From: Steve Guminski Date: Mon, 31 Oct 2016 17:46:10 +0000 (-0400) Subject: LU-6210 gss: Change positional struct initializers to C99 X-Git-Tag: 2.9.53~33 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=80d5a0ed4faab5bb21bcbf856765fd804002d145 LU-6210 gss: Change positional struct initializers to C99 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 Change-Id: I87aecee88dc8c97df5f6892c08c914732d455356 Reviewed-on: https://review.whamcloud.com/23677 Tested-by: Jenkins Tested-by: Maloo Reviewed-by: John L. Hammond Reviewed-by: James Simmons Reviewed-by: Oleg Drokin --- diff --git a/lustre/ptlrpc/gss/gss_keyring.c b/lustre/ptlrpc/gss/gss_keyring.c index 6186c5f..81aad1f 100644 --- a/lustre/ptlrpc/gss/gss_keyring.c +++ b/lustre/ptlrpc/gss/gss_keyring.c @@ -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); diff --git a/lustre/ptlrpc/gss/gss_krb5_mech.c b/lustre/ptlrpc/gss/gss_krb5_mech.c index 7d7a06f..000d7a8 100644 --- a/lustre/ptlrpc/gss/gss_krb5_mech.c +++ b/lustre/ptlrpc/gss/gss_krb5_mech.c @@ -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"}, diff --git a/lustre/ptlrpc/gss/gss_null_mech.c b/lustre/ptlrpc/gss/gss_null_mech.c index 9eb0f2b..fddd3ed 100644 --- a/lustre/ptlrpc/gss/gss_null_mech.c +++ b/lustre/ptlrpc/gss/gss_null_mech.c @@ -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, diff --git a/lustre/ptlrpc/gss/gss_sk_mech.c b/lustre/ptlrpc/gss/gss_sk_mech.c index 1e83ed4..fd1b071 100644 --- a/lustre/ptlrpc/gss/gss_sk_mech.c +++ b/lustre/ptlrpc/gss/gss_sk_mech.c @@ -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,