Displaying 4 results from an estimated 4 matches for "nr_subdirs".
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...struct lfn *lfns, size_t n);
+static ssize_t extend_dir_table (size_t di, struct virtual_floppy *floppy);
+
+/* Create the on disk directory table for dirs[di]. */
+int
+create_directory (size_t di, const char *label,
+ struct virtual_floppy *floppy)
+{
+ size_t i;
+ const size_t nr_subdirs = floppy->dirs[di].nr_subdirs;
+ const size_t nr_files = floppy->dirs[di].nr_files;
+ struct lfn *lfns, *lfn;
+ const char *name;
+ uint8_t attributes;
+ uint32_t file_size;
+ struct stat *statbuf;
+
+ if (di == 0) {
+ /* For root directory, add the volume label entry first. */
+...
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 30
2
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...floppy)
> +{
> + /* Add files. */
> + attributes = DIR_ENTRY_ARCHIVE; /* Same as set by Linux kernel. */
> + for (i = 0; i < nr_files; ++i) {
> + const size_t fi = floppy->dirs[di].files[i];
> + assert (fi < floppy->nr_files);
> +
> + lfn = &lfns[nr_subdirs+i];
Spacing around +
> +/* Either truncate or pad a string (with spaces). */
> +void
> +pad_string (const char *label, size_t n, uint8_t *out)
> +{
> + const size_t len = strlen (label);
> +
> + memcpy (out, label, len <= n ? len : n);
> + if (len < n)
> + m...
2018 Oct 30
0
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...NUL
provided the end coincides with a 13 codepoint boundary. Also to fill
the rest of the space with 0x0000. So that's what this implementation
does.
Having said that I didn't check it works on Windows (or even MS-DOS!)
guests, which I really should do ...
> >+ lfn = &lfns[nr_subdirs+i];
>
> Spacing around +
On the spacing issue I've tried not to be too religious here, and
instead group things logically. For example:
2*n + 1
would be fine.
> >+ /* Now we must see if some short filenames are duplicates and
> >+ * rename them. XXX Unfortunately O...