Add a -l option to show file system's corresponding /dev/ufsid path.
This is useful for scripts that converts existing system's fstab to use their /dev/ufsid devices. MFC after: 2 weeks
This commit is contained in:
parent
5375015146
commit
e293d08775
@ -28,7 +28,7 @@
|
||||
.\" @(#)dumpfs.8 8.1 (Berkeley) 6/5/93
|
||||
.\" $FreeBSD$
|
||||
.\"
|
||||
.Dd May 8, 2011
|
||||
.Dd Jul 14, 2011
|
||||
.Dt DUMPFS 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -37,6 +37,7 @@
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl f
|
||||
.Op Fl l
|
||||
.Op Fl m
|
||||
.Ar filesys | device
|
||||
.Sh DESCRIPTION
|
||||
@ -44,7 +45,8 @@ The
|
||||
.Nm
|
||||
utility prints out the UFS super block and cylinder group information
|
||||
for the file system or special device specified, unless the
|
||||
.Fl f
|
||||
.Fl f ,
|
||||
.Fl l
|
||||
or
|
||||
.Fl m
|
||||
flag is specified.
|
||||
@ -64,6 +66,11 @@ Fragment numbers may be converted to raw byte offsets by multiplying by the
|
||||
fragment size, which may be useful when recovering deleted data.
|
||||
.Pp
|
||||
If
|
||||
.Fl l
|
||||
is specified, the pathname to the file system's container derived from
|
||||
its unique identifier is printed.
|
||||
.Pp
|
||||
If
|
||||
.Fl m
|
||||
is specified, a
|
||||
.Xr newfs 8
|
||||
|
@ -79,6 +79,7 @@ static const char rcsid[] =
|
||||
struct uufsd disk;
|
||||
|
||||
int dumpfs(const char *);
|
||||
int dumpfsid(void);
|
||||
int dumpcg(void);
|
||||
int dumpfreespace(const char *, int);
|
||||
void dumpfreespacecg(int);
|
||||
@ -92,11 +93,11 @@ int
|
||||
main(int argc, char *argv[])
|
||||
{
|
||||
const char *name;
|
||||
int ch, dofreespace, domarshal, eval;
|
||||
int ch, dofreespace, domarshal, dolabel, eval;
|
||||
|
||||
dofreespace = domarshal = eval = 0;
|
||||
dofreespace = domarshal = dolabel = eval = 0;
|
||||
|
||||
while ((ch = getopt(argc, argv, "fm")) != -1) {
|
||||
while ((ch = getopt(argc, argv, "lfm")) != -1) {
|
||||
switch (ch) {
|
||||
case 'f':
|
||||
dofreespace++;
|
||||
@ -104,6 +105,9 @@ main(int argc, char *argv[])
|
||||
case 'm':
|
||||
domarshal = 1;
|
||||
break;
|
||||
case 'l':
|
||||
dolabel = 1;
|
||||
break;
|
||||
case '?':
|
||||
default:
|
||||
usage();
|
||||
@ -129,6 +133,8 @@ main(int argc, char *argv[])
|
||||
eval |= dumpfreespace(name, dofreespace);
|
||||
else if (domarshal)
|
||||
eval |= marshal(name);
|
||||
else if (dolabel)
|
||||
eval |= dumpfsid();
|
||||
else
|
||||
eval |= dumpfs(name);
|
||||
ufs_disk_close(&disk);
|
||||
@ -136,6 +142,14 @@ main(int argc, char *argv[])
|
||||
exit(eval);
|
||||
}
|
||||
|
||||
int
|
||||
dumpfsid(void)
|
||||
{
|
||||
|
||||
printf("/dev/ufsid/%x%x\n", afs.fs_id[0], afs.fs_id[1]);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int
|
||||
dumpfs(const char *name)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user