Merge from sys/isa/fd.c 1.221 and a few minor tweaks to make compile
with the post KSE world. Reviewed by: julian, bde, jhb
This commit is contained in:
parent
2fb670e0b5
commit
8ed1ddc825
@ -429,7 +429,7 @@ static timeout_t fd_iotimeout;
|
|||||||
static timeout_t fd_pseudointr;
|
static timeout_t fd_pseudointr;
|
||||||
static int fdstate(struct fdc_data *);
|
static int fdstate(struct fdc_data *);
|
||||||
static int retrier(struct fdc_data *);
|
static int retrier(struct fdc_data *);
|
||||||
static int fdformat(dev_t, struct fd_formb *, struct proc *);
|
static int fdformat(dev_t, struct fd_formb *, struct thread *);
|
||||||
|
|
||||||
static int enable_fifo(fdc_p fdc);
|
static int enable_fifo(fdc_p fdc);
|
||||||
static void fd_clone (void *arg, char *name, int namelen, dev_t *dev);
|
static void fd_clone (void *arg, char *name, int namelen, dev_t *dev);
|
||||||
@ -1863,7 +1863,7 @@ out_fdc(struct fdc_data *fdc, int x)
|
|||||||
/* fdopen/fdclose */
|
/* fdopen/fdclose */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
int
|
int
|
||||||
Fdopen(dev_t dev, int flags, int mode, struct proc *p)
|
Fdopen(dev_t dev, int flags, int mode, struct thread *td)
|
||||||
{
|
{
|
||||||
fdu_t fdu = FDUNIT(minor(dev));
|
fdu_t fdu = FDUNIT(minor(dev));
|
||||||
int type = FDTYPE(minor(dev));
|
int type = FDTYPE(minor(dev));
|
||||||
@ -1956,7 +1956,7 @@ Fdopen(dev_t dev, int flags, int mode, struct proc *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fdclose(dev_t dev, int flags, int mode, struct proc *p)
|
fdclose(dev_t dev, int flags, int mode, struct thread *td)
|
||||||
{
|
{
|
||||||
fdu_t fdu = FDUNIT(minor(dev));
|
fdu_t fdu = FDUNIT(minor(dev));
|
||||||
struct fd_data *fd;
|
struct fd_data *fd;
|
||||||
@ -2837,11 +2837,12 @@ fdbiodone(struct bio *bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fdformat(dev, finfo, p)
|
fdformat(dev, finfo, td)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
struct fd_formb *finfo;
|
struct fd_formb *finfo;
|
||||||
struct proc *p;
|
struct thread *td;
|
||||||
{
|
{
|
||||||
|
struct proc *p = td->td_proc;
|
||||||
fdu_t fdu;
|
fdu_t fdu;
|
||||||
fd_p fd;
|
fd_p fd;
|
||||||
|
|
||||||
@ -2908,12 +2909,12 @@ fdformat(dev, finfo, p)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fdioctl(dev, cmd, addr, flag, p)
|
fdioctl(dev, cmd, addr, flag, td)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
u_long cmd;
|
u_long cmd;
|
||||||
caddr_t addr;
|
caddr_t addr;
|
||||||
int flag;
|
int flag;
|
||||||
struct proc *p;
|
struct thread *td;
|
||||||
{
|
{
|
||||||
fdu_t fdu = FDUNIT(minor(dev));
|
fdu_t fdu = FDUNIT(minor(dev));
|
||||||
fd_p fd = devclass_get_softc(fd_devclass, fdu);
|
fd_p fd = devclass_get_softc(fd_devclass, fdu);
|
||||||
@ -2979,7 +2980,7 @@ fdioctl(dev, cmd, addr, flag, p)
|
|||||||
FD_FORMAT_VERSION)
|
FD_FORMAT_VERSION)
|
||||||
error = EINVAL; /* wrong version of formatting prog */
|
error = EINVAL; /* wrong version of formatting prog */
|
||||||
else
|
else
|
||||||
error = fdformat(dev, (struct fd_formb *)addr, p);
|
error = fdformat(dev, (struct fd_formb *)addr, td);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FD_GTYPE: /* get drive type */
|
case FD_GTYPE: /* get drive type */
|
||||||
@ -2988,7 +2989,7 @@ fdioctl(dev, cmd, addr, flag, p)
|
|||||||
|
|
||||||
case FD_STYPE: /* set drive type */
|
case FD_STYPE: /* set drive type */
|
||||||
/* this is considered harmful; only allow for superuser */
|
/* this is considered harmful; only allow for superuser */
|
||||||
if (suser(p) != 0)
|
if (suser_td(td) != 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
*fd->ft = *(struct fd_type *)addr;
|
*fd->ft = *(struct fd_type *)addr;
|
||||||
break;
|
break;
|
||||||
@ -3002,7 +3003,7 @@ fdioctl(dev, cmd, addr, flag, p)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FD_CLRERR:
|
case FD_CLRERR:
|
||||||
if (suser(p) != 0)
|
if (suser_td(td) != 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
fd->fdc->fdc_errs = 0;
|
fd->fdc->fdc_errs = 0;
|
||||||
break;
|
break;
|
||||||
|
@ -429,7 +429,7 @@ static timeout_t fd_iotimeout;
|
|||||||
static timeout_t fd_pseudointr;
|
static timeout_t fd_pseudointr;
|
||||||
static int fdstate(struct fdc_data *);
|
static int fdstate(struct fdc_data *);
|
||||||
static int retrier(struct fdc_data *);
|
static int retrier(struct fdc_data *);
|
||||||
static int fdformat(dev_t, struct fd_formb *, struct proc *);
|
static int fdformat(dev_t, struct fd_formb *, struct thread *);
|
||||||
|
|
||||||
static int enable_fifo(fdc_p fdc);
|
static int enable_fifo(fdc_p fdc);
|
||||||
static void fd_clone (void *arg, char *name, int namelen, dev_t *dev);
|
static void fd_clone (void *arg, char *name, int namelen, dev_t *dev);
|
||||||
@ -1863,7 +1863,7 @@ out_fdc(struct fdc_data *fdc, int x)
|
|||||||
/* fdopen/fdclose */
|
/* fdopen/fdclose */
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
int
|
int
|
||||||
Fdopen(dev_t dev, int flags, int mode, struct proc *p)
|
Fdopen(dev_t dev, int flags, int mode, struct thread *td)
|
||||||
{
|
{
|
||||||
fdu_t fdu = FDUNIT(minor(dev));
|
fdu_t fdu = FDUNIT(minor(dev));
|
||||||
int type = FDTYPE(minor(dev));
|
int type = FDTYPE(minor(dev));
|
||||||
@ -1956,7 +1956,7 @@ Fdopen(dev_t dev, int flags, int mode, struct proc *p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
fdclose(dev_t dev, int flags, int mode, struct proc *p)
|
fdclose(dev_t dev, int flags, int mode, struct thread *td)
|
||||||
{
|
{
|
||||||
fdu_t fdu = FDUNIT(minor(dev));
|
fdu_t fdu = FDUNIT(minor(dev));
|
||||||
struct fd_data *fd;
|
struct fd_data *fd;
|
||||||
@ -2837,11 +2837,12 @@ fdbiodone(struct bio *bp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fdformat(dev, finfo, p)
|
fdformat(dev, finfo, td)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
struct fd_formb *finfo;
|
struct fd_formb *finfo;
|
||||||
struct proc *p;
|
struct thread *td;
|
||||||
{
|
{
|
||||||
|
struct proc *p = td->td_proc;
|
||||||
fdu_t fdu;
|
fdu_t fdu;
|
||||||
fd_p fd;
|
fd_p fd;
|
||||||
|
|
||||||
@ -2908,12 +2909,12 @@ fdformat(dev, finfo, p)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
fdioctl(dev, cmd, addr, flag, p)
|
fdioctl(dev, cmd, addr, flag, td)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
u_long cmd;
|
u_long cmd;
|
||||||
caddr_t addr;
|
caddr_t addr;
|
||||||
int flag;
|
int flag;
|
||||||
struct proc *p;
|
struct thread *td;
|
||||||
{
|
{
|
||||||
fdu_t fdu = FDUNIT(minor(dev));
|
fdu_t fdu = FDUNIT(minor(dev));
|
||||||
fd_p fd = devclass_get_softc(fd_devclass, fdu);
|
fd_p fd = devclass_get_softc(fd_devclass, fdu);
|
||||||
@ -2979,7 +2980,7 @@ fdioctl(dev, cmd, addr, flag, p)
|
|||||||
FD_FORMAT_VERSION)
|
FD_FORMAT_VERSION)
|
||||||
error = EINVAL; /* wrong version of formatting prog */
|
error = EINVAL; /* wrong version of formatting prog */
|
||||||
else
|
else
|
||||||
error = fdformat(dev, (struct fd_formb *)addr, p);
|
error = fdformat(dev, (struct fd_formb *)addr, td);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FD_GTYPE: /* get drive type */
|
case FD_GTYPE: /* get drive type */
|
||||||
@ -2988,7 +2989,7 @@ fdioctl(dev, cmd, addr, flag, p)
|
|||||||
|
|
||||||
case FD_STYPE: /* set drive type */
|
case FD_STYPE: /* set drive type */
|
||||||
/* this is considered harmful; only allow for superuser */
|
/* this is considered harmful; only allow for superuser */
|
||||||
if (suser(p) != 0)
|
if (suser_td(td) != 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
*fd->ft = *(struct fd_type *)addr;
|
*fd->ft = *(struct fd_type *)addr;
|
||||||
break;
|
break;
|
||||||
@ -3002,7 +3003,7 @@ fdioctl(dev, cmd, addr, flag, p)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FD_CLRERR:
|
case FD_CLRERR:
|
||||||
if (suser(p) != 0)
|
if (suser_td(td) != 0)
|
||||||
return EPERM;
|
return EPERM;
|
||||||
fd->fdc->fdc_errs = 0;
|
fd->fdc->fdc_errs = 0;
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user