freevxfs: handle big endian HP-UX file systems
To support VxFS filesystems from HP-UX on x86 systems we need to implement byte swapping, and to keep support for Unixware filesystems it needs to be the complicated dual-endian kind ala sysvfs. To do this properly we have to split the on disk and in-core inode so that we can keep the in-core one in native endianness. All other structures are byteswapped on demand. Signed-off-by: Krzysztof Błaszkowski <kb@sysmikro.com.pl> [hch: make spare happy] Signed-off-by: Christoph Hellwig <hch@lst.de>
This commit is contained in:

committed by
Christoph Hellwig

parent
6b15d6650c
commit
0d83f7fc83
@@ -66,74 +66,74 @@ enum {
|
||||
* Data stored immediately in the inode.
|
||||
*/
|
||||
struct vxfs_immed {
|
||||
u_int8_t vi_immed[VXFS_NIMMED];
|
||||
__u8 vi_immed[VXFS_NIMMED];
|
||||
};
|
||||
|
||||
struct vxfs_ext4 {
|
||||
u_int32_t ve4_spare; /* ?? */
|
||||
u_int32_t ve4_indsize; /* Indirect extent size */
|
||||
vx_daddr_t ve4_indir[VXFS_NIADDR]; /* Indirect extents */
|
||||
__fs32 ve4_spare; /* ?? */
|
||||
__fs32 ve4_indsize; /* Indirect extent size */
|
||||
__fs32 ve4_indir[VXFS_NIADDR]; /* Indirect extents */
|
||||
struct direct { /* Direct extents */
|
||||
vx_daddr_t extent; /* Extent number */
|
||||
int32_t size; /* Size of extent */
|
||||
__fs32 extent; /* Extent number */
|
||||
__fs32 size; /* Size of extent */
|
||||
} ve4_direct[VXFS_NDADDR];
|
||||
};
|
||||
|
||||
struct vxfs_typed {
|
||||
u_int64_t vt_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
|
||||
vx_daddr_t vt_block; /* Extent block */
|
||||
int32_t vt_size; /* Size in blocks */
|
||||
__fs64 vt_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
|
||||
__fs32 vt_block; /* Extent block */
|
||||
__fs32 vt_size; /* Size in blocks */
|
||||
};
|
||||
|
||||
struct vxfs_typed_dev4 {
|
||||
u_int64_t vd4_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
|
||||
u_int64_t vd4_block; /* Extent block */
|
||||
u_int64_t vd4_size; /* Size in blocks */
|
||||
int32_t vd4_dev; /* Device ID */
|
||||
u_int32_t __pad1;
|
||||
__fs64 vd4_hdr; /* Header, 0xTTOOOOOOOOOOOOOO; T=type,O=offs */
|
||||
__fs64 vd4_block; /* Extent block */
|
||||
__fs64 vd4_size; /* Size in blocks */
|
||||
__fs32 vd4_dev; /* Device ID */
|
||||
__u8 __pad1;
|
||||
};
|
||||
|
||||
/*
|
||||
* The inode as contained on the physical device.
|
||||
*/
|
||||
struct vxfs_dinode {
|
||||
int32_t vdi_mode;
|
||||
u_int32_t vdi_nlink; /* Link count */
|
||||
u_int32_t vdi_uid; /* UID */
|
||||
u_int32_t vdi_gid; /* GID */
|
||||
u_int64_t vdi_size; /* Inode size in bytes */
|
||||
u_int32_t vdi_atime; /* Last time accessed - sec */
|
||||
u_int32_t vdi_autime; /* Last time accessed - usec */
|
||||
u_int32_t vdi_mtime; /* Last modify time - sec */
|
||||
u_int32_t vdi_mutime; /* Last modify time - usec */
|
||||
u_int32_t vdi_ctime; /* Create time - sec */
|
||||
u_int32_t vdi_cutime; /* Create time - usec */
|
||||
u_int8_t vdi_aflags; /* Allocation flags */
|
||||
u_int8_t vdi_orgtype; /* Organisation type */
|
||||
u_int16_t vdi_eopflags;
|
||||
u_int32_t vdi_eopdata;
|
||||
__fs32 vdi_mode;
|
||||
__fs32 vdi_nlink; /* Link count */
|
||||
__fs32 vdi_uid; /* UID */
|
||||
__fs32 vdi_gid; /* GID */
|
||||
__fs64 vdi_size; /* Inode size in bytes */
|
||||
__fs32 vdi_atime; /* Last time accessed - sec */
|
||||
__fs32 vdi_autime; /* Last time accessed - usec */
|
||||
__fs32 vdi_mtime; /* Last modify time - sec */
|
||||
__fs32 vdi_mutime; /* Last modify time - usec */
|
||||
__fs32 vdi_ctime; /* Create time - sec */
|
||||
__fs32 vdi_cutime; /* Create time - usec */
|
||||
__u8 vdi_aflags; /* Allocation flags */
|
||||
__u8 vdi_orgtype; /* Organisation type */
|
||||
__fs16 vdi_eopflags;
|
||||
__fs32 vdi_eopdata;
|
||||
union {
|
||||
u_int32_t rdev;
|
||||
u_int32_t dotdot;
|
||||
__fs32 rdev;
|
||||
__fs32 dotdot;
|
||||
struct {
|
||||
u_int32_t reserved;
|
||||
u_int32_t fixextsize;
|
||||
__u32 reserved;
|
||||
__fs32 fixextsize;
|
||||
} i_regular;
|
||||
struct {
|
||||
u_int32_t matchino;
|
||||
u_int32_t fsetindex;
|
||||
__fs32 matchino;
|
||||
__fs32 fsetindex;
|
||||
} i_vxspec;
|
||||
u_int64_t align;
|
||||
__u64 align;
|
||||
} vdi_ftarea;
|
||||
u_int32_t vdi_blocks; /* How much blocks does inode occupy */
|
||||
u_int32_t vdi_gen; /* Inode generation */
|
||||
u_int64_t vdi_version; /* Version */
|
||||
__fs32 vdi_blocks; /* How much blocks does inode occupy */
|
||||
__fs32 vdi_gen; /* Inode generation */
|
||||
__fs64 vdi_version; /* Version */
|
||||
union {
|
||||
struct vxfs_immed immed;
|
||||
struct vxfs_ext4 ext4;
|
||||
struct vxfs_typed typed[VXFS_NTYPED];
|
||||
} vdi_org;
|
||||
u_int32_t vdi_iattrino;
|
||||
__fs32 vdi_iattrino;
|
||||
};
|
||||
|
||||
#define vdi_rdev vdi_ftarea.rdev
|
||||
@@ -149,32 +149,38 @@ struct vxfs_dinode {
|
||||
|
||||
/*
|
||||
* The inode as represented in the main memory.
|
||||
*
|
||||
* TBD: This should become a separate structure...
|
||||
*/
|
||||
#define vxfs_inode_info vxfs_dinode
|
||||
struct vxfs_inode_info {
|
||||
__u32 vii_mode;
|
||||
__u32 vii_nlink; /* Link count */
|
||||
__u32 vii_uid; /* UID */
|
||||
__u32 vii_gid; /* GID */
|
||||
__u64 vii_size; /* Inode size in bytes */
|
||||
__u32 vii_atime; /* Last time accessed - sec */
|
||||
__u32 vii_autime; /* Last time accessed - usec */
|
||||
__u32 vii_mtime; /* Last modify time - sec */
|
||||
__u32 vii_mutime; /* Last modify time - usec */
|
||||
__u32 vii_ctime; /* Create time - sec */
|
||||
__u32 vii_cutime; /* Create time - usec */
|
||||
__u8 vii_orgtype; /* Organisation type */
|
||||
union {
|
||||
__u32 rdev;
|
||||
__u32 dotdot;
|
||||
} vii_ftarea;
|
||||
__u32 vii_blocks; /* How much blocks does inode occupy */
|
||||
__u32 vii_gen; /* Inode generation */
|
||||
union {
|
||||
struct vxfs_immed immed;
|
||||
struct vxfs_ext4 ext4;
|
||||
struct vxfs_typed typed[VXFS_NTYPED];
|
||||
} vii_org;
|
||||
};
|
||||
|
||||
#define vii_mode vdi_mode
|
||||
#define vii_uid vdi_uid
|
||||
#define vii_gid vdi_gid
|
||||
#define vii_nlink vdi_nlink
|
||||
#define vii_size vdi_size
|
||||
#define vii_atime vdi_atime
|
||||
#define vii_ctime vdi_ctime
|
||||
#define vii_mtime vdi_mtime
|
||||
#define vii_blocks vdi_blocks
|
||||
#define vii_org vdi_org
|
||||
#define vii_orgtype vdi_orgtype
|
||||
#define vii_gen vdi_gen
|
||||
#define vii_rdev vii_ftarea.rdev
|
||||
#define vii_dotdot vii_ftarea.dotdot
|
||||
|
||||
#define vii_rdev vdi_ftarea.rdev
|
||||
#define vii_dotdot vdi_ftarea.dotdot
|
||||
#define vii_fixextsize vdi_ftarea.regular.fixextsize
|
||||
#define vii_matchino vdi_ftarea.vxspec.matchino
|
||||
#define vii_fsetindex vdi_ftarea.vxspec.fsetindex
|
||||
|
||||
#define vii_immed vdi_org.immed
|
||||
#define vii_ext4 vdi_org.ext4
|
||||
#define vii_typed vdi_org.typed
|
||||
#define vii_immed vii_org.immed
|
||||
#define vii_ext4 vii_org.ext4
|
||||
#define vii_typed vii_org.typed
|
||||
|
||||
#endif /* _VXFS_INODE_H_ */
|
||||
|
Reference in New Issue
Block a user