linux/fs/ocfs2/stackglue.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * stackglue.c
 *
 * Code which implements an OCFS2 specific interface to underlying
 * cluster stacks.
 *
 * Copyright (C) 2007, 2009 Oracle.  All rights reserved.
 */

#include <linux/list.h>
#include <linux/spinlock.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/kmod.h>
#include <linux/fs.h>
#include <linux/kobject.h>
#include <linux/sysfs.h>
#include <linux/sysctl.h>

#include "ocfs2_fs.h"

#include "stackglue.h"

#define OCFS2_STACK_PLUGIN_O2CB
#define OCFS2_STACK_PLUGIN_USER
#define OCFS2_MAX_HB_CTL_PATH

static struct ocfs2_protocol_version locking_max_version;
static DEFINE_SPINLOCK(ocfs2_stack_lock);
static LIST_HEAD(ocfs2_stack_list);
static char cluster_stack_name[OCFS2_STACK_LABEL_LEN + 1];
static char ocfs2_hb_ctl_path[OCFS2_MAX_HB_CTL_PATH] =;

/*
 * The stack currently in use.  If not null, active_stack->sp_count > 0,
 * the module is pinned, and the locking protocol cannot be changed.
 */
static struct ocfs2_stack_plugin *active_stack;

static struct ocfs2_stack_plugin *ocfs2_stack_lookup(const char *name)
{}

static int ocfs2_stack_driver_request(const char *stack_name,
				      const char *plugin_name)
{}

/*
 * This function looks up the appropriate stack and makes it active.  If
 * there is no stack, it tries to load it.  It will fail if the stack still
 * cannot be found.  It will also fail if a different stack is in use.
 */
static int ocfs2_stack_driver_get(const char *stack_name)
{}

static void ocfs2_stack_driver_put(void)
{}

int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin)
{}
EXPORT_SYMBOL_GPL();

void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin)
{}
EXPORT_SYMBOL_GPL();

void ocfs2_stack_glue_set_max_proto_version(struct ocfs2_protocol_version *max_proto)
{}
EXPORT_SYMBOL_GPL();


/*
 * The ocfs2_dlm_lock() and ocfs2_dlm_unlock() functions take no argument
 * for the ast and bast functions.  They will pass the lksb to the ast
 * and bast.  The caller can wrap the lksb with their own structure to
 * get more information.
 */
int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,
		   int mode,
		   struct ocfs2_dlm_lksb *lksb,
		   u32 flags,
		   void *name,
		   unsigned int namelen)
{}
EXPORT_SYMBOL_GPL();

int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn,
		     struct ocfs2_dlm_lksb *lksb,
		     u32 flags)
{}
EXPORT_SYMBOL_GPL();

int ocfs2_dlm_lock_status(struct ocfs2_dlm_lksb *lksb)
{}
EXPORT_SYMBOL_GPL();

int ocfs2_dlm_lvb_valid(struct ocfs2_dlm_lksb *lksb)
{}
EXPORT_SYMBOL_GPL();

void *ocfs2_dlm_lvb(struct ocfs2_dlm_lksb *lksb)
{}
EXPORT_SYMBOL_GPL();

void ocfs2_dlm_dump_lksb(struct ocfs2_dlm_lksb *lksb)
{}
EXPORT_SYMBOL_GPL();

int ocfs2_stack_supports_plocks(void)
{}
EXPORT_SYMBOL_GPL();

/*
 * ocfs2_plock() can only be safely called if
 * ocfs2_stack_supports_plocks() returned true
 */
int ocfs2_plock(struct ocfs2_cluster_connection *conn, u64 ino,
		struct file *file, int cmd, struct file_lock *fl)
{}
EXPORT_SYMBOL_GPL();

int ocfs2_cluster_connect(const char *stack_name,
			  const char *cluster_name,
			  int cluster_name_len,
			  const char *group,
			  int grouplen,
			  struct ocfs2_locking_protocol *lproto,
			  void (*recovery_handler)(int node_num,
						   void *recovery_data),
			  void *recovery_data,
			  struct ocfs2_cluster_connection **conn)
{}
EXPORT_SYMBOL_GPL();

/* The caller will ensure all nodes have the same cluster stack */
int ocfs2_cluster_connect_agnostic(const char *group,
				   int grouplen,
				   struct ocfs2_locking_protocol *lproto,
				   void (*recovery_handler)(int node_num,
							    void *recovery_data),
				   void *recovery_data,
				   struct ocfs2_cluster_connection **conn)
{}
EXPORT_SYMBOL_GPL();

/* If hangup_pending is 0, the stack driver will be dropped */
int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
			     int hangup_pending)
{}
EXPORT_SYMBOL_GPL();

/*
 * Leave the group for this filesystem.  This is executed by a userspace
 * program (stored in ocfs2_hb_ctl_path).
 */
static void ocfs2_leave_group(const char *group)
{}

/*
 * Hangup is a required post-umount.  ocfs2-tools software expects the
 * filesystem to call "ocfs2_hb_ctl" during unmount.  This happens
 * regardless of whether the DLM got started, so we can't do it
 * in ocfs2_cluster_disconnect().  The ocfs2_leave_group() function does
 * the actual work.
 */
void ocfs2_cluster_hangup(const char *group, int grouplen)
{}
EXPORT_SYMBOL_GPL();

int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn,
			    unsigned int *node)
{}
EXPORT_SYMBOL_GPL();


/*
 * Sysfs bits
 */

static ssize_t ocfs2_max_locking_protocol_show(struct kobject *kobj,
					       struct kobj_attribute *attr,
					       char *buf)
{}

static struct kobj_attribute ocfs2_attr_max_locking_protocol =;

static ssize_t ocfs2_loaded_cluster_plugins_show(struct kobject *kobj,
						 struct kobj_attribute *attr,
						 char *buf)
{}

static struct kobj_attribute ocfs2_attr_loaded_cluster_plugins =;

static ssize_t ocfs2_active_cluster_plugin_show(struct kobject *kobj,
						struct kobj_attribute *attr,
						char *buf)
{}

static struct kobj_attribute ocfs2_attr_active_cluster_plugin =;

static ssize_t ocfs2_cluster_stack_show(struct kobject *kobj,
					struct kobj_attribute *attr,
					char *buf)
{}

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


static struct kobj_attribute ocfs2_attr_cluster_stack =;



static ssize_t ocfs2_dlm_recover_show(struct kobject *kobj,
					struct kobj_attribute *attr,
					char *buf)
{}

static struct kobj_attribute ocfs2_attr_dlm_recover_support =;

static struct attribute *ocfs2_attrs[] =;

static const struct attribute_group ocfs2_attr_group =;

struct kset *ocfs2_kset;
EXPORT_SYMBOL_GPL();

static void ocfs2_sysfs_exit(void)
{}

static int ocfs2_sysfs_init(void)
{}

/*
 * Sysctl bits
 *
 * The sysctl lives at /proc/sys/fs/ocfs2/nm/hb_ctl_path.  The 'nm' doesn't
 * make as much sense in a multiple cluster stack world, but it's safer
 * and easier to preserve the name.
 */

static struct ctl_table ocfs2_nm_table[] =;

static struct ctl_table_header *ocfs2_table_header;

/*
 * Initialization
 */

static int __init ocfs2_stack_glue_init(void)
{}

static void __exit ocfs2_stack_glue_exit(void)
{}

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();
module_init();
module_exit(ocfs2_stack_glue_exit);