thejoelpatrol / fusehfs

Update of FuseHFS for macFUSE on macOS 12 Monterey
28 stars 8 forks source link

inode vs CNID #13

Open joevt opened 11 months ago

joevt commented 11 months ago

Every time I mount a HFS disk image and use ls -il to list the files and directories on that volume, the inode numbers change.

They seem to be assigned in ascending order as directories are accessed. So if you mount the disk, access directory A, then access directory B, then you'll get one set of inode numbers. If you unmount and mount again, then access directory B before directory A then you'll get the numbers in a different order.

Is there a way to make macFUSE use the CNID (HFS Catalog Node ID) numbers instead?

In Mac OS X, there's a .vol directory that can be used to list a file by inode. You just need the device number for the volume. stat can be used to get the device number and inode number. GetFileInfo can be used to convert a device number and inode number to a path.

stat -f "%d %i" /users/joevt
16777292 36529

GetFileInfo /.vol/16777292/36529
directory: "/Users/joevt"
attributes: avbstclinmedz
created: 09/09/2019 08:06:18
modified: 08/15/2023 12:40:35

Those commands don't work with fusehfs though.

My dumpvols.sh script dumps info from the HFS Master Directory Block. There's some fields in drFndrInfo that use CNIDs. The bless command can be used to view and modify that info, but it doesn't work with fusehfs. I haven't checked the source code to see if it still has support for HFS. I do have a fork that compiles at least.

Do Finder aliases use CNIDs? I know with SheepShaver, if you mount a Mac OS X path in the emulated classic macOS, Finder Aliases created in one instance won't work when running in a different instance. That possibly might be due to the CNIDs not being constant but I haven't checked. I think in SheepShaver, the mount may act more like a network mount since you could access any number of disks through the /Volumes path.