Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * JFFS2 -- Journalling Flash File System, Version 2.
0003  *
0004  * Copyright © 2006  NEC Corporation
0005  *
0006  * Created by KaiGai Kohei <kaigai@ak.jp.nec.com>
0007  *
0008  * For licensing information, see the file 'LICENCE' in this directory.
0009  *
0010  */
0011 
0012 #include <linux/kernel.h>
0013 #include <linux/fs.h>
0014 #include <linux/jffs2.h>
0015 #include <linux/xattr.h>
0016 #include <linux/mtd/mtd.h>
0017 #include "nodelist.h"
0018 
0019 static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
0020                   struct dentry *unused, struct inode *inode,
0021                   const char *name, void *buffer, size_t size)
0022 {
0023     return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED,
0024                  name, buffer, size);
0025 }
0026 
0027 static int jffs2_trusted_setxattr(const struct xattr_handler *handler,
0028                   struct user_namespace *mnt_userns,
0029                   struct dentry *unused, struct inode *inode,
0030                   const char *name, const void *buffer,
0031                   size_t size, int flags)
0032 {
0033     return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED,
0034                  name, buffer, size, flags);
0035 }
0036 
0037 static bool jffs2_trusted_listxattr(struct dentry *dentry)
0038 {
0039     return capable(CAP_SYS_ADMIN);
0040 }
0041 
0042 const struct xattr_handler jffs2_trusted_xattr_handler = {
0043     .prefix = XATTR_TRUSTED_PREFIX,
0044     .list = jffs2_trusted_listxattr,
0045     .set = jffs2_trusted_setxattr,
0046     .get = jffs2_trusted_getxattr
0047 };