Move details of dev_t (and udev_t) to <sys/_types.h>.

This commit is contained in:
mike 2003-03-28 15:27:30 +00:00
parent d6b685fe45
commit 70f89c52b8
4 changed files with 28 additions and 31 deletions

@ -53,6 +53,7 @@ typedef __uint8_t __sa_family_t;
typedef __uint32_t __socklen_t; typedef __uint32_t __socklen_t;
typedef long __suseconds_t; /* microseconds (signed) */ typedef long __suseconds_t; /* microseconds (signed) */
typedef __int32_t __timer_t; /* timer_gettime()... */ typedef __int32_t __timer_t; /* timer_gettime()... */
typedef __uint32_t __udev_t; /* device number */
typedef __uint32_t __uid_t; typedef __uint32_t __uid_t;
typedef unsigned int __useconds_t; /* microseconds (unsigned) */ typedef unsigned int __useconds_t; /* microseconds (unsigned) */
@ -79,6 +80,16 @@ typedef __ct_rune_t __rune_t;
typedef __ct_rune_t __wchar_t; typedef __ct_rune_t __wchar_t;
typedef __ct_rune_t __wint_t; typedef __ct_rune_t __wint_t;
/*
* dev_t has differing meanings in userland and the kernel.
*/
#ifdef _KERNEL
struct cdev;
typedef struct cdev *__dev_t;
#else
typedef __udev_t __dev_t; /* device number */
#endif
/* /*
* mbstate_t is an opaque object to keep conversion state during multibyte * mbstate_t is an opaque object to keep conversion state during multibyte
* stream conversions. * stream conversions.

@ -49,12 +49,6 @@
*/ */
typedef u_int16_t comp_t; typedef u_int16_t comp_t;
#ifdef _KERNEL
#define __dev_t udev_t
#else
#define __dev_t dev_t
#endif
#define AC_COMM_LEN 16 #define AC_COMM_LEN 16
struct acct { struct acct {
char ac_comm[AC_COMM_LEN]; /* command name */ char ac_comm[AC_COMM_LEN]; /* command name */
@ -66,7 +60,7 @@ struct acct {
gid_t ac_gid; /* group id */ gid_t ac_gid; /* group id */
u_int16_t ac_mem; /* average memory usage */ u_int16_t ac_mem; /* average memory usage */
comp_t ac_io; /* count of IO blocks */ comp_t ac_io; /* count of IO blocks */
__dev_t ac_tty; /* controlling tty */ __udev_t ac_tty; /* controlling tty */
#define AFORK 0x01 /* forked but not exec'ed */ #define AFORK 0x01 /* forked but not exec'ed */
/* ASU is no longer supported */ /* ASU is no longer supported */
@ -76,7 +70,6 @@ struct acct {
#define AXSIG 0x10 /* killed by a signal */ #define AXSIG 0x10 /* killed by a signal */
u_int8_t ac_flag; /* accounting flags */ u_int8_t ac_flag; /* accounting flags */
}; };
#undef __dev_t
/* /*
* 1/AHZ is the granularity of the data encoded in the comp_t fields. * 1/AHZ is the granularity of the data encoded in the comp_t fields.

@ -45,7 +45,12 @@
#include <sys/cdefs.h> #include <sys/cdefs.h>
#include <sys/_types.h> #include <sys/_types.h>
/* XXX missing blkcnt_t, blksize_t, dev_t. */ /* XXX missing blkcnt_t, blksize_t. */
#ifndef _DEV_T_DECLARED
typedef __dev_t dev_t;
#define _DEV_T_DECLARED
#endif
#ifndef _FFLAGS_T_DECLARED #ifndef _FFLAGS_T_DECLARED
typedef __fflags_t fflags_t; typedef __fflags_t fflags_t;
@ -99,12 +104,6 @@ typedef __uid_t uid_t;
#include <sys/_timespec.h> #include <sys/_timespec.h>
#endif #endif
#ifdef _KERNEL /* XXX __dev_t should be in <sys/_types.h>. */
#define __dev_t udev_t
#else
#define __dev_t dev_t
#endif
#if __BSD_VISIBLE #if __BSD_VISIBLE
struct ostat { struct ostat {
__uint16_t st_dev; /* inode's device */ __uint16_t st_dev; /* inode's device */
@ -126,13 +125,13 @@ struct ostat {
#endif /* __BSD_VISIBLE */ #endif /* __BSD_VISIBLE */
struct stat { struct stat {
__dev_t st_dev; /* inode's device */ __udev_t st_dev; /* inode's device */
ino_t st_ino; /* inode's number */ ino_t st_ino; /* inode's number */
mode_t st_mode; /* inode protection mode */ mode_t st_mode; /* inode protection mode */
nlink_t st_nlink; /* number of hard links */ nlink_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of the file's owner */ uid_t st_uid; /* user ID of the file's owner */
gid_t st_gid; /* group ID of the file's group */ gid_t st_gid; /* group ID of the file's group */
__dev_t st_rdev; /* device type */ __udev_t st_rdev; /* device type */
#if __BSD_VISIBLE #if __BSD_VISIBLE
struct timespec st_atimespec; /* time of last access */ struct timespec st_atimespec; /* time of last access */
struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_mtimespec; /* time of last data modification */
@ -173,13 +172,13 @@ struct stat {
#if __BSD_VISIBLE #if __BSD_VISIBLE
struct nstat { struct nstat {
__dev_t st_dev; /* inode's device */ __udev_t st_dev; /* inode's device */
ino_t st_ino; /* inode's number */ ino_t st_ino; /* inode's number */
__uint32_t st_mode; /* inode protection mode */ __uint32_t st_mode; /* inode protection mode */
__uint32_t st_nlink; /* number of hard links */ __uint32_t st_nlink; /* number of hard links */
uid_t st_uid; /* user ID of the file's owner */ uid_t st_uid; /* user ID of the file's owner */
gid_t st_gid; /* group ID of the file's group */ gid_t st_gid; /* group ID of the file's group */
__dev_t st_rdev; /* device type */ __udev_t st_rdev; /* device type */
struct timespec st_atimespec; /* time of last access */ struct timespec st_atimespec; /* time of last access */
struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_mtimespec; /* time of last data modification */
struct timespec st_ctimespec; /* time of last file status change */ struct timespec st_ctimespec; /* time of last file status change */
@ -197,8 +196,6 @@ struct nstat {
}; };
#endif #endif
#undef __dev_t
#if __BSD_VISIBLE #if __BSD_VISIBLE
#define st_atime st_atimespec.tv_sec #define st_atime st_atimespec.tv_sec
#define st_mtime st_mtimespec.tv_sec #define st_mtime st_mtimespec.tv_sec

@ -132,6 +132,11 @@ typedef __clockid_t clockid_t;
typedef __critical_t critical_t; /* Critical section value */ typedef __critical_t critical_t; /* Critical section value */
typedef __int64_t daddr_t; /* disk address */ typedef __int64_t daddr_t; /* disk address */
#ifndef _DEV_T_DECLARED
typedef __dev_t dev_t; /* device number or struct cdev */
#define _DEV_T_DECLARED
#endif
#ifndef _FFLAGS_T_DECLARED #ifndef _FFLAGS_T_DECLARED
typedef __fflags_t fflags_t; /* file flags */ typedef __fflags_t fflags_t; /* file flags */
#define _FFLAGS_T_DECLARED #define _FFLAGS_T_DECLARED
@ -230,6 +235,7 @@ typedef __timer_t timer_t;
#endif #endif
typedef __u_register_t u_register_t; typedef __u_register_t u_register_t;
typedef __udev_t udev_t; /* device number */
#ifndef _UID_T_DECLARED #ifndef _UID_T_DECLARED
typedef __uid_t uid_t; /* user id */ typedef __uid_t uid_t; /* user id */
@ -265,18 +271,8 @@ typedef __uintfptr_t uintfptr_t;
typedef __uint64_t uoff_t; typedef __uint64_t uoff_t;
typedef struct vm_page *vm_page_t; typedef struct vm_page *vm_page_t;
struct cdev;
typedef __uint32_t udev_t; /* device number */
typedef struct cdev *dev_t;
#define offsetof(type, field) __offsetof(type, field) #define offsetof(type, field) __offsetof(type, field)
#else /* !_KERNEL */
typedef __uint32_t dev_t; /* device number */
#define udev_t dev_t
#endif /* !_KERNEL */ #endif /* !_KERNEL */
/* /*