Lines Matching full:rc
55 int rc; in init_mboxctl_dbus() local
57 rc = sd_bus_default_system(&context->bus); in init_mboxctl_dbus()
58 if (rc < 0) { in init_mboxctl_dbus()
60 strerror(-rc)); in init_mboxctl_dbus()
63 return rc; in init_mboxctl_dbus()
70 int rc; in mboxctl_directive() local
72 rc = sd_bus_message_new_method_call(context->bus, &m, in mboxctl_directive()
77 if (rc < 0) { in mboxctl_directive()
79 strerror(-rc)); in mboxctl_directive()
83 rc = sd_bus_call(context->bus, m, 0, &error, NULL); in mboxctl_directive()
84 if (rc < 0) { in mboxctl_directive()
85 MSG_ERR("Failed to post message: %s\n", strerror(-rc)); in mboxctl_directive()
92 return rc < 0 ? rc : 0; in mboxctl_directive()
108 int rc; in handle_cmd_ping() local
110 rc = mboxctl_directive(context, "Ping"); in handle_cmd_ping()
111 MSG_OUT("Ping: %s\n", rc ? strerror(-rc) : "Success"); in handle_cmd_ping()
113 return rc; in handle_cmd_ping()
119 int rc; in handle_cmd_daemon_state() local
121 rc = mboxctl_getter(context, "DaemonState", &resp); in handle_cmd_daemon_state()
122 if (rc < 0) in handle_cmd_daemon_state()
123 return rc; in handle_cmd_daemon_state()
133 int rc; in handle_cmd_lpc_state() local
135 rc = mboxctl_getter(context, "LpcState", &resp); in handle_cmd_lpc_state()
136 if (rc < 0) in handle_cmd_lpc_state()
137 return rc; in handle_cmd_lpc_state()
150 int rc; in handle_cmd_kill() local
152 rc = mboxctl_directive(context, "Kill"); in handle_cmd_kill()
153 MSG_OUT("Kill: %s\n", rc ? strerror(-rc) : "Success"); in handle_cmd_kill()
155 return rc; in handle_cmd_kill()
160 int rc; in handle_cmd_reset() local
162 rc = mboxctl_directive(context, "Reset"); in handle_cmd_reset()
163 MSG_OUT("Reset: %s\n", rc ? strerror(-rc) : "Success"); in handle_cmd_reset()
165 return rc; in handle_cmd_reset()
170 int rc; in handle_cmd_suspend() local
172 rc = mboxctl_directive(context, "Suspend"); in handle_cmd_suspend()
173 MSG_OUT("Suspend: %s\n", rc ? strerror(-rc) : "Success"); in handle_cmd_suspend()
175 return rc; in handle_cmd_suspend()
183 int rc; in handle_cmd_resume() local
190 rc = sd_bus_message_new_method_call(context->bus, &m, in handle_cmd_resume()
195 if (rc < 0) { in handle_cmd_resume()
197 strerror(-rc)); in handle_cmd_resume()
208 rc = -EINVAL; in handle_cmd_resume()
212 rc = sd_bus_message_append(m, "b", arg); in handle_cmd_resume()
213 if (rc < 0) { in handle_cmd_resume()
215 strerror(-rc)); in handle_cmd_resume()
219 rc = sd_bus_call(context->bus, m, 0, &error, &n); in handle_cmd_resume()
220 if (rc < 0) { in handle_cmd_resume()
221 MSG_ERR("Failed to post message: %s\n", strerror(-rc)); in handle_cmd_resume()
225 MSG_OUT("Resume: %s\n", rc < 0 ? strerror(-rc) : "Success"); in handle_cmd_resume()
232 return rc < 0 ? rc : 0; in handle_cmd_resume()
237 int rc; in handle_cmd_modified() local
239 rc = mboxctl_directive(context, "MarkFlashModified"); in handle_cmd_modified()
240 MSG_OUT("Clear Cache: %s\n", rc ? strerror(-rc) : "Success"); in handle_cmd_modified()
242 return rc; in handle_cmd_modified()
251 int rc; in handle_cmd_backend() local
258 rc = sd_bus_message_new_method_call(context->bus, &m, in handle_cmd_backend()
263 if (rc < 0) { in handle_cmd_backend()
265 strerror(-rc)); in handle_cmd_backend()
272 rc = -EINVAL; in handle_cmd_backend()
276 rc = sd_bus_message_append(m, "s", "vpnor"); in handle_cmd_backend()
277 if (rc < 0) in handle_cmd_backend()
280 rc = sd_bus_message_append(m, "s", "mtd"); in handle_cmd_backend()
281 if (rc < 0) in handle_cmd_backend()
284 rc = sd_bus_message_append(m, "s", "file"); in handle_cmd_backend()
285 if (rc < 0) in handle_cmd_backend()
288 rc = -EINVAL; in handle_cmd_backend()
300 rc = -errno; in handle_cmd_backend()
307 rc = sd_bus_message_append_strv(m, &strv[0]); in handle_cmd_backend()
309 if (rc < 0) in handle_cmd_backend()
314 rc = sd_bus_message_append_strv(m, &strv[0]); in handle_cmd_backend()
315 if (rc < 0) in handle_cmd_backend()
319 rc = sd_bus_call(context->bus, m, 0, &error, &n); in handle_cmd_backend()
320 if (rc < 0) { in handle_cmd_backend()
321 MSG_ERR("Failed to post message: %s\n", strerror(-rc)); in handle_cmd_backend()
325 MSG_OUT("SetBackend: %s\n", rc < 0 ? strerror(-rc) : "Success"); in handle_cmd_backend()
331 return rc < 0 ? rc : 0; in handle_cmd_backend()
336 int opt, rc = -1; in parse_cmdline() local
367 rc = handle_cmd_ping(context); in parse_cmdline()
370 rc = handle_cmd_daemon_state(context); in parse_cmdline()
373 rc = handle_cmd_lpc_state(context); in parse_cmdline()
376 rc = handle_cmd_kill(context); in parse_cmdline()
380 rc = handle_cmd_reset(context); in parse_cmdline()
383 rc = handle_cmd_suspend(context); in parse_cmdline()
386 rc = handle_cmd_resume(context, optarg); in parse_cmdline()
389 rc = handle_cmd_modified(context); in parse_cmdline()
392 rc = handle_cmd_backend(context, optarg); in parse_cmdline()
396 rc = 0; in parse_cmdline()
400 rc = 0; in parse_cmdline()
404 rc = -EINVAL; in parse_cmdline()
409 return rc; in parse_cmdline()
415 int rc; in main() local
419 rc = init_mboxctl_dbus(&context); in main()
420 if (rc < 0) { in main()
422 return rc; in main()
425 rc = parse_cmdline(&context, argc, argv); in main()
427 return rc; in main()