kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: ymdatta <ymdatta.work@gmail.com>
To: Greg KH <greg@kroah.com>
Cc: kernelnewbies@kernelnewbies.org
Subject: Re: Accessing allocated space in a debugfs file
Date: Fri, 2 Oct 2020 16:59:24 +0530	[thread overview]
Message-ID: <1e7b7d6d-0764-01fc-e527-f2e703e45ca2@gmail.com> (raw)
In-Reply-To: <20200930174906.GA1687038@kroah.com>

On 30/09/20 11:19 pm, Greg KH wrote:
> On Wed, Sep 30, 2020 at 10:32:05PM +0530, ymdatta wrote:

>>
>> I want to write in this file, how should i be accessing the space created
>> from previous function call.
> 
> That's not what "size" means here.  "size" just sets the value that you
> see if you look at the directory for that debugfs file (or stat() it).
> 

Didn't realize this. Why do we need this then? What does this 'size' help
in achieving (or) where is this used?

> debugfs is a virtual filesystem, there is no "backing store" or place to
> put your data in it.  It is there so that you can write code that can
> handle open/read/write/close to happen on a file, and your code will
> provide the data to userspace directly.
> 
> The simplest way to create a debugfs file is to just point it at a
> variable, and then you can change the variable value in the kernel, and
> userspace reading from the file will see whatever the value is at that
> point in time.

This clears up a lot of my doubts. Thanks!

ymdatta.


_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2020-10-02 11:30 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 17:02 Accessing allocated space in a debugfs file ymdatta
2020-09-30 17:49 ` Greg KH
2020-10-02 11:29   ` ymdatta [this message]
2020-10-02 11:35     ` Greg KH

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=1e7b7d6d-0764-01fc-e527-f2e703e45ca2@gmail.com \
    --to=ymdatta.work@gmail.com \
    --cc=greg@kroah.com \
    --cc=kernelnewbies@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 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).