I have started looking at linux kernel code for my OS course. In that I'm interested in sys file system (sysfs). I'm interested in finding out when and how sysfs gets created? Which files in linux kernel code generate this file system?
I have setup linux kernel on my system and have started debugging through the code.
I have referred to this document to understand sysfs file system : [sysfs] : https://www.kernel.org/doc/Documentation/filesystems/sysfs.txt
But this document explains only about directory structure, creation of directories and reading/writing attributes. I'm more interested in how kernel creates these directories during booting . I understood that following method is responsible for directory creation in sysfs.
int sysfs_create_file(struct kobject *kobj, struct attribute *attr);
This function accepts kboject structure, attributes and using these it creates directory in sysfs.
I understood that at the time of boot, kernel detects the memory and creates the directories under sys/devices/system/memory. I'm planning to change this directory structure as part of my homework. So, could you please point me to files and methods which are responsible for creation of this specific memory directories?