int do_set_uuid (const char *device, const char *uuid) { int r; /* How we set the UUID depends on the filesystem type. */ CLEANUP_FREE char *vfs_type = get_blkid_tag (device, "TYPE"); if (vfs_type == NULL) return -1; if (fstype_is_extfs (vfs_type)) r = e2uuid (device, uuid); else if (STREQ (vfs_type, "xfs")) r = xfsuuid (device, uuid); else if (STREQ (vfs_type, "swap")) r = swapuuid (device, uuid); else if (STREQ (vfs_type, "btrfs")) { reply_with_error ("btrfs filesystems' UUID cannot be changed"); r = -1; } else { reply_with_error ("don't know how to set the UUID for '%s' filesystems", vfs_type); r = -1; } return r; }
char * do_vfs_label (const mountable_t *mountable) { CLEANUP_FREE char *type = do_vfs_type (mountable); if (type) { if (STREQ (type, "btrfs") && optgroup_btrfs_available ()) return btrfs_get_label (mountable->device); if (STREQ (type, "ntfs") && optgroup_ntfsprogs_available ()) return ntfs_get_label (mountable->device); } return get_blkid_tag (mountable->device, "LABEL"); }
char * do_vfs_uuid (const mountable_t *mountable) { return get_blkid_tag (mountable->device, "UUID"); }
char * do_vfs_label (const mountable_t *mountable) { return get_blkid_tag (mountable->device, "LABEL"); }
char * do_vfs_type (const mountable_t *mountable) { return get_blkid_tag (mountable->device, "TYPE"); }
char * do_vfs_uuid (const char *device) { return get_blkid_tag (device, "UUID"); }
char * do_vfs_label (const char *device) { return get_blkid_tag (device, "LABEL"); }
char * do_vfs_type (const char *device) { return get_blkid_tag (device, "TYPE"); }