Date: Fri, 26 Apr 2013 17:45:38 +0000 (UTC) From: Eitan Adler <eadler@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r249948 - head/bin/rm Message-ID: <201304261745.r3QHjcCK080457@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: eadler Date: Fri Apr 26 17:45:37 2013 New Revision: 249948 URL: http://svnweb.freebsd.org/changeset/base/249948 Log: Add -x option to avoid crossing mount points when removing a hierarchy. Discussed on: -hackers Inspired by: DragonflyBSD MFC After: 1 week Modified: head/bin/rm/rm.1 head/bin/rm/rm.c Modified: head/bin/rm/rm.1 ============================================================================== --- head/bin/rm/rm.1 Fri Apr 26 17:28:45 2013 (r249947) +++ head/bin/rm/rm.1 Fri Apr 26 17:45:37 2013 (r249948) @@ -32,7 +32,7 @@ .\" @(#)rm.1 8.5 (Berkeley) 12/5/94 .\" $FreeBSD$ .\" -.Dd March 15, 2013 +.Dd April 25, 2013 .Dt RM 1 .Os .Sh NAME @@ -42,7 +42,7 @@ .Sh SYNOPSIS .Nm .Op Fl f | i -.Op Fl dIPRrvW +.Op Fl dIPRrvWx .Ar .Nm unlink .Ar file @@ -132,6 +132,8 @@ Attempt to undelete the named files. Currently, this option can only be used to recover files covered by whiteouts in a union file system (see .Xr undelete 2 ) . +.It Fl x +When removing a hierarchy, do not cross mount points. .El .Pp The Modified: head/bin/rm/rm.c ============================================================================== --- head/bin/rm/rm.c Fri Apr 26 17:28:45 2013 (r249947) +++ head/bin/rm/rm.c Fri Apr 26 17:45:37 2013 (r249948) @@ -59,7 +59,7 @@ __FBSDID("$FreeBSD$"); #include <unistd.h> static int dflag, eval, fflag, iflag, Pflag, vflag, Wflag, stdin_ok; -static int rflag, Iflag; +static int rflag, Iflag, xflag; static uid_t uid; static volatile sig_atomic_t info; @@ -106,8 +106,8 @@ main(int argc, char *argv[]) exit(eval); } - Pflag = rflag = 0; - while ((ch = getopt(argc, argv, "dfiIPRrvW")) != -1) + Pflag = rflag = xflag = 0; + while ((ch = getopt(argc, argv, "dfiIPRrvWx")) != -1) switch(ch) { case 'd': dflag = 1; @@ -136,6 +136,9 @@ main(int argc, char *argv[]) case 'W': Wflag = 1; break; + case 'x': + xflag = 1; + break; default: usage(); } @@ -196,6 +199,8 @@ rm_tree(char **argv) flags |= FTS_NOSTAT; if (Wflag) flags |= FTS_WHITEOUT; + if (xflag) + flags |= FTS_XDEV; if (!(fts = fts_open(argv, flags, NULL))) { if (fflag && errno == ENOENT) return; @@ -624,7 +629,7 @@ usage(void) { (void)fprintf(stderr, "%s\n%s\n", - "usage: rm [-f | -i] [-dIPRrvW] file ...", + "usage: rm [-f | -i] [-dIPRrvWx] file ...", " unlink file"); exit(EX_USAGE); }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201304261745.r3QHjcCK080457>