/* Check for the cursor referring to the last block at the given level.  */
int xfs_btree_islastblock(xfs_btree_cur_t *cur, int level)
/* Check for the cursor referring to the last block at the given level.  */
int xfs_btree_islastblock(xfs_btree_cur_t *cur, int level)
{
	struct xfs_btree_block	*block;
	xfs_buf_t		*bp;
	block = xfs_btree_get_block(cur, level, &bp);
	xfs_btree_check_block(cur, block, level, bp);
	if (cur->bc_flags & XFS_BTREE_LONG_PTRS)
		return be64_to_cpu(block->bb_u.l.bb_rightsib) == NULLDFSBNO;
	else
		return be32_to_cpu(block->bb_u.s.bb_rightsib) == NULLAGBLOCK;
}