diff options
author | jkh <jkh@FreeBSD.org> | 2001-03-10 19:51:04 +0000 |
---|---|---|
committer | jkh <jkh@FreeBSD.org> | 2001-03-10 19:51:04 +0000 |
commit | e6899b0da5c341a82e215bbd7ecf9f26e9652ce6 (patch) | |
tree | 99c901c730c245e9fd32216046a273fbc1e4c921 /usr.sbin/sade | |
parent | 369d42d4288db8d18fe136e29f89b472db5a0cf5 (diff) | |
download | FreeBSD-src-e6899b0da5c341a82e215bbd7ecf9f26e9652ce6.zip FreeBSD-src-e6899b0da5c341a82e215bbd7ecf9f26e9652ce6.tar.gz |
Support setting soft updates from the label editor.
Diffstat (limited to 'usr.sbin/sade')
-rw-r--r-- | usr.sbin/sade/install.c | 7 | ||||
-rw-r--r-- | usr.sbin/sade/label.c | 39 | ||||
-rw-r--r-- | usr.sbin/sade/sade.h | 1 |
3 files changed, 35 insertions, 12 deletions
diff --git a/usr.sbin/sade/install.c b/usr.sbin/sade/install.c index 8a116dc..638530a 100644 --- a/usr.sbin/sade/install.c +++ b/usr.sbin/sade/install.c @@ -930,6 +930,11 @@ installFilesystems(dialogMenuItem *self) msgConfirm("Warning: fsck returned status of %d for %s.\n" "This partition may be unsafe to use.", i, dname); } + if (root->soft) { + i = vsystem("tunefs -n enable %s", dname); + if (i) + msgConfirm("Warning: Unable to enable softupdates for root filesystem on %s", dname); + } /* Switch to block device */ sprintf(dname, "/dev/%s", rootdev->name); @@ -972,6 +977,8 @@ installFilesystems(dialogMenuItem *self) command_shell_add(tmp->mountpoint, "%s %s/dev/%s", tmp->newfs_cmd, RunningAsInit ? "/mnt" : "", c2->name); else command_shell_add(tmp->mountpoint, "fsck -y %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name); + if (tmp->soft) + command_shell_add(tmp->mountpoint, "tunefs -n enable %s/dev/%s", RunningAsInit ? "/mnt" : "", c2->name); command_func_add(tmp->mountpoint, Mount, c2->name); } else if (c2->type == part && c2->subtype == FS_SWAP) { diff --git a/usr.sbin/sade/label.c b/usr.sbin/sade/label.c index 6f8625c..64ec624 100644 --- a/usr.sbin/sade/label.c +++ b/usr.sbin/sade/label.c @@ -311,6 +311,7 @@ new_part(char *mpoint, Boolean newfs, u_long size) strcpy(ret->newfs_cmd, "newfs "); strcat(ret->newfs_cmd, variable_get(VAR_NEWFS_ARGS)); ret->newfs = newfs; + ret->soft = 0; if (!size) return ret; return ret; @@ -537,7 +538,7 @@ print_label_chunks(void) } /* Otherwise it's a DOS, swap or filesystem entry in the Chunk window */ else { - char onestr[PART_OFF], num[10], *mountpoint, *newfs; + char onestr[PART_OFF], num[10], *mountpoint, newfs[10]; /* * We copy this into a blank-padded string so that it looks like @@ -576,13 +577,17 @@ print_label_chunks(void) /* Now display the newfs field */ if (label_chunk_info[i].type == PART_FAT) - newfs = "DOS"; - else if (label_chunk_info[i].c->private_data && label_chunk_info[i].type == PART_FILESYSTEM) - newfs = ((PartInfo *)label_chunk_info[i].c->private_data)->newfs ? "UFS Y" : "UFS N"; + strcpy(newfs, "DOS"); + else if (label_chunk_info[i].c->private_data && label_chunk_info[i].type == PART_FILESYSTEM) { + strcpy(newfs, "UFS"); + if (((PartInfo *)label_chunk_info[i].c->private_data)->soft) + strcat(newfs, "+S"); + strcat(newfs, ((PartInfo *)label_chunk_info[i].c->private_data)->newfs ? " Y" : " N"); + } else if (label_chunk_info[i].type == PART_SWAP) - newfs = "SWAP"; + strcpy(newfs, "SWAP"); else - newfs = "*"; + strcpy(newfs, "*"); for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++) onestr[PART_MOUNT_COL + j] = mountpoint[j]; snprintf(num, 10, "%5ldMB", label_chunk_info[i].c->size ? label_chunk_info[i].c->size / ONE_MEG : 0); @@ -596,8 +601,8 @@ print_label_chunks(void) if (i == here) wattrset(ChunkWin, ATTR_SELECTED); - /*** lazy man's way of padding this string ***/ - while (strlen( onestr ) < 37) + /*** lazy man's way of expensively padding this string ***/ + while (strlen(onestr) < 37) strcat(onestr, " "); mvwaddstr(ChunkWin, prow, pcol, onestr); @@ -633,11 +638,11 @@ static void print_command_summary(void) { mvprintw(17, 0, "The following commands are valid here (upper or lower case):"); - mvprintw(18, 0, "C = Create D = Delete M = Mount pt."); + mvprintw(18, 0, "C = Create D = Delete M = Mount pt."); if (!RunningAsInit) - mvprintw(18, 49, "W = Write"); - mvprintw(19, 0, "N = Newfs Opts T = Newfs Toggle U = Undo Q = Finish"); - mvprintw(20, 0, "A = Auto Defaults for all!"); + mvprintw(18, 47, "W = Write"); + mvprintw(19, 0, "N = Newfs Opts Q = Finish S = Toggle SoftUpdates"); + mvprintw(20, 0, "T = Toggle Newfs U = Undo A = Auto Defaults"); mvprintw(22, 0, "Use F1 or ? to get more help, arrow keys to select."); move(0, 0); } @@ -1058,6 +1063,16 @@ diskLabel(Device *dev) clear_wins(); break; + case 'S': /* Toggle soft updates flag */ + if (label_chunk_info[here].type == PART_FILESYSTEM) { + PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data); + if (pi) + pi->soft = !pi->soft; + else + msg = MSG_NOT_APPLICABLE; + } + break; + case 'T': /* Toggle newfs state */ if (label_chunk_info[here].type == PART_FILESYSTEM) { PartInfo *pi = ((PartInfo *)label_chunk_info[here].c->private_data); diff --git a/usr.sbin/sade/sade.h b/usr.sbin/sade/sade.h index a489b85..63f32b7 100644 --- a/usr.sbin/sade/sade.h +++ b/usr.sbin/sade/sade.h @@ -283,6 +283,7 @@ typedef struct _part_info { Boolean newfs; char mountpoint[FILENAME_MAX]; char newfs_cmd[NEWFS_CMD_MAX]; + int soft; } PartInfo; /* An option */ |