1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27#ifndef USERDLM_H
28#define USERDLM_H
29
30#include <linux/module.h>
31#include <linux/fs.h>
32#include <linux/types.h>
33#include <linux/workqueue.h>
34
35
36#define USER_LOCK_ATTACHED (0x00000001)
37
38#define USER_LOCK_BUSY (0x00000002)
39
40#define USER_LOCK_BLOCKED (0x00000004)
41
42#define USER_LOCK_IN_TEARDOWN (0x00000008)
43
44
45#define USER_LOCK_QUEUED (0x00000010)
46
47#define USER_LOCK_IN_CANCEL (0x00000020)
48
49struct user_lock_res {
50 spinlock_t l_lock;
51
52 int l_flags;
53
54#define USER_DLM_LOCK_ID_MAX_LEN 32
55 char l_name[USER_DLM_LOCK_ID_MAX_LEN];
56 int l_namelen;
57 int l_level;
58 unsigned int l_ro_holders;
59 unsigned int l_ex_holders;
60 struct ocfs2_dlm_lksb l_lksb;
61
62 int l_requested;
63 int l_blocking;
64
65 wait_queue_head_t l_event;
66
67 struct work_struct l_work;
68};
69
70extern struct workqueue_struct *user_dlm_worker;
71
72void user_dlm_lock_res_init(struct user_lock_res *lockres,
73 struct dentry *dentry);
74int user_dlm_destroy_lock(struct user_lock_res *lockres);
75int user_dlm_cluster_lock(struct user_lock_res *lockres,
76 int level,
77 int lkm_flags);
78void user_dlm_cluster_unlock(struct user_lock_res *lockres,
79 int level);
80void user_dlm_write_lvb(struct inode *inode,
81 const char *val,
82 unsigned int len);
83ssize_t user_dlm_read_lvb(struct inode *inode,
84 char *val,
85 unsigned int len);
86struct ocfs2_cluster_connection *user_dlm_register(struct qstr *name);
87void user_dlm_unregister(struct ocfs2_cluster_connection *conn);
88void user_dlm_set_locking_protocol(void);
89
90struct dlmfs_inode_private {
91 struct ocfs2_cluster_connection *ip_conn;
92
93 struct user_lock_res ip_lockres;
94 struct inode *ip_parent;
95
96 struct inode ip_vfs_inode;
97};
98
99static inline struct dlmfs_inode_private *
100DLMFS_I(struct inode *inode)
101{
102 return container_of(inode,
103 struct dlmfs_inode_private,
104 ip_vfs_inode);
105}
106
107struct dlmfs_filp_private {
108 int fp_lock_level;
109};
110
111#define DLMFS_MAGIC 0x76a9f425
112
113#endif
114