pytdb: Add support for tdb_freelist_size()
authorKirill Smelkov <kirr@landau.phys.spbu.ru>
Sun, 19 Sep 2010 09:53:29 +0000 (13:53 +0400)
committerRusty Russell <rusty@rustcorp.com.au>
Thu, 7 Oct 2010 04:41:26 +0000 (15:11 +1030)
Cc: 597386@bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr@landau.phys.spbu.ru>
Signed-off-by: Jelmer Vernooij <jelmer@samba.org>
lib/tdb/pytdb.c
lib/tdb/python/tests/simple.py

index e20c79a..2f0580f 100644 (file)
@@ -414,6 +414,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));
@@ -433,6 +438,7 @@ static PyObject *obj_get_seqnum(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."},
index 0dae96e..ea1ccd2 100644 (file)
@@ -89,6 +89,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