kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: ymdatta <ymdatta.work@gmail.com>
To: kernelnewbies@kernelnewbies.org
Subject: Accessing allocated space in a debugfs file
Date: Wed, 30 Sep 2020 22:32:05 +0530	[thread overview]
Message-ID: <a6d49ab7-be8a-9a9c-f313-9088a7329f13@gmail.com> (raw)

Hello everyone,

I am trying to create a debugfs file for exposing some information to the
userspace. (I am exploring on how to use debugfs)

From the documentation (Documentation/filesystems/debugfs.txt), i came
across a function called

       struct dentry *debugfs_create_file_size(...,loff_t file_size);

This essentially creates a file with an initial size.

I want to write in this file, how should i be accessing the space created
from previous function call.

I have looked through the source code, but i have found very few places
where this function is used. In one of the use cases [0], the memory
equal to the size is allocated in the open file operation, and the
private_data member is pointed to this. (Looking at [0] helps in
understanding this). But from #kernelnewbies channel, i found that
private_data is a pointer for tty/char drivers.

Thanks for the help.

[0]: https://elixir.bootlin.com/linux/latest/source/drivers/usb/gadget/udc/atmel_usba_udc.c#L140

ymdatta.

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

             reply	other threads:[~2020-09-30 17:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-30 17:02 ymdatta [this message]
2020-09-30 17:49 ` Accessing allocated space in a debugfs file Greg KH
2020-10-02 11:29   ` ymdatta
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=a6d49ab7-be8a-9a9c-f313-9088a7329f13@gmail.com \
    --to=ymdatta.work@gmail.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).