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?
fs/dlm/ast.c +0 -0
fs/dlm/config.c +0 -0
fs/dlm/debug_fs.c +0 -0
fs/dlm/dir.c +0 -0
fs/dlm/lock.c +8 -8
@@ -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),
fs/dlm/lockspace.c +3 -3
@@ -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 ;
fs/dlm/lowcomms.c +0 -0
fs/dlm/main.c +0 -0
fs/dlm/member.c +0 -0
fs/dlm/memory.c +0 -0
fs/dlm/midcomms.c +0 -0
fs/dlm/netlink.c +0 -0
fs/dlm/plock.c +0 -0
fs/dlm/rcom.c +0 -0
fs/dlm/recover.c +0 -0
fs/dlm/recoverd.c +0 -0
fs/dlm/requestqueue.c +0 -0
fs/dlm/user.c +0 -0
fs/dlm/util.c +0 -0
include/linux/dlm.h +3 -3
@@ -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),
David Teigland
maintainerQuoted 7 lines · Steven Whitehouse
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?
Thanks, I'll add this to dlm.git. In theory resource names can be binary blobs, but in practice we assume they're strings to print them.