From 44c6d5b420c0412ed7fb86401beb4832e6724236 Mon Sep 17 00:00:00 2001 From: Sascha Wildner Date: Sun, 1 Aug 2010 10:38:46 +0200 Subject: [PATCH] Remove dschedctl(8). dsched's behavior is controlled by the dsched.* tunables and sysctls for a while now. In-discussion-with: alexh --- Makefile_upgrade.inc | 3 + usr.sbin/Makefile | 1 - usr.sbin/dschedctl/Makefile | 4 - usr.sbin/dschedctl/dschedctl.8 | 88 -------------- usr.sbin/dschedctl/dschedctl.c | 216 --------------------------------- 5 files changed, 3 insertions(+), 309 deletions(-) delete mode 100644 usr.sbin/dschedctl/Makefile delete mode 100644 usr.sbin/dschedctl/dschedctl.8 delete mode 100644 usr.sbin/dschedctl/dschedctl.c diff --git a/Makefile_upgrade.inc b/Makefile_upgrade.inc index 12089d7b9d..86d7bb0b12 100644 --- a/Makefile_upgrade.inc +++ b/Makefile_upgrade.inc @@ -1355,6 +1355,9 @@ TO_REMOVE+=/usr/share/man/man9/lwkt_trytokref.9.gz TO_REMOVE+=/usr/sbin/udevd TO_REMOVE+=/usr/share/zoneinfo/Pacific/Ponape TO_REMOVE+=/usr/share/zoneinfo/Pacific/Truk +TO_REMOVE+=/usr/sbin/dschedctl +TO_REMOVE+=/usr/share/man/cat8/dschedctl.8.gz +TO_REMOVE+=/usr/share/man/man8/dschedctl.8.gz # XXX Remove when adjusted to the new 802.11 framework TO_REMOVE+=/boot/modules/if_acx.ko diff --git a/usr.sbin/Makefile b/usr.sbin/Makefile index a262c45491..eac5ef390f 100644 --- a/usr.sbin/Makefile +++ b/usr.sbin/Makefile @@ -34,7 +34,6 @@ SUBDIR= 802_11 \ devinfo \ dev_mkdb \ dntpd \ - dschedctl \ edquota \ faithd \ fdcontrol \ diff --git a/usr.sbin/dschedctl/Makefile b/usr.sbin/dschedctl/Makefile deleted file mode 100644 index 2ffc4e541b..0000000000 --- a/usr.sbin/dschedctl/Makefile +++ /dev/null @@ -1,4 +0,0 @@ -PROG= dschedctl -MAN= dschedctl.8 - -.include diff --git a/usr.sbin/dschedctl/dschedctl.8 b/usr.sbin/dschedctl/dschedctl.8 deleted file mode 100644 index 5b3f8775de..0000000000 --- a/usr.sbin/dschedctl/dschedctl.8 +++ /dev/null @@ -1,88 +0,0 @@ -.\" -.\" Copyright (c) 2010 -.\" The DragonFly Project. All rights reserved. -.\" -.\" Redistribution and use in source and binary forms, with or without -.\" modification, are permitted provided that the following conditions -.\" are met: -.\" -.\" 1. Redistributions of source code must retain the above copyright -.\" notice, this list of conditions and the following disclaimer. -.\" 2. Redistributions in binary form must reproduce the above copyright -.\" notice, this list of conditions and the following disclaimer in -.\" the documentation and/or other materials provided with the -.\" distribution. -.\" 3. Neither the name of The DragonFly Project nor the names of its -.\" contributors may be used to endorse or promote products derived -.\" from this software without specific, prior written permission. -.\" -.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -.\" ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -.\" LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS -.\" FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE -.\" COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, -.\" INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, -.\" BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; -.\" LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED -.\" AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -.\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT -.\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF -.\" SUCH DAMAGE. -.\" -.Dd April 20, 2010 -.Os -.Dt DSCHEDCTL 8 -.Sh NAME -.Nm dschedctl -.Nd manipulate disk policies -.Sh SYNOPSIS -.Nm -.Fl l -.Op Ar disk -.Nm -.Fl p -.Nm -.Op Fl v -.Fl s Ar policy -.Op Ar disk -.Nm -.Fl h -.Sh DESCRIPTION -The -.Nm -provides an interface to manipulate the in-kernel -disk scheduler framework. -.Pp -The options are as follows: -.Bl -tag -width indent -.It Fl h -Shows a usage message with a short description of -.Nm Ap s -options. -.It Fl l Op Ar disk -If -.Ar disk -is specified, the policy currently assigned to -.Ar disk -is shown. -Otherwise all disks and their respective policies are shown. -.It Fl p -List all available dsched policies. -Any of these policies can be set on any disk. -.It Fl s Ar policy Op Ar disk -Sets the dsched policy of -.Ar disk -if specified, or all disks if not, to -.Ar policy . -If the verbose mode is enabled, a message will be printed for each successful -policy change. -.It Fl v -Enables verbose mode. -.El -.Sh HISTORY -The -.Nm -utility appeared in -.Dx 2.7 . -.Sh AUTHORS -.An Alex Hornung diff --git a/usr.sbin/dschedctl/dschedctl.c b/usr.sbin/dschedctl/dschedctl.c deleted file mode 100644 index 91eff5755b..0000000000 --- a/usr.sbin/dschedctl/dschedctl.c +++ /dev/null @@ -1,216 +0,0 @@ -/* - * Copyright (c) 2010 The DragonFly Project. All rights reserved. - * - * This code is derived from software contributed to The DragonFly Project - * by Alex Hornung - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. - * 3. Neither the name of The DragonFly Project nor the names of its - * contributors may be used to endorse or promote products derived - * from this software without specific, prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE - * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, - * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED - * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, - * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT - * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define DSCHED_FOREACH_DISK(dev_fd, diocp) \ - for ((diocp)->num_elem = 0; \ - (ioctl((dev_fd), \ - DSCHED_LIST_DISKS, (diocp)) != -1); \ - ++(diocp)->num_elem) - -#define DSCHED_FOREACH_POLICY(dev_fd, diocp) \ - for ((diocp)->num_elem = 0; \ - (ioctl((dev_fd), \ - DSCHED_LIST_POLICIES, (diocp)) != -1); \ - ++(diocp)->num_elem) - -static int dev_fd; -static int verbose = 0; - -static void -usage(void) -{ - fprintf(stderr, - "Usage: dschedctl \n" - "Valid commands are:\n" - " -l [disk]\n" - "\t Lists all disks and their policies, or just for [disk]\n" - " -p\n" - "\t Lists all available I/O scheduling policies\n" - " -s [disk]\n" - "\t Switches the policy of [disk] or otherwise all disks to " - "\n"); - - exit(1); -} - -static int -dsched_ioctl(unsigned long cmd, struct dsched_ioctl *pdioc) -{ - if (ioctl(dev_fd, cmd, pdioc) == -1) - err(1, "ioctl"); - - return 0; -} - -static int -dsched_set_disk_policy(char *disk_name, char *policy) -{ - struct dsched_ioctl dioc; - int error; - - bzero(&dioc, sizeof(dioc)); - strncpy(dioc.dev_name, disk_name, DSCHED_NAME_LENGTH); - strncpy(dioc.pol_name, policy, DSCHED_NAME_LENGTH); - error = dsched_ioctl(DSCHED_SET_DEVICE_POLICY, &dioc); - - if ((!error) && verbose) { - printf("Switched scheduler policy of %s successfully to %s\n", - disk_name, policy); - } - - return error; -} - -int -main(int argc, char *argv[]) -{ - struct dsched_ioctl dioc; - char *disk_name = NULL; - char *policy = NULL; - int dflag = 0, lflag = 0, pflag = 0, sflag = 0; - int ch, error = 0, found; - - while ((ch = getopt(argc, argv, "hlps:v")) != -1) { - switch (ch) { - case 'l': - lflag = 1; - break; - case 'p': - pflag = 1; - break; - case 's': - sflag = 1; - policy = optarg; - break; - case 'v': - verbose = 1; - break; - case 'h': - case '?': - default: - usage(); - /* NOT REACHED */ - } - } - - argc -= optind; - argv += optind; - - if (argc == 1) { - dflag = 1; - disk_name = basename(argv[0]); - if (!disk_name) - err(1, "basename"); - } else if (argc > 1) { - usage(); - /* NOT REACHED */ - } - - /* - * Check arguments: - * - need to use at least one mode - */ - if (!(lflag || pflag || sflag)) { - usage(); - /* NOT REACHED */ - } - - dev_fd = open("/dev/dsched", O_RDWR); - if (dev_fd == -1) - err(1, "open(/dev/dsched)"); - - if (lflag) { - if (dflag) { - strncpy(dioc.dev_name, disk_name, DSCHED_NAME_LENGTH); - error = dsched_ioctl(DSCHED_LIST_DISK, &dioc); - if (!error) { - printf("%s\t=>\t%s\n", - disk_name, dioc.pol_name); - } - } else { - DSCHED_FOREACH_DISK(dev_fd, &dioc) { - printf("%s\t=>\t%s\n", - dioc.dev_name, dioc.pol_name); - } - } - } - - if (pflag) { - DSCHED_FOREACH_POLICY(dev_fd, &dioc) { - printf("%s\n", dioc.pol_name); - } - } - - if (sflag) { - found = 0; - DSCHED_FOREACH_POLICY(dev_fd, &dioc) { - if (strcmp(policy, dioc.pol_name) == 0) { - found = 1; - break; - } - } - if (!found) - errx(1, "Policy '%s' not available", policy); - - if (dflag) { - error = dsched_set_disk_policy(disk_name, policy); - } else { - DSCHED_FOREACH_DISK(dev_fd, &dioc) { - error = dsched_set_disk_policy(dioc.dev_name, - policy); - } - } - } - - close(dev_fd); - - return (error); -} -- 2.41.0