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"));
}
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);
}
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);
}
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;
*/
}
- 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)
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;
}
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;
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;
return -errno;
}
sync_disks(cxt);
+
+ fdisk_sinfo(cxt, FDISK_INFO_SUCCESS,
+ _("Disklabel written to %s."), cxt->dev_path);
return 0;
}
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;
}
#include "nls.h"
#include "randutils.h"
#include "pt-mbr.h"
+#include "strutils.h"
#include "fdiskP.h"
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;
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);
}
}
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;
}
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;
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;
/* 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);
/* 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;
}
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;
}
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;
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;
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);
}
}
"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;
}
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);
}
goto done;
} else
- fdisk_warnx(cxt, _("Invalid partition type `%c'"), c);
+ fdisk_warnx(cxt, _("Invalid partition type `%c'."), c);
}
done:
if (rc == 0)
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;
}
/* 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);
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),
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;
}
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);
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;
}
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]);
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;
}
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"),
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;
}
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;
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
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;
}
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;
}
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;
} 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
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;
}
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++)
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);
}
}
}
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;
}
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
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)