wipefs: add -t <list> option
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
1208915521
commit
f126cd4694
|
@ -68,7 +68,9 @@ blkid_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
|
|||
findfs_LDADD = $(ul_libblkid_la)
|
||||
findfs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
|
||||
|
||||
wipefs_SOURCES = wipefs.c $(top_srcdir)/lib/strutils.c
|
||||
wipefs_SOURCES = wipefs.c \
|
||||
$(top_srcdir)/lib/strutils.c \
|
||||
$(top_srcdir)/lib/match.c
|
||||
wipefs_LDADD = $(ul_libblkid_la)
|
||||
wipefs_CFLAGS = $(AM_CFLAGS) -I$(ul_libblkid_incdir)
|
||||
|
||||
|
|
|
@ -4,25 +4,40 @@
|
|||
.\"
|
||||
.TH WIPEFS 8 "October 2009" "util-linux" "System Administration"
|
||||
.SH NAME
|
||||
wipefs \- wipe a filesystem signature from a device
|
||||
wipefs \- wipe a signature from a device
|
||||
.SH SYNOPSIS
|
||||
.B wipefs
|
||||
.RB [ \-ahnpV ]
|
||||
.RB [ \-ahnptV ]
|
||||
.RB [ \-o
|
||||
.IR offset ]
|
||||
.I device
|
||||
.SH DESCRIPTION
|
||||
.B wipefs
|
||||
can erase filesystem or raid signatures (magic strings) from the specified
|
||||
can erase filesystem, raid or partition table signatures (magic strings) from
|
||||
the specified
|
||||
.I device
|
||||
to make the filesystem invisible for libblkid.
|
||||
to make the signature invisible for libblkid.
|
||||
|
||||
.B wipefs
|
||||
does not erase the filesystem itself nor any other data from the device.
|
||||
When used without options \fB-a\fR or \fB-o\fR, it lists all visible filesystems
|
||||
and the offsets of their signatures.
|
||||
and the offsets of their basic signatures.
|
||||
|
||||
Note that some filesystems or some partition tables store more magic strings on
|
||||
the devices. The
|
||||
.B wipefs
|
||||
lists the first offset where a magic string has been detected. The device is
|
||||
not scanned for additional magic strings for the same filesystem. It's possible
|
||||
that after \fBwipefs -o <offset>\fR will be the same filesystem or partition
|
||||
table visible by another magic string on another offset.
|
||||
|
||||
When used with option \fB-a\fR then all for libblkid visible magic strings are
|
||||
erased.
|
||||
|
||||
.SH OPTIONS
|
||||
.IP "\fB\-a, \-\-all\fP"
|
||||
Erase all available signatures.
|
||||
Erase all available signatures. This set of erased signatures could be
|
||||
restricted by \fB\-t <list>\fP option.
|
||||
.IP "\fB\-h, \-\-help\fP"
|
||||
Print help and exit.
|
||||
.IP "\fB\-n, \-\-no\-act\fP"
|
||||
|
@ -38,6 +53,11 @@ GiB, TiB, PiB and EiB (the "iB" is optional, e.g. "K" has the same meaning as
|
|||
.IP "\fB\-p, \-\-parsable\fP"
|
||||
Print out in parsable instead of printable format. Encode all potentially unsafe
|
||||
characters of a string to the corresponding hex value prefixed by '\\x'.
|
||||
.IP "\fB\-t, \-\-types\fP \fIlist\fP
|
||||
Used to limit the set of printed or erased signatures. More than one type may
|
||||
be specified in a comma-separated list. The list of types or individual types
|
||||
can be prefixed with 'no' to specify the types on which no action should be
|
||||
taken. For more details see mount(8).
|
||||
.IP "\fB\-V, \-\-version\fP"
|
||||
Output version information and exit.
|
||||
.SH AUTHOR
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include "xalloc.h"
|
||||
#include "strutils.h"
|
||||
#include "writeall.h"
|
||||
#include "match.h"
|
||||
#include "c.h"
|
||||
|
||||
struct wipe_desc {
|
||||
|
@ -57,6 +58,8 @@ struct wipe_desc {
|
|||
#define WP_MODE_PRETTY 0 /* default */
|
||||
#define WP_MODE_PARSABLE 1
|
||||
|
||||
static const char *type_pattern;
|
||||
|
||||
static void
|
||||
print_pretty(struct wipe_desc *wp, int line)
|
||||
{
|
||||
|
@ -166,6 +169,9 @@ get_desc_for_probe(struct wipe_desc *wp, blkid_probe pr)
|
|||
} else
|
||||
return wp;
|
||||
|
||||
if (type_pattern && !match_fstype(type, type_pattern))
|
||||
return wp;
|
||||
|
||||
offset = strtoll(off, NULL, 10);
|
||||
|
||||
wp = add_offset(wp, offset, 0);
|
||||
|
@ -336,6 +342,7 @@ usage(FILE *out)
|
|||
" -n, --no-act do everything except the actual write() call\n"
|
||||
" -o, --offset <num> offset to erase, in bytes\n"
|
||||
" -p, --parsable print out in parsable instead of printable format\n"
|
||||
" -t, --types <list> limit the set of filesystem, RAIDs or partition tables\n"
|
||||
" -V, --version output version information and exit\n"), out);
|
||||
|
||||
fprintf(out, _("\nFor more information see wipefs(8).\n"));
|
||||
|
@ -357,6 +364,7 @@ main(int argc, char **argv)
|
|||
{ "no-act", 0, 0, 'n' },
|
||||
{ "offset", 1, 0, 'o' },
|
||||
{ "parsable", 0, 0, 'p' },
|
||||
{ "types", 1, 0, 't' },
|
||||
{ "version", 0, 0, 'V' },
|
||||
{ NULL, 0, 0, 0 }
|
||||
};
|
||||
|
@ -365,7 +373,7 @@ main(int argc, char **argv)
|
|||
bindtextdomain(PACKAGE, LOCALEDIR);
|
||||
textdomain(PACKAGE);
|
||||
|
||||
while ((c = getopt_long(argc, argv, "ahno:pV", longopts, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "ahno:pt:V", longopts, NULL)) != -1) {
|
||||
switch(c) {
|
||||
case 'a':
|
||||
all++;
|
||||
|
@ -383,6 +391,9 @@ main(int argc, char **argv)
|
|||
case 'p':
|
||||
mode = WP_MODE_PARSABLE;
|
||||
break;
|
||||
case 't':
|
||||
type_pattern = optarg;
|
||||
break;
|
||||
case 'V':
|
||||
printf(_("%s from %s\n"), program_invocation_short_name,
|
||||
PACKAGE_STRING);
|
||||
|
|
Loading…
Reference in New Issue