/* default _set_uuid function to set DCE UUIDs */ int blkid_probe_set_uuid_as(blkid_probe pr, unsigned char *uuid, const char *name) { struct blkid_chain *chn = blkid_probe_get_chain(pr); struct blkid_prval *v; int rc = 0; if (blkid_uuid_is_empty(uuid, 16)) return 0; if (!name) { if ((chn->flags & BLKID_SUBLKS_UUIDRAW) && (rc = blkid_probe_set_value(pr, "UUID_RAW", uuid, 16)) < 0) return rc; if (!(chn->flags & BLKID_SUBLKS_UUID)) return 0; v = blkid_probe_assign_value(pr, "UUID"); } else v = blkid_probe_assign_value(pr, name); if (!v) return -ENOMEM; v->len = 37; v->data = calloc(1, v->len); if (!v->data) rc = -ENOMEM; if (!rc) { blkid_unparse_uuid(uuid, (char *) v->data, v->len); return 0; } blkid_probe_free_value(v); return rc; }
/* default _set_uuid function to set DCE UUIDs */ int blkid_probe_set_uuid_as(blkid_probe pr, unsigned char *uuid, const char *name) { struct blkid_chain *chn = blkid_probe_get_chain(pr); struct blkid_prval *v; if (blkid_uuid_is_empty(uuid, 16)) return 0; if (!name) { if ((chn->flags & BLKID_SUBLKS_UUIDRAW) && blkid_probe_set_value(pr, "UUID_RAW", uuid, 16) < 0) return -1; if (!(chn->flags & BLKID_SUBLKS_UUID)) return 0; v = blkid_probe_assign_value(pr, "UUID"); } else v = blkid_probe_assign_value(pr, name); blkid_unparse_uuid(uuid, (char *) v->data, sizeof(v->data)); v->len = 37; return 0; }