From 9b47c11d1cbedcba685c9bd90c73fd41acdfab0e Mon Sep 17 00:00:00 2001 From: Steven Whitehouse Date: Fri, 8 Sep 2006 10:17:58 -0400 Subject: [GFS2] Use void * instead of typedef for locking module interface As requested by Jan Engelhardt, this removes the typedefs in the locking module interface and replaces them with void *. Also since we are changing the interface, I've added a few consts as well. Cc: Jan Engelhardt Cc: David Teigland Signed-off-by: Steven Whitehouse --- fs/gfs2/locking/dlm/lock.c | 32 ++++++++++++++++---------------- fs/gfs2/locking/dlm/lock_dlm.h | 22 +++++++++++----------- fs/gfs2/locking/dlm/mount.c | 24 ++++++++++++------------ fs/gfs2/locking/dlm/plock.c | 15 +++++++-------- 4 files changed, 46 insertions(+), 47 deletions(-) (limited to 'fs/gfs2/locking/dlm') diff --git a/fs/gfs2/locking/dlm/lock.c b/fs/gfs2/locking/dlm/lock.c index e4359b1b7174..b167addf9fd1 100644 --- a/fs/gfs2/locking/dlm/lock.c +++ b/fs/gfs2/locking/dlm/lock.c @@ -207,21 +207,21 @@ void gdlm_delete_lp(struct gdlm_lock *lp) kfree(lp); } -int gdlm_get_lock(lm_lockspace_t *lockspace, struct lm_lockname *name, - lm_lock_t **lockp) +int gdlm_get_lock(void *lockspace, struct lm_lockname *name, + void **lockp) { struct gdlm_lock *lp; int error; - error = gdlm_create_lp((struct gdlm_ls *) lockspace, name, &lp); + error = gdlm_create_lp(lockspace, name, &lp); - *lockp = (lm_lock_t *) lp; + *lockp = lp; return error; } -void gdlm_put_lock(lm_lock_t *lock) +void gdlm_put_lock(void *lock) { - gdlm_delete_lp((struct gdlm_lock *) lock); + gdlm_delete_lp(lock); } unsigned int gdlm_do_lock(struct gdlm_lock *lp) @@ -305,10 +305,10 @@ static unsigned int gdlm_do_unlock(struct gdlm_lock *lp) return LM_OUT_ASYNC; } -unsigned int gdlm_lock(lm_lock_t *lock, unsigned int cur_state, +unsigned int gdlm_lock(void *lock, unsigned int cur_state, unsigned int req_state, unsigned int flags) { - struct gdlm_lock *lp = (struct gdlm_lock *) lock; + struct gdlm_lock *lp = lock; clear_bit(LFL_DLM_CANCEL, &lp->flags); if (flags & LM_FLAG_NOEXP) @@ -321,9 +321,9 @@ unsigned int gdlm_lock(lm_lock_t *lock, unsigned int cur_state, return gdlm_do_lock(lp); } -unsigned int gdlm_unlock(lm_lock_t *lock, unsigned int cur_state) +unsigned int gdlm_unlock(void *lock, unsigned int cur_state) { - struct gdlm_lock *lp = (struct gdlm_lock *) lock; + struct gdlm_lock *lp = lock; clear_bit(LFL_DLM_CANCEL, &lp->flags); if (lp->cur == DLM_LOCK_IV) @@ -331,9 +331,9 @@ unsigned int gdlm_unlock(lm_lock_t *lock, unsigned int cur_state) return gdlm_do_unlock(lp); } -void gdlm_cancel(lm_lock_t *lock) +void gdlm_cancel(void *lock) { - struct gdlm_lock *lp = (struct gdlm_lock *) lock; + struct gdlm_lock *lp = lock; struct gdlm_ls *ls = lp->ls; int error, delay_list = 0; @@ -464,9 +464,9 @@ static void unhold_null_lock(struct gdlm_lock *lp) intact on the resource while the lvb is "held" even if it's holding no locks on the resource. */ -int gdlm_hold_lvb(lm_lock_t *lock, char **lvbp) +int gdlm_hold_lvb(void *lock, char **lvbp) { - struct gdlm_lock *lp = (struct gdlm_lock *) lock; + struct gdlm_lock *lp = lock; int error; error = gdlm_add_lvb(lp); @@ -482,9 +482,9 @@ int gdlm_hold_lvb(lm_lock_t *lock, char **lvbp) return error; } -void gdlm_unhold_lvb(lm_lock_t *lock, char *lvb) +void gdlm_unhold_lvb(void *lock, char *lvb) { - struct gdlm_lock *lp = (struct gdlm_lock *) lock; + struct gdlm_lock *lp = lock; unhold_null_lock(lp); gdlm_del_lvb(lp); diff --git a/fs/gfs2/locking/dlm/lock_dlm.h b/fs/gfs2/locking/dlm/lock_dlm.h index a4f534a0ecff..3a45c020d01e 100644 --- a/fs/gfs2/locking/dlm/lock_dlm.h +++ b/fs/gfs2/locking/dlm/lock_dlm.h @@ -112,7 +112,7 @@ struct gdlm_lock { s16 cur; s16 req; s16 prev_req; - u32 lkf; /* dlm flags DLM_LKF_ */ + u32 lkf; /* dlm flags DLM_LKF_ */ unsigned long flags; /* lock_dlm flags LFL_ */ int bast_mode; /* protected by async_lock */ @@ -165,23 +165,23 @@ int gdlm_release_all_locks(struct gdlm_ls *); void gdlm_delete_lp(struct gdlm_lock *); unsigned int gdlm_do_lock(struct gdlm_lock *); -int gdlm_get_lock(lm_lockspace_t *, struct lm_lockname *, lm_lock_t **); -void gdlm_put_lock(lm_lock_t *); -unsigned int gdlm_lock(lm_lock_t *, unsigned int, unsigned int, unsigned int); -unsigned int gdlm_unlock(lm_lock_t *, unsigned int); -void gdlm_cancel(lm_lock_t *); -int gdlm_hold_lvb(lm_lock_t *, char **); -void gdlm_unhold_lvb(lm_lock_t *, char *); +int gdlm_get_lock(void *, struct lm_lockname *, void **); +void gdlm_put_lock(void *); +unsigned int gdlm_lock(void *, unsigned int, unsigned int, unsigned int); +unsigned int gdlm_unlock(void *, unsigned int); +void gdlm_cancel(void *); +int gdlm_hold_lvb(void *, char **); +void gdlm_unhold_lvb(void *, char *); /* plock.c */ int gdlm_plock_init(void); void gdlm_plock_exit(void); -int gdlm_plock(lm_lockspace_t *, struct lm_lockname *, struct file *, int, +int gdlm_plock(void *, struct lm_lockname *, struct file *, int, struct file_lock *); -int gdlm_plock_get(lm_lockspace_t *, struct lm_lockname *, struct file *, +int gdlm_plock_get(void *, struct lm_lockname *, struct file *, struct file_lock *); -int gdlm_punlock(lm_lockspace_t *, struct lm_lockname *, struct file *, +int gdlm_punlock(void *, struct lm_lockname *, struct file *, struct file_lock *); #endif diff --git a/fs/gfs2/locking/dlm/mount.c b/fs/gfs2/locking/dlm/mount.c index 832fb819a2b5..1f94dd35a943 100644 --- a/fs/gfs2/locking/dlm/mount.c +++ b/fs/gfs2/locking/dlm/mount.c @@ -11,7 +11,7 @@ int gdlm_drop_count; int gdlm_drop_period; -struct lm_lockops gdlm_ops; +const struct lm_lockops gdlm_ops; static struct gdlm_ls *init_gdlm(lm_callback_t cb, struct gfs2_sbd *sdp, @@ -120,7 +120,7 @@ static int make_args(struct gdlm_ls *ls, char *data_arg, int *nodir) } static int gdlm_mount(char *table_name, char *host_data, - lm_callback_t cb, struct gfs2_sbd *sdp, + lm_callback_t cb, void *cb_data, unsigned int min_lvb_size, int flags, struct lm_lockstruct *lockstruct, struct kobject *fskobj) @@ -131,7 +131,7 @@ static int gdlm_mount(char *table_name, char *host_data, if (min_lvb_size > GDLM_LVB_SIZE) goto out; - ls = init_gdlm(cb, sdp, flags, table_name); + ls = init_gdlm(cb, cb_data, flags, table_name); if (!ls) goto out; @@ -174,9 +174,9 @@ out: return error; } -static void gdlm_unmount(lm_lockspace_t *lockspace) +static void gdlm_unmount(void *lockspace) { - struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; + struct gdlm_ls *ls = lockspace; int rv; log_debug("unmount flags %lx", ls->flags); @@ -198,18 +198,18 @@ out: kfree(ls); } -static void gdlm_recovery_done(lm_lockspace_t *lockspace, unsigned int jid, +static void gdlm_recovery_done(void *lockspace, unsigned int jid, unsigned int message) { - struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; + struct gdlm_ls *ls = lockspace; ls->recover_jid_done = jid; ls->recover_jid_status = message; kobject_uevent(&ls->kobj, KOBJ_CHANGE); } -static void gdlm_others_may_mount(lm_lockspace_t *lockspace) +static void gdlm_others_may_mount(void *lockspace) { - struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; + struct gdlm_ls *ls = lockspace; ls->first_done = 1; kobject_uevent(&ls->kobj, KOBJ_CHANGE); } @@ -218,9 +218,9 @@ static void gdlm_others_may_mount(lm_lockspace_t *lockspace) other mounters, and lets us know (sets WITHDRAW flag). Then, userspace leaves the mount group while we leave the lockspace. */ -static void gdlm_withdraw(lm_lockspace_t *lockspace) +static void gdlm_withdraw(void *lockspace) { - struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; + struct gdlm_ls *ls = lockspace; kobject_uevent(&ls->kobj, KOBJ_OFFLINE); @@ -233,7 +233,7 @@ static void gdlm_withdraw(lm_lockspace_t *lockspace) gdlm_kobject_release(ls); } -struct lm_lockops gdlm_ops = { +const struct lm_lockops gdlm_ops = { .lm_proto_name = "lock_dlm", .lm_mount = gdlm_mount, .lm_others_may_mount = gdlm_others_may_mount, diff --git a/fs/gfs2/locking/dlm/plock.c b/fs/gfs2/locking/dlm/plock.c index 263636b390fe..7365aec9511b 100644 --- a/fs/gfs2/locking/dlm/plock.c +++ b/fs/gfs2/locking/dlm/plock.c @@ -58,10 +58,10 @@ static void send_op(struct plock_op *op) wake_up(&send_wq); } -int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name, +int gdlm_plock(void *lockspace, struct lm_lockname *name, struct file *file, int cmd, struct file_lock *fl) { - struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; + struct gdlm_ls *ls = lockspace; struct plock_op *op; int rv; @@ -102,10 +102,10 @@ int gdlm_plock(lm_lockspace_t *lockspace, struct lm_lockname *name, return rv; } -int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name, +int gdlm_punlock(void *lockspace, struct lm_lockname *name, struct file *file, struct file_lock *fl) { - struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; + struct gdlm_ls *ls = lockspace; struct plock_op *op; int rv; @@ -141,10 +141,10 @@ int gdlm_punlock(lm_lockspace_t *lockspace, struct lm_lockname *name, return rv; } -int gdlm_plock_get(lm_lockspace_t *lockspace, struct lm_lockname *name, +int gdlm_plock_get(void *lockspace, struct lm_lockname *name, struct file *file, struct file_lock *fl) { - struct gdlm_ls *ls = (struct gdlm_ls *) lockspace; + struct gdlm_ls *ls = lockspace; struct plock_op *op; int rv; @@ -231,8 +231,7 @@ static ssize_t dev_write(struct file *file, const char __user *u, size_t count, spin_lock(&ops_lock); list_for_each_entry(op, &recv_list, list) { - if (op->info.fsid == info.fsid && - op->info.number == info.number && + if (op->info.fsid == info.fsid && op->info.number == info.number && op->info.owner == info.owner) { list_del_init(&op->list); found = 1; -- cgit v1.2.3