source: trunk/packages/python-afs/afs/_acl.pyx @ 2603

Last change on this file since 2603 was 2599, checked in by broder, 15 years ago

Import python-afs.

Debathena should eventually be importing PyAFS for
<http://debathena.mit.edu/trac/ticket/395>, so hopefully this is only
temporary.

File size: 1.3 KB
Line 
1from afs._util cimport *
2from afs._util import pyafs_error
3
4cdef extern from "afs/prs_fs.h":
5    enum:
6        PRSFS_READ, PRSFS_WRITE, PRSFS_INSERT, PRSFS_LOOKUP,
7        PRSFS_DELETE, PRSFS_LOCK, PRSFS_ADMINISTER,
8        PRSFS_USR0, PRSFS_USR1, PRSFS_USR2, PRSFS_USR2, PRSFS_USR3,
9        PRSFS_USR4, PRSFS_USR5, PRSFS_USR6, PRSFS_USR7
10
11# This is defined in afs/afs.h, but I can't figure how to include the
12# header. Also, venus/fs.c redefines the struct, so why not!
13cdef struct vcxstat2:
14    afs_int32 callerAccess
15    afs_int32 cbExpires
16    afs_int32 anyAccess
17    char mvstat
18
19READ = PRSFS_READ
20WRITE = PRSFS_WRITE
21INSERT = PRSFS_INSERT
22LOOKUP = PRSFS_LOOKUP
23DELETE = PRSFS_DELETE
24LOCK = PRSFS_LOCK
25ADMINISTER = PRSFS_ADMINISTER
26USR0 = PRSFS_USR0
27USR1 = PRSFS_USR1
28USR2 = PRSFS_USR2
29USR3 = PRSFS_USR3
30USR4 = PRSFS_USR4
31USR5 = PRSFS_USR5
32USR6 = PRSFS_USR6
33USR7 = PRSFS_USR7
34
35DEF MAXSIZE = 2048
36
37def getAcl(char* dir, int follow=1):
38    cdef char space[MAXSIZE]
39    pioctl_read(dir, VIOCGETAL, space, MAXSIZE, follow)
40    return space
41
42def getCallerAccess(char *dir, int follow=1):
43    cdef vcxstat2 stat
44    pioctl_read(dir, VIOC_GETVCXSTATUS2, <void*>&stat, sizeof(vcxstat2), follow)
45    return stat.callerAccess
46
47def setAcl(char* dir, char* acl, int follow=1):
48    pioctl_write(dir, VIOCSETAL, acl, follow)
Note: See TracBrowser for help on using the repository browser.