From ddf6fb8686b1ed6a26d5f1c76a642d0fb5fe7ba7 Mon Sep 17 00:00:00 2001 From: Aaron Burgemeister Date: Thu, 15 Jul 2010 19:54:49 -0600 Subject: stat: add %m to output the mount point for a file MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * src/find-mount-point.c: A new file refactoring find_mount_point() out from df.c * src/find-mount-point.h: Likewise. * src/df.c: Use the new find-mount-point module. * src/stat.c (print_stat): Handle the new %m format. (find_bind_mount): A new function to return the bind mount for a file if any. (out_mount_mount): Print the bind mount for a file, or else the standard mount point given by the find-mount-point module. (usage): Document the %m format directive. * src/Makefile.am: Reference the refactored find-mount-point.c * po/POTFILES.in: Add find_mount_point.c to the translation list * doc/coreutils.texi (stat invocation): Document %m, and how it may differ from the mount point that df outputs. * test/misc/stat-mount: A new test to correlate mount points output from df and stat. * tests/Makefile.am: Reference the new test. * NEWS: Mention the new feature * THANKS: Add the author Signed-off-by: Pádraig Brady --- doc/coreutils.texi | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'doc') diff --git a/doc/coreutils.texi b/doc/coreutils.texi index 7eedec75a..6771da949 100644 --- a/doc/coreutils.texi +++ b/doc/coreutils.texi @@ -8487,6 +8487,7 @@ removal is requested. Equivalent to @option{-I}. When removing a hierarchy recursively, skip any directory that is on a file system different from that of the corresponding command line argument. +@cindex bind mount This option is useful when removing a build ``chroot'' hierarchy, which normally contains no valuable data. However, it is not uncommon to bind-mount @file{/home} into such a hierarchy, to make it easier to @@ -10685,6 +10686,7 @@ The valid @var{format} directives for files with @option{--format} and @item %G - Group name of owner @item %h - Number of hard links @item %i - Inode number +@item %m - Mount point (See note below) @item %n - File name @item %N - Quoted file name with dereference if symbolic link @item %o - I/O block size @@ -10701,6 +10703,22 @@ The valid @var{format} directives for files with @option{--format} and @item %Z - Time of last change as seconds since Epoch @end itemize +The mount point printed by @samp{%m} is similar to that output +by @command{df}, except that: +@itemize @bullet +@item +stat does not dereference symlinks by default +(unless @option{-L} is specified) +@item +stat does not search for specified device nodes in the +file system list, instead operating on them directly +@item +@cindex bind mount +stat outputs the alias for a bind mounted file, +rather than its backing device. One can recursively call stat +until there is no change in output, to get the base mount point +@end itemize + When listing file system information (@option{--file-system} (@option{-f})), you must use a different set of @var{format} directives: -- cgit v1.2.3-70-g09d2