diff options
author | phk <phk@FreeBSD.org> | 2003-04-12 08:34:40 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2003-04-12 08:34:40 +0000 |
commit | e9d1c65d22261411dd6170529ca7f925989dca05 (patch) | |
tree | 789d291ca01de94508cdbf44ca93727387ca9c33 /sys/geom/geom_mbr.c | |
parent | 0aeffee15b90eaf9e1bf857750489faaac5eea25 (diff) | |
download | FreeBSD-src-e9d1c65d22261411dd6170529ca7f925989dca05.zip FreeBSD-src-e9d1c65d22261411dd6170529ca7f925989dca05.tar.gz |
Move the functions for encoding decoding struct dos_partition into
a separate .c file so they can be used from userland as well.
Diffstat (limited to 'sys/geom/geom_mbr.c')
-rw-r--r-- | sys/geom/geom_mbr.c | 20 |
1 files changed, 2 insertions, 18 deletions
diff --git a/sys/geom/geom_mbr.c b/sys/geom/geom_mbr.c index 05d6d45..4c81ec7 100644 --- a/sys/geom/geom_mbr.c +++ b/sys/geom/geom_mbr.c @@ -85,22 +85,6 @@ g_mbr_print(int i, struct dos_partition *dp) printf(" s:%d l:%d\n", dp->dp_start, dp->dp_size); } -static void -g_dec_dos_partition(u_char *ptr, struct dos_partition *d) -{ - - d->dp_flag = ptr[0]; - d->dp_shd = ptr[1]; - d->dp_ssect = ptr[2]; - d->dp_scyl = ptr[3]; - d->dp_typ = ptr[4]; - d->dp_ehd = ptr[5]; - d->dp_esect = ptr[6]; - d->dp_ecyl = ptr[7]; - d->dp_start = le32dec(ptr + 8); - d->dp_size = le32dec(ptr + 12); -} - struct g_mbr_softc { int type [NDOSPART]; u_int sectorsize; @@ -121,7 +105,7 @@ g_mbr_modify(struct g_geom *gp, struct g_mbr_softc *ms, u_char *sec0) dp = ndp; for (i = 0; i < NDOSPART; i++) { - g_dec_dos_partition( + dos_partition_dec( sec0 + DOSPARTOFF + i * sizeof(struct dos_partition), dp + i); if (bootverbose) @@ -428,7 +412,7 @@ g_mbrext_taste(struct g_class *mp, struct g_provider *pp, int insist __unused) if (buf[0x1fe] != 0x55 && buf[0x1ff] != 0xaa) break; for (i = 0; i < NDOSPART; i++) - g_dec_dos_partition( + dos_partition_dec( buf + DOSPARTOFF + i * sizeof(struct dos_partition), dp + i); g_free(buf); |