Print this page
*** NO COMMENTS ***


 235                     "[-o property[,...]] [-t type[,...]] [-s property] ...\n"
 236                     "\t    [-S property] ... "
 237                     "[filesystem|volume|snapshot] ...\n"));
 238         case HELP_MOUNT:
 239                 return (gettext("\tmount\n"
 240                     "\tmount [-vO] [-o opts] <-a | filesystem>\n"));
 241         case HELP_PROMOTE:
 242                 return (gettext("\tpromote <clone-filesystem>\n"));
 243         case HELP_RECEIVE:
 244                 return (gettext("\treceive [-vnFu] <filesystem|volume|"
 245                 "snapshot>\n"
 246                 "\treceive [-vnFu] [-d | -e] <filesystem>\n"));
 247         case HELP_RENAME:
 248                 return (gettext("\trename [-f] <filesystem|volume|snapshot> "
 249                     "<filesystem|volume|snapshot>\n"
 250                     "\trename [-f] -p <filesystem|volume> <filesystem|volume>\n"
 251                     "\trename -r <snapshot> <snapshot>"));
 252         case HELP_ROLLBACK:
 253                 return (gettext("\trollback [-rRf] <snapshot>\n"));
 254         case HELP_SEND:
 255                 return (gettext("\tsend [-DnPpRrv] [-[iI] snapshot] "
 256                     "<snapshot>\n"));
 257         case HELP_SET:
 258                 return (gettext("\tset <property=value> "
 259                     "<filesystem|volume|snapshot> ...\n"));
 260         case HELP_SHARE:
 261                 return (gettext("\tshare <-a | filesystem>\n"));
 262         case HELP_SNAPSHOT:
 263                 return (gettext("\tsnapshot [-r] [-o property=value] ... "
 264                     "<filesystem@snapname|volume@snapname> ...\n"));
 265         case HELP_UNMOUNT:
 266                 return (gettext("\tunmount [-f] "
 267                     "<-a | filesystem|mountpoint>\n"));
 268         case HELP_UNSHARE:
 269                 return (gettext("\tunshare "
 270                     "<-a | filesystem|mountpoint>\n"));
 271         case HELP_ALLOW:
 272                 return (gettext("\tallow <filesystem|volume>\n"
 273                     "\tallow [-ldug] "
 274                     "<\"everyone\"|user|group>[,...] <perm|@setname>[,...]\n"
 275                     "\t    <filesystem|volume>\n"


3535         usage(B_FALSE);
3536         return (-1);
3537 }
3538 
3539 /*
3540  * Send a backup stream to stdout.
3541  */
3542 static int
3543 zfs_do_send(int argc, char **argv)
3544 {
3545         char *fromname = NULL;
3546         char *toname = NULL;
3547         char *cp;
3548         zfs_handle_t *zhp;
3549         sendflags_t flags = { 0 };
3550         int c, err;
3551         nvlist_t *dbgnv = NULL;
3552         boolean_t extraverbose = B_FALSE;
3553 
3554         /* check options */
3555         while ((c = getopt(argc, argv, ":i:I:RDpvnP")) != -1) {
3556                 switch (c) {
3557                 case 'i':
3558                         if (fromname)
3559                                 usage(B_FALSE);
3560                         fromname = optarg;
3561                         break;
3562                 case 'I':
3563                         if (fromname)
3564                                 usage(B_FALSE);
3565                         fromname = optarg;
3566                         flags.doall = B_TRUE;
3567                         break;
3568                 case 'R':
3569                         flags.replicate = B_TRUE;
3570                         break;
3571                 case 'p':
3572                         flags.props = B_TRUE;
3573                         break;
3574                 case 'P':
3575                         flags.parsable = B_TRUE;
3576                         flags.verbose = B_TRUE;
3577                         break;
3578                 case 'v':
3579                         if (flags.verbose)
3580                                 extraverbose = B_TRUE;
3581                         flags.verbose = B_TRUE;
3582                         flags.progress = B_TRUE;
3583                         break;
3584                 case 'D':
3585                         flags.dedup = B_TRUE;
3586                         break;
3587                 case 'n':
3588                         flags.dryrun = B_TRUE;
3589                         break;



3590                 case ':':
3591                         (void) fprintf(stderr, gettext("missing argument for "
3592                             "'%c' option\n"), optopt);
3593                         usage(B_FALSE);
3594                         break;
3595                 case '?':
3596                         (void) fprintf(stderr, gettext("invalid option '%c'\n"),
3597                             optopt);
3598                         usage(B_FALSE);
3599                 }
3600         }
3601 
3602         argc -= optind;
3603         argv += optind;
3604 
3605         /* check number of arguments */
3606         if (argc < 1) {
3607                 (void) fprintf(stderr, gettext("missing snapshot argument\n"));
3608                 usage(B_FALSE);
3609         }
3610         if (argc > 1) {
3611                 (void) fprintf(stderr, gettext("too many arguments\n"));
3612                 usage(B_FALSE);
3613         }
3614 
3615         if (!flags.dryrun && isatty(STDOUT_FILENO)) {



3616                 (void) fprintf(stderr,
3617                     gettext("Error: Stream can not be written to a terminal.\n"
3618                     "You must redirect standard output.\n"));
3619                 return (1);
3620         }
3621 
3622         cp = strchr(argv[0], '@');
3623         if (cp == NULL) {
3624                 (void) fprintf(stderr,
3625                     gettext("argument must be a snapshot\n"));
3626                 usage(B_FALSE);
3627         }
3628         *cp = '\0';
3629         toname = cp + 1;
3630         zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME);
3631         if (zhp == NULL)
3632                 return (1);
3633 
3634         /*
3635          * If they specified the full path to the snapshot, chop off




 235                     "[-o property[,...]] [-t type[,...]] [-s property] ...\n"
 236                     "\t    [-S property] ... "
 237                     "[filesystem|volume|snapshot] ...\n"));
 238         case HELP_MOUNT:
 239                 return (gettext("\tmount\n"
 240                     "\tmount [-vO] [-o opts] <-a | filesystem>\n"));
 241         case HELP_PROMOTE:
 242                 return (gettext("\tpromote <clone-filesystem>\n"));
 243         case HELP_RECEIVE:
 244                 return (gettext("\treceive [-vnFu] <filesystem|volume|"
 245                 "snapshot>\n"
 246                 "\treceive [-vnFu] [-d | -e] <filesystem>\n"));
 247         case HELP_RENAME:
 248                 return (gettext("\trename [-f] <filesystem|volume|snapshot> "
 249                     "<filesystem|volume|snapshot>\n"
 250                     "\trename [-f] -p <filesystem|volume> <filesystem|volume>\n"
 251                     "\trename -r <snapshot> <snapshot>"));
 252         case HELP_ROLLBACK:
 253                 return (gettext("\trollback [-rRf] <snapshot>\n"));
 254         case HELP_SEND:
 255                 return (gettext("\tsend [-DnPpRrvs] [-[iI] snapshot] "
 256                     "<snapshot>\n"));
 257         case HELP_SET:
 258                 return (gettext("\tset <property=value> "
 259                     "<filesystem|volume|snapshot> ...\n"));
 260         case HELP_SHARE:
 261                 return (gettext("\tshare <-a | filesystem>\n"));
 262         case HELP_SNAPSHOT:
 263                 return (gettext("\tsnapshot [-r] [-o property=value] ... "
 264                     "<filesystem@snapname|volume@snapname> ...\n"));
 265         case HELP_UNMOUNT:
 266                 return (gettext("\tunmount [-f] "
 267                     "<-a | filesystem|mountpoint>\n"));
 268         case HELP_UNSHARE:
 269                 return (gettext("\tunshare "
 270                     "<-a | filesystem|mountpoint>\n"));
 271         case HELP_ALLOW:
 272                 return (gettext("\tallow <filesystem|volume>\n"
 273                     "\tallow [-ldug] "
 274                     "<\"everyone\"|user|group>[,...] <perm|@setname>[,...]\n"
 275                     "\t    <filesystem|volume>\n"


3535         usage(B_FALSE);
3536         return (-1);
3537 }
3538 
3539 /*
3540  * Send a backup stream to stdout.
3541  */
3542 static int
3543 zfs_do_send(int argc, char **argv)
3544 {
3545         char *fromname = NULL;
3546         char *toname = NULL;
3547         char *cp;
3548         zfs_handle_t *zhp;
3549         sendflags_t flags = { 0 };
3550         int c, err;
3551         nvlist_t *dbgnv = NULL;
3552         boolean_t extraverbose = B_FALSE;
3553 
3554         /* check options */
3555         while ((c = getopt(argc, argv, ":i:I:RDpvnPs")) != -1) {
3556                 switch (c) {
3557                 case 'i':
3558                         if (fromname)
3559                                 usage(B_FALSE);
3560                         fromname = optarg;
3561                         break;
3562                 case 'I':
3563                         if (fromname)
3564                                 usage(B_FALSE);
3565                         fromname = optarg;
3566                         flags.doall = B_TRUE;
3567                         break;
3568                 case 'R':
3569                         flags.replicate = B_TRUE;
3570                         break;
3571                 case 'p':
3572                         flags.props = B_TRUE;
3573                         break;
3574                 case 'P':
3575                         flags.parsable = B_TRUE;
3576                         flags.verbose = B_TRUE;
3577                         break;
3578                 case 'v':
3579                         if (flags.verbose)
3580                                 extraverbose = B_TRUE;
3581                         flags.verbose = B_TRUE;
3582                         flags.progress = B_TRUE;
3583                         break;
3584                 case 'D':
3585                         flags.dedup = B_TRUE;
3586                         break;
3587                 case 'n':
3588                         flags.dryrun = B_TRUE;
3589                         break;
3590                 case 's':
3591                         flags.sendsize = B_TRUE;
3592                         break;
3593                 case ':':
3594                         (void) fprintf(stderr, gettext("missing argument for "
3595                             "'%c' option\n"), optopt);
3596                         usage(B_FALSE);
3597                         break;
3598                 case '?':
3599                         (void) fprintf(stderr, gettext("invalid option '%c'\n"),
3600                             optopt);
3601                         usage(B_FALSE);
3602                 }
3603         }
3604 
3605         argc -= optind;
3606         argv += optind;
3607 
3608         /* check number of arguments */
3609         if (argc < 1) {
3610                 (void) fprintf(stderr, gettext("missing snapshot argument\n"));
3611                 usage(B_FALSE);
3612         }
3613         if (argc > 1) {
3614                 (void) fprintf(stderr, gettext("too many arguments\n"));
3615                 usage(B_FALSE);
3616         }
3617 
3618         if (flags.sendsize) {
3619                 (void) close(STDOUT_FILENO);
3620                 (void) open("/dev/null", O_WRONLY|O_LARGEFILE);
3621         } else if (!flags.dryrun && isatty(STDOUT_FILENO)) {
3622                 (void) fprintf(stderr,
3623                     gettext("Error: Stream can not be written to a terminal.\n"
3624                     "You must redirect standard output.\n"));
3625                 return (1);
3626         }
3627 
3628         cp = strchr(argv[0], '@');
3629         if (cp == NULL) {
3630                 (void) fprintf(stderr,
3631                     gettext("argument must be a snapshot\n"));
3632                 usage(B_FALSE);
3633         }
3634         *cp = '\0';
3635         toname = cp + 1;
3636         zhp = zfs_open(g_zfs, argv[0], ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME);
3637         if (zhp == NULL)
3638                 return (1);
3639 
3640         /*
3641          * If they specified the full path to the snapshot, chop off