MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dsl_props_set_sync_impl

Function dsl_props_set_sync_impl

freebsd/contrib/openzfs/module/zfs/dsl_prop.c:902–939  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

900}
901
902void
903dsl_props_set_sync_impl(dsl_dataset_t *ds, zprop_source_t source,
904 nvlist_t *props, dmu_tx_t *tx)
905{
906 nvpair_t *elem = NULL;
907
908 while ((elem = nvlist_next_nvpair(props, elem)) != NULL) {
909 nvpair_t *pair = elem;
910 const char *name = nvpair_name(pair);
911
912 if (nvpair_type(pair) == DATA_TYPE_NVLIST) {
913 /*
914 * This usually happens when we reuse the nvlist_t data
915 * returned by the counterpart dsl_prop_get_all_impl().
916 * For instance we do this to restore the original
917 * received properties when an error occurs in the
918 * zfs_ioc_recv() codepath.
919 */
920 nvlist_t *attrs = fnvpair_value_nvlist(pair);
921 pair = fnvlist_lookup_nvpair(attrs, ZPROP_VALUE);
922 }
923
924 if (nvpair_type(pair) == DATA_TYPE_STRING) {
925 const char *value = fnvpair_value_string(pair);
926 dsl_prop_set_sync_impl(ds, name,
927 source, 1, strlen(value) + 1, value, tx);
928 } else if (nvpair_type(pair) == DATA_TYPE_UINT64) {
929 uint64_t intval = fnvpair_value_uint64(pair);
930 dsl_prop_set_sync_impl(ds, name,
931 source, sizeof (intval), 1, &intval, tx);
932 } else if (nvpair_type(pair) == DATA_TYPE_BOOLEAN) {
933 dsl_prop_set_sync_impl(ds, name,
934 source, 0, 0, NULL, tx);
935 } else {
936 panic("invalid nvpair type");
937 }
938 }
939}
940
941void
942dsl_props_set_sync(void *arg, dmu_tx_t *tx)

Callers 3

zcp_set_user_propFunction · 0.85
dsl_props_set_syncFunction · 0.85

Calls 9

fnvpair_value_nvlistFunction · 0.85
fnvlist_lookup_nvpairFunction · 0.85
fnvpair_value_stringFunction · 0.85
dsl_prop_set_sync_implFunction · 0.85
fnvpair_value_uint64Function · 0.85
nvlist_next_nvpairFunction · 0.50
nvpair_nameFunction · 0.50
nvpair_typeFunction · 0.50
panicFunction · 0.50

Tested by

no test coverage detected