linux/fs/orangefs/orangefs-sysfs.c

// SPDX-License-Identifier: GPL-2.0
/*
 * Documentation/ABI/stable/sysfs-fs-orangefs:
 *
 * What:		/sys/fs/orangefs/perf_counter_reset
 * Date:		June 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 * 			echo a 0 or a 1 into perf_counter_reset to
 * 			reset all the counters in
 * 			/sys/fs/orangefs/perf_counters
 * 			except ones with PINT_PERF_PRESERVE set.
 *
 *
 * What:		/sys/fs/orangefs/perf_counters/...
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 * 			Counters and settings for various caches.
 * 			Read only.
 *
 *
 * What:		/sys/fs/orangefs/perf_time_interval_secs
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 *			Length of perf counter intervals in
 *			seconds.
 *
 *
 * What:		/sys/fs/orangefs/perf_history_size
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 * 			The perf_counters cache statistics have N, or
 * 			perf_history_size, samples. The default is
 * 			one.
 *
 *			Every perf_time_interval_secs the (first)
 *			samples are reset.
 *
 *			If N is greater than one, the "current" set
 *			of samples is reset, and the samples from the
 *			other N-1 intervals remain available.
 *
 *
 * What:		/sys/fs/orangefs/op_timeout_secs
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 *			Service operation timeout in seconds.
 *
 *
 * What:		/sys/fs/orangefs/slot_timeout_secs
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 *			"Slot" timeout in seconds. A "slot"
 *			is an indexed buffer in the shared
 *			memory segment used for communication
 *			between the kernel module and userspace.
 *			Slots are requested and waited for,
 *			the wait times out after slot_timeout_secs.
 *
 * What:		/sys/fs/orangefs/cache_timeout_msecs
 * Date:		Mar 2018
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 *			Time in milliseconds between which
 *			orangefs_revalidate_mapping will invalidate the page
 *			cache.
 *
 * What:		/sys/fs/orangefs/dcache_timeout_msecs
 * Date:		Jul 2016
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 *			Time lookup is valid in milliseconds.
 *
 * What:		/sys/fs/orangefs/getattr_timeout_msecs
 * Date:		Jul 2016
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 *			Time getattr is valid in milliseconds.
 *
 * What:		/sys/fs/orangefs/readahead_count
 * Date:		Aug 2016
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 *			Readahead cache buffer count.
 *
 * What:		/sys/fs/orangefs/readahead_size
 * Date:		Aug 2016
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 *			Readahead cache buffer size.
 *
 * What:		/sys/fs/orangefs/readahead_count_size
 * Date:		Aug 2016
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 *			Readahead cache buffer count and size.
 *
 * What:		/sys/fs/orangefs/readahead_readcnt
 * Date:		Jan 2017
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 *			Number of buffers (in multiples of readahead_size)
 *			which can be read ahead for a single file at once.
 *
 * What:		/sys/fs/orangefs/acache/...
 * Date:		Jun 2015
 * Contact:		Martin Brandenburg <[email protected]>
 * Description:
 * 			Attribute cache configurable settings.
 *
 *
 * What:		/sys/fs/orangefs/ncache/...
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 * 			Name cache configurable settings.
 *
 *
 * What:		/sys/fs/orangefs/capcache/...
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 * 			Capability cache configurable settings.
 *
 *
 * What:		/sys/fs/orangefs/ccache/...
 * Date:		Jun 2015
 * Contact:		Mike Marshall <[email protected]>
 * Description:
 * 			Credential cache configurable settings.
 *
 */

#include <linux/fs.h>
#include <linux/kobject.h>
#include <linux/string.h>
#include <linux/sysfs.h>
#include <linux/module.h>
#include <linux/init.h>

#include "protocol.h"
#include "orangefs-kernel.h"
#include "orangefs-sysfs.h"

#define ORANGEFS_KOBJ_ID
#define ACACHE_KOBJ_ID
#define CAPCACHE_KOBJ_ID
#define CCACHE_KOBJ_ID
#define NCACHE_KOBJ_ID
#define PC_KOBJ_ID
#define STATS_KOBJ_ID

/*
 * Every item calls orangefs_attr_show and orangefs_attr_store through
 * orangefs_sysfs_ops. They look at the orangefs_attributes further below to
 * call one of sysfs_int_show, sysfs_int_store, sysfs_service_op_show, or
 * sysfs_service_op_store.
 */

struct orangefs_attribute {};

static ssize_t orangefs_attr_show(struct kobject *kobj,
				  struct attribute *attr,
				  char *buf)
{}

static ssize_t orangefs_attr_store(struct kobject *kobj,
				   struct attribute *attr,
				   const char *buf,
				   size_t len)
{}

static const struct sysfs_ops orangefs_sysfs_ops =;

static ssize_t sysfs_int_show(struct kobject *kobj,
    struct orangefs_attribute *attr, char *buf)
{}

static ssize_t sysfs_int_store(struct kobject *kobj,
    struct orangefs_attribute *attr, const char *buf, size_t count)
{}

/*
 * obtain attribute values from userspace with a service operation.
 */
static ssize_t sysfs_service_op_show(struct kobject *kobj,
    struct orangefs_attribute *attr, char *buf)
{}

/*
 * pass attribute values back to userspace with a service operation.
 *
 * We have to do a memory allocation, an sscanf and a service operation.
 * And we have to evaluate what the user entered, to make sure the
 * value is within the range supported by the attribute. So, there's
 * a lot of return code checking and mapping going on here.
 *
 * We want to return 1 if we think everything went OK, and
 * EINVAL if not.
 */
static ssize_t sysfs_service_op_store(struct kobject *kobj,
    struct orangefs_attribute *attr, const char *buf, size_t count)
{}

static struct orangefs_attribute op_timeout_secs_attribute =;

static struct orangefs_attribute slot_timeout_secs_attribute =;

static struct orangefs_attribute cache_timeout_msecs_attribute =;

static struct orangefs_attribute dcache_timeout_msecs_attribute =;

static struct orangefs_attribute getattr_timeout_msecs_attribute =;

static struct orangefs_attribute readahead_count_attribute =;

static struct orangefs_attribute readahead_size_attribute =;

static struct orangefs_attribute readahead_count_size_attribute =;

static struct orangefs_attribute readahead_readcnt_attribute =;

static struct orangefs_attribute perf_counter_reset_attribute =;

static struct orangefs_attribute perf_history_size_attribute =;

static struct orangefs_attribute perf_time_interval_secs_attribute =;

static struct attribute *orangefs_default_attrs[] =;
ATTRIBUTE_GROUPS();

static struct kobject *orangefs_obj;

static void orangefs_obj_release(struct kobject *kobj)
{}

static struct kobj_type orangefs_ktype =;

static struct orangefs_attribute acache_hard_limit_attribute =;

static struct orangefs_attribute acache_reclaim_percent_attribute =;

static struct orangefs_attribute acache_soft_limit_attribute =;

static struct orangefs_attribute acache_timeout_msecs_attribute =;

static struct attribute *acache_orangefs_default_attrs[] =;
ATTRIBUTE_GROUPS();

static struct kobject *acache_orangefs_obj;

static void acache_orangefs_obj_release(struct kobject *kobj)
{}

static struct kobj_type acache_orangefs_ktype =;

static struct orangefs_attribute capcache_hard_limit_attribute =;

static struct orangefs_attribute capcache_reclaim_percent_attribute =;

static struct orangefs_attribute capcache_soft_limit_attribute =;

static struct orangefs_attribute capcache_timeout_secs_attribute =;

static struct attribute *capcache_orangefs_default_attrs[] =;
ATTRIBUTE_GROUPS();

static struct kobject *capcache_orangefs_obj;

static void capcache_orangefs_obj_release(struct kobject *kobj)
{}

static struct kobj_type capcache_orangefs_ktype =;

static struct orangefs_attribute ccache_hard_limit_attribute =;

static struct orangefs_attribute ccache_reclaim_percent_attribute =;

static struct orangefs_attribute ccache_soft_limit_attribute =;

static struct orangefs_attribute ccache_timeout_secs_attribute =;

static struct attribute *ccache_orangefs_default_attrs[] =;
ATTRIBUTE_GROUPS();

static struct kobject *ccache_orangefs_obj;

static void ccache_orangefs_obj_release(struct kobject *kobj)
{}

static struct kobj_type ccache_orangefs_ktype =;

static struct orangefs_attribute ncache_hard_limit_attribute =;

static struct orangefs_attribute ncache_reclaim_percent_attribute =;

static struct orangefs_attribute ncache_soft_limit_attribute =;

static struct orangefs_attribute ncache_timeout_msecs_attribute =;

static struct attribute *ncache_orangefs_default_attrs[] =;
ATTRIBUTE_GROUPS();

static struct kobject *ncache_orangefs_obj;

static void ncache_orangefs_obj_release(struct kobject *kobj)
{}

static struct kobj_type ncache_orangefs_ktype =;

static struct orangefs_attribute pc_acache_attribute =;

static struct orangefs_attribute pc_capcache_attribute =;

static struct orangefs_attribute pc_ncache_attribute =;

static struct attribute *pc_orangefs_default_attrs[] =;
ATTRIBUTE_GROUPS();

static struct kobject *pc_orangefs_obj;

static void pc_orangefs_obj_release(struct kobject *kobj)
{}

static struct kobj_type pc_orangefs_ktype =;

static struct orangefs_attribute stats_reads_attribute =;

static struct orangefs_attribute stats_writes_attribute =;

static struct attribute *stats_orangefs_default_attrs[] =;
ATTRIBUTE_GROUPS();

static struct kobject *stats_orangefs_obj;

static void stats_orangefs_obj_release(struct kobject *kobj)
{}

static struct kobj_type stats_orangefs_ktype =;

int orangefs_sysfs_init(void)
{}

void orangefs_sysfs_exit(void)
{}