util-linux-2.20.1/0000775000076400007640000000000011647764042010734 500000000000000util-linux-2.20.1/README.devel0000664000076400007640000001060511647210633012624 00000000000000 Notes for util-linux developers ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ AUTOTOOLS: * "./autogen.sh" generates all files needed to compile and install the code (run it after checkout from git) * "make distclean" removes all unnecessary files, but the code can still be recompiled with "./configure; make" * "make dist-gzip" (or -bzip2) creates a tarball that can be configured and compiled without running "./autogen.sh" PATCHES: * send your patches to the mailing list or to the upstream maintainer (see the AUTHORS and README files) * diff -u * don't include generated (autotools) stuff to your patches (hint: use git-clean [-X]) * patches are delivered via email only. Downloading them from internet servers is a pain. * one patch per email, with the changelog in the body of the email. * many small patches are favoured over one big. Break down is done on basis of logical functionality; for example #endif mark ups, compiler warning and exit codes fixes all should be individual small patches. * Subject: [PATCH] subsystem: description * if someone else wrote the patch, they should be credited (and blamed) for it. To communicate this, add a line: From: John Doe * add a Signed-off-by line (hint: use "git commit -s") The sign-off is a simple line at the end of the explanation for the patch, which certifies that you wrote it or otherwise have the right to pass it on as a open-source patch. The rules are pretty simple: if you can certify the below: By making a contribution to this project, I certify that: (a) The contribution was created in whole or in part by me and I have the right to submit it under the open source license indicated in the file; or (b) The contribution is based upon previous work that, to the best of my knowledge, is covered under an appropriate open source license and I have the right under that license to submit that work with modifications, whether created in whole or in part by me, under the same open source license (unless I am permitted to submit under a different license), as indicated in the file; or (c) The contribution was provided directly to me by some other person who certified (a), (b) or (c) and I have not modified it. (d) I understand and agree that this project and the contribution are public and that a record of the contribution (including all personal information I submit with it, including my sign-off) is maintained indefinitely and may be redistributed consistent with this project or the open source license(s) involved. then you just add a line saying Signed-off-by: Random J Developer using your real name (sorry, no pseudonyms or anonymous contributions.) * for more details see: The perfect patch http://userweb.kernel.org/~akpm/stuff/tpp.txt CODING STYLE: * the preferred coding style is based on the linux kernel Documentation/CodingStyle. For more details see: http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob_plain;f=Documentation/CodingStyle SCM (source code management): git clone git://git.kernel.org/pub/scm/utils/util-linux/util-linux.git util-linux * maintenance (stable) branch - created for every . release - branch name: stable/v. * bugfix branch - created for .. release for critical/security bugs only - this branch is optional - branch name: stable/v.. * master branch - the status of this branch is: "it works for me". It means useful but not well tested patches. - it's source for occasional snapshots - for long-term development or invasive changes should be an active development forked into a separate branch (topic branches) from the tip of "master". * A new tag object is created for: - every release, tag name: v * KNOWN BUGS: - tag v2.13.1 is typo. Please, ignore this tag. util-linux-2.20.1/partx/0000775000076400007640000000000011647764042012072 500000000000000util-linux-2.20.1/partx/delpart.80000664000076400007640000000146511645041543013534 00000000000000.\" delpart.8 -- .\" Copyright 2007 Karel Zak .\" Copyright 2007 Red Hat, Inc. .\" May be distributed under the GNU General Public License .TH DELPART 8 "January 2007" "util-linux" "System Administration" .SH NAME delpart \- simple wrapper around the "del partition" ioctl .SH SYNOPSIS .B delpart .I device partition .SH DESCRIPTION .B delpart is a program that asks the Linux kernel to remove a partition. This command doesn't manipulate partitions on hard drive. .SH OPTIONS .TP .I device Specify the disk device. .TP .I partition Specify the partition number. .SH SEE ALSO .BR addpart (8), .BR fdisk (8), .BR parted (8), .BR partprobe (8), .BR partx (8) .SH AVAILABILITY The delpart command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. util-linux-2.20.1/partx/delpart.c0000664000076400007640000000062211573627635013615 00000000000000#include #include #include #include "partx.h" int main(int argc, char **argv){ int fd; if (argc != 3) { fprintf(stderr, "usage: %s diskdevice partitionnr\n", argv[0]); exit(1); } if ((fd = open(argv[1], O_RDONLY)) < 0) { perror(argv[1]); exit(1); } if (partx_del_partition(fd, atoi(argv[2])) == -1) { perror("BLKPG"); exit(1); } return 0; } util-linux-2.20.1/partx/partx.h0000664000076400007640000000147211573627635013331 00000000000000#ifndef UTIL_LINUX_PARTX_H #define UTIL_LINUX_PARTX_H #include #include static inline int partx_del_partition(int fd, int partno) { struct blkpg_ioctl_arg a; struct blkpg_partition p; p.pno = partno; p.start = 0; p.length = 0; p.devname[0] = 0; p.volname[0] = 0; a.op = BLKPG_DEL_PARTITION; a.flags = 0; a.datalen = sizeof(p); a.data = &p; return ioctl(fd, BLKPG, &a); } static inline int partx_add_partition(int fd, int partno, unsigned long start, unsigned long size) { struct blkpg_ioctl_arg a; struct blkpg_partition p; p.pno = partno; p.start = start << 9; p.length = size << 9; p.devname[0] = 0; p.volname[0] = 0; a.op = BLKPG_ADD_PARTITION; a.flags = 0; a.datalen = sizeof(p); a.data = &p; return ioctl(fd, BLKPG, &a); } #endif /* UTIL_LINUX_PARTX_H */ util-linux-2.20.1/partx/Makefile.am0000664000076400007640000000077311647210633014045 00000000000000include $(top_srcdir)/config/include-Makefile.am usrsbin_exec_PROGRAMS = addpart delpart dist_man_MANS = addpart.8 delpart.8 usrsbin_exec_PROGRAMS += partx partx_SOURCES = partx.c partx.h \ $(top_srcdir)/lib/blkdev.c \ $(top_srcdir)/lib/sysfs.c \ $(top_srcdir)/lib/tt.c \ $(top_srcdir)/lib/at.c \ $(top_srcdir)/lib/mbsalign.c \ $(top_srcdir)/lib/strutils.c \ $(top_srcdir)/lib/linux_version.c partx_CFLAGS = -I$(ul_libblkid_incdir) partx_LDADD = $(ul_libblkid_la) dist_man_MANS += partx.8 util-linux-2.20.1/partx/Makefile.in0000664000076400007640000011757611647756713014106 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(dist_man_MANS) $(dist_noinst_DATA) \ $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ $(top_srcdir)/config/include-Makefile.am usrsbin_exec_PROGRAMS = addpart$(EXEEXT) delpart$(EXEEXT) \ partx$(EXEEXT) subdir = partx ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/tls.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = am__installdirs = "$(DESTDIR)$(usrsbin_execdir)" \ "$(DESTDIR)$(man8dir)" PROGRAMS = $(usrsbin_exec_PROGRAMS) addpart_SOURCES = addpart.c addpart_OBJECTS = addpart.$(OBJEXT) addpart_LDADD = $(LDADD) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent delpart_SOURCES = delpart.c delpart_OBJECTS = delpart.$(OBJEXT) delpart_LDADD = $(LDADD) am_partx_OBJECTS = partx-partx.$(OBJEXT) partx-blkdev.$(OBJEXT) \ partx-sysfs.$(OBJEXT) partx-tt.$(OBJEXT) partx-at.$(OBJEXT) \ partx-mbsalign.$(OBJEXT) partx-strutils.$(OBJEXT) \ partx-linux_version.$(OBJEXT) partx_OBJECTS = $(am_partx_OBJECTS) partx_DEPENDENCIES = $(ul_libblkid_la) partx_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(partx_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = addpart.c delpart.c $(partx_SOURCES) DIST_SOURCES = addpart.c delpart.c $(partx_SOURCES) am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ *) f=$$p;; \ esac; am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; am__install_max = 40 am__nobase_strip_setup = \ srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` am__nobase_strip = \ for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" am__nobase_list = $(am__nobase_strip_setup); \ for p in $$list; do echo "$$p $$p"; done | \ sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ if (++n[$$2] == $(am__install_max)) \ { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ END { for (dir in files) print dir, files[dir] }' am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' man8dir = $(mandir)/man8 NROFF = nroff MANS = $(dist_man_MANS) DATA = $(dist_noinst_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBLKID_DATE = @LIBBLKID_DATE@ LIBBLKID_VERSION = @LIBBLKID_VERSION@ LIBBLKID_VERSION_INFO = @LIBBLKID_VERSION_INFO@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMOUNT_VERSION = @LIBMOUNT_VERSION@ LIBMOUNT_VERSION_INFO = @LIBMOUNT_VERSION_INFO@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUUID_VERSION = @LIBUUID_VERSION@ LIBUUID_VERSION_INFO = @LIBUUID_VERSION_INFO@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ NCURSES_LIBS = @NCURSES_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ SELINUX_LIBS = @SELINUX_LIBS@ SELINUX_LIBS_STATIC = @SELINUX_LIBS_STATIC@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKET_LIBS = @SOCKET_LIBS@ STRIP = @STRIP@ SUID_CFLAGS = @SUID_CFLAGS@ SUID_LDFLAGS = @SUID_LDFLAGS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libdirname = @libdirname@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ usrbin_execdir = @usrbin_execdir@ usrlib_execdir = @usrlib_execdir@ usrsbin_execdir = @usrsbin_execdir@ AM_CPPFLAGS = -include $(top_builddir)/config.h -I$(top_srcdir)/include \ -DLOCALEDIR=\"$(localedir)\" AM_CFLAGS = -fsigned-char AM_LDFLAGS = # Automake (at least up to 1.10) mishandles dist_man_MANS inside conditionals. # Unlike with other dist primaries, the files are not distributed if the # conditional is false. # Work the bug around until it is fixed: dist_noinst_DATA = $(dist_man_MANS) # Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) # # blkid ul_libblkid_srcdir = $(top_srcdir)/libblkid/src ul_libblkid_builddir = $(top_builddir)/libblkid/src ul_libblkid_la = $(top_builddir)/libblkid/src/libblkid.la # blkid.h is generated by ./configure script and stored in build directory ul_libblkid_incdir = $(ul_libblkid_builddir) # uuid ul_libuuid_srcdir = $(top_srcdir)/libuuid/src ul_libuuid_builddir = $(top_builddir)/libuuid/src ul_libuuid_la = $(top_builddir)/libuuid/src/libuuid.la # mount ul_libmount_srcdir = $(top_srcdir)/libmount/src ul_libmount_builddir = $(top_builddir)/libmount/src ul_libmount_la = $(top_builddir)/libmount/src/libmount.la # libmount.h is generated by ./configure script and stored in build directory ul_libmount_incdir = $(ul_libmount_builddir) dist_man_MANS = addpart.8 delpart.8 partx.8 partx_SOURCES = partx.c partx.h \ $(top_srcdir)/lib/blkdev.c \ $(top_srcdir)/lib/sysfs.c \ $(top_srcdir)/lib/tt.c \ $(top_srcdir)/lib/at.c \ $(top_srcdir)/lib/mbsalign.c \ $(top_srcdir)/lib/strutils.c \ $(top_srcdir)/lib/linux_version.c partx_CFLAGS = -I$(ul_libblkid_incdir) partx_LDADD = $(ul_libblkid_la) all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/include-Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign partx/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign partx/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): install-usrsbin_execPROGRAMS: $(usrsbin_exec_PROGRAMS) @$(NORMAL_INSTALL) test -z "$(usrsbin_execdir)" || $(MKDIR_P) "$(DESTDIR)$(usrsbin_execdir)" @list='$(usrsbin_exec_PROGRAMS)'; test -n "$(usrsbin_execdir)" || list=; \ for p in $$list; do echo "$$p $$p"; done | \ sed 's/$(EXEEXT)$$//' | \ while read p p1; do if test -f $$p || test -f $$p1; \ then echo "$$p"; echo "$$p"; else :; fi; \ done | \ sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ sed 'N;N;N;s,\n, ,g' | \ $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ if ($$2 == $$4) files[d] = files[d] " " $$1; \ else { print "f", $$3 "/" $$4, $$1; } } \ END { for (d in files) print "f", d, files[d] }' | \ while read type dir files; do \ if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ test -z "$$files" || { \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(usrsbin_execdir)$$dir'"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(usrsbin_execdir)$$dir" || exit $$?; \ } \ ; done uninstall-usrsbin_execPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(usrsbin_exec_PROGRAMS)'; test -n "$(usrsbin_execdir)" || list=; \ files=`for p in $$list; do echo "$$p"; done | \ sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ -e 's/$$/$(EXEEXT)/' `; \ test -n "$$list" || exit 0; \ echo " ( cd '$(DESTDIR)$(usrsbin_execdir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(usrsbin_execdir)" && rm -f $$files clean-usrsbin_execPROGRAMS: @list='$(usrsbin_exec_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list addpart$(EXEEXT): $(addpart_OBJECTS) $(addpart_DEPENDENCIES) @rm -f addpart$(EXEEXT) $(AM_V_CCLD)$(LINK) $(addpart_OBJECTS) $(addpart_LDADD) $(LIBS) delpart$(EXEEXT): $(delpart_OBJECTS) $(delpart_DEPENDENCIES) @rm -f delpart$(EXEEXT) $(AM_V_CCLD)$(LINK) $(delpart_OBJECTS) $(delpart_LDADD) $(LIBS) partx$(EXEEXT): $(partx_OBJECTS) $(partx_DEPENDENCIES) @rm -f partx$(EXEEXT) $(AM_V_CCLD)$(partx_LINK) $(partx_OBJECTS) $(partx_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/addpart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/delpart.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-at.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-blkdev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-linux_version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-mbsalign.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-partx.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-strutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-sysfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/partx-tt.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< partx-partx.o: partx.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-partx.o -MD -MP -MF $(DEPDIR)/partx-partx.Tpo -c -o partx-partx.o `test -f 'partx.c' || echo '$(srcdir)/'`partx.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-partx.Tpo $(DEPDIR)/partx-partx.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='partx.c' object='partx-partx.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-partx.o `test -f 'partx.c' || echo '$(srcdir)/'`partx.c partx-partx.obj: partx.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-partx.obj -MD -MP -MF $(DEPDIR)/partx-partx.Tpo -c -o partx-partx.obj `if test -f 'partx.c'; then $(CYGPATH_W) 'partx.c'; else $(CYGPATH_W) '$(srcdir)/partx.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-partx.Tpo $(DEPDIR)/partx-partx.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='partx.c' object='partx-partx.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-partx.obj `if test -f 'partx.c'; then $(CYGPATH_W) 'partx.c'; else $(CYGPATH_W) '$(srcdir)/partx.c'; fi` partx-blkdev.o: $(top_srcdir)/lib/blkdev.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-blkdev.o -MD -MP -MF $(DEPDIR)/partx-blkdev.Tpo -c -o partx-blkdev.o `test -f '$(top_srcdir)/lib/blkdev.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/blkdev.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-blkdev.Tpo $(DEPDIR)/partx-blkdev.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/blkdev.c' object='partx-blkdev.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-blkdev.o `test -f '$(top_srcdir)/lib/blkdev.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/blkdev.c partx-blkdev.obj: $(top_srcdir)/lib/blkdev.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-blkdev.obj -MD -MP -MF $(DEPDIR)/partx-blkdev.Tpo -c -o partx-blkdev.obj `if test -f '$(top_srcdir)/lib/blkdev.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/blkdev.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/blkdev.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-blkdev.Tpo $(DEPDIR)/partx-blkdev.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/blkdev.c' object='partx-blkdev.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-blkdev.obj `if test -f '$(top_srcdir)/lib/blkdev.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/blkdev.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/blkdev.c'; fi` partx-sysfs.o: $(top_srcdir)/lib/sysfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-sysfs.o -MD -MP -MF $(DEPDIR)/partx-sysfs.Tpo -c -o partx-sysfs.o `test -f '$(top_srcdir)/lib/sysfs.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/sysfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-sysfs.Tpo $(DEPDIR)/partx-sysfs.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/sysfs.c' object='partx-sysfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-sysfs.o `test -f '$(top_srcdir)/lib/sysfs.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/sysfs.c partx-sysfs.obj: $(top_srcdir)/lib/sysfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-sysfs.obj -MD -MP -MF $(DEPDIR)/partx-sysfs.Tpo -c -o partx-sysfs.obj `if test -f '$(top_srcdir)/lib/sysfs.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/sysfs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/sysfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-sysfs.Tpo $(DEPDIR)/partx-sysfs.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/sysfs.c' object='partx-sysfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-sysfs.obj `if test -f '$(top_srcdir)/lib/sysfs.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/sysfs.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/sysfs.c'; fi` partx-tt.o: $(top_srcdir)/lib/tt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-tt.o -MD -MP -MF $(DEPDIR)/partx-tt.Tpo -c -o partx-tt.o `test -f '$(top_srcdir)/lib/tt.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/tt.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-tt.Tpo $(DEPDIR)/partx-tt.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/tt.c' object='partx-tt.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-tt.o `test -f '$(top_srcdir)/lib/tt.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/tt.c partx-tt.obj: $(top_srcdir)/lib/tt.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-tt.obj -MD -MP -MF $(DEPDIR)/partx-tt.Tpo -c -o partx-tt.obj `if test -f '$(top_srcdir)/lib/tt.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/tt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/tt.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-tt.Tpo $(DEPDIR)/partx-tt.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/tt.c' object='partx-tt.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-tt.obj `if test -f '$(top_srcdir)/lib/tt.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/tt.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/tt.c'; fi` partx-at.o: $(top_srcdir)/lib/at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-at.o -MD -MP -MF $(DEPDIR)/partx-at.Tpo -c -o partx-at.o `test -f '$(top_srcdir)/lib/at.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/at.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-at.Tpo $(DEPDIR)/partx-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/at.c' object='partx-at.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-at.o `test -f '$(top_srcdir)/lib/at.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/at.c partx-at.obj: $(top_srcdir)/lib/at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-at.obj -MD -MP -MF $(DEPDIR)/partx-at.Tpo -c -o partx-at.obj `if test -f '$(top_srcdir)/lib/at.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/at.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/at.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-at.Tpo $(DEPDIR)/partx-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/at.c' object='partx-at.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-at.obj `if test -f '$(top_srcdir)/lib/at.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/at.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/at.c'; fi` partx-mbsalign.o: $(top_srcdir)/lib/mbsalign.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-mbsalign.o -MD -MP -MF $(DEPDIR)/partx-mbsalign.Tpo -c -o partx-mbsalign.o `test -f '$(top_srcdir)/lib/mbsalign.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/mbsalign.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-mbsalign.Tpo $(DEPDIR)/partx-mbsalign.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/mbsalign.c' object='partx-mbsalign.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-mbsalign.o `test -f '$(top_srcdir)/lib/mbsalign.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/mbsalign.c partx-mbsalign.obj: $(top_srcdir)/lib/mbsalign.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-mbsalign.obj -MD -MP -MF $(DEPDIR)/partx-mbsalign.Tpo -c -o partx-mbsalign.obj `if test -f '$(top_srcdir)/lib/mbsalign.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/mbsalign.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/mbsalign.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-mbsalign.Tpo $(DEPDIR)/partx-mbsalign.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/mbsalign.c' object='partx-mbsalign.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-mbsalign.obj `if test -f '$(top_srcdir)/lib/mbsalign.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/mbsalign.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/mbsalign.c'; fi` partx-strutils.o: $(top_srcdir)/lib/strutils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-strutils.o -MD -MP -MF $(DEPDIR)/partx-strutils.Tpo -c -o partx-strutils.o `test -f '$(top_srcdir)/lib/strutils.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/strutils.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-strutils.Tpo $(DEPDIR)/partx-strutils.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/strutils.c' object='partx-strutils.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-strutils.o `test -f '$(top_srcdir)/lib/strutils.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/strutils.c partx-strutils.obj: $(top_srcdir)/lib/strutils.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-strutils.obj -MD -MP -MF $(DEPDIR)/partx-strutils.Tpo -c -o partx-strutils.obj `if test -f '$(top_srcdir)/lib/strutils.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/strutils.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/strutils.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-strutils.Tpo $(DEPDIR)/partx-strutils.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/strutils.c' object='partx-strutils.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-strutils.obj `if test -f '$(top_srcdir)/lib/strutils.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/strutils.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/strutils.c'; fi` partx-linux_version.o: $(top_srcdir)/lib/linux_version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-linux_version.o -MD -MP -MF $(DEPDIR)/partx-linux_version.Tpo -c -o partx-linux_version.o `test -f '$(top_srcdir)/lib/linux_version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/linux_version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-linux_version.Tpo $(DEPDIR)/partx-linux_version.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/linux_version.c' object='partx-linux_version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-linux_version.o `test -f '$(top_srcdir)/lib/linux_version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/linux_version.c partx-linux_version.obj: $(top_srcdir)/lib/linux_version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -MT partx-linux_version.obj -MD -MP -MF $(DEPDIR)/partx-linux_version.Tpo -c -o partx-linux_version.obj `if test -f '$(top_srcdir)/lib/linux_version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/linux_version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/linux_version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/partx-linux_version.Tpo $(DEPDIR)/partx-linux_version.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/linux_version.c' object='partx-linux_version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(partx_CFLAGS) $(CFLAGS) -c -o partx-linux_version.obj `if test -f '$(top_srcdir)/lib/linux_version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/linux_version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/linux_version.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs install-man8: $(dist_man_MANS) @$(NORMAL_INSTALL) test -z "$(man8dir)" || $(MKDIR_P) "$(DESTDIR)$(man8dir)" @list=''; test -n "$(man8dir)" || exit 0; \ { for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | while read p; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ echo "$$d$$p"; echo "$$p"; \ done | \ sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ sed 'N;N;s,\n, ,g' | { \ list=; while read file base inst; do \ if test "$$base" = "$$inst"; then list="$$list $$file"; else \ echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \ $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst" || exit $$?; \ fi; \ done; \ for i in $$list; do echo "$$i"; done | $(am__base_list) | \ while read files; do \ test -z "$$files" || { \ echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man8dir)'"; \ $(INSTALL_DATA) $$files "$(DESTDIR)$(man8dir)" || exit $$?; }; \ done; } uninstall-man8: @$(NORMAL_UNINSTALL) @list=''; test -n "$(man8dir)" || exit 0; \ files=`{ for i in $$list; do echo "$$i"; done; \ l2='$(dist_man_MANS)'; for i in $$l2; do echo "$$i"; done | \ sed -n '/\.8[a-z]*$$/p'; \ } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^8][0-9a-z]*$$,8,;x' \ -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ test -z "$$files" || { \ echo " ( cd '$(DESTDIR)$(man8dir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(man8dir)" && rm -f $$files; } ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @list='$(MANS)'; if test -n "$$list"; then \ list=`for p in $$list; do \ if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ if test -n "$$list" && \ grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ echo " typically \`make maintainer-clean' will remove them" >&2; \ exit 1; \ else :; fi; \ else :; fi @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) installdirs: for dir in "$(DESTDIR)$(usrsbin_execdir)" "$(DESTDIR)$(man8dir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-usrsbin_execPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-man install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-usrsbin_execPROGRAMS install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-man8 install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: uninstall-man uninstall-usrsbin_execPROGRAMS uninstall-man: uninstall-man8 .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-usrsbin_execPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-man8 install-pdf install-pdf-am install-ps \ install-ps-am install-strip install-usrsbin_execPROGRAMS \ installcheck installcheck-am installdirs maintainer-clean \ maintainer-clean-generic mostlyclean mostlyclean-compile \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ tags uninstall uninstall-am uninstall-man uninstall-man8 \ uninstall-usrsbin_execPROGRAMS $(ul_libblkid_la): $(MAKE) -C $(ul_libblkid_builddir) $(ul_libuuid_la): $(MAKE) -C $(ul_libuuid_builddir) $(ul_libmount_la): $(MAKE) -C $(ul_libmount_builddir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: util-linux-2.20.1/partx/addpart.c0000664000076400007640000000070311640045337013565 00000000000000#include #include #include #include "partx.h" int main(int argc, char **argv) { int fd; if (argc != 5) { fprintf(stderr, "usage: %s diskdevice partitionnr start length\n", argv[0]); exit(1); } if ((fd = open(argv[1], O_RDONLY)) < 0) { perror(argv[1]); exit(1); } if (partx_add_partition(fd, atoi(argv[2]), atoll(argv[3]), atoll(argv[4]))) { perror("BLKPG"); exit(1); } return 0; } util-linux-2.20.1/partx/addpart.80000664000076400007640000000172311645041543013515 00000000000000.\" addpart.8 -- .\" Copyright 2007 Karel Zak .\" Copyright 2007 Red Hat, Inc. .\" May be distributed under the GNU General Public License .TH ADDPART 8 "January 2007" "util-linux" "System Administration" .SH NAME addpart \- simple wrapper around the "add partition" ioctl .SH SYNOPSIS .B addpart .I device partition start length .SH DESCRIPTION .B addpart is a program that informs the Linux kernel of new partition. This command doesn't manipulate partitions on hard drive. .SH PARAMETERS .TP .I device Specify the disk device. .TP .I partition Specify the partition number. .TP .I start Specify the begin of the partition (in 512-byte sectors). .TP .I length Specify the length of the partition (in 512-byte sectors). .SH SEE ALSO .BR delpart (8), .BR fdisk (8), .BR parted (8), .BR partprobe (8), .BR partx (8) .SH AVAILABILITY The addpart command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. util-linux-2.20.1/partx/partx.80000664000076400007640000000770611645041543013243 00000000000000.\" partx.8 -- .\" Copyright 2007 Karel Zak .\" Copyright 2007 Red Hat, Inc. .\" Copyright 2010 Davidlohr Bueso .\" May be distributed under the GNU General Public License .TH PARTX 8 "February 2011" "util-linux" "System Administration" .SH NAME partx \- tell the Linux kernel about the presence and numbering of on-disk partitions .SH SYNOPSIS .B partx .RB [ \-a | \-d | \-s ] .RB [ \-t .IR TYPE ] .RB [ \-n .IR M:N ] .RI [ \- ] .I disk .B partx .RB [ \-a | \-d | \-s ] .RB [ \-t .IR TYPE ] .I partition .RI [ disk ] .SH DESCRIPTION Given a device or disk-image, \fBpartx\fP tries to parse the partition table and list its contents. It optionally adds or removes partitions. The .I disk argument is optional when a .I partition argument is provided. To force scanning a partition as if it were a whole disk (for example to list nested subpartitions), use the argument "-". For example: .RS .br .B partx \-\-show \- /dev/sda3 .RE This will see sda3 as a whole-disk rather than a partition. .B This is not an fdisk program \-\- adding and removing partitions does not change the disk, it just tells the kernel about the presence and numbering of on-disk partitions. .SH OPTIONS .IP "\fB\-a, \-\-add\fP" Add the specified partitions, or read the disk and add all partitions. .IP "\fB\-b, \-\-bytes\fP" Print the SIZE column in bytes rather than in human-readable format. .IP "\fB\-d, \-\-delete\fP" Delete the specified partitions or all partitions. .IP "\fB\-g, \-\-noheadings\fP" Do not print a header line. .IP "\fB\-l, \-\-list\fP" List the partitions. Note that all numbers are in 512-byte sectors. This output format is DEPRECATED in favour of \fB\-\-show\fP. Don't use it in newly written scripts. .IP "\fB\-o, \-\-output \fIlist\fP" Define the output columns to use for \fB\-\-show\fP and \fB\-\-raw\fP output. If no output arrangement is specified, then a default set is used. Use \fB\-\-help\fP to get list of all supported columns. .IP "\fB\-r, \-\-raw\fP" Use the raw output format. .IP "\fB\-s, \-\-show\fP" List the partitions. All numbers (except SIZE) are in 512-byte sectors. The output columns can be rearranged with the \fB\-\-output\fP option. .IP "\fB\-t, \-\-type \fItype\fP" Specify the partition table type -- aix, bsd, dos, gpt, mac, minix, sgi, solaris_x86, sun, ultrix or unixware. .IP "\fB\-n, \-\-nr \fIM:N\fP" Specify the range of partitions. For backward compatibility also the format is supported. The range may contain negative numbers, for example "--nr :-1" means the last partition, and "--nr -2:-1" means the last two partitions. Supported range specifications are: .RS .TP .B Specifies just one partition (e.g. --nr 3). .TP .B Specifies lower limit only (e.g. --nr 2:). .TP .B <:N> Specifies upper limit only (e.g. --nr :4). .TP .B or .B Specifies lower and upper limits (e.g. --nr 2:4). .RE .SH EXAMPLES .IP "\fBpartx \-\-show /dev/sdb3\fP" .IP "\fBpartx \-\-show --nr 3 /dev/sdb\fP" .IP "\fBpartx \-\-show /dev/sdb3 /dev/sdb\fP" All three commands list partition 3 of /dev/sdb. .IP "\fBpartx \-\-show \- /dev/sdb3\fP" Lists all subpartitions on /dev/sdb3 (the device is used as whole-disk). .IP "\fBpartx \-o START -g --nr 3 /dev/sdb\fP" Prints the start sector of partition 5 on /dev/sda without header. .IP "\fBpartx \-o SECTORS,SIZE /dev/sda5 /dev/sda\fP" Lists the length in sectors and human-readable size of partition 5 on /dev/sda. .IP "\fBpartx \-\-add --nr 3:5 /dev/sdd\fP" Adds all available partitions from 3 to 5 (inclusive) on /dev/sdd. .IP "\fBpartx \-d --nr :-1 /dev/sdd\fP" Removes the last partition on /dev/sdd. .SH SEE ALSO .BR addpart (8), .BR delpart (8), .BR fdisk (8), .BR parted (8), .BR partprobe (8) .SH AUTHORS .nf Davidlohr Bueso Karel Zak .fi The original version was written by Andries E. Brouwer . .SH AVAILABILITY The partx command is part of the util-linux package and is available from ftp://ftp.kernel.org/pub/linux/utils/util-linux/. util-linux-2.20.1/partx/partx.c0000664000076400007640000004574111647210633013317 00000000000000/* * partx: tell the kernel about your disk's partitions * [This is not an fdisk - adding and removing partitions * is not a change of the disk, but just telling the kernel * about presence and numbering of on-disk partitions.] * * aeb, 2000-03-21 -- sah is 42 now * * Copyright (C) 2010 Davidlohr Bueso * Rewritten to use libblkid for util-linux * based on ideas from Karel Zak */ #include #include #include #include #include #include #include #include #include #include "c.h" #include "pathnames.h" #include "nls.h" #include "tt.h" #include "blkdev.h" #include "strutils.h" #include "xalloc.h" #include "partx.h" #include "sysfs.h" #include "at.h" /* this is the default upper limit, could be modified by --nr */ #define SLICES_MAX 256 /* all the columns (-o option) */ enum { COL_PARTNO, COL_START, COL_END, COL_SECTORS, COL_SIZE, COL_NAME, COL_UUID, COL_TYPE, COL_FLAGS, COL_SCHEME, __NCOLUMNS }; enum { ACT_LIST = 1, ACT_SHOW, ACT_ADD, ACT_DELETE }; enum { FL_BYTES = (1 << 1) }; /* column names */ struct colinfo { const char *name; /* header */ double whint; /* width hint (N < 1 is in percent of termwidth) */ int flags; /* TT_FL_* */ const char *help; }; /* columns descriptions */ struct colinfo infos[__NCOLUMNS] = { [COL_PARTNO] = { "NR", 0.25, TT_FL_RIGHT, N_("partition number") }, [COL_START] = { "START", 0.30, TT_FL_RIGHT, N_("start of the partition in sectors") }, [COL_END] = { "END", 0.30, TT_FL_RIGHT, N_("end of the partition in sectors") }, [COL_SECTORS] = { "SECTORS", 0.30, TT_FL_RIGHT, N_("number of sectors") }, [COL_SIZE] = { "SIZE", 0.30, TT_FL_RIGHT, N_("human readable size") }, [COL_NAME] = { "NAME", 0.30, TT_FL_TRUNC, N_("partition name") }, [COL_UUID] = { "UUID", 36, 0, N_("partition UUID")}, [COL_SCHEME] = { "SCHEME", 0.1, TT_FL_TRUNC, N_("partition table type (dos, gpt, ...)")}, [COL_FLAGS] = { "FLAGS", 0.1, TT_FL_TRUNC, N_("partition flags")}, [COL_TYPE] = { "TYPE", 1, TT_FL_RIGHT, N_("partition type hex or uuid")}, }; /* array with IDs of enabled columns */ static int columns[__NCOLUMNS], ncolumns; static int verbose; static int partx_flags; static inline int get_column_id(int num) { assert(ARRAY_SIZE(columns) == __NCOLUMNS); assert(num < ncolumns); assert(columns[num] < __NCOLUMNS); return columns[num]; } static inline struct colinfo *get_column_info(int num) { return &infos[ get_column_id(num) ]; } static int column_name_to_id(const char *name, size_t namesz) { int i; assert(name); for (i = 0; i < __NCOLUMNS; i++) { const char *cn = infos[i].name; if (!strncasecmp(name, cn, namesz) && !*(cn + namesz)) return i; } warnx(_("unknown column: %s"), name); return -1; } /* * Given a partition return the corresponding partition number. * * Note that this function tries to use sysfs, otherwise it assumes that the * last characters are always numeric (sda1, sdc20, etc). */ static int get_partno_from_device(char *partition, dev_t devno) { int partno = 0; size_t sz; char *p, *end = NULL; assert(partition); if (devno) { struct sysfs_cxt cxt; sysfs_init(&cxt, devno, NULL); if (sysfs_read_int(&cxt, "partition", &partno) >= 0) { sysfs_deinit(&cxt); return partno; } } sz = strlen(partition); p = partition + sz - 1; if (!isdigit((unsigned int) *p)) goto err; while (isdigit((unsigned int) *(p - 1))) p--; errno = 0; partno = strtol(p, &end, 10); if (errno || !end || *end || p == end) goto err; return partno; err: errx(EXIT_FAILURE, _("%s: failed to get partition number"), partition); } static int get_max_partno(const char *disk, dev_t devno) { char path[PATH_MAX], *parent, *dirname = NULL; struct stat st; DIR *dir; struct dirent *d; int partno = 0; if (!devno && !stat(disk, &st)) devno = st.st_rdev; if (!devno) goto dflt; parent = strrchr(disk, '/'); if (!parent) goto dflt; parent++; snprintf(path, sizeof(path), _PATH_SYS_DEVBLOCK "/%d:%d/", major(devno), minor(devno)); dir = opendir(path); if (!dir) goto dflt; dirname = xstrdup(path); while ((d = readdir(dir))) { int fd; if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) continue; #ifdef _DIRENT_HAVE_D_TYPE if (d->d_type != DT_DIR) continue; #endif if (strncmp(parent, d->d_name, strlen(parent))) continue; snprintf(path, sizeof(path), "%s/partition", d->d_name); fd = open_at(dirfd(dir), dirname, path, O_RDONLY); if (fd) { int x = 0; FILE *f = fdopen(fd, "r"); if (f) { if (fscanf(f, "%d", &x) == 1 && x > partno) partno = x; fclose(f); } } } free(dirname); closedir(dir); return partno; dflt: return SLICES_MAX; } static void del_parts_warnx(const char *device, int first, int last) { if (first == last) warnx(_("%s: error deleting partition %d"), device, first); else warnx(_("%s: error deleting partitions %d-%d"), device, first, last); } static int del_parts(int fd, const char *device, dev_t devno, int lower, int upper) { int rc = 0, i, errfirst = 0, errlast = 0; assert(fd >= 0); assert(device); if (!lower) lower = 1; if (!upper || lower < 0 || upper < 0) { int n = get_max_partno(device, devno); if (!upper) upper = n; else if (upper < 0) upper = n + upper + 1; if (lower < 0) lower = n + lower + 1; } if (lower > upper) { warnx(_("specified range <%d:%d> " "does not make sense"), lower, upper); return -1; } for (i = lower; i <= upper; i++) { if (partx_del_partition(fd, i) == 0) { if (verbose) printf(_("%s: partition #%d removed\n"), device, i); continue; } rc = -1; if (verbose) warn(_("%s: deleting partition #%d failed"), device, i); if (!errfirst) errlast = errfirst = i; else if (errlast + 1 == i) errlast++; else { del_parts_warnx(device, errfirst, errlast); errlast = errfirst = i; } } if (errfirst) del_parts_warnx(device, errfirst, errlast); return rc; } static void add_parts_warnx(const char *device, int first, int last) { if (first == last) warnx(_("%s: error adding partition %d"), device, first); else warnx(_("%s: error adding partitions %d-%d"), device, first, last); } static int add_parts(int fd, const char *device, blkid_partlist ls, int lower, int upper) { int i, nparts, rc = 0, errfirst = 0, errlast = 0; assert(fd >= 0); assert(device); assert(ls); nparts = blkid_partlist_numof_partitions(ls); for (i = 0; i < nparts; i++) { blkid_partition par = blkid_partlist_get_partition(ls, i); int n = blkid_partition_get_partno(par); uintmax_t start, size; if (lower && n < lower) continue; if (upper && n > upper) continue; start = blkid_partition_get_start(par); size = blkid_partition_get_size(par); if (blkid_partition_is_extended(par)) /* * Let's follow the Linux kernel and reduce * DOS extended partition to 1 or 2 sectors. */ size = min(size, (uintmax_t) 2); if (partx_add_partition(fd, n, start, size) == 0) { if (verbose) printf(_("%s: partition #%d added\n"), device, n); continue; } rc = -1; if (verbose) warn(_("%s: adding partition #%d failed"), device, n); if (!errfirst) errlast = errfirst = n; else if (errlast + 1 == n) errlast++; else { add_parts_warnx(device, errfirst, errlast); errlast = errfirst = n; } } if (errfirst) add_parts_warnx(device, errfirst, errlast); return rc; } static int list_parts(blkid_partlist ls, int lower, int upper) { int i, nparts; assert(ls); nparts = blkid_partlist_numof_partitions(ls); for (i = 0; i < nparts; i++) { blkid_partition par = blkid_partlist_get_partition(ls, i); int n = blkid_partition_get_partno(par); uintmax_t start, size; if (lower && n < lower) continue; if (upper && n > upper) continue; start = blkid_partition_get_start(par); size = blkid_partition_get_size(par); printf(_("#%2d: %9ju-%9ju (%9ju sectors, %6ju MB)\n"), n, start, start + size -1, size, (size << 9) / 1000000); } return 0; } static void add_tt_line(struct tt *tt, blkid_partition par) { struct tt_line *line; int i; assert(tt); assert(par); line = tt_add_line(tt, NULL); if (!line) { warn(_("failed to add line to output")); return; } for (i = 0; i < ncolumns; i++) { char *str = NULL; int rc = 0; switch (get_column_id(i)) { case COL_PARTNO: rc = asprintf(&str, "%d", blkid_partition_get_partno(par)); break; case COL_START: rc = asprintf(&str, "%ju", blkid_partition_get_start(par)); break; case COL_END: rc = asprintf(&str, "%ju", blkid_partition_get_start(par) + blkid_partition_get_size(par) - 1); break; case COL_SECTORS: rc = asprintf(&str, "%ju", blkid_partition_get_size(par)); break; case COL_SIZE: if (partx_flags & FL_BYTES) rc = asprintf(&str, "%ju", (uintmax_t) blkid_partition_get_size(par) << 9); else str = size_to_human_string(SIZE_SUFFIX_1LETTER, blkid_partition_get_size(par) << 9); break; case COL_NAME: str = (char *) blkid_partition_get_name(par); if (str) str = xstrdup(str); break; case COL_UUID: str = (char *) blkid_partition_get_uuid(par); if (str) str = xstrdup(str); break; case COL_TYPE: str = (char *) blkid_partition_get_type_string(par); if (str) str = xstrdup(str); else rc = asprintf(&str, "0x%x", blkid_partition_get_type(par)); break; case COL_FLAGS: rc = asprintf(&str, "0x%llx", blkid_partition_get_flags(par)); break; case COL_SCHEME: { blkid_parttable tab = blkid_partition_get_table(par); if (tab) { str = (char *) blkid_parttable_get_type(tab); if (str) str = xstrdup(str); } break; } default: break; } if (rc || str) tt_line_set_data(line, i, str); } } static int show_parts(blkid_partlist ls, int tt_flags, int lower, int upper) { int i, rc = -1; struct tt *tt; int nparts; assert(ls); nparts = blkid_partlist_numof_partitions(ls); if (!nparts) return 0; tt = tt_new_table(tt_flags); if (!tt) { warn(_("failed to initialize output table")); return -1; } for (i = 0; i < ncolumns; i++) { struct colinfo *col = get_column_info(i); if (!tt_define_column(tt, col->name, col->whint, col->flags)) { warnx(_("failed to initialize output column")); goto done; } } for (i = 0; i < nparts; i++) { blkid_partition par = blkid_partlist_get_partition(ls, i); int n = blkid_partition_get_partno(par); if (lower && n < lower) continue; if (upper && n > upper) continue; add_tt_line(tt, par); } rc = 0; tt_print_table(tt); done: tt_free_table(tt); return rc; } static int parse_range(const char *str, int *lower, int *upper) { char *end = NULL; if (!str) return 0; *upper = *lower = 0; errno = 0; if (*str == ':') { /* <:N> */ str++; *upper = strtol(str, &end, 10); if (errno || !end || *end || end == str) return -1; } else { *upper = *lower = strtol(str, &end, 10); if (errno || !end || end == str) return -1; if (*end == ':' && !*(end + 1)) /* */ *upper = 0; else if (*end == '-' || *end == ':') { /* */ str = end + 1; end = NULL; errno = 0; *upper = strtol(str, &end, 10); if (errno || !end || *end || end == str) return -1; } } return 0; } static blkid_partlist get_partlist(blkid_probe pr, const char *device, char *type) { blkid_partlist ls; blkid_parttable tab; assert(pr); assert(device); if (type) { char *name[] = { type, NULL }; if (blkid_probe_filter_partitions_type(pr, BLKID_FLTR_ONLYIN, name)) { warnx(_("failed to initialize blkid " "filter for '%s'"), type); return NULL; } } ls = blkid_probe_get_partitions(pr); if (!ls) { warnx(_("%s: failed to read partition table"), device); return NULL; } tab = blkid_partlist_get_table(ls); if (verbose && tab) printf(_("%s: partition table type '%s' detected\n"), device, blkid_parttable_get_type(tab)); if (!blkid_partlist_numof_partitions(ls)) { warnx(_("%s: %s partition table does not contains " "usable partitions"), device, blkid_parttable_get_type(tab)); return NULL; } return ls; } static void __attribute__((__noreturn__)) usage(FILE *out) { int i; fputs(_("\nUsage:\n"), out); fprintf(out, _(" %s [-a|-d|-s] [--nr | ] \n"), program_invocation_short_name); fputs(_("\nOptions:\n"), out); fputs(_(" -a, --add add specified partitions or all of them\n" " -d, --delete delete specified partitions or all of them\n" " -l, --list list partitions (DEPRECATED)\n" " -s, --show list partitions\n\n" " -b, --bytes print SIZE in bytes rather than in human readable format\n" " -g, --noheadings don't print headings for --show\n" " -P, --pairs use key=\"value\" output format\n" " -r, --raw use raw output format\n" " -t, --type specify the partition type (dos, bsd, solaris, etc.)\n" " -n, --nr specify the range of partitions (e.g. --nr 2:4)\n" " -o, --output define which output columns to use\n" " -h, --help print this help\n"), out); fputs(_("\nAvailable columns (for --show, --raw or --pairs):\n"), out); for (i = 0; i < __NCOLUMNS; i++) fprintf(out, " %10s %s\n", infos[i].name, _(infos[i].help)); fprintf(out, _("\nFor more information see partx(8).\n")); exit(out == stderr ? EXIT_FAILURE : EXIT_SUCCESS); } static void __attribute__((__noreturn__)) errx_mutually_exclusive(const char *opts) { errx(EXIT_FAILURE, _("the options %s are mutually exclusive"), opts); } int main(int argc, char **argv) { int fd, c, what = 0, lower = 0, upper = 0, rc = 0; int tt_flags = 0; char *type = NULL; char *device = NULL; /* pointer to argv[], ie: /dev/sda1 */ char *wholedisk = NULL; /* allocated, ie: /dev/sda */ dev_t disk_devno = 0, part_devno = 0; static const struct option long_opts[] = { { "bytes", no_argument, NULL, 'b' }, { "noheadings", no_argument, NULL, 'g' }, { "raw", no_argument, NULL, 'r' }, { "list", no_argument, NULL, 'l' }, { "show", no_argument, NULL, 's' }, { "add", no_argument, NULL, 'a' }, { "delete", no_argument, NULL, 'd' }, { "type", required_argument, NULL, 't' }, { "nr", required_argument, NULL, 'n' }, { "output", required_argument, NULL, 'o' }, { "pairs", no_argument, NULL, 'P' }, { "help", no_argument, NULL, 'h' }, { NULL, 0, NULL, 0 } }; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); while ((c = getopt_long(argc, argv, "abdglrsvn:t:o:Ph", long_opts, NULL)) != -1) { switch(c) { case 'a': case 'd': case 'l': case 'r': case 'P': case 's': if (what) errx_mutually_exclusive("--{add,delete,show,list,raw,pairs}"); break; } switch(c) { case 'a': what = ACT_ADD; break; case 'b': partx_flags |= FL_BYTES; break; case 'd': what = ACT_DELETE; break; case 'g': tt_flags |= TT_FL_NOHEADINGS; break; case 'l': what = ACT_LIST; break; case 'n': if (parse_range(optarg, &lower, &upper)) errx(EXIT_FAILURE, _("failed to parse --nr range")); break; case 'o': ncolumns = string_to_idarray(optarg, columns, ARRAY_SIZE(columns), column_name_to_id); if (ncolumns < 0) return EXIT_FAILURE; break; case 'P': tt_flags |= TT_FL_EXPORT; what = ACT_SHOW; break; case 'r': tt_flags |= TT_FL_RAW; what = ACT_SHOW; break; case 's': what = ACT_SHOW; break; case 't': type = optarg; break; case 'v': verbose = 1; break; case 'h': usage(stdout); case '?': default: usage(stderr); } } /* -o enables --show mode by default */ if (ncolumns && !what) what = ACT_SHOW; /* backwardly compatible default */ if (!what) what = ACT_LIST; /* --show default, could by modified by -o */ if (what == ACT_SHOW && !ncolumns) { columns[ncolumns++] = COL_PARTNO; columns[ncolumns++] = COL_START; columns[ncolumns++] = COL_END; columns[ncolumns++] = COL_SECTORS; columns[ncolumns++] = COL_SIZE; columns[ncolumns++] = COL_NAME; columns[ncolumns++] = COL_UUID; } /* * Note that 'partx /dev/sda1' == 'partx /dev/sda1 /dev/sda' * so assume that the device and/or disk are always the last * arguments to be passed to partx. */ if (optind == argc - 2) { /* passed 2 arguments: * /dev/sda1 /dev/sda : partition + whole-disk * -- /dev/sda1 : partition that should be used as a whole-disk */ device = argv[optind]; if (strcmp(device, "-") == 0) { device = NULL; wholedisk = xstrdup(argv[optind + 1]); } else { device = argv[optind]; wholedisk = xstrdup(argv[optind + 1]); } } else if (optind == argc - 1) { /* passed only one arg (ie: /dev/sda3 or /dev/sda) */ struct stat sb; device = argv[optind]; if (stat(device, &sb)) err(EXIT_FAILURE, _("%s: stat failed"), device); part_devno = sb.st_rdev; if (blkid_devno_to_wholedisk(part_devno, NULL, 0, &disk_devno) == 0 && part_devno != disk_devno) wholedisk = blkid_devno_to_devname(disk_devno); if (!wholedisk) { wholedisk = xstrdup(device); disk_devno = part_devno; device = NULL; part_devno = 0; } } else usage(stderr); if (device && (upper || lower)) errx(EXIT_FAILURE, _("--nr and are mutually exclusive")); assert(wholedisk); if (device) { /* use partno from given partition instead of --nr range, e.g: * partx -d /dev/sda3 * is the same like: * partx -d --nr 3 /dev/sda */ struct stat sb; if (!part_devno && !stat(device, &sb)) part_devno = sb.st_rdev; lower = upper = get_partno_from_device(device, part_devno); } if (verbose) printf(_("partition: %s, disk: %s, lower: %d, upper: %d\n"), device ? device : "none", wholedisk, lower, upper); if (what == ACT_ADD || what == ACT_DELETE) { struct stat x; if (stat(wholedisk, &x) || !S_ISBLK(x.st_mode)) errx(EXIT_FAILURE, _("%s: not a block device"), wholedisk); } if ((fd = open(wholedisk, O_RDONLY)) == -1) err(EXIT_FAILURE, _("%s: open failed"), wholedisk); if (what == ACT_DELETE) rc = del_parts(fd, wholedisk, disk_devno, lower, upper); else { blkid_probe pr = blkid_new_probe(); blkid_partlist ls = NULL; if (!pr || blkid_probe_set_device(pr, fd, 0, 0)) warnx(_("%s: failed to initialize blkid prober"), wholedisk); else ls = get_partlist(pr, wholedisk, type); if (ls) { int n = blkid_partlist_numof_partitions(ls); if (lower < 0) lower = n + lower + 1; if (upper < 0) upper = n + upper + 1; if (lower > upper) { warnx(_("specified range <%d:%d> " "does not make sense"), lower, upper); rc = -1, what = 0; } switch (what) { case ACT_SHOW: rc = show_parts(ls, tt_flags, lower, upper); break; case ACT_LIST: rc = list_parts(ls, lower, upper); break; case ACT_ADD: rc = add_parts(fd, wholedisk, ls, lower, upper); break; } } blkid_free_probe(pr); } close(fd); return rc ? EXIT_FAILURE : EXIT_SUCCESS; } util-linux-2.20.1/lib/0000775000076400007640000000000011647764042011502 500000000000000util-linux-2.20.1/lib/ismounted.c0000664000076400007640000002124511573627634013604 00000000000000/* * ismounted.c --- Check to see if the filesystem was mounted * * Copyright (C) 1995,1996,1997,1998,1999,2000,2008 Theodore Ts'o. * * This file may be redistributed under the terms of the GNU Public * License. */ #include #include #include #include #include #if HAVE_MNTENT_H #include #endif #include #include #include #include #ifdef __APPLE__ #include #include #endif #include "pathnames.h" #include "ismounted.h" #include "c.h" #ifdef HAVE_MNTENT_H /* * Helper function which checks a file in /etc/mtab format to see if a * filesystem is mounted. Returns an error if the file doesn't exist * or can't be opened. */ static int check_mntent_file(const char *mtab_file, const char *file, int *mount_flags, char *mtpt, int mtlen) { struct mntent *mnt; struct stat st_buf; int retval = 0; dev_t file_dev=0, file_rdev=0; ino_t file_ino=0; FILE *f; int fd; *mount_flags = 0; if ((f = setmntent (mtab_file, "r")) == NULL) return errno; if (stat(file, &st_buf) == 0) { if (S_ISBLK(st_buf.st_mode)) { #ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */ file_rdev = st_buf.st_rdev; #endif /* __GNU__ */ } else { file_dev = st_buf.st_dev; file_ino = st_buf.st_ino; } } while ((mnt = getmntent (f)) != NULL) { if (mnt->mnt_fsname[0] != '/') continue; if (strcmp(file, mnt->mnt_fsname) == 0) break; if (stat(mnt->mnt_fsname, &st_buf) == 0) { if (S_ISBLK(st_buf.st_mode)) { #ifndef __GNU__ if (file_rdev && (file_rdev == st_buf.st_rdev)) break; #endif /* __GNU__ */ } else { if (file_dev && ((file_dev == st_buf.st_dev) && (file_ino == st_buf.st_ino))) break; } } } if (mnt == 0) { #ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */ /* * Do an extra check to see if this is the root device. We * can't trust /etc/mtab, and /proc/mounts will only list * /dev/root for the root filesystem. Argh. Instead we * check if the given device has the same major/minor number * as the device that the root directory is on. */ if (file_rdev && stat("/", &st_buf) == 0 && st_buf.st_dev == file_rdev) { *mount_flags = MF_MOUNTED; if (mtpt) strncpy(mtpt, "/", mtlen); goto is_root; } #endif /* __GNU__ */ goto errout; } #ifndef __GNU__ /* The GNU hurd is deficient; what else is new? */ /* Validate the entry in case /etc/mtab is out of date */ /* * We need to be paranoid, because some broken distributions * (read: Slackware) don't initialize /etc/mtab before checking * all of the non-root filesystems on the disk. */ if (stat(mnt->mnt_dir, &st_buf) < 0) { retval = errno; if (retval == ENOENT) { #ifdef DEBUG printf("Bogus entry in %s! (%s does not exist)\n", mtab_file, mnt->mnt_dir); #endif /* DEBUG */ retval = 0; } goto errout; } if (file_rdev && (st_buf.st_dev != file_rdev)) { #ifdef DEBUG printf("Bogus entry in %s! (%s not mounted on %s)\n", mtab_file, file, mnt->mnt_dir); #endif /* DEBUG */ goto errout; } #endif /* __GNU__ */ *mount_flags = MF_MOUNTED; #ifdef MNTOPT_RO /* Check to see if the ro option is set */ if (hasmntopt(mnt, MNTOPT_RO)) *mount_flags |= MF_READONLY; #endif if (mtpt) strncpy(mtpt, mnt->mnt_dir, mtlen); /* * Check to see if we're referring to the root filesystem. * If so, do a manual check to see if we can open /etc/mtab * read/write, since if the root is mounted read/only, the * contents of /etc/mtab may not be accurate. */ if (!strcmp(mnt->mnt_dir, "/")) { is_root: #define TEST_FILE "/.ismount-test-file" *mount_flags |= MF_ISROOT; fd = open(TEST_FILE, O_RDWR|O_CREAT, 0600); if (fd < 0) { if (errno == EROFS) *mount_flags |= MF_READONLY; } else close(fd); (void) unlink(TEST_FILE); } retval = 0; errout: endmntent (f); return retval; } static int check_mntent(const char *file, int *mount_flags, char *mtpt, int mtlen) { int retval; #ifdef DEBUG retval = check_mntent_file("/tmp/mtab", file, mount_flags, mtpt, mtlen); if (retval == 0) return 0; #endif /* DEBUG */ #ifdef __linux__ retval = check_mntent_file("/proc/mounts", file, mount_flags, mtpt, mtlen); if (retval == 0 && (*mount_flags != 0)) return 0; if (access("/proc/mounts", R_OK) == 0) { *mount_flags = 0; return retval; } #endif /* __linux__ */ #if defined(MOUNTED) || defined(_PATH_MOUNTED) #ifndef MOUNTED #define MOUNTED _PATH_MOUNTED #endif /* MOUNTED */ retval = check_mntent_file(MOUNTED, file, mount_flags, mtpt, mtlen); return retval; #else *mount_flags = 0; return 0; #endif /* defined(MOUNTED) || defined(_PATH_MOUNTED) */ } #else #if defined(HAVE_GETMNTINFO) static int check_getmntinfo(const char *file, int *mount_flags, char *mtpt, int mtlen) { struct statfs *mp; int len, n; const char *s1; char *s2; n = getmntinfo(&mp, MNT_NOWAIT); if (n == 0) return errno; len = sizeof(_PATH_DEV) - 1; s1 = file; if (strncmp(_PATH_DEV, s1, len) == 0) s1 += len; *mount_flags = 0; while (--n >= 0) { s2 = mp->f_mntfromname; if (strncmp(_PATH_DEV, s2, len) == 0) { s2 += len - 1; *s2 = 'r'; } if (strcmp(s1, s2) == 0 || strcmp(s1, &s2[1]) == 0) { *mount_flags = MF_MOUNTED; break; } ++mp; } if (mtpt) strncpy(mtpt, mp->f_mntonname, mtlen); return 0; } #endif /* HAVE_GETMNTINFO */ #endif /* HAVE_MNTENT_H */ /* * Check to see if we're dealing with the swap device. */ static int is_swap_device(const char *file) { FILE *f; char buf[1024], *cp; dev_t file_dev; struct stat st_buf; int ret = 0; file_dev = 0; #ifndef __GNU__ /* The GNU hurd is broken with respect to stat devices */ if ((stat(file, &st_buf) == 0) && S_ISBLK(st_buf.st_mode)) file_dev = st_buf.st_rdev; #endif /* __GNU__ */ if (!(f = fopen("/proc/swaps", "r"))) return 0; /* Skip the first line */ if (!fgets(buf, sizeof(buf), f)) goto leave; if (*buf && strncmp(buf, "Filename\t", 9)) /* Linux <=2.6.19 contained a bug in the /proc/swaps * code where the header would not be displayed */ goto valid_first_line; while (fgets(buf, sizeof(buf), f)) { valid_first_line: if ((cp = strchr(buf, ' ')) != NULL) *cp = 0; if ((cp = strchr(buf, '\t')) != NULL) *cp = 0; if (strcmp(buf, file) == 0) { ret++; break; } #ifndef __GNU__ if (file_dev && (stat(buf, &st_buf) == 0) && S_ISBLK(st_buf.st_mode) && file_dev == st_buf.st_rdev) { ret++; break; } #endif /* __GNU__ */ } leave: fclose(f); return ret; } /* * check_mount_point() fills determines if the device is mounted or otherwise * busy, and fills in mount_flags with one or more of the following flags: * MF_MOUNTED, MF_ISROOT, MF_READONLY, MF_SWAP, and MF_BUSY. If mtpt is * non-NULL, the directory where the device is mounted is copied to where mtpt * is pointing, up to mtlen characters. */ #ifdef __TURBOC__ #pragma argsused #endif int check_mount_point(const char *device, int *mount_flags, char *mtpt, int mtlen) { struct stat st_buf; int retval = 0; int fd; if (is_swap_device(device)) { *mount_flags = MF_MOUNTED | MF_SWAP; strncpy(mtpt, "", mtlen); } else { #ifdef HAVE_MNTENT_H retval = check_mntent(device, mount_flags, mtpt, mtlen); #else #ifdef HAVE_GETMNTINFO retval = check_getmntinfo(device, mount_flags, mtpt, mtlen); #else #ifdef __GNUC__ #warning "Can't use getmntent or getmntinfo to check for mounted filesystems!" #endif *mount_flags = 0; #endif /* HAVE_GETMNTINFO */ #endif /* HAVE_MNTENT_H */ } if (retval) return retval; #ifdef __linux__ /* This only works on Linux 2.6+ systems */ if ((stat(device, &st_buf) != 0) || !S_ISBLK(st_buf.st_mode)) return 0; fd = open(device, O_RDONLY | O_EXCL); if (fd < 0) { if (errno == EBUSY) *mount_flags |= MF_BUSY; } else close(fd); #endif return 0; } int is_mounted(const char *file) { int retval; int mount_flags = 0; retval = check_mount_point(file, &mount_flags, NULL, 0); if (retval) return 0; return mount_flags & MF_MOUNTED; } #ifdef TEST_PROGRAM int main(int argc, char **argv) { int flags = 0; char devname[PATH_MAX]; if (argc < 2) { fprintf(stderr, "Usage: %s device\n", argv[0]); return EXIT_FAILURE; } if (check_mount_point(argv[1], &flags, devname, sizeof(devname)) == 0 && (flags & MF_MOUNTED)) { if (flags & MF_SWAP) printf("used swap device\n"); else printf("mounted on %s\n", devname); return EXIT_SUCCESS; } printf("not mounted\n"); return EXIT_FAILURE; } #endif /* DEBUG */ util-linux-2.20.1/lib/sysfs.c0000664000076400007640000002270011647267603012737 00000000000000/* * Copyright (C) 2011 Karel Zak */ #include "c.h" #include "at.h" #include "pathnames.h" #include "sysfs.h" char *sysfs_devno_attribute_path(dev_t devno, char *buf, size_t bufsiz, const char *attr) { int len; if (attr) len = snprintf(buf, bufsiz, _PATH_SYS_DEVBLOCK "/%d:%d/%s", major(devno), minor(devno), attr); else len = snprintf(buf, bufsiz, _PATH_SYS_DEVBLOCK "/%d:%d", major(devno), minor(devno)); return (len < 0 || (size_t) len + 1 > bufsiz) ? NULL : buf; } int sysfs_devno_has_attribute(dev_t devno, const char *attr) { char path[PATH_MAX]; struct stat info; if (!sysfs_devno_attribute_path(devno, path, sizeof(path), attr)) return 0; if (stat(path, &info) == 0) return 1; return 0; } char *sysfs_devno_path(dev_t devno, char *buf, size_t bufsiz) { return sysfs_devno_attribute_path(devno, buf, bufsiz, NULL); } dev_t sysfs_devname_to_devno(const char *name, const char *parent) { char buf[PATH_MAX], *path = NULL; dev_t dev = 0; if (strncmp("/dev/", name, 5) == 0) { /* * Read from /dev */ struct stat st; if (stat(name, &st) == 0) dev = st.st_rdev; else name += 5; /* unaccesible, or not node in /dev */ } if (!dev && parent) { /* * Create path to /sys/block///dev */ int len = snprintf(buf, sizeof(buf), _PATH_SYS_BLOCK "/%s/%s/dev", parent, name); if (len < 0 || (size_t) len + 1 > sizeof(buf)) return 0; path = buf; } else if (!dev) { /* * Create path to /sys/block//dev */ int len = snprintf(buf, sizeof(buf), _PATH_SYS_BLOCK "/%s/dev", name); if (len < 0 || (size_t) len + 1 > sizeof(buf)) return 0; path = buf; } if (path) { /* * read devno from sysfs */ FILE *f; int maj = 0, min = 0; f = fopen(path, "r"); if (!f) return 0; if (fscanf(f, "%u:%u", &maj, &min) == 2) dev = makedev(maj, min); fclose(f); } return dev; } /* * Returns devname (e.g. "/dev/sda1") for the given devno. * * Note that the @buf has to be large enough to store /sys/dev/block/ * symlinks. * * Please, use more robust blkid_devno_to_devname() in your applications. */ char *sysfs_devno_to_devpath(dev_t devno, char *buf, size_t bufsiz) { struct sysfs_cxt cxt; char *name; size_t sz; struct stat st; if (sysfs_init(&cxt, devno, NULL)) return NULL; name = sysfs_get_devname(&cxt, buf, bufsiz); sysfs_deinit(&cxt); if (!name) return NULL; sz = strlen(name); if (sz + sizeof("/dev/") > bufsiz) return NULL; /* create the final "/dev/" string */ memmove(buf + 5, name, sz + 1); memcpy(buf, "/dev/", 5); if (!stat(buf, &st) && S_ISBLK(st.st_mode) && st.st_rdev == devno) return buf; return NULL; } int sysfs_init(struct sysfs_cxt *cxt, dev_t devno, struct sysfs_cxt *parent) { char path[PATH_MAX]; int fd, rc = 0; memset(cxt, 0, sizeof(*cxt)); cxt->dir_fd = -1; if (!sysfs_devno_path(devno, path, sizeof(path))) goto err; fd = open(path, O_RDONLY); if (fd < 0) goto err; cxt->dir_path = strdup(path); if (!cxt->dir_path) goto err; cxt->devno = devno; cxt->dir_fd = fd; cxt->parent = parent; return 0; err: rc = -errno; sysfs_deinit(cxt); return rc; } void sysfs_deinit(struct sysfs_cxt *cxt) { if (!cxt) return; if (cxt->dir_fd >= 0) close(cxt->dir_fd); free(cxt->dir_path); cxt->devno = 0; cxt->dir_fd = -1; cxt->parent = NULL; cxt->dir_path = NULL; } int sysfs_stat(struct sysfs_cxt *cxt, const char *attr, struct stat *st) { int rc = fstat_at(cxt->dir_fd, cxt->dir_path, attr, st, 0); if (rc != 0 && errno == ENOENT && strncmp(attr, "queue/", 6) == 0 && cxt->parent) { /* Exception for "queue/". These attributes are available * for parental devices only */ return fstat_at(cxt->parent->dir_fd, cxt->parent->dir_path, attr, st, 0); } return rc; } int sysfs_has_attribute(struct sysfs_cxt *cxt, const char *attr) { struct stat st; return sysfs_stat(cxt, attr, &st) == 0; } static int sysfs_open(struct sysfs_cxt *cxt, const char *attr) { int fd = open_at(cxt->dir_fd, cxt->dir_path, attr, O_RDONLY); if (fd == -1 && errno == ENOENT && strncmp(attr, "queue/", 6) == 0 && cxt->parent) { /* Exception for "queue/". These attributes are available * for parental devices only */ fd = open_at(cxt->parent->dir_fd, cxt->dir_path, attr, O_RDONLY); } return fd; } ssize_t sysfs_readlink(struct sysfs_cxt *cxt, const char *attr, char *buf, size_t bufsiz) { if (attr) return readlink_at(cxt->dir_fd, cxt->dir_path, attr, buf, bufsiz); /* read /sys/dev/block/ link */ return readlink(cxt->dir_path, buf, bufsiz); } DIR *sysfs_opendir(struct sysfs_cxt *cxt, const char *attr) { DIR *dir; int fd; if (attr) fd = sysfs_open(cxt, attr); else /* request to open root of device in sysfs (/sys/block/) * -- we cannot use cxt->sysfs_fd directly, because closedir() * will close this our persistent file descriptor. */ fd = dup(cxt->dir_fd); if (fd < 0) return NULL; dir = fdopendir(fd); if (!dir) { close(fd); return NULL; } if (!attr) rewinddir(dir); return dir; } static FILE *sysfs_fopen(struct sysfs_cxt *cxt, const char *attr) { int fd = sysfs_open(cxt, attr); return fd < 0 ? NULL : fdopen(fd, "r"); } static struct dirent *xreaddir(DIR *dp) { struct dirent *d; while ((d = readdir(dp))) { if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) continue; /* blacklist here? */ break; } return d; } int sysfs_is_partition_dirent(DIR *dir, struct dirent *d, const char *parent_name) { char path[256]; #ifdef _DIRENT_HAVE_D_TYPE if (d->d_type != DT_DIR) return 0; #endif if (strncmp(parent_name, d->d_name, strlen(parent_name))) return 0; /* Cannot use /partition file, not supported on old sysfs */ snprintf(path, sizeof(path), "%s/start", d->d_name); return faccessat(dirfd(dir), path, R_OK, 0) == 0; } int sysfs_scanf(struct sysfs_cxt *cxt, const char *attr, const char *fmt, ...) { FILE *f = sysfs_fopen(cxt, attr); va_list ap; int rc; if (!f) return -EINVAL; va_start(ap, fmt); rc = vfscanf(f, fmt, ap); va_end(ap); fclose(f); return rc; } int sysfs_read_s64(struct sysfs_cxt *cxt, const char *attr, int64_t *res) { int64_t x = 0; if (sysfs_scanf(cxt, attr, "%"SCNd64, &x) == 1) { if (res) *res = x; return 0; } return -1; } int sysfs_read_u64(struct sysfs_cxt *cxt, const char *attr, uint64_t *res) { uint64_t x = 0; if (sysfs_scanf(cxt, attr, "%"SCNu64, &x) == 1) { if (res) *res = x; return 0; } return -1; } int sysfs_read_int(struct sysfs_cxt *cxt, const char *attr, int *res) { int x = 0; if (sysfs_scanf(cxt, attr, "%d", &x) == 1) { if (res) *res = x; return 0; } return -1; } char *sysfs_strdup(struct sysfs_cxt *cxt, const char *attr) { char buf[1024]; return sysfs_scanf(cxt, attr, "%1024[^\n]", buf) == 1 ? strdup(buf) : NULL; } int sysfs_count_dirents(struct sysfs_cxt *cxt, const char *attr) { DIR *dir; int r = 0; if (!(dir = sysfs_opendir(cxt, attr))) return 0; while (xreaddir(dir)) r++; closedir(dir); return r; } int sysfs_count_partitions(struct sysfs_cxt *cxt, const char *devname) { DIR *dir; struct dirent *d; int r = 0; if (!(dir = sysfs_opendir(cxt, NULL))) return 0; while ((d = xreaddir(dir))) { if (sysfs_is_partition_dirent(dir, d, devname)) r++; } closedir(dir); return r; } /* * Returns slave name if there is only one slave, otherwise returns NULL. * The result should be deallocated by free(). */ char *sysfs_get_slave(struct sysfs_cxt *cxt) { DIR *dir; struct dirent *d; char *name = NULL; if (!(dir = sysfs_opendir(cxt, "slaves"))) return NULL; while ((d = xreaddir(dir))) { if (name) goto err; /* more slaves */ name = strdup(d->d_name); } closedir(dir); return name; err: free(name); return NULL; } /* * Note that the @buf has to be large enough to store /sys/dev/block/ * symlinks. */ char *sysfs_get_devname(struct sysfs_cxt *cxt, char *buf, size_t bufsiz) { char *name = NULL; ssize_t sz; sz = sysfs_readlink(cxt, NULL, buf, bufsiz - 1); if (sz < 0) return NULL; buf[sz] = '\0'; name = strrchr(buf, '/'); if (!name) return NULL; name++; sz = strlen(name); memmove(buf, name, sz + 1); return buf; } #ifdef TEST_PROGRAM_SYSFS #include #include #include int main(int argc, char *argv[]) { struct sysfs_cxt cxt; char *devname; dev_t devno; char path[PATH_MAX]; int i; uint64_t u64; ssize_t len; if (argc != 2) errx(EXIT_FAILURE, "usage: %s ", argv[0]); devname = argv[1]; devno = sysfs_devname_to_devno(devname, NULL); if (!devno) err(EXIT_FAILURE, "failed to read devno"); printf("NAME: %s\n", devname); printf("DEVNO: %u\n", (unsigned int) devno); printf("DEVNOPATH: %s\n", sysfs_devno_path(devno, path, sizeof(path))); printf("DEVPATH: %s\n", sysfs_devno_to_devpath(devno, path, sizeof(path))); printf("PARTITION: %s\n", sysfs_devno_has_attribute(devno, "partition") ? "YES" : "NOT"); sysfs_init(&cxt, devno, NULL); len = sysfs_readlink(&cxt, NULL, path, sizeof(path) - 1); if (len > 0) { path[len] = '\0'; printf("DEVNOLINK: %s\n", path); } printf("SLAVES: %d\n", sysfs_count_dirents(&cxt, "slaves")); if (sysfs_read_u64(&cxt, "size", &u64)) printf("read SIZE failed\n"); else printf("SIZE: %jd\n", u64); if (sysfs_read_int(&cxt, "queue/hw_sector_size", &i)) printf("read SECTOR failed\n"); else printf("SECTOR: %d\n", i); printf("DEVNAME: %s\n", sysfs_get_devname(&cxt, path, sizeof(path))); sysfs_deinit(&cxt); return EXIT_SUCCESS; } #endif util-linux-2.20.1/lib/fsprobe.c0000664000076400007640000000513211640045336013216 00000000000000#include #include #include #include #include #include #include #include #include #include "blkdev.h" #include "canonicalize.h" #include "pathnames.h" #include "fsprobe.h" static blkid_cache blcache; static blkid_probe blprobe; void fsprobe_init(void) { blcache = NULL; blprobe = NULL; } void fsprobe_exit(void) { if (blprobe) blkid_free_probe(blprobe); if (blcache) blkid_put_cache(blcache); } /* * Parses NAME=value, returns -1 on parse error, 0 success. The success is also * when the 'spec' doesn't contain name=value pair (because the spec could be * a devname too). In particular case the pointer 'name' is set to NULL. */ int fsprobe_parse_spec(const char *spec, char **name, char **value) { *name = NULL; *value = NULL; if (strchr(spec, '=')) return blkid_parse_tag_string(spec, name, value); return 0; } char * fsprobe_get_devname_by_spec(const char *spec) { return blkid_evaluate_spec(spec, &blcache); } int fsprobe_known_fstype(const char *fstype) { return blkid_known_fstype(fstype); } /* returns device LABEL, UUID, FSTYPE, ... by low-level * probing interface */ static char * fsprobe_get_value(const char *name, const char *devname, int *ambi) { int fd, rc; const char *data = NULL; if (!devname || !name) return NULL; fd = open(devname, O_RDONLY); if (fd < 0) return NULL; if (!blprobe) blprobe = blkid_new_probe(); if (!blprobe) goto done; if (blkid_probe_set_device(blprobe, fd, 0, 0)) goto done; blkid_probe_enable_superblocks(blprobe, 1); blkid_probe_set_superblocks_flags(blprobe, BLKID_SUBLKS_LABEL | BLKID_SUBLKS_UUID | BLKID_SUBLKS_TYPE); rc = blkid_do_safeprobe(blprobe); if (ambi) *ambi = rc == -2 ? 1 : 0; /* ambivalent probing result */ if (!rc) blkid_probe_lookup_value(blprobe, name, &data, NULL); done: close(fd); return data ? strdup((char *) data) : NULL; } char * fsprobe_get_label_by_devname(const char *devname) { return fsprobe_get_value("LABEL", devname, NULL); } char * fsprobe_get_uuid_by_devname(const char *devname) { return fsprobe_get_value("UUID", devname, NULL); } char * fsprobe_get_fstype_by_devname(const char *devname) { return fsprobe_get_value("TYPE", devname, NULL); } char * fsprobe_get_fstype_by_devname_ambi(const char *devname, int *ambi) { return fsprobe_get_value("TYPE", devname, ambi); } char * fsprobe_get_devname_by_uuid(const char *uuid) { return blkid_evaluate_tag("UUID", uuid, &blcache); } char * fsprobe_get_devname_by_label(const char *label) { return blkid_evaluate_tag("LABEL", label, &blcache); } util-linux-2.20.1/lib/tt.c0000664000076400007640000004147411640045336012216 00000000000000/* * TT - Table or Tree, features: * - column width could be defined as absolute or relative to the terminal width * - allows to truncate or wrap data in columns * - prints tree if parent->child relation is defined * - draws the tree by ASCII or UTF8 lines (depends on terminal setting) * * Copyright (C) 2010 Karel Zak * * This file may be redistributed under the terms of the * GNU Lesser General Public License. */ #include #include #include #include #include #ifdef HAVE_SYS_IOCTL_H #include #endif #include "nls.h" #include "widechar.h" #include "c.h" #include "tt.h" #include "mbsalign.h" struct tt_symbols { const char *branch; const char *vert; const char *right; }; static const struct tt_symbols ascii_tt_symbols = { .branch = "|-", .vert = "| ", .right = "`-", }; #ifdef HAVE_WIDECHAR #define mbs_width(_s) mbstowcs(NULL, _s, 0) #define UTF_V "\342\224\202" /* U+2502, Vertical line drawing char */ #define UTF_VR "\342\224\234" /* U+251C, Vertical and right */ #define UTF_H "\342\224\200" /* U+2500, Horizontal */ #define UTF_UR "\342\224\224" /* U+2514, Up and right */ static const struct tt_symbols utf8_tt_symbols = { .branch = UTF_VR UTF_H, .vert = UTF_V " ", .right = UTF_UR UTF_H, }; #else /* !HAVE_WIDECHAR */ # define mbs_width(_s) strlen(_s) #endif /* !HAVE_WIDECHAR */ #define is_last_column(_tb, _cl) \ list_last_entry(&(_cl)->cl_columns, &(_tb)->tb_columns) /* * @flags: TT_FL_* flags (usually TT_FL_{ASCII,RAW}) * * Returns: newly allocated table */ struct tt *tt_new_table(int flags) { struct tt *tb; tb = calloc(1, sizeof(struct tt)); if (!tb) return NULL; tb->flags = flags; INIT_LIST_HEAD(&tb->tb_lines); INIT_LIST_HEAD(&tb->tb_columns); #if defined(HAVE_WIDECHAR) if (!(flags & TT_FL_ASCII) && !strcmp(nl_langinfo(CODESET), "UTF-8")) tb->symbols = &utf8_tt_symbols; else #endif tb->symbols = &ascii_tt_symbols; tb->first_run = TRUE; return tb; } void tt_remove_lines(struct tt *tb) { if (!tb) return; while (!list_empty(&tb->tb_lines)) { struct tt_line *ln = list_entry(tb->tb_lines.next, struct tt_line, ln_lines); list_del(&ln->ln_lines); free(ln->data); free(ln); } } void tt_free_table(struct tt *tb) { if (!tb) return; tt_remove_lines(tb); while (!list_empty(&tb->tb_columns)) { struct tt_column *cl = list_entry(tb->tb_columns.next, struct tt_column, cl_columns); list_del(&cl->cl_columns); free(cl); } free(tb); } /* * @tb: table * @name: column header * @whint: column width hint (absolute width: N > 1; relative width: N < 1) * @flags: usually TT_FL_{TREE,TRUNCATE} * * The column width is possible to define by three ways: * * @whint = 0..1 : relative width, percent of terminal width * * @whint = 1..N : absolute width, empty colum will be truncated to * the column header width * * @whint = 1..N * @flags = TT_FL_STRICTWIDTH * : absolute width, empty colum won't be truncated * * The column is necessary to address (for example for tt_line_set_data()) by * sequential number. The first defined column has the colnum = 0. For example: * * tt_define_column(tab, "FOO", 0.5, 0); // colnum = 0 * tt_define_column(tab, "BAR", 0.5, 0); // colnum = 1 * . * . * tt_line_set_data(line, 0, "foo-data"); // FOO column * tt_line_set_data(line, 1, "bar-data"); // BAR column * * Returns: newly allocated column definition */ struct tt_column *tt_define_column(struct tt *tb, const char *name, double whint, int flags) { struct tt_column *cl; if (!tb) return NULL; cl = calloc(1, sizeof(*cl)); if (!cl) return NULL; cl->name = name; cl->width_hint = whint; cl->flags = flags; cl->seqnum = tb->ncols++; if (flags & TT_FL_TREE) tb->flags |= TT_FL_TREE; INIT_LIST_HEAD(&cl->cl_columns); list_add_tail(&cl->cl_columns, &tb->tb_columns); return cl; } /* * @tb: table * @parent: parental line or NULL * * Returns: newly allocate line */ struct tt_line *tt_add_line(struct tt *tb, struct tt_line *parent) { struct tt_line *ln = NULL; if (!tb || !tb->ncols) goto err; ln = calloc(1, sizeof(*ln)); if (!ln) goto err; ln->data = calloc(tb->ncols, sizeof(char *)); if (!ln->data) goto err; ln->table = tb; ln->parent = parent; INIT_LIST_HEAD(&ln->ln_lines); INIT_LIST_HEAD(&ln->ln_children); INIT_LIST_HEAD(&ln->ln_branch); list_add_tail(&ln->ln_lines, &tb->tb_lines); if (parent) list_add_tail(&ln->ln_children, &parent->ln_branch); return ln; err: free(ln); return NULL; } /* * @tb: table * @colnum: number of column (0..N) * * Returns: pointer to column or NULL */ struct tt_column *tt_get_column(struct tt *tb, size_t colnum) { struct list_head *p; list_for_each(p, &tb->tb_columns) { struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); if (cl->seqnum == colnum) return cl; } return NULL; } /* * @ln: line * @colnum: number of column (0..N) * @data: printable data * * Stores data that will be printed to the table cell. */ int tt_line_set_data(struct tt_line *ln, int colnum, const char *data) { struct tt_column *cl; if (!ln) return -1; cl = tt_get_column(ln->table, colnum); if (!cl) return -1; if (ln->data[cl->seqnum]) { size_t sz = strlen(ln->data[cl->seqnum]);; ln->data_sz = ln->data_sz > sz ? ln->data_sz - sz : 0; } ln->data[cl->seqnum] = data; if (data) ln->data_sz += strlen(data); return 0; } static int get_terminal_width(void) { #ifdef TIOCGSIZE struct ttysize t_win; #endif #ifdef TIOCGWINSZ struct winsize w_win; #endif const char *cp; #ifdef TIOCGSIZE if (ioctl (0, TIOCGSIZE, &t_win) == 0) return t_win.ts_cols; #endif #ifdef TIOCGWINSZ if (ioctl (0, TIOCGWINSZ, &w_win) == 0) return w_win.ws_col; #endif cp = getenv("COLUMNS"); if (cp) return strtol(cp, NULL, 10); return 0; } int tt_line_set_userdata(struct tt_line *ln, void *data) { if (!ln) return -1; ln->userdata = data; return 0; } static char *line_get_ascii_art(struct tt_line *ln, char *buf, size_t *bufsz) { const char *art; size_t len; if (!ln->parent) return buf; buf = line_get_ascii_art(ln->parent, buf, bufsz); if (!buf) return NULL; if (list_last_entry(&ln->ln_children, &ln->parent->ln_branch)) art = " "; else art = ln->table->symbols->vert; len = strlen(art); if (*bufsz < len) return NULL; /* no space, internal error */ memcpy(buf, art, len); *bufsz -= len; return buf + len; } static char *line_get_data(struct tt_line *ln, struct tt_column *cl, char *buf, size_t bufsz) { const char *data = ln->data[cl->seqnum]; const struct tt_symbols *sym; char *p = buf; memset(buf, 0, bufsz); if (!data) return NULL; if (!(cl->flags & TT_FL_TREE)) { strncpy(buf, data, bufsz); buf[bufsz - 1] = '\0'; return buf; } if (ln->parent) { p = line_get_ascii_art(ln->parent, buf, &bufsz); if (!p) return NULL; } sym = ln->table->symbols; if (!ln->parent) snprintf(p, bufsz, "%s", data); /* root node */ else if (list_last_entry(&ln->ln_children, &ln->parent->ln_branch)) snprintf(p, bufsz, "%s%s", sym->right, data); /* last chaild */ else snprintf(p, bufsz, "%s%s", sym->branch, data); /* any child */ return buf; } static void recount_widths(struct tt *tb, char *buf, size_t bufsz) { struct list_head *p; size_t width = 0; int trunc_only; /* set width according to the size of data */ list_for_each(p, &tb->tb_columns) { struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); struct list_head *lp; list_for_each(lp, &tb->tb_lines) { struct tt_line *ln = list_entry(lp, struct tt_line, ln_lines); char *data = line_get_data(ln, cl, buf, bufsz); size_t len = data ? mbs_width(data) : 0; if (cl->width < len) cl->width = len; } } /* set minimal width (= size of column header) */ list_for_each(p, &tb->tb_columns) { struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); if (cl->name) cl->width_min = mbs_width(cl->name); if (cl->width < cl->width_min && !(cl->flags & TT_FL_STRICTWIDTH)) cl->width = cl->width_min; else if (cl->width_hint >= 1 && cl->width < (size_t) cl->width_hint && cl->width_min < (size_t) cl->width_hint) cl->width = (size_t) cl->width_hint; width += cl->width + (is_last_column(tb, cl) ? 0 : 1); } if (width == tb->termwidth) goto leave; if (width < tb->termwidth) { /* cool, use the extra space for the last column */ struct tt_column *cl = list_entry( tb->tb_columns.prev, struct tt_column, cl_columns); if (!(cl->flags & TT_FL_RIGHT) && tb->termwidth - width > 0) cl->width += tb->termwidth - width; goto leave; } /* bad, we have to reduce output width, this is done in two steps: * 1/ reduce columns with a relative width and with truncate flag * 2) reduce columns with a relative width without truncate flag */ trunc_only = 1; while(width > tb->termwidth) { size_t org = width; list_for_each(p, &tb->tb_columns) { struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); if (width <= tb->termwidth) break; if (cl->width_hint > 1 && !(cl->flags & TT_FL_TRUNC)) continue; /* never truncate columns with absolute sizes */ if (cl->flags & TT_FL_TREE) continue; /* never truncate the tree */ if (trunc_only && !(cl->flags & TT_FL_TRUNC)) continue; if (cl->width == cl->width_min) continue; /* truncate column with relative sizes */ if (cl->width_hint < 1 && cl->width > 0 && width > 0 && cl->width > cl->width_hint * tb->termwidth) { cl->width--; width--; } /* truncate column with absolute size */ if (cl->width_hint > 1 && cl->width > 0 && width > 0 && !trunc_only) { cl->width--; width--; } } if (org == width) { if (trunc_only) trunc_only = 0; else break; } } leave: /* fprintf(stderr, "terminal: %d, output: %d\n", tb->termwidth, width); list_for_each(p, &tb->tb_columns) { struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); fprintf(stderr, "width: %s=%zd [hint=%d]\n", cl->name, cl->width, cl->width_hint > 1 ? (int) cl->width_hint : (int) (cl->width_hint * tb->termwidth)); } */ return; } /* note that this function modifies @data */ static void print_data(struct tt *tb, struct tt_column *cl, char *data) { size_t len, i, width; if (!data) data = ""; /* raw mode */ if (tb->flags & TT_FL_RAW) { fputs(data, stdout); if (!is_last_column(tb, cl)) fputc(' ', stdout); return; } /* NAME=value mode */ if (tb->flags & TT_FL_EXPORT) { fprintf(stdout, "%s=\"%s\"", cl->name, data); if (!is_last_column(tb, cl)) fputc(' ', stdout); return; } /* note that 'len' and 'width' are number of cells, not bytes */ len = mbs_width(data); if (!len || len == (size_t) -1) { len = 0; data = NULL; } width = cl->width; if (is_last_column(tb, cl) && len < width) width = len; /* truncate data */ if (len > width && (cl->flags & TT_FL_TRUNC)) { if (data) len = mbs_truncate(data, &width); if (!data || len == (size_t) -1) { len = 0; data = NULL; } } if (data) { if (!(tb->flags & TT_FL_RAW) && (cl->flags & TT_FL_RIGHT)) { size_t xw = cl->width; fprintf(stdout, "%*s", (int) xw, data); if (len < xw) len = xw; } else fputs(data, stdout); } for (i = len; i < width; i++) fputc(' ', stdout); /* padding */ if (!is_last_column(tb, cl)) { if (len > width && !(cl->flags & TT_FL_TRUNC)) { fputc('\n', stdout); for (i = 0; i <= (size_t) cl->seqnum; i++) { struct tt_column *x = tt_get_column(tb, i); printf("%*s ", -((int)x->width), " "); } } else fputc(' ', stdout); /* columns separator */ } } static void print_line(struct tt_line *ln, char *buf, size_t bufsz) { struct list_head *p; /* set width according to the size of data */ list_for_each(p, &ln->table->tb_columns) { struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); print_data(ln->table, cl, line_get_data(ln, cl, buf, bufsz)); } fputc('\n', stdout); } static void print_header(struct tt *tb, char *buf, size_t bufsz) { struct list_head *p; if (!tb->first_run || (tb->flags & TT_FL_NOHEADINGS) || (tb->flags & TT_FL_EXPORT) || list_empty(&tb->tb_lines)) return; /* set width according to the size of data */ list_for_each(p, &tb->tb_columns) { struct tt_column *cl = list_entry(p, struct tt_column, cl_columns); strncpy(buf, cl->name, bufsz); buf[bufsz - 1] = '\0'; print_data(tb, cl, buf); } fputc('\n', stdout); } static void print_table(struct tt *tb, char *buf, size_t bufsz) { struct list_head *p; print_header(tb, buf, bufsz); list_for_each(p, &tb->tb_lines) { struct tt_line *ln = list_entry(p, struct tt_line, ln_lines); print_line(ln, buf, bufsz); } } static void print_tree_line(struct tt_line *ln, char *buf, size_t bufsz) { struct list_head *p; print_line(ln, buf, bufsz); if (list_empty(&ln->ln_branch)) return; /* print all children */ list_for_each(p, &ln->ln_branch) { struct tt_line *chld = list_entry(p, struct tt_line, ln_children); print_tree_line(chld, buf, bufsz); } } static void print_tree(struct tt *tb, char *buf, size_t bufsz) { struct list_head *p; print_header(tb, buf, bufsz); list_for_each(p, &tb->tb_lines) { struct tt_line *ln = list_entry(p, struct tt_line, ln_lines); if (ln->parent) continue; print_tree_line(ln, buf, bufsz); } } /* * @tb: table * * Prints the table to stdout */ int tt_print_table(struct tt *tb) { char *line; size_t line_sz; struct list_head *p; if (!tb) return -1; if (tb->first_run && !tb->termwidth) { tb->termwidth = get_terminal_width(); if (tb->termwidth <= 0) tb->termwidth = 80; } line_sz = tb->termwidth; list_for_each(p, &tb->tb_lines) { struct tt_line *ln = list_entry(p, struct tt_line, ln_lines); if (ln->data_sz > line_sz) line_sz = ln->data_sz; } line = malloc(line_sz); if (!line) return -1; if (tb->first_run && !((tb->flags & TT_FL_RAW) || (tb->flags & TT_FL_EXPORT))) recount_widths(tb, line, line_sz); if (tb->flags & TT_FL_TREE) print_tree(tb, line, line_sz); else print_table(tb, line, line_sz); free(line); tb->first_run = FALSE; return 0; } #ifdef TEST_PROGRAM #include enum { MYCOL_NAME, MYCOL_FOO, MYCOL_BAR, MYCOL_PATH }; int main(int argc, char *argv[]) { struct tt *tb; struct tt_line *ln, *pr, *root; int flags = 0, notree = 0, i; if (argc == 2 && !strcmp(argv[1], "--help")) { printf("%s [--ascii | --raw | --list]\n", program_invocation_short_name); return EXIT_SUCCESS; } else if (argc == 2 && !strcmp(argv[1], "--ascii")) { flags |= TT_FL_ASCII; } else if (argc == 2 && !strcmp(argv[1], "--raw")) { flags |= TT_FL_RAW; notree = 1; } else if (argc == 2 && !strcmp(argv[1], "--export")) { flags |= TT_FL_EXPORT; notree = 1; } else if (argc == 2 && !strcmp(argv[1], "--list")) notree = 1; setlocale(LC_ALL, ""); bindtextdomain(PACKAGE, LOCALEDIR); textdomain(PACKAGE); tb = tt_new_table(flags); if (!tb) err(EXIT_FAILURE, "table initialization failed"); tt_define_column(tb, "NAME", 0.3, notree ? 0 : TT_FL_TREE); tt_define_column(tb, "FOO", 0.3, TT_FL_TRUNC); tt_define_column(tb, "BAR", 0.3, 0); tt_define_column(tb, "PATH", 0.3, 0); for (i = 0; i < 2; i++) { root = ln = tt_add_line(tb, NULL); tt_line_set_data(ln, MYCOL_NAME, "AAA"); tt_line_set_data(ln, MYCOL_FOO, "a-foo-foo"); tt_line_set_data(ln, MYCOL_BAR, "barBar-A"); tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA"); pr = ln = tt_add_line(tb, ln); tt_line_set_data(ln, MYCOL_NAME, "AAA.A"); tt_line_set_data(ln, MYCOL_FOO, "a.a-foo-foo"); tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A"); tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A"); ln = tt_add_line(tb, pr); tt_line_set_data(ln, MYCOL_NAME, "AAA.A.AAA"); tt_line_set_data(ln, MYCOL_FOO, "a.a.a-foo-foo"); tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A.A"); tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A/AAA"); ln = tt_add_line(tb, root); tt_line_set_data(ln, MYCOL_NAME, "AAA.B"); tt_line_set_data(ln, MYCOL_FOO, "a.b-foo-foo"); tt_line_set_data(ln, MYCOL_BAR, "barBar-A.B"); tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/B"); ln = tt_add_line(tb, pr); tt_line_set_data(ln, MYCOL_NAME, "AAA.A.BBB"); tt_line_set_data(ln, MYCOL_FOO, "a.a.b-foo-foo"); tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A.BBB"); tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A/BBB"); ln = tt_add_line(tb, pr); tt_line_set_data(ln, MYCOL_NAME, "AAA.A.CCC"); tt_line_set_data(ln, MYCOL_FOO, "a.a.c-foo-foo"); tt_line_set_data(ln, MYCOL_BAR, "barBar-A.A.CCC"); tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/A/CCC"); ln = tt_add_line(tb, root); tt_line_set_data(ln, MYCOL_NAME, "AAA.C"); tt_line_set_data(ln, MYCOL_FOO, "a.c-foo-foo"); tt_line_set_data(ln, MYCOL_BAR, "barBar-A.C"); tt_line_set_data(ln, MYCOL_PATH, "/mnt/AAA/C"); } tt_print_table(tb); tt_free_table(tb); return EXIT_SUCCESS; } #endif util-linux-2.20.1/lib/setproctitle.c0000664000076400007640000000444611647007614014312 00000000000000/* proctitle code - we know this to work only on linux... */ /* ** SETPROCTITLE -- set process title for ps (from sendmail) ** ** Parameters: ** fmt -- a printf style format string. ** ** Returns: ** none. ** ** Side Effects: ** Clobbers argv of our main procedure so ps(1) will ** display the title. */ #include #include #include #include #include "setproctitle.h" #ifndef SPT_BUFSIZE #define SPT_BUFSIZE 2048 #endif extern char** environ; static char** argv0; static int argv_lth; void initproctitle (int argc, char **argv) { int i; char **envp = environ; /* * Move the environment so we can reuse the memory. * (Code borrowed from sendmail.) * WARNING: ugly assumptions on memory layout here; * if this ever causes problems, #undef DO_PS_FIDDLING */ for (i = 0; envp[i] != NULL; i++) continue; environ = (char **) malloc(sizeof(char *) * (i + 1)); if (environ == NULL) return; for (i = 0; envp[i] != NULL; i++) if ((environ[i] = strdup(envp[i])) == NULL) return; environ[i] = NULL; argv0 = argv; if (i > 0) argv_lth = envp[i-1] + strlen(envp[i-1]) - argv0[0]; else argv_lth = argv0[argc-1] + strlen(argv0[argc-1]) - argv0[0]; } #if 0 /* Nice code, but many places do not know about vsnprintf ... */ void setproctitle (const char *fmt,...) { int i; char buf[SPT_BUFSIZE]; va_list ap; if (!argv0) return; va_start(ap, fmt); (void) vsnprintf(buf, SPT_BUFSIZE, fmt, ap); va_end(ap); i = strlen (buf); if (i > argv_lth - 2) { i = argv_lth - 2; buf[i] = '\0'; } memset(argv0[0], '\0', argv_lth); /* clear the memory area */ (void) strcpy (argv0[0], buf); argv0[1] = NULL; } #else void setproctitle (const char *prog, const char *txt) { int i; char buf[SPT_BUFSIZE]; if (!argv0) return; if (strlen(prog) + strlen(txt) + 5 > SPT_BUFSIZE) return; (void) sprintf(buf, "%s -- %s", prog, txt); i = strlen (buf); if (i > argv_lth - 2) { i = argv_lth - 2; buf[i] = '\0'; } memset(argv0[0], '\0', argv_lth); /* clear the memory area */ (void) strcpy (argv0[0], buf); argv0[1] = NULL; } #endif util-linux-2.20.1/lib/strutils.c0000664000076400007640000002251311647210633013452 00000000000000/* * Copyright (C) 2010 Karel Zak * Copyright (C) 2010 Davidlohr Bueso */ #include #include #include #include #include #include #include #include #include "c.h" #include "strutils.h" #include "bitops.h" static int do_scale_by_power (uintmax_t *x, int base, int power) { while (power--) { if (UINTMAX_MAX / base < *x) return -2; *x *= base; } return 0; } /* * strtosize() - convert string to size (uintmax_t). * * Supported suffixes: * * XiB or X for 2^N * where X = {K,M,G,T,P,E,Y,Z} * or X = {k,m,g,t,p,e} (undocumented for backward compatibility only) * for example: * 10KiB = 10240 * 10K = 10240 * * XB for 10^N * where X = {K,M,G,T,P,E,Y,Z} * for example: * 10KB = 10000 * * Note that the function does not accept numbers with '-' (negative sign) * prefix. */ int strtosize(const char *str, uintmax_t *res) { char *p; uintmax_t x; int base = 1024, rc = 0; *res = 0; if (!str || !*str) goto err; /* Only positive numbers are acceptable * * Note that this check is not perfect, it would be better to * use lconv->negative_sign. But coreutils use the same solution, * so it's probably good enough... */ p = (char *) str; while (isspace((unsigned char) *p)) p++; if (*p == '-') goto err; p = NULL; errno = 0; x = strtoumax(str, &p, 0); if (p == str || (errno != 0 && (x == UINTMAX_MAX || x == 0))) goto err; if (!p || !*p) goto done; /* without suffix */ /* * Check size suffixes */ if (*(p + 1) == 'i' && *(p + 2) == 'B' && !*(p + 3)) base = 1024; /* XiB, 2^N */ else if (*(p + 1) == 'B' && !*(p + 2)) base = 1000; /* XB, 10^N */ else if (*(p + 1)) goto err; /* unexpected suffix */ switch(*p) { case 'K': case 'k': rc = do_scale_by_power(&x, base, 1); break; case 'M': case 'm': rc = do_scale_by_power(&x, base, 2); break; case 'G': case 'g': rc = do_scale_by_power(&x, base, 3); break; case 'T': case 't': rc = do_scale_by_power(&x, base, 4); break; case 'P': case 'p': rc = do_scale_by_power(&x, base, 5); break; case 'E': case 'e': rc = do_scale_by_power(&x, base, 6); break; case 'Z': rc = do_scale_by_power(&x, base, 7); break; case 'Y': rc = do_scale_by_power(&x, base, 8); break; default: goto err; } done: *res = x; return rc; err: return -1; } #ifndef HAVE_STRNLEN size_t strnlen(const char *s, size_t maxlen) { int i; for (i = 0; i < maxlen; i++) { if (s[i] == '\0') return i + 1; } return maxlen; } #endif #ifndef HAVE_STRNCHR char *strnchr(const char *s, size_t maxlen, int c) { for (; maxlen-- && *s != '\0'; ++s) if (*s == (char)c) return (char *)s; return NULL; } #endif #ifndef HAVE_STRNDUP char *strndup(const char *s, size_t n) { size_t len = strnlen(s, n); char *new = (char *) malloc((len + 1) * sizeof(char)); if (!new) return NULL; new[len] = '\0'; return (char *) memcpy(new, s, len); } #endif /* * same as strtol(3) but exit on failure instead of returning crap */ long strtol_or_err(const char *str, const char *errmesg) { long num; char *end = NULL; if (str == NULL || *str == '\0') goto err; errno = 0; num = strtol(str, &end, 10); if (errno || str == end || (end && *end)) goto err; return num; err: if (errno) err(EXIT_FAILURE, "%s: '%s'", errmesg, str); else errx(EXIT_FAILURE, "%s: '%s'", errmesg, str); return 0; } /* * same as strtoll(3) but exit on failure instead of returning crap */ long long strtoll_or_err(const char *str, const char *errmesg) { long long num; char *end = NULL; if (str == NULL || *str == '\0') goto err; errno = 0; num = strtoll(str, &end, 10); if (errno || str == end || (end && *end)) goto err; return num; err: if (errno) err(EXIT_FAILURE, "%s: '%s'", errmesg, str); else errx(EXIT_FAILURE, "%s: '%s'", errmesg, str); return 0; } /* * same as strtoul(3) but exit on failure instead of returning crap */ unsigned long strtoul_or_err(const char *str, const char *errmesg) { unsigned long num; char *end = NULL; if (str == NULL || *str == '\0') goto err; errno = 0; num = strtoul(str, &end, 10); if (errno || str == end || (end && *end)) goto err; return num; err: if (errno) err(EXIT_FAILURE, "%s: '%s'", errmesg, str); else errx(EXIT_FAILURE, "%s: '%s'", errmesg, str); return 0; } /* * Converts stat->st_mode to ls(1)-like mode string. The size of "str" must * be 10 bytes. */ void strmode(mode_t mode, char *str) { if (S_ISDIR(mode)) str[0] = 'd'; else if (S_ISLNK(mode)) str[0] = 'l'; else if (S_ISCHR(mode)) str[0] = 'c'; else if (S_ISBLK(mode)) str[0] = 'b'; else if (S_ISSOCK(mode)) str[0] = 's'; else if (S_ISFIFO(mode)) str[0] = 'p'; else if (S_ISREG(mode)) str[0] = '-'; str[1] = mode & S_IRUSR ? 'r' : '-'; str[2] = mode & S_IWUSR ? 'w' : '-'; str[3] = (mode & S_ISUID ? (mode & S_IXUSR ? 's' : 'S') : (mode & S_IXUSR ? 'x' : '-')); str[4] = mode & S_IRGRP ? 'r' : '-'; str[5] = mode & S_IWGRP ? 'w' : '-'; str[6] = (mode & S_ISGID ? (mode & S_IXGRP ? 's' : 'S') : (mode & S_IXGRP ? 'x' : '-')); str[7] = mode & S_IROTH ? 'r' : '-'; str[8] = mode & S_IWOTH ? 'w' : '-'; str[9] = (mode & S_ISVTX ? (mode & S_IXOTH ? 't' : 'T') : (mode & S_IXOTH ? 'x' : '-')); str[10] = '\0'; } /* * returns exponent (2^x=n) in range KiB..PiB */ static int get_exp(uint64_t n) { int shft; for (shft = 10; shft <= 60; shft += 10) { if (n < (1ULL << shft)) break; } return shft - 10; } char *size_to_human_string(int options, uint64_t bytes) { char buf[32]; int dec, exp; uint64_t frac; const char *letters = "BKMGTPE"; char suffix[sizeof(" KiB")], *psuf = suffix; char c; if (options & SIZE_SUFFIX_SPACE) *psuf++ = ' '; exp = get_exp(bytes); c = *(letters + (exp ? exp / 10 : 0)); dec = exp ? bytes / (1ULL << exp) : bytes; frac = exp ? bytes % (1ULL << exp) : 0; *psuf++ = c; if ((options & SIZE_SUFFIX_3LETTER) && (c != 'B')) { *psuf++ = 'i'; *psuf++ = 'B'; } *psuf = '\0'; /* fprintf(stderr, "exp: %d, unit: %c, dec: %d, frac: %jd\n", * exp, suffix[0], dec, frac); */ if (frac) { /* round */ frac = (frac / (1ULL << (exp - 10)) + 50) / 100; if (frac == 10) dec++, frac = 0; } if (frac) { struct lconv const *l = localeconv(); char *dp = l ? l->decimal_point : NULL; if (!dp || !*dp) dp = "."; snprintf(buf, sizeof(buf), "%d%s%jd%s", dec, dp, frac, suffix); } else snprintf(buf, sizeof(buf), "%d%s", dec, suffix); return strdup(buf); } /* * Parses comma delimited list to array with IDs, for example: * * "aaa,bbb,ccc" --> ary[0] = FOO_AAA; * ary[1] = FOO_BBB; * ary[3] = FOO_CCC; * * The function name2id() provides conversion from string to ID. * * Returns: >= 0 : number of items added to ary[] * -1 : parse error or unknown item * -2 : arysz reached */ int string_to_idarray(const char *list, int ary[], size_t arysz, int (name2id)(const char *, size_t)) { const char *begin = NULL, *p; size_t n = 0; if (!list || !*list || !ary || !arysz || !name2id) return -1; for (p = list; p && *p; p++) { const char *end = NULL; int id; if (!begin) begin = p; /* begin of the column name */ if (*p == ',') end = p; /* terminate the name */ if (*(p + 1) == '\0') end = p + 1; /* end of string */ if (!begin || !end) continue; if (end <= begin) return -1; id = name2id(begin, end - begin); if (id == -1) return -1; ary[ n++ ] = id; if (n >= arysz) return -2; begin = NULL; if (end && !*end) break; } return n; } /* * LIST ::= [, ] * * The is translated to 'id' by name2id() function and the 'id' is used * as a possition in the 'ary' bit array. It means that the 'id' has to be in * range <0..N> where N < sizeof(ary) * NBBY. * * Returns: 0 on sucess, <0 on error. */ int string_to_bitarray(const char *list, char *ary, int (*name2bit)(const char *, size_t)) { const char *begin = NULL, *p; if (!list || !name2bit || !ary) return -EINVAL; for (p = list; p && *p; p++) { const char *end = NULL; int bit; if (!begin) begin = p; /* begin of the level name */ if (*p == ',') end = p; /* terminate the name */ if (*(p + 1) == '\0') end = p + 1; /* end of string */ if (!begin || !end) continue; if (end <= begin) return -1; bit = name2bit(begin, end - begin); if (bit < 0) return bit; setbit(ary, bit); begin = NULL; if (end && !*end) break; } return 0; } #ifdef TEST_PROGRAM int main(int argc, char *argv[]) { uintmax_t size = 0; char *hum, *hum2; if (argc < 2) { fprintf(stderr, "usage: %s [suffix]\n", argv[0]); exit(EXIT_FAILURE); } if (strtosize(argv[1], &size)) errx(EXIT_FAILURE, "invalid size '%s' value", argv[1]); hum = size_to_human_string(SIZE_SUFFIX_1LETTER, size); hum2 = size_to_human_string(SIZE_SUFFIX_3LETTER | SIZE_SUFFIX_SPACE, size); printf("%25s : %20ju : %8s : %12s\n", argv[1], size, hum, hum2); free(hum); free(hum2); return EXIT_FAILURE; } #endif /* TEST_PROGRAM */ util-linux-2.20.1/lib/canonicalize.c0000664000076400007640000001101311640045336014210 00000000000000/* * canonicalize.c -- canonicalize pathname by removing symlinks * Copyright (C) 1993 Rick Sladkey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library Public License for more details. * */ /* * This routine is part of libc. We include it nevertheless, * since the libc version has some security flaws. * * TODO: use canonicalize_file_name() when exist in glibc */ #include #include #include #include #include #include #include "canonicalize.h" #ifndef MAXSYMLINKS # define MAXSYMLINKS 256 #endif static char * myrealpath(const char *path, char *resolved_path, int maxreslth) { int readlinks = 0; char *npath; char link_path[PATH_MAX+1]; int n; char *buf = NULL; npath = resolved_path; /* If it's a relative pathname use getcwd for starters. */ if (*path != '/') { if (!getcwd(npath, maxreslth-2)) return NULL; npath += strlen(npath); if (npath[-1] != '/') *npath++ = '/'; } else { *npath++ = '/'; path++; } /* Expand each slash-separated pathname component. */ while (*path != '\0') { /* Ignore stray "/" */ if (*path == '/') { path++; continue; } if (*path == '.' && (path[1] == '\0' || path[1] == '/')) { /* Ignore "." */ path++; continue; } if (*path == '.' && path[1] == '.' && (path[2] == '\0' || path[2] == '/')) { /* Backup for ".." */ path += 2; while (npath > resolved_path+1 && (--npath)[-1] != '/') ; continue; } /* Safely copy the next pathname component. */ while (*path != '\0' && *path != '/') { if (npath-resolved_path > maxreslth-2) { errno = ENAMETOOLONG; goto err; } *npath++ = *path++; } /* Protect against infinite loops. */ if (readlinks++ > MAXSYMLINKS) { errno = ELOOP; goto err; } /* See if last pathname component is a symlink. */ *npath = '\0'; n = readlink(resolved_path, link_path, PATH_MAX); if (n < 0) { /* EINVAL means the file exists but isn't a symlink. */ if (errno != EINVAL) goto err; } else { int m; char *newbuf; /* Note: readlink doesn't add the null byte. */ link_path[n] = '\0'; if (*link_path == '/') /* Start over for an absolute symlink. */ npath = resolved_path; else /* Otherwise back up over this component. */ while (*(--npath) != '/') ; /* Insert symlink contents into path. */ m = strlen(path); newbuf = malloc(m + n + 1); if (!newbuf) goto err; memcpy(newbuf, link_path, n); memcpy(newbuf + n, path, m + 1); free(buf); path = buf = newbuf; } *npath++ = '/'; } /* Delete trailing slash but don't whomp a lone slash. */ if (npath != resolved_path+1 && npath[-1] == '/') npath--; /* Make sure it's null terminated. */ *npath = '\0'; free(buf); return resolved_path; err: free(buf); return NULL; } /* * Converts private "dm-N" names to "/dev/mapper/" * * Since 2.6.29 (patch 784aae735d9b0bba3f8b9faef4c8b30df3bf0128) kernel sysfs * provides the real DM device names in /sys/block//dm/name */ char * canonicalize_dm_name(const char *ptname) { FILE *f; size_t sz; char path[256], name[256], *res = NULL; snprintf(path, sizeof(path), "/sys/block/%s/dm/name", ptname); if (!(f = fopen(path, "r"))) return NULL; /* read "\n" from sysfs */ if (fgets(name, sizeof(name), f) && (sz = strlen(name)) > 1) { name[sz - 1] = '\0'; snprintf(path, sizeof(path), "/dev/mapper/%s", name); res = strdup(path); } fclose(f); return res; } char * canonicalize_path(const char *path) { char canonical[PATH_MAX+2]; char *p; if (path == NULL) return NULL; if (!myrealpath(path, canonical, PATH_MAX+1)) return strdup(path); p = strrchr(canonical, '/'); if (p && strncmp(p, "/dm-", 4) == 0 && isdigit(*(p + 4))) { p = canonicalize_dm_name(p+1); if (p) return p; } return strdup(canonical); } #ifdef TEST_PROGRAM_CANONICALIZE int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "usage: %s \n", argv[0]); exit(EXIT_FAILURE); } fprintf(stdout, "orig: %s\n", argv[1]); fprintf(stdout, "real: %s\n", canonicalize_path(argv[1])); exit(EXIT_SUCCESS); } #endif util-linux-2.20.1/lib/cpuset.c0000664000076400007640000001715211647210633013067 00000000000000/* * Terminology: * * cpuset - (libc) cpu_set_t data structure represents set of CPUs * cpumask - string with hex mask (e.g. "0x00000001") * cpulist - string with CPU ranges (e.g. "0-3,5,7,8") * * Based on code from taskset.c and Linux kernel. * * Copyright (C) 2010 Karel Zak */ #include #include #include #include #include #include #include #include #include "cpuset.h" #include "c.h" static inline int val_to_char(int v) { if (v >= 0 && v < 10) return '0' + v; else if (v >= 10 && v < 16) return ('a' - 10) + v; else return -1; } static inline int char_to_val(int c) { int cl; cl = tolower(c); if (c >= '0' && c <= '9') return c - '0'; else if (cl >= 'a' && cl <= 'f') return cl + (10 - 'a'); else return -1; } static const char *nexttoken(const char *q, int sep) { if (q) q = strchr(q, sep); if (q) q++; return q; } /* * Number of bits in a CPU bitmask on current system */ int get_max_number_of_cpus(void) { int n, cpus = 2048; size_t setsize; cpu_set_t *set = cpuset_alloc(cpus, &setsize, NULL); if (!set) return -1; /* error */ for (;;) { CPU_ZERO_S(setsize, set); /* the library version does not return size of cpumask_t */ n = syscall(SYS_sched_getaffinity, 0, setsize, set); if (n < 0 && errno == EINVAL && cpus < 1024 * 1024) { cpuset_free(set); cpus *= 2; set = cpuset_alloc(cpus, &setsize, NULL); if (!set) return -1; /* error */ continue; } cpuset_free(set); return n * 8; } return -1; } /* * Allocates a new set for ncpus and returns size in bytes and size in bits */ cpu_set_t *cpuset_alloc(int ncpus, size_t *setsize, size_t *nbits) { cpu_set_t *set = CPU_ALLOC(ncpus); if (!set) return NULL; if (setsize) *setsize = CPU_ALLOC_SIZE(ncpus); if (nbits) *nbits = cpuset_nbits(CPU_ALLOC_SIZE(ncpus)); return set; } void cpuset_free(cpu_set_t *set) { CPU_FREE(set); } #if !HAVE_DECL_CPU_ALLOC /* Please, use CPU_COUNT_S() macro. This is fallback */ int __cpuset_count_s(size_t setsize, const cpu_set_t *set) { int s = 0; const __cpu_mask *p = set->__bits; const __cpu_mask *end = &set->__bits[setsize / sizeof (__cpu_mask)]; while (p < end) { __cpu_mask l = *p++; if (l == 0) continue; # if LONG_BIT > 32 l = (l & 0x5555555555555555ul) + ((l >> 1) & 0x5555555555555555ul); l = (l & 0x3333333333333333ul) + ((l >> 2) & 0x3333333333333333ul); l = (l & 0x0f0f0f0f0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0f0f0f0f0ful); l = (l & 0x00ff00ff00ff00fful) + ((l >> 8) & 0x00ff00ff00ff00fful); l = (l & 0x0000ffff0000fffful) + ((l >> 16) & 0x0000ffff0000fffful); l = (l & 0x00000000fffffffful) + ((l >> 32) & 0x00000000fffffffful); # else l = (l & 0x55555555ul) + ((l >> 1) & 0x55555555ul); l = (l & 0x33333333ul) + ((l >> 2) & 0x33333333ul); l = (l & 0x0f0f0f0ful) + ((l >> 4) & 0x0f0f0f0ful); l = (l & 0x00ff00fful) + ((l >> 8) & 0x00ff00fful); l = (l & 0x0000fffful) + ((l >> 16) & 0x0000fffful); # endif s += l; } return s; } #endif /* * Returns human readable representation of the cpuset. The output format is * a list of CPUs with ranges (for example, "0,1,3-9"). */ char *cpulist_create(char *str, size_t len, cpu_set_t *set, size_t setsize) { size_t i; char *ptr = str; int entry_made = 0; size_t max = cpuset_nbits(setsize); for (i = 0; i < max; i++) { if (CPU_ISSET_S(i, setsize, set)) { int rlen; size_t j, run = 0; entry_made = 1; for (j = i + 1; j < max; j++) { if (CPU_ISSET_S(j, setsize, set)) run++; else break; } if (!run) rlen = snprintf(ptr, len, "%zd,", i); else if (run == 1) { rlen = snprintf(ptr, len, "%zd,%zd,", i, i + 1); i++; } else { rlen = snprintf(ptr, len, "%zd-%zd,", i, i + run); i += run; } if (rlen < 0 || (size_t) rlen + 1 > len) return NULL; ptr += rlen; if (rlen > 0 && len > (size_t) rlen) len -= rlen; else len = 0; } } ptr -= entry_made; *ptr = '\0'; return str; } /* * Returns string with CPU mask. */ char *cpumask_create(char *str, size_t len, cpu_set_t *set, size_t setsize) { char *ptr = str; char *ret = NULL; int cpu; for (cpu = cpuset_nbits(setsize) - 4; cpu >= 0; cpu -= 4) { char val = 0; if (len == (size_t) (ptr - str)) break; if (CPU_ISSET_S(cpu, setsize, set)) val |= 1; if (CPU_ISSET_S(cpu + 1, setsize, set)) val |= 2; if (CPU_ISSET_S(cpu + 2, setsize, set)) val |= 4; if (CPU_ISSET_S(cpu + 3, setsize, set)) val |= 8; if (!ret && val) ret = ptr; *ptr++ = val_to_char(val); } *ptr = '\0'; return ret ? ret : ptr - 1; } /* * Parses string with list of CPU ranges. */ int cpumask_parse(const char *str, cpu_set_t *set, size_t setsize) { int len = strlen(str); const char *ptr = str + len - 1; int cpu = 0; /* skip 0x, it's all hex anyway */ if (len > 1 && !memcmp(str, "0x", 2L)) str += 2; CPU_ZERO_S(setsize, set); while (ptr >= str) { char val; /* cpu masks in /sys uses comma as a separator */ if (*ptr == ',') ptr--; val = char_to_val(*ptr); if (val == (char) -1) return -1; if (val & 1) CPU_SET_S(cpu, setsize, set); if (val & 2) CPU_SET_S(cpu + 1, setsize, set); if (val & 4) CPU_SET_S(cpu + 2, setsize, set); if (val & 8) CPU_SET_S(cpu + 3, setsize, set); len--; ptr--; cpu += 4; } return 0; } /* * Parses string with CPUs mask. */ int cpulist_parse(const char *str, cpu_set_t *set, size_t setsize) { const char *p, *q; q = str; CPU_ZERO_S(setsize, set); while (p = q, q = nexttoken(q, ','), p) { unsigned int a; /* beginning of range */ unsigned int b; /* end of range */ unsigned int s; /* stride */ const char *c1, *c2; if (sscanf(p, "%u", &a) < 1) return 1; b = a; s = 1; c1 = nexttoken(p, '-'); c2 = nexttoken(p, ','); if (c1 != NULL && (c2 == NULL || c1 < c2)) { if (sscanf(c1, "%u", &b) < 1) return 1; c1 = nexttoken(c1, ':'); if (c1 != NULL && (c2 == NULL || c1 < c2)) if (sscanf(c1, "%u", &s) < 1) { return 1; } } if (!(a <= b)) return 1; while (a <= b) { CPU_SET_S(a, setsize, set); a += s; } } return 0; } #ifdef TEST_PROGRAM #include int main(int argc, char *argv[]) { cpu_set_t *set; size_t setsize, buflen, nbits; char *buf, *mask = NULL, *range = NULL; int ncpus = 2048, rc, c; static const struct option longopts[] = { { "ncpus", 1, 0, 'n' }, { "mask", 1, 0, 'm' }, { "range", 1, 0, 'r' }, { NULL, 0, 0, 0 } }; while ((c = getopt_long(argc, argv, "n:m:r:", longopts, NULL)) != -1) { switch(c) { case 'n': ncpus = atoi(optarg); break; case 'm': mask = strdup(optarg); break; case 'r': range = strdup(optarg); break; default: goto usage_err; } } if (!mask && !range) goto usage_err; set = cpuset_alloc(ncpus, &setsize, &nbits); if (!set) err(EXIT_FAILURE, "failed to allocate cpu set"); /* fprintf(stderr, "ncpus: %d, cpuset bits: %zd, cpuset bytes: %zd\n", ncpus, nbits, setsize); */ buflen = 7 * nbits; buf = malloc(buflen); if (!buf) err(EXIT_FAILURE, "failed to allocate cpu set buffer"); if (mask) rc = cpumask_parse(mask, set, setsize); else rc = cpulist_parse(range, set, setsize); if (rc) errx(EXIT_FAILURE, "failed to parse string: %s", mask ? : range); printf("%-15s = %15s ", mask ? : range, cpumask_create(buf, buflen, set, setsize)); printf("[%s]\n", cpulist_create(buf, buflen, set, setsize)); free(buf); free(range); cpuset_free(set); return EXIT_SUCCESS; usage_err: fprintf(stderr, "usage: %s [--ncpus ] --mask | --range ", program_invocation_short_name); exit(EXIT_FAILURE); } #endif util-linux-2.20.1/lib/Makefile.am0000664000076400007640000000216611640045336013452 00000000000000include $(top_srcdir)/config/include-Makefile.am AM_CPPFLAGS += -DTEST_PROGRAM noinst_PROGRAMS = test_blkdev test_ismounted test_wholedisk test_mangle \ test_tt test_canonicalize test_strutils test_procutils \ test_at if LINUX if HAVE_CPU_SET_T noinst_PROGRAMS += test_cpuset endif noinst_PROGRAMS += test_sysfs test_loopdev endif test_blkdev_SOURCES = blkdev.c test_ismounted_SOURCES = ismounted.c test_wholedisk_SOURCES = wholedisk.c test_mangle_SOURCES = mangle.c test_at_SOURCES = at.c test_at_CFLAGS = -DTEST_PROGRAM_AT test_strutils_SOURCES = strutils.c test_procutils_SOURCES = procutils.c if LINUX test_cpuset_SOURCES = cpuset.c test_sysfs_SOURCES = sysfs.c at.c test_sysfs_CFLAGS = -DTEST_PROGRAM_SYSFS test_loopdev_SOURCES = loopdev.c \ $(test_sysfs_SOURCES) \ $(top_srcdir)/lib/linux_version.c \ $(top_srcdir)/lib/canonicalize.c test_loopdev_CFLAGS = -DTEST_PROGRAM_LOOPDEV endif test_tt_SOURCES = tt.c $(top_srcdir)/lib/mbsalign.c test_canonicalize_SOURCES = canonicalize.c test_canonicalize_CFLAGS = -DTEST_PROGRAM_CANONICALIZE if LINUX test_blkdev_SOURCES += linux_version.c endif util-linux-2.20.1/lib/procutils.c0000664000076400007640000000503311640045336013602 00000000000000/* * Copyright (C) 2011 Davidlohr Bueso * * procutils.c: General purpose procfs parsing utilities * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Library Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Library Public License for more details. */ #include #include #include #include #include #include #include #include "procutils.h" #include "c.h" /* * @pid: process ID for which we want to obtain the threads group * * Returns: newly allocated tasks structure */ struct proc_tasks *proc_open_tasks(pid_t pid) { struct proc_tasks *tasks; char path[PATH_MAX]; sprintf(path, "/proc/%d/task/", pid); tasks = malloc(sizeof(struct proc_tasks)); if (tasks) { tasks->dir = opendir(path); if (tasks->dir) return tasks; } free(tasks); return NULL; } /* * @tasks: allocated tasks structure * * Returns: nothing */ void proc_close_tasks(struct proc_tasks *tasks) { if (tasks && tasks->dir) closedir(tasks->dir); free(tasks); } /* * @tasks: allocated task structure * @tid: [output] one of the thread IDs belonging to the thread group * If when an error occurs, it is set to 0. * * Returns: 0 on success, 1 on end, -1 on failure or no more threads */ int proc_next_tid(struct proc_tasks *tasks, pid_t *tid) { struct dirent *d; char *end; if (!tasks || !tid) return -1; *tid = 0; errno = 0; do { d = readdir(tasks->dir); if (!d) return errno ? -1 : 1; /* error or end-of-dir */ if (!isdigit((unsigned char) *d->d_name)) continue; *tid = (pid_t) strtol(d->d_name, &end, 10); if (errno || d->d_name == end || (end && *end)) return -1; } while (!*tid); return 0; } #ifdef TEST_PROGRAM int main(int argc, char *argv[]) { pid_t tid, pid; struct proc_tasks *ts; if (argc != 2) { fprintf(stderr, "usage: %s \n", argv[0]); return EXIT_FAILURE; } pid = strtol(argv[1], (char **) NULL, 10); printf("PID=%d, TIDs:", pid); ts = proc_open_tasks(pid); if (!ts) err(EXIT_FAILURE, "open list of tasks failed"); while (proc_next_tid(ts, &tid) == 0) printf(" %d", tid); printf("\n"); proc_close_tasks(ts); return EXIT_SUCCESS; } #endif /* TEST_PROGRAM */ util-linux-2.20.1/lib/Makefile.in0000664000076400007640000013043311647756711013477 00000000000000# Makefile.in generated by automake 1.11.1 from Makefile.am. # @configure_input@ # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, # 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, # Inc. # This Makefile.in is free software; the Free Software Foundation # gives unlimited permission to copy and/or distribute it, # with or without modifications, as long as this notice is preserved. # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY, to the extent permitted by law; without # even the implied warranty of MERCHANTABILITY or FITNESS FOR A # PARTICULAR PURPOSE. @SET_MAKE@ VPATH = @srcdir@ pkgdatadir = $(datadir)/@PACKAGE@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ pkglibexecdir = $(libexecdir)/@PACKAGE@ am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c install_sh_SCRIPT = $(install_sh) -c INSTALL_HEADER = $(INSTALL_DATA) transform = $(program_transform_name) NORMAL_INSTALL = : PRE_INSTALL = : POST_INSTALL = : NORMAL_UNINSTALL = : PRE_UNINSTALL = : POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ DIST_COMMON = $(dist_noinst_DATA) $(srcdir)/Makefile.am \ $(srcdir)/Makefile.in $(top_srcdir)/config/include-Makefile.am noinst_PROGRAMS = test_blkdev$(EXEEXT) test_ismounted$(EXEEXT) \ test_wholedisk$(EXEEXT) test_mangle$(EXEEXT) test_tt$(EXEEXT) \ test_canonicalize$(EXEEXT) test_strutils$(EXEEXT) \ test_procutils$(EXEEXT) test_at$(EXEEXT) $(am__EXEEXT_1) \ $(am__EXEEXT_2) @HAVE_CPU_SET_T_TRUE@@LINUX_TRUE@am__append_1 = test_cpuset @LINUX_TRUE@am__append_2 = test_sysfs test_loopdev @LINUX_TRUE@am__append_3 = linux_version.c subdir = lib ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/m4/gettext.m4 \ $(top_srcdir)/m4/gtk-doc.m4 $(top_srcdir)/m4/iconv.m4 \ $(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \ $(top_srcdir)/m4/lib-prefix.m4 $(top_srcdir)/m4/libtool.m4 \ $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \ $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \ $(top_srcdir)/m4/nls.m4 $(top_srcdir)/m4/po.m4 \ $(top_srcdir)/m4/progtest.m4 $(top_srcdir)/m4/tls.m4 \ $(top_srcdir)/configure.ac am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ $(ACLOCAL_M4) mkinstalldirs = $(SHELL) $(top_srcdir)/config/mkinstalldirs CONFIG_HEADER = $(top_builddir)/config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = @HAVE_CPU_SET_T_TRUE@@LINUX_TRUE@am__EXEEXT_1 = test_cpuset$(EXEEXT) @LINUX_TRUE@am__EXEEXT_2 = test_sysfs$(EXEEXT) test_loopdev$(EXEEXT) PROGRAMS = $(noinst_PROGRAMS) am_test_at_OBJECTS = test_at-at.$(OBJEXT) test_at_OBJECTS = $(am_test_at_OBJECTS) test_at_LDADD = $(LDADD) AM_V_lt = $(am__v_lt_$(V)) am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) am__v_lt_0 = --silent test_at_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_at_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am__test_blkdev_SOURCES_DIST = blkdev.c linux_version.c @LINUX_TRUE@am__objects_1 = linux_version.$(OBJEXT) am_test_blkdev_OBJECTS = blkdev.$(OBJEXT) $(am__objects_1) test_blkdev_OBJECTS = $(am_test_blkdev_OBJECTS) test_blkdev_LDADD = $(LDADD) am_test_canonicalize_OBJECTS = \ test_canonicalize-canonicalize.$(OBJEXT) test_canonicalize_OBJECTS = $(am_test_canonicalize_OBJECTS) test_canonicalize_LDADD = $(LDADD) test_canonicalize_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ $(test_canonicalize_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \ -o $@ am__test_cpuset_SOURCES_DIST = cpuset.c @LINUX_TRUE@am_test_cpuset_OBJECTS = cpuset.$(OBJEXT) test_cpuset_OBJECTS = $(am_test_cpuset_OBJECTS) test_cpuset_LDADD = $(LDADD) am_test_ismounted_OBJECTS = ismounted.$(OBJEXT) test_ismounted_OBJECTS = $(am_test_ismounted_OBJECTS) test_ismounted_LDADD = $(LDADD) am__test_loopdev_SOURCES_DIST = loopdev.c sysfs.c at.c \ $(top_srcdir)/lib/linux_version.c \ $(top_srcdir)/lib/canonicalize.c @LINUX_TRUE@am__objects_2 = test_loopdev-sysfs.$(OBJEXT) \ @LINUX_TRUE@ test_loopdev-at.$(OBJEXT) @LINUX_TRUE@am_test_loopdev_OBJECTS = test_loopdev-loopdev.$(OBJEXT) \ @LINUX_TRUE@ $(am__objects_2) \ @LINUX_TRUE@ test_loopdev-linux_version.$(OBJEXT) \ @LINUX_TRUE@ test_loopdev-canonicalize.$(OBJEXT) test_loopdev_OBJECTS = $(am_test_loopdev_OBJECTS) test_loopdev_LDADD = $(LDADD) test_loopdev_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_loopdev_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_test_mangle_OBJECTS = mangle.$(OBJEXT) test_mangle_OBJECTS = $(am_test_mangle_OBJECTS) test_mangle_LDADD = $(LDADD) am_test_procutils_OBJECTS = procutils.$(OBJEXT) test_procutils_OBJECTS = $(am_test_procutils_OBJECTS) test_procutils_LDADD = $(LDADD) am_test_strutils_OBJECTS = strutils.$(OBJEXT) test_strutils_OBJECTS = $(am_test_strutils_OBJECTS) test_strutils_LDADD = $(LDADD) am__test_sysfs_SOURCES_DIST = sysfs.c at.c @LINUX_TRUE@am_test_sysfs_OBJECTS = test_sysfs-sysfs.$(OBJEXT) \ @LINUX_TRUE@ test_sysfs-at.$(OBJEXT) test_sysfs_OBJECTS = $(am_test_sysfs_OBJECTS) test_sysfs_LDADD = $(LDADD) test_sysfs_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(test_sysfs_CFLAGS) \ $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@ am_test_tt_OBJECTS = tt.$(OBJEXT) mbsalign.$(OBJEXT) test_tt_OBJECTS = $(am_test_tt_OBJECTS) test_tt_LDADD = $(LDADD) am_test_wholedisk_OBJECTS = wholedisk.$(OBJEXT) test_wholedisk_OBJECTS = $(am_test_wholedisk_OBJECTS) test_wholedisk_LDADD = $(LDADD) DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) depcomp = $(SHELL) $(top_srcdir)/config/depcomp am__depfiles_maybe = depfiles am__mv = mv -f COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ $(AM_CFLAGS) $(CFLAGS) AM_V_CC = $(am__v_CC_$(V)) am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ CCLD = $(CC) LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ $(AM_LDFLAGS) $(LDFLAGS) -o $@ AM_V_CCLD = $(am__v_CCLD_$(V)) am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) am__v_CCLD_0 = @echo " CCLD " $@; AM_V_GEN = $(am__v_GEN_$(V)) am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) am__v_GEN_0 = @echo " GEN " $@; SOURCES = $(test_at_SOURCES) $(test_blkdev_SOURCES) \ $(test_canonicalize_SOURCES) $(test_cpuset_SOURCES) \ $(test_ismounted_SOURCES) $(test_loopdev_SOURCES) \ $(test_mangle_SOURCES) $(test_procutils_SOURCES) \ $(test_strutils_SOURCES) $(test_sysfs_SOURCES) \ $(test_tt_SOURCES) $(test_wholedisk_SOURCES) DIST_SOURCES = $(test_at_SOURCES) $(am__test_blkdev_SOURCES_DIST) \ $(test_canonicalize_SOURCES) $(am__test_cpuset_SOURCES_DIST) \ $(test_ismounted_SOURCES) $(am__test_loopdev_SOURCES_DIST) \ $(test_mangle_SOURCES) $(test_procutils_SOURCES) \ $(test_strutils_SOURCES) $(am__test_sysfs_SOURCES_DIST) \ $(test_tt_SOURCES) $(test_wholedisk_SOURCES) DATA = $(dist_noinst_DATA) ETAGS = etags CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) ACLOCAL = @ACLOCAL@ AMTAR = @AMTAR@ AM_DEFAULT_VERBOSITY = @AM_DEFAULT_VERBOSITY@ AR = @AR@ AUTOCONF = @AUTOCONF@ AUTOHEADER = @AUTOHEADER@ AUTOMAKE = @AUTOMAKE@ AWK = @AWK@ CC = @CC@ CCDEPMODE = @CCDEPMODE@ CFLAGS = @CFLAGS@ CPP = @CPP@ CPPFLAGS = @CPPFLAGS@ CYGPATH_W = @CYGPATH_W@ DEFS = @DEFS@ DEPDIR = @DEPDIR@ DLLTOOL = @DLLTOOL@ DSYMUTIL = @DSYMUTIL@ DUMPBIN = @DUMPBIN@ ECHO_C = @ECHO_C@ ECHO_N = @ECHO_N@ ECHO_T = @ECHO_T@ EGREP = @EGREP@ EXEEXT = @EXEEXT@ FGREP = @FGREP@ GMSGFMT = @GMSGFMT@ GREP = @GREP@ GTKDOC_CHECK = @GTKDOC_CHECK@ HTML_DIR = @HTML_DIR@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ INTLLIBS = @INTLLIBS@ LD = @LD@ LDFLAGS = @LDFLAGS@ LIBBLKID_DATE = @LIBBLKID_DATE@ LIBBLKID_VERSION = @LIBBLKID_VERSION@ LIBBLKID_VERSION_INFO = @LIBBLKID_VERSION_INFO@ LIBICONV = @LIBICONV@ LIBINTL = @LIBINTL@ LIBMOUNT_VERSION = @LIBMOUNT_VERSION@ LIBMOUNT_VERSION_INFO = @LIBMOUNT_VERSION_INFO@ LIBOBJS = @LIBOBJS@ LIBS = @LIBS@ LIBTOOL = @LIBTOOL@ LIBUUID_VERSION = @LIBUUID_VERSION@ LIBUUID_VERSION_INFO = @LIBUUID_VERSION_INFO@ LIPO = @LIPO@ LN_S = @LN_S@ LTLIBICONV = @LTLIBICONV@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ MAKEINFO = @MAKEINFO@ MANIFEST_TOOL = @MANIFEST_TOOL@ MKDIR_P = @MKDIR_P@ MKINSTALLDIRS = @MKINSTALLDIRS@ MSGFMT = @MSGFMT@ MSGMERGE = @MSGMERGE@ NCURSES_LIBS = @NCURSES_LIBS@ NM = @NM@ NMEDIT = @NMEDIT@ OBJDUMP = @OBJDUMP@ OBJEXT = @OBJEXT@ OTOOL = @OTOOL@ OTOOL64 = @OTOOL64@ PACKAGE = @PACKAGE@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ PACKAGE_NAME = @PACKAGE_NAME@ PACKAGE_STRING = @PACKAGE_STRING@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_URL = @PACKAGE_URL@ PACKAGE_VERSION = @PACKAGE_VERSION@ PATH_SEPARATOR = @PATH_SEPARATOR@ PERL = @PERL@ PKG_CONFIG = @PKG_CONFIG@ PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ POSUB = @POSUB@ RANLIB = @RANLIB@ SED = @SED@ SELINUX_LIBS = @SELINUX_LIBS@ SELINUX_LIBS_STATIC = @SELINUX_LIBS_STATIC@ SET_MAKE = @SET_MAKE@ SHELL = @SHELL@ SOCKET_LIBS = @SOCKET_LIBS@ STRIP = @STRIP@ SUID_CFLAGS = @SUID_CFLAGS@ SUID_LDFLAGS = @SUID_LDFLAGS@ USE_NLS = @USE_NLS@ VERSION = @VERSION@ XGETTEXT = @XGETTEXT@ XSLTPROC = @XSLTPROC@ abs_builddir = @abs_builddir@ abs_srcdir = @abs_srcdir@ abs_top_builddir = @abs_top_builddir@ abs_top_srcdir = @abs_top_srcdir@ ac_ct_AR = @ac_ct_AR@ ac_ct_CC = @ac_ct_CC@ ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ am__include = @am__include@ am__leading_dot = @am__leading_dot@ am__quote = @am__quote@ am__tar = @am__tar@ am__untar = @am__untar@ bindir = @bindir@ build = @build@ build_alias = @build_alias@ build_cpu = @build_cpu@ build_os = @build_os@ build_vendor = @build_vendor@ builddir = @builddir@ datadir = @datadir@ datarootdir = @datarootdir@ docdir = @docdir@ dvidir = @dvidir@ exec_prefix = @exec_prefix@ host = @host@ host_alias = @host_alias@ host_cpu = @host_cpu@ host_os = @host_os@ host_vendor = @host_vendor@ htmldir = @htmldir@ includedir = @includedir@ infodir = @infodir@ install_sh = @install_sh@ libdir = @libdir@ libdirname = @libdirname@ libexecdir = @libexecdir@ localedir = @localedir@ localstatedir = @localstatedir@ mandir = @mandir@ mkdir_p = @mkdir_p@ oldincludedir = @oldincludedir@ pdfdir = @pdfdir@ prefix = @prefix@ program_transform_name = @program_transform_name@ psdir = @psdir@ sbindir = @sbindir@ sharedstatedir = @sharedstatedir@ srcdir = @srcdir@ sysconfdir = @sysconfdir@ target_alias = @target_alias@ top_build_prefix = @top_build_prefix@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ usrbin_execdir = @usrbin_execdir@ usrlib_execdir = @usrlib_execdir@ usrsbin_execdir = @usrsbin_execdir@ AM_CPPFLAGS = -include $(top_builddir)/config.h \ -I$(top_srcdir)/include -DLOCALEDIR=\"$(localedir)\" \ -DTEST_PROGRAM AM_CFLAGS = -fsigned-char AM_LDFLAGS = # Automake (at least up to 1.10) mishandles dist_man_MANS inside conditionals. # Unlike with other dist primaries, the files are not distributed if the # conditional is false. # Work the bug around until it is fixed: dist_noinst_DATA = $(dist_man_MANS) # Paths to in-tree libraries (use ul_ prefix to avoid possible collisions) # # blkid ul_libblkid_srcdir = $(top_srcdir)/libblkid/src ul_libblkid_builddir = $(top_builddir)/libblkid/src ul_libblkid_la = $(top_builddir)/libblkid/src/libblkid.la # blkid.h is generated by ./configure script and stored in build directory ul_libblkid_incdir = $(ul_libblkid_builddir) # uuid ul_libuuid_srcdir = $(top_srcdir)/libuuid/src ul_libuuid_builddir = $(top_builddir)/libuuid/src ul_libuuid_la = $(top_builddir)/libuuid/src/libuuid.la # mount ul_libmount_srcdir = $(top_srcdir)/libmount/src ul_libmount_builddir = $(top_builddir)/libmount/src ul_libmount_la = $(top_builddir)/libmount/src/libmount.la # libmount.h is generated by ./configure script and stored in build directory ul_libmount_incdir = $(ul_libmount_builddir) test_blkdev_SOURCES = blkdev.c $(am__append_3) test_ismounted_SOURCES = ismounted.c test_wholedisk_SOURCES = wholedisk.c test_mangle_SOURCES = mangle.c test_at_SOURCES = at.c test_at_CFLAGS = -DTEST_PROGRAM_AT test_strutils_SOURCES = strutils.c test_procutils_SOURCES = procutils.c @LINUX_TRUE@test_cpuset_SOURCES = cpuset.c @LINUX_TRUE@test_sysfs_SOURCES = sysfs.c at.c @LINUX_TRUE@test_sysfs_CFLAGS = -DTEST_PROGRAM_SYSFS @LINUX_TRUE@test_loopdev_SOURCES = loopdev.c \ @LINUX_TRUE@ $(test_sysfs_SOURCES) \ @LINUX_TRUE@ $(top_srcdir)/lib/linux_version.c \ @LINUX_TRUE@ $(top_srcdir)/lib/canonicalize.c @LINUX_TRUE@test_loopdev_CFLAGS = -DTEST_PROGRAM_LOOPDEV test_tt_SOURCES = tt.c $(top_srcdir)/lib/mbsalign.c test_canonicalize_SOURCES = canonicalize.c test_canonicalize_CFLAGS = -DTEST_PROGRAM_CANONICALIZE all: all-am .SUFFIXES: .SUFFIXES: .c .lo .o .obj $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/config/include-Makefile.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ && { if test -f $@; then exit 0; else break; fi; }; \ exit 1;; \ esac; \ done; \ echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign lib/Makefile'; \ $(am__cd) $(top_srcdir) && \ $(AUTOMAKE) --foreign lib/Makefile .PRECIOUS: Makefile Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status @case '$?' in \ *config.status*) \ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ *) \ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ esac; $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(top_srcdir)/configure: $(am__configure_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(ACLOCAL_M4): $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): clean-noinstPROGRAMS: @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \ echo " rm -f" $$list; \ rm -f $$list || exit $$?; \ test -n "$(EXEEXT)" || exit 0; \ list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ echo " rm -f" $$list; \ rm -f $$list test_at$(EXEEXT): $(test_at_OBJECTS) $(test_at_DEPENDENCIES) @rm -f test_at$(EXEEXT) $(AM_V_CCLD)$(test_at_LINK) $(test_at_OBJECTS) $(test_at_LDADD) $(LIBS) test_blkdev$(EXEEXT): $(test_blkdev_OBJECTS) $(test_blkdev_DEPENDENCIES) @rm -f test_blkdev$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_blkdev_OBJECTS) $(test_blkdev_LDADD) $(LIBS) test_canonicalize$(EXEEXT): $(test_canonicalize_OBJECTS) $(test_canonicalize_DEPENDENCIES) @rm -f test_canonicalize$(EXEEXT) $(AM_V_CCLD)$(test_canonicalize_LINK) $(test_canonicalize_OBJECTS) $(test_canonicalize_LDADD) $(LIBS) test_cpuset$(EXEEXT): $(test_cpuset_OBJECTS) $(test_cpuset_DEPENDENCIES) @rm -f test_cpuset$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_cpuset_OBJECTS) $(test_cpuset_LDADD) $(LIBS) test_ismounted$(EXEEXT): $(test_ismounted_OBJECTS) $(test_ismounted_DEPENDENCIES) @rm -f test_ismounted$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_ismounted_OBJECTS) $(test_ismounted_LDADD) $(LIBS) test_loopdev$(EXEEXT): $(test_loopdev_OBJECTS) $(test_loopdev_DEPENDENCIES) @rm -f test_loopdev$(EXEEXT) $(AM_V_CCLD)$(test_loopdev_LINK) $(test_loopdev_OBJECTS) $(test_loopdev_LDADD) $(LIBS) test_mangle$(EXEEXT): $(test_mangle_OBJECTS) $(test_mangle_DEPENDENCIES) @rm -f test_mangle$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_mangle_OBJECTS) $(test_mangle_LDADD) $(LIBS) test_procutils$(EXEEXT): $(test_procutils_OBJECTS) $(test_procutils_DEPENDENCIES) @rm -f test_procutils$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_procutils_OBJECTS) $(test_procutils_LDADD) $(LIBS) test_strutils$(EXEEXT): $(test_strutils_OBJECTS) $(test_strutils_DEPENDENCIES) @rm -f test_strutils$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_strutils_OBJECTS) $(test_strutils_LDADD) $(LIBS) test_sysfs$(EXEEXT): $(test_sysfs_OBJECTS) $(test_sysfs_DEPENDENCIES) @rm -f test_sysfs$(EXEEXT) $(AM_V_CCLD)$(test_sysfs_LINK) $(test_sysfs_OBJECTS) $(test_sysfs_LDADD) $(LIBS) test_tt$(EXEEXT): $(test_tt_OBJECTS) $(test_tt_DEPENDENCIES) @rm -f test_tt$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_tt_OBJECTS) $(test_tt_LDADD) $(LIBS) test_wholedisk$(EXEEXT): $(test_wholedisk_OBJECTS) $(test_wholedisk_DEPENDENCIES) @rm -f test_wholedisk$(EXEEXT) $(AM_V_CCLD)$(LINK) $(test_wholedisk_OBJECTS) $(test_wholedisk_LDADD) $(LIBS) mostlyclean-compile: -rm -f *.$(OBJEXT) distclean-compile: -rm -f *.tab.c @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/blkdev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/cpuset.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ismounted.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/linux_version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mangle.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mbsalign.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/procutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/strutils.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_at-at.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_canonicalize-canonicalize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loopdev-at.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loopdev-canonicalize.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loopdev-linux_version.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loopdev-loopdev.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_loopdev-sysfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sysfs-at.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/test_sysfs-sysfs.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tt.Po@am__quote@ @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/wholedisk.Po@am__quote@ .c.o: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c $< .c.obj: @am__fastdepCC_TRUE@ $(AM_V_CC)$(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` .c.lo: @am__fastdepCC_TRUE@ $(AM_V_CC)$(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< test_at-at.o: at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_at_CFLAGS) $(CFLAGS) -MT test_at-at.o -MD -MP -MF $(DEPDIR)/test_at-at.Tpo -c -o test_at-at.o `test -f 'at.c' || echo '$(srcdir)/'`at.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_at-at.Tpo $(DEPDIR)/test_at-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='at.c' object='test_at-at.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_at_CFLAGS) $(CFLAGS) -c -o test_at-at.o `test -f 'at.c' || echo '$(srcdir)/'`at.c test_at-at.obj: at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_at_CFLAGS) $(CFLAGS) -MT test_at-at.obj -MD -MP -MF $(DEPDIR)/test_at-at.Tpo -c -o test_at-at.obj `if test -f 'at.c'; then $(CYGPATH_W) 'at.c'; else $(CYGPATH_W) '$(srcdir)/at.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_at-at.Tpo $(DEPDIR)/test_at-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='at.c' object='test_at-at.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_at_CFLAGS) $(CFLAGS) -c -o test_at-at.obj `if test -f 'at.c'; then $(CYGPATH_W) 'at.c'; else $(CYGPATH_W) '$(srcdir)/at.c'; fi` test_canonicalize-canonicalize.o: canonicalize.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_canonicalize_CFLAGS) $(CFLAGS) -MT test_canonicalize-canonicalize.o -MD -MP -MF $(DEPDIR)/test_canonicalize-canonicalize.Tpo -c -o test_canonicalize-canonicalize.o `test -f 'canonicalize.c' || echo '$(srcdir)/'`canonicalize.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_canonicalize-canonicalize.Tpo $(DEPDIR)/test_canonicalize-canonicalize.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='canonicalize.c' object='test_canonicalize-canonicalize.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_canonicalize_CFLAGS) $(CFLAGS) -c -o test_canonicalize-canonicalize.o `test -f 'canonicalize.c' || echo '$(srcdir)/'`canonicalize.c test_canonicalize-canonicalize.obj: canonicalize.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_canonicalize_CFLAGS) $(CFLAGS) -MT test_canonicalize-canonicalize.obj -MD -MP -MF $(DEPDIR)/test_canonicalize-canonicalize.Tpo -c -o test_canonicalize-canonicalize.obj `if test -f 'canonicalize.c'; then $(CYGPATH_W) 'canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/canonicalize.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_canonicalize-canonicalize.Tpo $(DEPDIR)/test_canonicalize-canonicalize.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='canonicalize.c' object='test_canonicalize-canonicalize.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_canonicalize_CFLAGS) $(CFLAGS) -c -o test_canonicalize-canonicalize.obj `if test -f 'canonicalize.c'; then $(CYGPATH_W) 'canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/canonicalize.c'; fi` test_loopdev-loopdev.o: loopdev.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-loopdev.o -MD -MP -MF $(DEPDIR)/test_loopdev-loopdev.Tpo -c -o test_loopdev-loopdev.o `test -f 'loopdev.c' || echo '$(srcdir)/'`loopdev.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-loopdev.Tpo $(DEPDIR)/test_loopdev-loopdev.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loopdev.c' object='test_loopdev-loopdev.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-loopdev.o `test -f 'loopdev.c' || echo '$(srcdir)/'`loopdev.c test_loopdev-loopdev.obj: loopdev.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-loopdev.obj -MD -MP -MF $(DEPDIR)/test_loopdev-loopdev.Tpo -c -o test_loopdev-loopdev.obj `if test -f 'loopdev.c'; then $(CYGPATH_W) 'loopdev.c'; else $(CYGPATH_W) '$(srcdir)/loopdev.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-loopdev.Tpo $(DEPDIR)/test_loopdev-loopdev.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='loopdev.c' object='test_loopdev-loopdev.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-loopdev.obj `if test -f 'loopdev.c'; then $(CYGPATH_W) 'loopdev.c'; else $(CYGPATH_W) '$(srcdir)/loopdev.c'; fi` test_loopdev-sysfs.o: sysfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-sysfs.o -MD -MP -MF $(DEPDIR)/test_loopdev-sysfs.Tpo -c -o test_loopdev-sysfs.o `test -f 'sysfs.c' || echo '$(srcdir)/'`sysfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-sysfs.Tpo $(DEPDIR)/test_loopdev-sysfs.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sysfs.c' object='test_loopdev-sysfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-sysfs.o `test -f 'sysfs.c' || echo '$(srcdir)/'`sysfs.c test_loopdev-sysfs.obj: sysfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-sysfs.obj -MD -MP -MF $(DEPDIR)/test_loopdev-sysfs.Tpo -c -o test_loopdev-sysfs.obj `if test -f 'sysfs.c'; then $(CYGPATH_W) 'sysfs.c'; else $(CYGPATH_W) '$(srcdir)/sysfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-sysfs.Tpo $(DEPDIR)/test_loopdev-sysfs.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sysfs.c' object='test_loopdev-sysfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-sysfs.obj `if test -f 'sysfs.c'; then $(CYGPATH_W) 'sysfs.c'; else $(CYGPATH_W) '$(srcdir)/sysfs.c'; fi` test_loopdev-at.o: at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-at.o -MD -MP -MF $(DEPDIR)/test_loopdev-at.Tpo -c -o test_loopdev-at.o `test -f 'at.c' || echo '$(srcdir)/'`at.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-at.Tpo $(DEPDIR)/test_loopdev-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='at.c' object='test_loopdev-at.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-at.o `test -f 'at.c' || echo '$(srcdir)/'`at.c test_loopdev-at.obj: at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-at.obj -MD -MP -MF $(DEPDIR)/test_loopdev-at.Tpo -c -o test_loopdev-at.obj `if test -f 'at.c'; then $(CYGPATH_W) 'at.c'; else $(CYGPATH_W) '$(srcdir)/at.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-at.Tpo $(DEPDIR)/test_loopdev-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='at.c' object='test_loopdev-at.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-at.obj `if test -f 'at.c'; then $(CYGPATH_W) 'at.c'; else $(CYGPATH_W) '$(srcdir)/at.c'; fi` test_loopdev-linux_version.o: $(top_srcdir)/lib/linux_version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-linux_version.o -MD -MP -MF $(DEPDIR)/test_loopdev-linux_version.Tpo -c -o test_loopdev-linux_version.o `test -f '$(top_srcdir)/lib/linux_version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/linux_version.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-linux_version.Tpo $(DEPDIR)/test_loopdev-linux_version.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/linux_version.c' object='test_loopdev-linux_version.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-linux_version.o `test -f '$(top_srcdir)/lib/linux_version.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/linux_version.c test_loopdev-linux_version.obj: $(top_srcdir)/lib/linux_version.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-linux_version.obj -MD -MP -MF $(DEPDIR)/test_loopdev-linux_version.Tpo -c -o test_loopdev-linux_version.obj `if test -f '$(top_srcdir)/lib/linux_version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/linux_version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/linux_version.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-linux_version.Tpo $(DEPDIR)/test_loopdev-linux_version.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/linux_version.c' object='test_loopdev-linux_version.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-linux_version.obj `if test -f '$(top_srcdir)/lib/linux_version.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/linux_version.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/linux_version.c'; fi` test_loopdev-canonicalize.o: $(top_srcdir)/lib/canonicalize.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-canonicalize.o -MD -MP -MF $(DEPDIR)/test_loopdev-canonicalize.Tpo -c -o test_loopdev-canonicalize.o `test -f '$(top_srcdir)/lib/canonicalize.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/canonicalize.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-canonicalize.Tpo $(DEPDIR)/test_loopdev-canonicalize.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/canonicalize.c' object='test_loopdev-canonicalize.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-canonicalize.o `test -f '$(top_srcdir)/lib/canonicalize.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/canonicalize.c test_loopdev-canonicalize.obj: $(top_srcdir)/lib/canonicalize.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -MT test_loopdev-canonicalize.obj -MD -MP -MF $(DEPDIR)/test_loopdev-canonicalize.Tpo -c -o test_loopdev-canonicalize.obj `if test -f '$(top_srcdir)/lib/canonicalize.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/canonicalize.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_loopdev-canonicalize.Tpo $(DEPDIR)/test_loopdev-canonicalize.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/canonicalize.c' object='test_loopdev-canonicalize.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_loopdev_CFLAGS) $(CFLAGS) -c -o test_loopdev-canonicalize.obj `if test -f '$(top_srcdir)/lib/canonicalize.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/canonicalize.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/canonicalize.c'; fi` test_sysfs-sysfs.o: sysfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -MT test_sysfs-sysfs.o -MD -MP -MF $(DEPDIR)/test_sysfs-sysfs.Tpo -c -o test_sysfs-sysfs.o `test -f 'sysfs.c' || echo '$(srcdir)/'`sysfs.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sysfs-sysfs.Tpo $(DEPDIR)/test_sysfs-sysfs.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sysfs.c' object='test_sysfs-sysfs.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -c -o test_sysfs-sysfs.o `test -f 'sysfs.c' || echo '$(srcdir)/'`sysfs.c test_sysfs-sysfs.obj: sysfs.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -MT test_sysfs-sysfs.obj -MD -MP -MF $(DEPDIR)/test_sysfs-sysfs.Tpo -c -o test_sysfs-sysfs.obj `if test -f 'sysfs.c'; then $(CYGPATH_W) 'sysfs.c'; else $(CYGPATH_W) '$(srcdir)/sysfs.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sysfs-sysfs.Tpo $(DEPDIR)/test_sysfs-sysfs.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='sysfs.c' object='test_sysfs-sysfs.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -c -o test_sysfs-sysfs.obj `if test -f 'sysfs.c'; then $(CYGPATH_W) 'sysfs.c'; else $(CYGPATH_W) '$(srcdir)/sysfs.c'; fi` test_sysfs-at.o: at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -MT test_sysfs-at.o -MD -MP -MF $(DEPDIR)/test_sysfs-at.Tpo -c -o test_sysfs-at.o `test -f 'at.c' || echo '$(srcdir)/'`at.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sysfs-at.Tpo $(DEPDIR)/test_sysfs-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='at.c' object='test_sysfs-at.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -c -o test_sysfs-at.o `test -f 'at.c' || echo '$(srcdir)/'`at.c test_sysfs-at.obj: at.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -MT test_sysfs-at.obj -MD -MP -MF $(DEPDIR)/test_sysfs-at.Tpo -c -o test_sysfs-at.obj `if test -f 'at.c'; then $(CYGPATH_W) 'at.c'; else $(CYGPATH_W) '$(srcdir)/at.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/test_sysfs-at.Tpo $(DEPDIR)/test_sysfs-at.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='at.c' object='test_sysfs-at.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(test_sysfs_CFLAGS) $(CFLAGS) -c -o test_sysfs-at.obj `if test -f 'at.c'; then $(CYGPATH_W) 'at.c'; else $(CYGPATH_W) '$(srcdir)/at.c'; fi` mbsalign.o: $(top_srcdir)/lib/mbsalign.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mbsalign.o -MD -MP -MF $(DEPDIR)/mbsalign.Tpo -c -o mbsalign.o `test -f '$(top_srcdir)/lib/mbsalign.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/mbsalign.c @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mbsalign.Tpo $(DEPDIR)/mbsalign.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/mbsalign.c' object='mbsalign.o' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mbsalign.o `test -f '$(top_srcdir)/lib/mbsalign.c' || echo '$(srcdir)/'`$(top_srcdir)/lib/mbsalign.c mbsalign.obj: $(top_srcdir)/lib/mbsalign.c @am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT mbsalign.obj -MD -MP -MF $(DEPDIR)/mbsalign.Tpo -c -o mbsalign.obj `if test -f '$(top_srcdir)/lib/mbsalign.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/mbsalign.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/mbsalign.c'; fi` @am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/mbsalign.Tpo $(DEPDIR)/mbsalign.Po @am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$(top_srcdir)/lib/mbsalign.c' object='mbsalign.obj' libtool=no @AMDEPBACKSLASH@ @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mbsalign.obj `if test -f '$(top_srcdir)/lib/mbsalign.c'; then $(CYGPATH_W) '$(top_srcdir)/lib/mbsalign.c'; else $(CYGPATH_W) '$(srcdir)/$(top_srcdir)/lib/mbsalign.c'; fi` mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ mkid -fID $$unique tags: TAGS TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) set x; \ here=`pwd`; \ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ shift; \ if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ test -n "$$unique" || unique=$$empty_fix; \ if test $$# -gt 0; then \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ "$$@" $$unique; \ else \ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ $$unique; \ fi; \ fi ctags: CTAGS CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ $(TAGS_FILES) $(LISP) list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ unique=`for i in $$list; do \ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ done | \ $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ END { if (nonempty) { for (i in files) print i; }; }'`; \ test -z "$(CTAGS_ARGS)$$unique" \ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ $$unique GTAGS: here=`$(am__cd) $(top_builddir) && pwd` \ && $(am__cd) $(top_srcdir) \ && gtags -i $(GTAGS_ARGS) "$$here" distclean-tags: -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ list='$(DISTFILES)'; \ dist_files=`for file in $$list; do echo $$file; done | \ sed -e "s|^$$srcdirstrip/||;t" \ -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ case $$dist_files in \ */*) $(MKDIR_P) `echo "$$dist_files" | \ sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ sort -u` ;; \ esac; \ for file in $$dist_files; do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ if test -d $$d/$$file; then \ dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ if test -d "$(distdir)/$$file"; then \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ fi; \ cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ else \ test -f "$(distdir)/$$file" \ || cp -p $$d/$$file "$(distdir)/$$file" \ || exit 1; \ fi; \ done check-am: all-am check: check-am all-am: Makefile $(PROGRAMS) $(DATA) installdirs: install: install-am install-exec: install-exec-am install-data: install-data-am uninstall: uninstall-am install-am: all-am @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am installcheck: installcheck-am install-strip: $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ `test -z '$(STRIP)' || \ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install mostlyclean-generic: clean-generic: distclean-generic: -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) maintainer-clean-generic: @echo "This command is intended for maintainers to use" @echo "it deletes files that may require special tools to rebuild." clean: clean-am clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \ mostlyclean-am distclean: distclean-am -rm -rf ./$(DEPDIR) -rm -f Makefile distclean-am: clean-am distclean-compile distclean-generic \ distclean-tags dvi: dvi-am dvi-am: html: html-am html-am: info: info-am info-am: install-data-am: install-dvi: install-dvi-am install-dvi-am: install-exec-am: install-html: install-html-am install-html-am: install-info: install-info-am install-info-am: install-man: install-pdf: install-pdf-am install-pdf-am: install-ps: install-ps-am install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am mostlyclean-am: mostlyclean-compile mostlyclean-generic \ mostlyclean-libtool pdf: pdf-am pdf-am: ps: ps-am ps-am: uninstall-am: .MAKE: install-am install-strip .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ clean-libtool clean-noinstPROGRAMS ctags distclean \ distclean-compile distclean-generic distclean-libtool \ distclean-tags distdir dvi dvi-am html html-am info info-am \ install install-am install-data install-data-am install-dvi \ install-dvi-am install-exec install-exec-am install-html \ install-html-am install-info install-info-am install-man \ install-pdf install-pdf-am install-ps install-ps-am \ install-strip installcheck installcheck-am installdirs \ maintainer-clean maintainer-clean-generic mostlyclean \ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ pdf pdf-am ps ps-am tags uninstall uninstall-am $(ul_libblkid_la): $(MAKE) -C $(ul_libblkid_builddir) $(ul_libuuid_la): $(MAKE) -C $(ul_libuuid_builddir) $(ul_libmount_la): $(MAKE) -C $(ul_libmount_builddir) # Tell versions [3.59,3.63) of GNU make to not export all variables. # Otherwise a system limit (for SysV at least) may be exceeded. .NOEXPORT: util-linux-2.20.1/lib/loopdev.c0000664000076400007640000005552111647267603013247 00000000000000/* * Copyright (C) 2011 Karel Zak * * -- based on mount/losetup.c * * Simple library for work with loop devices. * * - requires kernel 2.6.x * - reads info from /sys/block/loop/loop/ (new kernels) * - reads info by ioctl * - supports *unlimited* number of loop devices * - supports /dev/loop as well as /dev/loop/ * - minimize overhead (fd, loopinfo, ... are shared for all operations) * - setup (associate device and backing file) * - delete (dis-associate file) * - old LOOP_{SET,GET}_STATUS (32bit) ioctls are unsupported * - extendible */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "linux_version.h" #include "c.h" #include "sysfs.h" #include "pathnames.h" #include "loopdev.h" #include "canonicalize.h" #define loopcxt_ioctl_enabled(_lc) (!((_lc)->flags & LOOPDEV_FL_NOIOCTL)) /* * @lc: context * @device: device name, absolute device path or NULL to reset the current setting * * Sets device, absolute paths (e.g. "/dev/loop") are unchanged, device * names ("loop") are converted to the path (/dev/loop or to * /dev/loop/) * * Returns: <0 on error, 0 on success */ int loopcxt_set_device(struct loopdev_cxt *lc, const char *device) { if (!lc) return -EINVAL; if (lc->fd >= 0) close(lc->fd); lc->fd = -1; lc->mode = 0; lc->has_info = 0; *lc->device = '\0'; memset(&lc->info, 0, sizeof(lc->info)); /* set new */ if (device) { if (*device != '/') { const char *dir = _PATH_DEV; /* compose device name for /dev/loop or /dev/loop/ */ if (lc->flags & LOOPDEV_FL_DEVSUBDIR) { if (strlen(device) < 5) return -1; device += 4; dir = _PATH_DEV_LOOP "/"; /* _PATH_DEV uses tailing slash */ } snprintf(lc->device, sizeof(lc->device), "%s%s", dir, device); } else { strncpy(lc->device, device, sizeof(lc->device)); lc->device[sizeof(lc->device) - 1] = '\0'; } } sysfs_deinit(&lc->sysfs); return 0; } /* * @lc: context * @flags: LOOPDEV_FL_* flags * * Initilize loop handler. * * We have two sets of the flags: * * * LOOPDEV_FL_* flags control loopcxt_* API behavior * * * LO_FLAGS_* are kernel flags used for LOOP_{SET,GET}_STAT64 ioctls * * Note about LOOPDEV_FL_{RDONLY,RDWR} flags. These flags are used for open(2) * syscall to open loop device. By default is the device open read-only. * * The expection is loopcxt_setup_device(), where the device is open read-write * if LO_FLAGS_READ_ONLY flags is not set (see loopcxt_set_flags()). * * Returns: <0 on error, 0 on success. */ int loopcxt_init(struct loopdev_cxt *lc, int flags) { if (!lc) return -EINVAL; memset(lc, 0, sizeof(*lc)); lc->flags = flags; loopcxt_set_device(lc, NULL); if (!(lc->flags & LOOPDEV_FL_NOSYSFS) && get_linux_version() >= KERNEL_VERSION(2,6,37)) /* * Use only sysfs for basic information about loop devices */ lc->flags |= LOOPDEV_FL_NOIOCTL; return 0; } /* * @lc: context * * Deinitialize loop context */ void loopcxt_deinit(struct loopdev_cxt *lc) { if (!lc) return; free(lc->filename); lc->filename = NULL; loopcxt_set_device(lc, NULL); loopcxt_deinit_iterator(lc); } /* * @lc: context * * Returns newly allocated device path. */ char *loopcxt_strdup_device(struct loopdev_cxt *lc) { if (!lc || !*lc->device) return NULL; return strdup(lc->device); } /* * @lc: context * * Returns pointer device name in the @lc struct. */ const char *loopcxt_get_device(struct loopdev_cxt *lc) { return lc ? lc->device : NULL; } /* * @lc: context * * Returns pointer to the sysfs context (see lib/sysfs.c) */ struct sysfs_cxt *loopcxt_get_sysfs(struct loopdev_cxt *lc) { if (!lc || !*lc->device || (lc->flags & LOOPDEV_FL_NOSYSFS)) return NULL; if (!lc->sysfs.devno) { dev_t devno = sysfs_devname_to_devno(lc->device, NULL); if (!devno) return NULL; if (sysfs_init(&lc->sysfs, devno, NULL)) return NULL; } return &lc->sysfs; } /* * @lc: context * * Returns: file descriptor to the open loop device or <0 on error. The mode * depends on LOOPDEV_FL_{RDWR,RDONLY} context flags. Default is * read-only. */ int loopcxt_get_fd(struct loopdev_cxt *lc) { if (!lc || !*lc->device) return -EINVAL; if (lc->fd < 0) { lc->mode = lc->flags & LOOPDEV_FL_RDWR ? O_RDWR : O_RDONLY; lc->fd = open(lc->device, lc->mode); } return lc->fd; } int loopcxt_set_fd(struct loopdev_cxt *lc, int fd, int mode) { if (!lc) return -EINVAL; lc->fd = fd; lc->mode = mode; return 0; } /* * @lc: context * @flags: LOOPITER_FL_* flags * * Iterator allows to scan list of the free or used loop devices. * * Returns: <0 on error, 0 on success */ int loopcxt_init_iterator(struct loopdev_cxt *lc, int flags) { struct loopdev_iter *iter; struct stat st; if (!lc) return -EINVAL; iter = &lc->iter; /* always zeroize */ memset(iter, 0, sizeof(*iter)); iter->ncur = -1; iter->flags = flags; iter->default_check = 1; if (!lc->extra_check) { /* * Check for /dev/loop/ subdirectory */ if (!(lc->flags & LOOPDEV_FL_DEVSUBDIR) && stat(_PATH_DEV_LOOP, &st) == 0 && S_ISDIR(st.st_mode)) lc->flags |= LOOPDEV_FL_DEVSUBDIR; lc->extra_check = 1; } return 0; } /* * @lc: context * * Returns: <0 on error, 0 on success */ int loopcxt_deinit_iterator(struct loopdev_cxt *lc) { struct loopdev_iter *iter = &lc->iter; if (!lc) return -EINVAL; iter = &lc->iter; free(iter->minors); if (iter->proc) fclose(iter->proc); iter->minors = NULL; iter->proc = NULL; iter->done = 1; return 0; } /* * Same as loopcxt_set_device, but also checks if the device is * associeted with any file. * * Returns: <0 on error, 0 on success, 1 device does not match with * LOOPITER_FL_{USED,FREE} flags. */ static int loopiter_set_device(struct loopdev_cxt *lc, const char *device) { int rc = loopcxt_set_device(lc, device); int used; if (rc) return rc; if (!(lc->iter.flags & LOOPITER_FL_USED) && !(lc->iter.flags & LOOPITER_FL_FREE)) return 0; /* caller does not care about device status */ used = loopcxt_get_offset(lc, NULL) == 0; if ((lc->iter.flags & LOOPITER_FL_USED) && used) return 0; if ((lc->iter.flags & LOOPITER_FL_FREE) && !used) return 0; loopcxt_set_device(lc, NULL); return 1; } static int cmpnum(const void *p1, const void *p2) { return (((* (int *) p1) > (* (int *) p2)) - ((* (int *) p1) < (* (int *) p2))); } /* * The classic scandir() is more expensive and less portable. * We needn't full loop device names -- loop numbers (loop) * are enough. */ static int loop_scandir(const char *dirname, int **ary, int hasprefix) { DIR *dir; struct dirent *d; unsigned int n, count = 0, arylen = 0; if (!dirname || !ary) return 0; dir = opendir(dirname); if (!dir) return 0; free(*ary); *ary = NULL; while((d = readdir(dir))) { #ifdef _DIRENT_HAVE_D_TYPE if (d->d_type != DT_BLK && d->d_type != DT_UNKNOWN && d->d_type != DT_LNK) continue; #endif if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, "..")) continue; if (hasprefix) { /* /dev/loop */ if (sscanf(d->d_name, "loop%u", &n) != 1) continue; } else { /* /dev/loop/ */ char *end = NULL; n = strtol(d->d_name, &end, 10); if (d->d_name == end || (end && *end) || errno) continue; } if (n < LOOPDEV_DEFAULT_NNODES) continue; /* ignore loop<0..7> */ if (count + 1 > arylen) { int *tmp; arylen += 1; tmp = realloc(*ary, arylen * sizeof(int)); if (!tmp) { free(*ary); return -1; } *ary = tmp; } if (*ary) (*ary)[count++] = n; } if (count && *ary) qsort(*ary, count, sizeof(int), cmpnum); closedir(dir); return count; } /* * @lc: context, has to initialized by loopcxt_init_iterator() * * Returns: 0 on success, -1 on error, 1 at the end of scanning. The details * about the current loop device are available by * loopcxt_get_{fd,backing_file,device,offset, ...} functions. */ int loopcxt_next(struct loopdev_cxt *lc) { struct loopdev_iter *iter; if (!lc) return -EINVAL; iter = &lc->iter; if (iter->done) return 1; /* A) Look for used loop devices in /proc/partitions ("losetup -a" only) */ if (iter->flags & LOOPITER_FL_USED) { char buf[BUFSIZ]; if (!iter->proc) iter->proc = fopen(_PATH_PROC_PARTITIONS, "r"); while (iter->proc && fgets(buf, sizeof(buf), iter->proc)) { unsigned int m; char name[128]; if (sscanf(buf, " %u %*s %*s %128[^\n ]", &m, name) != 2 || m != LOOPDEV_MAJOR) continue; if (loopiter_set_device(lc, name) == 0) return 0; } goto done; } /* B) Classic way, try first eight loop devices (default number * of loop devices). This is enough for 99% of all cases. */ if (iter->default_check) { for (++iter->ncur; iter->ncur < LOOPDEV_DEFAULT_NNODES; iter->ncur++) { char name[16]; snprintf(name, sizeof(name), "loop%d", iter->ncur); if (loopiter_set_device(lc, name) == 0) return 0; } iter->default_check = 0; } /* C) the worst possibility, scan whole /dev or /dev/loop/ */ if (!iter->minors) { iter->nminors = (lc->flags & LOOPDEV_FL_DEVSUBDIR) ? loop_scandir(_PATH_DEV_LOOP, &iter->minors, 0) : loop_scandir(_PATH_DEV, &iter->minors, 1); iter->ncur = -1; } for (++iter->ncur; iter->ncur < iter->nminors; iter->ncur++) { char name[16]; snprintf(name, sizeof(name), "loop%d", iter->minors[iter->ncur]); if (loopiter_set_device(lc, name) == 0) return 0; } done: loopcxt_deinit_iterator(lc); return 1; } /* * @device: path to device */ int is_loopdev(const char *device) { struct stat st; if (!device) return 0; return (stat(device, &st) == 0 && S_ISBLK(st.st_mode) && major(st.st_rdev) == LOOPDEV_MAJOR); } /* * @lc: context * * Returns result from LOOP_GET_STAT64 ioctl or NULL on error. */ struct loop_info64 *loopcxt_get_info(struct loopdev_cxt *lc) { int fd; if (!lc) return NULL; if (lc->has_info) return &lc->info; fd = loopcxt_get_fd(lc); if (fd < 0) return NULL; if (ioctl(fd, LOOP_GET_STATUS64, &lc->info) == 0) { lc->has_info = 1; return &lc->info; } return NULL; } /* * @lc: context * * Returns (allocated) string with path to the file assicieted * with the current loop device. */ char *loopcxt_get_backing_file(struct loopdev_cxt *lc) { struct sysfs_cxt *sysfs = loopcxt_get_sysfs(lc); char *res = NULL; if (sysfs) /* * This is always preffered, the loop_info64 * has too small buffer for the filename. */ res = sysfs_strdup(sysfs, "loop/backing_file"); if (!res && loopcxt_ioctl_enabled(lc)) { struct loop_info64 *lo = loopcxt_get_info(lc); if (lo) { lo->lo_file_name[LO_NAME_SIZE - 2] = '*'; lo->lo_file_name[LO_NAME_SIZE - 1] = '\0'; res = strdup((char *) lo->lo_file_name); } } return res; } /* * @lc: context * @offset: returns offset number for the given device * * Returns: <0 on error, 0 on success */ int loopcxt_get_offset(struct loopdev_cxt *lc, uint64_t *offset) { struct sysfs_cxt *sysfs = loopcxt_get_sysfs(lc); int rc = -EINVAL; if (sysfs) rc = sysfs_read_u64(sysfs, "loop/offset", offset); if (rc && loopcxt_ioctl_enabled(lc)) { struct loop_info64 *lo = loopcxt_get_info(lc); if (lo) { if (offset) *offset = lo->lo_offset; return 0; } } return rc; } /* * @lc: context * @sizelimit: returns size limit for the given device * * Returns: <0 on error, 0 on success */ int loopcxt_get_sizelimit(struct loopdev_cxt *lc, uint64_t *size) { struct sysfs_cxt *sysfs = loopcxt_get_sysfs(lc); int rc = -EINVAL; if (sysfs) rc = sysfs_read_u64(sysfs, "loop/sizelimit", size); if (rc && loopcxt_ioctl_enabled(lc)) { struct loop_info64 *lo = loopcxt_get_info(lc); if (lo) { if (size) *size = lo->lo_sizelimit; return 0; } } return rc; } /* * @lc: context * * Returns: 1 of the autoclear flags is set. */ int loopcxt_is_autoclear(struct loopdev_cxt *lc) { struct sysfs_cxt *sysfs = loopcxt_get_sysfs(lc); if (sysfs) { int fl; if (sysfs_read_int(sysfs, "loop/autoclear", &fl) == 0) return fl; } if (loopcxt_ioctl_enabled(lc)) { struct loop_info64 *lo = loopcxt_get_info(lc); if (lo) return lo->lo_flags & LO_FLAGS_AUTOCLEAR; } return 0; } /* * @lc: context * * Returns: 1 of the readonly flags is set. */ int loopcxt_is_readonly(struct loopdev_cxt *lc) { struct sysfs_cxt *sysfs = loopcxt_get_sysfs(lc); if (sysfs) { int fl; if (sysfs_read_int(sysfs, "ro", &fl) == 0) return fl; } if (loopcxt_ioctl_enabled(lc)) { struct loop_info64 *lo = loopcxt_get_info(lc); if (lo) return lo->lo_flags & LO_FLAGS_READ_ONLY; } return 0; } /* * The setting is removed by loopcxt_set_device() loopcxt_next()! */ int loopcxt_set_offset(struct loopdev_cxt *lc, uint64_t offset) { if (!lc) return -EINVAL; lc->info.lo_offset = offset; return 0; } /* * The setting is removed by loopcxt_set_device() loopcxt_next()! */ int loopcxt_set_sizelimit(struct loopdev_cxt *lc, uint64_t sizelimit) { if (!lc) return -EINVAL; lc->info.lo_sizelimit = sizelimit; return 0; } /* * @lc: context * @flags: kernel LO_FLAGS_{READ_ONLY,USE_AOPS,AUTOCLEAR} flags * * The setting is removed by loopcxt_set_device() loopcxt_next()! * * Returns: 0 on success, <0 on error. */ int loopcxt_set_flags(struct loopdev_cxt *lc, uint32_t flags) { if (!lc) return -EINVAL; lc->info.lo_flags = flags; return 0; } /* * @lc: context * @filename: backing file path (the path will be canonicalized) * * The setting is removed by loopcxt_set_device() loopcxt_next()! * * Returns: 0 on success, <0 on error. */ int loopcxt_set_backing_file(struct loopdev_cxt *lc, const char *filename) { if (!lc) return -EINVAL; lc->filename = canonicalize_path(filename); if (!lc->filename) return -errno; strncpy((char *)lc->info.lo_file_name, lc->filename, LO_NAME_SIZE); lc->info.lo_file_name[LO_NAME_SIZE- 1] = '\0'; return 0; } static int digits_only(const char *s) { while (*s) if (!isdigit(*s++)) return 0; return 1; } /* * @lc: context * @encryption: encryption name / type (see lopsetup man page) * @password * * Note that the encryption functionality is deprecated an unmaintained. Use * cryptsetup (it also supports AES-loops). * * The setting is removed by loopcxt_set_device() loopcxt_next()! * * Returns: 0 on success, <0 on error. */ int loopcxt_set_encryption(struct loopdev_cxt *lc, const char *encryption, const char *password) { if (!lc) return -EINVAL; if (encryption && *encryption) { if (digits_only(encryption)) { lc->info.lo_encrypt_type = atoi(encryption); } else { lc->info.lo_encrypt_type = LO_CRYPT_CRYPTOAPI; snprintf((char *)lc->info.lo_crypt_name, LO_NAME_SIZE, "%s", encryption); } } switch (lc->info.lo_encrypt_type) { case LO_CRYPT_NONE: lc->info.lo_encrypt_key_size = 0; break; default: memset(lc->info.lo_encrypt_key, 0, LO_KEY_SIZE); strncpy((char *)lc->info.lo_encrypt_key, password, LO_KEY_SIZE); lc->info.lo_encrypt_key[LO_KEY_SIZE - 1] = '\0'; lc->info.lo_encrypt_key_size = LO_KEY_SIZE; break; } return 0; } /* * @cl: context * * Associate the current device (see loopcxt_{set,get}_device()) with * a file (see loopcxt_set_backing_file()). * * The device is initialized read-write by default. If you want read-only * device then set LO_FLAGS_READ_ONLY by loopcxt_set_flags(). The LOOPDEV_FL_* * flags are ignored and modified according to LO_FLAGS_*. * * If the device is already open by loopcxt_get_fd() then this setup device * function will re-open the device to fix read/write mode. * * The device is also initialized read-only if the backing file is not * possible to open read-write (e.g. read-only FS). * * Returns: <0 on error, 0 on success. */ int loopcxt_setup_device(struct loopdev_cxt *lc) { int file_fd, dev_fd, mode = O_RDWR, rc = -1; if (!lc || !*lc->device || !lc->filename) return -EINVAL; /* * Open backing file and device */ if (lc->info.lo_flags & LO_FLAGS_READ_ONLY) mode = O_RDONLY; if ((file_fd = open(lc->filename, mode)) < 0) { if (mode != O_RDONLY && (errno == EROFS || errno == EACCES)) file_fd = open(lc->filename, mode = O_RDONLY); if (file_fd < 0) return -errno; } if (lc->fd != -1 && lc->mode != mode) { close(lc->fd); lc->fd = -1; lc->mode = 0; } if (mode == O_RDONLY) { lc->flags |= LOOPDEV_FL_RDONLY; /* open() mode */ lc->info.lo_flags |= LO_FLAGS_READ_ONLY; /* kernel loopdev mode */ } else { lc->flags |= LOOPDEV_FL_RDWR; /* open() mode */ lc->info.lo_flags &= ~LO_FLAGS_READ_ONLY; lc->flags &= ~LOOPDEV_FL_RDONLY; } dev_fd = loopcxt_get_fd(lc); if (dev_fd < 0) { rc = -errno; goto err; } /* * Set FD */ if (ioctl(dev_fd, LOOP_SET_FD, file_fd) < 0) { rc = -errno; goto err; } close(file_fd); file_fd = -1; if (ioctl(dev_fd, LOOP_SET_STATUS64, &lc->info)) goto err; memset(&lc->info, 0, sizeof(lc->info)); lc->has_info = 0; return 0; err: if (file_fd >= 0) close(file_fd); if (dev_fd >= 0) ioctl(dev_fd, LOOP_CLR_FD, 0); return rc; } int loopcxt_delete_device(struct loopdev_cxt *lc) { int fd = loopcxt_get_fd(lc); if (fd < 0) return -EINVAL; if (ioctl(fd, LOOP_CLR_FD, 0) < 0) return -errno; return 0; } int loopcxt_find_unused(struct loopdev_cxt *lc) { int rc; rc = loopcxt_init_iterator(lc, LOOPITER_FL_FREE); if (rc) return rc; rc = loopcxt_next(lc); loopcxt_deinit_iterator(lc); return rc; } /* * Return: TRUE/FALSE */ int loopdev_is_autoclear(const char *device) { struct loopdev_cxt lc; int rc; if (!device) return 0; loopcxt_init(&lc, 0); loopcxt_set_device(&lc, device); rc = loopcxt_is_autoclear(&lc); loopcxt_deinit(&lc); return rc; } char *loopdev_get_backing_file(const char *device) { struct loopdev_cxt lc; char *res; if (!device) return NULL; loopcxt_init(&lc, 0); loopcxt_set_device(&lc, device); res = loopcxt_get_backing_file(&lc); loopcxt_deinit(&lc); return res; } /* * Returns: TRUE/FALSE */ int loopdev_is_used(const char *device, const char *filename, uint64_t offset, int flags) { struct loopdev_cxt lc; char *backing = NULL; int rc = 0; if (!device) return 0; loopcxt_init(&lc, 0); loopcxt_set_device(&lc, device); backing = loopcxt_get_backing_file(&lc); if (!backing) goto done; if (filename && strcmp(filename, backing) != 0) goto done; if (flags & LOOPDEV_FL_OFFSET) { uint64_t off; if (loopcxt_get_offset(&lc, &off) != 0 || off != offset) goto done; } rc = 1; done: free(backing); loopcxt_deinit(&lc); return rc; } int loopdev_delete(const char *device) { struct loopdev_cxt lc; int rc; loopcxt_init(&lc, 0); rc = loopcxt_set_device(&lc, device); if (!rc) rc = loopcxt_delete_device(&lc); loopcxt_deinit(&lc); return rc; } /* * Returns: 0 = success, < 0 error, 1 not found */ int loopcxt_find_by_backing_file(struct loopdev_cxt *lc, const char *filename, uint64_t offset, int flags) { int rc; if (!filename) return -EINVAL; rc = loopcxt_init_iterator(lc, LOOPITER_FL_USED); if (rc) return rc; while((rc = loopcxt_next(lc)) == 0) { char *backing = loopcxt_get_backing_file(lc); if (!backing || strcmp(backing, filename)) { free(backing); continue; } free(backing); if (flags & LOOPDEV_FL_OFFSET) { uint64_t off; if (loopcxt_get_offset(lc, &off) != 0 || offset != off) continue; } rc = 0; break; } loopcxt_deinit_iterator(lc); return rc; } /* * Returns allocated string with device name */ char *loopdev_find_by_backing_file(const char *filename, uint64_t offset, int flags) { struct loopdev_cxt lc; char *res = NULL; if (!filename) return NULL; loopcxt_init(&lc, 0); if (loopcxt_find_by_backing_file(&lc, filename, offset, flags)) res = loopcxt_strdup_device(&lc); loopcxt_deinit(&lc); return res; } #ifdef TEST_PROGRAM_LOOPDEV #include #include static void test_loop_info(const char *device, int flags) { struct loopdev_cxt lc; char *p; uint64_t u64; loopcxt_init(&lc, flags); if (loopcxt_set_device(&lc, device)) err(EXIT_FAILURE, "failed to set device"); p = loopcxt_get_backing_file(&lc); printf("\tBACKING FILE: %s\n", p); free(p); if (loopcxt_get_offset(&lc, &u64) == 0) printf("\tOFFSET: %jd\n", u64); if (loopcxt_get_sizelimit(&lc, &u64) == 0) printf("\tSIZE LIMIT: %jd\n", u64); printf("\tAUTOCLEAR: %s\n", loopcxt_is_autoclear(&lc) ? "YES" : "NOT"); loopcxt_deinit(&lc); } static void test_loop_scan(int flags) { struct loopdev_cxt lc; int rc; loopcxt_init(&lc, 0); if (loopcxt_init_iterator(&lc, flags)) err(EXIT_FAILURE, "iterator initlization failed"); while((rc = loopcxt_next(&lc)) == 0) { const char *device = loopcxt_get_device(&lc); if (flags & LOOPITER_FL_USED) { char *backing = loopcxt_get_backing_file(&lc); printf("\t%s: %s\n", device, backing); free(backing); } else printf("\t%s\n", device); } if (rc < 0) err(EXIT_FAILURE, "loopdevs scanning failed"); loopcxt_deinit(&lc); } static int test_loop_setup(const char *filename, const char *device) { struct loopdev_cxt lc; int rc = 0; loopcxt_init(&lc, 0); if (device) { rc = loopcxt_set_device(&lc, device); if (rc) err(EXIT_FAILURE, "failed to set device: %s", device); } do { if (!device) { rc = loopcxt_find_unused(&lc); if (rc) err(EXIT_FAILURE, "failed to find unused device"); printf("Trying to use '%s'\n", loopcxt_get_device(&lc)); } if (loopcxt_set_backing_file(&lc, filename)) err(EXIT_FAILURE, "failed to set backing file"); rc = loopcxt_setup_device(&lc); if (rc == 0) break; /* success */ if (device || rc != -EBUSY) err(EXIT_FAILURE, "failed to setup device for %s", lc.filename); printf("device stolen...trying again\n"); } while (1); loopcxt_deinit(&lc); return 0; } int main(int argc, char *argv[]) { if (argc < 2) goto usage; if (argc == 3 && strcmp(argv[1], "--info") == 0) { printf("---sysfs & ioctl:---\n"); test_loop_info(argv[2], 0); printf("---sysfs only:---\n"); test_loop_info(argv[2], LOOPDEV_FL_NOIOCTL); printf("---ioctl only:---\n"); test_loop_info(argv[2], LOOPDEV_FL_NOSYSFS); } else if (argc == 2 && strcmp(argv[1], "--used") == 0) { printf("---all used devices---\n"); test_loop_scan(LOOPITER_FL_USED); } else if (argc == 2 && strcmp(argv[1], "--free") == 0) { printf("---all free devices---\n"); test_loop_scan(LOOPITER_FL_FREE); } else if (argc >= 3 && strcmp(argv[1], "--setup") == 0) { test_loop_setup(argv[2], argv[3]); } else if (argc == 3 && strcmp(argv[1], "--delete") == 0) { if (loopdev_delete(argv[2])) errx(EXIT_FAILURE, "failed to deinitialize device %s", argv[2]); } else goto usage; return EXIT_SUCCESS; usage: errx(EXIT_FAILURE, "usage: \n" " %1$s --info \n" " %1$s --free\n" " %1$s --used\n" " %1$s --setup []\n" " %1$s --delete\n", argv[0]); } #endif /* TEST_PROGRAM */ util-linux-2.20.1/lib/mbsalign.c0000664000076400007640000001724611573627634013377 00000000000000/* Align/Truncate a string in a given screen width Copyright (C) 2009-2010 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . */ /* Written by Pádraig Brady. */ #include #include #include #include #include #include #include "c.h" #include "mbsalign.h" #include "widechar.h" #ifdef HAVE_WIDECHAR /* Replace non printable chars. Note \t and \n etc. are non printable. Return 1 if replacement made, 0 otherwise. */ static bool wc_ensure_printable (wchar_t *wchars) { bool replaced = false; wchar_t *wc = wchars; while (*wc) { if (!iswprint ((wint_t) *wc)) { *wc = 0xFFFD; /* L'\uFFFD' (replacement char) */ replaced = true; } wc++; } return replaced; } /* Truncate wchar string to width cells. * Returns number of cells used. */ static size_t wc_truncate (wchar_t *wc, size_t width) { size_t cells = 0; int next_cells = 0; while (*wc) { next_cells = wcwidth (*wc); if (next_cells == -1) /* non printable */ { *wc = 0xFFFD; /* L'\uFFFD' (replacement char) */ next_cells = 1; } if (cells + next_cells > width) break; cells += next_cells; wc++; } *wc = L'\0'; return cells; } /* FIXME: move this function to gnulib as it's missing on: OpenBSD 3.8, IRIX 5.3, Solaris 2.5.1, mingw, BeOS */ static int rpl_wcswidth (const wchar_t *s, size_t n) { int ret = 0; while (n-- > 0 && *s != L'\0') { int nwidth = wcwidth (*s++); if (nwidth == -1) /* non printable */ return -1; if (ret > (INT_MAX - nwidth)) /* overflow */ return -1; ret += nwidth; } return ret; } #endif /* Truncate multi-byte string to @width and returns number of * bytes of the new string @str, and in @width returns number * of cells. */ size_t mbs_truncate(char *str, size_t *width) { ssize_t bytes = strlen(str); #ifdef HAVE_WIDECHAR ssize_t sz = mbstowcs(NULL, str, 0); wchar_t *wcs = NULL; if (sz == (ssize_t) -1) goto done; wcs = malloc((sz + 1) * sizeof(wchar_t)); if (!wcs) goto done; if (!mbstowcs(wcs, str, sz)) goto done; *width = wc_truncate(wcs, *width); bytes = wcstombs(str, wcs, bytes); done: free(wcs); #else if (*width < bytes) bytes = *width; #endif if (bytes >= 0) str[bytes] = '\0'; return bytes; } /* Write N_SPACES space characters to DEST while ensuring nothing is written beyond DEST_END. A terminating NUL is always added to DEST. A pointer to the terminating NUL is returned. */ static char* mbs_align_pad (char *dest, const char* dest_end, size_t n_spaces) { /* FIXME: Should we pad with "figure space" (\u2007) if non ascii data present? */ while (n_spaces-- && (dest < dest_end)) *dest++ = ' '; *dest = '\0'; return dest; } /* Align a string, SRC, in a field of *WIDTH columns, handling multi-byte characters; write the result into the DEST_SIZE-byte buffer, DEST. ALIGNMENT specifies whether to left- or right-justify or to center. If SRC requires more than *WIDTH columns, truncate it to fit. When centering, the number of trailing spaces may be one less than the number of leading spaces. The FLAGS parameter is unused at present. Return the length in bytes required for the final result, not counting the trailing NUL. A return value of DEST_SIZE or larger means there wasn't enough space. DEST will be NUL terminated in any case. Return (size_t) -1 upon error (invalid multi-byte sequence in SRC, or malloc failure), unless MBA_UNIBYTE_FALLBACK is specified. Update *WIDTH to indicate how many columns were used before padding. */ size_t mbsalign (const char *src, char *dest, size_t dest_size, size_t *width, mbs_align_t align, int flags) { size_t ret = -1; size_t src_size = strlen (src) + 1; char *newstr = NULL; wchar_t *str_wc = NULL; const char *str_to_print = src; size_t n_cols = src_size - 1; size_t n_used_bytes = n_cols; /* Not including NUL */ size_t n_spaces = 0; bool conversion = false; bool wc_enabled = false; #ifdef HAVE_WIDECHAR /* In multi-byte locales convert to wide characters to allow easy truncation. Also determine number of screen columns used. */ if (MB_CUR_MAX > 1) { size_t src_chars = mbstowcs (NULL, src, 0); if (src_chars == (size_t) -1) { if (flags & MBA_UNIBYTE_FALLBACK) goto mbsalign_unibyte; else goto mbsalign_cleanup; } src_chars += 1; /* make space for NUL */ str_wc = malloc (src_chars * sizeof (wchar_t)); if (str_wc == NULL) { if (flags & MBA_UNIBYTE_FALLBACK) goto mbsalign_unibyte; else goto mbsalign_cleanup; } if (mbstowcs (str_wc, src, src_chars) != 0) { str_wc[src_chars - 1] = L'\0'; wc_enabled = true; conversion = wc_ensure_printable (str_wc); n_cols = rpl_wcswidth (str_wc, src_chars); } } /* If we transformed or need to truncate the source string then create a modified copy of it. */ if (wc_enabled && (conversion || (n_cols > *width))) { if (conversion) { /* May have increased the size by converting \t to \uFFFD for example. */ src_size = wcstombs(NULL, str_wc, 0) + 1; } newstr = malloc (src_size); if (newstr == NULL) { if (flags & MBA_UNIBYTE_FALLBACK) goto mbsalign_unibyte; else goto mbsalign_cleanup; } str_to_print = newstr; n_cols = wc_truncate (str_wc, *width); n_used_bytes = wcstombs (newstr, str_wc, src_size); } #endif mbsalign_unibyte: if (n_cols > *width) /* Unibyte truncation required. */ { n_cols = *width; n_used_bytes = n_cols; } if (*width > n_cols) /* Padding required. */ n_spaces = *width - n_cols; /* indicate to caller how many cells needed (not including padding). */ *width = n_cols; /* indicate to caller how many bytes needed (not including NUL). */ ret = n_used_bytes + (n_spaces * 1); /* Write as much NUL terminated output to DEST as possible. */ if (dest_size != 0) { char *dest_end = dest + dest_size - 1; size_t start_spaces = n_spaces / 2 + n_spaces % 2; size_t end_spaces = n_spaces / 2; switch (align) { case MBS_ALIGN_CENTER: start_spaces = n_spaces / 2 + n_spaces % 2; end_spaces = n_spaces / 2; break; case MBS_ALIGN_LEFT: start_spaces = 0; end_spaces = n_spaces; break; case MBS_ALIGN_RIGHT: start_spaces = n_spaces; end_spaces = 0; break; } dest = mbs_align_pad (dest, dest_end, start_spaces); size_t space_left = dest_end - dest; dest = mempcpy (dest, str_to_print, min (n_used_bytes, space_left)); mbs_align_pad (dest, dest_end, end_spaces); } mbsalign_cleanup: free (str_wc); free (newstr); return ret; } util-linux-2.20.1/lib/md5.c0000664000076400007640000001767111640045336012256 00000000000000/* * This code implements the MD5 message-digest algorithm. * The algorithm is due to Ron Rivest. This code was * written by Colin Plumb in 1993, no copyright is claimed. * This code is in the public domain; do with it what you wish. * * Equivalent code is available from RSA Data Security, Inc. * This code has been tested against that, and is equivalent, * except that you don't need to include two pages of legalese * with every copy. * * To compute the message digest of a chunk of bytes, declare an * MD5Context structure, pass it to MD5Init, call MD5Update as * needed on buffers full of bytes, and then call MD5Final, which * will fill a supplied 16-byte array with the digest. */ #include /* for memcpy() */ #include "md5.h" #if !defined(WORDS_BIGENDIAN) #define byteReverse(buf, len) /* Nothing */ #else void byteReverse(unsigned char *buf, unsigned longs); #ifndef ASM_MD5 /* * Note: this code is harmless on little-endian machines. */ void byteReverse(unsigned char *buf, unsigned longs) { uint32_t t; do { t = (uint32_t) ((unsigned) buf[3] << 8 | buf[2]) << 16 | ((unsigned) buf[1] << 8 | buf[0]); *(uint32_t *) buf = t; buf += 4; } while (--longs); } #endif #endif /* * Start MD5 accumulation. Set bit count to 0 and buffer to mysterious * initialization constants. */ void MD5Init(struct MD5Context *ctx) { ctx->buf[0] = 0x67452301; ctx->buf[1] = 0xefcdab89; ctx->buf[2] = 0x98badcfe; ctx->buf[3] = 0x10325476; ctx->bits[0] = 0; ctx->bits[1] = 0; } /* * Update context to reflect the concatenation of another buffer full * of bytes. */ void MD5Update(struct MD5Context *ctx, unsigned char const *buf, unsigned len) { uint32_t t; /* Update bitcount */ t = ctx->bits[0]; if ((ctx->bits[0] = t + ((uint32_t) len << 3)) < t) ctx->bits[1]++; /* Carry from low to high */ ctx->bits[1] += len >> 29; t = (t >> 3) & 0x3f; /* Bytes already in shsInfo->data */ /* Handle any leading odd-sized chunks */ if (t) { unsigned char *p = (unsigned char *) ctx->in + t; t = 64 - t; if (len < t) { memcpy(p, buf, len); return; } memcpy(p, buf, t); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); buf += t; len -= t; } /* Process data in 64-byte chunks */ while (len >= 64) { memcpy(ctx->in, buf, 64); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); buf += 64; len -= 64; } /* Handle any remaining bytes of data. */ memcpy(ctx->in, buf, len); } /* * Final wrapup - pad to 64-byte boundary with the bit pattern * 1 0* (64-bit count of bits processed, MSB-first) */ void MD5Final(unsigned char digest[MD5LENGTH], struct MD5Context *ctx) { unsigned count; unsigned char *p; /* Compute number of bytes mod 64 */ count = (ctx->bits[0] >> 3) & 0x3F; /* Set the first char of padding to 0x80. This is safe since there is always at least one byte free */ p = ctx->in + count; *p++ = 0x80; /* Bytes of padding needed to make 64 bytes */ count = 64 - 1 - count; /* Pad out to 56 mod 64 */ if (count < 8) { /* Two lots of padding: Pad the first block to 64 bytes */ memset(p, 0, count); byteReverse(ctx->in, 16); MD5Transform(ctx->buf, (uint32_t *) ctx->in); /* Now fill the next block with 56 bytes */ memset(ctx->in, 0, 56); } else { /* Pad block to 56 bytes */ memset(p, 0, count - 8); } byteReverse(ctx->in, 14); /* Append length in bits and transform */ ((uint32_t *) ctx->in)[14] = ctx->bits[0]; ((uint32_t *) ctx->in)[15] = ctx->bits[1]; MD5Transform(ctx->buf, (uint32_t *) ctx->in); byteReverse((unsigned char *) ctx->buf, 4); memcpy(digest, ctx->buf, MD5LENGTH); memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ } #ifndef ASM_MD5 /* The four core functions - F1 is optimized somewhat */ /* #define F1(x, y, z) (x & y | ~x & z) */ #define F1(x, y, z) (z ^ (x & (y ^ z))) #define F2(x, y, z) F1(z, x, y) #define F3(x, y, z) (x ^ y ^ z) #define F4(x, y, z) (y ^ (x | ~z)) /* This is the central step in the MD5 algorithm. */ #define MD5STEP(f, w, x, y, z, data, s) \ ( w += f(x, y, z) + data, w = w<>(32-s), w += x ) /* * The core of the MD5 algorithm, this alters an existing MD5 hash to * reflect the addition of 16 longwords of new data. MD5Update blocks * the data and converts bytes into longwords for this routine. */ void MD5Transform(uint32_t buf[4], uint32_t const in[16]) { register uint32_t a, b, c, d; a = buf[0]; b = buf[1]; c = buf[2]; d = buf[3]; MD5STEP(F1, a, b, c, d, in[0] + 0xd76aa478, 7); MD5STEP(F1, d, a, b, c, in[1] + 0xe8c7b756, 12); MD5STEP(F1, c, d, a, b, in[2] + 0x242070db, 17); MD5STEP(F1, b, c, d, a, in[3] + 0xc1bdceee, 22); MD5STEP(F1, a, b, c, d, in[4] + 0xf57c0faf, 7); MD5STEP(F1, d, a, b, c, in[5] + 0x4787c62a, 12); MD5STEP(F1, c, d, a, b, in[6] + 0xa8304613, 17); MD5STEP(F1, b, c, d, a, in[7] + 0xfd469501, 22); MD5STEP(F1, a, b, c, d, in[8] + 0x698098d8, 7); MD5STEP(F1, d, a, b, c, in[9] + 0x8b44f7af, 12); MD5STEP(F1, c, d, a, b, in[10] + 0xffff5bb1, 17); MD5STEP(F1, b, c, d, a, in[11] + 0x895cd7be, 22); MD5STEP(F1, a, b, c, d, in[12] + 0x6b901122, 7); MD5STEP(F1, d, a, b, c, in[13] + 0xfd987193, 12); MD5STEP(F1, c, d, a, b, in[14] + 0xa679438e, 17); MD5STEP(F1, b, c, d, a, in[15] + 0x49b40821, 22); MD5STEP(F2, a, b, c, d, in[1] + 0xf61e2562, 5); MD5STEP(F2, d, a, b, c, in[6] + 0xc040b340, 9); MD5STEP(F2, c, d, a, b, in[11] + 0x265e5a51, 14); MD5STEP(F2, b, c, d, a, in[0] + 0xe9b6c7aa, 20); MD5STEP(F2, a, b, c, d, in[5] + 0xd62f105d, 5); MD5STEP(F2, d, a, b, c, in[10] + 0x02441453, 9); MD5STEP(F2, c, d, a, b, in[15] + 0xd8a1e681, 14); MD5STEP(F2, b, c, d, a, in[4] + 0xe7d3fbc8, 20); MD5STEP(F2, a, b, c, d, in[9] + 0x21e1cde6, 5); MD5STEP(F2, d, a, b, c, in[14] + 0xc33707d6, 9); MD5STEP(F2, c, d, a, b, in[3] + 0xf4d50d87, 14); MD5STEP(F2, b, c, d, a, in[8] + 0x455a14ed, 20); MD5STEP(F2, a, b, c, d, in[13] + 0xa9e3e905, 5); MD5STEP(F2, d, a, b, c, in[2] + 0xfcefa3f8, 9); MD5STEP(F2, c, d, a, b, in[7] + 0x676f02d9, 14); MD5STEP(F2, b, c, d, a, in[12] + 0x8d2a4c8a, 20); MD5STEP(F3, a, b, c, d, in[5] + 0xfffa3942, 4); MD5STEP(F3, d, a, b, c, in[8] + 0x8771f681, 11); MD5STEP(F3, c, d, a, b, in[11] + 0x6d9d6122, 16); MD5STEP(F3, b, c, d, a, in[14] + 0xfde5380c, 23); MD5STEP(F3, a, b, c, d, in[1] + 0xa4beea44, 4); MD5STEP(F3, d, a, b, c, in[4] + 0x4bdecfa9, 11); MD5STEP(F3, c, d, a, b, in[7] + 0xf6bb4b60, 16); MD5STEP(F3, b, c, d, a, in[10] + 0xbebfbc70, 23); MD5STEP(F3, a, b, c, d, in[13] + 0x289b7ec6, 4); MD5STEP(F3, d, a, b, c, in[0] + 0xeaa127fa, 11); MD5STEP(F3, c, d, a, b, in[3] + 0xd4ef3085, 16); MD5STEP(F3, b, c, d, a, in[6] + 0x04881d05, 23); MD5STEP(F3, a, b, c, d, in[9] + 0xd9d4d039, 4); MD5STEP(F3, d, a, b, c, in[12] + 0xe6db99e5, 11); MD5STEP(F3, c, d, a, b, in[15] + 0x1fa27cf8, 16); MD5STEP(F3, b, c, d, a, in[2] + 0xc4ac5665, 23); MD5STEP(F4, a, b, c, d, in[0] + 0xf4292244, 6); MD5STEP(F4, d, a, b, c, in[7] + 0x432aff97, 10); MD5STEP(F4, c, d, a, b, in[14] + 0xab9423a7, 15); MD5STEP(F4, b, c, d, a, in[5] + 0xfc93a039, 21); MD5STEP(F4, a, b, c, d, in[12] + 0x655b59c3, 6); MD5STEP(F4, d, a, b, c, in[3] + 0x8f0ccc92, 10); MD5STEP(F4, c, d, a, b, in[10] + 0xffeff47d, 15); MD5STEP(F4, b, c, d, a, in[1] + 0x85845dd1, 21); MD5STEP(F4, a, b, c, d, in[8] + 0x6fa87e4f, 6); MD5STEP(F4, d, a, b, c, in[15] + 0xfe2ce6e0, 10); MD5STEP(F4, c, d, a, b, in[6] + 0xa3014314, 15); MD5STEP(F4, b, c, d, a, in[13] + 0x4e0811a1, 21); MD5STEP(F4, a, b, c, d, in[4] + 0xf7537e82, 6); MD5STEP(F4, d, a, b, c, in[11] + 0xbd3af235, 10); MD5STEP(F4, c, d, a, b, in[2] + 0x2ad7d2bb, 15); MD5STEP(F4, b, c, d, a, in[9] + 0xeb86d391, 21); buf[0] += a; buf[1] += b; buf[2] += c; buf[3] += d; } #endif util-linux-2.20.1/lib/langinfo.c0000664000076400007640000000377611573627634013403 00000000000000/* * This is callback solution for systems without nl_langinfo(), this function * returns hardcoded and on locale setting independed value. * * See langinfo.h man page for more details. * * Copyright (C) 2010 Karel Zak */ #include "nls.h" char *langinfo_fallback(nl_item item) { switch (item) { case CODESET: return "ISO-8859-1"; case THOUSEP: return ","; case D_T_FMT: case ERA_D_T_FMT: return "%a %b %e %H:%M:%S %Y"; case D_FMT: case ERA_D_FMT: return "%m/%d/%y"; case T_FMT: case ERA_T_FMT: return "%H:%M:%S"; case T_FMT_AMPM: return "%I:%M:%S %p"; case AM_STR: return "AM"; case PM_STR: return "PM"; case DAY_1: return "Sunday"; case DAY_2: return "Monday"; case DAY_3: return "Tuesday"; case DAY_4: return "Wednesday"; case DAY_5: return "Thursday"; case DAY_6: return "Friday"; case DAY_7: return "Saturday"; case ABDAY_1: return "Sun"; case ABDAY_2: return "Mon"; case ABDAY_3: return "Tue"; case ABDAY_4: return "Wed"; case ABDAY_5: return "Thu"; case ABDAY_6: return "Fri"; case ABDAY_7: return "Sat"; case MON_1: return "January"; case MON_2: return "February"; case MON_3: return "March"; case MON_4: return "April"; case MON_5: return "May"; case MON_6: return "June"; case MON_7: return "July"; case MON_8: return "August"; case MON_9: return "September"; case MON_10: return "October"; case MON_11: return "November"; case MON_12: return "December"; case ABMON_1: return "Jan"; case ABMON_2: return "Feb"; case ABMON_3: return "Mar"; case ABMON_4: return "Apr"; case ABMON_5: return "May"; case ABMON_6: return "Jun"; case ABMON_7: return "Jul"; case ABMON_8: return "Aug"; case ABMON_9: return "Sep"; case ABMON_10: return "Oct"; case ABMON_11: return "Nov"; case ABMON_12: return "Dec"; case ALT_DIGITS: return "\0\0\0\0\0\0\0\0\0\0"; case CRNCYSTR: return "-"; case YESEXPR: return "^[yY]"; case NOEXPR: return "^[nN]"; default: return ""; } } util-linux-2.20.1/lib/env.c0000664000076400007640000000502511573627634012363 00000000000000/* * Security checks of environment * Added from shadow-utils package * by Arkadiusz Mi¶kiewicz * */ #include #include #include #ifdef HAVE_SYS_PRCTL_H #include #else #define PR_GET_DUMPABLE 3 #endif #if (!defined(HAVE_PRCTL) && defined(linux)) #include #endif #include #include #include "env.h" extern char **environ; static char * const forbid[] = { "_RLD_=", "BASH_ENV=", /* GNU creeping featurism strikes again... */ "ENV=", "HOME=", "IFS=", "KRB_CONF=", "LD_", /* anything with the LD_ prefix */ "LIBPATH=", "MAIL=", "NLSPATH=", "PATH=", "SHELL=", "SHLIB_PATH=", (char *) 0 }; /* these are allowed, but with no slashes inside (to work around security problems in GNU gettext) */ static char * const noslash[] = { "LANG=", "LANGUAGE=", "LC_", /* anything with the LC_ prefix */ (char *) 0 }; void sanitize_env(void) { char **envp = environ; char * const *bad; char **cur; char **move; for (cur = envp; *cur; cur++) { for (bad = forbid; *bad; bad++) { if (strncmp(*cur, *bad, strlen(*bad)) == 0) { for (move = cur; *move; move++) *move = *(move + 1); cur--; break; } } } for (cur = envp; *cur; cur++) { for (bad = noslash; *bad; bad++) { if (strncmp(*cur, *bad, strlen(*bad)) != 0) continue; if (!strchr(*cur, '/')) continue; /* OK */ for (move = cur; *move; move++) *move = *(move + 1); cur--; break; } } } char *safe_getenv(const char *arg) { uid_t ruid = getuid(); if (ruid != 0 || (ruid != geteuid()) || (getgid() != getegid())) return NULL; #if HAVE_PRCTL if (prctl(PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) return NULL; #else #if (defined(linux) && defined(SYS_prctl)) if (syscall(SYS_prctl, PR_GET_DUMPABLE, 0, 0, 0, 0) == 0) return NULL; #endif #endif #ifdef HAVE___SECURE_GETENV return __secure_getenv(arg); #else return getenv(arg); #endif } util-linux-2.20.1/lib/at.c0000664000076400007640000000563511640045336012172 00000000000000/* * Portable xxxat() functions. * * Copyright (C) 2010 Karel Zak */ #include #include #include #include #include "at.h" #include "c.h" #ifdef HAVE_FSTATAT int fstat_at(int dir, const char *dirname __attribute__ ((__unused__)), const char *filename, struct stat *st, int nofollow) { return fstatat(dir, filename, st, nofollow ? AT_SYMLINK_NOFOLLOW : 0); } #else int fstat_at(int dir, const char *dirname, const char *filename, struct stat *st, int nofollow) { if (*filename != '/') { char path[PATH_MAX]; int len; len = snprintf(path, sizeof(path), "%s/%s", dirname, filename); if (len < 0 || len + 1 > sizeof(path)) return -1; return nofollow ? lstat(path, st) : stat(path, st); } return nofollow ? lstat(filename, st) : stat(filename, st); } #endif #ifdef HAVE_FSTATAT int open_at(int dir, const char *dirname __attribute__ ((__unused__)), const char *filename, int flags) { return openat(dir, filename, flags); } #else int open_at(int dir, const char *dirname, const char *filename, int flags) { if (*filename != '/') { char path[PATH_MAX]; int len; len = snprintf(path, sizeof(path), "%s/%s", dirname, filename); if (len < 0 || len + 1 > sizeof(path)) return -1; return open(path, flags); } return open(filename, flags); } #endif FILE *fopen_at(int dir, const char *dirname, const char *filename, int flags, const char *mode) { int fd = open_at(dir, dirname, filename, flags); if (fd < 0) return NULL; return fdopen(fd, mode); } #ifdef HAVE_FSTATAT ssize_t readlink_at(int dir, const char *dirname __attribute__ ((__unused__)), const char *pathname, char *buf, size_t bufsiz) { return readlinkat(dir, pathname, buf, bufsiz); } #else ssize_t readlink_at(int dir, const char *dirname, const char *pathname, char *buf, size_t bufsiz) { if (*pathname != '/') { char path[PATH_MAX]; int len; len = snprintf(path, sizeof(path), "%s/%s", dirname, pathname); if (len < 0 || len + 1 > sizeof(path)) return -1; return readlink(path, buf, bufsiz); } return readlink(pathname, buf, bufsiz); } #endif #ifdef TEST_PROGRAM_AT #include #include #include #include int main(int argc, char *argv[]) { DIR *dir; struct dirent *d; char *dirname; if (argc != 2) { fprintf(stderr, "usage: %s \n", argv[0]); exit(EXIT_FAILURE); } dirname = argv[1]; dir = opendir(dirname); if (!dir) err(EXIT_FAILURE, "%s: open failed", dirname); while ((d = readdir(dir))) { struct stat st; FILE *f; printf("%32s ", d->d_name); if (fstat_at(dirfd(dir), dirname, d->d_name, &st, 0) == 0) printf("%16jd bytes ", st.st_size); else printf("%16s bytes ", "???"); f = fopen_at(dirfd(dir), dirname, d->d_name, O_RDONLY, "r"); printf(" %s\n", f ? "OK" : strerror(errno)); if (f) fclose(f); } closedir(dir); return EXIT_SUCCESS; } #endif util-linux-2.20.1/lib/blkdev.c0000664000076400007640000001303511640045336013026 00000000000000 #include #include #include #include #include #ifdef HAVE_LINUX_FD_H #include #endif #ifdef HAVE_SYS_DISKLABEL_H #include #endif #ifdef HAVE_SYS_DISK_H #ifdef HAVE_SYS_QUEUE_H #include /* for LIST_HEAD */ #endif #include #endif #include "blkdev.h" #include "linux_version.h" #include "c.h" static long blkdev_valid_offset (int fd, off_t offset) { char ch; if (lseek (fd, offset, 0) < 0) return 0; if (read (fd, &ch, 1) < 1) return 0; return 1; } off_t blkdev_find_size (int fd) { uintmax_t high, low = 0; for (high = 1024; blkdev_valid_offset (fd, high); ) { if (high == UINTMAX_MAX) return -1; low = high; if (high >= UINTMAX_MAX/2) high = UINTMAX_MAX; else high *= 2; } while (low < high - 1) { uintmax_t mid = (low + high) / 2; if (blkdev_valid_offset (fd, mid)) low = mid; else high = mid; } blkdev_valid_offset (fd, 0); return (low + 1); } /* get size in bytes */ int blkdev_get_size(int fd, unsigned long long *bytes) { #ifdef DKIOCGETBLOCKCOUNT /* Apple Darwin */ if (ioctl(fd, DKIOCGETBLOCKCOUNT, bytes) >= 0) { *bytes <<= 9; return 0; } #endif #ifdef BLKGETSIZE64 { #ifdef __linux__ int ver = get_linux_version(); /* kernels 2.4.15-2.4.17, had a broken BLKGETSIZE64 */ if (ver >= KERNEL_VERSION (2,6,0) || (ver >= KERNEL_VERSION (2,4,18) && ver < KERNEL_VERSION (2,5,0))) #endif if (ioctl(fd, BLKGETSIZE64, bytes) >= 0) return 0; } #endif /* BLKGETSIZE64 */ #ifdef BLKGETSIZE { unsigned long size; if (ioctl(fd, BLKGETSIZE, &size) >= 0) { *bytes = ((unsigned long long)size << 9); return 0; } } #endif /* BLKGETSIZE */ #ifdef DIOCGMEDIASIZE /* FreeBSD */ if (ioctl(fd, DIOCGMEDIASIZE, bytes) >= 0) return 0; #endif #ifdef FDGETPRM { struct floppy_struct this_floppy; if (ioctl(fd, FDGETPRM, &this_floppy) >= 0) { *bytes = this_floppy.size << 9; return 0; } } #endif /* FDGETPRM */ #ifdef HAVE_SYS_DISKLABEL_H { /* * This code works for FreeBSD 4.11 i386, except for the full device * (such as /dev/ad0). It doesn't work properly for newer FreeBSD * though. FreeBSD >= 5.0 should be covered by the DIOCGMEDIASIZE * above however. * * Note that FreeBSD >= 4.0 has disk devices as unbuffered (raw, * character) devices, so we need to check for S_ISCHR, too. */ int part = -1; struct disklabel lab; struct partition *pp; char ch; struct stat st; if ((fstat(fd, &st) >= 0) && (S_ISBLK(st.st_mode) || S_ISCHR(st.st_mode))) part = st.st_rdev & 7; if (part >= 0 && (ioctl(fd, DIOCGDINFO, (char *)&lab) >= 0)) { pp = &lab.d_partitions[part]; if (pp->p_size) { *bytes = pp->p_size << 9; return 0; } } } #endif /* HAVE_SYS_DISKLABEL_H */ { struct stat st; if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode)) { *bytes = st.st_size; return 0; } if (!S_ISBLK(st.st_mode)) return -1; } *bytes = blkdev_find_size(fd); return 0; } /* get 512-byte sector count */ int blkdev_get_sectors(int fd, unsigned long long *sectors) { unsigned long long bytes; if (blkdev_get_size(fd, &bytes) == 0) { *sectors = (bytes >> 9); return 0; } return -1; } /* * Get logical sector size. * * This is the smallest unit the storage device can * address. It is typically 512 bytes. */ int blkdev_get_sector_size(int fd, int *sector_size) { #ifdef BLKSSZGET if (ioctl(fd, BLKSSZGET, sector_size) >= 0) return 0; return -1; #else *sector_size = DEFAULT_SECTOR_SIZE; return 0; #endif } /* * Get physical block device size. The BLKPBSZGET is supported since Linux * 2.6.32. For old kernels is probably the best to assume that physical sector * size is the same as logical sector size. * * Example: * * rc = blkdev_get_physector_size(fd, &physec); * if (rc || physec == 0) { * rc = blkdev_get_sector_size(fd, &physec); * if (rc) * physec = DEFAULT_SECTOR_SIZE; * } */ int blkdev_get_physector_size(int fd, int *sector_size) { #ifdef BLKPBSZGET if (ioctl(fd, BLKPBSZGET, §or_size) >= 0) return 0; return -1; #else *sector_size = DEFAULT_SECTOR_SIZE; return 0; #endif } /* * Return the alignment status of a device */ int blkdev_is_misaligned(int fd) { #ifdef BLKALIGNOFF int aligned; if (ioctl(fd, BLKALIGNOFF, &aligned) < 0) return 0; /* probably kernel < 2.6.32 */ /* * Note that kernel returns -1 as alignement offset if no compatible * sizes and alignments exist for stacked devices */ return aligned != 0 ? 1 : 0; #else return 0; #endif } #ifdef TEST_PROGRAM #include #include #include int main(int argc, char **argv) { unsigned long long bytes; unsigned long long sectors; int sector_size, phy_sector_size; int fd; if (argc != 2) { fprintf(stderr, "usage: %s device\n", argv[0]); exit(EXIT_FAILURE); } if ((fd = open(argv[1], O_RDONLY)) < 0) err(EXIT_FAILURE, "open %s failed", argv[1]); if (blkdev_get_size(fd, &bytes) < 0) err(EXIT_FAILURE, "blkdev_get_size() failed"); if (blkdev_get_sectors(fd, §ors) < 0) err(EXIT_FAILURE, "blkdev_get_sectors() failed"); if (blkdev_get_sector_size(fd, §or_size) < 0) err(EXIT_FAILURE, "blkdev_get_sector_size() failed"); if (blkdev_get_physector_size(fd, &phy_sector_size) < 0) err(EXIT_FAILURE, "blkdev_get_physector_size() failed"); printf(" bytes: %llu\n", bytes); printf(" sectors: %llu\n", sectors); printf(" sector size: %d\n", sector_size); printf("phy-sector size: %d\n", phy_sector_size); return EXIT_SUCCESS; } #endif /* TEST_PROGRAM */ util-linux-2.20.1/lib/crc32.c0000664000076400007640000001323011573627634012504 00000000000000/* * COPYRIGHT (C) 1986 Gary S. Brown. You may use this program, or * code or tables extracted from it, as desired without restriction. * * First, the polynomial itself and its table of feedback terms. The * polynomial is * X^32+X^26+X^23+X^22+X^16+X^12+X^11+X^10+X^8+X^7+X^5+X^4+X^2+X^1+X^0 * * Note that we take it "backwards" and put the highest-order term in * the lowest-order bit. The X^32 term is "implied"; the LSB is the * X^31 term, etc. The X^0 term (usually shown as "+1") results in * the MSB being 1. * * Note that the usual hardware shift register implementation, which * is what we're using (we're merely optimizing it by doing eight-bit * chunks at a time) shifts bits into the lowest-order term. In our * implementation, that means shifting towards the right. Why do we * do it this way? Because the calculated CRC must be transmitted in * order from highest-order term to lowest-order term. UARTs transmit * characters in order from LSB to MSB. By storing the CRC this way, * we hand it to the UART in the order low-byte to high-byte; the UART * sends each low-bit to hight-bit; and the result is transmission bit * by bit from highest- to lowest-order term without requiring any bit * shuffling on our part. Reception works similarly. * * The feedback terms table consists of 256, 32-bit entries. Notes * * The table can be generated at runtime if desired; code to do so * is shown later. It might not be obvious, but the feedback * terms simply represent the results of eight shift/xor opera- * tions for all combinations of data and CRC register values. * * The values must be right-shifted by eight bits by the "updcrc" * logic; the shift must be unsigned (bring in zeroes). On some * hardware you could probably optimize the shift in assembler by * using byte-swap instructions. * polynomial $edb88320 * */ #include #include "crc32.h" static const uint32_t crc32_tab[] = { 0x00000000L, 0x77073096L, 0xee0e612cL, 0x990951baL, 0x076dc419L, 0x706af48fL, 0xe963a535L, 0x9e6495a3L, 0x0edb8832L, 0x79dcb8a4L, 0xe0d5e91eL, 0x97d2d988L, 0x09b64c2bL, 0x7eb17cbdL, 0xe7b82d07L, 0x90bf1d91L, 0x1db71064L, 0x6ab020f2L, 0xf3b97148L, 0x84be41deL, 0x1adad47dL, 0x6ddde4ebL, 0xf4d4b551L, 0x83d385c7L, 0x136c9856L, 0x646ba8c0L, 0xfd62f97aL, 0x8a65c9ecL, 0x14015c4fL, 0x63066cd9L, 0xfa0f3d63L, 0x8d080df5L, 0x3b6e20c8L, 0x4c69105eL, 0xd56041e4L, 0xa2677172L, 0x3c03e4d1L, 0x4b04d447L, 0xd20d85fdL, 0xa50ab56bL, 0x35b5a8faL, 0x42b2986cL, 0xdbbbc9d6L, 0xacbcf940L, 0x32d86ce3L, 0x45df5c75L, 0xdcd60dcfL, 0xabd13d59L, 0x26d930acL, 0x51de003aL, 0xc8d75180L, 0xbfd06116L, 0x21b4f4b5L, 0x56b3c423L, 0xcfba9599L, 0xb8bda50fL, 0x2802b89eL, 0x5f058808L, 0xc60cd9b2L, 0xb10be924L, 0x2f6f7c87L, 0x58684c11L, 0xc1611dabL, 0xb6662d3dL, 0x76dc4190L, 0x01db7106L, 0x98d220bcL, 0xefd5102aL, 0x71b18589L, 0x06b6b51fL, 0x9fbfe4a5L, 0xe8b8d433L, 0x7807c9a2L, 0x0f00f934L, 0x9609a88eL, 0xe10e9818L, 0x7f6a0dbbL, 0x086d3d2dL, 0x91646c97L, 0xe6635c01L, 0x6b6b51f4L, 0x1c6c6162L, 0x856530d8L, 0xf262004eL, 0x6c0695edL, 0x1b01a57bL, 0x8208f4c1L, 0xf50fc457L, 0x65b0d9c6L, 0x12b7e950L, 0x8bbeb8eaL, 0xfcb9887cL, 0x62dd1ddfL, 0x15da2d49L, 0x8cd37cf3L, 0xfbd44c65L, 0x4db26158L, 0x3ab551ceL, 0xa3bc0074L, 0xd4bb30e2L, 0x4adfa541L, 0x3dd895d7L, 0xa4d1c46dL, 0xd3d6f4fbL, 0x4369e96aL, 0x346ed9fcL, 0xad678846L, 0xda60b8d0L, 0x44042d73L, 0x33031de5L, 0xaa0a4c5fL, 0xdd0d7cc9L, 0x5005713cL, 0x270241aaL, 0xbe0b1010L, 0xc90c2086L, 0x5768b525L, 0x206f85b3L, 0xb966d409L, 0xce61e49fL, 0x5edef90eL, 0x29d9c998L, 0xb0d09822L, 0xc7d7a8b4L, 0x59b33d17L, 0x2eb40d81L, 0xb7bd5c3bL, 0xc0ba6cadL, 0xedb88320L, 0x9abfb3b6L, 0x03b6e20cL, 0x74b1d29aL, 0xead54739L, 0x9dd277afL, 0x04db2615L, 0x73dc1683L, 0xe3630b12L, 0x94643b84L, 0x0d6d6a3eL, 0x7a6a5aa8L, 0xe40ecf0bL, 0x9309ff9dL, 0x0a00ae27L, 0x7d079eb1L, 0xf00f9344L, 0x8708a3d2L, 0x1e01f268L, 0x6906c2feL, 0xf762575dL, 0x806567cbL, 0x196c3671L, 0x6e6b06e7L, 0xfed41b76L, 0x89d32be0L, 0x10da7a5aL, 0x67dd4accL, 0xf9b9df6fL, 0x8ebeeff9L, 0x17b7be43L, 0x60b08ed5L, 0xd6d6a3e8L, 0xa1d1937eL, 0x38d8c2c4L, 0x4fdff252L, 0xd1bb67f1L, 0xa6bc5767L, 0x3fb506ddL, 0x48b2364bL, 0xd80d2bdaL, 0xaf0a1b4cL, 0x36034af6L, 0x41047a60L, 0xdf60efc3L, 0xa867df55L, 0x316e8eefL, 0x4669be79L, 0xcb61b38cL, 0xbc66831aL, 0x256fd2a0L, 0x5268e236L, 0xcc0c7795L, 0xbb0b4703L, 0x220216b9L, 0x5505262fL, 0xc5ba3bbeL, 0xb2bd0b28L, 0x2bb45a92L, 0x5cb36a04L, 0xc2d7ffa7L, 0xb5d0cf31L, 0x2cd99e8bL, 0x5bdeae1dL, 0x9b64c2b0L, 0xec63f226L, 0x756aa39cL, 0x026d930aL, 0x9c0906a9L, 0xeb0e363fL, 0x72076785L, 0x05005713L, 0x95bf4a82L, 0xe2b87a14L, 0x7bb12baeL, 0x0cb61b38L, 0x92d28e9bL, 0xe5d5be0dL, 0x7cdcefb7L, 0x0bdbdf21L, 0x86d3d2d4L, 0xf1d4e242L, 0x68ddb3f8L, 0x1fda836eL, 0x81be16cdL, 0xf6b9265bL, 0x6fb077e1L, 0x18b74777L, 0x88085ae6L, 0xff0f6a70L, 0x66063bcaL, 0x11010b5cL, 0x8f659effL, 0xf862ae69L, 0x616bffd3L, 0x166ccf45L, 0xa00ae278L, 0xd70dd2eeL, 0x4e048354L, 0x3903b3c2L, 0xa7672661L, 0xd06016f7L, 0x4969474dL, 0x3e6e77dbL, 0xaed16a4aL, 0xd9d65adcL, 0x40df0b66L, 0x37d83bf0L, 0xa9bcae53L, 0xdebb9ec5L, 0x47b2cf7fL, 0x30b5ffe9L, 0xbdbdf21cL, 0xcabac28aL, 0x53b39330L, 0x24b4a3a6L, 0xbad03605L, 0xcdd70693L, 0x54de5729L, 0x23d967bfL, 0xb3667a2eL, 0xc4614ab8L, 0x5d681b02L, 0x2a6f2b94L, 0xb40bbe37L, 0xc30c8ea1L, 0x5a05df1bL, 0x2d02ef8dL }; /* * This a generic crc32() function, it takes seed as an argument, * and does __not__ xor at the end. Then individual users can do * whatever they need. */ uint32_t crc32(uint32_t seed, const unsigned char *buf, size_t len) { uint32_t crc = seed; const unsigned char *p = buf; while(len-- > 0) crc = crc32_tab[(crc ^ *p++) & 0xff] ^ (crc >> 8); return crc; } util-linux-2.20.1/lib/linux_version.c0000664000076400007640000000066111640045336014464 00000000000000#include #include #include "linux_version.h" int get_linux_version (void) { static int kver = -1; struct utsname uts; int major = 0; int minor = 0; int teeny = 0; int n; if (kver != -1) return kver; if (uname (&uts)) return kver = 0; n = sscanf(uts.release, "%d.%d.%d", &major, &minor, &teeny); if (n < 1 || n > 3) return kver = 0; return kver = KERNEL_VERSION(major, minor, teeny); } util-linux-2.20.1/lib/wholedisk.c0000664000076400007640000000203111573627634013556 00000000000000 #include #include #include #include "blkdev.h" #include "wholedisk.h" int is_whole_disk_fd(int fd, const char *name) { #ifdef HDIO_GETGEO if (fd != -1) { struct hd_geometry geometry; int i = ioctl(fd, HDIO_GETGEO, &geometry); if (i == 0) return geometry.start == 0; } #endif /* * The "silly heuristic" is still sexy for us, because * for example Xen doesn't implement HDIO_GETGEO for virtual * block devices (/dev/xvda). * * -- kzak@redhat.com (23-Feb-2006) */ while (*name) name++; return !isdigit(name[-1]); } int is_whole_disk(const char *name) { int fd = -1, res = 0; #ifdef HDIO_GETGEO fd = open(name, O_RDONLY); if (fd != -1) #endif res = is_whole_disk_fd(fd, name); if (fd != -1) close(fd); return res; } #ifdef TEST_PROGRAM int main(int argc, char **argv) { if (argc < 2) { fprintf(stderr, "usage: %s \n", argv[0]); exit(EXIT_FAILURE); } printf("%s: is%s whole disk\n", argv[1], is_whole_disk(argv[1]) ? "" : " NOT"); exit(EXIT_SUCCESS); } #endif util-linux-2.20.1/lib/mangle.c0000664000076400007640000000444211640045336013024 00000000000000/* * Functions for \oct encoding used in mtab/fstab/swaps/etc. * * Based on code from mount(8). * * Copyright (C) 2010 Karel Zak */ #include #include #include #include #include "mangle.h" #include "c.h" #define isoctal(a) (((a) & ~7) == '0') static unsigned char need_escaping[] = { ' ', '\t', '\n', '\\' }; char *mangle(const char *s) { char *ss, *sp; size_t n; if (!s) return NULL; n = strlen(s); ss = sp = malloc(4*n+1); if (!sp) return NULL; while(1) { for (n = 0; n < sizeof(need_escaping); n++) { if (*s == need_escaping[n]) { *sp++ = '\\'; *sp++ = '0' + ((*s & 0300) >> 6); *sp++ = '0' + ((*s & 070) >> 3); *sp++ = '0' + (*s & 07); goto next; } } *sp++ = *s; if (*s == 0) break; next: s++; } return ss; } void unmangle_to_buffer(const char *s, char *buf, size_t len) { size_t sz = 0; if (!s) return; while(*s && sz < len - 1) { if (*s == '\\' && sz + 4 < len - 1 && isoctal(s[1]) && isoctal(s[2]) && isoctal(s[3])) { *buf++ = 64*(s[1] & 7) + 8*(s[2] & 7) + (s[3] & 7); s += 4; sz += 4; } else { *buf++ = *s++; sz++; } } *buf = '\0'; } static inline char *skip_nonspaces(const char *s) { while (*s && !(*s == ' ' || *s == '\t')) s++; return (char *) s; } /* * Returns mallocated buffer or NULL in case of error. */ char *unmangle(const char *s, char **end) { char *buf; char *e; size_t sz; if (!s) return NULL; e = skip_nonspaces(s); sz = e - s + 1; if (end) *end = e; if (e == s) return NULL; /* empty string */ buf = malloc(sz); if (!buf) return NULL; unmangle_to_buffer(s, buf, sz); return buf; } #ifdef TEST_PROGRAM #include int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "usage: %s --mangle | --unmangle \n", program_invocation_short_name); return EXIT_FAILURE; } if (!strcmp(argv[1], "--mangle")) printf("mangled: '%s'\n", mangle(argv[2])); else if (!strcmp(argv[1], "--unmangle")) { char *x = unmangle(argv[2], NULL); if (x) { printf("unmangled: '%s'\n", x); free(x); } x = strdup(argv[2]); unmangle_to_buffer(x, x, strlen(x) + 1); if (x) { printf("self-unmangled: '%s'\n", x); free(x); } } return EXIT_SUCCESS; } #endif /* TEST_PROGRAM */ util-linux-2.20.1/example.files/0000775000076400007640000000000011647254463013471 500000000000000util-linux-2.20.1/example.files/shells0000664000076400007640000000004511647254463014625 00000000000000/bin/sh /bin/bash /bin/csh /bin/tcsh util-linux-2.20.1/example.files/securetty0000664000076400007640000000003211647254463015356 00000000000000tty1 tty2 tty3 tty4 ttyS1 util-linux-2.20.1/example.files/udev-raw.rules0000664000076400007640000000047411647254463016224 00000000000000# Enter raw device bindings here. # # An example would be: # ACTION=="add", KERNEL=="sda", RUN+="/bin/raw /dev/raw/raw1 %N" # to bind /dev/raw/raw1 to /dev/sda, or # ACTION=="add", ENV{MAJOR}=="8", ENV{MINOR}=="1", RUN+="/bin/raw /dev/raw/raw2 %M %m" # to bind /dev/raw/raw2 to the device with major 8, minor 1. util-linux-2.20.1/example.files/fstab0000664000076400007640000000147511647254463014442 00000000000000# /etc/fstab # static file system information # # This file is not used by the kernel, but rather by mount(8) and umount(8) # (and some day fsck(8)). Comment lines have "#" in the first column. # # For more information see fstab(5) man page. # # device directory type options freq pass UUID=2cda1e08-1f22-490b-9101-c93d511bc9c9 / ext4 defaults 1 1 UUID=805e7418-fc20-4dcf-830c-729781e58d1a /boot ext4 defaults 1 2 proc /proc proc defaults 0 0 sysfs /sys sysfs defaults 0 0 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 util-linux-2.20.1/example.files/motd0000664000076400007640000000053011647254463014275 00000000000000 |^^^^^^| | | _____________________ | | / \ | (o)(o) | | @ _) | BOGUS man!! | | ,___| ,,| | | / ..'' | | /____\ \_____________________/ util-linux-2.20.1/example.files/filesystems0000664000076400007640000000005111647254463015677 00000000000000ext4 ext3 vfat hfs hfsplus iso9660 btrfs util-linux-2.20.1/README.licensing0000664000076400007640000000116411627117024013476 00000000000000 The project util-linux doesn't use the same license for all of the code. There is code under: * GPLv3+ (GNU General Public License version 3, or any later version) * GPLv2+ (GNU General Public License version 2, or any later version) * GPLv2 (GNU General Public License version 2) * LGPLv2+ (GNU Lesser General Public License v2 (or 2.1) or any later version) * BSD with advertising * Public Domain Please, check the source code for more details. A license is usually at the start of each source file. The /COPYING file (GPLv2+) is the default license for code without an explicitly defined license. util-linux-2.20.1/licenses/0000775000076400007640000000000011647254463012542 500000000000000util-linux-2.20.1/licenses/COPYING.GPL0000664000076400007640000004307611647254463014150 00000000000000 GNU GENERAL PUBLIC LICENSE Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 675 Mass Ave, Cambridge, MA 02139, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users. This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it. (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.) You can apply it to your programs, too. When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things. To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it. For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software. Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software. If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations. Finally, any free program is threatened constantly by software patents. We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary. To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License. The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language. (Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does. 1. You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program. You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee. 2. You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions: a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change. b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. c) If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License. (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.) These requirements apply to the modified work as a whole. If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it. Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program. In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License. 3. You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following: a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or, c) Accompany it with the information you received as to the offer to distribute corresponding source code. (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.) The source code for a work means the preferred form of the work for making modifications to it. For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable. However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable. If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code. 4. You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License. Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License. However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance. 5. You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License. Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it. 6. Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions. You may not impose any further restrictions on the recipients' exercise of the rights granted herein. You are not responsible for enforcing compliance by third parties to this License. 7. If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all. For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program. If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances. It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices. Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice. This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License. 8. If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded. In such case, this License incorporates the limitation as if written in the body of this License. 9. The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. Each version is given a distinguishing version number. If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation. 10. If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission. For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. END OF TERMS AND CONDITIONS Appendix: How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. Copyright (C) 19yy This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: Gnomovision version 69, Copyright (C) 19yy name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program. You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary. Here is a sample; alter the names: Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker. , 1 April 1989 Ty Coon, President of Vice This General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Library General Public License instead of this License. util-linux-2.20.1/licenses/COPYING.UCB0000664000076400007640000000344011647254463014126 00000000000000/* * Copyright (c) 1989 The Regents of the University of California. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions * are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: * This product includes software developed by the University of * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. */ util-linux-2.20.1/po/0000775000076400007640000000000011647764041011351 500000000000000util-linux-2.20.1/po/zh_TW.po0000664000076400007640000142426411647754036012704 00000000000000# Traditional Chinese Messages for util-linux-ng. # Copyright (C) 2005 Free Software Foundation, Inc. # This file is distributed under the same license as the util-linux-ng package. # Wei-Lun Chao , 2010. # msgid "" msgstr "" "Project-Id-Version: util-linux-ng 2.18-rc2\n" "Report-Msgid-Bugs-To: util-linux@vger.kernel.org\n" "POT-Creation-Date: 2011-10-20 10:13+0200\n" "PO-Revision-Date: 2010-08-22 00:14+0800\n" "Last-Translator: Wei-Lun Chao \n" "Language-Team: Chinese (traditional) \n" "Language: zh_TW\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=1; plural=0;\n" #: disk-utils/blockdev.c:61 msgid "set read-only" msgstr "設定唯讀" #: disk-utils/blockdev.c:68 msgid "set read-write" msgstr "設定可讀寫" #: disk-utils/blockdev.c:74 msgid "get read-only" msgstr "取得唯讀" #: disk-utils/blockdev.c:80 msgid "get discard zeroes support status" msgstr "" #: disk-utils/blockdev.c:86 msgid "get logical block (sector) size" msgstr "取得邏輯區塊 (çŁĺŤ€) 大小" #: disk-utils/blockdev.c:92 msgid "get physical block (sector) size" msgstr "取得實際區塊 (çŁĺŤ€) 大小" #: disk-utils/blockdev.c:98 msgid "get minimum I/O size" msgstr "取得最小 I/O 大小" #: disk-utils/blockdev.c:104 msgid "get optimal I/O size" msgstr "取得最佳化 I/O 大小" #: disk-utils/blockdev.c:110 #, fuzzy msgid "get alignment offset in bytes" msgstr "取得對齊ĺŹç§»ĺ€Ľ" #: disk-utils/blockdev.c:116 msgid "get max sectors per request" msgstr "取得單一č¦ć±‚最大çŁĺŤ€" #: disk-utils/blockdev.c:122 msgid "get blocksize" msgstr "取得區塊大小" #: disk-utils/blockdev.c:129 msgid "set blocksize" msgstr "設定區塊大小" #: disk-utils/blockdev.c:135 #, fuzzy msgid "get 32-bit sector count (deprecated, use --getsz)" msgstr "取得 32-bit çŁĺŤ€ć•¸" #: disk-utils/blockdev.c:141 msgid "get size in bytes" msgstr "以位ĺ…組為單位取得大小" #: disk-utils/blockdev.c:148 msgid "set readahead" msgstr "設定é ĺ…讀取" #: disk-utils/blockdev.c:154 msgid "get readahead" msgstr "取得é ĺ…讀取" #: disk-utils/blockdev.c:161 msgid "set filesystem readahead" msgstr "設定檔ćˇçł»çµ±é ĺ…讀取" #: disk-utils/blockdev.c:167 msgid "get filesystem readahead" msgstr "取得檔ćˇçł»çµ±é ĺ…讀取" #: disk-utils/blockdev.c:171 msgid "flush buffers" msgstr "清ç†ç·©čˇťĺŤ€" #: disk-utils/blockdev.c:175 msgid "reread partition table" msgstr "重新讀取ĺ†ĺ‰˛čˇ¨" #: disk-utils/blockdev.c:182 #, c-format msgid "" "\n" "Usage:\n" " %1$s -V\n" " %1$s --report [devices]\n" " %1$s [-v|-q] commands devices\n" "\n" "Available commands:\n" msgstr "" #: disk-utils/blockdev.c:188 #, fuzzy, c-format msgid " %-25s get size in 512-byte sectors\n" msgstr "以 512 位ĺ…組為單位取得大小" #: disk-utils/blockdev.c:230 disk-utils/fsck.minix.c:1272 #: disk-utils/isosize.c:196 disk-utils/mkfs.c:59 disk-utils/mkfs.minix.c:662 #: misc-utils/ddate.c:181 mount/swapon.c:721 mount/swapon.c:773 #: sys-utils/readprofile.c:184 sys-utils/tunelp.c:86 #, c-format msgid "%s (%s)\n" msgstr "%s (%s)\n" #: disk-utils/blockdev.c:274 disk-utils/blockdev.c:418 #: disk-utils/blockdev.c:443 disk-utils/mkfs.bfs.c:178 #: disk-utils/mkfs.cramfs.c:788 sys-utils/ldattach.c:273 #, c-format msgid "cannot open %s" msgstr "無法開啟 %s" #: disk-utils/blockdev.c:309 #, fuzzy msgid "could not get device size" msgstr "無法取得çŁç˘źĺ¤§ĺ°Ź" #: disk-utils/blockdev.c:315 #, fuzzy, c-format msgid "Unknown command: %s" msgstr "%s:不ćŽçš„命令:%s\n" #: disk-utils/blockdev.c:331 #, fuzzy, c-format msgid "%s requires an argument" msgstr "%s 需č¦ä¸€ĺ€‹ĺĽ•數\n" #: disk-utils/blockdev.c:368 #, c-format msgid "%s failed.\n" msgstr "%s 失敗。\n" #: disk-utils/blockdev.c:375 #, c-format msgid "%s succeeded.\n" msgstr "%s ć功。\n" #: disk-utils/blockdev.c:459 #, fuzzy, c-format msgid "ioctl error on %s" msgstr "%s:ioctl 錯誤發生於 %s\n" #: disk-utils/blockdev.c:467 #, c-format msgid "RO RA SSZ BSZ StartSec Size Device\n" msgstr "RO RA SSZ BSZ čµ·ĺ§‹çŁĺŤ€ 大小 裝置\n" #: disk-utils/elvtune.c:48 #, c-format msgid "usage:\n" msgstr "用法:\n" #: disk-utils/elvtune.c:53 #, c-format msgid "\tNOTE: elvtune only works with 2.4 kernels\n" msgstr "\t註č¨ďĽšelvtune 只é©ç”¨ć–Ľ 2.4 ĺ…§ć ¸\n" #: disk-utils/elvtune.c:107 #, c-format msgid "missing blockdevice, use -h for help\n" msgstr "缺少區塊裝置,使用 -h 以獲得說ćŽ\n" #: disk-utils/elvtune.c:128 #, c-format msgid "" "\n" "elvtune is only useful on older kernels;\n" "for 2.6 use IO scheduler sysfs tunables instead..\n" msgstr "" "\n" " elvtune 只é©ç”¨ć–ĽčŠçš„內核;\n" "ć–Ľ 2.6 請使用 IO 排程程式 sysfs tunables ĺšç‚şć›żä»Łă€‚\n" #: disk-utils/fdformat.c:27 #, c-format msgid "Formatting ... " msgstr "格式化中…" #: disk-utils/fdformat.c:47 disk-utils/fdformat.c:87 #, c-format msgid "done\n" msgstr "已完ć\n" #: disk-utils/fdformat.c:58 #, c-format msgid "Verifying ... " msgstr "驗證中…" #: disk-utils/fdformat.c:61 disk-utils/fdformat.c:153 #: disk-utils/mkfs.cramfs.c:663 term-utils/wall.c:262 #, fuzzy, c-format msgid "cannot open file %s" msgstr "ç„ˇćł•é–‹ĺ•źćŞ”ćˇ '%s'" #: disk-utils/fdformat.c:70 msgid "Read: " msgstr "讀取:" #: disk-utils/fdformat.c:72 #, c-format msgid "Problem reading cylinder %d, expected %d, read %d\n" msgstr "問題發生在讀取第 %d 個çŁćź±ć™‚,é č¨čł‡ć–™ç‚ş %d,實際讀取資料為 %d\n" #: disk-utils/fdformat.c:80 #, c-format msgid "" "bad data in cyl %d\n" "Continuing ... " msgstr "" "第 %d 個çŁćź±ćś‰ĺŁžčł‡ć–™ă€‚\n" "繼續進行..." #: disk-utils/fdformat.c:94 #, fuzzy, c-format msgid "Usage: %s [options] device\n" msgstr "用法:%s [é¸é …] 裝置…\n" #: disk-utils/fdformat.c:97 #, c-format msgid "" "\n" "Options:\n" " -n, --no-verify disable the verification after the format\n" " -V, --version output version information and exit\n" " -h, --help display this help and exit\n" "\n" msgstr "" #: disk-utils/fdformat.c:129 disk-utils/mkfs.bfs.c:88 #: disk-utils/mkfs.cramfs.c:767 disk-utils/mkswap.c:498 fdisk/sfdisk.c:2654 #: fsck/fsck.c:1414 getopt/getopt.c:430 hwclock/hwclock.c:1354 #: misc-utils/cal.c:351 misc-utils/kill.c:195 misc-utils/logger.c:234 #: misc-utils/look.c:124 misc-utils/mcookie.c:116 misc-utils/namei.c:458 #: misc-utils/rename.c:99 misc-utils/uuidd.c:509 misc-utils/uuidgen.c:75 #: misc-utils/whereis.c:403 misc-utils/wipefs.c:361 schedutils/ionice.c:169 #: sys-utils/dmesg.c:684 term-utils/agetty.c:664 term-utils/mesg.c:103 #: term-utils/script.c:211 term-utils/scriptreplay.c:170 #: term-utils/setterm.c:811 term-utils/wall.c:139 term-utils/write.c:110 #: text-utils/col.c:210 text-utils/colcrt.c:116 text-utils/colrm.c:171 #: text-utils/column.c:149 text-utils/hexsyntax.c:114 text-utils/rev.c:112 #: text-utils/tailf.c:263 text-utils/ul.c:193 #, c-format msgid "%s from %s\n" msgstr "%s 來自 %s\n" #: disk-utils/fdformat.c:144 #, fuzzy, c-format msgid "cannot stat file %s" msgstr "無法č­ĺĄčŁťç˝®ç‹€ć…‹ %s" #: disk-utils/fdformat.c:147 misc-utils/lsblk.c:788 partx/partx.c:803 #: sys-utils/mountpoint.c:102 #, fuzzy, c-format msgid "%s: not a block device" msgstr "%s:不ćŻĺŤ€ĺˇŠčŁťç˝®\n" #: disk-utils/fdformat.c:149 #, fuzzy, c-format msgid "cannot access file %s" msgstr "ç„ˇćł•é–‹ĺ•źćŞ”ćˇ '%s'" #: disk-utils/fdformat.c:155 msgid "Could not determine current format type" msgstr "無法決定目前的格式類型" #: disk-utils/fdformat.c:157 #, c-format msgid "%s-sided, %d tracks, %d sec/track. Total capacity %d kB.\n" msgstr "%s面ă€%d çŁč»Śă€%d çŁĺŤ€/çŁč»Śă€‚總容量 %d kB。\n" #: disk-utils/fdformat.c:158 msgid "Double" msgstr "é›™" #: disk-utils/fdformat.c:158 msgid "Single" msgstr "ĺ–®" #: disk-utils/fsck.cramfs.c:113 #, c-format msgid "" "usage: %s [-hv] [-x dir] file\n" " -h print this help\n" " -x dir extract into dir\n" " -v be more verbose\n" " file file to test\n" msgstr "" "用法:%s [-hv] [-x dir] file\n" " -h 印出這個說ćŽ\n" " -x dir č§Łé–‹ĺ°ç›®éŚ„\n" " -v 更詳細的訊ćŻ\n" " file 用來測試的檔ćˇ\n" #: disk-utils/fsck.cramfs.c:141 #, c-format msgid "stat failed: %s" msgstr "狀態取得失敗:%s" #: disk-utils/fsck.cramfs.c:145 disk-utils/fsck.cramfs.c:497 #: sys-utils/rtcwake.c:115 sys-utils/rtcwake.c:274 sys-utils/rtcwake.c:512 #: term-utils/script.c:232 term-utils/script.c:553 #, c-format msgid "open failed: %s" msgstr "開啟失敗:%s" #: disk-utils/fsck.cramfs.c:151 #, c-format msgid "ioctl failed: unable to determine device size: %s" msgstr "ioctl 失敗:無法決定裝置大小:%s" #: disk-utils/fsck.cramfs.c:157 #, c-format msgid "not a block device or file: %s" msgstr "不ćŻĺŤ€ĺˇŠčŁťç˝®ć–檔ćˇďĽš%s" #: disk-utils/fsck.cramfs.c:160 disk-utils/fsck.cramfs.c:194 msgid "file length too short" msgstr "檔ćˇé•·ĺş¦ĺ¤Şçź­" #: disk-utils/fsck.cramfs.c:164 disk-utils/fsck.cramfs.c:170 #: disk-utils/fsck.cramfs.c:226 disk-utils/fsck.cramfs.c:243 #, c-format msgid "read failed: %s" msgstr "讀取失敗:%s" #: disk-utils/fsck.cramfs.c:174 disk-utils/fsck.cramfs.c:176 msgid "superblock magic not found" msgstr "找不ĺ°č¶…區塊的魔術標č¨" #: disk-utils/fsck.cramfs.c:179 #, c-format msgid "cramfs endianness is %s\n" msgstr "" #: disk-utils/fsck.cramfs.c:180 msgid "big" msgstr "" #: disk-utils/fsck.cramfs.c:180 msgid "little" msgstr "" #: disk-utils/fsck.cramfs.c:184 msgid "unsupported filesystem features" msgstr "不受支援的檔ćˇçł»çµ±ç‰ąĺľµ" #: disk-utils/fsck.cramfs.c:187 #, c-format msgid "superblock size (%d) too small" msgstr "超區塊大小 (%d) 太小" #: disk-utils/fsck.cramfs.c:192 msgid "zero file count" msgstr "零個檔ćˇč¨ć•¸" #: disk-utils/fsck.cramfs.c:197 #, c-format msgid "warning: file extends past end of filesystem\n" msgstr "警告:檔ćˇĺ»¶äĽ¸č¶…éŽćŞ”ćˇçł»çµ±ćś«ç«Ż\n" #: disk-utils/fsck.cramfs.c:199 #, c-format msgid "warning: old cramfs format\n" msgstr "警告:čŠçš„ cramfs 格式\n" #: disk-utils/fsck.cramfs.c:211 msgid "unable to test CRC: old cramfs format" msgstr "無法測試循環冗é¤ćŞ˘ćźĄďĽščŠçš„ cramfs 格式" #: disk-utils/fsck.cramfs.c:262 msgid "crc error" msgstr "循環冗é¤ćŞ˘ćźĄéŚŻčŞ¤" #: disk-utils/fsck.cramfs.c:323 msgid "root inode is not directory" msgstr "ć ą inode 並非目錄" #: disk-utils/fsck.cramfs.c:327 #, c-format msgid "bad root offset (%lu)" msgstr "不當的根ĺŹç§» (%lu)" #: disk-utils/fsck.cramfs.c:345 msgid "data block too large" msgstr "資料區塊太大" #: disk-utils/fsck.cramfs.c:349 #, c-format msgid "decompression error %p(%d): %s" msgstr "解壓縮錯誤 %p(%d):%s" #: disk-utils/fsck.cramfs.c:375 #, c-format msgid " hole at %ld (%zd)\n" msgstr " 漏洞位於 %ld (%zd)\n" #: disk-utils/fsck.cramfs.c:382 disk-utils/fsck.cramfs.c:536 #, c-format msgid " uncompressing block at %ld to %ld (%ld)\n" msgstr " 解壓縮區塊位於 %ld ĺ° %ld (%ld)\n" #: disk-utils/fsck.cramfs.c:389 #, c-format msgid "non-block (%ld) bytes" msgstr "非區塊 (%ld) 位ĺ…組" #: disk-utils/fsck.cramfs.c:393 #, c-format msgid "non-size (%ld vs %ld) bytes" msgstr "非大小 (%ld vs %ld) 位ĺ…組" #: disk-utils/fsck.cramfs.c:399 #, c-format msgid "write failed: %s" msgstr "寫入失敗:%s" #: disk-utils/fsck.cramfs.c:411 #, c-format msgid "lchown failed: %s" msgstr "lchown 失敗:%s" #: disk-utils/fsck.cramfs.c:415 #, c-format msgid "chown failed: %s" msgstr "chown 失敗:%s" #: disk-utils/fsck.cramfs.c:420 #, c-format msgid "utime failed: %s" msgstr "utime 失敗:%s" #: disk-utils/fsck.cramfs.c:432 #, c-format msgid "directory inode has zero offset and non-zero size: %s" msgstr "目錄 inode 有零ĺŹç§»ĺ€Ľĺ’Śéťžé›¶ĺ¤§ĺ°ŹďĽš%s" #: disk-utils/fsck.cramfs.c:447 #, c-format msgid "mkdir failed: %s" msgstr "mkdir 失敗:%s" #: disk-utils/fsck.cramfs.c:463 msgid "filename length is zero" msgstr "檔ĺŤé•·ĺş¦ç‚şé›¶" #: disk-utils/fsck.cramfs.c:465 msgid "bad filename length" msgstr "不當的檔ĺŤé•·ĺş¦" #: disk-utils/fsck.cramfs.c:471 msgid "bad inode offset" msgstr "不當的 inode ĺŹç§»ĺ€Ľ" #: disk-utils/fsck.cramfs.c:486 msgid "file inode has zero offset and non-zero size" msgstr "ćŞ”ćˇ inode 有零ĺŹç§»ĺ€Ľĺ’Śéťžé›¶ĺ¤§ĺ°Ź" #: disk-utils/fsck.cramfs.c:489 msgid "file inode has zero size and non-zero offset" msgstr "ćŞ”ćˇ inode 有零大小和非零ĺŹç§»ĺ€Ľ" #: disk-utils/fsck.cramfs.c:517 msgid "symbolic link has zero offset" msgstr "符號連çµćś‰é›¶ĺŹç§»ĺ€Ľ" #: disk-utils/fsck.cramfs.c:519 msgid "symbolic link has zero size" msgstr "符號連çµćś‰é›¶ĺ¤§ĺ°Ź" #: disk-utils/fsck.cramfs.c:528 #, c-format msgid "size error in symlink: %s" msgstr "大小錯誤發生於符號連çµďĽš%s" #: disk-utils/fsck.cramfs.c:542 #, c-format msgid "symlink failed: %s" msgstr "符號連çµĺ¤±ć•—:%s" #: disk-utils/fsck.cramfs.c:555 #, c-format msgid "special file has non-zero offset: %s" msgstr "特殊檔ćˇćś‰éťžé›¶ĺŹç§»ĺ€ĽďĽš%s" #: disk-utils/fsck.cramfs.c:565 #, c-format msgid "fifo has non-zero size: %s" msgstr "fifo 有非零大小:%s" #: disk-utils/fsck.cramfs.c:571 #, c-format msgid "socket has non-zero size: %s" msgstr "通訊端有非零大小:%s" #: disk-utils/fsck.cramfs.c:574 #, c-format msgid "bogus mode: %s (%o)" msgstr "ĺ‡é€ ć¨ˇĺĽŹďĽš%s (%o)" #: disk-utils/fsck.cramfs.c:583 #, c-format msgid "mknod failed: %s" msgstr "mknod 失敗:%s" #: disk-utils/fsck.cramfs.c:615 #, c-format msgid "directory data start (%ld) < sizeof(struct cramfs_super) + start (%ld)" msgstr "目錄資料起始 (%ld) < sizeof(struct cramfs_super) + čµ·ĺ§‹ (%ld)" #: disk-utils/fsck.cramfs.c:619 #, c-format msgid "directory data end (%ld) != file data start (%ld)" msgstr "目錄資料çµćťź (%ld) != 檔ćˇčł‡ć–™čµ·ĺ§‹ (%ld)" #: disk-utils/fsck.cramfs.c:624 msgid "invalid file data offset" msgstr "無ć•的檔ćˇčł‡ć–™ĺŹç§»ĺ€Ľ" #: disk-utils/fsck.cramfs.c:658 msgid "compiled without -x support" msgstr "編譯時不具 -x 支援" #: disk-utils/fsck.cramfs.c:676 fdisk/sfdisk.c:2880 #, c-format msgid "%s: OK\n" msgstr "%s:確定\n" #: disk-utils/fsck.minix.c:196 #, c-format msgid "Usage: %s [-larvsmf] /dev/name\n" msgstr "用法:%s [-larvsmf] /dev/name\n" #: disk-utils/fsck.minix.c:293 #, c-format msgid "%s is mounted.\t " msgstr "%s 已掛載。\t" #: disk-utils/fsck.minix.c:295 msgid "Do you really want to continue" msgstr "您真的č¦çąĽçşŚĺ—ŽďĽź" #: disk-utils/fsck.minix.c:299 #, c-format msgid "check aborted.\n" msgstr "已放棄檢查。\n" #: disk-utils/fsck.minix.c:318 disk-utils/fsck.minix.c:341 #, c-format msgid "Zone nr < FIRSTZONE in file `%s'." msgstr "區域 nr < 檔ćˇă€Ś%s」中的 FIRSTZONE。" #: disk-utils/fsck.minix.c:322 disk-utils/fsck.minix.c:345 #, c-format msgid "Zone nr >= ZONES in file `%s'." msgstr "區域 nr >= 檔ćˇă€Ś%s」中的 ZONES。" #: disk-utils/fsck.minix.c:327 disk-utils/fsck.minix.c:350 msgid "Remove block" msgstr "移除區塊" #: disk-utils/fsck.minix.c:368 #, c-format msgid "Read error: unable to seek to block in file '%s'\n" msgstr "讀取錯誤:無法在檔ćˇă€Ś%s」中ćśĺ°‹ĺ°ĺŤ€ĺˇŠ\n" #: disk-utils/fsck.minix.c:374 #, c-format msgid "Read error: bad block in file '%s'\n" msgstr "讀取錯誤:在檔ćˇă€Ś%s」中有不良區塊\n" #: disk-utils/fsck.minix.c:389 #, c-format msgid "" "Internal error: trying to write bad block\n" "Write request ignored\n" msgstr "" "ĺ…§é¨éŚŻčŞ¤ďĽšĺ—試寫入不良區塊\n" "寫入č¦ć±‚已忽略\n" #: disk-utils/fsck.minix.c:395 msgid "seek failed in write_block" msgstr "write_block 時ćśĺ°‹ĺ¤±ć•—" #: disk-utils/fsck.minix.c:398 #, c-format msgid "Write error: bad block in file '%s'\n" msgstr "寫入錯誤:在檔ćˇă€Ś%s」中有不良區塊\n" #: disk-utils/fsck.minix.c:514 msgid "seek failed in write_super_block" msgstr "write_super_block 時ćśĺ°‹ĺ¤±ć•—" #: disk-utils/fsck.minix.c:516 msgid "unable to write super-block" msgstr "無法寫入 super-block" #: disk-utils/fsck.minix.c:529 msgid "Unable to write inode map" msgstr "無法寫入 inode ĺ°Ťć " #: disk-utils/fsck.minix.c:532 msgid "Unable to write zone map" msgstr "無法寫入區域對ć " #: disk-utils/fsck.minix.c:535 msgid "Unable to write inodes" msgstr "無法寫入 inodes" #: disk-utils/fsck.minix.c:563 msgid "seek failed" msgstr "ćśĺ°‹ĺ¤±ć•—" #: disk-utils/fsck.minix.c:567 msgid "unable to alloc buffer for superblock" msgstr "無法配置緩衝區給超區塊" #: disk-utils/fsck.minix.c:570 msgid "unable to read super block" msgstr "無法讀取超區塊" #: disk-utils/fsck.minix.c:588 msgid "bad magic number in super-block" msgstr "超區塊中有不當的魔術數字" #: disk-utils/fsck.minix.c:590 msgid "Only 1k blocks/zones supported" msgstr "只有支援 1k 區塊/區域" #: disk-utils/fsck.minix.c:592 msgid "bad s_imap_blocks field in super-block" msgstr "超區塊中有不當的 s_imap_blocks 欄位" #: disk-utils/fsck.minix.c:594 msgid "bad s_zmap_blocks field in super-block" msgstr "超區塊中有不當的 s_zmap_blocks 欄位" #: disk-utils/fsck.minix.c:610 msgid "Unable to allocate buffer for inode map" msgstr "無法配置 inode ĺ°Ťć ç·©čˇťĺŤ€" #: disk-utils/fsck.minix.c:613 msgid "Unable to allocate buffer for zone map" msgstr "無法配置區域對ć ç·©čˇťĺŤ€" #: disk-utils/fsck.minix.c:618 msgid "Unable to allocate buffer for inodes" msgstr "無法配置 inodes 緩衝區" #: disk-utils/fsck.minix.c:621 msgid "Unable to allocate buffer for inode count" msgstr "無法配置 inode č¨ć•¸ç·©čˇťĺŤ€" #: disk-utils/fsck.minix.c:624 msgid "Unable to allocate buffer for zone count" msgstr "無法配置區域č¨ć•¸ç·©čˇťĺŤ€" #: disk-utils/fsck.minix.c:628 msgid "Unable to read inode map" msgstr "無法讀取 inode ĺ°Ťć " #: disk-utils/fsck.minix.c:632 msgid "Unable to read zone map" msgstr "無法讀取區域對ć " #: disk-utils/fsck.minix.c:636 msgid "Unable to read inodes" msgstr "無法讀取 inodes" #: disk-utils/fsck.minix.c:638 #, c-format msgid "Warning: Firstzone != Norm_firstzone\n" msgstr "警告:Firstzone != Norm_firstzone\n" #: disk-utils/fsck.minix.c:643 #, c-format msgid "%ld inodes\n" msgstr "%ld inodes\n" #: disk-utils/fsck.minix.c:644 #, c-format msgid "%ld blocks\n" msgstr "%ld 區塊\n" #: disk-utils/fsck.minix.c:645 disk-utils/mkfs.minix.c:541 #, c-format msgid "Firstdatazone=%ld (%ld)\n" msgstr "第一資料區=%ld (%ld)\n" #: disk-utils/fsck.minix.c:646 disk-utils/mkfs.minix.c:542 #, c-format msgid "Zonesize=%d\n" msgstr "區域大小=%d\n" #: disk-utils/fsck.minix.c:647 #, c-format msgid "Maxsize=%ld\n" msgstr "最大大小=%ld\n" #: disk-utils/fsck.minix.c:648 #, c-format msgid "Filesystem state=%d\n" msgstr "檔ćˇçł»çµ±ç‹€ć…‹=%d\n" #: disk-utils/fsck.minix.c:649 #, fuzzy, c-format msgid "" "namelen=%zd\n" "\n" msgstr "" "ĺŤç¨±é•·ĺş¦=%d\n" "\n" #: disk-utils/fsck.minix.c:664 disk-utils/fsck.minix.c:715 #, c-format msgid "Inode %d marked unused, but used for file '%s'\n" msgstr "Inode %d 標č¨ç‚şćśŞä˝żç”¨ďĽŚä˝†ćŻĺŤ»ç”¨ć–ĽćŞ”ćˇă€Ś%s」\n" #: disk-utils/fsck.minix.c:668 disk-utils/fsck.minix.c:719 msgid "Mark in use" msgstr "標č¨ç‚şä˝żç”¨ä¸­" #: disk-utils/fsck.minix.c:690 disk-utils/fsck.minix.c:739 #, c-format msgid "The file `%s' has mode %05o\n" msgstr "檔ćˇă€Ś%s」具有模式 %05o\n" #: disk-utils/fsck.minix.c:697 disk-utils/fsck.minix.c:745 #, c-format msgid "Warning: inode count too big.\n" msgstr "警告:inode 數量太大。\n" #: disk-utils/fsck.minix.c:757 disk-utils/fsck.minix.c:765 msgid "root inode isn't a directory" msgstr "ć ą inode 並非目錄" #: disk-utils/fsck.minix.c:777 disk-utils/fsck.minix.c:808 #, c-format msgid "Block has been used before. Now in file `%s'." msgstr "區塊於之前已使用。現在屬於檔ćˇă€Ś%s」。" #: disk-utils/fsck.minix.c:779 disk-utils/fsck.minix.c:810 #: disk-utils/fsck.minix.c:1133 disk-utils/fsck.minix.c:1143 #: disk-utils/fsck.minix.c:1189 disk-utils/fsck.minix.c:1198 msgid "Clear" msgstr "清除" #: disk-utils/fsck.minix.c:789 disk-utils/fsck.minix.c:820 #, c-format msgid "Block %d in file `%s' is marked not in use." msgstr "檔ćˇă€Ś%2$s」中的 區塊 %1$d 已標č¨ç‚şćśŞč˘«ä˝żç”¨ă€‚" #: disk-utils/fsck.minix.c:791 disk-utils/fsck.minix.c:822 msgid "Correct" msgstr "修正" #: disk-utils/fsck.minix.c:961 disk-utils/fsck.minix.c:1028 #, c-format msgid "The directory '%s' contains a bad inode number for file '%.*s'." msgstr "目錄「%s」ĺ«ćś‰ä¸Ťç•¶çš„ inode 編號於檔ćˇă€Ś%.*s」。" #: disk-utils/fsck.minix.c:964 disk-utils/fsck.minix.c:1031 msgid " Remove" msgstr " 移除" #: disk-utils/fsck.minix.c:978 disk-utils/fsck.minix.c:1045 #, c-format msgid "%s: bad directory: '.' isn't first\n" msgstr "%s:不當的目錄:「.」不ćŻç¬¬ä¸€ĺ€‹\n" #: disk-utils/fsck.minix.c:986 disk-utils/fsck.minix.c:1054 #, c-format msgid "%s: bad directory: '..' isn't second\n" msgstr "%s:不當的目錄:「..」不ćŻç¬¬äşŚĺ€‹\n" #: disk-utils/fsck.minix.c:1088 disk-utils/fsck.minix.c:1106 msgid "internal error" msgstr "ĺ…§é¨éŚŻčŞ¤" #: disk-utils/fsck.minix.c:1091 disk-utils/fsck.minix.c:1109 #, c-format msgid "%s: bad directory: size < 32" msgstr "%s:不當的目錄:大小 < 32" #: disk-utils/fsck.minix.c:1122 msgid "seek failed in bad_zone" msgstr "在ćŤćŻ€ĺŤ€ĺźźä¸­ćśĺ°‹ĺ¤±ć•—" #: disk-utils/fsck.minix.c:1132 disk-utils/fsck.minix.c:1188 #, fuzzy, c-format msgid "Inode %lu mode not cleared." msgstr "Inode %d 模式無法清空。" #: disk-utils/fsck.minix.c:1141 disk-utils/fsck.minix.c:1197 #, fuzzy, c-format msgid "Inode %lu not used, marked used in the bitmap." msgstr "Inode %d 未被使用,在點陣圖中標č¨ç‚şä˝żç”¨ă€‚" #: disk-utils/fsck.minix.c:1148 disk-utils/fsck.minix.c:1203 #, fuzzy, c-format msgid "Inode %lu used, marked unused in the bitmap." msgstr "Inode %d 已使用,在點陣圖中標č¨ç‚şćśŞä˝żç”¨ă€‚" #: disk-utils/fsck.minix.c:1150 disk-utils/fsck.minix.c:1204 msgid "Set" msgstr "設定" #: disk-utils/fsck.minix.c:1154 disk-utils/fsck.minix.c:1208 #, fuzzy, c-format msgid "Inode %lu (mode = %07o), i_nlinks=%d, counted=%d." msgstr "Inode %d (模式 = %07o),i_nlinks=%d,數量=%d。" #: disk-utils/fsck.minix.c:1156 disk-utils/fsck.minix.c:1210 msgid "Set i_nlinks to count" msgstr "設定 in_links 加入č¨ć•¸" #: disk-utils/fsck.minix.c:1168 disk-utils/fsck.minix.c:1222 #, fuzzy, c-format msgid "Zone %lu: marked in use, no file uses it." msgstr "區域 %d: 標č¨ç‚şä˝żç”¨ä¸­ďĽŚä˝†ç„ˇćŞ”ćˇä˝żç”¨ĺ®ă€‚" #: disk-utils/fsck.minix.c:1169 disk-utils/fsck.minix.c:1224 msgid "Unmark" msgstr "取ć¶ć¨™č¨" #: disk-utils/fsck.minix.c:1174 disk-utils/fsck.minix.c:1229 #, fuzzy, c-format msgid "Zone %lu: in use, counted=%d\n" msgstr "區域 %d: 使用中,數量=%d\n" #: disk-utils/fsck.minix.c:1177 disk-utils/fsck.minix.c:1232 #, fuzzy, c-format msgid "Zone %lu: not in use, counted=%d\n" msgstr "區域 %d: 未被使用,數量=%d\n" #: disk-utils/fsck.minix.c:1277 msgid "bad inode size" msgstr "不當的 inode 大小" #: disk-utils/fsck.minix.c:1279 msgid "bad v2 inode size" msgstr "不當的 v2 inode 大小" #: disk-utils/fsck.minix.c:1305 msgid "need terminal for interactive repairs" msgstr "需č¦çµ‚端機以進行互動式修復" #: disk-utils/fsck.minix.c:1309 #, c-format msgid "unable to open '%s': %s" msgstr "無法開啟「%s」:%s" #: disk-utils/fsck.minix.c:1324 #, c-format msgid "%s is clean, no check.\n" msgstr "%s 已清除,不ĺšćŞ˘ćźĄă€‚\n" #: disk-utils/fsck.minix.c:1328 #, c-format msgid "Forcing filesystem check on %s.\n" msgstr "強ĺ¶ćŞ˘ćźĄ %s 檔ćˇçł»çµ±ă€‚\n" #: disk-utils/fsck.minix.c:1330 #, c-format msgid "Filesystem on %s is dirty, needs checking.\n" msgstr "%s 檔ćˇçł»çµ±ä¸Ťäąľć·¨ďĽŚéś€č¦ćŞ˘ćźĄă€‚\n" #: disk-utils/fsck.minix.c:1363 #, c-format msgid "" "\n" "%6ld inodes used (%ld%%)\n" msgstr "" "\n" "%6ld inodes 已使用 (%ld%%)\n" #: disk-utils/fsck.minix.c:1368 #, c-format msgid "%6ld zones used (%ld%%)\n" msgstr "%6ld 區域已使用 (%ld%%)\n" #: disk-utils/fsck.minix.c:1370 #, c-format msgid "" "\n" "%6d regular files\n" "%6d directories\n" "%6d character device files\n" "%6d block device files\n" "%6d links\n" "%6d symbolic links\n" "------\n" "%6d files\n" msgstr "" "\n" "%6d 標準檔ćˇ\n" "%6d 目錄\n" "%6d ĺ­—ĺ…裝置檔ćˇ\n" "%6d 區塊裝置檔ćˇ\n" "%6d éŹçµ\n" "%6d 符號連çµ\n" "------\n" "%6d 檔ćˇ\n" #: disk-utils/fsck.minix.c:1383 #, c-format msgid "" "----------------------------\n" "FILE SYSTEM HAS BEEN CHANGED\n" "----------------------------\n" msgstr "" "----------------------------\n" "檔ćˇçł»çµ±ĺ·˛č®Šć›´\n" "----------------------------\n" #: disk-utils/isosize.c:125 #, fuzzy, c-format msgid "failed to open %s" msgstr "%s:開啟失敗:%s\n" #: disk-utils/isosize.c:128 #, fuzzy, c-format msgid "seek error on %s" msgstr "%s:於 %s 尋找錯誤\n" #: disk-utils/isosize.c:131 #, fuzzy, c-format msgid "read error on %s" msgstr "%s:於 %s 讀取錯誤\n" #: disk-utils/isosize.c:138 #, c-format msgid "sector count: %d, sector size: %d\n" msgstr "çŁĺŤ€ć•¸é‡ŹďĽš%d, çŁĺŤ€ĺ¤§ĺ°ŹďĽš%d\n" #: disk-utils/isosize.c:155 #, fuzzy, c-format msgid "" "\n" "Usage:\n" " %s [options] iso9660_image_file\n" msgstr "用法:%s [é¸é …] 裝置…\n" #: disk-utils/isosize.c:159 #, c-format msgid "" "\n" "Options:\n" " -d, --divisor=NUM devide bytes NUM\n" " -x, --sectors show sector count and size\n" " -V, --version output version information and exit\n" " -H, --help display this help and exit\n" "\n" msgstr "" #: disk-utils/isosize.c:190 msgid "invalid divisor argument" msgstr "" #: disk-utils/mkfs.bfs.c:70 #, fuzzy, c-format msgid "Usage: %s [options] device [block-count]\n" msgstr "用法:%s [é¸é …] 裝置…\n" #: disk-utils/mkfs.bfs.c:72 #, c-format msgid "" "\n" "Options:\n" " -N, --inodes=NUM specify desired number of inodes\n" " -V, --vname=NAME specify volume name\n" " -F, --fname=NAME specify file system name\n" " -v, --verbose explain what is being done\n" " -c this option is silently ignored\n" " -l this option is silently ignored\n" " -V, --version output version information and exit\n" " -V as version must be only option\n" " -h, --help display this help and exit\n" "\n" msgstr "" #: disk-utils/mkfs.bfs.c:130 #, fuzzy msgid "invalid number of inodes" msgstr "無ć•çš„ĺ—數" #: disk-utils/mkfs.bfs.c:136 msgid "volume name too long" msgstr "卷冊ĺŤç¨±ĺ¤Şé•·" #: disk-utils/mkfs.bfs.c:143 msgid "fsname name too long" msgstr "檔ćˇçł»çµ±ĺŤç¨±ĺ¤Şé•·" #: disk-utils/mkfs.bfs.c:171 #, c-format msgid "cannot stat device %s" msgstr "無法č­ĺĄčŁťç˝®ç‹€ć…‹ %s" #: disk-utils/mkfs.bfs.c:174 #, c-format msgid "%s is not a block special device" msgstr "%s 並非區塊特殊裝置" #: disk-utils/mkfs.bfs.c:182 #, fuzzy msgid "invalid block-count" msgstr "無ć•çš„é¸é …" #: disk-utils/mkfs.bfs.c:188 #, c-format msgid "cannot get size of %s" msgstr "無法取得 %s 的大小" #: disk-utils/mkfs.bfs.c:193 #, c-format msgid "blocks argument too large, max is %llu" msgstr "ĺŤ€ĺˇŠĺĽ•ć•¸ĺ¤Şĺ¤§ďĽŚćś€ĺ¤§ćŻ %llu" #: disk-utils/mkfs.bfs.c:208 msgid "too many inodes - max is 512" msgstr "太多 inodes - 最大為 512" #: disk-utils/mkfs.bfs.c:218 #, c-format msgid "not enough space, need at least %llu blocks" msgstr "沒有足夠的空間,需č¦č‡łĺ°‘ %llu 區塊" #: disk-utils/mkfs.bfs.c:230 fdisk/fdisk.c:2680 #, c-format msgid "Device: %s\n" msgstr "裝置:%s\n" #: disk-utils/mkfs.bfs.c:231 #, c-format msgid "Volume: <%-6s>\n" msgstr "卷冊:<%-6s>\n" #: disk-utils/mkfs.bfs.c:232 #, c-format msgid "FSname: <%-6s>\n" msgstr "檔ćˇçł»çµ±ĺŤç¨±ďĽš<%-6s>\n" #: disk-utils/mkfs.bfs.c:233 #, c-format msgid "BlockSize: %d\n" msgstr "區塊大小:%d\n" #: disk-utils/mkfs.bfs.c:235 #, fuzzy, c-format msgid "Inodes: %lu (in 1 block)\n" msgstr "Inodes:%d (在 1 個區塊中)\n" #: disk-utils/mkfs.bfs.c:238 #, fuzzy, c-format msgid "Inodes: %lu (in %llu blocks)\n" msgstr "Inodes:%d (在 %lld 個區塊中)\n" #: disk-utils/mkfs.bfs.c:240 #, c-format msgid "Blocks: %lld\n" msgstr "區塊:%lld\n" #: disk-utils/mkfs.bfs.c:241 #, c-format msgid "Inode end: %d, Data end: %d\n" msgstr "Inode çµćťźďĽš%d, 資料çµćťźďĽš%d\n" #: disk-utils/mkfs.bfs.c:246 msgid "error writing superblock" msgstr "寫入超區塊時發生錯誤" #: disk-utils/mkfs.bfs.c:266 msgid "error writing root inode" msgstr "寫入根 inode 時發生錯誤" #: disk-utils/mkfs.bfs.c:271 msgid "error writing inode" msgstr "寫入 inode 時發生錯誤" #: disk-utils/mkfs.bfs.c:274 msgid "seek error" msgstr "尋找錯誤" #: disk-utils/mkfs.bfs.c:280 msgid "error writing . entry" msgstr "寫入 . 項目時發生錯誤" #: disk-utils/mkfs.bfs.c:284 msgid "error writing .. entry" msgstr "寫入 .. 項目時發生錯誤" #: disk-utils/mkfs.bfs.c:287 #, c-format msgid "error closing %s" msgstr "é—śé–‰ %s 時發生錯誤" #: disk-utils/mkfs.c:38 #, fuzzy, c-format msgid "Usage: %s [options] [-t type fs-options] device [size]\n" msgstr "用法:mkfs [-V] [-t 檔ćˇçł»çµ±éˇžĺž‹] [檔ćˇçł»çµ±é¸é …] 裝置 [大小]\n" #: disk-utils/mkfs.c:41 #, c-format msgid "" "\n" "Options:\n" " -t, --type=TYPE file system type, when undefined ext2 is used\n" " fs-options parameters to real file system builder\n" " device path to a device\n" " size number of blocks on the device\n" " -V, --verbose explain what is done\n" " defining -V more than once will cause a dry-run\n" " -V, --version output version information and exit\n" " -V as version must be only option\n" " -h, --help display this help and exit\n" msgstr "" #: disk-utils/mkfs.c:52 #, fuzzy, c-format msgid "" "\n" "For more information see mkfs(8).\n" msgstr "" "\n" "č¦çŤ˛ĺľ—更多資訊請ĺŹçś‹ wipefs(8)。\n" #: disk-utils/mkfs.c:129 #, c-format msgid "mkfs (%s)\n" msgstr "mkfs (%s)\n" #: disk-utils/mkfs.cramfs.c:125 #, c-format msgid "" "usage: %s [-h] [-v] [-b blksize] [-e edition] [-N endian] [-i file] [-n " "name] dirname outfile\n" " -h print this help\n" " -v be verbose\n" " -E make all warnings errors (non-zero exit status)\n" " -b blksize use this blocksize, must equal page size\n" " -e edition set edition number (part of fsid)\n" " -N endian set cramfs endianness (big|little|host), default host\n" " -i file insert a file image into the filesystem (requires >= 2.4.0)\n" " -n name set name of cramfs filesystem\n" " -p pad by %d bytes for boot code\n" " -s sort directory entries (old option, ignored)\n" " -z make explicit holes (requires >= 2.3.39)\n" " dirname root of the filesystem to be compressed\n" " outfile output file\n" msgstr "" "用法:%s [-h] [-v] [-b 區塊大小] [-e 編次] [-N 尾序] [-i 檔ćˇ] [-n ĺŤç¨±] " "dirname outfile\n" " -h 印出這個說ćŽ\n" " -v 詳細訊ćŻ\n" " -E 所有警告視為錯誤 (éťžé›¶çµćťźç‹€ć…‹)\n" " -b 區塊大小 使用這個區塊大小,必é ç­‰ć–Ľé éť˘ĺ¤§ĺ°Ź\n" " -e 編次 設定編次數字 (é¨ĺ†çš„ fsid)\n" " -N 尾序 設定 cramfs 尾序 (大|ĺ°Ź|主機),é č¨­äľťä¸»ć©ź\n" " -i ćŞ”ćˇ ćŹ’ĺ…ĄćŞ”ćˇĺ˝±ĺŹĺ°ćŞ”ćˇçł»çµ± (需求 >= 2.4.0)\n" " -n ĺŤç¨± 設定 cramfs 檔ćˇçł»çµ±çš„ĺŤç¨±\n" " -p 填充 %d 位ĺ…組於開機碼\n" " -s 排序目錄項目 (čŠé¸é …,忽略)\n" " -z 製作ćŽç˘şçš„空洞 (需求 >= 2.3.39)\n" " dirname 壓縮的檔ćˇçł»çµ±ć ąç›®éŚ„\n" " outfile 輸出檔ćˇ\n" #: disk-utils/mkfs.cramfs.c:298 #, fuzzy, c-format msgid "could not read directory %s" msgstr "%s:並非目錄" #: disk-utils/mkfs.cramfs.c:323 #, fuzzy, c-format msgid "" "Very long (%zu bytes) filename `%s' found.\n" " Please increase MAX_INPUT_NAMELEN in mkcramfs.c and recompile. Exiting." msgstr "" "找ĺ°ĺľé•· (%zu 位ĺ…組) 的檔ĺŤă€Ś%s」。\n" "請在 mkcramfs.c 中增加 MAX_INPUT_NAMELEN 並重新編譯。離開。\n" #: disk-utils/mkfs.cramfs.c:445 #, fuzzy msgid "filesystem too big. Exiting." msgstr "檔ćˇçł»çµ±ĺ¤Şĺ¤§ă€‚離開。\n" #: disk-utils/mkfs.cramfs.c:604 #, c-format msgid "AIEEE: block \"compressed\" to > 2*blocklength (%ld)\n" msgstr "AIEEEďĽšĺŤ€ĺˇŠă€Śč˘«ĺŁ“ç¸®ă€Ťĺ° > 2*區塊長度 (%ld)\n" #: disk-utils/mkfs.cramfs.c:623 #, c-format msgid "%6.2f%% (%+ld bytes)\t%s\n" msgstr "%6.2f%% (%+ld 位ĺ…組)\t%s\n" #: disk-utils/mkfs.cramfs.c:668 #, fuzzy, c-format msgid "cannot close file %s" msgstr "ç„ˇćł•é–‹ĺ•źćŞ”ćˇ '%s'" #: disk-utils/mkfs.cramfs.c:728 #, fuzzy msgid "failed to parse blocksize argument" msgstr "ĺ‰–ćž pid 時失敗" #: disk-utils/mkfs.cramfs.c:736 #, fuzzy msgid "edition number argument failed" msgstr "啟用 rtc 警示" #: disk-utils/mkfs.cramfs.c:746 msgid "invalid endianness given. Must be 'big', 'little', or 'host'" msgstr "" #: disk-utils/mkfs.cramfs.c:752 disk-utils/mkfs.cramfs.c:785 #, fuzzy, c-format msgid "cannot stat %s" msgstr "無法č­ĺĄă€Ś%s」狀態" #: disk-utils/mkfs.cramfs.c:803 #, fuzzy, c-format msgid "" "warning: guestimate of required size (upper bound) is %lldMB, but maximum " "image size is %uMB. We might die prematurely." msgstr "" "警告:所需大小é äĽ° (上é™) 為 %lldMB,但ćŻĺ˝±ĺŹĺ¤§ĺ°Źćś€ĺ¤§ĺ€Ľç‚ş %uMB。 ć‘們也許ćśéŽ" "早中斷執行。\n" #: disk-utils/mkfs.cramfs.c:830 msgid "ROM image map" msgstr "唯讀č¨ć†¶é«”ĺś–ĺŹć ĺ°„" #: disk-utils/mkfs.cramfs.c:842 #, c-format msgid "Including: %s\n" msgstr "包ĺ«ďĽš%s\n" #: disk-utils/mkfs.cramfs.c:848 #, c-format msgid "Directory data: %zd bytes\n" msgstr "目錄資料:%zd 位ĺ…組\n" #: disk-utils/mkfs.cramfs.c:856 #, c-format msgid "Everything: %zd kilobytes\n" msgstr "所有東西:%zd ĺŤä˝Ťĺ…組\n" #: disk-utils/mkfs.cramfs.c:861 #, c-format msgid "Super block: %zd bytes\n" msgstr "超區塊:%zd 位ĺ…組\n" #: disk-utils/mkfs.cramfs.c:868 #, c-format msgid "CRC: %x\n" msgstr "CRC:%x\n" #: disk-utils/mkfs.cramfs.c:873 #, fuzzy, c-format msgid "not enough space allocated for ROM image (%lld allocated, %zu used)" msgstr "配置給唯讀č¨ć†¶é«”ć ĺŹçš„空間不足 (%lld 已配置,%zu 已使用)\n" #: disk-utils/mkfs.cramfs.c:879 msgid "ROM image" msgstr "唯讀č¨ć†¶é«”ć ĺŹ" #: disk-utils/mkfs.cramfs.c:881 #, fuzzy, c-format msgid "ROM image write failed (%zd %zd)" msgstr "唯讀č¨ć†¶é«”ć ĺŹĺŻ«ĺ…Ąĺ¤±ć•— (%zd %zd)\n" #: disk-utils/mkfs.cramfs.c:891 #, fuzzy msgid "warning: filenames truncated to 255 bytes." msgstr "警告:檔ĺŤćŞçź­č‡ł 255 位ĺ…組。\n" #: disk-utils/mkfs.cramfs.c:893 #, fuzzy msgid "warning: files were skipped due to errors." msgstr "警告:檔ćˇĺ·˛ĺ› éŚŻčŞ¤č€Śç•ĄéŽă€‚\n" #: disk-utils/mkfs.cramfs.c:895 #, fuzzy, c-format msgid "warning: file sizes truncated to %luMB (minus 1 byte)." msgstr "警告:檔ćˇĺ¤§ĺ°ŹćŞçź­č‡ł %luMB (減去 1 位ĺ…組)。\n" #: disk-utils/mkfs.cramfs.c:899 #, fuzzy, c-format msgid "warning: uids truncated to %u bits. (This may be a security concern.)" msgstr "警告:uids ćŞçź­č‡ł %u 位ĺ…。 (這個也許ćŻĺ®‰ĺ…¨ä¸Šçš„č€é‡Źă€‚)\n" #: disk-utils/mkfs.cramfs.c:902 #, fuzzy, c-format msgid "warning: gids truncated to %u bits. (This may be a security concern.)" msgstr "警告:gids ćŞçź­č‡ł %u 位ĺ…。 (這個也許ćŻĺ®‰ĺ…¨ä¸Šçš„č€é‡Źă€‚)\n" #: disk-utils/mkfs.cramfs.c:905 #, fuzzy, c-format msgid "" "WARNING: device numbers truncated to %u bits. This almost certainly means\n" "that some device files will be wrong." msgstr "" "警告:裝置數量ćŞçź­č‡ł %u 位ĺ…。 這幾乎ćŽç˘şć„Źĺ‘łč‘—\n" "ćźäş›čŁťç˝®ćŞ”ćˇĺ°‡ćśç™Ľç”źéŚŻčŞ¤ă€‚\n" #: disk-utils/mkfs.minix.c:149 #, fuzzy, c-format msgid "Usage: %s [-c | -l filename] [-nXX] [-iXX] /dev/name [blocks]" msgstr "用法:%s [-c | -l 檔ĺŤ] [-nXX] [-iXX] /dev/ĺŤç¨± [區塊]\n" #: disk-utils/mkfs.minix.c:171 #, c-format msgid "%s is mounted; will not make a filesystem here!" msgstr "%s 已掛載;在此將無法製作檔ćˇçł»çµ±ďĽ" #: disk-utils/mkfs.minix.c:195 #, fuzzy, c-format msgid "%s: seek to boot block failed in write_tables" msgstr "在 write_tables 中ćśĺ°‹ĺ•źĺ‹•區塊時失敗" #: disk-utils/mkfs.minix.c:198 #, fuzzy, c-format msgid "%s: unable to clear boot sector" msgstr "無法清空開機çŁĺŤ€" #: disk-utils/mkfs.minix.c:200 #, fuzzy, c-format msgid "%s: seek failed in write_tables" msgstr "在 write_tables 中的尋找失敗" #: disk-utils/mkfs.minix.c:203 #, fuzzy, c-format msgid "%s: unable to write super-block" msgstr "無法寫入 super-block" #: disk-utils/mkfs.minix.c:206 #, fuzzy, c-format msgid "%s: unable to write inode map" msgstr "無法寫入 inode ĺ°Ťć " #: disk-utils/mkfs.minix.c:209 #, fuzzy, c-format msgid "%s: unable to write zone map" msgstr "無法寫入區域對ć " #: disk-utils/mkfs.minix.c:212 #, fuzzy, c-format msgid "%s: unable to write inodes" msgstr "無法寫入 inodes" #: disk-utils/mkfs.minix.c:217 #, fuzzy, c-format msgid "%s: seek failed in write_block" msgstr "write_block 時ćśĺ°‹ĺ¤±ć•—" #: disk-utils/mkfs.minix.c:220 #, fuzzy, c-format msgid "%s: write failed in write_block" msgstr "寫入 write_block 時失敗" #: disk-utils/mkfs.minix.c:229 disk-utils/mkfs.minix.c:304 #: disk-utils/mkfs.minix.c:353 #, fuzzy, c-format msgid "%s: too many bad blocks" msgstr "太多不良區塊" #: disk-utils/mkfs.minix.c:237 #, fuzzy, c-format msgid "%s: not enough good blocks" msgstr "良好區塊不足" #: disk-utils/mkfs.minix.c:482 #, fuzzy, c-format msgid "%s: unable to alloc buffer for superblock" msgstr "無法配置緩衝區給超區塊" #: disk-utils/mkfs.minix.c:526 #, fuzzy, c-format msgid "%s: unable to allocate buffers for maps" msgstr "無法配置對ć ç·©čˇťĺŤ€" #: disk-utils/mkfs.minix.c:536 #, fuzzy, c-format msgid "%s: unable to allocate buffer for inodes" msgstr "無法配置 inodes 緩衝區" #: disk-utils/mkfs.minix.c:539 #, fuzzy, c-format msgid "%lu inodes\n" msgstr "%ld inodes\n" #: disk-utils/mkfs.minix.c:540 #, fuzzy, c-format msgid "%lu blocks\n" msgstr "%ld 區塊\n" #: disk-utils/mkfs.minix.c:543 #, c-format msgid "" "Maxsize=%ld\n" "\n" msgstr "" "最大容量=%ld\n" "\n" #: disk-utils/mkfs.minix.c:556 #, fuzzy, c-format msgid "%s: seek failed during testing of blocks" msgstr "測試區塊的尋找失敗" #: disk-utils/mkfs.minix.c:563 #, c-format msgid "Weird values in do_check: probably bugs\n" msgstr "do_check 中出現異常值:可č˝éŚŻčŞ¤\n" #: disk-utils/mkfs.minix.c:596 #, fuzzy, c-format msgid "%s: seek failed in check_blocks" msgstr "在 check_blocks 中的尋找失敗" #: disk-utils/mkfs.minix.c:606 #, fuzzy, c-format msgid "%s: bad blocks before data-area: cannot make fs" msgstr "資料區之前有不良區塊:無法製作檔ćˇçł»çµ±" #: disk-utils/mkfs.minix.c:613 disk-utils/mkfs.minix.c:639 #, c-format msgid "%d bad blocks\n" msgstr "%d 個不良區塊\n" #: disk-utils/mkfs.minix.c:615 disk-utils/mkfs.minix.c:641 #, c-format msgid "one bad block\n" msgstr "一個不良區塊\n" #: disk-utils/mkfs.minix.c:624 #, fuzzy, c-format msgid "%s: can't open file of bad blocks" msgstr "無法開啟不良區塊中的檔ćˇ" #: disk-utils/mkfs.minix.c:629 #, c-format msgid "badblock number input error on line %d\n" msgstr "ćŤĺŁžĺŤ€ĺˇŠç·¨č™źčĽ¸ĺ…ĄéŚŻčŞ¤ć–Ľç¬¬ %d ĺ—\n" #: disk-utils/mkfs.minix.c:630 #, fuzzy, c-format msgid "%s: cannot read badblocks file" msgstr "無法讀取ćŤĺŁžĺŤ€ĺˇŠćŞ”ćˇ" #: disk-utils/mkfs.minix.c:667 disk-utils/mkfs.minix.c:669 #, fuzzy, c-format msgid "%s: bad inode size" msgstr "不當的 inode 大小" #: disk-utils/mkfs.minix.c:718 #, c-format msgid "strtol error: number of blocks not specified" msgstr "strtol 錯誤:區塊數量尚未指定" #: disk-utils/mkfs.minix.c:737 mount/swapon.c:423 partx/partx.c:758 #: sys-utils/fstrim.c:135 #, c-format msgid "%s: stat failed" msgstr "%s:stat 失敗" #: disk-utils/mkfs.minix.c:744 login-utils/last.c:240 login-utils/vipw.c:154 #: misc-utils/findmnt.c:687 misc-utils/wipefs.c:260 mount/swapon.c:221 #: mount/swapon.c:306 mount/swapon.c:454 mount/swapon.c:620 mount/swapon.c:825 #: partx/partx.c:806 sys-utils/fallocate.c:138 sys-utils/fsfreeze.c:102 #: sys-utils/fstrim.c:141 text-utils/rev.c:129 text-utils/ul.c:229 #, c-format msgid "%s: open failed" msgstr "%s:開啟失敗" #: disk-utils/mkfs.minix.c:753 #, fuzzy, c-format msgid "%s: device is misaligned" msgstr "%s:%s:裝置忙碌中" #: disk-utils/mkfs.minix.c:756 #, c-format msgid "block size smaller than physical sector size of %s" msgstr "區段大小小於 %s 的實體çŁĺŤ€ĺ¤§ĺ°Ź" #: disk-utils/mkfs.minix.c:760 #, c-format msgid "cannot determine size of %s" msgstr "無法決定 %s 的大小" #: disk-utils/mkfs.minix.c:769 #, c-format msgid "will not try to make filesystem on '%s'" msgstr "將不ćśč©¦č‘—於「%s」製作檔ćˇçł»çµ±" #: disk-utils/mkfs.minix.c:771 #, fuzzy, c-format msgid "%s: number of blocks too small" msgstr "區塊數量太小" #: disk-utils/mkswap.c:160 #, fuzzy, c-format msgid "Bad user-specified page size %lu" msgstr "不當的使用者指定é éť˘ĺ¤§ĺ°Ź %d\n" #: disk-utils/mkswap.c:166 #, fuzzy, c-format msgid "Using user-specified page size %d, instead of the system value %d" msgstr "正在採行使用者指定é éť˘ĺ¤§ĺ°Ź %d, 以代替系統值 %d\n" #: disk-utils/mkswap.c:189 #, fuzzy msgid "Bad swap header size, no label written." msgstr "不當的交換é é¦–大小,未寫入標籤。\n" #: disk-utils/mkswap.c:199 #, fuzzy msgid "Label was truncated." msgstr "標籤已被ćŞć–·ă€‚\n" #: disk-utils/mkswap.c:205 #, c-format msgid "no label, " msgstr "無標籤," #: disk-utils/mkswap.c:213 #, c-format msgid "no uuid\n" msgstr "沒有 uuid\n" #: disk-utils/mkswap.c:278 #, fuzzy, c-format msgid "" "\n" "Usage:\n" " %s [options] device [size]\n" msgstr "用法:%s [é¸é …] 裝置…\n" #: disk-utils/mkswap.c:283 #, c-format msgid "" "\n" "Options:\n" " -c, --check check bad blocks before creating the swap area\n" " -f, --force allow swap size area be larger than device\n" " -p, --pagesize SIZE specify page size in bytes\n" " -L, --label LABEL specify label\n" " -v, --swapversion NUM specify swap-space version number\n" " -U, --uuid UUID specify the uuid to use\n" " -V, --version output version information and exit\n" " -h, --help display this help and exit\n" "\n" msgstr "" #: disk-utils/mkswap.c:302 msgid "too many bad pages" msgstr "太多不良é éť˘" #: disk-utils/mkswap.c:319 msgid "seek failed in check_blocks" msgstr "在 check_blocks 中的尋找失敗" #: disk-utils/mkswap.c:325 #, c-format msgid "one bad page\n" msgstr "一個不良é éť˘\n" #: disk-utils/mkswap.c:327 #, c-format msgid "%lu bad pages\n" msgstr "%lu 個不良é éť˘\n" #: disk-utils/mkswap.c:382 disk-utils/mkswap.c:419 disk-utils/mkswap.c:627 msgid "unable to rewind swap-device" msgstr "無法倒轉交換裝置" #: disk-utils/mkswap.c:393 msgid "unable to alloc new libblkid probe" msgstr "無法配置新的 libblkid 探針" #: disk-utils/mkswap.c:395 msgid "unable to assign device to libblkid probe" msgstr "無法指派裝置給 libblkid 探針" #: disk-utils/mkswap.c:423 msgid "unable to erase bootbits sectors" msgstr "無法清除開機çŁĺŤ€" #: disk-utils/mkswap.c:427 #, fuzzy, c-format msgid "%s: warning: don't erase bootbits sectors" msgstr "%s:%s:警告:不清除開機çŁĺŤ€\n" #: disk-utils/mkswap.c:430 #, c-format msgid " (%s partition table detected). " msgstr " (ĺµć¸¬ĺ° %s ĺ†ĺ‰˛čˇ¨)。" #: disk-utils/mkswap.c:432 #, c-format msgid " on whole disk. " msgstr " 於整個çŁç˘źă€‚" #: disk-utils/mkswap.c:434 #, c-format msgid " (compiled without libblkid). " msgstr " (編譯時未支援 libblkid)。" #: disk-utils/mkswap.c:481 #, fuzzy msgid "parse page size failed" msgstr "%s:取得大小時失敗" #: disk-utils/mkswap.c:487 #, fuzzy msgid "parse version number failed" msgstr "建立號誌時失敗" #: disk-utils/mkswap.c:493 #, fuzzy, c-format msgid "warning: ignore -U (UUIDs are unsupported by %s)" msgstr "%1$s: 警告:忽略 -U (UUIDs 未被 %1$s 支援)\n" #: disk-utils/mkswap.c:518 #, fuzzy, c-format msgid "does not support swapspace version %lu." msgstr "%s:不支援 swapspace ç‰ćś¬ %d。\n" #: disk-utils/mkswap.c:524 msgid "error: UUID parsing failed" msgstr "錯誤:UUID 剖ćžĺ¤±ć•—" #: disk-utils/mkswap.c:533 #, fuzzy msgid "error: Nowhere to set up swap on?" msgstr "%s:錯誤:無處可設置開啟交換?\n" #: disk-utils/mkswap.c:551 #, fuzzy, c-format msgid "error: size %llu KiB is larger than device size %llu KiB" msgstr "%s:錯誤:大小 %llu KiB 大於裝置大小 %llu KiB\n" #: disk-utils/mkswap.c:557 #, fuzzy, c-format msgid "error: swap area needs to be at least %ld KiB" msgstr "%s:錯誤:交換區需č¦č‡łĺ°‘ %ld KiB\n" #: disk-utils/mkswap.c:573 #, fuzzy, c-format msgid "warning: truncating swap area to %llu KiB" msgstr "%s:警告:將交換區ćŞć–·ç‚ş %llu KiB\n" #: disk-utils/mkswap.c:595 #, fuzzy, c-format msgid "error: will not try to make swapdevice on '%s'" msgstr "%s:錯誤:將不ćśč©¦č‘—於「%s」製作交換裝置\n" #: disk-utils/mkswap.c:599 #, fuzzy, c-format msgid "error: %s is mounted; will not make swapspace." msgstr "%s:錯誤:%s 已掛載;將不ćśčŁ˝ä˝śäş¤ćŹ›ç©şé–“ă€‚\n" #: disk-utils/mkswap.c:603 #, fuzzy, c-format msgid "warning: %s is misaligned" msgstr "警告:%s 並非區塊裝置\n" #: disk-utils/mkswap.c:616 msgid "Unable to set up swap-space: unreadable" msgstr "無法設置交換空間:無法讀取" #: disk-utils/mkswap.c:619 #, c-format msgid "Setting up swapspace version 1, size = %llu KiB\n" msgstr "設定 swapspace ç‰ćś¬ 1, 大小 = %llu KiB\n" #: disk-utils/mkswap.c:631 #, fuzzy, c-format msgid "%s: unable to write signature page" msgstr "%s:%s:無法寫入簽章é éť˘ďĽš%s" #: disk-utils/mkswap.c:640 msgid "fsync failed" msgstr "fsync 失敗" #: disk-utils/mkswap.c:652 #, fuzzy, c-format msgid "%s: unable to obtain selinux file label" msgstr "%s: %s: ç„ˇćł•ĺľ—ĺ° selinux 檔ćˇć¨™ç±¤ďĽš%s\n" #: disk-utils/mkswap.c:655 msgid "unable to matchpathcon()" msgstr "無法 matchpathcon()" #: disk-utils/mkswap.c:658 msgid "unable to create new selinux context" msgstr "無法建立新的 selinux 相關項目" #: disk-utils/mkswap.c:660 msgid "couldn't compute selinux context" msgstr "無法č¨ç®— selinux 相關項目" #: disk-utils/mkswap.c:666 #, fuzzy, c-format msgid "unable to relabel %s to %s" msgstr "%s:無法重新標籤 %s 為 %s: %s\n" #: disk-utils/raw.c:50 #, c-format msgid "" "Usage:\n" " %1$s %2$srawN \n" " %1$s %2$srawN /dev/\n" " %1$s -q %2$srawN\n" " %1$s -qa\n" msgstr "" #: disk-utils/raw.c:125 #, fuzzy, c-format msgid "" "Device '%s' is the control raw device (use raw where is greater than " "zero)\n" msgstr "裝置「%să€ŤćŽ§ĺ¶ raw 裝置 (使用 raw 其中 大於零)\n" #: disk-utils/raw.c:145 #, c-format msgid "Cannot locate block device '%s' (%s)\n" msgstr "無法定位區塊裝置「%s」(%s)\n" #: disk-utils/raw.c:151 #, fuzzy, c-format msgid "Device '%s' is not a block device\n" msgstr "裝置「%s」並非區塊裝置\n" #: disk-utils/raw.c:186 #, fuzzy, c-format msgid "Cannot open master raw device '%s' (%s)\n" msgstr "無法定位 raw 裝置「%s」(%s)\n" #: disk-utils/raw.c:204 #, c-format msgid "Cannot locate raw device '%s' (%s)\n" msgstr "無法定位 raw 裝置「%s」(%s)\n" #: disk-utils/raw.c:210 #, c-format msgid "Raw device '%s' is not a character dev\n" msgstr "Raw 裝置「%s」並非字ĺ…裝置\n" #: disk-utils/raw.c:215 #, c-format msgid "Device '%s' is not a raw dev\n" msgstr "裝置「%s」並非 raw 裝置\n" #: disk-utils/raw.c:230 #, c-format msgid "Error querying raw device (%s)\n" msgstr "查詢 raw 裝置 (%s) 時發生錯誤\n" #: disk-utils/raw.c:240 disk-utils/raw.c:260 #, fuzzy, c-format msgid "%sraw%d: bound to major %d, minor %d\n" msgstr "raw%d:\tçą«çµĺ°ä¸»č¦ %dďĽŚć¬ˇč¦ %d\n" #: disk-utils/raw.c:256 #, c-format msgid "Error setting raw device (%s)\n" msgstr "設定 raw 裝置 (%s) 時發生錯誤\n" #: disk-utils/swaplabel.c:49 disk-utils/swaplabel.c:62 #, c-format msgid "%s: unable to probe device" msgstr "%s:無法探查裝置" #: disk-utils/swaplabel.c:64 #, c-format msgid "%s: ambivalent probing result, use wipefs(8)" msgstr "%s:探查çµćžśç”˘ç”źçź›ç›ľďĽŚä˝żç”¨ wipefs(8)" #: disk-utils/swaplabel.c:66 #, c-format msgid "%s: not a valid swap partition" msgstr "%s:不ćŻćś‰ć•的交換ĺ†ĺ‰˛ĺŤ€" #: disk-utils/swaplabel.c:72 #, c-format msgid "%s: unsupported swap version '%s'" msgstr "%s:不受支援的交換ç‰ćś¬ă€Ś%s」" #: disk-utils/swaplabel.c:103 #, c-format msgid "%s: failed to open" msgstr "%s:無法開啟" #: disk-utils/swaplabel.c:112 #, c-format msgid "failed to parse UUID: %s" msgstr "ĺ‰–ćž UUID 時失敗:%s" #: disk-utils/swaplabel.c:116 #, c-format msgid "%s: failed to seek to swap UUID" msgstr "%s:無法尋指ĺ°äş¤ćŹ› UUID" #: disk-utils/swaplabel.c:120 #, c-format msgid "%s: failed to write UUID" msgstr "%s:無法寫入 UUID" #: disk-utils/swaplabel.c:131 #, c-format msgid "%s: failed to seek to swap label " msgstr "%s:無法尋指ĺ°äş¤ćŹ›ć¨™ç±¤ " #: disk-utils/swaplabel.c:138 #, c-format msgid "label is too long. Truncating it to '%s'" msgstr "標籤太長。將ĺ®ćŞć–·ç‚şă€Ś%s」" #: disk-utils/swaplabel.c:141 #, c-format msgid "%s: failed to write label" msgstr "%s:無法寫入標籤" #: disk-utils/swaplabel.c:156 #, c-format msgid "" "Usage: %s [options] \n" "\n" "Options:\n" msgstr "" "用法:%s [é¸é …] <裝置>\n" "\n" "é¸é …:\n" #: disk-utils/swaplabel.c:160 #, c-format msgid "" " -h, --help this help\n" " -L, --label