[27521] in Source-Commits

home help back first fref pref prev next nref lref last post

python-afs commit: Add a low-level lsmount function and export it

daemon@ATHENA.MIT.EDU (Jonathan D Reed)
Tue Nov 12 18:27:54 2013

Date: Tue, 12 Nov 2013 18:27:47 -0500
From: Jonathan D Reed <jdreed@MIT.EDU>
Message-Id: <201311122327.rACNRlSa018620@drugstore.mit.edu>
To: source-commits@MIT.EDU

https://github.com/mit-athena/python-afs/commits/58d119d6f773dc119d54281966d249995cec7957
commit 58d119d6f773dc119d54281966d249995cec7957
Author: Jonathan Reed <jdreed@mit.edu>
Date:   Wed Oct 30 15:27:08 2013 -0400

    Add a low-level lsmount function and export it
    
    - Add a low-level function to implement "fs lsmount", and provide
      a docstring.
    - Import the necessary pioctl operation for it.
    - Add an __all__ attribute to _fs.pyx so we can import * sanely.

 afs/_fs.pyx   |   16 ++++++++++++++++
 afs/_util.pxd |    3 ++-
 2 files changed, 18 insertions(+), 1 deletions(-)

diff --git a/afs/_fs.pyx b/afs/_fs.pyx
index 57ac603..ff4dd00 100644
--- a/afs/_fs.pyx
+++ b/afs/_fs.pyx
@@ -1,9 +1,25 @@
 from afs._util cimport *
 from afs._util import pyafs_error
 
+__all__ = ['whichcell',
+           '_lsmount',
+           ]
+
 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
+
+def _lsmount(char* parent, char* path):
+    """
+    lsmount(parent, path) -> str
+
+    Given the parent directory, and a path, return the name of the
+    volume.  Raises OSError.
+    """
+    cdef char mtpt[AFS_PIOCTL_MAXSIZE]
+
+    pioctl_write(parent, VIOC_AFS_STAT_MT_PT, path, mtpt, 1)
+    return mtpt
diff --git a/afs/_util.pxd b/afs/_util.pxd
index 22f991e..c50b479 100644
--- a/afs/_util.pxd
+++ b/afs/_util.pxd
@@ -164,7 +164,8 @@ cdef extern from "afs/vice.h":
 cdef extern from "afs/venus.h":
     enum:
         # PIOCTLS to Venus that we use
-        VIOCGETAL, VIOC_GETVCXSTATUS2, VIOCSETAL, VIOC_FILE_CELL_NAME
+        VIOCGETAL, VIOC_GETVCXSTATUS2, VIOCSETAL, VIOC_FILE_CELL_NAME,
+        VIOC_AFS_STAT_MT_PT
 
 # pioctl doesn't actually have a header, so we have to define it here
 cdef extern int pioctl(char *, afs_int32, ViceIoctl *, afs_int32)

home help back first fref pref prev next nref lref last post