Commit a0e731839dd461eee0fe2dc026e0965e961e2730
Committed by
Steve French
1 parent
f436720e94
Exists in
smarc-l5.0.0_1.0.0-ga
and in
5 other branches
CIFS: Add SMB2 support for mkdir operation
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <smfrench@gmail.com>
Showing 3 changed files with 38 additions and 0 deletions Side-by-side Diff
fs/cifs/smb2inode.c
... | ... | @@ -122,4 +122,34 @@ |
122 | 122 | kfree(smb2_data); |
123 | 123 | return rc; |
124 | 124 | } |
125 | + | |
126 | +int | |
127 | +smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name, | |
128 | + struct cifs_sb_info *cifs_sb) | |
129 | +{ | |
130 | + return smb2_open_op_close(xid, tcon, cifs_sb, name, | |
131 | + FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0, | |
132 | + CREATE_NOT_FILE, NULL, SMB2_OP_MKDIR); | |
133 | +} | |
134 | + | |
135 | +void | |
136 | +smb2_mkdir_setinfo(struct inode *inode, const char *name, | |
137 | + struct cifs_sb_info *cifs_sb, struct cifs_tcon *tcon, | |
138 | + const unsigned int xid) | |
139 | +{ | |
140 | + FILE_BASIC_INFO data; | |
141 | + struct cifsInodeInfo *cifs_i; | |
142 | + u32 dosattrs; | |
143 | + int tmprc; | |
144 | + | |
145 | + memset(&data, 0, sizeof(data)); | |
146 | + cifs_i = CIFS_I(inode); | |
147 | + dosattrs = cifs_i->cifsAttrs | ATTR_READONLY; | |
148 | + data.Attributes = cpu_to_le32(dosattrs); | |
149 | + tmprc = smb2_open_op_close(xid, tcon, cifs_sb, name, | |
150 | + FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0, | |
151 | + CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO); | |
152 | + if (tmprc == 0) | |
153 | + cifs_i->cifsAttrs = dosattrs; | |
154 | +} |
fs/cifs/smb2ops.c
... | ... | @@ -318,6 +318,8 @@ |
318 | 318 | .query_path_info = smb2_query_path_info, |
319 | 319 | .get_srv_inum = smb2_get_srv_inum, |
320 | 320 | .build_path_to_root = smb2_build_path_to_root, |
321 | + .mkdir = smb2_mkdir, | |
322 | + .mkdir_setinfo = smb2_mkdir_setinfo, | |
321 | 323 | }; |
322 | 324 | |
323 | 325 | struct smb_version_values smb21_values = { |
fs/cifs/smb2proto.h
... | ... | @@ -52,6 +52,12 @@ |
52 | 52 | struct cifs_sb_info *cifs_sb, |
53 | 53 | const char *full_path, FILE_ALL_INFO *data, |
54 | 54 | bool *adjust_tz); |
55 | +extern int smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon, | |
56 | + const char *name, struct cifs_sb_info *cifs_sb); | |
57 | +extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path, | |
58 | + struct cifs_sb_info *cifs_sb, | |
59 | + struct cifs_tcon *tcon, const unsigned int xid); | |
60 | + | |
55 | 61 | /* |
56 | 62 | * SMB2 Worker functions - most of protocol specific implementation details |
57 | 63 | * are contained within these calls. |