diff options
author | Steve French <stevef@smfhome1.smfdom> | 2004-07-28 13:00:40 -0500 |
---|---|---|
committer | Steve French <cifs.adm@hostme.bitkeeper.com> | 2004-07-28 13:00:40 -0500 |
commit | 7a1f67547e8b10223e97fedf39715f59efa1f0ae (patch) | |
tree | baedbb108e948c9a2649ac057cb6e06a1b40465f /fs | |
parent | 486326cf4179a2ab63491503927047c6d053ece5 (diff) | |
download | history-7a1f67547e8b10223e97fedf39715f59efa1f0ae.tar.gz |
[CIFS] xattr support for cifs filesystem part 5 of 5, add removexattr capability
Signed-off-by: Steve French (sfrench@us.ibm.com)
Diffstat (limited to 'fs')
-rw-r--r-- | fs/Kconfig | 16 | ||||
-rw-r--r-- | fs/cifs/CHANGES | 5 | ||||
-rw-r--r-- | fs/cifs/cifssmb.c | 3 | ||||
-rw-r--r-- | fs/cifs/xattr.c | 44 |
4 files changed, 66 insertions, 2 deletions
diff --git a/fs/Kconfig b/fs/Kconfig index 5e7c10fa8f8f95..82810094fdcea5 100644 --- a/fs/Kconfig +++ b/fs/Kconfig @@ -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 diff --git a/fs/cifs/CHANGES b/fs/cifs/CHANGES index 3ed47af501548b..a853ec02e494cb 100644 --- a/fs/cifs/CHANGES +++ b/fs/cifs/CHANGES @@ -1,3 +1,8 @@ +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 diff --git a/fs/cifs/cifssmb.c b/fs/cifs/cifssmb.c index cb26572ce826d6..dc9e0fd4edd9dd 100644 --- a/fs/cifs/cifssmb.c +++ b/fs/cifs/cifssmb.c @@ -3370,7 +3370,8 @@ SetEARetry: /*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); diff --git a/fs/cifs/xattr.c b/fs/cifs/xattr.c index 0e6b36b4ec8710..5380c349b7dbee 100644 --- a/fs/cifs/xattr.c +++ b/fs/cifs/xattr.c @@ -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; } |