[lxc-devel] Understanding - LXCFS source code to add /sys/power/state as an entry in LXCFS

Christian Brauner christian.brauner at ubuntu.com
Thu Jun 4 01:29:44 UTC 2020


On Wed, Jun 03, 2020 at 11:06:23PM +0530, Souvik Datta wrote:
> Hello,
> I am trying to understand the source code of LXCFS. My final objective
> is to add /sys/power/state file as an entry. I understand the changes
> that need to be done in sysfs_fuse.c/h to support this.
> 
> To do this, first I am first trying to understand, how the sys entry -
> "/sys/devices/system/cpu/online" has been added in the "target
> directory - /var/lib/lxcfs" but I am not able to figure that out.
> 
> Can you please give me some pointers so that I can understand how this
> is achieved?

Please take a look at:
src/sysfs_fuse.c:sys_read()
The enum and path used to add a file type is defined in
src/bindings.h: enum lxcfs_virt_t

and then you need to implement the actual virtualization in
sysfs_fuse.{c,h}.

Christian


More information about the lxc-devel mailing list