Displaying 20 results from an estimated 252 matches for "nbdkit_plugin".
2019 Aug 02
0
[nbdkit PATCH v2 10/17] plugins: Add .fork_safe field
...ons implied if
+C<.fork_safe> is not set.
The possible settings for C<THREAD_MODEL> are defined below.
diff --git a/include/nbdkit-plugin.h b/include/nbdkit-plugin.h
index 632df867..75e08651 100644
--- a/include/nbdkit-plugin.h
+++ b/include/nbdkit-plugin.h
@@ -132,6 +132,7 @@ struct nbdkit_plugin {
int (*cache) (void *handle, uint32_t count, uint64_t offset, uint32_t flags);
int (*thread_model) (void);
+ int fork_safe;
};
extern void nbdkit_set_error (int err);
diff --git a/plugins/curl/curl.c b/plugins/curl/curl.c
index 7e3e8c92..192bae4e 100644
--- a/plugins/curl/curl.c
+++ b/p...
2019 May 10
11
[nbdkit PATCH 0/9] RFC: implement NBD_CMD_CACHE
I'm still working my way through the filters before this series will
be complete, but this is enough of a start to at least get some
feedback on the idea of implementing another NBD protocol extension.
Eric Blake (9):
server: Internal hooks for implementing NBD_CMD_CACHE
plugins: Add .cache callback
file, split: Implement .cache with posix_fadvise
nbd: Implement NBD_CMD_CACHE
2019 Jan 05
0
[PATCH nbdkit v2 06/11] plugins: Return NBD_FLAG_CAN_MULTI_CONN from some readonly plugins.
...;floppy.regions);
}
+/* Serves the same data over multiple connections. */
+static int
+floppy_can_multi_conn (void *handle)
+{
+ return 1;
+}
+
/* Read data from the file. */
static int
floppy_pread (void *handle, void *buf, uint32_t count, uint64_t offset)
@@ -192,6 +199,7 @@ static struct nbdkit_plugin plugin = {
.magic_config_key = "dir",
.open = floppy_open,
.get_size = floppy_get_size,
+ .can_multi_conn = floppy_can_multi_conn,
.pread = floppy_pread,
.errno_is_preserved = 1,
};
diff --git a/plugins/iso/iso.c b/plugins/iso/iso.c
i...
2017 Feb 06
3
[PATCH nbdkit 0/2] Change .errno_is_reliable function to .errno_is_preserved constant.
See patch 1 for rationale.
2019 Mar 20
0
[PATCH nbdkit 6/8] data, memory: Implement extents.
...ta_extents (void *handle, uint32_t count, uint64_t offset,
+ uint32_t flags, struct nbdkit_extents *extents)
+{
+ int r;
+
+ pthread_mutex_lock (&lock);
+ r = sparse_array_extents (sa, count, offset, extents);
+ pthread_mutex_unlock (&lock);
+ return r;
+}
+
static struct nbdkit_plugin plugin = {
.name = "data",
.version = PACKAGE_VERSION,
@@ -394,6 +407,7 @@ static struct nbdkit_plugin plugin = {
.pwrite = data_pwrite,
.zero = data_zero,
.trim = data_trim,
+ .extents = data_extents,...
2018 Mar 08
0
[nbdkit PATCH v3 15/15] RFC: plugins: Add back-compat for new plugin with old nbdkit
...nsertions(+), 22 deletions(-)
diff --git a/docs/nbdkit-plugin.pod b/docs/nbdkit-plugin.pod
index 933f710..a82ced8 100644
--- a/docs/nbdkit-plugin.pod
+++ b/docs/nbdkit-plugin.pod
@@ -6,7 +6,7 @@ nbdkit-plugin - How to write nbdkit plugins
=head1 SYNOPSIS
- #define NBDKIT_API_VERSION 2
+ #define NBDKIT_PLUGIN_LEVEL 2
#include <nbdkit-plugin.h>
@@ -65,22 +65,22 @@ L<nbdkit-perl-plugin(3)>,
L<nbdkit-python-plugin(3)>,
L<nbdkit-ruby-plugin(3)>.
-=head1 C<#define NBDKIT_API_VERSION 2>
+=head1 C<#define NBDKIT_PLUGIN_LEVEL 2>
Plugins must choose which API vers...
2020 Feb 25
6
[PATCH nbdkit 0/5] server: Add .get_ready callback.
I like this change. I think we were overloading the config_complete
method before to do two different things (complete configuration; do
any allocation/housekeeping necessary before we can start serving).
The only questions in my mind are whether we want this before 1.18,
and whether the name ("get_ready") is a good one.
Rich.
2019 Jan 05
15
[PATCH nbdkit v2 01/11] server: Implement NBD_FLAG_CAN_MULTI_CONN.
For existing commits, this is almost identical to v1, except that I
updated some commit messages and reordered the commits in a somewhat
more logical sequence.
The main changes are the extra commits:
[06/11] plugins: Return NBD_FLAG_CAN_MULTI_CONN from some readonly plugins.
- Readonly plugins that can set the flag unconditionally.
[09/11] partitioning: Return NBD_FLAG_CAN_MULTI_CONN.
[10/11]
2018 Jan 31
1
[nbdkit PATCH] file: Add trim support
...!= EIO) {
+ nbdkit_debug ("ignoring failed fallocate during trim: %m");
+ r = 0;
+ }
+ else
+ nbdkit_error ("fallocate: %m");
+ }
+#else
+ /* Based on .can_trim, this should not be reached. */
+ errno = EOPNOTSUPP;
+#endif
+ return r;
+}
+
static struct nbdkit_plugin plugin = {
.name = "file",
.longname = "nbdkit file plugin",
@@ -279,10 +318,12 @@ static struct nbdkit_plugin plugin = {
.open = file_open,
.close = file_close,
.get_size = file_get_size,
+ .can_trim...
2019 Jan 18
1
Re: [PATCH nbdkit 2/2] tests: Test that public headers are ANSI (ISO C90) compatible.
...;re compiling with -pedantic, so we _are_
lol
> + * strictly speaking), ANSI C did not allow struct initialization
> + * using labels. However it was a common extension to C compilers of
> + * the period.
> + *
> + * Therefore we rely here on the order of fields in struct
> + * nbdkit_plugin. But that's OK because of nbdkit's stable ABI
> + * guarantee.
> + *
> + * If you are really writing an nbdkit plugin which can only use C90
> + * then you are advised to find the extension to your compiler which
> + * allows you to initialize named fields.
> + */
> +s...
2018 Jan 16
0
[PATCH nbdkit 2/3] Refactor plugin_* functions into a backend struct.
...ree (void *ptr);
#define CLEANUP_FREE __attribute__((cleanup (cleanup_free)))
@@ -142,28 +144,31 @@ extern int crypto_negotiate_tls (struct connection *conn, int sockin, int sockou
#define debug nbdkit_debug
/* plugins.c */
-extern void plugin_register (const char *_filename, void *_dl, struct nbdkit_plugin *(*plugin_init) (void));
-extern void plugin_cleanup (void);
-extern int plugin_thread_model (void);
-extern const char *plugin_name (void);
-extern void plugin_usage (void);
-extern const char *plugin_version (void);
-extern void plugin_dump_fields (void);
-extern void plugin_config (const char *k...
2018 Jan 16
6
[PATCH nbdkit 0/3] Refactor plugin_* functions into a backend struct.
Somewhat invasive but mostly mechanical change to how plugins are
called. This patch is in preparation for adding a second backend
subtype for filters.
Rich.
2017 Jan 27
0
[nbdkit PATCH v3 1/4] plugins: Don't use bogus errno from non-C plugins
...in.h
@@ -1,5 +1,5 @@
/* nbdkit
- * Copyright (C) 2013-2016 Red Hat Inc.
+ * Copyright (C) 2013-2017 Red Hat Inc.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -47,10 +47,19 @@
#define NBDKIT_API_VERSION 1
struct nbdkit_plugin {
+ /* Do not set these fields directly; use NBDKIT_REGISTER_PLUGIN.
+ * They exist so that we can support plugins compiled against
+ * one version of the header with a runtime compiled against a
+ * different version with more (or fewer) fields.
+ */
uint64_t _struct_size;
int _api_...
2018 Jan 17
0
[PATCH 2/9] Refactor plugin_* functions into a backend struct.
...ree (void *ptr);
#define CLEANUP_FREE __attribute__((cleanup (cleanup_free)))
@@ -142,28 +150,31 @@ extern int crypto_negotiate_tls (struct connection *conn, int sockin, int sockou
#define debug nbdkit_debug
/* plugins.c */
-extern void plugin_register (const char *_filename, void *_dl, struct nbdkit_plugin *(*plugin_init) (void));
-extern void plugin_cleanup (void);
-extern int plugin_thread_model (void);
-extern const char *plugin_name (void);
-extern void plugin_usage (void);
-extern const char *plugin_version (void);
-extern void plugin_dump_fields (void);
-extern void plugin_config (const char *k...
2018 Jan 16
0
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend struct.
...ree (void *ptr);
#define CLEANUP_FREE __attribute__((cleanup (cleanup_free)))
@@ -142,28 +150,31 @@ extern int crypto_negotiate_tls (struct connection *conn, int sockin, int sockou
#define debug nbdkit_debug
/* plugins.c */
-extern void plugin_register (const char *_filename, void *_dl, struct nbdkit_plugin *(*plugin_init) (void));
-extern void plugin_cleanup (void);
-extern int plugin_thread_model (void);
-extern const char *plugin_name (void);
-extern void plugin_usage (void);
-extern const char *plugin_version (void);
-extern void plugin_dump_fields (void);
-extern void plugin_config (const char *k...
2017 Feb 01
1
[PATCH nbdkit v3] Really fix C++ support in the <nbdkit-plugin.h>
This version uses a static initializer function
(https://bugzilla.redhat.com/show_bug.cgi?id=1418328#c9).
Rich.
2017 Feb 06
0
[PATCH 1/2] Define .errno_is_preserved constant instead of a .errno_is_reliable callback.
...s in other languages.
-
=head2 C<.pread>
int pread (void *handle, void *buf, uint32_t count, uint64_t offset);
diff --git a/include/nbdkit-plugin.h b/include/nbdkit-plugin.h
index 568aaf5..95cba8d 100644
--- a/include/nbdkit-plugin.h
+++ b/include/nbdkit-plugin.h
@@ -92,7 +92,7 @@ struct nbdkit_plugin {
int (*trim) (void *handle, uint32_t count, uint64_t offset);
int (*zero) (void *handle, uint32_t count, uint64_t offset, int may_trim);
- int (*errno_is_reliable) (void *handle);
+ int errno_is_preserved;
/* int (*set_exportname) (void *handle, const char *exportname); */
};
diff...
2019 Aug 02
23
[nbdkit PATCH v2 00/17] fd leak safety
This is a major rewrite compared to my v1 series, where I've tried
a lot harder to ensure that we still accommodate building on Haiku
(although I have not actually yet fired up a Haiku VM to try it
for myself). I also managed to make the sh plugin fully parallel,
on capable platforms.
See also my question on patch 10 on whether I've picked the best
naming convention.
Eric Blake (17):
2019 Mar 28
0
[PATCH nbdkit v5 FINAL 14/19] data, memory: Implement extents.
...ta_extents (void *handle, uint32_t count, uint64_t offset,
+ uint32_t flags, struct nbdkit_extents *extents)
+{
+ int r;
+
+ pthread_mutex_lock (&lock);
+ r = sparse_array_extents (sa, count, offset, extents);
+ pthread_mutex_unlock (&lock);
+ return r;
+}
+
static struct nbdkit_plugin plugin = {
.name = "data",
.version = PACKAGE_VERSION,
@@ -394,6 +407,7 @@ static struct nbdkit_plugin plugin = {
.pwrite = data_pwrite,
.zero = data_zero,
.trim = data_trim,
+ .extents = data_extents,...
2018 Jan 16
4
[PATCH nbdkit v2 2/3] Refactor plugin_* functions into a backend
v1 -> v2:
- Fixed everything mentioned in the review.
Rich.