1 /* MIB service - minix.c - implementation of the CTL_MINIX subtree */ 2 3 #include "mib.h" 4 5 #if MINIX_TEST_SUBTREE 6 7 static char test_string[16], test_struct[12]; 8 9 static struct mib_node mib_minix_test_secret_table[] = { 10 /* 0*/ [SECRET_VALUE] = MIB_INT(_RO, 12345, "value", 11 "The combination to my luggage"), 12 }; 13 14 /* 15 * Note that even the descriptions here have been chosen such that returned 16 * description array alignment is tested. Do not change existing fields 17 * lightly, although adding new fields is always fine. 18 */ 19 static struct mib_node mib_minix_test_table[] = { 20 /* 0*/ [TEST_INT] = MIB_INT(_RO | CTLFLAG_HEX, 0x01020304, "int", 21 "Value test field"), 22 /* 1*/ [TEST_BOOL] = MIB_BOOL(_RW, 0, "bool", 23 "Boolean test field"), 24 /* 2*/ [TEST_QUAD] = MIB_QUAD(_RW, 0, "quad", "Quad test field"), 25 /* 3*/ [TEST_STRING] = MIB_STRING(_RW, test_string, "string", 26 "String test field"), 27 /* 4*/ [TEST_STRUCT] = MIB_STRUCT(_RW, sizeof(test_struct), 28 test_struct, "struct", 29 "Structure test field"), 30 /* 5*/ [TEST_PRIVATE] = MIB_INT(_RW | CTLFLAG_PRIVATE, -5375, 31 "private", "Private test field"), 32 /* 6*/ [TEST_ANYWRITE] = MIB_INT(_RW | CTLFLAG_ANYWRITE, 0, 33 "anywrite", "AnyWrite test field"), 34 /* 7*/ [TEST_DYNAMIC] = MIB_INT(_RO, 0, "deleteme", 35 "This node will be destroyed"), 36 /* 8*/ [TEST_SECRET] = MIB_NODE(_RO | CTLFLAG_PRIVATE, 37 mib_minix_test_secret_table, "secret", 38 "Private subtree"), 39 /* 9*/ [TEST_PERM] = MIB_INT(_P | _RO, 1, "permanent", NULL), 40 /*10*/ [TEST_DESTROY1] = MIB_INT(_RO, 123, "destroy1", NULL), 41 /*11*/ [TEST_DESTROY2] = MIB_INT(_RO, 456, "destroy2", 42 "This node will be destroyed"), 43 }; 44 45 #endif /* MINIX_TEST_SUBTREE */ 46 47 static struct mib_node mib_minix_mib_table[] = { 48 /* 1*/ [MIB_NODES] = MIB_INTPTR(_P | _RO | CTLFLAG_UNSIGNED, 49 &mib_nodes, "nodes", 50 "Number of nodes in the MIB tree"), 51 /* 2*/ [MIB_OBJECTS] = MIB_INTPTR(_P | _RO | CTLFLAG_UNSIGNED, 52 &mib_objects, "objects", "Number of " 53 "dynamically allocated MIB objects"), 54 /* 3*/ [MIB_REMOTES] = MIB_INTPTR(_P | _RO | CTLFLAG_UNSIGNED, 55 &mib_remotes, "remotes", 56 "Number of mounted remote MIB subtrees"), 57 }; 58 59 static struct mib_node mib_minix_proc_table[] = { 60 /* 1*/ [PROC_LIST] = MIB_FUNC(_P | _RO | CTLTYPE_STRUCT, 0, 61 mib_minix_proc_list, "list", 62 "Process list"), 63 /* 2*/ [PROC_DATA] = MIB_FUNC(_P | _RO | CTLTYPE_NODE, 0, 64 mib_minix_proc_data, "data", 65 "Process data"), 66 }; 67 68 static struct mib_node mib_minix_table[] = { 69 #if MINIX_TEST_SUBTREE 70 /* 0*/ [MINIX_TEST] = MIB_NODE(_P | _RW | CTLFLAG_HIDDEN, 71 mib_minix_test_table, "test", 72 "Test87 testing ground"), 73 #endif /* MINIX_TEST_SUBTREE */ 74 /* 1*/ [MINIX_MIB] = MIB_NODE(_P | _RO, mib_minix_mib_table, 75 "mib", "MIB service information"), 76 /* 2*/ [MINIX_PROC] = MIB_NODE(_P | _RO, mib_minix_proc_table, 77 "proc", "Process information for ProcFS"), 78 }; 79 80 /* 81 * Initialize the CTL_MINIX subtree. 82 */ 83 void 84 mib_minix_init(struct mib_node * node) 85 { 86 87 MIB_INIT_ENODE(node, mib_minix_table); 88 } 89