From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M3dRZ-00021R-EO for qemu-devel@nongnu.org; Mon, 11 May 2009 17:53:53 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M3dRU-0001zz-F5 for qemu-devel@nongnu.org; Mon, 11 May 2009 17:53:52 -0400 Received: from [199.232.76.173] (port=59457 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M3dRU-0001zw-CU for qemu-devel@nongnu.org; Mon, 11 May 2009 17:53:48 -0400 Received: from e39.co.us.ibm.com ([32.97.110.160]:58414) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1M3dRT-0000Qe-Un for qemu-devel@nongnu.org; Mon, 11 May 2009 17:53:48 -0400 Received: from d03relay02.boulder.ibm.com (d03relay02.boulder.ibm.com [9.17.195.227]) by e39.co.us.ibm.com (8.13.1/8.13.1) with ESMTP id n4BLoBqr021521 for ; Mon, 11 May 2009 15:50:11 -0600 Received: from d03av02.boulder.ibm.com (d03av02.boulder.ibm.com [9.17.195.168]) by d03relay02.boulder.ibm.com (8.13.8/8.13.8/NCO v9.2) with ESMTP id n4BLrk7K248008 for ; Mon, 11 May 2009 15:53:46 -0600 Received: from d03av02.boulder.ibm.com (loopback [127.0.0.1]) by d03av02.boulder.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id n4BLrkgY023787 for ; Mon, 11 May 2009 15:53:46 -0600 Message-ID: <4A089E68.4030805@us.ibm.com> Date: Mon, 11 May 2009 16:53:44 -0500 From: Anthony Liguori MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH 1/4] Add module infrastructure to QEMU References: <1242052009-27339-1-git-send-email-aliguori@us.ibm.com> <1242052009-27339-2-git-send-email-aliguori@us.ibm.com> <20090511213747.GA18336@game.jcrosoft.org> In-Reply-To: <20090511213747.GA18336@game.jcrosoft.org> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jean-Christophe PLAGNIOL-VILLARD Cc: qemu-devel@nongnu.org, Paul Brook Jean-Christophe PLAGNIOL-VILLARD wrote: >> diff --git a/module.h b/module.h >> new file mode 100644 >> index 0000000..5aa3eaa >> --- /dev/null >> +++ b/module.h >> @@ -0,0 +1,41 @@ >> +/* >> + * QEMU Module Infrastructure >> + * >> + * Copyright IBM, Corp. 2009 >> + * >> + * Authors: >> + * Anthony Liguori >> + * >> + * This work is licensed under the terms of the GNU GPL, version 2. See >> + * the COPYING file in the top-level directory. >> + * >> + */ >> + >> +#ifndef QEMU_MODULE_H >> +#define QEMU_MODULE_H >> + >> +#define module_init(function, priority) \ >> +static void __attribute__((constructor)) qemu_init_ ## function(void) { \ >> + register_module_init(function, priority); \ >> +} >> + >> +#define module_exit(function, priority) \ >> +static void __attribute__((constructor)) qemu_exit_ ## function(void) { \ >> > constructor? ;-) > Yes, that's intentional. These functions just register functions, they don't actually call those functions. This allows us to explicitly invoke the constructors/destructors when we want to instead of relying on gcc doing it before and after main. -- Regards, Anthony Liguori