Mercurial > yaffs-ecoscentric-gpl
comparison direct/python/examples.py @ 299:acc06403a0bc
More python example stuff
| author | charles <charles> |
|---|---|
| date | Tue, 13 Oct 2009 03:20:05 +0000 |
| parents | 2cb3c22ed0a0 |
| children | d326b86a50d5 |
comparison
equal
deleted
inserted
replaced
| 298:2cb3c22ed0a0 | 299:acc06403a0bc |
|---|---|
| 20 if isDir : | 20 if isDir : |
| 21 print "Dir ",se.d_ino, hex(perms), fullname | 21 print "Dir ",se.d_ino, hex(perms), fullname |
| 22 yaffs_ls(fullname) | 22 yaffs_ls(fullname) |
| 23 | 23 |
| 24 sep = yaffs_readdir(dc) | 24 sep = yaffs_readdir(dc) |
| 25 yaffs_closedir(dc) | |
| 26 return 0 | |
| 25 else: | 27 else: |
| 26 print "Could not open directory" | 28 print "Could not open directory" |
| 27 return -1 | 29 return -1 |
| 28 | 30 |
| 31 def yaffs_mkfile(fname,fsize): | |
| 32 fd = yaffs_open(fname,66, 0666) | |
| 33 if fd >= 0: | |
| 34 b = create_string_buffer("",1024) | |
| 35 totalwrite=0 | |
| 36 while fsize > 0: | |
| 37 thiswrite = 1024 if fsize > 1024 else fsize | |
| 38 result = yaffs_write(fd,b,thiswrite) | |
| 39 totalwrite += result | |
| 40 fsize -= result | |
| 41 if result != thiswrite: | |
| 42 fsize= 0 | |
| 43 | |
| 44 return totalwrite | |
| 45 else : | |
| 46 return -1 | |
| 29 | 47 |
| 30 root = "/yaffs2" | 48 root = "/yaffs2" |
| 31 | 49 |
| 32 yaffs_StartUp() | 50 yaffs_StartUp() |
| 33 yaffs_mount(root) | 51 yaffs_mount(root) |
