Skip to contentSkip to conversation

drop sysfs inode number functionality?

DISCUSSION Adam J. Richter 1 participant 1 message Dec 12, 2004 VFS

lore
Share & tools
lore
#0 lore raw
Quoted 7 lines · Anton Altaparmakov

All other issues aside, inode number 0 is special cased by glibc and all your files with inode number 0 are invisible to "ls". In ntfs the $MFT system file has inode number 0 and if you do "ls" it does not appear. But if you do "ls \$MFT" it does appear and if you do "stat \$MFT" it also returns the correct information. So if you return inode 0 for all things sysfs the whole sysfs tree would be invisible which is probably not what you want...

I must apologize for not having experimented with this a
bit more before posting. You're right: GNU ls made it look like /sys was empty when I made sysfs return 0 for all inode numbers. Making sysfs return another constant caused GNU find not to descend into subdirectories. From looking at the source code to find, it looks like GNU find deliberately stops descending into directories if the current inode and device numbers match those of an ancestor directory.

Returning unique inode numbers for directories (I'm currently
using the address of the sysfs_dirent) and returning a non-zero constant for non-directories seems to work okay so far.

                    __     ______________

Adam J. Richter \ /
[email protected] | g g d r a s i l