Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
xattr.c File Reference
#include <linux/fs.h>
#include <linux/slab.h>
#include <linux/file.h>
#include <linux/xattr.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/security.h>
#include <linux/evm.h>
#include <linux/syscalls.h>
#include <linux/export.h>
#include <linux/fsnotify.h>
#include <linux/audit.h>
#include <linux/vmalloc.h>
#include <linux/posix_acl_xattr.h>
#include <asm/uaccess.h>

Go to the source code of this file.

Functions

: name of the new extended attribute

simple_xattr_set - xattr SET operation for in-memory/pseudo filesystems : target simple_xattr list

: value of the new xattr. If NULL, will remove the attribute : size of the new xattr : XATTR_{CREATE|REPLACE}

XATTR_CREATE is set, the xattr shouldn't exist already; otherwise fails with -EEXIST. If XATTR_REPLACE is set, the xattr should exist; otherwise, fails with -ENODATA.

Returns 0 on success, -errno on failure.

int simple_xattr_set (struct simple_xattrs *xattrs, const char *name, const void *value, size_t size, int flags)
 
int simple_xattr_remove (struct simple_xattrs *xattrs, const char *name)
 
ssize_t simple_xattr_list (struct simple_xattrs *xattrs, char *buffer, size_t size)
 
void simple_xattr_list_add (struct simple_xattrs *xattrs, struct simple_xattr *new_xattr)
 

to

- size of - flags to pass into filesystem operations

returns the result of the internal setxattr or setsecurity operations.

This function requires the caller to lock the inode's i_mutex before it is executed. It also assumes that the caller will make the appropriate permission checks.

#define for_each_xattr_handler(handlers, handler)
 
int __vfs_setxattr_noperm (struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
 
int vfs_setxattr (struct dentry *dentry, const char *name, const void *value, size_t size, int flags)
 
 EXPORT_SYMBOL_GPL (vfs_setxattr)
 
ssize_t xattr_getsecurity (struct inode *inode, const char *name, void *value, size_t size)
 
 EXPORT_SYMBOL_GPL (xattr_getsecurity)
 
ssize_t vfs_getxattr_alloc (struct dentry *dentry, const char *name, char **xattr_value, size_t xattr_size, gfp_t flags)
 
int vfs_xattr_cmp (struct dentry *dentry, const char *xattr_name, const char *value, size_t size, gfp_t flags)
 
ssize_t vfs_getxattr (struct dentry *dentry, const char *name, void *value, size_t size)
 
 EXPORT_SYMBOL_GPL (vfs_getxattr)
 
ssize_t vfs_listxattr (struct dentry *d, char *list, size_t size)
 
 EXPORT_SYMBOL_GPL (vfs_listxattr)
 
int vfs_removexattr (struct dentry *dentry, const char *name)
 
 EXPORT_SYMBOL_GPL (vfs_removexattr)
 
 SYSCALL_DEFINE5 (setxattr, const char __user *, pathname, const char __user *, name, const void __user *, value, size_t, size, int, flags)
 
 SYSCALL_DEFINE5 (lsetxattr, const char __user *, pathname, const char __user *, name, const void __user *, value, size_t, size, int, flags)
 
 SYSCALL_DEFINE5 (fsetxattr, int, fd, const char __user *, name, const void __user *, value, size_t, size, int, flags)
 
 SYSCALL_DEFINE4 (getxattr, const char __user *, pathname, const char __user *, name, void __user *, value, size_t, size)
 
 SYSCALL_DEFINE4 (lgetxattr, const char __user *, pathname, const char __user *, name, void __user *, value, size_t, size)
 
 SYSCALL_DEFINE4 (fgetxattr, int, fd, const char __user *, name, void __user *, value, size_t, size)
 
 SYSCALL_DEFINE3 (listxattr, const char __user *, pathname, char __user *, list, size_t, size)
 
 SYSCALL_DEFINE3 (llistxattr, const char __user *, pathname, char __user *, list, size_t, size)
 
 SYSCALL_DEFINE3 (flistxattr, int, fd, char __user *, list, size_t, size)
 
 SYSCALL_DEFINE2 (removexattr, const char __user *, pathname, const char __user *, name)
 
 SYSCALL_DEFINE2 (lremovexattr, const char __user *, pathname, const char __user *, name)
 
 SYSCALL_DEFINE2 (fremovexattr, int, fd, const char __user *, name)
 
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)
 
 EXPORT_SYMBOL (generic_getxattr)
 
 EXPORT_SYMBOL (generic_listxattr)
 
 EXPORT_SYMBOL (generic_setxattr)
 
 EXPORT_SYMBOL (generic_removexattr)
 
struct simple_xattrsimple_xattr_alloc (const void *value, size_t size)
 
int simple_xattr_get (struct simple_xattrs *xattrs, const char *name, void *buffer, size_t size)
 

Macro Definition Documentation

#define for_each_xattr_handler (   handlers,
  handler 
)
Value:
for ((handler) = *(handlers)++; \
(handler) != NULL; \
(handler) = *(handlers)++)

Definition at line 688 of file xattr.c.

Function Documentation

int __vfs_setxattr_noperm ( struct dentry dentry,
const char name,
const void value,
size_t  size,
int  flags 
)

Definition at line 92 of file xattr.c.

EXPORT_SYMBOL ( generic_getxattr  )
EXPORT_SYMBOL ( generic_listxattr  )
EXPORT_SYMBOL ( generic_setxattr  )
EXPORT_SYMBOL ( generic_removexattr  )
EXPORT_SYMBOL_GPL ( vfs_setxattr  )
EXPORT_SYMBOL_GPL ( xattr_getsecurity  )
EXPORT_SYMBOL_GPL ( vfs_getxattr  )
EXPORT_SYMBOL_GPL ( vfs_listxattr  )
EXPORT_SYMBOL_GPL ( vfs_removexattr  )
ssize_t generic_getxattr ( struct dentry dentry,
const char name,
void buffer,
size_t  size 
)

Definition at line 718 of file xattr.c.

ssize_t generic_listxattr ( struct dentry dentry,
char buffer,
size_t  buffer_size 
)

Definition at line 733 of file xattr.c.

int generic_removexattr ( struct dentry dentry,
const char name 
)

Definition at line 780 of file xattr.c.

int generic_setxattr ( struct dentry dentry,
const char name,
const void value,
size_t  size,
int  flags 
)

Definition at line 763 of file xattr.c.

struct simple_xattr* simple_xattr_alloc ( const void value,
size_t  size 
)
read

Definition at line 799 of file xattr.c.

int simple_xattr_get ( struct simple_xattrs xattrs,
const char name,
void buffer,
size_t  size 
)

Definition at line 821 of file xattr.c.

ssize_t simple_xattr_list ( struct simple_xattrs xattrs,
char buffer,
size_t  size 
)

Definition at line 934 of file xattr.c.

void simple_xattr_list_add ( struct simple_xattrs xattrs,
struct simple_xattr new_xattr 
)

Definition at line 968 of file xattr.c.

int simple_xattr_remove ( struct simple_xattrs xattrs,
const char name 
)

Definition at line 921 of file xattr.c.

int simple_xattr_set ( struct simple_xattrs xattrs,
const char name,
const void value,
size_t  size,
int  flags 
)

Definition at line 910 of file xattr.c.

SYSCALL_DEFINE2 ( removexattr  ,
const char __user ,
pathname  ,
const char __user ,
name   
)

Definition at line 613 of file xattr.c.

SYSCALL_DEFINE2 ( lremovexattr  ,
const char __user ,
pathname  ,
const char __user ,
name   
)

Definition at line 631 of file xattr.c.

SYSCALL_DEFINE2 ( fremovexattr  ,
int  ,
fd  ,
const char __user ,
name   
)

Definition at line 649 of file xattr.c.

SYSCALL_DEFINE3 ( listxattr  ,
const char __user ,
pathname  ,
char __user ,
list  ,
size_t  ,
size   
)

Definition at line 554 of file xattr.c.

SYSCALL_DEFINE3 ( llistxattr  ,
const char __user ,
pathname  ,
char __user ,
list  ,
size_t  ,
size   
)

Definition at line 568 of file xattr.c.

SYSCALL_DEFINE3 ( flistxattr  ,
int  ,
fd  ,
char __user ,
list  ,
size_t  ,
size   
)

Definition at line 582 of file xattr.c.

SYSCALL_DEFINE4 ( getxattr  ,
const char __user ,
pathname  ,
const char __user ,
name  ,
void __user ,
value  ,
size_t  ,
size   
)

Definition at line 474 of file xattr.c.

SYSCALL_DEFINE4 ( lgetxattr  ,
const char __user ,
pathname  ,
const char __user ,
name  ,
void __user ,
value  ,
size_t  ,
size   
)

Definition at line 488 of file xattr.c.

SYSCALL_DEFINE4 ( fgetxattr  ,
int  ,
fd  ,
const char __user ,
name  ,
void __user ,
value  ,
size_t  ,
size   
)

Definition at line 502 of file xattr.c.

SYSCALL_DEFINE5 ( setxattr  ,
const char __user ,
pathname  ,
const char __user ,
name  ,
const void __user ,
value  ,
size_t  ,
size  ,
int  ,
flags   
)

Definition at line 367 of file xattr.c.

SYSCALL_DEFINE5 ( lsetxattr  ,
const char __user ,
pathname  ,
const char __user ,
name  ,
const void __user ,
value  ,
size_t  ,
size  ,
int  ,
flags   
)

Definition at line 386 of file xattr.c.

SYSCALL_DEFINE5 ( fsetxattr  ,
int  ,
fd  ,
const char __user ,
name  ,
const void __user ,
value  ,
size_t  ,
size  ,
int  ,
flags   
)

Definition at line 405 of file xattr.c.

ssize_t vfs_getxattr ( struct dentry dentry,
const char name,
void value,
size_t  size 
)

Definition at line 231 of file xattr.c.

ssize_t vfs_getxattr_alloc ( struct dentry dentry,
const char name,
char **  xattr_value,
size_t  xattr_size,
gfp_t  flags 
)

Definition at line 181 of file xattr.c.

ssize_t vfs_listxattr ( struct dentry d,
char list,
size_t  size 
)

Definition at line 267 of file xattr.c.

int vfs_removexattr ( struct dentry dentry,
const char name 
)

Definition at line 287 of file xattr.c.

int vfs_setxattr ( struct dentry dentry,
const char name,
const void value,
size_t  size,
int  flags 
)

Definition at line 122 of file xattr.c.

int vfs_xattr_cmp ( struct dentry dentry,
const char xattr_name,
const char value,
size_t  size,
gfp_t  flags 
)

Definition at line 212 of file xattr.c.

ssize_t xattr_getsecurity ( struct inode inode,
const char name,
void value,
size_t  size 
)

Definition at line 146 of file xattr.c.