fs: dlm: const void resource name parameter
The resource name parameter should never be changed by DLM so we declare it as const. At some point it is handled as a char pointer, a resource name can be a non printable ascii string as well. This patch change it to handle it as void pointer as it is offered by DLM API. Signed-off-by: Alexander Aring <aahringo@redhat.com> Signed-off-by: David Teigland <teigland@redhat.com>
This commit is contained in:
parent
9cb16d4271
commit
56171e0db2
@ -401,7 +401,7 @@ static int pre_rsb_struct(struct dlm_ls *ls)
|
|||||||
unlock any spinlocks, go back and call pre_rsb_struct again.
|
unlock any spinlocks, go back and call pre_rsb_struct again.
|
||||||
Otherwise, take an rsb off the list and return it. */
|
Otherwise, take an rsb off the list and return it. */
|
||||||
|
|
||||||
static int get_rsb_struct(struct dlm_ls *ls, char *name, int len,
|
static int get_rsb_struct(struct dlm_ls *ls, const void *name, int len,
|
||||||
struct dlm_rsb **r_ret)
|
struct dlm_rsb **r_ret)
|
||||||
{
|
{
|
||||||
struct dlm_rsb *r;
|
struct dlm_rsb *r;
|
||||||
@ -412,7 +412,8 @@ static int get_rsb_struct(struct dlm_ls *ls, char *name, int len,
|
|||||||
count = ls->ls_new_rsb_count;
|
count = ls->ls_new_rsb_count;
|
||||||
spin_unlock(&ls->ls_new_rsb_spin);
|
spin_unlock(&ls->ls_new_rsb_spin);
|
||||||
log_debug(ls, "find_rsb retry %d %d %s",
|
log_debug(ls, "find_rsb retry %d %d %s",
|
||||||
count, dlm_config.ci_new_rsb_count, name);
|
count, dlm_config.ci_new_rsb_count,
|
||||||
|
(const char *)name);
|
||||||
return -EAGAIN;
|
return -EAGAIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,7 +449,7 @@ static int rsb_cmp(struct dlm_rsb *r, const char *name, int nlen)
|
|||||||
return memcmp(r->res_name, maxname, DLM_RESNAME_MAXLEN);
|
return memcmp(r->res_name, maxname, DLM_RESNAME_MAXLEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len,
|
int dlm_search_rsb_tree(struct rb_root *tree, const void *name, int len,
|
||||||
struct dlm_rsb **r_ret)
|
struct dlm_rsb **r_ret)
|
||||||
{
|
{
|
||||||
struct rb_node *node = tree->rb_node;
|
struct rb_node *node = tree->rb_node;
|
||||||
@ -546,7 +547,7 @@ static int rsb_insert(struct dlm_rsb *rsb, struct rb_root *tree)
|
|||||||
* while that rsb has a potentially stale master.)
|
* while that rsb has a potentially stale master.)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int find_rsb_dir(struct dlm_ls *ls, char *name, int len,
|
static int find_rsb_dir(struct dlm_ls *ls, const void *name, int len,
|
||||||
uint32_t hash, uint32_t b,
|
uint32_t hash, uint32_t b,
|
||||||
int dir_nodeid, int from_nodeid,
|
int dir_nodeid, int from_nodeid,
|
||||||
unsigned int flags, struct dlm_rsb **r_ret)
|
unsigned int flags, struct dlm_rsb **r_ret)
|
||||||
@ -724,7 +725,7 @@ static int find_rsb_dir(struct dlm_ls *ls, char *name, int len,
|
|||||||
dlm_recover_locks) before we've made ourself master (in
|
dlm_recover_locks) before we've made ourself master (in
|
||||||
dlm_recover_masters). */
|
dlm_recover_masters). */
|
||||||
|
|
||||||
static int find_rsb_nodir(struct dlm_ls *ls, char *name, int len,
|
static int find_rsb_nodir(struct dlm_ls *ls, const void *name, int len,
|
||||||
uint32_t hash, uint32_t b,
|
uint32_t hash, uint32_t b,
|
||||||
int dir_nodeid, int from_nodeid,
|
int dir_nodeid, int from_nodeid,
|
||||||
unsigned int flags, struct dlm_rsb **r_ret)
|
unsigned int flags, struct dlm_rsb **r_ret)
|
||||||
@ -818,8 +819,9 @@ static int find_rsb_nodir(struct dlm_ls *ls, char *name, int len,
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int find_rsb(struct dlm_ls *ls, char *name, int len, int from_nodeid,
|
static int find_rsb(struct dlm_ls *ls, const void *name, int len,
|
||||||
unsigned int flags, struct dlm_rsb **r_ret)
|
int from_nodeid, unsigned int flags,
|
||||||
|
struct dlm_rsb **r_ret)
|
||||||
{
|
{
|
||||||
uint32_t hash, b;
|
uint32_t hash, b;
|
||||||
int dir_nodeid;
|
int dir_nodeid;
|
||||||
@ -3320,8 +3322,9 @@ static int _cancel_lock(struct dlm_rsb *r, struct dlm_lkb *lkb)
|
|||||||
* request_lock(), convert_lock(), unlock_lock(), cancel_lock()
|
* request_lock(), convert_lock(), unlock_lock(), cancel_lock()
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static int request_lock(struct dlm_ls *ls, struct dlm_lkb *lkb, char *name,
|
static int request_lock(struct dlm_ls *ls, struct dlm_lkb *lkb,
|
||||||
int len, struct dlm_args *args)
|
const void *name, int len,
|
||||||
|
struct dlm_args *args)
|
||||||
{
|
{
|
||||||
struct dlm_rsb *r;
|
struct dlm_rsb *r;
|
||||||
int error;
|
int error;
|
||||||
@ -3420,7 +3423,7 @@ int dlm_lock(dlm_lockspace_t *lockspace,
|
|||||||
int mode,
|
int mode,
|
||||||
struct dlm_lksb *lksb,
|
struct dlm_lksb *lksb,
|
||||||
uint32_t flags,
|
uint32_t flags,
|
||||||
void *name,
|
const void *name,
|
||||||
unsigned int namelen,
|
unsigned int namelen,
|
||||||
uint32_t parent_lkid,
|
uint32_t parent_lkid,
|
||||||
void (*ast) (void *astarg),
|
void (*ast) (void *astarg),
|
||||||
|
@ -36,7 +36,7 @@ static inline void dlm_adjust_timeouts(struct dlm_ls *ls) { }
|
|||||||
int dlm_master_lookup(struct dlm_ls *ls, int nodeid, char *name, int len,
|
int dlm_master_lookup(struct dlm_ls *ls, int nodeid, char *name, int len,
|
||||||
unsigned int flags, int *r_nodeid, int *result);
|
unsigned int flags, int *r_nodeid, int *result);
|
||||||
|
|
||||||
int dlm_search_rsb_tree(struct rb_root *tree, char *name, int len,
|
int dlm_search_rsb_tree(struct rb_root *tree, const void *name, int len,
|
||||||
struct dlm_rsb **r_ret);
|
struct dlm_rsb **r_ret);
|
||||||
|
|
||||||
void dlm_recover_purge(struct dlm_ls *ls);
|
void dlm_recover_purge(struct dlm_ls *ls);
|
||||||
|
@ -131,7 +131,7 @@ int dlm_lock(dlm_lockspace_t *lockspace,
|
|||||||
int mode,
|
int mode,
|
||||||
struct dlm_lksb *lksb,
|
struct dlm_lksb *lksb,
|
||||||
uint32_t flags,
|
uint32_t flags,
|
||||||
void *name,
|
const void *name,
|
||||||
unsigned int namelen,
|
unsigned int namelen,
|
||||||
uint32_t parent_lkid,
|
uint32_t parent_lkid,
|
||||||
void (*lockast) (void *astarg),
|
void (*lockast) (void *astarg),
|
||||||
|
@ -49,7 +49,7 @@
|
|||||||
/* note: we begin tracing dlm_lock_start() only if ls and lkb are found */
|
/* note: we begin tracing dlm_lock_start() only if ls and lkb are found */
|
||||||
TRACE_EVENT(dlm_lock_start,
|
TRACE_EVENT(dlm_lock_start,
|
||||||
|
|
||||||
TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, void *name,
|
TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, const void *name,
|
||||||
unsigned int namelen, int mode, __u32 flags),
|
unsigned int namelen, int mode, __u32 flags),
|
||||||
|
|
||||||
TP_ARGS(ls, lkb, name, namelen, mode, flags),
|
TP_ARGS(ls, lkb, name, namelen, mode, flags),
|
||||||
@ -91,7 +91,7 @@ TRACE_EVENT(dlm_lock_start,
|
|||||||
|
|
||||||
TRACE_EVENT(dlm_lock_end,
|
TRACE_EVENT(dlm_lock_end,
|
||||||
|
|
||||||
TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, void *name,
|
TP_PROTO(struct dlm_ls *ls, struct dlm_lkb *lkb, const void *name,
|
||||||
unsigned int namelen, int mode, __u32 flags, int error,
|
unsigned int namelen, int mode, __u32 flags, int error,
|
||||||
bool kernel_lock),
|
bool kernel_lock),
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user