Add necessary awk magic to create a table of major numbers allocated

in conf/majors so we can avoid autoallocating them in the kernel.
This commit is contained in:
Poul-Henning Kamp 2003-02-27 08:52:11 +00:00
parent b89bc9e62b
commit 76d6aef572
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=111606
3 changed files with 29 additions and 1 deletions

View file

@ -72,7 +72,7 @@ tlphy.o xmphy.o: miidevs.h
kernel-clean: kernel-clean:
rm -f *.o *.so *.So *.ko *.s eddep errs \ rm -f *.o *.so *.So *.ko *.s eddep errs \
${FULLKERNEL} ${KERNEL_KO} linterrs makelinks tags \ ${FULLKERNEL} ${KERNEL_KO} linterrs makelinks tags \
vers.c vnode_if.c vnode_if.h \ vers.c vnode_if.c vnode_if.h majors.c \
${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \ ${MFILES:T:S/.m$/.c/} ${MFILES:T:S/.m$/.h/} \
${CLEAN} ${CLEAN}
@ -215,4 +215,10 @@ vnode_if.h: $S/tools/vnode_if.awk $S/kern/vnode_if.src
vnode_if.o: vnode_if.o:
${NORMAL_C} ${NORMAL_C}
majors.c: $S/conf/majors $S/conf/majors.awk
${AWK} -f $S/conf/majors.awk $S/conf/majors > majors.c
majors.o:
${NORMAL_C}
.include <bsd.kern.mk> .include <bsd.kern.mk>

View file

@ -67,6 +67,7 @@ SYSTEM_CFILES= vnode_if.c hints.c env.c config.c
SYSTEM_SFILES= $S/$M/$M/locore.s SYSTEM_SFILES= $S/$M/$M/locore.s
SYSTEM_DEP= Makefile ${SYSTEM_OBJS} SYSTEM_DEP= Makefile ${SYSTEM_OBJS}
SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So SYSTEM_OBJS= locore.o vnode_if.o ${OBJS} hints.o env.o config.o hack.So
SYSTEM_OBJS+= majors.o
SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \ SYSTEM_LD= @${LD} ${FMT} -Bdynamic -T $S/conf/ldscript.$M \
-warn-common -export-dynamic -dynamic-linker /red/herring \ -warn-common -export-dynamic -dynamic-linker /red/herring \
-o ${.TARGET} -X ${SYSTEM_OBJS} vers.o -o ${.TARGET} -X ${SYSTEM_OBJS} vers.o

21
sys/conf/majors.awk Normal file
View file

@ -0,0 +1,21 @@
# $FreeBSD$
/^#/ { next }
NF == 1 { next }
$2 == "??" { next }
$2 == "lkm" { next }
{
a[$1] = $1;
}
END {
print "unsigned char reserved_majors[256] = {"
for (i = 0; i < 256; i += 16) {
for (j = 0; j < 16; j++) {
printf("%3d", a[i + j]);
if (i + j != 255)
printf(",");
}
print ""
}
print "};"
}