[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[Cluster-devel] dlm: constify a couple of DLM calls



This patch adds some consts to the DLM in a few places. This means that
the interfaces to new lockspace and the lock commands can take const
pointers for the lock space name and lock name respectively. I noticed
that the lock name is a void * in the header file, but a char *
internally to DLM. Perhaps the interface and the internal type should be
changed to match?

Signed-off-by: Steven Whitehouse <swhiteho redhat com>
Cc: David Teigland <teigland redhat com>
Cc: Christine Caulfield <ccaulfie redhat com>

diff --git a/fs/dlm/ast.c b/fs/dlm/ast.c
diff --git a/fs/dlm/config.c b/fs/dlm/config.c
diff --git a/fs/dlm/debug_fs.c b/fs/dlm/debug_fs.c
diff --git a/fs/dlm/dir.c b/fs/dlm/dir.c
diff --git a/fs/dlm/lock.c b/fs/dlm/lock.c
index 2d3d102..8ad51cc 100644
--- a/fs/dlm/lock.c
+++ b/fs/dlm/lock.c
@@ -330,7 +330,7 @@ static void queue_bast(struct dlm_rsb *r, struct dlm_lkb *lkb, int rqmode)
  * Basic operations on rsb's and lkb's
  */
 
-static struct dlm_rsb *create_rsb(struct dlm_ls *ls, char *name, int len)
+static struct dlm_rsb *create_rsb(struct dlm_ls *ls, const char *name, int len)
 {
 	struct dlm_rsb *r;
 
@@ -353,7 +353,7 @@ static struct dlm_rsb *create_rsb(struct dlm_ls *ls, char *name, int len)
 	return r;
 }
 
-static int search_rsb_list(struct list_head *head, char *name, int len,
+static int search_rsb_list(struct list_head *head, const char *name, int len,
 			   unsigned int flags, struct dlm_rsb **r_ret)
 {
 	struct dlm_rsb *r;
@@ -372,7 +372,7 @@ static int search_rsb_list(struct list_head *head, char *name, int len,
 	return error;
 }
 
-static int _search_rsb(struct dlm_ls *ls, char *name, int len, int b,
+static int _search_rsb(struct dlm_ls *ls, const char *name, int len, int b,
 		       unsigned int flags, struct dlm_rsb **r_ret)
 {
 	struct dlm_rsb *r;
@@ -407,7 +407,7 @@ static int _search_rsb(struct dlm_ls *ls, char *name, int len, int b,
 	return error;
 }
 
-static int search_rsb(struct dlm_ls *ls, char *name, int len, int b,
+static int search_rsb(struct dlm_ls *ls, const char *name, int len, int b,
 		      unsigned int flags, struct dlm_rsb **r_ret)
 {
 	int error;
@@ -431,7 +431,7 @@ static int search_rsb(struct dlm_ls *ls, char *name, int len, int b,
  * ref count of 1; when found on normal list the ref count is incremented.
  */
 
-static int find_rsb(struct dlm_ls *ls, char *name, int namelen,
+static int find_rsb(struct dlm_ls *ls, const char *name, int namelen,
 		    unsigned int flags, struct dlm_rsb **r_ret)
 {
 	struct dlm_rsb *r, *tmp;
@@ -2414,8 +2414,8 @@ static int _cancel_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
  * request_lock(), convert_lock(), unlock_lock(), cancel_lock()
  */
 
-static int request_lock(struct dlm_ls *ls, struct dlm_lkb *lkb, char *name,
-			int len, struct dlm_args *args)
+static int request_lock(struct dlm_ls *ls, struct dlm_lkb *lkb,
+			const char *name, int len, struct dlm_args *args)
 {
 	struct dlm_rsb *r;
 	int error;
@@ -2516,7 +2516,7 @@ int dlm_lock(dlm_lockspace_t *lockspace,
 	     int mode,
 	     struct dlm_lksb *lksb,
 	     uint32_t flags,
-	     void *name,
+	     const void *name,
 	     unsigned int namelen,
 	     uint32_t parent_lkid,
 	     void (*ast) (void *astarg),
diff --git a/fs/dlm/lockspace.c b/fs/dlm/lockspace.c
index 499e167..4163834 100644
--- a/fs/dlm/lockspace.c
+++ b/fs/dlm/lockspace.c
@@ -246,7 +246,7 @@ static void dlm_scand_stop(void)
 	kthread_stop(scand_task);
 }
 
-static struct dlm_ls *dlm_find_lockspace_name(char *name, int namelen)
+static struct dlm_ls *dlm_find_lockspace_name(const char *name, int namelen)
 {
 	struct dlm_ls *ls;
 
@@ -377,7 +377,7 @@ static void threads_stop(void)
 	dlm_astd_stop();
 }
 
-static int new_lockspace(char *name, int namelen, void **lockspace,
+static int new_lockspace(const char *name, int namelen, void **lockspace,
 			 uint32_t flags, int lvblen)
 {
 	struct dlm_ls *ls;
@@ -579,7 +579,7 @@ static int new_lockspace(char *name, int namelen, void **lockspace,
 	return error;
 }
 
-int dlm_new_lockspace(char *name, int namelen, void **lockspace,
+int dlm_new_lockspace(const char *name, int namelen, void **lockspace,
 		      uint32_t flags, int lvblen)
 {
 	int error = 0;
diff --git a/fs/dlm/lowcomms.c b/fs/dlm/lowcomms.c
diff --git a/fs/dlm/main.c b/fs/dlm/main.c
diff --git a/fs/dlm/member.c b/fs/dlm/member.c
diff --git a/fs/dlm/memory.c b/fs/dlm/memory.c
diff --git a/fs/dlm/midcomms.c b/fs/dlm/midcomms.c
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c
diff --git a/fs/dlm/plock.c b/fs/dlm/plock.c
diff --git a/fs/dlm/rcom.c b/fs/dlm/rcom.c
diff --git a/fs/dlm/recover.c b/fs/dlm/recover.c
diff --git a/fs/dlm/recoverd.c b/fs/dlm/recoverd.c
diff --git a/fs/dlm/requestqueue.c b/fs/dlm/requestqueue.c
diff --git a/fs/dlm/user.c b/fs/dlm/user.c
diff --git a/fs/dlm/util.c b/fs/dlm/util.c
diff --git a/include/linux/dlm.h b/include/linux/dlm.h
index 203a025..ef27f1a 100644
--- a/include/linux/dlm.h
+++ b/include/linux/dlm.h
@@ -78,8 +78,8 @@ struct dlm_lksb {
  * the cluster, the calling node joins it.
  */
 
-int dlm_new_lockspace(char *name, int namelen, dlm_lockspace_t **lockspace,
-		      uint32_t flags, int lvblen);
+int dlm_new_lockspace(const char *name, int namelen,
+		      dlm_lockspace_t **lockspace, uint32_t flags, int lvblen);
 
 /*
  * dlm_release_lockspace
@@ -130,7 +130,7 @@ int dlm_lock(dlm_lockspace_t *lockspace,
 	     int mode,
 	     struct dlm_lksb *lksb,
 	     uint32_t flags,
-	     void *name,
+	     const void *name,
 	     unsigned int namelen,
 	     uint32_t parent_lkid,
 	     void (*lockast) (void *astarg),



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]