Commit | Line | Data |
---|---|---|
68988114 DC |
1 | /* |
2 | * Copyright (c) 2000-2006 Silicon Graphics, Inc. | |
3 | * All Rights Reserved. | |
4 | * | |
5 | * This program is free software; you can redistribute it and/or | |
6 | * modify it under the terms of the GNU General Public License as | |
7 | * published by the Free Software Foundation. | |
8 | * | |
9 | * This program is distributed in the hope that it would be useful, | |
10 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
11 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
12 | * GNU General Public License for more details. | |
13 | * | |
14 | * You should have received a copy of the GNU General Public License | |
15 | * along with this program; if not, write the Free Software Foundation, | |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | |
17 | */ | |
18 | #ifndef __XFS_BMAP_UTIL_H__ | |
19 | #define __XFS_BMAP_UTIL_H__ | |
20 | ||
21 | /* Kernel only BMAP related definitions and functions */ | |
22 | ||
23 | struct xfs_bmbt_irec; | |
c24b5dfa | 24 | struct xfs_bmap_free_item; |
68988114 DC |
25 | struct xfs_ifork; |
26 | struct xfs_inode; | |
27 | struct xfs_mount; | |
28 | struct xfs_trans; | |
9799b438 | 29 | struct xfs_bmalloca; |
68988114 | 30 | |
68988114 | 31 | int xfs_bmap_rtalloc(struct xfs_bmalloca *ap); |
68988114 DC |
32 | int xfs_bmap_eof(struct xfs_inode *ip, xfs_fileoff_t endoff, |
33 | int whichfork, int *eof); | |
34 | int xfs_bmap_count_blocks(struct xfs_trans *tp, struct xfs_inode *ip, | |
35 | int whichfork, int *count); | |
36 | int xfs_bmap_punch_delalloc_range(struct xfs_inode *ip, | |
37 | xfs_fileoff_t start_fsb, xfs_fileoff_t length); | |
38 | ||
39 | /* bmap to userspace formatter - copy to user & advance pointer */ | |
40 | typedef int (*xfs_bmap_format_t)(void **, struct getbmapx *, int *); | |
41 | int xfs_getbmap(struct xfs_inode *ip, struct getbmapx *bmv, | |
42 | xfs_bmap_format_t formatter, void *arg); | |
43 | ||
44 | /* functions in xfs_bmap.c that are only needed by xfs_bmap_util.c */ | |
45 | void xfs_bmap_del_free(struct xfs_bmap_free *flist, | |
46 | struct xfs_bmap_free_item *prev, | |
47 | struct xfs_bmap_free_item *free); | |
48 | int xfs_bmap_extsize_align(struct xfs_mount *mp, struct xfs_bmbt_irec *gotp, | |
49 | struct xfs_bmbt_irec *prevp, xfs_extlen_t extsz, | |
50 | int rt, int eof, int delay, int convert, | |
51 | xfs_fileoff_t *offp, xfs_extlen_t *lenp); | |
52 | void xfs_bmap_adjacent(struct xfs_bmalloca *ap); | |
53 | int xfs_bmap_last_extent(struct xfs_trans *tp, struct xfs_inode *ip, | |
54 | int whichfork, struct xfs_bmbt_irec *rec, | |
55 | int *is_empty); | |
56 | ||
c24b5dfa | 57 | /* preallocation and hole punch interface */ |
83aee9e4 CH |
58 | int xfs_alloc_file_space(struct xfs_inode *ip, xfs_off_t offset, |
59 | xfs_off_t len, int alloc_type); | |
60 | int xfs_free_file_space(struct xfs_inode *ip, xfs_off_t offset, | |
61 | xfs_off_t len); | |
865e9446 CH |
62 | int xfs_zero_file_space(struct xfs_inode *ip, xfs_off_t offset, |
63 | xfs_off_t len); | |
e1d8fb88 NJ |
64 | int xfs_collapse_file_space(struct xfs_inode *, xfs_off_t offset, |
65 | xfs_off_t len); | |
a904b1ca NJ |
66 | int xfs_insert_file_space(struct xfs_inode *, xfs_off_t offset, |
67 | xfs_off_t len); | |
c24b5dfa DC |
68 | |
69 | /* EOF block manipulation functions */ | |
70 | bool xfs_can_free_eofblocks(struct xfs_inode *ip, bool force); | |
71 | int xfs_free_eofblocks(struct xfs_mount *mp, struct xfs_inode *ip, | |
72 | bool need_iolock); | |
73 | ||
a133d952 DC |
74 | int xfs_swap_extents(struct xfs_inode *ip, struct xfs_inode *tip, |
75 | struct xfs_swapext *sx); | |
76 | ||
68988114 DC |
77 | xfs_daddr_t xfs_fsb_to_db(struct xfs_inode *ip, xfs_fsblock_t fsb); |
78 | ||
79 | #endif /* __XFS_BMAP_UTIL_H__ */ |