Commit c4aca0c09f80ca40dbcecb2370af9594fbe9051d

Authored by Shirish Pargaonkar
Committed by Steve French
1 parent f14bcf71d1

cifs: Change key name to cifs.idmap, misc. clean-up

Change idmap key name from cifs.cifs_idmap to cifs.idmap.
Removed unused structure wksidarr and function match_sid().
Handle errors correctly in function init_cifs().

Signed-off-by: Shirish Pargaonkar <shirishpargaonkar@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Steve French <sfrench@us.ibm.com>

Showing 3 changed files with 6 additions and 62 deletions Side-by-side Diff

... ... @@ -33,18 +33,6 @@
33 33 #include "cifsproto.h"
34 34 #include "cifs_debug.h"
35 35  
36   -
37   -static struct cifs_wksid wksidarr[NUM_WK_SIDS] = {
38   - {{1, 0, {0, 0, 0, 0, 0, 0}, {0, 0, 0, 0, 0} }, "null user"},
39   - {{1, 1, {0, 0, 0, 0, 0, 1}, {0, 0, 0, 0, 0} }, "nobody"},
40   - {{1, 1, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(11), 0, 0, 0, 0} }, "net-users"},
41   - {{1, 1, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(18), 0, 0, 0, 0} }, "sys"},
42   - {{1, 2, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(32), __constant_cpu_to_le32(544), 0, 0, 0} }, "root"},
43   - {{1, 2, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(32), __constant_cpu_to_le32(545), 0, 0, 0} }, "users"},
44   - {{1, 2, {0, 0, 0, 0, 0, 5}, {__constant_cpu_to_le32(32), __constant_cpu_to_le32(546), 0, 0, 0} }, "guest"} }
45   -;
46   -
47   -
48 36 /* security id for everyone/world system group */
49 37 static const struct cifs_sid sid_everyone = {
50 38 1, 1, {0, 0, 0, 0, 0, 1}, {0} };
... ... @@ -131,7 +119,7 @@
131 119 }
132 120  
133 121 struct key_type cifs_idmap_key_type = {
134   - .name = "cifs.cifs_idmap",
  122 + .name = "cifs.idmap",
135 123 .instantiate = cifs_idmap_key_instantiate,
136 124 .destroy = cifs_idmap_key_destroy,
137 125 .describe = user_describe,
... ... @@ -433,51 +421,6 @@
433 421 while ((node = rb_first(root)))
434 422 rb_erase(node, root);
435 423 spin_unlock(&sidgidlock);
436   -}
437   -
438   -int match_sid(struct cifs_sid *ctsid)
439   -{
440   - int i, j;
441   - int num_subauth, num_sat, num_saw;
442   - struct cifs_sid *cwsid;
443   -
444   - if (!ctsid)
445   - return -1;
446   -
447   - for (i = 0; i < NUM_WK_SIDS; ++i) {
448   - cwsid = &(wksidarr[i].cifssid);
449   -
450   - /* compare the revision */
451   - if (ctsid->revision != cwsid->revision)
452   - continue;
453   -
454   - /* compare all of the six auth values */
455   - for (j = 0; j < 6; ++j) {
456   - if (ctsid->authority[j] != cwsid->authority[j])
457   - break;
458   - }
459   - if (j < 6)
460   - continue; /* all of the auth values did not match */
461   -
462   - /* compare all of the subauth values if any */
463   - num_sat = ctsid->num_subauth;
464   - num_saw = cwsid->num_subauth;
465   - num_subauth = num_sat < num_saw ? num_sat : num_saw;
466   - if (num_subauth) {
467   - for (j = 0; j < num_subauth; ++j) {
468   - if (ctsid->sub_auth[j] != cwsid->sub_auth[j])
469   - break;
470   - }
471   - if (j < num_subauth)
472   - continue; /* all sub_auth values do not match */
473   - }
474   -
475   - cFYI(1, "matching sid: %s\n", wksidarr[i].sidname);
476   - return 0; /* sids compare/match */
477   - }
478   -
479   - cFYI(1, "No matching sid");
480   - return -1;
481 424 }
482 425  
483 426 /* if the two SIDs (roughly equivalent to a UUID for a user or group) are
... ... @@ -98,7 +98,6 @@
98 98 extern const struct cred *root_cred;
99 99 #endif /* KERNEL */
100 100  
101   -extern int match_sid(struct cifs_sid *);
102 101 extern int compare_sids(const struct cifs_sid *, const struct cifs_sid *);
103 102  
104 103 #endif /* _CIFSACL_H */
... ... @@ -1046,21 +1046,23 @@
1046 1046 #ifdef CONFIG_CIFS_ACL
1047 1047 rc = init_cifs_idmap();
1048 1048 if (rc)
1049   - goto out_destroy_request_bufs;
  1049 + goto out_register_key_type;
1050 1050 #endif /* CONFIG_CIFS_ACL */
1051 1051  
1052 1052 rc = register_filesystem(&cifs_fs_type);
1053 1053 if (rc)
1054   - goto out_destroy_request_bufs;
  1054 + goto out_init_cifs_idmap;
1055 1055  
1056 1056 return 0;
1057 1057  
1058   -out_destroy_request_bufs:
  1058 +out_init_cifs_idmap:
1059 1059 #ifdef CONFIG_CIFS_ACL
1060 1060 exit_cifs_idmap();
  1061 +out_register_key_type:
1061 1062 #endif
1062 1063 #ifdef CONFIG_CIFS_UPCALL
1063 1064 unregister_key_type(&cifs_spnego_key_type);
  1065 +out_destroy_request_bufs:
1064 1066 #endif
1065 1067 cifs_destroy_request_bufs();
1066 1068 out_destroy_mids: