CIFS: Add set_file_info support for SMB2
Signed-off-by: Pavel Shilovsky <pshilovsky@samba.org> Signed-off-by: Steve French <smfrench@gmail.com>
This commit is contained in:
parent
6bdf6dbd66
commit
1feeaac753
4 changed files with 39 additions and 0 deletions
|
@ -86,6 +86,10 @@ smb2_open_op_close(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
tmprc = SMB2_set_eof(xid, tcon, persistent_fid, volatile_fid,
|
tmprc = SMB2_set_eof(xid, tcon, persistent_fid, volatile_fid,
|
||||||
current->tgid, (__le64 *)data);
|
current->tgid, (__le64 *)data);
|
||||||
break;
|
break;
|
||||||
|
case SMB2_OP_SET_INFO:
|
||||||
|
tmprc = SMB2_set_info(xid, tcon, persistent_fid, volatile_fid,
|
||||||
|
(FILE_BASIC_INFO *)data);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
cERROR(1, "Invalid command");
|
cERROR(1, "Invalid command");
|
||||||
break;
|
break;
|
||||||
|
@ -232,3 +236,21 @@ smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
FILE_WRITE_DATA, FILE_OPEN, 0, 0, &eof,
|
FILE_WRITE_DATA, FILE_OPEN, 0, 0, &eof,
|
||||||
SMB2_OP_SET_EOF);
|
SMB2_OP_SET_EOF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
smb2_set_file_info(struct inode *inode, const char *full_path,
|
||||||
|
FILE_BASIC_INFO *buf, const unsigned int xid)
|
||||||
|
{
|
||||||
|
struct cifs_sb_info *cifs_sb = CIFS_SB(inode->i_sb);
|
||||||
|
struct tcon_link *tlink;
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
tlink = cifs_sb_tlink(cifs_sb);
|
||||||
|
if (IS_ERR(tlink))
|
||||||
|
return PTR_ERR(tlink);
|
||||||
|
rc = smb2_open_op_close(xid, tlink_tcon(tlink), cifs_sb, full_path,
|
||||||
|
FILE_WRITE_ATTRIBUTES, FILE_OPEN, 0, 0, buf,
|
||||||
|
SMB2_OP_SET_INFO);
|
||||||
|
cifs_put_tlink(tlink);
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
|
@ -457,6 +457,7 @@ struct smb_version_operations smb21_operations = {
|
||||||
.query_file_info = smb2_query_file_info,
|
.query_file_info = smb2_query_file_info,
|
||||||
.set_path_size = smb2_set_path_size,
|
.set_path_size = smb2_set_path_size,
|
||||||
.set_file_size = smb2_set_file_size,
|
.set_file_size = smb2_set_file_size,
|
||||||
|
.set_file_info = smb2_set_file_info,
|
||||||
.build_path_to_root = smb2_build_path_to_root,
|
.build_path_to_root = smb2_build_path_to_root,
|
||||||
.mkdir = smb2_mkdir,
|
.mkdir = smb2_mkdir,
|
||||||
.mkdir_setinfo = smb2_mkdir_setinfo,
|
.mkdir_setinfo = smb2_mkdir_setinfo,
|
||||||
|
|
|
@ -1760,3 +1760,14 @@ SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon, u64 persistent_fid,
|
||||||
return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid,
|
return send_set_info(xid, tcon, persistent_fid, volatile_fid, pid,
|
||||||
FILE_END_OF_FILE_INFORMATION, 1, &data, &size);
|
FILE_END_OF_FILE_INFORMATION, 1, &data, &size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
|
u64 persistent_fid, u64 volatile_fid, FILE_BASIC_INFO *buf)
|
||||||
|
{
|
||||||
|
unsigned int size;
|
||||||
|
size = sizeof(FILE_BASIC_INFO);
|
||||||
|
return send_set_info(xid, tcon, persistent_fid, volatile_fid,
|
||||||
|
current->tgid, FILE_BASIC_INFORMATION, 1,
|
||||||
|
(void **)&buf, &size);
|
||||||
|
}
|
||||||
|
|
|
@ -59,6 +59,8 @@ extern int smb2_query_path_info(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
extern int smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
|
extern int smb2_set_path_size(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
const char *full_path, __u64 size,
|
const char *full_path, __u64 size,
|
||||||
struct cifs_sb_info *cifs_sb, bool set_alloc);
|
struct cifs_sb_info *cifs_sb, bool set_alloc);
|
||||||
|
extern int smb2_set_file_info(struct inode *inode, const char *full_path,
|
||||||
|
FILE_BASIC_INFO *buf, const unsigned int xid);
|
||||||
extern int smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon,
|
extern int smb2_mkdir(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
const char *name, struct cifs_sb_info *cifs_sb);
|
const char *name, struct cifs_sb_info *cifs_sb);
|
||||||
extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path,
|
extern void smb2_mkdir_setinfo(struct inode *inode, const char *full_path,
|
||||||
|
@ -124,5 +126,8 @@ extern int SMB2_set_hardlink(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon,
|
extern int SMB2_set_eof(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
u64 persistent_fid, u64 volatile_fid, u32 pid,
|
u64 persistent_fid, u64 volatile_fid, u32 pid,
|
||||||
__le64 *eof);
|
__le64 *eof);
|
||||||
|
extern int SMB2_set_info(const unsigned int xid, struct cifs_tcon *tcon,
|
||||||
|
u64 persistent_fid, u64 volatile_fid,
|
||||||
|
FILE_BASIC_INFO *buf);
|
||||||
|
|
||||||
#endif /* _SMB2PROTO_H */
|
#endif /* _SMB2PROTO_H */
|
||||||
|
|
Loading…
Reference in a new issue