diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2018-10-07 19:19:58 -0500 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2018-10-23 21:16:05 -0500 |
commit | f5b05d622a3e99e6a97a189fe500414be802a05c (patch) | |
tree | 173d227ce653e9a9ee4fbaffb4a7f4c7e2ea715e /fs/cifs/ioctl.c | |
parent | 8c1beb9801293b175cfa0341e5df89581a87dc02 (diff) |
cifs: add IOCTL for QUERY_INFO passthrough to userspace
This allows userspace tools to query the raw info levels for cifs files
and process the response in userspace.
In particular this is useful for many of those data where there is no
corresponding native data structure in linux.
For example querying the security descriptor for a file and extract the
SIDs.
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs/ioctl.c')
-rw-r--r-- | fs/cifs/ioctl.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/fs/cifs/ioctl.c b/fs/cifs/ioctl.c index 565cf7d6f81f..77c7a5796dfd 100644 --- a/fs/cifs/ioctl.c +++ b/fs/cifs/ioctl.c @@ -34,6 +34,24 @@ #include "cifs_ioctl.h" #include <linux/btrfs.h> +static long cifs_ioctl_query_info(unsigned int xid, struct file *filep, + unsigned long p) +{ + struct cifsFileInfo *pSMBFile = filep->private_data; + struct cifs_tcon *tcon; + + cifs_dbg(FYI, "%s %p\n", __func__, pSMBFile); + if (pSMBFile == NULL) + return -EISDIR; + tcon = tlink_tcon(pSMBFile->tlink); + + if (tcon->ses->server->ops->ioctl_query_info) + return tcon->ses->server->ops->ioctl_query_info( + xid, pSMBFile, p); + else + return -EOPNOTSUPP; +} + static long cifs_ioctl_copychunk(unsigned int xid, struct file *dst_file, unsigned long srcfd) { @@ -194,6 +212,9 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg) case CIFS_IOC_COPYCHUNK_FILE: rc = cifs_ioctl_copychunk(xid, filep, arg); break; + case CIFS_QUERY_INFO: + rc = cifs_ioctl_query_info(xid, filep, arg); + break; case CIFS_IOC_SET_INTEGRITY: if (pSMBFile == NULL) break; |