|
|
6661d0 |
From e06b90e7609a1f107d4e21467e84a300666e2d91 Mon Sep 17 00:00:00 2001
|
|
|
7084e2 |
From: Nir Soffer <nsoffer@redhat.com>
|
|
|
7084e2 |
Date: Sat, 6 Nov 2021 00:03:11 +0200
|
|
|
7084e2 |
Subject: [PATCH] common/utils/vector: Rename `size` to `len`
|
|
|
7084e2 |
|
|
|
7084e2 |
The field `size` may be confusing with the size of the underlying array.
|
|
|
7084e2 |
Rename to `len`, a common term for this concept.
|
|
|
7084e2 |
|
|
|
7084e2 |
Tested with "make check" as regular user, tests that need root or
|
|
|
7084e2 |
external libraries (vddk) are not tested.
|
|
|
7084e2 |
|
|
|
7084e2 |
Ported from libnbd commit cc0567e9aed7e6b40a44bf8eac0a262ac7314fec.
|
|
|
7084e2 |
|
|
|
7084e2 |
(cherry picked from commit 0b0eece73f04963a66b9adc507e5cbaba608660b)
|
|
|
7084e2 |
---
|
|
|
7084e2 |
common/allocators/allocator.c | 2 +-
|
|
|
7084e2 |
common/allocators/malloc.c | 2 +-
|
|
|
7084e2 |
common/allocators/sparse.c | 6 +-
|
|
|
7084e2 |
common/allocators/zstd.c | 6 +-
|
|
|
7084e2 |
common/regions/regions.h | 6 +-
|
|
|
7084e2 |
common/utils/environ.c | 2 +-
|
|
|
7084e2 |
common/utils/test-vector.c | 2 +-
|
|
|
7084e2 |
common/utils/vector.h | 52 ++++++------
|
|
|
7084e2 |
filters/ddrescue/ddrescue.c | 2 +-
|
|
|
7084e2 |
filters/exitwhen/exitwhen.c | 2 +-
|
|
|
7084e2 |
filters/extentlist/extentlist.c | 14 ++--
|
|
|
7084e2 |
filters/multi-conn/multi-conn.c | 16 ++--
|
|
|
7084e2 |
plugins/cc/cc.c | 4 +-
|
|
|
7084e2 |
plugins/data/data.c | 4 +-
|
|
|
7084e2 |
plugins/data/format.c | 114 +++++++++++++--------------
|
|
|
7084e2 |
plugins/eval/eval.c | 2 +-
|
|
|
7084e2 |
plugins/floppy/directory-lfn.c | 24 +++---
|
|
|
7084e2 |
plugins/floppy/floppy.c | 2 +-
|
|
|
7084e2 |
plugins/floppy/virtual-floppy.c | 32 ++++----
|
|
|
7084e2 |
plugins/iso/iso.c | 4 +-
|
|
|
7084e2 |
plugins/nbd/nbd.c | 6 +-
|
|
|
7084e2 |
plugins/partitioning/partition-mbr.c | 8 +-
|
|
|
7084e2 |
plugins/partitioning/partitioning.c | 18 ++---
|
|
|
7084e2 |
plugins/partitioning/virtual-disk.c | 12 +--
|
|
|
7084e2 |
plugins/partitioning/virtual-disk.h | 2 +-
|
|
|
7084e2 |
plugins/split/split.c | 14 ++--
|
|
|
7084e2 |
plugins/ssh/ssh.c | 2 +-
|
|
|
7084e2 |
plugins/vddk/reexec.c | 8 +-
|
|
|
7084e2 |
plugins/vddk/stats.c | 4 +-
|
|
|
7084e2 |
plugins/vddk/worker.c | 4 +-
|
|
|
7084e2 |
server/exports.c | 6 +-
|
|
|
7084e2 |
server/extents.c | 22 +++---
|
|
|
7084e2 |
server/main.c | 2 +-
|
|
|
7084e2 |
server/sockets.c | 8 +-
|
|
|
7084e2 |
wrapper.c | 4 +-
|
|
|
7084e2 |
35 files changed, 209 insertions(+), 209 deletions(-)
|
|
|
7084e2 |
|
|
|
7084e2 |
diff --git a/common/allocators/allocator.c b/common/allocators/allocator.c
|
|
|
7084e2 |
index d306a842..019c68cd 100644
|
|
|
7084e2 |
--- a/common/allocators/allocator.c
|
|
|
7084e2 |
+++ b/common/allocators/allocator.c
|
|
|
7084e2 |
@@ -137,7 +137,7 @@ create_allocator (const char *type, bool debug)
|
|
|
7084e2 |
return NULL;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* See if we can find the allocator. */
|
|
|
7084e2 |
- for (i = 0; i < allocators.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < allocators.len; ++i) {
|
|
|
7084e2 |
if (strncmp (type, allocators.ptr[i]->type, type_len) == 0) {
|
|
|
7084e2 |
ret = allocators.ptr[i]->create (¶ms);
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
diff --git a/common/allocators/malloc.c b/common/allocators/malloc.c
|
|
|
7084e2 |
index f7474465..eea44432 100644
|
|
|
7084e2 |
--- a/common/allocators/malloc.c
|
|
|
7084e2 |
+++ b/common/allocators/malloc.c
|
|
|
7084e2 |
@@ -241,7 +241,7 @@ m_alloc_create (const void *paramsv)
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Parse the optional mlock=true|false parameter. */
|
|
|
7084e2 |
- for (i = 0; i < params->size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < params->len; ++i) {
|
|
|
7084e2 |
if (strcmp (params->ptr[i].key, "mlock") == 0) {
|
|
|
7084e2 |
int r = nbdkit_parse_bool (params->ptr[i].value);
|
|
|
7084e2 |
if (r == -1) return NULL;
|
|
|
7084e2 |
diff --git a/common/allocators/sparse.c b/common/allocators/sparse.c
|
|
|
7084e2 |
index ca508c35..7c6d1636 100644
|
|
|
7084e2 |
--- a/common/allocators/sparse.c
|
|
|
7084e2 |
+++ b/common/allocators/sparse.c
|
|
|
7084e2 |
@@ -150,7 +150,7 @@ sparse_array_free (struct allocator *a)
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
if (sa) {
|
|
|
7084e2 |
- for (i = 0; i < sa->l1_dir.size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < sa->l1_dir.len; ++i)
|
|
|
7084e2 |
free_l2_dir (sa->l1_dir.ptr[i].l2_dir);
|
|
|
7084e2 |
free (sa->l1_dir.ptr);
|
|
|
7084e2 |
pthread_mutex_destroy (&sa->lock);
|
|
|
7084e2 |
@@ -184,7 +184,7 @@ insert_l1_entry (struct sparse_array *sa, const struct l1_entry *entry)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < sa->l1_dir.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < sa->l1_dir.len; ++i) {
|
|
|
7084e2 |
if (entry->offset < sa->l1_dir.ptr[i].offset) {
|
|
|
7084e2 |
/* Insert new entry before i'th directory entry. */
|
|
|
7084e2 |
if (l1_dir_insert (&sa->l1_dir, *entry, i) == -1) {
|
|
|
7084e2 |
@@ -508,7 +508,7 @@ sparse_array_create (const void *paramsv)
|
|
|
7084e2 |
const allocator_parameters *params = paramsv;
|
|
|
7084e2 |
struct sparse_array *sa;
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (params->size > 0) {
|
|
|
7084e2 |
+ if (params->len > 0) {
|
|
|
7084e2 |
nbdkit_error ("allocator=sparse does not take extra parameters");
|
|
|
7084e2 |
return NULL;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
diff --git a/common/allocators/zstd.c b/common/allocators/zstd.c
|
|
|
7084e2 |
index 81fe4ed0..1675d21c 100644
|
|
|
7084e2 |
--- a/common/allocators/zstd.c
|
|
|
7084e2 |
+++ b/common/allocators/zstd.c
|
|
|
7084e2 |
@@ -136,7 +136,7 @@ zstd_array_free (struct allocator *a)
|
|
|
7084e2 |
|
|
|
7084e2 |
ZSTD_freeCCtx (za->zcctx);
|
|
|
7084e2 |
ZSTD_freeDStream (za->zdstrm);
|
|
|
7084e2 |
- for (i = 0; i < za->l1_dir.size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < za->l1_dir.len; ++i)
|
|
|
7084e2 |
free_l2_dir (za->l1_dir.ptr[i].l2_dir);
|
|
|
7084e2 |
free (za->l1_dir.ptr);
|
|
|
7084e2 |
pthread_mutex_destroy (&za->lock);
|
|
|
7084e2 |
@@ -170,7 +170,7 @@ insert_l1_entry (struct zstd_array *za, const struct l1_entry *entry)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < za->l1_dir.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < za->l1_dir.len; ++i) {
|
|
|
7084e2 |
if (entry->offset < za->l1_dir.ptr[i].offset) {
|
|
|
7084e2 |
/* Insert new entry before i'th directory entry. */
|
|
|
7084e2 |
if (l1_dir_insert (&za->l1_dir, *entry, i) == -1) {
|
|
|
7084e2 |
@@ -600,7 +600,7 @@ zstd_array_create (const void *paramsv)
|
|
|
7084e2 |
const allocator_parameters *params = paramsv;
|
|
|
7084e2 |
struct zstd_array *za;
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (params->size > 0) {
|
|
|
7084e2 |
+ if (params->len > 0) {
|
|
|
7084e2 |
nbdkit_error ("allocator=zstd does not take extra parameters");
|
|
|
7084e2 |
return NULL;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
diff --git a/common/regions/regions.h b/common/regions/regions.h
|
|
|
e7ca0c |
index 6dfd5d88..3d562316 100644
|
|
|
7084e2 |
--- a/common/regions/regions.h
|
|
|
7084e2 |
+++ b/common/regions/regions.h
|
|
|
7084e2 |
@@ -84,17 +84,17 @@ extern void free_regions (regions *regions)
|
|
|
7084e2 |
static inline size_t __attribute__((__nonnull__ (1)))
|
|
|
7084e2 |
nr_regions (regions *rs)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- return rs->size;
|
|
|
7084e2 |
+ return rs->len;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Return the virtual size of the disk. */
|
|
|
7084e2 |
static inline int64_t __attribute__((__nonnull__ (1)))
|
|
|
7084e2 |
virtual_size (regions *rs)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- if (rs->size == 0)
|
|
|
7084e2 |
+ if (rs->len == 0)
|
|
|
7084e2 |
return 0;
|
|
|
7084e2 |
else
|
|
|
7084e2 |
- return rs->ptr[rs->size-1].end + 1;
|
|
|
7084e2 |
+ return rs->ptr[rs->len-1].end + 1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Look up the region corresponding to the given offset. If the
|
|
|
7084e2 |
diff --git a/common/utils/environ.c b/common/utils/environ.c
|
|
|
7084e2 |
index e70976cb..2ad996eb 100644
|
|
|
7084e2 |
--- a/common/utils/environ.c
|
|
|
7084e2 |
+++ b/common/utils/environ.c
|
|
|
7084e2 |
@@ -82,7 +82,7 @@ copy_environ (char **env, ...)
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Search for key in the existing environment. It's O(n^2) ... */
|
|
|
7084e2 |
len = strlen (key);
|
|
|
7084e2 |
- for (i = 0; i < ret.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < ret.len; ++i) {
|
|
|
7084e2 |
if (strncmp (key, ret.ptr[i], len) == 0 && ret.ptr[i][len] == '=') {
|
|
|
7084e2 |
/* Replace the existing key. */
|
|
|
7084e2 |
free (ret.ptr[i]);
|
|
|
7084e2 |
diff --git a/common/utils/test-vector.c b/common/utils/test-vector.c
|
|
|
7084e2 |
index 28af59b8..6d89a281 100644
|
|
|
7084e2 |
--- a/common/utils/test-vector.c
|
|
|
7084e2 |
+++ b/common/utils/test-vector.c
|
|
|
7084e2 |
@@ -73,7 +73,7 @@ test_int64_vector (void)
|
|
|
7084e2 |
assert (v.ptr[i] == i);
|
|
|
7084e2 |
|
|
|
7084e2 |
int64_vector_remove (&v, 1);
|
|
|
7084e2 |
- assert (v.size == 9);
|
|
|
7084e2 |
+ assert (v.len == 9);
|
|
|
7084e2 |
assert (v.ptr[1] == 2);
|
|
|
7084e2 |
|
|
|
7084e2 |
tmp = 10;
|
|
|
7084e2 |
diff --git a/common/utils/vector.h b/common/utils/vector.h
|
|
|
7084e2 |
index 782dcba6..1d04f812 100644
|
|
|
7084e2 |
--- a/common/utils/vector.h
|
|
|
7084e2 |
+++ b/common/utils/vector.h
|
|
|
7084e2 |
@@ -59,14 +59,14 @@
|
|
|
7084e2 |
*
|
|
|
7084e2 |
* string_vector names = empty_vector;
|
|
|
7084e2 |
*
|
|
|
7084e2 |
- * where ‘names.ptr[]’ will be an array of strings and ‘names.size’
|
|
|
7084e2 |
+ * where ‘names.ptr[]’ will be an array of strings and ‘names.len’
|
|
|
7084e2 |
* will be the number of strings. There are no get/set accessors. To
|
|
|
7084e2 |
* iterate over the strings you can use the ‘.ptr’ field directly:
|
|
|
7084e2 |
*
|
|
|
7084e2 |
- * for (size_t i = 0; i < names.size; ++i)
|
|
|
7084e2 |
+ * for (size_t i = 0; i < names.len; ++i)
|
|
|
7084e2 |
* printf ("%s\n", names.ptr[i]);
|
|
|
7084e2 |
*
|
|
|
7084e2 |
- * Initializing with ‘empty_vector’ sets ‘.ptr = NULL’ and ‘.size = 0’.
|
|
|
7084e2 |
+ * Initializing with ‘empty_vector’ sets ‘.ptr = NULL’ and ‘.len = 0’.
|
|
|
7084e2 |
*
|
|
|
7084e2 |
* DEFINE_VECTOR_TYPE also defines utility functions. For the full
|
|
|
7084e2 |
* list see the definition below, but useful functions include:
|
|
|
7084e2 |
@@ -84,15 +84,15 @@
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
#define DEFINE_VECTOR_TYPE(name, type) \
|
|
|
7084e2 |
struct name { \
|
|
|
7084e2 |
- type *ptr; /* Pointer to array of items. */ \
|
|
|
7084e2 |
- size_t size; /* Number of valid items in the array. */ \
|
|
|
7084e2 |
- size_t cap; /* Maximum number of items. */ \
|
|
|
7084e2 |
+ type *ptr; /* Pointer to array of items. */ \
|
|
|
7084e2 |
+ size_t len; /* Number of valid items in the array. */ \
|
|
|
7084e2 |
+ size_t cap; /* Maximum number of items. */ \
|
|
|
7084e2 |
}; \
|
|
|
7084e2 |
typedef struct name name; \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
/* Reserve n elements at the end of the vector. Note space is \
|
|
|
7084e2 |
- * allocated but the vector size is not increased and the new \
|
|
|
7084e2 |
- * elements are not initialized. \
|
|
|
7084e2 |
+ * allocated and capacity is increased, but the vector length \
|
|
|
7084e2 |
+ * is not increased and the new elements are not initialized. \
|
|
|
7084e2 |
*/ \
|
|
|
7084e2 |
static inline int \
|
|
|
7084e2 |
name##_reserve (name *v, size_t n) \
|
|
|
7084e2 |
@@ -101,17 +101,17 @@
|
|
|
7084e2 |
sizeof (type)); \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
- /* Insert at i'th element. i=0 => beginning i=size => append */ \
|
|
|
7084e2 |
+ /* Insert at i'th element. i=0 => beginning i=len => append */ \
|
|
|
7084e2 |
static inline int \
|
|
|
7084e2 |
name##_insert (name *v, type elem, size_t i) \
|
|
|
7084e2 |
{ \
|
|
|
7084e2 |
- assert (i <= v->size); \
|
|
|
7084e2 |
- if (v->size >= v->cap) { \
|
|
|
7084e2 |
+ assert (i <= v->len); \
|
|
|
7084e2 |
+ if (v->len >= v->cap) { \
|
|
|
7084e2 |
if (name##_reserve (v, 1) == -1) return -1; \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
- memmove (&v->ptr[i+1], &v->ptr[i], (v->size-i) * sizeof (elem)); \
|
|
|
7084e2 |
+ memmove (&v->ptr[i+1], &v->ptr[i], (v->len-i) * sizeof (elem)); \
|
|
|
7084e2 |
v->ptr[i] = elem; \
|
|
|
7084e2 |
- v->size++; \
|
|
|
7084e2 |
+ v->len++; \
|
|
|
7084e2 |
return 0; \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
@@ -119,16 +119,16 @@
|
|
|
7084e2 |
static inline int \
|
|
|
7084e2 |
name##_append (name *v, type elem) \
|
|
|
7084e2 |
{ \
|
|
|
7084e2 |
- return name##_insert (v, elem, v->size); \
|
|
|
7084e2 |
+ return name##_insert (v, elem, v->len); \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
- /* Remove i'th element. i=0 => beginning i=size-1 => end */ \
|
|
|
7084e2 |
+ /* Remove i'th element. i=0 => beginning i=len-1 => end */ \
|
|
|
7084e2 |
static inline void \
|
|
|
7084e2 |
name##_remove (name *v, size_t i) \
|
|
|
7084e2 |
{ \
|
|
|
7084e2 |
- assert (i < v->size); \
|
|
|
7084e2 |
- memmove (&v->ptr[i], &v->ptr[i+1], (v->size-i-1) * sizeof (type)); \
|
|
|
7084e2 |
- v->size--; \
|
|
|
7084e2 |
+ assert (i < v->len); \
|
|
|
7084e2 |
+ memmove (&v->ptr[i], &v->ptr[i+1], (v->len-i-1) * sizeof (type)); \
|
|
|
7084e2 |
+ v->len--; \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
/* Remove all elements and deallocate the vector. */ \
|
|
|
7084e2 |
@@ -137,7 +137,7 @@
|
|
|
7084e2 |
{ \
|
|
|
7084e2 |
free (v->ptr); \
|
|
|
7084e2 |
v->ptr = NULL; \
|
|
|
7084e2 |
- v->size = v->cap = 0; \
|
|
|
7084e2 |
+ v->len = v->cap = 0; \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
/* Iterate over the vector, calling f() on each element. */ \
|
|
|
7084e2 |
@@ -145,7 +145,7 @@
|
|
|
7084e2 |
name##_iter (name *v, void (*f) (type elem)) \
|
|
|
7084e2 |
{ \
|
|
|
7084e2 |
size_t i; \
|
|
|
7084e2 |
- for (i = 0; i < v->size; ++i) \
|
|
|
7084e2 |
+ for (i = 0; i < v->len; ++i) \
|
|
|
7084e2 |
f (v->ptr[i]); \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
@@ -154,7 +154,7 @@
|
|
|
7084e2 |
name##_sort (name *v, \
|
|
|
7084e2 |
int (*compare) (const type *p1, const type *p2)) \
|
|
|
7084e2 |
{ \
|
|
|
7084e2 |
- qsort (v->ptr, v->size, sizeof (type), (void *) compare); \
|
|
|
7084e2 |
+ qsort (v->ptr, v->len, sizeof (type), (void *) compare); \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
/* Search for an exactly matching element in the vector using a \
|
|
|
7084e2 |
@@ -164,7 +164,7 @@
|
|
|
7084e2 |
name##_search (const name *v, const void *key, \
|
|
|
7084e2 |
int (*compare) (const void *key, const type *v)) \
|
|
|
7084e2 |
{ \
|
|
|
7084e2 |
- return bsearch (key, v->ptr, v->size, sizeof (type), \
|
|
|
7084e2 |
+ return bsearch (key, v->ptr, v->len, sizeof (type), \
|
|
|
7084e2 |
(void *) compare); \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
@@ -175,22 +175,22 @@
|
|
|
7084e2 |
/* Note it's allowed for v and copy to be the same pointer. */ \
|
|
|
7084e2 |
type *vptr = v->ptr; \
|
|
|
7084e2 |
type *newptr; \
|
|
|
7084e2 |
- size_t len = v->size * sizeof (type); \
|
|
|
7084e2 |
+ size_t len = v->len * sizeof (type); \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
newptr = malloc (len); \
|
|
|
7084e2 |
if (newptr == NULL) return -1; \
|
|
|
7084e2 |
memcpy (newptr, vptr, len); \
|
|
|
7084e2 |
copy->ptr = newptr; \
|
|
|
7084e2 |
- copy->size = copy->cap = v->size; \
|
|
|
7084e2 |
+ copy->len = copy->cap = v->len; \
|
|
|
7084e2 |
return 0; \
|
|
|
7084e2 |
} \
|
|
|
7084e2 |
\
|
|
|
7084e2 |
|
|
|
7084e2 |
-#define empty_vector { .ptr = NULL, .size = 0, .cap = 0 }
|
|
|
7084e2 |
+#define empty_vector { .ptr = NULL, .len = 0, .cap = 0 }
|
|
|
7084e2 |
|
|
|
7084e2 |
struct generic_vector {
|
|
|
7084e2 |
void *ptr;
|
|
|
7084e2 |
- size_t size;
|
|
|
7084e2 |
+ size_t len;
|
|
|
7084e2 |
size_t cap;
|
|
|
7084e2 |
};
|
|
|
7084e2 |
|
|
|
7084e2 |
diff --git a/filters/ddrescue/ddrescue.c b/filters/ddrescue/ddrescue.c
|
|
|
7084e2 |
index 7b1c9c1e..218c8ee5 100644
|
|
|
7084e2 |
--- a/filters/ddrescue/ddrescue.c
|
|
|
7084e2 |
+++ b/filters/ddrescue/ddrescue.c
|
|
|
7084e2 |
@@ -180,7 +180,7 @@ ddrescue_pread (nbdkit_next *next,
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < map.ranges.size; i++) {
|
|
|
7084e2 |
+ for (i = 0; i < map.ranges.len; i++) {
|
|
|
7084e2 |
if (map.ranges.ptr[i].status != '+')
|
|
|
7084e2 |
continue;
|
|
|
7084e2 |
if (offset >= map.ranges.ptr[i].start && offset <= map.ranges.ptr[i].end) {
|
|
|
7084e2 |
diff --git a/filters/exitwhen/exitwhen.c b/filters/exitwhen/exitwhen.c
|
|
|
7084e2 |
index 543af058..83e99953 100644
|
|
|
7084e2 |
--- a/filters/exitwhen/exitwhen.c
|
|
|
7084e2 |
+++ b/filters/exitwhen/exitwhen.c
|
|
|
7084e2 |
@@ -143,7 +143,7 @@ check_for_event (void)
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
if (!exiting) {
|
|
|
7084e2 |
- for (i = 0; i < events.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < events.len; ++i) {
|
|
|
7084e2 |
const struct event *event = &events.ptr[i];
|
|
|
7084e2 |
|
|
|
7084e2 |
switch (event->type) {
|
|
|
7084e2 |
diff --git a/filters/extentlist/extentlist.c b/filters/extentlist/extentlist.c
|
|
|
7084e2 |
index 7e6f1b78..c91fbfea 100644
|
|
|
7084e2 |
--- a/filters/extentlist/extentlist.c
|
|
|
7084e2 |
+++ b/filters/extentlist/extentlist.c
|
|
|
7084e2 |
@@ -134,7 +134,7 @@ parse_extentlist (void)
|
|
|
7084e2 |
|
|
|
7084e2 |
assert (extentlist != NULL);
|
|
|
7084e2 |
assert (extents.ptr == NULL);
|
|
|
7084e2 |
- assert (extents.size == 0);
|
|
|
7084e2 |
+ assert (extents.len == 0);
|
|
|
7084e2 |
|
|
|
7084e2 |
fp = fopen (extentlist, "r");
|
|
|
7084e2 |
if (!fp) {
|
|
|
7084e2 |
@@ -200,7 +200,7 @@ parse_extentlist (void)
|
|
|
7084e2 |
|
|
|
7084e2 |
/* There must not be overlaps at this point. */
|
|
|
7084e2 |
end = 0;
|
|
|
7084e2 |
- for (i = 0; i < extents.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < extents.len; ++i) {
|
|
|
7084e2 |
if (extents.ptr[i].offset < end ||
|
|
|
7084e2 |
extents.ptr[i].offset + extents.ptr[i].length < extents.ptr[i].offset) {
|
|
|
7084e2 |
nbdkit_error ("extents in the extent list are overlapping");
|
|
|
7084e2 |
@@ -210,8 +210,8 @@ parse_extentlist (void)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* If there's a gap at the beginning, insert a hole|zero extent. */
|
|
|
7084e2 |
- if (extents.size == 0 || extents.ptr[0].offset > 0) {
|
|
|
7084e2 |
- end = extents.size == 0 ? UINT64_MAX : extents.ptr[0].offset;
|
|
|
7084e2 |
+ if (extents.len == 0 || extents.ptr[0].offset > 0) {
|
|
|
7084e2 |
+ end = extents.len == 0 ? UINT64_MAX : extents.ptr[0].offset;
|
|
|
7084e2 |
if (extent_list_insert (&extents,
|
|
|
7084e2 |
(struct extent){.offset = 0, .length = end,
|
|
|
7084e2 |
.type = HOLE},
|
|
|
7084e2 |
@@ -224,7 +224,7 @@ parse_extentlist (void)
|
|
|
7084e2 |
/* Now insert hole|zero extents after every extent where there
|
|
|
7084e2 |
* is a gap between that extent and the next one.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- for (i = 0; i < extents.size-1; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < extents.len-1; ++i) {
|
|
|
7084e2 |
end = extents.ptr[i].offset + extents.ptr[i].length;
|
|
|
7084e2 |
if (end < extents.ptr[i+1].offset)
|
|
|
7084e2 |
if (extent_list_insert (&extents,
|
|
|
7084e2 |
@@ -238,7 +238,7 @@ parse_extentlist (void)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* If there's a gap at the end, insert a hole|zero extent. */
|
|
|
7084e2 |
- end = extents.ptr[extents.size-1].offset + extents.ptr[extents.size-1].length;
|
|
|
7084e2 |
+ end = extents.ptr[extents.len-1].offset + extents.ptr[extents.len-1].length;
|
|
|
7084e2 |
if (end < UINT64_MAX) {
|
|
|
7084e2 |
if (extent_list_append (&extents,
|
|
|
7084e2 |
(struct extent){.offset = end,
|
|
|
7084e2 |
@@ -250,7 +250,7 @@ parse_extentlist (void)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Debug the final list. */
|
|
|
7084e2 |
- for (i = 0; i < extents.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < extents.len; ++i) {
|
|
|
7084e2 |
nbdkit_debug ("extentlist: "
|
|
|
7084e2 |
"extent[%zu] = %" PRIu64 "-%" PRIu64 " (length %" PRIu64 ")"
|
|
|
7084e2 |
" type %" PRIu32,
|
|
|
7084e2 |
diff --git a/filters/multi-conn/multi-conn.c b/filters/multi-conn/multi-conn.c
|
|
|
7084e2 |
index a6a25ef9..c7421a39 100644
|
|
|
7084e2 |
--- a/filters/multi-conn/multi-conn.c
|
|
|
7084e2 |
+++ b/filters/multi-conn/multi-conn.c
|
|
|
7084e2 |
@@ -207,14 +207,14 @@ multi_conn_prepare (nbdkit_next *next, void *handle, int readonly)
|
|
|
7084e2 |
ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
|
|
|
7084e2 |
if (byname) {
|
|
|
7084e2 |
g = NULL;
|
|
|
7084e2 |
- for (i = 0; i < groups.size; i++)
|
|
|
7084e2 |
+ for (i = 0; i < groups.len; i++)
|
|
|
7084e2 |
if (strcmp (groups.ptr[i]->name, h->name) == 0) {
|
|
|
7084e2 |
g = groups.ptr[i];
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else
|
|
|
7084e2 |
- g = groups.size ? groups.ptr[0] : NULL;
|
|
|
7084e2 |
+ g = groups.len ? groups.ptr[0] : NULL;
|
|
|
7084e2 |
|
|
|
7084e2 |
if (!g) {
|
|
|
7084e2 |
g = calloc (1, sizeof *g);
|
|
|
7084e2 |
@@ -230,7 +230,7 @@ multi_conn_prepare (nbdkit_next *next, void *handle, int readonly)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
if (conns_vector_append (&g->conns, h) == -1) {
|
|
|
7084e2 |
if (new_group) {
|
|
|
7084e2 |
- group_vector_remove (&groups, groups.size - 1);
|
|
|
7084e2 |
+ group_vector_remove (&groups, groups.len - 1);
|
|
|
7084e2 |
free (g->name);
|
|
|
7084e2 |
free (g);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -251,14 +251,14 @@ multi_conn_finalize (nbdkit_next *next, void *handle)
|
|
|
7084e2 |
assert (h->group);
|
|
|
7084e2 |
|
|
|
7084e2 |
/* XXX should we add a config param to flush if the client forgot? */
|
|
|
7084e2 |
- for (i = 0; i < h->group->conns.size; i++) {
|
|
|
7084e2 |
+ for (i = 0; i < h->group->conns.len; i++) {
|
|
|
7084e2 |
if (h->group->conns.ptr[i] == h) {
|
|
|
7084e2 |
conns_vector_remove (&h->group->conns, i);
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- if (h->group->conns.size == 0) {
|
|
|
7084e2 |
- for (i = 0; i < groups.size; i++)
|
|
|
7084e2 |
+ if (h->group->conns.len == 0) {
|
|
|
7084e2 |
+ for (i = 0; i < groups.len; i++)
|
|
|
7084e2 |
if (groups.ptr[i] == h->group) {
|
|
|
7084e2 |
group_vector_remove (&groups, i);
|
|
|
7084e2 |
free (h->group->name);
|
|
|
7084e2 |
@@ -451,7 +451,7 @@ multi_conn_flush (nbdkit_next *next,
|
|
|
7084e2 |
assert (h->group);
|
|
|
7084e2 |
if (h->mode == EMULATE) {
|
|
|
7084e2 |
ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
|
|
|
7084e2 |
- for (i = 0; i < h->group->conns.size; i++) {
|
|
|
7084e2 |
+ for (i = 0; i < h->group->conns.len; i++) {
|
|
|
7084e2 |
h2 = h->group->conns.ptr[i];
|
|
|
7084e2 |
if (track == OFF || (h->group->dirty &&
|
|
|
7084e2 |
(track == FAST || h2->dirty & READ)) ||
|
|
|
7084e2 |
@@ -474,7 +474,7 @@ multi_conn_flush (nbdkit_next *next,
|
|
|
7084e2 |
case CONN:
|
|
|
7084e2 |
if (next->can_multi_conn (next) == 1) {
|
|
|
7084e2 |
ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&lock);
|
|
|
7084e2 |
- for (i = 0; i < h->group->conns.size; i++)
|
|
|
7084e2 |
+ for (i = 0; i < h->group->conns.len; i++)
|
|
|
7084e2 |
h->group->conns.ptr[i]->dirty = 0;
|
|
|
7084e2 |
h->group->dirty = 0;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
diff --git a/plugins/cc/cc.c b/plugins/cc/cc.c
|
|
|
7084e2 |
index 3251f312..c8c3c86b 100644
|
|
|
7084e2 |
--- a/plugins/cc/cc.c
|
|
|
7084e2 |
+++ b/plugins/cc/cc.c
|
|
|
7084e2 |
@@ -292,12 +292,12 @@ cc_config_complete (void)
|
|
|
7084e2 |
if (subplugin.load)
|
|
|
7084e2 |
subplugin.load ();
|
|
|
7084e2 |
if (subplugin.config) {
|
|
|
7084e2 |
- for (i = 0; i < params.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < params.len; ++i) {
|
|
|
7084e2 |
if (subplugin.config (params.ptr[i].key, params.ptr[i].value) == -1)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- else if (params.size > 0) {
|
|
|
7084e2 |
+ else if (params.len > 0) {
|
|
|
7084e2 |
/* Just print the first one in the error message. */
|
|
|
7084e2 |
nbdkit_error ("unknown parameter: %s", params.ptr[0].key);
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
diff --git a/plugins/data/data.c b/plugins/data/data.c
|
|
|
7084e2 |
index 03bcc8a5..960cf97d 100644
|
|
|
7084e2 |
--- a/plugins/data/data.c
|
|
|
7084e2 |
+++ b/plugins/data/data.c
|
|
|
7084e2 |
@@ -158,7 +158,7 @@ get_extra_param (const char *name)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < params.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < params.len; ++i) {
|
|
|
7084e2 |
if (strcmp (params.ptr[i].key, name) == 0)
|
|
|
7084e2 |
return params.ptr[i].value;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -176,7 +176,7 @@ data_config_complete (void)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (data_seen != DATA && params.size != 0) {
|
|
|
7084e2 |
+ if (data_seen != DATA && params.len != 0) {
|
|
|
7084e2 |
nbdkit_error ("extra parameters passed and not using data='...'");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
diff --git a/plugins/data/format.c b/plugins/data/format.c
|
|
|
7084e2 |
index d351f79a..986a0f6e 100644
|
|
|
7084e2 |
--- a/plugins/data/format.c
|
|
|
7084e2 |
+++ b/plugins/data/format.c
|
|
|
7084e2 |
@@ -83,7 +83,7 @@ substring (string s, size_t offset, size_t len)
|
|
|
7084e2 |
string r = empty_vector;
|
|
|
7084e2 |
|
|
|
7084e2 |
for (i = 0; i < len; ++i) {
|
|
|
7084e2 |
- assert (offset+i < s.size);
|
|
|
7084e2 |
+ assert (offset+i < s.len);
|
|
|
7084e2 |
if (string_append (&r, s.ptr[offset+i]) == -1) {
|
|
|
7084e2 |
nbdkit_error ("realloc: %m");
|
|
|
7084e2 |
exit (EXIT_FAILURE);
|
|
|
7084e2 |
@@ -167,7 +167,7 @@ static expr_list expr_table;
|
|
|
7084e2 |
static node_id
|
|
|
7084e2 |
new_node (const expr_t e)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- if (expr_table.size == 0) {
|
|
|
7084e2 |
+ if (expr_table.len == 0) {
|
|
|
7084e2 |
static const expr_t enull = { .t = EXPR_NULL };
|
|
|
7084e2 |
if (expr_list_append (&expr_table, enull) == -1)
|
|
|
7084e2 |
goto out_of_memory;
|
|
|
7084e2 |
@@ -179,14 +179,14 @@ new_node (const expr_t e)
|
|
|
7084e2 |
nbdkit_error ("realloc");
|
|
|
7084e2 |
exit (EXIT_FAILURE);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- return expr_table.size-1;
|
|
|
7084e2 |
+ return expr_table.len-1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Get an expression by node_id. */
|
|
|
7084e2 |
static expr_t
|
|
|
7084e2 |
get_node (node_id id)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- assert (id < expr_table.size);
|
|
|
7084e2 |
+ assert (id < expr_table.len);
|
|
|
7084e2 |
return expr_table.ptr[id];
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -196,7 +196,7 @@ free_expr_table (void)
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
expr_t e;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < expr_table.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < expr_table.len; ++i) {
|
|
|
7084e2 |
e = get_node (i);
|
|
|
7084e2 |
switch (e.t) {
|
|
|
7084e2 |
case EXPR_LIST: free (e.list.ptr); break;
|
|
|
7084e2 |
@@ -344,7 +344,7 @@ debug_expr (node_id id, int level)
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
case EXPR_LIST:
|
|
|
7084e2 |
nbdkit_debug ("%s(", debug_indent (level));
|
|
|
7084e2 |
- for (i = 0; i < e.list.size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < e.list.len; ++i)
|
|
|
7084e2 |
debug_expr (e.list.ptr[i], level+1);
|
|
|
7084e2 |
nbdkit_debug ("%s)", debug_indent (level));
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
@@ -370,7 +370,7 @@ debug_expr (node_id id, int level)
|
|
|
7084e2 |
CLEANUP_FREE_STRING string s = empty_vector;
|
|
|
7084e2 |
static const char hex[] = "0123456789abcdef";
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < e.string.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < e.string.len; ++i) {
|
|
|
7084e2 |
char c = e.string.ptr[i];
|
|
|
7084e2 |
if (ascii_isprint ((char) c))
|
|
|
7084e2 |
string_append (&s, e.string.ptr[i]);
|
|
|
7084e2 |
@@ -445,7 +445,7 @@ read_data_format (const char *value, struct allocator *a, uint64_t *size_rtn)
|
|
|
7084e2 |
uint64_t offset = 0;
|
|
|
7084e2 |
int r = -1;
|
|
|
7084e2 |
|
|
|
7084e2 |
- assert (expr_table.size == 0);
|
|
|
7084e2 |
+ assert (expr_table.len == 0);
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Run the parser across the entire string, returning the top level
|
|
|
7084e2 |
* expression.
|
|
|
7084e2 |
@@ -600,11 +600,11 @@ parser (int level, const char *value, size_t *start, size_t len,
|
|
|
7084e2 |
|
|
|
7084e2 |
case '*': /* expr*N */
|
|
|
7084e2 |
i++;
|
|
|
7084e2 |
- if (list.size == 0) {
|
|
|
7084e2 |
+ if (list.len == 0) {
|
|
|
7084e2 |
nbdkit_error ("*N must follow an expression");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- if (! is_data_expr (get_node (list.ptr[list.size-1]))) {
|
|
|
7084e2 |
+ if (! is_data_expr (get_node (list.ptr[list.len-1]))) {
|
|
|
7084e2 |
nbdkit_error ("*N cannot be applied to this type of expression");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -619,18 +619,18 @@ parser (int level, const char *value, size_t *start, size_t len,
|
|
|
7084e2 |
nbdkit_error ("*N not numeric");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- id = list.ptr[list.size-1];
|
|
|
7084e2 |
- list.size--;
|
|
|
7084e2 |
+ id = list.ptr[list.len-1];
|
|
|
7084e2 |
+ list.len--;
|
|
|
7084e2 |
APPEND_EXPR (new_node (expr (EXPR_REPEAT, id, (uint64_t) i64)));
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
|
|
|
7084e2 |
case '[': /* expr[k:m] */
|
|
|
7084e2 |
i++;
|
|
|
7084e2 |
- if (list.size == 0) {
|
|
|
7084e2 |
+ if (list.len == 0) {
|
|
|
7084e2 |
nbdkit_error ("[N:M] must follow an expression");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- if (! is_data_expr (get_node (list.ptr[list.size-1]))) {
|
|
|
7084e2 |
+ if (! is_data_expr (get_node (list.ptr[list.len-1]))) {
|
|
|
7084e2 |
nbdkit_error ("[N:M] cannot be applied to this type of expression");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -647,8 +647,8 @@ parser (int level, const char *value, size_t *start, size_t len,
|
|
|
7084e2 |
nbdkit_error ("enclosed pattern (...)[N:M] not numeric");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- id = list.ptr[list.size-1];
|
|
|
7084e2 |
- list.size--;
|
|
|
7084e2 |
+ id = list.ptr[list.len-1];
|
|
|
7084e2 |
+ list.len--;
|
|
|
7084e2 |
APPEND_EXPR (new_node (expr (EXPR_SLICE, id, i64, m)));
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -720,11 +720,11 @@ parser (int level, const char *value, size_t *start, size_t len,
|
|
|
7084e2 |
i++;
|
|
|
7084e2 |
if (value[i] != '>') goto parse_error;
|
|
|
7084e2 |
i++;
|
|
|
7084e2 |
- if (list.size == 0) {
|
|
|
7084e2 |
+ if (list.len == 0) {
|
|
|
7084e2 |
nbdkit_error ("-> must follow an expression");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- if (! is_data_expr (get_node (list.ptr[list.size-1]))) {
|
|
|
7084e2 |
+ if (! is_data_expr (get_node (list.ptr[list.len-1]))) {
|
|
|
7084e2 |
nbdkit_error ("-> cannot be applied to this type of expression");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -735,9 +735,9 @@ parser (int level, const char *value, size_t *start, size_t len,
|
|
|
7084e2 |
nbdkit_error ("strndup: %m");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- id = list.ptr[list.size-1];
|
|
|
7084e2 |
+ id = list.ptr[list.len-1];
|
|
|
7084e2 |
i += flen;
|
|
|
7084e2 |
- list.size--;
|
|
|
7084e2 |
+ list.len--;
|
|
|
7084e2 |
APPEND_EXPR (new_node (expr (EXPR_ASSIGN, name, id)));
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -1023,7 +1023,7 @@ parse_word (const char *value, size_t *start, size_t len, string *rtn)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
memcpy (copy.ptr, &value[*start], n);
|
|
|
7084e2 |
copy.ptr[n] = '\0';
|
|
|
7084e2 |
- copy.size = n + 1;
|
|
|
7084e2 |
+ copy.len = n + 1;
|
|
|
7084e2 |
*start = i;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Reserve enough space in the return buffer for the longest
|
|
|
7084e2 |
@@ -1036,22 +1036,22 @@ parse_word (const char *value, size_t *start, size_t len, string *rtn)
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Parse the rest of {le|be}{16|32|64}: */
|
|
|
7084e2 |
if (strncmp (copy.ptr, "le16:", 5) == 0) {
|
|
|
7084e2 |
- endian = little; rtn->size = 2;
|
|
|
7084e2 |
+ endian = little; rtn->len = 2;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else if (strncmp (copy.ptr, "le32:", 5) == 0) {
|
|
|
7084e2 |
- endian = little; rtn->size = 4;
|
|
|
7084e2 |
+ endian = little; rtn->len = 4;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else if (strncmp (copy.ptr, "le64:", 5) == 0) {
|
|
|
7084e2 |
- endian = little; rtn->size = 8;
|
|
|
7084e2 |
+ endian = little; rtn->len = 8;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else if (strncmp (copy.ptr, "be16:", 5) == 0) {
|
|
|
7084e2 |
- endian = big; rtn->size = 2;
|
|
|
7084e2 |
+ endian = big; rtn->len = 2;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else if (strncmp (copy.ptr, "be32:", 5) == 0) {
|
|
|
7084e2 |
- endian = big; rtn->size = 4;
|
|
|
7084e2 |
+ endian = big; rtn->len = 4;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else if (strncmp (copy.ptr, "be64:", 5) == 0) {
|
|
|
7084e2 |
- endian = big; rtn->size = 8;
|
|
|
7084e2 |
+ endian = big; rtn->len = 8;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else {
|
|
|
7084e2 |
nbdkit_error ("data parameter: expected \"le16/32/64:\" "
|
|
|
7084e2 |
@@ -1060,7 +1060,7 @@ parse_word (const char *value, size_t *start, size_t len, string *rtn)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Parse the word field into a host-order unsigned int. */
|
|
|
7084e2 |
- switch (rtn->size) {
|
|
|
7084e2 |
+ switch (rtn->len) {
|
|
|
7084e2 |
case 2:
|
|
|
7084e2 |
if (nbdkit_parse_uint16_t ("data", ©.ptr[5], &u16) == -1)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
@@ -1081,7 +1081,7 @@ parse_word (const char *value, size_t *start, size_t len, string *rtn)
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
switch (endian) {
|
|
|
7084e2 |
case little:
|
|
|
7084e2 |
- switch (rtn->size) {
|
|
|
7084e2 |
+ switch (rtn->len) {
|
|
|
7084e2 |
case 2: /* le16: */
|
|
|
7084e2 |
*((uint16_t *) rtn->ptr) = htole16 (u16);
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
@@ -1096,7 +1096,7 @@ parse_word (const char *value, size_t *start, size_t len, string *rtn)
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
|
|
|
7084e2 |
case big:
|
|
|
7084e2 |
- switch (rtn->size) {
|
|
|
7084e2 |
+ switch (rtn->len) {
|
|
|
7084e2 |
case 2: /* be16: */
|
|
|
7084e2 |
*((uint16_t *) rtn->ptr) = htobe16 (u16);
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
@@ -1134,7 +1134,7 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
/* For convenience this makes a new list node. */
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Optimize each element of the list. */
|
|
|
7084e2 |
- for (i = 0; i < get_node (root).list.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < get_node (root).list.len; ++i) {
|
|
|
7084e2 |
id = get_node (root).list.ptr[i];
|
|
|
7084e2 |
if (optimize_ast (id, &id) == -1)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
@@ -1148,7 +1148,7 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
* because flattening the list changes the scope.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
if (list_safe_to_inline (get_node (id).list)) {
|
|
|
7084e2 |
- for (j = 0; j < get_node (id).list.size; ++j) {
|
|
|
7084e2 |
+ for (j = 0; j < get_node (id).list.len; ++j) {
|
|
|
7084e2 |
if (node_ids_append (&list, get_node (id).list.ptr[j]) == -1)
|
|
|
7084e2 |
goto list_append_error;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -1165,7 +1165,7 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Combine adjacent pairs of elements if possible. */
|
|
|
7084e2 |
- for (i = 1; i < list.size; ++i) {
|
|
|
7084e2 |
+ for (i = 1; i < list.len; ++i) {
|
|
|
7084e2 |
node_id id0, id1;
|
|
|
7084e2 |
|
|
|
7084e2 |
id0 = list.ptr[i-1];
|
|
|
7084e2 |
@@ -1178,7 +1178,7 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* List of length 0 is replaced with null. */
|
|
|
7084e2 |
- if (list.size == 0) {
|
|
|
7084e2 |
+ if (list.len == 0) {
|
|
|
7084e2 |
free (list.ptr);
|
|
|
7084e2 |
*root_rtn = new_node (expr (EXPR_NULL));
|
|
|
7084e2 |
return 0;
|
|
|
7084e2 |
@@ -1187,7 +1187,7 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
/* List of length 1 is replaced with the first element, but as
|
|
|
7084e2 |
* above avoid inlining if it is not a safe expression.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- if (list.size == 1 && expr_safe_to_inline (get_node (list.ptr[0]))) {
|
|
|
7084e2 |
+ if (list.len == 1 && expr_safe_to_inline (get_node (list.ptr[0]))) {
|
|
|
7084e2 |
id = list.ptr[0];
|
|
|
7084e2 |
free (list.ptr);
|
|
|
7084e2 |
*root_rtn = id;
|
|
|
7084e2 |
@@ -1242,13 +1242,13 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
if (get_node (id).t == EXPR_STRING &&
|
|
|
7084e2 |
get_node (root).r.n <= 4 &&
|
|
|
7084e2 |
- get_node (id).string.size <= 512) {
|
|
|
7084e2 |
+ get_node (id).string.len <= 512) {
|
|
|
7084e2 |
string s = empty_vector;
|
|
|
7084e2 |
size_t n = get_node (root).r.n;
|
|
|
7084e2 |
const string sub = get_node (id).string;
|
|
|
7084e2 |
|
|
|
7084e2 |
for (i = 0; i < n; ++i) {
|
|
|
7084e2 |
- for (j = 0; j < sub.size; ++j) {
|
|
|
7084e2 |
+ for (j = 0; j < sub.len; ++j) {
|
|
|
7084e2 |
if (string_append (&s, sub.ptr[j]) == -1) {
|
|
|
7084e2 |
nbdkit_error ("realloc: %m");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
@@ -1307,7 +1307,7 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
case EXPR_STRING: /* substring */
|
|
|
7084e2 |
- len = get_node (id).string.size;
|
|
|
7084e2 |
+ len = get_node (id).string.len;
|
|
|
7084e2 |
if (m >= 0 && n <= m && m <= len) {
|
|
|
7084e2 |
if (m-n == 1)
|
|
|
7084e2 |
*root_rtn = new_node (expr (EXPR_BYTE, get_node (id).string.ptr[n]));
|
|
|
7084e2 |
@@ -1355,23 +1355,23 @@ optimize_ast (node_id root, node_id *root_rtn)
|
|
|
7084e2 |
|
|
|
7084e2 |
case EXPR_STRING:
|
|
|
7084e2 |
/* A zero length string can be replaced with null. */
|
|
|
7084e2 |
- if (get_node (root).string.size == 0) {
|
|
|
7084e2 |
+ if (get_node (root).string.len == 0) {
|
|
|
7084e2 |
*root_rtn = new_node (expr (EXPR_NULL));
|
|
|
7084e2 |
return 0;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
/* Strings containing the same character can be replaced by a
|
|
|
7084e2 |
* fill. These can be produced by other optimizations.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- if (get_node (root).string.size > 1) {
|
|
|
7084e2 |
+ if (get_node (root).string.len > 1) {
|
|
|
7084e2 |
const string s = get_node (root).string;
|
|
|
7084e2 |
uint8_t b = s.ptr[0];
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 1; i < s.size; ++i)
|
|
|
7084e2 |
+ for (i = 1; i < s.len; ++i)
|
|
|
7084e2 |
if (s.ptr[i] != b)
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (i == s.size) {
|
|
|
7084e2 |
- *root_rtn = new_node (expr (EXPR_FILL, b, (uint64_t) s.size));
|
|
|
7084e2 |
+ if (i == s.len) {
|
|
|
7084e2 |
+ *root_rtn = new_node (expr (EXPR_FILL, b, (uint64_t) s.len));
|
|
|
7084e2 |
return 0;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -1442,7 +1442,7 @@ list_safe_to_inline (const node_ids list)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < list.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < list.len; ++i) {
|
|
|
7084e2 |
if (!expr_safe_to_inline (get_node (list.ptr[i])))
|
|
|
7084e2 |
return false;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -1461,11 +1461,11 @@ expr_is_single_byte (const expr_t e, uint8_t *b)
|
|
|
7084e2 |
if (b) *b = e.b;
|
|
|
7084e2 |
return true;
|
|
|
7084e2 |
case EXPR_LIST: /* A single element list if it is single byte */
|
|
|
7084e2 |
- if (e.list.size != 1)
|
|
|
7084e2 |
+ if (e.list.len != 1)
|
|
|
7084e2 |
return false;
|
|
|
7084e2 |
return expr_is_single_byte (get_node (e.list.ptr[0]), b);
|
|
|
7084e2 |
case EXPR_STRING: /* A length-1 string. */
|
|
|
7084e2 |
- if (e.string.size != 1)
|
|
|
7084e2 |
+ if (e.string.len != 1)
|
|
|
7084e2 |
return false;
|
|
|
7084e2 |
if (b) *b = e.string.ptr[0];
|
|
|
7084e2 |
return true;
|
|
|
7084e2 |
@@ -1511,10 +1511,10 @@ exprs_can_combine (expr_t e0, expr_t e1, node_id *id_rtn)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
return true;
|
|
|
7084e2 |
case EXPR_STRING: /* byte string => string */
|
|
|
7084e2 |
- len = e1.string.size;
|
|
|
7084e2 |
+ len = e1.string.len;
|
|
|
7084e2 |
if (string_reserve (&s, len+1) == -1)
|
|
|
7084e2 |
goto out_of_memory;
|
|
|
7084e2 |
- s.size = len+1;
|
|
|
7084e2 |
+ s.len = len+1;
|
|
|
7084e2 |
s.ptr[0] = e0.b;
|
|
|
7084e2 |
memcpy (&s.ptr[1], e1.string.ptr, len);
|
|
|
7084e2 |
*id_rtn = new_node (expr (EXPR_STRING, s));
|
|
|
7084e2 |
@@ -1533,20 +1533,20 @@ exprs_can_combine (expr_t e0, expr_t e1, node_id *id_rtn)
|
|
|
7084e2 |
case EXPR_STRING:
|
|
|
7084e2 |
switch (e1.t) {
|
|
|
7084e2 |
case EXPR_BYTE: /* string byte => string */
|
|
|
7084e2 |
- len = e0.string.size;
|
|
|
7084e2 |
+ len = e0.string.len;
|
|
|
7084e2 |
if (string_reserve (&s, len+1) == -1)
|
|
|
7084e2 |
goto out_of_memory;
|
|
|
7084e2 |
- s.size = len+1;
|
|
|
7084e2 |
+ s.len = len+1;
|
|
|
7084e2 |
memcpy (s.ptr, e0.string.ptr, len);
|
|
|
7084e2 |
s.ptr[len] = e1.b;
|
|
|
7084e2 |
*id_rtn = new_node (expr (EXPR_STRING, s));
|
|
|
7084e2 |
return true;
|
|
|
7084e2 |
case EXPR_STRING: /* string string => string */
|
|
|
7084e2 |
- len = e0.string.size;
|
|
|
7084e2 |
- len1 = e1.string.size;
|
|
|
7084e2 |
+ len = e0.string.len;
|
|
|
7084e2 |
+ len1 = e1.string.len;
|
|
|
7084e2 |
if (string_reserve (&s, len+len1) == -1)
|
|
|
7084e2 |
goto out_of_memory;
|
|
|
7084e2 |
- s.size = len+len1;
|
|
|
7084e2 |
+ s.len = len+len1;
|
|
|
7084e2 |
memcpy (s.ptr, e0.string.ptr, len);
|
|
|
7084e2 |
memcpy (&s.ptr[len], e1.string.ptr, len1);
|
|
|
7084e2 |
*id_rtn = new_node (expr (EXPR_STRING, s));
|
|
|
7084e2 |
@@ -1618,11 +1618,11 @@ evaluate (const dict_t *dict, node_id root,
|
|
|
7084e2 |
list = get_node (root).list;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else {
|
|
|
7084e2 |
- list.size = 1;
|
|
|
7084e2 |
+ list.len = 1;
|
|
|
7084e2 |
list.ptr = &roo;;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < list.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < list.len; ++i) {
|
|
|
7084e2 |
const expr_t e = get_node (list.ptr[i]);
|
|
|
7084e2 |
|
|
|
7084e2 |
switch (e.t) {
|
|
|
7084e2 |
@@ -1667,9 +1667,9 @@ evaluate (const dict_t *dict, node_id root,
|
|
|
7084e2 |
|
|
|
7084e2 |
case EXPR_STRING:
|
|
|
7084e2 |
/* Copy the string into the allocator. */
|
|
|
7084e2 |
- if (a->f->write (a, e.string.ptr, e.string.size, *offset) == -1)
|
|
|
7084e2 |
+ if (a->f->write (a, e.string.ptr, e.string.len, *offset) == -1)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
- *offset += e.string.size;
|
|
|
7084e2 |
+ *offset += e.string.len;
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
|
|
|
7084e2 |
case EXPR_FILL:
|
|
|
7084e2 |
diff --git a/plugins/eval/eval.c b/plugins/eval/eval.c
|
|
|
7084e2 |
index fa1c23ff..b312a59c 100644
|
|
|
7084e2 |
--- a/plugins/eval/eval.c
|
|
|
7084e2 |
+++ b/plugins/eval/eval.c
|
|
|
7084e2 |
@@ -114,7 +114,7 @@ insert_method_script (const char *method, char *script)
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
struct method_script new_entry = { .method = method, .script = script };
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < method_scripts.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < method_scripts.len; ++i) {
|
|
|
7084e2 |
r = compare_script (method, &method_scripts.ptr[i]);
|
|
|
7084e2 |
/* This shouldn't happen. insert_method_script() must not be
|
|
|
7084e2 |
* called if the method has already been added. Call get_script()
|
|
|
7084e2 |
diff --git a/plugins/floppy/directory-lfn.c b/plugins/floppy/directory-lfn.c
|
|
|
7084e2 |
index a87d376a..fe47e0b6 100644
|
|
|
7084e2 |
--- a/plugins/floppy/directory-lfn.c
|
|
|
7084e2 |
+++ b/plugins/floppy/directory-lfn.c
|
|
|
7084e2 |
@@ -79,8 +79,8 @@ create_directory (size_t di, const char *label,
|
|
|
7084e2 |
struct virtual_floppy *floppy)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
- const size_t nr_subdirs = floppy->dirs.ptr[di].subdirs.size;
|
|
|
7084e2 |
- const size_t nr_files = floppy->dirs.ptr[di].fileidxs.size;
|
|
|
7084e2 |
+ const size_t nr_subdirs = floppy->dirs.ptr[di].subdirs.len;
|
|
|
7084e2 |
+ const size_t nr_files = floppy->dirs.ptr[di].fileidxs.len;
|
|
|
7084e2 |
struct lfn *lfns, *lfn;
|
|
|
7084e2 |
const char *name;
|
|
|
7084e2 |
uint8_t attributes;
|
|
|
7084e2 |
@@ -109,14 +109,14 @@ create_directory (size_t di, const char *label,
|
|
|
7084e2 |
}
|
|
|
7084e2 |
for (i = 0; i < nr_subdirs; ++i) {
|
|
|
7084e2 |
const size_t sdi = floppy->dirs.ptr[di].subdirs.ptr[i];
|
|
|
7084e2 |
- assert (sdi < floppy->dirs.size);
|
|
|
7084e2 |
+ assert (sdi < floppy->dirs.len);
|
|
|
7084e2 |
|
|
|
7084e2 |
name = floppy->dirs.ptr[sdi].name;
|
|
|
7084e2 |
lfns[i].name = name;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
for (i = 0; i < nr_files; ++i) {
|
|
|
7084e2 |
const size_t fi = floppy->dirs.ptr[di].fileidxs.ptr[i];
|
|
|
7084e2 |
- assert (fi < floppy->files.size);
|
|
|
7084e2 |
+ assert (fi < floppy->files.len);
|
|
|
7084e2 |
|
|
|
7084e2 |
name = floppy->files.ptr[fi].name;
|
|
|
7084e2 |
lfns[nr_subdirs+i].name = name;
|
|
|
7084e2 |
@@ -132,7 +132,7 @@ create_directory (size_t di, const char *label,
|
|
|
7084e2 |
file_size = 0;
|
|
|
7084e2 |
for (i = 0; i < nr_subdirs; ++i) {
|
|
|
7084e2 |
const size_t sdi = floppy->dirs.ptr[di].subdirs.ptr[i];
|
|
|
7084e2 |
- assert (sdi < floppy->dirs.size);
|
|
|
7084e2 |
+ assert (sdi < floppy->dirs.len);
|
|
|
7084e2 |
|
|
|
7084e2 |
lfn = &lfns[i];
|
|
|
7084e2 |
statbuf = &floppy->dirs.ptr[sdi].statbuf;
|
|
|
7084e2 |
@@ -148,7 +148,7 @@ create_directory (size_t di, const char *label,
|
|
|
7084e2 |
attributes = DIR_ENTRY_ARCHIVE; /* Same as set by Linux kernel. */
|
|
|
7084e2 |
for (i = 0; i < nr_files; ++i) {
|
|
|
7084e2 |
const size_t fi = floppy->dirs.ptr[di].fileidxs.ptr[i];
|
|
|
7084e2 |
- assert (fi < floppy->files.size);
|
|
|
7084e2 |
+ assert (fi < floppy->files.len);
|
|
|
7084e2 |
|
|
|
7084e2 |
lfn = &lfns[nr_subdirs+i];
|
|
|
7084e2 |
statbuf = &floppy->files.ptr[fi].statbuf;
|
|
|
7084e2 |
@@ -532,7 +532,7 @@ append_dir_table (size_t di, const struct dir_entry *entry,
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- i = floppy->dirs.ptr[di].table.size;
|
|
|
7084e2 |
+ i = floppy->dirs.ptr[di].table.len;
|
|
|
7084e2 |
if (dir_entries_append (&floppy->dirs.ptr[di].table, *entry) == -1) {
|
|
|
7084e2 |
nbdkit_error ("realloc: %m");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
@@ -550,8 +550,8 @@ int
|
|
|
7084e2 |
update_directory_first_cluster (size_t di, struct virtual_floppy *floppy)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i, j, pdi;
|
|
|
7084e2 |
- const size_t nr_subdirs = floppy->dirs.ptr[di].subdirs.size;
|
|
|
7084e2 |
- const size_t nr_files = floppy->dirs.ptr[di].fileidxs.size;
|
|
|
7084e2 |
+ const size_t nr_subdirs = floppy->dirs.ptr[di].subdirs.len;
|
|
|
7084e2 |
+ const size_t nr_files = floppy->dirs.ptr[di].fileidxs.len;
|
|
|
7084e2 |
uint32_t first_cluster;
|
|
|
7084e2 |
struct dir_entry *entry;
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -561,7 +561,7 @@ update_directory_first_cluster (size_t di, struct virtual_floppy *floppy)
|
|
|
7084e2 |
* table entries.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
i = 0;
|
|
|
7084e2 |
- for (j = 0; j < floppy->dirs.ptr[di].table.size; ++j) {
|
|
|
7084e2 |
+ for (j = 0; j < floppy->dirs.ptr[di].table.len; ++j) {
|
|
|
7084e2 |
entry = &floppy->dirs.ptr[di].table.ptr[j];
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Skip LFN entries. */
|
|
|
7084e2 |
@@ -596,12 +596,12 @@ update_directory_first_cluster (size_t di, struct virtual_floppy *floppy)
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
if (i < nr_subdirs) {
|
|
|
7084e2 |
const size_t sdi = floppy->dirs.ptr[di].subdirs.ptr[i];
|
|
|
7084e2 |
- assert (sdi < floppy->dirs.size);
|
|
|
7084e2 |
+ assert (sdi < floppy->dirs.len);
|
|
|
7084e2 |
first_cluster = floppy->dirs.ptr[sdi].first_cluster;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else if (i < nr_subdirs + nr_files) {
|
|
|
7084e2 |
const size_t fi = floppy->dirs.ptr[di].fileidxs.ptr[i-nr_subdirs];
|
|
|
7084e2 |
- assert (fi < floppy->files.size);
|
|
|
7084e2 |
+ assert (fi < floppy->files.len);
|
|
|
7084e2 |
first_cluster = floppy->files.ptr[fi].first_cluster;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else
|
|
|
7084e2 |
diff --git a/plugins/floppy/floppy.c b/plugins/floppy/floppy.c
|
|
|
7084e2 |
index 80f350af..938f5bec 100644
|
|
|
7084e2 |
--- a/plugins/floppy/floppy.c
|
|
|
7084e2 |
+++ b/plugins/floppy/floppy.c
|
|
|
7084e2 |
@@ -172,7 +172,7 @@ floppy_pread (void *handle, void *buf, uint32_t count, uint64_t offset)
|
|
|
7084e2 |
switch (region->type) {
|
|
|
7084e2 |
case region_file:
|
|
|
7084e2 |
i = region->u.i;
|
|
|
7084e2 |
- assert (i < floppy.files.size);
|
|
|
7084e2 |
+ assert (i < floppy.files.len);
|
|
|
7084e2 |
host_path = floppy.files.ptr[i].host_path;
|
|
|
7084e2 |
fd = open (host_path, O_RDONLY|O_CLOEXEC);
|
|
|
7084e2 |
if (fd == -1) {
|
|
|
7084e2 |
diff --git a/plugins/floppy/virtual-floppy.c b/plugins/floppy/virtual-floppy.c
|
|
|
7084e2 |
index 6eae5600..b1546bd5 100644
|
|
|
7084e2 |
--- a/plugins/floppy/virtual-floppy.c
|
|
|
7084e2 |
+++ b/plugins/floppy/virtual-floppy.c
|
|
|
7084e2 |
@@ -97,10 +97,10 @@ create_virtual_floppy (const char *dir, const char *label, uint64_t size,
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
|
|
|
7084e2 |
nbdkit_debug ("floppy: %zu directories and %zu files",
|
|
|
7084e2 |
- floppy->dirs.size, floppy->files.size);
|
|
|
7084e2 |
+ floppy->dirs.len, floppy->files.len);
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Create the on disk directory tables. */
|
|
|
7084e2 |
- for (i = 0; i < floppy->dirs.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->dirs.len; ++i) {
|
|
|
7084e2 |
if (create_directory (i, label, floppy) == -1)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -115,10 +115,10 @@ create_virtual_floppy (const char *dir, const char *label, uint64_t size,
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
data_used_size = 0;
|
|
|
7084e2 |
cluster = 2;
|
|
|
7084e2 |
- for (i = 0; i < floppy->dirs.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->dirs.len; ++i) {
|
|
|
7084e2 |
floppy->dirs.ptr[i].first_cluster = cluster;
|
|
|
7084e2 |
nr_bytes =
|
|
|
7084e2 |
- ROUND_UP (floppy->dirs.ptr[i].table.size * sizeof (struct dir_entry),
|
|
|
7084e2 |
+ ROUND_UP (floppy->dirs.ptr[i].table.len * sizeof (struct dir_entry),
|
|
|
7084e2 |
CLUSTER_SIZE);
|
|
|
7084e2 |
data_used_size += nr_bytes;
|
|
|
7084e2 |
nr_clusters = nr_bytes / CLUSTER_SIZE;
|
|
|
7084e2 |
@@ -127,7 +127,7 @@ create_virtual_floppy (const char *dir, const char *label, uint64_t size,
|
|
|
7084e2 |
floppy->dirs.ptr[i].nr_clusters = nr_clusters;
|
|
|
7084e2 |
cluster += nr_clusters;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- for (i = 0; i < floppy->files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->files.len; ++i) {
|
|
|
7084e2 |
floppy->files.ptr[i].first_cluster = cluster;
|
|
|
7084e2 |
nr_bytes = ROUND_UP (floppy->files.ptr[i].statbuf.st_size, CLUSTER_SIZE);
|
|
|
7084e2 |
data_used_size += nr_bytes;
|
|
|
7084e2 |
@@ -187,7 +187,7 @@ create_virtual_floppy (const char *dir, const char *label, uint64_t size,
|
|
|
7084e2 |
* directory entries (which we didn't have available during
|
|
|
7084e2 |
* create_directory above).
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- for (i = 0; i < floppy->dirs.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->dirs.len; ++i) {
|
|
|
7084e2 |
if (update_directory_first_cluster (i, floppy) == -1)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -230,13 +230,13 @@ free_virtual_floppy (struct virtual_floppy *floppy)
|
|
|
7084e2 |
|
|
|
7084e2 |
free (floppy->fat);
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < floppy->files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->files.len; ++i) {
|
|
|
7084e2 |
free (floppy->files.ptr[i].name);
|
|
|
7084e2 |
free (floppy->files.ptr[i].host_path);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
free (floppy->files.ptr);
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < floppy->dirs.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->dirs.len; ++i) {
|
|
|
7084e2 |
free (floppy->dirs.ptr[i].name);
|
|
|
7084e2 |
free (floppy->dirs.ptr[i].subdirs.ptr);
|
|
|
7084e2 |
free (floppy->dirs.ptr[i].fileidxs.ptr);
|
|
|
7084e2 |
@@ -266,7 +266,7 @@ visit (const char *dir, struct virtual_floppy *floppy)
|
|
|
7084e2 |
* directory will always be at dirs[0].
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
memset (&null_dir, 0, sizeof null_dir);
|
|
|
7084e2 |
- di = floppy->dirs.size;
|
|
|
7084e2 |
+ di = floppy->dirs.len;
|
|
|
7084e2 |
if (dirs_append (&floppy->dirs, null_dir) == -1) {
|
|
|
7084e2 |
nbdkit_error ("realloc: %m");
|
|
|
7084e2 |
goto error0;
|
|
|
7084e2 |
@@ -423,7 +423,7 @@ visit_file (const char *dir, const char *name,
|
|
|
7084e2 |
}
|
|
|
7084e2 |
new_file.host_path = host_path;
|
|
|
7084e2 |
new_file.statbuf = *statbuf;
|
|
|
7084e2 |
- fi = floppy->files.size;
|
|
|
7084e2 |
+ fi = floppy->files.len;
|
|
|
7084e2 |
if (files_append (&floppy->files, new_file) == -1) {
|
|
|
7084e2 |
nbdkit_error ("realloc: %m");
|
|
|
7084e2 |
free (host_path);
|
|
|
7084e2 |
@@ -574,11 +574,11 @@ create_fat (struct virtual_floppy *floppy)
|
|
|
7084e2 |
floppy->fat[0] = htole32 (0x0ffffff8);
|
|
|
7084e2 |
floppy->fat[1] = htole32 (0x0fffffff);
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < floppy->dirs.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->dirs.len; ++i) {
|
|
|
7084e2 |
write_fat_file (floppy->dirs.ptr[i].first_cluster,
|
|
|
7084e2 |
floppy->dirs.ptr[i].nr_clusters, floppy);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- for (i = 0; i < floppy->files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->files.len; ++i) {
|
|
|
7084e2 |
write_fat_file (floppy->files.ptr[i].first_cluster,
|
|
|
7084e2 |
floppy->files.ptr[i].nr_clusters, floppy);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -676,15 +676,15 @@ create_regions (struct virtual_floppy *floppy)
|
|
|
7084e2 |
/* Now we're into the data region. We add all directory tables
|
|
|
7084e2 |
* first.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- for (i = 0; i < floppy->dirs.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->dirs.len; ++i) {
|
|
|
7084e2 |
/* Directories can never be completely empty because of the volume
|
|
|
7084e2 |
* label (root) or "." and ".." entries (non-root).
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- assert (floppy->dirs.ptr[i].table.size > 0);
|
|
|
7084e2 |
+ assert (floppy->dirs.ptr[i].table.len > 0);
|
|
|
7084e2 |
|
|
|
7084e2 |
if (append_region_len (&floppy->regions,
|
|
|
7084e2 |
i == 0 ? "root directory" : floppy->dirs.ptr[i].name,
|
|
|
7084e2 |
- floppy->dirs.ptr[i].table.size *
|
|
|
7084e2 |
+ floppy->dirs.ptr[i].table.len *
|
|
|
7084e2 |
sizeof (struct dir_entry),
|
|
|
7084e2 |
0, CLUSTER_SIZE,
|
|
|
7084e2 |
region_data,
|
|
|
7084e2 |
@@ -693,7 +693,7 @@ create_regions (struct virtual_floppy *floppy)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Add all files. */
|
|
|
7084e2 |
- for (i = 0; i < floppy->files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < floppy->files.len; ++i) {
|
|
|
7084e2 |
/* It's possible for a file to have zero size, in which case it
|
|
|
7084e2 |
* doesn't occupy a region or cluster.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
diff --git a/plugins/iso/iso.c b/plugins/iso/iso.c
|
|
|
7084e2 |
index cb621f41..e232175f 100644
|
|
|
7084e2 |
--- a/plugins/iso/iso.c
|
|
|
7084e2 |
+++ b/plugins/iso/iso.c
|
|
|
7084e2 |
@@ -105,7 +105,7 @@ make_iso (void)
|
|
|
7084e2 |
fprintf (fp, " -quiet");
|
|
|
7084e2 |
if (params)
|
|
|
7084e2 |
fprintf (fp, " %s", params);
|
|
|
7084e2 |
- for (i = 0; i < dirs.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < dirs.len; ++i) {
|
|
|
7084e2 |
fputc (' ', fp);
|
|
|
7084e2 |
shell_quote (dirs.ptr[i], fp);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -169,7 +169,7 @@ iso_config (const char *key, const char *value)
|
|
|
7084e2 |
static int
|
|
|
7084e2 |
iso_config_complete (void)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- if (dirs.size == 0) {
|
|
|
7084e2 |
+ if (dirs.len == 0) {
|
|
|
7084e2 |
nbdkit_error ("you must supply the dir=<DIRECTORY> parameter "
|
|
|
7084e2 |
"after the plugin name on the command line");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
diff --git a/plugins/nbd/nbd.c b/plugins/nbd/nbd.c
|
|
|
7084e2 |
index 488eadb2..ae595ea7 100644
|
|
|
7084e2 |
--- a/plugins/nbd/nbd.c
|
|
|
7084e2 |
+++ b/plugins/nbd/nbd.c
|
|
|
7084e2 |
@@ -244,7 +244,7 @@ static int
|
|
|
7084e2 |
nbdplug_config_complete (void)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
int c = !!sockname + !!hostname + !!uri +
|
|
|
7084e2 |
- (command.size > 0) + (socket_fd >= 0) + !!raw_cid;
|
|
|
7084e2 |
+ (command.len > 0) + (socket_fd >= 0) + !!raw_cid;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Check the user passed exactly one connection parameter. */
|
|
|
7084e2 |
if (c > 1) {
|
|
|
7084e2 |
@@ -303,7 +303,7 @@ nbdplug_config_complete (void)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
#endif
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- else if (command.size > 0) {
|
|
|
7084e2 |
+ else if (command.len > 0) {
|
|
|
7084e2 |
/* Add NULL sentinel to the command. */
|
|
|
7084e2 |
if (string_vector_append (&command, NULL) == -1) {
|
|
|
7084e2 |
nbdkit_error ("realloc: %m");
|
|
|
7084e2 |
@@ -574,7 +574,7 @@ nbdplug_connect (struct nbd_handle *nbd)
|
|
|
7084e2 |
#else
|
|
|
7084e2 |
return nbd_connect_vsock (nbd, cid, vport);
|
|
|
7084e2 |
#endif
|
|
|
7084e2 |
- else if (command.size > 0)
|
|
|
7084e2 |
+ else if (command.len > 0)
|
|
|
7084e2 |
return nbd_connect_systemd_socket_activation (nbd, (char **) command.ptr);
|
|
|
7084e2 |
else if (socket_fd >= 0)
|
|
|
7084e2 |
return nbd_connect_socket (nbd, socket_fd);
|
|
|
7084e2 |
diff --git a/plugins/partitioning/partition-mbr.c b/plugins/partitioning/partition-mbr.c
|
|
|
7084e2 |
index 9a1a043c..1f178dcb 100644
|
|
|
7084e2 |
--- a/plugins/partitioning/partition-mbr.c
|
|
|
7084e2 |
+++ b/plugins/partitioning/partition-mbr.c
|
|
|
7084e2 |
@@ -62,9 +62,9 @@ create_mbr_layout (void)
|
|
|
7084e2 |
primary[0x1fe] = 0x55;
|
|
|
7084e2 |
primary[0x1ff] = 0xaa;
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (the_files.size <= 4) {
|
|
|
7084e2 |
+ if (the_files.len <= 4) {
|
|
|
7084e2 |
/* Basic MBR with no extended partition. */
|
|
|
7084e2 |
- for (i = 0; i < the_files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < the_files.len; ++i) {
|
|
|
7084e2 |
const struct region *region = find_file_region (i, &j);
|
|
|
7084e2 |
|
|
|
7084e2 |
create_mbr_partition_table_entry (region, i == 0, the_files.ptr[i].mbr_id,
|
|
|
7084e2 |
@@ -97,7 +97,7 @@ create_mbr_layout (void)
|
|
|
7084e2 |
/* The remaining files are mapped to logical partitions living in
|
|
|
7084e2 |
* the fourth extended partition.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- for (i = 3; i < the_files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 3; i < the_files.len; ++i) {
|
|
|
7084e2 |
if (i == 3)
|
|
|
7084e2 |
eptr = eptr0;
|
|
|
7084e2 |
else
|
|
|
7084e2 |
@@ -117,7 +117,7 @@ create_mbr_layout (void)
|
|
|
7084e2 |
create_mbr_partition_table_entry (®ion, false, the_files.ptr[i].mbr_id,
|
|
|
7084e2 |
&ebr[i-3][0x1be]);
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (i < the_files.size-1) {
|
|
|
7084e2 |
+ if (i < the_files.len-1) {
|
|
|
7084e2 |
size_t j2 = j;
|
|
|
7084e2 |
const struct region *enext = find_ebr_region (i+1, &j2;;
|
|
|
7084e2 |
const struct region *rnext = find_file_region (i+1, &j2;;
|
|
|
7084e2 |
diff --git a/plugins/partitioning/partitioning.c b/plugins/partitioning/partitioning.c
|
|
|
7084e2 |
index 231b2d77..2301ba4e 100644
|
|
|
7084e2 |
--- a/plugins/partitioning/partitioning.c
|
|
|
7084e2 |
+++ b/plugins/partitioning/partitioning.c
|
|
|
7084e2 |
@@ -104,7 +104,7 @@ partitioning_unload (void)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < the_files.size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < the_files.len; ++i)
|
|
|
7084e2 |
close (the_files.ptr[i].fd);
|
|
|
7084e2 |
free (the_files.ptr);
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -116,7 +116,7 @@ partitioning_unload (void)
|
|
|
7084e2 |
free (primary);
|
|
|
7084e2 |
free (secondary);
|
|
|
7084e2 |
if (ebr) {
|
|
|
7084e2 |
- for (i = 0; i < the_files.size-3; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < the_files.len-3; ++i)
|
|
|
7084e2 |
free (ebr[i]);
|
|
|
7084e2 |
free (ebr);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -235,19 +235,19 @@ partitioning_config_complete (void)
|
|
|
7084e2 |
bool needs_gpt;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Not enough / too many files? */
|
|
|
7084e2 |
- if (the_files.size == 0) {
|
|
|
7084e2 |
+ if (the_files.len == 0) {
|
|
|
7084e2 |
nbdkit_error ("at least one file= parameter must be supplied");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
total_size = 0;
|
|
|
7084e2 |
- for (i = 0; i < the_files.size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < the_files.len; ++i)
|
|
|
7084e2 |
total_size += the_files.ptr[i].statbuf.st_size;
|
|
|
7084e2 |
needs_gpt = total_size > MAX_MBR_DISK_SIZE;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Choose default parttype if not set. */
|
|
|
7084e2 |
if (parttype == PARTTYPE_UNSET) {
|
|
|
7084e2 |
- if (needs_gpt || the_files.size > 4) {
|
|
|
7084e2 |
+ if (needs_gpt || the_files.len > 4) {
|
|
|
7084e2 |
parttype = PARTTYPE_GPT;
|
|
|
7084e2 |
nbdkit_debug ("picking partition type GPT");
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -262,7 +262,7 @@ partitioning_config_complete (void)
|
|
|
7084e2 |
"but you requested %zu partition(s) "
|
|
|
7084e2 |
"and a total size of %" PRIu64 " bytes (> %" PRIu64 "). "
|
|
|
7084e2 |
"Try using: partition-type=gpt",
|
|
|
7084e2 |
- the_files.size, total_size, (uint64_t) MAX_MBR_DISK_SIZE);
|
|
|
7084e2 |
+ the_files.len, total_size, (uint64_t) MAX_MBR_DISK_SIZE);
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -327,7 +327,7 @@ partitioning_pread (void *handle, void *buf, uint32_t count, uint64_t offset)
|
|
|
7084e2 |
switch (region->type) {
|
|
|
7084e2 |
case region_file:
|
|
|
7084e2 |
i = region->u.i;
|
|
|
7084e2 |
- assert (i < the_files.size);
|
|
|
7084e2 |
+ assert (i < the_files.len);
|
|
|
7084e2 |
r = pread (the_files.ptr[i].fd, buf, len, offset - region->start);
|
|
|
7084e2 |
if (r == -1) {
|
|
|
7084e2 |
nbdkit_error ("pread: %s: %m", the_files.ptr[i].filename);
|
|
|
7084e2 |
@@ -376,7 +376,7 @@ partitioning_pwrite (void *handle,
|
|
|
7084e2 |
switch (region->type) {
|
|
|
7084e2 |
case region_file:
|
|
|
7084e2 |
i = region->u.i;
|
|
|
7084e2 |
- assert (i < the_files.size);
|
|
|
7084e2 |
+ assert (i < the_files.len);
|
|
|
7084e2 |
r = pwrite (the_files.ptr[i].fd, buf, len, offset - region->start);
|
|
|
7084e2 |
if (r == -1) {
|
|
|
7084e2 |
nbdkit_error ("pwrite: %s: %m", the_files.ptr[i].filename);
|
|
|
7084e2 |
@@ -418,7 +418,7 @@ partitioning_flush (void *handle)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < the_files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < the_files.len; ++i) {
|
|
|
7084e2 |
if (fdatasync (the_files.ptr[i].fd) == -1) {
|
|
|
7084e2 |
nbdkit_error ("fdatasync: %m");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
diff --git a/plugins/partitioning/virtual-disk.c b/plugins/partitioning/virtual-disk.c
|
|
|
7084e2 |
index 389a17b6..d46ca46a 100644
|
|
|
7084e2 |
--- a/plugins/partitioning/virtual-disk.c
|
|
|
7084e2 |
+++ b/plugins/partitioning/virtual-disk.c
|
|
|
7084e2 |
@@ -56,7 +56,7 @@ create_virtual_disk_layout (void)
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
assert (nr_regions (&the_regions) == 0);
|
|
|
7084e2 |
- assert (the_files.size > 0);
|
|
|
7084e2 |
+ assert (the_files.len > 0);
|
|
|
7084e2 |
assert (primary == NULL);
|
|
|
7084e2 |
assert (secondary == NULL);
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -68,17 +68,17 @@ create_virtual_disk_layout (void)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (the_files.size > 4) {
|
|
|
7084e2 |
+ if (the_files.len > 4) {
|
|
|
7084e2 |
/* The first 3 primary partitions will be real partitions, the
|
|
|
7084e2 |
* 4th will be an extended partition, and so we need to store
|
|
|
7084e2 |
* EBRs for the_files.size-3 logical partitions.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
- ebr = malloc (sizeof (unsigned char *) * (the_files.size-3));
|
|
|
7084e2 |
+ ebr = malloc (sizeof (unsigned char *) * (the_files.len-3));
|
|
|
7084e2 |
if (ebr == NULL) {
|
|
|
7084e2 |
nbdkit_error ("malloc: %m");
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- for (i = 0; i < the_files.size-3; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < the_files.len-3; ++i) {
|
|
|
7084e2 |
ebr[i] = calloc (1, SECTOR_SIZE);
|
|
|
7084e2 |
if (ebr[i] == NULL) {
|
|
|
7084e2 |
nbdkit_error ("malloc: %m");
|
|
|
7084e2 |
@@ -117,7 +117,7 @@ create_virtual_disk_layout (void)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* The partitions. */
|
|
|
7084e2 |
- for (i = 0; i < the_files.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < the_files.len; ++i) {
|
|
|
7084e2 |
uint64_t offset;
|
|
|
7084e2 |
|
|
|
7084e2 |
offset = virtual_size (&the_regions);
|
|
|
7084e2 |
@@ -127,7 +127,7 @@ create_virtual_disk_layout (void)
|
|
|
7084e2 |
assert (IS_ALIGNED (offset, SECTOR_SIZE));
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Logical partitions are preceeded by an EBR. */
|
|
|
7084e2 |
- if (parttype == PARTTYPE_MBR && the_files.size > 4 && i >= 3) {
|
|
|
7084e2 |
+ if (parttype == PARTTYPE_MBR && the_files.len > 4 && i >= 3) {
|
|
|
7084e2 |
if (append_region_len (&the_regions, "EBR",
|
|
|
7084e2 |
SECTOR_SIZE, 0, 0,
|
|
|
7084e2 |
region_data, ebr[i-3]) == -1)
|
|
|
7084e2 |
diff --git a/plugins/partitioning/virtual-disk.h b/plugins/partitioning/virtual-disk.h
|
|
|
7084e2 |
index 7032dfc8..d56c2b86 100644
|
|
|
7084e2 |
--- a/plugins/partitioning/virtual-disk.h
|
|
|
7084e2 |
+++ b/plugins/partitioning/virtual-disk.h
|
|
|
7084e2 |
@@ -55,7 +55,7 @@
|
|
|
7084e2 |
* 32 if the number of files is <= GPT_MIN_PARTITIONS, which is the
|
|
|
7084e2 |
* normal case.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
-#define GPT_PTA_SIZE ROUND_UP (the_files.size, GPT_MIN_PARTITIONS)
|
|
|
7084e2 |
+#define GPT_PTA_SIZE ROUND_UP (the_files.len, GPT_MIN_PARTITIONS)
|
|
|
7084e2 |
#define GPT_PTA_LBAs (GPT_PTA_SIZE * GPT_PT_ENTRY_SIZE / SECTOR_SIZE)
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Maximum possible and default alignment between partitions. */
|
|
|
7084e2 |
diff --git a/plugins/split/split.c b/plugins/split/split.c
|
|
|
7084e2 |
index c559a0cd..4c9790a6 100644
|
|
|
7084e2 |
--- a/plugins/split/split.c
|
|
|
7084e2 |
+++ b/plugins/split/split.c
|
|
|
7084e2 |
@@ -121,13 +121,13 @@ split_open (int readonly)
|
|
|
7084e2 |
return NULL;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
- h->files = malloc (filenames.size * sizeof (struct file));
|
|
|
7084e2 |
+ h->files = malloc (filenames.len * sizeof (struct file));
|
|
|
7084e2 |
if (h->files == NULL) {
|
|
|
7084e2 |
nbdkit_error ("malloc: %m");
|
|
|
7084e2 |
free (h);
|
|
|
7084e2 |
return NULL;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- for (i = 0; i < filenames.size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < filenames.len; ++i)
|
|
|
7084e2 |
h->files[i].fd = -1;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Open the files. */
|
|
|
7084e2 |
@@ -137,7 +137,7 @@ split_open (int readonly)
|
|
|
7084e2 |
else
|
|
|
7084e2 |
flags |= O_RDWR;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < filenames.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < filenames.len; ++i) {
|
|
|
7084e2 |
h->files[i].fd = open (filenames.ptr[i], flags);
|
|
|
7084e2 |
if (h->files[i].fd == -1) {
|
|
|
7084e2 |
nbdkit_error ("open: %s: %m", filenames.ptr[i]);
|
|
|
7084e2 |
@@ -146,7 +146,7 @@ split_open (int readonly)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
offset = 0;
|
|
|
7084e2 |
- for (i = 0; i < filenames.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < filenames.len; ++i) {
|
|
|
7084e2 |
h->files[i].offset = offset;
|
|
|
7084e2 |
|
|
|
7084e2 |
if (fstat (h->files[i].fd, &statbuf) == -1) {
|
|
|
7084e2 |
@@ -179,7 +179,7 @@ split_open (int readonly)
|
|
|
7084e2 |
return h;
|
|
|
7084e2 |
|
|
|
7084e2 |
err:
|
|
|
7084e2 |
- for (i = 0; i < filenames.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < filenames.len; ++i) {
|
|
|
7084e2 |
if (h->files[i].fd >= 0)
|
|
|
7084e2 |
close (h->files[i].fd);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -195,7 +195,7 @@ split_close (void *handle)
|
|
|
7084e2 |
struct handle *h = handle;
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < filenames.size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < filenames.len; ++i)
|
|
|
7084e2 |
close (h->files[i].fd);
|
|
|
7084e2 |
free (h->files);
|
|
|
7084e2 |
free (h);
|
|
|
7084e2 |
@@ -242,7 +242,7 @@ static struct file *
|
|
|
7084e2 |
get_file (struct handle *h, uint64_t offset)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
return bsearch (&offset, h->files,
|
|
|
7084e2 |
- filenames.size, sizeof (struct file),
|
|
|
7084e2 |
+ filenames.len, sizeof (struct file),
|
|
|
7084e2 |
compare_offset);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
diff --git a/plugins/ssh/ssh.c b/plugins/ssh/ssh.c
|
|
|
7084e2 |
index 535caf1a..80623525 100644
|
|
|
7084e2 |
--- a/plugins/ssh/ssh.c
|
|
|
7084e2 |
+++ b/plugins/ssh/ssh.c
|
|
|
7084e2 |
@@ -397,7 +397,7 @@ ssh_open (int readonly)
|
|
|
7084e2 |
* as this file is rarely present.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- for (i = 0; i < identities.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < identities.len; ++i) {
|
|
|
7084e2 |
r = ssh_options_set (h->session,
|
|
|
7084e2 |
SSH_OPTIONS_ADD_IDENTITY, identities.ptr[i]);
|
|
|
7084e2 |
if (r != SSH_OK) {
|
|
|
7084e2 |
diff --git a/plugins/vddk/reexec.c b/plugins/vddk/reexec.c
|
|
|
7084e2 |
index 9e87025e..4eae2221 100644
|
|
|
7084e2 |
--- a/plugins/vddk/reexec.c
|
|
|
7084e2 |
+++ b/plugins/vddk/reexec.c
|
|
|
7084e2 |
@@ -116,20 +116,20 @@ perform_reexec (const char *env, const char *prepend)
|
|
|
7084e2 |
nbdkit_error ("realloc: %m");
|
|
|
7084e2 |
exit (EXIT_FAILURE);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- r = read (fd, buf.ptr + buf.size, buf.cap - buf.size);
|
|
|
7084e2 |
+ r = read (fd, buf.ptr + buf.len, buf.cap - buf.len);
|
|
|
7084e2 |
if (r == -1) {
|
|
|
7084e2 |
nbdkit_error ("read: %s: %m", cmdline_file);
|
|
|
7084e2 |
exit (EXIT_FAILURE);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
if (r == 0)
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
- buf.size += r;
|
|
|
7084e2 |
+ buf.len += r;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
close (fd);
|
|
|
7084e2 |
- nbdkit_debug ("original command line occupies %zu bytes", buf.size);
|
|
|
7084e2 |
+ nbdkit_debug ("original command line occupies %zu bytes", buf.len);
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Split cmdline into argv, then append one more arg. */
|
|
|
7084e2 |
- for (len = 0; len < buf.size; len += strlen (buf.ptr + len) + 1) {
|
|
|
7084e2 |
+ for (len = 0; len < buf.len; len += strlen (buf.ptr + len) + 1) {
|
|
|
7084e2 |
char *arg = buf.ptr + len; /* Next \0-terminated argument. */
|
|
|
7084e2 |
|
|
|
7084e2 |
/* See below for why we eat password parameter(s). */
|
|
|
7084e2 |
diff --git a/plugins/vddk/stats.c b/plugins/vddk/stats.c
|
|
|
7084e2 |
index 76e0c244..bb5401b1 100644
|
|
|
7084e2 |
--- a/plugins/vddk/stats.c
|
|
|
7084e2 |
+++ b/plugins/vddk/stats.c
|
|
|
7084e2 |
@@ -94,12 +94,12 @@ display_stats (void)
|
|
|
7084e2 |
#undef STUB
|
|
|
7084e2 |
#undef OPTIONAL_STUB
|
|
|
7084e2 |
|
|
|
7084e2 |
- qsort (stats.ptr, stats.size, sizeof stats.ptr[0], stat_compare);
|
|
|
7084e2 |
+ qsort (stats.ptr, stats.len, sizeof stats.ptr[0], stat_compare);
|
|
|
7084e2 |
|
|
|
7084e2 |
nbdkit_debug ("VDDK function stats (-D vddk.stats=1):");
|
|
|
7084e2 |
nbdkit_debug ("%-24s %15s %5s %15s",
|
|
|
7084e2 |
"VixDiskLib_...", "µs", "calls", "bytes");
|
|
|
7084e2 |
- for (i = 0; i < stats.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < stats.len; ++i) {
|
|
|
7084e2 |
if (stats.ptr[i].usecs) {
|
|
|
7084e2 |
if (stats.ptr[i].bytes > 0)
|
|
|
7084e2 |
nbdkit_debug (" %-22s %15" PRIi64 " %5" PRIu64 " %15" PRIu64,
|
|
|
7084e2 |
diff --git a/plugins/vddk/worker.c b/plugins/vddk/worker.c
|
|
|
7084e2 |
index 2a1d4f26..c6e2fd22 100644
|
|
|
7084e2 |
--- a/plugins/vddk/worker.c
|
|
|
7084e2 |
+++ b/plugins/vddk/worker.c
|
|
|
7084e2 |
@@ -82,7 +82,7 @@ send_command_and_wait (struct vddk_handle *h, struct command *cmd)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Signal the caller if it could be sleeping on an empty queue. */
|
|
|
7084e2 |
- if (h->commands.size == 1)
|
|
|
7084e2 |
+ if (h->commands.len == 1)
|
|
|
7084e2 |
pthread_cond_signal (&h->commands_cond);
|
|
|
7084e2 |
|
|
|
7084e2 |
/* This will be used to signal command completion back to us. */
|
|
|
7084e2 |
@@ -497,7 +497,7 @@ vddk_worker_thread (void *handle)
|
|
|
7084e2 |
/* Wait until we are sent at least one command. */
|
|
|
7084e2 |
{
|
|
|
7084e2 |
ACQUIRE_LOCK_FOR_CURRENT_SCOPE (&h->commands_lock);
|
|
|
7084e2 |
- while (h->commands.size == 0)
|
|
|
7084e2 |
+ while (h->commands.len == 0)
|
|
|
7084e2 |
pthread_cond_wait (&h->commands_cond, &h->commands_lock);
|
|
|
7084e2 |
cmd = h->commands.ptr[0];
|
|
|
7084e2 |
command_queue_remove (&h->commands, 0);
|
|
|
7084e2 |
diff --git a/server/exports.c b/server/exports.c
|
|
|
7084e2 |
index 7ce1eda9..12c8a879 100644
|
|
|
7084e2 |
--- a/server/exports.c
|
|
|
7084e2 |
+++ b/server/exports.c
|
|
|
7084e2 |
@@ -90,13 +90,13 @@ nbdkit_exports_free (struct nbdkit_exports *exps)
|
|
|
7084e2 |
NBDKIT_DLL_PUBLIC size_t
|
|
|
7084e2 |
nbdkit_exports_count (const struct nbdkit_exports *exps)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- return exps->exports.size;
|
|
|
7084e2 |
+ return exps->exports.len;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
NBDKIT_DLL_PUBLIC const struct nbdkit_export
|
|
|
7084e2 |
nbdkit_get_export (const struct nbdkit_exports *exps, size_t i)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- assert (i < exps->exports.size);
|
|
|
7084e2 |
+ assert (i < exps->exports.len);
|
|
|
7084e2 |
return exps->exports.ptr[i];
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -106,7 +106,7 @@ nbdkit_add_export (struct nbdkit_exports *exps,
|
|
|
7084e2 |
{
|
|
|
7084e2 |
struct nbdkit_export e = { NULL, NULL };
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (exps->exports.size == MAX_EXPORTS) {
|
|
|
7084e2 |
+ if (exps->exports.len == MAX_EXPORTS) {
|
|
|
7084e2 |
nbdkit_error ("nbdkit_add_export: too many exports");
|
|
|
7084e2 |
errno = EINVAL;
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
diff --git a/server/extents.c b/server/extents.c
|
|
|
7084e2 |
index 8da82cf1..e180e313 100644
|
|
|
7084e2 |
--- a/server/extents.c
|
|
|
7084e2 |
+++ b/server/extents.c
|
|
|
7084e2 |
@@ -117,13 +117,13 @@ nbdkit_extents_free (struct nbdkit_extents *exts)
|
|
|
7084e2 |
NBDKIT_DLL_PUBLIC size_t
|
|
|
7084e2 |
nbdkit_extents_count (const struct nbdkit_extents *exts)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- return exts->extents.size;
|
|
|
7084e2 |
+ return exts->extents.len;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
NBDKIT_DLL_PUBLIC struct nbdkit_extent
|
|
|
7084e2 |
nbdkit_get_extent (const struct nbdkit_extents *exts, size_t i)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- assert (i < exts->extents.size);
|
|
|
7084e2 |
+ assert (i < exts->extents.len);
|
|
|
7084e2 |
return exts->extents.ptr[i];
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -160,7 +160,7 @@ nbdkit_add_extent (struct nbdkit_extents *exts,
|
|
|
7084e2 |
return 0;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Ignore extents beyond the end of the range, or if list is full. */
|
|
|
7084e2 |
- if (offset >= exts->end || exts->extents.size >= MAX_EXTENTS)
|
|
|
7084e2 |
+ if (offset >= exts->end || exts->extents.len >= MAX_EXTENTS)
|
|
|
7084e2 |
return 0;
|
|
|
7084e2 |
|
|
|
7084e2 |
/* Shorten extents that overlap the end of the range. */
|
|
|
7084e2 |
@@ -169,7 +169,7 @@ nbdkit_add_extent (struct nbdkit_extents *exts,
|
|
|
7084e2 |
length -= overlap;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (exts->extents.size == 0) {
|
|
|
7084e2 |
+ if (exts->extents.len == 0) {
|
|
|
7084e2 |
/* If there are no existing extents, and the new extent is
|
|
|
7084e2 |
* entirely before start, ignore it.
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
@@ -196,10 +196,10 @@ nbdkit_add_extent (struct nbdkit_extents *exts,
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
/* If we get here we are going to either add or extend. */
|
|
|
7084e2 |
- if (exts->extents.size > 0 &&
|
|
|
7084e2 |
- exts->extents.ptr[exts->extents.size-1].type == type) {
|
|
|
7084e2 |
+ if (exts->extents.len > 0 &&
|
|
|
7084e2 |
+ exts->extents.ptr[exts->extents.len-1].type == type) {
|
|
|
7084e2 |
/* Coalesce with the last extent. */
|
|
|
7084e2 |
- exts->extents.ptr[exts->extents.size-1].length += length;
|
|
|
7084e2 |
+ exts->extents.ptr[exts->extents.len-1].length += length;
|
|
|
7084e2 |
return 0;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
else {
|
|
|
7084e2 |
@@ -226,13 +226,13 @@ nbdkit_extents_aligned (struct context *next_c,
|
|
|
7084e2 |
/* Perform an initial query, then scan for the first unaligned extent. */
|
|
|
7084e2 |
if (next->extents (next_c, count, offset, flags, exts, err) == -1)
|
|
|
7084e2 |
return -1;
|
|
|
7084e2 |
- for (i = 0; i < exts->extents.size; ++i) {
|
|
|
7084e2 |
+ for (i = 0; i < exts->extents.len; ++i) {
|
|
|
7084e2 |
e = &exts->extents.ptr[i];
|
|
|
7084e2 |
if (!IS_ALIGNED(e->length, align)) {
|
|
|
7084e2 |
/* If the unalignment is past align, just truncate and return early */
|
|
|
7084e2 |
if (e->offset + e->length > offset + align) {
|
|
|
7084e2 |
e->length = ROUND_DOWN (e->length, align);
|
|
|
7084e2 |
- exts->extents.size = i + !!e->length;
|
|
|
7084e2 |
+ exts->extents.len = i + !!e->length;
|
|
|
7084e2 |
exts->next = e->offset + e->length;
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
@@ -249,7 +249,7 @@ nbdkit_extents_aligned (struct context *next_c,
|
|
|
7084e2 |
*/
|
|
|
7084e2 |
assert (i == 0);
|
|
|
7084e2 |
while (e->length < align) {
|
|
|
7084e2 |
- if (exts->extents.size > 1) {
|
|
|
7084e2 |
+ if (exts->extents.len > 1) {
|
|
|
7084e2 |
e->length += exts->extents.ptr[1].length;
|
|
|
7084e2 |
e->type &= exts->extents.ptr[1].type;
|
|
|
7084e2 |
extents_remove (&exts->extents, 1);
|
|
|
7084e2 |
@@ -284,7 +284,7 @@ nbdkit_extents_aligned (struct context *next_c,
|
|
|
7084e2 |
}
|
|
|
7084e2 |
}
|
|
|
7084e2 |
e->length = align;
|
|
|
7084e2 |
- exts->extents.size = 1;
|
|
|
7084e2 |
+ exts->extents.len = 1;
|
|
|
7084e2 |
exts->next = e->offset + e->length;
|
|
|
7084e2 |
break;
|
|
|
7084e2 |
}
|
|
|
7084e2 |
diff --git a/server/main.c b/server/main.c
|
|
|
7084e2 |
index 5fd8308f..225258de 100644
|
|
|
7084e2 |
--- a/server/main.c
|
|
|
7084e2 |
+++ b/server/main.c
|
|
|
7084e2 |
@@ -940,7 +940,7 @@ start_serving (void)
|
|
|
7084e2 |
r = sockets_append (&socks, s);
|
|
|
7084e2 |
assert (r == 0);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
- debug ("using socket activation, nr_socks = %zu", socks.size);
|
|
|
7084e2 |
+ debug ("using socket activation, nr_socks = %zu", socks.len);
|
|
|
7084e2 |
change_user ();
|
|
|
7084e2 |
write_pidfile ();
|
|
|
7084e2 |
top->after_fork (top);
|
|
|
7084e2 |
diff --git a/server/sockets.c b/server/sockets.c
|
|
|
7084e2 |
index 95fce484..f13f8600 100644
|
|
|
7084e2 |
--- a/server/sockets.c
|
|
|
7084e2 |
+++ b/server/sockets.c
|
|
|
7084e2 |
@@ -246,14 +246,14 @@ bind_tcpip_socket (sockets *socks)
|
|
|
7084e2 |
|
|
|
7084e2 |
freeaddrinfo (ai);
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (socks->size == 0 && addr_in_use) {
|
|
|
7084e2 |
+ if (socks->len == 0 && addr_in_use) {
|
|
|
7084e2 |
fprintf (stderr, "%s: unable to bind to any sockets: %s\n",
|
|
|
7084e2 |
program_name, strerror (EADDRINUSE));
|
|
|
7084e2 |
exit (EXIT_FAILURE);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
debug ("bound to IP address %s:%s (%zu socket(s))",
|
|
|
7084e2 |
- ipaddr ? ipaddr : "<any>", port, socks->size);
|
|
|
7084e2 |
+ ipaddr ? ipaddr : "<any>", port, socks->len);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
|
|
|
7084e2 |
void
|
|
|
7084e2 |
@@ -443,7 +443,7 @@ accept_connection (int listen_sock)
|
|
|
7084e2 |
static void
|
|
|
7084e2 |
check_sockets_and_quit_fd (const sockets *socks)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
- const size_t nr_socks = socks->size;
|
|
|
7084e2 |
+ const size_t nr_socks = socks->len;
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
int r;
|
|
|
7084e2 |
|
|
|
7084e2 |
@@ -552,7 +552,7 @@ accept_incoming_connections (const sockets *socks)
|
|
|
7084e2 |
}
|
|
|
7084e2 |
pthread_mutex_unlock (&count_mutex);
|
|
|
7084e2 |
|
|
|
7084e2 |
- for (i = 0; i < socks->size; ++i)
|
|
|
7084e2 |
+ for (i = 0; i < socks->len; ++i)
|
|
|
7084e2 |
closesocket (socks->ptr[i]);
|
|
|
7084e2 |
free (socks->ptr);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
diff --git a/wrapper.c b/wrapper.c
|
|
|
7084e2 |
index 3bab2074..87e5a033 100644
|
|
|
7084e2 |
--- a/wrapper.c
|
|
|
7084e2 |
+++ b/wrapper.c
|
|
|
7084e2 |
@@ -130,9 +130,9 @@ print_command (void)
|
|
|
7084e2 |
{
|
|
|
7084e2 |
size_t i;
|
|
|
7084e2 |
|
|
|
7084e2 |
- if (cmd.size > 0)
|
|
|
7084e2 |
+ if (cmd.len > 0)
|
|
|
7084e2 |
shell_quote (cmd.ptr[0], stderr);
|
|
|
7084e2 |
- for (i = 1; i < cmd.size && cmd.ptr[i] != NULL; ++i) {
|
|
|
7084e2 |
+ for (i = 1; i < cmd.len && cmd.ptr[i] != NULL; ++i) {
|
|
|
7084e2 |
fputc (' ', stderr);
|
|
|
7084e2 |
shell_quote (cmd.ptr[i], stderr);
|
|
|
7084e2 |
}
|
|
|
7084e2 |
--
|
|
|
7084e2 |
2.31.1
|
|
|
7084e2 |
|