All of lore.kernel.org
 help / color / mirror / Atom feed
From: greg@kroah.com (Greg KH)
To: kernelnewbies@lists.kernelnewbies.org
Subject: More info about kobj_attribute store and show functions
Date: Wed, 3 Sep 2014 17:23:46 -0700	[thread overview]
Message-ID: <20140904002346.GA29474@kroah.com> (raw)
In-Reply-To: <CAJyon0u5ZV5dQmZhMMy1PkMsXv1Haq7GmkCVL2X99YTHoVsVyw@mail.gmail.com>

On Wed, Sep 03, 2014 at 09:10:41PM -0300, Lucas Tanure wrote:
> (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?

I'm guessing you didn't read the kobject documentation that is in the
kernel tree?

  reply	other threads:[~2014-09-04  0:23 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140904002346.GA29474@kroah.com \
    --to=greg@kroah.com \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.