Re: APFS root filesystem. All files' inode id have offset of 0x200000000
Re: APFS root filesystem. All files' inode id have offset of 0x200000000
- Subject: Re: APFS root filesystem. All files' inode id have offset of 0x200000000
- From: Thomas Tempelmann <email@hidden>
- Date: Thu, 22 Mar 2018 00:35:09 +0100
>
> 1. Is there any way to extract the current file-id range (minimum to
> maximum fileid).
>
Well, both HFS+ and APFS know the last used FileID and whenever a new node
(file, dir) is created, the last ID + 1 will be used for it. But you cannot
query that value directly (only indirectly, by creating a new file and then
getting its ID).
> 2. I've noticed that there are some gaps in file-id list. meaning that
> some ids aren't connected to files. How can this happen (I assume it's due
> to deleted files), and when creating new file, does it get file-id from the
> lowest available value or the next file-id after the current maximum value.
>
When dirs or files are deleted, those IDs will not be re-used. This is on
purpose, i.e. by design. It allows programs to later find previously
identified files by their ID. Finder Aliases (and NSURL Bookmark files) use
this.
3. I'd like to use an array that each index represent a file-id. Can I
> assume that the file-ids aren't sparse (meaning that the gaps of unused id
> values are small) so that I won't waste too much memory ?
>
Not smart at all. You should rather use a dictionary (hash-map, hashed set)
for this, with the key being the ID.
4. Do you recommend other, more efficient way to iterate through the files
> in order to ascending file-id, other than through the /.vol/ drive ?
>
If you want to traverse all files on a volume, use searchfs (see "man
searchfs") - that's ideal for this purpose. It tells you ever ID, and then
you can look up the file information from that ID.
Thomas
_______________________________________________
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