Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* |
| 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 French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 23 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 24 | #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 French | c67593a | 2005-04-28 22:41:04 -0700 | [diff] [blame^] | 30 | #include "cifsfs.h" |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 31 | |
| 32 | int 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 French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 37 | __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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 62 | cFYI(1,("ioctl file %p cmd %u arg %lu",filep,command,arg)); |
| 63 | switch(command) { |
| 64 | case EXT2_IOC_GETFLAGS: |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 65 | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 75 | case EXT2_IOC_SETFLAGS: |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 76 | 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 Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 85 | cFYI(1,("set flags not implemented yet")); |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 86 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 87 | default: |
| 88 | cFYI(1,("unsupported ioctl")); |
| 89 | return rc; |
| 90 | } |
| 91 | #endif /* CONFIG_CIFS_POSIX */ |
Steve French | f654bac | 2005-04-28 22:41:04 -0700 | [diff] [blame] | 92 | |
| 93 | cifs_ioctl_out: |
| 94 | FreeXid(xid); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 95 | return rc; |
| 96 | } |