+def yaffs_mkfile(fname,fsize):
+ fd = yaffs_open(fname,66, 0666)
+ if fd >= 0:
+ b = create_string_buffer("",1024)
+ totalwrite=0
+ while fsize > 0:
+ thiswrite = 1024 if fsize > 1024 else fsize
+ result = yaffs_write(fd,b,thiswrite)
+ totalwrite += result
+ fsize -= result
+ if result != thiswrite:
+ fsize= 0
+
+ return totalwrite
+ else :
+ return -1
+
+def yaffs_link_test(dir):
+ fnamea = dir + '/aaa'
+ fnameb = dir + '/bbb'
+ yaffs_unlink(fnamea)
+ fd = yaffs_open(fnamea,66,0666)
+ yaffs_link(fnamea,fnameb)
+ yaffs_ls(dir)
+ yaffs_unlink(fnamea)
+ yaffs_ls(dir)
+ yaffs_unlink(fnameb)
+
+def yaffs_o_excl_test(dir):
+ fname = dir + '/aaa'
+ yaffs_unlink(fname)
+ fd = yaffs_open(fname, 66, 0666)
+ yaffs_close(fd)
+ print "Created ", fname, " result ", fd
+ fdx = yaffs_open(fname, 0301, 0666)
+ print "Attempt to create with O_EXCL existing file returned ", fdx
+ yaffs_unlink(fname)
+ fdx = yaffs_open(fname, 0301, 0666)
+ print "Attempt to create with O_EXCL non-existing file returned ", fdx