diff options
author | Markus Armbruster <armbru@redhat.com> | 2014-05-02 13:26:30 +0200 |
---|---|---|
committer | Luiz Capitulino <lcapitulino@redhat.com> | 2014-05-09 09:11:26 -0400 |
commit | 77dbc81b0ffe5f2ce403984fc179f3ed44ac7459 (patch) | |
tree | 4d52d30da8d234eb33c2eb5b8be54cc331c74d64 /qga/commands-win32.c | |
parent | e940f543ae7606819c9083fdb524e5b85914f032 (diff) |
qga: Consistently name Error ** objects errp, and not err
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Luiz Capitulino <lcapitulino@redhat.com>
Diffstat (limited to 'qga/commands-win32.c')
-rw-r--r-- | qga/commands-win32.c | 105 |
1 files changed, 54 insertions, 51 deletions
diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 0ee07b6e23..d0d8504b39 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -29,13 +29,13 @@ (365 * (1970 - 1601) + \ (1970 - 1601) / 4 - 3)) -static void acquire_privilege(const char *name, Error **err) +static void acquire_privilege(const char *name, Error **errp) { HANDLE token; TOKEN_PRIVILEGES priv; Error *local_err = NULL; - if (error_is_set(err)) { + if (error_is_set(errp)) { return; } @@ -65,26 +65,27 @@ static void acquire_privilege(const char *name, Error **err) out: if (local_err) { - error_propagate(err, local_err); + error_propagate(errp, local_err); } } -static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, Error **err) +static void execute_async(DWORD WINAPI (*func)(LPVOID), LPVOID opaque, + Error **errp) { Error *local_err = NULL; - if (error_is_set(err)) { + if (error_is_set(errp)) { return; } HANDLE thread = CreateThread(NULL, 0, func, opaque, 0, NULL); if (!thread) { error_set(&local_err, QERR_QGA_COMMAND_FAILED, "failed to dispatch asynchronous command"); - error_propagate(err, local_err); + error_propagate(errp, local_err); } } -void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err) +void qmp_guest_shutdown(bool has_mode, const char *mode, Error **errp) { UINT shutdown_flag = EWX_FORCE; @@ -97,68 +98,70 @@ void qmp_guest_shutdown(bool has_mode, const char *mode, Error **err) } else if (strcmp(mode, "reboot") == 0) { shutdown_flag |= EWX_REBOOT; } else { - error_set(err, QERR_INVALID_PARAMETER_VALUE, "mode", + error_set(errp, QERR_INVALID_PARAMETER_VALUE, "mode", "halt|powerdown|reboot"); return; } /* Request a shutdown privilege, but try to shut down the system anyway. */ - acquire_privilege(SE_SHUTDOWN_NAME, err); - if (error_is_set(err)) { + acquire_privilege(SE_SHUTDOWN_NAME, errp); + if (error_is_set(errp)) { return; } if (!ExitWindowsEx(shutdown_flag, SHTDN_REASON_FLAG_PLANNED)) { slog("guest-shutdown failed: %lu", GetLastError()); - error_set(err, QERR_UNDEFINED_ERROR); + error_set(errp, QERR_UNDEFINED_ERROR); } } -int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, Error **err) +int64_t qmp_guest_file_open(const char *path, bool has_mode, const char *mode, + Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return 0; } -void qmp_guest_file_close(int64_t handle, Error **err) +void qmp_guest_file_close(int64_t handle, Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); } GuestFileRead *qmp_guest_file_read(int64_t handle, bool has_count, - int64_t count, Error **err) + int64_t count, Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return 0; } GuestFileWrite *qmp_guest_file_write(int64_t handle, const char *buf_b64, - bool has_count, int64_t count, Error **err) + bool has_count, int64_t count, + Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return 0; } GuestFileSeek *qmp_guest_file_seek(int64_t handle, int64_t offset, - int64_t whence, Error **err) + int64_t whence, Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return 0; } -void qmp_guest_file_flush(int64_t handle, Error **err) +void qmp_guest_file_flush(int64_t handle, Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); } /* * Return status of freeze/thaw */ -GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err) +GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **errp) { if (!vss_initialized()) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return 0; } @@ -173,13 +176,13 @@ GuestFsfreezeStatus qmp_guest_fsfreeze_status(Error **err) * Freeze local file systems using Volume Shadow-copy Service. * The frozen state is limited for up to 10 seconds by VSS. */ -int64_t qmp_guest_fsfreeze_freeze(Error **err) +int64_t qmp_guest_fsfreeze_freeze(Error **errp) { int i; Error *local_err = NULL; if (!vss_initialized()) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return 0; } @@ -188,8 +191,8 @@ int64_t qmp_guest_fsfreeze_freeze(Error **err) /* cannot risk guest agent blocking itself on a write in this state */ ga_set_frozen(ga_state); - qga_vss_fsfreeze(&i, err, true); - if (error_is_set(err)) { + qga_vss_fsfreeze(&i, errp, true); + if (error_is_set(errp)) { goto error; } @@ -207,16 +210,16 @@ error: /* * Thaw local file systems using Volume Shadow-copy Service. */ -int64_t qmp_guest_fsfreeze_thaw(Error **err) +int64_t qmp_guest_fsfreeze_thaw(Error **errp) { int i; if (!vss_initialized()) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return 0; } - qga_vss_fsfreeze(&i, err, false); + qga_vss_fsfreeze(&i, errp, false); ga_unset_frozen(ga_state); return i; @@ -246,9 +249,9 @@ static void guest_fsfreeze_cleanup(void) * Walk list of mounted file systems in the guest, and discard unused * areas. */ -void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **err) +void qmp_guest_fstrim(bool has_minimum, int64_t minimum, Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); } typedef enum { @@ -256,12 +259,12 @@ typedef enum { GUEST_SUSPEND_MODE_RAM } GuestSuspendMode; -static void check_suspend_mode(GuestSuspendMode mode, Error **err) +static void check_suspend_mode(GuestSuspendMode mode, Error **errp) { SYSTEM_POWER_CAPABILITIES sys_pwr_caps; Error *local_err = NULL; - if (error_is_set(err)) { + if (error_is_set(errp)) { return; } ZeroMemory(&sys_pwr_caps, sizeof(sys_pwr_caps)); @@ -291,7 +294,7 @@ static void check_suspend_mode(GuestSuspendMode mode, Error **err) out: if (local_err) { - error_propagate(err, local_err); + error_propagate(errp, local_err); } } @@ -308,42 +311,42 @@ static DWORD WINAPI do_suspend(LPVOID opaque) return ret; } -void qmp_guest_suspend_disk(Error **err) +void qmp_guest_suspend_disk(Error **errp) { GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode)); *mode = GUEST_SUSPEND_MODE_DISK; - check_suspend_mode(*mode, err); - acquire_privilege(SE_SHUTDOWN_NAME, err); - execute_async(do_suspend, mode, err); + check_suspend_mode(*mode, errp); + acquire_privilege(SE_SHUTDOWN_NAME, errp); + execute_async(do_suspend, mode, errp); - if (error_is_set(err)) { + if (error_is_set(errp)) { g_free(mode); } } -void qmp_guest_suspend_ram(Error **err) +void qmp_guest_suspend_ram(Error **errp) { GuestSuspendMode *mode = g_malloc(sizeof(GuestSuspendMode)); *mode = GUEST_SUSPEND_MODE_RAM; - check_suspend_mode(*mode, err); - acquire_privilege(SE_SHUTDOWN_NAME, err); - execute_async(do_suspend, mode, err); + check_suspend_mode(*mode, errp); + acquire_privilege(SE_SHUTDOWN_NAME, errp); + execute_async(do_suspend, mode, errp); - if (error_is_set(err)) { + if (error_is_set(errp)) { g_free(mode); } } -void qmp_guest_suspend_hybrid(Error **err) +void qmp_guest_suspend_hybrid(Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); } -GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **err) +GuestNetworkInterfaceList *qmp_guest_network_get_interfaces(Error **errp) { - error_set(err, QERR_UNSUPPORTED); + error_set(errp, QERR_UNSUPPORTED); return NULL; } |