|
|
efa7a1 |
From 17721b316dd66b0a1ed792eeccd2489fb97828df Mon Sep 17 00:00:00 2001
|
|
|
efa7a1 |
From: "Richard W.M. Jones" <rjones@redhat.com>
|
|
|
efa7a1 |
Date: Thu, 21 Nov 2019 16:42:59 +0000
|
|
|
60545c |
Subject: [PATCH 07/19] python: Implement can_zero, can_fast_zero.
|
|
|
efa7a1 |
|
|
|
efa7a1 |
(cherry picked from commit 039f600d2ad7a9ff04523a165eb2fe41b9c87c01)
|
|
|
efa7a1 |
---
|
|
|
efa7a1 |
plugins/python/nbdkit-python-plugin.pod | 16 ++++++++++++++--
|
|
|
efa7a1 |
plugins/python/python.c | 14 ++++++++++++++
|
|
|
efa7a1 |
2 files changed, 28 insertions(+), 2 deletions(-)
|
|
|
efa7a1 |
|
|
|
efa7a1 |
diff --git a/plugins/python/nbdkit-python-plugin.pod b/plugins/python/nbdkit-python-plugin.pod
|
|
|
60545c |
index 0ea8deef..1f1c30f6 100644
|
|
|
efa7a1 |
--- a/plugins/python/nbdkit-python-plugin.pod
|
|
|
efa7a1 |
+++ b/plugins/python/nbdkit-python-plugin.pod
|
|
|
efa7a1 |
@@ -208,6 +208,20 @@ contents will be garbage collected.
|
|
|
efa7a1 |
def can_trim(h):
|
|
|
efa7a1 |
# return a boolean
|
|
|
efa7a1 |
|
|
|
efa7a1 |
+=item C<can_zero>
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
+(Optional)
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
+ def can_zero(h):
|
|
|
efa7a1 |
+ # return a boolean
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
+=item C<can_fast_zero>
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
+(Optional)
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
+ def can_fast_zero(h):
|
|
|
efa7a1 |
+ # return a boolean
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
=item C<pread>
|
|
|
efa7a1 |
|
|
|
efa7a1 |
(Required)
|
|
|
efa7a1 |
@@ -326,8 +340,6 @@ C<config_help>,
|
|
|
efa7a1 |
C<magic_config_key>,
|
|
|
efa7a1 |
C<can_fua>,
|
|
|
efa7a1 |
C<can_cache>,
|
|
|
efa7a1 |
-C<can_zero>,
|
|
|
efa7a1 |
-C<can_fast_zero>,
|
|
|
efa7a1 |
C<can_extents>,
|
|
|
efa7a1 |
C<can_multi_conn>,
|
|
|
efa7a1 |
C<extents>.
|
|
|
efa7a1 |
diff --git a/plugins/python/python.c b/plugins/python/python.c
|
|
|
60545c |
index c5cf38e5..38fc1193 100644
|
|
|
efa7a1 |
--- a/plugins/python/python.c
|
|
|
efa7a1 |
+++ b/plugins/python/python.c
|
|
|
efa7a1 |
@@ -797,6 +797,18 @@ py_can_trim (void *handle)
|
|
|
efa7a1 |
return boolean_callback (handle, "can_trim", "trim");
|
|
|
efa7a1 |
}
|
|
|
efa7a1 |
|
|
|
efa7a1 |
+static int
|
|
|
efa7a1 |
+py_can_zero (void *handle)
|
|
|
efa7a1 |
+{
|
|
|
efa7a1 |
+ return boolean_callback (handle, "can_zero", "zero");
|
|
|
efa7a1 |
+}
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
+static int
|
|
|
efa7a1 |
+py_can_fast_zero (void *handle)
|
|
|
efa7a1 |
+{
|
|
|
efa7a1 |
+ return boolean_callback (handle, "can_fast_zero", NULL);
|
|
|
efa7a1 |
+}
|
|
|
efa7a1 |
+
|
|
|
efa7a1 |
#define py_config_help \
|
|
|
efa7a1 |
"script=<FILENAME> (required) The Python plugin to run.\n" \
|
|
|
efa7a1 |
"[other arguments may be used by the plugin that you load]"
|
|
|
efa7a1 |
@@ -823,6 +835,8 @@ static struct nbdkit_plugin plugin = {
|
|
|
efa7a1 |
.can_write = py_can_write,
|
|
|
efa7a1 |
.can_flush = py_can_flush,
|
|
|
efa7a1 |
.can_trim = py_can_trim,
|
|
|
efa7a1 |
+ .can_zero = py_can_zero,
|
|
|
efa7a1 |
+ .can_fast_zero = py_can_fast_zero,
|
|
|
efa7a1 |
|
|
|
efa7a1 |
.pread = py_pread,
|
|
|
efa7a1 |
.pwrite = py_pwrite,
|
|
|
efa7a1 |
--
|
|
|
efa7a1 |
2.18.2
|
|
|
efa7a1 |
|