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).
This commit is contained in:
phk 1999-05-11 19:55:07 +00:00
parent c783fdfffa
commit 7e26ca1d1a
71 changed files with 337 additions and 209 deletions

View File

@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.59 1999/05/03 09:47:53 peter Exp $
* $Id: mem.c,v 1.60 1999/05/08 17:48:21 peter Exp $
*/
/*
@ -49,13 +49,13 @@
#include "opt_perfmon.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/buf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /* DEVFS */
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/ioccom.h>
#include <sys/malloc.h>

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/coda/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda.h,v 1.5 1998/10/28 19:33:49 rvb Exp $
* $Id: coda.h,v 1.6 1998/11/11 20:32:20 rvb Exp $
*
*/
@ -87,7 +87,7 @@ typedef unsigned long long u_quad_t;
typedef unsigned long long u_quad_t;
#endif
#else
#define cdev_t dev_t
#define cdev_t udev_t
#endif
#ifdef __CYGWIN32__

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_venus.c,v 1.5 1998/10/28 19:33:50 rvb Exp $
* $Id: coda_venus.c,v 1.6 1998/11/11 20:32:20 rvb Exp $
*
*/
@ -197,7 +197,7 @@ venus_open(void *mdp, ViceFid *fid, int flag,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
*dev = outp->dev;
*dev = udev2dev(outp->dev, 2);
*inode = outp->inode;
}

View File

@ -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;

View File

@ -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;

View File

@ -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: ata-disk.c,v 1.8 1999/05/07 07:03:11 phk Exp $
* $Id: ata-disk.c,v 1.9 1999/05/07 16:37:06 peter Exp $
*/
#include "ata.h"
@ -78,7 +78,7 @@ static struct cdevsw ad_cdevsw = {
};
/* misc defines */
#define UNIT(dev) (dev>>3 & 0x1f) /* assume 8 minor # per unit */
#define UNIT(dev) (minor(dev)>>3 & 0x1f) /* assume 8 minor # per unit */
#define NUNIT 16 /* max # of devices */
/* prototypes */

View File

@ -1,4 +1,4 @@
/* $Id: ccd.c,v 1.45 1999/05/07 07:03:17 phk Exp $ */
/* $Id: ccd.c,v 1.46 1999/05/07 10:09:42 phk Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@ -361,7 +361,7 @@ ccdinit(ccd, cpaths, p)
free(cs->sc_cinfo, M_DEVBUF);
return (error);
}
ci->ci_dev = va.va_rdev;
ci->ci_dev = udev2dev(va.va_rdev, 2);
/*
* Get partition information for the component.

View File

@ -38,7 +38,7 @@
* from: Utah Hdr: vn.c 1.13 94/04/02
*
* from: @(#)vn.c 8.6 (Berkeley) 4/1/94
* $Id: vn.c,v 1.77 1999/05/07 07:03:20 phk Exp $
* $Id: vn.c,v 1.78 1999/05/07 10:10:10 phk Exp $
*/
/*
@ -80,6 +80,7 @@
#include <sys/mount.h>
#include <sys/vnode.h>
#include <sys/fcntl.h>
#include <sys/conf.h>
#include <sys/disklabel.h>
#include <sys/diskslice.h>
#include <sys/stat.h>

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_node.c,v 1.26 1999/01/02 11:34:54 bde Exp $
* $Id: cd9660_node.c,v 1.27 1999/01/27 21:49:54 dillon Exp $
*/
#include <sys/param.h>
@ -57,7 +57,7 @@
*/
static struct iso_node **isohashtbl;
static u_long isohash;
#define INOHASH(device, inum) (((device) + ((inum)>>12)) & isohash)
#define INOHASH(device, inum) ((minor(device) + ((inum)>>12)) & isohash)
#ifndef NULL_SIMPLELOCKS
static struct simplelock cd9660_ihash_slock;
#endif

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.h 8.6 (Berkeley) 5/14/95
* $Id: cd9660_node.h,v 1.16 1997/11/18 14:40:34 phk Exp $
* $Id: cd9660_node.h,v 1.17 1998/02/03 21:39:30 bde Exp $
*/
/*
@ -56,7 +56,7 @@ typedef struct {
uid_t iso_uid; /* owner user id */
gid_t iso_gid; /* owner group id */
short iso_links; /* links of file */
dev_t iso_rdev; /* Major/Minor number for special */
udev_t iso_rdev; /* Major/Minor number for special */
} ISO_RRIP_INODE;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94
* $Id: cd9660_rrip.c,v 1.13 1997/08/02 14:31:19 bde Exp $
* $Id: cd9660_rrip.c,v 1.14 1999/04/18 10:58:01 dcs Exp $
*/
#include <sys/param.h>
@ -423,9 +423,9 @@ cd9660_rrip_device(p,ana)
low = isonum_733(p->dev_t_low);
if (high == 0)
ana->inop->inode.iso_rdev = makedev(major(low), minor(low));
ana->inop->inode.iso_rdev = umakedev(umajor(low), uminor(low));
else
ana->inop->inode.iso_rdev = makedev(high, minor(low));
ana->inop->inode.iso_rdev = umakedev(high, uminor(low));
ana->fields &= ~ISO_SUSP_DEVICE;
return ISO_SUSP_DEVICE;
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
* $Id: cd9660_vnops.c,v 1.54 1999/01/27 21:49:55 dillon Exp $
* $Id: cd9660_vnops.c,v 1.55 1999/04/18 10:58:02 dcs Exp $
*/
#include <sys/param.h>
@ -210,7 +210,7 @@ cd9660_getattr(ap)
register struct vattr *vap = ap->a_vap;
register struct iso_node *ip = VTOI(vp);
vap->va_fsid = ip->i_dev;
vap->va_fsid = dev2udev(ip->i_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->inode.iso_mode;

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/coda/coda.h,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda.h,v 1.5 1998/10/28 19:33:49 rvb Exp $
* $Id: coda.h,v 1.6 1998/11/11 20:32:20 rvb Exp $
*
*/
@ -87,7 +87,7 @@ typedef unsigned long long u_quad_t;
typedef unsigned long long u_quad_t;
#endif
#else
#define cdev_t dev_t
#define cdev_t udev_t
#endif
#ifdef __CYGWIN32__

View File

@ -27,7 +27,7 @@
* Mellon the rights to redistribute these changes without encumbrance.
*
* @(#) src/sys/cfs/coda_venus.c,v 1.1.1.1 1998/08/29 21:14:52 rvb Exp $
* $Id: coda_venus.c,v 1.5 1998/10/28 19:33:50 rvb Exp $
* $Id: coda_venus.c,v 1.6 1998/11/11 20:32:20 rvb Exp $
*
*/
@ -197,7 +197,7 @@ venus_open(void *mdp, ViceFid *fid, int flag,
error = coda_call(mdp, Isize, &Osize, (char *)inp);
if (!error) {
*dev = outp->dev;
*dev = udev2dev(outp->dev, 2);
*inode = outp->inode;
}

View File

@ -1,4 +1,4 @@
/* $Id: msdosfs_denode.c,v 1.43 1998/12/07 21:58:34 archie Exp $ */
/* $Id: msdosfs_denode.c,v 1.44 1999/01/02 11:34:56 bde Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */
/*-
@ -70,7 +70,7 @@ static MALLOC_DEFINE(M_MSDOSFSNODE, "MSDOSFS node", "MSDOSFS vnode private part"
static struct denode **dehashtbl;
static u_long dehash; /* size of hash table - 1 */
#define DEHASH(dev, dcl, doff) (dehashtbl[((dev) + (dcl) + (doff) / \
#define DEHASH(dev, dcl, doff) (dehashtbl[(minor(dev) + (dcl) + (doff) / \
sizeof(struct direntry)) & dehash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock dehash_slock;

View File

@ -1,4 +1,4 @@
/* $Id: msdosfs_vnops.c,v 1.83 1999/04/28 11:37:27 phk Exp $ */
/* $Id: msdosfs_vnops.c,v 1.84 1999/05/06 18:12:51 peter Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */
/*-
@ -341,7 +341,7 @@ msdosfs_getattr(ap)
getnanotime(&ts);
DETIMES(dep, &ts, &ts, &ts);
vap->va_fsid = dep->de_dev;
vap->va_fsid = dev2udev(dep->de_dev);
/*
* The following computation of the fileid must be the same as that
* used in msdosfs_readdir() to compute d_fileno. If not, pwd

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95
* $Id: ntfs_ihash.c,v 1.2 1999/01/02 01:17:38 semen Exp $
* $Id: ntfs_ihash.c,v 1.3 1999/04/20 21:06:43 semenu Exp $
*/
#include <sys/param.h>
@ -53,7 +53,7 @@ MALLOC_DEFINE(M_NTFSNTHASH, "NTFS nthash", "NTFS ntnode hash tables");
*/
static LIST_HEAD(nthashhead, ntnode) *ntfs_nthashtbl;
static u_long ntfs_nthash; /* size of hash table - 1 */
#define NTNOHASH(device, inum) (&ntfs_nthashtbl[((device) + (inum)) & ntfs_nthash])
#define NTNOHASH(device, inum) (&ntfs_nthashtbl[(minor(device) + (inum)) & ntfs_nthash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock ntfs_nthash_slock;
#endif

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ntfs_vfsops.c,v 1.3 1999/04/20 21:06:43 semenu Exp $
* $Id: ntfs_vfsops.c,v 1.4 1999/05/06 22:07:34 peter Exp $
*/
@ -500,7 +500,7 @@ ntfs_mountfs(devvp, mp, argsp, p)
vput(vp);
}
mp->mnt_stat.f_fsid.val[0] = (long)dev;
mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
#if __FreeBSD_version >= 300000
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
#else

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ntfs_vnops.c,v 1.10 1999/02/02 03:15:13 semen Exp $
* $Id: ntfs_vnops.c,v 1.3 1999/04/20 21:06:43 semenu Exp $
*
*/
@ -215,13 +215,13 @@ ntfs_getattr(ap)
dprintf(("ntfs_getattr: %d, flags: %d\n",ip->i_number,ip->i_flag));
vap->va_fsid = fp->f_dev;
vap->va_fsid = dev2udev(fp->f_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->i_mode;
vap->va_nlink = ip->i_nlink;
vap->va_uid = ip->i_uid;
vap->va_gid = ip->i_gid;
vap->va_rdev = (dev_t)0;
vap->va_rdev = 0; /* XXX UNODEV ? */
vap->va_size = fp->f_size;
vap->va_bytes = fp->f_allocated;
vap->va_atime = ntfs_nttimetounix(fp->f_times.t_access);

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
* $Id: spec_vnops.c,v 1.84 1999/05/07 10:11:05 phk Exp $
* $Id: spec_vnops.c,v 1.85 1999/05/08 06:39:55 phk Exp $
*/
#include <sys/param.h>
@ -162,7 +162,7 @@ spec_open(ap)
{
struct proc *p = ap->a_p;
struct vnode *bvp, *vp = ap->a_vp;
dev_t bdev, dev = (dev_t)vp->v_rdev;
dev_t bdev, dev = vp->v_rdev;
int maj = major(dev);
int error;
struct cdevsw *dsw;

View File

@ -1,4 +1,4 @@
/* $Id: ccd.c,v 1.45 1999/05/07 07:03:17 phk Exp $ */
/* $Id: ccd.c,v 1.46 1999/05/07 10:09:42 phk Exp $ */
/* $NetBSD: ccd.c,v 1.22 1995/12/08 19:13:26 thorpej Exp $ */
@ -361,7 +361,7 @@ ccdinit(ccd, cpaths, p)
free(cs->sc_cinfo, M_DEVBUF);
return (error);
}
ci->ci_dev = va.va_rdev;
ci->ci_dev = udev2dev(va.va_rdev, 2);
/*
* Get partition information for the component.

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95
* $Id: ufs_ihash.c,v 1.17 1998/11/10 09:16:27 peter Exp $
* $Id: ufs_ihash.c,v 1.18 1999/01/02 11:34:56 bde Exp $
*/
#include <sys/param.h>
@ -52,7 +52,7 @@ static MALLOC_DEFINE(M_UFSIHASH, "UFS ihash", "UFS Inode hash tables");
*/
static LIST_HEAD(ihashhead, inode) *ihashtbl;
static u_long ihash; /* size of hash table - 1 */
#define INOHASH(device, inum) (&ihashtbl[((device) + (inum)) & ihash])
#define INOHASH(device, inum) (&ihashtbl[(minor(device) + (inum)) & ihash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock ufs_ihash_slock;
#endif

View File

@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.84 1999/05/09 04:58:13 yokota Exp $
* $Id: apm.c,v 1.85 1999/05/09 13:00:41 phk Exp $
*/
#include "opt_devfs.h"
@ -23,12 +23,12 @@
#include "opt_smp.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/reboot.h>
#include <sys/bus.h>

View File

@ -15,7 +15,7 @@
*
* Sep, 1994 Implemented on FreeBSD 1.1.5.1R (Toshiba AVS001WD)
*
* $Id: apm.c,v 1.84 1999/05/09 04:58:13 yokota Exp $
* $Id: apm.c,v 1.85 1999/05/09 13:00:41 phk Exp $
*/
#include "opt_devfs.h"
@ -23,12 +23,12 @@
#include "opt_smp.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/kernel.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /*DEVFS*/
#include <sys/systm.h>
#include <sys/time.h>
#include <sys/reboot.h>
#include <sys/bus.h>

View File

@ -38,7 +38,7 @@
*
* from: Utah $Hdr: mem.c 1.13 89/10/08$
* from: @(#)mem.c 7.2 (Berkeley) 5/9/91
* $Id: mem.c,v 1.59 1999/05/03 09:47:53 peter Exp $
* $Id: mem.c,v 1.60 1999/05/08 17:48:21 peter Exp $
*/
/*
@ -49,13 +49,13 @@
#include "opt_perfmon.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/buf.h>
#ifdef DEVFS
#include <sys/devfsext.h>
#endif /* DEVFS */
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/uio.h>
#include <sys/ioccom.h>
#include <sys/malloc.h>

View File

@ -35,10 +35,11 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: diskslice_machdep.c,v 1.32 1998/12/04 22:54:46 archie Exp $
* $Id: diskslice_machdep.c,v 1.33 1999/01/28 01:59:53 dillon Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/disklabel.h>
@ -48,7 +49,6 @@
#include <sys/diskslice.h>
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#define TRACE(str) do { if (dsi_debug) printf str; } while (0)

View File

@ -21,7 +21,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: if_le.c,v 1.48 1998/10/22 05:58:39 bde Exp $
* $Id: if_le.c,v 1.49 1998/12/30 00:37:42 hoek Exp $
*/
/*
@ -41,8 +41,8 @@
#include "opt_ipx.h"
#include <sys/param.h>
#include <sys/conf.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/mbuf.h>
#include <sys/socket.h>
#include <sys/sockio.h>

View File

@ -74,13 +74,13 @@
#if PCVT_FREEBSD >= 200
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/conf.h>
#include <sys/proc.h>
#include <sys/signalvar.h>
#include <sys/tty.h>
#include <sys/uio.h>
#include <sys/callout.h>
#include <sys/systm.h>
#include <sys/kernel.h>
#include <sys/syslog.h>
#include <sys/malloc.h>

View File

@ -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;

View File

@ -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;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.c 8.2 (Berkeley) 1/23/94
* $Id: cd9660_node.c,v 1.26 1999/01/02 11:34:54 bde Exp $
* $Id: cd9660_node.c,v 1.27 1999/01/27 21:49:54 dillon Exp $
*/
#include <sys/param.h>
@ -57,7 +57,7 @@
*/
static struct iso_node **isohashtbl;
static u_long isohash;
#define INOHASH(device, inum) (((device) + ((inum)>>12)) & isohash)
#define INOHASH(device, inum) ((minor(device) + ((inum)>>12)) & isohash)
#ifndef NULL_SIMPLELOCKS
static struct simplelock cd9660_ihash_slock;
#endif

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_node.h 8.6 (Berkeley) 5/14/95
* $Id: cd9660_node.h,v 1.16 1997/11/18 14:40:34 phk Exp $
* $Id: cd9660_node.h,v 1.17 1998/02/03 21:39:30 bde Exp $
*/
/*
@ -56,7 +56,7 @@ typedef struct {
uid_t iso_uid; /* owner user id */
gid_t iso_gid; /* owner group id */
short iso_links; /* links of file */
dev_t iso_rdev; /* Major/Minor number for special */
udev_t iso_rdev; /* Major/Minor number for special */
} ISO_RRIP_INODE;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_rrip.c 8.6 (Berkeley) 12/5/94
* $Id: cd9660_rrip.c,v 1.13 1997/08/02 14:31:19 bde Exp $
* $Id: cd9660_rrip.c,v 1.14 1999/04/18 10:58:01 dcs Exp $
*/
#include <sys/param.h>
@ -423,9 +423,9 @@ cd9660_rrip_device(p,ana)
low = isonum_733(p->dev_t_low);
if (high == 0)
ana->inop->inode.iso_rdev = makedev(major(low), minor(low));
ana->inop->inode.iso_rdev = umakedev(umajor(low), uminor(low));
else
ana->inop->inode.iso_rdev = makedev(high, minor(low));
ana->inop->inode.iso_rdev = umakedev(high, uminor(low));
ana->fields &= ~ISO_SUSP_DEVICE;
return ISO_SUSP_DEVICE;
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)cd9660_vnops.c 8.19 (Berkeley) 5/27/95
* $Id: cd9660_vnops.c,v 1.54 1999/01/27 21:49:55 dillon Exp $
* $Id: cd9660_vnops.c,v 1.55 1999/04/18 10:58:02 dcs Exp $
*/
#include <sys/param.h>
@ -210,7 +210,7 @@ cd9660_getattr(ap)
register struct vattr *vap = ap->a_vap;
register struct iso_node *ip = VTOI(vp);
vap->va_fsid = ip->i_dev;
vap->va_fsid = dev2udev(ip->i_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->inode.iso_mode;

View File

@ -30,7 +30,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: kern_conf.c,v 1.35 1999/05/09 08:18:12 phk Exp $
* $Id: kern_conf.c,v 1.36 1999/05/09 13:00:46 phk Exp $
*/
#include <sys/param.h>
@ -70,7 +70,15 @@ cdevsw_add(dev_t *descrip,
struct cdevsw *newentry,
struct cdevsw **oldentry)
{
int i ;
int i;
static int setup;
if (!setup) {
for (i = 0; i < NUMCDEV; i++)
if (!bmaj2cmaj[i])
bmaj2cmaj[i] = 254;
setup++;
}
if ( *descrip == NODEV) { /* auto (0 is valid) */
/*
@ -161,3 +169,66 @@ devsw_module_handler(module_t mod, int what, void* arg)
else
return 0;
}
/*
* dev_t and u_dev_t primitives
*/
#define DEVT_FASCIST 1
int
major(dev_t x)
{
#ifdef DEVT_FASCIST
return(253 - ((x >> 8) & 0xff));
#else
return((x >> 8) & 0xff);
#endif
}
int
minor(dev_t x)
{
return(x & 0xffff00ff);
}
dev_t
makedev(int x, int y)
{
#ifdef DEVT_FASCIST
return (((253 - x) << 8) | y);
#else
return ((x << 8) | y);
#endif
}
udev_t
dev2udev(dev_t x)
{
return umakedev(major(x), minor(x));
}
dev_t
udev2dev(udev_t x, int b)
{
return makedev(umajor(x), uminor(x));
}
int
uminor(udev_t dev)
{
return(dev & 0xffff00ff);
}
int
umajor(udev_t dev)
{
return((dev & 0xff00) >> 8);
}
udev_t
umakedev(int x, int y)
{
return ((x << 8) | y);
}

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)kern_descrip.c 8.6 (Berkeley) 4/19/94
* $Id: kern_descrip.c,v 1.59 1999/04/28 10:53:22 dt Exp $
* $Id: kern_descrip.c,v 1.60 1999/05/03 23:57:20 billf Exp $
*/
#include "opt_compat.h"
@ -81,7 +81,7 @@ static d_open_t fdopen;
static struct cdevsw fildesc_cdevsw =
{ fdopen, noclose, noread, nowrite,
noioc, nostop, nullreset, nodevtotty,
seltrue, nommap, nostrat };
seltrue, nommap, nostrat, "FD" };
static int finishdup __P((struct filedesc *fdp, int old, int new, register_t *retval));
/*

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)kern_proc.c 8.7 (Berkeley) 2/14/95
* $Id: kern_proc.c,v 1.48 1999/05/03 23:57:21 billf Exp $
* $Id: kern_proc.c,v 1.49 1999/05/06 18:12:44 peter Exp $
*/
#include <sys/param.h>
@ -548,7 +548,8 @@ sysctl_kern_proc SYSCTL_HANDLER_ARGS
if ((p->p_flag & P_CONTROLT) == 0 ||
p->p_session == NULL ||
p->p_session->s_ttyp == NULL ||
p->p_session->s_ttyp->t_dev != (dev_t)name[0])
p->p_session->s_ttyp->t_dev !=
udev2dev((udev_t)name[0], 0))
continue;
break;

View File

@ -35,10 +35,11 @@
*
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: diskslice_machdep.c,v 1.32 1998/12/04 22:54:46 archie Exp $
* $Id: diskslice_machdep.c,v 1.33 1999/01/28 01:59:53 dillon Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/disklabel.h>
@ -48,7 +49,6 @@
#include <sys/diskslice.h>
#include <sys/malloc.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#define TRACE(str) do { if (dsi_debug) printf str; } while (0)

View File

@ -43,7 +43,7 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: subr_diskslice.c,v 1.62 1999/05/07 09:10:10 phk Exp $
* $Id: subr_diskslice.c,v 1.63 1999/05/09 11:27:41 dfr Exp $
*/
#include "opt_devfs.h"
@ -51,6 +51,7 @@
#include <stddef.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/conf.h>
#ifdef DEVFS
@ -63,7 +64,6 @@
#include <sys/malloc.h>
#include <sys/stat.h>
#include <sys/syslog.h>
#include <sys/systm.h>
#include <sys/vnode.h>
#include <ufs/ffs/fs.h>

View File

@ -43,10 +43,11 @@
* from: wd.c,v 1.55 1994/10/22 01:57:12 phk Exp $
* from: @(#)ufs_disksubr.c 7.16 (Berkeley) 5/4/91
* from: ufs_disksubr.c,v 1.8 1994/06/07 01:21:39 phk Exp $
* $Id: subr_dkbad.c,v 1.7 1997/11/24 04:14:21 dyson Exp $
* $Id: subr_dkbad.c,v 1.8 1997/12/02 21:06:43 phk Exp $
*/
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/buf.h>
#include <sys/conf.h>
#include <sys/disklabel.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* From: @(#)uipc_usrreq.c 8.3 (Berkeley) 1/4/94
* $Id: uipc_usrreq.c,v 1.43 1999/04/28 11:37:07 phk Exp $
* $Id: uipc_usrreq.c,v 1.44 1999/05/10 18:09:39 truckman Exp $
*/
#include <sys/param.h>
@ -391,7 +391,7 @@ uipc_sense(struct socket *so, struct stat *sb)
so2 = unp->unp_conn->unp_socket;
sb->st_blksize += so2->so_rcv.sb_cc;
}
sb->st_dev = NODEV;
sb->st_dev = NOUDEV;
if (unp->unp_ino == 0)
unp->unp_ino = unp_ino++;
sb->st_ino = unp->unp_ino;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.192 1999/05/08 06:39:48 phk Exp $
* $Id: vfs_subr.c,v 1.193 1999/05/08 07:02:38 phk Exp $
*/
/*
@ -1188,7 +1188,7 @@ bdevvp(dev, vpp)
}
vp = nvp;
vp->v_type = VBLK;
if ((nvp = checkalias(vp, dev, (struct mount *)0)) != NULL) {
if ((nvp = checkalias(vp, dev2udev(dev), (struct mount *)0)) != NULL) {
vput(vp);
vp = nvp;
}
@ -1207,22 +1207,25 @@ bdevvp(dev, vpp)
struct vnode *
checkalias(nvp, nvp_rdev, mp)
register struct vnode *nvp;
dev_t nvp_rdev;
udev_t nvp_rdev;
struct mount *mp;
{
struct proc *p = curproc; /* XXX */
struct vnode *vp;
struct vnode **vpp;
int rmaj = major(nvp_rdev);
int rmaj = umajor(nvp_rdev);
dev_t dev;
if (nvp->v_type != VBLK && nvp->v_type != VCHR)
return (NULLVP);
dev = udev2dev(nvp_rdev, 2);
vpp = &speclisth[SPECHASH(nvp_rdev)];
loop:
simple_lock(&spechash_slock);
for (vp = *vpp; vp; vp = vp->v_specnext) {
if (nvp_rdev != vp->v_rdev || nvp->v_type != vp->v_type)
if (dev != vp->v_rdev || nvp->v_type != vp->v_type)
continue;
/*
* Alias, but not in use, so flush it out.
@ -1262,7 +1265,7 @@ checkalias(nvp, nvp_rdev, mp)
sizeof(struct specinfo), M_VNODE, M_WAITOK);
bzero(sinfo, sizeof(struct specinfo));
nvp->v_specinfo = sinfo;
sinfo->si_rdev = nvp_rdev;
sinfo->si_rdev = dev;
sinfo->si_hashchain = vpp;
sinfo->si_specnext = *vpp;
sinfo->si_bsize_phys = DEV_BSIZE;
@ -1275,12 +1278,12 @@ checkalias(nvp, nvp_rdev, mp)
*/
if (nvp->v_type == VBLK && rmaj < nblkdev) {
if (bdevsw(nvp_rdev) && bdevsw(nvp_rdev)->d_parms)
if (bdevsw(dev) && bdevsw(dev)->d_parms)
(*bdevsw(nvp_rdev)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
(*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
} else if (nvp->v_type == VCHR && rmaj < nchrdev) {
if (devsw(nvp_rdev) && devsw(nvp_rdev)->d_parms)
(*devsw(nvp_rdev)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
if (devsw(dev) && devsw(dev)->d_parms)
(*devsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
}
simple_unlock(&spechash_slock);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)vfs_subr.c 8.31 (Berkeley) 5/26/95
* $Id: vfs_subr.c,v 1.192 1999/05/08 06:39:48 phk Exp $
* $Id: vfs_subr.c,v 1.193 1999/05/08 07:02:38 phk Exp $
*/
/*
@ -1188,7 +1188,7 @@ bdevvp(dev, vpp)
}
vp = nvp;
vp->v_type = VBLK;
if ((nvp = checkalias(vp, dev, (struct mount *)0)) != NULL) {
if ((nvp = checkalias(vp, dev2udev(dev), (struct mount *)0)) != NULL) {
vput(vp);
vp = nvp;
}
@ -1207,22 +1207,25 @@ bdevvp(dev, vpp)
struct vnode *
checkalias(nvp, nvp_rdev, mp)
register struct vnode *nvp;
dev_t nvp_rdev;
udev_t nvp_rdev;
struct mount *mp;
{
struct proc *p = curproc; /* XXX */
struct vnode *vp;
struct vnode **vpp;
int rmaj = major(nvp_rdev);
int rmaj = umajor(nvp_rdev);
dev_t dev;
if (nvp->v_type != VBLK && nvp->v_type != VCHR)
return (NULLVP);
dev = udev2dev(nvp_rdev, 2);
vpp = &speclisth[SPECHASH(nvp_rdev)];
loop:
simple_lock(&spechash_slock);
for (vp = *vpp; vp; vp = vp->v_specnext) {
if (nvp_rdev != vp->v_rdev || nvp->v_type != vp->v_type)
if (dev != vp->v_rdev || nvp->v_type != vp->v_type)
continue;
/*
* Alias, but not in use, so flush it out.
@ -1262,7 +1265,7 @@ checkalias(nvp, nvp_rdev, mp)
sizeof(struct specinfo), M_VNODE, M_WAITOK);
bzero(sinfo, sizeof(struct specinfo));
nvp->v_specinfo = sinfo;
sinfo->si_rdev = nvp_rdev;
sinfo->si_rdev = dev;
sinfo->si_hashchain = vpp;
sinfo->si_specnext = *vpp;
sinfo->si_bsize_phys = DEV_BSIZE;
@ -1275,12 +1278,12 @@ checkalias(nvp, nvp_rdev, mp)
*/
if (nvp->v_type == VBLK && rmaj < nblkdev) {
if (bdevsw(nvp_rdev) && bdevsw(nvp_rdev)->d_parms)
if (bdevsw(dev) && bdevsw(dev)->d_parms)
(*bdevsw(nvp_rdev)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
(*bdevsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
} else if (nvp->v_type == VCHR && rmaj < nchrdev) {
if (devsw(nvp_rdev) && devsw(nvp_rdev)->d_parms)
(*devsw(nvp_rdev)->d_parms)(nvp_rdev, sinfo, DPARM_GET);
if (devsw(dev) && devsw(dev)->d_parms)
(*devsw(dev)->d_parms)(dev, sinfo, DPARM_GET);
}
simple_unlock(&spechash_slock);

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: devfs_vnops.c,v 1.72 1999/04/28 11:37:15 phk Exp $
* $Id: devfs_vnops.c,v 1.73 1999/05/06 20:00:27 phk Exp $
*/
@ -411,15 +411,15 @@ DBPRINT(("getattr\n"));
switch (file_node->type)
{
case DEV_DIR:
vap->va_rdev = (dev_t)file_node->dvm;
vap->va_rdev = (udev_t)file_node->dvm;
vap->va_mode |= (S_IFDIR);
break;
case DEV_CDEV:
vap->va_rdev = file_node->by.Cdev.dev;
vap->va_rdev = dev2udev(file_node->by.Cdev.dev);
vap->va_mode |= (S_IFCHR);
break;
case DEV_BDEV:
vap->va_rdev = file_node->by.Bdev.dev;
vap->va_rdev = dev2udev(file_node->by.Bdev.dev);
vap->va_mode |= (S_IFBLK);
break;
case DEV_SLNK:

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)kernfs_vfsops.c 8.10 (Berkeley) 5/14/95
* $Id: kernfs_vfsops.c,v 1.25 1999/05/07 10:11:02 phk Exp $
* $Id: kernfs_vfsops.c,v 1.26 1999/05/08 06:39:52 phk Exp $
*/
/*
@ -79,7 +79,6 @@ static void
kernfs_get_rrootdev()
{
static int tried = 0;
int bmaj = major(rootdev);
int cmaj;
if (tried) {

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)spec_vnops.c 8.14 (Berkeley) 5/21/95
* $Id: spec_vnops.c,v 1.84 1999/05/07 10:11:05 phk Exp $
* $Id: spec_vnops.c,v 1.85 1999/05/08 06:39:55 phk Exp $
*/
#include <sys/param.h>
@ -162,7 +162,7 @@ spec_open(ap)
{
struct proc *p = ap->a_p;
struct vnode *bvp, *vp = ap->a_vp;
dev_t bdev, dev = (dev_t)vp->v_rdev;
dev_t bdev, dev = vp->v_rdev;
int maj = major(dev);
int error;
struct cdevsw *dsw;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)specdev.h 8.6 (Berkeley) 5/21/95
* $Id: specdev.h,v 1.15 1998/04/19 23:32:29 julian Exp $
* $Id: specdev.h,v 1.16 1999/02/25 05:22:30 dillon Exp $
*/
/*
@ -60,11 +60,7 @@ struct specinfo {
* Special device management
*/
#define SPECHSZ 64
#if ((SPECHSZ&(SPECHSZ-1)) == 0)
#define SPECHASH(rdev) (((rdev>>5)+(rdev))&(SPECHSZ-1))
#else
#define SPECHASH(rdev) (((unsigned)((rdev>>5)+(rdev)))%SPECHSZ)
#endif
#define SPECHASH(rdev) (((unsigned)(minor(rdev)))%SPECHSZ)
extern struct vnode *speclisth[SPECHSZ];

View File

@ -1,4 +1,4 @@
/* $Id: msdosfs_denode.c,v 1.43 1998/12/07 21:58:34 archie Exp $ */
/* $Id: msdosfs_denode.c,v 1.44 1999/01/02 11:34:56 bde Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.28 1998/02/10 14:10:00 mrg Exp $ */
/*-
@ -70,7 +70,7 @@ static MALLOC_DEFINE(M_MSDOSFSNODE, "MSDOSFS node", "MSDOSFS vnode private part"
static struct denode **dehashtbl;
static u_long dehash; /* size of hash table - 1 */
#define DEHASH(dev, dcl, doff) (dehashtbl[((dev) + (dcl) + (doff) / \
#define DEHASH(dev, dcl, doff) (dehashtbl[(minor(dev) + (dcl) + (doff) / \
sizeof(struct direntry)) & dehash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock dehash_slock;

View File

@ -1,4 +1,4 @@
/* $Id: msdosfs_vnops.c,v 1.83 1999/04/28 11:37:27 phk Exp $ */
/* $Id: msdosfs_vnops.c,v 1.84 1999/05/06 18:12:51 peter Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.68 1998/02/10 14:10:04 mrg Exp $ */
/*-
@ -341,7 +341,7 @@ msdosfs_getattr(ap)
getnanotime(&ts);
DETIMES(dep, &ts, &ts, &ts);
vap->va_fsid = dep->de_dev;
vap->va_fsid = dev2udev(dep->de_dev);
/*
* The following computation of the fileid must be the same as that
* used in msdosfs_readdir() to compute d_fileno. If not, pwd

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
* $Id: nfs_subs.c,v 1.72 1999/01/27 22:42:27 dillon Exp $
* $Id: nfs_subs.c,v 1.73 1999/02/17 13:59:29 bde Exp $
*/
/*
@ -1260,7 +1260,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
if (v3) {
vtyp = nfsv3tov_type(fp->fa_type);
vmode = fxdr_unsigned(u_short, fp->fa_mode);
rdev = makedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
rdev = umakedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
fxdr_unsigned(int, fp->fa3_rdev.specdata2));
fxdr_nfsv3time(&fp->fa3_mtime, &mtime);
} else {
@ -1312,7 +1312,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
}
if (vp->v_type == VCHR || vp->v_type == VBLK) {
vp->v_op = spec_nfsv2nodeop_p;
nvp = checkalias(vp, (dev_t)rdev, vp->v_mount);
nvp = checkalias(vp, rdev, vp->v_mount);
if (nvp) {
/*
* Discard unneeded vnode, but save its nfsnode.
@ -1338,7 +1338,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
vap = &np->n_vattr;
vap->va_type = vtyp;
vap->va_mode = (vmode & 07777);
vap->va_rdev = (dev_t)rdev;
vap->va_rdev = rdev;
vap->va_mtime = mtime;
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
if (v3) {
@ -1862,8 +1862,8 @@ nfsm_srvfattr(nfsd, vap, fp)
fp->fa_mode = vtonfsv3_mode(vap->va_mode);
txdr_hyper(&vap->va_size, &fp->fa3_size);
txdr_hyper(&vap->va_bytes, &fp->fa3_used);
fp->fa3_rdev.specdata1 = txdr_unsigned(major(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(minor(vap->va_rdev));
fp->fa3_rdev.specdata1 = txdr_unsigned(umajor(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(uminor(vap->va_rdev));
fp->fa3_fsid.nfsuquad[0] = 0;
fp->fa3_fsid.nfsuquad[1] = txdr_unsigned(vap->va_fsid);
fp->fa3_fileid.nfsuquad[0] = 0;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95
* $Id: nfs_serv.c,v 1.75 1999/04/28 11:37:54 phk Exp $
* $Id: nfs_serv.c,v 1.76 1999/05/06 18:13:04 peter Exp $
*/
/*
@ -1453,7 +1453,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
nfsm_reply(0);
return (error);
} else
vap->va_rdev = (dev_t)rdev;
vap->va_rdev = rdev;
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
vput(nd.ni_dvp);
@ -1619,7 +1619,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
major = fxdr_unsigned(u_int32_t, *tl++);
minor = fxdr_unsigned(u_int32_t, *tl);
vap->va_rdev = makedev(major, minor);
vap->va_rdev = umakedev(major, minor);
}
/*

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
* $Id: nfs_subs.c,v 1.72 1999/01/27 22:42:27 dillon Exp $
* $Id: nfs_subs.c,v 1.73 1999/02/17 13:59:29 bde Exp $
*/
/*
@ -1260,7 +1260,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
if (v3) {
vtyp = nfsv3tov_type(fp->fa_type);
vmode = fxdr_unsigned(u_short, fp->fa_mode);
rdev = makedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
rdev = umakedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
fxdr_unsigned(int, fp->fa3_rdev.specdata2));
fxdr_nfsv3time(&fp->fa3_mtime, &mtime);
} else {
@ -1312,7 +1312,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
}
if (vp->v_type == VCHR || vp->v_type == VBLK) {
vp->v_op = spec_nfsv2nodeop_p;
nvp = checkalias(vp, (dev_t)rdev, vp->v_mount);
nvp = checkalias(vp, rdev, vp->v_mount);
if (nvp) {
/*
* Discard unneeded vnode, but save its nfsnode.
@ -1338,7 +1338,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
vap = &np->n_vattr;
vap->va_type = vtyp;
vap->va_mode = (vmode & 07777);
vap->va_rdev = (dev_t)rdev;
vap->va_rdev = rdev;
vap->va_mtime = mtime;
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
if (v3) {
@ -1862,8 +1862,8 @@ nfsm_srvfattr(nfsd, vap, fp)
fp->fa_mode = vtonfsv3_mode(vap->va_mode);
txdr_hyper(&vap->va_size, &fp->fa3_size);
txdr_hyper(&vap->va_bytes, &fp->fa3_used);
fp->fa3_rdev.specdata1 = txdr_unsigned(major(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(minor(vap->va_rdev));
fp->fa3_rdev.specdata1 = txdr_unsigned(umajor(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(uminor(vap->va_rdev));
fp->fa3_fsid.nfsuquad[0] = 0;
fp->fa3_fsid.nfsuquad[1] = txdr_unsigned(vap->va_fsid);
fp->fa3_fileid.nfsuquad[0] = 0;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
* $Id: nfs_vnops.c,v 1.127 1999/05/06 18:13:05 peter Exp $
* $Id: nfs_vnops.c,v 1.128 1999/05/06 20:00:30 phk Exp $
*/
@ -1242,8 +1242,8 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
nfsm_v3attrbuild(vap, FALSE);
if (vap->va_type == VCHR || vap->va_type == VBLK) {
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(major(vap->va_rdev));
*tl = txdr_unsigned(minor(vap->va_rdev));
*tl++ = txdr_unsigned(umajor(vap->va_rdev));
*tl = txdr_unsigned(uminor(vap->va_rdev));
}
} else {
nfsm_build(sp, struct nfsv2_sattr *, NFSX_V2SATTR);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
* $Id: nfs_subs.c,v 1.72 1999/01/27 22:42:27 dillon Exp $
* $Id: nfs_subs.c,v 1.73 1999/02/17 13:59:29 bde Exp $
*/
/*
@ -1260,7 +1260,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
if (v3) {
vtyp = nfsv3tov_type(fp->fa_type);
vmode = fxdr_unsigned(u_short, fp->fa_mode);
rdev = makedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
rdev = umakedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
fxdr_unsigned(int, fp->fa3_rdev.specdata2));
fxdr_nfsv3time(&fp->fa3_mtime, &mtime);
} else {
@ -1312,7 +1312,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
}
if (vp->v_type == VCHR || vp->v_type == VBLK) {
vp->v_op = spec_nfsv2nodeop_p;
nvp = checkalias(vp, (dev_t)rdev, vp->v_mount);
nvp = checkalias(vp, rdev, vp->v_mount);
if (nvp) {
/*
* Discard unneeded vnode, but save its nfsnode.
@ -1338,7 +1338,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
vap = &np->n_vattr;
vap->va_type = vtyp;
vap->va_mode = (vmode & 07777);
vap->va_rdev = (dev_t)rdev;
vap->va_rdev = rdev;
vap->va_mtime = mtime;
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
if (v3) {
@ -1862,8 +1862,8 @@ nfsm_srvfattr(nfsd, vap, fp)
fp->fa_mode = vtonfsv3_mode(vap->va_mode);
txdr_hyper(&vap->va_size, &fp->fa3_size);
txdr_hyper(&vap->va_bytes, &fp->fa3_used);
fp->fa3_rdev.specdata1 = txdr_unsigned(major(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(minor(vap->va_rdev));
fp->fa3_rdev.specdata1 = txdr_unsigned(umajor(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(uminor(vap->va_rdev));
fp->fa3_fsid.nfsuquad[0] = 0;
fp->fa3_fsid.nfsuquad[1] = txdr_unsigned(vap->va_fsid);
fp->fa3_fileid.nfsuquad[0] = 0;

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_vnops.c 8.16 (Berkeley) 5/27/95
* $Id: nfs_vnops.c,v 1.127 1999/05/06 18:13:05 peter Exp $
* $Id: nfs_vnops.c,v 1.128 1999/05/06 20:00:30 phk Exp $
*/
@ -1242,8 +1242,8 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
nfsm_v3attrbuild(vap, FALSE);
if (vap->va_type == VCHR || vap->va_type == VBLK) {
nfsm_build(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
*tl++ = txdr_unsigned(major(vap->va_rdev));
*tl = txdr_unsigned(minor(vap->va_rdev));
*tl++ = txdr_unsigned(umajor(vap->va_rdev));
*tl = txdr_unsigned(uminor(vap->va_rdev));
}
} else {
nfsm_build(sp, struct nfsv2_sattr *, NFSX_V2SATTR);

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_serv.c 8.8 (Berkeley) 7/31/95
* $Id: nfs_serv.c,v 1.75 1999/04/28 11:37:54 phk Exp $
* $Id: nfs_serv.c,v 1.76 1999/05/06 18:13:04 peter Exp $
*/
/*
@ -1453,7 +1453,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
nfsm_reply(0);
return (error);
} else
vap->va_rdev = (dev_t)rdev;
vap->va_rdev = rdev;
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
vput(nd.ni_dvp);
@ -1619,7 +1619,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
nfsm_dissect(tl, u_int32_t *, 2 * NFSX_UNSIGNED);
major = fxdr_unsigned(u_int32_t, *tl++);
minor = fxdr_unsigned(u_int32_t, *tl);
vap->va_rdev = makedev(major, minor);
vap->va_rdev = umakedev(major, minor);
}
/*

View File

@ -34,7 +34,7 @@
* SUCH DAMAGE.
*
* @(#)nfs_subs.c 8.8 (Berkeley) 5/22/95
* $Id: nfs_subs.c,v 1.72 1999/01/27 22:42:27 dillon Exp $
* $Id: nfs_subs.c,v 1.73 1999/02/17 13:59:29 bde Exp $
*/
/*
@ -1260,7 +1260,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
if (v3) {
vtyp = nfsv3tov_type(fp->fa_type);
vmode = fxdr_unsigned(u_short, fp->fa_mode);
rdev = makedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
rdev = umakedev(fxdr_unsigned(int, fp->fa3_rdev.specdata1),
fxdr_unsigned(int, fp->fa3_rdev.specdata2));
fxdr_nfsv3time(&fp->fa3_mtime, &mtime);
} else {
@ -1312,7 +1312,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
}
if (vp->v_type == VCHR || vp->v_type == VBLK) {
vp->v_op = spec_nfsv2nodeop_p;
nvp = checkalias(vp, (dev_t)rdev, vp->v_mount);
nvp = checkalias(vp, rdev, vp->v_mount);
if (nvp) {
/*
* Discard unneeded vnode, but save its nfsnode.
@ -1338,7 +1338,7 @@ nfs_loadattrcache(vpp, mdp, dposp, vaper)
vap = &np->n_vattr;
vap->va_type = vtyp;
vap->va_mode = (vmode & 07777);
vap->va_rdev = (dev_t)rdev;
vap->va_rdev = rdev;
vap->va_mtime = mtime;
vap->va_fsid = vp->v_mount->mnt_stat.f_fsid.val[0];
if (v3) {
@ -1862,8 +1862,8 @@ nfsm_srvfattr(nfsd, vap, fp)
fp->fa_mode = vtonfsv3_mode(vap->va_mode);
txdr_hyper(&vap->va_size, &fp->fa3_size);
txdr_hyper(&vap->va_bytes, &fp->fa3_used);
fp->fa3_rdev.specdata1 = txdr_unsigned(major(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(minor(vap->va_rdev));
fp->fa3_rdev.specdata1 = txdr_unsigned(umajor(vap->va_rdev));
fp->fa3_rdev.specdata2 = txdr_unsigned(uminor(vap->va_rdev));
fp->fa3_fsid.nfsuquad[0] = 0;
fp->fa3_fsid.nfsuquad[1] = txdr_unsigned(vap->va_fsid);
fp->fa3_fileid.nfsuquad[0] = 0;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95
* $Id: ntfs_ihash.c,v 1.2 1999/01/02 01:17:38 semen Exp $
* $Id: ntfs_ihash.c,v 1.3 1999/04/20 21:06:43 semenu Exp $
*/
#include <sys/param.h>
@ -53,7 +53,7 @@ MALLOC_DEFINE(M_NTFSNTHASH, "NTFS nthash", "NTFS ntnode hash tables");
*/
static LIST_HEAD(nthashhead, ntnode) *ntfs_nthashtbl;
static u_long ntfs_nthash; /* size of hash table - 1 */
#define NTNOHASH(device, inum) (&ntfs_nthashtbl[((device) + (inum)) & ntfs_nthash])
#define NTNOHASH(device, inum) (&ntfs_nthashtbl[(minor(device) + (inum)) & ntfs_nthash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock ntfs_nthash_slock;
#endif

View File

@ -23,7 +23,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ntfs_vfsops.c,v 1.3 1999/04/20 21:06:43 semenu Exp $
* $Id: ntfs_vfsops.c,v 1.4 1999/05/06 22:07:34 peter Exp $
*/
@ -500,7 +500,7 @@ ntfs_mountfs(devvp, mp, argsp, p)
vput(vp);
}
mp->mnt_stat.f_fsid.val[0] = (long)dev;
mp->mnt_stat.f_fsid.val[0] = dev2udev(dev);
#if __FreeBSD_version >= 300000
mp->mnt_stat.f_fsid.val[1] = mp->mnt_vfc->vfc_typenum;
#else

View File

@ -33,7 +33,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: ntfs_vnops.c,v 1.10 1999/02/02 03:15:13 semen Exp $
* $Id: ntfs_vnops.c,v 1.3 1999/04/20 21:06:43 semenu Exp $
*
*/
@ -215,13 +215,13 @@ ntfs_getattr(ap)
dprintf(("ntfs_getattr: %d, flags: %d\n",ip->i_number,ip->i_flag));
vap->va_fsid = fp->f_dev;
vap->va_fsid = dev2udev(fp->f_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->i_mode;
vap->va_nlink = ip->i_nlink;
vap->va_uid = ip->i_uid;
vap->va_gid = ip->i_gid;
vap->va_rdev = (dev_t)0;
vap->va_rdev = 0; /* XXX UNODEV ? */
vap->va_size = fp->f_size;
vap->va_bytes = fp->f_allocated;
vap->va_atime = ntfs_nttimetounix(fp->f_times.t_access);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
* $Id: conf.h,v 1.53 1999/05/09 08:58:44 phk Exp $
* $Id: conf.h,v 1.54 1999/05/09 13:00:50 phk Exp $
*/
#ifndef _SYS_CONF_H_
@ -142,7 +142,18 @@ static __inline
struct cdevsw *
bdevsw(dev_t dev)
{
struct cdevsw *c = cdevsw[bmaj2cmaj[major(dev)]];
struct cdevsw *c;
int i = major(dev);
if (bmaj2cmaj[i] == 254)
return 0;
c = cdevsw[bmaj2cmaj[major(dev)]];
if (!c) {
printf("bogus bdev dev_t %x, no cdev\n", dev);
Debugger("Bummer");
return 0;
}
/* CMAJ zero is the console, which has no strategy so this works */
if (c->d_strategy)
return (c);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)conf.h 8.5 (Berkeley) 1/9/95
* $Id: conf.h,v 1.53 1999/05/09 08:58:44 phk Exp $
* $Id: conf.h,v 1.54 1999/05/09 13:00:50 phk Exp $
*/
#ifndef _SYS_CONF_H_
@ -142,7 +142,18 @@ static __inline
struct cdevsw *
bdevsw(dev_t dev)
{
struct cdevsw *c = cdevsw[bmaj2cmaj[major(dev)]];
struct cdevsw *c;
int i = major(dev);
if (bmaj2cmaj[i] == 254)
return 0;
c = cdevsw[bmaj2cmaj[major(dev)]];
if (!c) {
printf("bogus bdev dev_t %x, no cdev\n", dev);
Debugger("Bummer");
return 0;
}
/* CMAJ zero is the console, which has no strategy so this works */
if (c->d_strategy)
return (c);

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)param.h 8.3 (Berkeley) 4/4/95
* $Id: param.h,v 1.45 1999/04/27 11:20:54 phk Exp $
* $Id: param.h,v 1.46 1999/05/09 08:58:45 phk Exp $
*/
#ifndef _SYS_PARAM_H_
@ -122,8 +122,13 @@
#define NBPW sizeof(int) /* number of bytes per word (integer) */
#define CMASK 022 /* default file mask: S_IWGRP|S_IWOTH */
#ifdef KERNEL
#define NODEV (dev_t)(-1) /* non-existent device */
#define NOUDEV (udev_t)(-1) /* non-existent device */
#define NOMAJ 256 /* non-existent device */
#else
#define NODEV (dev_t)(-1) /* non-existent device */
#endif
/*
* Clustering of hardware pages on machines with ridiculously small

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)stat.h 8.12 (Berkeley) 6/16/95
* $Id: stat.h,v 1.14 1998/02/25 02:00:44 bde Exp $
* $Id: stat.h,v 1.15 1998/05/11 03:55:13 dyson Exp $
*/
#ifndef _SYS_STAT_H_
@ -50,6 +50,12 @@
#include <sys/time.h>
#endif
#ifdef KERNEL
#define __devt udev_t
#else
#define __devt dev_t
#endif
#ifndef _POSIX_SOURCE
struct ostat {
u_int16_t st_dev; /* inode's device */
@ -71,13 +77,13 @@ struct ostat {
#endif /* !_POSIX_SOURCE */
struct stat {
dev_t st_dev; /* inode's device */
__devt st_dev; /* inode's device */
ino_t st_ino; /* inode's number */
mode_t st_mode; /* inode protection mode */
nlink_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of the file's owner */
gid_t st_gid; /* group ID of the file's group */
dev_t st_rdev; /* device type */
__devt st_rdev; /* device type */
#ifndef _POSIX_SOURCE
struct timespec st_atimespec; /* time of last access */
struct timespec st_mtimespec; /* time of last data modification */
@ -101,13 +107,13 @@ struct stat {
#ifndef _POSIX_SOURCE
struct nstat {
dev_t st_dev; /* inode's device */
__devt st_dev; /* inode's device */
ino_t st_ino; /* inode's number */
u_int32_t st_mode; /* inode protection mode */
u_int32_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of the file's owner */
gid_t st_gid; /* group ID of the file's group */
dev_t st_rdev; /* device type */
__devt st_rdev; /* device type */
#ifndef _POSIX_SOURCE
struct timespec st_atimespec; /* time of last access */
struct timespec st_mtimespec; /* time of last data modification */
@ -129,6 +135,8 @@ struct nstat {
};
#endif
#undef __devt
#ifndef _POSIX_SOURCE
#define st_atime st_atimespec.tv_sec
#define st_mtime st_mtimespec.tv_sec

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)systm.h 8.7 (Berkeley) 3/29/95
* $Id: systm.h,v 1.87 1999/03/11 15:09:40 phk Exp $
* $Id: systm.h,v 1.88 1999/04/21 07:26:30 peter Exp $
*/
#ifndef _SYS_SYSTM_H_
@ -305,4 +305,16 @@ int asleep __P((void *chan, int pri, const char *wmesg, int timo));
int await __P((int pri, int timo));
void wakeup __P((void *chan));
/*
* Common `dev_t' stuff are declared here to avoid #include poisoning
*/
int major(dev_t x);
int minor(dev_t x);
dev_t makedev(int x, int y);
udev_t dev2udev(dev_t x);
dev_t udev2dev(udev_t x, int b);
int uminor(udev_t dev);
int umajor(udev_t dev);
udev_t umakedev(int x, int y);
#endif /* !_SYS_SYSTM_H_ */

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)types.h 8.6 (Berkeley) 2/19/95
* $Id: types.h,v 1.29 1999/01/28 00:57:54 dillon Exp $
* $Id: types.h,v 1.30 1999/05/09 18:03:48 phk Exp $
*/
#ifndef _SYS_TYPES_H_
@ -71,7 +71,6 @@ typedef const char * c_caddr_t; /* core address, pointer to const */
typedef volatile char * v_caddr_t; /* core address, pointer to volatile */
typedef int32_t daddr_t; /* disk address */
typedef u_int32_t u_daddr_t; /* unsigned disk address */
typedef u_int32_t dev_t; /* device number */
typedef u_int32_t fixpt_t; /* fixed point number */
typedef u_int32_t gid_t; /* group id */
typedef u_int32_t ino_t; /* inode number */
@ -96,32 +95,35 @@ typedef u_int64_t uoff_t;
typedef struct vm_page *vm_page_t;
#endif
#ifdef KERNEL
typedef u_int32_t udev_t; /* device number */
typedef u_int32_t dev_t;
#else /* !KERNEL */
typedef u_int32_t dev_t; /* device number */
#ifndef _POSIX_SOURCE
/*
* minor() gives a cookie instead of an index since we don't want to
* change the meanings of bits 0-15 or waste time and space shifting
* bits 16-31 for devices that don't use them.
*/
static __inline int
minor(dev_t dev)
{
return(dev & 0xffff00ff);
}
/*
* minor() gives a cookie instead of an index since we don't want to
* change the meanings of bits 0-15 or waste time and space shifting
* bits 16-31 for devices that don't use them.
*/
#define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */
#define minor(x) ((int)((x)&0xffff00ff)) /* minor number */
#define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */
static __inline int
major(dev_t dev)
{
return((dev & 0xff00) >> 8);
}
#endif /* _POSIX_SOURCE */
static __inline dev_t
makedev(int x, int y)
{
return ((x << 8) | y);
}
#endif
#endif /* !KERNEL */
#include <machine/endian.h>

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)vnode.h 8.7 (Berkeley) 2/4/94
* $Id: vnode.h,v 1.85 1999/02/19 17:41:14 dillon Exp $
* $Id: vnode.h,v 1.86 1999/04/17 08:36:06 peter Exp $
*/
#ifndef _SYS_VNODE_H_
@ -183,7 +183,7 @@ struct vattr {
struct timespec va_ctime; /* time file changed */
u_long va_gen; /* generation number of file */
u_long va_flags; /* flags defined for file */
dev_t va_rdev; /* device the special file represents */
udev_t va_rdev; /* device the special file represents */
u_quad_t va_bytes; /* bytes of disk space held by file */
u_quad_t va_filerev; /* file modification number */
u_int va_vaflags; /* operations flags, see below */
@ -543,7 +543,7 @@ int vop_null __P((struct vop_generic_args *ap));
int vop_panic __P((struct vop_generic_args *ap));
struct vnode *
checkalias __P((struct vnode *vp, dev_t nvp_rdev, struct mount *mp));
checkalias __P((struct vnode *vp, udev_t nvp_rdev, struct mount *mp));
void vput __P((struct vnode *vp));
void vrele __P((struct vnode *vp));
void vref __P((struct vnode *vp));

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)mfs_vfsops.c 8.11 (Berkeley) 6/19/95
* $Id: mfs_vfsops.c,v 1.60 1999/04/21 09:41:07 dt Exp $
* $Id: mfs_vfsops.c,v 1.61 1999/05/10 17:12:45 peter Exp $
*/
@ -309,7 +309,7 @@ mfs_mount(mp, path, data, ndp, p)
goto error_1;
}
devvp->v_type = VBLK;
if (checkalias(devvp, makedev(255, mfs_minor++), (struct mount *)0))
if (checkalias(devvp, umakedev(255, mfs_minor++), (struct mount *)0))
panic("mfs_mount: dup dev");
devvp->v_data = mfsp;
mfsp->mfs_baseoff = args.base;

View File

@ -31,7 +31,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_ihash.c 8.7 (Berkeley) 5/17/95
* $Id: ufs_ihash.c,v 1.17 1998/11/10 09:16:27 peter Exp $
* $Id: ufs_ihash.c,v 1.18 1999/01/02 11:34:56 bde Exp $
*/
#include <sys/param.h>
@ -52,7 +52,7 @@ static MALLOC_DEFINE(M_UFSIHASH, "UFS ihash", "UFS Inode hash tables");
*/
static LIST_HEAD(ihashhead, inode) *ihashtbl;
static u_long ihash; /* size of hash table - 1 */
#define INOHASH(device, inum) (&ihashtbl[((device) + (inum)) & ihash])
#define INOHASH(device, inum) (&ihashtbl[(minor(device) + (inum)) & ihash])
#ifndef NULL_SIMPLELOCKS
static struct simplelock ufs_ihash_slock;
#endif

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)ufs_vnops.c 8.27 (Berkeley) 5/27/95
* $Id: ufs_vnops.c,v 1.112 1999/04/27 11:18:44 phk Exp $
* $Id: ufs_vnops.c,v 1.113 1999/04/28 11:38:20 phk Exp $
*/
#include "opt_quota.h"
@ -380,13 +380,13 @@ ufs_getattr(ap)
/*
* Copy from inode table
*/
vap->va_fsid = ip->i_dev;
vap->va_fsid = dev2udev(ip->i_dev);
vap->va_fileid = ip->i_number;
vap->va_mode = ip->i_mode & ~IFMT;
vap->va_nlink = ip->i_effnlink;
vap->va_uid = ip->i_uid;
vap->va_gid = ip->i_gid;
vap->va_rdev = (dev_t)ip->i_rdev;
vap->va_rdev = ip->i_rdev;
vap->va_size = ip->i_din.di_size;
vap->va_atime.tv_sec = ip->i_atime;
vap->va_atime.tv_nsec = ip->i_atimensec;

View File

@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* @(#)device_pager.c 8.1 (Berkeley) 6/11/93
* $Id: device_pager.c,v 1.39 1999/01/24 02:32:14 dillon Exp $
* $Id: device_pager.c,v 1.40 1999/05/08 06:40:29 phk Exp $
*/
#include <sys/param.h>
@ -103,7 +103,7 @@ dev_pager_alloc(void *handle, vm_ooffset_t size, vm_prot_t prot, vm_ooffset_t fo
/*
* Make sure this device can be mapped.
*/
dev = (dev_t) (uintptr_t) handle;
dev = udev2dev((uintptr_t) handle, 2);
mapfunc = devsw(dev)->d_mmap;
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop) {
printf("obsolete map function %p\n", (void *)mapfunc);
@ -199,7 +199,7 @@ dev_pager_getpages(object, m, count, reqpage)
d_mmap_t *mapfunc;
int prot;
dev = (dev_t) (uintptr_t) object->handle;
dev = udev2dev((uintptr_t) object->handle, 2);
offset = m[reqpage]->pindex;
prot = PROT_READ; /* XXX should pass in? */
mapfunc = devsw(dev)->d_mmap;
@ -207,7 +207,7 @@ dev_pager_getpages(object, m, count, reqpage)
if (mapfunc == NULL || mapfunc == (d_mmap_t *)nullop)
panic("dev_pager_getpage: no map function");
paddr = pmap_phys_address((*mapfunc) ((dev_t) dev, (vm_offset_t) offset << PAGE_SHIFT, prot));
paddr = pmap_phys_address((*mapfunc) (dev, (vm_offset_t) offset << PAGE_SHIFT, prot));
KASSERT(paddr != -1,("dev_pager_getpage: map function returns error"));
/*
* Replace the passed in reqpage page with our own fake page and free up the