diff options
author | phk <phk@FreeBSD.org> | 1999-05-11 19:55:07 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 1999-05-11 19:55:07 +0000 |
commit | 7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd (patch) | |
tree | 31ecebf331e4a644fafb96ecafe7d2b6b1a24d39 /sys/i386/linux | |
parent | c783fdfffac012af2a31c3939b62a23b94680404 (diff) | |
download | FreeBSD-src-7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd.zip FreeBSD-src-7e26ca1d1a4bb6507cb6f9241f2d35b1048eaecd.tar.gz |
Divorce "dev_t" from the "major|minor" bitmap, which is now called
udev_t in the kernel but still called dev_t in userland.
Provide functions to manipulate both types:
major() umajor()
minor() uminor()
makedev() umakedev()
dev2udev() udev2dev()
For now they're functions, they will become in-line functions
after one of the next two steps in this process.
Return major/minor/makedev to macro-hood for userland.
Register a name in cdevsw[] for the "filedescriptor" driver.
In the kernel the udev_t appears in places where we have the
major/minor number combination, (ie: a potential device: we
may not have the driver nor the device), like in inodes, vattr,
cdevsw registration and so on, whereas the dev_t appears where
we carry around a reference to a actual device.
In the future the cdevsw and the aliased-from vnode will be hung
directly from the dev_t, along with up to two softc pointers for
the device driver and a few houskeeping bits. This will essentially
replace the current "alias" check code (same buck, bigger bang).
A little stunt has been provided to try to catch places where the
wrong type is being used (dev_t vs udev_t), if you see something
not working, #undef DEVT_FASCIST in kern/kern_conf.c and see if
it makes a difference. If it does, please try to track it down
(many hands make light work) or at least try to reproduce it
as simply as possible, and describe how to do that.
Without DEVT_FASCIST I belive this patch is a no-op.
Stylistic/posixoid comments about the userland view of the <sys/*.h>
files welcome now, from userland they now contain the end result.
Next planned step: make all dev_t's refer to the same devsw[] which
means convert BLK's to CHR's at the perimeter of the vnodes and
other places where they enter the game (bootdev, mknod, sysctl).
Diffstat (limited to 'sys/i386/linux')
-rw-r--r-- | sys/i386/linux/linux_file.c | 8 | ||||
-rw-r--r-- | sys/i386/linux/linux_stats.c | 4 |
2 files changed, 7 insertions, 5 deletions
diff --git a/sys/i386/linux/linux_file.c b/sys/i386/linux/linux_file.c index e357e15..3dc3cbc 100644 --- a/sys/i386/linux/linux_file.c +++ b/sys/i386/linux/linux_file.c @@ -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: linux_file.c,v 1.24 1999/05/06 18:44:20 peter Exp $ + * $Id: linux_file.c,v 1.25 1999/05/08 06:39:26 phk Exp $ */ #include "opt_compat.h" @@ -204,6 +204,7 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) struct pgrp *pgrp; struct tty *tp, *(*d_tty) __P((dev_t)); caddr_t sg; + dev_t dev; sg = stackgap_init(); bsd_flock = (struct flock *)stackgap_alloc(&sg, sizeof(struct flock)); @@ -306,8 +307,9 @@ linux_fcntl(struct proc *p, struct linux_fcntl_args *args) if ((error = VOP_GETATTR(vp, &va, p->p_ucred, p))) return error; - d_tty = devsw(va.va_rdev)->d_devtotty; - if (!d_tty || (!(tp = (*d_tty)(va.va_rdev)))) + dev = udev2dev(va.va_rdev, 0); /* XXX vp->v_rdev ? */ + d_tty = devsw(dev)->d_devtotty; + if (!d_tty || (!(tp = (*d_tty)(dev)))) return EINVAL; if (args->cmd == LINUX_F_GETOWN) { p->p_retval[0] = tp->t_pgrp ? tp->t_pgrp->pg_id : NO_PID; diff --git a/sys/i386/linux/linux_stats.c b/sys/i386/linux/linux_stats.c index 8e9db81..e7f9390 100644 --- a/sys/i386/linux/linux_stats.c +++ b/sys/i386/linux/linux_stats.c @@ -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: linux_stats.c,v 1.10 1999/05/06 18:44:28 peter Exp $ + * $Id: linux_stats.c,v 1.11 1999/05/09 10:25:30 phk Exp $ */ #include <sys/param.h> @@ -74,7 +74,7 @@ newstat_copyout(struct stat *buf, void *ubuf) { struct linux_newstat tbuf; - tbuf.stat_dev = minor(buf->st_dev) | (major(buf->st_dev) << 10); + tbuf.stat_dev = uminor(buf->st_dev) | (umajor(buf->st_dev) << 10); tbuf.stat_ino = buf->st_ino; tbuf.stat_mode = buf->st_mode; tbuf.stat_nlink = buf->st_nlink; |