patch-2_6_7-vs1_9_1_12
[linux-2.6.git] / fs / cifs / xattr.c
1 /*
2  *   fs/cifs/xattr.c
3  *
4  *   Copyright (c) International Business Machines  Corp., 2003
5  *   Author(s): Steve French (sfrench@us.ibm.com)
6  *
7  *   This library is free software; you can redistribute it and/or modify
8  *   it under the terms of the GNU Lesser General Public License as published
9  *   by the Free Software Foundation; either version 2.1 of the License, or
10  *   (at your option) any later version.
11  *
12  *   This library is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
15  *   the GNU Lesser General Public License for more details.
16  *
17  *   You should have received a copy of the GNU Lesser General Public License
18  *   along with this library; if not, write to the Free Software
19  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20  */
21
22 #include <linux/fs.h>
23 #include "cifsfs.h"
24 #include "cifspdu.h"
25 #include "cifsglob.h"
26 #include "cifsproto.h"
27 #include "cifs_debug.h"
28
29 int cifs_removexattr(struct dentry * direntry, const char * name)
30 {
31         int rc = -EOPNOTSUPP;
32         return rc;
33 }
34
35 int cifs_setxattr(struct dentry * direntry, const char * name,
36         const void * value, size_t size, int flags)
37 {
38         int rc = -EOPNOTSUPP;
39         return rc;
40 }
41
42 ssize_t cifs_getxattr(struct dentry * direntry, const char * name,
43          void * value, size_t size)
44 {
45         ssize_t rc = -EOPNOTSUPP;
46         return rc;
47 }
48
49 ssize_t cifs_listxattr(struct dentry * direntry, char * ea_data, size_t ea_size)
50 {
51         ssize_t rc = -EOPNOTSUPP;
52 #ifdef CONFIG_CIFS_XATTR
53         int xid;
54         struct cifs_sb_info *cifs_sb;
55         struct cifsTconInfo *pTcon;
56         struct super_block * sb;
57         char * full_path;
58         if(direntry == NULL)
59                 return -EIO;
60         if(direntry->d_inode == NULL)
61                 return -EIO;
62         sb = direntry->d_inode->i_sb;
63         if(sb == NULL)
64                 return -EIO;
65         xid = GetXid();
66
67         cifs_sb = CIFS_SB(sb);
68         pTcon = cifs_sb->tcon;
69
70         down(&sb->s_vfs_rename_sem);
71         full_path = build_path_from_dentry(direntry);
72         up(&sb->s_vfs_rename_sem);
73         if(full_path == NULL) {
74                 FreeXid(xid);
75                 return -ENOMEM;
76         }
77         /* return dosattributes as pseudo xattr */
78         /* return alt name if available as pseudo attr */
79
80         /* if proc/fs/cifs/streamstoxattr is set then
81                 search server for EAs or streams to 
82                 returns as xattrs */
83         rc = CIFSSMBQAllEAs(xid,pTcon,full_path,ea_data,ea_size,cifs_sb->local_nls);
84         FreeXid(xid);
85 #endif
86         return rc;
87 }