kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
* More info about kobj_attribute store and show functions
@ 2014-09-04  0:04 Lucas Tanure
  2014-09-04  0:10 ` Lucas Tanure
  0 siblings, 1 reply; 9+ messages in thread
From: Lucas Tanure @ 2014-09-04  0:04 UTC (permalink / raw)
  To: kernelnewbies

Sorry, didn't finish to write the email and Gmail sent.
I will re-send.

Sorry.

--
Lucas Tanure
+55 (19) 988176559
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140903/d63405a1/attachment.html 

^ permalink raw reply	[flat|nested] 9+ messages in thread
* More info about kobj_attribute store and show functions
@ 2014-09-04  0:03 Lucas Tanure
  0 siblings, 0 replies; 9+ messages in thread
From: Lucas Tanure @ 2014-09-04  0:03 UTC (permalink / raw)
  To: kernelnewbies

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);

if (count == 13) {
 if (buffer) {
        copy_from_user(buffer, buf, count);
printk("A %s",buffer);
 if (0) {
if (strcmp(buffer, eudyptula_id) == 0)
 return count;
        printk("erro na strcmp\n");
}
 else
printk("erro na copia\n");
 }
}
return -EINVAL;
}

So, this *const char *buf, *where ti come from ? Kernel space


--
Lucas Tanure
+55 (19) 988176559
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140903/394557fa/attachment-0001.html 

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-09-04  2:22 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-04  0:04 More info about kobj_attribute store and show functions Lucas Tanure
2014-09-04  0:10 ` Lucas Tanure
2014-09-04  0:23   ` Greg KH
2014-09-04  0:39     ` Lucas Tanure
2014-09-04  0:56       ` Greg KH
2014-09-04  1:39         ` Lucas Tanure
2014-09-04  2:22           ` Greg KH
2014-09-04  1:30   ` Jeff Haran
  -- strict thread matches above, loose matches on Subject: below --
2014-09-04  0:03 Lucas Tanure

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).