search for: create_regions

Displaying 10 results from an estimated 10 matches for "create_regions".

2019 Feb 22
0
[PATCH nbdkit v3 4/4] Add linuxdisk plugin.
...b.h> +#include <stdbool.h> +#include <stdint.h> +#include <inttypes.h> +#include <string.h> +#include <unistd.h> + +#include <nbdkit-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 s...
2020 Apr 15
0
[PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
..._virtual_floppy (struct virtual_floppy *floppy) free (floppy->dirs[i].name); free (floppy->dirs[i].subdirs); free (floppy->dirs[i].files); - free (floppy->dirs[i].table); + free (floppy->dirs[i].table.ptr); } free (floppy->dirs); } @@ -677,14 +677,15 @@ create_regions (struct virtual_floppy *floppy) /* Directories can never be completely empty because of the volume * label (root) or "." and ".." entries (non-root). */ - assert (floppy->dirs[i].table_entries > 0); + assert (floppy->dirs[i].table.size > 0);...
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...n_boot_sector (const char *label, struct virtual_floppy *floppy); +static int create_fsinfo (struct virtual_floppy *floppy); +static int create_fat (struct 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 (siz...
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
...b.h> +#include <stdbool.h> +#include <stdint.h> +#include <inttypes.h> +#include <string.h> +#include <unistd.h> + +#include <nbdkit-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...
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 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 30
2
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...gt; + floppy->files[fi].statbuf = *statbuf; > + > + /* Add to the list of files in the parent directory (di). */ > + i = floppy->dirs[di].nr_files; > + np = realloc (floppy->dirs[di].files, sizeof (size_t) * (i+1)); Recurring issue, isn't it :) > +static int > +create_regions (struct virtual_floppy *floppy) > +{ > + struct region region; > + size_t i; > + > + /* MBR. */ > + region.start = 0; > + region.end = SECTOR_SIZE-1; and again Overall, looks like a useful plugin! -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-91...
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
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.