summaryrefslogtreecommitdiff
path: root/extras/volume_id
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-07-13 16:59:01 +0200
committerKay Sievers <kay.sievers@suse.de>2006-07-13 16:59:01 +0200
commit7d5ccc081008a08f066b5bb6805f417585ae663a (patch)
tree6c8e11bfaefeae57c4d6ac46b76d16b0cf5fa685 /extras/volume_id
parentf566b05b572492e4e7a684a5b04231412d71d0bd (diff)
vol_id: add --skip-raid and --probe-all option
Diffstat (limited to 'extras/volume_id')
-rw-r--r--extras/volume_id/lib/Makefile2
-rw-r--r--extras/volume_id/lib/exported_symbols4
-rw-r--r--extras/volume_id/lib/volume_id.c12
-rw-r--r--extras/volume_id/vol_id.86
-rw-r--r--extras/volume_id/vol_id.c109
5 files changed, 115 insertions, 18 deletions
diff --git a/extras/volume_id/lib/Makefile b/extras/volume_id/lib/Makefile
index 90cd63e745..66b3b92f9d 100644
--- a/extras/volume_id/lib/Makefile
+++ b/extras/volume_id/lib/Makefile
@@ -13,7 +13,7 @@ INSTALL_DATA = ${INSTALL} -m 644
INSTALL_LIB = ${INSTALL} -m 755
SHLIB_CUR = 0
-SHLIB_REV = 66
+SHLIB_REV = 67
SHLIB_AGE = 0
SHLIB = libvolume_id.so.$(SHLIB_CUR).$(SHLIB_REV).$(SHLIB_AGE)
diff --git a/extras/volume_id/lib/exported_symbols b/extras/volume_id/lib/exported_symbols
index 3f10ec0c78..57a1feb3dc 100644
--- a/extras/volume_id/lib/exported_symbols
+++ b/extras/volume_id/lib/exported_symbols
@@ -7,6 +7,8 @@
volume_id_probe_raid;
volume_id_close;
+ volume_id_probe_linux_swap;
+ volume_id_probe_luks;
volume_id_probe_cramfs;
volume_id_probe_ext;
volume_id_probe_vfat;
@@ -41,6 +43,8 @@
volume_id_probe_promise_fasttrack_raid;
volume_id_probe_silicon_medley_raid;
volume_id_probe_via_raid;
+ volume_id_probe_adaptec_raid;
+ volume_id_probe_jmicron_raid;
local:
*;
};
diff --git a/extras/volume_id/lib/volume_id.c b/extras/volume_id/lib/volume_id.c
index bcdbe2feaa..f74319fb96 100644
--- a/extras/volume_id/lib/volume_id.c
+++ b/extras/volume_id/lib/volume_id.c
@@ -102,21 +102,21 @@ int volume_id_probe_filesystem(struct volume_id *id, uint64_t off, uint64_t size
info("probing at offset 0x%llx, size 0x%llx",
(unsigned long long) off, (unsigned long long) size);
- if (volume_id_probe_luks(id, off) == 0)
- goto found;
-
if (volume_id_probe_vfat(id, off) == 0)
goto found;
- if (volume_id_probe_xfs(id, off) == 0)
- goto found;
-
/* fill buffer with maximum */
volume_id_get_buffer(id, 0, SB_BUFFER_SIZE);
if (volume_id_probe_linux_swap(id, off) == 0)
goto found;
+ if (volume_id_probe_luks(id, off) == 0)
+ goto found;
+
+ if (volume_id_probe_xfs(id, off) == 0)
+ goto found;
+
if (volume_id_probe_ext(id, off) == 0)
goto found;
diff --git a/extras/volume_id/vol_id.8 b/extras/volume_id/vol_id.8
index 9f5a9c5d8e..15fccbe97e 100644
--- a/extras/volume_id/vol_id.8
+++ b/extras/volume_id/vol_id.8
@@ -31,6 +31,12 @@ print the label of a volume
.TP
\fB\-u\fR
print the uuid of a volume
+.TP
+\fB\-\-skip-raid\fR
+skip probing for raid signatures
+.TP
+\fB\-\-probe-all\fR
+probe for all known signatures to detect possible conflicts
.SH "ENVIRONMENT"
.TP
\fBUDEV_LOG\fR
diff --git a/extras/volume_id/vol_id.c b/extras/volume_id/vol_id.c
index dcf56d87e9..d516eb5cbd 100644
--- a/extras/volume_id/vol_id.c
+++ b/extras/volume_id/vol_id.c
@@ -109,11 +109,14 @@ static void set_str(char *to, const char *from, size_t count)
int main(int argc, char *argv[])
{
- const char help[] = "usage: vol_id [--export|-t|-l|-u] <device>\n"
- " --export\n"
- " -t filesystem type\n"
- " -l filesystem label\n"
- " -u filesystem uuid\n"
+ const char help[] = "Usage: vol_id [options] <device>\n"
+ " --export export key/value pairs\n"
+ " -t filesystem type\n"
+ " -l filesystem label\n"
+ " -u filesystem uuid\n"
+ " --skip-raid don't probe for raid\n"
+ " --probe-all find possibly conflicting signatures\n"
+ " --help\n"
"\n";
enum print_type {
PRINT_EXPORT,
@@ -125,9 +128,12 @@ int main(int argc, char *argv[])
static char name[VOLUME_ID_LABEL_SIZE];
int i;
uint64_t size;
+ int skip_raid = 0;
+ int probe_all = 0;
const char *node = NULL;
uid_t nobody_uid;
gid_t nobody_gid;
+ int retval;
int rc = 0;
logging_init("vol_id");
@@ -146,6 +152,13 @@ int main(int argc, char *argv[])
print = PRINT_LABEL;
} else if (strcmp(arg, "-u") == 0) {
print = PRINT_UUID;
+ } else if (strcmp(arg, "--skip-raid") == 0) {
+ skip_raid = 1;
+ } else if (strcmp(arg, "--probe-all") == 0) {
+ probe_all = 1;
+ } else if (strcmp(arg, "--help") == 0 || strcmp(arg, "-h") == 0) {
+ printf(help);
+ goto exit;
} else
node = arg;
}
@@ -179,15 +192,89 @@ int main(int argc, char *argv[])
}
}
- if (volume_id_probe_all(vid, 0, size) == 0)
- goto print;
+ if (probe_all) {
+ if (volume_id_probe_linux_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_intel_software_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_lsi_mega_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_via_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_silicon_medley_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_nvidia_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_promise_fasttrack_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_highpoint_45x_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_adaptec_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_jmicron_raid(vid, 0, size) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_vfat(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_linux_swap(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_luks(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_xfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_ext(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_reiserfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_jfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_udf(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_iso9660(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_hfs_hfsplus(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_ufs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_ntfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_cramfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_romfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_hpfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_sysv(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_minix(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_ocfs1(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_ocfs2(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_vxfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_squashfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_netware(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_gfs(vid, 0) == 0)
+ printf("%s\n", vid->type);
+ if (volume_id_probe_gfs2(vid, 0) == 0)
+ printf("%s\n", vid->type);
+
+ goto exit;
+ }
- if (print != PRINT_EXPORT)
+ if (skip_raid)
+ retval = volume_id_probe_filesystem(vid, 0, size);
+ else
+ retval = volume_id_probe_all(vid, 0, size);
+ if (retval != 0) {
fprintf(stderr, "%s: unknown volume type\n", node);
- rc = 4;
- goto exit;
+ rc = 4;
+ goto exit;
+ }
-print:
set_str(name, vid->label, sizeof(vid->label));
replace_untrusted_chars(name);