Ejemplo n.º 1
0
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;
}
Ejemplo n.º 2
0
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");
}
Ejemplo n.º 3
0
char *
do_vfs_uuid (const mountable_t *mountable)
{
  return get_blkid_tag (mountable->device, "UUID");
}
Ejemplo n.º 4
0
char *
do_vfs_label (const mountable_t *mountable)
{
  return get_blkid_tag (mountable->device, "LABEL");
}
Ejemplo n.º 5
0
char *
do_vfs_type (const mountable_t *mountable)
{
  return get_blkid_tag (mountable->device, "TYPE");
}
Ejemplo n.º 6
0
char *
do_vfs_uuid (const char *device)
{
  return get_blkid_tag (device, "UUID");
}
Ejemplo n.º 7
0
char *
do_vfs_label (const char *device)
{
  return get_blkid_tag (device, "LABEL");
}
Ejemplo n.º 8
0
char *
do_vfs_type (const char *device)
{
  return get_blkid_tag (device, "TYPE");
}