Rename struct specinfo to the more appropriate struct cdev.
Agreed on: jake, rwatson, jhb
This commit is contained in:
parent
c5e827ebc8
commit
ca916247cd
@ -500,7 +500,7 @@ ntfs_unmount(
|
|||||||
printf("ntfs_unmount: vflush failed(sysnodes): %d\n",error);
|
printf("ntfs_unmount: vflush failed(sysnodes): %d\n",error);
|
||||||
|
|
||||||
/* Check if the type of device node isn't VBAD before
|
/* Check if the type of device node isn't VBAD before
|
||||||
* touching v_specinfo. If the device vnode is revoked, the
|
* touching v_cdev. If the device vnode is revoked, the
|
||||||
* field is NULL and touching it causes null pointer derefercence.
|
* field is NULL and touching it causes null pointer derefercence.
|
||||||
*/
|
*/
|
||||||
if (ntmp->ntm_devvp->v_type != VBAD)
|
if (ntmp->ntm_devvp->v_type != VBAD)
|
||||||
|
@ -56,11 +56,11 @@ static MALLOC_DEFINE(M_DEVT, "dev_t", "dev_t storage");
|
|||||||
/* The number of dev_t's we can create before malloc(9) kick in. */
|
/* The number of dev_t's we can create before malloc(9) kick in. */
|
||||||
#define DEVT_STASH 50
|
#define DEVT_STASH 50
|
||||||
|
|
||||||
static struct specinfo devt_stash[DEVT_STASH];
|
static struct cdev devt_stash[DEVT_STASH];
|
||||||
|
|
||||||
static LIST_HEAD(, specinfo) dev_hash[DEVT_HASH];
|
static LIST_HEAD(, cdev) dev_hash[DEVT_HASH];
|
||||||
|
|
||||||
static LIST_HEAD(, specinfo) dev_free;
|
static LIST_HEAD(, cdev) dev_free;
|
||||||
|
|
||||||
devfs_create_t *devfs_create_hook;
|
devfs_create_t *devfs_create_hook;
|
||||||
devfs_destroy_t *devfs_destroy_hook;
|
devfs_destroy_t *devfs_destroy_hook;
|
||||||
@ -173,13 +173,13 @@ static dev_t
|
|||||||
allocdev(void)
|
allocdev(void)
|
||||||
{
|
{
|
||||||
static int stashed;
|
static int stashed;
|
||||||
struct specinfo *si;
|
struct cdev *si;
|
||||||
|
|
||||||
if (LIST_FIRST(&dev_free)) {
|
if (LIST_FIRST(&dev_free)) {
|
||||||
si = LIST_FIRST(&dev_free);
|
si = LIST_FIRST(&dev_free);
|
||||||
LIST_REMOVE(si, si_hash);
|
LIST_REMOVE(si, si_hash);
|
||||||
} else if (stashed >= DEVT_STASH) {
|
} else if (stashed >= DEVT_STASH) {
|
||||||
MALLOC(si, struct specinfo *, sizeof(*si), M_DEVT,
|
MALLOC(si, struct cdev *, sizeof(*si), M_DEVT,
|
||||||
M_USE_RESERVE | M_ZERO);
|
M_USE_RESERVE | M_ZERO);
|
||||||
} else {
|
} else {
|
||||||
si = devt_stash + stashed++;
|
si = devt_stash + stashed++;
|
||||||
@ -194,7 +194,7 @@ allocdev(void)
|
|||||||
dev_t
|
dev_t
|
||||||
makedev(int x, int y)
|
makedev(int x, int y)
|
||||||
{
|
{
|
||||||
struct specinfo *si;
|
struct cdev *si;
|
||||||
udev_t udev;
|
udev_t udev;
|
||||||
int hash;
|
int hash;
|
||||||
|
|
||||||
|
@ -321,8 +321,8 @@ SYSCTL_INT(_debug_sizeof, OID_AUTO, proc, CTLFLAG_RD,
|
|||||||
0, sizeof(struct proc), "sizeof(struct proc)");
|
0, sizeof(struct proc), "sizeof(struct proc)");
|
||||||
|
|
||||||
#include <sys/conf.h>
|
#include <sys/conf.h>
|
||||||
SYSCTL_INT(_debug_sizeof, OID_AUTO, specinfo, CTLFLAG_RD,
|
SYSCTL_INT(_debug_sizeof, OID_AUTO, cdev, CTLFLAG_RD,
|
||||||
0, sizeof(struct specinfo), "sizeof(struct specinfo)");
|
0, sizeof(struct cdev), "sizeof(struct cdev)");
|
||||||
|
|
||||||
#include <sys/bio.h>
|
#include <sys/bio.h>
|
||||||
#include <sys/buf.h>
|
#include <sys/buf.h>
|
||||||
|
@ -53,7 +53,7 @@ struct vnode;
|
|||||||
struct buf;
|
struct buf;
|
||||||
TAILQ_HEAD(snaphead, inode);
|
TAILQ_HEAD(snaphead, inode);
|
||||||
|
|
||||||
struct specinfo {
|
struct cdev {
|
||||||
u_int si_flags;
|
u_int si_flags;
|
||||||
#define SI_STASHED 0x0001 /* created in stashed storage */
|
#define SI_STASHED 0x0001 /* created in stashed storage */
|
||||||
#define SI_ALIAS 0x0002 /* carrier of alias name */
|
#define SI_ALIAS 0x0002 /* carrier of alias name */
|
||||||
@ -67,10 +67,10 @@ struct specinfo {
|
|||||||
struct timespec si_ctime;
|
struct timespec si_ctime;
|
||||||
struct timespec si_mtime;
|
struct timespec si_mtime;
|
||||||
udev_t si_udev;
|
udev_t si_udev;
|
||||||
LIST_ENTRY(specinfo) si_hash;
|
LIST_ENTRY(cdev) si_hash;
|
||||||
SLIST_HEAD(, vnode) si_hlist;
|
SLIST_HEAD(, vnode) si_hlist;
|
||||||
LIST_HEAD(, specinfo) si_children;
|
LIST_HEAD(, cdev) si_children;
|
||||||
LIST_ENTRY(specinfo) si_siblings;
|
LIST_ENTRY(cdev) si_siblings;
|
||||||
dev_t si_parent;
|
dev_t si_parent;
|
||||||
struct snaphead si_snapshots;
|
struct snaphead si_snapshots;
|
||||||
int (*si_copyonwrite)(struct vnode *, struct buf *);
|
int (*si_copyonwrite)(struct vnode *, struct buf *);
|
||||||
|
@ -53,7 +53,7 @@ struct vnode;
|
|||||||
struct buf;
|
struct buf;
|
||||||
TAILQ_HEAD(snaphead, inode);
|
TAILQ_HEAD(snaphead, inode);
|
||||||
|
|
||||||
struct specinfo {
|
struct cdev {
|
||||||
u_int si_flags;
|
u_int si_flags;
|
||||||
#define SI_STASHED 0x0001 /* created in stashed storage */
|
#define SI_STASHED 0x0001 /* created in stashed storage */
|
||||||
#define SI_ALIAS 0x0002 /* carrier of alias name */
|
#define SI_ALIAS 0x0002 /* carrier of alias name */
|
||||||
@ -67,10 +67,10 @@ struct specinfo {
|
|||||||
struct timespec si_ctime;
|
struct timespec si_ctime;
|
||||||
struct timespec si_mtime;
|
struct timespec si_mtime;
|
||||||
udev_t si_udev;
|
udev_t si_udev;
|
||||||
LIST_ENTRY(specinfo) si_hash;
|
LIST_ENTRY(cdev) si_hash;
|
||||||
SLIST_HEAD(, vnode) si_hlist;
|
SLIST_HEAD(, vnode) si_hlist;
|
||||||
LIST_HEAD(, specinfo) si_children;
|
LIST_HEAD(, cdev) si_children;
|
||||||
LIST_ENTRY(specinfo) si_siblings;
|
LIST_ENTRY(cdev) si_siblings;
|
||||||
dev_t si_parent;
|
dev_t si_parent;
|
||||||
struct snaphead si_snapshots;
|
struct snaphead si_snapshots;
|
||||||
int (*si_copyonwrite)(struct vnode *, struct buf *);
|
int (*si_copyonwrite)(struct vnode *, struct buf *);
|
||||||
|
@ -187,10 +187,10 @@ typedef __uintfptr_t uintfptr_t;
|
|||||||
typedef u_int64_t uoff_t;
|
typedef u_int64_t uoff_t;
|
||||||
typedef struct vm_page *vm_page_t;
|
typedef struct vm_page *vm_page_t;
|
||||||
|
|
||||||
struct specinfo;
|
struct cdev;
|
||||||
|
|
||||||
typedef u_int32_t udev_t; /* device number */
|
typedef u_int32_t udev_t; /* device number */
|
||||||
typedef struct specinfo *dev_t;
|
typedef struct cdev *dev_t;
|
||||||
|
|
||||||
#define offsetof(type, field) __offsetof(type, field)
|
#define offsetof(type, field) __offsetof(type, field)
|
||||||
|
|
||||||
|
@ -121,7 +121,7 @@ struct vnode {
|
|||||||
struct mount *vu_mountedhere;/* v ptr to mounted vfs (VDIR) */
|
struct mount *vu_mountedhere;/* v ptr to mounted vfs (VDIR) */
|
||||||
struct socket *vu_socket; /* v unix ipc (VSOCK) */
|
struct socket *vu_socket; /* v unix ipc (VSOCK) */
|
||||||
struct {
|
struct {
|
||||||
struct specinfo *vu_specinfo; /* v device (VCHR, VBLK) */
|
struct cdev *vu_cdev; /* v device (VCHR, VBLK) */
|
||||||
SLIST_ENTRY(vnode) vu_specnext; /* s device aliases */
|
SLIST_ENTRY(vnode) vu_specnext; /* s device aliases */
|
||||||
} vu_spec;
|
} vu_spec;
|
||||||
struct fifoinfo *vu_fifoinfo; /* v fifo (VFIFO) */
|
struct fifoinfo *vu_fifoinfo; /* v fifo (VFIFO) */
|
||||||
@ -152,7 +152,7 @@ struct vnode {
|
|||||||
};
|
};
|
||||||
#define v_mountedhere v_un.vu_mountedhere
|
#define v_mountedhere v_un.vu_mountedhere
|
||||||
#define v_socket v_un.vu_socket
|
#define v_socket v_un.vu_socket
|
||||||
#define v_rdev v_un.vu_spec.vu_specinfo
|
#define v_rdev v_un.vu_spec.vu_cdev
|
||||||
#define v_specnext v_un.vu_spec.vu_specnext
|
#define v_specnext v_un.vu_spec.vu_specnext
|
||||||
#define v_fifoinfo v_un.vu_fifoinfo
|
#define v_fifoinfo v_un.vu_fifoinfo
|
||||||
|
|
||||||
|
@ -872,14 +872,14 @@ socktrans(sock, i)
|
|||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Read the specinfo structure in the kernel (as pointed to by a dev_t)
|
* Read the cdev structure in the kernel (as pointed to by a dev_t)
|
||||||
* in order to work out the associated udev_t
|
* in order to work out the associated udev_t
|
||||||
*/
|
*/
|
||||||
udev_t
|
udev_t
|
||||||
dev2udev(dev)
|
dev2udev(dev)
|
||||||
dev_t dev;
|
dev_t dev;
|
||||||
{
|
{
|
||||||
struct specinfo si;
|
struct cdev si;
|
||||||
|
|
||||||
if (KVM_READ(dev, &si, sizeof si)) {
|
if (KVM_READ(dev, &si, sizeof si)) {
|
||||||
return si.si_udev;
|
return si.si_udev;
|
||||||
|
Loading…
Reference in New Issue
Block a user