Merged from sys/isa/fd.c revision 1.270.

This commit is contained in:
Yoshihiro Takahashi 2004-04-25 12:43:44 +00:00
parent 67f266bab9
commit 944d807245
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=128640
2 changed files with 18 additions and 4 deletions

View File

@ -3105,9 +3105,16 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
return (0);
case FD_STYPE: /* set drive type */
if (suser(td) != 0)
return (EPERM);
/*
* Allow setting drive type temporarily iff
* currently unset. Used for fdformat so any
* user can set it, and then start formatting.
*/
if (fd->ft)
return (EINVAL); /* already set */
fd->fts[0] = *(struct fd_type *)addr;
fd->ft = &fd->fts[0];
fd->flags |= FD_UA;
return (0);
case FD_GOPTS: /* get drive options */

View File

@ -3105,9 +3105,16 @@ fdioctl(dev_t dev, u_long cmd, caddr_t addr, int flag, struct thread *td)
return (0);
case FD_STYPE: /* set drive type */
if (suser(td) != 0)
return (EPERM);
/*
* Allow setting drive type temporarily iff
* currently unset. Used for fdformat so any
* user can set it, and then start formatting.
*/
if (fd->ft)
return (EINVAL); /* already set */
fd->fts[0] = *(struct fd_type *)addr;
fd->ft = &fd->fts[0];
fd->flags |= FD_UA;
return (0);
case FD_GOPTS: /* get drive options */