Displaying 5 results from an estimated 5 matches for "visit_file".
2018 Oct 30
1
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...&statbuf, di, floppy) == -1)
>>> + goto error2;
>>> + }
And then you have to audit whether your visit_subdirectory() code left
errno unchanged...
>>> + /* Regular file. */
>>> + else if (S_ISREG (statbuf.st_mode)) {
>>> + if (visit_file (dir, d->d_name, &statbuf, di, floppy) == -1)
>>> + goto 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,
> +...
2018 Oct 30
2
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...}
> +
> + /* Directory. */
> + if (S_ISDIR (statbuf.st_mode)) {
> + if (visit_subdirectory (dir, d->d_name, &statbuf, di, floppy) == -1)
> + goto error2;
> + }
> + /* Regular file. */
> + else if (S_ISREG (statbuf.st_mode)) {
> + if (visit_file (dir, d->d_name, &statbuf, di, floppy) == -1)
> + goto error2;
> + }
> + /* else ALL other file types are ignored - see documentation. */
> + }
Need to reset errno back to 0 before looping back to the next readdir()
call.
> +
> + /* Did readdir fail? */
&g...
2018 Oct 30
0
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...ory. */
> >+ if (S_ISDIR (statbuf.st_mode)) {
> >+ if (visit_subdirectory (dir, d->d_name, &statbuf, di, floppy) == -1)
> >+ goto error2;
> >+ }
> >+ /* Regular file. */
> >+ else if (S_ISREG (statbuf.st_mode)) {
> >+ if (visit_file (dir, d->d_name, &statbuf, di, floppy) == -1)
> >+ goto error2;
> >+ }
> >+ /* else ALL other file types are ignored - see documentation. */
> >+ }
>
> Need to reset errno back to 0 before looping back to the next
> readdir() call.
Hmm, really...
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.
...+ * for greatest compatibility.
+ */
+#define OEM_NAME "MSWIN4.1"
+
+static ssize_t visit (const char *dir, struct virtual_floppy *floppy);
+static int visit_subdirectory (const char *dir, const char *name, const struct stat *statbuf, size_t di, struct virtual_floppy *floppy);
+static int visit_file (const char *dir, const char *name, const struct stat *statbuf, size_t di, struct virtual_floppy *floppy);
+static int create_mbr (struct virtual_floppy *floppy);
+static void chs_too_large (uint8_t *out);
+static int create_partition_boot_sector (const char *label, struct virtual_floppy *floppy);...