Skip to content

Commit 5585f2a

Browse files
committed
fs-verity: add inode and superblock fields
Analogous to fs/crypto/, add fields to the VFS inode and superblock for use by the fs/verity/ support layer: - ->s_vop: points to the fsverity_operations if the filesystem supports fs-verity, otherwise is NULL. - ->i_verity_info: points to cached fs-verity information for the inode after someone opens it, otherwise is NULL. - S_VERITY: bit in ->i_flags that identifies verity inodes, even when they haven't been opened yet and thus still have NULL ->i_verity_info. Reviewed-by: Theodore Ts'o <tytso@mit.edu> Reviewed-by: Jaegeuk Kim <jaegeuk@kernel.org> Signed-off-by: Eric Biggers <ebiggers@google.com>
1 parent 671e67b commit 5585f2a

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎include/linux/fs.h‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ struct workqueue_struct;
6464
struct iov_iter;
6565
struct fscrypt_info;
6666
struct fscrypt_operations;
67+
struct fsverity_info;
68+
struct fsverity_operations;
6769
struct fs_context;
6870
struct fs_parameter_description;
6971

@@ -723,6 +725,10 @@ struct inode {
723725
struct fscrypt_info *i_crypt_info;
724726
#endif
725727

728+
#ifdef CONFIG_FS_VERITY
729+
struct fsverity_info *i_verity_info;
730+
#endif
731+
726732
void *i_private; /* fs or device private pointer */
727733
} __randomize_layout;
728734

@@ -1427,6 +1433,9 @@ struct super_block {
14271433
const struct xattr_handler **s_xattr;
14281434
#ifdef CONFIG_FS_ENCRYPTION
14291435
const struct fscrypt_operations *s_cop;
1436+
#endif
1437+
#ifdef CONFIG_FS_VERITY
1438+
const struct fsverity_operations *s_vop;
14301439
#endif
14311440
struct hlist_bl_head s_roots; /* alternate root dentries for NFS */
14321441
struct list_head s_mounts; /* list of mounts; _not_ for fs use */
@@ -1965,6 +1974,7 @@ struct super_operations {
19651974
#endif
19661975
#define S_ENCRYPTED 16384 /* Encrypted file (using fs/crypto/) */
19671976
#define S_CASEFOLD 32768 /* Casefolded file */
1977+
#define S_VERITY 65536 /* Verity file (using fs/verity/) */
19681978

19691979
/*
19701980
* Note that nosuid etc flags are inode-specific: setting some file-system
@@ -2006,6 +2016,7 @@ static inline bool sb_rdonly(const struct super_block *sb) { return sb->s_flags
20062016
#define IS_DAX(inode) ((inode)->i_flags & S_DAX)
20072017
#define IS_ENCRYPTED(inode) ((inode)->i_flags & S_ENCRYPTED)
20082018
#define IS_CASEFOLDED(inode) ((inode)->i_flags & S_CASEFOLD)
2019+
#define IS_VERITY(inode) ((inode)->i_flags & S_VERITY)
20092020

20102021
#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
20112022
(inode)->i_rdev == WHITEOUT_DEV)

0 commit comments

Comments
 (0)