Displaying 20 results from an estimated 22 matches for "get_region".
2020 Apr 15
0
[PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...ard replacement, but note that we must rename all
variables called ‘regions’ as something else (eg. ‘rs’) because
-Wshadow warns about them (which is surprising to me since I thought
this warning only applied to local vs global variable, not local
variable vs global typedef).
Also I got rid of the get_regions accessor method, replacing it
everywhere with direct use of regions->ptr[]. Although the accessor
method did bounds checking, my reasoning is this change is correct
because in all cases we were iterating over the regions from
0 .. nr_regions-1. However an improvement would be to have a proper...
2019 Sep 24
2
What is the best way to loop over an ALTREP vector?
...right and looks
like a useful onramp. There are a few things to watch out for though (I've
cc'ed Romain so he's aware of these comments). @romain I hope you taake the
following comments as they are intended, as help rather than attacks.
The largest issue I see is that the contract for Get_region is that it
*populates the
provided buffer with a copy of the data. *That buffer is expected to be
safe to destructively modify, shuffle, etc though I don't know if we are
actually doing that anywhere. As such, if I understand his C++ correctly,
that Get_region method is not safe and shouldn...
2019 Sep 23
2
What is the best way to loop over an ALTREP vector?
...e
>>>> package
>>>> previously used pointers to access the data of a SEXP, so it would not
>>>> work
>>>> for some ALTREP objects which do not have a pointer. I plan to rewrite
>>>> the
>>>> code and use functions like get_elt, get_region, and get_subset to
>>>> access
>>>> the values of a vector, so I have a few questions for ALTREP:
>>>>
>>>> 1. Since an ALTREP do not have to define all of the above
>>>> functions(element, region, subset), is there any way to check which...
2019 Aug 28
3
What is the best way to loop over an ALTREP vector?
Hi devel team,
I'm working on C/C++ level ALTREP compatibility for a package. The package
previously used pointers to access the data of a SEXP, so it would not work
for some ALTREP objects which do not have a pointer. I plan to rewrite the
code and use functions like get_elt, get_region, and get_subset to access
the values of a vector, so I have a few questions for ALTREP:
1. Since an ALTREP do not have to define all of the above
functions(element, region, subset), is there any way to check which
function has been defined for an ALTREP class? I did a search on
RInternal.h and alt...
2019 Jan 21
0
[PATCH nbdkit v2 1/4] partitioning plugin: Support MBR logical partitions.
...c const struct region *find_ebr_region (size_t i, size_t *j);
+
+/* Create the MBR and optionally EBRs. */
void
-create_mbr_partition_table (unsigned char *out)
+create_mbr_layout (void)
{
- size_t i, j;
-
- for (j = 0; j < nr_regions (®ions); ++j) {
- const struct region *region = get_region (®ions, j);
-
- if (region->type == region_file) {
- i = region->u.i;
- assert (i < 4);
- create_mbr_partition_table_entry (region, i == 0,
- files[i].mbr_id,
- &out[0x1be + 16*i]);
-...
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.
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.
2020 Apr 15
1
Re: [PATCH nbdkit 4/9] common/regions: Use new vector type to store the list of regions.
...we must rename all
> variables called ‘regions’ as something else (eg. ‘rs’) because
> -Wshadow warns about them (which is surprising to me since I thought
> this warning only applied to local vs global variable, not local
> variable vs global typedef).
>
> Also I got rid of the get_regions accessor method, replacing it
> everywhere with direct use of regions->ptr[]. Although the accessor
> method did bounds checking, my reasoning is this change is correct
> because in all cases we were iterating over the regions from
> 0 .. nr_regions-1. However an improvement would...
2019 Sep 23
0
What is the best way to loop over an ALTREP vector?
...bility for a package. The
>>> package
>>> previously used pointers to access the data of a SEXP, so it would not
>>> work
>>> for some ALTREP objects which do not have a pointer. I plan to rewrite
>>> the
>>> code and use functions like get_elt, get_region, and get_subset to access
>>> the values of a vector, so I have a few questions for ALTREP:
>>>
>>> 1. Since an ALTREP do not have to define all of the above
>>> functions(element, region, subset), is there any way to check which
>>> function has been de...
2019 Sep 24
0
What is the best way to loop over an ALTREP vector?
...ackage
>>>>> previously used pointers to access the data of a SEXP, so it would not
>>>>> work
>>>>> for some ALTREP objects which do not have a pointer. I plan to rewrite
>>>>> the
>>>>> code and use functions like get_elt, get_region, and get_subset to
>>>>> access
>>>>> the values of a vector, so I have a few questions for ALTREP:
>>>>>
>>>>> 1. Since an ALTREP do not have to define all of the above
>>>>> functions(element, region, subset), is there an...
2018 Sep 17
0
[PATCH nbdkit v3 3/3] Add partitioning plugin.
..._offset (const void *offsetp, const void *regionp)
+{
+ const uint64_t offset = *(uint64_t *)offsetp;
+ const struct region *region = (struct region *)regionp;
+
+ if (offset < region->start) return -1;
+ if (offset > region->end) return 1;
+ return 0;
+}
+
+static struct region *
+get_region (uint64_t offset)
+{
+ return bsearch (&offset, regions, nr_regions, sizeof (struct region),
+ compare_offset);
+}
+
+/* Helper function to expand an array of objects. */
+static int
+expand (void **objects, size_t size, size_t *nr_objects)
+{
+ void *p;
+
+ p = realloc (*ob...
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
2018 Sep 17
4
[PATCH nbdkit 0/3] Add partitioning plugin.
nbdkit partitioning boot.img swap.img root.img
... creates a virtual disk by adding a partition table.
In ancient times Xen used to do this.
Rich.
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.
2018 Sep 17
7
[PATCH nbdkit v3 0/3] Add partitioning plugin.
The partitioning plugin patch is the same (except for rebasing).
However I have changed the first two patches based on feedback
received. In particular this fixes a very serious bug found by Eric
Blake in the current truncate filter.
Rich.
2019 Jan 02
0
[PATCH nbdkit v2 1/2] Annotate internal function parameters with attribute((nonnull)).
...uint64_t offset)
+ __attribute__((__nonnull__ (1)));
+extern int append_region (struct regions *regions, struct region region)
+ __attribute__((__nonnull__ (1)));
-static inline const struct region *
+static inline const struct region * __attribute__((__nonnull__ (1)))
get_region (const struct regions *regions, size_t i)
{
assert (i < regions->nr_regions);
return ®ions->regions[i];
}
-static inline size_t
+static inline size_t __attribute__((__nonnull__ (1)))
nr_regions (struct regions *regions)
{
return regions->nr_regions;
}
-static in...
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 Feb 22
0
[PATCH nbdkit v3 4/4] Add linuxdisk plugin.
...4 (region->end / SECTOR_SIZE);
+ entry->attributes = htole64 (bootable ? 4 : 0);
+}
+
+static void
+create_gpt_partition_table (struct virtual_disk *disk, unsigned char *out)
+{
+ size_t j;
+
+ for (j = 0; j < nr_regions (&disk->regions); ++j) {
+ const struct region *region = get_region (&disk->regions, j);
+
+ /* Find the (only) partition region, which has type region_file. */
+ if (region->type == region_file) {
+ create_gpt_partition_table_entry (region, true,
+ PARTITION_TYPE_GUID,
+...
2019 Feb 19
0
[PATCH nbdkit 4/4] Add linuxdisk plugin.
...4 (region->end / SECTOR_SIZE);
+ entry->attributes = htole64 (bootable ? 4 : 0);
+}
+
+static void
+create_gpt_partition_table (struct virtual_disk *disk, unsigned char *out)
+{
+ size_t j;
+
+ for (j = 0; j < nr_regions (&disk->regions); ++j) {
+ const struct region *region = get_region (&disk->regions, j);
+
+ /* Find the (only) partition region, which has type region_file. */
+ if (region->type == region_file) {
+ create_gpt_partition_table_entry (region, true,
+ PARTITION_TYPE_GUID,
+...
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