[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260126045212.1381843-10-hch@lst.de>
Date: Mon, 26 Jan 2026 05:50:55 +0100
From: Christoph Hellwig <hch@....de>
To: Eric Biggers <ebiggers@...nel.org>
Cc: Al Viro <viro@...iv.linux.org.uk>,
Christian Brauner <brauner@...nel.org>,
Jan Kara <jack@...e.cz>,
David Sterba <dsterba@...e.com>,
"Theodore Ts'o" <tytso@....edu>,
Jaegeuk Kim <jaegeuk@...nel.org>,
Chao Yu <chao@...nel.org>,
Andrey Albershteyn <aalbersh@...hat.com>,
Matthew Wilcox <willy@...radead.org>,
linux-fsdevel@...r.kernel.org,
linux-btrfs@...r.kernel.org,
linux-ext4@...r.kernel.org,
linux-f2fs-devel@...ts.sourceforge.net,
fsverity@...ts.linux.dev
Subject: [PATCH 09/16] fsverity: constify the vi pointer in fsverity_verification_context
struct fsverity_info contains information that is only read in the
verification path. Apply the const qualifier to match various explicitly
passed arguments.
Signed-off-by: Christoph Hellwig <hch@....de>
---
fs/verity/verify.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/fs/verity/verify.c b/fs/verity/verify.c
index 32cadb71953c..881af159e705 100644
--- a/fs/verity/verify.c
+++ b/fs/verity/verify.c
@@ -21,7 +21,7 @@ struct fsverity_pending_block {
struct fsverity_verification_context {
struct inode *inode;
- struct fsverity_info *vi;
+ const struct fsverity_info *vi;
/*
* This is the queue of data blocks that are pending verification. When
@@ -84,8 +84,8 @@ EXPORT_SYMBOL_GPL(fsverity_readahead);
* Returns true if the hash block with index @hblock_idx in the tree, located in
* @hpage, has already been verified.
*/
-static bool is_hash_block_verified(struct fsverity_info *vi, struct page *hpage,
- unsigned long hblock_idx)
+static bool is_hash_block_verified(const struct fsverity_info *vi,
+ struct page *hpage, unsigned long hblock_idx)
{
unsigned int blocks_per_page;
unsigned int i;
@@ -156,7 +156,8 @@ static bool is_hash_block_verified(struct fsverity_info *vi, struct page *hpage,
*
* Return: %true if the data block is valid, else %false.
*/
-static bool verify_data_block(struct inode *inode, struct fsverity_info *vi,
+static bool verify_data_block(struct inode *inode,
+ const struct fsverity_info *vi,
const struct fsverity_pending_block *dblock)
{
const u64 data_pos = dblock->pos;
@@ -315,7 +316,7 @@ static void
fsverity_init_verification_context(struct fsverity_verification_context *ctx,
struct inode *inode)
{
- struct fsverity_info *vi = *fsverity_info_addr(inode);
+ const struct fsverity_info *vi = *fsverity_info_addr(inode);
ctx->inode = inode;
ctx->vi = vi;
@@ -342,7 +343,7 @@ fsverity_clear_pending_blocks(struct fsverity_verification_context *ctx)
static bool
fsverity_verify_pending_blocks(struct fsverity_verification_context *ctx)
{
- struct fsverity_info *vi = ctx->vi;
+ const struct fsverity_info *vi = ctx->vi;
const struct merkle_tree_params *params = &vi->tree_params;
int i;
@@ -372,7 +373,7 @@ static bool fsverity_add_data_blocks(struct fsverity_verification_context *ctx,
struct folio *data_folio, size_t len,
size_t offset)
{
- struct fsverity_info *vi = ctx->vi;
+ const struct fsverity_info *vi = ctx->vi;
const struct merkle_tree_params *params = &vi->tree_params;
const unsigned int block_size = params->block_size;
u64 pos = (u64)data_folio->index << PAGE_SHIFT;
--
2.47.3
Powered by blists - more mailing lists