Here is a set of patches that alowed me to at least make a 1.5TB partition on my raid set. I am willing to bet that it breaks other platforms as I haven't even compiled them but it's mainly mechanical editing.
is there a "Mr sysinstall" these days? The set I posted for 4.7++ is different from this as I think that the two are diverging with the addition of ufs2 to -current. This is not complete but it did allow me to partition the array with one big partition which is what I wanted (for testing UFS2). Julian
Index: lib/libdisk/chunk.c =================================================================== RCS file: /usr/cvs/src/lib/libdisk/chunk.c,v retrieving revision 1.44 diff -u -r1.44 chunk.c --- lib/libdisk/chunk.c 13 Nov 2002 05:31:32 -0000 1.44 +++ lib/libdisk/chunk.c 15 Nov 2002 18:56:50 -0000 @@ -44,7 +44,7 @@ } static struct chunk * -Find_Mother_Chunk(struct chunk *chunks, u_long offset, u_long end, chunk_e type) +Find_Mother_Chunk(struct chunk *chunks, blk_cnt offset, blk_cnt end, chunk_e type) { struct chunk *c1,*c2,ct; @@ -121,7 +121,7 @@ } int -Insert_Chunk(struct chunk *c2, u_long offset, u_long size, const char *name, +Insert_Chunk(struct chunk *c2, blk_cnt offset, blk_cnt size, const char *name, chunk_e type, int subtype, u_long flags, const char *sname) { struct chunk *ct,*cs; @@ -204,11 +204,11 @@ } int -Add_Chunk(struct disk *d, long offset, u_long size, const char *name, +Add_Chunk(struct disk *d, blk_cnt offset, blk_cnt size, const char *name, chunk_e type, int subtype, u_long flags, const char *sname) { struct chunk *c1,*c2,ct; - u_long end = offset + size - 1; + blk_cnt end = offset + size - 1; ct.offset = offset; ct.end = end; ct.size = size; @@ -381,7 +381,7 @@ for(; i < offset; i++) putchar('-'); putchar('>'); for(; i < 10; i++) putchar(' '); - printf("%p %8ld %8lu %8lu %-8s %-16s %-8s 0x%02x %s", + printf("%p %12llu %12llu %12llu %-8s %-16s %-8s 0x%02x %s", c1, c1->offset, c1->size, c1->end, c1->name, c1->sname, chunk_name(c1->type), c1->subtype, ShowChunkFlags(c1)); @@ -407,7 +407,7 @@ { struct chunk *c1=0, *c2, *c3; chunk_e type = c->type; - u_long offset = c->offset; + blk_cnt offset = c->offset; if(type == whole) return 1; Index: lib/libdisk/create_chunk.c =================================================================== RCS file: /usr/cvs/src/lib/libdisk/create_chunk.c,v retrieving revision 1.76 diff -u -r1.76 create_chunk.c --- lib/libdisk/create_chunk.c 11 Nov 2002 04:46:39 -0000 1.76 +++ lib/libdisk/create_chunk.c 15 Nov 2002 19:24:48 -0000 @@ -171,10 +171,10 @@ } int -Create_Chunk(struct disk *d, u_long offset, u_long size, chunk_e type, int subtype, u_long flags, const char *sname) +Create_Chunk(struct disk *d, blk_cnt offset, blk_cnt size, chunk_e type, int subtype, +u_long flags, const char *sname) { int i; - u_long l; + blk_cnt l; if(!(flags & CHUNK_FORCE_ALL)) { #ifdef PC98 @@ -202,7 +202,8 @@ } struct chunk * -Create_Chunk_DWIM(struct disk *d, const struct chunk *parent , u_long size, chunk_e type, int subtype, u_long flags) +Create_Chunk_DWIM(struct disk *d, const struct chunk *parent , blk_cnt size, +chunk_e type, int subtype, u_long flags) { int i; struct chunk *c1; Index: lib/libdisk/disk.c =================================================================== RCS file: /usr/cvs/src/lib/libdisk/disk.c,v retrieving revision 1.108 diff -u -r1.108 disk.c --- lib/libdisk/disk.c 13 Nov 2002 05:31:32 -0000 1.108 +++ lib/libdisk/disk.c 15 Nov 2002 19:19:01 -0000 @@ -102,7 +102,7 @@ size_t txtsize; int error, i; char *p, *q, *r, *a, *b, *n, *t; - off_t o, len, off; + blk_cnt o, len, off; u_int l, s, ty, sc, hd, alt; off_t lo[10]; @@ -152,7 +152,7 @@ d->name = strdup(name); a = strsep(&p, " "); /* length in bytes */ - len = strtoimax(a, &r, 0); + len = strtoull(a, &r, 0); if (*r) { printf("BARF %d <%d>\n", __LINE__, *r); exit (0); } a = strsep(&p, " "); /* sectorsize */ @@ -162,7 +162,7 @@ d->sector_size = s; len /= s; /* media size in number of sectors. */ - if (Add_Chunk(d, 0, len, name, whole, 0, 0, "-")) + if (Add_Chunk(d, 0LL, len, name, whole, 0, 0, "-")) DPRINT(("Failed to add 'whole' chunk")); for (;;) { @@ -170,7 +170,7 @@ if (a == NULL) break; b = strsep(&p, " "); - o = strtoul(b, &r, 0); + o = strtoull(b, &r, 0); if (*r) { printf("BARF %d <%d>\n", __LINE__, *r); exit (0); } if (!strcmp(a, "hd")) d->bios_hd = o; @@ -202,7 +202,7 @@ t = strsep(&p, " "); /* Type {SUN, BSD, MBR, GPT} */ n = strsep(&p, " "); /* name */ a = strsep(&p, " "); /* len */ - len = strtoimax(a, &r, 0); + len = strtoull(a, &r, 0); if (*r) { printf("BARF %d <%d>\n", __LINE__, *r); exit (0); } a = strsep(&p, " "); /* secsize */ s = strtoimax(a, &r, 0); @@ -212,7 +212,7 @@ if (a == NULL) break; b = strsep(&p, " "); - o = strtoimax(b, &r, 0); + o = strtoull(b, &r, 0); if (*r) { uint32_t status; Index: lib/libdisk/libdisk.h =================================================================== RCS file: /usr/cvs/src/lib/libdisk/libdisk.h,v retrieving revision 1.51 diff -u -r1.51 libdisk.h --- lib/libdisk/libdisk.h 11 Nov 2002 18:55:57 -0000 1.51 +++ lib/libdisk/libdisk.h 15 Nov 2002 19:22:34 -0000 @@ -10,6 +10,7 @@ * */ +typedef u_int64_t blk_cnt; #define DEBUG 1 /* You can define a particular architecture here if you are debugging. */ /* #define P_DEBUG p_sparc64 */ @@ -100,9 +101,9 @@ struct chunk *next; struct chunk *part; struct disk *disk; - long offset; - u_long size; - u_long end; + blk_cnt offset; + blk_cnt size; + blk_cnt end; char *sname; /* PC98 field */ char *name; char *oname; @@ -180,7 +181,7 @@ */ int -Insert_Chunk(struct chunk *, u_long, u_long, const char *, chunk_e, int, +Insert_Chunk(struct chunk *, blk_cnt, blk_cnt, const char *, chunk_e, int, u_long, const char *); int @@ -204,7 +205,7 @@ */ int -Create_Chunk(struct disk *, u_long, u_long, chunk_e, int, u_long, const char *); +Create_Chunk(struct disk *, blk_cnt, blk_cnt, chunk_e, int, u_long, const char *); /* Create a chunk with the specified paramters */ @@ -249,36 +250,36 @@ /* Write all the MBRs, disklabels, bootblocks and boot managers */ -u_long -Next_Cyl_Aligned(const struct disk *, u_long); +blk_cnt +Next_Cyl_Aligned(const struct disk *, blk_cnt); /* Round offset up to next cylinder according to the bios-geometry */ -u_long -Prev_Cyl_Aligned(const struct disk *, u_long); +blk_cnt +Prev_Cyl_Aligned(const struct disk *, blk_cnt); /* Round offset down to previous cylinder according to the bios- * geometry */ int -Track_Aligned(const struct disk *, u_long); +Track_Aligned(const struct disk *, blk_cnt); /* Check if offset is aligned on a track according to the * bios geometry */ -u_long -Next_Track_Aligned(const struct disk *, u_long); +blk_cnt +Next_Track_Aligned(const struct disk *, blk_cnt); /* Round offset up to next track according to the bios-geometry */ -u_long -Prev_Track_Aligned(const struct disk *, u_long); +blk_cnt +Prev_Track_Aligned(const struct disk *, blk_cnt); /* Check if offset is aligned on a track according to the * bios geometry */ struct chunk * -Create_Chunk_DWIM(struct disk *, const struct chunk *, u_long, chunk_e, int, +Create_Chunk_DWIM(struct disk *, const struct chunk *, blk_cnt, chunk_e, int, u_long); /* This one creates a partition inside the given parent of the given * size, and returns a pointer to it. The first unused chunk big @@ -299,7 +300,7 @@ void Debug_Chunk(struct chunk *); void Free_Chunk(struct chunk *); struct chunk *Clone_Chunk(const struct chunk *); -int Add_Chunk(struct disk *, long, u_long, const char *, chunk_e, int, u_long, +int Add_Chunk(struct disk *, blk_cnt, blk_cnt, const char *, chunk_e, int, u_long, const char *); void *read_block(int, daddr_t, u_long); int write_block(int, daddr_t, const void *, u_long); Index: lib/libdisk/rules.c =================================================================== RCS file: /usr/cvs/src/lib/libdisk/rules.c,v retrieving revision 1.27 diff -u -r1.27 rules.c --- lib/libdisk/rules.c 31 Oct 2002 05:51:25 -0000 1.27 +++ lib/libdisk/rules.c 15 Nov 2002 19:26:51 -0000 @@ -25,7 +25,7 @@ #include "libdisk.h" int -Track_Aligned(const struct disk *d, u_long offset) +Track_Aligned(const struct disk *d, blk_cnt offset) { if (!d->bios_sect) return 1; @@ -34,16 +34,16 @@ return 1; } -u_long -Prev_Track_Aligned(const struct disk *d, u_long offset) +blk_cnt +Prev_Track_Aligned(const struct disk *d, blk_cnt offset) { if (!d->bios_sect) return offset; return (offset / d->bios_sect) * d->bios_sect; } -u_long -Next_Track_Aligned(const struct disk *d, u_long offset) +blk_cnt +Next_Track_Aligned(const struct disk *d, blk_cnt offset) { if (!d->bios_sect) return offset; @@ -51,7 +51,7 @@ } static int -Cyl_Aligned(const struct disk *d, u_long offset) +Cyl_Aligned(const struct disk *d, blk_cnt offset) { if (!d->bios_sect || !d->bios_hd) return 1; @@ -60,16 +60,16 @@ return 1; } -u_long -Prev_Cyl_Aligned(const struct disk *d, u_long offset) +blk_cnt +Prev_Cyl_Aligned(const struct disk *d, blk_cnt offset) { if (!d->bios_sect || !d->bios_hd) return offset; return (offset / (d->bios_sect*d->bios_hd)) * d->bios_sect * d->bios_hd; } -u_long -Next_Cyl_Aligned(const struct disk *d, u_long offset) +blk_cnt +Next_Cyl_Aligned(const struct disk *d, blk_cnt offset) { if (!d->bios_sect || !d->bios_hd) return offset; @@ -134,9 +134,9 @@ #endif sprintf(msg + strlen(msg), #ifdef PC98 - "chunk '%s' [%ld..%ld] does not start on a cylinder boundary\n", + "chunk '%s' [%llu..%llu] does not start on a cylinder boundary\n", #else - "chunk '%s' [%ld..%ld] does not start on a track boundary\n", + "chunk '%s' [%llu..%llu] does not start on a track boundary\n", #endif c1->name, c1->offset, c1->end); if ((c->type == whole || c->end == c1->end) @@ -144,7 +144,7 @@ ; else sprintf(msg + strlen(msg), - "chunk '%s' [%ld..%ld] does not end on a cylinder boundary\n", + "chunk '%s' [%llu..%llu] does not end on a cylinder boundary\n", c1->name, c1->offset, c1->end); } } Index: lib/libdisk/write_i386_disk.c =================================================================== RCS file: /usr/cvs/src/lib/libdisk/write_i386_disk.c,v retrieving revision 1.4 diff -u -r1.4 write_i386_disk.c --- lib/libdisk/write_i386_disk.c 8 Nov 2002 14:00:44 -0000 1.4 +++ lib/libdisk/write_i386_disk.c 15 Nov 2002 19:36:18 -0000 @@ -82,8 +82,9 @@ int Write_Disk(const struct disk *d1) { - int fd,i; - int j; + int fd; + blk_cnt blks; + int i, j; struct disk *old = 0; struct chunk *c1; int ret = 0; @@ -120,43 +121,43 @@ Write_Int32(&dp[j].dp_start, c1->offset); Write_Int32(&dp[j].dp_size, c1->size); - i = c1->offset; - if (i >= 1024*d1->bios_sect*d1->bios_hd) { + blks = c1->offset; + if (blks >= 1024*d1->bios_sect*d1->bios_hd) { dp[j].dp_ssect = 0xff; dp[j].dp_shd = 0xff; dp[j].dp_scyl = 0xff; need_edd++; } else { - dp[j].dp_ssect = i % d1->bios_sect; - i -= dp[j].dp_ssect++; - i /= d1->bios_sect; - dp[j].dp_shd = i % d1->bios_hd; - i -= dp[j].dp_shd; - i /= d1->bios_hd; - dp[j].dp_scyl = i; - i -= dp[j].dp_scyl; - dp[j].dp_ssect |= i >> 2; + dp[j].dp_ssect = blks % d1->bios_sect; + blks -= dp[j].dp_ssect++; + blks /= d1->bios_sect; + dp[j].dp_shd = blks % d1->bios_hd; + blks -= dp[j].dp_shd; + blks /= d1->bios_hd; + dp[j].dp_scyl = blks; + blks -= dp[j].dp_scyl; + dp[j].dp_ssect |= blks >> 2; } #ifdef DEBUG - printf("S:%lu = (%x/%x/%x)", + printf("S:%llu = (%x/%x/%x)", c1->offset, dp[j].dp_scyl, dp[j].dp_shd, dp[j].dp_ssect); #endif - i = c1->end; - dp[j].dp_esect = i % d1->bios_sect; - i -= dp[j].dp_esect++; - i /= d1->bios_sect; - dp[j].dp_ehd = i % d1->bios_hd; - i -= dp[j].dp_ehd; - i /= d1->bios_hd; - if (i>1023) i = 1023; - dp[j].dp_ecyl = i; - i -= dp[j].dp_ecyl; - dp[j].dp_esect |= i >> 2; + blks = c1->end; + dp[j].dp_esect = blks % d1->bios_sect; + blks -= dp[j].dp_esect++; + blks /= d1->bios_sect; + dp[j].dp_ehd = blks % d1->bios_hd; + blks -= dp[j].dp_ehd; + blks /= d1->bios_hd; + if (blks>1023) blks = 1023; + dp[j].dp_ecyl = blks; + blks -= dp[j].dp_ecyl; + dp[j].dp_esect |= blks >> 2; #ifdef DEBUG - printf(" E:%lu = (%x/%x/%x)\n", + printf(" E:%llu = (%x/%x/%x)\n", c1->end, dp[j].dp_ecyl, dp[j].dp_ehd, dp[j].dp_esect); #endif Index: usr.sbin/sysinstall/disks.c =================================================================== RCS file: /usr/cvs/src/usr.sbin/sysinstall/disks.c,v retrieving revision 1.139 diff -u -r1.139 disks.c --- usr.sbin/sysinstall/disks.c 13 Nov 2002 05:39:58 -0000 1.139 +++ usr.sbin/sysinstall/disks.c 15 Nov 2002 19:48:52 -0000 @@ -66,7 +66,7 @@ { struct chunk *c1 = NULL; int i = 0; - int last_free = 0; + blk_cnt last_free = 0; if (!d->chunks) msgFatal("No chunk list found for %s!", d->name); @@ -83,19 +83,19 @@ current_chunk = i - 1; } -static int Total; +static blk_cnt Total; static void print_chunks(Disk *d, int u) { int row; int i; - int sz; + blk_cnt sz; char *szstr; szstr = (u == UNIT_MEG ? "MB" : (u == UNIT_KILO ? "KB" : "ST")); - for (i = Total = 0; chunk_info[i]; i++) + for (i = 0, Total = 0LL; chunk_info[i]; i++) Total += chunk_info[i]->size; #ifdef PC98 if (d->bios_cyl >= 65536 || d->bios_hd > 16 || d->bios_sect >= 256) { @@ -121,10 +121,10 @@ attrset(A_REVERSE); addstr(d->name); attrset(A_NORMAL); attrset(A_REVERSE); mvaddstr(0, 55, "FDISK Partition Editor"); attrset(A_NORMAL); mvprintw(1, 0, - "DISK Geometry:\t%lu cyls/%lu heads/%lu sectors = %lu sectors (%luMB)", + "DISK Geometry:\t%lu cyls/%lu heads/%lu sectors = %llu sectors (%luMB)", d->bios_cyl, d->bios_hd, d->bios_sect, - d->bios_cyl * d->bios_hd * d->bios_sect, - d->bios_cyl * d->bios_hd * d->bios_sect / (1024/512) / 1024); + (blk_cnt)d->bios_cyl * d->bios_hd * d->bios_sect, + (blk_cnt)d->bios_cyl * d->bios_hd * d->bios_sect / (1024/512) / 1024); mvprintw(3, 0, "%6s %10s(%s) %10s %8s %6s %10s %8s %8s", "Offset", "Size", szstr, "End", "Name", "PType", "Desc", "Subtype", "Flags"); @@ -143,7 +143,7 @@ } if (i == current_chunk) attrset(ATTR_SELECTED); - mvprintw(row, 0, "%10ld %10lu %10lu %8s %6d %10s %8d\t%-6s", + mvprintw(row, 0, "%10llu %10llu %10llu %8s %6d %10s %8d\t%-6s", chunk_info[i]->offset, sz, chunk_info[i]->end, chunk_info[i]->name, chunk_info[i]->type, @@ -400,7 +400,7 @@ msg = "Slice in use, delete it first or move to an unused one."; else { char *val, tmp[20], *cp; - int size; + blk_cnt size; #ifdef PC98 char name[16]; @@ -416,7 +416,7 @@ snprintf(tmp, 20, "%lu", chunk_info[current_chunk]->size); val = msgGetInput(tmp, "Please specify the size for new FreeBSD slice in blocks\n" "or append a trailing `M' for megabytes (e.g. 20M)."); - if (val && (size = strtol(val, &cp, 0)) > 0) { + if (val && (size = strtoull(val, &cp, 0)) > 0) { if (*cp && toupper(*cp) == 'M') size *= ONE_MEG; else if (*cp && toupper(*cp) == 'G') @@ -883,7 +883,8 @@ diskPartitionNonInteractive(Device *dev) { char *cp; - int i, sz, all_disk = 0; + int i, all_disk = 0; + blk_cnt sz; #ifdef PC98 u_char *bootipl; size_t bootipl_size; @@ -936,7 +937,7 @@ All_FreeBSD(d, all_disk = TRUE); } - else if ((sz = strtol(cp, &cp, 0))) { + else if ((sz = strtoull(cp, &cp, 0))) { /* Look for sz bytes free */ if (*cp && toupper(*cp) == 'M') sz *= ONE_MEG; Index: usr.sbin/sysinstall/label.c =================================================================== RCS file: /usr/cvs/src/usr.sbin/sysinstall/label.c,v retrieving revision 1.130 diff -u -r1.130 label.c --- usr.sbin/sysinstall/label.c 14 Nov 2002 01:46:20 -0000 1.130 +++ usr.sbin/sysinstall/label.c 15 Nov 2002 20:42:41 -0000 @@ -244,11 +244,11 @@ } /* How much space is in this FreeBSD slice? */ -static int +static blk_cnt space_free(struct chunk *c) { struct chunk *c1; - int sz = c->size; + blk_cnt sz = c->size; for (c1 = c->part; c1; c1 = c1->next) { if (c1->type != unused) @@ -474,7 +474,7 @@ print_label_chunks(void) { int i, j, srow, prow, pcol; - int sz; + blk_cnt sz; char clrmsg[80]; int ChunkPartStartRow; WINDOW *ChunkWin; @@ -570,7 +570,7 @@ pslice_focus_found = -1; mvprintw(srow++, 0, - "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", + "Disk: %s\tPartition name: %s\tFree: %llu blocks (%lluMB)", label_chunk_info[i].c->disk->name, label_chunk_info[i].c->name, sz, (sz / ONE_MEG)); attrset(A_NORMAL); @@ -713,7 +713,8 @@ static int diskLabel(Device *dev) { - int sz, key = 0; + blk_cnt sz; + int key = 0; Boolean labeling; char *msg = NULL; PartInfo *p, *oldp; @@ -840,18 +841,18 @@ } else { char *val; - int size; + blk_cnt size; struct chunk *tmp; char osize[80]; u_long flags = 0; - sprintf(osize, "%d", sz); + sprintf(osize, "%llu", sz); val = msgGetInput(osize, "Please specify the partition size in blocks or append a trailing G for\n" "gigabytes, M for megabytes, or C for cylinders.\n" - "%d blocks (%dMB) are free.", + "%llu blocks (%lluMB) are free.", sz, sz / ONE_MEG); - if (!val || (size = strtol(val, &cp, 0)) <= 0) { + if (!val || (size = strtoull(val, &cp, 0)) <= 0) { clear_wins(); break; } @@ -1160,14 +1161,14 @@ return DITEM_SUCCESS; } -static __inline int -requested_part_size(char *varName, int nom, int def, int perc) +static __inline blk_cnt +requested_part_size(char *varName, blk_cnt nom, int def, int perc) { char *cp; - int sz; + blk_cnt sz; if ((cp = variable_get(varName)) != NULL) - sz = atoi(cp); + sz = strtoull(cp, NULL, 0); else sz = nom + (def - nom) * perc / 100; return(sz * ONE_MEG); @@ -1188,7 +1189,7 @@ static char * try_auto_label(Device **devs, Device *dev, int perc, int *req) { - int sz; + blk_cnt sz; struct chunk *root_chunk = NULL; struct chunk *swap_chunk = NULL; struct chunk *usr_chunk = NULL; @@ -1227,8 +1228,8 @@ if (!swapdev) { sz = requested_part_size(VAR_SWAP_SIZE, 0, 0, perc); if (sz == 0) { - int nom; - int def; + blk_cnt nom; + blk_cnt def; mib[0] = CTL_HW; mib[1] = HW_PHYSMEM; @@ -1402,11 +1403,12 @@ int entries; for (entries = 1;; entries++) { - int sz, soft = 0; + blk_cnt sz; + int soft = 0; snprintf(name, sizeof name, "%s-%d", c1->name, entries); if ((cp = variable_get(name)) == NULL) break; - if (sscanf(cp, "%s %d %s %d", typ, &sz, mpoint, &soft) < 3) { + if (sscanf(cp, "%s %llu %s %d", typ, &sz, mpoint, &soft) < 3) { msgConfirm("For slice entry %s, got an invalid detail entry of: %s", c1->name, cp); status = DITEM_FAILURE; break;