aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/ioctl.c
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2018-10-07 20:19:58 -0400
committerSteve French <stfrench@microsoft.com>2018-10-23 22:16:05 -0400
commitf5b05d622a3e99e6a97a189fe500414be802a05c (patch)
tree173d227ce653e9a9ee4fbaffb4a7f4c7e2ea715e /fs/cifs/ioctl.c
parent8c1beb9801293b175cfa0341e5df89581a87dc02 (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.c21
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 @@
34#include "cifs_ioctl.h" 34#include "cifs_ioctl.h"
35#include <linux/btrfs.h> 35#include <linux/btrfs.h>
36 36
37static long cifs_ioctl_query_info(unsigned int xid, struct file *filep,
38 unsigned long p)
39{
40 struct cifsFileInfo *pSMBFile = filep->private_data;
41 struct cifs_tcon *tcon;
42
43 cifs_dbg(FYI, "%s %p\n", __func__, pSMBFile);
44 if (pSMBFile == NULL)
45 return -EISDIR;
46 tcon = tlink_tcon(pSMBFile->tlink);
47
48 if (tcon->ses->server->ops->ioctl_query_info)
49 return tcon->ses->server->ops->ioctl_query_info(
50 xid, pSMBFile, p);
51 else
52 return -EOPNOTSUPP;
53}
54
37static long cifs_ioctl_copychunk(unsigned int xid, struct file *dst_file, 55static long cifs_ioctl_copychunk(unsigned int xid, struct file *dst_file,
38 unsigned long srcfd) 56 unsigned long srcfd)
39{ 57{
@@ -194,6 +212,9 @@ long cifs_ioctl(struct file *filep, unsigned int command, unsigned long arg)
194 case CIFS_IOC_COPYCHUNK_FILE: 212 case CIFS_IOC_COPYCHUNK_FILE:
195 rc = cifs_ioctl_copychunk(xid, filep, arg); 213 rc = cifs_ioctl_copychunk(xid, filep, arg);
196 break; 214 break;
215 case CIFS_QUERY_INFO:
216 rc = cifs_ioctl_query_info(xid, filep, arg);
217 break;
197 case CIFS_IOC_SET_INTEGRITY: 218 case CIFS_IOC_SET_INTEGRITY:
198 if (pSMBFile == NULL) 219 if (pSMBFile == NULL)
199 break; 220 break;