Skip to content

Commit ebc84a2

Browse files
dhowellssmfrench
authored andcommitted
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> cc: Steve French <sfrench@samba.org> cc: Paulo Alcantara <pc@manguebit.org> cc: linux-cifs@vger.kernel.org Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 621ac96 commit ebc84a2

19 files changed

+47
-51
lines changed

fs/smb/client/cifs_debug.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1318,11 +1318,11 @@ static const struct proc_ops cifs_mount_params_proc_ops = {
13181318
};
13191319

13201320
#else
1321-
inline void cifs_proc_init(void)
1321+
void cifs_proc_init(void)
13221322
{
13231323
}
13241324

1325-
inline void cifs_proc_clean(void)
1325+
void cifs_proc_clean(void)
13261326
{
13271327
}
13281328
#endif /* PROC_FS */

fs/smb/client/cifs_spnego.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,8 @@ struct cifs_spnego_msg {
2727
uint8_t data[];
2828
};
2929

30-
#ifdef __KERNEL__
3130
extern struct key_type cifs_spnego_key_type;
3231
extern struct key *cifs_get_spnego_key(struct cifs_ses *sesInfo,
3332
struct TCP_Server_Info *server);
34-
#endif /* KERNEL */
3533

3634
#endif /* _CIFS_SPNEGO_H */

fs/smb/client/cifs_unicode.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@
5454
#define SFM_MAP_UNI_RSVD 1
5555
#define SFU_MAP_UNI_RSVD 2
5656

57-
#ifdef __KERNEL__
5857
int cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
5958
const struct nls_table *cp, int map_type);
6059
int cifs_utf16_bytes(const __le16 *from, int maxbytes,
@@ -69,8 +68,6 @@ extern int cifs_remap(struct cifs_sb_info *cifs_sb);
6968
extern __le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
7069
int *utf16_len, const struct nls_table *cp,
7170
int remap);
72-
#endif
73-
7471
wchar_t cifs_toupper(wchar_t in);
7572

7673
#endif /* _CIFS_UNICODE_H */

fs/smb/client/cifsfs.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,18 @@
2828
#include <linux/splice.h>
2929
#include <linux/uuid.h>
3030
#include <linux/xattr.h>
31+
#include <linux/mm.h>
32+
#include <linux/key-type.h>
3133
#include <uapi/linux/magic.h>
3234
#include <net/ipv6.h>
3335
#include "cifsfs.h"
3436
#include "cifspdu.h"
3537
#define DECLARE_GLOBALS_HERE
3638
#include "cifsglob.h"
3739
#include "cifsproto.h"
40+
#include "smb2proto.h"
3841
#include "cifs_debug.h"
3942
#include "cifs_fs_sb.h"
40-
#include <linux/mm.h>
41-
#include <linux/key-type.h>
4243
#include "cifs_spnego.h"
4344
#include "fscache.h"
4445
#ifdef CONFIG_CIFS_DFS_UPCALL

fs/smb/client/cifsglob.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2118,7 +2118,7 @@ extern struct smb_version_operations smb1_operations;
21182118
extern struct smb_version_values smb1_values;
21192119
extern struct smb_version_operations smb20_operations;
21202120
extern struct smb_version_values smb20_values;
2121-
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
2121+
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
21222122
extern struct smb_version_operations smb21_operations;
21232123
extern struct smb_version_values smb21_values;
21242124
extern struct smb_version_values smbdefault_values;
@@ -2286,4 +2286,10 @@ static inline void mid_execute_callback(struct TCP_Server_Info *server,
22862286
(le32_to_cpu((tcon)->fsAttrInfo.Attributes) & \
22872287
FILE_SUPPORTS_REPARSE_POINTS))
22882288

2289+
struct cifs_calc_sig_ctx {
2290+
struct md5_ctx *md5;
2291+
struct hmac_sha256_ctx *hmac;
2292+
struct shash_desc *shash;
2293+
};
2294+
22892295
#endif /* _CIFS_GLOB_H */

fs/smb/client/cifsproto.h

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,7 @@ extern int cifs_do_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
594594
const struct nls_table *nls_codepage, int remap);
595595
extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
596596
const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
597-
#endif /* CIFS_ALLOW_INSECURE_LEGACY */
597+
#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
598598
extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
599599
extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
600600
extern int check_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
@@ -626,11 +626,6 @@ int cifs_create_mf_symlink(unsigned int xid, struct cifs_tcon *tcon,
626626
struct cifs_sb_info *cifs_sb,
627627
const unsigned char *path, char *pbuf,
628628
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-
};
634629
int __cifs_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
635630
char *signature, struct cifs_calc_sig_ctx *ctx);
636631
enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,

fs/smb/client/compress.c

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ struct bucket {
4444
unsigned int count;
4545
};
4646

47-
/**
47+
/*
4848
* has_low_entropy() - Compute Shannon entropy of the sampled data.
4949
* @bkt: Bytes counts of the sample.
5050
* @slen: Size of the sample.
@@ -82,7 +82,7 @@ static bool has_low_entropy(struct bucket *bkt, size_t slen)
8282
#define BYTE_DIST_BAD 0
8383
#define BYTE_DIST_GOOD 1
8484
#define BYTE_DIST_MAYBE 2
85-
/**
85+
/*
8686
* calc_byte_distribution() - Compute byte distribution on the sampled data.
8787
* @bkt: Byte counts of the sample.
8888
* @slen: Size of the sample.
@@ -182,7 +182,7 @@ static int collect_sample(const struct iov_iter *source, ssize_t max, u8 *sample
182182
return s;
183183
}
184184

185-
/**
185+
/*
186186
* is_compressible() - Determines if a chunk of data is compressible.
187187
* @data: Iterator containing uncompressed data.
188188
*
@@ -261,6 +261,21 @@ static bool is_compressible(const struct iov_iter *data)
261261
return ret;
262262
}
263263

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+
*/
264279
bool should_compress(const struct cifs_tcon *tcon, const struct smb_rqst *rq)
265280
{
266281
const struct smb2_hdr *shdr = rq->rq_iov->iov_base;

fs/smb/client/compress.h

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,26 +29,11 @@
2929
#ifdef CONFIG_CIFS_COMPRESSION
3030
typedef int (*compress_send_fn)(struct TCP_Server_Info *, int, struct smb_rqst *);
3131

32-
int smb_compress(struct TCP_Server_Info *server, struct smb_rqst *rq, compress_send_fn send_fn);
3332

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);
4934
bool should_compress(const struct cifs_tcon *tcon, const struct smb_rqst *rq);
5035

51-
/**
36+
/*
5237
* smb_compress_alg_valid() - Validate a compression algorithm.
5338
* @alg: Compression algorithm to check.
5439
* @valid_none: Conditional check whether NONE algorithm should be

fs/smb/client/dir.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ static int cifs_do_create(struct inode *inode, struct dentry *direntry, unsigned
457457

458458
int
459459
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)
461461
{
462462
int rc;
463463
unsigned int xid;

fs/smb/client/dns_resolve.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
#include "cifsglob.h"
1616
#include "cifsproto.h"
1717

18-
#ifdef __KERNEL__
19-
2018
int dns_resolve_name(const char *dom, const char *name,
2119
size_t namelen, struct sockaddr *ip_addr);
2220

@@ -36,6 +34,4 @@ static inline int dns_resolve_unc(const char *dom, const char *unc,
3634
return dns_resolve_name(dom, name, namelen, ip_addr);
3735
}
3836

39-
#endif /* KERNEL */
40-
4137
#endif /* _DNS_RESOLVE_H */

0 commit comments

Comments
 (0)