linux/fs/bcachefs/bkey_types.h

/* SPDX-License-Identifier: GPL-2.0 */
#ifndef _BCACHEFS_BKEY_TYPES_H
#define _BCACHEFS_BKEY_TYPES_H

#include "bcachefs_format.h"

/*
 * bkey_i	- bkey with inline value
 * bkey_s	- bkey with split value
 * bkey_s_c	- bkey with split value, const
 */

#define bkey_p_next(_k)

static inline struct bkey_i *bkey_next(struct bkey_i *k)
{}

#define bkey_val_u64s(_k)

static inline size_t bkey_val_bytes(const struct bkey *k)
{}

static inline void set_bkey_val_u64s(struct bkey *k, unsigned val_u64s)
{}

static inline void set_bkey_val_bytes(struct bkey *k, unsigned bytes)
{}

#define bkey_val_end(_k)

#define bkey_deleted(_k)

#define bkey_whiteout(_k)

/* bkey with split value, const */
struct bkey_s_c {};

/* bkey with split value */
struct bkey_s {};

#define bkey_s_null
#define bkey_s_c_null

#define bkey_s_err(err)
#define bkey_s_c_err(err)

static inline struct bkey_s bkey_to_s(struct bkey *k)
{}

static inline struct bkey_s_c bkey_to_s_c(const struct bkey *k)
{}

static inline struct bkey_s bkey_i_to_s(struct bkey_i *k)
{}

static inline struct bkey_s_c bkey_i_to_s_c(const struct bkey_i *k)
{}

/*
 * For a given type of value (e.g. struct bch_extent), generates the types for
 * bkey + bch_extent - inline, split, split const - and also all the conversion
 * functions, which also check that the value is of the correct type.
 *
 * We use anonymous unions for upcasting - e.g. converting from e.g. a
 * bkey_i_extent to a bkey_i - since that's always safe, instead of conversion
 * functions.
 */
#define x

BCH_BKEY_TYPES();
#undef x

#endif /* _BCACHEFS_BKEY_TYPES_H */