[PATCH 10/14] pytdb: Add support for tdb_fd()
Kirill Smelkov
kirr at landau.phys.spbu.ru
Sun Sep 19 03:53:28 MDT 2010
Cc: 597386 at bugs.debian.org
Signed-off-by: Kirill Smelkov <kirr at landau.phys.spbu.ru>
---
lib/tdb/pytdb.c | 7 +++++++
lib/tdb/python/tests/simple.py | 3 +++
2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/lib/tdb/pytdb.c b/lib/tdb/pytdb.c
index 25aefb0..27fcdab 100644
--- a/lib/tdb/pytdb.c
+++ b/lib/tdb/pytdb.c
@@ -532,6 +532,12 @@ static PyObject *obj_get_seqnum(PyTdbObject *self, void *closure)
return PyInt_FromLong(tdb_get_seqnum(self->ctx));
}
+static PyObject *obj_get_fd(PyTdbObject *self, void *closure)
+{
+ int fd = tdb_fd(self->ctx);
+ return PyInt_FromLong(fd);
+}
+
static PyGetSetDef tdb_object_getsetters[] = {
{ (char *)"hash_size", (getter)obj_get_hash_size, NULL, NULL },
@@ -540,6 +546,7 @@ static PyGetSetDef tdb_object_getsetters[] = {
{ (char *)"max_dead", NULL, (setter)obj_set_max_dead, NULL },
{ (char *)"filename", (getter)obj_get_filename, NULL, (char *)"The filename of this TDB file."},
{ (char *)"seqnum", (getter)obj_get_seqnum, NULL, NULL },
+ { (char *)"fd", (getter)obj_get_fd, NULL, NULL },
{ NULL }
};
diff --git a/lib/tdb/python/tests/simple.py b/lib/tdb/python/tests/simple.py
index c47c9e0..1a32e7a 100644
--- a/lib/tdb/python/tests/simple.py
+++ b/lib/tdb/python/tests/simple.py
@@ -177,6 +177,9 @@ class SimpleTdbTests(TestCase):
seq2 = self.tdb.seqnum
self.assertEquals(seq2-seq1, 1)
+ def test_fd(self):
+ self.assertTrue(self.tdb.fd > 0)
+
def test_len(self):
self.assertEquals(0, len(list(self.tdb)))
--
1.7.3.rc2
More information about the samba-technical
mailing list