]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
cifs: Do some preparation prior to organising the function declarations
authorDavid Howells <dhowells@redhat.com>
Mon, 1 Dec 2025 08:40:25 +0000 (08:40 +0000)
committerSteve French <stfrench@microsoft.com>
Fri, 5 Dec 2025 23:11:55 +0000 (17:11 -0600)
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>
19 files changed:
fs/smb/client/cifs_debug.c
fs/smb/client/cifs_spnego.h
fs/smb/client/cifs_unicode.h
fs/smb/client/cifsfs.c
fs/smb/client/cifsglob.h
fs/smb/client/cifsproto.h
fs/smb/client/compress.c
fs/smb/client/compress.h
fs/smb/client/dir.c
fs/smb/client/dns_resolve.h
fs/smb/client/fs_context.c
fs/smb/client/misc.c
fs/smb/client/netmisc.c
fs/smb/client/smb2file.c
fs/smb/client/smb2inode.c
fs/smb/client/smb2maperror.c
fs/smb/client/smb2ops.c
fs/smb/client/smb2pdu.c
fs/smb/client/smb2proto.h

index 881d3a88d683a3e9cbe3c3cd903e60a583e542ef..2cb234d4bd2fc32538163ce21aab01bcdd9cd8aa 100644 (file)
@@ -1318,11 +1318,11 @@ static const struct proc_ops cifs_mount_params_proc_ops = {
 };
 
 #else
-inline void cifs_proc_init(void)
+void cifs_proc_init(void)
 {
 }
 
-inline void cifs_proc_clean(void)
+void cifs_proc_clean(void)
 {
 }
 #endif /* PROC_FS */
index e4d751b0c812777ea4afc5c3afb6af5cca1baf8a..e70929db3611f0ec42738fd000a3a9d8db2f183a 100644 (file)
@@ -27,10 +27,8 @@ struct cifs_spnego_msg {
        uint8_t         data[];
 };
 
-#ifdef __KERNEL__
 extern struct key_type cifs_spnego_key_type;
 extern struct key *cifs_get_spnego_key(struct cifs_ses *sesInfo,
                                       struct TCP_Server_Info *server);
-#endif /* KERNEL */
 
 #endif /* _CIFS_SPNEGO_H */
index e137a0dfbbe9a2b98bc121087e62396ccb8ee823..6e4b99786498d7bff6eb0791ec394274590a820d 100644 (file)
@@ -54,7 +54,6 @@
 #define SFM_MAP_UNI_RSVD       1
 #define SFU_MAP_UNI_RSVD       2
 
-#ifdef __KERNEL__
 int cifs_from_utf16(char *to, const __le16 *from, int tolen, int fromlen,
                    const struct nls_table *cp, int map_type);
 int cifs_utf16_bytes(const __le16 *from, int maxbytes,
@@ -69,8 +68,6 @@ extern int cifs_remap(struct cifs_sb_info *cifs_sb);
 extern __le16 *cifs_strndup_to_utf16(const char *src, const int maxlen,
                                     int *utf16_len, const struct nls_table *cp,
                                     int remap);
-#endif
-
 wchar_t cifs_toupper(wchar_t in);
 
 #endif /* _CIFS_UNICODE_H */
index 011976f5f62297d1873776c3132a4f2d374c2829..d9664634144d3ebba5cdd659f651d6e6e8f975fa 100644 (file)
@@ -28,6 +28,8 @@
 #include <linux/splice.h>
 #include <linux/uuid.h>
 #include <linux/xattr.h>
+#include <linux/mm.h>
+#include <linux/key-type.h>
 #include <uapi/linux/magic.h>
 #include <net/ipv6.h>
 #include "cifsfs.h"
 #define DECLARE_GLOBALS_HERE
 #include "cifsglob.h"
 #include "cifsproto.h"
+#include "smb2proto.h"
 #include "cifs_debug.h"
 #include "cifs_fs_sb.h"
-#include <linux/mm.h>
-#include <linux/key-type.h>
 #include "cifs_spnego.h"
 #include "fscache.h"
 #ifdef CONFIG_CIFS_DFS_UPCALL
index a8cfe9b87a20d25938ce8309e1ac5e53056740a7..f9c1f553ffd00c77ddaf3a21eeec4999576c931e 100644 (file)
@@ -2118,7 +2118,7 @@ extern struct smb_version_operations smb1_operations;
 extern struct smb_version_values smb1_values;
 extern struct smb_version_operations smb20_operations;
 extern struct smb_version_values smb20_values;
-#endif /* CIFS_ALLOW_INSECURE_LEGACY */
+#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
 extern struct smb_version_operations smb21_operations;
 extern struct smb_version_values smb21_values;
 extern struct smb_version_values smbdefault_values;
@@ -2286,4 +2286,10 @@ static inline void mid_execute_callback(struct TCP_Server_Info *server,
         (le32_to_cpu((tcon)->fsAttrInfo.Attributes) & \
          FILE_SUPPORTS_REPARSE_POINTS))
 
+struct cifs_calc_sig_ctx {
+       struct md5_ctx *md5;
+       struct hmac_sha256_ctx *hmac;
+       struct shash_desc *shash;
+};
+
 #endif /* _CIFS_GLOB_H */
index 5d54de12f0f409756fdf1afdc665c4db47e1e1e5..823ca4f369140815295c209e0093089ed1a5c88b 100644 (file)
@@ -594,7 +594,7 @@ extern int cifs_do_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
                           const struct nls_table *nls_codepage, int remap);
 extern int CIFSGetExtAttr(const unsigned int xid, struct cifs_tcon *tcon,
                        const int netfid, __u64 *pExtAttrBits, __u64 *pMask);
-#endif /* CIFS_ALLOW_INSECURE_LEGACY */
+#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
 extern void cifs_autodisable_serverino(struct cifs_sb_info *cifs_sb);
 extern bool couldbe_mf_symlink(const struct cifs_fattr *fattr);
 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,
                           struct cifs_sb_info *cifs_sb,
                           const unsigned char *path, char *pbuf,
                           unsigned int *pbytes_written);
-struct cifs_calc_sig_ctx {
-       struct md5_ctx *md5;
-       struct hmac_sha256_ctx *hmac;
-       struct shash_desc *shash;
-};
 int __cifs_calc_signature(struct smb_rqst *rqst, struct TCP_Server_Info *server,
                          char *signature, struct cifs_calc_sig_ctx *ctx);
 enum securityEnum cifs_select_sectype(struct TCP_Server_Info *,
index f03dd980442706637506295b9668d400f09956be..e0c44b46080ef7748ba335b830ead02b4e4d2362 100644 (file)
@@ -44,7 +44,7 @@ struct bucket {
        unsigned int count;
 };
 
-/**
+/*
  * has_low_entropy() - Compute Shannon entropy of the sampled data.
  * @bkt:       Bytes counts of the sample.
  * @slen:      Size of the sample.
@@ -82,7 +82,7 @@ static bool has_low_entropy(struct bucket *bkt, size_t slen)
 #define BYTE_DIST_BAD          0
 #define BYTE_DIST_GOOD         1
 #define BYTE_DIST_MAYBE                2
-/**
+/*
  * calc_byte_distribution() - Compute byte distribution on the sampled data.
  * @bkt:       Byte counts of the sample.
  * @slen:      Size of the sample.
@@ -182,7 +182,7 @@ static int collect_sample(const struct iov_iter *source, ssize_t max, u8 *sample
        return s;
 }
 
-/**
+/*
  * is_compressible() - Determines if a chunk of data is compressible.
  * @data: Iterator containing uncompressed data.
  *
@@ -261,6 +261,21 @@ out:
        return ret;
 }
 
+/*
+ * should_compress() - Determines if a request (write) or the response to a
+ *                    request (read) should be compressed.
+ * @tcon: tcon of the request is being sent to
+ * @rqst: request to evaluate
+ *
+ * Return: true iff:
+ * - compression was successfully negotiated with server
+ * - server has enabled compression for the share
+ * - it's a read or write request
+ * - (write only) request length is >= SMB_COMPRESS_MIN_LEN
+ * - (write only) is_compressible() returns 1
+ *
+ * Return false otherwise.
+ */
 bool should_compress(const struct cifs_tcon *tcon, const struct smb_rqst *rq)
 {
        const struct smb2_hdr *shdr = rq->rq_iov->iov_base;
index f3ed1d3e52fbfd3fc3acda05393a3a1e189da6cb..63aea32fbe9211c9f926e3de4db8ad87addba5df 100644 (file)
 #ifdef CONFIG_CIFS_COMPRESSION
 typedef int (*compress_send_fn)(struct TCP_Server_Info *, int, struct smb_rqst *);
 
-int smb_compress(struct TCP_Server_Info *server, struct smb_rqst *rq, compress_send_fn send_fn);
 
-/**
- * should_compress() - Determines if a request (write) or the response to a
- *                    request (read) should be compressed.
- * @tcon: tcon of the request is being sent to
- * @rqst: request to evaluate
- *
- * Return: true iff:
- * - compression was successfully negotiated with server
- * - server has enabled compression for the share
- * - it's a read or write request
- * - (write only) request length is >= SMB_COMPRESS_MIN_LEN
- * - (write only) is_compressible() returns 1
- *
- * Return false otherwise.
- */
+int smb_compress(struct TCP_Server_Info *server, struct smb_rqst *rq, compress_send_fn send_fn);
 bool should_compress(const struct cifs_tcon *tcon, const struct smb_rqst *rq);
 
-/**
+/*
  * smb_compress_alg_valid() - Validate a compression algorithm.
  * @alg: Compression algorithm to check.
  * @valid_none: Conditional check whether NONE algorithm should be
index 4ad69dc77e09bc62e79266cfa0082d845f4d0e68..747256025e49bd1562e8be7da59c1ced428be199 100644 (file)
@@ -457,7 +457,7 @@ out_err:
 
 int
 cifs_atomic_open(struct inode *inode, struct dentry *direntry,
-                struct file *file, unsigned oflags, umode_t mode)
+                struct file *file, unsigned int oflags, umode_t mode)
 {
        int rc;
        unsigned int xid;
index 0dc706f2c42259be0acea5d6e924c93cf99c1611..36bc4a6a55bfb98a66e122cfd853469df707fc07 100644 (file)
@@ -15,8 +15,6 @@
 #include "cifsglob.h"
 #include "cifsproto.h"
 
-#ifdef __KERNEL__
-
 int dns_resolve_name(const char *dom, const char *name,
                     size_t namelen, struct sockaddr *ip_addr);
 
@@ -36,6 +34,4 @@ static inline int dns_resolve_unc(const char *dom, const char *unc,
        return dns_resolve_name(dom, name, namelen, ip_addr);
 }
 
-#endif /* KERNEL */
-
 #endif /* _DNS_RESOLVE_H */
index a966c6a8b1f5bf195c19ce359b7cde64bcb98b2b..1419a7336d3feb49b74b6bccc7676345a87c83bf 100644 (file)
@@ -505,7 +505,7 @@ cifs_parse_smb_version(struct fs_context *fc, char *value, struct smb3_fs_contex
        case Smb_20:
                cifs_errorf(fc, "vers=2.0 mount not permitted when legacy dialects disabled\n");
                return 1;
-#endif /* CIFS_ALLOW_INSECURE_LEGACY */
+#endif /* CONFIG_CIFS_ALLOW_INSECURE_LEGACY */
        case Smb_21:
                ctx->ops = &smb21_operations;
                ctx->vals = &smb21_values;
index eb7368367c143009975256a99da536ab7e13db5a..9529fa385938e05925fc443a91c0dca81464740f 100644 (file)
@@ -18,6 +18,7 @@
 #include "nterr.h"
 #include "cifs_unicode.h"
 #include "smb2pdu.h"
+#include "smb2proto.h"
 #include "cifsfs.h"
 #ifdef CONFIG_CIFS_DFS_UPCALL
 #include "dns_resolve.h"
index e5a465a018c046e6a0b5dbdc507eb97c1f951024..ae15f0bef009721df2629b36a5e81101ece205d6 100644 (file)
@@ -200,7 +200,7 @@ cifs_set_port(struct sockaddr *addr, const unsigned short int port)
 }
 
 /*****************************************************************************
-convert a NT status code to a dos class/code
+ *convert a NT status code to a dos class/code
  *****************************************************************************/
 /* NT status -> dos error map */
 static const struct {
index 68d37f11f3f3d5d5f16ac7f2e62d6ebd8a0b3983..7f11ae6bb785dd935c7626d9f92426954731a91b 100644 (file)
@@ -140,7 +140,8 @@ int smb2_parse_symlink_response(struct cifs_sb_info *cifs_sb, const struct kvec
                                         cifs_sb);
 }
 
-int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms, __u32 *oplock, void *buf)
+int smb2_open_file(const unsigned int xid, struct cifs_open_parms *oparms,
+                  __u32 *oplock, void *buf)
 {
        int rc;
        __le16 *smb2_path;
index 3e45e41f5713b96862783ab5123a78cfada978ee..2ded3246600c01d7ae88772eef0c578e4a78e726 100644 (file)
@@ -21,7 +21,6 @@
 #include "cifs_unicode.h"
 #include "fscache.h"
 #include "smb2glob.h"
-#include "smb2pdu.h"
 #include "smb2proto.h"
 #include "cached_dir.h"
 #include "../common/smb2status.h"
index b179d7369fbac4654616563cc7f6982c4d4e6f68..4fc22456c39e7c4ca4df2343befa87f8831a140a 100644 (file)
 #include "cifsglob.h"
 #include "cifsproto.h"
 #include "cifs_debug.h"
-#include "smb2pdu.h"
 #include "smb2proto.h"
-#include "../common/smb2status.h"
 #include "smb2glob.h"
+#include "../common/smb2status.h"
 #include "trace.h"
 
 struct status_to_posix_error {
index 3328d6a8903808bbf18c568176125c6849988198..a16ded46b5a2673afd8940159dc748b193e8e4ff 100644 (file)
@@ -17,9 +17,9 @@
 #include <uapi/linux/magic.h>
 #include "cifsfs.h"
 #include "cifsglob.h"
-#include "smb2pdu.h"
-#include "smb2proto.h"
 #include "cifsproto.h"
+#include "smb2proto.h"
+#include "smb2pdu.h"
 #include "cifs_debug.h"
 #include "cifs_unicode.h"
 #include "../common/smb2status.h"
index 7d041dc168247aaa58662ff47730c9d5c891133c..bff39a5f39b0fc95987ba87b3c26d0e38dd5632e 100644 (file)
@@ -26,8 +26,8 @@
 #include <linux/netfs.h>
 #include <trace/events/netfs.h>
 #include "cifsglob.h"
-#include "cifsacl.h"
 #include "cifsproto.h"
+#include "cifsacl.h"
 #include "smb2proto.h"
 #include "cifs_unicode.h"
 #include "cifs_debug.h"
@@ -3949,7 +3949,8 @@ int SMB2_query_info(const unsigned int xid, struct cifs_tcon *tcon,
 /* currently unused, as now we are doing compounding instead (see smb311_posix_query_path_info) */
 int
 SMB311_posix_query_info(const unsigned int xid, struct cifs_tcon *tcon,
-               u64 persistent_fid, u64 volatile_fid, struct smb311_posix_qinfo *data, u32 *plen)
+                       u64 persistent_fid, u64 volatile_fid,
+                       struct smb311_posix_qinfo *data, u32 *plen)
 {
        size_t output_len = sizeof(struct smb311_posix_qinfo *) +
                        (sizeof(struct smb_sid) * 2) + (PATH_MAX * 2);
index 441df217c7969560f56c42398ee5f344faad0ab6..152e888512aaf228d0b6e513320ae662ceb8f8a7 100644 (file)
@@ -9,8 +9,10 @@
  */
 #ifndef _SMB2PROTO_H
 #define _SMB2PROTO_H
+
 #include <linux/nls.h>
 #include <linux/key-type.h>
+#include "cached_dir.h"
 
 struct statfs;
 struct smb_rqst;