ulfs_inode.h revision 1.6 1 1.6 dholland /* $NetBSD: ulfs_inode.h,v 1.6 2013/06/08 02:04:31 dholland Exp $ */
2 1.1 dholland /* from NetBSD: inode.h,v 1.64 2012/11/19 00:36:21 jakllsch Exp */
3 1.1 dholland
4 1.1 dholland /*
5 1.1 dholland * Copyright (c) 1982, 1989, 1993
6 1.1 dholland * The Regents of the University of California. All rights reserved.
7 1.1 dholland * (c) UNIX System Laboratories, Inc.
8 1.1 dholland * All or some portions of this file are derived from material licensed
9 1.1 dholland * to the University of California by American Telephone and Telegraph
10 1.1 dholland * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11 1.1 dholland * the permission of UNIX System Laboratories, Inc.
12 1.1 dholland *
13 1.1 dholland * Redistribution and use in source and binary forms, with or without
14 1.1 dholland * modification, are permitted provided that the following conditions
15 1.1 dholland * are met:
16 1.1 dholland * 1. Redistributions of source code must retain the above copyright
17 1.1 dholland * notice, this list of conditions and the following disclaimer.
18 1.1 dholland * 2. Redistributions in binary form must reproduce the above copyright
19 1.1 dholland * notice, this list of conditions and the following disclaimer in the
20 1.1 dholland * documentation and/or other materials provided with the distribution.
21 1.1 dholland * 3. Neither the name of the University nor the names of its contributors
22 1.1 dholland * may be used to endorse or promote products derived from this software
23 1.1 dholland * without specific prior written permission.
24 1.1 dholland *
25 1.1 dholland * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26 1.1 dholland * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 1.1 dholland * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28 1.1 dholland * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29 1.1 dholland * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 1.1 dholland * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31 1.1 dholland * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32 1.1 dholland * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33 1.1 dholland * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34 1.1 dholland * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35 1.1 dholland * SUCH DAMAGE.
36 1.1 dholland *
37 1.1 dholland * @(#)inode.h 8.9 (Berkeley) 5/14/95
38 1.1 dholland */
39 1.1 dholland
40 1.3 dholland #ifndef _UFS_LFS_ULFS_INODE_H_
41 1.3 dholland #define _UFS_LFS_ULFS_INODE_H_
42 1.1 dholland
43 1.1 dholland #include <sys/vnode.h>
44 1.6 dholland #include <ufs/lfs/lfs_inode.h>
45 1.2 dholland #include <ufs/lfs/ulfs_dinode.h>
46 1.2 dholland #include <ufs/lfs/ulfs_dir.h>
47 1.2 dholland #include <ufs/lfs/ulfs_quotacommon.h>
48 1.1 dholland
49 1.1 dholland #if defined(_KERNEL)
50 1.1 dholland
51 1.1 dholland /*
52 1.1 dholland * The DIP macro is used to access fields in the dinode that are
53 1.1 dholland * not cached in the inode itself.
54 1.1 dholland */
55 1.1 dholland #define DIP(ip, field) \
56 1.3 dholland (((ip)->i_ump->um_fstype == ULFS1) ? \
57 1.1 dholland (ip)->i_ffs1_##field : (ip)->i_ffs2_##field)
58 1.1 dholland
59 1.1 dholland #define DIP_ASSIGN(ip, field, value) \
60 1.1 dholland do { \
61 1.3 dholland if ((ip)->i_ump->um_fstype == ULFS1) \
62 1.1 dholland (ip)->i_ffs1_##field = (value); \
63 1.1 dholland else \
64 1.1 dholland (ip)->i_ffs2_##field = (value); \
65 1.1 dholland } while(0)
66 1.1 dholland
67 1.1 dholland #define DIP_ADD(ip, field, value) \
68 1.1 dholland do { \
69 1.3 dholland if ((ip)->i_ump->um_fstype == ULFS1) \
70 1.1 dholland (ip)->i_ffs1_##field += (value); \
71 1.1 dholland else \
72 1.1 dholland (ip)->i_ffs2_##field += (value); \
73 1.1 dholland } while(0)
74 1.1 dholland
75 1.1 dholland #define SHORTLINK(ip) \
76 1.3 dholland (((ip)->i_ump->um_fstype == ULFS1) ? \
77 1.1 dholland (void *)(ip)->i_ffs1_db : (void *)(ip)->i_ffs2_db)
78 1.1 dholland
79 1.1 dholland
80 1.1 dholland /*
81 1.1 dholland * Structure used to pass around logical block paths generated by
82 1.3 dholland * ulfs_getlbns and used by truncate and bmap code.
83 1.1 dholland */
84 1.1 dholland struct indir {
85 1.1 dholland daddr_t in_lbn; /* Logical block number. */
86 1.1 dholland int in_off; /* Offset in buffer. */
87 1.1 dholland int in_exists; /* Flag if the block exists. */
88 1.1 dholland };
89 1.1 dholland
90 1.1 dholland /* Convert between inode pointers and vnode pointers. */
91 1.1 dholland #define VTOI(vp) ((struct inode *)(vp)->v_data)
92 1.1 dholland #define ITOV(ip) ((ip)->i_vnode)
93 1.1 dholland
94 1.1 dholland #endif /* _KERNEL */
95 1.1 dholland
96 1.3 dholland #endif /* !_UFS_LFS_ULFS_INODE_H_ */
97