summaryrefslogtreecommitdiffstats
path: root/usr.sbin/amd
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2014-10-26 03:28:41 +0000
committerguenther <guenther@openbsd.org>2014-10-26 03:28:41 +0000
commit26d0c865b2e28f6e7d4c71090534c37cab976ea0 (patch)
tree35209b43e77fd4ebcf694f105da273697e916e47 /usr.sbin/amd
parentDelete casts to void* of the argument to free(): only needed when lying (diff)
downloadwireguard-openbsd-26d0c865b2e28f6e7d4c71090534c37cab976ea0.tar.xz
wireguard-openbsd-26d0c865b2e28f6e7d4c71090534c37cab976ea0.zip
Remove a gazillion useless casts to void*
Eliminate a couple function pointer casts, fixing the function to match in one case
Diffstat (limited to 'usr.sbin/amd')
-rw-r--r--usr.sbin/amd/amd/afs_ops.c26
-rw-r--r--usr.sbin/amd/amd/amq_subr.c8
-rw-r--r--usr.sbin/amd/amd/info_nis.c9
-rw-r--r--usr.sbin/amd/amd/map.c23
-rw-r--r--usr.sbin/amd/amd/mapc.c6
-rw-r--r--usr.sbin/amd/amd/misc_rpc.c8
-rw-r--r--usr.sbin/amd/amd/mntfs.c3
-rw-r--r--usr.sbin/amd/amd/nfs_ops.c20
-rw-r--r--usr.sbin/amd/amd/nfs_subr.c10
-rw-r--r--usr.sbin/amd/amd/nfsx_ops.c13
-rw-r--r--usr.sbin/amd/amd/opts.c6
-rw-r--r--usr.sbin/amd/amd/pfs_ops.c6
-rw-r--r--usr.sbin/amd/amd/rpc_fwd.c10
-rw-r--r--usr.sbin/amd/amd/sched.c16
-rw-r--r--usr.sbin/amd/amd/srvr_afs.c6
-rw-r--r--usr.sbin/amd/amd/srvr_nfs.c25
-rw-r--r--usr.sbin/amd/amd/ufs_ops.c4
-rw-r--r--usr.sbin/amd/amd/util.c4
-rw-r--r--usr.sbin/amd/amq/amq.c10
19 files changed, 105 insertions, 108 deletions
diff --git a/usr.sbin/amd/amd/afs_ops.c b/usr.sbin/amd/amd/afs_ops.c
index 953d3483efe..120e1af41f7 100644
--- a/usr.sbin/amd/amd/afs_ops.c
+++ b/usr.sbin/amd/amd/afs_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: afs_ops.c,v 1.18 2014/10/26 03:08:21 guenther Exp $ */
+/* $OpenBSD: afs_ops.c,v 1.19 2014/10/26 03:28:41 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -107,7 +107,7 @@ mount_toplvl(char *dir, char *opts)
const char *type = MOUNT_NFS;
- bzero((void *)&nfs_args, sizeof(nfs_args)); /* Paranoid */
+ bzero(&nfs_args, sizeof(nfs_args)); /* Paranoid */
mnt.mnt_dir = dir;
mnt.mnt_fsname = pid_fsname;
@@ -138,7 +138,7 @@ mount_toplvl(char *dir, char *opts)
* is not used since that will not work in HP-UX clusters and
* this is no more expensive.
*/
- bzero((void *)&sin, sizeof(sin));
+ bzero(&sin, sizeof(sin));
sin.sin_family = AF_INET;
sin.sin_addr = myipaddr;
if ((port = hasmntval(&mnt, "port"))) {
@@ -227,7 +227,7 @@ afs_mkcacheref(mntfs *mf)
cache = mf->mf_fo->opt_cache;
else
cache = "none";
- mf->mf_private = (void *)mapc_find(mf->mf_info, cache);
+ mf->mf_private = mapc_find(mf->mf_info, cache);
mf->mf_prfree = mapc_free;
}
@@ -240,7 +240,7 @@ root_mount(am_node *mp)
mntfs *mf = mp->am_mnt;
mf->mf_mount = strealloc(mf->mf_mount, pid_fsname);
- mf->mf_private = (void *)mapc_find(mf->mf_info, "");
+ mf->mf_private = mapc_find(mf->mf_info, "");
mf->mf_prfree = mapc_free;
return 0;
@@ -410,7 +410,7 @@ union_mounted(mntfs *mf)
* keep the wildcard and /defaults entries...
*/
mapc_free(mf->mf_private);
- mf->mf_private = (void *)mapc_find(mf->mf_info, "inc");
+ mf->mf_private = mapc_find(mf->mf_info, "inc");
/* mapc_add_kv(mf->mf_private, strdup("/defaults"),
strdup("type:=link;opts:=nounmount;sublink:=${key}")); */
#endif
@@ -586,7 +586,7 @@ afs_cont(int rc, int term, void *closure)
/*
* Wakeup anything waiting for this mount
*/
- wakeup((void *)mf);
+ wakeup(mf);
/*
* Check for termination signal or exit status...
@@ -989,7 +989,7 @@ afs_bgmount(struct continuation *cp, int mpe)
untimeout(cp->callout);
cp->callout = 0;
}
- run_task(try_mount, (void *)mp, afs_cont, (void *)cp);
+ run_task(try_mount, mp, afs_cont, cp);
mf->mf_flags |= MFF_MKMNT; /* XXX */
if (mf_retry) free_mntfs(mf_retry);
return -1;
@@ -997,7 +997,7 @@ afs_bgmount(struct continuation *cp, int mpe)
#ifdef DEBUG
dlog("foreground mount of \"%s\" ...", mf->mf_info);
#endif /* DEBUG */
- this_error = try_mount((void *)mp);
+ this_error = try_mount(mp);
if (this_error < 0) {
if (!mf_retry)
mf_retry = dup_mntfs(mf);
@@ -1017,7 +1017,7 @@ afs_bgmount(struct continuation *cp, int mpe)
/*
* Wakeup anything waiting for this mount
*/
- wakeup((void *)mf);
+ wakeup(mf);
}
}
@@ -1043,10 +1043,10 @@ afs_bgmount(struct continuation *cp, int mpe)
#ifdef DEBUG
dlog("Arranging to retry mount of %s", cp->mp->am_path);
#endif /* DEBUG */
- sched_task(afs_retry, (void *)cp, (void *)mf);
+ sched_task(afs_retry, cp, mf);
if (cp->callout)
untimeout(cp->callout);
- cp->callout = timeout(RETRY_INTERVAL, wakeup, (void *)mf);
+ cp->callout = timeout(RETRY_INTERVAL, wakeup, mf);
cp->mp->am_ttl = clocktime() + RETRY_INTERVAL;
@@ -1477,7 +1477,7 @@ in_progrss:
cp->tried = FALSE;
cp->start = clocktime();
cp->def_opts = strdup(auto_opts);
- bzero((void *)&cp->fs_opts, sizeof(cp->fs_opts));
+ bzero(&cp->fs_opts, sizeof(cp->fs_opts));
/*
* Try and mount the file system
diff --git a/usr.sbin/amd/amd/amq_subr.c b/usr.sbin/amd/amd/amq_subr.c
index f99e6904b02..bab1b95d356 100644
--- a/usr.sbin/amd/amd/amq_subr.c
+++ b/usr.sbin/amd/amd/amq_subr.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)amq_subr.c 8.1 (Berkeley) 6/6/93
- * $Id: amq_subr.c,v 1.15 2014/10/26 03:03:34 guenther Exp $
+ * $Id: amq_subr.c,v 1.16 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -50,7 +50,7 @@ amqproc_null_1_svc(void *argp, struct svc_req *rqstp)
{
static char res;
- return (void *)&res;
+ return &res;
}
/*
@@ -77,7 +77,7 @@ amqproc_umnt_1_svc(void *argp, struct svc_req *rqstp)
if (mp)
forcibly_timeout_mp(mp);
- return (void *)&res;
+ return &res;
}
/*
@@ -218,7 +218,7 @@ struct svc_req *rqstp;
cp++;
root_newmap(s, cp, (char *) 0);
- rc = mount_auto_node(s, (void *)root_node);
+ rc = mount_auto_node(s, root_node);
if (rc < 0)
return 0;
return &rc;
diff --git a/usr.sbin/amd/amd/info_nis.c b/usr.sbin/amd/amd/info_nis.c
index cda31d6563f..146e6ea73a3 100644
--- a/usr.sbin/amd/amd/info_nis.c
+++ b/usr.sbin/amd/amd/info_nis.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)info_nis.c 8.1 (Berkeley) 6/6/93
- * $Id: info_nis.c,v 1.12 2014/10/26 03:03:34 guenther Exp $
+ * $Id: info_nis.c,v 1.13 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -93,9 +93,10 @@ struct nis_callback_data {
* Callback from yp_all
*/
static int
-callback(int status, char *key, int kl, char *val,
- int vl, struct nis_callback_data *data)
+callback(unsigned long status, char *key, int kl, char *val, int vl, void *arg)
{
+ struct nis_callback_data *data = arg;
+
if (status == YP_TRUE) {
/*
* Add to list of maps
@@ -148,7 +149,7 @@ nis_reload(mnt_map *m, char *map, void (*fn)(mnt_map *, char *, char *))
data.ncd_map = map;
data.ncd_fn = fn;
cbinfo.data = (void *)&data;
- cbinfo.foreach = (void *)&callback;
+ cbinfo.foreach = &callback;
error = yp_all(domain, map, &cbinfo);
diff --git a/usr.sbin/amd/amd/map.c b/usr.sbin/amd/amd/map.c
index 173f27424e8..262c83a2905 100644
--- a/usr.sbin/amd/amd/map.c
+++ b/usr.sbin/amd/amd/map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map.c,v 1.14 2014/10/26 03:08:21 guenther Exp $ */
+/* $OpenBSD: map.c,v 1.15 2014/10/26 03:28:41 guenther Exp $ */
/*-
* Copyright (c) 1990 Jan-Simon Pendry
@@ -90,15 +90,6 @@ static struct fattr gen_fattr = {
static int
exported_ap_realloc_map(int nsize)
{
-#ifdef notdef
- /*
- * If a second realloc occasionally causes Amd to die
- * in then include this check.
- */
- if (exported_ap_size != 0) /* XXX */
- return 0;
-#endif
-
/*
* this shouldn't happen, but...
*/
@@ -108,7 +99,7 @@ exported_ap_realloc_map(int nsize)
exported_ap = xreallocarray(exported_ap, nsize, sizeof *exported_ap);
if (nsize > exported_ap_size)
- bzero((char *) (exported_ap+exported_ap_size),
+ bzero(exported_ap+exported_ap_size,
(nsize - exported_ap_size) * sizeof(am_node*));
exported_ap_size = nsize;
@@ -142,7 +133,7 @@ am_node *exported_ap_alloc(void)
*/
mpp = exported_ap + first_free_map;
mp = *mpp = ALLOC(am_node);
- bzero((char *) mp, sizeof(*mp));
+ bzero(mp, sizeof(*mp));
mp->am_mapno = first_free_map++;
@@ -925,7 +916,7 @@ free_map_if_success(int rc, int term, void *closure)
/*
* Wakeup anything waiting for this mount
*/
- wakeup((void *)mf);
+ wakeup(mf);
}
static int
@@ -960,8 +951,8 @@ unmount_mp(am_node *mp)
* Note that we are unmounting this node
*/
mf->mf_flags |= MFF_UNMOUNTING;
- run_task(unmount_node_wrap, (void *)mp,
- free_map_if_success, (void *)mp);
+ run_task(unmount_node_wrap, mp,
+ free_map_if_success, mp);
was_backgrounded = 1;
#ifdef DEBUG
dlog("unmount attempt backgrounded");
@@ -973,7 +964,7 @@ unmount_mp(am_node *mp)
dlog("Trying unmount in foreground");
#endif
mf->mf_flags |= MFF_UNMOUNTING;
- free_map_if_success(unmount_node(mp), 0, (void *)mp);
+ free_map_if_success(unmount_node(mp), 0, mp);
#ifdef DEBUG
dlog("unmount attempt done");
#endif /* DEBUG */
diff --git a/usr.sbin/amd/amd/mapc.c b/usr.sbin/amd/amd/mapc.c
index 221ea3b7948..4db212f33c9 100644
--- a/usr.sbin/amd/amd/mapc.c
+++ b/usr.sbin/amd/amd/mapc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: mapc.c,v 1.21 2014/10/26 03:08:21 guenther Exp $ */
+/* $OpenBSD: mapc.c,v 1.22 2014/10/26 03:28:41 guenther Exp $ */
/*-
* Copyright (c) 1989 Jan-Simon Pendry
@@ -431,7 +431,7 @@ mapc_create(char *map, char *opt)
m->modify = modify;
m->search = alloc >= MAPC_ALL ? error_search : mt->search;
m->mtime = mt->mtime;
- bzero((void *)m->kvhash, sizeof(m->kvhash));
+ bzero(m->kvhash, sizeof(m->kvhash));
m->map_name = strdup(map);
m->refc = 1;
m->wildcard = 0;
@@ -470,7 +470,7 @@ mapc_clear(mnt_map *m)
/*
* Zero the hash slots
*/
- bzero((void *)m->kvhash, sizeof(m->kvhash));
+ bzero(m->kvhash, sizeof(m->kvhash));
/*
* Free the wildcard if it exists
*/
diff --git a/usr.sbin/amd/amd/misc_rpc.c b/usr.sbin/amd/amd/misc_rpc.c
index f332531b35e..9aa69555828 100644
--- a/usr.sbin/amd/amd/misc_rpc.c
+++ b/usr.sbin/amd/amd/misc_rpc.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)misc_rpc.c 8.1 (Berkeley) 6/6/93
- * $Id: misc_rpc.c,v 1.7 2003/06/02 23:36:51 millert Exp $
+ * $Id: misc_rpc.c,v 1.8 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -53,7 +53,7 @@ rpc_msg_init(struct rpc_msg *mp, unsigned long prog,
/*
* Initialise the message
*/
- bzero((void *)mp, sizeof(*mp));
+ bzero(mp, sizeof(*mp));
mp->rm_xid = 0;
mp->rm_direction = CALL;
mp->rm_call.cb_rpcvers = RPC_MSG_VERSION;
@@ -74,8 +74,8 @@ pickup_rpc_reply(void *pkt, int len, void *where, xdrproc_t where_xdr)
struct rpc_msg reply_msg;
int error = 0;
- /*bzero((void *)&err, sizeof(err));*/
- bzero((void *)&reply_msg, sizeof(reply_msg));
+ /*bzero(&err, sizeof(err));*/
+ bzero(&reply_msg, sizeof(reply_msg));
reply_msg.acpted_rply.ar_results.where = (caddr_t) where;
reply_msg.acpted_rply.ar_results.proc = where_xdr;
diff --git a/usr.sbin/amd/amd/mntfs.c b/usr.sbin/amd/amd/mntfs.c
index f1dc631adde..63f11c9b3ef 100644
--- a/usr.sbin/amd/amd/mntfs.c
+++ b/usr.sbin/amd/amd/mntfs.c
@@ -300,7 +300,8 @@ free_mntfs(void *arg)
if (mf->mf_flags & (MFF_MOUNTED|MFF_MOUNTING|MFF_UNMOUNTING))
dlog("mntfs reference for %s still active", mf->mf_mount);
#endif /* DEBUG */
- mf->mf_cid = timeout(ALLOWED_MOUNT_TIME, discard_mntfs, (void *)mf);
+ mf->mf_cid = timeout(ALLOWED_MOUNT_TIME,
+ discard_mntfs, mf);
}
}
}
diff --git a/usr.sbin/amd/amd/nfs_ops.c b/usr.sbin/amd/amd/nfs_ops.c
index 7966b75305c..6e7d8ee3a03 100644
--- a/usr.sbin/amd/amd/nfs_ops.c
+++ b/usr.sbin/amd/amd/nfs_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_ops.c,v 1.25 2014/10/26 03:08:21 guenther Exp $ */
+/* $OpenBSD: nfs_ops.c,v 1.26 2014/10/26 03:28:41 guenther Exp $ */
/*-
* Copyright (c) 1990 Jan-Simon Pendry
@@ -146,7 +146,8 @@ got_nfs_fh(void *pkt, int len, struct sockaddr_in *sa,
fh_cache *fp = find_nfs_fhandle_cache(idv, done);
if (fp) {
fp->fh_handle.fhs_vers = MOUNTVERS;
- fp->fh_error = pickup_rpc_reply(pkt, len, (void *)&fp->fh_handle, xdr_fhstatus);
+ fp->fh_error = pickup_rpc_reply(pkt, len, &fp->fh_handle,
+ xdr_fhstatus);
if (!fp->fh_error) {
#ifdef DEBUG
dlog("got filehandle for %s:%s", fp->fh_fs->fs_host, fp->fh_path);
@@ -214,7 +215,7 @@ prime_nfs_fhandle_cache(char *path, fserver *fs, fhstatus *fhbuf, void *wchan)
error = fp->fh_error = unx_error(fp->fh_handle.fhs_stat);
if (error == 0) {
if (fhbuf)
- bcopy((void *)&fp->fh_handle, (void *)fhbuf,
+ bcopy(&fp->fh_handle, fhbuf,
sizeof(fp->fh_handle));
if (fp->fh_cid)
untimeout(fp->fh_cid);
@@ -278,7 +279,7 @@ prime_nfs_fhandle_cache(char *path, fserver *fs, fhstatus *fhbuf, void *wchan)
free(fp->fh_path);
} else {
fp = ALLOC(fh_cache);
- bzero((void *)fp, sizeof(*fp));
+ bzero(fp, sizeof(*fp));
ins_que(&fp->fh_q, &fh_head);
}
if (!reuse_id)
@@ -354,7 +355,7 @@ call_mountd(fh_cache *fp, u_long proc, fwd_fun f, void *wchan)
rpc_msg_init(&mnt_msg, MOUNTPROG, MOUNTVERS, (unsigned long) 0);
len = make_rpc_packet(iobuf, sizeof(iobuf), proc,
- &mnt_msg, (void *)&fp->fh_path, xdr_nfspath, nfs_auth);
+ &mnt_msg, &fp->fh_path, xdr_nfspath, nfs_auth);
/*
* XXX EVIL! We cast fh_id to a pointer, then back to an int
@@ -362,7 +363,8 @@ call_mountd(fh_cache *fp, u_long proc, fwd_fun f, void *wchan)
*/
if (len > 0) {
error = fwd_packet(MK_RPC_XID(RPC_XID_MOUNTD, fp->fh_id),
- (void *)iobuf, len, &fp->fh_sin, &fp->fh_sin, (void *)((long)fp->fh_id), f);
+ iobuf, len, &fp->fh_sin, &fp->fh_sin,
+ (void *)((long)fp->fh_id), f);
} else {
error = -len;
}
@@ -462,7 +464,7 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
const char *type = MOUNT_NFS;
- bzero((void *)&nfs_args, sizeof(nfs_args)); /* Paranoid */
+ bzero(&nfs_args, sizeof(nfs_args)); /* Paranoid */
/*
* Extract host name to give to kernel
@@ -477,7 +479,7 @@ mount_nfs_fh(fhstatus *fhp, char *dir, char *fs_name, char *opts,
else
xopts = strdup(opts);
- bzero((void *)&nfs_args, sizeof(nfs_args));
+ bzero(&nfs_args, sizeof(nfs_args));
mnt.mnt_dir = dir;
mnt.mnt_fsname = fs_name;
@@ -625,7 +627,7 @@ mount_nfs(char *dir, char *fs_name, char *opts, mntfs *mf)
#ifdef DEBUG
dlog("locating fhandle for %s", fs_name);
#endif /* DEBUG */
- error = prime_nfs_fhandle_cache(colon+1, mf->mf_server, &fhs, (void *)0);
+ error = prime_nfs_fhandle_cache(colon+1, mf->mf_server, &fhs, NULL);
if (error)
return error;
diff --git a/usr.sbin/amd/amd/nfs_subr.c b/usr.sbin/amd/amd/nfs_subr.c
index a818c090071..93170d4febb 100644
--- a/usr.sbin/amd/amd/nfs_subr.c
+++ b/usr.sbin/amd/amd/nfs_subr.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)nfs_subr.c 8.1 (Berkeley) 6/6/93
- * $Id: nfs_subr.c,v 1.7 2014/10/26 02:43:50 guenther Exp $
+ * $Id: nfs_subr.c,v 1.8 2014/10/26 03:28:41 guenther Exp $
*/
#include "am.h"
@@ -83,7 +83,7 @@ nfsproc_null_2(void *argp, struct svc_req *rqstp)
{
static char res;
- return (void *)&res;
+ return &res;
}
@@ -148,7 +148,7 @@ nfsproc_root_2(void *argp, struct svc_req *rqstp)
{
static char res;
- return (void *)&res;
+ return &res;
}
@@ -240,7 +240,7 @@ nfsproc_read_2(struct readargs *argp, struct svc_req *rqstp)
{
static struct readres res;
- bzero((char *)&res, sizeof(res));
+ bzero(&res, sizeof(res));
res.status = nfs_error(EACCES);
@@ -253,7 +253,7 @@ nfsproc_writecache_2(void *argp, struct svc_req *rqstp)
{
static char res;
- return (void *)&res;
+ return &res;
}
diff --git a/usr.sbin/amd/amd/nfsx_ops.c b/usr.sbin/amd/amd/nfsx_ops.c
index d2343ba4b03..716baa75707 100644
--- a/usr.sbin/amd/amd/nfsx_ops.c
+++ b/usr.sbin/amd/amd/nfsx_ops.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)nfsx_ops.c 8.1 (Berkeley) 6/6/93
- * $Id: nfsx_ops.c,v 1.8 2014/10/26 03:08:21 guenther Exp $
+ * $Id: nfsx_ops.c,v 1.9 2014/10/26 03:28:41 guenther Exp $
*/
#include "am.h"
@@ -187,7 +187,7 @@ nfsx_init(mntfs *mf)
;
nx = ALLOC(nfsx);
- mf->mf_private = (void *)nx;
+ mf->mf_private = nx;
mf->mf_prfree = nfsx_prfree;
nx->nx_c = i - 1; /* i-1 because we don't want the prefix */
@@ -259,7 +259,7 @@ errexit:
glob_error = -1;
if (!asked_for_wakeup) {
asked_for_wakeup = 1;
- sched_task(wakeup_task, (void *)mf, (void *)m);
+ sched_task(wakeup_task, mf, m);
}
}
}
@@ -280,7 +280,7 @@ nfsx_cont(int rc, int term, void *closure)
/*
* Wakeup anything waiting for this mount
*/
- wakeup((void *)n->n_mnt);
+ wakeup(n->n_mnt);
if (rc || term) {
if (term) {
@@ -313,7 +313,7 @@ nfsx_cont(int rc, int term, void *closure)
* Do the remaining bits
*/
if (nfsx_fmount(mf) >= 0) {
- wakeup((void *)mf);
+ wakeup(mf);
mf->mf_flags &= ~MFF_MOUNTING;
mf_mounted(mf);
}
@@ -372,7 +372,8 @@ nfsx_remount(mntfs *mf, int fg)
dlog("backgrounding mount of \"%s\"", m->mf_info);
#endif
nx->nx_try = n;
- run_task(try_nfsx_mount, (void *)m, nfsx_cont, (void *)mf);
+ run_task(try_nfsx_mount, m,
+ nfsx_cont, mf);
n->n_error = -1;
return -1;
} else {
diff --git a/usr.sbin/amd/amd/opts.c b/usr.sbin/amd/amd/opts.c
index b614223006a..e94a1704aa6 100644
--- a/usr.sbin/amd/amd/opts.c
+++ b/usr.sbin/amd/amd/opts.c
@@ -734,9 +734,9 @@ eval_fs_opts(am_opts *fo, char *opts, char *g_opts, char *path,
/*
* Clear out the option table
*/
- bzero((void *)&fs_static, sizeof(fs_static));
- bzero((void *)vars, sizeof(vars));
- bzero((void *)fo, sizeof(*fo));
+ bzero(&fs_static, sizeof(fs_static));
+ bzero(vars, sizeof(vars));
+ bzero(fo, sizeof(*fo));
/*
* Set key, map & path before expansion
diff --git a/usr.sbin/amd/amd/pfs_ops.c b/usr.sbin/amd/amd/pfs_ops.c
index f294731a28f..0388e9d26d3 100644
--- a/usr.sbin/amd/amd/pfs_ops.c
+++ b/usr.sbin/amd/amd/pfs_ops.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)pfs_ops.c 8.1 (Berkeley) 6/6/93
- * $Id: pfs_ops.c,v 1.7 2014/10/26 03:08:21 guenther Exp $
+ * $Id: pfs_ops.c,v 1.8 2014/10/26 03:28:41 guenther Exp $
*/
#include "am.h"
@@ -68,8 +68,8 @@ pfs_init(mntfs *mf)
* Save unmount command
*/
if (mf->mf_refc == 1) {
- mf->mf_private = (void *)strdup(mf->mf_fo->opt_unmount);
- mf->mf_prfree = (void (*) ()) free;
+ mf->mf_private = strdup(mf->mf_fo->opt_unmount);
+ mf->mf_prfree = free;
}
return 0;
}
diff --git a/usr.sbin/amd/amd/rpc_fwd.c b/usr.sbin/amd/amd/rpc_fwd.c
index 6415aa2bd40..2cc341c2cb2 100644
--- a/usr.sbin/amd/amd/rpc_fwd.c
+++ b/usr.sbin/amd/amd/rpc_fwd.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)rpc_fwd.c 8.1 (Berkeley) 6/6/93
- * $Id: rpc_fwd.c,v 1.8 2014/10/26 03:08:21 guenther Exp $
+ * $Id: rpc_fwd.c,v 1.9 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -302,7 +302,7 @@ fwd_packet(int type_id, void *pkt, int len, struct sockaddr_in *fwdto,
if (replyto)
p->rf_sin = *replyto;
else
- bzero((void *)&p->rf_sin, sizeof(p->rf_sin));
+ bzero(&p->rf_sin, sizeof(p->rf_sin));
p->rf_ptr = i;
return error;
@@ -330,7 +330,7 @@ fwd_reply()
* Determine the length of the packet
*/
#ifdef DYNAMIC_BUFFERS
- if (ioctl(fwd_sock, FIONREAD, &len) < 0) {
+ if (ioctl(fwd_sock, FIONREAD, &len) < 0 || len < 0) {
plog(XLOG_ERROR, "Error reading packet size: %m");
return;
}
@@ -338,7 +338,7 @@ fwd_reply()
/*
* Allocate a buffer
*/
- pkt = (void *)malloc((unsigned) len);
+ pkt = malloc(len);
if (!pkt) {
plog(XLOG_ERROR, "Out of buffers in fwd_reply");
return;
@@ -407,7 +407,7 @@ again:
/*
* Call forwarding function
*/
- (*p->rf_fwd)((void *)pkt, rc, &src_addr, &p->rf_sin, p->rf_ptr, TRUE);
+ (*p->rf_fwd)(pkt, rc, &src_addr, &p->rf_sin, p->rf_ptr, TRUE);
}
/*
diff --git a/usr.sbin/amd/amd/sched.c b/usr.sbin/amd/amd/sched.c
index 044361ab7b8..9f868270f4c 100644
--- a/usr.sbin/amd/amd/sched.c
+++ b/usr.sbin/amd/amd/sched.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sched.c,v 1.17 2014/10/26 03:08:21 guenther Exp $ */
+/* $OpenBSD: sched.c,v 1.18 2014/10/26 03:28:41 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* from: @(#)sched.c 8.1 (Berkeley) 6/6/93
- * $Id: sched.c,v 1.17 2014/10/26 03:08:21 guenther Exp $
+ * $Id: sched.c,v 1.18 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -106,7 +106,7 @@ run_task(task_fun tf, void *ta, cb_fun cf, void *ca)
pjob *p = sched_job(cf, ca);
sigset_t mask, omask;
- p->wchan = (void *)p;
+ p->wchan = p;
sigemptyset(&mask);
sigaddset(&mask, SIGCHLD);
@@ -137,7 +137,7 @@ sched_task(cb_fun cf, void *ca, void *wchan)
#endif
p->wchan = wchan;
p->pid = 0;
- bzero((void *)&p->w, sizeof(p->w));
+ bzero(&p->w, sizeof(p->w));
}
static void
@@ -200,17 +200,17 @@ sigchld(int sig)
pjob *p, *p2;
if (WIFSIGNALED(w))
- plog(XLOG_ERROR, "Process %ld exited with signal %ld",
+ plog(XLOG_ERROR, "Process %ld exited with signal %d",
(long)pid, WTERMSIG(w));
#ifdef DEBUG
else
- dlog("Process %ld exited with status %ld",
+ dlog("Process %ld exited with status %d",
(long)pid, WEXITSTATUS(w));
#endif /* DEBUG */
for (p = FIRST(pjob, &proc_wait_list);
- p2 = NEXT(pjob, p), p != HEAD(pjob, &proc_wait_list);
- p = p2) {
+ p2 = NEXT(pjob, p), p != HEAD(pjob, &proc_wait_list);
+ p = p2) {
if (p->pid == pid) {
p->w = w;
wakeupjob(p);
diff --git a/usr.sbin/amd/amd/srvr_afs.c b/usr.sbin/amd/amd/srvr_afs.c
index f5997e9c906..f938a8d8ee2 100644
--- a/usr.sbin/amd/amd/srvr_afs.c
+++ b/usr.sbin/amd/amd/srvr_afs.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)srvr_afs.c 8.1 (Berkeley) 6/6/93
- * $Id: srvr_afs.c,v 1.6 2014/10/26 03:08:21 guenther Exp $
+ * $Id: srvr_afs.c,v 1.7 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -88,7 +88,7 @@ void
wakeup_srvr(fserver *fs)
{
fs->fs_flags &= ~FSF_WANT;
- wakeup((void *)fs);
+ wakeup(fs);
}
/*
@@ -165,7 +165,7 @@ free_srvr(fserver *fs)
/*
* Keep structure lying around for a while
*/
- fs->fs_cid = timeout(ttl, timeout_srvr, (void *)fs);
+ fs->fs_cid = timeout(ttl, timeout_srvr, fs);
/*
* Mark the fileserver down and invalid again
*/
diff --git a/usr.sbin/amd/amd/srvr_nfs.c b/usr.sbin/amd/amd/srvr_nfs.c
index 4b65725f105..b76d0674e44 100644
--- a/usr.sbin/amd/amd/srvr_nfs.c
+++ b/usr.sbin/amd/amd/srvr_nfs.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)srvr_nfs.c 8.1 (Berkeley) 6/6/93
- * $Id: srvr_nfs.c,v 1.9 2014/10/26 03:03:34 guenther Exp $
+ * $Id: srvr_nfs.c,v 1.10 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -156,7 +156,7 @@ got_portmap(void *pkt, int len, struct sockaddr_in *sa,
if (fs == fs2) {
u_long port = 0; /* XXX - should be short but protocol is naff */
- int error = done ? pickup_rpc_reply(pkt, len, (void *)&port, xdr_u_long) : -1;
+ int error = done ? pickup_rpc_reply(pkt, len, &port, xdr_u_long) : -1;
nfs_private *np = (nfs_private *) fs->fs_private;
if (!error && port) {
#ifdef DEBUG
@@ -212,14 +212,14 @@ call_portmap(fserver *fs, AUTH *auth, unsigned long prog,
pmap.pm_prot = prot;
pmap.pm_port = 0;
len = make_rpc_packet(iobuf, sizeof(iobuf), PMAPPROC_GETPORT,
- &pmap_msg, (void *)&pmap, xdr_pmap, auth);
+ &pmap_msg, &pmap, xdr_pmap, auth);
if (len > 0) {
struct sockaddr_in sin;
- bzero((void *)&sin, sizeof(sin));
+ bzero(&sin, sizeof(sin));
sin = *fs->fs_ip;
sin.sin_port = htons(PMAPPORT);
- error = fwd_packet(RPC_XID_PORTMAP, (void *)iobuf, len,
- &sin, &sin, (void *)fs, got_portmap);
+ error = fwd_packet(RPC_XID_PORTMAP, iobuf, len,
+ &sin, &sin, fs, got_portmap);
} else {
error = -len;
}
@@ -449,8 +449,9 @@ nfs_keepalive(void *arg)
* XXX EVIL! We cast xid to a pointer, then back to an int when
* XXX we get the reply.
*/
- error = fwd_packet(MK_RPC_XID(RPC_XID_NFSPING, np->np_xid), (void *)ping_buf,
- ping_len, fs->fs_ip, (struct sockaddr_in *) 0, (void *)((long)np->np_xid), nfs_pinged);
+ error = fwd_packet(MK_RPC_XID(RPC_XID_NFSPING, np->np_xid), ping_buf,
+ ping_len, fs->fs_ip, NULL, (void *)((long)np->np_xid),
+ nfs_pinged);
/*
* See if a hard error occured
@@ -546,7 +547,7 @@ nfs_srvr_port(fserver *fs, u_short *port, void *wchan)
* come back here and new, better things to happen.
*/
fs->fs_flags |= FSF_WANT;
- sched_task(wakeup_task, wchan, (void *)fs);
+ sched_task(wakeup_task, wchan, fs);
}
return error;
}
@@ -634,9 +635,9 @@ find_nfs_srvr(mntfs *mf)
switch (hp->h_addrtype) {
case AF_INET:
ip = ALLOC(sockaddr_in);
- bzero((void *)ip, sizeof(*ip));
+ bzero(ip, sizeof(*ip));
ip->sin_family = AF_INET;
- bcopy((void *)hp->h_addr, (void *)&ip->sin_addr, sizeof(ip->sin_addr));
+ bcopy(hp->h_addr, &ip->sin_addr, sizeof(ip->sin_addr));
ip->sin_port = htons(NFS_PORT);
break;
@@ -669,7 +670,7 @@ find_nfs_srvr(mntfs *mf)
fs->fs_type = "nfs";
fs->fs_pinger = AM_PINGER;
np = ALLOC(nfs_private);
- bzero((void *)np, sizeof(*np));
+ bzero(np, sizeof(*np));
np->np_mountd_inval = TRUE;
np->np_xid = NPXID_ALLOC();
np->np_error = -1;
diff --git a/usr.sbin/amd/amd/ufs_ops.c b/usr.sbin/amd/amd/ufs_ops.c
index 2ad7a1ff5b7..4fb0f259ee2 100644
--- a/usr.sbin/amd/amd/ufs_ops.c
+++ b/usr.sbin/amd/amd/ufs_ops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ufs_ops.c,v 1.9 2014/10/26 02:43:50 guenther Exp $ */
+/* $OpenBSD: ufs_ops.c,v 1.10 2014/10/26 03:28:41 guenther Exp $ */
/*
* Copyright (c) 1990 Jan-Simon Pendry
@@ -80,7 +80,7 @@ mount_ufs(char *dir, char *fs_name, char *opts)
*/
const char *type = MOUNT_FFS;
- bzero((void *)&ufs_args, sizeof(ufs_args)); /* Paranoid */
+ bzero(&ufs_args, sizeof(ufs_args)); /* Paranoid */
/*
* Fill in the mount structure
diff --git a/usr.sbin/amd/amd/util.c b/usr.sbin/amd/amd/util.c
index be275d53fe6..c0ccabc8c8a 100644
--- a/usr.sbin/amd/amd/util.c
+++ b/usr.sbin/amd/amd/util.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)util.c 8.1 (Berkeley) 6/6/93
- * $Id: util.c,v 1.14 2014/10/26 01:16:48 guenther Exp $
+ * $Id: util.c,v 1.15 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -286,7 +286,7 @@ bind_resv_port(int so, u_short *pp)
struct sockaddr_in sin;
int rc;
- bzero((void *)&sin, sizeof(sin));
+ bzero(&sin, sizeof(sin));
sin.sin_family = AF_INET;
rc = bindresvport(so, &sin);
diff --git a/usr.sbin/amd/amq/amq.c b/usr.sbin/amd/amq/amq.c
index d9d4ba9d4db..dfc9da99d0f 100644
--- a/usr.sbin/amd/amq/amq.c
+++ b/usr.sbin/amd/amq/amq.c
@@ -32,7 +32,7 @@
* SUCH DAMAGE.
*
* from: @(#)amq.c 8.1 (Berkeley) 6/7/93
- * $Id: amq.c,v 1.15 2014/10/20 00:20:04 guenther Exp $
+ * $Id: amq.c,v 1.16 2014/10/26 03:28:41 guenther Exp $
*/
/*
@@ -311,7 +311,7 @@ show_usage:
bzero(&server_addr, sizeof server_addr);
server_addr.sin_family = AF_INET;
if (hp) {
- bcopy((void *)hp->h_addr, (void *)&server_addr.sin_addr,
+ bcopy(hp->h_addr, &server_addr.sin_addr,
sizeof(server_addr.sin_addr));
} else {
/* fake "localhost" */
@@ -444,7 +444,7 @@ show_usage:
* Get Version
*/
if (getvers_flag) {
- amq_string *spp = amqproc_getvers_1((void *)0, clnt);
+ amq_string *spp = amqproc_getvers_1(NULL, clnt);
if (spp && *spp) {
printf("%s.\n", *spp);
free(*spp);
@@ -502,7 +502,7 @@ show_usage:
} else if (unmount_flag) {
goto show_usage;
} else if (stats_flag) {
- amq_mount_stats *ms = amqproc_stats_1((void *)0, clnt);
+ amq_mount_stats *ms = amqproc_stats_1(NULL, clnt);
if (ms) {
show_ms(ms);
} else {
@@ -511,7 +511,7 @@ show_usage:
errs = 1;
}
} else if (!nodefault) {
- amq_mount_tree_list *mlp = amqproc_export_1((void *)0, clnt);
+ amq_mount_tree_list *mlp = amqproc_export_1(NULL, clnt);
if (mlp) {
enum show_opt e = Calc;
int mwid = 0, dwid = 0, pwid = 0;