Page MenuHomeFreeBSD

Add st_ino etc to libsa ufs_stat
ClosedPublic

Authored by sjg on Apr 13 2018, 11:48 PM.
Tags
None
Referenced Files
Unknown Object (File)
Jan 22 2024, 11:31 PM
Unknown Object (File)
Dec 23 2023, 1:35 AM
Unknown Object (File)
Dec 2 2023, 1:19 PM
Unknown Object (File)
Aug 27 2023, 1:28 AM
Unknown Object (File)
Aug 15 2023, 5:11 PM
Unknown Object (File)
Jun 3 2023, 1:46 AM
Unknown Object (File)
May 14 2023, 6:24 AM
Unknown Object (File)
May 12 2023, 3:58 PM
Subscribers
None

Details

Summary

For the loader to verify files we need stat(2) to
provide st_dev, st_ino, and st_mtime.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

stand/libsa/ufs.c
194 ↗(On Diff #41455)

this makes sense. It's a good change.

847 ↗(On Diff #41455)

But I don't understand this, or even why you need this. WTF is st_dev to you?

stand/libsa/ufs.c
847 ↗(On Diff #41455)

st_dev differentiates one device from another, st_ino by itself is not unique.
you need the tupple of st_dev and st_ino - and strictly speaking the inode generation
to uniquely identify a file - we can dispense with the generation number for the loader though.

fs_id is supposed to be unique per filesystem so can satisfy the requirement, but it is 64bit vs 32bit for st_dev.

stand/libsa/ufs.c
847 ↗(On Diff #41455)

I guess I should have been more direct. Does it need to be stable from boot to boot, or just stable within a boot?

stand/libsa/ufs.c
847 ↗(On Diff #41455)

There is no need for stability beyond the current boot.
Any value would do so long as it is stable per filesystem.

stand/libsa/ufs.c
847 ↗(On Diff #41455)

I would like to ask another way still - why should the boot loader care about st_dev and specifically in case of one file system (out of ~8)? Sure, we can fill the fields in hope that maybe there will be some use case in the future, or do you have some followup planned? We would like to avoid implementing inconsistent behavior too - if those fields are to be filled in case of ufs, why not for other file systems?

Is there a

stand/libsa/ufs.c
847 ↗(On Diff #41455)

To add to that last bit- I'd like to see at least the ZFS analog of this, though I'm not sure how easy it would be to break out inumber (not that familiar with ZFS, didn't seem readily available at a glance).

stand/libsa/ufs.c
847 ↗(On Diff #41455)

The loader needs to care about st_dev, because in Junos at least; files may read from more than one filesystem, each of which has a /boot/manifest we need to be able to differentiate.

847 ↗(On Diff #41455)

Someone might need to point to where the zfs impl for libsa is ;-)

stand/libsa/ufs.c
847 ↗(On Diff #41455)

ok, that explains it.

stand/libsa/ufs.c
847 ↗(On Diff #41455)

I'd start with zfsimp in the poorly conceived stand/zfs directory.

stand/libsa/ufs.c
847 ↗(On Diff #41455)

imp; did you have any better idea that my trying to squeeze fs_id into st_dev ?

sjg edited the summary of this revision. (Show Details)

Tweak comments

This revision was not accepted when it landed; it landed in state Needs Review.Jun 9 2018, 2:42 AM
This revision was automatically updated to reflect the committed changes.