Skip to content

Commit d2fe975

Browse files
committed
fscrypt: fix all kerneldoc warnings
Fix all kerneldoc warnings in fs/crypto/ and include/linux/fscrypt.h. Most of these were due to missing documentation for function parameters. Detected with: scripts/kernel-doc -v -none fs/crypto/*.{c,h} include/linux/fscrypt.h This cleanup makes it possible to check new patches for kerneldoc warnings without having to filter out all the existing ones. For consistency, also adjust some function "brief descriptions" to include the parentheses and to wrap at 80 characters. (The latter matches the checkpatch expectation.) Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent 2ef96a5 commit d2fe975

File tree

7 files changed

+82
-34
lines changed

7 files changed

+82
-34
lines changed

fs/crypto/crypto.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ struct page *fscrypt_alloc_bounce_page(gfp_t gfp_flags)
5454

5555
/**
5656
* fscrypt_free_bounce_page() - free a ciphertext bounce page
57+
* @bounce_page: the bounce page to free, or NULL
5758
*
5859
* Free a bounce page that was allocated by fscrypt_encrypt_pagecache_blocks(),
5960
* or by fscrypt_alloc_bounce_page() directly.
@@ -132,7 +133,8 @@ int fscrypt_crypt_block(const struct inode *inode, fscrypt_direction_t rw,
132133
}
133134

134135
/**
135-
* fscrypt_encrypt_pagecache_blocks() - Encrypt filesystem blocks from a pagecache page
136+
* fscrypt_encrypt_pagecache_blocks() - Encrypt filesystem blocks from a
137+
* pagecache page
136138
* @page: The locked pagecache page containing the block(s) to encrypt
137139
* @len: Total size of the block(s) to encrypt. Must be a nonzero
138140
* multiple of the filesystem's block size.
@@ -222,7 +224,8 @@ int fscrypt_encrypt_block_inplace(const struct inode *inode, struct page *page,
222224
EXPORT_SYMBOL(fscrypt_encrypt_block_inplace);
223225

224226
/**
225-
* fscrypt_decrypt_pagecache_blocks() - Decrypt filesystem blocks in a pagecache page
227+
* fscrypt_decrypt_pagecache_blocks() - Decrypt filesystem blocks in a
228+
* pagecache page
226229
* @page: The locked pagecache page containing the block(s) to decrypt
227230
* @len: Total size of the block(s) to decrypt. Must be a nonzero
228231
* multiple of the filesystem's block size.
@@ -346,6 +349,8 @@ void fscrypt_msg(const struct inode *inode, const char *level,
346349

347350
/**
348351
* fscrypt_init() - Set up for fs encryption.
352+
*
353+
* Return: 0 on success; -errno on failure
349354
*/
350355
static int __init fscrypt_init(void)
351356
{

fs/crypto/fname.c

Lines changed: 38 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
#include <crypto/skcipher.h>
1919
#include "fscrypt_private.h"
2020

21-
/**
21+
/*
2222
* struct fscrypt_nokey_name - identifier for directory entry when key is absent
2323
*
2424
* When userspace lists an encrypted directory without access to the key, the
@@ -105,9 +105,12 @@ static inline bool fscrypt_is_dot_dotdot(const struct qstr *str)
105105

106106
/**
107107
* fscrypt_fname_encrypt() - encrypt a filename
108-
*
109-
* The output buffer must be at least as large as the input buffer.
110-
* Any extra space is filled with NUL padding before encryption.
108+
* @inode: inode of the parent directory (for regular filenames)
109+
* or of the symlink (for symlink targets)
110+
* @iname: the filename to encrypt
111+
* @out: (output) the encrypted filename
112+
* @olen: size of the encrypted filename. It must be at least @iname->len.
113+
* Any extra space is filled with NUL padding before encryption.
111114
*
112115
* Return: 0 on success, -errno on failure
113116
*/
@@ -157,8 +160,11 @@ int fscrypt_fname_encrypt(const struct inode *inode, const struct qstr *iname,
157160

158161
/**
159162
* fname_decrypt() - decrypt a filename
160-
*
161-
* The caller must have allocated sufficient memory for the @oname string.
163+
* @inode: inode of the parent directory (for regular filenames)
164+
* or of the symlink (for symlink targets)
165+
* @iname: the encrypted filename to decrypt
166+
* @oname: (output) the decrypted filename. The caller must have allocated
167+
* enough space for this, e.g. using fscrypt_fname_alloc_buffer().
162168
*
163169
* Return: 0 on success, -errno on failure
164170
*/
@@ -206,7 +212,10 @@ static const char lookup_table[65] =
206212
#define BASE64_CHARS(nbytes) DIV_ROUND_UP((nbytes) * 4, 3)
207213

208214
/**
209-
* base64_encode() -
215+
* base64_encode() - base64-encode some bytes
216+
* @src: the bytes to encode
217+
* @len: number of bytes to encode
218+
* @dst: (output) the base64-encoded string. Not NUL-terminated.
210219
*
211220
* Encodes the input string using characters from the set [A-Za-z0-9+,].
212221
* The encoded string is roughly 4/3 times the size of the input string.
@@ -272,7 +281,12 @@ bool fscrypt_fname_encrypted_size(const struct inode *inode, u32 orig_len,
272281
}
273282

274283
/**
275-
* fscrypt_fname_alloc_buffer - allocate a buffer for presented filenames
284+
* fscrypt_fname_alloc_buffer() - allocate a buffer for presented filenames
285+
* @inode: inode of the parent directory (for regular filenames)
286+
* or of the symlink (for symlink targets)
287+
* @max_encrypted_len: maximum length of encrypted filenames the buffer will be
288+
* used to present
289+
* @crypto_str: (output) buffer to allocate
276290
*
277291
* Allocate a buffer that is large enough to hold any decrypted or encoded
278292
* filename (null-terminated), for the given maximum encrypted filename length.
@@ -297,9 +311,10 @@ int fscrypt_fname_alloc_buffer(const struct inode *inode,
297311
EXPORT_SYMBOL(fscrypt_fname_alloc_buffer);
298312

299313
/**
300-
* fscrypt_fname_free_buffer - free the buffer for presented filenames
314+
* fscrypt_fname_free_buffer() - free a buffer for presented filenames
315+
* @crypto_str: the buffer to free
301316
*
302-
* Free the buffer allocated by fscrypt_fname_alloc_buffer().
317+
* Free a buffer that was allocated by fscrypt_fname_alloc_buffer().
303318
*/
304319
void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str)
305320
{
@@ -311,10 +326,19 @@ void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str)
311326
EXPORT_SYMBOL(fscrypt_fname_free_buffer);
312327

313328
/**
314-
* fscrypt_fname_disk_to_usr() - converts a filename from disk space to user
315-
* space
316-
*
317-
* The caller must have allocated sufficient memory for the @oname string.
329+
* fscrypt_fname_disk_to_usr() - convert an encrypted filename to
330+
* user-presentable form
331+
* @inode: inode of the parent directory (for regular filenames)
332+
* or of the symlink (for symlink targets)
333+
* @hash: first part of the name's dirhash, if applicable. This only needs to
334+
* be provided if the filename is located in an indexed directory whose
335+
* encryption key may be unavailable. Not needed for symlink targets.
336+
* @minor_hash: second part of the name's dirhash, if applicable
337+
* @iname: encrypted filename to convert. May also be "." or "..", which
338+
* aren't actually encrypted.
339+
* @oname: output buffer for the user-presentable filename. The caller must
340+
* have allocated enough space for this, e.g. using
341+
* fscrypt_fname_alloc_buffer().
318342
*
319343
* If the key is available, we'll decrypt the disk name. Otherwise, we'll
320344
* encode it for presentation in fscrypt_nokey_name format.

fs/crypto/fscrypt_private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct fscrypt_context_v2 {
4343
u8 nonce[FS_KEY_DERIVATION_NONCE_SIZE];
4444
};
4545

46-
/**
46+
/*
4747
* fscrypt_context - the encryption context of an inode
4848
*
4949
* This is the on-disk equivalent of an fscrypt_policy, stored alongside each
@@ -157,7 +157,7 @@ fscrypt_policy_flags(const union fscrypt_policy *policy)
157157
BUG();
158158
}
159159

160-
/**
160+
/*
161161
* For encrypted symlinks, the ciphertext length is stored at the beginning
162162
* of the string in little-endian format.
163163
*/

fs/crypto/hooks.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
#include "fscrypt_private.h"
1111

1212
/**
13-
* fscrypt_file_open - prepare to open a possibly-encrypted regular file
13+
* fscrypt_file_open() - prepare to open a possibly-encrypted regular file
1414
* @inode: the inode being opened
1515
* @filp: the struct file being set up
1616
*
@@ -262,7 +262,7 @@ int __fscrypt_encrypt_symlink(struct inode *inode, const char *target,
262262
EXPORT_SYMBOL_GPL(__fscrypt_encrypt_symlink);
263263

264264
/**
265-
* fscrypt_get_symlink - get the target of an encrypted symlink
265+
* fscrypt_get_symlink() - get the target of an encrypted symlink
266266
* @inode: the symlink inode
267267
* @caddr: the on-disk contents of the symlink
268268
* @max_size: size of @caddr buffer

fs/crypto/keysetup.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,8 @@ int fscrypt_get_encryption_info(struct inode *inode)
475475
EXPORT_SYMBOL(fscrypt_get_encryption_info);
476476

477477
/**
478-
* fscrypt_put_encryption_info - free most of an inode's fscrypt data
478+
* fscrypt_put_encryption_info() - free most of an inode's fscrypt data
479+
* @inode: an inode being evicted
479480
*
480481
* Free the inode's fscrypt_info. Filesystems must call this when the inode is
481482
* being evicted. An RCU grace period need not have elapsed yet.
@@ -488,7 +489,8 @@ void fscrypt_put_encryption_info(struct inode *inode)
488489
EXPORT_SYMBOL(fscrypt_put_encryption_info);
489490

490491
/**
491-
* fscrypt_free_inode - free an inode's fscrypt data requiring RCU delay
492+
* fscrypt_free_inode() - free an inode's fscrypt data requiring RCU delay
493+
* @inode: an inode being freed
492494
*
493495
* Free the inode's cached decrypted symlink target, if any. Filesystems must
494496
* call this after an RCU grace period, just before they free the inode.
@@ -503,7 +505,8 @@ void fscrypt_free_inode(struct inode *inode)
503505
EXPORT_SYMBOL(fscrypt_free_inode);
504506

505507
/**
506-
* fscrypt_drop_inode - check whether the inode's master key has been removed
508+
* fscrypt_drop_inode() - check whether the inode's master key has been removed
509+
* @inode: an inode being considered for eviction
507510
*
508511
* Filesystems supporting fscrypt must call this from their ->drop_inode()
509512
* method so that encrypted inodes are evicted as soon as they're no longer in

fs/crypto/policy.c

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616
#include "fscrypt_private.h"
1717

1818
/**
19-
* fscrypt_policies_equal - check whether two encryption policies are the same
19+
* fscrypt_policies_equal() - check whether two encryption policies are the same
20+
* @policy1: the first policy
21+
* @policy2: the second policy
2022
*
2123
* Return: %true if equal, else %false
2224
*/
@@ -170,7 +172,9 @@ static bool fscrypt_supported_v2_policy(const struct fscrypt_policy_v2 *policy,
170172
}
171173

172174
/**
173-
* fscrypt_supported_policy - check whether an encryption policy is supported
175+
* fscrypt_supported_policy() - check whether an encryption policy is supported
176+
* @policy_u: the encryption policy
177+
* @inode: the inode on which the policy will be used
174178
*
175179
* Given an encryption policy, check whether all its encryption modes and other
176180
* settings are supported by this kernel on the given inode. (But we don't
@@ -192,7 +196,10 @@ bool fscrypt_supported_policy(const union fscrypt_policy *policy_u,
192196
}
193197

194198
/**
195-
* fscrypt_new_context_from_policy - create a new fscrypt_context from a policy
199+
* fscrypt_new_context_from_policy() - create a new fscrypt_context from
200+
* an fscrypt_policy
201+
* @ctx_u: output context
202+
* @policy_u: input policy
196203
*
197204
* Create an fscrypt_context for an inode that is being assigned the given
198205
* encryption policy. A new nonce is randomly generated.
@@ -242,7 +249,11 @@ static int fscrypt_new_context_from_policy(union fscrypt_context *ctx_u,
242249
}
243250

244251
/**
245-
* fscrypt_policy_from_context - convert an fscrypt_context to an fscrypt_policy
252+
* fscrypt_policy_from_context() - convert an fscrypt_context to
253+
* an fscrypt_policy
254+
* @policy_u: output policy
255+
* @ctx_u: input context
256+
* @ctx_size: size of input context in bytes
246257
*
247258
* Given an fscrypt_context, build the corresponding fscrypt_policy.
248259
*

include/linux/fscrypt.h

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ static inline bool fscrypt_has_encryption_key(const struct inode *inode)
7575
/**
7676
* fscrypt_needs_contents_encryption() - check whether an inode needs
7777
* contents encryption
78+
* @inode: the inode to check
7879
*
7980
* Return: %true iff the inode is an encrypted regular file and the kernel was
8081
* built with fscrypt support.
@@ -504,7 +505,7 @@ static inline void fscrypt_set_ops(struct super_block *sb,
504505
#endif /* !CONFIG_FS_ENCRYPTION */
505506

506507
/**
507-
* fscrypt_require_key - require an inode's encryption key
508+
* fscrypt_require_key() - require an inode's encryption key
508509
* @inode: the inode we need the key for
509510
*
510511
* If the inode is encrypted, set up its encryption key if not already done.
@@ -530,7 +531,8 @@ static inline int fscrypt_require_key(struct inode *inode)
530531
}
531532

532533
/**
533-
* fscrypt_prepare_link - prepare to link an inode into a possibly-encrypted directory
534+
* fscrypt_prepare_link() - prepare to link an inode into a possibly-encrypted
535+
* directory
534536
* @old_dentry: an existing dentry for the inode being linked
535537
* @dir: the target directory
536538
* @dentry: negative dentry for the target filename
@@ -557,7 +559,8 @@ static inline int fscrypt_prepare_link(struct dentry *old_dentry,
557559
}
558560

559561
/**
560-
* fscrypt_prepare_rename - prepare for a rename between possibly-encrypted directories
562+
* fscrypt_prepare_rename() - prepare for a rename between possibly-encrypted
563+
* directories
561564
* @old_dir: source directory
562565
* @old_dentry: dentry for source file
563566
* @new_dir: target directory
@@ -590,7 +593,8 @@ static inline int fscrypt_prepare_rename(struct inode *old_dir,
590593
}
591594

592595
/**
593-
* fscrypt_prepare_lookup - prepare to lookup a name in a possibly-encrypted directory
596+
* fscrypt_prepare_lookup() - prepare to lookup a name in a possibly-encrypted
597+
* directory
594598
* @dir: directory being searched
595599
* @dentry: filename being looked up
596600
* @fname: (output) the name to use to search the on-disk directory
@@ -623,7 +627,8 @@ static inline int fscrypt_prepare_lookup(struct inode *dir,
623627
}
624628

625629
/**
626-
* fscrypt_prepare_setattr - prepare to change a possibly-encrypted inode's attributes
630+
* fscrypt_prepare_setattr() - prepare to change a possibly-encrypted inode's
631+
* attributes
627632
* @dentry: dentry through which the inode is being changed
628633
* @attr: attributes to change
629634
*
@@ -648,7 +653,7 @@ static inline int fscrypt_prepare_setattr(struct dentry *dentry,
648653
}
649654

650655
/**
651-
* fscrypt_prepare_symlink - prepare to create a possibly-encrypted symlink
656+
* fscrypt_prepare_symlink() - prepare to create a possibly-encrypted symlink
652657
* @dir: directory in which the symlink is being created
653658
* @target: plaintext symlink target
654659
* @len: length of @target excluding null terminator
@@ -687,7 +692,7 @@ static inline int fscrypt_prepare_symlink(struct inode *dir,
687692
}
688693

689694
/**
690-
* fscrypt_encrypt_symlink - encrypt the symlink target if needed
695+
* fscrypt_encrypt_symlink() - encrypt the symlink target if needed
691696
* @inode: symlink inode
692697
* @target: plaintext symlink target
693698
* @len: length of @target excluding null terminator

0 commit comments

Comments
 (0)