1 Using python with yaffsfs
2 ~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 Herewith a brief session showing yaffs direct being accessed from python.
6 I tried SWIG first, but ctypes turned out to be way, way easier...
8 Thanks to the people on NZPUG mailing list that helped with the exercise.
10 Build libyaffsfs.so with the accompanying Makefile.
15 Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
17 Type "help", "copyright", "credits" or "license" for more information.
18 >>> from yaffsfs import *
21 >>> yaffs_mount("/yaffs2")
22 yaffs: Mounting /yaffs2
23 yaffs: yaffs_GutsInitialise()
24 yaffs_ScanBackwards starts intstartblk 1 intendblk 256...
25 0 blocks to be sorted...
27 yaffs_ScanBackwards ends
30 0 blocks have illegal states
32 Needs scanning 0 blocks
42 yaffs: yaffs_GutsInitialise() done.
45 >>> yaffs_open("/yaffs2/xx",66,0666)
47 Allocated block 1, seq 4097, 255 left
49 >>> yaffs_write(0,"abcdefg",5)
51 >>> b = create_string_buffer("",100)
52 >>> yaffs_lseek(0,0,0)
54 >>> yaffs_read(0,b,100)