[PATCH 1/1] fs: ext4: document struct ext2_inode

Provide Sphinx style documentation for struct ext2_inode.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com --- include/ext_common.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
diff --git a/include/ext_common.h b/include/ext_common.h index b09bbde116a..a85ac04f79a 100644 --- a/include/ext_common.h +++ b/include/ext_common.h @@ -173,20 +173,35 @@ struct ext2_block_group { __le32 bg_reserved; };
-/* The ext2 inode. */ +/** + * struct ext2_inode - ext2 inode + */ struct ext2_inode { + /** @mode: file mode */ __le16 mode; + /** @uid: lower 16 bits of owner UID */ __le16 uid; + /** @size: lower 32 bits of file size */ __le32 size; + /** @atime: last access time */ __le32 atime; + /** @ctime: last change time */ __le32 ctime; + /** @mtime: last modification time */ __le32 mtime; + /** @dtime: deletion time */ __le32 dtime; + /** @gid: lower 16 bits of group ID */ __le16 gid; + /** @nlinks: number of hard links */ __le16 nlinks; - __le32 blockcnt; /* Blocks of either 512 or block_size bytes */ + /** @blockcnt: lower 32 bit of block count */ + __le32 blockcnt; + /** @flags: inode flags */ __le32 flags; + /** @osd1: operating system specific data */ __le32 osd1; + /** @b: block map or extent tree */ union { struct datablocks { __le32 dir_blocks[INDIRECT_BLOCKS]; @@ -197,10 +212,19 @@ struct ext2_inode { char symlink[60]; char inline_data[60]; } b; + /** @version: file version (for NFS) */ __le32 version; + /** @acl: lower 32 bit of extended attribute block */ __le32 acl; - __le32 size_high; /* previously dir_acl, but never used */ + /** @size_high - dir_acl on ext2/3, upper 32 size bits on ext4 + * + * In ext2/3 this field was named i_dir_acl, though it was usually set + * to zero and never used. + */ + __le32 size_high; + /** @fragment_addr - (obsolete) fragment address */ __le32 fragment_addr; + /** @osd2: operating system specific data */ __le32 osd2[3]; };

On Thu, 24 Oct 2024 at 15:16, Heinrich Schuchardt heinrich.schuchardt@canonical.com wrote:
Provide Sphinx style documentation for struct ext2_inode.
Signed-off-by: Heinrich Schuchardt heinrich.schuchardt@canonical.com
include/ext_common.h | 30 +++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-)
Reviewed-by: Simon Glass sjg@chromium.org
diff --git a/include/ext_common.h b/include/ext_common.h index b09bbde116a..a85ac04f79a 100644 --- a/include/ext_common.h +++ b/include/ext_common.h @@ -173,20 +173,35 @@ struct ext2_block_group { __le32 bg_reserved; };
-/* The ext2 inode. */ +/**
- struct ext2_inode - ext2 inode
- */
struct ext2_inode {
/** @mode: file mode */ __le16 mode;
/** @uid: lower 16 bits of owner UID */ __le16 uid;
/** @size: lower 32 bits of file size */ __le32 size;
/** @atime: last access time */
Is this seconds since 1970?
__le32 atime;
/** @ctime: last change time */ __le32 ctime;
/** @mtime: last modification time */ __le32 mtime;
/** @dtime: deletion time */ __le32 dtime;
/** @gid: lower 16 bits of group ID */ __le16 gid;
/** @nlinks: number of hard links */ __le16 nlinks;
__le32 blockcnt; /* Blocks of either 512 or block_size bytes */
/** @blockcnt: lower 32 bit of block count */
__le32 blockcnt;
/** @flags: inode flags */ __le32 flags;
Where are the values for these flags?
/** @osd1: operating system specific data */
hyphen before specific
__le32 osd1;
/** @b: block map or extent tree */ union { struct datablocks { __le32 dir_blocks[INDIRECT_BLOCKS];
@@ -197,10 +212,19 @@ struct ext2_inode { char symlink[60]; char inline_data[60]; } b;
/** @version: file version (for NFS) */ __le32 version;
/** @acl: lower 32 bit of extended attribute block */ __le32 acl;
Can you link to where the attributes are defined, or add the enum name?
__le32 size_high; /* previously dir_acl, but never used */
/** @size_high - dir_acl on ext2/3, upper 32 size bits on ext4
*
* In ext2/3 this field was named i_dir_acl, though it was usually set
* to zero and never used.
*/
__le32 size_high;
/** @fragment_addr - (obsolete) fragment address */ __le32 fragment_addr;
/** @osd2: operating system specific data */ __le32 osd2[3];
};
-- 2.45.2
Regards, Simon
participants (2)
-
Heinrich Schuchardt
-
Simon Glass