fdc.c (a7e943a456cb6d7af392834ffb2304db509422bf) | fdc.c (62da7a2d68510c673507574e5667c690172c407f) |
---|---|
1/*- 2 * Copyright (c) 2004 Poul-Henning Kamp 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Don Ahn. 8 * --- 1430 unchanged lines hidden (view full) --- 1439 fd = pp->geom->softc; 1440 1441 switch (cmd) { 1442 case FD_GTYPE: /* get drive type */ 1443 *(struct fd_type *)data = *fd->ft; 1444 return (0); 1445 1446 case FD_STYPE: /* set drive type */ | 1/*- 2 * Copyright (c) 2004 Poul-Henning Kamp 3 * Copyright (c) 1990 The Regents of the University of California. 4 * All rights reserved. 5 * 6 * This code is derived from software contributed to Berkeley by 7 * Don Ahn. 8 * --- 1430 unchanged lines hidden (view full) --- 1439 fd = pp->geom->softc; 1440 1441 switch (cmd) { 1442 case FD_GTYPE: /* get drive type */ 1443 *(struct fd_type *)data = *fd->ft; 1444 return (0); 1445 1446 case FD_STYPE: /* set drive type */ |
1447 if (!fflag & FWRITE) | 1447 if (!(fflag & FWRITE)) |
1448 return (EPERM); 1449 /* 1450 * Allow setting drive type temporarily iff 1451 * currently unset. Used for fdformat so any 1452 * user can set it, and then start formatting. 1453 */ 1454 fd->fts = *(struct fd_type *)data; 1455 if (fd->fts.sectrac) { --- 6 unchanged lines hidden (view full) --- 1462 fdprinttype(fd->ft); 1463 return (0); 1464 1465 case FD_GOPTS: /* get drive options */ 1466 *(int *)data = fd->options; 1467 return (0); 1468 1469 case FD_SOPTS: /* set drive options */ | 1448 return (EPERM); 1449 /* 1450 * Allow setting drive type temporarily iff 1451 * currently unset. Used for fdformat so any 1452 * user can set it, and then start formatting. 1453 */ 1454 fd->fts = *(struct fd_type *)data; 1455 if (fd->fts.sectrac) { --- 6 unchanged lines hidden (view full) --- 1462 fdprinttype(fd->ft); 1463 return (0); 1464 1465 case FD_GOPTS: /* get drive options */ 1466 *(int *)data = fd->options; 1467 return (0); 1468 1469 case FD_SOPTS: /* set drive options */ |
1470 if (!fflag & FWRITE) | 1470 if (!(fflag & FWRITE)) |
1471 return (EPERM); 1472 fd->options = *(int *)data; 1473 return (0); 1474 1475 case FD_CLRERR: 1476 if (suser(td) != 0) 1477 return (EPERM); 1478 fd->fdc->fdc_errs = 0; --- 6 unchanged lines hidden (view full) --- 1485 memcpy(fsp->status, fd->fdc->status, 7 * sizeof(u_int)); 1486 return (0); 1487 1488 case FD_GDTYPE: 1489 *(enum fd_drivetype *)data = fd->type; 1490 return (0); 1491 1492 case FD_FORM: | 1471 return (EPERM); 1472 fd->options = *(int *)data; 1473 return (0); 1474 1475 case FD_CLRERR: 1476 if (suser(td) != 0) 1477 return (EPERM); 1478 fd->fdc->fdc_errs = 0; --- 6 unchanged lines hidden (view full) --- 1485 memcpy(fsp->status, fd->fdc->status, 7 * sizeof(u_int)); 1486 return (0); 1487 1488 case FD_GDTYPE: 1489 *(enum fd_drivetype *)data = fd->type; 1490 return (0); 1491 1492 case FD_FORM: |
1493 if (!fflag & FWRITE) | 1493 if (!(fflag & FWRITE)) |
1494 return (EPERM); 1495 if (((struct fd_formb *)data)->format_version != 1496 FD_FORMAT_VERSION) 1497 return (EINVAL); /* wrong version of formatting prog */ 1498 error = fdmisccmd(fd, BIO_FMT, data); 1499 mtx_lock(&fd->fdc->fdc_mtx); 1500 fd->flags |= FD_NEWDISK; 1501 mtx_unlock(&fd->fdc->fdc_mtx); --- 522 unchanged lines hidden --- | 1494 return (EPERM); 1495 if (((struct fd_formb *)data)->format_version != 1496 FD_FORMAT_VERSION) 1497 return (EINVAL); /* wrong version of formatting prog */ 1498 error = fdmisccmd(fd, BIO_FMT, data); 1499 mtx_lock(&fd->fdc->fdc_mtx); 1500 fd->flags |= FD_NEWDISK; 1501 mtx_unlock(&fd->fdc->fdc_mtx); --- 522 unchanged lines hidden --- |