From 70f89c52b847076a353c28b1b081c645af2e39e8 Mon Sep 17 00:00:00 2001 From: mike Date: Fri, 28 Mar 2003 15:27:30 +0000 Subject: [PATCH] Move details of dev_t (and udev_t) to . --- sys/sys/_types.h | 11 +++++++++++ sys/sys/acct.h | 9 +-------- sys/sys/stat.h | 23 ++++++++++------------- sys/sys/types.h | 16 ++++++---------- 4 files changed, 28 insertions(+), 31 deletions(-) diff --git a/sys/sys/_types.h b/sys/sys/_types.h index 09b158680847..f9f00f2453b2 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -53,6 +53,7 @@ typedef __uint8_t __sa_family_t; typedef __uint32_t __socklen_t; typedef long __suseconds_t; /* microseconds (signed) */ typedef __int32_t __timer_t; /* timer_gettime()... */ +typedef __uint32_t __udev_t; /* device number */ typedef __uint32_t __uid_t; 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 __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 * stream conversions. diff --git a/sys/sys/acct.h b/sys/sys/acct.h index 8e1b294f61e6..d0ff9475511c 100644 --- a/sys/sys/acct.h +++ b/sys/sys/acct.h @@ -49,12 +49,6 @@ */ 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 struct acct { char ac_comm[AC_COMM_LEN]; /* command name */ @@ -66,7 +60,7 @@ struct acct { gid_t ac_gid; /* group id */ u_int16_t ac_mem; /* average memory usage */ 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 */ /* ASU is no longer supported */ @@ -76,7 +70,6 @@ struct acct { #define AXSIG 0x10 /* killed by a signal */ u_int8_t ac_flag; /* accounting flags */ }; -#undef __dev_t /* * 1/AHZ is the granularity of the data encoded in the comp_t fields. diff --git a/sys/sys/stat.h b/sys/sys/stat.h index d2e8dfbc0509..2c830a688a20 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -45,7 +45,12 @@ #include #include -/* 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 typedef __fflags_t fflags_t; @@ -99,12 +104,6 @@ typedef __uid_t uid_t; #include #endif -#ifdef _KERNEL /* XXX __dev_t should be in . */ -#define __dev_t udev_t -#else -#define __dev_t dev_t -#endif - #if __BSD_VISIBLE struct ostat { __uint16_t st_dev; /* inode's device */ @@ -126,13 +125,13 @@ struct ostat { #endif /* __BSD_VISIBLE */ struct stat { - __dev_t st_dev; /* inode's device */ + __udev_t 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 */ + __udev_t st_rdev; /* device type */ #if __BSD_VISIBLE struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ @@ -173,13 +172,13 @@ struct stat { #if __BSD_VISIBLE struct nstat { - __dev_t st_dev; /* inode's device */ + __udev_t st_dev; /* inode's device */ ino_t st_ino; /* inode's number */ __uint32_t st_mode; /* inode protection mode */ __uint32_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 */ + __udev_t st_rdev; /* device type */ struct timespec st_atimespec; /* time of last access */ struct timespec st_mtimespec; /* time of last data modification */ struct timespec st_ctimespec; /* time of last file status change */ @@ -197,8 +196,6 @@ struct nstat { }; #endif -#undef __dev_t - #if __BSD_VISIBLE #define st_atime st_atimespec.tv_sec #define st_mtime st_mtimespec.tv_sec diff --git a/sys/sys/types.h b/sys/sys/types.h index 57d271992b5b..d20581ce7418 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -132,6 +132,11 @@ typedef __clockid_t clockid_t; typedef __critical_t critical_t; /* Critical section value */ 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 typedef __fflags_t fflags_t; /* file flags */ #define _FFLAGS_T_DECLARED @@ -230,6 +235,7 @@ typedef __timer_t timer_t; #endif typedef __u_register_t u_register_t; +typedef __udev_t udev_t; /* device number */ #ifndef _UID_T_DECLARED typedef __uid_t uid_t; /* user id */ @@ -265,18 +271,8 @@ typedef __uintfptr_t uintfptr_t; typedef __uint64_t uoff_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) -#else /* !_KERNEL */ - -typedef __uint32_t dev_t; /* device number */ -#define udev_t dev_t - #endif /* !_KERNEL */ /*