From acd102e64b61f716b46d42613c65070247551406 Mon Sep 17 00:00:00 2001 From: Poul-Henning Kamp Date: Sun, 27 Feb 2005 22:02:03 +0000 Subject: [PATCH] Use dynamic major number allocation. --- sys/conf/majors | 2 -- sys/kern/subr_log.c | 4 +--- sys/kern/tty_pty.c | 6 +----- sys/kern/tty_tty.c | 5 +---- 4 files changed, 3 insertions(+), 14 deletions(-) diff --git a/sys/conf/majors b/sys/conf/majors index c006ba5f24fa..141ba1a157ae 100644 --- a/sys/conf/majors +++ b/sys/conf/majors @@ -21,8 +21,6 @@ #maj name comments 1 *ctty /dev/tty 4 *geom GEOMetry -5 *pts pseudo tty "tty" half -6 *ptc pseudo tty "master" half 19 *tw X-10 power interface 22 *fd (/dev/stdin etc) 30 *snd sound driver system diff --git a/sys/kern/subr_log.c b/sys/kern/subr_log.c index c3b5764fe6a8..cd9a70abf12c 100644 --- a/sys/kern/subr_log.c +++ b/sys/kern/subr_log.c @@ -63,7 +63,6 @@ static d_poll_t logpoll; static void logtimeout(void *arg); -#define CDEV_MAJOR 7 static struct cdevsw log_cdevsw = { .d_version = D_VERSION, .d_flags = D_NEEDGIANT, @@ -73,7 +72,6 @@ static struct cdevsw log_cdevsw = { .d_ioctl = logioctl, .d_poll = logpoll, .d_name = "log", - .d_maj = CDEV_MAJOR, }; static struct logsoftc { @@ -252,4 +250,4 @@ log_drvinit(void *unused) make_dev(&log_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "klog"); } -SYSINIT(logdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,log_drvinit,NULL) +SYSINIT(logdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,log_drvinit,NULL) diff --git a/sys/kern/tty_pty.c b/sys/kern/tty_pty.c index f9551c8e3888..21d47e27a845 100644 --- a/sys/kern/tty_pty.c +++ b/sys/kern/tty_pty.c @@ -77,7 +77,6 @@ static d_ioctl_t ptcioctl; static d_write_t ptcwrite; static d_poll_t ptcpoll; -#define CDEV_MAJOR_S 5 static struct cdevsw pts_cdevsw = { .d_version = D_VERSION, .d_open = ptsopen, @@ -86,11 +85,9 @@ static struct cdevsw pts_cdevsw = { .d_write = ptswrite, .d_ioctl = ptsioctl, .d_name = "pts", - .d_maj = CDEV_MAJOR_S, .d_flags = D_TTY | D_NEEDGIANT, }; -#define CDEV_MAJOR_C 6 static struct cdevsw ptc_cdevsw = { .d_version = D_VERSION, .d_open = ptcopen, @@ -100,7 +97,6 @@ static struct cdevsw ptc_cdevsw = { .d_ioctl = ptcioctl, .d_poll = ptcpoll, .d_name = "ptc", - .d_maj = CDEV_MAJOR_C, .d_flags = D_TTY | D_NEEDGIANT, }; @@ -725,4 +721,4 @@ ptc_drvinit(void *unused) EVENTHANDLER_REGISTER(dev_clone, pty_clone, 0, 1000); } -SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL) +SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,ptc_drvinit,NULL) diff --git a/sys/kern/tty_tty.c b/sys/kern/tty_tty.c index e467dd304364..c813211ee8ed 100644 --- a/sys/kern/tty_tty.c +++ b/sys/kern/tty_tty.c @@ -35,13 +35,10 @@ __FBSDID("$FreeBSD$"); static d_open_t cttyopen; -#define CDEV_MAJOR 1 - static struct cdevsw ctty_cdevsw = { .d_version = D_VERSION, .d_open = cttyopen, .d_name = "ctty", - .d_maj = CDEV_MAJOR, .d_flags = D_TTY | D_NEEDGIANT, }; @@ -78,4 +75,4 @@ ctty_drvinit(void *unused) ctty = make_dev(&ctty_cdevsw, 0, 0, 0, 0666, "ctty"); } -SYSINIT(cttydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,ctty_drvinit,NULL) +SYSINIT(cttydev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE,ctty_drvinit,NULL)