include/linux/ceph/decode.h
Source file repositories/reference/linux-study-clean/include/linux/ceph/decode.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/ceph/decode.h- Extension
.h- Size
- 10174 bytes
- Lines
- 399
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/err.hlinux/bug.hlinux/slab.hlinux/time.hlinux/unaligned.hlinux/ceph/types.h
Detected Declarations
function bufferfunction ceph_decode_32function ceph_decode_16function ceph_decode_8function ceph_decode_copyfunction ceph_has_roomfunction lengthfunction ceph_decode_timespec64function ceph_encode_timespec64function ceph_encode_banner_addrfunction ceph_decode_banner_addrfunction ceph_encode_64function ceph_encode_32function ceph_encode_16function ceph_encode_8function ceph_encode_copyfunction ceph_encode_filepathfunction ceph_encode_stringfunction ceph_start_encodingfunction ceph_start_decoding
Annotated Snippet
while (len--) { \
ceph_decode_skip_##ktype(p, end, bad); \
ceph_decode_skip_##vtype(p, end, bad); \
} \
} while (0)
#define ceph_decode_skip_map_of_map(p, end, ktype1, ktype2, vtype2, bad) \
do { \
u32 len; \
\
ceph_decode_32_safe(p, end, len, bad); \
while (len--) { \
ceph_decode_skip_##ktype1(p, end, bad); \
ceph_decode_skip_map(p, end, ktype2, vtype2, bad); \
} \
} while (0)
/*
* struct ceph_timespec <-> struct timespec64
*/
static inline void ceph_decode_timespec64(struct timespec64 *ts,
const struct ceph_timespec *tv)
{
/*
* This will still overflow in year 2106. We could extend
* the protocol to steal two more bits from tv_nsec to
* add three more 136 year epochs after that the way ext4
* does if necessary.
*/
ts->tv_sec = (time64_t)le32_to_cpu(tv->tv_sec);
ts->tv_nsec = (long)le32_to_cpu(tv->tv_nsec);
}
static inline void ceph_encode_timespec64(struct ceph_timespec *tv,
const struct timespec64 *ts)
{
tv->tv_sec = cpu_to_le32((u32)ts->tv_sec);
tv->tv_nsec = cpu_to_le32((u32)ts->tv_nsec);
}
/*
* sockaddr_storage <-> ceph_sockaddr
*/
#define CEPH_ENTITY_ADDR_TYPE_NONE 0
#define CEPH_ENTITY_ADDR_TYPE_LEGACY __cpu_to_le32(1)
#define CEPH_ENTITY_ADDR_TYPE_MSGR2 __cpu_to_le32(2)
#define CEPH_ENTITY_ADDR_TYPE_ANY __cpu_to_le32(3)
static inline void ceph_encode_banner_addr(struct ceph_entity_addr *a)
{
__be16 ss_family = htons(a->in_addr.ss_family);
a->in_addr.ss_family = *(__u16 *)&ss_family;
/* Banner addresses require TYPE_NONE */
a->type = CEPH_ENTITY_ADDR_TYPE_NONE;
}
static inline void ceph_decode_banner_addr(struct ceph_entity_addr *a)
{
__be16 ss_family = *(__be16 *)&a->in_addr.ss_family;
a->in_addr.ss_family = ntohs(ss_family);
WARN_ON(a->in_addr.ss_family == 512);
a->type = CEPH_ENTITY_ADDR_TYPE_LEGACY;
}
extern int ceph_decode_entity_addr(void **p, void *end,
struct ceph_entity_addr *addr);
int ceph_decode_entity_addrvec(void **p, void *end, bool msgr2,
struct ceph_entity_addr *addr);
int ceph_entity_addr_encoding_len(const struct ceph_entity_addr *addr);
void ceph_encode_entity_addr(void **p, const struct ceph_entity_addr *addr);
/*
* encoders
*/
static inline void ceph_encode_64(void **p, u64 v)
{
put_unaligned_le64(v, (__le64 *)*p);
*p += sizeof(u64);
}
static inline void ceph_encode_32(void **p, u32 v)
{
put_unaligned_le32(v, (__le32 *)*p);
*p += sizeof(u32);
}
static inline void ceph_encode_16(void **p, u16 v)
{
put_unaligned_le16(v, (__le16 *)*p);
*p += sizeof(u16);
}
static inline void ceph_encode_8(void **p, u8 v)
Annotation
- Immediate include surface: `linux/err.h`, `linux/bug.h`, `linux/slab.h`, `linux/time.h`, `linux/unaligned.h`, `linux/ceph/types.h`.
- Detected declarations: `function buffer`, `function ceph_decode_32`, `function ceph_decode_16`, `function ceph_decode_8`, `function ceph_decode_copy`, `function ceph_has_room`, `function length`, `function ceph_decode_timespec64`, `function ceph_encode_timespec64`, `function ceph_encode_banner_addr`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.