Displaying 10 results from an estimated 10 matches for "nbdkit_isaligned_h".
2018 Aug 19
1
Re: [PATCH v3 3/4] common: Add isaligned helper module
...HOWEVER CAUSED AND
> + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
> + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
> + * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> + * SUCH DAMAGE.
> + */
> +
> +#ifndef NBDKIT_ISALIGNED_H
> +#define NBDKIT_ISALIGNED_H
> +
> +#include <assert.h>
> +#include <stdbool.h>
> +
> +#include "ispowerof2.h"
> +
> +/* Return true if size is a multiple of align. align must be power of 2.
> + */
> +static inline bool
> +is_aligned (unsigned...
2018 Aug 03
0
[PATCH v2 3/4] common: Add isaligned helper module
...PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef NBDKIT_ISALIGNED_H
+#define NBDKIT_ISALIGNED_H
+
+#include <stdbool.h>
+
+/* Return true if size is a multiple of align. align must be power of 2.
+ *
+ * Suggested by Eric Blake. See:
+ * https://www.redhat.com/archives/libguestfs/2018-August/msg00036.html
+ */
+static inline bool
+is_aligned (unsigned int si...
2018 Aug 18
0
[PATCH v3 3/4] common: Add isaligned helper module
...PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifndef NBDKIT_ISALIGNED_H
+#define NBDKIT_ISALIGNED_H
+
+#include <assert.h>
+#include <stdbool.h>
+
+#include "ispowerof2.h"
+
+/* Return true if size is a multiple of align. align must be power of 2.
+ */
+static inline bool
+is_aligned (unsigned int size, unsigned int align)
+{
+ assert (is_power_o...
2018 Aug 18
7
[PATCH v3 0/4] file: Zero for block devices and older file systems
This version addresses some of the comments on v2.
Changes since v2:
- file_zero: Add missing space in function call
- is_aligned: Assert that align is indeed a power of 2
- Spelling in commit message
Not changed:
- Eric commented that spacing was off:
https://www.redhat.com/archives/libguestfs/2018-August/msg00113.html
but I could not find anything wrong.
- Eric asked if ioctl.h will cause
2018 Sep 17
4
[PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...aligned (unsigned int size, unsigned int align)
-{
- assert (is_power_of_2 (align));
- return !(size & (align - 1));
-}
+#define IS_ALIGNED(size, align) ({ \
+ assert (is_power_of_2 ((align))); \
+ !((size) & ((align) - 1)); \
+})
#endif /* NBDKIT_ISALIGNED_H */
diff --git a/plugins/file/file.c b/plugins/file/file.c
index 9d03f18..1391f62 100644
--- a/plugins/file/file.c
+++ b/plugins/file/file.c
@@ -397,13 +397,13 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_trim)
#ifdef BLKZEROOUT
/* For aligned range and block device, we...
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
2018 Sep 17
0
[PATCH nbdkit v3 1/3] common: isaligned: Use a macro instead of relying on implicit truncation.
...aligned (unsigned int size, unsigned int align)
-{
- assert (is_power_of_2 (align));
- return !(size & (align - 1));
-}
+#define IS_ALIGNED(size, align) ({ \
+ assert (is_power_of_2 ((align))); \
+ !((size) & ((align) - 1)); \
+})
#endif /* NBDKIT_ISALIGNED_H */
diff --git a/plugins/file/file.c b/plugins/file/file.c
index 9d03f18..1391f62 100644
--- a/plugins/file/file.c
+++ b/plugins/file/file.c
@@ -397,13 +397,13 @@ file_zero (void *handle, uint32_t count, uint64_t offset, int may_trim)
#ifdef BLKZEROOUT
/* For aligned range and block device, we...
2018 Sep 17
0
Re: [PATCH nbdkit v2] common: isaligned: Use a macro instead of relying on implicit truncation.
...N_DOWN(x, a) __ALIGN_KERNEL((x) - ((a) - 1), (a))
60 #define __ALIGN_MASK(x, mask) __ALIGN_KERNEL_MASK((x), (mask))
61 #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
62 #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
>
> #endif /* NBDKIT_ISALIGNED_H */
> diff --git a/plugins/file/file.c b/plugins/file/file.c
> index 9d03f18..1391f62 100644
> --- a/plugins/file/file.c
> +++ b/plugins/file/file.c
> @@ -397,13 +397,13 @@ file_zero (void *handle, uint32_t count, uint64_t
> offset, int may_trim)
>
> #ifdef BLKZEROOUT
>...
2018 Aug 03
10
[PATCH v2 0/4] file: Zero for block devices and older file systems
This is the third version to support efficient zero for block devices
on older kernels (e.g. RHEL 7.5), and file systems that do not support
yet FALLOC_FS_ZERO_RANGE (e.g. NFS 4.2).
Changes 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.
-
2018 Sep 17
7
[PATCH nbdkit v3 0/3] Add partitioning plugin.
The partitioning plugin patch is the same (except for rebasing).
However I have changed the first two patches based on feedback
received. In particular this fixes a very serious bug found by Eric
Blake in the current truncate filter.
Rich.