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
This commit is contained in:
delphij 2009-12-14 17:04:44 +00:00
parent f86f4aa6c8
commit d9b88426fb
3 changed files with 11 additions and 5 deletions

View File

@ -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;

View File

@ -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,

View File

@ -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 char *tosnap, recvflags_t flags,
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;