diff options
author | Karel Zak <kzak@redhat.com> | 2006-12-07 00:25:43 +0100 |
---|---|---|
committer | Karel Zak <kzak@redhat.com> | 2006-12-07 00:25:43 +0100 |
commit | 22853e4a82c6ef7b336527529acb94b14a0b0fd8 (patch) | |
tree | ee28e4598c8c449d7e811711d8ce8eb17caecfb6 /disk-utils/raw.c | |
parent | eb63b9b8f4cecb34c2478282567862bc48ef256d (diff) | |
download | util-linux-old-22853e4a82c6ef7b336527529acb94b14a0b0fd8.tar.gz |
Imported from util-linux-2.10m tarball.
Diffstat (limited to 'disk-utils/raw.c')
-rw-r--r-- | disk-utils/raw.c | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/disk-utils/raw.c b/disk-utils/raw.c index 5fb95348..54e1008c 100644 --- a/disk-utils/raw.c +++ b/disk-utils/raw.c @@ -1,12 +1,12 @@ /* * raw.c: User mode tool to bind and query raw character devices. * - * Stephen Tweedie, 1999 + * Stephen Tweedie, 1999, 2000 * * This file may be redistributed under the terms of the GNU General * Public License, version 2. * - * Copyright Red Hat Software, 1999 + * Copyright Red Hat Software, 1999, 2000 * */ @@ -19,8 +19,16 @@ #include <sys/stat.h> #include <sys/ioctl.h> #include <sys/sysmacros.h> -#include <sys/raw.h> +#include <linux/raw.h> +#include <linux/major.h> +#ifdef OLD_RAW_DEVS +#define RAWCTLDEV "/dev/raw" +#define RAWDEVDIR "/dev/" +#else +#define RAWCTLDEV "/dev/rawctl" +#define RAWDEVDIR "/dev/raw/" +#endif char * progname; @@ -39,9 +47,9 @@ static void usage(int err) { fprintf(stderr, "Usage:\n" - " %s /dev/rawN <major> <minor>\n" - " %s /dev/rawN /dev/<blockdev>\n" - " %s -q /dev/rawN\n" + " %s " RAWDEVDIR "rawN <major> <minor>\n" + " %s " RAWDEVDIR "rawN /dev/<blockdev>\n" + " %s -q " RAWDEVDIR "rawN\n" " %s -qa\n", progname, progname, progname, progname); exit(err); @@ -164,10 +172,10 @@ int main(int argc, char *argv[]) void open_raw_ctl(void) { - master_fd = open("/dev/raw", O_RDWR, 0); + master_fd = open(RAWCTLDEV, O_RDWR, 0); if (master_fd < 0) { fprintf (stderr, - "Cannot open master raw device '/dev/raw' (%s)\n", + "Cannot open master raw device '" RAWCTLDEV "' (%s)\n", strerror(errno)); exit(2); } @@ -190,7 +198,7 @@ int query(int minor, int quiet) } if (quiet && !rq.block_major && !rq.block_minor) return 0; - printf ("/dev/raw%d: bound to major %d, minor %d\n", + printf (RAWDEVDIR "raw%d: bound to major %d, minor %d\n", minor, (int) rq.block_major, (int) rq.block_minor); return 0; } @@ -210,7 +218,7 @@ int bind(int minor, int block_major, int block_minor) strerror(errno)); exit(3); } - printf ("/dev/raw%d: bound to major %d, minor %d\n", + printf (RAWDEVDIR "raw%d: bound to major %d, minor %d\n", raw_minor, (int) rq.block_major, (int) rq.block_minor); return 0; } |