Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /* -*- mode: c; c-basic-offset: 8; -*-
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * vim: noexpandtab sw=8 ts=8 sts=0:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * stackglue.h
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  * Glue to the underlying cluster stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  * Copyright (C) 2007 Oracle.  All rights reserved.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) #ifndef STACKGLUE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #define STACKGLUE_H
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/types.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/dlmconstants.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include "dlm/dlmapi.h"
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/dlm.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) /* Needed for plock-related prototypes */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) struct file;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) struct file_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28)  * dlmconstants.h does not have a LOCAL flag.  We hope to remove it
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29)  * some day, but right now we need it.  Let's fake it.  This value is larger
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30)  * than any flag in dlmconstants.h.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32) #define DLM_LKF_LOCAL		0x00100000
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  * This shadows DLM_LOCKSPACE_LEN in fs/dlm/dlm_internal.h.  That probably
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  * wants to be in a public header.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38) #define GROUP_NAME_MAX		64
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40) /* This shadows  OCFS2_CLUSTER_NAME_LEN */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41) #define CLUSTER_NAME_MAX	16
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  * ocfs2_protocol_version changes when ocfs2 does something different in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46)  * its inter-node behavior.  See dlmglue.c for more information.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48) struct ocfs2_protocol_version {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49) 	u8 pv_major;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50) 	u8 pv_minor;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * The dlm_lockstatus struct includes lvb space, but the dlm_lksb struct only
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * has a pointer to separately allocated lvb space.  This struct exists only to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * include in the lksb union to make space for a combined dlm_lksb and lvb.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58) struct fsdlm_lksb_plus_lvb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59) 	struct dlm_lksb lksb;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60) 	char lvb[DLM_LVB_LEN];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * A union of all lock status structures.  We define it here so that the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  * size of the union is known.  Lock status structures are embedded in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * ocfs2 inodes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68) struct ocfs2_cluster_connection;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69) struct ocfs2_dlm_lksb {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70) 	 union {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71) 		 struct dlm_lockstatus lksb_o2dlm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72) 		 struct dlm_lksb lksb_fsdlm;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) 		 struct fsdlm_lksb_plus_lvb padding;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	 };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	 struct ocfs2_cluster_connection *lksb_conn;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79)  * The ocfs2_locking_protocol defines the handlers called on ocfs2's behalf.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) struct ocfs2_locking_protocol {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	struct ocfs2_protocol_version lp_max_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	void (*lp_lock_ast)(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 	void (*lp_blocking_ast)(struct ocfs2_dlm_lksb *lksb, int level);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	void (*lp_unlock_ast)(struct ocfs2_dlm_lksb *lksb, int error);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90)  * A cluster connection.  Mostly opaque to ocfs2, the connection holds
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91)  * state for the underlying stack.  ocfs2 does use cc_version to determine
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92)  * locking compatibility.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) struct ocfs2_cluster_connection {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) 	char cc_name[GROUP_NAME_MAX + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	int cc_namelen;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) 	char cc_cluster_name[CLUSTER_NAME_MAX + 1];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) 	int cc_cluster_name_len;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 	struct ocfs2_protocol_version cc_version;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) 	struct ocfs2_locking_protocol *cc_proto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101) 	void (*cc_recovery_handler)(int node_num, void *recovery_data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102) 	void *cc_recovery_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103) 	void *cc_lockspace;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104) 	void *cc_private;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  * Each cluster stack implements the stack operations structure.  Not used
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109)  * in the ocfs2 code, the stackglue code translates generic cluster calls
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110)  * into stack operations.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) struct ocfs2_stack_operations {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	 * The fs code calls ocfs2_cluster_connect() to attach a new
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) 	 * filesystem to the cluster stack.  The ->connect() op is passed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) 	 * an ocfs2_cluster_connection with the name and recovery field
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 	 * filled in.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	 * The stack must set up any notification mechanisms and create
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	 * the filesystem lockspace in the DLM.  The lockspace should be
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	 * stored on cc_lockspace.  Any other information can be stored on
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) 	 * cc_private.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) 	 * ->connect() must not return until it is guaranteed that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126) 	 *  - Node down notifications for the filesystem will be received
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127) 	 *    and passed to conn->cc_recovery_handler().
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128) 	 *  - Locking requests for the filesystem will be processed.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130) 	int (*connect)(struct ocfs2_cluster_connection *conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133) 	 * The fs code calls ocfs2_cluster_disconnect() when a filesystem
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134) 	 * no longer needs cluster services.  All DLM locks have been
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135) 	 * dropped, and recovery notification is being ignored by the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136) 	 * fs code.  The stack must disengage from the DLM and discontinue
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137) 	 * recovery notification.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139) 	 * Once ->disconnect() has returned, the connection structure will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140) 	 * be freed.  Thus, a stack must not return from ->disconnect()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141) 	 * until it will no longer reference the conn pointer.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143) 	 * Once this call returns, the stack glue will be dropping this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144) 	 * connection's reference on the module.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146) 	int (*disconnect)(struct ocfs2_cluster_connection *conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149) 	 * ->this_node() returns the cluster's unique identifier for the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150) 	 * local node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152) 	int (*this_node)(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153) 			 unsigned int *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156) 	 * Call the underlying dlm lock function.  The ->dlm_lock()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157) 	 * callback should convert the flags and mode as appropriate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159) 	 * ast and bast functions are not part of the call because the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160) 	 * stack will likely want to wrap ast and bast calls before passing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161) 	 * them to stack->sp_proto.  There is no astarg.  The lksb will
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162) 	 * be passed back to the ast and bast functions.  The caller can
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163) 	 * use this to find their object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165) 	int (*dlm_lock)(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166) 			int mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167) 			struct ocfs2_dlm_lksb *lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) 			u32 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 			void *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 			unsigned int namelen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	 * Call the underlying dlm unlock function.  The ->dlm_unlock()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	 * function should convert the flags as appropriate.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 	 * The unlock ast is not passed, as the stack will want to wrap
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	 * it before calling stack->sp_proto->lp_unlock_ast().  There is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	 * no astarg.  The lksb will be passed back to the unlock ast
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 	 * function.  The caller can use this to find their object.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	int (*dlm_unlock)(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 			  struct ocfs2_dlm_lksb *lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 			  u32 flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 	 * Return the status of the current lock status block.  The fs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	 * code should never dereference the union.  The ->lock_status()
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	 * callback pulls out the stack-specific lksb, converts the status
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	 * to a proper errno, and returns it.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 	int (*lock_status)(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	 * Return non-zero if the LVB is valid.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	int (*lvb_valid)(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	 * Pull the lvb pointer off of the stack-specific lksb.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	void *(*lock_lvb)(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	 * Cluster-aware posix locks
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	 *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 	 * This is NULL for stacks which do not support posix locks.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	int (*plock)(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 		     u64 ino,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) 		     struct file *file,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) 		     int cmd,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 		     struct file_lock *fl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) 	/*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) 	 * This is an optoinal debugging hook.  If provided, the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) 	 * stack can dump debugging information about this lock.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) 	 */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) 	void (*dump_lksb)(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222)  * Each stack plugin must describe itself by registering a
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223)  * ocfs2_stack_plugin structure.  This is only seen by stackglue and the
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224)  * stack driver.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) struct ocfs2_stack_plugin {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) 	char *sp_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 	struct ocfs2_stack_operations *sp_ops;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) 	struct module *sp_owner;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) 	/* These are managed by the stackglue code. */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) 	struct list_head sp_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) 	unsigned int sp_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 	struct ocfs2_protocol_version sp_max_proto;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) /* Used by the filesystem */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) int ocfs2_cluster_connect(const char *stack_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 			  const char *cluster_name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) 			  int cluster_name_len,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 			  const char *group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) 			  int grouplen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) 			  struct ocfs2_locking_protocol *lproto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) 			  void (*recovery_handler)(int node_num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) 						   void *recovery_data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) 			  void *recovery_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) 			  struct ocfs2_cluster_connection **conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250)  * Used by callers that don't store their stack name.  They must ensure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251)  * all nodes have the same stack.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) int ocfs2_cluster_connect_agnostic(const char *group,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) 				   int grouplen,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 				   struct ocfs2_locking_protocol *lproto,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 				   void (*recovery_handler)(int node_num,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) 							    void *recovery_data),
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 				   void *recovery_data,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) 				   struct ocfs2_cluster_connection **conn);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) int ocfs2_cluster_disconnect(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 			     int hangup_pending);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) void ocfs2_cluster_hangup(const char *group, int grouplen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 263) int ocfs2_cluster_this_node(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 264) 			    unsigned int *node);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 265) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 266) struct ocfs2_lock_res;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 267) int ocfs2_dlm_lock(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 268) 		   int mode,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 269) 		   struct ocfs2_dlm_lksb *lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 270) 		   u32 flags,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 271) 		   void *name,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 272) 		   unsigned int namelen);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 273) int ocfs2_dlm_unlock(struct ocfs2_cluster_connection *conn,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 274) 		     struct ocfs2_dlm_lksb *lksb,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 275) 		     u32 flags);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 276) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 277) int ocfs2_dlm_lock_status(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 278) int ocfs2_dlm_lvb_valid(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 279) void *ocfs2_dlm_lvb(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 280) void ocfs2_dlm_dump_lksb(struct ocfs2_dlm_lksb *lksb);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 281) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 282) int ocfs2_stack_supports_plocks(void);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 283) int ocfs2_plock(struct ocfs2_cluster_connection *conn, u64 ino,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 284) 		struct file *file, int cmd, struct file_lock *fl);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 285) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 286) void ocfs2_stack_glue_set_max_proto_version(struct ocfs2_protocol_version *max_proto);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 287) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 288) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 289) /* Used by stack plugins */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 290) int ocfs2_stack_glue_register(struct ocfs2_stack_plugin *plugin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 291) void ocfs2_stack_glue_unregister(struct ocfs2_stack_plugin *plugin);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 292) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 293) extern struct kset *ocfs2_kset;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 294) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 295) #endif  /* STACKGLUE_H */