extern int fsprobe_parse_spec(const char *spec, char **name, char **value);
-extern const char *fsprobe_get_devname_by_uuid(const char *uuid);
-extern const char *fsprobe_get_devname_by_label(const char *label);
-extern const char *fsprobe_get_devname_by_spec(const char *spec);
+/* all routines return newly allocated string */
+extern char *fsprobe_get_devname_by_uuid(const char *uuid);
+extern char *fsprobe_get_devname_by_label(const char *label);
+extern char *fsprobe_get_devname_by_spec(const char *spec);
-extern const char *fsprobe_get_label_by_devname(const char *devname);
-extern const char *fsprobe_get_uuid_by_devname(const char *devname);
-extern const char *fsprobe_get_fstype_by_devname(const char *devname);
+extern char *fsprobe_get_label_by_devname(const char *devname);
+extern char *fsprobe_get_uuid_by_devname(const char *devname);
+extern char *fsprobe_get_fstype_by_devname(const char *devname);
extern int fsprobe_known_fstype(const char *fstype);
return 0;
}
-const char *
+char *
fsprobe_get_devname_by_spec(const char *spec)
{
char *name, *value;
if (fsprobe_parse_spec(spec, &name, &value) != 0)
return NULL; /* parse error */
if (name) {
- const char *nspec = NULL;
+ char *nspec = NULL;
if (!strcmp(name,"LABEL"))
nspec = fsprobe_get_devname_by_label(value);
/* returns device LABEL, UUID, FSTYPE, ... by low-level
* probing interface
*/
-static const char *
+static char *
fsprobe_get_value(const char *name, const char *devname)
{
int fd;
return data ? strdup((char *) data) : NULL;
}
-const char *
+char *
fsprobe_get_label_by_devname(const char *devname)
{
return fsprobe_get_value("LABEL", devname);
}
-const char *
+char *
fsprobe_get_uuid_by_devname(const char *devname)
{
return fsprobe_get_value("UUID", devname);
}
-const char *
+char *
fsprobe_get_fstype_by_devname(const char *devname)
{
return fsprobe_get_value("TYPE", devname);
}
-const char *
+char *
fsprobe_get_devname_by_uuid(const char *uuid)
{
return blkid_evaluate_spec("UUID", uuid, &blcache);
}
-const char *
+char *
fsprobe_get_devname_by_label(const char *label)
{
return blkid_evaluate_spec("LABEL", label, &blcache);
blkid_put_cache(blcache);
}
-const char *
+char *
fsprobe_get_devname_by_uuid(const char *uuid)
{
if (!blcache)
return blkid_get_devname(blcache, "UUID", uuid);
}
-const char *
+char *
fsprobe_get_devname_by_label(const char *label)
{
if (!blcache)
return blkid_get_devname(blcache, "LABEL", label);
}
-const char *
+char *
fsprobe_get_fstype_by_devname(const char *devname)
{
blkid_cache c;
return tp;
}
-const char *
+char *
fsprobe_get_label_by_devname(const char *devname)
{
if (!blcache)
return blkid_get_tag_value(blcache, "LABEL", devname);
}
-const char *
+char *
fsprobe_get_uuid_by_devname(const char *devname)
{
if (!blcache)
switch(type) {
case VOLUME_ID_LABEL:
if (volume_id_get_label(id, &val))
- value = xstrdup(val);
+ value = strdup(val);
break;
case VOLUME_ID_UUID:
if (volume_id_get_uuid(id, &val))
- value = xstrdup(val);
+ value = strdup(val);
break;
case VOLUME_ID_TYPE:
if (volume_id_get_type(id, &val))
- value = xstrdup(val);
+ value = strdup(val);
break;
default:
break;
return 0;
}
-const char *
+char *
fsprobe_get_uuid_by_devname(const char *devname)
{
return probe(devname, VOLUME_ID_UUID);
}
-const char *
+char *
fsprobe_get_label_by_devname(const char *devname)
{
return probe(devname, VOLUME_ID_LABEL);
}
-const char *
+char *
fsprobe_get_fstype_by_devname(const char *devname)
{
return probe(devname, VOLUME_ID_TYPE);
}
-const char *
+char *
fsprobe_get_devname_by_uuid(const char *uuid)
{
char dev[PATH_MAX];
return canonicalize_path(dev);
}
-const char *
+char *
fsprobe_get_devname_by_label(const char *label)
{
char dev[PATH_MAX];
* number and writes the number back to the file.
*/
/* dummy */
-const char *fsprobe_get_label_by_devname(const char *spec) { return NULL; }
-const char *fsprobe_get_uuid_by_devname(const char *spec) { return NULL; }
+char *fsprobe_get_label_by_devname(const char *spec) { return NULL; }
+char *fsprobe_get_uuid_by_devname(const char *spec) { return NULL; }
int fsprobe_parse_spec(const char *spec, char **name, char **value) { return 0; }
struct my_mntent *my_getmntent (mntFILE *mfp) { return NULL; }
mntFILE *my_setmntent (const char *file, char *mode) { return NULL; }