mirror of
https://github.com/ebrandi/FDD-book.git
synced 2026-12-06 00:23:30 +00:00
Organize companion code and materials by book part: part-01/ Foundations part-02/ Kernel & driver fundamentals part-03/ Character & block devices part-04/ Networking & storage part-05/ Buses & advanced topics part-06/ Debugging & performance part-07/ Real-world drivers appendices/ Supplementary material README.md Overview and build instructions
18 lines
517 B
C
18 lines
517 B
C
#ifndef DEVNAME_H
|
|
#define DEVNAME_H
|
|
|
|
#include <stddef.h>
|
|
|
|
/* Tiny errno-like set for clarity when reading results. */
|
|
enum dn_err { DN_OK = 0, DN_EINVAL = 22, DN_ERANGE = 34 };
|
|
|
|
/*
|
|
* Caller supplies dst and its size. We combine prefix + unit into dst.
|
|
* This mirrors common kernel patterns: pointer plus explicit length.
|
|
*/
|
|
int build_devname(char *dst, size_t dstsz, const char *prefix, int unit);
|
|
|
|
/* Quick validator: letters then at least one digit (e.g., ttyu0). */
|
|
int is_valid_devname(const char *s);
|
|
|
|
#endif
|