mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-28 19:52:44 +00:00
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.
This commit is contained in:
parent
3fdc1d5c48
commit
81f5cd998c
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=194892
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user