First small steps at merging DEVFS and PHK's Dev_t stuff.
This commit is contained in:
parent
26db38df3e
commit
1744fcd082
@ -25,7 +25,7 @@
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
|
||||
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: syscons.h,v 1.49 1999/06/24 13:04:33 yokota Exp $
|
||||
* $Id: syscons.h,v 1.50 1999/07/07 13:48:50 yokota Exp $
|
||||
*/
|
||||
|
||||
#ifndef _DEV_SYSCONS_SYSCONS_H_
|
||||
@ -207,7 +207,10 @@ typedef struct sc_softc {
|
||||
struct scr_stat *old_scp;
|
||||
int delayed_next_scr;
|
||||
|
||||
void **devfs_token;
|
||||
/* uncontitional as you'd need to check opt_devfs in about 25 files */
|
||||
void *devfs_token[MAXCONS];
|
||||
void *mouse_devfs_token;
|
||||
void *console_devfs_token;
|
||||
|
||||
char font_loading_in_progress;
|
||||
char switch_in_progress;
|
||||
|
@ -30,9 +30,11 @@
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $Id: kern_conf.c,v 1.57 1999/08/15 09:32:47 phk Exp $
|
||||
* $Id: kern_conf.c,v 1.58 1999/08/17 20:25:50 billf Exp $
|
||||
*/
|
||||
|
||||
#include "opt_devfs.h"
|
||||
|
||||
#include <sys/param.h>
|
||||
#include <sys/kernel.h>
|
||||
#include <sys/systm.h>
|
||||
@ -42,6 +44,10 @@
|
||||
#include <sys/vnode.h>
|
||||
#include <sys/queue.h>
|
||||
#include <machine/stdarg.h>
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif /* DEVFS */
|
||||
|
||||
|
||||
#define cdevsw_ALLOCSTART (NUMCDEVSW/2)
|
||||
|
||||
@ -306,6 +312,18 @@ make_dev(struct cdevsw *devsw, int minor, uid_t uid, gid_t gid, int perms, char
|
||||
dev->si_name[i] = '\0';
|
||||
va_end(ap);
|
||||
dev->si_devsw = devsw;
|
||||
|
||||
#ifdef DEVFS
|
||||
dev->si_devfs = devfs_add_devswf(devsw, minor, DV_CHR,
|
||||
uid, gid, perms, dev->si_name);
|
||||
/* XXX HACK .. name may not start in 'r' */
|
||||
if ((devsw->d_bmaj != -1)
|
||||
&& (*dev->si_name == 'r')
|
||||
&& ((devsw->d_flags & D_TYPEMASK) == D_DISK)) {
|
||||
dev->si_devfs = devfs_add_devswf(devsw, minor, DV_BLK,
|
||||
uid, gid, perms, dev->si_name + 1);
|
||||
}
|
||||
#endif /* DEVFS */
|
||||
return (dev);
|
||||
}
|
||||
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* from: @(#)cons.c 7.2 (Berkeley) 5/9/91
|
||||
* $Id: tty_cons.c,v 1.72 1999/08/09 11:02:43 phk Exp $
|
||||
* $Id: tty_cons.c,v 1.73 1999/08/13 10:52:22 phk Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -99,8 +99,9 @@ static int openmode, openflag; /* how /dev/console was openned */
|
||||
static u_char cn_phys_is_open; /* nonzero if physical device is open */
|
||||
static d_close_t *cn_phys_close; /* physical device close function */
|
||||
static d_open_t *cn_phys_open; /* physical device open function */
|
||||
struct consdev *cn_tab; /* physical console device info */
|
||||
struct consdev *cn_tab; /* physical console device info */
|
||||
static struct tty *cn_tp; /* physical console tty struct */
|
||||
static dev_t condev_t; /* represents the device private info */
|
||||
|
||||
CONS_DRIVER(cons, NULL, NULL, NULL, NULL, NULL, NULL);
|
||||
|
||||
@ -432,7 +433,8 @@ cn_drvinit(void *unused)
|
||||
{
|
||||
|
||||
cdevsw_add(&cn_cdevsw);
|
||||
make_dev (&cn_cdevsw, 0, UID_ROOT, GID_WHEEL, 0600, "console");
|
||||
condev_t = make_dev (&cn_cdevsw, 0,
|
||||
UID_ROOT, GID_WHEEL, 0600, "console");
|
||||
}
|
||||
|
||||
SYSINIT(cndev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR,cn_drvinit,NULL)
|
||||
|
@ -31,7 +31,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)tty_pty.c 8.4 (Berkeley) 2/20/95
|
||||
* $Id: tty_pty.c,v 1.63 1999/08/08 19:47:32 phk Exp $
|
||||
* $Id: tty_pty.c,v 1.64 1999/08/17 23:08:51 julian Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -57,10 +57,6 @@
|
||||
#include <sys/signalvar.h>
|
||||
#include <sys/malloc.h>
|
||||
|
||||
#ifdef DEVFS
|
||||
#include <sys/devfsext.h>
|
||||
#endif /*DEVFS*/
|
||||
|
||||
MALLOC_DEFINE(M_PTY, "ptys", "pty data structures");
|
||||
|
||||
static void ptsstart __P((struct tty *tp));
|
||||
@ -134,10 +130,7 @@ struct pt_ioctl {
|
||||
u_char pt_send;
|
||||
u_char pt_ucntl;
|
||||
struct tty pt_tty;
|
||||
#ifdef DEVFS
|
||||
void *devfs_token_pts;
|
||||
void *devfs_token_ptc;
|
||||
#endif /* DEVFS */
|
||||
dev_t devs, devc;
|
||||
};
|
||||
|
||||
#define PF_PKT 0x08 /* packet mode */
|
||||
@ -167,24 +160,16 @@ ptyinit(n)
|
||||
if (n & ~0xff)
|
||||
return;
|
||||
|
||||
devs = make_dev(&pts_cdevsw, n,
|
||||
0, 0, 0666, "tty%c%r", names[n / 32], n % 32);
|
||||
devc = make_dev(&ptc_cdevsw, n,
|
||||
0, 0, 0666, "pty%c%r", names[n / 32], n % 32);
|
||||
|
||||
pt = malloc(sizeof(*pt), M_PTY, M_WAITOK);
|
||||
bzero(pt, sizeof(*pt));
|
||||
pt->devs = devs = make_dev(&pts_cdevsw, n,
|
||||
0, 0, 0666, "tty%c%r", names[n / 32], n % 32);
|
||||
pt->devc = devc = make_dev(&ptc_cdevsw, n,
|
||||
0, 0, 0666, "pty%c%r", names[n / 32], n % 32);
|
||||
|
||||
devs->si_drv1 = devc->si_drv1 = pt;
|
||||
devs->si_tty_tty = devc->si_tty_tty = &pt->pt_tty;
|
||||
ttyregister(&pt->pt_tty);
|
||||
#ifdef DEVFS
|
||||
pt->devfs_token_pts = devfs_add_devswf(&pts_cdevsw,n,
|
||||
DV_CHR,0,0,0666,
|
||||
devs->si_name);
|
||||
pt->devfs_token_ptc = devfs_add_devswf(&ptc_cdevsw,n,
|
||||
DV_CHR,0,0,0666,
|
||||
devc->si_name);
|
||||
#endif /* DEVFS */
|
||||
}
|
||||
|
||||
/*ARGSUSED*/
|
||||
@ -196,13 +181,14 @@ ptsopen(dev, flag, devtype, p)
|
||||
{
|
||||
register struct tty *tp;
|
||||
int error;
|
||||
#ifdef DEVFS
|
||||
int minr;
|
||||
dev_t nextdev;
|
||||
|
||||
/*
|
||||
* If we openned this device, ensure we have the
|
||||
* next ready in the DEVFS (up to 256 of them).
|
||||
* XXX probably a more efficient way of know if the next one has
|
||||
* been made already would be to just keep track..
|
||||
*/
|
||||
minr = lminor(dev);
|
||||
if (minr < 255) {
|
||||
@ -211,7 +197,6 @@ ptsopen(dev, flag, devtype, p)
|
||||
ptyinit(minr + 1);
|
||||
}
|
||||
}
|
||||
#endif /* DEVFS */
|
||||
if (!dev->si_drv1)
|
||||
ptyinit(minor(dev));
|
||||
if (!dev->si_drv1)
|
||||
@ -859,9 +844,7 @@ ptc_drvinit(unused)
|
||||
cdevsw_add(&ptc_cdevsw);
|
||||
ptc_devsw_installed = 1;
|
||||
}
|
||||
#ifdef DEVFS
|
||||
ptyinit(0); /* Add the first pty into the system.. prime the pump */
|
||||
#endif /* DEVFS */
|
||||
}
|
||||
|
||||
SYSINIT(ptcdev,SI_SUB_DRIVERS,SI_ORDER_MIDDLE+CDEV_MAJOR_C,ptc_drvinit,NULL)
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.74 1999/08/15 09:32:44 phk Exp $
|
||||
* $Id: conf.h,v 1.75 1999/08/17 20:25:48 billf Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -61,6 +61,7 @@ struct specinfo {
|
||||
char si_name[SPECNAMELEN + 1];
|
||||
void *si_drv1, *si_drv2;
|
||||
struct cdevsw *si_devsw;
|
||||
void *si_devfs; /* save cookie for devfs operations */
|
||||
union {
|
||||
struct {
|
||||
struct tty *__sit_tty;
|
||||
@ -272,7 +273,7 @@ int lminor __P((dev_t dev));
|
||||
void setconf __P((void));
|
||||
|
||||
/*
|
||||
* XXX: This gunk included in case DEVFS resurfaces
|
||||
* XXX: This included for when DEVFS resurfaces
|
||||
*/
|
||||
|
||||
#define UID_ROOT 0
|
||||
|
@ -36,7 +36,7 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* @(#)conf.h 8.5 (Berkeley) 1/9/95
|
||||
* $Id: conf.h,v 1.74 1999/08/15 09:32:44 phk Exp $
|
||||
* $Id: conf.h,v 1.75 1999/08/17 20:25:48 billf Exp $
|
||||
*/
|
||||
|
||||
#ifndef _SYS_CONF_H_
|
||||
@ -61,6 +61,7 @@ struct specinfo {
|
||||
char si_name[SPECNAMELEN + 1];
|
||||
void *si_drv1, *si_drv2;
|
||||
struct cdevsw *si_devsw;
|
||||
void *si_devfs; /* save cookie for devfs operations */
|
||||
union {
|
||||
struct {
|
||||
struct tty *__sit_tty;
|
||||
@ -272,7 +273,7 @@ int lminor __P((dev_t dev));
|
||||
void setconf __P((void));
|
||||
|
||||
/*
|
||||
* XXX: This gunk included in case DEVFS resurfaces
|
||||
* XXX: This included for when DEVFS resurfaces
|
||||
*/
|
||||
|
||||
#define UID_ROOT 0
|
||||
|
Loading…
Reference in New Issue
Block a user