2 cdll.LoadLibrary("./libyaffsfs.so")
3 ylib = CDLL("./libyaffsfs.so")
5 #int yaffs_open(const YCHAR *path, int oflag, int mode) ;
6 yaffs_open = ylib.yaffs_open
7 yaffs_open.argtypes = [ c_char_p, c_int, c_int]
8 yaffs_open.restype = c_int
10 #int yaffs_close(int fd) ;
11 yaffs_close = ylib.yaffs_close
12 yaffs_close.argtypes = [ c_int]
13 yaffs_close.restype = c_int
15 #int yaffs_fsync(int fd) ;
16 yaffs_fsync = ylib.yaffs_fsync
17 yaffs_fsync.argtypes = [c_int]
18 yaffs_fsync.restype = c_int
20 #int yaffs_fdatasync(int fd) ;
21 yaffs_fdatasync = ylib.yaffs_fdatasync
22 yaffs_fdatasync.argtypes = [c_int]
23 yaffs_fdatasync.restype = c_int
25 #int yaffs_flush(int fd) ; /* same as yaffs_fsync() */
26 yaffs_flush = ylib.yaffs_flush
27 yaffs_flush.argtypes = [c_int]
28 yaffs_flush.restype = c_int
30 #int yaffs_access(const YCHAR *path, int amode);
31 yaffs_access=ylib.yaffs_access
32 yaffs_access.argtypes= [c_char_p,c_int]
33 yaffs_access.restype = c_int
35 #int yaffs_dup(int fd);
36 yaffs_dup = ylib.yaffs_dup
37 yaffs_dup.argtypes = [c_int]
38 yaffs_dup.restype = c_int
40 #int yaffs_read(int fd, void *buf, unsigned int nbyte) ;
41 yaffs_read=ylib.yaffs_read
42 yaffs_read.argtypes=[c_int,c_char_p,c_int]
43 yaffs_read.restype = c_int
45 #int yaffs_write(int fd, const void *buf, unsigned int nbyte) ;
46 yaffs_write=ylib.yaffs_write
47 yaffs_write.argtypes=[c_int,c_char_p,c_int]
48 yaffs_write.restype = c_int
50 #int yaffs_pread(int fd, void *buf, unsigned int nbyte, unsigned int offset);
51 yaffs_pread=ylib.yaffs_pread
52 yaffs_pread.argtypes=[c_int,c_char_p,c_int,c_int]
53 yaffs_pread.restype = c_int
55 #int yaffs_pwrite(int fd, const void *buf, unsigned int nbyte, unsigned int offset);
56 yaffs_pwrite=ylib.yaffs_pwrite
57 yaffs_pwrite.argtypes=[c_int,c_char_p,c_int,c_int]
58 yaffs_pwrite.restype = c_int
61 #off_t yaffs_lseek(int fd, off_t offset, int whence) ;
62 yaffs_lseek=ylib.yaffs_lseek
63 yaffs_lseek.argtypes= [c_int, c_int, c_int]
64 yaffs_lseek.restype= c_int
66 #int yaffs_truncate(const YCHAR *path, off_t newSize);
67 yaffs_truncate=ylib.yaffs_truncate
68 yaffs_truncate.argtypes = [c_char_p,c_int]
69 yaffs_truncate.restype = c_int
71 #int yaffs_ftruncate(int fd, off_t newSize);
72 yaffs_ftruncate = ylib.yaffs_ftruncate
73 yaffs_truncate.argtypes = [c_int,c_int]
74 yaffs_truncate.restype = c_int
76 #int yaffs_unlink(const YCHAR *path) ;
77 yaffs_unlink=ylib.yaffs_unlink
78 yaffs_unlink.argtypes = [c_char_p]
79 yaffs_unlink.restype = c_int
81 #int yaffs_rename(const YCHAR *oldPath, const YCHAR *newPath) ;
82 yaffs_rename= ylib.yaffs_rename
83 yaffs_rename.argtypes=[c_char_p, c_char_p]
84 yaffs_rename.restype = c_int
86 class yaffs_stat_struct(Structure):
96 ("st_blksize", c_int),
100 ("yst_ctime", c_int)]
102 #int yaffs_stat(const YCHAR *path, struct yaffs_stat *buf) ;
103 yaffs_stat = ylib.yaffs_stat
104 yaffs_stat.argtypes=[c_char_p,POINTER(yaffs_stat_struct)]
105 yaffs_stat.restype=c_int
107 #int yaffs_lstat(const YCHAR *path, struct yaffs_stat *buf) ;
108 yaffs_lstat = ylib.yaffs_lstat
109 yaffs_lstat.argtypes=[c_char_p,POINTER(yaffs_stat_struct)]
110 yaffs_lstat.restype=c_int
112 #int yaffs_fstat(int fd, struct yaffs_stat *buf) ;
113 yaffs_fstat = ylib.yaffs_fstat
114 yaffs_fstat.argtypes=[c_int,POINTER(yaffs_stat_struct)]
115 yaffs_fstat.restype=c_int
118 #int yaffs_chmod(const YCHAR *path, mode_t mode);
119 yaffs_chmod = ylib.yaffs_chmod
120 yaffs_chmod.argtypes = [c_char_p, c_int]
121 yaffs_chmod.restype = c_int
123 #int yaffs_fchmod(int fd, mode_t mode);
124 yaffs_fchmod = ylib.yaffs_fchmod
125 yaffs_fchmod.argtypes = [c_int, c_int]
126 yaffs_fchmod.restype = c_int
128 #int yaffs_mkdir(const YCHAR *path, mode_t mode) ;
129 yaffs_mkdir = ylib.yaffs_mkdir
130 yaffs_mkdir.argtypes = [c_char_p, c_int]
131 yaffs_mkdir.restype = c_int
133 #int yaffs_rmdir(const YCHAR *path) ;
134 yaffs_rmdir = ylib.yaffs_rmdir
135 yaffs_rmdir.argtypes = [c_char_p]
136 yaffs_rmdir.restype = c_int
138 class yaffs_dirent_struct(Structure):
142 ("d_reclen", c_short),
144 ("d_name", c_char * 257),
145 ("d_dont_use", c_int)]
147 #yaffs_DIR *yaffs_opendir(const YCHAR *dirname) ;
148 yaffs_opendir = ylib.yaffs_opendir
149 yaffs_opendir.argtypes = [c_char_p]
150 yaffs_opendir.restype = c_int
152 #struct yaffs_dirent *yaffs_readdir(yaffs_DIR *dirp) ;
153 yaffs_readdir= ylib.yaffs_readdir
154 yaffs_readdir.argtypes=[c_int]
155 yaffs_readdir.restype=POINTER(yaffs_dirent_struct)
157 #void yaffs_rewinddir(yaffs_DIR *dirp) ;
158 yaffs_rewinddir = ylib.yaffs_rewinddir
159 yaffs_rewinddir.argtypes = [c_int]
160 yaffs_rewinddir.restype = c_int ###### Should be void
162 #int yaffs_closedir(yaffs_DIR *dirp) ;
163 yaffs_closedir = ylib.yaffs_closedir
164 yaffs_closedir.argtypes = [c_int]
165 yaffs_closedir.restype = c_int
168 #int yaffs_mount(const YCHAR *path) ;
169 yaffs_mount = ylib.yaffs_mount
170 yaffs_mount.argtypes = [c_char_p]
171 yaffs_mount.restype = c_int
173 #int yaffs_mount2(const YCHAR *path,int readOnly) ;
174 yaffs_mount2 = ylib.yaffs_mount2
175 yaffs_mount2.argtypes = [c_char_p, c_int]
176 yaffs_mount2.restype = c_int
178 #int yaffs_unmount(const YCHAR *path) ;
179 yaffs_unmount = ylib.yaffs_unmount
180 yaffs_unmount.argtypes = [c_char_p]
181 yaffs_unmount.restype = c_int
183 #int yaffs_unmount(const YCHAR *path, int force) ;
184 yaffs_unmount2 = ylib.yaffs_unmount2
185 yaffs_unmount2.argtypes = [c_char_p, c_int]
186 yaffs_unmount2.restype = c_int
188 #int yaffs_remount(const YCHAR *path, int force, int readOnly) ;
189 yaffs_remount = ylib.yaffs_remount
190 yaffs_remount.argtypes = [c_char_p, c_int, c_int]
191 yaffs_remount.restype = c_int
193 #int yaffs_sync(const YCHAR *path) ;
194 yaffs_sync = ylib.yaffs_sync
195 yaffs_sync.argtypes = [c_char_p]
196 yaffs_sync.restype = c_int
198 #int yaffs_symlink(const YCHAR *oldpath, const YCHAR *newpath);
199 yaffs_symlink= ylib.yaffs_symlink
200 yaffs_symlink.argtypes= [c_char_p, c_char_p]
201 yaffs_symlink.restype = c_int
203 #int yaffs_readlink(const YCHAR *path, YCHAR *buf, int bufsiz);
204 yaffs_readlink = ylib.yaffs_readlink
205 yaffs_readlink.argtypes = [c_char_p, c_char_p, c_int]
206 yaffs_readlink.restype = c_int
208 #int yaffs_link(const YCHAR *oldpath, const YCHAR *newpath);
209 yaffs_link = ylib.yaffs_link
210 yaffs_link.argtypes = [c_char_p, c_char_p]
211 yaffs_link.restype = c_int
213 #int yaffs_mknod(const YCHAR *pathname, mode_t mode, dev_t dev);
214 yaffs_mknod = ylib.yaffs_mknod
215 yaffs_mknod.argtypes = [c_char_p, c_int, c_int]
216 yaffs_mknod.restype = c_int
218 #loff_t yaffs_freespace(const YCHAR *path);
219 yaffs_freespace = ylib.yaffs_freespace
220 yaffs_freespace.argtypes = [c_char_p]
221 yaffs_freespace.restype = c_longlong
223 #loff_t yaffs_totalspace(const YCHAR *path);
224 yaffs_totalspace = ylib.yaffs_totalspace
225 yaffs_totalspace.argtypes = [c_char_p]
226 yaffs_totalspace.restype = c_longlong
228 #int yaffs_inodecount(const YCHAR *path);
229 yaffs_inodecount = ylib.yaffs_inodecount
230 yaffs_inodecount.argtypes = [c_char_p]
231 yaffs_inodecount.restype = c_int
233 #int yaffs_StartUp(void)
234 yaffs_StartUp = ylib.yaffs_StartUp
235 yaffs_StartUp.argtypes = []
236 yaffs_StartUp.restype = c_int