Skip to content

Commit 6070090

Browse files
committed
fscrypt: remove unnecessary extern keywords
Remove the unnecessary 'extern' keywords from function declarations. This makes it so that we don't have a mix of both styles, so it won't be ambiguous what to use in new fscrypt patches. This also makes the code shorter and matches the 'checkpatch --strict' expectation. Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Eric Biggers <[email protected]>
1 parent fe015a7 commit 6070090

File tree

2 files changed

+105
-117
lines changed

2 files changed

+105
-117
lines changed

fs/crypto/fscrypt_private.h

Lines changed: 40 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -231,15 +231,14 @@ typedef enum {
231231

232232
/* crypto.c */
233233
extern struct kmem_cache *fscrypt_info_cachep;
234-
extern int fscrypt_initialize(unsigned int cop_flags);
235-
extern int fscrypt_crypt_block(const struct inode *inode,
236-
fscrypt_direction_t rw, u64 lblk_num,
237-
struct page *src_page, struct page *dest_page,
238-
unsigned int len, unsigned int offs,
239-
gfp_t gfp_flags);
240-
extern struct page *fscrypt_alloc_bounce_page(gfp_t gfp_flags);
241-
242-
extern void __printf(3, 4) __cold
234+
int fscrypt_initialize(unsigned int cop_flags);
235+
int fscrypt_crypt_block(const struct inode *inode, fscrypt_direction_t rw,
236+
u64 lblk_num, struct page *src_page,
237+
struct page *dest_page, unsigned int len,
238+
unsigned int offs, gfp_t gfp_flags);
239+
struct page *fscrypt_alloc_bounce_page(gfp_t gfp_flags);
240+
241+
void __printf(3, 4) __cold
243242
fscrypt_msg(const struct inode *inode, const char *level, const char *fmt, ...);
244243

245244
#define fscrypt_warn(inode, fmt, ...) \
@@ -264,12 +263,10 @@ void fscrypt_generate_iv(union fscrypt_iv *iv, u64 lblk_num,
264263
const struct fscrypt_info *ci);
265264

266265
/* fname.c */
267-
extern int fscrypt_fname_encrypt(const struct inode *inode,
268-
const struct qstr *iname,
269-
u8 *out, unsigned int olen);
270-
extern bool fscrypt_fname_encrypted_size(const struct inode *inode,
271-
u32 orig_len, u32 max_len,
272-
u32 *encrypted_len_ret);
266+
int fscrypt_fname_encrypt(const struct inode *inode, const struct qstr *iname,
267+
u8 *out, unsigned int olen);
268+
bool fscrypt_fname_encrypted_size(const struct inode *inode, u32 orig_len,
269+
u32 max_len, u32 *encrypted_len_ret);
273270
extern const struct dentry_operations fscrypt_d_ops;
274271

275272
/* hkdf.c */
@@ -278,8 +275,8 @@ struct fscrypt_hkdf {
278275
struct crypto_shash *hmac_tfm;
279276
};
280277

281-
extern int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
282-
unsigned int master_key_size);
278+
int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
279+
unsigned int master_key_size);
283280

284281
/*
285282
* The list of contexts in which fscrypt uses HKDF. These values are used as
@@ -294,11 +291,11 @@ extern int fscrypt_init_hkdf(struct fscrypt_hkdf *hkdf, const u8 *master_key,
294291
#define HKDF_CONTEXT_IV_INO_LBLK_64_KEY 4
295292
#define HKDF_CONTEXT_DIRHASH_KEY 5
296293

297-
extern int fscrypt_hkdf_expand(const struct fscrypt_hkdf *hkdf, u8 context,
298-
const u8 *info, unsigned int infolen,
299-
u8 *okm, unsigned int okmlen);
294+
int fscrypt_hkdf_expand(const struct fscrypt_hkdf *hkdf, u8 context,
295+
const u8 *info, unsigned int infolen,
296+
u8 *okm, unsigned int okmlen);
300297

301-
extern void fscrypt_destroy_hkdf(struct fscrypt_hkdf *hkdf);
298+
void fscrypt_destroy_hkdf(struct fscrypt_hkdf *hkdf);
302299

303300
/* keyring.c */
304301

@@ -436,14 +433,14 @@ static inline int master_key_spec_len(const struct fscrypt_key_specifier *spec)
436433
return 0;
437434
}
438435

439-
extern struct key *
436+
struct key *
440437
fscrypt_find_master_key(struct super_block *sb,
441438
const struct fscrypt_key_specifier *mk_spec);
442439

443-
extern int fscrypt_verify_key_added(struct super_block *sb,
444-
const u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]);
440+
int fscrypt_verify_key_added(struct super_block *sb,
441+
const u8 identifier[FSCRYPT_KEY_IDENTIFIER_SIZE]);
445442

446-
extern int __init fscrypt_init_keyring(void);
443+
int __init fscrypt_init_keyring(void);
447444

448445
/* keysetup.c */
449446

@@ -457,33 +454,32 @@ struct fscrypt_mode {
457454

458455
extern struct fscrypt_mode fscrypt_modes[];
459456

460-
extern struct crypto_skcipher *
461-
fscrypt_allocate_skcipher(struct fscrypt_mode *mode, const u8 *raw_key,
462-
const struct inode *inode);
457+
struct crypto_skcipher *fscrypt_allocate_skcipher(struct fscrypt_mode *mode,
458+
const u8 *raw_key,
459+
const struct inode *inode);
463460

464-
extern int fscrypt_set_per_file_enc_key(struct fscrypt_info *ci,
465-
const u8 *raw_key);
461+
int fscrypt_set_per_file_enc_key(struct fscrypt_info *ci, const u8 *raw_key);
466462

467-
extern int fscrypt_derive_dirhash_key(struct fscrypt_info *ci,
468-
const struct fscrypt_master_key *mk);
463+
int fscrypt_derive_dirhash_key(struct fscrypt_info *ci,
464+
const struct fscrypt_master_key *mk);
469465

470466
/* keysetup_v1.c */
471467

472-
extern void fscrypt_put_direct_key(struct fscrypt_direct_key *dk);
468+
void fscrypt_put_direct_key(struct fscrypt_direct_key *dk);
473469

474-
extern int fscrypt_setup_v1_file_key(struct fscrypt_info *ci,
475-
const u8 *raw_master_key);
470+
int fscrypt_setup_v1_file_key(struct fscrypt_info *ci,
471+
const u8 *raw_master_key);
472+
473+
int fscrypt_setup_v1_file_key_via_subscribed_keyrings(struct fscrypt_info *ci);
476474

477-
extern int fscrypt_setup_v1_file_key_via_subscribed_keyrings(
478-
struct fscrypt_info *ci);
479475
/* policy.c */
480476

481-
extern bool fscrypt_policies_equal(const union fscrypt_policy *policy1,
482-
const union fscrypt_policy *policy2);
483-
extern bool fscrypt_supported_policy(const union fscrypt_policy *policy_u,
484-
const struct inode *inode);
485-
extern int fscrypt_policy_from_context(union fscrypt_policy *policy_u,
486-
const union fscrypt_context *ctx_u,
487-
int ctx_size);
477+
bool fscrypt_policies_equal(const union fscrypt_policy *policy1,
478+
const union fscrypt_policy *policy2);
479+
bool fscrypt_supported_policy(const union fscrypt_policy *policy_u,
480+
const struct inode *inode);
481+
int fscrypt_policy_from_context(union fscrypt_policy *policy_u,
482+
const union fscrypt_context *ctx_u,
483+
int ctx_size);
488484

489485
#endif /* _FSCRYPT_PRIVATE_H */

include/linux/fscrypt.h

Lines changed: 65 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -108,22 +108,21 @@ static inline void fscrypt_handle_d_move(struct dentry *dentry)
108108
}
109109

110110
/* crypto.c */
111-
extern void fscrypt_enqueue_decrypt_work(struct work_struct *);
112-
113-
extern struct page *fscrypt_encrypt_pagecache_blocks(struct page *page,
114-
unsigned int len,
115-
unsigned int offs,
116-
gfp_t gfp_flags);
117-
extern int fscrypt_encrypt_block_inplace(const struct inode *inode,
118-
struct page *page, unsigned int len,
119-
unsigned int offs, u64 lblk_num,
120-
gfp_t gfp_flags);
121-
122-
extern int fscrypt_decrypt_pagecache_blocks(struct page *page, unsigned int len,
123-
unsigned int offs);
124-
extern int fscrypt_decrypt_block_inplace(const struct inode *inode,
125-
struct page *page, unsigned int len,
126-
unsigned int offs, u64 lblk_num);
111+
void fscrypt_enqueue_decrypt_work(struct work_struct *);
112+
113+
struct page *fscrypt_encrypt_pagecache_blocks(struct page *page,
114+
unsigned int len,
115+
unsigned int offs,
116+
gfp_t gfp_flags);
117+
int fscrypt_encrypt_block_inplace(const struct inode *inode, struct page *page,
118+
unsigned int len, unsigned int offs,
119+
u64 lblk_num, gfp_t gfp_flags);
120+
121+
int fscrypt_decrypt_pagecache_blocks(struct page *page, unsigned int len,
122+
unsigned int offs);
123+
int fscrypt_decrypt_block_inplace(const struct inode *inode, struct page *page,
124+
unsigned int len, unsigned int offs,
125+
u64 lblk_num);
127126

128127
static inline bool fscrypt_is_bounce_page(struct page *page)
129128
{
@@ -135,81 +134,74 @@ static inline struct page *fscrypt_pagecache_page(struct page *bounce_page)
135134
return (struct page *)page_private(bounce_page);
136135
}
137136

138-
extern void fscrypt_free_bounce_page(struct page *bounce_page);
137+
void fscrypt_free_bounce_page(struct page *bounce_page);
139138

140139
/* policy.c */
141-
extern int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg);
142-
extern int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg);
143-
extern int fscrypt_ioctl_get_policy_ex(struct file *filp, void __user *arg);
144-
extern int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg);
145-
extern int fscrypt_has_permitted_context(struct inode *parent,
146-
struct inode *child);
147-
extern int fscrypt_inherit_context(struct inode *parent, struct inode *child,
148-
void *fs_data, bool preload);
140+
int fscrypt_ioctl_set_policy(struct file *filp, const void __user *arg);
141+
int fscrypt_ioctl_get_policy(struct file *filp, void __user *arg);
142+
int fscrypt_ioctl_get_policy_ex(struct file *filp, void __user *arg);
143+
int fscrypt_ioctl_get_nonce(struct file *filp, void __user *arg);
144+
int fscrypt_has_permitted_context(struct inode *parent, struct inode *child);
145+
int fscrypt_inherit_context(struct inode *parent, struct inode *child,
146+
void *fs_data, bool preload);
149147

150148
/* keyring.c */
151-
extern void fscrypt_sb_free(struct super_block *sb);
152-
extern int fscrypt_ioctl_add_key(struct file *filp, void __user *arg);
153-
extern int fscrypt_ioctl_remove_key(struct file *filp, void __user *arg);
154-
extern int fscrypt_ioctl_remove_key_all_users(struct file *filp,
155-
void __user *arg);
156-
extern int fscrypt_ioctl_get_key_status(struct file *filp, void __user *arg);
149+
void fscrypt_sb_free(struct super_block *sb);
150+
int fscrypt_ioctl_add_key(struct file *filp, void __user *arg);
151+
int fscrypt_ioctl_remove_key(struct file *filp, void __user *arg);
152+
int fscrypt_ioctl_remove_key_all_users(struct file *filp, void __user *arg);
153+
int fscrypt_ioctl_get_key_status(struct file *filp, void __user *arg);
157154

158155
/* keysetup.c */
159-
extern int fscrypt_get_encryption_info(struct inode *inode);
160-
extern void fscrypt_put_encryption_info(struct inode *inode);
161-
extern void fscrypt_free_inode(struct inode *inode);
162-
extern int fscrypt_drop_inode(struct inode *inode);
156+
int fscrypt_get_encryption_info(struct inode *inode);
157+
void fscrypt_put_encryption_info(struct inode *inode);
158+
void fscrypt_free_inode(struct inode *inode);
159+
int fscrypt_drop_inode(struct inode *inode);
163160

164161
/* fname.c */
165-
extern int fscrypt_setup_filename(struct inode *inode, const struct qstr *iname,
166-
int lookup, struct fscrypt_name *fname);
162+
int fscrypt_setup_filename(struct inode *inode, const struct qstr *iname,
163+
int lookup, struct fscrypt_name *fname);
167164

168165
static inline void fscrypt_free_filename(struct fscrypt_name *fname)
169166
{
170167
kfree(fname->crypto_buf.name);
171168
}
172169

173-
extern int fscrypt_fname_alloc_buffer(const struct inode *inode,
174-
u32 max_encrypted_len,
175-
struct fscrypt_str *crypto_str);
176-
extern void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str);
177-
extern int fscrypt_fname_disk_to_usr(const struct inode *inode,
178-
u32 hash, u32 minor_hash,
179-
const struct fscrypt_str *iname,
180-
struct fscrypt_str *oname);
181-
extern bool fscrypt_match_name(const struct fscrypt_name *fname,
182-
const u8 *de_name, u32 de_name_len);
183-
extern u64 fscrypt_fname_siphash(const struct inode *dir,
184-
const struct qstr *name);
170+
int fscrypt_fname_alloc_buffer(const struct inode *inode, u32 max_encrypted_len,
171+
struct fscrypt_str *crypto_str);
172+
void fscrypt_fname_free_buffer(struct fscrypt_str *crypto_str);
173+
int fscrypt_fname_disk_to_usr(const struct inode *inode,
174+
u32 hash, u32 minor_hash,
175+
const struct fscrypt_str *iname,
176+
struct fscrypt_str *oname);
177+
bool fscrypt_match_name(const struct fscrypt_name *fname,
178+
const u8 *de_name, u32 de_name_len);
179+
u64 fscrypt_fname_siphash(const struct inode *dir, const struct qstr *name);
185180

186181
/* bio.c */
187-
extern void fscrypt_decrypt_bio(struct bio *bio);
188-
extern int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
189-
sector_t pblk, unsigned int len);
182+
void fscrypt_decrypt_bio(struct bio *bio);
183+
int fscrypt_zeroout_range(const struct inode *inode, pgoff_t lblk,
184+
sector_t pblk, unsigned int len);
190185

191186
/* hooks.c */
192-
extern int fscrypt_file_open(struct inode *inode, struct file *filp);
193-
extern int __fscrypt_prepare_link(struct inode *inode, struct inode *dir,
194-
struct dentry *dentry);
195-
extern int __fscrypt_prepare_rename(struct inode *old_dir,
196-
struct dentry *old_dentry,
197-
struct inode *new_dir,
198-
struct dentry *new_dentry,
199-
unsigned int flags);
200-
extern int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry,
201-
struct fscrypt_name *fname);
202-
extern int fscrypt_prepare_setflags(struct inode *inode,
203-
unsigned int oldflags, unsigned int flags);
204-
extern int __fscrypt_prepare_symlink(struct inode *dir, unsigned int len,
205-
unsigned int max_len,
206-
struct fscrypt_str *disk_link);
207-
extern int __fscrypt_encrypt_symlink(struct inode *inode, const char *target,
208-
unsigned int len,
209-
struct fscrypt_str *disk_link);
210-
extern const char *fscrypt_get_symlink(struct inode *inode, const void *caddr,
211-
unsigned int max_size,
212-
struct delayed_call *done);
187+
int fscrypt_file_open(struct inode *inode, struct file *filp);
188+
int __fscrypt_prepare_link(struct inode *inode, struct inode *dir,
189+
struct dentry *dentry);
190+
int __fscrypt_prepare_rename(struct inode *old_dir, struct dentry *old_dentry,
191+
struct inode *new_dir, struct dentry *new_dentry,
192+
unsigned int flags);
193+
int __fscrypt_prepare_lookup(struct inode *dir, struct dentry *dentry,
194+
struct fscrypt_name *fname);
195+
int fscrypt_prepare_setflags(struct inode *inode,
196+
unsigned int oldflags, unsigned int flags);
197+
int __fscrypt_prepare_symlink(struct inode *dir, unsigned int len,
198+
unsigned int max_len,
199+
struct fscrypt_str *disk_link);
200+
int __fscrypt_encrypt_symlink(struct inode *inode, const char *target,
201+
unsigned int len, struct fscrypt_str *disk_link);
202+
const char *fscrypt_get_symlink(struct inode *inode, const void *caddr,
203+
unsigned int max_size,
204+
struct delayed_call *done);
213205
static inline void fscrypt_set_ops(struct super_block *sb,
214206
const struct fscrypt_operations *s_cop)
215207
{

0 commit comments

Comments
 (0)