Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Copyright (c) 2000-2003 Silicon Graphics, Inc. All Rights Reserved. | |
3 | * | |
4 | * This program is free software; you can redistribute it and/or modify it | |
5 | * under the terms of version 2 of the GNU General Public License as | |
6 | * published by the Free Software Foundation. | |
7 | * | |
8 | * This program is distributed in the hope that it would be useful, but | |
9 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | |
11 | * | |
12 | * Further, this software is distributed without any warranty that it is | |
13 | * free of the rightful claim of any third person regarding infringement | |
14 | * or the like. Any license provided herein, whether implied or | |
15 | * otherwise, applies only to this software file. Patent licenses, if | |
16 | * any, provided herein do not apply to combinations of this program with | |
17 | * other software, or any other product whatsoever. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License along | |
20 | * with this program; if not, write the Free Software Foundation, Inc., 59 | |
21 | * Temple Place - Suite 330, Boston MA 02111-1307, USA. | |
22 | * | |
23 | * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy, | |
24 | * Mountain View, CA 94043, or: | |
25 | * | |
26 | * http://www.sgi.com | |
27 | * | |
28 | * For further information regarding this notice, see: | |
29 | * | |
30 | * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/ | |
31 | */ | |
32 | ||
33 | #include "xfs.h" | |
34 | #include "xfs_macros.h" | |
35 | #include "xfs_types.h" | |
36 | #include "xfs_inum.h" | |
37 | #include "xfs_log.h" | |
38 | #include "xfs_trans.h" | |
39 | #include "xfs_sb.h" | |
40 | #include "xfs_ag.h" | |
41 | #include "xfs_dir.h" | |
42 | #include "xfs_dir2.h" | |
43 | #include "xfs_dmapi.h" | |
44 | #include "xfs_mount.h" | |
45 | #include "xfs_alloc_btree.h" | |
46 | #include "xfs_bmap_btree.h" | |
47 | #include "xfs_ialloc_btree.h" | |
48 | #include "xfs_itable.h" | |
49 | #include "xfs_btree.h" | |
50 | #include "xfs_alloc.h" | |
51 | #include "xfs_ialloc.h" | |
52 | #include "xfs_attr_sf.h" | |
53 | #include "xfs_dir_sf.h" | |
54 | #include "xfs_dir2_sf.h" | |
55 | #include "xfs_dinode.h" | |
56 | #include "xfs_inode_item.h" | |
57 | #include "xfs_inode.h" | |
58 | #include "xfs_bmap.h" | |
59 | #include "xfs_error.h" | |
60 | #include "xfs_bit.h" | |
61 | #include "xfs_rw.h" | |
62 | #include "xfs_quota.h" | |
63 | #include "xfs_trans_space.h" | |
64 | #include "xfs_iomap.h" | |
65 | ||
66 | ||
67 | STATIC xfs_fsize_t | |
68 | xfs_size_fn( | |
69 | xfs_inode_t *ip) | |
70 | { | |
71 | return (ip->i_d.di_size); | |
72 | } | |
73 | ||
74 | STATIC int | |
75 | xfs_ioinit( | |
76 | struct vfs *vfsp, | |
77 | struct xfs_mount_args *mntargs, | |
78 | int flags) | |
79 | { | |
80 | return xfs_mountfs(vfsp, XFS_VFSTOM(vfsp), flags); | |
81 | } | |
82 | ||
83 | xfs_ioops_t xfs_iocore_xfs = { | |
84 | .xfs_ioinit = (xfs_ioinit_t) xfs_ioinit, | |
85 | .xfs_bmapi_func = (xfs_bmapi_t) xfs_bmapi, | |
86 | .xfs_bmap_eof_func = (xfs_bmap_eof_t) xfs_bmap_eof, | |
87 | .xfs_iomap_write_direct = | |
88 | (xfs_iomap_write_direct_t) xfs_iomap_write_direct, | |
89 | .xfs_iomap_write_delay = | |
90 | (xfs_iomap_write_delay_t) xfs_iomap_write_delay, | |
91 | .xfs_iomap_write_allocate = | |
92 | (xfs_iomap_write_allocate_t) xfs_iomap_write_allocate, | |
93 | .xfs_iomap_write_unwritten = | |
94 | (xfs_iomap_write_unwritten_t) xfs_iomap_write_unwritten, | |
95 | .xfs_ilock = (xfs_lock_t) xfs_ilock, | |
96 | .xfs_lck_map_shared = (xfs_lck_map_shared_t) xfs_ilock_map_shared, | |
97 | .xfs_ilock_demote = (xfs_lock_demote_t) xfs_ilock_demote, | |
98 | .xfs_ilock_nowait = (xfs_lock_nowait_t) xfs_ilock_nowait, | |
99 | .xfs_unlock = (xfs_unlk_t) xfs_iunlock, | |
100 | .xfs_size_func = (xfs_size_t) xfs_size_fn, | |
101 | .xfs_iodone = (xfs_iodone_t) fs_noerr, | |
102 | }; | |
103 | ||
104 | void | |
105 | xfs_iocore_inode_reinit( | |
106 | xfs_inode_t *ip) | |
107 | { | |
108 | xfs_iocore_t *io = &ip->i_iocore; | |
109 | ||
110 | io->io_flags = 0; | |
111 | if (ip->i_d.di_flags & XFS_DIFLAG_REALTIME) | |
112 | io->io_flags |= XFS_IOCORE_RT; | |
113 | io->io_dmevmask = ip->i_d.di_dmevmask; | |
114 | io->io_dmstate = ip->i_d.di_dmstate; | |
115 | } | |
116 | ||
117 | void | |
118 | xfs_iocore_inode_init( | |
119 | xfs_inode_t *ip) | |
120 | { | |
121 | xfs_iocore_t *io = &ip->i_iocore; | |
122 | xfs_mount_t *mp = ip->i_mount; | |
123 | ||
124 | io->io_mount = mp; | |
125 | #ifdef DEBUG | |
126 | io->io_lock = &ip->i_lock; | |
127 | io->io_iolock = &ip->i_iolock; | |
128 | #endif | |
129 | ||
130 | io->io_obj = (void *)ip; | |
131 | ||
132 | xfs_iocore_inode_reinit(ip); | |
133 | } |