disks.c (8313) | disks.c (8314) |
---|---|
1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 * | 1/* 2 * The new sysinstall program. 3 * 4 * This is probably the last program in the `sysinstall' line - the next 5 * generation being essentially a complete rewrite. 6 * |
7 * $Id: disks.c,v 1.3 1995/05/06 09:34:11 jkh Exp $ | 7 * $Id: disks.c,v 1.4 1995/05/07 02:04:25 jkh Exp $ |
8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 114 unchanged lines hidden (view full) --- 130 int i, j, p; 131 132 j = p = 0; 133 for (i = 0; disks[i]; i++) { 134 struct chunk *c1; 135 136 if (!disks[i]->chunks) 137 msgFatal("No chunk list found for %s!", disks[i]->name); | 8 * 9 * Copyright (c) 1995 10 * Jordan Hubbard. All rights reserved. 11 * 12 * Redistribution and use in source and binary forms, with or without 13 * modification, are permitted provided that the following conditions 14 * are met: 15 * 1. Redistributions of source code must retain the above copyright --- 114 unchanged lines hidden (view full) --- 130 int i, j, p; 131 132 j = p = 0; 133 for (i = 0; disks[i]; i++) { 134 struct chunk *c1; 135 136 if (!disks[i]->chunks) 137 msgFatal("No chunk list found for %s!", disks[i]->name); |
138 c1 = disks[i]->chunks->part; 139 while (c1) { 140 if (c1->type == freebsd) { 141 struct chunk *c2 = c1->part; | |
142 | 138 |
139 /* Put the freebsd chunks first */ 140 for (c1 = disks[i]->chunks->part; c1; c1 = c1->next) { 141 if (c1->type == freebsd) { |
|
143 fbsd_chunk_info[j].type = PART_SLICE; 144 fbsd_chunk_info[j].d = disks[i]; 145 fbsd_chunk_info[j].c = c1; 146 fbsd_chunk_info[j++].p = NULL; | 142 fbsd_chunk_info[j].type = PART_SLICE; 143 fbsd_chunk_info[j].d = disks[i]; 144 fbsd_chunk_info[j].c = c1; 145 fbsd_chunk_info[j++].p = NULL; |
146 } 147 } 148 149 /* Then buzz through and pick up the partitions */ 150 for (c1 = disks[i]->chunks->part; c1; c1 = c1->next) { 151 if (c1->type == freebsd) { 152 struct chunk *c2 = c1->part; 153 |
|
147 while (c2) { 148 if (c2->type == part) { 149 if (c2->subtype == FS_SWAP) 150 fbsd_chunk_info[j].type = PART_SWAP; 151 else 152 fbsd_chunk_info[j].type = PART_FILESYSTEM; 153 fbsd_chunk_info[j].d = disks[i]; 154 fbsd_chunk_info[j].c = c2; 155 fbsd_chunk_info[j++].p = c2->private; 156 } 157 c2 = c2->next; 158 } 159 } | 154 while (c2) { 155 if (c2->type == part) { 156 if (c2->subtype == FS_SWAP) 157 fbsd_chunk_info[j].type = PART_SWAP; 158 else 159 fbsd_chunk_info[j].type = PART_FILESYSTEM; 160 fbsd_chunk_info[j].d = disks[i]; 161 fbsd_chunk_info[j].c = c2; 162 fbsd_chunk_info[j++].p = c2->private; 163 } 164 c2 = c2->next; 165 } 166 } |
160 c1 = c1->next; | |
161 } 162 } 163 fbsd_chunk_info[j].d = NULL; 164 fbsd_chunk_info[j].c = NULL; 165} 166 167int 168get_mountpoint(struct chunk *c) --- 53 unchanged lines hidden (view full) --- 222#define PART_MOUNT_COL 8 223#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 4) 224#define PART_NEWFS_COL (PART_SIZE_COL + 8) 225#define PART_OFF 40 226 227static void 228print_fbsd_chunks(void) 229{ | 167 } 168 } 169 fbsd_chunk_info[j].d = NULL; 170 fbsd_chunk_info[j].c = NULL; 171} 172 173int 174get_mountpoint(struct chunk *c) --- 53 unchanged lines hidden (view full) --- 228#define PART_MOUNT_COL 8 229#define PART_SIZE_COL (PART_MOUNT_COL + MAX_MOUNT_NAME + 4) 230#define PART_NEWFS_COL (PART_SIZE_COL + 8) 231#define PART_OFF 40 232 233static void 234print_fbsd_chunks(void) 235{ |
230 int i, srow, prow, pcol; | 236 int i, j, srow, prow, pcol; |
231 int sz; 232 233 attrset(A_REVERSE); 234 mvaddstr(0, 25, "FreeBSD Partition Editor"); 235 attrset(A_NORMAL); 236 237 for (i = 0; i < 2; i++) { 238 attrset(A_UNDERLINE); 239 mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF), 240 "Part"); 241 attrset(A_NORMAL); 242 243 attrset(A_UNDERLINE); 244 mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF), 245 "Mount"); 246 attrset(A_NORMAL); 247 248 attrset(A_UNDERLINE); | 237 int sz; 238 239 attrset(A_REVERSE); 240 mvaddstr(0, 25, "FreeBSD Partition Editor"); 241 attrset(A_NORMAL); 242 243 for (i = 0; i < 2; i++) { 244 attrset(A_UNDERLINE); 245 mvaddstr(CHUNK_PART_START_ROW - 1, PART_PART_COL + (i * PART_OFF), 246 "Part"); 247 attrset(A_NORMAL); 248 249 attrset(A_UNDERLINE); 250 mvaddstr(CHUNK_PART_START_ROW - 1, PART_MOUNT_COL + (i * PART_OFF), 251 "Mount"); 252 attrset(A_NORMAL); 253 254 attrset(A_UNDERLINE); |
249 mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF), | 255 mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF) + 2, |
250 "Size"); | 256 "Size"); |
257 attrset(A_NORMAL); |
|
251 252 attrset(A_UNDERLINE); 253 mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF), 254 "Newfs"); 255 attrset(A_NORMAL); 256 } 257 258 srow = CHUNK_SLICE_START_ROW; 259 prow = CHUNK_PART_START_ROW; 260 261 for (i = 0; fbsd_chunk_info[i].d; i++) { 262 if (i == current_chunk) | 258 259 attrset(A_UNDERLINE); 260 mvaddstr(CHUNK_PART_START_ROW - 1, PART_NEWFS_COL + (i * PART_OFF), 261 "Newfs"); 262 attrset(A_NORMAL); 263 } 264 265 srow = CHUNK_SLICE_START_ROW; 266 prow = CHUNK_PART_START_ROW; 267 268 for (i = 0; fbsd_chunk_info[i].d; i++) { 269 if (i == current_chunk) |
263 attrset(ColorDisplay ? A_BOLD : A_UNDERLINE); | 270 attrset(A_REVERSE); |
264 /* Is it a slice entry displayed at the top? */ 265 if (fbsd_chunk_info[i].type == PART_SLICE) { 266 sz = space_free(fbsd_chunk_info[i].c); 267 mvprintw(srow++, 0, 268 "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", 269 fbsd_chunk_info[i].d->name, 270 fbsd_chunk_info[i].c->name, sz, (sz / 2048)); 271 } --- 16 unchanged lines hidden (view full) --- 288 mountpoint = " "; 289 newfs = " "; 290 } 291 } 292 else { 293 mountpoint = "swap"; 294 newfs = " "; 295 } | 271 /* Is it a slice entry displayed at the top? */ 272 if (fbsd_chunk_info[i].type == PART_SLICE) { 273 sz = space_free(fbsd_chunk_info[i].c); 274 mvprintw(srow++, 0, 275 "Disk: %s\tPartition name: %s\tFree: %d blocks (%dMB)", 276 fbsd_chunk_info[i].d->name, 277 fbsd_chunk_info[i].c->name, sz, (sz / 2048)); 278 } --- 16 unchanged lines hidden (view full) --- 295 mountpoint = " "; 296 newfs = " "; 297 } 298 } 299 else { 300 mountpoint = "swap"; 301 newfs = " "; 302 } |
296 for (i = 0; i < MAX_MOUNT_NAME && mountpoint[i]; i++) 297 mvaddch(prow, pcol + PART_MOUNT_COL + i, mountpoint[i]); | 303 for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++) 304 mvaddch(prow, pcol + PART_MOUNT_COL + j, mountpoint[j]); |
298 mvprintw(prow, pcol + PART_SIZE_COL, "%4dMB", 299 fbsd_chunk_info[i].c->size ? 300 fbsd_chunk_info[i].c->size / 2048 : 0); 301 mvaddstr(prow, pcol + PART_NEWFS_COL, newfs); 302 ++prow; 303 } 304 if (i == current_chunk) 305 attrset(A_NORMAL); 306 } 307} 308 309static void 310print_command_summary() 311{ | 305 mvprintw(prow, pcol + PART_SIZE_COL, "%4dMB", 306 fbsd_chunk_info[i].c->size ? 307 fbsd_chunk_info[i].c->size / 2048 : 0); 308 mvaddstr(prow, pcol + PART_NEWFS_COL, newfs); 309 ++prow; 310 } 311 if (i == current_chunk) 312 attrset(A_NORMAL); 313 } 314} 315 316static void 317print_command_summary() 318{ |
312 int attrs = ColorDisplay ? A_BOLD : A_UNDERLINE; 313 | |
314 mvprintw(19, 0, 315 "The following commands are valid here (upper or lower case):"); 316 mvprintw(20, 0, "C = Create FreeBSD Partition D = Delete Partition"); 317 mvprintw(21, 0, "M = Mount Partition (no newfs) ESC = Proceed to summary screen"); 318 mvprintw(22, 0, "The default target will be displayed in "); 319 | 319 mvprintw(19, 0, 320 "The following commands are valid here (upper or lower case):"); 321 mvprintw(20, 0, "C = Create FreeBSD Partition D = Delete Partition"); 322 mvprintw(21, 0, "M = Mount Partition (no newfs) ESC = Proceed to summary screen"); 323 mvprintw(22, 0, "The default target will be displayed in "); 324 |
320 attrset(attrs); 321 addstr(ColorDisplay ? "bold" : "underline"); | 325 attrset(A_REVERSE); 326 addstr("reverse video"); |
322 attrset(A_NORMAL); 323 move(0, 0); 324} 325 326void 327partition_disks(struct disk **disks) 328{ 329 int sz, key = 0; --- 122 unchanged lines hidden --- | 327 attrset(A_NORMAL); 328 move(0, 0); 329} 330 331void 332partition_disks(struct disk **disks) 333{ 334 int sz, key = 0; --- 122 unchanged lines hidden --- |