search for: nr_dir

Displaying 12 results from an estimated 12 matches for "nr_dir".

Did you mean: nr_dirs
2020 Apr 15
0
[PATCH nbdkit 2/9] floppy, iso, split, ssh: Use new vector type to store lists of strings.
...diff --git a/plugins/floppy/virtual-floppy.c b/plugins/floppy/virtual-floppy.c index fc0cafa8..ad192976 100644 --- a/plugins/floppy/virtual-floppy.c +++ b/plugins/floppy/virtual-floppy.c @@ -117,7 +117,7 @@ create_virtual_floppy (const char *dir, const char *label, for (i = 0; i < floppy->nr_dirs; ++i) { floppy->dirs[i].first_cluster = cluster; nr_bytes = - ROUND_UP (floppy->dirs[i].table_entries * sizeof (struct dir_entry), + ROUND_UP (floppy->dirs[i].table.size * sizeof (struct dir_entry), CLUSTER_SIZE); floppy->data_size += nr_bytes;...
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...be renamed. + */ + lfns = calloc (nr_subdirs + nr_files, sizeof (struct lfn)); + if (lfns == NULL) { + nbdkit_error ("calloc: %m"); + return -1; + } + for (i = 0; i < nr_subdirs; ++i) { + const size_t sdi = floppy->dirs[di].subdirs[i]; + assert (sdi < floppy->nr_dirs); + + name = floppy->dirs[sdi].name; + lfns[i].name = name; + } + for (i = 0; i < nr_files; ++i) { + const size_t fi = floppy->dirs[di].files[i]; + assert (fi < floppy->nr_files); + + name = floppy->files[fi].name; + lfns[nr_subdirs+i].name = name; + } + + i...
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
...if (err) { + nbdkit_error ("ext2fs_read_bitmaps: %s", error_message (err)); + ext2fs_close (fs); + return -1; + } + + /* First pass: This creates subdirectories in the filesystem and + * also builds a list of files so we can identify hard links. + */ + for (i = 0; i < nr_dirs; ++i) { + if (visit (dirs[i], fs, EXT2_ROOT_INO, &files, &nr_files) == -1) + return -1; + } + + if (nr_files > 0) { + assert (files != NULL); + + /* Sort the files by device and inode number to identify hard links. */ + qsort (files, nr_files, sizeof (struct file), co...
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 Jun 26
3
[nbdkit PATCH] iso: Shell-quote an alternative isoprog
...- a/plugins/iso/iso.c +++ b/plugins/iso/iso.c @@ -94,7 +94,8 @@ make_iso (void) return -1; } - fprintf (fp, "%s -quiet", isoprog); + shell_quote (isoprog, fp); + fprintf (fp, " -quiet"); if (params) fprintf (fp, " %s", params); for (i = 0; i < nr_dirs; ++i) { -- 2.20.1
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.
2019 Feb 19
0
[PATCH nbdkit 3/4] common: Move a utility function to a common directory.
...ins/iso/iso.c b/plugins/iso/iso.c index 7431b48..53fccf0 100644 --- a/plugins/iso/iso.c +++ b/plugins/iso/iso.c @@ -43,6 +43,8 @@ #include <nbdkit-plugin.h> +#include "utils.h" + /* List of directories parsed from the command line. */ static char **dirs = NULL; static size_t nr_dirs = 0; @@ -59,8 +61,6 @@ static const char *params = NULL; static int fd = -1; /* Construct the temporary ISO. */ -static void shell_quote (const char *str, FILE *fp); - static int make_iso (void) { @@ -136,38 +136,6 @@ make_iso (void) return 0; } -/* Print str to fp, shell quoting if n...
2019 Feb 19
2
Re: [PATCH nbdkit 4/4] Add linuxdisk plugin.
...t2fs_read_bitmaps: %s", error_message (err)); > + ext2fs_close (fs); > + return -1; > + } > + > + /* First pass: This creates subdirectories in the filesystem and > + * also builds a list of files so we can identify hard links. > + */ > + for (i = 0; i < nr_dirs; ++i) { > + if (visit (dirs[i], fs, EXT2_ROOT_INO, &files, &nr_files) == -1) > + return -1; > + } > + > + if (nr_files > 0) { > + assert (files != NULL); > + > + /* Sort the files by device and inode number to identify hard links. */ > + qso...
2018 Oct 30
2
Re: [PATCH nbdkit 4/4] Add floppy plugin.
...> + size_t di; > + char *origdir; > + DIR *DIR; > + struct dirent *d; > + int err; > + struct stat statbuf; > + > + /* Allocate a new index in the directory array. Note that the root > + * directory will always be at dirs[0]. > + */ > + di = floppy->nr_dirs; > + np = realloc (floppy->dirs, sizeof (struct dir) * (di+1)); More operator spacing. > + if (np == NULL) { > + nbdkit_error ("realloc: %m"); > + goto error0; > + } > + floppy->dirs = np; > + floppy->nr_dirs++; > + memset (&floppy->d...
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