18c2ecf20Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * linux/fs/ext4/xattr_hurd.c 48c2ecf20Sopenharmony_ci * Handler for extended gnu attributes for the Hurd. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2001 by Andreas Gruenbacher, <a.gruenbacher@computer.org> 78c2ecf20Sopenharmony_ci * Copyright (C) 2020 by Jan (janneke) Nieuwenhuizen, <janneke@gnu.org> 88c2ecf20Sopenharmony_ci */ 98c2ecf20Sopenharmony_ci 108c2ecf20Sopenharmony_ci#include <linux/init.h> 118c2ecf20Sopenharmony_ci#include <linux/string.h> 128c2ecf20Sopenharmony_ci#include "ext4.h" 138c2ecf20Sopenharmony_ci#include "xattr.h" 148c2ecf20Sopenharmony_ci 158c2ecf20Sopenharmony_cistatic bool 168c2ecf20Sopenharmony_ciext4_xattr_hurd_list(struct dentry *dentry) 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci return test_opt(dentry->d_sb, XATTR_USER); 198c2ecf20Sopenharmony_ci} 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_cistatic int 228c2ecf20Sopenharmony_ciext4_xattr_hurd_get(const struct xattr_handler *handler, 238c2ecf20Sopenharmony_ci struct dentry *unused, struct inode *inode, 248c2ecf20Sopenharmony_ci const char *name, void *buffer, size_t size) 258c2ecf20Sopenharmony_ci{ 268c2ecf20Sopenharmony_ci if (!test_opt(inode->i_sb, XATTR_USER)) 278c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_ci return ext4_xattr_get(inode, EXT4_XATTR_INDEX_HURD, 308c2ecf20Sopenharmony_ci name, buffer, size); 318c2ecf20Sopenharmony_ci} 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cistatic int 348c2ecf20Sopenharmony_ciext4_xattr_hurd_set(const struct xattr_handler *handler, 358c2ecf20Sopenharmony_ci struct dentry *unused, struct inode *inode, 368c2ecf20Sopenharmony_ci const char *name, const void *value, 378c2ecf20Sopenharmony_ci size_t size, int flags) 388c2ecf20Sopenharmony_ci{ 398c2ecf20Sopenharmony_ci if (!test_opt(inode->i_sb, XATTR_USER)) 408c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci return ext4_xattr_set(inode, EXT4_XATTR_INDEX_HURD, 438c2ecf20Sopenharmony_ci name, value, size, flags); 448c2ecf20Sopenharmony_ci} 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ciconst struct xattr_handler ext4_xattr_hurd_handler = { 478c2ecf20Sopenharmony_ci .prefix = XATTR_HURD_PREFIX, 488c2ecf20Sopenharmony_ci .list = ext4_xattr_hurd_list, 498c2ecf20Sopenharmony_ci .get = ext4_xattr_hurd_get, 508c2ecf20Sopenharmony_ci .set = ext4_xattr_hurd_set, 518c2ecf20Sopenharmony_ci}; 52