libxfs: split out xfs->libxfs mappings
The defines that map the external libxfs namespace are found only in
libxfs_priv.h. That means we have to re-declare all the exported
function prototypes in libxfs.h so that external uses know about
them and can use them. This also means we effectively have duplicate
function prototypes as they are all already declared in the xfs_*
namespace due to the includes of the libxfs header files through
libxfs.h.
Split the mapping macros out from libxfs_priv.h into a separate
libxfs_api_defs.h and include that header file directly in both
libxfs-priv.h and libxfs.h before we include any other header file.
This means that all the xfs_* namespace definitions are mapped to
libxfs_* namespaces correctly and we don't need to have duplicate
prototypes.
This also points out all the function prototypes the external code
uses but does not have function prototypes exposed by the mapped
libxfs header files, and hence indicates future kernel/user libxfs
synchronisation work that needs to be done.
Signed-off-by: Dave Chinner <dchinner@redhat.com>
diff --git a/include/libxfs.h b/include/libxfs.h
index 22f5e35..6a59cc0 100644
--- a/include/libxfs.h
+++ b/include/libxfs.h
@@ -19,6 +19,7 @@
#ifndef __LIBXFS_H__
#define __LIBXFS_H__
+#include <xfs/libxfs_api_defs.h>
#include <xfs/platform_defs.h>
#include <xfs/list.h>
@@ -153,11 +154,6 @@
libxfs_get_block_t *, void *);
-#define LIBXFS_ATTR_ROOT 0x0002 /* use attrs in root namespace */
-#define LIBXFS_ATTR_SECURE 0x0008 /* use attrs in security namespace */
-#define LIBXFS_ATTR_CREATE 0x0010 /* create, but fail if attr exists */
-#define LIBXFS_ATTR_REPLACE 0x0020 /* set, but fail if attr not exists */
-
/* Shared utility routines */
extern unsigned int libxfs_log2_roundup(unsigned int i);
@@ -187,121 +183,6 @@
#define XFS_INOBT_IS_FREE_DISK(rp,i) \
((be64_to_cpu((rp)->ir_free) & XFS_INOBT_MASK(i)) != 0)
-/*
- * public xfs kernel routines to be called as libxfs_*
- *
- * These are all present in the xfs_* namespace but we don't want that namespace
- * to be used or even exposed, and hence we declare them here explicitly if we
- * aren't directly building the libxfs code itself.
- *
- * XXX: This needs to be more formalised in the shared header files so that
- * these declarations can go away, and so there's documentation in the kernel
- * code base that certain functions are shared with userspace.
- */
-#ifndef __LIBXFS_INTERNAL_XFS_H__
-
-/* xfs_sb.h */
-void libxfs_log_sb(struct xfs_trans *tp);
-void libxfs_sb_from_disk(struct xfs_sb *, struct xfs_dsb *);
-void libxfs_sb_to_disk(struct xfs_dsb *, struct xfs_sb *);
-void libxfs_sb_quota_from_disk(struct xfs_sb *sbp);
-
-/* xfs_bmap.h */
-int libxfs_bmapi_write(struct xfs_trans *tp, struct xfs_inode *ip,
- xfs_fileoff_t bno, xfs_filblks_t len, int flags,
- xfs_fsblock_t *firstblock, xfs_extlen_t total,
- struct xfs_bmbt_irec *mval, int *nmap,
- struct xfs_bmap_free *flist);
-int libxfs_bunmapi(struct xfs_trans *tp, struct xfs_inode *ip,
- xfs_fileoff_t bno, xfs_filblks_t len, int flags,
- xfs_extnum_t nexts, xfs_fsblock_t *firstblock,
- struct xfs_bmap_free *flist, int *done);
-void libxfs_bmap_cancel(struct xfs_bmap_free *flist);
-int libxfs_bmap_last_offset(struct xfs_inode *ip,
- xfs_fileoff_t *unused, int whichfork);
-int libxfs_bmap_finish(struct xfs_trans **tp, struct xfs_bmap_free *flist,
- int *committed);
-
-/* xfs_dir2.h */
-int libxfs_dir_init(struct xfs_trans *tp, struct xfs_inode *dp,
- struct xfs_inode *pdp);
-int libxfs_dir_createname(struct xfs_trans *tp, struct xfs_inode *dp,
- struct xfs_name *name, xfs_ino_t inum,
- xfs_fsblock_t *first,
- struct xfs_bmap_free *flist, xfs_extlen_t tot);
-int libxfs_dir_lookup(struct xfs_trans *tp, struct xfs_inode *dp,
- struct xfs_name *name, xfs_ino_t *inum,
- struct xfs_name *ci_name);
-int libxfs_dir_replace(struct xfs_trans *tp, struct xfs_inode *dp,
- struct xfs_name *name, xfs_ino_t inum,
- xfs_fsblock_t *first,
- struct xfs_bmap_free *flist, xfs_extlen_t tot);
-
-int libxfs_dir2_isblock(struct xfs_da_args *args, int *r);
-int libxfs_dir2_isleaf(struct xfs_da_args *args, int *r);
-int libxfs_dir2_shrink_inode(struct xfs_da_args *args, xfs_dir2_db_t db,
- struct xfs_buf *bp);
-
-void libxfs_dir2_data_freescan(struct xfs_da_geometry *geo,
- const struct xfs_dir_ops *ops,
- struct xfs_dir2_data_hdr *hdr, int *loghead);
-
-void libxfs_dir2_data_log_entry(struct xfs_da_args *args,
- struct xfs_buf *bp, struct xfs_dir2_data_entry *dep);
-void libxfs_dir2_data_log_header(struct xfs_da_args *args,
- struct xfs_buf *bp);
-void libxfs_dir2_data_log_unused(struct xfs_da_args *args,
- struct xfs_buf *bp, struct xfs_dir2_data_unused *dup);
-void libxfs_dir2_data_make_free(struct xfs_da_args *args,
- struct xfs_buf *bp, xfs_dir2_data_aoff_t offset,
- xfs_dir2_data_aoff_t len, int *needlogp, int *needscanp);
-void libxfs_dir2_data_use_free(struct xfs_da_args *args,
- struct xfs_buf *bp, struct xfs_dir2_data_unused *dup,
- xfs_dir2_data_aoff_t offset, xfs_dir2_data_aoff_t len,
- int *needlogp, int *needscanp);
-
-/* xfs_da_btree.h */
-uint libxfs_da_hashname(const __uint8_t *name_string, int name_length);
-int libxfs_da_shrink_inode(xfs_da_args_t *args, xfs_dablk_t dead_blkno,
- struct xfs_buf *dead_buf);
-int libxfs_da_read_buf(struct xfs_trans *trans, struct xfs_inode *dp,
- xfs_dablk_t bno, xfs_daddr_t mappedbno,
- struct xfs_buf **bpp, int whichfork,
- const struct xfs_buf_ops *ops);
-
-
-/* xfs_inode_buf.h */
-void libxfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *);
-
-/* xfs_inode_fork.h */
-void libxfs_idata_realloc(struct xfs_inode *, int, int);
-
-/* xfs_symlink_remote.h */
-int libxfs_symlink_blocks(struct xfs_mount *mp, int pathlen);
-bool libxfs_symlink_hdr_ok(xfs_ino_t ino, uint32_t offset, uint32_t size,
- struct xfs_buf *bp);
-
-/* xfs_bit.h */
-/* XXX: these are special as they are static inline functions in the header */
-#define libxfs_highbit32 xfs_highbit32
-#define libxfs_highbit64 xfs_highbit64
-
-/* xfs_alloc.c */
-int libxfs_alloc_fix_freelist(xfs_alloc_arg_t *, int);
-
-/* xfs_attr.c */
-int libxfs_attr_get(struct xfs_inode *, const unsigned char *,
- unsigned char *, int *, int);
-int libxfs_attr_set(struct xfs_inode *, const unsigned char *,
- unsigned char *, int, int);
-int libxfs_attr_remove(struct xfs_inode *, const unsigned char *, int);
-
-/* xfs_bmap.c */
-xfs_bmbt_rec_host_t *xfs_bmap_search_extents(struct xfs_inode *, xfs_fileoff_t,
- int, int *, xfs_extnum_t *, xfs_bmbt_irec_t *,
- xfs_bmbt_irec_t *);
-void libxfs_bmbt_get_all(struct xfs_bmbt_rec_host *r, struct xfs_bmbt_irec *s);
-
static inline void
libxfs_bmbt_disk_get_all(
struct xfs_bmbt_rec *rp,
@@ -314,21 +195,18 @@
libxfs_bmbt_get_all(&hrec, irec);
}
-void libxfs_dinode_from_disk(struct xfs_icdinode *,
- struct xfs_dinode *);
-bool libxfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino,
- struct xfs_dinode *dip);
-
-/* this file */
-/* XXX: this needs cleanup like the xfs_bit.h stuff */
-#define libxfs_verify_cksum xfs_verify_cksum
-#define libxfs_buf_verify_cksum xfs_buf_verify_cksum
-#define libxfs_buf_update_cksum xfs_buf_update_cksum
-
-#endif /* __LIBXFS_INTERNAL_XFS_H__ */
-
/* XXX: this is clearly a bug - a shared header needs to export this */
/* xfs_rtalloc.c */
int libxfs_rtfree_extent(struct xfs_trans *, xfs_rtblock_t, xfs_extlen_t);
+/* XXX: need parts of xfs_attr.h in userspace */
+#define LIBXFS_ATTR_ROOT 0x0002 /* use attrs in root namespace */
+#define LIBXFS_ATTR_SECURE 0x0008 /* use attrs in security namespace */
+#define LIBXFS_ATTR_CREATE 0x0010 /* create, but fail if attr exists */
+#define LIBXFS_ATTR_REPLACE 0x0020 /* set, but fail if attr not exists */
+
+int xfs_attr_remove(struct xfs_inode *dp, const unsigned char *name, int flags);
+int xfs_attr_set(struct xfs_inode *dp, const unsigned char *name,
+ unsigned char *value, int valuelen, int flags);
+
#endif /* __LIBXFS_H__ */
diff --git a/libxfs/Makefile b/libxfs/Makefile
index df4e369..981cb0b 100644
--- a/libxfs/Makefile
+++ b/libxfs/Makefile
@@ -46,7 +46,8 @@
xfs_shared.h \
xfs_trans_resv.h \
xfs_trans_space.h \
- libxfs_io.h
+ libxfs_io.h \
+ libxfs_api_defs.h
CFILES = cache.c \
crc32.c \
diff --git a/libxfs/libxfs_api_defs.h b/libxfs/libxfs_api_defs.h
new file mode 100644
index 0000000..f843e7d
--- /dev/null
+++ b/libxfs/libxfs_api_defs.h
@@ -0,0 +1,111 @@
+/*
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it would be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef __LIBXFS_API_DEFS_H__
+#define __LIBXFS_API_DEFS_H__
+
+/*
+ * This file defines all the kernel based functions we expose to userspace
+ * via the libxfs_* namespace. This is kept in a separate header file so
+ * it can be included in both the internal and external libxfs header files
+ * without introducing any depenencies between the two.
+ */
+#define xfs_highbit32 libxfs_highbit32
+#define xfs_highbit64 libxfs_highbit64
+
+#define xfs_fs_repair_cmn_err libxfs_fs_repair_cmn_err
+#define xfs_fs_cmn_err libxfs_fs_cmn_err
+
+#define xfs_trans_alloc libxfs_trans_alloc
+#define xfs_trans_add_item libxfs_trans_add_item
+#define xfs_trans_bhold libxfs_trans_bhold
+#define xfs_trans_binval libxfs_trans_binval
+#define xfs_trans_bjoin libxfs_trans_bjoin
+#define xfs_trans_brelse libxfs_trans_brelse
+#define xfs_trans_commit libxfs_trans_commit
+#define xfs_trans_cancel libxfs_trans_cancel
+#define xfs_trans_del_item libxfs_trans_del_item
+#define xfs_trans_dup libxfs_trans_dup
+#define xfs_trans_get_buf libxfs_trans_get_buf
+#define xfs_trans_getsb libxfs_trans_getsb
+#define xfs_trans_iget libxfs_trans_iget
+#define xfs_trans_ichgtime libxfs_trans_ichgtime
+#define xfs_trans_ijoin libxfs_trans_ijoin
+#define xfs_trans_ijoin_ref libxfs_trans_ijoin_ref
+#define xfs_trans_init libxfs_trans_init
+#define xfs_trans_inode_alloc_buf libxfs_trans_inode_alloc_buf
+#define xfs_trans_log_buf libxfs_trans_log_buf
+#define xfs_trans_log_inode libxfs_trans_log_inode
+#define xfs_trans_mod_sb libxfs_trans_mod_sb
+#define xfs_trans_read_buf libxfs_trans_read_buf
+#define xfs_trans_read_buf_map libxfs_trans_read_buf_map
+#define xfs_trans_roll libxfs_trans_roll
+#define xfs_trans_get_buf_map libxfs_trans_get_buf_map
+#define xfs_trans_reserve libxfs_trans_reserve
+#define xfs_trans_resv_calc libxfs_trans_resv_calc
+
+#define xfs_attr_get libxfs_attr_get
+#define xfs_attr_set libxfs_attr_set
+#define xfs_attr_remove libxfs_attr_remove
+#define xfs_attr_leaf_newentsize libxfs_attr_leaf_newentsize
+
+#define xfs_alloc_fix_freelist libxfs_alloc_fix_freelist
+#define xfs_bmap_cancel libxfs_bmap_cancel
+#define xfs_bmap_last_offset libxfs_bmap_last_offset
+#define xfs_bmap_search_extents libxfs_bmap_search_extents
+#define xfs_bmap_finish libxfs_bmap_finish
+#define xfs_bmapi_write libxfs_bmapi_write
+#define xfs_bmapi_read libxfs_bmapi_read
+#define xfs_bunmapi libxfs_bunmapi
+#define xfs_bmbt_get_all libxfs_bmbt_get_all
+#define xfs_rtfree_extent libxfs_rtfree_extent
+
+#define xfs_da_brelse libxfs_da_brelse
+#define xfs_da_hashname libxfs_da_hashname
+#define xfs_da_shrink_inode libxfs_da_shrink_inode
+#define xfs_da_read_buf libxfs_da_read_buf
+#define xfs_dir_createname libxfs_dir_createname
+#define xfs_dir_init libxfs_dir_init
+#define xfs_dir_lookup libxfs_dir_lookup
+#define xfs_dir_replace libxfs_dir_replace
+#define xfs_dir2_isblock libxfs_dir2_isblock
+#define xfs_dir2_isleaf libxfs_dir2_isleaf
+#define __xfs_dir2_data_freescan libxfs_dir2_data_freescan
+#define xfs_dir2_data_log_entry libxfs_dir2_data_log_entry
+#define xfs_dir2_data_log_header libxfs_dir2_data_log_header
+#define xfs_dir2_data_make_free libxfs_dir2_data_make_free
+#define xfs_dir2_data_use_free libxfs_dir2_data_use_free
+#define xfs_dir2_shrink_inode libxfs_dir2_shrink_inode
+
+#define xfs_dinode_from_disk libxfs_dinode_from_disk
+#define xfs_dinode_to_disk libxfs_dinode_to_disk
+#define xfs_dinode_calc_crc libxfs_dinode_calc_crc
+#define xfs_idata_realloc libxfs_idata_realloc
+#define xfs_idestroy_fork libxfs_idestroy_fork
+
+#define xfs_log_sb libxfs_log_sb
+#define xfs_sb_from_disk libxfs_sb_from_disk
+#define xfs_sb_quota_from_disk libxfs_sb_quota_from_disk
+#define xfs_sb_to_disk libxfs_sb_to_disk
+
+#define xfs_symlink_blocks libxfs_symlink_blocks
+#define xfs_symlink_hdr_ok libxfs_symlink_hdr_ok
+
+#define xfs_verify_cksum libxfs_verify_cksum
+
+#endif /* __LIBXFS_API_DEFS_H__ */
diff --git a/libxfs/libxfs_priv.h b/libxfs/libxfs_priv.h
index 26db719..1b4ac64 100644
--- a/libxfs/libxfs_priv.h
+++ b/libxfs/libxfs_priv.h
@@ -50,123 +50,14 @@
#define __LIBXFS_INTERNAL_XFS_H__
/*
- * repair doesn't have a inode when it calls libxfs_dir2_data_freescan,
- * so we map this internally for now.
+ * Repair doesn't have a inode when it calls libxfs_dir2_data_freescan,
+ * so we to work around this internally for now.
*/
#define xfs_dir2_data_freescan(ip, hdr, loghead) \
__xfs_dir2_data_freescan((ip)->i_mount->m_dir_geo, \
(ip)->d_ops, hdr, loghead)
-/*
- * start by remapping all the symbols we expect external users to call
- * to the libxfs_ namespace. This ensures that all internal symbols are
- * remapped correctly throughout all the included header files
- * as well as in the C code.
- */
-#define xfs_alloc_fix_freelist libxfs_alloc_fix_freelist
-#define xfs_attr_get libxfs_attr_get
-#define xfs_attr_set libxfs_attr_set
-#define xfs_attr_remove libxfs_attr_remove
-#define xfs_rtfree_extent libxfs_rtfree_extent
-
-#define xfs_fs_repair_cmn_err libxfs_fs_repair_cmn_err
-#define xfs_fs_cmn_err libxfs_fs_cmn_err
-
-#define xfs_bmap_finish libxfs_bmap_finish
-#define xfs_trans_ichgtime libxfs_trans_ichgtime
-
-#define xfs_trans_alloc libxfs_trans_alloc
-#define xfs_trans_add_item libxfs_trans_add_item
-#define xfs_trans_bhold libxfs_trans_bhold
-#define xfs_trans_binval libxfs_trans_binval
-#define xfs_trans_bjoin libxfs_trans_bjoin
-#define xfs_trans_brelse libxfs_trans_brelse
-#define xfs_trans_commit libxfs_trans_commit
-#define xfs_trans_cancel libxfs_trans_cancel
-#define xfs_trans_del_item libxfs_trans_del_item
-#define xfs_trans_dup libxfs_trans_dup
-#define xfs_trans_get_buf libxfs_trans_get_buf
-#define xfs_trans_getsb libxfs_trans_getsb
-#define xfs_trans_iget libxfs_trans_iget
-#define xfs_trans_ijoin libxfs_trans_ijoin
-#define xfs_trans_ijoin_ref libxfs_trans_ijoin_ref
-#define xfs_trans_init libxfs_trans_init
-#define xfs_trans_inode_alloc_buf libxfs_trans_inode_alloc_buf
-#define xfs_trans_log_buf libxfs_trans_log_buf
-#define xfs_trans_log_inode libxfs_trans_log_inode
-#define xfs_trans_mod_sb libxfs_trans_mod_sb
-#define xfs_trans_read_buf libxfs_trans_read_buf
-#define xfs_trans_read_buf_map libxfs_trans_read_buf_map
-#define xfs_trans_roll libxfs_trans_roll
-#define xfs_trans_get_buf_map libxfs_trans_get_buf_map
-#define xfs_trans_reserve libxfs_trans_reserve
-
-/* xfs_attr_leaf.h */
-#define xfs_attr_leaf_newentsize libxfs_attr_leaf_newentsize
-
-/* xfs_bit.h */
-#define xfs_highbit32 libxfs_highbit32
-#define xfs_highbit64 libxfs_highbit64
-
-/* xfs_bmap.h */
-#define xfs_bmap_cancel libxfs_bmap_cancel
-#define xfs_bmap_last_offset libxfs_bmap_last_offset
-#define xfs_bmapi_write libxfs_bmapi_write
-#define xfs_bmapi_read libxfs_bmapi_read
-#define xfs_bunmapi libxfs_bunmapi
-
-/* xfs_bmap_btree.h */
-#define xfs_bmbt_get_all libxfs_bmbt_get_all
-
-/* xfs_da_btree.h */
-#define xfs_da_brelse libxfs_da_brelse
-#define xfs_da_hashname libxfs_da_hashname
-#define xfs_da_shrink_inode libxfs_da_shrink_inode
-#define xfs_da_read_buf libxfs_da_read_buf
-
-/* xfs_dir2.h */
-#define xfs_dir_createname libxfs_dir_createname
-#define xfs_dir_init libxfs_dir_init
-#define xfs_dir_lookup libxfs_dir_lookup
-#define xfs_dir_replace libxfs_dir_replace
-#define xfs_dir2_isblock libxfs_dir2_isblock
-#define xfs_dir2_isleaf libxfs_dir2_isleaf
-
-/* xfs_dir2_data.h */
-#define __xfs_dir2_data_freescan libxfs_dir2_data_freescan
-#define xfs_dir2_data_log_entry libxfs_dir2_data_log_entry
-#define xfs_dir2_data_log_header libxfs_dir2_data_log_header
-#define xfs_dir2_data_make_free libxfs_dir2_data_make_free
-#define xfs_dir2_data_use_free libxfs_dir2_data_use_free
-#define xfs_dir2_shrink_inode libxfs_dir2_shrink_inode
-
-/* xfs_inode.h */
-#define xfs_dinode_from_disk libxfs_dinode_from_disk
-#define xfs_dinode_to_disk libxfs_dinode_to_disk
-#define xfs_dinode_calc_crc libxfs_dinode_calc_crc
-#define xfs_idata_realloc libxfs_idata_realloc
-#define xfs_idestroy_fork libxfs_idestroy_fork
-
-#define xfs_dinode_verify libxfs_dinode_verify
-
-/* xfs_sb.h */
-#define xfs_log_sb libxfs_log_sb
-#define xfs_sb_from_disk libxfs_sb_from_disk
-#define xfs_sb_quota_from_disk libxfs_sb_quota_from_disk
-#define xfs_sb_to_disk libxfs_sb_to_disk
-
-/* xfs_symlink.h */
-#define xfs_symlink_blocks libxfs_symlink_blocks
-#define xfs_symlink_hdr_ok libxfs_symlink_hdr_ok
-
-/* xfs_trans_resv.h */
-#define xfs_trans_resv_calc libxfs_trans_resv_calc
-
-
-/*
- * Now we've renamed and mapped everything, include the rest of the external
- * libxfs headers.
- */
+#include "libxfs_api_defs.h"
#include <xfs/platform_defs.h>
#include <xfs/list.h>
diff --git a/libxfs/xfs_alloc.h b/libxfs/xfs_alloc.h
index d1b4b6a..db5da4a 100644
--- a/libxfs/xfs_alloc.h
+++ b/libxfs/xfs_alloc.h
@@ -233,5 +233,6 @@
int xfs_read_agf(struct xfs_mount *mp, struct xfs_trans *tp,
xfs_agnumber_t agno, int flags, struct xfs_buf **bpp);
+int xfs_alloc_fix_freelist(struct xfs_alloc_arg *args, int flags);
#endif /* __XFS_ALLOC_H__ */
diff --git a/libxfs/xfs_bmap.h b/libxfs/xfs_bmap.h
index 6aaa0c1..85143e5 100644
--- a/libxfs/xfs_bmap.h
+++ b/libxfs/xfs_bmap.h
@@ -222,4 +222,11 @@
int num_exts);
int xfs_bmap_split_extent(struct xfs_inode *ip, xfs_fileoff_t split_offset);
+struct xfs_bmbt_rec_host *
+ xfs_bmap_search_extents(struct xfs_inode *ip, xfs_fileoff_t bno,
+ int fork, int *eofp, xfs_extnum_t *lastxp,
+ struct xfs_bmbt_irec *gotp,
+ struct xfs_bmbt_irec *prevp);
+
+
#endif /* __XFS_BMAP_H__ */
diff --git a/libxfs/xfs_inode_buf.c b/libxfs/xfs_inode_buf.c
index 28085b3..fd48f04 100644
--- a/libxfs/xfs_inode_buf.c
+++ b/libxfs/xfs_inode_buf.c
@@ -287,7 +287,7 @@
bool
xfs_dinode_verify(
struct xfs_mount *mp,
- struct xfs_inode *ip,
+ xfs_ino_t ino,
struct xfs_dinode *dip)
{
if (dip->di_magic != cpu_to_be16(XFS_DINODE_MAGIC))
@@ -302,7 +302,7 @@
if (!xfs_verify_cksum((char *)dip, mp->m_sb.sb_inodesize,
XFS_DINODE_CRC_OFF))
return false;
- if (be64_to_cpu(dip->di_ino) != ip->i_ino)
+ if (be64_to_cpu(dip->di_ino) != ino)
return false;
if (!uuid_equal(&dip->di_uuid, &mp->m_sb.sb_uuid))
return false;
@@ -380,7 +380,7 @@
return error;
/* even unallocated inodes are verified */
- if (!xfs_dinode_verify(mp, ip, dip)) {
+ if (!xfs_dinode_verify(mp, ip->i_ino, dip)) {
xfs_alert(mp, "%s: validation failed for inode %lld failed",
__func__, ip->i_ino);
diff --git a/libxfs/xfs_inode_buf.h b/libxfs/xfs_inode_buf.h
index 9308c47..dd38034 100644
--- a/libxfs/xfs_inode_buf.h
+++ b/libxfs/xfs_inode_buf.h
@@ -40,6 +40,8 @@
void xfs_dinode_calc_crc(struct xfs_mount *, struct xfs_dinode *);
void xfs_dinode_to_disk(struct xfs_dinode *to, struct xfs_icdinode *from);
void xfs_dinode_from_disk(struct xfs_icdinode *to, struct xfs_dinode *from);
+bool xfs_dinode_verify(struct xfs_mount *mp, xfs_ino_t ino,
+ struct xfs_dinode *dip);
#if defined(DEBUG)
void xfs_inobp_check(struct xfs_mount *, struct xfs_buf *);
diff --git a/repair/phase6.c b/repair/phase6.c
index 7843ecd..130ed4f 100644
--- a/repair/phase6.c
+++ b/repair/phase6.c
@@ -454,7 +454,8 @@
(error = xfs_iread_extents(tp, ip, whichfork)))
return error;
bno = *bnop + 1;
- xfs_bmap_search_extents(ip, bno, whichfork, &eof, &lastx, &got, &prev);
+ libxfs_bmap_search_extents(ip, bno, whichfork, &eof, &lastx,
+ &got, &prev);
if (eof)
*bnop = NULLFILEOFF;
else