ref: 0acd2208855ac7e5c1e2499614c50828a1ace0de
dir: /fs.c/
#include <u.h> #include <libc.h> #include "uiglue.h" typedef struct DSP DSP; #include "dspf.h" typedef struct { void *metaInterface; void (*declare)(void *metaInterface, const char *key, const char *value); }MetaGlue; static char *meta = nil; static int metalen = 0; static void addmeta(void *metaInterface, const char *k, const char *v) { int klen, vlen; USED(metaInterface); if (strchr(k, '/') != nil) /* ignore library-specific meta */ return; klen = strlen(k); vlen = strlen(v); meta = realloc(meta, metalen + klen + 1 + vlen + 2); strcpy(meta+metalen, k); metalen += klen; meta[metalen++] = '\t'; strcpy(meta+metalen, v); metalen += vlen; meta[metalen++] = '\n'; meta[metalen] = 0; } void build_fs(void *dspf) { DSPf *f; MetaGlue mg; f = dspf; mg.declare = addmeta; f->metadata(&mg); }