equal
deleted
inserted
replaced
1 from __future__ import absolute_import |
1 from __future__ import absolute_import |
2 |
2 |
3 import cffi |
3 import cffi |
4 |
4 |
5 ffi = cffi.FFI() |
5 ffi = cffi.FFI() |
6 ffi.set_source("mercurial.cffi._osutil", """ |
6 ffi.set_source( |
|
7 "mercurial.cffi._osutil", |
|
8 """ |
7 #include <sys/attr.h> |
9 #include <sys/attr.h> |
8 #include <sys/vnode.h> |
10 #include <sys/vnode.h> |
9 #include <unistd.h> |
11 #include <unistd.h> |
10 #include <fcntl.h> |
12 #include <fcntl.h> |
11 #include <time.h> |
13 #include <time.h> |
17 fsobj_type_t obj_type; |
19 fsobj_type_t obj_type; |
18 struct timespec mtime; |
20 struct timespec mtime; |
19 uint32_t accessmask; |
21 uint32_t accessmask; |
20 off_t datalength; |
22 off_t datalength; |
21 } __attribute__((aligned(4), packed)) val_attrs_t; |
23 } __attribute__((aligned(4), packed)) val_attrs_t; |
22 """, include_dirs=['mercurial']) |
24 """, |
23 ffi.cdef(''' |
25 include_dirs=['mercurial'], |
|
26 ) |
|
27 ffi.cdef( |
|
28 ''' |
24 |
29 |
25 typedef uint32_t attrgroup_t; |
30 typedef uint32_t attrgroup_t; |
26 |
31 |
27 typedef struct attrlist { |
32 typedef struct attrlist { |
28 uint16_t bitmapcount; /* number of attr. bit sets in list */ |
33 uint16_t bitmapcount; /* number of attr. bit sets in list */ |
94 |
99 |
95 int open(const char *path, int oflag, int perm); |
100 int open(const char *path, int oflag, int perm); |
96 int close(int); |
101 int close(int); |
97 |
102 |
98 #define O_RDONLY ... |
103 #define O_RDONLY ... |
99 ''') |
104 ''' |
|
105 ) |
100 |
106 |
101 if __name__ == '__main__': |
107 if __name__ == '__main__': |
102 ffi.compile() |
108 ffi.compile() |