Displaying 17 results from an estimated 17 matches for "free_regions".
2020 Apr 15
0
[PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...*/
-struct regions {
- struct region *regions;
- size_t nr_regions;
-};
+/* Vector of struct region. */
+DEFINE_VECTOR_TYPE(regions, struct region);
-extern void init_regions (struct regions *regions)
+extern void init_regions (regions *regions)
__attribute__((__nonnull__ (1)));
-extern void free_regions (struct regions *regions)
+extern void free_regions (regions *regions)
__attribute__((__nonnull__ (1)));
/* Return the number of regions. */
static inline size_t __attribute__((__nonnull__ (1)))
-nr_regions (struct regions *regions)
+nr_regions (struct regions *rs)
{
- return regions->n...
2020 Apr 15
1
Re: [PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...uct region);
>
> -extern void init_regions (struct regions *regions)
> +extern void init_regions (regions *regions)
> __attribute__((__nonnull__ (1)));
This change makes sense (DEFINE_VECTOR_TYPE gives us a typedef, so you
lose the explicit 'struct').
> -extern void free_regions (struct regions *regions)
> +extern void free_regions (regions *regions)
> __attribute__((__nonnull__ (1)));
>
> /* Return the number of regions. */
> static inline size_t __attribute__((__nonnull__ (1)))
> -nr_regions (struct regions *regions)
> +nr_regions (struct...
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 Jan 01
3
[PATCH nbdkit] include: Annotate function parameters with attribute((nonnull)).
Should we use attribute((nonnull)) at all? There's a very interesting
history of this in libvirt -- try looking at commit eefb881 plus the
commits referencing eefb881 -- but it does seem to work for me using
recent GCC and Clang.
I only did a few functions because annotating them gets old quickly...
Rich.
2008 Apr 28
4
Wineserver causing heavy CPU load
I am running Fedora 8 uname -r = 2.6.24.4-64.fc8 on my box with Wine 0.9.58. When I first installed it I noticed that my CPU usage jumped and stayed at 100% with wineserver taking > 85%. I killed the wineserver process and it dropped down, however it soon jumped back up when wineserver restarted itself. I then killed it again and all related processes and disabled it from starting as a damen
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...5, 7) * 9;
diff --git a/common/regions/regions.h b/common/regions/regions.h
index ca9b3d5..4fcaf09 100644
--- a/common/regions/regions.h
+++ b/common/regions/regions.h
@@ -76,25 +76,30 @@ struct regions {
size_t nr_regions;
};
-extern void init_regions (struct regions *regions);
-extern void free_regions (struct regions *regions);
-extern const struct region *find_region (const struct regions *regions, uint64_t offset);
-extern int append_region (struct regions *regions, struct region region);
+extern void init_regions (struct regions *regions)
+ __attribute__((__nonnull__ (1)));
+extern void free...
2019 Jan 02
4
[PATCH nbdkit v2 0/2] Use of attribute(()).
v1 was here:
https://www.redhat.com/archives/libguestfs/2019-January/msg00008.html
In v2 I have provided two patches:
The first patch extends attribute((nonnull)) to most internal
functions, but not to the external API.
The second patch uses a macro so that attribute((format)) is only used
in the public API on GCC or Clang. At least in theory these headers
could be used by a C compiler which
2019 Jan 21
0
[PATCH nbdkit v2 1/4] partitioning plugin: Support MBR logical partitions.
...struct random_state random_state;
@@ -106,12 +109,17 @@ partitioning_unload (void)
free (files);
/* We don't need to free regions.regions[].u.data because it points
- * to either primary or secondary which we free here.
+ * to primary, secondary or ebr which we free here.
*/
free_regions (®ions);
free (primary);
free (secondary);
+ if (ebr) {
+ for (i = 0; i < nr_files-3; ++i)
+ free (ebr[i]);
+ free (ebr);
+ }
}
static int
@@ -237,17 +245,11 @@ partitioning_config_complete (void)
total_size = 0;
for (i = 0; i < nr_files; ++i)
total_...
2019 Jan 20
1
[PATCH nbdkit] partitioning: Support MBR logical partitions.
An evolution of the patch I posted yesterday to qemu-devel
(https://www.mail-archive.com/qemu-devel@nongnu.org/msg588920.html)
which (a) works and (b) has a test.
Rich.
2019 Jan 21
8
[PATCH nbdkit v2 0/4] Support MBR logical partitions.
This is a revised version of the two series previously posted here:
https://www.redhat.com/archives/libguestfs/2019-January/msg00137.html
https://www.redhat.com/archives/libguestfs/2019-January/msg00139.html
There have been many smaller changes but the highlights are:
- Using SECTOR_SIZE instead of hard-coding 512 everywhere.
- Additional safety checks that the EBR chain doesn't
jump
2019 Feb 22
0
[PATCH nbdkit v3 4/4] Add linuxdisk plugin.
...create_regions (disk) == -1)
+ return -1;
+
+ /* Initialize partition table structures. This depends on
+ * disk->regions so must be done last.
+ */
+ if (create_partition_table (disk) == -1)
+ return -1;
+
+ return 0;
+}
+
+void
+free_virtual_disk (struct virtual_disk *disk)
+{
+ free_regions (&disk->regions);
+ free (disk->protective_mbr);
+ free (disk->primary_header);
+ free (disk->pt);
+ free (disk->secondary_header);
+ if (disk->fd >= 0)
+ close (disk->fd);
+}
+
+/* Lay out the final disk. */
+static int
+create_regions (struct virtual_disk *disk...
2018 Oct 28
0
[PATCH nbdkit 4/4] Add floppy plugin.
...if (create_fat (floppy) == -1)
+ return -1;
+
+ /* Now we know how large everything is we can create the virtual
+ * disk regions.
+ */
+ if (create_regions (floppy) == -1)
+ return -1;
+
+ return 0;
+}
+
+void
+free_virtual_floppy (struct virtual_floppy *floppy)
+{
+ size_t i;
+
+ free_regions (&floppy->regions);
+
+ free (floppy->fat);
+
+ for (i = 0; i < floppy->nr_files; ++i) {
+ free (floppy->files[i].name);
+ free (floppy->files[i].host_path);
+ }
+ free (floppy->files);
+
+ for (i = 0; i < floppy->nr_dirs; ++i) {
+ free (floppy->dirs[...
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
...create_regions (disk) == -1)
+ return -1;
+
+ /* Initialize partition table structures. This depends on
+ * disk->regions so must be done last.
+ */
+ if (create_partition_table (disk) == -1)
+ return -1;
+
+ return 0;
+}
+
+void
+free_virtual_disk (struct virtual_disk *disk)
+{
+ free_regions (&disk->regions);
+ free (disk->protective_mbr);
+ free (disk->primary_header);
+ free (disk->pt);
+ free (disk->secondary_header);
+ if (disk->fd >= 0)
+ close (disk->fd);
+}
+
+/* Lay out the final disk. */
+static int
+create_regions (struct virtual_disk *disk...
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
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 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