Re: [Xen-devel] [PATCH v2 2/3] tools/libxc: add API for bitmap access for restore
On Thu, Aug 24, 2017 at 08:36:16AM +0200, Olaf Hering wrote: > On Thu, Aug 17, Olaf Hering wrote: > > > Extend API for managing bitmaps. Each bitmap is now represented by a > > generic struct xc_sr_bitmap. > > > +static inline bool xc_sr_bitmap_resize(struct xc_sr_bitmap *bm, unsigned > > long bits) > > +static inline void xc_sr_bitmap_free(struct xc_sr_bitmap *bm) > > > +static inline bool xc_sr_set_bit(unsigned long bit, struct xc_sr_bitmap > > *bm) > > +static inline bool xc_sr_test_bit(unsigned long bit, struct xc_sr_bitmap > > *bm) > > +static inline int xc_sr_test_and_clear_bit(unsigned long bit, struct > > xc_sr_bitmap *bm) > > +static inline int xc_sr_test_and_set_bit(unsigned long bit, struct > > xc_sr_bitmap *bm) > > Any objection to remove the trailing '_bit' from these four function names? No preference. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v2 2/3] tools/libxc: add API for bitmap access for restore
On Thu, Aug 17, Olaf Hering wrote: > Extend API for managing bitmaps. Each bitmap is now represented by a > generic struct xc_sr_bitmap. > +static inline bool xc_sr_bitmap_resize(struct xc_sr_bitmap *bm, unsigned > long bits) > +static inline void xc_sr_bitmap_free(struct xc_sr_bitmap *bm) > +static inline bool xc_sr_set_bit(unsigned long bit, struct xc_sr_bitmap *bm) > +static inline bool xc_sr_test_bit(unsigned long bit, struct xc_sr_bitmap *bm) > +static inline int xc_sr_test_and_clear_bit(unsigned long bit, struct > xc_sr_bitmap *bm) > +static inline int xc_sr_test_and_set_bit(unsigned long bit, struct > xc_sr_bitmap *bm) Any objection to remove the trailing '_bit' from these four function names? Olaf signature.asc Description: PGP signature ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v2 2/3] tools/libxc: add API for bitmap access for restore
On Tue, Aug 22, 2017 at 03:34:37PM +0100, Wei Liu wrote: > > +static inline int pfn_set_populated(struct xc_sr_context *ctx, xen_pfn_t > > pfn) > > +{ > > +xc_interface *xch = ctx->xch; > > + > > This is not used, right? Oh this is acutally used. Please ignore this comment. ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel
Re: [Xen-devel] [PATCH v2 2/3] tools/libxc: add API for bitmap access for restore
On Thu, Aug 17, 2017 at 07:01:32PM +0200, Olaf Hering wrote: > Extend API for managing bitmaps. Each bitmap is now represented by a > generic struct xc_sr_bitmap. > Switch the existing populated_pfns to this API. > > Signed-off-by: Olaf Hering> + [...] > +static inline void xc_sr_bitmap_free(struct xc_sr_bitmap *bm) > +{ > +free(bm->p); Also set bm->p to NULL to make it idempotent please. > +} > + > +static inline bool xc_sr_set_bit(unsigned long bit, struct xc_sr_bitmap *bm) > +{ > +if (!xc_sr_bitmap_resize(bm, bit)) > +return false; > + > +set_bit(bit, bm->p); > +return true; > +} > + > +static inline bool xc_sr_test_bit(unsigned long bit, struct xc_sr_bitmap *bm) > +{ > +if (bit > bm->bits) > +return false; > +return !!test_bit(bit, bm->p); > +} > + > +static inline int xc_sr_test_and_clear_bit(unsigned long bit, struct > xc_sr_bitmap *bm) > +{ > +return test_and_clear_bit(bit, bm->p); > +} > + > +static inline int xc_sr_test_and_set_bit(unsigned long bit, struct > xc_sr_bitmap *bm) > +{ > +return test_and_set_bit(bit, bm->p); > +} > + > +static inline bool pfn_is_populated(struct xc_sr_context *ctx, xen_pfn_t pfn) > +{ > +return xc_sr_test_bit(pfn, >restore.populated_pfns); > +} > + > +static inline int pfn_set_populated(struct xc_sr_context *ctx, xen_pfn_t pfn) > +{ > +xc_interface *xch = ctx->xch; > + This is not used, right? ___ Xen-devel mailing list Xen-devel@lists.xen.org https://lists.xen.org/xen-devel