VisionFive2 Linux kernel

StarFive Tech Linux Kernel for VisionFive (JH7110) boards (mirror)

More than 9999 Commits   35 Branches   59 Tags
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  1) // SPDX-License-Identifier: GPL-2.0
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  2) /*
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  3)  * linux/fs/ext4/xattr_hurd.c
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  4)  * Handler for extended gnu attributes for the Hurd.
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  5)  *
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  6)  * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org>
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  7)  * Copyright (C) 2020 by Jan (janneke) Nieuwenhuizen, <janneke@gnu.org>
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  8)  */
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200  9) 
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 10) #include <linux/init.h>
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 11) #include <linux/string.h>
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 12) #include "ext4.h"
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 13) #include "xattr.h"
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 14) 
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 15) static bool
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 16) ext4_xattr_hurd_list(struct dentry *dentry)
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 17) {
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 18) 	return test_opt(dentry->d_sb, XATTR_USER);
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 19) }
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 20) 
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 21) static int
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 22) ext4_xattr_hurd_get(const struct xattr_handler *handler,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 23) 		    struct dentry *unused, struct inode *inode,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 24) 		    const char *name, void *buffer, size_t size)
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 25) {
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 26) 	if (!test_opt(inode->i_sb, XATTR_USER))
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 27) 		return -EOPNOTSUPP;
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 28) 
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 29) 	return ext4_xattr_get(inode, EXT4_XATTR_INDEX_HURD,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 30) 			      name, buffer, size);
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 31) }
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 32) 
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 33) static int
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 34) ext4_xattr_hurd_set(const struct xattr_handler *handler,
e65ce2a50cf6a (Christian Brauner           2021-01-21 14:19:27 +0100 35) 		    struct user_namespace *mnt_userns,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 36) 		    struct dentry *unused, struct inode *inode,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 37) 		    const char *name, const void *value,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 38) 		    size_t size, int flags)
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 39) {
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 40) 	if (!test_opt(inode->i_sb, XATTR_USER))
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 41) 		return -EOPNOTSUPP;
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 42) 
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 43) 	return ext4_xattr_set(inode, EXT4_XATTR_INDEX_HURD,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 44) 			      name, value, size, flags);
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 45) }
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 46) 
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 47) const struct xattr_handler ext4_xattr_hurd_handler = {
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 48) 	.prefix	= XATTR_HURD_PREFIX,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 49) 	.list	= ext4_xattr_hurd_list,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 50) 	.get	= ext4_xattr_hurd_get,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 51) 	.set	= ext4_xattr_hurd_set,
88ee9d571b6d8 (Jan (janneke) Nieuwenhuizen 2020-05-25 21:39:40 +0200 52) };