X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/python-afs.git/blobdiff_plain/0e6d75ba5dd3588ebdf323a12ae2e11ed71cd8eb..dee660f2c4164dbe8862e0158494dbfe966b8c43:/afs/_acl.pyx diff --git a/afs/_acl.pyx b/afs/_acl.pyx new file mode 100644 index 0000000..5f0360b --- /dev/null +++ b/afs/_acl.pyx @@ -0,0 +1,46 @@ +from afs cimport * +from afs import pyafs_error + +cdef import from "afs/prs_fs.h": + enum: + PRSFS_READ, PRSFS_WRITE, PRSFS_INSERT, PRSFS_LOOKUP, + PRSFS_DELETE, PRSFS_LOCK, PRSFS_ADMINISTER, + PRSFS_USR0, PRSFS_USR1, PRSFS_USR2, PRSFS_USR2, PRSFS_USR3, + PRSFS_USR4, PRSFS_USR5, PRSFS_USR6, PRSFS_USR7 + +# This is defined in afs/afs.h, but I can't figure how to include the +# header. Also, venus/fs.c redefines the struct, so why not! +cdef struct vcxstat2: + afs_int32 callerAccess + afs_int32 cbExpires + afs_int32 anyAccess + char mvstat + +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 +USR2 = PRSFS_USR2 +USR3 = PRSFS_USR3 +USR4 = PRSFS_USR4 +USR5 = PRSFS_USR5 +USR6 = PRSFS_USR6 +USR7 = PRSFS_USR7 + +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 + +def getCallerAccess(char *dir, int follow=1): + cdef vcxstat2 stat + pioctl_read(dir, VIOC_GETVCXSTATUS2, &stat, sizeof(vcxstat2), follow) + return stat.callerAccess