search for: mappings_overlap

Displaying 4 results from an estimated 4 matches for "mappings_overlap".

2018 Jul 31
2
Re: [PATCH nbdkit 3/4] Add map filter.
...k containing sensitive information)? > +static int > +insert_mapping (struct map *map, const struct mapping *new_mapping) > +{ > + size_t i; > + > + /* Adjust existing mappings if they overlap with this mapping. */ > + for (i = 0; i < map->nr_map; ++i) { > + if (mappings_overlap (&map->map[i], new_mapping)) { > + /* The four cases are: > + * > + * existing +---+ > + * new +-------------------+ > + * => erase existing mapping > + * > + * existing +------------------...
2018 Aug 01
0
Re: [PATCH nbdkit 3/4] Add map filter.
...ped. > >+static int > >+insert_mapping (struct map *map, const struct mapping *new_mapping) > >+{ > >+ size_t i; > >+ > >+ /* Adjust existing mappings if they overlap with this mapping. */ > >+ for (i = 0; i < map->nr_map; ++i) { > >+ if (mappings_overlap (&map->map[i], new_mapping)) { > >+ /* The four cases are: > >+ * > >+ * existing +---+ > >+ * new +-------------------+ > >+ * => erase existing mapping > >+ * > >+ * e...
2018 Jul 31
0
[PATCH nbdkit 3/4] Add map filter.
...onst struct mapping *m1 = mv1; + const struct mapping *m2 = mv2; + + if (m1->rq_start < m2->rq_start) + return -1; + else if (m1->rq_start > m2->rq_start) + return 1; + else + return 0; +} + +/* Return true if two mappings overlap in the request range. */ +static int +mappings_overlap (const struct mapping *m1, const struct mapping *m2) +{ + return m1->rq_end >= m2->rq_start && m1->rq_start <= m2->rq_end; +} + +void +map_init (struct map *map) +{ + map->nr_map = 0; + map->map = NULL; +} + +void +map_free (struct map *map) +{ + if (!map) return...
2018 Jul 31
7
[PATCH nbdkit 0/4] Add truncate and map filters.
This patch series proposes two new filters. * truncate: This can truncate, extend, round up or round down the size of a plugin/device. A typical usage is to fix the qemu problem that it can only handle devices which are a multiple of 512-bytes: nbdkit --filter=truncate random size=500 round-up=512 This will serve a virtual device with size 512 bytes. Reading from the last 12 bytes will