summaryrefslogtreecommitdiffstats
path: root/sys-utils
diff options
context:
space:
mode:
authorKarel Zak2010-05-13 13:58:16 +0200
committerKarel Zak2010-05-18 16:14:44 +0200
commita3e40c14651fccf18e7954f081e601389baefe3f (patch)
treef42e86d02f3aee65019dc78bd346c647a3770dec /sys-utils
parentlibblkid: improbe DDF detection (diff)
downloadkernel-qcow2-util-linux-a3e40c14651fccf18e7954f081e601389baefe3f.tar.gz
kernel-qcow2-util-linux-a3e40c14651fccf18e7954f081e601389baefe3f.tar.xz
kernel-qcow2-util-linux-a3e40c14651fccf18e7954f081e601389baefe3f.zip
rdev: remove this deprecated command
Signed-off-by: Karel Zak <kzak@redhat.com>
Diffstat (limited to 'sys-utils')
-rw-r--r--sys-utils/.gitignore4
-rw-r--r--sys-utils/Makefile.am14
-rw-r--r--sys-utils/rdev.8207
-rw-r--r--sys-utils/rdev.c279
4 files changed, 0 insertions, 504 deletions
diff --git a/sys-utils/.gitignore b/sys-utils/.gitignore
index f82d10724..7af5ffbff 100644
--- a/sys-utils/.gitignore
+++ b/sys-utils/.gitignore
@@ -24,11 +24,8 @@ pivot_root
ppc32.8
ppc64.8
ppc.8
-ramsize.8
-rdev
readprofile
renice
-rootflags.8
rtcwake
s390.8
s390x.8
@@ -41,5 +38,4 @@ sparc.8
switch_root
tunelp
unshare
-vidmode.8
x86_64.8
diff --git a/sys-utils/Makefile.am b/sys-utils/Makefile.am
index 957fd6e82..06d991c3a 100644
--- a/sys-utils/Makefile.am
+++ b/sys-utils/Makefile.am
@@ -49,13 +49,6 @@ bin_PROGRAMS += arch
dist_man_MANS += arch.1
endif
-RDEV_LINKS =
-if BUILD_RDEV
-usrsbin_exec_PROGRAMS += rdev
-RDEV_LINKS += ramsize vidmode rootflags
-dist_man_MANS += rdev.8
-endif
-
SETARCH_LINKS = linux32 linux64
if ARCH_S390
@@ -83,21 +76,14 @@ if ARCH_HPPA
SETARCH_LINKS += parisc parisc64 parisc32
endif
-RDEV_MAN_LINKS = $(RDEV_LINKS:=.8)
SETARCH_MAN_LINKS = $(SETARCH_LINKS:=.8)
man_MANS = $(RDEV_MAN_LINKS) $(SETARCH_MAN_LINKS)
CLEANFILES = $(man_MANS)
-$(RDEV_MAN_LINKS): rdev.8
- echo ".so man8/rdev.8" > $@
-
$(SETARCH_MAN_LINKS): setarch.8
echo ".so man8/setarch.8" > $@
install-exec-hook:
- for I in $(RDEV_LINKS); do \
- cd $(DESTDIR)$(usrsbin_execdir) && ln -sf rdev $$I ; \
- done
for I in $(SETARCH_LINKS); do \
cd $(DESTDIR)$(usrbin_execdir) && ln -sf setarch $$I ; \
done
diff --git a/sys-utils/rdev.8 b/sys-utils/rdev.8
deleted file mode 100644
index 16d6420f0..000000000
--- a/sys-utils/rdev.8
+++ /dev/null
@@ -1,207 +0,0 @@
-.\" Copyright 1992, 1993 Rickard E. Faith (faith@cs.unc.edu)
-.\" May be distributed under the GNU General Public License
-.\" Changes from sct@dcs.ed.ac.uk added Sat Oct 9 09:54:00 1993.
-.TH RDEV 8 "20 November 1993" "Linux 0.99" "Linux Programmer's Manual"
-.SH NAME
-rdev \- query/set image root device, RAM disk size, or video mode
-.SH SYNOPSIS
-.B rdev
-.RB [ \-Rrvh ]
-.RB [ \-o
-.IR offset ]
-.RI [ image
-.RI [ value
-.RI [ offset ]]]
-.br
-.B rdev
-.RB [ \-o
-.IR offset ]
-.RI [ image
-.RI [ root_device
-.RI [ offset ]]]
-.br
-.B ramsize
-.RB [ \-o
-.IR offset ]
-.RI [ image
-.RI [ size
-.RI [ offset ]]]
-.br
-.B vidmode
-.RB [ \-o
-.IR offset ]
-.RI [ image
-.RI [ mode
-.RI [ offset ]]]
-.br
-.B rootflags
-.RB [ \-o
-.IR offset ]
-.RI [ image
-.RI [ flags
-.RI [ offset ]]]
-.SH DESCRIPTION
-With no arguments,
-.B rdev
-outputs an
-.I /etc/mtab
-line for the current root file system.
-With no arguments,
-.BR ramsize ", " vidmode ", and " rootflags
-print usage information.
-
-In a bootable image for the Linux kernel on i386, there are several pairs
-of bytes which specify the root device, the video mode, and the size of
-the RAM disk. These pairs of bytes, by default, begin
-at offset 504 (decimal) in the kernel image:
-
-.nf
-.RS
- 498 Root flags
-(500 and 502 Reserved)
- 504 RAM Disk Size
- 506 VGA Mode
- 508 Root Device
-(510 Boot Signature)
-.RE
-.fi
-
-.B rdev
-will change these values.
-
-Typical values for the
-.I image
-parameter, which is a bootable Linux kernel image, might be:
-
-.nf
-.RS
-/vmlinux
-/vmunix
-/boot/bzImage-2.4.0
-/dev/fd0
-/dev/fd1
-.RE
-.fi
-
-When using the
-.B rdev
-command, the
-.I root_device
-parameter might be something like:
-
-.nf
-.RS
-/dev/hda1
-/dev/hdf13
-/dev/sda2
-/dev/sdc4
-/dev/ida/c0d0p1
-.RE
-.fi
-
-One may also specify the device by a comma-separated pair
-of decimal integers
-.IR major , minor .
-
-For the
-.B ramsize
-command, the
-.I size
-parameter specifies the size of the RAM disk in kilobytes. 2.0.x kernels
-and newer dynamically allocate the ramdisk and do not need this setting.
-
-For the
-.B rootflags
-command, the
-.I flags
-parameter contains extra information used when mounting root.
-Currently the only effect of these flags is to force the kernel to
-mount the root filesystem in readonly mode if
-.I flags
-is non-zero.
-
-For the
-.B vidmode
-command, the
-.I mode
-parameter specifies the video mode:
-
-.nf
-.RS
--3 = Prompt
--2 = Extended VGA
--1 = Normal VGA
- 0 = as if "0" was pressed at the prompt
- 1 = as if "1" was pressed at the prompt
- 2 = as if "2" was pressed at the prompt
- n = as if "n" was pressed at the prompt
-.RE
-.fi
-
-If the
-.I value
-is not specified, the
-.I image
-will be examined to determine the current settings.
-.SH OPTIONS
-.TP
-.B \-r
-Causes
-.B rdev
-to act like
-.BR ramsize
-(Not relevant for 2.0.x and newer kernels).
-.TP
-.B \-R
-Causes
-.B rdev
-to act like
-.BR rootflags .
-.TP
-.B \-v
-Causes
-.B rdev
-to act like
-.BR vidmode .
-.TP
-.B \-h
-Provides help.
-.SH BUGS
-The
-.B rdev
-utility, when used other than to find a name for the current root device,
-is an ancient hack that works by patching a kernel image at a magic offset
-with magic numbers. It does not work on architectures other than i386.
-Its use is strongly discouraged. Use a boot loader like SysLinux or LILO
-instead.
-.SH HISTORY
-At offset 502 there used to be the device number of the swap device
-(in Linux 0.12), and "rdev -s" or "swapdev" would set this.
-However, since Linux 0.95 this constant is not used any longer,
-and the swap device is specified using the
-.BR swapon (2)
-system call.
-
-At offset 504 there used to be the size of the ramdisk in kilobytes.
-One would specify a size, and this much was grabbed off the top of memory.
-In Linux 1.1.39 it became also possible to set this value on the kernel
-command line.
-In Linux 1.3.48 the ramdisk setup was changed. Ramdisk memory is now
-taken from the buffer cache, so that the ramdisk can grow dynamically.
-The interpretation of the ramdisk word was changed to a word of which
-the high order bit is a prompt flag (1: prompt for ramdisk:
-"VFS: Insert ramdisk floppy and press ENTER" - this is needed with a
-two-floppy boot), the next bit a load flag (1: load ramdisk),
-and the low order 11 bits give the starting block number of the
-root filesystem image (so that one can have a single floppy boot).
-See also
-.IR linux/Documentation/ramdisk.txt .
-.SH AUTHORS
-.nf
-Originally by Werner Almesberger (almesber@nessie.cs.id.ethz.ch)
-Modified by Peter MacDonald (pmacdona@sanjuan.UVic.CA)
-rootflags support added by Stephen Tweedie (sct@dcs.ed.ac.uk)
-.fi
-.SH AVAILABILITY
-The rdev command is part of the util-linux-ng package and is available from
-ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/.
diff --git a/sys-utils/rdev.c b/sys-utils/rdev.c
deleted file mode 100644
index 14fac814c..000000000
--- a/sys-utils/rdev.c
+++ /dev/null
@@ -1,279 +0,0 @@
-/*
-
- rdev.c - query/set root device.
-
--------------------------------------------------------------------------
-
-Date: Sun, 27 Dec 1992 15:55:31 +0000
-Subject: Re: rdev
-From: almesber@nessie.cs.id.ethz.ch (Werner Almesberger)
-To: Rik Faith <faith@cs.unc.edu>
-
-There are quite a few versions of rdev:
-
- - the original rootdev that only printed the current root device, by
- Linus.
- - rdev that does what rootdev did and that also allows you to change
- the root (and swap) device, by me.
- - rdev got renamed to setroot and I think even to rootdev on various
- distributions.
- - Peter MacDonald added video mode and RAM disk setting and included
- this version on SLS, called rdev again. I've attached his rdev.c to
- this mail.
-
--------------------------------------------------------------------------
-
-Date: 11 Mar 92 21:37:37 GMT
-Subject: rdev - query/set root device
-From: almesber@nessie.cs.id.ethz.ch (Werner Almesberger)
-Organization: Swiss Federal Institute of Technology (ETH), Zurich, CH
-
-With all that socket, X11, disk driver and FS hacking going on, apparently
-nobody has found time to address one of the minor nuisances of life: set-
-ting the root FS device is still somewhat cumbersome. I've written a little
-utility which can read and set the root device in boot images:
-
-rdev accepts an optional offset argument, just in case the address should
-ever move from 508. If called without arguments, rdev outputs an mtab line
-for the current root FS, just like /etc/rootdev does.
-
-ramsize sets the size of the ramdisk. If size is zero, no ramdisk is used.
-
-vidmode sets the default video mode at bootup time. -1 uses default video
-mode, -2 uses menu.
-
--------------------------------------------------------------------------
-
-Sun Dec 27 10:42:16 1992: Minor usage changes, faith@cs.unc.edu.
-Tue Mar 30 09:31:52 1993: rdev -Rn to set root readonly flag, sct@dcs.ed.ac.uk
-Wed Jun 22 21:12:29 1994: Applied patches from Dave
- (gentzel@nova.enet.dec.com) to prevent dereferencing
- the NULL pointer, faith@cs.unc.edu
-1999-02-22 Arkadiusz Mi¶kiewicz <misiek@pld.ORG.PL>
-- added Native Language Support
-
--------------------------------------------------------------------------
-
-*/
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <dirent.h>
-#include <unistd.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include "nls.h"
-
-/* rdev.c - query/set root device. */
-
-static void
-usage(void) {
-
- puts(_("usage: rdev [ -rv ] [ -o OFFSET ] [ IMAGE [ VALUE [ OFFSET ] ] ]"));
- puts(_(" rdev /dev/fd0 (or rdev /linux, etc.) displays the current ROOT device"));
- puts(_(" rdev /dev/fd0 /dev/hda2 sets ROOT to /dev/hda2"));
- puts(_(" rdev -R /dev/fd0 1 set the ROOTFLAGS (readonly status)"));
- puts(_(" rdev -r /dev/fd0 627 set the RAMDISK size"));
- puts(_(" rdev -v /dev/fd0 1 set the bootup VIDEOMODE"));
- puts(_(" rdev -o N ... use the byte offset N"));
- puts(_(" rootflags ... same as rdev -R"));
- puts(_(" ramsize ... same as rdev -r"));
- puts(_(" vidmode ... same as rdev -v"));
- puts(_("Note: video modes are: -3=Ask, -2=Extended, -1=NormalVga, 1=key1, 2=key2,..."));
- puts(_(" use -R 1 to mount root readonly, -R 0 for read/write."));
- exit(-1);
-}
-
-
-#define DEFAULT_OFFSET 508
-
-
-static void
-die(char *msg) {
- perror(msg);
- exit(1);
-}
-
-/* Earlier rdev fails on /dev/ida/c0d0p1 so we allow for
- recursion in /dev. -- Paul Clements */
-/* In fact devfs needs deep recursion. */
-
-static int
-find_dev_recursive(char *dirnamebuf, int number) {
- DIR *dp;
- struct dirent *dir;
- struct stat s;
- int dirnamelen = 0;
-
- if ((dp = opendir(dirnamebuf)) == NULL)
- die("opendir");
- dirnamelen = strlen(dirnamebuf);
- while ((dir = readdir(dp)) != NULL) {
- if (!strcmp(dir->d_name, ".") || !strcmp(dir->d_name, ".."))
- continue;
- if (dirnamelen + 1 + strlen(dir->d_name) > PATH_MAX)
- continue;
- dirnamebuf[dirnamelen] = '/';
- strcpy(dirnamebuf+dirnamelen+1, dir->d_name);
- if (lstat(dirnamebuf, &s) < 0)
- continue;
- if ((s.st_mode & S_IFMT) == S_IFBLK && s.st_rdev == number)
- return 1;
- if ((s.st_mode & S_IFMT) == S_IFDIR &&
- find_dev_recursive(dirnamebuf, number))
- return 1;
- }
- dirnamebuf[dirnamelen] = 0;
- closedir(dp);
- return 0;
-}
-
-static char *
-find_dev(int number) {
- static char name[PATH_MAX+1];
-
- if (!number)
- return "Boot device";
- strcpy(name, "/dev");
- if (find_dev_recursive(name, number))
- return name;
- sprintf(name, "0x%04x", number);
- return name;
-}
-
-/* The enum values are significant, things are stored in this order,
- see bootsect.S */
-enum { RDEV, VIDMODE, RAMSIZE, __swapdev__, __syssize__, ROOTFLAGS };
-char *cmdnames[6] = { "rdev", "vidmode", "ramsize", "",
- "", "rootflags"};
-char *desc[6] = { "Root device", "Video mode", "Ramsize", "",
- "", "Root flags"};
-#define shift(n) argv+=n,argc-=n
-
-int
-main(int argc, char **argv) {
- int image, offset, dev_nr, i, newoffset=-1;
- char *ptr;
- unsigned short val, have_val;
- struct stat s;
- int cmd;
-
- setlocale(LC_ALL, "");
- bindtextdomain(PACKAGE, LOCALEDIR);
- textdomain(PACKAGE);
-
- /* use the command name to figure out what we have to do - ugly */
- cmd = RDEV;
- if ((ptr = strrchr(argv[0],'/')) != NULL)
- ptr++;
- else
- ptr = argv[0];
- for (i=0; i<=5; i++) {
- if (!strcmp(ptr,cmdnames[i])) {
- cmd = i;
- break;
- }
- }
-
- while (argc > 1) {
- if (argv[1][0] != '-')
- break;
- switch (argv[1][1]) {
- case 'R':
- cmd = ROOTFLAGS;
- shift(1);
- break;
- case 'r':
- cmd = RAMSIZE;
- shift(1);
- break;
- case 'v':
- cmd = VIDMODE;
- shift(1);
- break;
- case 'o':
- if (argv[1][2]) {
- newoffset = atoi(argv[1]+2);
- shift(1);
- break;
- } else if (argc > 2) {
- newoffset = atoi(argv[2]);
- shift(2);
- break;
- }
- /* Fall through. . . */
- default:
- usage();
- }
- }
-
- /* Here the only sensible way of using rdev */
- if (argc == 1) {
- if (cmd == RDEV) {
- if (stat("/",&s) < 0) die("/");
- printf("%s /\n", find_dev(s.st_dev));
- exit(0);
- }
- usage();
- }
-
- if (argc > 4)
- usage();
-
- /* Ancient garbage.. */
- offset = DEFAULT_OFFSET-cmd*2;
- if (newoffset >= 0)
- offset = newoffset;
- if (argc == 4)
- offset = atoi(argv[3]);
-
- have_val = 0;
-
- if (argc >= 3) {
- if (cmd == RDEV) {
- if (isdigit(*argv[2])) {
- /* earlier: specify offset */
- /* now: specify major,minor */
- char *p;
- unsigned int ma,mi;
- if ((p = strchr(argv[2], ',')) == NULL)
- die(_("missing comma"));
- ma = atoi(argv[2]);
- mi = atoi(p+1);
- val = ((ma<<8) | mi);
- } else {
- char *device = argv[2];
- if (stat(device,&s) < 0)
- die(device);
- val = s.st_rdev;
- }
- } else {
- val = atoi(argv[2]);
- }
- have_val = 1;
- }
-
- if (have_val) {
- if ((image = open(argv[1],O_WRONLY)) < 0) die(argv[1]);
- if (lseek(image,offset,0) < 0) die("lseek");
- if (write(image,(char *)&val,2) != 2) die(argv[1]);
- if (close(image) < 0) die("close");
- } else {
- if ((image = open(argv[1],O_RDONLY)) < 0) die(argv[1]);
- if (lseek(image,offset,0) < 0) die("lseek");
- dev_nr = 0;
- if (read(image,(char *)&dev_nr,2) != 2) die(argv[1]);
- if (close(image) < 0) die("close");
- fputs(desc[cmd], stdout);
- if (cmd == RDEV)
- printf(" %s\n", find_dev(dev_nr));
- else
- printf(" %d\n", dev_nr);
- }
- return 0;
-}