Rename afs.afs to afs._util so that absolute imports from afs work.
[invirt/packages/python-afs.git] / afs / _acl.pyx
index ef65388..bf1b1f9 100644 (file)
@@ -1,7 +1,7 @@
-from afs cimport *
-from afs import pyafs_error
+from afs._util cimport *
+from afs._util import pyafs_error
 
 
-cdef import from "afs/prs_fs.h":
+cdef extern from "afs/prs_fs.h":
     enum:
         PRSFS_READ, PRSFS_WRITE, PRSFS_INSERT, PRSFS_LOOKUP,
         PRSFS_DELETE, PRSFS_LOCK, PRSFS_ADMINISTER,
     enum:
         PRSFS_READ, PRSFS_WRITE, PRSFS_INSERT, PRSFS_LOOKUP,
         PRSFS_DELETE, PRSFS_LOCK, PRSFS_ADMINISTER,
@@ -43,3 +43,6 @@ def getCallerAccess(char *dir, int follow=1):
     cdef vcxstat2 stat
     pioctl_read(dir, VIOC_GETVCXSTATUS2, <void*>&stat, sizeof(vcxstat2), follow)
     return stat.callerAccess
     cdef vcxstat2 stat
     pioctl_read(dir, VIOC_GETVCXSTATUS2, <void*>&stat, sizeof(vcxstat2), follow)
     return stat.callerAccess
+
+def setAcl(char* dir, char* acl, int follow=1):
+    pioctl_write(dir, VIOCSETAL, acl, follow)