From: Eric Biggers <ebiggers@kernel.org>
To: linux-fscrypt@vger.kernel.org
Cc: Eric Biggers <ebiggers@kernel.org>
Subject: [PATCH] fscrypt: Move several items from fscrypt_private.h to .c files
Date: Thu, 24 Sep 2026 21:08:53 -0700 [thread overview]
Message-ID: <20260925040853.110410-1-ebiggers@kernel.org> (raw)
enum fscrypt_direction_t, struct fscrypt_symlink_data, and struct
fscrypt_master_key_user are each used in only one file. Move them to
their respective files.
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
---
fs/crypto/crypto.c | 5 +++++
fs/crypto/fscrypt_private.h | 27 ---------------------------
fs/crypto/hooks.c | 9 +++++++++
fs/crypto/keyring.c | 13 +++++++++++++
4 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c
index 5286a124b0d9..8f212e7f39f6 100644
--- a/fs/crypto/crypto.c
+++ b/fs/crypto/crypto.c
@@ -98,6 +98,11 @@ void fscrypt_generate_iv(union fscrypt_iv *iv, u64 index,
iv->index = cpu_to_le64(index);
}
+typedef enum {
+ FS_DECRYPT = 0,
+ FS_ENCRYPT,
+} fscrypt_direction_t;
+
/* Encrypt or decrypt a single "data unit" of file contents. */
static int fscrypt_crypt_data_unit(const struct fscrypt_inode_info *ci,
fscrypt_direction_t rw, u64 index,
diff --git a/fs/crypto/fscrypt_private.h b/fs/crypto/fscrypt_private.h
index 74329e0953d1..e602c31b3844 100644
--- a/fs/crypto/fscrypt_private.h
+++ b/fs/crypto/fscrypt_private.h
@@ -219,15 +219,6 @@ fscrypt_policy_du_bits(const union fscrypt_policy *policy,
BUG();
}
-/*
- * For encrypted symlinks, the ciphertext length is stored at the beginning
- * of the string in little-endian format.
- */
-struct fscrypt_symlink_data {
- __le16 len;
- char encrypted_path[];
-} __packed;
-
/**
* struct fscrypt_prepared_key - a key prepared for actual encryption/decryption
* @tfm: crypto API transform object
@@ -321,11 +312,6 @@ struct fscrypt_inode_info {
u8 ci_nonce[FSCRYPT_FILE_NONCE_SIZE];
};
-typedef enum {
- FS_DECRYPT = 0,
- FS_ENCRYPT,
-} fscrypt_direction_t;
-
/* crypto.c */
extern struct kmem_cache *fscrypt_inode_info_cachep;
int fscrypt_initialize(struct super_block *sb);
@@ -473,19 +459,6 @@ fscrypt_is_key_prepared(const struct fscrypt_prepared_key *prep_key,
/* keyring.c */
-/*
- * fscrypt_master_key_user - a user's claim to a master key
- */
-struct fscrypt_master_key_user {
- struct list_head link;
- kuid_t uid;
- /*
- * This 'struct key' contains no secret. It exists solely to charge the
- * appropriate user's key quota.
- */
- struct key *quota_key;
-};
-
/*
* fscrypt_master_key_secret - secret key material of an in-use master key
*/
diff --git a/fs/crypto/hooks.c b/fs/crypto/hooks.c
index a7a8a3f581a0..149498bdab94 100644
--- a/fs/crypto/hooks.c
+++ b/fs/crypto/hooks.c
@@ -9,6 +9,15 @@
#include "fscrypt_private.h"
+/*
+ * For encrypted symlinks, the ciphertext length is stored at the beginning
+ * of the string in little-endian format.
+ */
+struct fscrypt_symlink_data {
+ __le16 len;
+ char encrypted_path[];
+} __packed;
+
/**
* fscrypt_file_open() - prepare to open a possibly-encrypted regular file
* @inode: the inode being opened
diff --git a/fs/crypto/keyring.c b/fs/crypto/keyring.c
index 76e28d1e0064..874cc183ee62 100644
--- a/fs/crypto/keyring.c
+++ b/fs/crypto/keyring.c
@@ -145,6 +145,19 @@ static inline bool valid_key_spec(const struct fscrypt_key_specifier *spec)
return master_key_spec_len(spec) != 0;
}
+/*
+ * fscrypt_master_key_user - a user's claim to a master key
+ */
+struct fscrypt_master_key_user {
+ struct list_head link;
+ kuid_t uid;
+ /*
+ * This 'struct key' contains no secret. It exists solely to charge the
+ * appropriate user's key quota.
+ */
+ struct key *quota_key;
+};
+
static int fscrypt_user_key_instantiate(struct key *key,
struct key_preparsed_payload *prep)
{
base-commit: 165768bb70265b5c38cf0b73fafd75be235f8b14
--
2.55.0
reply other threads:[~2026-09-25 4:09 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260925040853.110410-1-ebiggers@kernel.org \
--to=ebiggers@kernel.org \
--cc=linux-fscrypt@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.