From: "Adam J. Richter" Subject: Re: drop sysfs inode number functionality? Date: Sun, 12 Dec 2004 01:22:17 -0800 Message-ID: <200412120922.iBC9MHO25791@adam.yggdrasil.com> Cc: greg@kroah.com, linux-fsdevel@vger.kernel.org, maneesh@in.ibm.com Return-path: Received: from [61.49.148.248] ([61.49.148.248]:16891 "EHLO adam.yggdrasil.com") by vger.kernel.org with ESMTP id S262059AbULLJcx (ORCPT ); Sun, 12 Dec 2004 04:32:53 -0500 To: aia21@cam.ac.uk Sender: linux-fsdevel-owner@vger.kernel.org List-Id: linux-fsdevel.vger.kernel.org On Sun, 12 Dec 2004, Anton Altaparmakov wrote: >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 \ / adam@yggdrasil.com | g g d r a s i l