// SPDX-License-Identifier: GPL-2.0 /* * (C) 2001 Clemson University and The University of Chicago * Copyright 2018 Omnibond Systems, L.L.C. * * See COPYING in top-level directory. */ /* * Linux VFS extended attribute operations. */ #include "protocol.h" #include "orangefs-kernel.h" #include "orangefs-bufmap.h" #include <linux/posix_acl_xattr.h> #include <linux/xattr.h> #include <linux/hashtable.h> #define SYSTEM_ORANGEFS_KEY … #define SYSTEM_ORANGEFS_KEY_LEN … /* * this function returns * 0 if the key corresponding to name is not meant to be printed as part * of a listxattr. * 1 if the key corresponding to name is meant to be returned as part of * a listxattr. * The ones that start SYSTEM_ORANGEFS_KEY are the ones to avoid printing. */ static int is_reserved_key(const char *key, size_t size) { … } static inline int convert_to_internal_xattr_flags(int setxattr_flags) { … } static unsigned int xattr_key(const char *key) { … } static struct orangefs_cached_xattr *find_cached_xattr(struct inode *inode, const char *key) { … } /* * Tries to get a specified key's attributes of a given * file into a user-specified buffer. Note that the getxattr * interface allows for the users to probe the size of an * extended attribute by passing in a value of 0 to size. * Thus our return value is always the size of the attribute * unless the key does not exist for the file and/or if * there were errors in fetching the attribute value. */ ssize_t orangefs_inode_getxattr(struct inode *inode, const char *name, void *buffer, size_t size) { … } static int orangefs_inode_removexattr(struct inode *inode, const char *name, int flags) { … } /* * Tries to set an attribute for a given key on a file. * * Returns a -ve number on error and 0 on success. Key is text, but value * can be binary! */ int orangefs_inode_setxattr(struct inode *inode, const char *name, const void *value, size_t size, int flags) { … } /* * Tries to get a specified object's keys into a user-specified buffer of a * given size. Note that like the previous instances of xattr routines, this * also allows you to pass in a NULL pointer and 0 size to probe the size for * subsequent memory allocations. Thus our return value is always the size of * all the keys unless there were errors in fetching the keys! */ ssize_t orangefs_listxattr(struct dentry *dentry, char *buffer, size_t size) { … } static int orangefs_xattr_set_default(const struct xattr_handler *handler, struct mnt_idmap *idmap, struct dentry *unused, struct inode *inode, const char *name, const void *buffer, size_t size, int flags) { … } static int orangefs_xattr_get_default(const struct xattr_handler *handler, struct dentry *unused, struct inode *inode, const char *name, void *buffer, size_t size) { … } static const struct xattr_handler orangefs_xattr_default_handler = …; const struct xattr_handler * const orangefs_xattr_handlers[] = …;