1*d84c38aeSchristos /* $NetBSD: ufs_inode.h,v 1.5 2013/01/30 19:19:19 christos Exp $ */ 2944794a5Slukem /* From: NetBSD: inode.h,v 1.27 2001/12/18 10:57:23 fvdl Exp $ */ 3944794a5Slukem 4944794a5Slukem /* 5944794a5Slukem * Copyright (c) 1982, 1989, 1993 6944794a5Slukem * The Regents of the University of California. All rights reserved. 7944794a5Slukem * (c) UNIX System Laboratories, Inc. 8944794a5Slukem * All or some portions of this file are derived from material licensed 9944794a5Slukem * to the University of California by American Telephone and Telegraph 10944794a5Slukem * Co. or Unix System Laboratories, Inc. and are reproduced herein with 11944794a5Slukem * the permission of UNIX System Laboratories, Inc. 12944794a5Slukem * 13944794a5Slukem * Redistribution and use in source and binary forms, with or without 14944794a5Slukem * modification, are permitted provided that the following conditions 15944794a5Slukem * are met: 16944794a5Slukem * 1. Redistributions of source code must retain the above copyright 17944794a5Slukem * notice, this list of conditions and the following disclaimer. 18944794a5Slukem * 2. Redistributions in binary form must reproduce the above copyright 19944794a5Slukem * notice, this list of conditions and the following disclaimer in the 20944794a5Slukem * documentation and/or other materials provided with the distribution. 21326b2259Sagc * 3. Neither the name of the University nor the names of its contributors 22944794a5Slukem * may be used to endorse or promote products derived from this software 23944794a5Slukem * without specific prior written permission. 24944794a5Slukem * 25944794a5Slukem * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 26944794a5Slukem * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27944794a5Slukem * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 28944794a5Slukem * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 29944794a5Slukem * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30944794a5Slukem * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 31944794a5Slukem * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 32944794a5Slukem * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 33944794a5Slukem * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 34944794a5Slukem * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 35944794a5Slukem * SUCH DAMAGE. 36944794a5Slukem * 37944794a5Slukem * @(#)inode.h 8.9 (Berkeley) 5/14/95 38944794a5Slukem */ 39944794a5Slukem 4042614ed3Sfvdl union dinode { 4142614ed3Sfvdl struct ufs1_dinode ffs1_din; 4242614ed3Sfvdl struct ufs2_dinode ffs2_din; 4342614ed3Sfvdl }; 44944794a5Slukem 45944794a5Slukem struct inode { 46944794a5Slukem ino_t i_number; /* The identity of the inode. */ 47*d84c38aeSchristos struct vnode *i_devvp; /* device vnode for block I/O */ 48944794a5Slukem struct fs *i_fs; /* File system */ 4942614ed3Sfvdl union dinode i_din; 5042614ed3Sfvdl uint64_t i_size; 51944794a5Slukem }; 52944794a5Slukem 5342614ed3Sfvdl #define i_ffs1_atime i_din.ffs1_din.di_atime 5442614ed3Sfvdl #define i_ffs1_atimensec i_din.ffs1_din.di_atimensec 5542614ed3Sfvdl #define i_ffs1_blocks i_din.ffs1_din.di_blocks 5642614ed3Sfvdl #define i_ffs1_ctime i_din.ffs1_din.di_ctime 5742614ed3Sfvdl #define i_ffs1_ctimensec i_din.ffs1_din.di_ctimensec 5842614ed3Sfvdl #define i_ffs1_db i_din.ffs1_din.di_db 5942614ed3Sfvdl #define i_ffs1_flags i_din.ffs1_din.di_flags 6042614ed3Sfvdl #define i_ffs1_gen i_din.ffs1_din.di_gen 6142614ed3Sfvdl #define i_ffs11_gid i_din.ffs1_din.di_gid 6242614ed3Sfvdl #define i_ffs1_ib i_din.ffs1_din.di_ib 6342614ed3Sfvdl #define i_ffs1_mode i_din.ffs1_din.di_mode 6442614ed3Sfvdl #define i_ffs1_mtime i_din.ffs1_din.di_mtime 6542614ed3Sfvdl #define i_ffs1_mtimensec i_din.ffs1_din.di_mtimensec 6642614ed3Sfvdl #define i_ffs1_nlink i_din.ffs1_din.di_nlink 6742614ed3Sfvdl #define i_ffs1_rdev i_din.ffs1_din.di_rdev 6842614ed3Sfvdl #define i_ffs1_shortlink i_din.ffs1_din.db 6942614ed3Sfvdl #define i_ffs1_size i_din.ffs1_din.di_size 7042614ed3Sfvdl #define i_ffs1_uid i_din.ffs1_din.di_uid 7142614ed3Sfvdl 7242614ed3Sfvdl #define i_ffs2_atime i_din.ffs2_din.di_atime 7342614ed3Sfvdl #define i_ffs2_atimensec i_din.ffs2_din.di_atimensec 7442614ed3Sfvdl #define i_ffs2_blocks i_din.ffs2_din.di_blocks 7542614ed3Sfvdl #define i_ffs2_ctime i_din.ffs2_din.di_ctime 7642614ed3Sfvdl #define i_ffs2_ctimensec i_din.ffs2_din.di_ctimensec 7742614ed3Sfvdl #define i_ffs2_birthtime i_din.ffs2_din.di_birthtime 7842614ed3Sfvdl #define i_ffs2_birthnsec i_din.ffs2_din.di_birthnsec 7942614ed3Sfvdl #define i_ffs2_db i_din.ffs2_din.di_db 8042614ed3Sfvdl #define i_ffs2_flags i_din.ffs2_din.di_flags 8142614ed3Sfvdl #define i_ffs2_gen i_din.ffs2_din.di_gen 8242614ed3Sfvdl #define i_ffs21_gid i_din.ffs2_din.di_gid 8342614ed3Sfvdl #define i_ffs2_ib i_din.ffs2_din.di_ib 8442614ed3Sfvdl #define i_ffs2_mode i_din.ffs2_din.di_mode 8542614ed3Sfvdl #define i_ffs2_mtime i_din.ffs2_din.di_mtime 8642614ed3Sfvdl #define i_ffs2_mtimensec i_din.ffs2_din.di_mtimensec 8742614ed3Sfvdl #define i_ffs2_nlink i_din.ffs2_din.di_nlink 8842614ed3Sfvdl #define i_ffs2_rdev i_din.ffs2_din.di_rdev 8942614ed3Sfvdl #define i_ffs2_shortlink i_din.ffs2_din.db 9042614ed3Sfvdl #define i_ffs2_size i_din.ffs2_din.di_size 9142614ed3Sfvdl #define i_ffs2_uid i_din.ffs2_din.di_uid 9242614ed3Sfvdl 9342614ed3Sfvdl #undef DIP 9442614ed3Sfvdl #define DIP(ip, field) \ 9542614ed3Sfvdl (((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) ? \ 9642614ed3Sfvdl (ip)->i_ffs1_##field : (ip)->i_ffs2_##field) 97b14624e5Sfvdl 98b14624e5Sfvdl #define DIP_ASSIGN(ip, field, value) \ 99b14624e5Sfvdl do { \ 100b14624e5Sfvdl if ((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) \ 101b14624e5Sfvdl (ip)->i_ffs1_##field = (value); \ 102b14624e5Sfvdl else \ 103b14624e5Sfvdl (ip)->i_ffs2_##field = (value); \ 104b14624e5Sfvdl } while(0) 105b14624e5Sfvdl 106b14624e5Sfvdl #define DIP_ADD(ip, field, value) \ 107b14624e5Sfvdl do { \ 108b14624e5Sfvdl if ((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) \ 109b14624e5Sfvdl (ip)->i_ffs1_##field += (value); \ 110b14624e5Sfvdl else \ 111b14624e5Sfvdl (ip)->i_ffs2_##field += (value); \ 112b14624e5Sfvdl } while(0) 113