+#ifdef CONFIG_CIFS_XATTR
+ int xid;
+ struct cifs_sb_info *cifs_sb;
+ struct cifsTconInfo *pTcon;
+ struct super_block * sb;
+ char * full_path;
+
+ if(direntry == NULL)
+ return -EIO;
+ if(direntry->d_inode == NULL)
+ return -EIO;
+ sb = direntry->d_inode->i_sb;
+ if(sb == NULL)
+ return -EIO;
+
+ xid = GetXid();
+
+ cifs_sb = CIFS_SB(sb);
+ pTcon = cifs_sb->tcon;
+
+ down(&sb->s_vfs_rename_sem);
+ full_path = build_path_from_dentry(direntry);
+ up(&sb->s_vfs_rename_sem);
+ if(full_path == NULL) {
+ FreeXid(xid);
+ return -ENOMEM;
+ }
+ /* return dos attributes as pseudo xattr */
+ /* return alt name if available as pseudo attr */
+ if(ea_name == NULL) {
+ cFYI(1,("Null xattr names not supported"));
+ } else if(strncmp(ea_name,CIFS_XATTR_USER_PREFIX,5) == 0) {
+ if(strncmp(ea_name,CIFS_XATTR_DOS_ATTRIB,14) == 0) {
+ cFYI(1,("attempt to query cifs inode metadata"));
+ /* revalidate/getattr then populate from inode */
+ } /* BB add else when above is implemented */
+ ea_name += 5; /* skip past user. prefix */
+ rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value,
+ buf_size, cifs_sb->local_nls);
+ } else if(strncmp(ea_name, CIFS_XATTR_OS2_PREFIX,4) == 0) {
+ ea_name += 4; /* skip past os2. prefix */
+ rc = CIFSSMBQueryEA(xid,pTcon,full_path,ea_name,ea_value,
+ buf_size, cifs_sb->local_nls);
+ } else if(strncmp(ea_name,POSIX_ACL_XATTR_ACCESS,strlen(POSIX_ACL_XATTR_ACCESS)) == 0) {
+#ifdef CONFIG_CIFS_POSIX
+ rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
+ ea_value, buf_size, ACL_TYPE_ACCESS,
+ cifs_sb->local_nls);
+#else
+ cFYI(1,("query POSIX ACL not supported yet"));
+#endif /* CONFIG_CIFS_POSIX */
+ } else if(strncmp(ea_name,POSIX_ACL_XATTR_DEFAULT,strlen(POSIX_ACL_XATTR_DEFAULT)) == 0) {
+#ifdef CONFIG_CIFS_POSIX
+ rc = CIFSSMBGetPosixACL(xid, pTcon, full_path,
+ ea_value, buf_size, ACL_TYPE_DEFAULT,
+ cifs_sb->local_nls);
+#else
+ cFYI(1,("query POSIX default ACL not supported yet"));
+#endif
+ } else if(strncmp(ea_name,
+ CIFS_XATTR_TRUSTED_PREFIX,XATTR_TRUSTED_PREFIX_LEN) == 0) {
+ cFYI(1,("Trusted xattr namespace not supported yet"));
+ } else if(strncmp(ea_name,
+ CIFS_XATTR_SECURITY_PREFIX,XATTR_SECURITY_PREFIX_LEN) == 0) {
+ cFYI(1,("Security xattr namespace not supported yet"));
+ } else {
+ cFYI(1,("illegal xattr name request %s (only user namespace supported)",ea_name));
+ }
+
+ /* We could add an additional check for streams ie
+ if proc/fs/cifs/streamstoxattr is set then
+ search server for EAs or streams to
+ returns as xattrs */
+
+ if(rc == -EINVAL)
+ rc = -EOPNOTSUPP;
+
+ if (full_path)
+ kfree(full_path);
+ FreeXid(xid);
+#endif