linux/fs/ceph/xattr.c

// SPDX-License-Identifier: GPL-2.0
#include <linux/ceph/ceph_debug.h>
#include <linux/ceph/pagelist.h>

#include "super.h"
#include "mds_client.h"

#include <linux/ceph/decode.h>

#include <linux/xattr.h>
#include <linux/security.h>
#include <linux/posix_acl_xattr.h>
#include <linux/slab.h>

#define XATTR_CEPH_PREFIX
#define XATTR_CEPH_PREFIX_LEN

static int __remove_xattr(struct ceph_inode_info *ci,
			  struct ceph_inode_xattr *xattr);

static bool ceph_is_valid_xattr(const char *name)
{}

/*
 * These define virtual xattrs exposing the recursive directory
 * statistics and layout metadata.
 */
struct ceph_vxattr {};

#define VXATTR_FLAG_READONLY
#define VXATTR_FLAG_HIDDEN
#define VXATTR_FLAG_RSTAT
#define VXATTR_FLAG_DIRSTAT

/* layouts */

static bool ceph_vxattrcb_layout_exists(struct ceph_inode_info *ci)
{}

static ssize_t ceph_vxattrcb_layout(struct ceph_inode_info *ci, char *val,
				    size_t size)
{}

/*
 * The convention with strings in xattrs is that they should not be NULL
 * terminated, since we're returning the length with them. snprintf always
 * NULL terminates however, so call it on a temporary buffer and then memcpy
 * the result into place.
 */
static __printf(3, 4)
int ceph_fmt_xattr(char *val, size_t size, const char *fmt, ...)
{}

static ssize_t ceph_vxattrcb_layout_stripe_unit(struct ceph_inode_info *ci,
						char *val, size_t size)
{}

static ssize_t ceph_vxattrcb_layout_stripe_count(struct ceph_inode_info *ci,
						 char *val, size_t size)
{}

static ssize_t ceph_vxattrcb_layout_object_size(struct ceph_inode_info *ci,
						char *val, size_t size)
{}

static ssize_t ceph_vxattrcb_layout_pool(struct ceph_inode_info *ci,
					 char *val, size_t size)
{}

static ssize_t ceph_vxattrcb_layout_pool_namespace(struct ceph_inode_info *ci,
						   char *val, size_t size)
{}

/* directories */

static ssize_t ceph_vxattrcb_dir_entries(struct ceph_inode_info *ci, char *val,
					 size_t size)
{}

static ssize_t ceph_vxattrcb_dir_files(struct ceph_inode_info *ci, char *val,
				       size_t size)
{}

static ssize_t ceph_vxattrcb_dir_subdirs(struct ceph_inode_info *ci, char *val,
					 size_t size)
{}

static ssize_t ceph_vxattrcb_dir_rentries(struct ceph_inode_info *ci, char *val,
					  size_t size)
{}

static ssize_t ceph_vxattrcb_dir_rfiles(struct ceph_inode_info *ci, char *val,
					size_t size)
{}

static ssize_t ceph_vxattrcb_dir_rsubdirs(struct ceph_inode_info *ci, char *val,
					  size_t size)
{}

static ssize_t ceph_vxattrcb_dir_rsnaps(struct ceph_inode_info *ci, char *val,
					  size_t size)
{}

static ssize_t ceph_vxattrcb_dir_rbytes(struct ceph_inode_info *ci, char *val,
					size_t size)
{}

static ssize_t ceph_vxattrcb_dir_rctime(struct ceph_inode_info *ci, char *val,
					size_t size)
{}

/* dir pin */
static bool ceph_vxattrcb_dir_pin_exists(struct ceph_inode_info *ci)
{}

static ssize_t ceph_vxattrcb_dir_pin(struct ceph_inode_info *ci, char *val,
				     size_t size)
{}

/* quotas */
static bool ceph_vxattrcb_quota_exists(struct ceph_inode_info *ci)
{}

static ssize_t ceph_vxattrcb_quota(struct ceph_inode_info *ci, char *val,
				   size_t size)
{}

static ssize_t ceph_vxattrcb_quota_max_bytes(struct ceph_inode_info *ci,
					     char *val, size_t size)
{}

static ssize_t ceph_vxattrcb_quota_max_files(struct ceph_inode_info *ci,
					     char *val, size_t size)
{}

/* snapshots */
static bool ceph_vxattrcb_snap_btime_exists(struct ceph_inode_info *ci)
{}

static ssize_t ceph_vxattrcb_snap_btime(struct ceph_inode_info *ci, char *val,
					size_t size)
{}

static ssize_t ceph_vxattrcb_cluster_fsid(struct ceph_inode_info *ci,
					  char *val, size_t size)
{}

static ssize_t ceph_vxattrcb_client_id(struct ceph_inode_info *ci,
				       char *val, size_t size)
{}

static ssize_t ceph_vxattrcb_caps(struct ceph_inode_info *ci, char *val,
					size_t size)
{}

static ssize_t ceph_vxattrcb_auth_mds(struct ceph_inode_info *ci,
				       char *val, size_t size)
{}

#if IS_ENABLED(CONFIG_FS_ENCRYPTION)
static bool ceph_vxattrcb_fscrypt_auth_exists(struct ceph_inode_info *ci)
{}

static ssize_t ceph_vxattrcb_fscrypt_auth(struct ceph_inode_info *ci,
					  char *val, size_t size)
{}
#endif /* CONFIG_FS_ENCRYPTION */

#define CEPH_XATTR_NAME(_type, _name)
#define CEPH_XATTR_NAME2(_type, _name, _name2)

#define XATTR_NAME_CEPH(_type, _name, _flags)
#define XATTR_RSTAT_FIELD(_type, _name)
#define XATTR_RSTAT_FIELD_UPDATABLE(_type, _name)
#define XATTR_LAYOUT_FIELD(_type, _name, _field)
#define XATTR_QUOTA_FIELD(_type, _name)

static struct ceph_vxattr ceph_dir_vxattrs[] =;

/* files */

static struct ceph_vxattr ceph_file_vxattrs[] =;

static struct ceph_vxattr ceph_common_vxattrs[] =;

static struct ceph_vxattr *ceph_inode_vxattrs(struct inode *inode)
{}

static struct ceph_vxattr *ceph_match_vxattr(struct inode *inode,
						const char *name)
{}

#define MAX_XATTR_VAL_PRINT_LEN

static int __set_xattr(struct ceph_inode_info *ci,
			   const char *name, int name_len,
			   const char *val, int val_len,
			   int flags, int update_xattr,
			   struct ceph_inode_xattr **newxattr)
{}

static struct ceph_inode_xattr *__get_xattr(struct ceph_inode_info *ci,
			   const char *name)
{}

static void __free_xattr(struct ceph_inode_xattr *xattr)
{}

static int __remove_xattr(struct ceph_inode_info *ci,
			  struct ceph_inode_xattr *xattr)
{}

static char *__copy_xattr_names(struct ceph_inode_info *ci,
				char *dest)
{}

void __ceph_destroy_xattrs(struct ceph_inode_info *ci)
{}

static int __build_xattrs(struct inode *inode)
	__releases(ci->i_ceph_lock)
	__acquires(ci->i_ceph_lock)
{}

static int __get_required_blob_size(struct ceph_inode_info *ci, int name_size,
				    int val_size)
{}

/*
 * If there are dirty xattrs, reencode xattrs into the prealloc_blob
 * and swap into place.  It returns the old i_xattrs.blob (or NULL) so
 * that it can be freed by the caller as the i_ceph_lock is likely to be
 * held.
 */
struct ceph_buffer *__ceph_build_xattrs_blob(struct ceph_inode_info *ci)
{}

static inline int __get_request_mask(struct inode *in) {}

ssize_t __ceph_getxattr(struct inode *inode, const char *name, void *value,
		      size_t size)
{}

ssize_t ceph_listxattr(struct dentry *dentry, char *names, size_t size)
{}

static int ceph_sync_setxattr(struct inode *inode, const char *name,
			      const char *value, size_t size, int flags)
{}

int __ceph_setxattr(struct inode *inode, const char *name,
			const void *value, size_t size, int flags)
{}

static int ceph_get_xattr_handler(const struct xattr_handler *handler,
				  struct dentry *dentry, struct inode *inode,
				  const char *name, void *value, size_t size)
{}

static int ceph_set_xattr_handler(const struct xattr_handler *handler,
				  struct mnt_idmap *idmap,
				  struct dentry *unused, struct inode *inode,
				  const char *name, const void *value,
				  size_t size, int flags)
{}

static const struct xattr_handler ceph_other_xattr_handler =;

#ifdef CONFIG_SECURITY
bool ceph_security_xattr_wanted(struct inode *in)
{}

bool ceph_security_xattr_deadlock(struct inode *in)
{}

#ifdef CONFIG_CEPH_FS_SECURITY_LABEL
int ceph_security_init_secctx(struct dentry *dentry, umode_t mode,
			   struct ceph_acl_sec_ctx *as_ctx)
{}
#endif /* CONFIG_CEPH_FS_SECURITY_LABEL */
#endif /* CONFIG_SECURITY */

void ceph_release_acl_sec_ctx(struct ceph_acl_sec_ctx *as_ctx)
{}

/*
 * List of handlers for synthetic system.* attributes. Other
 * attributes are handled directly.
 */
const struct xattr_handler * const ceph_xattr_handlers[] =;