search for: isalign

Displaying 20 results from an estimated 88 matches for "isalign".

Did you mean: disalign
2018 Sep 17
4
[PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
--- common/include/isaligned.h | 11 +++++------ plugins/file/file.c | 4 ++-- plugins/vddk/vddk.c | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/common/include/isaligned.h b/common/include/isaligned.h index e693820..81ce8a7 100644 --- a/common/include/isaligned.h +++ b/common/...
2018 Aug 19
1
Re: [PATCH v3 3/4] common: Add isaligned helper module
..., 2018 at 01:13:07AM +0300, Nir Soffer wrote: > is_aligned (size, align) returns true if size is aligned to align, > assuming that align is power of 2. > > Suggested by Eric Blake in > https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html > --- > common/include/isaligned.h | 51 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 51 insertions(+) > create mode 100644 common/include/isaligned.h > > diff --git a/common/include/isaligned.h b/common/include/isaligned.h You have to add this file to common/include/Makefile.am otherwise it will never...
2018 Aug 03
0
[PATCH v2 3/4] common: Add isaligned helper module
is_aligned (size, align) returns true if size is aligned to align, assuming that align is power of 2. Suggested by Eric in https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html --- common/include/isaligned.h | 50 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 common/include/isaligned.h diff --git a/common/include/isaligned.h b/common/include/isaligned.h new file mode 100644 index 0000000..468b624 --- /dev/null +++ b/common/include/isaligned.h @@ -0,0 +...
2018 Aug 18
0
[PATCH v3 3/4] common: Add isaligned helper module
is_aligned (size, align) returns true if size is aligned to align, assuming that align is power of 2. Suggested by Eric Blake in https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html --- common/include/isaligned.h | 51 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 common/include/isaligned.h diff --git a/common/include/isaligned.h b/common/include/isaligned.h new file mode 100644 index 0000000..e693820 --- /dev/null +++ b/common/include/isaligned.h @@ -0,0 +...
2018 Sep 17
0
[PATCH nbdkit 1/3] common: isaligned: Use uint64_t instead of unsigned int.
This should have no effect. However it's probably better to pass the full type explicitly rather than using an implicit truncation. --- common/include/isaligned.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/common/include/isaligned.h b/common/include/isaligned.h index e693820..9ed635e 100644 --- a/common/include/isaligned.h +++ b/common/include/isaligned.h @@ -36,13 +36,14 @@ #include <assert.h> #include <stdbool.h&...
2018 Sep 17
0
[PATCH nbdkit v3 1/3] common: isaligned: Use a macro instead of relying on implicit truncation.
--- common/include/isaligned.h | 11 +++++------ plugins/file/file.c | 4 ++-- plugins/vddk/vddk.c | 8 ++++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/common/include/isaligned.h b/common/include/isaligned.h index e693820..81ce8a7 100644 --- a/common/include/isaligned.h +++ b/common/...
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On Mon, Sep 17, 2018 at 11:27 PM Richard W.M. Jones <rjones@redhat.com> wrote: > --- > common/include/isaligned.h | 11 +++++------ > plugins/file/file.c | 4 ++-- > plugins/vddk/vddk.c | 8 ++++---- > 3 files changed, 11 insertions(+), 12 deletions(-) > > diff --git a/common/include/isaligned.h b/common/include/isaligned.h > index e693820..81ce8a7 100644 > --- a/common...
2018 Sep 17
3
Re: [PATCH nbdkit 1/3] common: isaligned: Use uint64_t instead of unsigned int.
...e only about the least significant bits; current code is clear about that. This is also specified behavior, although the only reference I can find now is this: https://docs.microsoft.com/en-us/cpp/c-language/conversions-from-unsigned-integral-types?view=vs-2017 Nir > --- > common/include/isaligned.h | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/common/include/isaligned.h b/common/include/isaligned.h > index e693820..9ed635e 100644 > --- a/common/include/isaligned.h > +++ b/common/include/isaligned.h > @@ -36,13 +36,14 @@ > > #include...
2018 Aug 13
1
Re: [PATCH v2 3/4] common: Add isaligned helper module
On 08/03/2018 02:28 PM, Nir Soffer wrote: > is_aligned (size, align) returns true if size is aligned to align, > assuming that align is power of 2. > > Suggested by Eric in > https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html > --- > common/include/isaligned.h | 50 ++++++++++++++++++++++++++++++++++++++ > 1 file changed, 50 insertions(+) > create mode 100644 common/include/isaligned.h > > +/* Return true if size is a multiple of align. align must be power of 2. > + * > + * Suggested by Eric Blake. See: > + * https://www.re...
2018 Sep 17
1
Re: [PATCH nbdkit 1/3] common: isaligned: Use uint64_t instead of unsigned int.
...Why is it better? OK I'll give one (somewhat contrived) example where it might be better not to rely on implicit truncation of parameters: (1) User is compiling on a 32 bit architecture. (2) They have turned off or are ignoring compiler warnings. (3) The code has forgotten to #include "isaligned.h" (either our code omits this, which is unlikely, or the user is developing a new plugin using the same framework). In this case the uint64_t would be passed as a 64 bit value (eg. in two registers, or as a 64 bit stack entry), and thus the receiving function would get the wrong parameter...
2018 Aug 19
9
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses comments on v3. Changes since v3: - Finally got spacing right (Eric) - Reorder includes (Richard) - Return 0 or -1 instead of r (Richard) - Add common/include/isaligned.h to Makefile.am (Richard) v3 was here: https://www.redhat.com/archives/libguestfs/2018-August/msg00177.html Nir Soffer (4): file: Avoid unsupported fallocate() calls file: Support zero without ZERO_RANGE common: Add isaligned helper module file: Zero for block devices on old kernels...
2023 Mar 01
6
[libnbd PATCH 0/6] common: catch up with nbdkit
...o form a common baseline for porting my recent patches from libnbd to nbdkit. The larger LISTEN_FDNAMES series will be resumed even later. Laszlo Eric Blake (1): tests: Avoid odd test behavior under NDEBUG [partial port] Richard W.M. Jones (5): common/include: Add unit tests [byte-swapping, isaligned, iszero] common/include: Add further unit tests [minmax] common: include: Define bswap_16, bswap_32 and bswap_64 [finish port] vector: Add vector_duplicate function common/include: Fix MIN and MAX macros so they can be nested [finish port] .gitignore | 4 +...
2018 Sep 17
0
Re: [PATCH nbdkit 1/3] common: isaligned: Use uint64_t instead of unsigned int.
On Mon, Sep 17, 2018 at 10:00:30PM +0300, Nir Soffer wrote: > On Mon, Sep 17, 2018 at 6:03 PM Richard W.M. Jones <rjones@redhat.com> > wrote: > > > This should have no effect. However it's probably better to pass the > > full type explicitly rather than using an implicit truncation. > > > > Why is it better? It's not necessarily, hence patches are
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On Tue, Sep 18, 2018 at 12:13 AM Eric Blake <eblake@redhat.com> wrote: > On 9/17/18 3:39 PM, Nir Soffer wrote: > > >> +#define IS_ALIGNED(size, align) ({ \ > >> + assert (is_power_of_2 ((align))); \ > >> + !((size) & ((align) - 1)); \ > >> +}) > >> > > > > But this version will
2018 Sep 17
1
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On 9/17/18 4:41 PM, Nir Soffer wrote: > The FreeBSD version: > > #define IS_ALIGNED <http://fxr.watson.org/fxr/ident?i=IS_ALIGNED>(n > <http://fxr.watson.org/fxr/ident?i=n>,align) (!((uint32_t)(n > <http://fxr.watson.org/fxr/ident?i=n>) & (align - 1))) > > http://fxr.watson.org/fxr/source/contrib/ncsw/inc/ncsw_ext.h#L182 Which truncates to 32
2018 Aug 18
7
[PATCH v3 0/4] file: Zero for block devices and older file systems
...is no issue. I also look at NetBSD and OpenBSD source, and in alll ioctl() is defined in ioctl.h. v2 was here: https://www.redhat.com/archives/libguestfs/2018-August/msg00041.html Nir Soffer (4): file: Avoid unsupported fallocate() calls file: Support zero without ZERO_RANGE common: Add isaligned helper module file: Zero for block devices on old kernels common/include/isaligned.h | 51 +++++++++++ plugins/file/Makefile.am | 3 +- plugins/file/file.c | 182 +++++++++++++++++++++++++++++-------- 3 files changed, 197 insertions(+), 39 deletions(-) create mode 100644 common/i...
2018 Sep 17
2
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
On 9/17/18 3:39 PM, Nir Soffer wrote: >> +#define IS_ALIGNED(size, align) ({ \ >> + assert (is_power_of_2 ((align))); \ >> + !((size) & ((align) - 1)); \ >> +}) >> > > But this version will happily accept singed int, and I think this code > behavior with signed int is undefined. Well, sort of. Bit shifts
2020 Jul 07
2
[nbdkit PATCH] RFC tests: Avoid odd test behavior under NDEBUG
...nce 'make check' passed in a build with CFLAGS=-DNDEBUG, I'm not sure we need it. common/include/test-ascii-ctype.c | 1 + common/include/test-ascii-string.c | 1 + common/include/test-byte-swapping.c | 1 + common/include/test-current-dir-name.c | 1 + common/include/test-isaligned.c | 1 + common/include/test-ispowerof2.c | 1 + common/include/test-iszero.c | 1 + common/include/test-minmax.c | 1 + common/include/test-nextnonzero.c | 1 + common/bitmap/test-bitmap.c | 1 + common/utils/test-quotes.c | 1 + commo...
2018 Aug 03
10
[PATCH v2 0/4] file: Zero for block devices and older file systems
...anges since v2: - Revert file_can_trim change, since it is too late to change the value after negotiation. Changing the capability dinamically may be useful internally, but it should be done via other means. - Do not depend on FALLOC_FL_* when including <linux/fs.h>. - Add common/includes/isaligned.h for is_aligned helper, implemented in a more efficient way with bitwise math. - If getting sector size fail, fall back to safe guess instead of hard failure. - More efficient alignment check using bitwise math. - For BLKZEROOUT, treat ENOTTY as EOPNOTSUPP. Theoretically possible with a mi...
2020 Jul 07
0
Re: [nbdkit PATCH] RFC tests: Avoid odd test behavior under NDEBUG
...t something is being tested even under these conditions. ACK Rich. > common/include/test-ascii-ctype.c | 1 + > common/include/test-ascii-string.c | 1 + > common/include/test-byte-swapping.c | 1 + > common/include/test-current-dir-name.c | 1 + > common/include/test-isaligned.c | 1 + > common/include/test-ispowerof2.c | 1 + > common/include/test-iszero.c | 1 + > common/include/test-minmax.c | 1 + > common/include/test-nextnonzero.c | 1 + > common/bitmap/test-bitmap.c | 1 + > common/utils/test-quo...