Re: More info about kobj_attribute store and show functions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



(Forget the last e-mail, please, stupid Gmail)

Hi, 

I'm looking for some information about :

struct kobj_attribute {
        struct attribute attr;
        ssize_t (*show)(struct kobject *kobj, struct kobj_attribute *attr, char *buf);
        ssize_t (*store)(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count);
};


My function to handle the operation:

static ssize_t my_store(struct kobject *kobj, struct kobj_attribute *attr, const char *buf, size_t count) {
char *buffer;
        
        buffer = (char*) kcalloc(count, sizeof(char), GFP_KERNEL);

        copy_from_user(buffer, buf, count);
        .....
        .....
        etc....
}

So, this const char *buf, where ti come from ? Kernel space? 
My copy_from_user it's not working. Should return zero.

There any Macro or function to test if the pointer buf is a kernel pointer ? 

Thanks 

Lucas Tanure
_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux