Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 97d21167 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull vfs xattr updates from Al Viro:
 "xattr stuff from Andreas

  This completes the switch to xattr_handler ->get()/->set() from
  ->getxattr/->setxattr/->removexattr"

* 'work.xattr' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
  vfs: Remove {get,set,remove}xattr inode operations
  xattr: Stop calling {get,set,remove}xattr inode operations
  vfs: Check for the IOP_XATTR flag in listxattr
  xattr: Add __vfs_{get,set,remove}xattr helpers
  libfs: Use IOP_XATTR flag for empty directory handling
  vfs: Use IOP_XATTR flag for bad-inode handling
  vfs: Add IOP_XATTR inode operations flag
  vfs: Move xattr_resolve_name to the front of fs/xattr.c
  ecryptfs: Switch to generic xattr handlers
  sockfs: Get rid of getxattr iop
  sockfs: getxattr: Fail with -EOPNOTSUPP for invalid attribute names
  kernfs: Switch to generic xattr handlers
  hfs: Switch to generic xattr handlers
  jffs2: Remove jffs2_{get,set,remove}xattr macros
  xattr: Remove unnecessary NULL attribute name check
parents 30066ce6 fd50ecad
Loading
Loading
Loading
Loading
+18 −6
Original line number Diff line number Diff line
@@ -61,10 +61,7 @@ prototypes:
	int (*get_acl)(struct inode *, int);
	int (*setattr) (struct dentry *, struct iattr *);
	int (*getattr) (struct vfsmount *, struct dentry *, struct kstat *);
	int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	int (*removexattr) (struct dentry *, const char *);
	int (*fiemap)(struct inode *, struct fiemap_extent_info *, u64 start, u64 len);
	void (*update_time)(struct inode *, struct timespec *, int);
	int (*atomic_open)(struct inode *, struct dentry *,
@@ -91,15 +88,13 @@ setattr: yes
permission:	no (may not block if called in rcu-walk mode)
get_acl:	no
getattr:	no
setxattr:	yes
getxattr:	no
listxattr:	no
removexattr:	yes
fiemap:		no
update_time:	no
atomic_open:	yes
tmpfile:	no


	Additionally, ->rmdir(), ->unlink() and ->rename() have ->i_mutex on
victim.
	cross-directory ->rename() and rename2() has (per-superblock)
@@ -108,6 +103,23 @@ victim.
See Documentation/filesystems/directory-locking for more detailed discussion
of the locking scheme for directory operations.

----------------------- xattr_handler operations -----------------------
prototypes:
	bool (*list)(struct dentry *dentry);
	int (*get)(const struct xattr_handler *handler, struct dentry *dentry,
		   struct inode *inode, const char *name, void *buffer,
		   size_t size);
	int (*set)(const struct xattr_handler *handler, struct dentry *dentry,
		   struct inode *inode, const char *name, const void *buffer,
		   size_t size, int flags);

locking rules:
	all may block
		i_mutex(inode)
list:		no
get:		no
set:		yes

--------------------------- super_operations ---------------------------
prototypes:
	struct inode *(*alloc_inode)(struct super_block *sb);
+30 −15
Original line number Diff line number Diff line
@@ -323,6 +323,35 @@ Whoever sets up the inode is responsible for filling in the "i_op" field. This
is a pointer to a "struct inode_operations" which describes the methods that
can be performed on individual inodes.

struct xattr_handlers
---------------------

On filesystems that support extended attributes (xattrs), the s_xattr
superblock field points to a NULL-terminated array of xattr handlers.  Extended
attributes are name:value pairs.

  name: Indicates that the handler matches attributes with the specified name
	(such as "system.posix_acl_access"); the prefix field must be NULL.

  prefix: Indicates that the handler matches all attributes with the specified
	name prefix (such as "user."); the name field must be NULL.

  list: Determine if attributes matching this xattr handler should be listed
	for a particular dentry.  Used by some listxattr implementations like
	generic_listxattr.

  get: Called by the VFS to get the value of a particular extended attribute.
	This method is called by the getxattr(2) system call.

  set: Called by the VFS to set the value of a particular extended attribute.
	When the new value is NULL, called to remove a particular extended
	attribute.  This method is called by the the setxattr(2) and
	removexattr(2) system calls.

When none of the xattr handlers of a filesystem match the specified attribute
name or when a filesystem doesn't support extended attributes, the various
*xattr(2) system calls return -EOPNOTSUPP.


The Inode Object
================
@@ -356,10 +385,7 @@ struct inode_operations {
	int (*get_acl)(struct inode *, int);
	int (*setattr) (struct dentry *, struct iattr *);
	int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
	int (*setxattr) (struct dentry *, const char *,const void *,size_t,int);
	ssize_t (*getxattr) (struct dentry *, const char *, void *, size_t);
	ssize_t (*listxattr) (struct dentry *, char *, size_t);
	int (*removexattr) (struct dentry *, const char *);
	void (*update_time)(struct inode *, struct timespec *, int);
	int (*atomic_open)(struct inode *, struct dentry *, struct file *,
			unsigned open_flag, umode_t create_mode, int *opened);
@@ -463,19 +489,8 @@ otherwise noted.
  getattr: called by the VFS to get attributes of a file. This method
  	is called by stat(2) and related system calls.

  setxattr: called by the VFS to set an extended attribute for a file.
  	Extended attribute is a name:value pair associated with an
  	inode. This method is called by setxattr(2) system call.

  getxattr: called by the VFS to retrieve the value of an extended
  	attribute name. This method is called by getxattr(2) function
  	call.

  listxattr: called by the VFS to list all extended attributes for a
  	given file. This method is called by listxattr(2) system call.

  removexattr: called by the VFS to remove an extended attribute from
  	a file. This method is called by removexattr(2) system call.
	given file. This method is called by the listxattr(2) system call.

  update_time: called by the VFS to update a specific time or the i_version of
  	an inode.  If this is not defined the VFS will update the inode itself
+0 −3
Original line number Diff line number Diff line
@@ -3268,10 +3268,7 @@ const struct inode_operations ll_file_inode_operations = {
	.setattr	= ll_setattr,
	.getattr	= ll_getattr,
	.permission	= ll_inode_permission,
	.setxattr	= generic_setxattr,
	.getxattr	= generic_getxattr,
	.listxattr	= ll_listxattr,
	.removexattr	= generic_removexattr,
	.fiemap		= ll_fiemap,
	.get_acl	= ll_get_acl,
};
+0 −6
Original line number Diff line number Diff line
@@ -1152,10 +1152,7 @@ const struct inode_operations ll_dir_inode_operations = {
	.setattr	    = ll_setattr,
	.getattr	    = ll_getattr,
	.permission	 = ll_inode_permission,
	.setxattr	   = generic_setxattr,
	.getxattr	   = generic_getxattr,
	.listxattr	  = ll_listxattr,
	.removexattr	= generic_removexattr,
	.get_acl	    = ll_get_acl,
};

@@ -1163,9 +1160,6 @@ const struct inode_operations ll_special_inode_operations = {
	.setattr	= ll_setattr,
	.getattr	= ll_getattr,
	.permission     = ll_inode_permission,
	.setxattr       = generic_setxattr,
	.getxattr       = generic_getxattr,
	.listxattr      = ll_listxattr,
	.removexattr    = generic_removexattr,
	.get_acl	    = ll_get_acl,
};
+0 −3
Original line number Diff line number Diff line
@@ -154,8 +154,5 @@ const struct inode_operations ll_fast_symlink_inode_operations = {
	.get_link	= ll_get_link,
	.getattr	= ll_getattr,
	.permission	= ll_inode_permission,
	.setxattr	= generic_setxattr,
	.getxattr	= generic_getxattr,
	.listxattr	= ll_listxattr,
	.removexattr	= generic_removexattr,
};
Loading