aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@citi.umich.edu>2005-06-22 13:16:22 -0400
committerTrond Myklebust <Trond.Myklebust@netapp.com>2005-06-22 16:07:10 -0400
commit6b3b5496d7b261d6c9202008dc528e52dbd11e57 (patch)
treebcd625880fc7799ddd85b132e3cdfd501f5a82b9 /fs
parentada70d9425bcc5e376fef8591e4e76e204c0834c (diff)
[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: J. Bruce Fields <bfields@citi.umich.edu> Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfs/dir.c3
-rw-r--r--fs/nfs/nfs4_fs.h7
-rw-r--r--fs/nfs/nfs4proc.c39
3 files changed, 48 insertions, 1 deletions
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index dffa21abd3ea..5720537bffdd 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -91,6 +91,9 @@ struct inode_operations nfs4_dir_inode_operations = {
91 .permission = nfs_permission, 91 .permission = nfs_permission,
92 .getattr = nfs_getattr, 92 .getattr = nfs_getattr,
93 .setattr = nfs_setattr, 93 .setattr = nfs_setattr,
94 .getxattr = nfs4_getxattr,
95 .setxattr = nfs4_setxattr,
96 .listxattr = nfs4_listxattr,
94}; 97};
95 98
96#endif /* CONFIG_NFS_V4 */ 99#endif /* CONFIG_NFS_V4 */
diff --git a/fs/nfs/nfs4_fs.h b/fs/nfs/nfs4_fs.h
index 85cf3bd36921..d71f416bd9e5 100644
--- a/fs/nfs/nfs4_fs.h
+++ b/fs/nfs/nfs4_fs.h
@@ -176,6 +176,13 @@ struct nfs4_state_recovery_ops {
176 176
177extern struct dentry_operations nfs4_dentry_operations; 177extern struct dentry_operations nfs4_dentry_operations;
178extern struct inode_operations nfs4_dir_inode_operations; 178extern struct inode_operations nfs4_dir_inode_operations;
179extern struct inode_operations nfs4_file_inode_operations;
180
181/* inode.c */
182extern ssize_t nfs4_getxattr(struct dentry *, const char *, void *, size_t);
183extern int nfs4_setxattr(struct dentry *, const char *, const void *, size_t, int);
184extern ssize_t nfs4_listxattr(struct dentry *, char *, size_t);
185
179 186
180/* nfs4proc.c */ 187/* nfs4proc.c */
181extern int nfs4_map_errors(int err); 188extern int nfs4_map_errors(int err);
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index a5a8cb3159a0..1b14d17ae9a4 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -2732,6 +2732,34 @@ nfs4_proc_lock(struct file *filp, int cmd, struct file_lock *request)
2732 return status; 2732 return status;
2733} 2733}
2734 2734
2735
2736int nfs4_setxattr(struct dentry *dentry, const char *key, const void *buf,
2737 size_t buflen, int flags)
2738{
2739 return -EOPNOTSUPP;
2740}
2741
2742/* The getxattr man page suggests returning -ENODATA for unknown attributes,
2743 * and that's what we'll do for e.g. user attributes that haven't been set.
2744 * But we'll follow ext2/ext3's lead by returning -EOPNOTSUPP for unsupported
2745 * attributes in kernel-managed attribute namespaces. */
2746ssize_t nfs4_getxattr(struct dentry *dentry, const char *key, void *buf,
2747 size_t buflen)
2748{
2749 return -EOPNOTSUPP;
2750}
2751
2752ssize_t nfs4_listxattr(struct dentry *dentry, char *buf, size_t buflen)
2753{
2754 ssize_t len = 0;
2755
2756 if (buf && buflen < len)
2757 return -ERANGE;
2758 if (buf)
2759 memcpy(buf, "", 0);
2760 return 0;
2761}
2762
2735struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops = { 2763struct nfs4_state_recovery_ops nfs4_reboot_recovery_ops = {
2736 .recover_open = nfs4_open_reclaim, 2764 .recover_open = nfs4_open_reclaim,
2737 .recover_lock = nfs4_lock_reclaim, 2765 .recover_lock = nfs4_lock_reclaim,
@@ -2742,11 +2770,20 @@ struct nfs4_state_recovery_ops nfs4_network_partition_recovery_ops = {
2742 .recover_lock = nfs4_lock_expired, 2770 .recover_lock = nfs4_lock_expired,
2743}; 2771};
2744 2772
2773static struct inode_operations nfs4_file_inode_operations = {
2774 .permission = nfs_permission,
2775 .getattr = nfs_getattr,
2776 .setattr = nfs_setattr,
2777 .getxattr = nfs4_getxattr,
2778 .setxattr = nfs4_setxattr,
2779 .listxattr = nfs4_listxattr,
2780};
2781
2745struct nfs_rpc_ops nfs_v4_clientops = { 2782struct nfs_rpc_ops nfs_v4_clientops = {
2746 .version = 4, /* protocol version */ 2783 .version = 4, /* protocol version */
2747 .dentry_ops = &nfs4_dentry_operations, 2784 .dentry_ops = &nfs4_dentry_operations,
2748 .dir_inode_ops = &nfs4_dir_inode_operations, 2785 .dir_inode_ops = &nfs4_dir_inode_operations,
2749 .file_inode_ops = &nfs_file_inode_operations, 2786 .file_inode_ops = &nfs4_file_inode_operations,
2750 .getroot = nfs4_proc_get_root, 2787 .getroot = nfs4_proc_get_root,
2751 .getattr = nfs4_proc_getattr, 2788 .getattr = nfs4_proc_getattr,
2752 .setattr = nfs4_proc_setattr, 2789 .setattr = nfs4_proc_setattr,