#include "fdiskbsdlabel.h"
#include "all-io.h"
-static char *xbsd_dktypenames[] = {
+static char *bsd_dktypenames[] = {
"unknown",
"SMD",
"MSCP",
"floppy",
0
};
-#define BSD_DKMAXTYPES (ARRAY_SIZE(xbsd_dktypenames) - 1)
+#define BSD_DKMAXTYPES (ARRAY_SIZE(bsd_dktypenames) - 1)
-static struct fdisk_parttype xbsd_fstypes[] = {
+static struct fdisk_parttype bsd_fstypes[] = {
{BSD_FS_UNUSED, "unused"},
{BSD_FS_SWAP, "swap"},
{BSD_FS_V6, "Version 6"},
{BSD_FS_ADVFS, "AdvFS"},
{ 0, NULL }
};
-#define BSD_FSMAXTYPES (ARRAY_SIZE(xbsd_fstypes)-1)
+#define BSD_FSMAXTYPES (ARRAY_SIZE(bsd_fstypes)-1)
/*
* in-memory fdisk BSD stuff
};
static int bsd_list_disklabel(struct fdisk_context *cxt);
-static int xbsd_initlabel(struct fdisk_context *cxt);
-static int xbsd_readlabel(struct fdisk_context *cxt);
-static int xbsd_writelabel(struct fdisk_context *cxt);
+static int bsd_initlabel(struct fdisk_context *cxt);
+static int bsd_readlabel(struct fdisk_context *cxt);
+static int bsd_writelabel(struct fdisk_context *cxt);
static void sync_disks(struct fdisk_context *cxt);
#define bsd_cround(c, n) \
if (cxt->parent)
rc = bsd_assign_dos_partition(cxt); /* nested BSD partiotn table */
if (!rc)
- rc = xbsd_readlabel(cxt);
+ rc = bsd_readlabel(cxt);
if (!rc)
return 1; /* found BSD */
return 0; /* not found */
}
-static int xbsd_write_disklabel (struct fdisk_context *cxt)
+static int bsd_write_disklabel (struct fdisk_context *cxt)
{
fdisk_info(cxt, _("Writing disklabel to %s."), cxt->dev_path);
- xbsd_writelabel(cxt);
+ bsd_writelabel(cxt);
reread_partition_table(cxt, 0); /* no exit yet */
return 0;
}
-static int xbsd_add_part (struct fdisk_context *cxt,
+static int bsd_add_part (struct fdisk_context *cxt,
size_t i,
struct fdisk_parttype *t __attribute__((__unused__)))
{
}
/* Returns 0 on success, < 0 on error. */
-static int xbsd_create_disklabel(struct fdisk_context *cxt)
+static int bsd_create_disklabel(struct fdisk_context *cxt)
{
int rc, yes = 0;
struct bsd_disklabel *d = self_disklabel(cxt);
if (rc)
return rc;
- rc = xbsd_initlabel(cxt);
+ rc = bsd_initlabel(cxt);
if (!rc) {
int org = fdisk_context_display_details(cxt);
return rc;
}
-static int xbsd_delete_part(
+static int bsd_delete_part(
struct fdisk_context *cxt,
size_t partnum)
{
fdisk_info(cxt, "# %s:", cxt->dev_path);
if ((unsigned) d->d_type < BSD_DKMAXTYPES)
- fdisk_info(cxt, _("type: %s"), xbsd_dktypenames[d->d_type]);
+ fdisk_info(cxt, _("type: %s"), bsd_dktypenames[d->d_type]);
else
fdisk_info(cxt, _("type: %d"), d->d_type);
}
if ((unsigned) p->p_fstype < BSD_FSMAXTYPES)
- rc = asprintf(&s, "%s", xbsd_fstypes[p->p_fstype].name);
+ rc = asprintf(&s, "%s", bsd_fstypes[p->p_fstype].name);
else
rc = asprintf(&s, "%x", p->p_fstype);
if (rc > 0)
return 0;
}
-static int xbsd_get_bootstrap(struct fdisk_context *cxt,
+static int bsd_get_bootstrap(struct fdisk_context *cxt,
char *path, void *ptr, int size)
{
int fd;
name = res;
snprintf(buf, sizeof(buf), "%s/%sboot", BSD_LINUX_BOOTDIR, name);
- rc = xbsd_get_bootstrap(cxt, buf, l->bsdbuffer, (int) d->d_secsize);
+ rc = bsd_get_bootstrap(cxt, buf, l->bsdbuffer, (int) d->d_secsize);
if (rc)
goto done;
memset(dp, 0, sizeof(struct bsd_disklabel));
snprintf(buf, sizeof(buf), "%s/boot%s", BSD_LINUX_BOOTDIR, name);
- rc = xbsd_get_bootstrap(cxt, buf,
+ rc = bsd_get_bootstrap(cxt, buf,
&l->bsdbuffer[d->d_secsize],
(int) d->d_bbsize - d->d_secsize);
if (rc)
return rc;
}
-static unsigned short xbsd_dkcksum (struct bsd_disklabel *lp)
+static unsigned short bsd_dkcksum (struct bsd_disklabel *lp)
{
unsigned short *start, *end;
unsigned short sum = 0;
return sum;
}
-static int xbsd_initlabel (struct fdisk_context *cxt)
+static int bsd_initlabel (struct fdisk_context *cxt)
{
struct fdisk_bsd_label *l = self_label(cxt);
struct bsd_disklabel *d = self_disklabel(cxt);
}
/*
- * Read a xbsd_disklabel from sector 0 or from the starting sector of p.
+ * Read a bsd_disklabel from sector 0 or from the starting sector of p.
* If it has the right magic, return 0.
*/
-static int xbsd_readlabel(struct fdisk_context *cxt)
+static int bsd_readlabel(struct fdisk_context *cxt)
{
struct fdisk_bsd_label *l;
struct bsd_disklabel *d;
return 0;
}
-static int xbsd_writelabel(struct fdisk_context *cxt)
+static int bsd_writelabel(struct fdisk_context *cxt)
{
off_t offset = 0;
struct fdisk_bsd_label *l;
offset = dos_partition_get_start(l->dos_part) * cxt->sector_size;
d->d_checksum = 0;
- d->d_checksum = xbsd_dkcksum(d);
+ d->d_checksum = bsd_dkcksum(d);
/* Update label with in boot block. */
memmove(&l->bsdbuffer[BSD_LABELSECTOR * DEFAULT_SECTOR_SIZE
sleep(4);
}
-static int xbsd_translate_fstype (int linux_type)
+static int bsd_translate_fstype (int linux_type)
{
switch (linux_type) {
case 0x01: /* DOS 12-bit FAT */
d->d_partitions[i].p_size = dos_partition_get_size(p);
d->d_partitions[i].p_offset = dos_partition_get_start(p);
- d->d_partitions[i].p_fstype = xbsd_translate_fstype(p->sys_ind);
+ d->d_partitions[i].p_fstype = bsd_translate_fstype(p->sys_ind);
if (i >= d->d_npartitions)
d->d_npartitions = i + 1;
return 0;
}
-static struct fdisk_parttype *xbsd_get_parttype(
+static struct fdisk_parttype *bsd_get_parttype(
struct fdisk_context *cxt,
size_t n)
{
return t;
}
-static int xbsd_set_parttype(
+static int bsd_set_parttype(
struct fdisk_context *cxt,
size_t partnum,
struct fdisk_parttype *t)
{
.probe = bsd_probe_label,
.list = bsd_list_disklabel,
- .write = xbsd_write_disklabel,
- .create = xbsd_create_disklabel,
- .part_add = xbsd_add_part,
- .part_delete = xbsd_delete_part,
- .part_get_type = xbsd_get_parttype,
- .part_set_type = xbsd_set_parttype,
+ .write = bsd_write_disklabel,
+ .create = bsd_create_disklabel,
+ .part_add = bsd_add_part,
+ .part_delete = bsd_delete_part,
+ .part_get_type = bsd_get_parttype,
+ .part_set_type = bsd_set_parttype,
.part_get_status= bsd_get_partition_status,
};
lb->name = "bsd";
lb->id = FDISK_DISKLABEL_BSD;
lb->op = &bsd_operations;
- lb->parttypes = xbsd_fstypes;
- lb->nparttypes = ARRAY_SIZE(xbsd_fstypes);
+ lb->parttypes = bsd_fstypes;
+ lb->nparttypes = ARRAY_SIZE(bsd_fstypes);
lb->flags |= FDISK_LABEL_FL_INCHARS_PARTNO;
lb->flags |= FDISK_LABEL_FL_REQUIRE_GEOMETRY;