1*6b392b0aSkrw /* $OpenBSD: ufs_inode.h,v 1.4 2016/12/17 16:26:46 krw Exp $ */ 26163fc9cSnatano /* $NetBSD: ufs_inode.h,v 1.5 2013/01/30 19:19:19 christos Exp $ */ 36163fc9cSnatano /* From: NetBSD: inode.h,v 1.27 2001/12/18 10:57:23 fvdl Exp $ */ 46163fc9cSnatano 56163fc9cSnatano /* 66163fc9cSnatano * Copyright (c) 1982, 1989, 1993 76163fc9cSnatano * The Regents of the University of California. All rights reserved. 86163fc9cSnatano * (c) UNIX System Laboratories, Inc. 96163fc9cSnatano * All or some portions of this file are derived from material licensed 106163fc9cSnatano * to the University of California by American Telephone and Telegraph 116163fc9cSnatano * Co. or Unix System Laboratories, Inc. and are reproduced herein with 126163fc9cSnatano * the permission of UNIX System Laboratories, Inc. 136163fc9cSnatano * 146163fc9cSnatano * Redistribution and use in source and binary forms, with or without 156163fc9cSnatano * modification, are permitted provided that the following conditions 166163fc9cSnatano * are met: 176163fc9cSnatano * 1. Redistributions of source code must retain the above copyright 186163fc9cSnatano * notice, this list of conditions and the following disclaimer. 196163fc9cSnatano * 2. Redistributions in binary form must reproduce the above copyright 206163fc9cSnatano * notice, this list of conditions and the following disclaimer in the 216163fc9cSnatano * documentation and/or other materials provided with the distribution. 226163fc9cSnatano * 3. Neither the name of the University nor the names of its contributors 236163fc9cSnatano * may be used to endorse or promote products derived from this software 246163fc9cSnatano * without specific prior written permission. 256163fc9cSnatano * 266163fc9cSnatano * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 276163fc9cSnatano * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 286163fc9cSnatano * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 296163fc9cSnatano * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 306163fc9cSnatano * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 316163fc9cSnatano * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 326163fc9cSnatano * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 336163fc9cSnatano * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 346163fc9cSnatano * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 356163fc9cSnatano * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 366163fc9cSnatano * SUCH DAMAGE. 376163fc9cSnatano * 386163fc9cSnatano * @(#)inode.h 8.9 (Berkeley) 5/14/95 396163fc9cSnatano */ 406163fc9cSnatano 416163fc9cSnatano union dinode { 426163fc9cSnatano struct ufs1_dinode ffs1_din; 436163fc9cSnatano struct ufs2_dinode ffs2_din; 446163fc9cSnatano }; 456163fc9cSnatano 466163fc9cSnatano struct inode { 476163fc9cSnatano ino_t i_number; /* The identity of the inode. */ 484af638d7Stedu struct mkfsvnode *i_devvp; /* device mkfsvnode for block I/O */ 496163fc9cSnatano struct fs *i_fs; /* File system */ 506163fc9cSnatano union dinode i_din; 516163fc9cSnatano uint64_t i_size; 526163fc9cSnatano }; 536163fc9cSnatano 546163fc9cSnatano #define i_ffs1_atime i_din.ffs1_din.di_atime 556163fc9cSnatano #define i_ffs1_atimensec i_din.ffs1_din.di_atimensec 566163fc9cSnatano #define i_ffs1_blocks i_din.ffs1_din.di_blocks 576163fc9cSnatano #define i_ffs1_ctime i_din.ffs1_din.di_ctime 586163fc9cSnatano #define i_ffs1_ctimensec i_din.ffs1_din.di_ctimensec 596163fc9cSnatano #define i_ffs1_db i_din.ffs1_din.di_db 606163fc9cSnatano #define i_ffs1_flags i_din.ffs1_din.di_flags 616163fc9cSnatano #define i_ffs1_gen i_din.ffs1_din.di_gen 626163fc9cSnatano #define i_ffs11_gid i_din.ffs1_din.di_gid 636163fc9cSnatano #define i_ffs1_ib i_din.ffs1_din.di_ib 646163fc9cSnatano #define i_ffs1_mode i_din.ffs1_din.di_mode 656163fc9cSnatano #define i_ffs1_mtime i_din.ffs1_din.di_mtime 666163fc9cSnatano #define i_ffs1_mtimensec i_din.ffs1_din.di_mtimensec 676163fc9cSnatano #define i_ffs1_nlink i_din.ffs1_din.di_nlink 686163fc9cSnatano #define i_ffs1_rdev i_din.ffs1_din.di_rdev 696163fc9cSnatano #define i_ffs1_shortlink i_din.ffs1_din.db 706163fc9cSnatano #define i_ffs1_size i_din.ffs1_din.di_size 716163fc9cSnatano #define i_ffs1_uid i_din.ffs1_din.di_uid 726163fc9cSnatano 736163fc9cSnatano #define i_ffs2_atime i_din.ffs2_din.di_atime 746163fc9cSnatano #define i_ffs2_atimensec i_din.ffs2_din.di_atimensec 756163fc9cSnatano #define i_ffs2_blocks i_din.ffs2_din.di_blocks 766163fc9cSnatano #define i_ffs2_ctime i_din.ffs2_din.di_ctime 776163fc9cSnatano #define i_ffs2_ctimensec i_din.ffs2_din.di_ctimensec 786163fc9cSnatano #define i_ffs2_birthtime i_din.ffs2_din.di_birthtime 796163fc9cSnatano #define i_ffs2_birthnsec i_din.ffs2_din.di_birthnsec 806163fc9cSnatano #define i_ffs2_db i_din.ffs2_din.di_db 816163fc9cSnatano #define i_ffs2_flags i_din.ffs2_din.di_flags 826163fc9cSnatano #define i_ffs2_gen i_din.ffs2_din.di_gen 836163fc9cSnatano #define i_ffs21_gid i_din.ffs2_din.di_gid 846163fc9cSnatano #define i_ffs2_ib i_din.ffs2_din.di_ib 856163fc9cSnatano #define i_ffs2_mode i_din.ffs2_din.di_mode 866163fc9cSnatano #define i_ffs2_mtime i_din.ffs2_din.di_mtime 876163fc9cSnatano #define i_ffs2_mtimensec i_din.ffs2_din.di_mtimensec 886163fc9cSnatano #define i_ffs2_nlink i_din.ffs2_din.di_nlink 896163fc9cSnatano #define i_ffs2_rdev i_din.ffs2_din.di_rdev 906163fc9cSnatano #define i_ffs2_shortlink i_din.ffs2_din.db 916163fc9cSnatano #define i_ffs2_size i_din.ffs2_din.di_size 926163fc9cSnatano #define i_ffs2_uid i_din.ffs2_din.di_uid 936163fc9cSnatano 946163fc9cSnatano #undef DIP 956163fc9cSnatano #define DIP(ip, field) \ 966163fc9cSnatano (((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) ? \ 976163fc9cSnatano (ip)->i_ffs1_##field : (ip)->i_ffs2_##field) 986163fc9cSnatano 996163fc9cSnatano #define DIP_ASSIGN(ip, field, value) \ 1006163fc9cSnatano do { \ 1016163fc9cSnatano if ((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) \ 1026163fc9cSnatano (ip)->i_ffs1_##field = (value); \ 1036163fc9cSnatano else \ 1046163fc9cSnatano (ip)->i_ffs2_##field = (value); \ 1056163fc9cSnatano } while(0) 1066163fc9cSnatano 1076163fc9cSnatano #define DIP_ADD(ip, field, value) \ 1086163fc9cSnatano do { \ 1096163fc9cSnatano if ((ip)->i_fs->fs_magic == FS_UFS1_MAGIC) \ 1106163fc9cSnatano (ip)->i_ffs1_##field += (value); \ 1116163fc9cSnatano else \ 1126163fc9cSnatano (ip)->i_ffs2_##field += (value); \ 1136163fc9cSnatano } while(0) 114