More caddr_t removal, make fo_ioctl take a void * instead of a caddr_t.

This commit is contained in:
Alfred Perlstein 2002-06-29 01:50:25 +00:00
parent 69a3693f3e
commit 7f05b0353a
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=99009
12 changed files with 66 additions and 71 deletions

View File

@ -99,7 +99,7 @@ static struct cdevsw fildesc_cdevsw = {
static int do_dup(struct filedesc *fdp, int old, int new, register_t *retval, struct thread *td);
static int badfo_readwrite(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct thread *td);
static int badfo_ioctl(struct file *fp, u_long com, caddr_t data,
static int badfo_ioctl(struct file *fp, u_long com, void *data,
struct thread *td);
static int badfo_poll(struct file *fp, int events,
struct ucred *cred, struct thread *td);
@ -313,34 +313,34 @@ fcntl(td, uap)
fp->f_flag &= ~FCNTLFLAGS;
fp->f_flag |= FFLAGS(uap->arg & ~O_ACCMODE) & FCNTLFLAGS;
tmp = fp->f_flag & FNONBLOCK;
error = fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, td);
error = fo_ioctl(fp, FIONBIO, &tmp, td);
if (error) {
fdrop(fp, td);
break;
}
tmp = fp->f_flag & FASYNC;
error = fo_ioctl(fp, FIOASYNC, (caddr_t)&tmp, td);
error = fo_ioctl(fp, FIOASYNC, &tmp, td);
if (!error) {
fdrop(fp, td);
break;
}
fp->f_flag &= ~FNONBLOCK;
tmp = 0;
(void)fo_ioctl(fp, FIONBIO, (caddr_t)&tmp, td);
(void)fo_ioctl(fp, FIONBIO, &tmp, td);
fdrop(fp, td);
break;
case F_GETOWN:
fhold(fp);
FILEDESC_UNLOCK(fdp);
error = fo_ioctl(fp, FIOGETOWN, (caddr_t)td->td_retval, td);
error = fo_ioctl(fp, FIOGETOWN, (void *)td->td_retval, td);
fdrop(fp, td);
break;
case F_SETOWN:
fhold(fp);
FILEDESC_UNLOCK(fdp);
error = fo_ioctl(fp, FIOSETOWN, (caddr_t)&uap->arg, td);
error = fo_ioctl(fp, FIOSETOWN, &uap->arg, td);
fdrop(fp, td);
break;
@ -363,8 +363,7 @@ fcntl(td, uap)
vp = (struct vnode *)fp->f_data;
/* Copy in the lock structure */
error = copyin((caddr_t)(intptr_t)uap->arg, (caddr_t)&fl,
sizeof(fl));
error = copyin((caddr_t)(intptr_t)uap->arg, &fl, sizeof(fl));
if (error) {
fdrop(fp, td);
break;
@ -434,8 +433,7 @@ fcntl(td, uap)
vp = (struct vnode *)fp->f_data;
/* Copy in the lock structure */
error = copyin((caddr_t)(intptr_t)uap->arg, (caddr_t)&fl,
sizeof(fl));
error = copyin((caddr_t)(intptr_t)uap->arg, &fl, sizeof(fl));
if (error) {
fdrop(fp, td);
break;
@ -461,8 +459,8 @@ fcntl(td, uap)
&fl, F_POSIX);
fdrop(fp, td);
if (error == 0) {
error = copyout((caddr_t)&fl,
(caddr_t)(intptr_t)uap->arg, sizeof(fl));
error = copyout(&fl, (caddr_t)(intptr_t)uap->arg,
sizeof(fl));
}
break;
default:
@ -835,7 +833,7 @@ ofstat(td, uap)
error = fo_stat(fp, &ub, td);
if (error == 0) {
cvtstat(&ub, &oub);
error = copyout((caddr_t)&oub, (caddr_t)uap->sb, sizeof (oub));
error = copyout(&oub, uap->sb, sizeof (oub));
}
fdrop(fp, td);
done2:
@ -871,7 +869,7 @@ fstat(td, uap)
goto done2;
error = fo_stat(fp, &ub, td);
if (error == 0)
error = copyout((caddr_t)&ub, (caddr_t)uap->sb, sizeof (ub));
error = copyout(&ub, uap->sb, sizeof (ub));
fdrop(fp, td);
done2:
mtx_unlock(&Giant);
@ -907,7 +905,7 @@ nfstat(td, uap)
error = fo_stat(fp, &ub, td);
if (error == 0) {
cvtnstat(&ub, &nub);
error = copyout((caddr_t)&nub, (caddr_t)uap->sb, sizeof (nub));
error = copyout(&nub, uap->sb, sizeof (nub));
}
fdrop(fp, td);
done2:
@ -1563,7 +1561,7 @@ fdcheckstd(td)
break;
}
NDFREE(&nd, NDF_ONLY_PNBUF);
fp->f_data = (caddr_t)nd.ni_vp;
fp->f_data = nd.ni_vp;
fp->f_flag = flags;
fp->f_ops = &vnops;
fp->f_type = DTYPE_VNODE;
@ -2067,7 +2065,7 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
return (error);
}
error = SYSCTL_OUT(req, (caddr_t)&filehead, sizeof(filehead));
error = SYSCTL_OUT(req, &filehead, sizeof(filehead));
if (error) {
sx_sunlock(&filelist_lock);
return (error);
@ -2077,7 +2075,7 @@ sysctl_kern_file(SYSCTL_HANDLER_ARGS)
* followed by an array of file structures
*/
LIST_FOREACH(fp, &filehead, f_list) {
error = SYSCTL_OUT(req, (caddr_t)fp, sizeof (struct file));
error = SYSCTL_OUT(req, fp, sizeof (struct file));
if (error) {
sx_sunlock(&filelist_lock);
return (error);
@ -2145,7 +2143,7 @@ static int
badfo_ioctl(fp, com, data, td)
struct file *fp;
u_long com;
caddr_t data;
void *data;
struct thread *td;
{

View File

@ -60,7 +60,7 @@ static int kqueue_read(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct thread *td);
static int kqueue_write(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct thread *td);
static int kqueue_ioctl(struct file *fp, u_long com, caddr_t data,
static int kqueue_ioctl(struct file *fp, u_long com, void *data,
struct thread *td);
static int kqueue_poll(struct file *fp, int events, struct ucred *cred,
struct thread *td);
@ -793,7 +793,7 @@ kqueue_write(struct file *fp, struct uio *uio, struct ucred *cred,
/*ARGSUSED*/
static int
kqueue_ioctl(struct file *fp, u_long com, caddr_t data, struct thread *td)
kqueue_ioctl(struct file *fp, u_long com, void *data, struct thread *td)
{
return (ENOTTY);
}

View File

@ -353,7 +353,7 @@ execve(td, uap)
p->p_flag |= P_EXEC;
if (p->p_pptr && (p->p_flag & P_PPWAIT)) {
p->p_flag &= ~P_PPWAIT;
wakeup((caddr_t)p->p_pptr);
wakeup(p->p_pptr);
}
/*

View File

@ -157,7 +157,7 @@ exit1(td, rv)
q = q->p_peers;
}
while (p->p_peers)
msleep((caddr_t)p, &p->p_mtx, PWAIT, "exit1", 0);
msleep(p, &p->p_mtx, PWAIT, "exit1", 0);
}
PROC_UNLOCK(p);
@ -212,7 +212,7 @@ exit1(td, rv)
while (q->p_peers != p)
q = q->p_peers;
q->p_peers = p->p_peers;
wakeup((caddr_t)p->p_leader);
wakeup(p->p_leader);
}
PROC_UNLOCK(p->p_leader);
@ -348,7 +348,7 @@ exit1(td, rv)
sx_xlock(&proctree_lock);
q = LIST_FIRST(&p->p_children);
if (q != NULL) /* only need this if any child is S_ZOMB */
wakeup((caddr_t) initproc);
wakeup(initproc);
for (; q != NULL; q = nq) {
nq = LIST_NEXT(q, p_sibling);
PROC_LOCK(q);
@ -401,7 +401,7 @@ exit1(td, rv)
* continue.
*/
if (LIST_EMPTY(&pp->p_children))
wakeup((caddr_t)pp);
wakeup(pp);
}
if (p->p_sigparent && p->p_pptr != initproc)
@ -414,7 +414,7 @@ exit1(td, rv)
* If this is a kthread, then wakeup anyone waiting for it to exit.
*/
if (p->p_flag & P_KTHREAD)
wakeup((caddr_t)p);
wakeup(p);
PROC_UNLOCK(p);
/*
@ -569,8 +569,8 @@ wait1(td, uap, compat)
if (uap->status) {
status = p->p_xstat; /* convert to int */
PROC_UNLOCK(p);
if ((error = copyout((caddr_t)&status,
(caddr_t)uap->status, sizeof(status)))) {
if ((error = copyout(&status,
uap->status, sizeof(status)))) {
sx_xunlock(&proctree_lock);
mtx_unlock(&Giant);
return (error);
@ -580,9 +580,8 @@ wait1(td, uap, compat)
if (uap->rusage) {
bcopy(p->p_ru, &ru, sizeof(ru));
PROC_UNLOCK(p);
if ((error = copyout((caddr_t)&ru,
(caddr_t)uap->rusage,
sizeof (struct rusage)))) {
if ((error = copyout(&ru,
uap->rusage, sizeof (struct rusage)))) {
sx_xunlock(&proctree_lock);
mtx_unlock(&Giant);
return (error);
@ -599,7 +598,7 @@ wait1(td, uap, compat)
proc_reparent(p, t);
PROC_UNLOCK(p);
psignal(t, SIGCHLD);
wakeup((caddr_t)t);
wakeup(t);
PROC_UNLOCK(t);
sx_xunlock(&proctree_lock);
mtx_unlock(&Giant);
@ -685,8 +684,8 @@ wait1(td, uap, compat)
if (uap->status) {
status = W_STOPCODE(p->p_xstat);
PROC_UNLOCK(p);
error = copyout((caddr_t)&status,
(caddr_t)uap->status, sizeof(status));
error = copyout(&status,
uap->status, sizeof(status));
} else {
PROC_UNLOCK(p);
error = 0;
@ -702,8 +701,8 @@ wait1(td, uap, compat)
if (uap->status) {
status = SIGCONT;
error = copyout((caddr_t)&status,
(caddr_t)uap->status, sizeof(status));
error = copyout(&status,
uap->status, sizeof(status));
} else
error = 0;
@ -725,7 +724,7 @@ wait1(td, uap, compat)
}
PROC_LOCK(q);
sx_xunlock(&proctree_lock);
error = msleep((caddr_t)q, &q->p_mtx, PWAIT | PCATCH, "wait", 0);
error = msleep(q, &q->p_mtx, PWAIT | PCATCH, "wait", 0);
PROC_UNLOCK(q);
if (error) {
mtx_unlock(&Giant);

View File

@ -604,14 +604,14 @@ utrace(td, uap)
#ifdef KTRACE
struct ktr_request *req;
register caddr_t cp;
void *cp;
if (uap->len > KTR_USER_MAXLEN)
return (EINVAL);
req = ktr_getrequest(KTR_USER);
if (req == NULL)
return (0);
MALLOC(cp, caddr_t, uap->len, M_KTRACE, M_WAITOK);
cp = malloc(uap->len, M_KTRACE, M_WAITOK);
if (!copyin(uap->addr, cp, uap->len)) {
req->ktr_header.ktr_buffer = cp;
req->ktr_header.ktr_len = uap->len;

View File

@ -33,7 +33,7 @@
static void
physwakeup(struct buf *bp)
{
wakeup((caddr_t) bp);
wakeup(bp);
}
int
@ -107,7 +107,7 @@ physio(dev_t dev, struct uio *uio, int ioflag)
DEV_STRATEGY(bp, 0);
spl = splbio();
while ((bp->b_flags & B_DONE) == 0)
tsleep((caddr_t)bp, PRIBIO, "physstr", 0);
tsleep(bp, PRIBIO, "physstr", 0);
splx(spl);
if (uio->uio_segflg == UIO_USERSPACE)

View File

@ -316,8 +316,7 @@ getgroups(struct thread *td, register struct getgroups_args *uap)
if (ngrp < cred->cr_ngroups)
return (EINVAL);
ngrp = cred->cr_ngroups;
error = copyout((caddr_t)cred->cr_groups, (caddr_t)uap->gidset,
ngrp * sizeof(gid_t));
error = copyout(cred->cr_groups, uap->gidset, ngrp * sizeof(gid_t));
if (error == 0)
td->td_retval[0] = ngrp;
return (error);
@ -806,8 +805,7 @@ setgroups(struct thread *td, struct setgroups_args *uap)
return (EINVAL);
mtx_lock(&Giant);
tempcred = crget();
error = copyin((caddr_t)uap->gidset, (caddr_t)tempcred->cr_groups,
ngrp * sizeof(gid_t));
error = copyin(uap->gidset, tempcred->cr_groups, ngrp * sizeof(gid_t));
if (error != 0) {
crfree(tempcred);
mtx_unlock(&Giant);
@ -1130,14 +1128,14 @@ getresuid(register struct thread *td, struct getresuid_args *uap)
cred = td->td_ucred;
if (uap->ruid)
error1 = copyout((caddr_t)&cred->cr_ruid,
(caddr_t)uap->ruid, sizeof(cred->cr_ruid));
error1 = copyout(&cred->cr_ruid,
uap->ruid, sizeof(cred->cr_ruid));
if (uap->euid)
error2 = copyout((caddr_t)&cred->cr_uid,
(caddr_t)uap->euid, sizeof(cred->cr_uid));
error2 = copyout(&cred->cr_uid,
uap->euid, sizeof(cred->cr_uid));
if (uap->suid)
error3 = copyout((caddr_t)&cred->cr_svuid,
(caddr_t)uap->suid, sizeof(cred->cr_svuid));
error3 = copyout(&cred->cr_svuid,
uap->suid, sizeof(cred->cr_svuid));
return (error1 ? error1 : error2 ? error2 : error3);
}
@ -1160,14 +1158,14 @@ getresgid(register struct thread *td, struct getresgid_args *uap)
cred = td->td_ucred;
if (uap->rgid)
error1 = copyout((caddr_t)&cred->cr_rgid,
(caddr_t)uap->rgid, sizeof(cred->cr_rgid));
error1 = copyout(&cred->cr_rgid,
uap->rgid, sizeof(cred->cr_rgid));
if (uap->egid)
error2 = copyout((caddr_t)&cred->cr_groups[0],
(caddr_t)uap->egid, sizeof(cred->cr_groups[0]));
error2 = copyout(&cred->cr_groups[0],
uap->egid, sizeof(cred->cr_groups[0]));
if (uap->sgid)
error3 = copyout((caddr_t)&cred->cr_svgid,
(caddr_t)uap->sgid, sizeof(cred->cr_svgid));
error3 = copyout(&cred->cr_svgid,
uap->sgid, sizeof(cred->cr_svgid));
return (error1 ? error1 : error2 ? error2 : error3);
}
@ -1716,7 +1714,7 @@ crfree(struct ucred *cr)
*/
if (jailed(cr))
prison_free(cr->cr_prison);
FREE((caddr_t)cr, M_CRED);
FREE(cr, M_CRED);
mtx_unlock(&Giant);
} else {
mtx_unlock(mtxp);
@ -1829,7 +1827,7 @@ getlogin(struct thread *td, struct getlogin_args *uap)
bcopy(p->p_session->s_login, login, uap->namelen);
SESS_UNLOCK(p->p_session);
PROC_UNLOCK(p);
error = copyout((caddr_t) login, (caddr_t) uap->namebuf, uap->namelen);
error = copyout(login, uap->namebuf, uap->namelen);
return(error);
}
@ -1855,8 +1853,7 @@ setlogin(struct thread *td, struct setlogin_args *uap)
error = suser_cred(td->td_ucred, PRISON_ROOT);
if (error)
return (error);
error = copyinstr((caddr_t) uap->namebuf, (caddr_t) logintmp,
sizeof(logintmp), (size_t *)0);
error = copyinstr(uap->namebuf, logintmp, sizeof(logintmp), NULL);
if (error == ENAMETOOLONG)
error = EINVAL;
else if (!error) {

View File

@ -100,7 +100,8 @@ static int pipe_poll(struct file *fp, int events, struct ucred *cred,
struct thread *td);
static int pipe_kqfilter(struct file *fp, struct knote *kn);
static int pipe_stat(struct file *fp, struct stat *sb, struct thread *td);
static int pipe_ioctl(struct file *fp, u_long cmd, caddr_t data, struct thread *td);
static int pipe_ioctl(struct file *fp, u_long cmd, void *data,
struct thread *td);
static struct fileops pipeops = {
pipe_read, pipe_write, pipe_ioctl, pipe_poll, pipe_kqfilter,
@ -1116,7 +1117,7 @@ int
pipe_ioctl(fp, cmd, data, td)
struct file *fp;
u_long cmd;
caddr_t data;
void *data;
struct thread *td;
{
struct pipe *mpipe = (struct pipe *)fp->f_data;

View File

@ -96,7 +96,7 @@ int
soo_ioctl(fp, cmd, data, td)
struct file *fp;
u_long cmd;
register caddr_t data;
void *data;
struct thread *td;
{
register struct socket *so = (struct socket *)fp->f_data;

View File

@ -61,7 +61,7 @@
#include <machine/limits.h>
static int vn_closefile(struct file *fp, struct thread *td);
static int vn_ioctl(struct file *fp, u_long com, caddr_t data,
static int vn_ioctl(struct file *fp, u_long com, void *data,
struct thread *td);
static int vn_read(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct thread *td);
@ -664,7 +664,7 @@ static int
vn_ioctl(fp, com, data, td)
struct file *fp;
u_long com;
caddr_t data;
void *data;
struct thread *td;
{
register struct vnode *vp = ((struct vnode *)fp->f_data);

View File

@ -82,7 +82,7 @@ struct file {
int (*fo_write)(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct thread *td);
#define FOF_OFFSET 1
int (*fo_ioctl)(struct file *fp, u_long com, caddr_t data,
int (*fo_ioctl)(struct file *fp, u_long com, void *data,
struct thread *td);
int (*fo_poll)(struct file *fp, int events,
struct ucred *cred, struct thread *td);
@ -153,7 +153,7 @@ static __inline int fo_read(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct thread *td);
static __inline int fo_write(struct file *fp, struct uio *uio,
struct ucred *cred, int flags, struct thread *td);
static __inline int fo_ioctl(struct file *fp, u_long com, caddr_t data,
static __inline int fo_ioctl(struct file *fp, u_long com, void *data,
struct thread *td);
static __inline int fo_poll(struct file *fp, int events,
struct ucred *cred, struct thread *td);
@ -191,7 +191,7 @@ static __inline int
fo_ioctl(fp, com, data, td)
struct file *fp;
u_long com;
caddr_t data;
void *data;
struct thread *td;
{

View File

@ -347,7 +347,7 @@ int soo_read(struct file *fp, struct uio *uio, struct ucred *cred,
int soo_write(struct file *fp, struct uio *uio, struct ucred *cred,
int flags, struct thread *td);
int soo_close(struct file *fp, struct thread *td);
int soo_ioctl(struct file *fp, u_long cmd, caddr_t data,
int soo_ioctl(struct file *fp, u_long cmd, void *data,
struct thread *td);
int soo_poll(struct file *fp, int events, struct ucred *cred,
struct thread *td);