mirror of https://gitee.com/openkylin/linux.git
CIFS: Add SMB2 support for mkdir operation
Signed-off-by: Pavel Shilovsky <piastryyy@gmail.com> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
parent
f436720e94
commit
a0e731839d
|
@ -122,3 +122,33 @@ smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
|
|||
kfree(smb2_data);
|
||||
return rc;
|
||||
}
|
||||
|
||||
int
|
||||
smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon, const char *name,
|
||||
struct cifs_sb_info *cifs_sb)
|
||||
{
|
||||
return smb2_open_op_close(xid, tcon, cifs_sb, name,
|
||||
FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0,
|
||||
CREATE_NOT_FILE, NULL, SMB2_OP_MKDIR);
|
||||
}
|
||||
|
||||
void
|
||||
smb2_mkdir_setinfo(struct inode *inode, const char *name,
|
||||
struct cifs_sb_info *cifs_sb, struct cifs_tcon *tcon,
|
||||
const unsigned int xid)
|
||||
{
|
||||
FILE_BASIC_INFO data;
|
||||
struct cifsInodeInfo *cifs_i;
|
||||
u32 dosattrs;
|
||||
int tmprc;
|
||||
|
||||
memset(&data, 0, sizeof(data));
|
||||
cifs_i = CIFS_I(inode);
|
||||
dosattrs = cifs_i->cifsAttrs | ATTR_READONLY;
|
||||
data.Attributes = cpu_to_le32(dosattrs);
|
||||
tmprc = smb2_open_op_close(xid, tcon, cifs_sb, name,
|
||||
FILE_WRITE_ATTRIBUTES, FILE_CREATE, 0,
|
||||
CREATE_NOT_FILE, &data, SMB2_OP_SET_INFO);
|
||||
if (tmprc == 0)
|
||||
cifs_i->cifsAttrs = dosattrs;
|
||||
}
|
||||
|
|
|
@ -318,6 +318,8 @@ struct smb_version_operations smb21_operations = {
|
|||
.query_path_info = smb2_query_path_info,
|
||||
.get_srv_inum = smb2_get_srv_inum,
|
||||
.build_path_to_root = smb2_build_path_to_root,
|
||||
.mkdir = smb2_mkdir,
|
||||
.mkdir_setinfo = smb2_mkdir_setinfo,
|
||||
};
|
||||
|
||||
struct smb_version_values smb21_values = {
|
||||
|
|
|
@ -52,6 +52,12 @@ extern int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
|
|||
struct cifs_sb_info *cifs_sb,
|
||||
const char *full_path, FILE_ALL_INFO *data,
|
||||
bool *adjust_tz);
|
||||
extern int smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon,
|
||||
const char *name, struct cifs_sb_info *cifs_sb);
|
||||
extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path,
|
||||
struct cifs_sb_info *cifs_sb,
|
||||
struct cifs_tcon *tcon, const unsigned int xid);
|
||||
|
||||
/*
|
||||
* SMB2 Worker functions - most of protocol specific implementation details
|
||||
* are contained within these calls.
|
||||
|
|
Loading…
Reference in New Issue