fs/unicode/mkutf8data.c
Source file repositories/reference/linux-study-clean/fs/unicode/mkutf8data.c
File Facts
- System
- Linux kernel
- Corpus path
fs/unicode/mkutf8data.c- Extension
.c- Size
- 81770 bytes
- Lines
- 3435
- Domain
- Core OS
- Bucket
- VFS And Filesystem Core
- Inferred role
- Core OS: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
sys/types.hstddef.hstdlib.hstdio.hassert.hstring.hunistd.herrno.h
Detected Declarations
struct treestruct treestruct nodestruct unicode_datastruct utf8cursorstruct utf8cursorfunction age_validfunction utf8encodefunction utf8decodefunction utf32validfunction tree_walkfunction insertfunction prunefunction mark_nodesfunction index_nodesfunction mark_subtreefunction size_nodesfunction emitfunction nfdi_equalfunction nfdicf_equalfunction nfdi_printfunction nfdicf_printfunction nfdi_markfunction nfdicf_markfunction correction_markfunction nfdi_sizefunction nfdicf_sizefunction utf8_createfunction utf8_initfunction trees_initfunction trees_populatefunction trees_reducefunction verifyfunction LEAF_STRfunction LEAF_STRfunction trees_verifyfunction helpfunction usagefunction open_failfunction file_failfunction line_failfunction print_utf32function print_utf32nfdifunction print_utf32nfdicffunction age_initfunction ccc_initfunction ignore_compatibility_formfunction nfdi_init
Annotated Snippet
struct tree {
void *root;
int childnode;
const char *type;
unsigned int maxage;
struct tree *next;
int (*leaf_equal)(void *, void *);
void (*leaf_print)(void *, int);
int (*leaf_mark)(void *);
int (*leaf_size)(void *);
int *(*leaf_index)(struct tree *, void *);
unsigned char *(*leaf_emit)(void *, unsigned char *);
int leafindex[0x110000];
int index;
};
struct node {
int index;
int offset;
int mark;
int size;
struct node *parent;
void *left;
void *right;
unsigned char bitnum;
unsigned char nextbyte;
unsigned char leftnode;
unsigned char rightnode;
unsigned int keybits;
unsigned int keymask;
};
/*
* Example lookup function for a tree.
*/
static void *lookup(struct tree *tree, const char *key)
{
struct node *node;
void *leaf = NULL;
node = tree->root;
while (!leaf && node) {
if (node->nextbyte)
key++;
if (*key & (1 << (node->bitnum & 7))) {
/* Right leg */
if (node->rightnode == NODE) {
node = node->right;
} else if (node->rightnode == LEAF) {
leaf = node->right;
} else {
node = NULL;
}
} else {
/* Left leg */
if (node->leftnode == NODE) {
node = node->left;
} else if (node->leftnode == LEAF) {
leaf = node->left;
} else {
node = NULL;
}
}
}
return leaf;
}
/*
* A simple non-recursive tree walker: keep track of visits to the
* left and right branches in the leftmask and rightmask.
*/
static void tree_walk(struct tree *tree)
{
struct node *node;
unsigned int leftmask;
unsigned int rightmask;
unsigned int bitmask;
int indent = 1;
int nodes, singletons, leaves;
nodes = singletons = leaves = 0;
printf("%s_%x root %p\n", tree->type, tree->maxage, tree->root);
if (tree->childnode == LEAF) {
assert(tree->root);
tree->leaf_print(tree->root, indent);
leaves = 1;
} else {
assert(tree->childnode == NODE);
Annotation
- Immediate include surface: `sys/types.h`, `stddef.h`, `stdlib.h`, `stdio.h`, `assert.h`, `string.h`, `unistd.h`, `errno.h`.
- Detected declarations: `struct tree`, `struct tree`, `struct node`, `struct unicode_data`, `struct utf8cursor`, `struct utf8cursor`, `function age_valid`, `function utf8encode`, `function utf8decode`, `function utf32valid`.
- Atlas domain: Core OS / VFS And Filesystem Core.
- Implementation status: integration 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.