Author: delphij
Date: Mon Dec 14 17:04:44 2009
New Revision: 200516
URL: http://svn.freebsd.org/changeset/base/200516

Log:
  Add an option to specify that the received ZFS should not be automatically
  mounted (receive -u).
  
  Obtained from:        OpenSolaris (onnv revision 8584:327a1b6dd944)
  Approved by:  pjd

Modified:
  head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
  head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c

Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c    Mon Dec 14 16:54:39 
2009        (r200515)
+++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c    Mon Dec 14 17:04:44 
2009        (r200516)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -2457,7 +2457,7 @@ zfs_do_receive(int argc, char **argv)
 
        bzero(&flags, sizeof (recvflags_t));
        /* check options */
-       while ((c = getopt(argc, argv, ":dnvF")) != -1) {
+       while ((c = getopt(argc, argv, ":dnuvF")) != -1) {
                switch (c) {
                case 'd':
                        flags.isprefix = B_TRUE;
@@ -2465,6 +2465,9 @@ zfs_do_receive(int argc, char **argv)
                case 'n':
                        flags.dryrun = B_TRUE;
                        break;
+               case 'u':
+                       flags.nomount = B_TRUE;
+                       break;
                case 'v':
                        flags.verbose = B_TRUE;
                        break;

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h    Mon Dec 14 
16:54:39 2009        (r200515)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h    Mon Dec 14 
17:04:44 2009        (r200516)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -457,6 +457,9 @@ typedef struct recvflags {
 
        /* byteswap flag is used internally; callers need not specify */
        int byteswap : 1;
+
+       /* do not mount file systems as they are extracted (private) */
+       int nomount : 1;
 } recvflags_t;
 
 extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t,

Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c
==============================================================================
--- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Mon Dec 
14 16:54:39 2009        (r200515)
+++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c   Mon Dec 
14 17:04:44 2009        (r200516)
@@ -20,7 +20,7 @@
  */
 
 /*
- * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
+ * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
  */
 
@@ -2080,7 +2080,7 @@ zfs_receive(libzfs_handle_t *hdl, const 
 
        err = zfs_receive_impl(hdl, tosnap, flags, infd, stream_avl, &top_zfs);
 
-       if (err == 0 && top_zfs) {
+       if (err == 0 && !flags.nomount && top_zfs) {
                zfs_handle_t *zhp;
                prop_changelist_t *clp;
 
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to