From: Ian Jackson Subject: Re: [PATCH v11 09/17] libxl: set nic type of stub to PV instead of copying from the parent Date: Tue, 24 Jul 2012 16:27:05 +0100 Message-ID: <20494.48841.830761.344513@mariner.uk.xensource.com> References: <1343064465-17864-1-git-send-email-roger.pau@citrix.com> <1343064465-17864-10-git-send-email-roger.pau@citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1343064465-17864-10-git-send-email-roger.pau@citrix.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: Roger Pau Monne Cc: Ian Campbell , "xen-devel@lists.xen.org" List-Id: xen-devel@lists.xenproject.org Roger Pau Monne writes ("[PATCH v11 09/17] libxl: set nic type of stub to PV instead of copying from the parent"): > Introduce a new function used to copy the array of nics from the > parent guest to the stubdomain, and set the type of the nics used to > PV unconditianlly, or the call to setdefaults later is going to fail. ... > +static int libxl__nics_from_hvm_guest_config(libxl__gc *gc, > + const libxl_domain_config *guest_config, > + libxl_device_nic *nic) At the very least this parameter should be called `nics' or declared as an array. It would be nice to document the implied array size guest_config->num_nics. > +{ > + const libxl_domain_build_info *b_info = &guest_config->b_info; > + int i; > + > + if (b_info->type != LIBXL_DOMAIN_TYPE_HVM) > + return ERROR_INVAL; > + > + for (i = 0; i < guest_config->num_nics; i++) { > + libxl_device_nic_init(&nic[i]); > + memcpy(&nic[i], &guest_config->nics[i], sizeof(nic[i])); > + nic[i].nictype = LIBXL_NIC_TYPE_VIF; > + nic[i].backend_domid = 0; As discussed, this should not be hardcoded to 0. Thanks, Ian.