tools/net/ynl/lib/ynl.h
Source file repositories/reference/linux-study-clean/tools/net/ynl/lib/ynl.h
File Facts
- System
- Linux kernel
- Corpus path
tools/net/ynl/lib/ynl.h- Extension
.h- Size
- 3631 bytes
- Lines
- 144
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
stdbool.hstddef.hlinux/genetlink.hlinux/types.hynl-priv.h
Detected Declarations
struct ynl_errorstruct ynl_familystruct ynl_sockstruct ynl_stringenum ynl_error_codefunction ynl_dump_emptyfunction ynl_has_ntf
Annotated Snippet
struct ynl_error {
enum ynl_error_code code;
unsigned int attr_offs;
char msg[512];
};
/**
* struct ynl_family - YNL family info
* Family description generated by codegen. Pass to ynl_sock_create().
*/
struct ynl_family {
/* private: */
const char *name;
size_t hdr_len;
bool is_classic;
__u16 classic_id;
const struct ynl_ntf_info *ntf_info;
unsigned int ntf_info_size;
};
/**
* struct ynl_sock - YNL wrapped netlink socket
* @err: YNL error descriptor, cleared on every request.
*/
struct ynl_sock {
struct ynl_error err;
/* private: */
const struct ynl_family *family;
int socket;
__u32 seq;
__u32 portid;
__u16 family_id;
unsigned int n_mcast_groups;
struct {
unsigned int id;
char name[GENL_NAMSIZ];
} *mcast_groups;
struct ynl_ntf_base_type *ntf_first;
struct ynl_ntf_base_type **ntf_last_next;
struct nlmsghdr *nlh;
const struct ynl_policy_nest *req_policy;
size_t req_hdr_len;
unsigned char *tx_buf;
unsigned char *rx_buf;
unsigned char raw_buf[];
};
/**
* struct ynl_string - parsed individual string
* @len: length of the string (excluding terminating character)
* @str: value of the string
*
* Parsed and nul-terminated string. This struct is only used for arrays of
* strings. Non-array string members are placed directly in respective types.
*/
struct ynl_string {
unsigned int len;
char str[];
};
struct ynl_sock *
ynl_sock_create(const struct ynl_family *yf, struct ynl_error *e);
void ynl_sock_destroy(struct ynl_sock *ys);
#define ynl_dump_foreach(dump, iter) \
for (typeof(dump->obj) *iter = &dump->obj; \
!ynl_dump_obj_is_last(iter); \
iter = ynl_dump_obj_next(iter))
/**
* ynl_dump_empty() - does the dump have no entries
* @dump: pointer to the dump list, as returned by a dump call
*
* Check if the dump is empty, i.e. contains no objects.
* Dump calls return NULL on error, and terminator element if empty.
*/
static inline bool ynl_dump_empty(void *dump)
{
return dump == (void *)YNL_LIST_END;
}
int ynl_subscribe(struct ynl_sock *ys, const char *grp_name);
int ynl_socket_get_fd(struct ynl_sock *ys);
int ynl_ntf_check(struct ynl_sock *ys);
/**
Annotation
- Immediate include surface: `stdbool.h`, `stddef.h`, `linux/genetlink.h`, `linux/types.h`, `ynl-priv.h`.
- Detected declarations: `struct ynl_error`, `struct ynl_family`, `struct ynl_sock`, `struct ynl_string`, `enum ynl_error_code`, `function ynl_dump_empty`, `function ynl_has_ntf`.
- Atlas domain: Support Tooling And Documentation / tools.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.