No functional change.
-/* $OpenBSD: cmd.c,v 1.130 2021/07/17 13:37:01 krw Exp $ */
+/* $OpenBSD: cmd.c,v 1.131 2021/07/17 14:16:34 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
maxsec = 9999999;
#endif
- /* Ask for new info */
if (ask_yn("Change disk geometry?")) {
disk.dk_cylinders = ask_num("BIOS Cylinders",
disk.dk_cylinders, 1, maxcyl);
gg = &gp[pn];
- /* Print out current table entry */
GPT_print_parthdr(TERSE);
GPT_print_part(pn, "s", TERSE);
pp = &mbr->mbr_prt[pn];
- /* Print out current table entry */
PRT_print(0, NULL, NULL);
PRT_print(pn, pp, NULL);
- /* Ask for MBR partition type */
pp->prt_id = ask_pid(pp->prt_id, NULL);
return 0;
int
Xupdate(char *args, struct mbr *mbr)
{
- /* Update code */
memcpy(mbr->mbr_code, initial_mbr.mbr_code, sizeof(mbr->mbr_code));
mbr->mbr_signature = DOSMBR_SIGNATURE;
printf("Machine code updated.\n");
return CMD_CONT;
if (flag != NULL) {
- /* Set flag to value provided. */
if (letoh64(gh.gh_sig) == GPTSIGNATURE)
val = strtonum(flag, 0, INT64_MAX, &errstr);
else
mbr->mbr_prt[pn].prt_flag = val;
printf("Partition %d flag value set to 0x%llx.\n", pn, val);
} else {
- /* Set active flag */
if (letoh64(gh.gh_sig) == GPTSIGNATURE) {
for (i = 0; i < NGPTPARTITIONS; i++) {
if (i == pn)
-/* $OpenBSD: disk.c,v 1.66 2021/07/16 13:26:04 krw Exp $ */
+/* $OpenBSD: disk.c,v 1.67 2021/07/17 14:16:34 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
}
}
-/*
- * Print the disk geometry information. Take an optional modifier
- * to indicate the units that should be used for display.
- */
void
DISK_printgeometry(const char *units)
{
}
/*
- * Read the sector at 'where' from the file descriptor 'fd' into newly
- * calloc'd memory. Return a pointer to the memory if it contains the
- * requested data, or NULL if it does not.
- *
- * The caller must free() the memory it gets.
+ * The caller must free() the returned memory!
*/
char *
DISK_readsector(const uint64_t sector)
return secbuf;
}
-/*
- * Write the sector-sized 'secbuf' to the sector 'where' on the file
- * descriptor 'fd'. Return 0 if the write works. Return -1 and set
- * errno if the write fails.
- */
int
DISK_writesector(const char *secbuf, const uint64_t sector)
{
len = write(disk.dk_fd, secbuf, secsize);
if (len == -1 || len != secsize) {
- /* short read or write */
errno = EIO;
return -1;
}
-/* $OpenBSD: fdisk.c,v 1.122 2021/07/15 23:25:46 krw Exp $ */
+/* $OpenBSD: fdisk.c,v 1.123 2021/07/17 14:16:34 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
argc -= optind;
argv += optind;
- /* Argument checking */
if (argc != 1 || (i_flag && u_flag) ||
(i_flag == 0 && g_flag))
usage();
-/* $OpenBSD: mbr.c,v 1.86 2021/07/15 21:58:02 krw Exp $ */
+/* $OpenBSD: mbr.c,v 1.87 2021/07/17 14:16:34 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
DISK_printgeometry(NULL);
- /* Header */
printf("Offset: %lld\t", (long long)mbr->mbr_lba_self);
printf("Signature: 0x%X\n", (int)mbr->mbr_signature);
PRT_print(0, NULL, units);
- /* Entries */
for (i = 0; i < NDOSPART; i++)
PRT_print(i, &mbr->mbr_prt[i], units);
}
if (secbuf == NULL)
return -1;
- /*
- * Place the new MBR at the start of the sector and
- * write the sector back to "disk".
- */
memcpy(secbuf, dos_mbr, sizeof(*dos_mbr));
DISK_writesector(secbuf, sector);
-/* $OpenBSD: misc.c,v 1.77 2021/07/16 13:26:04 krw Exp $ */
+/* $OpenBSD: misc.c,v 1.78 2021/07/17 14:16:34 krw Exp $ */
/*
* Copyright (c) 1997 Tobias Weingartner
break;
i++;
}
- /* default */
if (unit_types[i].ut_abbr == NULL)
return SECTORS;