Use an ifdef in ext2_fs.h instead of a bogus separate file (ext2_fs_i.h)

to avoid the namespace problems caused by <ufs/ufs/inode.h> #defining
i_mode, etc.

ext2_fs_i.h had nothing to do with the Linux version.  It was a small
part of the Linux version of ext2_fs.h (the part that declares extra
in-core fields for an inode).  We don't need it because we use the
ufs in-core inode for the extra fields.
This commit is contained in:
Bruce Evans 2000-01-01 14:43:20 +00:00
parent ec106704c6
commit 8e19715af3
5 changed files with 144 additions and 90 deletions

View File

@ -3,6 +3,8 @@
*
* Aug 1995, Godmar Back (gback@cs.utah.edu)
* University of Utah, Department of Computer Science
*
* $FreeBSD$
*/
/*
* linux/include/linux/ext2_fs.h
@ -226,6 +228,71 @@ struct ext2_group_desc
#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
/*
* Only declare `struct ext2_inode' if <ufs/ufs/inode.h> hasn't made things
* difficult by #defining i_mode and other struct members. The details of
* the struct are only needed in ext2_inode_cnv.c where the ext2fs on-disk
* inode is converted to a ufs in-core inode.
*/
#ifndef i_mode
/*
* Structure of an inode on the disk
*/
struct ext2_inode {
__u16 i_mode; /* File mode */
__u16 i_uid; /* Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Creation time */
__u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
__u32 i_flags; /* File flags */
union {
struct {
__u32 l_i_reserved1;
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
struct {
__u32 m_i_reserved1;
} masix1;
} osd1; /* OS dependent 1 */
__u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
__u32 i_version; /* File version (for NFS) */
__u32 i_file_acl; /* File ACL */
__u32 i_dir_acl; /* Directory ACL */
__u32 i_faddr; /* Fragment address */
union {
struct {
__u8 l_i_frag; /* Fragment number */
__u8 l_i_fsize; /* Fragment size */
__u16 i_pad1;
__u32 l_i_reserved2[2];
} linux2;
struct {
__u8 h_i_frag; /* Fragment number */
__u8 h_i_fsize; /* Fragment size */
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
struct {
__u8 m_i_frag; /* Fragment number */
__u8 m_i_fsize; /* Fragment size */
__u16 m_pad1;
__u32 m_i_reserved2[2];
} masix2;
} osd2; /* OS dependent 2 */
};
#endif /* i_mode */
/*
* File system states
*/

View File

@ -1,86 +0,0 @@
/*
* added for EXT2FS support in Lites 1.1
*
* Aug 1995, Godmar Back (gback@cs.utah.edu)
* University of Utah, Department of Computer Science
*
* Note that this started out to be ext2_fs_i.h. In reality it
* doesn't have anything to do with. I put the declaration of
* the on disk ext2 format here from ext2_fs.h because this is
* something that would name clash with other stuff.
* This is used only in ext2_inode_cnv.c
*/
/*
* linux/include/linux/ext2_fs_i.h
*
* Copyright (C) 1992, 1993, 1994, 1995
* Remy Card (card@masi.ibp.fr)
* Laboratoire MASI - Institut Blaise Pascal
* Universite Pierre et Marie Curie (Paris VI)
*
* from
*
* linux/include/linux/minix_fs_i.h
*
* Copyright (C) 1991, 1992 Linus Torvalds
*/
#ifndef _EXT2_FS_I
#define _EXT2_FS_I
/*
* Structure of an inode on the disk
*/
struct ext2_inode {
__u16 i_mode; /* File mode */
__u16 i_uid; /* Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Creation time */
__u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
__u32 i_flags; /* File flags */
union {
struct {
__u32 l_i_reserved1;
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
struct {
__u32 m_i_reserved1;
} masix1;
} osd1; /* OS dependent 1 */
__u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
__u32 i_version; /* File version (for NFS) */
__u32 i_file_acl; /* File ACL */
__u32 i_dir_acl; /* Directory ACL */
__u32 i_faddr; /* Fragment address */
union {
struct {
__u8 l_i_frag; /* Fragment number */
__u8 l_i_fsize; /* Fragment size */
__u16 i_pad1;
__u32 l_i_reserved2[2];
} linux2;
struct {
__u8 h_i_frag; /* Fragment number */
__u8 h_i_fsize; /* Fragment size */
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
struct {
__u8 m_i_frag; /* Fragment number */
__u8 m_i_fsize; /* Fragment size */
__u16 m_pad1;
__u32 m_i_reserved2[2];
} masix2;
} osd2; /* OS dependent 2 */
};
#endif /* _EXT2_FS_I */

View File

@ -19,6 +19,7 @@
* improvements that they make and grant CSL redistribution rights.
*
* Utah $Hdr$
* $FreeBSD$
*/
/*
@ -33,7 +34,10 @@
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
/* these defs would destroy the ext2_fs_i #include */
/*
* Undo the definitions in <ufs/ufs/inode.h> that would destroy the include
* of <gnu/ext2fs/ext2_fs.h>.
*/
#undef i_atime
#undef i_blocks
#undef i_ctime
@ -52,7 +56,6 @@
#include <gnu/ext2fs/ext2_fs.h>
#include <gnu/ext2fs/ext2_extern.h>
#include <gnu/ext2fs/ext2_fs_i.h>
void
ext2_print_dinode( di )

View File

@ -3,6 +3,8 @@
*
* Aug 1995, Godmar Back (gback@cs.utah.edu)
* University of Utah, Department of Computer Science
*
* $FreeBSD$
*/
/*
* linux/include/linux/ext2_fs.h
@ -226,6 +228,71 @@ struct ext2_group_desc
#define EXT2_IOC_GETVERSION _IOR('v', 1, long)
#define EXT2_IOC_SETVERSION _IOW('v', 2, long)
/*
* Only declare `struct ext2_inode' if <ufs/ufs/inode.h> hasn't made things
* difficult by #defining i_mode and other struct members. The details of
* the struct are only needed in ext2_inode_cnv.c where the ext2fs on-disk
* inode is converted to a ufs in-core inode.
*/
#ifndef i_mode
/*
* Structure of an inode on the disk
*/
struct ext2_inode {
__u16 i_mode; /* File mode */
__u16 i_uid; /* Owner Uid */
__u32 i_size; /* Size in bytes */
__u32 i_atime; /* Access time */
__u32 i_ctime; /* Creation time */
__u32 i_mtime; /* Modification time */
__u32 i_dtime; /* Deletion Time */
__u16 i_gid; /* Group Id */
__u16 i_links_count; /* Links count */
__u32 i_blocks; /* Blocks count */
__u32 i_flags; /* File flags */
union {
struct {
__u32 l_i_reserved1;
} linux1;
struct {
__u32 h_i_translator;
} hurd1;
struct {
__u32 m_i_reserved1;
} masix1;
} osd1; /* OS dependent 1 */
__u32 i_block[EXT2_N_BLOCKS];/* Pointers to blocks */
__u32 i_version; /* File version (for NFS) */
__u32 i_file_acl; /* File ACL */
__u32 i_dir_acl; /* Directory ACL */
__u32 i_faddr; /* Fragment address */
union {
struct {
__u8 l_i_frag; /* Fragment number */
__u8 l_i_fsize; /* Fragment size */
__u16 i_pad1;
__u32 l_i_reserved2[2];
} linux2;
struct {
__u8 h_i_frag; /* Fragment number */
__u8 h_i_fsize; /* Fragment size */
__u16 h_i_mode_high;
__u16 h_i_uid_high;
__u16 h_i_gid_high;
__u32 h_i_author;
} hurd2;
struct {
__u8 m_i_frag; /* Fragment number */
__u8 m_i_fsize; /* Fragment size */
__u16 m_pad1;
__u32 m_i_reserved2[2];
} masix2;
} osd2; /* OS dependent 2 */
};
#endif /* i_mode */
/*
* File system states
*/

View File

@ -19,6 +19,7 @@
* improvements that they make and grant CSL redistribution rights.
*
* Utah $Hdr$
* $FreeBSD$
*/
/*
@ -33,7 +34,10 @@
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
/* these defs would destroy the ext2_fs_i #include */
/*
* Undo the definitions in <ufs/ufs/inode.h> that would destroy the include
* of <gnu/ext2fs/ext2_fs.h>.
*/
#undef i_atime
#undef i_blocks
#undef i_ctime
@ -52,7 +56,6 @@
#include <gnu/ext2fs/ext2_fs.h>
#include <gnu/ext2fs/ext2_extern.h>
#include <gnu/ext2fs/ext2_fs_i.h>
void
ext2_print_dinode( di )