tools/net/ynl/lib/ynl-priv.h
Source file repositories/reference/linux-study-clean/tools/net/ynl/lib/ynl-priv.h
File Facts
- System
- Linux kernel
- Corpus path
tools/net/ynl/lib/ynl-priv.h- Extension
.h- Size
- 11244 bytes
- Lines
- 479
- Domain
- Support Tooling And Documentation
- Bucket
- tools
- Inferred role
- Support Tooling And Documentation: implementation source
- Status
- source implementation candidate
Why This File Exists
Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Repository support layer: documentation, build tooling, samples, user-space helper tools, generated initramfs support, licenses, and validation utilities.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdbool.hstddef.hlinux/types.h
Detected Declarations
struct ynl_parse_argstruct ynl_policy_attrstruct ynl_policy_neststruct ynl_parse_argstruct ynl_dump_list_typestruct ynl_ntf_base_typestruct ynl_req_statestruct ynl_dump_statestruct ynl_ntf_infoenum ynl_policy_typeenum ynl_parse_resultfunction ynl_dump_obj_is_lastfunction ynl_nlmsg_data_lenfunction ynl_nlmsg_data_offsetfunction ynl_nlmsg_put_extra_headerfunction ynl_attr_typefunction ynl_attr_data_lenfunction ynl_attr_if_goodfunction ynl_attr_nextfunction ynl_attr_firstfunction __ynl_attr_put_overflowfunction ynl_attr_nest_startfunction ynl_attr_nest_endfunction ynl_attr_putfunction ynl_attr_put_strfunction ynl_attr_get_s8function ynl_attr_get_s16function ynl_attr_get_s32function ynl_attr_get_s64function ynl_attr_get_u8function ynl_attr_get_u16function ynl_attr_get_u32function ynl_attr_get_u64function ynl_attr_put_s8function ynl_attr_put_s16function ynl_attr_put_s32function ynl_attr_put_s64function ynl_attr_put_u8function ynl_attr_put_u16function ynl_attr_put_u32function ynl_attr_put_u64function ynl_attr_get_uintfunction ynl_attr_get_sintfunction ynl_attr_put_uintfunction ynl_attr_put_sintfunction ynl_attr_validate
Annotated Snippet
struct ynl_policy_attr {
enum ynl_policy_type type:8;
__u8 is_submsg:1;
__u8 is_selector:1;
__u16 selector_type;
unsigned int len;
const char *name;
const struct ynl_policy_nest *nest;
};
struct ynl_policy_nest {
unsigned int max_attr;
const struct ynl_policy_attr *table;
};
struct ynl_parse_arg {
struct ynl_sock *ys;
const struct ynl_policy_nest *rsp_policy;
void *data;
};
struct ynl_dump_list_type {
struct ynl_dump_list_type *next;
unsigned char data[] __attribute__((aligned(8)));
};
extern struct ynl_dump_list_type *YNL_LIST_END;
static inline bool ynl_dump_obj_is_last(void *obj)
{
unsigned long uptr = (unsigned long)obj;
uptr -= offsetof(struct ynl_dump_list_type, data);
return uptr == (unsigned long)YNL_LIST_END;
}
static inline void *ynl_dump_obj_next(void *obj)
{
unsigned long uptr = (unsigned long)obj;
struct ynl_dump_list_type *list;
uptr -= offsetof(struct ynl_dump_list_type, data);
list = (struct ynl_dump_list_type *)uptr;
uptr = (unsigned long)list->next;
uptr += offsetof(struct ynl_dump_list_type, data);
return (void *)uptr;
}
struct ynl_ntf_base_type {
__u16 family;
__u8 cmd;
struct ynl_ntf_base_type *next;
void (*free)(struct ynl_ntf_base_type *ntf);
unsigned char data[] __attribute__((aligned(8)));
};
struct nlmsghdr *ynl_msg_start_req(struct ynl_sock *ys, __u32 id, __u16 flags);
struct nlmsghdr *ynl_msg_start_dump(struct ynl_sock *ys, __u32 id);
struct nlmsghdr *
ynl_gemsg_start_req(struct ynl_sock *ys, __u32 id, __u8 cmd, __u8 version);
struct nlmsghdr *
ynl_gemsg_start_dump(struct ynl_sock *ys, __u32 id, __u8 cmd, __u8 version);
int ynl_submsg_failed(struct ynl_parse_arg *yarg, const char *field_name,
const char *sel_name);
/* YNL specific helpers used by the auto-generated code */
struct ynl_req_state {
struct ynl_parse_arg yarg;
ynl_parse_cb_t cb;
__u32 rsp_cmd;
};
struct ynl_dump_state {
struct ynl_parse_arg yarg;
void *first;
struct ynl_dump_list_type *last;
size_t alloc_sz;
ynl_parse_cb_t cb;
__u32 rsp_cmd;
};
struct ynl_ntf_info {
const struct ynl_policy_nest *policy;
ynl_parse_cb_t cb;
size_t alloc_sz;
void (*free)(struct ynl_ntf_base_type *ntf);
};
Annotation
- Immediate include surface: `stdbool.h`, `stddef.h`, `linux/types.h`.
- Detected declarations: `struct ynl_parse_arg`, `struct ynl_policy_attr`, `struct ynl_policy_nest`, `struct ynl_parse_arg`, `struct ynl_dump_list_type`, `struct ynl_ntf_base_type`, `struct ynl_req_state`, `struct ynl_dump_state`, `struct ynl_ntf_info`, `enum ynl_policy_type`.
- Atlas domain: Support Tooling And Documentation / tools.
- 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.