mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-11-24 06:50:58 +07:00
cifs: Add support for FSCTL passthrough that write data to the server
Add support to pass a blob to the server in FSCTL passthrough. Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com> Signed-off-by: Steve French <stfrench@microsoft.com>
This commit is contained in:
parent
0ae3fa4dc1
commit
efac779b1c
@ -1382,6 +1382,18 @@ smb2_ioctl_query_info(const unsigned int xid,
|
|||||||
oparms.fid = &fid;
|
oparms.fid = &fid;
|
||||||
oparms.reconnect = false;
|
oparms.reconnect = false;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FSCTL codes encode the special access they need in the fsctl code.
|
||||||
|
*/
|
||||||
|
if (qi.flags & PASSTHRU_FSCTL) {
|
||||||
|
switch (qi.info_type & FSCTL_DEVICE_ACCESS_MASK) {
|
||||||
|
case FSCTL_DEVICE_ACCESS_FILE_READ_WRITE_ACCESS:
|
||||||
|
oparms.desired_access = FILE_READ_DATA | FILE_WRITE_DATA | FILE_READ_ATTRIBUTES | SYNCHRONIZE;
|
||||||
|
;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
rc = SMB2_open_init(tcon, &rqst[0], &oplock, &oparms, path);
|
rc = SMB2_open_init(tcon, &rqst[0], &oplock, &oparms, path);
|
||||||
if (rc)
|
if (rc)
|
||||||
goto iqinf_exit;
|
goto iqinf_exit;
|
||||||
@ -1399,8 +1411,9 @@ smb2_ioctl_query_info(const unsigned int xid,
|
|||||||
|
|
||||||
rc = SMB2_ioctl_init(tcon, &rqst[1],
|
rc = SMB2_ioctl_init(tcon, &rqst[1],
|
||||||
COMPOUND_FID, COMPOUND_FID,
|
COMPOUND_FID, COMPOUND_FID,
|
||||||
qi.info_type, true, NULL,
|
qi.info_type, true, buffer,
|
||||||
0, CIFSMaxBufSize);
|
qi.output_buffer_length,
|
||||||
|
CIFSMaxBufSize);
|
||||||
}
|
}
|
||||||
} else if (qi.flags == PASSTHRU_QUERY_INFO) {
|
} else if (qi.flags == PASSTHRU_QUERY_INFO) {
|
||||||
memset(&qi_iov, 0, sizeof(qi_iov));
|
memset(&qi_iov, 0, sizeof(qi_iov));
|
||||||
|
@ -35,6 +35,33 @@
|
|||||||
* below). Additional detail on less common ones can be found in MS-FSCC
|
* below). Additional detail on less common ones can be found in MS-FSCC
|
||||||
* section 2.3.
|
* section 2.3.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FSCTL values are 32 bits and are constructed as
|
||||||
|
* <device 16bits> <access 2bits> <function 12bits> <method 2bits>
|
||||||
|
*/
|
||||||
|
/* Device */
|
||||||
|
#define FSCTL_DEVICE_DFS (0x0006 << 16)
|
||||||
|
#define FSCTL_DEVICE_FILE_SYSTEM (0x0009 << 16)
|
||||||
|
#define FSCTL_DEVICE_NAMED_PIPE (0x0011 << 16)
|
||||||
|
#define FSCTL_DEVICE_NETWORK_FILE_SYSTEM (0x0014 << 16)
|
||||||
|
#define FSCTL_DEVICE_MASK 0xffff0000
|
||||||
|
/* Access */
|
||||||
|
#define FSCTL_DEVICE_ACCESS_FILE_ANY_ACCESS (0x00 << 14)
|
||||||
|
#define FSCTL_DEVICE_ACCESS_FILE_READ_ACCESS (0x01 << 14)
|
||||||
|
#define FSCTL_DEVICE_ACCESS_FILE_WRITE_ACCESS (0x02 << 14)
|
||||||
|
#define FSCTL_DEVICE_ACCESS_FILE_READ_WRITE_ACCESS (0x03 << 14)
|
||||||
|
#define FSCTL_DEVICE_ACCESS_MASK 0x0000c000
|
||||||
|
/* Function */
|
||||||
|
#define FSCTL_DEVICE_FUNCTION_MASK 0x00003ffc
|
||||||
|
/* Method */
|
||||||
|
#define FSCTL_DEVICE_METHOD_BUFFERED 0x00
|
||||||
|
#define FSCTL_DEVICE_METHOD_IN_DIRECT 0x01
|
||||||
|
#define FSCTL_DEVICE_METHOD_OUT_DIRECT 0x02
|
||||||
|
#define FSCTL_DEVICE_METHOD_NEITHER 0x03
|
||||||
|
#define FSCTL_DEVICE_METHOD_MASK 0x00000003
|
||||||
|
|
||||||
|
|
||||||
#define FSCTL_DFS_GET_REFERRALS 0x00060194
|
#define FSCTL_DFS_GET_REFERRALS 0x00060194
|
||||||
#define FSCTL_DFS_GET_REFERRALS_EX 0x000601B0
|
#define FSCTL_DFS_GET_REFERRALS_EX 0x000601B0
|
||||||
#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
|
#define FSCTL_REQUEST_OPLOCK_LEVEL_1 0x00090000
|
||||||
|
Loading…
Reference in New Issue
Block a user