btrfs-progs: remove direct calls to crc32c from ctree.h

Make the helpers using crc32c not inline so the crc32c.h can be removed
from the public headers exported by libbtrfs.

Signed-off-by: David Sterba <dsterba@suse.com>
This commit is contained in:
David Sterba 2021-09-22 20:50:39 +02:00
parent 732d73dc1f
commit 785218efb1
3 changed files with 17 additions and 15 deletions

View File

@ -20,6 +20,7 @@
#include "kernel-shared/disk-io.h"
#include "kernel-shared/transaction.h"
#include "kernel-shared/print-tree.h"
#include "crypto/crc32c.h"
#include "common/repair.h"
#include "common/internal.h"
#include "common/messages.h"
@ -72,6 +73,19 @@ u16 btrfs_csum_type_size(u16 csum_type)
return btrfs_csums[csum_type].size;
}
u64 btrfs_name_hash(const char *name, int len)
{
return crc32c((u32)~1, name, len);
}
/*
* Figure the key offset of an extended inode ref
*/
u64 btrfs_extref_hash(u64 parent_objectid, const char *name, int len)
{
return (u64)crc32c(parent_objectid, name, len);
}
inline void btrfs_init_path(struct btrfs_path *p)
{
memset(p, 0, sizeof(*p));

View File

@ -27,14 +27,12 @@
#include "common/extent-cache.h"
#include "kernel-shared/extent_io.h"
#include "ioctl.h"
#include "crypto/crc32c.h"
#else
#include <btrfs/list.h>
#include <btrfs/kerncompat.h>
#include <btrfs/extent-cache.h>
#include <btrfs/extent_io.h>
#include <btrfs/ioctl.h>
#include <btrfs/crc32c.h>
#endif /* BTRFS_FLAT_INCLUDES */
struct btrfs_root;
@ -2542,19 +2540,8 @@ static inline int __btrfs_fs_compat_ro(struct btrfs_fs_info *fs_info, u64 flag)
((unsigned long)(btrfs_leaf_data(leaf) + \
btrfs_item_offset_nr(leaf, slot)))
static inline u64 btrfs_name_hash(const char *name, int len)
{
return crc32c((u32)~1, name, len);
}
/*
* Figure the key offset of an extended inode ref
*/
static inline u64 btrfs_extref_hash(u64 parent_objectid, const char *name,
int len)
{
return (u64)crc32c(parent_objectid, name, len);
}
u64 btrfs_name_hash(const char *name, int len);
u64 btrfs_extref_hash(u64 parent_objectid, const char *name, int len);
/* extent-tree.c */
int btrfs_reserve_extent(struct btrfs_trans_handle *trans,

View File

@ -37,6 +37,7 @@
#include "kernel-shared/volumes.h"
#include "kernel-shared/transaction.h"
#include "kernel-shared/zoned.h"
#include "crypto/crc32c.h"
#include "common/utils.h"
#include "common/path-utils.h"
#include "common/device-utils.h"