libfdisk: use fdisk_colon() and fdisk_sinfo()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
dd00d1b27d
commit
ac1a559a67
|
@ -179,13 +179,13 @@ void change_partition_type(struct fdisk_context *cxt)
|
|||
continue;
|
||||
|
||||
if (fdisk_set_partition_type(cxt, i, t) == 0) {
|
||||
fdisk_info(cxt,
|
||||
_("Changed type of partition '%s' to '%s'"),
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Changed type of partition '%s' to '%s'."),
|
||||
org_t ? org_t->name : _("Unknown"),
|
||||
t ? t->name : _("Unknown"));
|
||||
} else {
|
||||
fdisk_info(cxt,
|
||||
_("Type of partition %zu is unchanged: %s"),
|
||||
_("Type of partition %zu is unchanged: %s".),
|
||||
i + 1,
|
||||
org_t ? org_t->name : _("Unknown"));
|
||||
}
|
||||
|
@ -203,32 +203,32 @@ void list_disk_geometry(struct fdisk_context *cxt)
|
|||
char *strsz = size_to_human_string(SIZE_SUFFIX_SPACE
|
||||
| SIZE_SUFFIX_3LETTER, bytes);
|
||||
|
||||
fdisk_info(cxt, _("Disk %s: %s, %llu bytes, %llu sectors"),
|
||||
fdisk_colon(cxt, _("Disk %s: %s, %llu bytes, %llu sectors"),
|
||||
cxt->dev_path, strsz, bytes, cxt->total_sectors);
|
||||
free(strsz);
|
||||
|
||||
if (fdisk_require_geometry(cxt))
|
||||
fdisk_info(cxt, _("Geometry: %d heads, %llu sectors/track, %llu cylinders"),
|
||||
fdisk_colon(cxt, _("Geometry: %d heads, %llu sectors/track, %llu cylinders"),
|
||||
cxt->geom.heads, cxt->geom.sectors, cxt->geom.cylinders);
|
||||
|
||||
fdisk_info(cxt, _("Units: %s of %d * %ld = %ld bytes"),
|
||||
fdisk_colon(cxt, _("Units: %s of %d * %ld = %ld bytes"),
|
||||
fdisk_context_get_unit(cxt, PLURAL),
|
||||
fdisk_context_get_units_per_sector(cxt),
|
||||
cxt->sector_size,
|
||||
fdisk_context_get_units_per_sector(cxt) * cxt->sector_size);
|
||||
|
||||
fdisk_info(cxt, _("Sector size (logical/physical): %lu bytes / %lu bytes"),
|
||||
fdisk_colon(cxt, _("Sector size (logical/physical): %lu bytes / %lu bytes"),
|
||||
cxt->sector_size, cxt->phy_sector_size);
|
||||
fdisk_info(cxt, _("I/O size (minimum/optimal): %lu bytes / %lu bytes"),
|
||||
fdisk_colon(cxt, _("I/O size (minimum/optimal): %lu bytes / %lu bytes"),
|
||||
cxt->min_io_size, cxt->io_size);
|
||||
if (cxt->alignment_offset)
|
||||
fdisk_info(cxt, _("Alignment offset: %lu bytes"),
|
||||
fdisk_colon(cxt, _("Alignment offset: %lu bytes"),
|
||||
cxt->alignment_offset);
|
||||
if (fdisk_dev_has_disklabel(cxt))
|
||||
fdisk_info(cxt, _("Disk label type: %s"), cxt->label->name);
|
||||
fdisk_colon(cxt, _("Disk label type: %s"), cxt->label->name);
|
||||
|
||||
if (fdisk_get_disklabel_id(cxt, &id) == 0 && id)
|
||||
fdisk_info(cxt, _("Disk identifier: %s"), id);
|
||||
fdisk_colon(cxt, _("Disk identifier: %s"), id);
|
||||
}
|
||||
|
||||
|
||||
|
@ -476,7 +476,7 @@ int main(int argc, char **argv)
|
|||
fflush(stdout);
|
||||
|
||||
if (!fdisk_dev_has_disklabel(cxt)) {
|
||||
fdisk_warnx(cxt, _("Device does not contain a recognized partition table"));
|
||||
fdisk_warnx(cxt, _("Device does not contain a recognized partition table."));
|
||||
fdisk_create_disklabel(cxt, NULL);
|
||||
}
|
||||
|
||||
|
|
|
@ -342,36 +342,36 @@ static int bsd_list_disklabel(struct fdisk_context *cxt)
|
|||
assert(fdisk_is_disklabel(cxt, BSD));
|
||||
|
||||
if (fdisk_context_display_details(cxt)) {
|
||||
fdisk_info(cxt, "# %s:", cxt->dev_path);
|
||||
fdisk_colon(cxt, "# %s:", cxt->dev_path);
|
||||
|
||||
if ((unsigned) d->d_type < BSD_DKMAXTYPES)
|
||||
fdisk_info(cxt, _("type: %s"), bsd_dktypenames[d->d_type]);
|
||||
fdisk_colon(cxt, _("type: %s"), bsd_dktypenames[d->d_type]);
|
||||
else
|
||||
fdisk_info(cxt, _("type: %d"), d->d_type);
|
||||
fdisk_colon(cxt, _("type: %d"), d->d_type);
|
||||
|
||||
fdisk_info(cxt, _("disk: %.*s"), (int) sizeof(d->d_typename), d->d_typename);
|
||||
fdisk_info(cxt, _("label: %.*s"), (int) sizeof(d->d_packname), d->d_packname);
|
||||
fdisk_colon(cxt, _("disk: %.*s"), (int) sizeof(d->d_typename), d->d_typename);
|
||||
fdisk_colon(cxt, _("label: %.*s"), (int) sizeof(d->d_packname), d->d_packname);
|
||||
|
||||
fdisk_info(cxt, _("flags: %s"),
|
||||
fdisk_colon(cxt, _("flags: %s"),
|
||||
d->d_flags & BSD_D_REMOVABLE ? _(" removable") :
|
||||
d->d_flags & BSD_D_ECC ? _(" ecc") :
|
||||
d->d_flags & BSD_D_BADSECT ? _(" badsect") : "");
|
||||
|
||||
/* On various machines the fields of *lp are short/int/long */
|
||||
/* In order to avoid problems, we cast them all to long. */
|
||||
fdisk_info(cxt, _("bytes/sector: %ld"), (long) d->d_secsize);
|
||||
fdisk_info(cxt, _("sectors/track: %ld"), (long) d->d_nsectors);
|
||||
fdisk_info(cxt, _("tracks/cylinder: %ld"), (long) d->d_ntracks);
|
||||
fdisk_info(cxt, _("sectors/cylinder: %ld"), (long) d->d_secpercyl);
|
||||
fdisk_info(cxt, _("cylinders: %ld"), (long) d->d_ncylinders);
|
||||
fdisk_info(cxt, _("rpm: %d"), d->d_rpm);
|
||||
fdisk_info(cxt, _("interleave: %d"), d->d_interleave);
|
||||
fdisk_info(cxt, _("trackskew: %d"), d->d_trackskew);
|
||||
fdisk_info(cxt, _("cylinderskew: %d"), d->d_cylskew);
|
||||
fdisk_info(cxt, _("headswitch: %ld (milliseconds)"), (long) d->d_headswitch);
|
||||
fdisk_info(cxt, _("track-to-track seek: %ld (milliseconds)"), (long) d->d_trkseek);
|
||||
fdisk_colon(cxt, _("bytes/sector: %ld"), (long) d->d_secsize);
|
||||
fdisk_colon(cxt, _("sectors/track: %ld"), (long) d->d_nsectors);
|
||||
fdisk_colon(cxt, _("tracks/cylinder: %ld"), (long) d->d_ntracks);
|
||||
fdisk_colon(cxt, _("sectors/cylinder: %ld"), (long) d->d_secpercyl);
|
||||
fdisk_colon(cxt, _("cylinders: %ld"), (long) d->d_ncylinders);
|
||||
fdisk_colon(cxt, _("rpm: %d"), d->d_rpm);
|
||||
fdisk_colon(cxt, _("interleave: %d"), d->d_interleave);
|
||||
fdisk_colon(cxt, _("trackskew: %d"), d->d_trackskew);
|
||||
fdisk_colon(cxt, _("cylinderskew: %d"), d->d_cylskew);
|
||||
fdisk_colon(cxt, _("headswitch: %ld (milliseconds)"), (long) d->d_headswitch);
|
||||
fdisk_colon(cxt, _("track-to-track seek: %ld (milliseconds)"), (long) d->d_trkseek);
|
||||
/*
|
||||
fdisk_info(cxt, _("drivedata: "));
|
||||
fdisk_colon(cxt, _("drivedata: "));
|
||||
for (i = ARRAY_SIZE(d->d_drivedata)- 1; i >= 0; i--)
|
||||
if (d->d_drivedata[i])
|
||||
break;
|
||||
|
@ -382,7 +382,7 @@ static int bsd_list_disklabel(struct fdisk_context *cxt)
|
|||
*/
|
||||
}
|
||||
|
||||
fdisk_info(cxt, _("partitions: %d"), d->d_npartitions);
|
||||
fdisk_colon(cxt, _("partitions: %d"), d->d_npartitions);
|
||||
|
||||
tb = tt_new_table(TT_FL_FREEDATA);
|
||||
if (!tb)
|
||||
|
@ -530,7 +530,8 @@ static int bsd_get_bootstrap(struct fdisk_context *cxt,
|
|||
return -errno;
|
||||
}
|
||||
|
||||
fdisk_info(cxt, "bootstrap file %s successfully loaded", path);
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("The bootstrap file %s successfully loaded."), path);
|
||||
close (fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -601,7 +602,8 @@ int fdisk_bsd_write_bootstrap(struct fdisk_context *cxt)
|
|||
goto done;
|
||||
}
|
||||
|
||||
fdisk_info(cxt, _("Bootstrap installed on %s."), cxt->dev_path);
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Bootstrap installed on %s."), cxt->dev_path);
|
||||
sync_disks(cxt);
|
||||
|
||||
rc = 0;
|
||||
|
@ -742,7 +744,6 @@ static int bsd_write_disklabel(struct fdisk_context *cxt)
|
|||
struct fdisk_bsd_label *l = self_label(cxt);
|
||||
struct bsd_disklabel *d = self_disklabel(cxt);
|
||||
|
||||
fdisk_info(cxt, _("Writing disklabel to %s."), cxt->dev_path);
|
||||
|
||||
if (l->dos_part)
|
||||
offset = dos_partition_get_start(l->dos_part) * cxt->sector_size;
|
||||
|
@ -767,6 +768,9 @@ static int bsd_write_disklabel(struct fdisk_context *cxt)
|
|||
return -errno;
|
||||
}
|
||||
sync_disks(cxt);
|
||||
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Disklabel written to %s."), cxt->dev_path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -834,7 +838,8 @@ int fdisk_bsd_link_partition(struct fdisk_context *cxt)
|
|||
cxt->label->nparts_cur = d->d_npartitions;
|
||||
fdisk_label_set_changed(cxt->label, 1);
|
||||
|
||||
fdisk_info(cxt, _("BSD partition '%c' linked to DOS partition %d."),
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("BSD partition '%c' linked to DOS partition %d."),
|
||||
'a' + i, k + 1);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nls.h"
|
||||
#include "randutils.h"
|
||||
#include "pt-mbr.h"
|
||||
#include "strutils.h"
|
||||
|
||||
#include "fdiskP.h"
|
||||
|
||||
|
@ -164,7 +165,7 @@ static int get_partition_unused_primary(struct fdisk_context *cxt)
|
|||
|
||||
switch (rc) {
|
||||
case 1:
|
||||
fdisk_info(cxt, _("All primary partitions have been defined already"));
|
||||
fdisk_info(cxt, _("All primary partitions have been defined already."));
|
||||
return -1;
|
||||
case 0:
|
||||
return n;
|
||||
|
@ -280,19 +281,18 @@ static void dos_init(struct fdisk_context *cxt)
|
|||
fdisk_warnx(cxt, _("Cylinders as display units are deprecated."));
|
||||
|
||||
if (cxt->total_sectors > UINT_MAX) {
|
||||
unsigned long long bytes = cxt->total_sectors * cxt->sector_size;
|
||||
int giga = bytes / 1000000000;
|
||||
int hectogiga = (giga + 50) / 100;
|
||||
|
||||
uint64_t bytes = cxt->total_sectors * cxt->sector_size;
|
||||
char *szstr = size_to_human_string(SIZE_SUFFIX_SPACE
|
||||
| SIZE_SUFFIX_3LETTER, bytes);
|
||||
fdisk_warnx(cxt,
|
||||
_("The size of this disk is %d.%d TB (%llu bytes). DOS "
|
||||
_("The size of this disk is %s (%llu bytes). DOS "
|
||||
"partition table format can not be used on drives for "
|
||||
"volumes larger than (%llu bytes) for %ld-byte "
|
||||
"sectors. Use GUID partition table format (GPT)."),
|
||||
hectogiga / 10, hectogiga % 10,
|
||||
bytes,
|
||||
szstr, bytes,
|
||||
(sector_t ) UINT_MAX * cxt->sector_size,
|
||||
cxt->sector_size);
|
||||
free(szstr);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
|
|||
|
||||
p = pex->pt_entry;
|
||||
if (!dos_partition_get_start(p)) {
|
||||
fdisk_warnx(cxt, _("Bad offset in primary extended partition"));
|
||||
fdisk_warnx(cxt, _("Bad offset in primary extended partition."));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -434,7 +434,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
|
|||
if (pe->ex_entry)
|
||||
fdisk_warnx(cxt, _(
|
||||
"Extra link pointer in partition "
|
||||
"table %zd"),
|
||||
"table %zd."),
|
||||
cxt->label->nparts_max + 1);
|
||||
else
|
||||
pe->ex_entry = p;
|
||||
|
@ -442,7 +442,7 @@ static void read_extended(struct fdisk_context *cxt, int ext)
|
|||
if (pe->pt_entry)
|
||||
fdisk_warnx(cxt, _(
|
||||
"Ignoring extra data in partition "
|
||||
"table %zd"),
|
||||
"table %zd."),
|
||||
cxt->label->nparts_max + 1);
|
||||
else
|
||||
pe->pt_entry = p;
|
||||
|
@ -509,9 +509,6 @@ static int dos_create_disklabel(struct fdisk_context *cxt)
|
|||
/* random disk signature */
|
||||
random_get_bytes(&id, sizeof(id));
|
||||
|
||||
fdisk_info(cxt, ("Building a new DOS disklabel with disk "
|
||||
"identifier 0x%08x."), id);
|
||||
|
||||
dos_init(cxt);
|
||||
fdisk_zeroize_firstsector(cxt);
|
||||
fdisk_label_set_changed(cxt->label, 1);
|
||||
|
@ -521,6 +518,10 @@ static int dos_create_disklabel(struct fdisk_context *cxt)
|
|||
|
||||
/* Put MBR signature */
|
||||
mbr_set_magic(cxt->firstsector);
|
||||
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
("Created a new DOS disklabel with disk "
|
||||
"identifier 0x%08x."), id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -549,12 +550,14 @@ static int dos_set_disklabel_id(struct fdisk_context *cxt)
|
|||
return -EINVAL;
|
||||
}
|
||||
|
||||
fdisk_info(cxt, _("Changing disk identifier from 0x%08x to 0x%08x."),
|
||||
old, id);
|
||||
|
||||
mbr_set_id(cxt->firstsector, id);
|
||||
l->non_pt_changed = 1;
|
||||
fdisk_label_set_changed(cxt->label, 1);
|
||||
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Disk identifier changed from 0x%08x to 0x%08x."),
|
||||
old, id);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -822,7 +825,7 @@ static int add_partition(struct fdisk_context *cxt, int n, struct fdisk_parttype
|
|||
break;
|
||||
if (start >= temp + fdisk_context_get_units_per_sector(cxt)
|
||||
&& read) {
|
||||
fdisk_info(cxt, _("Sector %llu is already allocated"),
|
||||
fdisk_info(cxt, _("Sector %llu is already allocated."),
|
||||
temp);
|
||||
temp = start;
|
||||
read = 0;
|
||||
|
@ -879,7 +882,7 @@ static int add_partition(struct fdisk_context *cxt, int n, struct fdisk_parttype
|
|||
limit = first[i] - 1;
|
||||
}
|
||||
if (start > limit) {
|
||||
fdisk_info(cxt, _("No free sectors available"));
|
||||
fdisk_info(cxt, _("No free sectors available."));
|
||||
if (n > 4)
|
||||
cxt->label->nparts_max--;
|
||||
return -ENOSPC;
|
||||
|
@ -1147,13 +1150,13 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
|
|||
if (!p->sys_ind) {
|
||||
if (i != 4 || i + 1 < cxt->label->nparts_max)
|
||||
fdisk_warnx(cxt,
|
||||
_("Partition %zd: empty"),
|
||||
_("Partition %zd: empty."),
|
||||
i + 1);
|
||||
} else if (first[i] < l->ext_offset
|
||||
|| last[i] > e_last) {
|
||||
|
||||
fdisk_warnx(cxt, _("Logical partition %zd: "
|
||||
"not entirely in partition %zd"),
|
||||
"not entirely in partition %zd."),
|
||||
i + 1, l->ext_index + 1);
|
||||
}
|
||||
}
|
||||
|
@ -1164,7 +1167,7 @@ static int dos_verify_disklabel(struct fdisk_context *cxt)
|
|||
"than the maximum %llu."), total, n_sectors);
|
||||
else if (total < n_sectors)
|
||||
fdisk_warnx(cxt, _("Remaining %lld unallocated %ld-byte "
|
||||
"sectors"), n_sectors - total, cxt->sector_size);
|
||||
"sectors."), n_sectors - total, cxt->sector_size);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1240,7 +1243,7 @@ static int dos_add_partition(
|
|||
return rc;
|
||||
if (!buf[0]) {
|
||||
c = dflt;
|
||||
fdisk_info(cxt, _("Using default response %c"), c);
|
||||
fdisk_info(cxt, _("Using default response %c."), c);
|
||||
} else
|
||||
c = tolower(buf[0]);
|
||||
free(buf);
|
||||
|
@ -1262,7 +1265,7 @@ static int dos_add_partition(
|
|||
}
|
||||
goto done;
|
||||
} else
|
||||
fdisk_warnx(cxt, _("Invalid partition type `%c'"), c);
|
||||
fdisk_warnx(cxt, _("Invalid partition type `%c'."), c);
|
||||
}
|
||||
done:
|
||||
if (rc == 0)
|
||||
|
@ -1755,7 +1758,7 @@ int fdisk_dos_move_begin(struct fdisk_context *cxt, int i)
|
|||
p = pe->pt_entry;
|
||||
|
||||
if (!p->sys_ind || !dos_partition_get_size(p) || IS_EXTENDED (p->sys_ind)) {
|
||||
fdisk_warn(cxt, _("Partition %d: no data area."), i + 1);
|
||||
fdisk_warnx(cxt, _("Partition %d: no data area."), i + 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1149,11 +1149,11 @@ static int gpt_list_disklabel(struct fdisk_context *cxt)
|
|||
/* don't trunc anything in expert mode */
|
||||
if (fdisk_context_display_details(cxt)) {
|
||||
trunc = 0;
|
||||
fdisk_info(cxt, _("First LBA: %ju"), h->first_usable_lba);
|
||||
fdisk_info(cxt, _("Last LBA: %ju"), h->last_usable_lba);
|
||||
fdisk_info(cxt, _("Alternative LBA: %ju"), h->alternative_lba);
|
||||
fdisk_info(cxt, _("Partitions entries LBA: %ju"), h->partition_entry_lba);
|
||||
fdisk_info(cxt, _("Allocated partition entries: %ju"), h->npartition_entries);
|
||||
fdisk_colon(cxt, _("First LBA: %ju"), h->first_usable_lba);
|
||||
fdisk_colon(cxt, _("Last LBA: %ju"), h->last_usable_lba);
|
||||
fdisk_colon(cxt, _("Alternative LBA: %ju"), h->alternative_lba);
|
||||
fdisk_colon(cxt, _("Partitions entries LBA: %ju"), h->partition_entry_lba);
|
||||
fdisk_colon(cxt, _("Allocated partition entries: %ju"), h->npartition_entries);
|
||||
}
|
||||
tt_define_column(tb, _("Device"), 0.1, 0);
|
||||
tt_define_column(tb, _("Start"), 12, TT_FL_RIGHT);
|
||||
|
@ -1476,7 +1476,7 @@ static int gpt_verify_disklabel(struct fdisk_context *cxt)
|
|||
uint32_t nsegments = 0;
|
||||
uint64_t free_sectors = 0, largest_segment = 0;
|
||||
|
||||
fdisk_info(cxt, _("No errors detected"));
|
||||
fdisk_info(cxt, _("No errors detected."));
|
||||
fdisk_info(cxt, _("Header version: %s"), gpt_get_header_revstr(gpt->pheader));
|
||||
fdisk_info(cxt, _("Using %u out of %d partitions."),
|
||||
partitions_in_use(gpt->pheader, gpt->ents),
|
||||
|
@ -1759,8 +1759,9 @@ static int gpt_create_disklabel(struct fdisk_context *cxt)
|
|||
cxt->label->nparts_cur = 0;
|
||||
|
||||
guid_to_string(&gpt->pheader->disk_guid, str);
|
||||
fdisk_info(cxt, _("Building a new GPT disklabel (GUID: %s)"), str);
|
||||
fdisk_label_set_changed(cxt->label, 1);
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Created a new GPT disklabel (GUID: %s)"), str);
|
||||
done:
|
||||
return rc;
|
||||
}
|
||||
|
@ -1818,7 +1819,8 @@ static int gpt_set_disklabel_id(struct fdisk_context *cxt)
|
|||
|
||||
gpt_get_disklabel_id(cxt, &new);
|
||||
|
||||
fdisk_info(cxt, _("Changing disk identifier from %s to %s."), old, new);
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Disk identifier changed from %s to %s."), old, new);
|
||||
|
||||
free(old);
|
||||
free(new);
|
||||
|
@ -1939,14 +1941,15 @@ int fdisk_gpt_partition_set_uuid(struct fdisk_context *cxt, size_t i)
|
|||
|
||||
guid_to_string(&e->partition_guid, old_u);
|
||||
guid_to_string(&uuid, new_u);
|
||||
fdisk_info(cxt, _("Changing partition UUID from %s to %s"),
|
||||
old_u, new_u);
|
||||
|
||||
e->partition_guid = uuid;
|
||||
gpt_recompute_crc(gpt->pheader, gpt->ents);
|
||||
gpt_recompute_crc(gpt->bheader, gpt->ents);
|
||||
|
||||
fdisk_label_set_changed(cxt->label, 1);
|
||||
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Partition UUID changed from %s to %s"),
|
||||
old_u, new_u);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1974,16 +1977,12 @@ int fdisk_gpt_partition_set_name(struct fdisk_context *cxt, size_t i)
|
|||
e = &gpt->ents[i];
|
||||
old = encode_to_utf8((unsigned char *)e->name, sizeof(e->name));
|
||||
|
||||
fdisk_info(cxt, _("Changing partition name from '%s' to '%.*s'"),
|
||||
old, GPT_PART_NAME_LEN, str);
|
||||
sz = strlen(str);
|
||||
if (sz) {
|
||||
if (sz > GPT_PART_NAME_LEN)
|
||||
sz = GPT_PART_NAME_LEN;
|
||||
memcpy(name, str, sz);
|
||||
}
|
||||
free(str);
|
||||
free(old);
|
||||
|
||||
for (i = 0; i < GPT_PART_NAME_LEN; i++)
|
||||
e->name[i] = cpu_to_le16((uint16_t) name[i]);
|
||||
|
@ -1992,6 +1991,13 @@ int fdisk_gpt_partition_set_name(struct fdisk_context *cxt, size_t i)
|
|||
gpt_recompute_crc(gpt->bheader, gpt->ents);
|
||||
|
||||
fdisk_label_set_changed(cxt->label, 1);
|
||||
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Partition name changed from '%s' to '%.*s'"),
|
||||
old, GPT_PART_NAME_LEN, str);
|
||||
free(str);
|
||||
free(old);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -256,7 +256,7 @@ static int sgi_list_table(struct fdisk_context *cxt)
|
|||
int rc;
|
||||
|
||||
if (fdisk_context_display_details(cxt))
|
||||
fdisk_info(cxt, _(
|
||||
fdisk_colon(cxt, _(
|
||||
"Label geometry: %d heads, %llu sectors\n"
|
||||
" %llu cylinders, %d physical cylinders\n"
|
||||
" %d extra sects/cyl, interleave %d:1\n"),
|
||||
|
@ -362,7 +362,7 @@ static int sgi_list_table(struct fdisk_context *cxt)
|
|||
rc = fdisk_print_table(cxt, tb);
|
||||
tt_free_table(tb);
|
||||
|
||||
fdisk_info(cxt, _("Bootfile: %s"), sgilabel->boot_file);
|
||||
fdisk_colon(cxt, _("Bootfile: %s"), sgilabel->boot_file);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
@ -463,7 +463,8 @@ int fdisk_sgi_set_bootfile(struct fdisk_context *cxt)
|
|||
|
||||
memcpy(sgilabel->boot_file, name, sz);
|
||||
|
||||
fdisk_info(cxt,_("Bootfile is changed to \"%s\"."), name);
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Bootfile is changed to \"%s\"."), name);
|
||||
done:
|
||||
free(name);
|
||||
return rc;
|
||||
|
@ -958,9 +959,6 @@ static int sgi_create_disklabel(struct fdisk_context *cxt)
|
|||
assert(fdisk_is_disklabel(cxt, SGI));
|
||||
|
||||
sec_fac = cxt->sector_size / 512; /* determine the sector factor */
|
||||
|
||||
fdisk_info(cxt, _("Building a new SGI disklabel."));
|
||||
|
||||
res = blkdev_get_sectors(cxt->dev_fd, &llsectors);
|
||||
|
||||
#ifdef HDIO_GETGEO
|
||||
|
@ -1040,6 +1038,9 @@ static int sgi_create_disklabel(struct fdisk_context *cxt)
|
|||
sgi_set_volhdr(cxt);
|
||||
|
||||
cxt->label->nparts_cur = count_used_partitions(cxt);
|
||||
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Created a new SGI disklabel."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -125,9 +125,9 @@ static int sun_probe_label(struct fdisk_context *cxt)
|
|||
csum ^= *ush--;
|
||||
|
||||
if (csum) {
|
||||
fdisk_warnx(cxt, _("Detected sun disklabel with wrong checksum.\n"
|
||||
"Probably you'll have to set all the values,\n"
|
||||
"e.g. heads, sectors, cylinders and partitions\n"
|
||||
fdisk_warnx(cxt, _("Detected sun disklabel with wrong checksum. "
|
||||
"Probably you'll have to set all the values, "
|
||||
"e.g. heads, sectors, cylinders and partitions "
|
||||
"or force a fresh label (s command in main menu)"));
|
||||
return 1;
|
||||
}
|
||||
|
@ -202,8 +202,6 @@ static int sun_create_disklabel(struct fdisk_context *cxt)
|
|||
assert(cxt->label);
|
||||
assert(fdisk_is_disklabel(cxt, SUN));
|
||||
|
||||
fdisk_info(cxt, _("Building a new Sun disklabel."));
|
||||
|
||||
/* map first sector to header */
|
||||
fdisk_zeroize_firstsector(cxt);
|
||||
sun = (struct fdisk_sun_label *) cxt->label;
|
||||
|
@ -233,10 +231,10 @@ static int sun_create_disklabel(struct fdisk_context *cxt)
|
|||
} else {
|
||||
cxt->geom.cylinders = geometry.cylinders;
|
||||
fdisk_warnx(cxt,
|
||||
_("Warning: BLKGETSIZE ioctl failed on %s. "
|
||||
"Using geometry cylinder value of %llu.\n"
|
||||
"This value may be truncated for devices"
|
||||
" > 33.8 GB."),
|
||||
_("BLKGETSIZE ioctl failed on %s. "
|
||||
"Using geometry cylinder value of %llu. "
|
||||
"This value may be truncated for devices "
|
||||
"> 33.8 GB."),
|
||||
cxt->dev_path, cxt->geom.cylinders);
|
||||
}
|
||||
} else
|
||||
|
@ -285,6 +283,8 @@ static int sun_create_disklabel(struct fdisk_context *cxt)
|
|||
fdisk_label_set_changed(cxt->label, 1);
|
||||
cxt->label->nparts_cur = count_used_partitions(cxt);
|
||||
|
||||
fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
|
||||
_("Created a new Sun disklabel."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -397,7 +397,7 @@ static int sun_verify_disklabel(struct fdisk_context *cxt)
|
|||
for (k = 0; k < 7; k++) {
|
||||
for (i = 0; i < SUN_MAXPARTITIONS; i++) {
|
||||
if (k && (lens[i] % (cxt->geom.heads * cxt->geom.sectors))) {
|
||||
fdisk_warnx(cxt, _("Partition %d doesn't end on cylinder boundary"), i+1);
|
||||
fdisk_warnx(cxt, _("Partition %d doesn't end on cylinder boundary."), i+1);
|
||||
}
|
||||
if (lens[i]) {
|
||||
for (j = 0; j < i; j++)
|
||||
|
@ -418,7 +418,7 @@ static int sun_verify_disklabel(struct fdisk_context *cxt)
|
|||
if (starts[j]+lens[j] < endo)
|
||||
endo = starts[j]+lens[j];
|
||||
fdisk_warnx(cxt, _("Partition %d overlaps with others in "
|
||||
"sectors %d-%d"), i+1, starto, endo);
|
||||
"sectors %d-%d."), i+1, starto, endo);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -437,20 +437,20 @@ static int sun_verify_disklabel(struct fdisk_context *cxt)
|
|||
verify_sun_starts);
|
||||
|
||||
if (array[0] == -1) {
|
||||
fdisk_info(cxt, _("No partitions defined"));
|
||||
fdisk_info(cxt, _("No partitions defined."));
|
||||
return 0;
|
||||
}
|
||||
stop = cxt->geom.cylinders * cxt->geom.heads * cxt->geom.sectors;
|
||||
if (starts[array[0]])
|
||||
fdisk_warnx(cxt, _("Unused gap - sectors 0-%d"), starts[array[0]]);
|
||||
fdisk_warnx(cxt, _("Unused gap - sectors 0-%d."), starts[array[0]]);
|
||||
for (i = 0; i < 7 && array[i+1] != -1; i++) {
|
||||
fdisk_warnx(cxt, _("Unused gap - sectors %d-%d"),
|
||||
fdisk_warnx(cxt, _("Unused gap - sectors %d-%d."),
|
||||
(starts[array[i]] + lens[array[i]]),
|
||||
starts[array[i+1]]);
|
||||
}
|
||||
start = (starts[array[i]] + lens[array[i]]);
|
||||
if (start < stop)
|
||||
fdisk_warnx(cxt, _("Unused gap - sectors %d-%d"), start, stop);
|
||||
fdisk_warnx(cxt, _("Unused gap - sectors %d-%d."), start, stop);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -526,9 +526,9 @@ static int sun_add_partition(
|
|||
first += cs - x;
|
||||
}
|
||||
if (n == 2 && first != 0)
|
||||
fdisk_warnx(cxt, _("\
|
||||
It is highly recommended that the third partition covers the whole disk\n\
|
||||
and is of type `Whole disk'"));
|
||||
fdisk_warnx(cxt, _("It is highly recommended that the "
|
||||
"third partition covers the whole disk "
|
||||
"and is of type `Whole disk'"));
|
||||
/* ewt asks to add: "don't start a partition at cyl 0"
|
||||
However, edmundo@rano.demon.co.uk writes:
|
||||
"In addition to having a Sun partition table, to be able to
|
||||
|
@ -677,19 +677,19 @@ static int sun_list_disklabel(struct fdisk_context *cxt)
|
|||
|
||||
sunlabel = self_disklabel(cxt);
|
||||
|
||||
if (fdisk_context_display_details(cxt))
|
||||
fdisk_info(cxt,
|
||||
if (fdisk_context_display_details(cxt)) {
|
||||
fdisk_colon(cxt,
|
||||
_("Label geometry: %d rpm, %d alternate and %d physical cylinders,\n"
|
||||
" %d extra sects/cyl, interleave %d:1\n"
|
||||
"Label ID: %s\n"
|
||||
"Volume ID: %s\n"),
|
||||
" %d extra sects/cyl, interleave %d:1"),
|
||||
be16_to_cpu(sunlabel->rpm),
|
||||
be16_to_cpu(sunlabel->acyl),
|
||||
be16_to_cpu(sunlabel->pcyl),
|
||||
be16_to_cpu(sunlabel->apc),
|
||||
be16_to_cpu(sunlabel->intrlv),
|
||||
sunlabel->label_id,
|
||||
be16_to_cpu(sunlabel->intrlv));
|
||||
fdisk_colon(cxt, _("Label ID: %s"), sunlabel->label_id);
|
||||
fdisk_colon(cxt, _("Volume ID: %s"),
|
||||
*sunlabel->vtoc.volume_id ? sunlabel->vtoc.volume_id : _("<none>"));
|
||||
}
|
||||
|
||||
tb = tt_new_table(TT_FL_FREEDATA);
|
||||
if (!tb)
|
||||
|
|
Loading…
Reference in New Issue