162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * JFFS2 -- Journalling Flash File System, Version 2. 362306a36Sopenharmony_ci * 462306a36Sopenharmony_ci * Copyright © 2006 NEC Corporation 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Created by KaiGai Kohei <kaigai@ak.jp.nec.com> 762306a36Sopenharmony_ci * 862306a36Sopenharmony_ci * For licensing information, see the file 'LICENCE' in this directory. 962306a36Sopenharmony_ci * 1062306a36Sopenharmony_ci */ 1162306a36Sopenharmony_ci 1262306a36Sopenharmony_ci#include <linux/kernel.h> 1362306a36Sopenharmony_ci#include <linux/fs.h> 1462306a36Sopenharmony_ci#include <linux/jffs2.h> 1562306a36Sopenharmony_ci#include <linux/xattr.h> 1662306a36Sopenharmony_ci#include <linux/mtd/mtd.h> 1762306a36Sopenharmony_ci#include "nodelist.h" 1862306a36Sopenharmony_ci 1962306a36Sopenharmony_cistatic int jffs2_trusted_getxattr(const struct xattr_handler *handler, 2062306a36Sopenharmony_ci struct dentry *unused, struct inode *inode, 2162306a36Sopenharmony_ci const char *name, void *buffer, size_t size) 2262306a36Sopenharmony_ci{ 2362306a36Sopenharmony_ci return do_jffs2_getxattr(inode, JFFS2_XPREFIX_TRUSTED, 2462306a36Sopenharmony_ci name, buffer, size); 2562306a36Sopenharmony_ci} 2662306a36Sopenharmony_ci 2762306a36Sopenharmony_cistatic int jffs2_trusted_setxattr(const struct xattr_handler *handler, 2862306a36Sopenharmony_ci struct mnt_idmap *idmap, 2962306a36Sopenharmony_ci struct dentry *unused, struct inode *inode, 3062306a36Sopenharmony_ci const char *name, const void *buffer, 3162306a36Sopenharmony_ci size_t size, int flags) 3262306a36Sopenharmony_ci{ 3362306a36Sopenharmony_ci return do_jffs2_setxattr(inode, JFFS2_XPREFIX_TRUSTED, 3462306a36Sopenharmony_ci name, buffer, size, flags); 3562306a36Sopenharmony_ci} 3662306a36Sopenharmony_ci 3762306a36Sopenharmony_cistatic bool jffs2_trusted_listxattr(struct dentry *dentry) 3862306a36Sopenharmony_ci{ 3962306a36Sopenharmony_ci return capable(CAP_SYS_ADMIN); 4062306a36Sopenharmony_ci} 4162306a36Sopenharmony_ci 4262306a36Sopenharmony_ciconst struct xattr_handler jffs2_trusted_xattr_handler = { 4362306a36Sopenharmony_ci .prefix = XATTR_TRUSTED_PREFIX, 4462306a36Sopenharmony_ci .list = jffs2_trusted_listxattr, 4562306a36Sopenharmony_ci .set = jffs2_trusted_setxattr, 4662306a36Sopenharmony_ci .get = jffs2_trusted_getxattr 4762306a36Sopenharmony_ci}; 48