Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

cifs: Do some preparation prior to organising the function declarations

Make some preparatory cleanups prior to running a script to organise the
function declarations within the fs/smb/client/ headers. These include:

(1) Remove "inline" from the dummy cifs_proc_init/clean() functions as
they are in a .c file.

(2) Move should_compress()'s kdoc comment to the .c file and remove kdoc
markers from the comments.

(3) Rename CIFS_ALLOW_INSECURE_LEGACY in #endif comments to have CONFIG_
on the front to allow the script to recognise it.

(4) Don't let comments have bare words at the left margin as that confused
the simplistic function detection code in the script.

(5) Adjust some argument lists so that when and if the cleanup script is
run they don't end up over 100 chars.

(6) Fix a few comments to have missing '*' added or the "*/" moved to
their own lines so that checkpatch doesn't moan over the cleanup
script patch.

(7) Move struct cifs_calc_sig_ctx to cifsglob.h.

(8) Remove some __KERNEL__ conditionals.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.org>
cc: linux-cifs@vger.kernel.org
Signed-off-by: Steve French <stfrench@microsoft.com>

authored by

David Howells and committed by
Steve French
32a60868 f80ac7ed

+47 -51
+2 -2
fs/smb/client/cifs_debug.c
··· 1318 1318 }; 1319 1319 1320 1320 #else 1321 - inline void cifs_proc_init(void) 1321 + void cifs_proc_init(void) 1322 1322 { 1323 1323 } 1324 1324 1325 - inline void cifs_proc_clean(void) 1325 + void cifs_proc_clean(void) 1326 1326 { 1327 1327 } 1328 1328 #endif /* PROC_FS */
-2
fs/smb/client/cifs_spnego.h
··· 27 27 uint8_t data[]; 28 28 }; 29 29 30 - #ifdef __KERNEL__ 31 30 extern struct key_type cifs_spnego_key_type; 32 31 extern struct key *cifs_get_spnego_key(struct cifs_ses *sesInfo, 33 32 struct TCP_Server_Info *server); 34 - #endif /* KERNEL */ 35 33 36 34 #endif /* _CIFS_SPNEGO_H */
-3
fs/smb/client/cifs_unicode.h
··· 54 54 #define SFM_MAP_UNI_RSVD 1 55 55 #define SFU_MAP_UNI_RSVD 2 56 56 57 - #ifdef __KERNEL__ 58 57 int cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen, 59 58 const struct nls_table *cp, int map_type); 60 59 int cifs_utf16_bytes(const __le16 *from, int maxbytes, ··· 68 69 extern __le16 *cifs_strndup_to_utf16(const char *src, const int maxlen, 69 70 int *utf16_len, const struct nls_table *cp, 70 71 int remap); 71 - #endif 72 - 73 72 wchar_t cifs_toupper(wchar_t in); 74 73 75 74 #endif /* _CIFS_UNICODE_H */
+3 -2
fs/smb/client/cifsfs.c
··· 28 28 #include <linux/splice.h> 29 29 #include <linux/uuid.h> 30 30 #include <linux/xattr.h> 31 + #include <linux/mm.h> 32 + #include <linux/key-type.h> 31 33 #include <uapi/linux/magic.h> 32 34 #include <net/ipv6.h> 33 35 #include "cifsfs.h" ··· 37 35 #define DECLARE_GLOBALS_HERE 38 36 #include "cifsglob.h" 39 37 #include "cifsproto.h" 38 + #include "smb2proto.h" 40 39 #include "cifs_debug.h" 41 40 #include "cifs_fs_sb.h" 42 - #include <linux/mm.h> 43 - #include <linux/key-type.h> 44 41 #include "cifs_spnego.h" 45 42 #include "fscache.h" 46 43 #ifdef CONFIG_CIFS_DFS_UPCALL
+7 -1
fs/smb/client/cifsglob.h
··· 2118 2118 extern struct smb_version_values smb1_values; 2119 2119 extern struct smb_version_operations smb20_operations; 2120 2120 extern struct smb_version_values smb20_values; 2121 - #endif /* CIFS_ALLOW_INSECURE_LEGACY */ 2121 + #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ 2122 2122 extern struct smb_version_operations smb21_operations; 2123 2123 extern struct smb_version_values smb21_values; 2124 2124 extern struct smb_version_values smbdefault_values; ··· 2285 2285 ((tcon)->posix_extensions || \ 2286 2286 (le32_to_cpu((tcon)->fsAttrInfo.Attributes) & \ 2287 2287 FILE_SUPPORTS_REPARSE_POINTS)) 2288 + 2289 + struct cifs_calc_sig_ctx { 2290 + struct md5_ctx *md5; 2291 + struct hmac_sha256_ctx *hmac; 2292 + struct shash_desc *shash; 2293 + }; 2288 2294 2289 2295 #endif /* _CIFS_GLOB_H */
+1 -6
fs/smb/client/cifsproto.h
··· 594 594 const struct nls_table *nls_codepage, int remap); 595 595 extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon, 596 596 const int netfid, __u64 *pExtAttrBits, __u64 *pMask); 597 - #endif /* CIFS_ALLOW_INSECURE_LEGACY */ 597 + #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ 598 598 extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb); 599 599 extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr); 600 600 extern int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon, ··· 626 626 struct cifs_sb_info *cifs_sb, 627 627 const unsigned char *path, char *pbuf, 628 628 unsigned int *pbytes_written); 629 - struct cifs_calc_sig_ctx { 630 - struct md5_ctx *md5; 631 - struct hmac_sha256_ctx *hmac; 632 - struct shash_desc *shash; 633 - }; 634 629 int __cifs_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server, 635 630 char *signature, struct cifs_calc_sig_ctx *ctx); 636 631 enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
+18 -3
fs/smb/client/compress.c
··· 44 44 unsigned int count; 45 45 }; 46 46 47 - /** 47 + /* 48 48 * has_low_entropy() - Compute Shannon entropy of the sampled data. 49 49 * @bkt: Bytes counts of the sample. 50 50 * @slen: Size of the sample. ··· 82 82 #define BYTE_DIST_BAD 0 83 83 #define BYTE_DIST_GOOD 1 84 84 #define BYTE_DIST_MAYBE 2 85 - /** 85 + /* 86 86 * calc_byte_distribution() - Compute byte distribution on the sampled data. 87 87 * @bkt: Byte counts of the sample. 88 88 * @slen: Size of the sample. ··· 182 182 return s; 183 183 } 184 184 185 - /** 185 + /* 186 186 * is_compressible() - Determines if a chunk of data is compressible. 187 187 * @data: Iterator containing uncompressed data. 188 188 * ··· 261 261 return ret; 262 262 } 263 263 264 + /* 265 + * should_compress() - Determines if a request (write) or the response to a 266 + * request (read) should be compressed. 267 + * @tcon: tcon of the request is being sent to 268 + * @rqst: request to evaluate 269 + * 270 + * Return: true iff: 271 + * - compression was successfully negotiated with server 272 + * - server has enabled compression for the share 273 + * - it's a read or write request 274 + * - (write only) request length is >= SMB_COMPRESS_MIN_LEN 275 + * - (write only) is_compressible() returns 1 276 + * 277 + * Return false otherwise. 278 + */ 264 279 bool should_compress(const struct cifs_tcon *tcon, const struct smb_rqst *rq) 265 280 { 266 281 const struct smb2_hdr *shdr = rq->rq_iov->iov_base;
+2 -17
fs/smb/client/compress.h
··· 29 29 #ifdef CONFIG_CIFS_COMPRESSION 30 30 typedef int (*compress_send_fn)(struct TCP_Server_Info *, int, struct smb_rqst *); 31 31 32 - int smb_compress(struct TCP_Server_Info *server, struct smb_rqst *rq, compress_send_fn send_fn); 33 32 34 - /** 35 - * should_compress() - Determines if a request (write) or the response to a 36 - * request (read) should be compressed. 37 - * @tcon: tcon of the request is being sent to 38 - * @rqst: request to evaluate 39 - * 40 - * Return: true iff: 41 - * - compression was successfully negotiated with server 42 - * - server has enabled compression for the share 43 - * - it's a read or write request 44 - * - (write only) request length is >= SMB_COMPRESS_MIN_LEN 45 - * - (write only) is_compressible() returns 1 46 - * 47 - * Return false otherwise. 48 - */ 33 + int smb_compress(struct TCP_Server_Info *server, struct smb_rqst *rq, compress_send_fn send_fn); 49 34 bool should_compress(const struct cifs_tcon *tcon, const struct smb_rqst *rq); 50 35 51 - /** 36 + /* 52 37 * smb_compress_alg_valid() - Validate a compression algorithm. 53 38 * @alg: Compression algorithm to check. 54 39 * @valid_none: Conditional check whether NONE algorithm should be
+1 -1
fs/smb/client/dir.c
··· 457 457 458 458 int 459 459 cifs_atomic_open(struct inode *inode, struct dentry *direntry, 460 - struct file *file, unsigned oflags, umode_t mode) 460 + struct file *file, unsigned int oflags, umode_t mode) 461 461 { 462 462 int rc; 463 463 unsigned int xid;
-4
fs/smb/client/dns_resolve.h
··· 15 15 #include "cifsglob.h" 16 16 #include "cifsproto.h" 17 17 18 - #ifdef __KERNEL__ 19 - 20 18 int dns_resolve_name(const char *dom, const char *name, 21 19 size_t namelen, struct sockaddr *ip_addr); 22 20 ··· 33 35 34 36 return dns_resolve_name(dom, name, namelen, ip_addr); 35 37 } 36 - 37 - #endif /* KERNEL */ 38 38 39 39 #endif /* _DNS_RESOLVE_H */
+1 -1
fs/smb/client/fs_context.c
··· 505 505 case Smb_20: 506 506 cifs_errorf(fc, "vers=2.0 mount not permitted when legacy dialects disabled\n"); 507 507 return 1; 508 - #endif /* CIFS_ALLOW_INSECURE_LEGACY */ 508 + #endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */ 509 509 case Smb_21: 510 510 ctx->ops = &smb21_operations; 511 511 ctx->vals = &smb21_values;
+1
fs/smb/client/misc.c
··· 18 18 #include "nterr.h" 19 19 #include "cifs_unicode.h" 20 20 #include "smb2pdu.h" 21 + #include "smb2proto.h" 21 22 #include "cifsfs.h" 22 23 #ifdef CONFIG_CIFS_DFS_UPCALL 23 24 #include "dns_resolve.h"
+1 -1
fs/smb/client/netmisc.c
··· 200 200 } 201 201 202 202 /***************************************************************************** 203 - convert a NT status code to a dos class/code 203 + *convert a NT status code to a dos class/code 204 204 *****************************************************************************/ 205 205 /* NT status -> dos error map */ 206 206 static const struct {
+2 -1
fs/smb/client/smb2file.c
··· 140 140 cifs_sb); 141 141 } 142 142 143 - int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32 *oplock, void *buf) 143 + int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, 144 + __u32 *oplock, void *buf) 144 145 { 145 146 int rc; 146 147 __le16 *smb2_path;
-1
fs/smb/client/smb2inode.c
··· 21 21 #include "cifs_unicode.h" 22 22 #include "fscache.h" 23 23 #include "smb2glob.h" 24 - #include "smb2pdu.h" 25 24 #include "smb2proto.h" 26 25 #include "cached_dir.h" 27 26 #include "../common/smb2status.h"
+1 -2
fs/smb/client/smb2maperror.c
··· 11 11 #include "cifsglob.h" 12 12 #include "cifsproto.h" 13 13 #include "cifs_debug.h" 14 - #include "smb2pdu.h" 15 14 #include "smb2proto.h" 16 - #include "../common/smb2status.h" 17 15 #include "smb2glob.h" 16 + #include "../common/smb2status.h" 18 17 #include "trace.h" 19 18 20 19 struct status_to_posix_error {
+2 -2
fs/smb/client/smb2ops.c
··· 17 17 #include <uapi/linux/magic.h> 18 18 #include "cifsfs.h" 19 19 #include "cifsglob.h" 20 - #include "smb2pdu.h" 21 - #include "smb2proto.h" 22 20 #include "cifsproto.h" 21 + #include "smb2proto.h" 22 + #include "smb2pdu.h" 23 23 #include "cifs_debug.h" 24 24 #include "cifs_unicode.h" 25 25 #include "../common/smb2status.h"
+3 -2
fs/smb/client/smb2pdu.c
··· 26 26 #include <linux/netfs.h> 27 27 #include <trace/events/netfs.h> 28 28 #include "cifsglob.h" 29 - #include "cifsacl.h" 30 29 #include "cifsproto.h" 30 + #include "cifsacl.h" 31 31 #include "smb2proto.h" 32 32 #include "cifs_unicode.h" 33 33 #include "cifs_debug.h" ··· 3949 3949 /* currently unused, as now we are doing compounding instead (see smb311_posix_query_path_info) */ 3950 3950 int 3951 3951 SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon, 3952 - u64 persistent_fid, u64 volatile_fid, struct smb311_posix_qinfo *data, u32 *plen) 3952 + u64 persistent_fid, u64 volatile_fid, 3953 + struct smb311_posix_qinfo *data, u32 *plen) 3953 3954 { 3954 3955 size_t output_len = sizeof(struct smb311_posix_qinfo *) + 3955 3956 (sizeof(struct smb_sid) * 2) + (PATH_MAX * 2);
+2
fs/smb/client/smb2proto.h
··· 9 9 */ 10 10 #ifndef _SMB2PROTO_H 11 11 #define _SMB2PROTO_H 12 + 12 13 #include <linux/nls.h> 13 14 #include <linux/key-type.h> 15 + #include "cached_dir.h" 14 16 15 17 struct statfs; 16 18 struct smb_rqst;