Displaying 20 results from an estimated 22 matches for "nbdkit_next".
2018 Jan 16
2
[nbdkit] Proposed (new) filter API
...#define NBDKIT_FILTER_H
/* This header also defines some useful functions like nbdkit_debug
* and nbdkit_parse_size which are appropriate for filters to use.
*/
#include <nbdkit-plugin.h>
#ifdef __cplusplus
extern "C" {
#endif
#define NBDKIT_FILTER_API_VERSION 1
typedef int (*nbdkit_next_config) (void *nxdata,
const char *key, const char *value);
typedef int (*nbdkit_next_config_complete) (void *nxdata);
struct nbdkit_next {
int64_t (*get_size) (void *nxdata);
int (*can_write) (void *nxdata);
int (*can_flush) (void *nxdata);
int (*is_rot...
2018 Jan 19
0
[PATCH nbdkit filters-v2 5/5] INCOMPLETE filters: Add nbdkit-partition-filter.
...lters/Makefile.am
+++ b/filters/Makefile.am
@@ -32,4 +32,5 @@
SUBDIRS = \
delay \
- offset
+ offset \
+ partition
diff --git a/filters/delay/delay.c b/filters/delay/delay.c
index c8d9ef2..66b7e56 100644
--- a/filters/delay/delay.c
+++ b/filters/delay/delay.c
@@ -121,30 +121,30 @@ delay_config (nbdkit_next_config *next, void *nxdata,
/* Read data. */
static int
-delay_pread (struct nbdkit_next *next, void *nxdata,
+delay_pread (struct nbdkit_next_ops *next_ops, void *nxdata,
void *handle, void *buf, uint32_t count, uint64_t offset)
{
read_delay ();
- return next->pread (nxda...
2018 Jan 17
4
Re: [PATCH 9/9] filters: Move rdelay/wdelay from file plugin to new delay filter.
...plugin supported ‘rdelay’ and ‘wdelay’ parameters
> for injecting delays (for testing) into read and write requests. This
> moves the functionality to a new delay filter so that it can be used
> with any plugin.
> ---
> +/* Write data. */
> +static int
> +delay_pwrite (struct nbdkit_next *next, void *nxdata,
> + void *handle,
> + const void *buf, uint32_t count, uint64_t offset)
> +{
> + write_delay ();
> + return next->pwrite (nxdata, buf, count, offset);
> +}
> +
> +/* Zero data. */
> +static int
> +delay_zero (struct n...
2018 Jan 19
0
[PATCH nbdkit filters-v2 3/5] filters: Add nbdkit-offset-filter.
...ude <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+
+#include <nbdkit-filter.h>
+
+static int64_t offset = -1, range = -1;
+
+/* Called for each key=value passed on the command line. */
+static int
+offset_config (nbdkit_next_config *next, void *nxdata,
+ const char *key, const char *value)
+{
+ if (strcmp (key, "offset") == 0) {
+ offset = nbdkit_parse_size (value);
+ if (offset == -1)
+ return -1;
+ return 0;
+ }
+ else if (strcmp (key, "range") == 0) {
+ range = n...
2023 Jan 27
2
[nbdkit PATCH 1/2] retry: Add in retry support during .open
...-2021 Red Hat Inc.
+ * Copyright (C) 2019-2023 Red Hat Inc.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -113,45 +113,6 @@ struct retry_handle {
bool open;
};
-static void *
-retry_open (nbdkit_next_open *next, nbdkit_context *nxdata,
- int readonly, const char *exportname, int is_tls)
-{
- struct retry_handle *h;
-
- if (next (nxdata, readonly, exportname) == -1)
- return NULL;
-
- h = malloc (sizeof *h);
- if (h == NULL) {
- nbdkit_error ("malloc: %m");
- re...
2018 Jan 17
14
[PATCH 0/9] Add filters to nbdkit.
The first three patches are identical to:
https://www.redhat.com/archives/libguestfs/2018-January/msg00079.html
"[PATCH nbdkit v2 0/3] Refactor plugin_* functions into a backend"
The rest of the patches add filters using the new filter API
previously described here:
https://www.redhat.com/archives/libguestfs/2018-January/msg00073.html
This needs a lot more testing -- and tests --
2018 Jan 18
0
Re: [PATCH 9/9] filters: Move rdelay/wdelay from file plugin to new delay filter.
On Wed, Jan 17, 2018 at 04:38:04PM -0600, Eric Blake wrote:
> > +/* Zero data. */
> > +static int
> > +delay_zero (struct nbdkit_next *next, void *nxdata,
> > + void *handle, uint32_t count, uint64_t offset, int may_trim)
> > +{
> > + write_delay ();
> > + return next->zero (nxdata, count, offset, may_trim);
>
> If next->zero() fails with EOPNOTSUPP, that means we will delay once...
2018 Jan 18
0
Re: [PATCH 9/9] filters: Move rdelay/wdelay from file plugin to new delay filter.
...elay’ parameters
>> for injecting delays (for testing) into read and write requests. This
>> moves the functionality to a new delay filter so that it can be used
>> with any plugin.
>> ---
>
>> +/* Write data. */
>> +static int
>> +delay_pwrite (struct nbdkit_next *next, void *nxdata,
>> + void *handle,
>> + const void *buf, uint32_t count, uint64_t offset)
>> +{
>> + write_delay ();
>> + return next->pwrite (nxdata, buf, count, offset);
>> +}
>> +
>> +/* Zero data. */
>> +s...
2018 Jan 17
2
Re: [PATCH 7/9] Implement filters.
On 01/17/2018 02:53 PM, Richard W.M. Jones wrote:
> Also implements the --filters parameter.
> ---
> docs/nbdkit.pod | 21 +-
> nbdkit.in | 17 +-
> src/Makefile.am | 1 +
> src/filters.c | 606 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> src/internal.h | 23 ++-
> src/main.c | 114 +++++++++--
> src/plugins.c | 11 +-
> 7 files
2020 Feb 12
4
[nbdkit PATCH 0/3] Make ext2 a filter
...de "cleanup.h"
+#include "io.h"
+
+/* Filename parameter. */
static char *file;
static void
@@ -59,25 +62,16 @@ ext2_load (void)
static void
ext2_unload (void)
{
- free (disk);
free (file);
}
static int
-ext2_config (const char *key, const char *value)
+ext2_config (nbdkit_next_config *next, void *nxdata,
+ const char *key, const char *value)
{
- if (strcmp (key, "disk") == 0) {
- if (disk != NULL) {
- nbdkit_error ("disk parameter specified more than once");
- return -1;
- }
- disk = nbdkit_absolute_path (value);
-...
2018 Jan 19
16
[nbdkit PATCH v2 00/13] Add filters + FUA support to nbdkit
A combination of the work that both Rich and I have been doing
lately, where filters use only the new API with flags on every
command that the client can send over the wire (we can then
add support for more flags in nbdkit without having to add new
callbacks, as NBD adds more flags upstream).
Eric Blake (4):
protocol: Split flags from cmd field in requests
backend: Pass flags argument through
2023 Jan 28
1
[nbdkit PATCH 1/2] retry: Add in retry support during .open
...3 Red Hat Inc.
> *
> * Redistribution and use in source and binary forms, with or without
> * modification, are permitted provided that the following conditions are
> @@ -113,45 +113,6 @@ struct retry_handle {
> bool open;
> };
>
> -static void *
> -retry_open (nbdkit_next_open *next, nbdkit_context *nxdata,
> - int readonly, const char *exportname, int is_tls)
> -{
> - struct retry_handle *h;
> -
> - if (next (nxdata, readonly, exportname) == -1)
> - return NULL;
> -
> - h = malloc (sizeof *h);
> - if (h == NULL) {
> -...
2018 Jan 19
10
[PATCH nbdkit filters-v2 0/5] Introduce filters.
...'t expose them to plugins (only internally in the
backend). However for filters they make more sense since they give
you a place to prepare and finalize. They're necessary also for
filters because filter.open could not call the next open method, save
the (plugin) handle, then construct an nbdkit_next_ops object, and
call pread. It _has_ to be split into two operations.
This patch series is incomplete in at least three ways:
- We still need a way for filter.open to call down to the next open
function, so it can adjust the readonly flag (for copyonwrite
filter, TBD).
- Partition filte...
2023 Jan 27
2
[nbdkit PATCH 0/2] retry: add support for retrying .open
In https://bugzilla.redhat.com/show_bug.cgi?id=1841820, it was pointed
out that the retry filter not retrying .open means that an ssh
connection (such as in a vmx+ssh v2v conversion) fails when the ssh
connection itself cannot be retried. A year ago, this was an inherent
limitation of our retry implementation; but in the meantime, my work
to allow filters to open independent backends has made it
2018 Jan 17
0
[PATCH 9/9] filters: Move rdelay/wdelay from file plugin to new delay filter.
....tv_nsec = (ms * 1000000) % 1000000000
+ };
+ nanosleep (&ts, NULL);
+ }
+}
+
+static void
+read_delay (void)
+{
+ delay (rdelayms);
+}
+
+static void
+write_delay (void)
+{
+ delay (wdelayms);
+}
+
+/* Called for each key=value passed on the command line. */
+static int
+delay_config (nbdkit_next_config *next, void *nxdata,
+ const char *key, const char *value)
+{
+ if (strcmp (key, "rdelay") == 0) {
+ rdelayms = parse_delay (value);
+ if (rdelayms == -1)
+ return -1;
+ return 0;
+ }
+ else if (strcmp (key, "wdelay") == 0) {
+ wdelayms =...
2018 Jan 18
0
Re: [PATCH 7/9] Implement filters.
...0600, Eric Blake wrote:
> (I'm also planning on rebasing my
> FUA flags on top of your series, since so far it is looking pretty good).
I think after some thought I'm going to add a filter.open method which
will include a next parameter (actually 2x next parameters, for
next_open and nbdkit_next).
It's necessary to implement a copy-on-write layer that we can have a
read-write filter which enables readonly on the layer below. Thus it
needs to call the layer below with open (readonly=1).
For the partition filter it makes sense that during the filter open
call we can read the partition...
2018 Jan 16
0
Re: [nbdkit] Proposed (new) filter API
...fines some useful functions like nbdkit_debug
> * and nbdkit_parse_size which are appropriate for filters to use.
Too much copy-and-paste?
> */
> #include <nbdkit-plugin.h>
I guess you get those useful functions by inclusion, rather than by
direct definition.
>
> struct nbdkit_next {
> int64_t (*get_size) (void *nxdata);
>
> int (*can_write) (void *nxdata);
> int (*can_flush) (void *nxdata);
> int (*is_rotational) (void *nxdata);
> int (*can_trim) (void *nxdata);
>
> int (*pread) (void *nxdata, void *buf, uint32_t count, uint64_t offset);...
2023 Jun 13
3
[PATCH nbdkit 0/3] tar: Implement tar-limit
This patch series cleans up some issues with nbdkit-tar-filter and (in
patch 3) implements a new tar-limit feature which limits how much of
the tar file we will read to find the entry within the tar file that
we will serve. This protects against the case where a tar file is
presented that contains much content at the front that we must iterate
over (and download) before we get to the entry we are
2020 Aug 27
0
[nbdkit PATCH 2/2] ext2: Supply .list_exports and .default_export
...r export name. Using the export
+ * name is opt-in (see ext2_config_complete).
+ */
+static const char *file;
static void
ext2_load (void)
@@ -59,12 +61,6 @@ ext2_load (void)
initialize_ext2_error_table ();
}
-static void
-ext2_unload (void)
-{
- free (file);
-}
-
static int
ext2_config (nbdkit_next_config *next, void *nxdata,
const char *key, const char *value)
@@ -74,11 +70,7 @@ ext2_config (nbdkit_next_config *next, void *nxdata,
nbdkit_error ("ext2file parameter specified more than once");
return -1;
}
- file = strdup (value);
- if (file ==...
2020 Aug 27
4
[nbdkit PATCH 0/2] ext2 export list tweaks
Applies on top of my pending series for the exportname filter,
addressing one of the todo's in that cover letter.
Eric Blake (2):
filters: Add .export_description wrappers
ext2: Supply .list_exports and .default_export
filters/ext2/nbdkit-ext2-filter.pod | 3 +-
tests/Makefile.am | 16 +++-
filters/ext2/ext2.c | 125 +++++++++++++++++++---------