[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [v10][PATCH 11/16] tools/libxl: detect and avoid conflicts with RDM



On 2015/7/21 23:09, Ian Jackson wrote:
Chen, Tiejun writes ("Re: [v10][PATCH 11/16] tools/libxl: detect and avoid conflicts 
with RDM"):
+static void
+add_rdm_entry(libxl__gc *gc, libxl_domain_config *d_config,
+              uint64_t rdm_start, uint64_t rdm_size, int rdm_policy)
+{
+    d_config->num_rdms++;
+    d_config->rdms = libxl__realloc(NOGC, d_config->rdms,
+                            d_config->num_rdms * sizeof(libxl_device_rdm));
+
+    d_config->rdms[d_config->num_rdms - 1].start = rdm_start;
+    d_config->rdms[d_config->num_rdms - 1].size = rdm_size;
+    d_config->rdms[d_config->num_rdms - 1].policy = rdm_policy;
+}


But, I wrote:

    Can I suggest a function

       void add_rdm_entry(libxl__gc *gc, libxl_domain_config *d_config,
                     uint64_t rdm_start, uint64_t rdm_size, int rdm_policy)

    which assumes that d_config->num_rdms is set correctly, and increments
    it ?

    (Please put the increment at the end so that the assignments are to
    ->rdms[d_config->num_rdms], or perhaps make a convenience alias.)

Note the last paragraph.

This is now the third time I have posted that text.  It is the fifth
request or clarification I have had to make about this very small
area.  I have to say that I'm finding this rather frustrating.

Sorry, I just ignore the line in brackets since I always think this kind of thing is often not a big deal, and next time I should pay more attention to the (). But indeed, before I post this whole patch online I also picked up this chunk of code to ask you to take a look that. This manner means I'm not very sure if I'm addressing this properly. But I didn't get a further response, so I guess that should work for you and then I posted the whole online.

Now back on our problem,

static void
add_rdm_entry(libxl__gc *gc, libxl_domain_config *d_config,
              uint64_t rdm_start, uint64_t rdm_size, int rdm_policy)
{
    d_config->rdms = libxl__realloc(NOGC, d_config->rdms,
                    (d_config->num_rdms+1) * sizeof(libxl_device_rdm));

    d_config->rdms[d_config->num_rdms].start = rdm_start;
    d_config->rdms[d_config->num_rdms].size = rdm_size;
    d_config->rdms[d_config->num_rdms].policy = rdm_policy;
    d_config->num_rdms++;
}

Does this work for you? If I'm still wrong, please correct this function directly to cost you less.

Thanks
Tiejun

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.