Skip to content

Commit ccdb8ac

Browse files
ChenXiaoSongSasha Levin
authored andcommitted
smb/client: rename cifs_sid to smb_sid
[ Upstream commit 7f599d8 ] Preparation for moving acl definitions to new common header file. Use the following shell command to rename: find fs/smb/client -type f -exec sed -i \ 's/struct cifs_sid/struct smb_sid/g' {} + Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Reviewed-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com> Stable-dep-of: d413eab ("fs/smb/client: implement chmod() for SMB3 POSIX Extensions") Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent f9e3009 commit ccdb8ac

File tree

7 files changed

+63
-63
lines changed

7 files changed

+63
-63
lines changed

fs/smb/client/cifsacl.c

Lines changed: 48 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,18 @@
2727
#include "cifs_unicode.h"
2828

2929
/* security id for everyone/world system group */
30-
static const struct cifs_sid sid_everyone = {
30+
static const struct smb_sid sid_everyone = {
3131
1, 1, {0, 0, 0, 0, 0, 1}, {0} };
3232
/* security id for Authenticated Users system group */
33-
static const struct cifs_sid sid_authusers = {
33+
static const struct smb_sid sid_authusers = {
3434
1, 1, {0, 0, 0, 0, 0, 5}, {cpu_to_le32(11)} };
3535

3636
/* S-1-22-1 Unmapped Unix users */
37-
static const struct cifs_sid sid_unix_users = {1, 1, {0, 0, 0, 0, 0, 22},
37+
static const struct smb_sid sid_unix_users = {1, 1, {0, 0, 0, 0, 0, 22},
3838
{cpu_to_le32(1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
3939

4040
/* S-1-22-2 Unmapped Unix groups */
41-
static const struct cifs_sid sid_unix_groups = { 1, 1, {0, 0, 0, 0, 0, 22},
41+
static const struct smb_sid sid_unix_groups = { 1, 1, {0, 0, 0, 0, 0, 22},
4242
{cpu_to_le32(2), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
4343

4444
/*
@@ -48,17 +48,17 @@ static const struct cifs_sid sid_unix_groups = { 1, 1, {0, 0, 0, 0, 0, 22},
4848
/* S-1-5-88 MS NFS and Apple style UID/GID/mode */
4949

5050
/* S-1-5-88-1 Unix uid */
51-
static const struct cifs_sid sid_unix_NFS_users = { 1, 2, {0, 0, 0, 0, 0, 5},
51+
static const struct smb_sid sid_unix_NFS_users = { 1, 2, {0, 0, 0, 0, 0, 5},
5252
{cpu_to_le32(88),
5353
cpu_to_le32(1), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
5454

5555
/* S-1-5-88-2 Unix gid */
56-
static const struct cifs_sid sid_unix_NFS_groups = { 1, 2, {0, 0, 0, 0, 0, 5},
56+
static const struct smb_sid sid_unix_NFS_groups = { 1, 2, {0, 0, 0, 0, 0, 5},
5757
{cpu_to_le32(88),
5858
cpu_to_le32(2), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
5959

6060
/* S-1-5-88-3 Unix mode */
61-
static const struct cifs_sid sid_unix_NFS_mode = { 1, 2, {0, 0, 0, 0, 0, 5},
61+
static const struct smb_sid sid_unix_NFS_mode = { 1, 2, {0, 0, 0, 0, 0, 5},
6262
{cpu_to_le32(88),
6363
cpu_to_le32(3), 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0} };
6464

@@ -106,7 +106,7 @@ static struct key_type cifs_idmap_key_type = {
106106
};
107107

108108
static char *
109-
sid_to_key_str(struct cifs_sid *sidptr, unsigned int type)
109+
sid_to_key_str(struct smb_sid *sidptr, unsigned int type)
110110
{
111111
int i, len;
112112
unsigned int saval;
@@ -158,7 +158,7 @@ sid_to_key_str(struct cifs_sid *sidptr, unsigned int type)
158158
* the same returns zero, if they do not match returns non-zero.
159159
*/
160160
static int
161-
compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
161+
compare_sids(const struct smb_sid *ctsid, const struct smb_sid *cwsid)
162162
{
163163
int i;
164164
int num_subauth, num_sat, num_saw;
@@ -204,11 +204,11 @@ compare_sids(const struct cifs_sid *ctsid, const struct cifs_sid *cwsid)
204204
}
205205

206206
static bool
207-
is_well_known_sid(const struct cifs_sid *psid, uint32_t *puid, bool is_group)
207+
is_well_known_sid(const struct smb_sid *psid, uint32_t *puid, bool is_group)
208208
{
209209
int i;
210210
int num_subauth;
211-
const struct cifs_sid *pwell_known_sid;
211+
const struct smb_sid *pwell_known_sid;
212212

213213
if (!psid || (puid == NULL))
214214
return false;
@@ -260,7 +260,7 @@ is_well_known_sid(const struct cifs_sid *psid, uint32_t *puid, bool is_group)
260260
}
261261

262262
static __u16
263-
cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
263+
cifs_copy_sid(struct smb_sid *dst, const struct smb_sid *src)
264264
{
265265
int i;
266266
__u16 size = 1 + 1 + 6;
@@ -277,11 +277,11 @@ cifs_copy_sid(struct cifs_sid *dst, const struct cifs_sid *src)
277277
}
278278

279279
static int
280-
id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid)
280+
id_to_sid(unsigned int cid, uint sidtype, struct smb_sid *ssid)
281281
{
282282
int rc;
283283
struct key *sidkey;
284-
struct cifs_sid *ksid;
284+
struct smb_sid *ksid;
285285
unsigned int ksid_size;
286286
char desc[3 + 10 + 1]; /* 3 byte prefix + 10 bytes for value + NULL */
287287
const struct cred *saved_cred;
@@ -312,8 +312,8 @@ id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid)
312312
* it could be.
313313
*/
314314
ksid = sidkey->datalen <= sizeof(sidkey->payload) ?
315-
(struct cifs_sid *)&sidkey->payload :
316-
(struct cifs_sid *)sidkey->payload.data[0];
315+
(struct smb_sid *)&sidkey->payload :
316+
(struct smb_sid *)sidkey->payload.data[0];
317317

318318
ksid_size = CIFS_SID_BASE_SIZE + (ksid->num_subauth * sizeof(__le32));
319319
if (ksid_size > sidkey->datalen) {
@@ -336,7 +336,7 @@ id_to_sid(unsigned int cid, uint sidtype, struct cifs_sid *ssid)
336336
}
337337

338338
int
339-
sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
339+
sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
340340
struct cifs_fattr *fattr, uint sidtype)
341341
{
342342
int rc = 0;
@@ -518,40 +518,40 @@ exit_cifs_idmap(void)
518518
static __u32 copy_sec_desc(const struct smb_ntsd *pntsd,
519519
struct smb_ntsd *pnntsd,
520520
__u32 sidsoffset,
521-
struct cifs_sid *pownersid,
522-
struct cifs_sid *pgrpsid)
521+
struct smb_sid *pownersid,
522+
struct smb_sid *pgrpsid)
523523
{
524-
struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
525-
struct cifs_sid *nowner_sid_ptr, *ngroup_sid_ptr;
524+
struct smb_sid *owner_sid_ptr, *group_sid_ptr;
525+
struct smb_sid *nowner_sid_ptr, *ngroup_sid_ptr;
526526

527527
/* copy security descriptor control portion */
528528
pnntsd->revision = pntsd->revision;
529529
pnntsd->type = pntsd->type;
530530
pnntsd->dacloffset = cpu_to_le32(sizeof(struct smb_ntsd));
531531
pnntsd->sacloffset = 0;
532532
pnntsd->osidoffset = cpu_to_le32(sidsoffset);
533-
pnntsd->gsidoffset = cpu_to_le32(sidsoffset + sizeof(struct cifs_sid));
533+
pnntsd->gsidoffset = cpu_to_le32(sidsoffset + sizeof(struct smb_sid));
534534

535535
/* copy owner sid */
536536
if (pownersid)
537537
owner_sid_ptr = pownersid;
538538
else
539-
owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
539+
owner_sid_ptr = (struct smb_sid *)((char *)pntsd +
540540
le32_to_cpu(pntsd->osidoffset));
541-
nowner_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset);
541+
nowner_sid_ptr = (struct smb_sid *)((char *)pnntsd + sidsoffset);
542542
cifs_copy_sid(nowner_sid_ptr, owner_sid_ptr);
543543

544544
/* copy group sid */
545545
if (pgrpsid)
546546
group_sid_ptr = pgrpsid;
547547
else
548-
group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
548+
group_sid_ptr = (struct smb_sid *)((char *)pntsd +
549549
le32_to_cpu(pntsd->gsidoffset));
550-
ngroup_sid_ptr = (struct cifs_sid *)((char *)pnntsd + sidsoffset +
551-
sizeof(struct cifs_sid));
550+
ngroup_sid_ptr = (struct smb_sid *)((char *)pnntsd + sidsoffset +
551+
sizeof(struct smb_sid));
552552
cifs_copy_sid(ngroup_sid_ptr, group_sid_ptr);
553553

554-
return sidsoffset + (2 * sizeof(struct cifs_sid));
554+
return sidsoffset + (2 * sizeof(struct smb_sid));
555555
}
556556

557557

@@ -666,7 +666,7 @@ static void mode_to_access_flags(umode_t mode, umode_t bits_to_use,
666666
return;
667667
}
668668

669-
static __u16 cifs_copy_ace(struct cifs_ace *dst, struct cifs_ace *src, struct cifs_sid *psid)
669+
static __u16 cifs_copy_ace(struct cifs_ace *dst, struct cifs_ace *src, struct smb_sid *psid)
670670
{
671671
__u16 size = 1 + 1 + 2 + 4;
672672

@@ -686,7 +686,7 @@ static __u16 cifs_copy_ace(struct cifs_ace *dst, struct cifs_ace *src, struct ci
686686
}
687687

688688
static __u16 fill_ace_for_sid(struct cifs_ace *pntace,
689-
const struct cifs_sid *psid, __u64 nmode,
689+
const struct smb_sid *psid, __u64 nmode,
690690
umode_t bits, __u8 access_type,
691691
bool allow_delete_child)
692692
{
@@ -759,7 +759,7 @@ static void dump_ace(struct cifs_ace *pace, char *end_of_acl)
759759
#endif
760760

761761
static void parse_dacl(struct cifs_acl *pdacl, char *end_of_acl,
762-
struct cifs_sid *pownersid, struct cifs_sid *pgrpsid,
762+
struct smb_sid *pownersid, struct smb_sid *pgrpsid,
763763
struct cifs_fattr *fattr, bool mode_from_special_sid)
764764
{
765765
int i;
@@ -930,8 +930,8 @@ unsigned int setup_special_user_owner_ACE(struct cifs_ace *pntace)
930930
}
931931

932932
static void populate_new_aces(char *nacl_base,
933-
struct cifs_sid *pownersid,
934-
struct cifs_sid *pgrpsid,
933+
struct smb_sid *pownersid,
934+
struct smb_sid *pgrpsid,
935935
__u64 *pnmode, u32 *pnum_aces, u16 *pnsize,
936936
bool modefromsid)
937937
{
@@ -967,7 +967,7 @@ static void populate_new_aces(char *nacl_base,
967967
* updated in the inode.
968968
*/
969969

970-
if (!memcmp(pownersid, pgrpsid, sizeof(struct cifs_sid))) {
970+
if (!memcmp(pownersid, pgrpsid, sizeof(struct smb_sid))) {
971971
/*
972972
* Case when owner and group SIDs are the same.
973973
* Set the more restrictive of the two modes.
@@ -1035,8 +1035,8 @@ static void populate_new_aces(char *nacl_base,
10351035
}
10361036

10371037
static __u16 replace_sids_and_copy_aces(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
1038-
struct cifs_sid *pownersid, struct cifs_sid *pgrpsid,
1039-
struct cifs_sid *pnownersid, struct cifs_sid *pngrpsid)
1038+
struct smb_sid *pownersid, struct smb_sid *pgrpsid,
1039+
struct smb_sid *pnownersid, struct smb_sid *pngrpsid)
10401040
{
10411041
int i;
10421042
u16 size = 0;
@@ -1075,7 +1075,7 @@ static __u16 replace_sids_and_copy_aces(struct cifs_acl *pdacl, struct cifs_acl
10751075
}
10761076

10771077
static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
1078-
struct cifs_sid *pownersid, struct cifs_sid *pgrpsid,
1078+
struct smb_sid *pownersid, struct smb_sid *pgrpsid,
10791079
__u64 *pnmode, bool mode_from_sid)
10801080
{
10811081
int i;
@@ -1156,7 +1156,7 @@ static int set_chmod_dacl(struct cifs_acl *pdacl, struct cifs_acl *pndacl,
11561156
return 0;
11571157
}
11581158

1159-
static int parse_sid(struct cifs_sid *psid, char *end_of_acl)
1159+
static int parse_sid(struct smb_sid *psid, char *end_of_acl)
11601160
{
11611161
/* BB need to add parm so we can store the SID BB */
11621162

@@ -1195,17 +1195,17 @@ static int parse_sec_desc(struct cifs_sb_info *cifs_sb,
11951195
bool get_mode_from_special_sid)
11961196
{
11971197
int rc = 0;
1198-
struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
1198+
struct smb_sid *owner_sid_ptr, *group_sid_ptr;
11991199
struct cifs_acl *dacl_ptr; /* no need for SACL ptr */
12001200
char *end_of_acl = ((char *)pntsd) + acl_len;
12011201
__u32 dacloffset;
12021202

12031203
if (pntsd == NULL)
12041204
return -EIO;
12051205

1206-
owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
1206+
owner_sid_ptr = (struct smb_sid *)((char *)pntsd +
12071207
le32_to_cpu(pntsd->osidoffset));
1208-
group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
1208+
group_sid_ptr = (struct smb_sid *)((char *)pntsd +
12091209
le32_to_cpu(pntsd->gsidoffset));
12101210
dacloffset = le32_to_cpu(pntsd->dacloffset);
12111211
dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset);
@@ -1257,8 +1257,8 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
12571257
__u32 dacloffset;
12581258
__u32 ndacloffset;
12591259
__u32 sidsoffset;
1260-
struct cifs_sid *owner_sid_ptr, *group_sid_ptr;
1261-
struct cifs_sid *nowner_sid_ptr = NULL, *ngroup_sid_ptr = NULL;
1260+
struct smb_sid *owner_sid_ptr, *group_sid_ptr;
1261+
struct smb_sid *nowner_sid_ptr = NULL, *ngroup_sid_ptr = NULL;
12621262
struct cifs_acl *dacl_ptr = NULL; /* no need for SACL ptr */
12631263
struct cifs_acl *ndacl_ptr = NULL; /* no need for SACL ptr */
12641264
char *end_of_acl = ((char *)pntsd) + secdesclen;
@@ -1273,9 +1273,9 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
12731273
}
12741274
}
12751275

1276-
owner_sid_ptr = (struct cifs_sid *)((char *)pntsd +
1276+
owner_sid_ptr = (struct smb_sid *)((char *)pntsd +
12771277
le32_to_cpu(pntsd->osidoffset));
1278-
group_sid_ptr = (struct cifs_sid *)((char *)pntsd +
1278+
group_sid_ptr = (struct smb_sid *)((char *)pntsd +
12791279
le32_to_cpu(pntsd->gsidoffset));
12801280

12811281
if (pnmode && *pnmode != NO_CHANGE_64) { /* chmod */
@@ -1305,7 +1305,7 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
13051305

13061306
if (uid_valid(uid)) { /* chown */
13071307
uid_t id;
1308-
nowner_sid_ptr = kzalloc(sizeof(struct cifs_sid),
1308+
nowner_sid_ptr = kzalloc(sizeof(struct smb_sid),
13091309
GFP_KERNEL);
13101310
if (!nowner_sid_ptr) {
13111311
rc = -ENOMEM;
@@ -1334,7 +1334,7 @@ static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
13341334
}
13351335
if (gid_valid(gid)) { /* chgrp */
13361336
gid_t id;
1337-
ngroup_sid_ptr = kzalloc(sizeof(struct cifs_sid),
1337+
ngroup_sid_ptr = kzalloc(sizeof(struct smb_sid),
13381338
GFP_KERNEL);
13391339
if (!ngroup_sid_ptr) {
13401340
rc = -ENOMEM;
@@ -1630,7 +1630,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
16301630
nsecdesclen += 5 * sizeof(struct cifs_ace);
16311631
} else { /* chown */
16321632
/* When ownership changes, changes new owner sid length could be different */
1633-
nsecdesclen = sizeof(struct smb_ntsd) + (sizeof(struct cifs_sid) * 2);
1633+
nsecdesclen = sizeof(struct smb_ntsd) + (sizeof(struct smb_sid) * 2);
16341634
dacloffset = le32_to_cpu(pntsd->dacloffset);
16351635
if (dacloffset) {
16361636
dacl_ptr = (struct cifs_acl *)((char *)pntsd + dacloffset);

fs/smb/client/cifsacl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,14 +64,14 @@ struct smb_ntsd {
6464
__le32 dacloffset;
6565
} __attribute__((packed));
6666

67-
struct cifs_sid {
67+
struct smb_sid {
6868
__u8 revision; /* revision level */
6969
__u8 num_subauth;
7070
__u8 authority[NUM_AUTHS];
7171
__le32 sub_auth[SID_MAX_SUB_AUTHORITIES]; /* sub_auth[num_subauth] */
7272
} __attribute__((packed));
7373

74-
/* size of a struct cifs_sid, sans sub_auth array */
74+
/* size of a struct smb_sid, sans sub_auth array */
7575
#define CIFS_SID_BASE_SIZE (1 + 1 + NUM_AUTHS)
7676

7777
struct cifs_acl {
@@ -116,7 +116,7 @@ struct cifs_ace {
116116
__u8 flags;
117117
__le16 size;
118118
__le32 access_req;
119-
struct cifs_sid sid; /* ie UUID of user or group who gets these perms */
119+
struct smb_sid sid; /* ie UUID of user or group who gets these perms */
120120
} __attribute__((packed));
121121

122122
/*

fs/smb/client/cifsglob.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ struct cifs_cred {
202202
int gid;
203203
int mode;
204204
int cecount;
205-
struct cifs_sid osid;
206-
struct cifs_sid gsid;
205+
struct smb_sid osid;
206+
struct smb_sid gsid;
207207
struct cifs_ntace *ntaces;
208208
struct cifs_ace *aces;
209209
};
@@ -231,8 +231,8 @@ struct cifs_open_info_data {
231231
unsigned int eas_len;
232232
} wsl;
233233
char *symlink_target;
234-
struct cifs_sid posix_owner;
235-
struct cifs_sid posix_group;
234+
struct smb_sid posix_owner;
235+
struct smb_sid posix_group;
236236
union {
237237
struct smb2_file_all_info fi;
238238
struct smb311_posix_qinfo posix_fi;

fs/smb/client/cifsproto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ extern int cifs_set_file_info(struct inode *inode, struct iattr *attrs,
223223
extern int cifs_rename_pending_delete(const char *full_path,
224224
struct dentry *dentry,
225225
const unsigned int xid);
226-
extern int sid_to_id(struct cifs_sb_info *cifs_sb, struct cifs_sid *psid,
226+
extern int sid_to_id(struct cifs_sb_info *cifs_sb, struct smb_sid *psid,
227227
struct cifs_fattr *fattr, uint sidtype);
228228
extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
229229
struct cifs_fattr *fattr, struct inode *inode,

fs/smb/client/smb2inode.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
315315
SMB2_O_INFO_FILE, 0,
316316
sizeof(struct smb311_posix_qinfo *) +
317317
(PATH_MAX * 2) +
318-
(sizeof(struct cifs_sid) * 2), 0, NULL);
318+
(sizeof(struct smb_sid) * 2), 0, NULL);
319319
} else {
320320
rc = SMB2_query_info_init(tcon, server,
321321
&rqst[num_rqst],
@@ -325,7 +325,7 @@ static int smb2_compound_op(const unsigned int xid, struct cifs_tcon *tcon,
325325
SMB2_O_INFO_FILE, 0,
326326
sizeof(struct smb311_posix_qinfo *) +
327327
(PATH_MAX * 2) +
328-
(sizeof(struct cifs_sid) * 2), 0, NULL);
328+
(sizeof(struct smb_sid) * 2), 0, NULL);
329329
}
330330
if (!rc && (!cfile || num_rqst > 1)) {
331331
smb2_set_next_command(tcon, &rqst[num_rqst]);

0 commit comments

Comments
 (0)