Print this page
FAR: generating send-streams in portable format
This commit adds a switch '-F' to  zfs send. This set, zfs send generates
a stream in FAR-format instead of the traditional zfs stream format. The
generated send stream is compatible with the stream generated from 'btrfs send'
and can in principle easily be received to any filesystem.

@@ -250,12 +250,12 @@
                     "\trename [-f] -p <filesystem|volume> <filesystem|volume>\n"
                     "\trename -r <snapshot> <snapshot>"));
         case HELP_ROLLBACK:
                 return (gettext("\trollback [-rRf] <snapshot>\n"));
         case HELP_SEND:
-                return (gettext("\tsend [-DnPpRv] [-[iI] snapshot] "
-                    "<snapshot>\n"));
+                return (gettext("\tsend [-DnPpRv] [-[iI] snapshot] <snapshot>\n"
+                    "\tsend -F [-nPRv] [-[iI] snapshot] <snapshot>\n"));
         case HELP_SET:
                 return (gettext("\tset <property=value> "
                     "<filesystem|volume|snapshot> ...\n"));
         case HELP_SHARE:
                 return (gettext("\tshare <-a | filesystem>\n"));

@@ -3519,11 +3519,11 @@
         int c, err;
         nvlist_t *dbgnv = NULL;
         boolean_t extraverbose = B_FALSE;
 
         /* check options */
-        while ((c = getopt(argc, argv, ":i:I:RDpvnP")) != -1) {
+        while ((c = getopt(argc, argv, ":i:I:RDpvnPF")) != -1) {
                 switch (c) {
                 case 'i':
                         if (fromname)
                                 usage(B_FALSE);
                         fromname = optarg;

@@ -3554,10 +3554,13 @@
                         flags.dedup = B_TRUE;
                         break;
                 case 'n':
                         flags.dryrun = B_TRUE;
                         break;
+                case 'F':
+                        flags.far = B_TRUE;
+                        break;
                 case ':':
                         (void) fprintf(stderr, gettext("missing argument for "
                             "'%c' option\n"), optopt);
                         usage(B_FALSE);
                         break;

@@ -3579,10 +3582,15 @@
         if (argc > 1) {
                 (void) fprintf(stderr, gettext("too many arguments\n"));
                 usage(B_FALSE);
         }
 
+        if (flags.far && (flags.dedup || flags.props)) {
+                (void) fprintf(stderr, gettext("options -D and -p are not "
+                    "allowed with -F\n"));
+                usage(B_FALSE);
+        }
         if (!flags.dryrun && isatty(STDOUT_FILENO)) {
                 (void) fprintf(stderr,
                     gettext("Error: Stream can not be written to a terminal.\n"
                     "You must redirect standard output.\n"));
                 return (1);