| 719 | } |
| 720 | |
| 721 | static struct command_result *json_success_subsystems(struct command *cmd, |
| 722 | const struct subsystem_and_variant *single) |
| 723 | { |
| 724 | struct json_stream *response = jsonrpc_stream_success(cmd); |
| 725 | struct subsystem_and_variant sv = first_sv(); |
| 726 | |
| 727 | json_object_start(response, "autoclean"); |
| 728 | do { |
| 729 | struct per_variant *pv; |
| 730 | if (single && |
| 731 | (sv.type != single->type || sv.variant != single->variant)) |
| 732 | continue; |
| 733 | |
| 734 | /* Some don't have both success and failure */ |
| 735 | if (!subsystem_to_str(&sv)) |
| 736 | continue; |
| 737 | |
| 738 | pv = &timer_cinfo->per_subsystem[sv.type].variants[sv.variant]; |
| 739 | json_object_start(response, subsystem_to_str(&sv)); |
| 740 | json_add_bool(response, "enabled", pv->age != 0); |
| 741 | if (pv->age != 0) |
| 742 | json_add_u64(response, "age", pv->age); |
| 743 | json_add_u64(response, "cleaned", *total_cleaned(&sv)); |
| 744 | json_object_end(response); |
| 745 | } while (next_sv(&sv)); |
| 746 | json_object_end(response); |
| 747 | return command_finished(cmd, response); |
| 748 | } |
| 749 | |
| 750 | static struct command_result *json_autoclean_status(struct command *cmd, |
| 751 | const char *buffer, |
no test coverage detected