squashfs: expose metadata via StatT (alternative to #395)#398
Merged
Conversation
Alternative design to diskfs#395, applying the same StatT pattern used by the iso9660 and ext4 siblings of diskfs#301. Breaking change: removes the FileStat = *directoryEntry alias and the public UID()/GID()/Xattrs() accessor methods. Sys() now returns *StatT with UID, GID, Inode, InodeType, Xattrs, and LinkTarget fields.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #301. Alternative design to #395 — same goal, restructured around a
StatTstruct to match the pattern used by the ext4 (#393) and iso9660 (#394) siblings.What changed vs #395
#395 added two more accessor methods (
Inode(),InodeType()) on top of the existingUID()/GID()/Xattrs()/Readlink()surface reachable throughsquashfs.FileStat. That kept squashfs internally consistent but left it stylistically out of step with the other filesystems answering #301, which all expose aStatTstruct.This PR goes the other way: it converts the squashfs
Sys()surface to aStatTstruct too, accepting the breaking change to get one consistent shape across the package.Fields
UID uint32GID uint32Inode uint32InodeType string"unknown"Xattrs map[string]stringLinkTarget stringBreaking changes
Removed from the public surface:
type FileStat = *directoryEntryalias(FileStat).UID() uint32(FileStat).GID() uint32(FileStat).Xattrs() map[string]stringExternal callers migrate:
Readlink()andOpen()remain as methods on the now-unexporteddirectoryEntryfor internal use, but are no longer reachable externally. Symlink targets are exposed viaStatT.LinkTarget; opening files continues throughFileSystem.OpenFile.Tests
TestSquashfsStatTcovers the new struct: non-zeroInode, validInodeType, directory entries report a directory type, emptyLinkTargetfor regular files, also reachable fromOpenFile().Stat().TestDirectoryEntry(internal) updated to assert on*StatT.TestSquashfsOpen,TestSquashfsCheckListing,TestSquashfsReadDirXattrupdated to the new shape.Which to merge
This is meant as a comparison PR — if you prefer the consistency across packages, merge this and close #395; if you prefer keeping squashfs's existing accessor surface, merge #395 and close this.