From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57552) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhmxx-0001dl-GG for qemu-devel@nongnu.org; Thu, 01 Oct 2015 19:08:46 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Zhmxu-0003Oj-AJ for qemu-devel@nongnu.org; Thu, 01 Oct 2015 19:08:45 -0400 Received: from e32.co.us.ibm.com ([32.97.110.150]:33001) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Zhmxu-0003O5-3a for qemu-devel@nongnu.org; Thu, 01 Oct 2015 19:08:42 -0400 Received: from localhost by e32.co.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Thu, 1 Oct 2015 17:08:40 -0600 Received: from b03cxnp08025.gho.boulder.ibm.com (b03cxnp08025.gho.boulder.ibm.com [9.17.130.17]) by d03dlp03.boulder.ibm.com (Postfix) with ESMTP id 29CF519D803E for ; Thu, 1 Oct 2015 16:56:49 -0600 (MDT) Received: from d03av03.boulder.ibm.com (d03av03.boulder.ibm.com [9.17.195.169]) by b03cxnp08025.gho.boulder.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id t91N7M8t4260230 for ; Thu, 1 Oct 2015 16:07:22 -0700 Received: from d03av03.boulder.ibm.com (localhost [127.0.0.1]) by d03av03.boulder.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id t91N8aOd017589 for ; Thu, 1 Oct 2015 17:08:36 -0600 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Michael Roth In-Reply-To: <1443685083-6242-2-git-send-email-den@openvz.org> References: <1443685083-6242-1-git-send-email-den@openvz.org> <1443685083-6242-2-git-send-email-den@openvz.org> Message-ID: <20151001214603.32707.27392@loki> Date: Thu, 01 Oct 2015 16:46:03 -0500 Subject: Re: [Qemu-devel] [PATCH 1/5] qga: drop guest_file_init helper and replace it with static initializers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Denis V. Lunev" Cc: Yuri Pudgorodskiy , qemu-devel@nongnu.org Quoting Denis V. Lunev (2015-10-01 02:37:59) > This just makes code shorter and better. Can't complain with that. > = > Signed-off-by: Denis V. Lunev > Signed-off-by: Yuri Pudgorodskiy > CC: Michael Roth Reviewed-by: Michael Roth > --- > 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 =3D { > + .filehandles =3D QTAILQ_HEAD_INITIALIZER(guest_file_state.filehandle= s), > +}; > = > static int64_t guest_file_handle_add(FILE *fh, Error **errp) > { > @@ -586,11 +588,6 @@ void qmp_guest_file_flush(int64_t handle, Error **er= rp) > } > } > = > -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, GACommandSta= te *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 =3D { > + .filehandles =3D QTAILQ_HEAD_INITIALIZER(guest_file_state.filehandle= s), > +}; > = > = > typedef struct OpenFlags { > @@ -390,11 +392,6 @@ void qmp_guest_file_flush(int64_t handle, Error **er= rp) > } > } > = > -static void guest_file_init(void) > -{ > - QTAILQ_INIT(&guest_file_state.filehandles); > -} > - > #ifdef CONFIG_QGA_NTDDSCSI > = > static STORAGE_BUS_TYPE win2qemu[] =3D { > @@ -1330,5 +1327,4 @@ void ga_command_state_init(GAState *s, GACommandSta= te *cs) > if (!vss_initialized()) { > ga_command_state_add(cs, NULL, guest_fsfreeze_cleanup); > } > - ga_command_state_add(cs, guest_file_init, NULL); > } > -- = > 2.1.4 >=20