From be14597995499c5e3908927ef30778158955be40 Mon Sep 17 00:00:00 2001 From: krw Date: Fri, 22 Aug 2014 23:05:15 +0000 Subject: [PATCH] POSIX/FreeBSD/NetBSD/Linux/etc agree -- blk[size|cnt]_t is the bomb. So add the types blksize_t (a.k.a. int32_t) and blkcnt_t (a.k.a. int64_t). Use blkcnt_t in stat.h since the base type (int64_t) does not change. blksize_t in stat.h will follow after the tree is audited for signed issues, since the base type will change from u_int32_t to a POSIX compliant int32_t. Guidance and feedback from guenther@ ok millert@ --- lib/libc/sys/stat.2 | 6 +++--- sys/sys/_types.h | 4 +++- sys/sys/stat.h | 4 ++-- sys/sys/types.h | 4 +++- 4 files changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/libc/sys/stat.2 b/lib/libc/sys/stat.2 index bdbb2576d05..428086c3848 100644 --- a/lib/libc/sys/stat.2 +++ b/lib/libc/sys/stat.2 @@ -1,4 +1,4 @@ -.\" $OpenBSD: stat.2,v 1.40 2014/02/13 07:30:39 guenther Exp $ +.\" $OpenBSD: stat.2,v 1.41 2014/08/22 23:05:15 krw Exp $ .\" .\" Copyright (c) 1980, 1991, 1993, 1994 .\" The Regents of the University of California. All rights reserved. @@ -29,7 +29,7 @@ .\" .\" @(#)stat.2 8.3 (Berkeley) 4/19/94 .\" -.Dd $Mdocdate: February 13 2014 $ +.Dd $Mdocdate: August 22 2014 $ .Dt STAT 2 .Os .Sh NAME @@ -141,7 +141,7 @@ struct stat { struct timespec st_mtim; /* time of last data modification */ struct timespec st_ctim; /* time of last file status change */ off_t st_size; /* file size, in bytes */ - int64_t st_blocks; /* blocks allocated for file */ + blkcnt_t st_blocks; /* blocks allocated for file */ u_int32_t st_blksize;/* optimal blocksize for I/O */ u_int32_t st_flags; /* user defined flags for file */ u_int32_t st_gen; /* file generation number */ diff --git a/sys/sys/_types.h b/sys/sys/_types.h index ba924d9f084..e05867429cd 100644 --- a/sys/sys/_types.h +++ b/sys/sys/_types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: _types.h,v 1.8 2013/10/24 07:34:56 guenther Exp $ */ +/* $OpenBSD: _types.h,v 1.9 2014/08/22 23:05:15 krw Exp $ */ /*- * Copyright (c) 1990, 1993 @@ -36,6 +36,8 @@ #include +typedef __int64_t __blkcnt_t; /* blocks allocated for file */ +typedef __int32_t __blksize_t; /* optimal blocksize for I/O */ typedef __int64_t __clock_t; /* ticks in CLOCKS_PER_SEC */ typedef __int32_t __clockid_t; /* CLOCK_* identifiers */ typedef unsigned long __cpuid_t; /* CPU id */ diff --git a/sys/sys/stat.h b/sys/sys/stat.h index c50860e2e9f..fc8b6393efc 100644 --- a/sys/sys/stat.h +++ b/sys/sys/stat.h @@ -1,4 +1,4 @@ -/* $OpenBSD: stat.h,v 1.24 2013/09/14 01:35:02 guenther Exp $ */ +/* $OpenBSD: stat.h,v 1.25 2014/08/22 23:05:15 krw Exp $ */ /* $NetBSD: stat.h,v 1.20 1996/05/16 22:17:49 cgd Exp $ */ /*- @@ -63,7 +63,7 @@ struct stat { long st_ctimensec; /* nsec of last file status change */ #endif /* __POSIX_VISIBLE >= 200809 || __BSD_VISIBLE */ off_t st_size; /* file size, in bytes */ - int64_t st_blocks; /* blocks allocated for file */ + blkcnt_t st_blocks; /* blocks allocated for file */ u_int32_t st_blksize; /* optimal blocksize for I/O */ u_int32_t st_flags; /* user defined flags for file */ u_int32_t st_gen; /* file generation number */ diff --git a/sys/sys/types.h b/sys/sys/types.h index a2e9962693e..d686c36c49a 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -1,4 +1,4 @@ -/* $OpenBSD: types.h,v 1.41 2014/07/12 16:25:08 guenther Exp $ */ +/* $OpenBSD: types.h,v 1.42 2014/08/22 23:05:15 krw Exp $ */ /* $NetBSD: types.h,v 1.29 1996/11/15 22:48:25 jtc Exp $ */ /*- @@ -130,6 +130,8 @@ typedef __psize_t psize_t; #endif /* __BSD_VISIBLE */ /* Standard system types */ +typedef __blkcnt_t blkcnt_t; /* blocks allocated for file */ +typedef __blksize_t blksize_t; /* optimal blocksize for I/O */ typedef char * caddr_t; /* core address */ typedef __int32_t daddr32_t; /* 32-bit disk address */ typedef __int64_t daddr_t; /* 64-bit disk address */ -- 2.20.1