summaryrefslogtreecommitdiff
path: root/disk-utils
diff options
context:
space:
mode:
authorLaMont Jones <lamont@debian.org>2009-07-21 15:45:04 -0600
committerLaMont Jones <lamont@debian.org>2009-07-21 15:45:04 -0600
commit7a22bb9abcb56d1010cefd204709e3888f95f735 (patch)
tree5c38b4485f79ee8f6a9d5f9537e973f1f663f027 /disk-utils
parent4e13a18f57a5b427c559f3b466b9655db14d28f8 (diff)
parent741064af10ec81635d708e9fb8373f96341246eb (diff)
downloadutil-linux-old-7a22bb9abcb56d1010cefd204709e3888f95f735.tar.gz
Merge commit 'origin/master'
Conflicts: AUTHORS NEWS config/include-Makefile.am configure.ac mount/lomount.c po/POTFILES.in po/ca.po po/cs.po po/da.po po/de.po po/es.po po/et.po po/eu.po po/fi.po po/fr.po po/hu.po po/id.po po/it.po po/ja.po po/nl.po po/pl.po po/pt_BR.po po/ru.po po/sl.po po/sv.po po/tr.po po/uk.po po/util-linux-ng.pot po/vi.po po/zh_CN.po
Diffstat (limited to 'disk-utils')
-rw-r--r--disk-utils/Makefile.am19
-rw-r--r--disk-utils/mkswap.c6
-rw-r--r--disk-utils/raw.85
-rw-r--r--disk-utils/raw.c58
4 files changed, 50 insertions, 38 deletions
diff --git a/disk-utils/Makefile.am b/disk-utils/Makefile.am
index 4854d5f6..6bd22bc5 100644
--- a/disk-utils/Makefile.am
+++ b/disk-utils/Makefile.am
@@ -12,15 +12,18 @@ sbin_PROGRAMS = mkfs mkswap fsck.minix mkfs.minix mkfs.bfs
fsck_minix_SOURCES = fsck.minix.c minix.h
mkfs_minix_SOURCES = mkfs.minix.c minix.h $(utils_common)
mkfs_bfs_SOURCES = mkfs.bfs.c $(utils_common)
+
mkswap_SOURCES = mkswap.c $(utils_common) ../lib/wholedisk.c ../lib/pttype.c
+mkswap_LDADD =
+mkswap_CFLAGS =
-usrbinexec_PROGRAMS = isosize
-usrsbinexec_PROGRAMS =
+usrbin_exec_PROGRAMS = isosize
+usrsbin_exec_PROGRAMS =
if LINUX
dist_man_MANS += fdformat.8 blockdev.8
sbin_PROGRAMS += blockdev
-usrsbinexec_PROGRAMS += fdformat
+usrsbin_exec_PROGRAMS += fdformat
blockdev_SOURCES = blockdev.c $(utils_common)
endif
@@ -46,10 +49,14 @@ fsck_cramfs_LDADD = -lz
mkfs_cramfs_LDADD = -lz
endif
-mkswap_LDADD =
-
if HAVE_UUID
-mkswap_LDADD += -luuid
+if BUILD_LIBUUID
+mkswap_LDADD += $(ul_libuuid_la)
+mkswap_CFLAGS += -I$(ul_libuuid_srcdir)
+else
+mkswap_LDADD += $(UUID_LIBS)
+mkswap_CFLAGS += $(UUID_CFLAGS)
+endif
endif
if HAVE_SELINUX
diff --git a/disk-utils/mkswap.c b/disk-utils/mkswap.c
index 4acc73b2..bb97210e 100644
--- a/disk-utils/mkswap.c
+++ b/disk-utils/mkswap.c
@@ -57,7 +57,11 @@
#include "wholedisk.h"
#ifdef HAVE_LIBUUID
-#include <uuid/uuid.h>
+# ifdef HAVE_UUID_UUID_H
+# include <uuid/uuid.h>
+#else
+# include <uuid.h>
+# endif
#endif
static char * program_name = "mkswap";
diff --git a/disk-utils/raw.8 b/disk-utils/raw.8
index babdbd44..72bb17c9 100644
--- a/disk-utils/raw.8
+++ b/disk-utils/raw.8
@@ -15,11 +15,6 @@ raw \- bind a Linux raw character device
.PP
.B raw
.B \-qa
-.SH WARNING
-The rawio is a deprecated interface since Linux kernel 2.6.3. Please,
-modify your application to open the block device with the
-O_DIRECT flag.
-
.SH DESCRIPTION
.B raw
is used to bind a Linux raw character device to a block device. Any
diff --git a/disk-utils/raw.c b/disk-utils/raw.c
index bc64b349..f634b602 100644
--- a/disk-utils/raw.c
+++ b/disk-utils/raw.c
@@ -40,11 +40,11 @@ int master_fd;
int raw_minor;
void open_raw_ctl(void);
-int query(int minor, int quiet);
+int query(int minor, const char *raw_name, int quiet);
int bind (int minor, int block_major, int block_minor);
-static void usage(int err)
+static void usage(int err)
{
fprintf(stderr,
_("Usage:\n"
@@ -99,7 +99,7 @@ int main(int argc, char *argv[])
if (optind < argc)
usage(1);
for (i = 1; i < RAW_NR_MINORS; i++)
- query(i, 1);
+ query(i, NULL, 1);
exit(0);
}
@@ -117,7 +117,10 @@ int main(int argc, char *argv[])
* causes udev to *remove* /dev/rawctl
*/
rc = sscanf(raw_name, RAWDEVDIR "raw%d", &raw_minor);
- if (rc == 1 && raw_minor == 0) {
+ if (rc != 1)
+ usage(1);
+
+ if (raw_minor == 0) {
fprintf (stderr,
_("Device '%s' is control raw dev "
"(use raw<N> where <N> is greater than zero)\n"),
@@ -125,28 +128,8 @@ int main(int argc, char *argv[])
exit(2);
}
- err = stat(raw_name, &statbuf);
- if (err) {
- fprintf (stderr, _("Cannot locate raw device '%s' (%s)\n"),
- raw_name, strerror(errno));
- exit(2);
- }
-
- if (!S_ISCHR(statbuf.st_mode)) {
- fprintf (stderr, _("Raw device '%s' is not a character dev\n"),
- raw_name);
- exit(2);
- }
- if (major(statbuf.st_rdev) != RAW_MAJOR) {
- fprintf (stderr, _("Device '%s' is not a raw dev\n"),
- raw_name);
- exit(2);
- }
-
- raw_minor = minor(statbuf.st_rdev);
-
if (do_query)
- return query(raw_minor, 0);
+ return query(raw_minor, raw_name, 0);
/*
* It's not a query, so we still have some parsing to do. Have
@@ -208,12 +191,35 @@ void open_raw_ctl(void)
}
}
-int query(int minor, int quiet)
+int query(int minor, const char *raw_name, int quiet)
{
struct raw_config_request rq;
static int has_worked = 0;
int err;
+ if (raw_name) {
+ struct stat statbuf;
+
+ err = stat(raw_name, &statbuf);
+ if (err) {
+ fprintf (stderr, _("Cannot locate raw device '%s' (%s)\n"),
+ raw_name, strerror(errno));
+ exit(2);
+ }
+
+ if (!S_ISCHR(statbuf.st_mode)) {
+ fprintf (stderr, _("Raw device '%s' is not a character dev\n"),
+ raw_name);
+ exit(2);
+ }
+ if (major(statbuf.st_rdev) != RAW_MAJOR) {
+ fprintf (stderr, _("Device '%s' is not a raw dev\n"),
+ raw_name);
+ exit(2);
+ }
+ minor = minor(statbuf.st_rdev);
+ }
+
rq.raw_minor = minor;
err = ioctl(master_fd, RAW_GETBIND, &rq);
if (err < 0) {