1 /* SPDX-License-Identifier: GPL-2.0-or-later */
5 * Userspace dlm defines
7 * Copyright (C) 2002, 2004 Oracle. All rights reserved.
14 #include <linux/module.h>
16 #include <linux/types.h>
17 #include <linux/workqueue.h>
19 /* user_lock_res->l_flags flags. */
20 #define USER_LOCK_ATTACHED (0x00000001) /* we have initialized
22 #define USER_LOCK_BUSY (0x00000002) /* we are currently in
24 #define USER_LOCK_BLOCKED (0x00000004) /* blocked waiting to
26 #define USER_LOCK_IN_TEARDOWN (0x00000008) /* we're currently
29 #define USER_LOCK_QUEUED (0x00000010) /* lock is on the
31 #define USER_LOCK_IN_CANCEL (0x00000020)
33 struct user_lock_res {
38 #define USER_DLM_LOCK_ID_MAX_LEN 32
39 char l_name[USER_DLM_LOCK_ID_MAX_LEN];
42 unsigned int l_ro_holders;
43 unsigned int l_ex_holders;
44 struct ocfs2_dlm_lksb l_lksb;
49 wait_queue_head_t l_event;
51 struct work_struct l_work;
54 extern struct workqueue_struct *user_dlm_worker;
56 void user_dlm_lock_res_init(struct user_lock_res *lockres,
57 struct dentry *dentry);
58 int user_dlm_destroy_lock(struct user_lock_res *lockres);
59 int user_dlm_cluster_lock(struct user_lock_res *lockres,
62 void user_dlm_cluster_unlock(struct user_lock_res *lockres,
64 void user_dlm_write_lvb(struct inode *inode,
67 bool user_dlm_read_lvb(struct inode *inode, char *val);
68 struct ocfs2_cluster_connection *user_dlm_register(const struct qstr *name);
69 void user_dlm_unregister(struct ocfs2_cluster_connection *conn);
70 void user_dlm_set_locking_protocol(void);
72 struct dlmfs_inode_private {
73 struct ocfs2_cluster_connection *ip_conn;
75 struct user_lock_res ip_lockres; /* unused for directories. */
76 struct inode *ip_parent;
78 struct inode ip_vfs_inode;
81 static inline struct dlmfs_inode_private *
82 DLMFS_I(struct inode *inode)
84 return container_of(inode,
85 struct dlmfs_inode_private,
89 struct dlmfs_filp_private {
93 #define DLMFS_MAGIC 0x76a9f425
95 #endif /* USERDLM_H */