1 /* -*- mode: c; c-basic-offset: 8; -*-
2 * vim: noexpandtab sw=8 ts=8 sts=0:
6 * Userspace dlm defines
8 * Copyright (C) 2002, 2004 Oracle. All rights reserved.
10 * This program is free software; you can redistribute it and/or
11 * modify it under the terms of the GNU General Public
12 * License as published by the Free Software Foundation; either
13 * version 2 of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public
21 * License along with this program; if not, write to the
22 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
23 * Boston, MA 021110-1307, USA.
30 #include <linux/module.h>
32 #include <linux/types.h>
33 #include <linux/workqueue.h>
35 /* user_lock_res->l_flags flags. */
36 #define USER_LOCK_ATTACHED (0x00000001) /* we have initialized
38 #define USER_LOCK_BUSY (0x00000002) /* we are currently in
40 #define USER_LOCK_BLOCKED (0x00000004) /* blocked waiting to
42 #define USER_LOCK_IN_TEARDOWN (0x00000008) /* we're currently
45 #define USER_LOCK_QUEUED (0x00000010) /* lock is on the
47 #define USER_LOCK_IN_CANCEL (0x00000020)
49 struct user_lock_res {
54 #define USER_DLM_LOCK_ID_MAX_LEN 32
55 char l_name[USER_DLM_LOCK_ID_MAX_LEN];
58 unsigned int l_ro_holders;
59 unsigned int l_ex_holders;
60 struct dlm_lockstatus l_lksb;
65 wait_queue_head_t l_event;
67 struct work_struct l_work;
70 extern struct workqueue_struct *user_dlm_worker;
72 void user_dlm_lock_res_init(struct user_lock_res *lockres,
73 struct dentry *dentry);
74 int user_dlm_destroy_lock(struct user_lock_res *lockres);
75 int user_dlm_cluster_lock(struct user_lock_res *lockres,
78 void user_dlm_cluster_unlock(struct user_lock_res *lockres,
80 void user_dlm_write_lvb(struct inode *inode,
83 void user_dlm_read_lvb(struct inode *inode,
86 struct dlm_ctxt *user_dlm_register_context(struct qstr *name,
87 struct dlm_protocol_version *proto);
88 void user_dlm_unregister_context(struct dlm_ctxt *dlm);
90 struct dlmfs_inode_private {
91 struct dlm_ctxt *ip_dlm;
93 struct user_lock_res ip_lockres; /* unused for directories. */
94 struct inode *ip_parent;
96 struct inode ip_vfs_inode;
99 static inline struct dlmfs_inode_private *
100 DLMFS_I(struct inode *inode)
102 return container_of(inode,
103 struct dlmfs_inode_private,
107 struct dlmfs_filp_private {
111 #define DLMFS_MAGIC 0x76a9f425
113 #endif /* USERDLM_H */