From 5485f5406426eb7458891c2218d2e07f42aca8cf Mon Sep 17 00:00:00 2001 From: Matthew Dillon Date: Mon, 4 Aug 2008 18:15:47 +0000 Subject: [PATCH] Keep UFS compatible on 32 and 64 bit builds by changing the 'time_t' embedded in its media structure to ufs_time_t. --- sys/vfs/ufs/dinode.h | 6 ++---- sys/vfs/ufs/fs.h | 8 ++++---- sys/vfs/ufs/quota.h | 8 +++++--- sys/vfs/ufs/ufs_types.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ sys/vfs/ufs/ufsmount.h | 6 +++--- 5 files changed, 58 insertions(+), 14 deletions(-) create mode 100644 sys/vfs/ufs/ufs_types.h diff --git a/sys/vfs/ufs/dinode.h b/sys/vfs/ufs/dinode.h index 5752ec3aa3..41071ec37b 100644 --- a/sys/vfs/ufs/dinode.h +++ b/sys/vfs/ufs/dinode.h @@ -37,13 +37,13 @@ * * @(#)dinode.h 8.3 (Berkeley) 1/21/94 * $FreeBSD: src/sys/ufs/ufs/dinode.h,v 1.7 1999/08/28 00:52:27 peter Exp $ - * $DragonFly: src/sys/vfs/ufs/dinode.h,v 1.7 2006/09/10 01:26:41 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/dinode.h,v 1.8 2008/08/04 18:15:47 dillon Exp $ */ #ifndef _VFS_UFS_DINODE_H_ #define _VFS_UFS_DINODE_H_ -typedef __uint32_t ufs1_ino_t; +#include "ufs_types.h" /* * The root inode is the root of the filesystem. Inode 0 can't be used for @@ -68,8 +68,6 @@ typedef __uint32_t ufs1_ino_t; * are defined by types with precise widths. */ -typedef __int32_t ufs_daddr_t; - #define NDADDR 12 /* Direct addresses in inode. */ #define NIADDR 3 /* Indirect addresses in inode. */ diff --git a/sys/vfs/ufs/fs.h b/sys/vfs/ufs/fs.h index 5fd4238e10..b05e5342d1 100644 --- a/sys/vfs/ufs/fs.h +++ b/sys/vfs/ufs/fs.h @@ -32,7 +32,7 @@ * * @(#)fs.h 8.13 (Berkeley) 3/21/95 * $FreeBSD: src/sys/ufs/ffs/fs.h,v 1.14.2.3 2001/09/21 19:15:22 dillon Exp $ - * $DragonFly: src/sys/vfs/ufs/fs.h,v 1.5 2006/04/03 02:02:37 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/fs.h,v 1.6 2008/08/04 18:15:47 dillon Exp $ */ #ifndef _VFS_UFS_FS_H_ @@ -194,7 +194,7 @@ struct fs { ufs_daddr_t fs_dblkno; /* offset of first data after cg */ int32_t fs_cgoffset; /* cylinder group offset in cylinder */ int32_t fs_cgmask; /* used to calc mod fs_ntrak */ - time_t fs_time; /* last time written */ + ufs_time_t fs_time; /* last time written */ int32_t fs_size; /* number of blocks in fs */ int32_t fs_dsize; /* number of data blocks in fs */ int32_t fs_ncg; /* number of cylinder groups */ @@ -348,7 +348,7 @@ struct fs { struct cg { int32_t cg_firstfield; /* historic cyl groups linked list */ int32_t cg_magic; /* magic number */ - time_t cg_time; /* time last written */ + ufs_time_t cg_time; /* time last written */ int32_t cg_cgx; /* we are the cgx'th cylinder group */ int16_t cg_ncyl; /* number of cyl's this cg */ int16_t cg_niblk; /* number of inode blocks this cg */ @@ -405,7 +405,7 @@ struct cg { struct ocg { int32_t cg_firstfield; /* historic linked list of cyl groups */ int32_t cg_unused_1; /* used for incore cyl groups */ - time_t cg_time; /* time last written */ + ufs_time_t cg_time; /* time last written */ int32_t cg_cgx; /* we are the cgx'th cylinder group */ int16_t cg_ncyl; /* number of cyl's this cg */ int16_t cg_niblk; /* number of inode blocks this cg */ diff --git a/sys/vfs/ufs/quota.h b/sys/vfs/ufs/quota.h index 7ede91eaec..affa3e068f 100644 --- a/sys/vfs/ufs/quota.h +++ b/sys/vfs/ufs/quota.h @@ -35,12 +35,14 @@ * * @(#)quota.h 8.3 (Berkeley) 8/19/94 * $FreeBSD: src/sys/ufs/ufs/quota.h,v 1.15.2.1 2003/02/27 12:04:13 das Exp $ - * $DragonFly: src/sys/vfs/ufs/quota.h,v 1.9 2007/11/06 17:11:38 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/quota.h,v 1.10 2008/08/04 18:15:47 dillon Exp $ */ #ifndef _VFS_UFS_QUOTA_H_ #define _VFS_UFS_QUOTA_H_ +#include "ufs_types.h" + /* * Definitions for disk quotas imposed on the average user * (big brother finally hits UNIX). @@ -105,8 +107,8 @@ struct ufs_dqblk { uint32_t dqb_ihardlimit; /* maximum # allocated inodes + 1 */ uint32_t dqb_isoftlimit; /* preferred inode limit */ uint32_t dqb_curinodes; /* current # allocated inodes */ - time_t dqb_btime; /* time limit for excessive disk use */ - time_t dqb_itime; /* time limit for excessive files */ + ufs_time_t dqb_btime; /* time limit for excessive disk use */ + ufs_time_t dqb_itime; /* time limit for excessive files */ }; #ifdef _KERNEL diff --git a/sys/vfs/ufs/ufs_types.h b/sys/vfs/ufs/ufs_types.h new file mode 100644 index 0000000000..46bcb6a168 --- /dev/null +++ b/sys/vfs/ufs/ufs_types.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 2008 The DragonFly Project. All rights reserved. + * + * This code is derived from software contributed to The DragonFly Project + * by Matthew Dillon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. + * 3. Neither the name of The DragonFly Project nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific, prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS + * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE + * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $DragonFly: src/sys/vfs/ufs/ufs_types.h,v 1.1 2008/08/04 18:15:47 dillon Exp $ + */ + +#ifndef _VFS_UFS_UFS_TYPES_H_ +#define _VFS_UFS_UFS_TYPES_H_ + +typedef __uint32_t ufs1_ino_t; +typedef __int32_t ufs_daddr_t; +typedef __int32_t ufs_time_t; + +#endif diff --git a/sys/vfs/ufs/ufsmount.h b/sys/vfs/ufs/ufsmount.h index 7415eb05a6..1a07f1dd17 100644 --- a/sys/vfs/ufs/ufsmount.h +++ b/sys/vfs/ufs/ufsmount.h @@ -32,7 +32,7 @@ * * @(#)ufsmount.h 8.6 (Berkeley) 3/30/95 * $FreeBSD: src/sys/ufs/ufs/ufsmount.h,v 1.17 1999/12/29 04:55:06 peter Exp $ - * $DragonFly: src/sys/vfs/ufs/ufsmount.h,v 1.10 2006/09/10 01:26:41 dillon Exp $ + * $DragonFly: src/sys/vfs/ufs/ufsmount.h,v 1.11 2008/08/04 18:15:47 dillon Exp $ */ #ifndef _VFS_UFS_UFSMOUNT_H_ @@ -88,8 +88,8 @@ struct ufsmount { u_long um_nindir; /* indirect ptrs per block */ u_long um_bptrtodb; /* indir ptr to disk block */ u_long um_seqinc; /* inc between seq blocks */ - time_t um_btime[MAXQUOTAS]; /* block quota time limit */ - time_t um_itime[MAXQUOTAS]; /* inode quota time limit */ + ufs_time_t um_btime[MAXQUOTAS]; /* block quota time limit */ + ufs_time_t um_itime[MAXQUOTAS]; /* inode quota time limit */ char um_qflags[MAXQUOTAS]; /* quota specific flags */ struct netexport um_export; /* export information */ int64_t um_savedmaxfilesize; /* XXX - limit maxfilesize */ -- 2.11.4.GIT