Rev 2787 | Rev 3425 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
| Rev 2787 | Rev 3424 | ||
|---|---|---|---|
| Line 175... | Line 175... | ||
| 175 | /* If already created create only returns pointer |
175 | /* If already created create only returns pointer |
| 176 | If not, create it */ |
176 | If not, create it */ |
| 177 | sysinfo_item_t *item = sysinfo_create_path(name, root); |
177 | sysinfo_item_t *item = sysinfo_create_path(name, root); |
| 178 | 178 | ||
| 179 | if (item != NULL) { /* If in subsystem, unable to create or return so unable to set */ |
179 | if (item != NULL) { /* If in subsystem, unable to create or return so unable to set */ |
| 180 | item->val.val=val; |
180 | item->val.val = val; |
| 181 | item->val_type = SYSINFO_VAL_VAL; |
181 | item->val_type = SYSINFO_VAL_VAL; |
| 182 | } |
182 | } |
| 183 | } |
183 | } |
| 184 | 184 | ||
| 185 | void sysinfo_set_item_function(const char *name, sysinfo_item_t **root, sysinfo_val_fn_t fn) |
185 | void sysinfo_set_item_function(const char *name, sysinfo_item_t **root, sysinfo_val_fn_t fn) |
| Line 190... | Line 190... | ||
| 190 | /* If already created create only returns pointer |
190 | /* If already created create only returns pointer |
| 191 | If not, create it */ |
191 | If not, create it */ |
| 192 | sysinfo_item_t *item = sysinfo_create_path(name, root); |
192 | sysinfo_item_t *item = sysinfo_create_path(name, root); |
| 193 | 193 | ||
| 194 | if (item != NULL) { /* If in subsystem, unable to create or return so unable to set */ |
194 | if (item != NULL) { /* If in subsystem, unable to create or return so unable to set */ |
| 195 | item->val.fn=fn; |
195 | item->val.fn = fn; |
| 196 | item->val_type = SYSINFO_VAL_FUNCTION; |
196 | item->val_type = SYSINFO_VAL_FUNCTION; |
| 197 | } |
197 | } |
| 198 | } |
198 | } |
| 199 | 199 | ||
| 200 | 200 | ||
| Line 242... | Line 242... | ||
| 242 | val = ((sysinfo_val_fn_t) (root->val.fn)) (root); |
242 | val = ((sysinfo_val_fn_t) (root->val.fn)) (root); |
| 243 | vtype = "FUN"; |
243 | vtype = "FUN"; |
| 244 | break; |
244 | break; |
| 245 | } |
245 | } |
| 246 | 246 | ||
| 247 | printf("%s %s val:%d(%x) sub:%s\n", root->name, vtype, val, |
247 | printf("%s %s val:%" PRIun "(%" PRIxn ") sub:%s\n", root->name, vtype, val, |
| 248 | val, (root->subinfo_type == SYSINFO_SUBINFO_NONE) ? |
248 | val, (root->subinfo_type == SYSINFO_SUBINFO_NONE) ? |
| 249 | "NON" : ((root->subinfo_type == SYSINFO_SUBINFO_TABLE) ? |
249 | "NON" : ((root->subinfo_type == SYSINFO_SUBINFO_TABLE) ? |
| 250 | "TAB" : "FUN")); |
250 | "TAB" : "FUN")); |
| 251 | 251 | ||
| 252 | if (root->subinfo_type == SYSINFO_SUBINFO_TABLE) |
252 | if (root->subinfo_type == SYSINFO_SUBINFO_TABLE) |