I started learning Linux kernel code for my OS course. In this I am interested in the sys file system (sysfs). I am interested to know when and how sysfs are created? What files in the Linux kernel code generate this file system?
I have a linux kernel installation on my system and code debugging has begun.
I mentioned this document to understand the sysfs file system: [sysfs]: https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt
But this document only explains the directory structure, the creation of directories and read / write attributes. I'm more interested in how the kernel creates these directories at boot time. I realized that the following method is responsible for creating directories in sysfs.
int sysfs_create_file(struct kobject *kobj, struct attribute *attr);
This function takes a structure, kboject attributes and with their help creates a directory in sysfs.
I realized that at boot time, the kernel detects memory and creates directories in sys / devices / system / memory. I plan to change this directory structure as part of my homework. So, could you tell me the files and methods that are responsible for creating these specific memory directories?
source
share