From 940817b736bceccca9be6b9b73e4dd7da0d89142 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Sun, 8 Feb 2009 00:23:55 +0100 Subject: [PATCH] blkid: add findfs(8) Signed-off-by: Karel Zak --- libs/blkid/.gitignore | 1 + libs/blkid/bin/Makefile.am | 7 +++-- libs/blkid/bin/findfs.8 | 35 ++++++++++++++++++++++ libs/blkid/bin/findfs.c | 60 +++++++++++++++++++++++++++++++++++++ libs/blkid/bin/findfs.sh.in | 10 +++++++ 5 files changed, 110 insertions(+), 3 deletions(-) create mode 100644 libs/blkid/bin/findfs.8 create mode 100644 libs/blkid/bin/findfs.c create mode 100644 libs/blkid/bin/findfs.sh.in diff --git a/libs/blkid/.gitignore b/libs/blkid/.gitignore index a8ec330a..d6126dea 100644 --- a/libs/blkid/.gitignore +++ b/libs/blkid/.gitignore @@ -1,3 +1,4 @@ *.sh bin/blkid +bin/findfs test_* diff --git a/libs/blkid/bin/Makefile.am b/libs/blkid/bin/Makefile.am index cc34c573..581adbe7 100644 --- a/libs/blkid/bin/Makefile.am +++ b/libs/blkid/bin/Makefile.am @@ -3,13 +3,14 @@ include $(top_srcdir)/config/include-Makefile.am AM_LDFLAGS += -L$(top_builddir)/libs/blkid/src -lblkid AM_CPPFLAGS += -I$(top_builddir)/libs/blkid/src/ -sbin_PROGRAMS = blkid -dist_man_MANS = blkid.8 +sbin_PROGRAMS = blkid findfs +dist_man_MANS = blkid.8 findfs.8 -shell_in_files = blkid.sh.in +shell_in_files = blkid.sh.in findfs.sh noinst_SCRIPTS = $(shell_in_files:.sh.in=.sh) blkid_SOURCES = blkid.c +findfs_SOURCES = findfs.c CLEANFILES = $(noinst_SCRIPTS) diff --git a/libs/blkid/bin/findfs.8 b/libs/blkid/bin/findfs.8 new file mode 100644 index 00000000..e93fe542 --- /dev/null +++ b/libs/blkid/bin/findfs.8 @@ -0,0 +1,35 @@ +.\" -*- nroff -*- +.\" Copyright 1993, 1994, 1995 by Theodore Ts'o. All Rights Reserved. +.\" This file may be copied under the terms of the GNU Public License. +.\" +.TH FINDFS 8 "February 2009" "Linux" "MAINTENANCE COMMANDS" +.SH NAME +findfs \- Find a filesystem by label or UUID +.SH SYNOPSIS +.B findfs +.BI LABEL= label +.sp +.B findfs +.BI UUID= uuid +.SH DESCRIPTION +.B findfs +will search the disks in the system looking for a filesystem which has +a label matching +.I label +or a UUID equal to +.IR uuid . +If the filesystem is found, the device name for the filesystem will +be printed on stdout. +.PP +.SH AUTHOR +.B findfs +was originally written by Theodore Ts'o (tytso@mit.edu) and re-written for +util-linux-ng package by Karel Zak (kzak@redhat.com). +.SH AVAILABILITY +.B findfs +The blkid command is part of the util-linux-ng package and is available from +ftp://ftp.kernel.org/pub/linux/utils/util-linux-ng/. +.SH SEE ALSO +.BR blkid (8) +.BR fsck (8) + diff --git a/libs/blkid/bin/findfs.c b/libs/blkid/bin/findfs.c new file mode 100644 index 00000000..e316eb24 --- /dev/null +++ b/libs/blkid/bin/findfs.c @@ -0,0 +1,60 @@ +/* + * Copyright (C) 2009 Karel Zak + * + * This file may be redistributed under the terms of the GNU Public + * License. + */ +#include +#include +#include +#include +#include + +#include + +#include "nls.h" + +static void __attribute__((__noreturn__)) usage(int rc) +{ + const char *p = program_invocation_short_name; + + if (!p) + p = "findfs"; + + fprintf(stderr, _("Usage: %s LABEL=