search for: region_data

Displaying 16 results from an estimated 16 matches for "region_data".

2020 Apr 15
0
[PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...ion (const regions *regions, uint64_t offset) __attribute__((__nonnull__ (1))); @@ -119,7 +118,7 @@ extern const struct region *find_region (const struct regions *regions, * If type == region_file, it must be followed by u.i parameter. * If type == region_data, it must be followed by u.data parameter. */ -extern int append_region_len (struct regions *regions, +extern int append_region_len (regions *regions, const char *description, uint64_t len, uint64_t pre_aligment, uint64_t post_alignment...
2018 Sep 17
0
[PATCH nbdkit v3 3/3] Add partitioning plugin.
...size_t nr_files = 0; + +/* partition-type parameter. */ +#define PARTTYPE_UNSET 0 +#define PARTTYPE_MBR 1 +#define PARTTYPE_GPT 2 +static int parttype = PARTTYPE_UNSET; + +/* Virtual disk regions (contiguous). */ +enum region_type { + region_file, /* contents of the i'th file */ + region_data, /* pointer to data (used for partition table) */ + region_zero, /* padding */ +}; + +struct region { + uint64_t start, len, end; /* byte offsets; end = start + len - 1 */ + enum region_type type; + union { + size_t i; /* region_file: i'th file */ + c...
2018 Sep 17
4
[PATCH nbdkit 0/3] Add partitioning plugin.
nbdkit partitioning boot.img swap.img root.img ... creates a virtual disk by adding a partition table. In ancient times Xen used to do this. Rich.
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
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.
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...ot;pread: %s: %m", host_path); + close (fd); + return -1; + } + if (r == 0) { + nbdkit_error ("pread: %s: unexpected end of file", host_path); + close (fd); + return -1; + } + close (fd); + len = r; + break; + + case region_data: + memcpy (buf, &region->u.data[offset - region->start], len); + break; + + case region_zero: + memset (buf, 0, len); + break; + } + + count -= len; + buf += len; + offset += len; + } + + return 0; +} + +static struct nbdkit_plugin plugin = { + .name...
2019 Feb 22
0
[PATCH nbdkit v3 4/4] Add linuxdisk plugin.
....fd, buf, len, offset - region->start); + if (r == -1) { + nbdkit_error ("pread: %m"); + return -1; + } + if (r == 0) { + nbdkit_error ("pread: unexpected end of file"); + return -1; + } + len = r; + break; + + case region_data: + memcpy (buf, &region->u.data[offset - region->start], len); + break; + + case region_zero: + memset (buf, 0, len); + break; + } + + count -= len; + buf += len; + offset += len; + } + + return 0; +} + +static struct nbdkit_plugin plugin = { + .name...
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.
2020 Apr 15
0
[PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
...;root directory" : floppy->dirs[i].name, - floppy->dirs[i].table_entries * + floppy->dirs[i].table.size * sizeof (struct dir_entry), 0, CLUSTER_SIZE, - region_data, (void *) floppy->dirs[i].table) == -1) + region_data, + (void *) floppy->dirs[i].table.ptr) == -1) return -1; } diff --git a/plugins/iso/iso.c b/plugins/iso/iso.c index 92554ace..733bcb60 100644 --- a/plugins/iso/iso.c +++ b/plu...
2019 Jan 21
0
[PATCH nbdkit v2 1/4] partitioning plugin: Support MBR logical partitions.
...ensuring we only do a linear scan. + */ +static const struct region * +find_ebr_region (size_t i, size_t *j) +{ + const struct region *region; + + assert (i >= 3); + + for (; *j < nr_regions (&regions); ++(*j)) { + region = get_region (&regions, *j); + if (region->type == region_data && region->u.data == ebr[i-3]) + return region; + } + abort (); } static void diff --git a/plugins/partitioning/partitioning.c b/plugins/partitioning/partitioning.c index 3992bef..689cb24 100644 --- a/plugins/partitioning/partitioning.c +++ b/plugins/partitioning/partitioning....
2019 Jan 20
1
[PATCH nbdkit] partitioning: Support MBR logical partitions.
An evolution of the patch I posted yesterday to qemu-devel (https://www.mail-archive.com/qemu-devel@nongnu.org/msg588920.html) which (a) works and (b) has a test. Rich.
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
....fd, buf, len, offset - region->start); + if (r == -1) { + nbdkit_error ("pread: %m"); + return -1; + } + if (r == 0) { + nbdkit_error ("pread: unexpected end of file"); + return -1; + } + len = r; + break; + + case region_data: + memcpy (buf, &region->u.data[offset - region->start], len); + break; + + case region_zero: + memset (buf, 0, len); + break; + } + + count -= len; + buf += len; + offset += len; + } + + return 0; +} + +static struct nbdkit_plugin plugin = { + .name...
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
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
2019 Jan 21
8
[PATCH nbdkit v2 0/4] Support MBR logical partitions.
This is a revised version of the two series previously posted here: https://www.redhat.com/archives/libguestfs/2019-January/msg00137.html https://www.redhat.com/archives/libguestfs/2019-January/msg00139.html There have been many smaller changes but the highlights are: - Using SECTOR_SIZE instead of hard-coding 512 everywhere. - Additional safety checks that the EBR chain doesn't jump