Skip to content

Commit ed7f8a3

Browse files
ChenXiaoSongSasha Levin
authored andcommitted
smb/client: rename cifs_ace to smb_ace
[ Upstream commit 09bedaf ] 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_ace/struct smb_ace/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 5f8a209 commit ed7f8a3

File tree

5 files changed

+41
-41
lines changed

5 files changed

+41
-41
lines changed

fs/smb/client/cifsacl.c

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -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 smb_sid *psid)
669+
static __u16 cifs_copy_ace(struct smb_ace *dst, struct smb_ace *src, struct smb_sid *psid)
670670
{
671671
__u16 size = 1 + 1 + 2 + 4;
672672

@@ -685,7 +685,7 @@ static __u16 cifs_copy_ace(struct cifs_ace *dst, struct cifs_ace *src, struct sm
685685
return size;
686686
}
687687

688-
static __u16 fill_ace_for_sid(struct cifs_ace *pntace,
688+
static __u16 fill_ace_for_sid(struct smb_ace *pntace,
689689
const struct smb_sid *psid, __u64 nmode,
690690
umode_t bits, __u8 access_type,
691691
bool allow_delete_child)
@@ -723,7 +723,7 @@ static __u16 fill_ace_for_sid(struct cifs_ace *pntace,
723723

724724

725725
#ifdef CONFIG_CIFS_DEBUG2
726-
static void dump_ace(struct cifs_ace *pace, char *end_of_acl)
726+
static void dump_ace(struct smb_ace *pace, char *end_of_acl)
727727
{
728728
int num_subauth;
729729

@@ -766,7 +766,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
766766
int num_aces = 0;
767767
int acl_size;
768768
char *acl_base;
769-
struct cifs_ace **ppace;
769+
struct smb_ace **ppace;
770770

771771
/* BB need to add parm so we can store the SID BB */
772772

@@ -799,15 +799,15 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
799799
if (num_aces > 0) {
800800
umode_t denied_mode = 0;
801801

802-
if (num_aces > ULONG_MAX / sizeof(struct cifs_ace *))
802+
if (num_aces > ULONG_MAX / sizeof(struct smb_ace *))
803803
return;
804-
ppace = kmalloc_array(num_aces, sizeof(struct cifs_ace *),
804+
ppace = kmalloc_array(num_aces, sizeof(struct smb_ace *),
805805
GFP_KERNEL);
806806
if (!ppace)
807807
return;
808808

809809
for (i = 0; i < num_aces; ++i) {
810-
ppace[i] = (struct cifs_ace *) (acl_base + acl_size);
810+
ppace[i] = (struct smb_ace *) (acl_base + acl_size);
811811
#ifdef CONFIG_CIFS_DEBUG2
812812
dump_ace(ppace[i], end_of_acl);
813813
#endif
@@ -849,7 +849,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
849849

850850
/* memcpy((void *)(&(cifscred->aces[i])),
851851
(void *)ppace[i],
852-
sizeof(struct cifs_ace)); */
852+
sizeof(struct smb_ace)); */
853853

854854
acl_base = (char *)ppace[i];
855855
acl_size = le16_to_cpu(ppace[i]->size);
@@ -861,7 +861,7 @@ static void parse_dacl(struct smb_acl *pdacl, char *end_of_acl,
861861
return;
862862
}
863863

864-
unsigned int setup_authusers_ACE(struct cifs_ace *pntace)
864+
unsigned int setup_authusers_ACE(struct smb_ace *pntace)
865865
{
866866
int i;
867867
unsigned int ace_size = 20;
@@ -885,7 +885,7 @@ unsigned int setup_authusers_ACE(struct cifs_ace *pntace)
885885
* Fill in the special SID based on the mode. See
886886
* https://technet.microsoft.com/en-us/library/hh509017(v=ws.10).aspx
887887
*/
888-
unsigned int setup_special_mode_ACE(struct cifs_ace *pntace, __u64 nmode)
888+
unsigned int setup_special_mode_ACE(struct smb_ace *pntace, __u64 nmode)
889889
{
890890
int i;
891891
unsigned int ace_size = 28;
@@ -907,7 +907,7 @@ unsigned int setup_special_mode_ACE(struct cifs_ace *pntace, __u64 nmode)
907907
return ace_size;
908908
}
909909

910-
unsigned int setup_special_user_owner_ACE(struct cifs_ace *pntace)
910+
unsigned int setup_special_user_owner_ACE(struct smb_ace *pntace)
911911
{
912912
int i;
913913
unsigned int ace_size = 28;
@@ -944,17 +944,17 @@ static void populate_new_aces(char *nacl_base,
944944
__u64 deny_user_mode = 0;
945945
__u64 deny_group_mode = 0;
946946
bool sticky_set = false;
947-
struct cifs_ace *pnntace = NULL;
947+
struct smb_ace *pnntace = NULL;
948948

949949
nmode = *pnmode;
950950
num_aces = *pnum_aces;
951951
nsize = *pnsize;
952952

953953
if (modefromsid) {
954-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
954+
pnntace = (struct smb_ace *) (nacl_base + nsize);
955955
nsize += setup_special_mode_ACE(pnntace, nmode);
956956
num_aces++;
957-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
957+
pnntace = (struct smb_ace *) (nacl_base + nsize);
958958
nsize += setup_authusers_ACE(pnntace);
959959
num_aces++;
960960
goto set_size;
@@ -992,39 +992,39 @@ static void populate_new_aces(char *nacl_base,
992992
sticky_set = true;
993993

994994
if (deny_user_mode) {
995-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
995+
pnntace = (struct smb_ace *) (nacl_base + nsize);
996996
nsize += fill_ace_for_sid(pnntace, pownersid, deny_user_mode,
997997
0700, ACCESS_DENIED, false);
998998
num_aces++;
999999
}
10001000

10011001
/* Group DENY ACE does not conflict with owner ALLOW ACE. Keep in preferred order*/
10021002
if (deny_group_mode && !(deny_group_mode & (user_mode >> 3))) {
1003-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1003+
pnntace = (struct smb_ace *) (nacl_base + nsize);
10041004
nsize += fill_ace_for_sid(pnntace, pgrpsid, deny_group_mode,
10051005
0070, ACCESS_DENIED, false);
10061006
num_aces++;
10071007
}
10081008

1009-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1009+
pnntace = (struct smb_ace *) (nacl_base + nsize);
10101010
nsize += fill_ace_for_sid(pnntace, pownersid, user_mode,
10111011
0700, ACCESS_ALLOWED, true);
10121012
num_aces++;
10131013

10141014
/* Group DENY ACE conflicts with owner ALLOW ACE. So keep it after. */
10151015
if (deny_group_mode && (deny_group_mode & (user_mode >> 3))) {
1016-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1016+
pnntace = (struct smb_ace *) (nacl_base + nsize);
10171017
nsize += fill_ace_for_sid(pnntace, pgrpsid, deny_group_mode,
10181018
0070, ACCESS_DENIED, false);
10191019
num_aces++;
10201020
}
10211021

1022-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1022+
pnntace = (struct smb_ace *) (nacl_base + nsize);
10231023
nsize += fill_ace_for_sid(pnntace, pgrpsid, group_mode,
10241024
0070, ACCESS_ALLOWED, !sticky_set);
10251025
num_aces++;
10261026

1027-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1027+
pnntace = (struct smb_ace *) (nacl_base + nsize);
10281028
nsize += fill_ace_for_sid(pnntace, &sid_everyone, other_mode,
10291029
0007, ACCESS_ALLOWED, !sticky_set);
10301030
num_aces++;
@@ -1040,11 +1040,11 @@ static __u16 replace_sids_and_copy_aces(struct smb_acl *pdacl, struct smb_acl *p
10401040
{
10411041
int i;
10421042
u16 size = 0;
1043-
struct cifs_ace *pntace = NULL;
1043+
struct smb_ace *pntace = NULL;
10441044
char *acl_base = NULL;
10451045
u32 src_num_aces = 0;
10461046
u16 nsize = 0;
1047-
struct cifs_ace *pnntace = NULL;
1047+
struct smb_ace *pnntace = NULL;
10481048
char *nacl_base = NULL;
10491049
u16 ace_size = 0;
10501050

@@ -1057,8 +1057,8 @@ static __u16 replace_sids_and_copy_aces(struct smb_acl *pdacl, struct smb_acl *p
10571057

10581058
/* Go through all the ACEs */
10591059
for (i = 0; i < src_num_aces; ++i) {
1060-
pntace = (struct cifs_ace *) (acl_base + size);
1061-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1060+
pntace = (struct smb_ace *) (acl_base + size);
1061+
pnntace = (struct smb_ace *) (nacl_base + nsize);
10621062

10631063
if (pnownersid && compare_sids(&pntace->sid, pownersid) == 0)
10641064
ace_size = cifs_copy_ace(pnntace, pntace, pnownersid);
@@ -1080,11 +1080,11 @@ static int set_chmod_dacl(struct smb_acl *pdacl, struct smb_acl *pndacl,
10801080
{
10811081
int i;
10821082
u16 size = 0;
1083-
struct cifs_ace *pntace = NULL;
1083+
struct smb_ace *pntace = NULL;
10841084
char *acl_base = NULL;
10851085
u32 src_num_aces = 0;
10861086
u16 nsize = 0;
1087-
struct cifs_ace *pnntace = NULL;
1087+
struct smb_ace *pnntace = NULL;
10881088
char *nacl_base = NULL;
10891089
u32 num_aces = 0;
10901090
bool new_aces_set = false;
@@ -1108,7 +1108,7 @@ static int set_chmod_dacl(struct smb_acl *pdacl, struct smb_acl *pndacl,
11081108

11091109
/* Retain old ACEs which we can retain */
11101110
for (i = 0; i < src_num_aces; ++i) {
1111-
pntace = (struct cifs_ace *) (acl_base + size);
1111+
pntace = (struct smb_ace *) (acl_base + size);
11121112

11131113
if (!new_aces_set && (pntace->flags & INHERITED_ACE)) {
11141114
/* Place the new ACEs in between existing explicit and inherited */
@@ -1130,7 +1130,7 @@ static int set_chmod_dacl(struct smb_acl *pdacl, struct smb_acl *pndacl,
11301130
}
11311131

11321132
/* update the pointer to the next ACE to populate*/
1133-
pnntace = (struct cifs_ace *) (nacl_base + nsize);
1133+
pnntace = (struct smb_ace *) (nacl_base + nsize);
11341134

11351135
nsize += cifs_copy_ace(pnntace, pntace, NULL);
11361136
num_aces++;
@@ -1625,9 +1625,9 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
16251625
nsecdesclen = secdesclen;
16261626
if (pnmode && *pnmode != NO_CHANGE_64) { /* chmod */
16271627
if (mode_from_sid)
1628-
nsecdesclen += 2 * sizeof(struct cifs_ace);
1628+
nsecdesclen += 2 * sizeof(struct smb_ace);
16291629
else /* cifsacl */
1630-
nsecdesclen += 5 * sizeof(struct cifs_ace);
1630+
nsecdesclen += 5 * sizeof(struct smb_ace);
16311631
} else { /* chown */
16321632
/* When ownership changes, changes new owner sid length could be different */
16331633
nsecdesclen = sizeof(struct smb_ntsd) + (sizeof(struct smb_sid) * 2);
@@ -1636,7 +1636,7 @@ id_mode_to_cifs_acl(struct inode *inode, const char *path, __u64 *pnmode,
16361636
dacl_ptr = (struct smb_acl *)((char *)pntsd + dacloffset);
16371637
if (mode_from_sid)
16381638
nsecdesclen +=
1639-
le32_to_cpu(dacl_ptr->num_aces) * sizeof(struct cifs_ace);
1639+
le32_to_cpu(dacl_ptr->num_aces) * sizeof(struct smb_ace);
16401640
else /* cifsacl */
16411641
nsecdesclen += le16_to_cpu(dacl_ptr->size);
16421642
}

fs/smb/client/cifsacl.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
*/
3636
#define DEFAULT_SEC_DESC_LEN (sizeof(struct smb_ntsd) + \
3737
sizeof(struct smb_acl) + \
38-
(sizeof(struct cifs_ace) * 4))
38+
(sizeof(struct smb_ace) * 4))
3939

4040
/*
4141
* Maximum size of a string representation of a SID:
@@ -111,7 +111,7 @@ struct smb_acl {
111111
#define SUCCESSFUL_ACCESS_ACE_FLAG 0x40
112112
#define FAILED_ACCESS_ACE_FLAG 0x80
113113

114-
struct cifs_ace {
114+
struct smb_ace {
115115
__u8 type; /* see above and MS-DTYP 2.4.4.1 */
116116
__u8 flags;
117117
__le16 size;

fs/smb/client/cifsglob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ struct cifs_cred {
205205
struct smb_sid osid;
206206
struct smb_sid gsid;
207207
struct cifs_ntace *ntaces;
208-
struct cifs_ace *aces;
208+
struct smb_ace *aces;
209209
};
210210

211211
struct cifs_open_info_data {

fs/smb/client/cifsproto.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ extern int cifs_set_acl(struct mnt_idmap *idmap,
241241
struct dentry *dentry, struct posix_acl *acl, int type);
242242
extern int set_cifs_acl(struct smb_ntsd *pntsd, __u32 len, struct inode *ino,
243243
const char *path, int flag);
244-
extern unsigned int setup_authusers_ACE(struct cifs_ace *pace);
245-
extern unsigned int setup_special_mode_ACE(struct cifs_ace *pace, __u64 nmode);
246-
extern unsigned int setup_special_user_owner_ACE(struct cifs_ace *pace);
244+
extern unsigned int setup_authusers_ACE(struct smb_ace *pace);
245+
extern unsigned int setup_special_mode_ACE(struct smb_ace *pace, __u64 nmode);
246+
extern unsigned int setup_special_user_owner_ACE(struct smb_ace *pace);
247247

248248
extern void dequeue_mid(struct mid_q_entry *mid, bool malformed);
249249
extern int cifs_read_from_socket(struct TCP_Server_Info *server, char *buf,

fs/smb/client/smb2pdu.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2623,7 +2623,7 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
26232623
unsigned int group_offset = 0;
26242624
struct smb3_acl acl = {};
26252625

2626-
*len = round_up(sizeof(struct crt_sd_ctxt) + (sizeof(struct cifs_ace) * 4), 8);
2626+
*len = round_up(sizeof(struct crt_sd_ctxt) + (sizeof(struct smb_ace) * 4), 8);
26272627

26282628
if (set_owner) {
26292629
/* sizeof(struct owner_group_sids) is already multiple of 8 so no need to round */
@@ -2672,21 +2672,21 @@ create_sd_buf(umode_t mode, bool set_owner, unsigned int *len)
26722672
ptr += sizeof(struct smb3_acl);
26732673

26742674
/* create one ACE to hold the mode embedded in reserved special SID */
2675-
acelen = setup_special_mode_ACE((struct cifs_ace *)ptr, (__u64)mode);
2675+
acelen = setup_special_mode_ACE((struct smb_ace *)ptr, (__u64)mode);
26762676
ptr += acelen;
26772677
acl_size = acelen + sizeof(struct smb3_acl);
26782678
ace_count = 1;
26792679

26802680
if (set_owner) {
26812681
/* we do not need to reallocate buffer to add the two more ACEs. plenty of space */
2682-
acelen = setup_special_user_owner_ACE((struct cifs_ace *)ptr);
2682+
acelen = setup_special_user_owner_ACE((struct smb_ace *)ptr);
26832683
ptr += acelen;
26842684
acl_size += acelen;
26852685
ace_count += 1;
26862686
}
26872687

26882688
/* and one more ACE to allow access for authenticated users */
2689-
acelen = setup_authusers_ACE((struct cifs_ace *)ptr);
2689+
acelen = setup_authusers_ACE((struct smb_ace *)ptr);
26902690
ptr += acelen;
26912691
acl_size += acelen;
26922692
ace_count += 1;

0 commit comments

Comments
 (0)