#On ZFS, how can I read a file as an inode or znode struct?
29 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For more information use !howto ask.
Sorry @rocky onyx, I'm not sure how dirent or readdir help to get a znode (https://github.com/openzfs/zfs/blob/ede037cda73675f42b1452187e8dd3438fafc220/include/sys/zfs_znode.h#L180-L219) or inode (https://unix.stackexchange.com/questions/35672/) struct
the stat struct contains the information of the given inode
type, owner, group, ...
@rocky onyx I might be mistaken but I think an inode struct in ZFS/BSD is not the same as the inode field in the stat struct
the inode field in thr stat struct is just the number of where its located in the inode table
the rest of the members are the information related to this inode
(and unix as it seems)
Yeah, I haven'e done much low-level programming
you might want to get a copy of "the linux programming interface"
and read chapter 14
Okay, thanks 🙂
not really, i have 0 experience with kernel programming
Okay, well thank you, I'll see if I can figure it out 🙂
i dont really know what you want to do, but i think stat() should suffice
except you plan on hacking on the filesystem itself
Lol, not trying to hack the filesystem. Actually, the ultimate goal is to get the z_pflags (https://github.com/openzfs/zfs/blob/ede037cda73675f42b1452187e8dd3438fafc220/include/sys/zfs_znode.h#L200) field from the znode struct. However, as I have had limited success with anything related to znode, and I found an ITOZ conversion function (https://github.com/openzfs/zfs/blob/ede037cda73675f42b1452187e8dd3438fafc220/include/os/freebsd/zfs/sys/zfs_znode_impl.h#L104), so I thought I could try getting the znode from an inode
Actually, it looks like I might need to figure out vnode in this case, not inode...I'm so confused haha
There is zfs list, but I'll take a look at debugfs