--- cci/usr/src/etc/config/mkswapconf.c 2019/07/28 12:24:19 1.1.1.1 +++ cci/usr/src/etc/config/mkswapconf.c 2019/07/28 12:24:40 1.1.1.2 @@ -9,6 +9,7 @@ static char sccsid[] = "@(#)mkswapconf.c #include #include +#include swapconf() { @@ -33,6 +34,7 @@ do_swap(fl) char swapname[80], *cp; register struct file_list *swap; dev_t dev; + int i; if (eq(fl->f_fn, "generic")) { fl = fl->f_next; @@ -66,13 +68,29 @@ do_swap(fl) major(fl->f_dumpdev), minor(fl->f_dumpdev)); fprintf(fp, "\n"); fprintf(fp, "struct\tswdevt swdevt[] = {\n"); + + /* + * The commented code is for the previously more general case. + * Now, we configure for swap on 0b and leave room for more + * swap partitions. If a configuration file is ever given + * directly to the user, we should revert back to the previous + * code. + * do { dev = swap->f_swapdev; - fprintf(fp, "\t{ makedev(%d, %d),\t0,\t%d },\t/* %s */\n", + fprintf(fp, "\t{ makedev(%d, %d),\t0,\t%d },\t/* %s *//*\n", major(dev), minor(dev), swap->f_swapsize, swap->f_fn); swap = swap->f_next; } while (swap && swap->f_type == SWAPSPEC); - fprintf(fp, "\t{ 0, 0, 0 }\n"); + */ + dev = swap->f_swapdev; + fprintf(fp, "\t{ makedev(%d, %d),\t0,\t%d,\t0 },\t/* %s */\n", + major(dev), minor(dev), swap->f_swapsize, swap->f_fn); + for (i = 1; i < NSWAPDRIVES; i++) { + fprintf(fp, "\t{ -1,\t\t\t0,\t0,\t0 },\t"); + fprintf(fp, "/* available for swap */\n"); + } + fprintf(fp, "\t{ 0,\t\t\t0,\t0,\t0 }\t/* end of table */\n"); fprintf(fp, "};\n"); fclose(fp); return (swap);