Skip to content

Commit 0124f42

Browse files
author
Kent Overstreet
committed
bcachefs: Don't pass memcmp() as a pointer
Some (buggy!) compilers have issues with this. Fixes: koverstreet/bcachefs#625 Signed-off-by: Kent Overstreet <[email protected]>
1 parent 57f2d20 commit 0124f42

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

fs/bcachefs/replicas.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@
99
static int bch2_cpu_replicas_to_sb_replicas(struct bch_fs *,
1010
struct bch_replicas_cpu *);
1111

12+
/* Some (buggy!) compilers don't allow memcmp to be passed as a pointer */
13+
static int bch2_memcmp(const void *l, const void *r, size_t size)
14+
{
15+
return memcmp(l, r, size);
16+
}
17+
1218
/* Replicas tracking - in memory: */
1319

1420
static void verify_replicas_entry(struct bch_replicas_entry_v1 *e)
@@ -33,7 +39,7 @@ void bch2_replicas_entry_sort(struct bch_replicas_entry_v1 *e)
3339

3440
static void bch2_cpu_replicas_sort(struct bch_replicas_cpu *r)
3541
{
36-
eytzinger0_sort(r->entries, r->nr, r->entry_size, memcmp, NULL);
42+
eytzinger0_sort(r->entries, r->nr, r->entry_size, bch2_memcmp, NULL);
3743
}
3844

3945
static void bch2_replicas_entry_v0_to_text(struct printbuf *out,
@@ -821,7 +827,7 @@ static int bch2_cpu_replicas_validate(struct bch_replicas_cpu *cpu_r,
821827
sort_cmp_size(cpu_r->entries,
822828
cpu_r->nr,
823829
cpu_r->entry_size,
824-
memcmp, NULL);
830+
bch2_memcmp, NULL);
825831

826832
for (i = 0; i < cpu_r->nr; i++) {
827833
struct bch_replicas_entry_v1 *e =

0 commit comments

Comments
 (0)