File: names.h

package info (click to toggle)
iproute2 6.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,380 kB
  • sloc: ansic: 127,486; sh: 1,363; cpp: 946; makefile: 720; yacc: 421; lex: 145; python: 43
file content (26 lines) | stat: -rw-r--r-- 492 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* SPDX-License-Identifier: GPL-2.0 */
#ifndef DB_NAMES_H_
#define DB_NAMES_H_ 1

#define IDNAME_MAX 256

struct db_entry {
	struct db_entry *next;
	unsigned int id;
	char *name;
};

struct db_names {
	unsigned int size;
	struct db_entry *cached;
	struct db_entry **hash;
	int max;
};

struct db_names *db_names_alloc(void);
int db_names_load(struct db_names *db, const char *path);
void db_names_free(struct db_names *db);

char *id_to_name(struct db_names *db, int id, char *name);

#endif