Commit 7a1f6754 authored by Steve French's avatar Steve French Committed by Steve French

[CIFS] xattr support for cifs filesystem part 5 of 5, add removexattr capability

Signed-off-by:  Steve French (sfrench@us.ibm.com)
parent 486326cf
......@@ -1652,6 +1652,22 @@ config CIFS_STATS
Enabling this option will cause statistics for each server share
mounted by the cifs client to be displayed in /proc/fs/cifs/Stats
config CIFS_XATTR
bool "CIFS extended attributes (EXPERIMENTAL)"
depends on CIFS
help
Extended attributes are name:value pairs associated with inodes by
the kernel or by users (see the attr(5) manual page, or visit
<http://acl.bestbits.at/> for details). CIFS maps the name of
extended attributes beginning with the user namespace prefix
to SMB/CIFS EAs. EAs are stored on Windows servers without the
user namespace prefix, but their names are seen by Linux cifs clients
prefaced by the user namespace prefix. The system namespace
(used by some filesystems to store ACLs) is not supported at
this time.
If unsure, say N.
config CIFS_POSIX
bool "CIFS POSIX Extensions (EXPERIMENTAL)"
depends on CIFS
......
Version 1.22
------------
Add config option to enable XATTR (extended attribute) support, mapping
xattr names in the "user." namespace space to SMB/CIFS EAs.
Version 1.21
------------
Add new mount parm to control whether mode check (vfs_permission) is done on
......
......@@ -3370,7 +3370,8 @@ CIFSSMBSetEA(const int xid, struct cifsTconInfo *tcon, const char *fileName,
/*BB add length check that it would fit in negotiated SMB buffer size BB */
/* if(ea_value_len > buffer_size - 512 (enough for header)) */
memcpy(parm_data->list[0].name+name_len+1,ea_value,ea_value_len);
if(ea_value_len)
memcpy(parm_data->list[0].name+name_len+1,ea_value,ea_value_len);
pSMB->TotalDataCount = pSMB->DataCount;
pSMB->ParameterCount = cpu_to_le16(pSMB->ParameterCount);
......
......@@ -34,9 +34,51 @@
/* also note could add check for security prefix XATTR_SECURITY_PREFIX */
int cifs_removexattr(struct dentry * direntry, const char * name)
int cifs_removexattr(struct dentry * direntry, const char * ea_name)
{
int rc = -EOPNOTSUPP;
#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;
}
if(ea_name == NULL) {
cFYI(1,("Null xattr names not supported"));
} else if(strncmp(ea_name,CIFS_XATTR_USER_PREFIX,5)) {
cFYI(1,("illegal xattr namespace %s (only user namespace supported)",ea_name));
/* BB what if no namespace prefix? */
/* Should we just pass them to server, except for
system and perhaps security prefixes? */
} else {
ea_name+=5; /* skip past user. prefix */
rc = CIFSSMBSetEA(xid,pTcon,full_path,ea_name,0,
(__u16)0, cifs_sb->local_nls);
}
if (full_path)
kfree(full_path);
FreeXid(xid);
#endif
return rc;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment