Deleted Added
full compact
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 $
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
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;
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 }
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{
230 int i, 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);
249 mvaddstr(CHUNK_PART_START_ROW - 1, PART_SIZE_COL + (i * PART_OFF),
250 "Size");
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)
263 attrset(ColorDisplay ? A_BOLD : A_UNDERLINE);
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 }
296 for (i = 0; i < MAX_MOUNT_NAME && mountpoint[i]; i++)
297 mvaddch(prow, pcol + PART_MOUNT_COL + i, mountpoint[i]);
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{
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
320 attrset(attrs);
321 addstr(ColorDisplay ? "bold" : "underline");
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 ---