Commit 6b3b5496 authored by J. Bruce Fields's avatar J. Bruce Fields Committed by Trond Myklebust

[PATCH] NFSv4: Add {get,set,list}xattr methods for nfs4

 Add {get,set,list}xattr methods for nfs4.  The new methods are no-ops, to be
 used by subsequent ACL patch.
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent ada70d94
...@@ -91,6 +91,9 @@ struct inode_operations nfs4_dir_inode_operations = { ...@@ -91,6 +91,9 @@ struct inode_operations nfs4_dir_inode_operations = {
.permission = nfs_permission, .permission = nfs_permission,
.getattr = nfs_getattr, .getattr = nfs_getattr,
.setattr = nfs_setattr, .setattr = nfs_setattr,
.getxattr = nfs4_getxattr,
.setxattr = nfs4_setxattr,
.listxattr = nfs4_listxattr,
}; };
#endif /* CONFIG_NFS_V4 */ #endif /* CONFIG_NFS_V4 */
......
...@@ -176,6 +176,13 @@ struct nfs4_state_recovery_ops { ...@@ -176,6 +176,13 @@ struct nfs4_state_recovery_ops {
extern struct dentry_operations nfs4_dentry_operations; extern struct dentry_operations nfs4_dentry_operations;
extern struct inode_operations nfs4_dir_inode_operations; extern struct inode_operations nfs4_dir_inode_operations;
extern struct inode_operations nfs4_file_inode_operations;
/* inode.c */
extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t);
extern int nfs4_setxattr(struct dentry *, const char *, const void *, size_t, int);
extern ssize_t nfs4_listxattr(struct dentry *, char *, size_t);
/* nfs4proc.c */ /* nfs4proc.c */
extern int nfs4_map_errors(int err); extern int nfs4_map_errors(int err);
......
...@@ -2732,6 +2732,34 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request) ...@@ -2732,6 +2732,34 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
return status; return status;
} }
int nfs4_setxattr(struct dentry *dentry, const char *key, const void *buf,
size_t buflen, int flags)
{
return -EOPNOTSUPP;
}
/* The getxattr man page suggests returning -ENODATA for unknown attributes,
* and that's what we'll do for e.g. user attributes that haven't been set.
* But we'll follow ext2/ext3's lead by returning -EOPNOTSUPP for unsupported
* attributes in kernel-managed attribute namespaces. */
ssize_t nfs4_getxattr(struct dentry *dentry, const char *key, void *buf,
size_t buflen)
{
return -EOPNOTSUPP;
}
ssize_t nfs4_listxattr(struct dentry *dentry, char *buf, size_t buflen)
{
ssize_t len = 0;
if (buf && buflen < len)
return -ERANGE;
if (buf)
memcpy(buf, "", 0);
return 0;
}
struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops = { struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops = {
.recover_open = nfs4_open_reclaim, .recover_open = nfs4_open_reclaim,
.recover_lock = nfs4_lock_reclaim, .recover_lock = nfs4_lock_reclaim,
...@@ -2742,11 +2770,20 @@ struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops = { ...@@ -2742,11 +2770,20 @@ struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops = {
.recover_lock = nfs4_lock_expired, .recover_lock = nfs4_lock_expired,
}; };
static struct inode_operations nfs4_file_inode_operations = {
.permission = nfs_permission,
.getattr = nfs_getattr,
.setattr = nfs_setattr,
.getxattr = nfs4_getxattr,
.setxattr = nfs4_setxattr,
.listxattr = nfs4_listxattr,
};
struct nfs_rpc_ops nfs_v4_clientops = { struct nfs_rpc_ops nfs_v4_clientops = {
.version = 4, /* protocol version */ .version = 4, /* protocol version */
.dentry_ops = &nfs4_dentry_operations, .dentry_ops = &nfs4_dentry_operations,
.dir_inode_ops = &nfs4_dir_inode_operations, .dir_inode_ops = &nfs4_dir_inode_operations,
.file_inode_ops = &nfs_file_inode_operations, .file_inode_ops = &nfs4_file_inode_operations,
.getroot = nfs4_proc_get_root, .getroot = nfs4_proc_get_root,
.getattr = nfs4_proc_getattr, .getattr = nfs4_proc_getattr,
.setattr = nfs4_proc_setattr, .setattr = nfs4_proc_setattr,
......
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