Displaying 4 results from an estimated 4 matches for "last_file".
2019 Feb 19
2
Re: [PATCH nbdkit 4/4] Add linuxdisk plugin.
...; +
> + 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), compare_inodes);
> +
> + /* Second pass: Copy/create the files. */
> + last_file = NULL;
> + for (i = 0; i < nr_files; ++i) {
> + hardlinked = last_file && compare_inodes (last_file, &files[i]) == 0;
> +
> + if (!hardlinked) {
> + /* Normal case: creating a new inode. */
> + last_file = &files[i];
> + ass...
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
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
...*file);
+
+void
+load_filesystem (void)
+{
+ initialize_ext2_error_table ();
+}
+
+int
+create_filesystem (struct virtual_disk *disk)
+{
+ const char *tmpdir;
+ char *filename;
+ errcode_t err;
+ ext2_filsys fs;
+ size_t i;
+ struct file *files = NULL;
+ size_t nr_files = 0;
+ struct file *last_file;
+ bool hardlinked;
+
+ /* Estimate the filesystem size and compute the final virtual size
+ * of the disk. We only need to do this if the user didn't specify
+ * the exact size on the command line.
+ */
+ if (size == 0 || size_add_estimate) {
+ int64_t estimate;
+
+ estimate =...
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.
-