Skip to contentSkip to conversation

net: sunrpc: fixed function and extra line coding styles

PATCH In review namratajanawade 2 participants 2 messages Mar 16, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: sunrpc: fixed function and extra line coding styles

Block comments written in format suggested by checkpatch.pl.
Removed trailing semicolon in macros definition as macros should not use a trailing semicolon. Open braces shifted to new line (as suggested by checkpatch.pl).

---
 net/sunrpc/auth.c | 36 ++++++++++++++----------------------
 1 file changed, 14 insertions(+), 22 deletions(-)
net/sunrpc/auth.c +14 -22
index a9f0d17fdb0d..6ef9481a0d2d 100644
@@ -45,8 +45,7 @@ static struct cred machine_cred = {
 #endif
 };
 
-/*
- * Return the machine_cred pointer to be used whenever
+/* Return the machine_cred pointer to be used whenever
  * the a generic machine credential is needed.
  */
 const struct cred *rpc_machine_cred(void)
@@ -84,7 +83,7 @@ static int param_get_hashtbl_sz(char *buffer, const struct kernel_param *kp)
 	return sprintf(buffer, "%u\n", 1U << nbits);
 }
 
-#define param_check_hashtbl_sz(name, p) __param_check(name, p, unsigned int);
+#define param_check_hashtbl_sz(name, p) __param_check(name, p, unsigned int)
 
 static const struct kernel_param_ops param_ops_hashtbl_sz = {
 	.set = param_set_hashtbl_sz,
@@ -99,7 +98,8 @@ module_param(auth_max_cred_cachesize, ulong, 0644);
 MODULE_PARM_DESC(auth_max_cred_cachesize, "RPC credential maximum total cache size");
 
 static u32
-pseudoflavor_to_flavor(u32 flavor) {
+pseudoflavor_to_flavor(u32 flavor) 
+{
 	if (flavor > RPC_AUTH_MAXFLAVOR)
 		return RPC_AUTH_GSS;
 	return flavor;
@@ -256,8 +256,7 @@ rpcauth_release(struct rpc_auth *auth)
 
 static DEFINE_SPINLOCK(rpc_credcache_lock);
 
-/*
- * On success, the caller is responsible for freeing the reference
+/* On success, the caller is responsible for freeing the reference
  * held by the hashtable
  */
 static bool
@@ -284,8 +283,7 @@ rpcauth_unhash_cred(struct rpc_cred *cred)
 	return ret;
 }
 
-/*
- * Initialize RPC credential cache
+/* Initialize RPC credential cache
  */
 int
 rpcauth_init_credcache(struct rpc_auth *auth)
@@ -320,8 +318,7 @@ rpcauth_stringify_acceptor(struct rpc_cred *cred)
 }
 EXPORT_SYMBOL_GPL(rpcauth_stringify_acceptor);
 
-/*
- * Destroy a list of credentials
+/* Destroy a list of credentials
  */
 static inline
 void rpcauth_destroy_credlist(struct list_head *head)
@@ -373,8 +370,7 @@ rpcauth_lru_remove(struct rpc_cred *cred)
 	spin_unlock(&rpc_credcache_lock);
 }
 
-/*
- * Clear the RPC credential cache, and delete those credentials
+/* Clear the RPC credential cache, and delete those credentials
  * that are not referenced.
  */
 void
@@ -403,8 +399,7 @@ rpcauth_clear_credcache(struct rpc_cred_cache *cache)
 	rpcauth_destroy_credlist(&free);
 }
 
-/*
- * Destroy the RPC credential cache
+/* Destroy the RPC credential cache
  */
 void
 rpcauth_destroy_credcache(struct rpc_auth *auth)
@@ -423,8 +418,7 @@ EXPORT_SYMBOL_GPL(rpcauth_destroy_credcache);
 
 #define RPC_AUTH_EXPIRY_MORATORIUM (60 * HZ)
 
-/*
- * Remove stale credentials. Avoid sleeping inside the loop.
+/* Remove stale credentials. Avoid sleeping inside the loop.
  */
 static long
 rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
@@ -441,8 +435,7 @@ rpcauth_prune_expired(struct list_head *free, int nr_to_scan)
 			rpcauth_lru_remove_locked(cred);
 			continue;
 		}
-		/*
-		 * Enforce a 60 second garbage collection moratorium
+		/* Enforce a 60 second garbage collection moratorium
 		 * Note that the cred_unused list must be time-ordered.
 		 */
 		if (!time_in_range(cred->cr_expire, expired, jiffies))
@@ -471,8 +464,7 @@ rpcauth_cache_do_shrink(int nr_to_scan)
 	return freed;
 }
 
-/*
- * Run memory cache shrinker.
+/* Run memory cache shrinker.
  */
 static unsigned long
 rpcauth_cache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
@@ -510,8 +502,7 @@ rpcauth_cache_enforce_limit(void)
 	rpcauth_cache_do_shrink(nr_to_scan);
 }
 
-/*
- * Look up a process' credentials in the authentication cache
+/* Look up a process' credentials in the authentication cache
  */
 struct rpc_cred *
 rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
@@ -566,6 +557,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,
 	    cred->cr_ops->cr_init != NULL &&
 	    !(flags & RPCAUTH_LOOKUP_NEW)) {
 		int res = cred->cr_ops->cr_init(auth, cred);
+
 		if (res < 0) {
 			put_rpccred(cred);
 			cred = ERR_PTR(res);
Signature · 1 line
2.25.1
#1 lore raw
Quoted 145 lines · namratajanawade

Block comments written in format suggested by checkpatch.pl. Removed trailing semicolon in macros definition as macros should not use a trailing semicolon.
Open braces shifted to new line (as suggested by checkpatch.pl).

---
 net/sunrpc/auth.c | 36 ++++++++++++++----------------------

 1 file changed, 14 insertions(+), 22 deletions(-)
net/sunrpc/auth.c +0 -0
index a9f0d17fdb0d..6ef9481a0d2d 100644
@@ -45,8 +45,7 @@ static struct cred machine_cred = {
  #endif
  };

net/sunrpc/auth.c +1 -2
-/*
- * Return the machine_cred pointer to be used whenever
+/* Return the machine_cred pointer to be used whenever

  * the a generic machine credential is needed.
  */
 const struct cred *rpc_machine_cred(void)

net/sunrpc/auth.c +0 -0
@@ -84,7 +83,7 @@ static int param_get_hashtbl_sz(char *buffer, const
 struct kernel_param *kp)
         return sprintf(buffer, "%u\n", 1U << nbits);
  }


-#define param_check_hashtbl_sz(name, p) __param_check(name, p, unsigned int);
+#define param_check_hashtbl_sz(name, p) __param_check(name, p, unsigned int)

 static const struct kernel_param_ops param_ops_hashtbl_sz = { .set = param_set_hashtbl_sz,

net/sunrpc/auth.c +0 -0
@@ -99,7 +98,8 @@ module_param(auth_max_cred_cachesize, ulong, 0644);

 MODULE_PARM_DESC(auth_max_cred_cachesize, "RPC credential maximum total cache size");

 static u32

net/sunrpc/auth.c +2 -1
-pseudoflavor_to_flavor(u32 flavor) {
+pseudoflavor_to_flavor(u32 flavor) 
+{

        if (flavor > RPC_AUTH_MAXFLAVOR)
                return RPC_AUTH_GSS;
        return flavor;

net/sunrpc/auth.c +0 -0
@@ -256,8 +256,7 @@ rpcauth_release(struct rpc_auth *auth)


 static DEFINE_SPINLOCK(rpc_credcache_lock);

net/sunrpc/auth.c +1 -2
-/*
- * On success, the caller is responsible for freeing the reference
+/* On success, the caller is responsible for freeing the reference

  * held by the hashtable
  */
 static bool

net/sunrpc/auth.c +0 -0
@@ -284,8 +283,7 @@ rpcauth_unhash_cred(struct rpc_cred *cred)
         return ret;
  }

net/sunrpc/auth.c +1 -2
-/*
- * Initialize RPC credential cache
+/* Initialize RPC credential cache

  */
 int
 rpcauth_init_credcache(struct rpc_auth *auth)

net/sunrpc/auth.c +0 -0
@@ -320,8 +318,7 @@ rpcauth_stringify_acceptor(struct rpc_cred *cred)
  }
  EXPORT_SYMBOL_GPL(rpcauth_stringify_acceptor);

net/sunrpc/auth.c +1 -2
-/*
- * Destroy a list of credentials
+/* Destroy a list of credentials

  */
 static inline
 void rpcauth_destroy_credlist(struct list_head *head)

net/sunrpc/auth.c +0 -0
@@ -373,8 +370,7 @@ rpcauth_lru_remove(struct rpc_cred *cred)
         spin_unlock(&rpc_credcache_lock);
  }

net/sunrpc/auth.c +1 -2
-/*
- * Clear the RPC credential cache, and delete those credentials
+/* Clear the RPC credential cache, and delete those credentials

  * that are not referenced.
  */
 void

net/sunrpc/auth.c +0 -0
@@ -403,8 +399,7 @@ rpcauth_clear_credcache(struct rpc_cred_cache
 *cache)
         rpcauth_destroy_credlist(&free);
  }

net/sunrpc/auth.c +1 -2
-/*
- * Destroy the RPC credential cache
+/* Destroy the RPC credential cache

  */
 void
 rpcauth_destroy_credcache(struct rpc_auth *auth)

net/sunrpc/auth.c +0 -0
@@ -423,8 +418,7 @@ EXPORT_SYMBOL_GPL(rpcauth_destroy_credcache);


 #define RPC_AUTH_EXPIRY_MORATORIUM (60 * HZ)

net/sunrpc/auth.c +1 -2
-/*
- * Remove stale credentials. Avoid sleeping inside the loop.
+/* Remove stale credentials. Avoid sleeping inside the loop.

  */
 static long
 rpcauth_prune_expired(struct list_head *free, int nr_to_scan)

net/sunrpc/auth.c +1 -2
@@ -441,8 +435,7 @@ rpcauth_prune_expired(struct list_head *free, int
 nr_to_scan)
                         rpcauth_lru_remove_locked(cred);
                         continue;
                 }
-               /*
-                * Enforce a 60 second garbage collection moratorium
+               /* Enforce a 60 second garbage collection moratorium
                  * Note that the cred_unused list must be time-

ordered.
                 */
                if (!time_in_range(cred->cr_expire, expired, jiffies))

net/sunrpc/auth.c +0 -0
@@ -471,8 +464,7 @@ rpcauth_cache_do_shrink(int nr_to_scan)
         return freed;
  }

net/sunrpc/auth.c +1 -2
-/*
- * Run memory cache shrinker.
+/* Run memory cache shrinker.

  */
 static unsigned long rpcauth_cache_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)

net/sunrpc/auth.c +0 -0
@@ -510,8 +502,7 @@ rpcauth_cache_enforce_limit(void)
         rpcauth_cache_do_shrink(nr_to_scan);
  }

net/sunrpc/auth.c +1 -2
-/*
- * Look up a process' credentials in the authentication cache
+/* Look up a process' credentials in the authentication cache

  */
 struct rpc_cred *
 rpcauth_lookup_credcache(struct rpc_auth *auth, struct auth_cred * acred,

net/sunrpc/auth.c +0 -0
@@ -566,6 +557,7 @@ rpcauth_lookup_credcache(struct rpc_auth *auth,
 struct auth_cred * acred,
Quoted 7 lines

            cred->cr_ops->cr_init != NULL && !(flags & RPCAUTH_LOOKUP_NEW)) {
                int res = cred->cr_ops->cr_init(auth, cred); +
                if (res < 0) {
                        put_rpccred(cred);
                        cred = ERR_PTR(res);

NACK. This is not consistent with the preferred style for NFS and SUNRPC (or the preferred style in Documentation/process/coding- style.rst).

Signature · 3 lines
Trond Myklebust
Linux NFS client maintainer, Hammerspace
[email protected]