summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorJames Morris <jmorris@redhat.com>2004-10-18 18:15:51 -0700
committerLinus Torvalds <torvalds@ppc970.osdl.org>2004-10-18 18:15:51 -0700
commitdbcd7a5fb9d12336fb4a758ff9f3fe57dd21772c (patch)
treef6bde7c8b5afce63084c0edf19c81064676dc000 /include
parent8d8b5f34361b3cc7181df73e5aef89646fa68ddb (diff)
[PATCH] xattr consolidation v3 - generic xattr API
This patch consolidates common xattr handling logic into the core fs code, with modifications suggested by Christoph Hellwig (hang off superblock, remove locking, use generic code as methods), for use by ext2, ext3 and devpts, as well as upcoming tmpfs xattr code. Signed-off-by: James Morris <jmorris@redhat.com> Signed-off-by: Stephen Smalley <sds@epoch.ncsc.mil> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include')
-rw-r--r--include/linux/fs.h1
-rw-r--r--include/linux/xattr.h16
2 files changed, 17 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 13e1b4cb7c74..6768655fd11d 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -758,6 +758,7 @@ struct super_block {
int s_need_sync_fs;
atomic_t s_active;
void *s_security;
+ struct xattr_handler **s_xattr;
struct list_head s_dirty; /* dirty inodes */
struct list_head s_io; /* parked for writeback */
diff --git a/include/linux/xattr.h b/include/linux/xattr.h
index d9c5d5c83d49..23f9c61d9546 100644
--- a/include/linux/xattr.h
+++ b/include/linux/xattr.h
@@ -5,6 +5,7 @@
Copyright (C) 2001 by Andreas Gruenbacher <a.gruenbacher@computer.org>
Copyright (c) 2001-2002 Silicon Graphics, Inc. All Rights Reserved.
+ Copyright (c) 2004 Red Hat, Inc., James Morris <jmorris@redhat.com>
*/
#ifndef _LINUX_XATTR_H
#define _LINUX_XATTR_H
@@ -14,4 +15,19 @@
#define XATTR_SECURITY_PREFIX "security."
+struct xattr_handler {
+ char *prefix;
+ size_t (*list)(struct inode *inode, char *list, size_t list_size,
+ const char *name, size_t name_len);
+ int (*get)(struct inode *inode, const char *name, void *buffer,
+ size_t size);
+ int (*set)(struct inode *inode, const char *name, const void *buffer,
+ size_t size, int flags);
+};
+
+ssize_t generic_getxattr(struct dentry *dentry, const char *name, void *buffer, size_t size);
+ssize_t generic_listxattr(struct dentry *dentry, char *buffer, size_t buffer_size);
+int generic_setxattr(struct dentry *dentry, const char *name, const void *value, size_t size, int flags);
+int generic_removexattr(struct dentry *dentry, const char *name);
+
#endif /* _LINUX_XATTR_H */