Whamcloud - gitweb
LU-6210 gss: Change positional struct initializers to C99 77/23677/3
authorSteve Guminski <stephenx.guminski@intel.com>
Mon, 31 Oct 2016 17:46:10 +0000 (13:46 -0400)
committerOleg Drokin <oleg.drokin@intel.com>
Tue, 31 Jan 2017 04:10:19 +0000 (04:10 +0000)
This patch makes no functional changes.  Struct initializers in the
gss directory that use C89 or GCC-only syntax are updated to C99
syntax.  Whitespace is changed to match the coding style guidelines.

The C99 syntax prevents incorrect initialization if values are
accidently placed in the wrong position, allows changes in the struct
definition, and clears any members that are not given an explicit
value.

The following struct initializers have been updated:

lustre/ptlrpc/gss/gss_keyring.c:
struct vfs_cred vcred (2 occurrences)
lustre/ptlrpc/gss/gss_krb5_mech.c:
static struct krb5_enctype enctypes[]
lustre/ptlrpc/gss/gss_sk_mech.c:
static struct gss_api_mech gss_sk_mech

Test-Parameters: trivial
Signed-off-by: Steve Guminski <stephenx.guminski@intel.com>
Change-Id: I87aecee88dc8c97df5f6892c08c914732d455356
Reviewed-on: https://review.whamcloud.com/23677
Tested-by: Jenkins
Tested-by: Maloo <hpdd-maloo@intel.com>
Reviewed-by: John L. Hammond <john.hammond@intel.com>
Reviewed-by: James Simmons <uja.ornl@yahoo.com>
Reviewed-by: Oleg Drokin <oleg.drokin@intel.com>
lustre/ptlrpc/gss/gss_keyring.c
lustre/ptlrpc/gss/gss_krb5_mech.c
lustre/ptlrpc/gss/gss_null_mech.c
lustre/ptlrpc/gss/gss_sk_mech.c

index 6186c5f..81aad1f 100644 (file)
@@ -1165,11 +1165,11 @@ void gss_cli_ctx_die_kr(struct ptlrpc_cli_ctx *ctx, int grace)
 
 static
 int sec_install_rctx_kr(struct ptlrpc_sec *sec,
-                        struct ptlrpc_svc_ctx *svc_ctx)
+                       struct ptlrpc_svc_ctx *svc_ctx)
 {
-        struct ptlrpc_cli_ctx   *cli_ctx;
-        struct vfs_cred          vcred = { 0, 0 };
-        int                      rc;
+       struct ptlrpc_cli_ctx *cli_ctx;
+       struct vfs_cred vcred = { .vc_uid = 0 };
+       int rc;
 
         LASSERT(sec);
         LASSERT(svc_ctx);
@@ -1197,13 +1197,13 @@ int sec_install_rctx_kr(struct ptlrpc_sec *sec,
 
 static
 int sec_install_rctx_kr(struct ptlrpc_sec *sec,
-                        struct ptlrpc_svc_ctx *svc_ctx)
+                       struct ptlrpc_svc_ctx *svc_ctx)
 {
-        struct ptlrpc_cli_ctx   *cli_ctx = NULL;
-        struct key              *key;
-        struct vfs_cred          vcred = { 0, 0 };
-        char                     desc[64];
-        int                      rc;
+       struct ptlrpc_cli_ctx *cli_ctx = NULL;
+       struct key *key;
+       struct vfs_cred vcred = { .vc_uid = 0 };
+       char desc[64];
+       int rc;
 
         LASSERT(sec);
         LASSERT(svc_ctx);
index 7d7a06f..000d7a8 100644 (file)
@@ -88,51 +88,45 @@ struct krb5_enctype {
  * yet. this need to be fixed in the future.
  */
 static struct krb5_enctype enctypes[] = {
-        [ENCTYPE_DES_CBC_RAW] = {               /* des-cbc-md5 */
-                "des-cbc-md5",
-                "cbc(des)",
-                "md5",
-                0,
-                16,
-                8,
-                0,
-        },
-        [ENCTYPE_DES3_CBC_RAW] = {              /* des3-hmac-sha1 */
-                "des3-hmac-sha1",
-                "cbc(des3_ede)",
-                "hmac(sha1)",
-                0,
-                20,
-                8,
-                1,
-        },
-        [ENCTYPE_AES128_CTS_HMAC_SHA1_96] = {   /* aes128-cts */
-                "aes128-cts-hmac-sha1-96",
-                "cbc(aes)",
-                "hmac(sha1)",
-                0,
-                12,
-                16,
-                1,
-        },
-        [ENCTYPE_AES256_CTS_HMAC_SHA1_96] = {   /* aes256-cts */
-                "aes256-cts-hmac-sha1-96",
-                "cbc(aes)",
-                "hmac(sha1)",
-                0,
-                12,
-                16,
-                1,
-        },
-        [ENCTYPE_ARCFOUR_HMAC] = {              /* arcfour-hmac-md5 */
-                "arcfour-hmac-md5",
-                "ecb(arc4)",
-                "hmac(md5)",
-                0,
-                16,
-                8,
-                1,
-        },
+       [ENCTYPE_DES_CBC_RAW] = {               /* des-cbc-md5 */
+               .ke_dispname    = "des-cbc-md5",
+               .ke_enc_name    = "cbc(des)",
+               .ke_hash_name   = "md5",
+               .ke_hash_size   = 16,
+               .ke_conf_size   = 8,
+       },
+       [ENCTYPE_DES3_CBC_RAW] = {              /* des3-hmac-sha1 */
+               .ke_dispname    = "des3-hmac-sha1",
+               .ke_enc_name    = "cbc(des3_ede)",
+               .ke_hash_name   = "hmac(sha1)",
+               .ke_hash_size   = 20,
+               .ke_conf_size   = 8,
+               .ke_hash_hmac   = 1,
+       },
+       [ENCTYPE_AES128_CTS_HMAC_SHA1_96] = {   /* aes128-cts */
+               .ke_dispname    = "aes128-cts-hmac-sha1-96",
+               .ke_enc_name    = "cbc(aes)",
+               .ke_hash_name   = "hmac(sha1)",
+               .ke_hash_size   = 12,
+               .ke_conf_size   = 16,
+               .ke_hash_hmac   = 1,
+       },
+       [ENCTYPE_AES256_CTS_HMAC_SHA1_96] = {   /* aes256-cts */
+               .ke_dispname    = "aes256-cts-hmac-sha1-96",
+               .ke_enc_name    = "cbc(aes)",
+               .ke_hash_name   = "hmac(sha1)",
+               .ke_hash_size   = 12,
+               .ke_conf_size   = 16,
+               .ke_hash_hmac   = 1,
+       },
+       [ENCTYPE_ARCFOUR_HMAC] = {              /* arcfour-hmac-md5 */
+               .ke_dispname    = "arcfour-hmac-md5",
+               .ke_enc_name    = "ecb(arc4)",
+               .ke_hash_name   = "hmac(md5)",
+               .ke_hash_size   = 16,
+               .ke_conf_size   = 8,
+               .ke_hash_hmac   = 1,
+       }
 };
 
 #define MAX_ENCTYPES    sizeof(enctypes)/sizeof(struct krb5_enctype)
@@ -1532,11 +1526,8 @@ static struct subflavor_desc gss_kerberos_sfs[] = {
         },
 };
 
-/*
- * currently we leave module owner NULL
- */
 static struct gss_api_mech gss_kerberos_mech = {
-        .gm_owner       = NULL, /*THIS_MODULE, */
+       /* .gm_owner uses default NULL value for THIS_MODULE */
         .gm_name        = "krb5",
         .gm_oid         = (rawobj_t)
                                 {9, "\052\206\110\206\367\022\001\002\002"},
index 9eb0f2b..fddd3ed 100644 (file)
@@ -190,11 +190,8 @@ static struct subflavor_desc gss_null_sfs[] = {
        },
 };
 
-/*
- * currently we leave module owner NULL
- */
 static struct gss_api_mech gss_null_mech = {
-       .gm_owner       = NULL, /*THIS_MODULE, */
+       /* .gm_owner uses default NULL value for THIS_MODULE */
        .gm_name        = "gssnull",
        .gm_oid         = (rawobj_t) {
                12,
index 1e83ed4..fd1b071 100644 (file)
@@ -940,15 +940,12 @@ static struct subflavor_desc gss_sk_sfs[] = {
        },
 };
 
-/*
- * currently we leave module owner NULL
- */
 static struct gss_api_mech gss_sk_mech = {
-       .gm_owner       = NULL, /*THIS_MODULE, */
+       /* .gm_owner uses default NULL value for THIS_MODULE */
        .gm_name        = "sk",
        .gm_oid         = (rawobj_t) {
-               12,
-               "\053\006\001\004\001\311\146\215\126\001\000\001",
+               .len = 12,
+               .data = "\053\006\001\004\001\311\146\215\126\001\000\001",
        },
        .gm_ops         = &gss_sk_ops,
        .gm_sf_num      = 4,