Hi folks,

I'm currently creating a Vinum(4) configuration wizard for sysinstall(8), which
would simplify Vinum configuration procedure for the vinum newbies. So far I
finished a patch that allows create vinum partitions using sysinstall's
disklabel editor and would like to commit it. Please review attached patches.

Thanks!

-Maxim
Index: label.c
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sysinstall/label.c,v
retrieving revision 1.102
diff -d -u -r1.102 label.c
--- label.c     2001/02/07 11:26:41     1.102
+++ label.c     2001/03/02 14:12:59
@@ -277,6 +277,8 @@
                    if (c2->type == part) {
                        if (c2->subtype == FS_SWAP)
                            label_chunk_info[j].type = PART_SWAP;
+                       else if (c2->subtype == FS_VINUM)
+                           label_chunk_info[j].type = PART_VINUM;
                        else
                            label_chunk_info[j].type = PART_FILESYSTEM;
                        label_chunk_info[j].c = c2;
@@ -383,19 +385,24 @@
        "A file system",
        "Swap",
        "A swap partition.",
+       "Vinum",
+       "A vinum subdisk."
     };
     WINDOW *w = savescr();
 
     i = dialog_menu("Please choose a partition type",
                    "If you want to use this partition for swap space, select Swap.\n"
-                   "If you want to put a filesystem on it, choose FS.",
-                   -1, -1, 2, 2, fs_types, selection, NULL, NULL);
+                   "If you want to put a filesystem on it, choose FS.\n"
+                   "If you want to use it as a subdisk in a Vinum plex, choose 
+Vinum.",
+                   -1, -1, 3, 3, fs_types, selection, NULL, NULL);
     restorescr(w);
     if (!i) {
        if (!strcmp(selection, "FS"))
            return PART_FILESYSTEM;
        else if (!strcmp(selection, "Swap"))
            return PART_SWAP;
+       else if (!strcmp(selection, "Vinum"))
+           return PART_VINUM;
     }
     return PART_NONE;
 }
@@ -571,6 +578,8 @@
                mountpoint = ((PartInfo 
*)label_chunk_info[i].c->private_data)->mountpoint;
            else if (label_chunk_info[i].type == PART_SWAP)
                mountpoint = "swap";
+           else if (label_chunk_info[i].type == PART_VINUM)
+               mountpoint = "vinum";
            else
                mountpoint = "<none>";
 
@@ -581,6 +590,8 @@
                newfs = ((PartInfo *)label_chunk_info[i].c->private_data)->newfs ? 
"UFS Y" : "UFS N";
            else if (label_chunk_info[i].type == PART_SWAP)
                newfs = "SWAP";
+           else if (label_chunk_info[i].type == PART_VINUM)
+               newfs = "VINUM";
            else
                newfs = "*";
            for (j = 0; j < MAX_MOUNT_NAME && mountpoint[j]; j++)
@@ -895,6 +906,7 @@
            else {
                char *val;
                int size;
+               int subtype;
                struct chunk *tmp;
                char osize[80];
                u_long flags = 0;
@@ -959,17 +971,26 @@
                                   "partitions should usually be at least %dMB in 
size", ROOT_MIN_SIZE);
                    }
                }
+               switch (type) {
+               case PART_SWAP:
+                   subtype = FS_SWAP;
+                   break;
+               case PART_VINUM:
+                   subtype = FS_VINUM;
+                   break;
+               default:
+                   subtype = FS_BSDFFS;
+                   break;
+               }
                tmp = Create_Chunk_DWIM(label_chunk_info[here].c->disk,
                                        label_chunk_info[here].c,
-                                       size, part,
-                                       (type == PART_SWAP) ? FS_SWAP : FS_BSDFFS,
-                                       flags);
+                                       size, part, subtype, flags);
                if (!tmp) {
                    msgConfirm("Unable to create the partition. Too big?");
                    clear_wins();
                    break;
                }
-               if (type != PART_SWAP) {
+               if (type != PART_SWAP && type != PART_VINUM) {
                    /* This is needed to tell the newfs -u about the size */
                    tmp->private_data = new_part(p->mountpoint, p->newfs, tmp->size);
                    safe_free(p);
@@ -1021,6 +1042,10 @@
 
            case PART_SWAP:
                msg = "You don't need to specify a mountpoint for a swap partition.";
+               break;
+
+           case PART_VINUM:
+               msg = "You don't need to specify a mountpoint for a vinum subdisk.";
                break;
 
            case PART_FAT:
Index: sysinstall.h
===================================================================
RCS file: /home/ncvs/src/usr.sbin/sysinstall/sysinstall.h,v
retrieving revision 1.202
diff -d -u -r1.202 sysinstall.h
--- sysinstall.h        2001/03/02 08:15:40     1.202
+++ sysinstall.h        2001/03/02 14:13:01
@@ -245,7 +245,7 @@
     DEVICE_TYPE_UFS,
     DEVICE_TYPE_NFS,
     DEVICE_TYPE_ANY,
-    DEVICE_TYPE_HTTP,
+    DEVICE_TYPE_HTTP
 } DeviceType;
 
 /* CDROM mount codes */
@@ -274,6 +274,7 @@
     PART_SWAP,
     PART_FILESYSTEM,
     PART_FAT,
+    PART_VINUM
 } PartType;
 
 /* The longest newfs command we'll hand to system() */

Reply via email to