linux/fs/ocfs2/dlm/dlmapi.h

/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
 * dlmapi.h
 *
 * externally exported dlm interfaces
 *
 * Copyright (C) 2004 Oracle.  All rights reserved.
 */

#ifndef DLMAPI_H
#define DLMAPI_H

struct dlm_lock;
struct dlm_ctxt;

/* NOTE: changes made to this enum should be reflected in dlmdebug.c */
enum dlm_status {};

/* for pretty-printing dlm_status error messages */
const char *dlm_errmsg(enum dlm_status err);
/* for pretty-printing dlm_status error names */
const char *dlm_errname(enum dlm_status err);

/* Eventually the DLM will use standard errno values, but in the
 * meantime this lets us track dlm errors as they bubble up. When we
 * bring its error reporting into line with the rest of the stack,
 * these can just be replaced with calls to mlog_errno. */
#define dlm_error(st)

#define DLM_LKSB_UNUSED1
#define DLM_LKSB_PUT_LVB
#define DLM_LKSB_GET_LVB
#define DLM_LKSB_UNUSED2
#define DLM_LKSB_UNUSED3
#define DLM_LKSB_UNUSED4
#define DLM_LKSB_UNUSED5
#define DLM_LKSB_UNUSED6

#define DLM_LVB_LEN

/* Callers are only allowed access to the lvb and status members of
 * this struct. */
struct dlm_lockstatus {};

/* Valid lock modes. */
#define LKM_IVMODE
#define LKM_NLMODE
#define LKM_CRMODE
#define LKM_CWMODE
#define LKM_PRMODE
#define LKM_PWMODE
#define LKM_EXMODE
#define LKM_MAXMODE
#define LKM_MODEMASK

/* Flags passed to dlmlock and dlmunlock:
 * reserved: flags used by the "real" dlm
 * only a few are supported by this dlm
 * (U) = unsupported by ocfs2 dlm */
#define LKM_ORPHAN
#define LKM_PARENTABLE
#define LKM_BLOCK
#define LKM_LOCAL
#define LKM_VALBLK
#define LKM_NOQUEUE
#define LKM_CONVERT
#define LKM_NODLCKWT
#define LKM_UNLOCK
#define LKM_CANCEL
#define LKM_DEQALL
#define LKM_INVVALBLK
#define LKM_SYNCSTS
#define LKM_TIMEOUT
#define LKM_SNGLDLCK
#define LKM_FINDLOCAL
#define LKM_PROC_OWNED
#define LKM_XID
#define LKM_XID_CONFLICT
#define LKM_FORCE
#define LKM_REVVALBLK
/* unused */
#define LKM_UNUSED1
#define LKM_UNUSED2
#define LKM_UNUSED3
#define LKM_UNUSED4
#define LKM_UNUSED5
#define LKM_UNUSED6
#define LKM_UNUSED7

/* ocfs2 extensions: internal only
 * should never be used by caller */
#define LKM_MIGRATION
#define LKM_PUT_LVB
#define LKM_GET_LVB
#define LKM_RECOVERY


dlm_astlockfunc_t;
dlm_bastlockfunc_t;
dlm_astunlockfunc_t;

enum dlm_status dlmlock(struct dlm_ctxt *dlm,
			int mode,
			struct dlm_lockstatus *lksb,
			int flags,
			const char *name,
			int namelen,
			dlm_astlockfunc_t *ast,
			void *data,
			dlm_bastlockfunc_t *bast);

enum dlm_status dlmunlock(struct dlm_ctxt *dlm,
			  struct dlm_lockstatus *lksb,
			  int flags,
			  dlm_astunlockfunc_t *unlockast,
			  void *data);

struct dlm_protocol_version {};
struct dlm_ctxt * dlm_register_domain(const char *domain, u32 key,
				      struct dlm_protocol_version *fs_proto);

void dlm_unregister_domain(struct dlm_ctxt *dlm);

void dlm_print_one_lock(struct dlm_lock *lockid);

dlm_eviction_func;
struct dlm_eviction_cb {};
void dlm_setup_eviction_cb(struct dlm_eviction_cb *cb,
			   dlm_eviction_func *f,
			   void *data);
void dlm_register_eviction_cb(struct dlm_ctxt *dlm,
			      struct dlm_eviction_cb *cb);
void dlm_unregister_eviction_cb(struct dlm_eviction_cb *cb);

#endif /* DLMAPI_H */