Fix python wrapper pointer types
[yaffs2.git] / direct / python / yaffsfs.py
index 5ef7c76120a38e4ae00e549a8d1c1f03b735e01c..79b6adb24a0f4ebc1f937a1289a2bd847262f751 100644 (file)
@@ -1,7 +1,31 @@
+##
+## YAFFS: Yet Another Flash File System. A NAND-flash specific file system.
+##
+## Copyright (C) 2002-2010 Aleph One Ltd.
+##   for Toby Churchill Ltd and Brightstar Engineering
+##
+## Created by Charles Manning <charles@aleph1.co.uk>
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License version 2 as
+## published by the Free Software Foundation.
+##
+
 from ctypes import *
 cdll.LoadLibrary("./libyaffsfs.so")
 ylib = CDLL("./libyaffsfs.so")
 
+#const char * yaffs_error_to_str(int err);
+yaffs_error_to_str = ylib.yaffs_error_to_str
+yaffs_error_to_str.argtypes=[c_int]
+yaffs_error_to_str.restype=c_char_p
+
+
+#int yaffs_open_sharing(const YCHAR *path, int oflag, int mode, int sharingmode) ;
+yaffs_open_sharing = ylib.yaffs_open_sharing
+yaffs_open_sharing.argtypes = [ c_char_p, c_int, c_int, c_int]
+yaffs_open_sharing.restype = c_int
+
 #int yaffs_open(const YCHAR *path, int oflag, int mode) ;
 yaffs_open = ylib.yaffs_open
 yaffs_open.argtypes = [ c_char_p, c_int, c_int]
@@ -147,21 +171,21 @@ class yaffs_dirent_struct(Structure):
 #yaffs_DIR *yaffs_opendir(const YCHAR *dirname) ;
 yaffs_opendir = ylib.yaffs_opendir
 yaffs_opendir.argtypes = [c_char_p]
-yaffs_opendir.restype = c_int
+yaffs_opendir.restype = c_void_p
 
 #struct yaffs_dirent *yaffs_readdir(yaffs_DIR *dirp) ;
 yaffs_readdir= ylib.yaffs_readdir
-yaffs_readdir.argtypes=[c_int]
+yaffs_readdir.argtypes=[c_void_p]
 yaffs_readdir.restype=POINTER(yaffs_dirent_struct)
 
 #void yaffs_rewinddir(yaffs_DIR *dirp) ;
 yaffs_rewinddir = ylib.yaffs_rewinddir
-yaffs_rewinddir.argtypes = [c_int]
-yaffs_rewinddir.restype = c_int ###### Should be void
+yaffs_rewinddir.argtypes = [c_void_p]
+yaffs_rewinddir.restype = None # void
 
 #int yaffs_closedir(yaffs_DIR *dirp) ;
 yaffs_closedir = ylib.yaffs_closedir
-yaffs_closedir.argtypes = [c_int]
+yaffs_closedir.argtypes = [c_void_p]
 yaffs_closedir.restype = c_int
 
 
@@ -235,8 +259,40 @@ yaffs_n_handles = ylib.yaffs_n_handles
 yaffs_n_handles.argtypes = [c_char_p]
 yaffs_n_handles.restype = c_int
 
-#int yaffs_StartUp(void)
-yaffs_StartUp = ylib.yaffs_StartUp
-yaffs_StartUp.argtypes = []
-yaffs_StartUp.restype = c_int
-
+#int yaffs_start_up(void)
+yaffs_start_up = ylib.yaffs_start_up
+yaffs_start_up.argtypes = []
+yaffs_start_up.restype = c_int
+
+#int yaffs_set_trace(unsigned int tm) { return yaffs_traceMask=tm; }
+yaffs_set_trace=ylib.yaffs_set_trace
+yaffs_set_trace.argtypes=[c_uint]
+yaffs_set_trace.restype=c_uint
+
+#int yaffs_get_trace(void) { return yaffs_traceMask; }
+yaffs_get_trace=ylib.yaffs_get_trace
+yaffs_get_trace.argtypes=[]
+yaffs_get_trace.restypes=c_uint
+
+#int yaffs_get_error(void)
+yaffs_get_error=ylib.yaffs_get_error
+yaffs_get_error.argtypes=[]
+yaffs_get_error.restypes=c_int
+
+yaffs_O_CREAT=ylib.yaffs_O_CREAT()
+yaffs_O_RDONLY=ylib.yaffs_O_RDONLY()
+yaffs_O_WRONLY=ylib.yaffs_O_WRONLY()
+yaffs_O_RDWR=ylib.yaffs_O_RDWR()
+yaffs_O_TRUNC=ylib.yaffs_O_TRUNC()
+
+
+yaffs_S_IFMT=ylib.yaffs_S_IFMT()
+yaffs_S_IFLNK= ylib.yaffs_S_IFLNK()
+yaffs_S_IFDIR =ylib.yaffs_S_IFDIR()
+yaffs_S_IFREG=ylib.yaffs_S_IFREG()
+yaffs_S_IREAD=ylib.yaffs_S_IREAD()
+yaffs_S_IWRITE=ylib.yaffs_S_IWRITE()
+yaffs_S_IEXEC=ylib.yaffs_S_IEXEC()  
+yaffs_XATTR_CREATE=ylib.yaffs_XATTR_CREATE()
+yaffs_XATTR_REPLACE=ylib.yaffs_XATTR_REPLACE()
+yaffs_S_IEXEC=ylib.yaffs_S_IEXEC()