[PATCH 11/14] pytdb: Add support for tdb_freelist_size()

Kirill Smelkov kirr at landau.phys.spbu.ru
Sun Sep 19 03:53:29 MDT 2010


Cc: 597386 at bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr at landau.phys.spbu.ru>
---
 lib/tdb/pytdb.c                |    6 ++++++
 lib/tdb/python/tests/simple.py |    3 +++
 2 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index 27fcdab..e61391c 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -517,6 +517,11 @@ static PyObject *obj_get_map_size(PyTdbObject *self, void *closure)
 	return PyInt_FromLong(tdb_map_size(self->ctx));
 }
 
+static PyObject *obj_get_freelist_size(PyTdbObject *self, void *closure)
+{
+	return PyInt_FromLong(tdb_freelist_size(self->ctx));
+}
+
 static PyObject *obj_get_flags(PyTdbObject *self, void *closure)
 {
 	return PyInt_FromLong(tdb_get_flags(self->ctx));
@@ -542,6 +547,7 @@ static PyObject *obj_get_fd(PyTdbObject *self, void *closure)
 static PyGetSetDef tdb_object_getsetters[] = {
 	{ (char *)"hash_size", (getter)obj_get_hash_size, NULL, NULL },
 	{ (char *)"map_size", (getter)obj_get_map_size, NULL, NULL },
+	{ (char *)"freelist_size", (getter)obj_get_freelist_size, NULL, NULL },
 	{ (char *)"flags", (getter)obj_get_flags, NULL, NULL },
 	{ (char *)"max_dead", NULL, (setter)obj_set_max_dead, NULL },
 	{ (char *)"filename", (getter)obj_get_filename, NULL, (char *)"The filename of this TDB file."},
diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py
index 1a32e7a..acc9d66 100644
--- a/lib/tdb/python/tests/simple.py
+++ b/lib/tdb/python/tests/simple.py
@@ -122,6 +122,9 @@ class SimpleTdbTests(TestCase):
     def test_map_size(self):
         self.tdb.map_size
 
+    def test_freelist_size(self):
+        self.tdb.freelist_size
+
     def test_name(self):
         self.tdb.filename
 
-- 
1.7.3.rc2


More information about the samba-technical mailing list