From 2402211a8389282fd2942fad4511f02c0eeeffc5 Mon Sep 17 00:00:00 2001 From: David Teigland Date: Fri, 14 Mar 2008 15:09:15 -0500 Subject: dlm: move plock code from gfs2 Move the code that handles cluster posix locks from gfs2 into the dlm so that it can be used by both gfs2 and ocfs2. Signed-off-by: David Teigland --- include/linux/Kbuild | 2 +- include/linux/dlm_plock.h | 50 ++++++++++++++++++++++++++++++++++++++++++ include/linux/lock_dlm_plock.h | 41 ---------------------------------- 3 files changed, 51 insertions(+), 42 deletions(-) create mode 100644 include/linux/dlm_plock.h delete mode 100644 include/linux/lock_dlm_plock.h (limited to 'include') diff --git a/include/linux/Kbuild b/include/linux/Kbuild index b3d9ccde0c2..376fc972efe 100644 --- a/include/linux/Kbuild +++ b/include/linux/Kbuild @@ -100,7 +100,7 @@ header-y += ixjuser.h header-y += jffs2.h header-y += keyctl.h header-y += limits.h -header-y += lock_dlm_plock.h +header-y += dlm_plock.h header-y += magic.h header-y += major.h header-y += matroxfb.h diff --git a/include/linux/dlm_plock.h b/include/linux/dlm_plock.h new file mode 100644 index 00000000000..18d5fdbceb7 --- /dev/null +++ b/include/linux/dlm_plock.h @@ -0,0 +1,50 @@ +/* + * Copyright (C) 2005-2008 Red Hat, Inc. All rights reserved. + * + * This copyrighted material is made available to anyone wishing to use, + * modify, copy, or redistribute it subject to the terms and conditions + * of the GNU General Public License v.2. + */ + +#ifndef __DLM_PLOCK_DOT_H__ +#define __DLM_PLOCK_DOT_H__ + +#define DLM_PLOCK_MISC_NAME "dlm_plock" + +#define DLM_PLOCK_VERSION_MAJOR 1 +#define DLM_PLOCK_VERSION_MINOR 1 +#define DLM_PLOCK_VERSION_PATCH 0 + +enum { + DLM_PLOCK_OP_LOCK = 1, + DLM_PLOCK_OP_UNLOCK, + DLM_PLOCK_OP_GET, +}; + +struct dlm_plock_info { + __u32 version[3]; + __u8 optype; + __u8 ex; + __u8 wait; + __u8 pad; + __u32 pid; + __s32 nodeid; + __s32 rv; + __u32 fsid; + __u64 number; + __u64 start; + __u64 end; + __u64 owner; +}; + +#ifdef __KERNEL__ +int dlm_posix_lock(dlm_lockspace_t *lockspace, u64 number, struct file *file, + int cmd, struct file_lock *fl); +int dlm_posix_unlock(dlm_lockspace_t *lockspace, u64 number, struct file *file, + struct file_lock *fl); +int dlm_posix_get(dlm_lockspace_t *lockspace, u64 number, struct file *file, + struct file_lock *fl); +#endif /* __KERNEL__ */ + +#endif + diff --git a/include/linux/lock_dlm_plock.h b/include/linux/lock_dlm_plock.h deleted file mode 100644 index fc341511397..00000000000 --- a/include/linux/lock_dlm_plock.h +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Copyright (C) 2005 Red Hat, Inc. All rights reserved. - * - * This copyrighted material is made available to anyone wishing to use, - * modify, copy, or redistribute it subject to the terms and conditions - * of the GNU General Public License v.2. - */ - -#ifndef __LOCK_DLM_PLOCK_DOT_H__ -#define __LOCK_DLM_PLOCK_DOT_H__ - -#define GDLM_PLOCK_MISC_NAME "lock_dlm_plock" - -#define GDLM_PLOCK_VERSION_MAJOR 1 -#define GDLM_PLOCK_VERSION_MINOR 1 -#define GDLM_PLOCK_VERSION_PATCH 0 - -enum { - GDLM_PLOCK_OP_LOCK = 1, - GDLM_PLOCK_OP_UNLOCK, - GDLM_PLOCK_OP_GET, -}; - -struct gdlm_plock_info { - __u32 version[3]; - __u8 optype; - __u8 ex; - __u8 wait; - __u8 pad; - __u32 pid; - __s32 nodeid; - __s32 rv; - __u32 fsid; - __u64 number; - __u64 start; - __u64 end; - __u64 owner; -}; - -#endif - -- cgit v1.2.3 From 3d564fa3472d36cd6aa70514c37b8bbbec5b17ab Mon Sep 17 00:00:00 2001 From: David Teigland Date: Mon, 14 Apr 2008 14:06:29 -0500 Subject: dlm: common max length definitions Add central definitions for max lockspace name length and max resource name length. The lack of central definitions has resulted in scattered private definitions which we can now clean up, including an unused one in dlm_device.h. Signed-off-by: David Teigland --- include/linux/dlm.h | 4 ---- include/linux/dlm_device.h | 3 --- include/linux/dlmconstants.h | 4 ++++ 3 files changed, 4 insertions(+), 7 deletions(-) (limited to 'include') diff --git a/include/linux/dlm.h b/include/linux/dlm.h index c743fbc769d..188f6e6925a 100644 --- a/include/linux/dlm.h +++ b/include/linux/dlm.h @@ -22,10 +22,6 @@ /* Lock levels and flags are here */ #include - -#define DLM_RESNAME_MAXLEN 64 - - typedef void dlm_lockspace_t; /* diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h index 9642277a152..dcfd2499902 100644 --- a/include/linux/dlm_device.h +++ b/include/linux/dlm_device.h @@ -94,9 +94,6 @@ struct dlm_lock_result { #define DLM_USER_PURGE 6 #define DLM_USER_DEADLOCK 7 -/* Arbitrary length restriction */ -#define MAX_LS_NAME_LEN 64 - /* Lockspace flags */ #define DLM_USER_LSFLG_AUTOFREE 1 #define DLM_USER_LSFLG_FORCEFREE 2 diff --git a/include/linux/dlmconstants.h b/include/linux/dlmconstants.h index fddb3d3ff32..47bf08dc756 100644 --- a/include/linux/dlmconstants.h +++ b/include/linux/dlmconstants.h @@ -18,6 +18,10 @@ * Constants used by DLM interface. */ +#define DLM_LOCKSPACE_LEN 64 +#define DLM_RESNAME_MAXLEN 64 + + /* * Lock Modes */ -- cgit v1.2.3 From c1c76743e98346eb052b707f0e054377a09441d1 Mon Sep 17 00:00:00 2001 From: Mike Frysinger Date: Mon, 21 Apr 2008 11:35:39 -0500 Subject: dlm: linux/{dlm,dlm_device}.h: cleanup for userspace linux/dlm_device.h uses types from dlm.h and types.h, so pull them in. The dlm.h header should use __u## rather than uint##_t types and thus pull in linux/types.h for it. Signed-off-by: Mike Frysinger Signed-off-by: David Teigland --- include/linux/dlm.h | 3 ++- include/linux/dlm_device.h | 8 ++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'include') diff --git a/include/linux/dlm.h b/include/linux/dlm.h index 188f6e6925a..203a025e30e 100644 --- a/include/linux/dlm.h +++ b/include/linux/dlm.h @@ -21,6 +21,7 @@ /* Lock levels and flags are here */ #include +#include typedef void dlm_lockspace_t; @@ -59,7 +60,7 @@ typedef void dlm_lockspace_t; struct dlm_lksb { int sb_status; - uint32_t sb_lkid; + __u32 sb_lkid; char sb_flags; char * sb_lvbptr; }; diff --git a/include/linux/dlm_device.h b/include/linux/dlm_device.h index dcfd2499902..c6034508fed 100644 --- a/include/linux/dlm_device.h +++ b/include/linux/dlm_device.h @@ -11,10 +11,16 @@ ******************************************************************************* ******************************************************************************/ +#ifndef _LINUX_DLM_DEVICE_H +#define _LINUX_DLM_DEVICE_H + /* This is the device interface for dlm, most users will use a library * interface. */ +#include +#include + #define DLM_USER_LVB_LEN 32 /* Version of the device interface */ @@ -98,3 +104,5 @@ struct dlm_lock_result { #define DLM_USER_LSFLG_AUTOFREE 1 #define DLM_USER_LSFLG_FORCEFREE 2 +#endif + -- cgit v1.2.3