const char * mount_get_devname(const char *spec) { if (!strncmp(spec, "UUID=", 5)) return get_spec_by_uuid(spec+5); if (!strncmp(spec, "LABEL=", 6)) return get_spec_by_volume_label(spec+6); return spec; }
const char * mount_get_devname_by_label(const char *volumelabel) { const char *spec, *spec2; spec = get_spec_by_volume_label(volumelabel); spec2 = second_occurrence_of_vol_label(volumelabel); if (spec2) die (EX_FAIL, _("%s: error: the label %s occurs on both %s and %s\n"), progname, volumelabel, spec, spec2); return spec; }
/* * Interpret the device name if necessary. * Frees the pointer passed to it if we return a different device string. */ char *interpret_spec(char *spec) { char *dev = NULL; if (!spec) return NULL; if (!strncmp(spec, "UUID=", 5)) dev = get_spec_by_uuid(spec+5); else if (!strncmp(spec, "LABEL=", 6)) dev = get_spec_by_volume_label(spec+6); else dev = string_copy(spec); return dev; }