summaryrefslogtreecommitdiffstats
path: root/usr.sbin
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>2009-06-24 19:47:53 +0000
committerjoerg <joerg@FreeBSD.org>2009-06-24 19:47:53 +0000
commit28ee5250ac542f0374f1ec07f32276a5581a2353 (patch)
tree7c80e7b291959bae36b32f2ec52a06cf667479e5 /usr.sbin
parent8c4a62bd5baed926c5edabe6c2a36fe1d5cf7376 (diff)
downloadFreeBSD-src-28ee5250ac542f0374f1ec07f32276a5581a2353.zip
FreeBSD-src-28ee5250ac542f0374f1ec07f32276a5581a2353.tar.gz
Drop the defunct FDOPT_NOERRLOG option from all the floppy utilities.
The kernel does not log floppy media errors anymore. In fdcontrol, do always open the file descriptor in read-only mode so it can operate on read-only media, as there is no longer a separate control device to operate on.
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/fdcontrol/fdcontrol.c9
-rw-r--r--usr.sbin/fdformat/fdformat.c7
-rw-r--r--usr.sbin/fdread/fdread.c9
-rw-r--r--usr.sbin/fdwrite/fdwrite.c5
4 files changed, 5 insertions, 25 deletions
diff --git a/usr.sbin/fdcontrol/fdcontrol.c b/usr.sbin/fdcontrol/fdcontrol.c
index f1a9233..91877e6 100644
--- a/usr.sbin/fdcontrol/fdcontrol.c
+++ b/usr.sbin/fdcontrol/fdcontrol.c
@@ -72,7 +72,7 @@ main(int argc, char **argv)
enum fd_drivetype type;
struct fd_type ft, newft, *fdtp;
const char *name, *descr;
- int fd, i, mode, autofmt;
+ int fd, i, autofmt;
autofmt = 0;
while((i = getopt(argc, argv, "aFf:s:v")) != -1)
@@ -116,12 +116,7 @@ main(int argc, char **argv)
if(argc != 1)
usage();
- if (show || showfmt)
- mode = O_RDONLY | O_NONBLOCK;
- else
- mode = O_RDWR;
-
- if((fd = open(argv[0], mode)) < 0)
+ if((fd = open(argv[0], O_RDONLY | O_NONBLOCK)) < 0)
err(EX_UNAVAILABLE, "open(%s)", argv[0]);
if (ioctl(fd, FD_GDTYPE, &type) == -1)
diff --git a/usr.sbin/fdformat/fdformat.c b/usr.sbin/fdformat/fdformat.c
index 8e29e40..807ad8d 100644
--- a/usr.sbin/fdformat/fdformat.c
+++ b/usr.sbin/fdformat/fdformat.c
@@ -146,7 +146,7 @@ main(int argc, char **argv)
struct fdc_status fdcs[MAXPRINTERRS];
int format, fill, quiet, verify, verify_only, confirm;
int fd, c, i, track, error, tracks_per_dot, bytes_per_track, errs;
- int fdopts, flags;
+ int flags;
char *fmtstring, *device;
const char *name, *descr;
@@ -250,11 +250,6 @@ main(int argc, char **argv)
errx(EX_OSERR, "not a floppy disk: %s", device);
if (ioctl(fd, FD_GDTYPE, &type) == -1)
err(EX_OSERR, "ioctl(FD_GDTYPE)");
- if (ioctl(fd, FD_GOPTS, &fdopts) == -1)
- err(EX_OSERR, "ioctl(FD_GOPTS)");
- fdopts |= FDOPT_NOERRLOG;
- if (ioctl(fd, FD_SOPTS, &fdopts) == -1)
- err(EX_OSERR, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)");
if (format) {
getname(type, &name, &descr);
fdtp = get_fmt(format, type);
diff --git a/usr.sbin/fdread/fdread.c b/usr.sbin/fdread/fdread.c
index 2539b3a..1aae665 100644
--- a/usr.sbin/fdread/fdread.c
+++ b/usr.sbin/fdread/fdread.c
@@ -166,9 +166,6 @@ doread(int fd, FILE *of, const char *_devname)
if (ioctl(fd, FD_GTYPE, &fdt) == -1)
err(EX_OSERR, "ioctl(FD_GTYPE) failed -- not a floppy?");
- fdopts = FDOPT_NOERRLOG;
- if (ioctl(fd, FD_SOPTS, &fdopts) == -1)
- err(EX_OSERR, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)");
secsize = 128 << fdt.secsize;
tracksize = fdt.sectrac * secsize;
@@ -300,7 +297,7 @@ doread(int fd, FILE *of, const char *_devname)
int
doreadid(int fd, unsigned int numids, unsigned int trackno)
{
- int rv = 0, fdopts;
+ int rv = 0;
unsigned int i;
struct fdc_readid info;
struct fdc_status fdcs;
@@ -309,10 +306,6 @@ doreadid(int fd, unsigned int numids, unsigned int trackno)
if (ioctl(fd, FD_GTYPE, &fdt) == -1)
err(EX_OSERR, "ioctl(FD_GTYPE) failed -- not a floppy?");
- fdopts = FDOPT_NOERRLOG;
- if (ioctl(fd, FD_SOPTS, &fdopts) == -1)
- err(EX_OSERR, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)");
-
for (i = 0; i < numids; i++) {
info.cyl = trackno / fdt.heads;
info.head = fdt.heads > 1? trackno % fdt.heads: 0;
diff --git a/usr.sbin/fdwrite/fdwrite.c b/usr.sbin/fdwrite/fdwrite.c
index 3c22091..8c953a6 100644
--- a/usr.sbin/fdwrite/fdwrite.c
+++ b/usr.sbin/fdwrite/fdwrite.c
@@ -66,7 +66,7 @@ main(int argc, char **argv)
{
int inputfd = -1, c, fdn = 0, i,j,fd;
int bpt, verbose=1, nbytes=0, track;
- int interactive = 1, fdopts;
+ int interactive = 1;
const char *device= "/dev/fd0";
char *trackbuf = 0,*vrfybuf = 0;
struct fd_type fdt;
@@ -130,9 +130,6 @@ main(int argc, char **argv)
if(ioctl(fd, FD_GTYPE, &fdt) < 0)
errx(1, "not a floppy disk: %s", device);
- fdopts = FDOPT_NOERRLOG;
- if (ioctl(fd, FD_SOPTS, &fdopts) == -1)
- err(1, "ioctl(FD_SOPTS, FDOPT_NOERRLOG)");
bpt = fdt.sectrac * (1<<fdt.secsize) * 128;
if(!trackbuf) {
OpenPOWER on IntegriCloud