Re: Accessing allocated space in a debugfs file

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

 



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@xxxxxxxxxxxxxxxxx
https://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