How to define a major for a pseudo character device on NetBSD 1.6

Previous thread: Fix for kern/44310 (write to /dev/bpf truncates size_t to int) by Alexander Nasonov on Sunday, January 2, 2011 - 7:32 am. (1 message)

Next thread: __ps_strings and compat32 by Joerg Sonnenberger on Tuesday, January 4, 2011 - 5:09 am. (1 message)
From: Luciano Rodrigues Furtado
Date: Monday, January 3, 2011 - 5:07 am

Hi All,

I have a machine still stuck on NetBSD 1.6,  I decided to try to port
the Tap driver to it. One question I have is where I define the major
for this new driver on 1.6.

On current I see conf/majors. Do I do this simply by adding a new
entry to the structure bellow:

#include "clockctl.h"
cdev_decl(clockctl);

struct cdevsw   cdevsw[] =
{
        cdev_cn_init(1,cn),             /* 0: virtual console */
        cdev_ctty_init(1,ctty),         /* 1: controlling terminal */
        cdev_mm_init(1,mm),             /* 2: /dev/{null,mem,kmem,...} */
        cdev_disk_init(NWD,wd),         /* 3: ST506/ESDI/IDE disk */




more specifically on one of the positions listed as  cdev_notdef().

I am doing this as a learning project.

Thanks in advance.
Luciano
From: Manuel Bouyer
Date: Monday, January 3, 2011 - 7:31 am

from what I remember this is the right way to do it, yes.
Don't forget to cdev_decl() it too.
You'll also have to hack MAKEDEV (or create the device nodes by calling
mknod directly).

-- 
Manuel Bouyer <bouyer@antioche.eu.org>
     NetBSD: 26 ans d'experience feront toujours la difference
--
Previous thread: Fix for kern/44310 (write to /dev/bpf truncates size_t to int) by Alexander Nasonov on Sunday, January 2, 2011 - 7:32 am. (1 message)

Next thread: __ps_strings and compat32 by Joerg Sonnenberger on Tuesday, January 4, 2011 - 5:09 am. (1 message)