|
Lines 613-620
Link Here
|
| 613 |
const char *fromsnap; |
613 |
const char *fromsnap; |
| 614 |
const char *tosnap; |
614 |
const char *tosnap; |
| 615 |
boolean_t recursive; |
615 |
boolean_t recursive; |
|
|
616 |
boolean_t replicate; |
| 616 |
boolean_t verbose; |
617 |
boolean_t verbose; |
| 617 |
boolean_t replicate; |
|
|
| 618 |
|
618 |
|
| 619 |
/* |
619 |
/* |
| 620 |
* The header nvlist is of the following format: |
620 |
* The header nvlist is of the following format: |
|
Lines 848-875
Link Here
|
| 848 |
rv = -1; |
848 |
rv = -1; |
| 849 |
goto out; |
849 |
goto out; |
| 850 |
} |
850 |
} |
| 851 |
VERIFY(0 == nvlist_add_uint64(nvfs, "origin", |
851 |
fnvlist_add_uint64(nvfs, "origin", |
| 852 |
origin->zfs_dmustats.dds_guid)); |
852 |
origin->zfs_dmustats.dds_guid); |
| 853 |
} |
853 |
} |
| 854 |
|
854 |
|
| 855 |
/* iterate over props */ |
855 |
/* iterate over props */ |
| 856 |
VERIFY(0 == nvlist_alloc(&nv, NV_UNIQUE_NAME, 0)); |
856 |
nv = fnvlist_alloc(); |
| 857 |
send_iterate_prop(zhp, nv); |
857 |
send_iterate_prop(zhp, nv); |
| 858 |
VERIFY(0 == nvlist_add_nvlist(nvfs, "props", nv)); |
858 |
fnvlist_add_nvlist(nvfs, "props", nv); |
| 859 |
nvlist_free(nv); |
859 |
fnvlist_free(nv); |
| 860 |
|
860 |
|
| 861 |
/* iterate over snaps, and set sd->parent_fromsnap_guid */ |
861 |
/* iterate over snaps, and set sd->parent_fromsnap_guid */ |
|
|
862 |
sd->parent_fromsnap_guid = 0; |
| 863 |
sd->parent_snaps = fnvlist_alloc(); |
| 864 |
sd->snapprops = fnvlist_alloc(); |
| 862 |
if (!sd->replicate && fromsnap_txg != 0) |
865 |
if (!sd->replicate && fromsnap_txg != 0) |
| 863 |
min_txg = fromsnap_txg; |
866 |
min_txg = fromsnap_txg; |
| 864 |
if (!sd->replicate && tosnap_txg != 0) |
867 |
if (!sd->replicate && tosnap_txg != 0) |
| 865 |
max_txg = tosnap_txg; |
868 |
max_txg = tosnap_txg; |
| 866 |
sd->parent_fromsnap_guid = 0; |
|
|
| 867 |
VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); |
| 868 |
VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); |
| 869 |
(void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, |
869 |
(void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, |
| 870 |
min_txg, max_txg); |
870 |
min_txg, max_txg); |
| 871 |
VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); |
871 |
fnvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps); |
| 872 |
VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); |
872 |
fnvlist_add_nvlist(nvfs, "snapprops", sd->snapprops); |
| 873 |
fnvlist_free(sd->parent_snaps); |
873 |
fnvlist_free(sd->parent_snaps); |
| 874 |
fnvlist_free(sd->snapprops); |
874 |
fnvlist_free(sd->snapprops); |
| 875 |
|
875 |
|
|
Lines 876-883
Link Here
|
| 876 |
/* add this fs to nvlist */ |
876 |
/* add this fs to nvlist */ |
| 877 |
(void) snprintf(guidstring, sizeof (guidstring), |
877 |
(void) snprintf(guidstring, sizeof (guidstring), |
| 878 |
"0x%llx", (longlong_t)guid); |
878 |
"0x%llx", (longlong_t)guid); |
| 879 |
VERIFY(0 == nvlist_add_nvlist(sd->fss, guidstring, nvfs)); |
879 |
fnvlist_add_nvlist(sd->fss, guidstring, nvfs); |
| 880 |
nvlist_free(nvfs); |
880 |
fnvlist_free(nvfs); |
| 881 |
|
881 |
|
| 882 |
/* iterate over children */ |
882 |
/* iterate over children */ |
| 883 |
if (sd->recursive) |
883 |
if (sd->recursive) |
|
Lines 894-906
Link Here
|
| 894 |
|
894 |
|
| 895 |
static int |
895 |
static int |
| 896 |
gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, |
896 |
gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, |
| 897 |
const char *tosnap, boolean_t recursive, boolean_t verbose, |
897 |
const char *tosnap, boolean_t recursive, boolean_t replicate, |
| 898 |
boolean_t replicate, nvlist_t **nvlp, avl_tree_t **avlp) |
898 |
boolean_t verbose, nvlist_t **nvlp, avl_tree_t **avlp) |
| 899 |
{ |
899 |
{ |
| 900 |
zfs_handle_t *zhp; |
900 |
zfs_handle_t *zhp; |
|
|
901 |
send_data_t sd = { 0 }; |
| 901 |
int error; |
902 |
int error; |
| 902 |
uint64_t min_txg = 0, max_txg = 0; |
|
|
| 903 |
send_data_t sd = { 0 }; |
| 904 |
|
903 |
|
| 905 |
zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); |
904 |
zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); |
| 906 |
if (zhp == NULL) |
905 |
if (zhp == NULL) |
|
Lines 911-918
Link Here
|
| 911 |
sd.fromsnap = fromsnap; |
910 |
sd.fromsnap = fromsnap; |
| 912 |
sd.tosnap = tosnap; |
911 |
sd.tosnap = tosnap; |
| 913 |
sd.recursive = recursive; |
912 |
sd.recursive = recursive; |
|
|
913 |
sd.replicate = replicate; |
| 914 |
sd.verbose = verbose; |
914 |
sd.verbose = verbose; |
| 915 |
sd.replicate = replicate; |
|
|
| 916 |
|
915 |
|
| 917 |
if ((error = send_iterate_fs(zhp, &sd)) != 0) { |
916 |
if ((error = send_iterate_fs(zhp, &sd)) != 0) { |
| 918 |
nvlist_free(sd.fss); |
917 |
nvlist_free(sd.fss); |
|
Lines 1349-1358
Link Here
|
| 1349 |
dump_filesystem(zfs_handle_t *zhp, void *arg) |
1348 |
dump_filesystem(zfs_handle_t *zhp, void *arg) |
| 1350 |
{ |
1349 |
{ |
| 1351 |
int rv = 0; |
1350 |
int rv = 0; |
| 1352 |
uint64_t min_txg = 0, max_txg = 0; |
|
|
| 1353 |
send_dump_data_t *sdd = arg; |
1351 |
send_dump_data_t *sdd = arg; |
| 1354 |
boolean_t missingfrom = B_FALSE; |
1352 |
boolean_t missingfrom = B_FALSE; |
| 1355 |
zfs_cmd_t zc = { 0 }; |
1353 |
zfs_cmd_t zc = { 0 }; |
|
|
1354 |
uint64_t min_txg = 0, max_txg = 0; |
| 1356 |
|
1355 |
|
| 1357 |
(void) snprintf(zc.zc_name, sizeof (zc.zc_name), "%s@%s", |
1356 |
(void) snprintf(zc.zc_name, sizeof (zc.zc_name), "%s@%s", |
| 1358 |
zhp->zfs_name, sdd->tosnap); |
1357 |
zhp->zfs_name, sdd->tosnap); |
|
Lines 1853-1860
Link Here
|
| 1853 |
} |
1852 |
} |
| 1854 |
|
1853 |
|
| 1855 |
err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, |
1854 |
err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, |
| 1856 |
fromsnap, tosnap, flags->replicate, flags->verbose, |
1855 |
fromsnap, tosnap, flags->replicate, |
| 1857 |
flags->replicate, &fss, &fsavl); |
1856 |
flags->replicate, flags->verbose, &fss, &fsavl); |
| 1858 |
if (err) |
1857 |
if (err) |
| 1859 |
goto err_out; |
1858 |
goto err_out; |
| 1860 |
VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); |
1859 |
VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); |
|
Lines 2497-2503
Link Here
|
| 2497 |
VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); |
2496 |
VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); |
| 2498 |
|
2497 |
|
| 2499 |
if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, |
2498 |
if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, |
| 2500 |
recursive, B_FALSE, B_FALSE, &local_nv, &local_avl)) != 0) |
2499 |
recursive, recursive, B_FALSE, &local_nv, &local_avl)) != 0) |
| 2501 |
return (error); |
2500 |
return (error); |
| 2502 |
|
2501 |
|
| 2503 |
/* |
2502 |
/* |