blob: a4f1c34a8dc7fa518e557f8f57beab4c1a4ee3a5 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 * fs/cifs/ioctl.c
3 *
4 * vfs operations that deal with io control
5 *
6 * Copyright (C) International Business Machines Corp., 2005
7 * Author(s): Steve French (sfrench@us.ibm.com)
8 *
9 * This library is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU Lesser General Public License as published
11 * by the Free Software Foundation; either version 2.1 of the License, or
12 * (at your option) any later version.
13 *
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
17 * the GNU Lesser General Public License for more details.
18 *
19 * You should have received a copy of the GNU Lesser General Public License
20 * along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 */
Steve Frenchf654bac2005-04-28 22:41:04 -070023
Linus Torvalds1da177e2005-04-16 15:20:36 -070024#include <linux/fs.h>
25#include <linux/ext2_fs.h>
26#include "cifspdu.h"
27#include "cifsglob.h"
28#include "cifsproto.h"
29#include "cifs_debug.h"
Steve Frenchc67593a2005-04-28 22:41:04 -070030#include "cifsfs.h"
Linus Torvalds1da177e2005-04-16 15:20:36 -070031
32int cifs_ioctl (struct inode * inode, struct file * filep,
33 unsigned int command, unsigned long arg)
34{
35 int rc = -ENOTTY; /* strange error - but the precedent */
36#ifdef CONFIG_CIFS_POSIX
Steve Frenchf654bac2005-04-28 22:41:04 -070037 __u64 ExtAttrBits = 0;
38 __u64 ExtAttrMask = 0;
39 __u64 caps;
40#endif /* CONFIG_CIFS_POSIX */
41 int xid;
42 struct cifs_sb_info *cifs_sb;
43 struct cifsTconInfo *tcon;
44 struct cifsFileInfo *pSMBFile =
45 (struct cifsFileInfo *)filep->private_data;
46
47 xid = GetXid();
48
49 cifs_sb = CIFS_SB(inode->i_sb);
50 tcon = cifs_sb->tcon;
51 if (pSMBFile == NULL)
52 goto cifs_ioctl_out;
53
54#ifdef CONFIG_CIFS_POSIX
55 if(tcon)
56 caps = le64_to_cpu(tcon->fsUnixInfo.Capability);
57 else {
58 rc = -EIO;
59 goto cifs_ioctl_out;
60 }
61
Linus Torvalds1da177e2005-04-16 15:20:36 -070062 cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg));
63 switch(command) {
64 case EXT2_IOC_GETFLAGS:
Steve Frenchf654bac2005-04-28 22:41:04 -070065 if(CIFS_UNIX_EXTATTR_CAP & caps) {
66 rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
67 &ExtAttrBits, &ExtAttrMask);
68 if(rc == 0)
69 rc = put_user(ExtAttrBits &
70 EXT2_FL_USER_VISIBLE,
71 (int __user *)arg);
72 }
73 break;
74
Linus Torvalds1da177e2005-04-16 15:20:36 -070075 case EXT2_IOC_SETFLAGS:
Steve Frenchf654bac2005-04-28 22:41:04 -070076 if(CIFS_UNIX_EXTATTR_CAP & caps) {
77 if(get_user(ExtAttrBits,(int __user *)arg)) {
78 rc = -EFAULT;
79 goto cifs_ioctl_out;
80 }
81 /* rc = CIFSGetExtAttr(xid, tcon, pSMBFile->netfid,
82 extAttrBits, &ExtAttrMask);*/
83
84 }
Linus Torvalds1da177e2005-04-16 15:20:36 -070085 cFYI(1,("set flags not implemented yet"));
Steve Frenchf654bac2005-04-28 22:41:04 -070086 break;
Linus Torvalds1da177e2005-04-16 15:20:36 -070087 default:
88 cFYI(1,("unsupported ioctl"));
89 return rc;
90 }
91#endif /* CONFIG_CIFS_POSIX */
Steve Frenchf654bac2005-04-28 22:41:04 -070092
93cifs_ioctl_out:
94 FreeXid(xid);
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 return rc;
96}