Skip to content

Commit 3651487

Browse files
ChenXiaoSongsmfrench
authored andcommitted
smb/client: rename cifs_ntsd to smb_ntsd
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_ntsd/struct smb_ntsd/g' {} + Signed-off-by: ChenXiaoSong <chenxiaosong@kylinos.cn> Reviewed-by: Namjae Jeon <linkinjeon@kernel.org> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 98f7e32 commit 3651487

9 files changed

Lines changed: 49 additions & 49 deletions

File tree

fs/smb/client/cifsacl.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -515,8 +515,8 @@ exit_cifs_idmap(void)
515515
}
516516

517517
/* copy ntsd, owner sid, and group sid from a security descriptor to another */
518-
static __u32 copy_sec_desc(const struct cifs_ntsd *pntsd,
519-
struct cifs_ntsd *pnntsd,
518+
static __u32 copy_sec_desc(const struct smb_ntsd *pntsd,
519+
struct smb_ntsd *pnntsd,
520520
__u32 sidsoffset,
521521
struct cifs_sid *pownersid,
522522
struct cifs_sid *pgrpsid)
@@ -527,7 +527,7 @@ static __u32 copy_sec_desc(const struct cifs_ntsd *pntsd,
527527
/* copy security descriptor control portion */
528528
pnntsd->revision = pntsd->revision;
529529
pnntsd->type = pntsd->type;
530-
pnntsd->dacloffset = cpu_to_le32(sizeof(struct cifs_ntsd));
530+
pnntsd->dacloffset = cpu_to_le32(sizeof(struct smb_ntsd));
531531
pnntsd->sacloffset = 0;
532532
pnntsd->osidoffset = cpu_to_le32(sidsoffset);
533533
pnntsd->gsidoffset = cpu_to_le32(sidsoffset + sizeof(struct cifs_sid));
@@ -1191,7 +1191,7 @@ static int parse_sid(struct cifs_sid *psid, char *end_of_acl)
11911191

11921192
/* Convert CIFS ACL to POSIX form */
11931193
static int parse_sec_desc(struct cifs_sb_info *cifs_sb,
1194-
struct cifs_ntsd *pntsd, int acl_len, struct cifs_fattr *fattr,
1194+
struct smb_ntsd *pntsd, int acl_len, struct cifs_fattr *fattr,
11951195
bool get_mode_from_special_sid)
11961196
{
11971197
int rc = 0;
@@ -1249,7 +1249,7 @@ static int parse_sec_desc(struct cifs_sb_info *cifs_sb,
12491249
}
12501250

12511251
/* Convert permission bits from mode to equivalent CIFS ACL */
1252-
static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
1252+
static int build_sec_desc(struct smb_ntsd *pntsd, struct smb_ntsd *pnntsd,
12531253
__u32 secdesclen, __u32 *pnsecdesclen, __u64 *pnmode, kuid_t uid, kgid_t gid,
12541254
bool mode_from_sid, bool id_from_sid, int *aclflag)
12551255
{
@@ -1279,7 +1279,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
12791279
le32_to_cpu(pntsd->gsidoffset));
12801280

12811281
if (pnmode && *pnmode != NO_CHANGE_64) { /* chmod */
1282-
ndacloffset = sizeof(struct cifs_ntsd);
1282+
ndacloffset = sizeof(struct smb_ntsd);
12831283
ndacl_ptr = (struct cifs_acl *)((char *)pnntsd + ndacloffset);
12841284
ndacl_ptr->revision =
12851285
dacloffset ? dacl_ptr->revision : cpu_to_le16(ACL_REVISION);
@@ -1297,7 +1297,7 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
12971297

12981298
*aclflag |= CIFS_ACL_DACL;
12991299
} else {
1300-
ndacloffset = sizeof(struct cifs_ntsd);
1300+
ndacloffset = sizeof(struct smb_ntsd);
13011301
ndacl_ptr = (struct cifs_acl *)((char *)pnntsd + ndacloffset);
13021302
ndacl_ptr->revision =
13031303
dacloffset ? dacl_ptr->revision : cpu_to_le16(ACL_REVISION);
@@ -1385,11 +1385,11 @@ static int build_sec_desc(struct cifs_ntsd *pntsd, struct cifs_ntsd *pnntsd,
13851385
}
13861386

13871387
#ifdef CONFIG_CIFS_ALLOW_INSECURE_LEGACY
1388-
struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
1388+
struct smb_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
13891389
const struct cifs_fid *cifsfid, u32 *pacllen,
13901390
u32 __maybe_unused unused)
13911391
{
1392-
struct cifs_ntsd *pntsd = NULL;
1392+
struct smb_ntsd *pntsd = NULL;
13931393
unsigned int xid;
13941394
int rc;
13951395
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
@@ -1410,10 +1410,10 @@ struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifs_sb,
14101410
return pntsd;
14111411
}
14121412

1413-
static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
1413+
static struct smb_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
14141414
const char *path, u32 *pacllen)
14151415
{
1416-
struct cifs_ntsd *pntsd = NULL;
1416+
struct smb_ntsd *pntsd = NULL;
14171417
int oplock = 0;
14181418
unsigned int xid;
14191419
int rc;
@@ -1454,11 +1454,11 @@ static struct cifs_ntsd *get_cifs_acl_by_path(struct cifs_sb_info *cifs_sb,
14541454
}
14551455

14561456
/* Retrieve an ACL from the server */
1457-
struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
1457+
struct smb_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
14581458
struct inode *inode, const char *path,
14591459
u32 *pacllen, u32 info)
14601460
{
1461-
struct cifs_ntsd *pntsd = NULL;
1461+
struct smb_ntsd *pntsd = NULL;
14621462
struct cifsFileInfo *open_file = NULL;
14631463

14641464
if (inode)
@@ -1472,7 +1472,7 @@ struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *cifs_sb,
14721472
}
14731473

14741474
/* Set an ACL on the server */
1475-
int set_cifs_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
1475+
int set_cifs_acl(struct smb_ntsd *pnntsd, __u32 acllen,
14761476
struct inode *inode, const char *path, int aclflag)
14771477
{
14781478
int oplock = 0;
@@ -1528,7 +1528,7 @@ cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb, struct cifs_fattr *fattr,
15281528
struct inode *inode, bool mode_from_special_sid,
15291529
const char *path, const struct cifs_fid *pfid)
15301530
{
1531-
struct cifs_ntsd *pntsd = NULL;
1531+
struct smb_ntsd *pntsd = NULL;
15321532
u32 acllen = 0;
15331533
int rc = 0;
15341534
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
@@ -1581,8 +1581,8 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
15811581
__u32 nsecdesclen = 0;
15821582
__u32 dacloffset = 0;
15831583
struct cifs_acl *dacl_ptr = NULL;
1584-
struct cifs_ntsd *pntsd = NULL; /* acl obtained from server */
1585-
struct cifs_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
1584+
struct smb_ntsd *pntsd = NULL; /* acl obtained from server */
1585+
struct smb_ntsd *pnntsd = NULL; /* modified acl to be sent to server */
15861586
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
15871587
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
15881588
struct smb_version_operations *ops;
@@ -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 cifs_ntsd) + (sizeof(struct cifs_sid) * 2);
1633+
nsecdesclen = sizeof(struct smb_ntsd) + (sizeof(struct cifs_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
@@ -33,7 +33,7 @@
3333
* Security Descriptor length containing DACL with 3 ACEs (one each for
3434
* owner, group and world).
3535
*/
36-
#define DEFAULT_SEC_DESC_LEN (sizeof(struct cifs_ntsd) + \
36+
#define DEFAULT_SEC_DESC_LEN (sizeof(struct smb_ntsd) + \
3737
sizeof(struct cifs_acl) + \
3838
(sizeof(struct cifs_ace) * 4))
3939

@@ -55,7 +55,7 @@
5555
#define SID_STRING_BASE_SIZE (2 + 3 + 15 + 1)
5656
#define SID_STRING_SUBAUTH_SIZE (11) /* size of a single subauth string */
5757

58-
struct cifs_ntsd {
58+
struct smb_ntsd {
5959
__le16 revision; /* revision level */
6060
__le16 type;
6161
__le32 osidoffset;
@@ -194,6 +194,6 @@ struct owner_group_sids {
194194
* Minimum security descriptor can be one without any SACL and DACL and can
195195
* consist of revision, type, and two sids of minimum size for owner and group
196196
*/
197-
#define MIN_SEC_DESC_LEN (sizeof(struct cifs_ntsd) + (2 * MIN_SID_LEN))
197+
#define MIN_SEC_DESC_LEN (sizeof(struct smb_ntsd) + (2 * MIN_SID_LEN))
198198

199199
#endif /* _CIFSACL_H */

fs/smb/client/cifsglob.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -536,12 +536,12 @@ struct smb_version_operations {
536536
int (*set_EA)(const unsigned int, struct cifs_tcon *, const char *,
537537
const char *, const void *, const __u16,
538538
const struct nls_table *, struct cifs_sb_info *);
539-
struct cifs_ntsd * (*get_acl)(struct cifs_sb_info *, struct inode *,
540-
const char *, u32 *, u32);
541-
struct cifs_ntsd * (*get_acl_by_fid)(struct cifs_sb_info *,
542-
const struct cifs_fid *, u32 *, u32);
543-
int (*set_acl)(struct cifs_ntsd *, __u32, struct inode *, const char *,
544-
int);
539+
struct smb_ntsd * (*get_acl)(struct cifs_sb_info *cifssb, struct inode *ino,
540+
const char *patch, u32 *plen, u32 info);
541+
struct smb_ntsd * (*get_acl_by_fid)(struct cifs_sb_info *cifssmb,
542+
const struct cifs_fid *pfid, u32 *plen, u32 info);
543+
int (*set_acl)(struct smb_ntsd *pntsd, __u32 len, struct inode *ino, const char *path,
544+
int flag);
545545
/* writepages retry size */
546546
unsigned int (*wp_retry_size)(struct inode *);
547547
/* get mtu credits */

fs/smb/client/cifsproto.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,16 @@ extern int cifs_acl_to_fattr(struct cifs_sb_info *cifs_sb,
233233
const char *path, const struct cifs_fid *pfid);
234234
extern int id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
235235
kuid_t uid, kgid_t gid);
236-
extern struct cifs_ntsd *get_cifs_acl(struct cifs_sb_info *, struct inode *,
237-
const char *, u32 *, u32);
238-
extern struct cifs_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *,
239-
const struct cifs_fid *, u32 *, u32);
236+
extern struct smb_ntsd *get_cifs_acl(struct cifs_sb_info *cifssmb, struct inode *ino,
237+
const char *path, u32 *plen, u32 info);
238+
extern struct smb_ntsd *get_cifs_acl_by_fid(struct cifs_sb_info *cifssb,
239+
const struct cifs_fid *pfid, u32 *plen, u32 info);
240240
extern struct posix_acl *cifs_get_acl(struct mnt_idmap *idmap,
241241
struct dentry *dentry, int type);
242242
extern int cifs_set_acl(struct mnt_idmap *idmap,
243243
struct dentry *dentry, struct posix_acl *acl, int type);
244-
extern int set_cifs_acl(struct cifs_ntsd *, __u32, struct inode *,
245-
const char *, int);
244+
extern int set_cifs_acl(struct smb_ntsd *pntsd, __u32 len, struct inode *ino,
245+
const char *path, int flag);
246246
extern unsigned int setup_authusers_ACE(struct cifs_ace *pace);
247247
extern unsigned int setup_special_mode_ACE(struct cifs_ace *pace, __u64 nmode);
248248
extern unsigned int setup_special_user_owner_ACE(struct cifs_ace *pace);
@@ -570,9 +570,9 @@ extern int CIFSSMBSetEA(const unsigned int xid, struct cifs_tcon *tcon,
570570
const struct nls_table *nls_codepage,
571571
struct cifs_sb_info *cifs_sb);
572572
extern int CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon,
573-
__u16 fid, struct cifs_ntsd **acl_inf, __u32 *buflen);
573+
__u16 fid, struct smb_ntsd **acl_inf, __u32 *buflen);
574574
extern int CIFSSMBSetCIFSACL(const unsigned int, struct cifs_tcon *, __u16,
575-
struct cifs_ntsd *, __u32, int);
575+
struct smb_ntsd *pntsd, __u32 len, int aclflag);
576576
extern int cifs_do_get_acl(const unsigned int xid, struct cifs_tcon *tcon,
577577
const unsigned char *searchName,
578578
struct posix_acl **acl, const int acl_type,

fs/smb/client/cifssmb.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3428,7 +3428,7 @@ validate_ntransact(char *buf, char **ppparm, char **ppdata,
34283428
/* Get Security Descriptor (by handle) from remote server for a file or dir */
34293429
int
34303430
CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
3431-
struct cifs_ntsd **acl_inf, __u32 *pbuflen)
3431+
struct smb_ntsd **acl_inf, __u32 *pbuflen)
34323432
{
34333433
int rc = 0;
34343434
int buf_type = 0;
@@ -3498,7 +3498,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
34983498

34993499
/* check if buffer is big enough for the acl
35003500
header followed by the smallest SID */
3501-
if ((*pbuflen < sizeof(struct cifs_ntsd) + 8) ||
3501+
if ((*pbuflen < sizeof(struct smb_ntsd) + 8) ||
35023502
(*pbuflen >= 64 * 1024)) {
35033503
cifs_dbg(VFS, "bad acl length %d\n", *pbuflen);
35043504
rc = -EINVAL;
@@ -3518,7 +3518,7 @@ CIFSSMBGetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
35183518

35193519
int
35203520
CIFSSMBSetCIFSACL(const unsigned int xid, struct cifs_tcon *tcon, __u16 fid,
3521-
struct cifs_ntsd *pntsd, __u32 acllen, int aclflag)
3521+
struct smb_ntsd *pntsd, __u32 acllen, int aclflag)
35223522
{
35233523
__u16 byte_count, param_count, data_count, param_offset, data_offset;
35243524
int rc = 0;

fs/smb/client/smb2ops.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3048,11 +3048,11 @@ smb2_get_dfs_refer(const unsigned int xid, struct cifs_ses *ses,
30483048
return rc;
30493049
}
30503050

3051-
static struct cifs_ntsd *
3051+
static struct smb_ntsd *
30523052
get_smb2_acl_by_fid(struct cifs_sb_info *cifs_sb,
30533053
const struct cifs_fid *cifsfid, u32 *pacllen, u32 info)
30543054
{
3055-
struct cifs_ntsd *pntsd = NULL;
3055+
struct smb_ntsd *pntsd = NULL;
30563056
unsigned int xid;
30573057
int rc = -EOPNOTSUPP;
30583058
struct tcon_link *tlink = cifs_sb_tlink(cifs_sb);
@@ -3077,11 +3077,11 @@ get_smb2_acl_by_fid(struct cifs_sb_info *cifs_sb,
30773077

30783078
}
30793079

3080-
static struct cifs_ntsd *
3080+
static struct smb_ntsd *
30813081
get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
30823082
const char *path, u32 *pacllen, u32 info)
30833083
{
3084-
struct cifs_ntsd *pntsd = NULL;
3084+
struct smb_ntsd *pntsd = NULL;
30853085
u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
30863086
unsigned int xid;
30873087
int rc;
@@ -3144,7 +3144,7 @@ get_smb2_acl_by_path(struct cifs_sb_info *cifs_sb,
31443144
}
31453145

31463146
static int
3147-
set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
3147+
set_smb2_acl(struct smb_ntsd *pnntsd, __u32 acllen,
31483148
struct inode *inode, const char *path, int aclflag)
31493149
{
31503150
u8 oplock = SMB2_OPLOCK_LEVEL_NONE;
@@ -3202,12 +3202,12 @@ set_smb2_acl(struct cifs_ntsd *pnntsd, __u32 acllen,
32023202
}
32033203

32043204
/* Retrieve an ACL from the server */
3205-
static struct cifs_ntsd *
3205+
static struct smb_ntsd *
32063206
get_smb2_acl(struct cifs_sb_info *cifs_sb,
32073207
struct inode *inode, const char *path,
32083208
u32 *pacllen, u32 info)
32093209
{
3210-
struct cifs_ntsd *pntsd = NULL;
3210+
struct smb_ntsd *pntsd = NULL;
32113211
struct cifsFileInfo *open_file = NULL;
32123212

32133213
if (inode && !(info & SACL_SECINFO))

fs/smb/client/smb2pdu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5683,7 +5683,7 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
56835683
int
56845684
SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
56855685
u64 persistent_fid, u64 volatile_fid,
5686-
struct cifs_ntsd *pnntsd, int pacllen, int aclflag)
5686+
struct smb_ntsd *pnntsd, int pacllen, int aclflag)
56875687
{
56885688
return send_set_info(xid, tcon, persistent_fid, volatile_fid,
56895689
current->tgid, 0, SMB2_O_INFO_SECURITY, aclflag,

fs/smb/client/smb2proto.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ extern int SMB2_set_info_init(struct cifs_tcon *tcon,
238238
extern void SMB2_set_info_free(struct smb_rqst *rqst);
239239
extern int SMB2_set_acl(const unsigned int xid, struct cifs_tcon *tcon,
240240
u64 persistent_fid, u64 volatile_fid,
241-
struct cifs_ntsd *pnntsd, int pacllen, int aclflag);
241+
struct smb_ntsd *pnntsd, int pacllen, int aclflag);
242242
extern int SMB2_set_ea(const unsigned int xid, struct cifs_tcon *tcon,
243243
u64 persistent_fid, u64 volatile_fid,
244244
struct smb2_file_full_ea_info *buf, int len);

fs/smb/client/xattr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ static int cifs_xattr_set(const struct xattr_handler *handler,
162162
case XATTR_CIFS_ACL:
163163
case XATTR_CIFS_NTSD:
164164
case XATTR_CIFS_NTSD_FULL: {
165-
struct cifs_ntsd *pacl;
165+
struct smb_ntsd *pacl;
166166

167167
if (!value)
168168
goto out;
@@ -315,7 +315,7 @@ static int cifs_xattr_get(const struct xattr_handler *handler,
315315
* fetch owner and DACL otherwise
316316
*/
317317
u32 acllen, extra_info;
318-
struct cifs_ntsd *pacl;
318+
struct smb_ntsd *pacl;
319319

320320
if (pTcon->ses->server->ops->get_acl == NULL)
321321
goto out; /* rc already EOPNOTSUPP */

0 commit comments

Comments
 (0)