svn commit: r194892 - in head/usr.sbin: fdcontrol fdformat fdread
fdwrite
Joerg Wunsch
joerg at FreeBSD.org
Wed Jun 24 19:47:54 UTC 2009
Author: joerg
Date: Wed Jun 24 19:47:53 2009
New Revision: 194892
URL: http://svn.freebsd.org/changeset/base/194892
Log:
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.
Modified:
head/usr.sbin/fdcontrol/fdcontrol.c
head/usr.sbin/fdformat/fdformat.c
head/usr.sbin/fdread/fdread.c
head/usr.sbin/fdwrite/fdwrite.c
Modified: head/usr.sbin/fdcontrol/fdcontrol.c
==============================================================================
--- head/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 19:30:31 2009 (r194891)
+++ head/usr.sbin/fdcontrol/fdcontrol.c Wed Jun 24 19:47:53 2009 (r194892)
@@ -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)
Modified: head/usr.sbin/fdformat/fdformat.c
==============================================================================
--- head/usr.sbin/fdformat/fdformat.c Wed Jun 24 19:30:31 2009 (r194891)
+++ head/usr.sbin/fdformat/fdformat.c Wed Jun 24 19:47:53 2009 (r194892)
@@ -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);
Modified: head/usr.sbin/fdread/fdread.c
==============================================================================
--- head/usr.sbin/fdread/fdread.c Wed Jun 24 19:30:31 2009 (r194891)
+++ head/usr.sbin/fdread/fdread.c Wed Jun 24 19:47:53 2009 (r194892)
@@ -166,9 +166,6 @@ doread(int fd, FILE *of, const char *_de
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 *_de
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, un
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;
Modified: head/usr.sbin/fdwrite/fdwrite.c
==============================================================================
--- head/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 19:30:31 2009 (r194891)
+++ head/usr.sbin/fdwrite/fdwrite.c Wed Jun 24 19:47:53 2009 (r194892)
@@ -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) {
More information about the svn-src-head
mailing list