Blame view

fs/jffs2/xattr_trusted.c 1.19 KB
652ecc20d   KaiGai Kohei   [JFFS2][XATTR] Un...
1
2
  /*
   * JFFS2 -- Journalling Flash File System, Version 2.
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
3
   *
c00c310ea   David Woodhouse   [JFFS2] Tidy up l...
4
   * Copyright © 2006  NEC Corporation
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
5
   *
652ecc20d   KaiGai Kohei   [JFFS2][XATTR] Un...
6
7
8
9
10
   * Created by KaiGai Kohei <kaigai@ak.jp.nec.com>
   *
   * For licensing information, see the file 'LICENCE' in this directory.
   *
   */
c00c310ea   David Woodhouse   [JFFS2] Tidy up l...
11

aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
12
13
14
15
16
17
  #include <linux/kernel.h>
  #include <linux/fs.h>
  #include <linux/jffs2.h>
  #include <linux/xattr.h>
  #include <linux/mtd/mtd.h>
  #include "nodelist.h"
d9a82a040   Andreas Gruenbacher   xattr handlers: P...
18
  static int jffs2_trusted_getxattr(const struct xattr_handler *handler,
b296821a7   Al Viro   xattr_handler: pa...
19
20
  				  struct dentry *unused, struct inode *inode,
  				  const char *name, void *buffer, size_t size)
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
21
  {
b296821a7   Al Viro   xattr_handler: pa...
22
  	return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED,
431547b3c   Christoph Hellwig   sanitize xattr ha...
23
  				 name, buffer, size);
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
24
  }
d9a82a040   Andreas Gruenbacher   xattr handlers: P...
25
  static int jffs2_trusted_setxattr(const struct xattr_handler *handler,
593012268   Al Viro   switch xattr_hand...
26
27
28
  				  struct dentry *unused, struct inode *inode,
  				  const char *name, const void *buffer,
  				  size_t size, int flags)
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
29
  {
593012268   Al Viro   switch xattr_hand...
30
  	return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED,
431547b3c   Christoph Hellwig   sanitize xattr ha...
31
  				 name, buffer, size, flags);
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
32
  }
764a5c6b1   Andreas Gruenbacher   xattr handlers: S...
33
  static bool jffs2_trusted_listxattr(struct dentry *dentry)
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
34
  {
764a5c6b1   Andreas Gruenbacher   xattr handlers: S...
35
  	return capable(CAP_SYS_ADMIN);
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
36
  }
365f0cb9d   Stephen Hemminger   jffs2: constify x...
37
  const struct xattr_handler jffs2_trusted_xattr_handler = {
aa98d7cf5   KaiGai Kohei   [JFFS2][XATTR] XA...
38
39
40
41
42
  	.prefix = XATTR_TRUSTED_PREFIX,
  	.list = jffs2_trusted_listxattr,
  	.set = jffs2_trusted_setxattr,
  	.get = jffs2_trusted_getxattr
  };