import sys
+# otherwise certain headers are unhappy
+cdef import from "netinet/in.h": pass
+cdef import from "afs/vice.h": pass
+
cdef int _init = 0
+# pioctl convenience wrappers
+
+cdef extern int pioctl_read(char *dir, afs_int32 op, void *buffer, unsigned short size, afs_int32 follow) except -1:
+ cdef ViceIoctl blob
+ cdef afs_int32 code
+ blob.in_size = 0
+ blob.out_size = size
+ blob.out = buffer
+ code = pioctl(dir, op, &blob, follow)
+ pyafs_error(code)
+ return code
+
+# Error handling
+
class AFSException(Exception):
def __init__(self, errno):
self.errno = errno