Blame SOURCES/0007-python-Implement-can_zero-can_fast_zero.patch

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