These are accessible from the plugin by:
import nbdkit
if flags & nbdkit.FLAG_MAY_TRIM:
&c.
Many (all?) of these are not yet useful for plugins, some will never
be useful, but they only consume a tiny bit of memory and it's nice to
have the complete set available for future use.
---
plugins/python/python.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/plugins/python/python.c b/plugins/python/python.c
index d65ac45..69cf4e9 100644
--- a/plugins/python/python.c
+++ b/plugins/python/python.c
@@ -231,6 +231,33 @@ create_nbdkit_module (void)
nbdkit_error ("could not create the nbdkit API module");
exit (EXIT_FAILURE);
}
+
+ /* Constants corresponding to various flags. */
+ PyModule_AddIntConstant (m, "THREAD_MODEL_SERIALIZE_CONNECTIONS",
+ NBDKIT_THREAD_MODEL_SERIALIZE_CONNECTIONS);
+ PyModule_AddIntConstant (m, "THREAD_MODEL_SERIALIZE_ALL_REQUESTS",
+ NBDKIT_THREAD_MODEL_SERIALIZE_ALL_REQUESTS);
+ PyModule_AddIntConstant (m, "THREAD_MODEL_SERIALIZE_REQUESTS",
+ NBDKIT_THREAD_MODEL_SERIALIZE_REQUESTS);
+ PyModule_AddIntConstant (m, "THREAD_MODEL_PARALLEL",
+ NBDKIT_THREAD_MODEL_PARALLEL);
+
+ PyModule_AddIntConstant (m, "FLAG_MAY_TRIM", NBDKIT_FLAG_MAY_TRIM);
+ PyModule_AddIntConstant (m, "FLAG_FUA", NBDKIT_FLAG_FUA);
+ PyModule_AddIntConstant (m, "FLAG_REQ_ONE", NBDKIT_FLAG_REQ_ONE);
+ PyModule_AddIntConstant (m, "FLAG_FAST_ZERO", NBDKIT_FLAG_FAST_ZERO);
+
+ PyModule_AddIntConstant (m, "FUA_NONE", NBDKIT_FUA_NONE);
+ PyModule_AddIntConstant (m, "FUA_EMULATE", NBDKIT_FUA_EMULATE);
+ PyModule_AddIntConstant (m, "FUA_NATIVE", NBDKIT_FUA_NATIVE);
+
+ PyModule_AddIntConstant (m, "CACHE_NONE", NBDKIT_CACHE_NONE);
+ PyModule_AddIntConstant (m, "CACHE_EMULATE", NBDKIT_CACHE_EMULATE);
+ PyModule_AddIntConstant (m, "CACHE_NATIVE", NBDKIT_CACHE_NATIVE);
+
+ PyModule_AddIntConstant (m, "EXTENT_HOLE", NBDKIT_EXTENT_HOLE);
+ PyModule_AddIntConstant (m, "EXTENT_ZERO", NBDKIT_EXTENT_ZERO);
+
return m;
}
--
2.23.0