From: Sascha Wildner Date: Thu, 21 Jun 2018 12:18:07 +0000 (+0200) Subject: kernel: Remove the definition of the unimplemented FD_DEBUG ioctl. X-Git-Tag: v5.5.0~484 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/ee21086ce2d93da091939395287d3bbba1bcf221 kernel: Remove the definition of the unimplemented FD_DEBUG ioctl. Remove fdcontrol(8)'s bogus -d option. Also remove -s because it is now the only option and also default. Finally, do some style(9) cleanups in fdcontrol(8). Thanks to zrj for testing with a dports bulk. --- diff --git a/sys/platform/pc64/include/ioctl_fd.h b/sys/platform/pc64/include/ioctl_fd.h index 2312412909..c87f04863b 100644 --- a/sys/platform/pc64/include/ioctl_fd.h +++ b/sys/platform/pc64/include/ioctl_fd.h @@ -110,8 +110,6 @@ struct fdc_status { #define FD_GOPTS _IOR('F', 64, int) /* drive options, see below */ #define FD_SOPTS _IOW('F', 65, int) -#define FD_DEBUG _IOW('F', 66, int) - /* * Obtain NE765 status registers. Only successful if there is * a valid status stored in fdc->status[]. diff --git a/usr.sbin/fdcontrol/fdcontrol.8 b/usr.sbin/fdcontrol/fdcontrol.8 index e4c85a8eb4..d57f06495e 100644 --- a/usr.sbin/fdcontrol/fdcontrol.8 +++ b/usr.sbin/fdcontrol/fdcontrol.8 @@ -26,7 +26,7 @@ .\" .\" $FreeBSD: src/usr.sbin/fdcontrol/fdcontrol.8,v 1.9.2.4 2002/06/21 16:40:24 charnier Exp $ .\" -.Dd May 22, 1994 +.Dd June 21, 2018 .Dt FDCONTROL 8 .Os .Sh NAME @@ -34,10 +34,6 @@ .Nd modify floppy disk parameters .Sh SYNOPSIS .Nm -.Op Fl d Ar 0|1 -.Ar device -.Nm -.Op Fl s .Ar device .Sh DESCRIPTION The @@ -47,18 +43,8 @@ disk device specified by .Ar device . .Ar Device should be a character device. -.Pp -The -.Nm -utility currently supports the specification of device parameters for the -floppy disk drive -.Fl ( s , -also default mode), -or it allows the modification of the driver debug level, in case the -floppy driver has been compiled into the kernel with the -.Em DEBUG -option set -.Pq Fl d . +It currently supports the specification of device parameters for the +floppy disk drive. .Pp Since the implications of such actions are considered harmful, the underlying @@ -78,26 +64,7 @@ facility. .Xr ioctl 2 , .Xr warn 3 , .Xr fdc 4 -.Sh HISTORY -The -.Nm -utility is currently under development. -Its user interface and overall -functionality are subjects to future improvements and changes. .Sh AUTHORS The program has been contributed by .An J\(:org Wunsch , Dresden. -.Sh BUGS -The -.Nm -utility is currently under development. -Its user interface is rather -silly and likely to change in future, options should be provided to -allow anything being modified from the command line. -.Pp -The driver does actually support only two debug levels -(0 and 1), -where debug level 1 will generate huge amounts of output. -It is likely -to overflow the syslog if not used with extreme care. diff --git a/usr.sbin/fdcontrol/fdcontrol.c b/usr.sbin/fdcontrol/fdcontrol.c index fccce5a5d1..b30b97d9d6 100644 --- a/usr.sbin/fdcontrol/fdcontrol.c +++ b/usr.sbin/fdcontrol/fdcontrol.c @@ -37,102 +37,65 @@ static int getnumber(void) { - int i; - char b[80]; + int i; + char b[80]; - fgets(b, 80, stdin); - if(b[0] == '\n') return -1; + fgets(b, 80, stdin); + if (b[0] == '\n') + return -1; - sscanf(b, " %i", &i); - return i; + sscanf(b, " %i", &i); + return i; } __dead2 static void usage(void) { - fprintf(stderr, "usage: fdcontrol [-d 0|1] | [-s] device-node\n"); - exit(2); + fprintf(stderr, "usage: fdcontrol device-node\n"); + exit(2); } -#define ask(name, fmt) \ -printf(#name "? [" fmt "]: ", ft.name); fflush(stdout); \ -if((i = getnumber()) != -1) ft.name = i +#define ask(name, fmt) do { \ + printf(#name "? [" fmt "]: ", ft.name); fflush(stdout); \ + if((i = getnumber()) != -1) \ + ft.name = i; \ +} while (0) int main(int argc, char **argv) { - struct fd_type ft; - int fd, i; - int debug = -1, settype = 1; + struct fd_type ft; + int fd, i; - while((i = getopt(argc, argv, "d:s")) != -1) - switch(i) - { - case 'd': - debug = atoi(optarg); - settype = 0; - break; + if (argc != 2) + usage(); - case 's': - debug = -1; - settype = 1; - break; - - case '?': - default: - usage(); - } - - argc -= optind; - argv += optind; - - if(argc != 1) - usage(); - - if((fd = open(argv[0], 0)) < 0) - { - warn("open(floppy)"); - return 1; - } - - if(debug != -1) - { - if(ioctl(fd, FD_DEBUG, &debug) < 0) - { - warn("ioctl(FD_DEBUG)"); - return 1; + if ((fd = open(argv[1], 0)) < 0) { + warn("open(floppy)"); + return 1; } - return 0; - } - if(settype) - { - if(ioctl(fd, FD_GTYPE, &ft) < 0) - { - warn("ioctl(FD_GTYPE)"); - return 1; + if (ioctl(fd, FD_GTYPE, &ft) < 0) { + warn("ioctl(FD_GTYPE)"); + return 1; } - ask(sectrac, "%d"); - ask(secsize, "%d"); - ask(datalen, "0x%x"); - ask(gap, "0x%x"); - ask(tracks, "%d"); - ask(size, "%d"); - ask(steptrac, "%d"); - ask(trans, "%d"); - ask(heads, "%d"); - ask(f_gap, "0x%x"); - ask(f_inter, "%d"); - - if(ioctl(fd, FD_STYPE, &ft) < 0) - { - warn("ioctl(FD_STYPE)"); - return 1; + ask(sectrac, "%d"); + ask(secsize, "%d"); + ask(datalen, "0x%x"); + ask(gap, "0x%x"); + ask(tracks, "%d"); + ask(size, "%d"); + ask(steptrac, "%d"); + ask(trans, "%d"); + ask(heads, "%d"); + ask(f_gap, "0x%x"); + ask(f_inter, "%d"); + + if(ioctl(fd, FD_STYPE, &ft) < 0) { + warn("ioctl(FD_STYPE)"); + return 1; } - return 0; - } - - return 0; + return 0; }