* [PATCH] fscrypt: Move several items from fscrypt_private.h to .c files
@ 2026-09-25 4:08 Eric Biggers
0 siblings, 0 replies; only message in thread
From: Eric Biggers @ 2026-09-25 4:08 UTC (permalink / raw)
To: linux-fscrypt; +Cc: Eric Biggers
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-09-25 4:09 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-25 4:08 [PATCH] fscrypt: Move several items from fscrypt_private.h to .c files Eric Biggers
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox