• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Can i rely on inode numbers?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can i rely on inode numbers?


  • Subject: Re: Can i rely on inode numbers?
  • From: Quinn <email@hidden>
  • Date: Fri, 11 Apr 2008 13:12:48 +0100

At 12:27 +0200 11/4/08, Lutz Helwing wrote:
Excellent question :) Yet i don't know what to do with files on mounted devices or if i want to include them at all...
But i think i can find out if a directory is on a mounted device, right?

I don't really understand this question. What do you mean by "mounted device"? Are you trying to distinguish between the root volume and other volumes, or between local volumes (volumes mounted on locally connected media) and network volumes?


Uhm btw how can i open a file when just having its inode number?

Not directly. You have to get the path to the file and then open that. You can get the path by repeatedly calling getattrlist to get ATTR_CMN_PAROBJID and ATTR_CMN_NAME until you get to an item in the root of the volume (where ATTR_CMN_PAROBJID will be 2), joining up all of the paths to form the volume-relative path, and then prefixing that with the mount point path.


WARNING: You might be tempted to do this using volfs.

<http://developer.apple.com/qa/qa2001/qa1113.html>

Please don't. The volfs stuff has changed in 10.5 and it's likely to change again in the future.

This presents a couple of challenges:

o Due to hard links, there may be more than one path to a file. The above will give you one such path to the file, chosen in a hard-to-explain-unless-you-understand-how-the-kernel-works fashion.

o Not all volumes formats support ATTR_CMN_PAROBJID.

S+E
--
Quinn "The Eskimo!"                    <http://www.apple.com/developer/>
Apple Developer Relations, Developer Technical Support, Core OS/Hardware
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Filesystem-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Can i rely on inode numbers?
      • From: Lutz Helwing <email@hidden>
References: 
 >Can i rely on inode numbers? (From: Lutz Helwing <email@hidden>)
 >Re: Can i rely on inode numbers? (From: Quinn <email@hidden>)
 >Re: Can i rely on inode numbers? (From: Lutz Helwing <email@hidden>)

  • Prev by Date: Re: Can i rely on inode numbers?
  • Next by Date: Re: Can i rely on inode numbers?
  • Previous by thread: Re: Can i rely on inode numbers?
  • Next by thread: Re: Can i rely on inode numbers?
  • Index(es):
    • Date
    • Thread