int pentry_set_metadata(pentry_t *pe, dpl_dict_t *dict) { int ret; assert(pe); if (pe->metadata) dpl_dict_free(pe->metadata); pe->metadata = dpl_dict_new(13); if (! pe->metadata) { LOG(LOG_ERR, "dpl_dict_new: can't allocate memory"); ret = -1; goto err; } if (DPL_FAILURE == dpl_dict_copy(pe->metadata, dict)) { ret = -1; goto err; } ret = 0; err: return ret; }
int pentry_set_usermd(tpath_entry *pe, dpl_dict_t *dict) { int ret; assert(pe); if (pe->usermd) dpl_dict_free(pe->usermd); pe->usermd = dpl_dict_new(13); if (! pe->usermd) { LOG(LOG_ERR, "path=%s: dpl_dict_new: can't allocate memory", pe->path); ret = -1; goto err; } if (DPL_FAILURE == dpl_dict_copy(pe->usermd, dict)) { LOG(LOG_ERR, "path=%s: dpl_dict_copy: failed", pe->path); ret = -1; goto err; } ret = 0; err: return ret; }
dpl_status_t dpl_req_add_metadata(dpl_req_t *req, const dpl_dict_t *metadata) { int ret; ret = dpl_dict_copy(req->metadata, metadata); if (DPL_SUCCESS != ret) { return DPL_FAILURE; } return DPL_SUCCESS; }