From f9fe53ba89c761935aaa47068f0dd6ba27d31555 Mon Sep 17 00:00:00 2001 From: phk Date: Wed, 23 Oct 2002 21:05:42 +0000 Subject: More lobotomy: remove CHUNK_BSD_COMPAT, it was a bad idea, and now its gone. remove DOSPTYP_ONTRACK, missed in OnTrack removal commit. unifdef -DHAVE_GEOM make tst01 compile again. --- lib/libdisk/chunk.c | 1 - lib/libdisk/create_chunk.c | 9 ++--- lib/libdisk/disk.c | 80 ------------------------------------------ lib/libdisk/libdisk.h | 3 -- lib/libdisk/tst01.c | 6 +--- lib/libdisk/write_amd64_disk.c | 6 +--- lib/libdisk/write_i386_disk.c | 6 +--- lib/libdisk/write_ia64_disk.c | 6 +--- 8 files changed, 6 insertions(+), 111 deletions(-) (limited to 'lib/libdisk') diff --git a/lib/libdisk/chunk.c b/lib/libdisk/chunk.c index efb76c8..14e9500 100644 --- a/lib/libdisk/chunk.c +++ b/lib/libdisk/chunk.c @@ -307,7 +307,6 @@ ShowChunkFlags(struct chunk *c) static char ret[10]; int i=0; - if (c->flags & CHUNK_BSD_COMPAT) ret[i++] = 'C'; if (c->flags & CHUNK_ACTIVE) ret[i++] = 'A'; if (c->flags & CHUNK_ALIGN) ret[i++] = '='; if (c->flags & CHUNK_IS_ROOT) ret[i++] = 'R'; diff --git a/lib/libdisk/create_chunk.c b/lib/libdisk/create_chunk.c index bc0acb0..7a7fdb4 100644 --- a/lib/libdisk/create_chunk.c +++ b/lib/libdisk/create_chunk.c @@ -101,6 +101,7 @@ Fixup_FreeBSD_Names(struct disk *d, struct chunk *c) return 0; } +#ifndef PC98 static int Fixup_Extended_Names(struct disk *d, struct chunk *c) { @@ -119,6 +120,7 @@ Fixup_Extended_Names(struct disk *d, struct chunk *c) } return 0; } +#endif int Fixup_Names(struct disk *d) @@ -131,7 +133,6 @@ Fixup_Names(struct disk *d) c1 = d->chunks; for(c2 = c1->part; c2 ; c2 = c2->next) { - c2->flags &= ~CHUNK_BSD_COMPAT; if (c2->type == unused) continue; if (strcmp(c2->name, "X")) @@ -159,12 +160,6 @@ Fixup_Names(struct disk *d) #endif /*__i386__*/ } for(c2 = c1->part; c2; c2 = c2->next) { - if (c2->type == freebsd) { - c2->flags |= CHUNK_BSD_COMPAT; - break; - } - } - for(c2 = c1->part; c2; c2 = c2->next) { if (c2->type == freebsd) Fixup_FreeBSD_Names(d, c2); #ifndef PC98 diff --git a/lib/libdisk/disk.c b/lib/libdisk/disk.c index 24ba45b..96df3c4 100644 --- a/lib/libdisk/disk.c +++ b/lib/libdisk/disk.c @@ -31,15 +31,12 @@ __FBSDID("$FreeBSD$"); #ifndef PC98 #define HAVE_GEOM #endif -#ifdef HAVE_GEOM #include #include #include -#endif /*HAVE_GEOM*/ #ifndef PC98 #define DOSPTYP_EXTENDED 5 -#define DOSPTYP_ONTRACK 84 #endif #ifdef DEBUG @@ -76,7 +73,6 @@ Read_Int32(u_int32_t *p) } #endif -#ifdef HAVE_GEOM /* * XXX BEGIN HACK XXX * Scan/parse the XML geom data to retrieve what we need to @@ -456,7 +452,6 @@ assignToPartition(void *arg, XMLToken t, u_int *part, u_int64_t v) return 0; } #undef N -#endif /*HAVE_GEOM*/ struct disk * Int_Open_Disk(const char *name, u_long size) @@ -473,15 +468,10 @@ Int_Open_Disk(const char *name, u_long size) struct dos_partition *dp; void *p; #endif -#ifdef HAVE_GEOM char *confxml = NULL; size_t xmlsize; u_int64_t mediasize; int error; -#else - u_long sector_size; - char *buf; -#endif /*HAVE_GEOM*/ strlcpy(device, _PATH_DEV, sizeof(device)); strlcat(device, name, sizeof(device)); @@ -498,7 +488,6 @@ Int_Open_Disk(const char *name, u_long size) memset(&dl, 0, sizeof dl); memset(&ds, 0, sizeof ds); -#ifdef HAVE_GEOM /* * Read and hack-parse the XML that provides the info we need. */ @@ -555,51 +544,6 @@ Int_Open_Disk(const char *name, u_long size) dl.d_ncylinders = size / (dl.d_ntracks * dl.d_nsectors); /* "whole disk" slice maintained for compatibility */ ds.dss_slices[WHOLE_DISK_SLICE].ds_size = size; -#else /* !HAVE_GEOM */ - if (ioctl(fd, DIOCGDINFO, &dl) < 0) { - DPRINT(("DIOCGDINFO(%s) failed", device)); - goto bad; - } - i = ioctl(fd, DIOCGSLICEINFO, &ds); - if (i < 0) { - DPRINT(("DIOCGSLICEINFO(%s) failed", device)); - goto bad; - } - -#ifdef DEBUG - for(i = 0; i < ds.dss_nslices; i++) - if(ds.dss_slices[i].ds_openmask) - printf(" open(%d)=0x%2x", - i, ds.dss_slices[i].ds_openmask); - printf("\n"); -#endif - -/* XXX --- ds.dss_slice[WHOLE_DISK_SLICE].ds.size of MO disk is wrong!!! */ -#ifdef PC98 - if (!size) - size = dl.d_ncylinders * dl.d_ntracks * dl.d_nsectors; -#else - if (!size) - size = ds.dss_slices[WHOLE_DISK_SLICE].ds_size; -#endif - - /* determine media sector size */ - if ((buf = malloc(MAX_SEC_SIZE)) == NULL) - return NULL; - for (sector_size = MIN_SEC_SIZE; sector_size <= MAX_SEC_SIZE; sector_size *= 2) { - if (read(fd, buf, sector_size) == sector_size) { - d->sector_size = sector_size; - break; - } - } - free (buf); - if (sector_size > MAX_SEC_SIZE) { - DPRINT(("Int_Open_Disk: could not determine sector size, " - "calculated %u, max %u\n", sector_size, MAX_SEC_SIZE)); - /* could not determine sector size */ - goto bad; - } -#endif /*HAVE_GEOM*/ #ifdef PC98 p = (unsigned char*)read_block(fd, 1, d->sector_size); @@ -707,32 +651,10 @@ Int_Open_Disk(const char *name, u_long size) if (ds.dss_slices[i].ds_type != 0xa5) #endif continue; -#ifdef HAVE_GEOM if (xmlparse(confxml, "BSD", sname, assignToPartition, &dl) != 0) { DPRINTX(("Error parsing MBR geometry specification.")); goto bad; } -#else - { - struct disklabel dl; - int k; - - strlcpy(pname, _PATH_DEV, sizeof(pname)); - strlcat(pname, sname, sizeof(pname)); - j = open(pname, O_RDONLY); - if (j < 0) { - DPRINT(("open(%s)", pname)); - continue; - } - k = ioctl(j, DIOCGDINFO, &dl); - if (k < 0) { - DPRINT(("ioctl(%s, DIOCGDINFO)", pname)); - close(j); - continue; - } - close(j); - } -#endif /*HAVE_GEOM*/ for(j = 0; j <= dl.d_npartitions; j++) { if (j == RAW_PART) @@ -828,10 +750,8 @@ pc98_mo_done: Fixup_Names(d); return d; bad: -#ifdef HAVE_GEOM if (confxml != NULL) free(confxml); -#endif if (fd >= 0) close(fd); return NULL; diff --git a/lib/libdisk/libdisk.h b/lib/libdisk/libdisk.h index 52fa135..a015828 100644 --- a/lib/libdisk/libdisk.h +++ b/lib/libdisk/libdisk.h @@ -78,8 +78,6 @@ struct chunk { /* * flags: * - * BSD_COMPAT - This chunk is in the BSD-compatibility, and has - * a short name too, ie wd0s4f -> wd0f * ALIGN - This chunk should be aligned * IS_ROOT - This 'part' is a rootfs, allocate 'a' * ACTIVE - This is the active slice in the MBR @@ -91,7 +89,6 @@ struct chunk { * delete (along with AUTO_SIZE). */ -#define CHUNK_BSD_COMPAT 0x0002 #define CHUNK_ALIGN 0x0008 #define CHUNK_IS_ROOT 0x0010 #define CHUNK_ACTIVE 0x0020 diff --git a/lib/libdisk/tst01.c b/lib/libdisk/tst01.c index 23b949f..7173c53 100644 --- a/lib/libdisk/tst01.c +++ b/lib/libdisk/tst01.c @@ -179,10 +179,6 @@ main(int argc, char **argv) strtol(cmds[5],0,0))); continue; } - if (!strcasecmp(*cmds,"mknod")) { - MakeDevDisk(d,"/tmp"); - continue; - } if (!strcasecmp(*cmds,"delete") && ncmd == 2) { printf("delete = %d\n", Delete_Chunk(d, @@ -234,7 +230,7 @@ main(int argc, char **argv) strtol(cmds[5],0,0), cmds[6])); #else - strtol(cmds[5],0,0))); + strtol(cmds[5],0,0), NULL)); #endif continue; } diff --git a/lib/libdisk/write_amd64_disk.c b/lib/libdisk/write_amd64_disk.c index ad788a2..6922776 100644 --- a/lib/libdisk/write_amd64_disk.c +++ b/lib/libdisk/write_amd64_disk.c @@ -98,12 +98,8 @@ Write_Disk(const struct disk *d1) fd = open(device,O_RDWR); - if (fd < 0) { -#ifdef DEBUG - warn("open(%s) failed", device); -#endif + if (fd < 0) return 1; - } memset(s,0,sizeof s); mbr = read_block(fd, 0, d1->sector_size); diff --git a/lib/libdisk/write_i386_disk.c b/lib/libdisk/write_i386_disk.c index ad788a2..6922776 100644 --- a/lib/libdisk/write_i386_disk.c +++ b/lib/libdisk/write_i386_disk.c @@ -98,12 +98,8 @@ Write_Disk(const struct disk *d1) fd = open(device,O_RDWR); - if (fd < 0) { -#ifdef DEBUG - warn("open(%s) failed", device); -#endif + if (fd < 0) return 1; - } memset(s,0,sizeof s); mbr = read_block(fd, 0, d1->sector_size); diff --git a/lib/libdisk/write_ia64_disk.c b/lib/libdisk/write_ia64_disk.c index ad788a2..6922776 100644 --- a/lib/libdisk/write_ia64_disk.c +++ b/lib/libdisk/write_ia64_disk.c @@ -98,12 +98,8 @@ Write_Disk(const struct disk *d1) fd = open(device,O_RDWR); - if (fd < 0) { -#ifdef DEBUG - warn("open(%s) failed", device); -#endif + if (fd < 0) return 1; - } memset(s,0,sizeof s); mbr = read_block(fd, 0, d1->sector_size); -- cgit v1.1