search for: blk_bit

Displaying 8 results from an estimated 8 matches for "blk_bit".

2018 Dec 03
1
Re: [PATCH nbdkit v2] common: Move shared bitmap code to a common library.
...associated with the given block. > + * If the request is out of range, returns the default value. > + */ > +static inline unsigned > +bitmap_get_blk (const struct bitmap *bm, uint64_t blk, unsigned default_) > +{ > + uint64_t blk_offset = blk / (8 / bm->bpb); > + unsigned blk_bit = bm->bpb * (blk % (8 / bm->bpb)); Would using << and >> instead of / and % aid the compiler, since we know we have powers of 2 based on initialization, but the compiler might not see it locally? > +/* Set the bit(s) associated with the given block. > + * If out of range...
2018 Dec 03
3
[PATCH nbdkit v3] common: Move shared bitmap code to a common library.
v2: https://www.redhat.com/archives/libguestfs/2018-December/msg00039.html v2 -> v3: - Fix all the issues raised in Eric's review. - Precompute some numbers to make the calculations easier. - Calculations now use bitshifts and masks in preference to division and modulo. - Clear existing bits before setting (which fixes a bug in the cache filter). Rich.
2018 Dec 02
2
[PATCH nbdkit v2] common: Move shared bitmap code to a common library.
This is exactly the same as v1: https://www.redhat.com/archives/libguestfs/2018-December/msg00004.html except that it now frees the bitmap on unload (which the old code did not - there was always a memory leak). Rich.
2018 Dec 01
0
[PATCH nbdkit] common: Move shared bitmap code to a common library.
...new_size); + +/* Return the bit(s) associated with the given block. + * If the request is out of range, returns the default value. + */ +static inline unsigned +bitmap_get_blk (const struct bitmap *bm, uint64_t blk, unsigned default_) +{ + uint64_t blk_offset = blk / (8 / bm->bpb); + unsigned blk_bit = bm->bpb * (blk % (8 / bm->bpb)); + unsigned mask = (1 << bm->bpb) - 1; + + if (blk_offset >= bm->size) { + nbdkit_debug ("bitmap_get: block number is out of range"); + return default_; + } + + return (bm->bitmap[blk_offset] & (mask << blk_bit)...
2018 Dec 02
0
[PATCH nbdkit v2] common: Move shared bitmap code to a common library.
...new_size); + +/* Return the bit(s) associated with the given block. + * If the request is out of range, returns the default value. + */ +static inline unsigned +bitmap_get_blk (const struct bitmap *bm, uint64_t blk, unsigned default_) +{ + uint64_t blk_offset = blk / (8 / bm->bpb); + unsigned blk_bit = bm->bpb * (blk % (8 / bm->bpb)); + unsigned mask = (1 << bm->bpb) - 1; + + if (blk_offset >= bm->size) { + nbdkit_debug ("bitmap_get: block number is out of range"); + return default_; + } + + return (bm->bitmap[blk_offset] & (mask << blk_bit)...
2018 Dec 03
0
[PATCH nbdkit v3] common: Move shared bitmap code to a common library.
...e virtual disk size in bytes. + * Returns -1 on error, setting nbdkit_error. + */ +extern int bitmap_resize (struct bitmap *bm, uint64_t new_size); + +/* This macro calculates the byte offset in the bitmap and which + * bit/mask we are addressing within that byte. + * + * bpb blk_offset blk_bit mask + * 1 blk >> 3 0,1,2,...,7 any single bit + * 2 blk >> 2 0, 2, 4 or 6 0x3, 0xc, 0x30 or 0xc0 + * 4 blk >> 1 0 or 4 0xf, 0xf0 + * 8 blk >> 0 always 0 always 0xff + */ +#de...
2018 Dec 01
2
[PATCH nbdkit] common: Move shared bitmap code to a common library.
I have some patches I'm working on to fix the cache filter. However this is a prelude. It should be simply pure refactoring. All tests pass still. Rich.
2009 Dec 14
1
Applied the generic path searching to ISOLINUX
Hi all, I just applied the generic path searching to ISOLINUX, and you can check it here: http://git.zytor.com/?p=users/liu/gsoc09_liu.git since commit 4bb194f14a43674cced3a8c35d5e625e59db32dc. hpa, for now, all the fs code have been converted to new-style interface and I have done my best to make all the fs C code be clean and readable. Well, it would be great if you take a minute to