From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?ISO-8859-1?Q?Roger_Pau_Monn=E9?= Subject: Re: [PATCH v1 08/12] libxl: add disk specific remove functions Date: Fri, 15 Mar 2013 12:52:55 +0100 Message-ID: <51430B97.3010308@citrix.com> References: <1358963317-10221-1-git-send-email-roger.pau@citrix.com> <1358963317-10221-9-git-send-email-roger.pau@citrix.com> <20800.42945.866350.396411@mariner.uk.xensource.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20800.42945.866350.396411@mariner.uk.xensource.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: Ian Jackson Cc: Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org On 13/03/13 17:22, Ian Jackson wrote: > Roger Pau Monne writes ("[Xen-devel] [PATCH v1 08/12] libxl: add disk specific remove functions"): >> Add a specific macro to generate libxl_device_disk_{remove/destroy} >> functions that passes the hotplug_version field down to the aodev >> struct. > >> +/* Specific for disk devices, that have to set aodev->hotplug_version */ >> +#define DEFINE_DISK_REMOVE(type, removedestroy, f) \ >> + int libxl_device_##type##_##removedestroy(libxl_ctx *ctx, \ > > This macro is very similar to DEFINE_DEVICE_REMOVE. The only > difference seems to be these extra lines: > >> + aodev->hotplug.version = type->hotplug_version; \ >> + LOG(DEBUG, "hotplug version: %d", aodev->hotplug.version); \ >> + libxl__initiate_device_remove(egc, aodev); \ > > Perhaps the right answer would be to add a new formal parameter to > DEFINE_DEVICE_REMOVE which allows DEFINE_DEVICE_REMOVE's user to > specify some extra code here ? type->hotplug_version is only available in libxl_device_disk, so even if using something like if (param) aodev->hotplug.version = type->hotplug_version; Would break compilation because other device types don't have the hotplug_version field (and adding a hotplug_version field to all device structures seems overkill).