search for: init_region

Displaying 13 results from an estimated 13 matches for "init_region".

Did you mean: init_regions
2020 Apr 15
0
[PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...the partitioning and floppy plugins. * @@ -70,38 +72,35 @@ struct region { const char *description; }; -/* Array of regions. */ -struct regions { - struct region *regions; - size_t nr_regions; -}; +/* Vector of struct region. */ +DEFINE_VECTOR_TYPE(regions, struct region); -extern void init_regions (struct regions *regions) +extern void init_regions (regions *regions) __attribute__((__nonnull__ (1))); -extern void free_regions (struct regions *regions) +extern void free_regions (regions *regions) __attribute__((__nonnull__ (1))); /* Return the number of regions. */ static inline si...
2020 Apr 15
1
Re: [PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...ruct region { > const char *description; > }; > > -/* Array of regions. */ > -struct regions { > - struct region *regions; > - size_t nr_regions; > -}; > +/* Vector of struct region. */ > +DEFINE_VECTOR_TYPE(regions, struct region); > > -extern void init_regions (struct regions *regions) > +extern void init_regions (regions *regions) > __attribute__((__nonnull__ (1))); This change makes sense (DEFINE_VECTOR_TYPE gives us a typedef, so you lose the explicit 'struct'). > -extern void free_regions (struct regions *regions) > +exter...
2020 Apr 15
18
[PATCH nbdkit 0/9] Generic vector, and pass $nbdkit_stdio_safe to shell scripts.
This was a rather longer trip around the houses than I anticipated! The basic purpose of the patch series is to set $nbdkit_stdio_safe to "0" or "1" in sh and eval plugin scripts. To do that, I ended up adding a nicer way to manipulate environ lists, and to do that, I ended up adding a whole generic vector implementation which is applicable in a lot of different places.
2019 Jan 01
3
[PATCH nbdkit] include: Annotate function parameters with attribute((nonnull)).
Should we use attribute((nonnull)) at all? There's a very interesting history of this in libvirt -- try looking at commit eefb881 plus the commits referencing eefb881 -- but it does seem to work for me using recent GCC and Clang. I only did a few functions because annotating them gets old quickly... Rich.
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...nst uint64_t result_starstar = rotl (state->s[1] * 5, 7) * 9; diff --git a/common/regions/regions.h b/common/regions/regions.h index ca9b3d5..4fcaf09 100644 --- a/common/regions/regions.h +++ b/common/regions/regions.h @@ -76,25 +76,30 @@ struct regions { size_t nr_regions; }; -extern void init_regions (struct regions *regions); -extern void free_regions (struct regions *regions); -extern const struct region *find_region (const struct regions *regions, uint64_t offset); -extern int append_region (struct regions *regions, struct region region); +extern void init_regions (struct regions *regions)...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here: https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html In v2 I have provided two patches: The first patch extends attribute((nonnull)) to most internal functions, but not to the external API. The second patch uses a macro so that attribute((format)) is only used in the public API on GCC or Clang. At least in theory these headers could be used by a C compiler which
2019 Feb 22
0
[PATCH nbdkit v3 4/4] Add linuxdisk plugin.
...bdkit-plugin.h> + +#include "random.h" +#include "regions.h" + +#include "virtual-disk.h" + +static int create_regions (struct virtual_disk *disk); + +void +init_virtual_disk (struct virtual_disk *disk) +{ + memset (disk, 0, sizeof *disk); + disk->fd = -1; + + init_regions (&disk->regions); +} + +int +create_virtual_disk (struct virtual_disk *disk) +{ + size_t i; + + /* Allocate the partition table structures. We can't fill them in + * until we have created the disk layout. + */ + disk->protective_mbr = calloc (1, SECTOR_SIZE); + disk->prim...
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...t virtual_floppy *floppy); +static void write_fat_file (uint32_t first_cluster, uint32_t nr_clusters, struct virtual_floppy *floppy); +static int create_regions (struct virtual_floppy *floppy); + +void +init_virtual_floppy (struct virtual_floppy *floppy) +{ + memset (floppy, 0, sizeof *floppy); + init_regions (&floppy->regions); + + /* Assert that the on disk struct sizes are correct. */ + assert (sizeof (struct dir_entry) == 32); + assert (sizeof (struct lfn_entry) == 32); + assert (sizeof (struct bootsector) == 512); + assert (sizeof (struct fsinfo) == 512); +} + +int +create_virtual_flop...
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
...bdkit-plugin.h> + +#include "random.h" +#include "regions.h" + +#include "virtual-disk.h" + +static int create_regions (struct virtual_disk *disk); + +void +init_virtual_disk (struct virtual_disk *disk) +{ + memset (disk, 0, sizeof *disk); + disk->fd = -1; + + init_regions (&disk->regions); +} + +int +create_virtual_disk (const char **dirs, size_t nr_dirs, const char *label, + int64_t size, bool size_add_estimate, + struct virtual_disk *disk) +{ + size_t i; + + /* Allocate the partition table structures. We can't...
2019 Feb 22
5
[PATCH nbdkit v3 0/4] Add linuxdisk plugin.
For v3 I reimplemented this using mke2fs -d. This obviously makes the implementation a whole lot simpler, but cannot support multiple directory merging. Patches 1-3 are the same as before. I've also reproduced the notes from v2 below. v2: - Fix inconsistent tab/space. - All 3 plugins now contain a block of text pointing to the other 2 plugins. - TMDIR -> TMPDIR - Unlink the
2018 Oct 28
6
[PATCH nbdkit 0/4] Add floppy plugin.
Add nbdkit-floppy-plugin, “inspired” by qemu's VVFAT driver, but without the ability to handle writes. The implementation is pretty complete, supporting FAT32, LFNs, volume labels, timestamps, etc, and it passes both ‘make check’ and ‘make check-valgrind’. Usage is simple; to serve the current directory: $ nbdkit floppy . Then using guestfish (or any NBD client): $ guestfish --ro
2019 Feb 19
6
[PATCH nbdkit v2 0/5] Add linuxdisk plugin.
Another interesting thing you can do with this plugin: https://rwmj.wordpress.com/2019/02/19/nbdkit-linuxdisk-plugin/ v2: - Fix inconsistent tab/space. - All 3 plugins now contain a block of text pointing to the other 2 plugins. - TMDIR -> TMPDIR - Unlink the temporary file and other cleanups along error paths. - fclose -> pclose, and check the return value for errors. -
2019 Feb 19
7
[PATCH nbdkit 0/4] New plugin: Add linuxdisk plugin.
Turns out Japanese trains are good for coding! In supermin we have a bunch of code to create the libguestfs appliance. It creates it directly using libext2fs (part of e2fsprogs). We can use the same technique to create ext2 virtual disks in nbdkit, which is what this new plugin does. Why a new plugin instead of modifying the floppy plugin? See the 4/4 commit message for an explanation. The