Add a simple afs._fs module that exposes a whichcell function, and an
[invirt/packages/python-afs.git] / afs / _fs.pyx
diff --git a/afs/_fs.pyx b/afs/_fs.pyx
new file mode 100644 (file)
index 0000000..75653e2
--- /dev/null
@@ -0,0 +1,9 @@
+from afs cimport *
+from afs import pyafs_error
+
+def whichcell(char* path):
+    """Determine which AFS cell a particular path is in."""
+    cdef char cell[MAXCELLCHARS]
+
+    pioctl_read(path, VIOC_FILE_CELL_NAME, cell, sizeof(cell), 1)
+    return cell