1 /*-*- Mode: C; c-basic-offset: 8 -*-*/
7 static void device_dump(Name *n, FILE *f, const char *prefix) {
9 static const char* const state_table[_DEVICE_STATE_MAX] = {
10 [DEVICE_DEAD] = "dead",
11 [DEVICE_AVAILABLE] = "available"
14 Device *s = DEVICE(n);
19 "%sDevice State: %s\n",
20 prefix, state_table[s->state]);
23 static NameActiveState device_active_state(Name *n) {
24 return DEVICE(n)->state == DEVICE_DEAD ? NAME_INACTIVE : NAME_ACTIVE;
27 static void device_free_hook(Name *n) {
28 Device *d = DEVICE(n);
34 const NameVTable device_vtable = {
37 .load = name_load_fragment_and_dropin,
44 .active_state = device_active_state,
46 .free_hook = device_free_hook