search for: host_path

Displaying 4 results from an estimated 4 matches for "host_path".

2018 Oct 30
1
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...o error2; >>> + } ...and visit_file(). Looking at just visit_file(): > +static int > +visit_file (const char *dir, const char *name, > + const struct stat *statbuf, size_t di, > + struct virtual_floppy *floppy) > +{ > + void *np; > + char *host_path; > + size_t fi, i; > + > + if (asprintf (&host_path, "%s/%s", dir, name) == -1) { > + nbdkit_error ("asprintf: %m"); > + return -1; > + } asprintf() may have modified errno... > + /* Add to global list of files. */ > + fi = floppy->nr_...
2018 Oct 30
2
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...also > + * adds the file to the list of files in the parent directory. > + */ > +static int > +visit_file (const char *dir, const char *name, > + const struct stat *statbuf, size_t di, > + struct virtual_floppy *floppy) > +{ > + void *np; > + char *host_path; > + size_t fi, i; > + > + if (asprintf (&host_path, "%s/%s", dir, name) == -1) { > + nbdkit_error ("asprintf: %m"); > + return -1; > + } > + > + if (statbuf->st_size >= UINT32_MAX) { > + nbdkit_error ("%s: file is larger th...
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 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...rtual_size (&floppy.regions); +} + +/* Read data from the file. */ +static int +floppy_pread (void *handle, void *buf, uint32_t count, uint64_t offset) +{ + while (count > 0) { + const struct region *region = find_region (&floppy.regions, offset); + size_t i, len; + const char *host_path; + int fd; + ssize_t r; + + /* Length to end of region. */ + len = region->end - offset + 1; + if (len > count) + len = count; + + switch (region->type) { + case region_file: + i = region->u.i; + assert (i < floppy.nr_files); + host_path = flo...