xfs: Implement xfs_readdir_dir2_node() function
[syslinux.git] / core / fs / xfs / xfs_dir2.h
blobc93983326da915266ccaf21cf5ccda9b364dcdb3
1 /*
2 * Copyright (c) 2012 Paulo Alcantara <pcacjr@zytor.com>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it would be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write the Free Software Foundation,
15 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
18 #ifndef XFS_DIR2_H_
19 #define XFS_DIR2_H_
21 #include <core.h>
22 #include <fs.h>
24 #include "xfs.h"
26 char *xfs_dir2_get_entry_name(uint8_t *start, uint8_t *end);
27 void *xfs_dir2_get_dirblks(struct fs_info *fs, block_t startblock,
28 xfs_filblks_t c);
29 uint32_t xfs_dir2_da_hashname(const uint8_t *name, int namelen);
30 block_t xfs_dir2_get_right_blk(struct fs_info *fs, xfs_dinode_t *core,
31 uint32_t from, uint32_t to, block_t fsblkno,
32 int *error);
34 struct inode *xfs_dir2_local_find_entry(const char *dname, struct inode *parent,
35 xfs_dinode_t *core);
36 struct inode *xfs_dir2_block_find_entry(const char *dname, struct inode *parent,
37 xfs_dinode_t *core);
38 struct inode *xfs_dir2_leaf_find_entry(const char *dname, struct inode *parent,
39 xfs_dinode_t *core);
40 struct inode *xfs_dir2_node_find_entry(const char *dname, struct inode *parent,
41 xfs_dinode_t *core);
43 static inline bool xfs_dir2_isleaf(struct fs_info *fs, xfs_dinode_t *dip)
45 uint64_t last = 0;
46 xfs_bmbt_irec_t irec;
48 bmbt_irec_get(&irec, ((xfs_bmbt_rec_t *)&dip->di_literal_area[0]) +
49 be32_to_cpu(dip->di_nextents) - 1);
50 last = irec.br_startoff + irec.br_blockcount;
52 return (last == XFS_INFO(fs)->dirleafblk + (1 << XFS_INFO(fs)->dirblklog));
55 #endif /* XFS_DIR2_H_ */