X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/blobdiff_plain/dee660f2c4164dbe8862e0158494dbfe966b8c43..e328d3f22890be98db114267141c237217f372b1:/afs/_acl.pyx?ds=sidebyside diff --git a/afs/_acl.pyx b/afs/_acl.pyx index 5f0360b..bf1b1f9 100644 --- a/afs/_acl.pyx +++ b/afs/_acl.pyx @@ -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, @@ -16,12 +16,12 @@ cdef struct vcxstat2: afs_int32 anyAccess char mvstat -READ = PRSFS_READ -WRITE = PRSFS_WRITE -INSERT = PRSFS_INSERT -LOOKUP = PRSFS_LOOKUP -DELETE = PRSFS_DELETE -LOCK = PRSFS_LOCK +READ = PRSFS_READ +WRITE = PRSFS_WRITE +INSERT = PRSFS_INSERT +LOOKUP = PRSFS_LOOKUP +DELETE = PRSFS_DELETE +LOCK = PRSFS_LOCK ADMINISTER = PRSFS_ADMINISTER USR0 = PRSFS_USR0 USR1 = PRSFS_USR1 @@ -37,10 +37,12 @@ DEF MAXSIZE = 2048 def getAcl(char* dir, int follow=1): cdef char space[MAXSIZE] pioctl_read(dir, VIOCGETAL, space, MAXSIZE, follow) - ret = space # Python managed string - return ret + return space def getCallerAccess(char *dir, int follow=1): cdef vcxstat2 stat pioctl_read(dir, VIOC_GETVCXSTATUS2, &stat, sizeof(vcxstat2), follow) return stat.callerAccess + +def setAcl(char* dir, char* acl, int follow=1): + pioctl_write(dir, VIOCSETAL, acl, follow)