aboutsummaryrefslogtreecommitdiff
path: root/usr.sbin/config/config.y
diff options
context:
space:
mode:
authorBruce Evans <bde@FreeBSD.org>1995-02-16 12:17:30 +0000
committerBruce Evans <bde@FreeBSD.org>1995-02-16 12:17:30 +0000
commitda12c6d2aa1d7b438f9e051a1fe81ead1c64a19e (patch)
tree405135aed47947fe7c2c6940f53165a2cdbec4e9 /usr.sbin/config/config.y
parent8b47b44cc0c822879aa96078248061e3a75ec970 (diff)
downloadsrc-da12c6d2aa1d7b438f9e051a1fe81ead1c64a19e.tar.gz
src-da12c6d2aa1d7b438f9e051a1fe81ead1c64a19e.zip
config.y:
Support slice numbers in device names. The syntax is `<driver name> [<unit number>] ['s' <slice number>] [<partition letter>]'. Only `['s' <slice number>]' is new here. The slice number defaults to 0 so that there is no change in the output from config if this new feature is not used. Replace some magic disk numbers by `dk' slice and label macros. mkswapconf.c: Improve the output formatting: Generate <> style includes. Print minor numbers in hex so that slice numbers are easy to see and edit. Print the rootdev and dumpdev names in comments like the swapdev names.
Notes
Notes: svn path=/head/; revision=6497
Diffstat (limited to 'usr.sbin/config/config.y')
-rw-r--r--usr.sbin/config/config.y45
1 files changed, 31 insertions, 14 deletions
diff --git a/usr.sbin/config/config.y b/usr.sbin/config/config.y
index 6773073e1042..97257ebd946c 100644
--- a/usr.sbin/config/config.y
+++ b/usr.sbin/config/config.y
@@ -110,6 +110,10 @@
*/
#include "config.h"
+
+#include <sys/disklabel.h>
+#include <sys/diskslice.h>
+
#include <ctype.h>
#include <stdio.h>
#include <err.h>
@@ -245,7 +249,7 @@ System_parameter:
addr_spec:
AT NUMBER
- = { loadaddress = $2; };
+ = { loadaddress = $2; }
;
swap_spec:
@@ -270,7 +274,8 @@ swap_device_spec:
if (eq($1, "generic"))
fl->f_fn = $1;
else {
- fl->f_swapdev = nametodev($1, 0, 'b');
+ fl->f_swapdev = nametodev($1, 0,
+ COMPATIBILITY_SLICE, 'b');
fl->f_fn = devtoname(fl->f_swapdev);
}
$$ = fl;
@@ -308,7 +313,7 @@ root_device_specs:
root_device_spec:
device_name
- = { $$ = nametodev($1, 0, 'a'); }
+ = { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'a'); }
| major_minor
;
@@ -327,7 +332,7 @@ dump_spec:
dump_device_spec:
device_name
- = { $$ = nametodev($1, 0, 'b'); }
+ = { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'b'); }
| major_minor
;
@@ -338,7 +343,7 @@ arg_spec:
arg_device_spec:
device_name
- = { $$ = nametodev($1, 0, 'b'); }
+ = { $$ = nametodev($1, 0, COMPATIBILITY_SLICE, 'b'); }
| major_minor
;
@@ -383,6 +388,20 @@ device_name:
(void) sprintf(buf, "%s%d%s", $1, $2, $3);
$$ = ns(buf); free($1);
}
+ | Save_id NUMBER ID NUMBER
+ = {
+ char buf[80];
+
+ (void) sprintf(buf, "%s%d%s%d", $1, $2, $3, $4);
+ $$ = ns(buf); free($1);
+ }
+ | Save_id NUMBER ID NUMBER ID
+ = {
+ char buf[80];
+
+ (void) sprintf(buf, "%s%d%s%d%s", $1, $2, $3, $4, $5);
+ $$ = ns(buf); free($1);
+ }
;
Opt_list:
@@ -503,7 +522,8 @@ comp_device_spec:
= {
struct file_list *fl = newflist(COMPSPEC);
- fl->f_compdev = nametodev($1, 0, 'c');
+ fl->f_compdev = nametodev($1, 0, COMPATIBILITY_SLICE,
+ 'c');
fl->f_fn = devtoname(fl->f_compdev);
$$ = fl;
}
@@ -979,14 +999,13 @@ checksystemspec(fl)
swap = newflist(SWAPSPEC);
dev = fl->f_rootdev;
- if (minor(dev) & 07) {
+ if (dkpart(dev) != 0) {
(void) sprintf(buf,
"Warning, swap defaulted to 'b' partition with root on '%c' partition",
- (minor(dev) & 07) + 'a');
+ dkpart(dev) + 'a');
yyerror(buf);
}
- swap->f_swapdev =
- makedev(major(dev), (minor(dev) &~ 07) | ('b' - 'a'));
+ swap->f_swapdev = dkmodpart(dev, SWAP_PART);
swap->f_fn = devtoname(swap->f_swapdev);
mkswap(fl, swap, 0);
}
@@ -1036,8 +1055,6 @@ verifysystemspecs()
deverror(fl->f_needs, "root");
*pchecked++ = fl->f_rootdev;
pchecked = verifyswap(fl->f_next, checked, pchecked);
-#define samedev(dev1, dev2) \
- ((minor(dev1) &~ 07) != (minor(dev2) &~ 07))
if (!alreadychecked(fl->f_dumpdev, checked, pchecked)) {
if (!finddev(fl->f_dumpdev))
deverror(fl->f_needs, "dump");
@@ -1088,7 +1105,7 @@ verifycomp(fl)
/*
* Has a device already been checked
- * for it's existence in the configuration?
+ * for its existence in the configuration?
*/
alreadychecked(dev, list, last)
dev_t dev, list[];
@@ -1097,7 +1114,7 @@ alreadychecked(dev, list, last)
register dev_t *p;
for (p = list; p < last; p++)
- if (samedev(*p, dev))
+ if (dkmodpart(*p, 0) != dkmodpart(dev, 0))
return (1);
return (0);
}