From patchwork Tue Oct 13 15:41:19 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis V. Lunev" X-Patchwork-Id: 529822 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id AE2351402B7 for ; Wed, 14 Oct 2015 02:43:35 +1100 (AEDT) Received: from localhost ([::1]:36979 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm1jh-0000Th-No for incoming@patchwork.ozlabs.org; Tue, 13 Oct 2015 11:43:33 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:51903) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm1hp-0006Js-Ie for qemu-devel@nongnu.org; Tue, 13 Oct 2015 11:41:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zm1hk-0001Rg-Sk for qemu-devel@nongnu.org; Tue, 13 Oct 2015 11:41:37 -0400 Received: from mailhub.sw.ru ([195.214.232.25]:7726 helo=relay.sw.ru) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zm1hk-0001RF-88 for qemu-devel@nongnu.org; Tue, 13 Oct 2015 11:41:32 -0400 Received: from irbis.sw.ru ([10.30.2.139]) by relay.sw.ru (8.13.4/8.13.4) with ESMTP id t9DFfNOc022796; Tue, 13 Oct 2015 18:41:26 +0300 (MSK) From: "Denis V. Lunev" To: Date: Tue, 13 Oct 2015 18:41:19 +0300 Message-Id: <1444750883-13007-2-git-send-email-den@openvz.org> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1444750883-13007-1-git-send-email-den@openvz.org> References: <1444750883-13007-1-git-send-email-den@openvz.org> X-detected-operating-system: by eggs.gnu.org: OpenBSD 3.x X-Received-From: 195.214.232.25 Cc: "Denis V. Lunev" , Yuri Pudgorodskiy , mdroth@linux.vnet.ibm.com, v.tolstov@selfip.ru, qemu-devel@nongnu.org Subject: [Qemu-devel] [PATCH 1/5] qga: drop guest_file_init helper and replace it with static initializers X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org This just makes code shorter and better. Signed-off-by: Denis V. Lunev Signed-off-by: Yuri Pudgorodskiy Reviewed-by: Michael Roth Signed-off-by: Denis V. Lunev --- qga/commands-posix.c | 10 +++------- qga/commands-win32.c | 10 +++------- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/qga/commands-posix.c b/qga/commands-posix.c index b03c316..8989912 100644 --- a/qga/commands-posix.c +++ b/qga/commands-posix.c @@ -223,7 +223,9 @@ typedef struct GuestFileHandle { static struct { QTAILQ_HEAD(, GuestFileHandle) filehandles; -} guest_file_state; +} guest_file_state = { + .filehandles = QTAILQ_HEAD_INITIALIZER(guest_file_state.filehandles), +}; static int64_t guest_file_handle_add(FILE *fh, Error **errp) { @@ -586,11 +588,6 @@ void qmp_guest_file_flush(int64_t handle, Error **errp) } } -static void guest_file_init(void) -{ - QTAILQ_INIT(&guest_file_state.filehandles); -} - /* linux-specific implementations. avoid this if at all possible. */ #if defined(__linux__) @@ -2486,5 +2483,4 @@ void ga_command_state_init(GAState *s, GACommandState *cs) #if defined(CONFIG_FSFREEZE) ga_command_state_add(cs, NULL, guest_fsfreeze_cleanup); #endif - ga_command_state_add(cs, guest_file_init, NULL); } diff --git a/qga/commands-win32.c b/qga/commands-win32.c index 41bdd3f..3374678 100644 --- a/qga/commands-win32.c +++ b/qga/commands-win32.c @@ -55,7 +55,9 @@ typedef struct GuestFileHandle { static struct { QTAILQ_HEAD(, GuestFileHandle) filehandles; -} guest_file_state; +} guest_file_state = { + .filehandles = QTAILQ_HEAD_INITIALIZER(guest_file_state.filehandles), +}; typedef struct OpenFlags { @@ -390,11 +392,6 @@ void qmp_guest_file_flush(int64_t handle, Error **errp) } } -static void guest_file_init(void) -{ - QTAILQ_INIT(&guest_file_state.filehandles); -} - #ifdef CONFIG_QGA_NTDDSCSI static STORAGE_BUS_TYPE win2qemu[] = { @@ -1330,5 +1327,4 @@ void ga_command_state_init(GAState *s, GACommandState *cs) if (!vss_initialized()) { ga_command_state_add(cs, NULL, guest_fsfreeze_cleanup); } - ga_command_state_add(cs, guest_file_init, NULL); }