comparison direct/python/README.txt @ 320:e239e0b8c57d

Full change over to ctypes
author charles
date Tue, 13 Oct 2009 00:05:49 +0100
parents 3ef58b114b5e
children
comparison
equal deleted inserted replaced
319:3ef58b114b5e 320:e239e0b8c57d
13 13
14 $ python 14 $ python
15 Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41) 15 Python 2.6.2 (release26-maint, Apr 19 2009, 01:56:41)
16 [GCC 4.3.3] on linux2 16 [GCC 4.3.3] on linux2
17 Type "help", "copyright", "credits" or "license" for more information. 17 Type "help", "copyright", "credits" or "license" for more information.
18 >>> from ctypes import * 18 >>> from yaffsfs import *
19 >>> cdll.LoadLibrary("./libyaffsfs.so") 19 >>> yaffs_StartUp()
20 <CDLL './libyaffsfs.so', handle 9ed4178 at b7d418ac>
21 >>> y = CDLL("./libyaffsfs.so")
22 >>> y.yaffs_StartUp()
23 0 20 0
24 >>> y.yaffs_mount("/yaffs2") 21 >>> yaffs_mount("/yaffs2")
25 yaffs: Mounting /yaffs2 22 yaffs: Mounting /yaffs2
26 yaffs: yaffs_GutsInitialise() 23 yaffs: yaffs_GutsInitialise()
27 yaffs_ScanBackwards starts intstartblk 1 intendblk 256... 24 yaffs_ScanBackwards starts intstartblk 1 intendblk 256...
28 0 blocks to be sorted... 25 0 blocks to be sorted...
29 ...done 26 ...done
43 Dead 0 blocks 40 Dead 0 blocks
44 41
45 yaffs: yaffs_GutsInitialise() done. 42 yaffs: yaffs_GutsInitialise() done.
46 43
47 0 44 0
48 >>> y.yaffs_open("/yaffs2/xx",66,0666) 45 >>> yaffs_open("/yaffs2/xx",66,0666)
49 yaffs: Tnodes added 46 yaffs: Tnodes added
50 Allocated block 1, seq 4097, 255 left 47 Allocated block 1, seq 4097, 255 left
51 0 48 0
52 >>> y.yaffs_write(0,"abc",3) 49 >>> yaffs_write(0,"abcdefg",5)
53 3 50 5
54 >>> y.yaffs_lseek(0,0,0) 51 >>> b = create_string_buffer("",100)
52 >>> yaffs_lseek(0,0,0)
55 0 53 0
56 >>> b = create_string_buffer("",100) 54 >>> yaffs_read(0,b,100)
57 >>> y.yaffs_read(0,b,100) 55 5
58 3 56 >>> print b.value
59 >>> b.value 57 abcde
60 'abc'
61 >>>
62