Back to home page

OSCL-LXR

 
 

    


0001 // SPDX-License-Identifier: GPL-2.0
0002 /*
0003  * linux/fs/ext4/xattr_hurd.c
0004  * Handler for extended gnu attributes for the Hurd.
0005  *
0006  * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
0007  * Copyright (C) 2020 by Jan (janneke) Nieuwenhuizen, <janneke@gnu.org>
0008  */
0009 
0010 #include <linux/init.h>
0011 #include <linux/string.h>
0012 #include "ext4.h"
0013 #include "xattr.h"
0014 
0015 static bool
0016 ext4_xattr_hurd_list(struct dentry *dentry)
0017 {
0018     return test_opt(dentry->d_sb, XATTR_USER);
0019 }
0020 
0021 static int
0022 ext4_xattr_hurd_get(const struct xattr_handler *handler,
0023             struct dentry *unused, struct inode *inode,
0024             const char *name, void *buffer, size_t size)
0025 {
0026     if (!test_opt(inode->i_sb, XATTR_USER))
0027         return -EOPNOTSUPP;
0028 
0029     return ext4_xattr_get(inode, EXT4_XATTR_INDEX_HURD,
0030                   name, buffer, size);
0031 }
0032 
0033 static int
0034 ext4_xattr_hurd_set(const struct xattr_handler *handler,
0035             struct user_namespace *mnt_userns,
0036             struct dentry *unused, struct inode *inode,
0037             const char *name, const void *value,
0038             size_t size, int flags)
0039 {
0040     if (!test_opt(inode->i_sb, XATTR_USER))
0041         return -EOPNOTSUPP;
0042 
0043     return ext4_xattr_set(inode, EXT4_XATTR_INDEX_HURD,
0044                   name, value, size, flags);
0045 }
0046 
0047 const struct xattr_handler ext4_xattr_hurd_handler = {
0048     .prefix = XATTR_HURD_PREFIX,
0049     .list   = ext4_xattr_hurd_list,
0050     .get    = ext4_xattr_hurd_get,
0051     .set    = ext4_xattr_hurd_set,
0052 };