Beispiel #1
0
void yaffs_device_flush_test(const char *path)
{
	char fn[100];
	int h;
	int i;
	
	yaffs_StartUp();	
	
	yaffs_mount(path);
	
	do_some_file_stuff(path);
	
	// Open and add some data to a few files
	for(i = 0; i < 10; i++) {
	
		sprintf(fn,"%s/ff%d",path,i);

		h = yaffs_open(fn, O_CREAT | O_RDWR | O_TRUNC, S_IWRITE | S_IREAD);
		yaffs_write(h,xxzz,2000);
		yaffs_write(h,xxzz,2000);
	}
	yaffs_unmount(path);
	
	yaffs_mount(path);
}
Beispiel #2
0
void handle_test(const char *mountpt)
{
	int i;
	int h;
	int cycle;
	char a[100];

	sprintf(a,"%s/aaa",mountpt);
	
	yaffs_StartUp();
	
	yaffs_mount(mountpt);

        for(cycle = 0; cycle < 5; cycle++){
        printf("Start cycle %d\n",cycle);
 	i = 0;
	do {
        h = yaffs_open(a, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
	printf("%d  handle %d\n",i,h);
	i++;
	} while(h >= 0);
	
	while(i >= -1) {
	 yaffs_close(i);
	 i--;
        }
        }
	
	yaffs_unmount(mountpt);
}
Beispiel #3
0
void fill_empty_files_test(const char *mountpt)
{
	int i;
	yaffs_StartUp();
	char name[100];
	int result = 0;
	
	int d,f;

	for(i = 0; i < 5; i++)
	{
		yaffs_mount(mountpt);
		for(d = 0; result >= 0 && d < 1000; d++){
			sprintf(name,"%s/%d",mountpt,d);
			result= yaffs_mkdir(name,0);
			printf("creating directory %s result %d\n",name,result);
			
			for(f = 0; result >= 0 && f < 100; f++){
				sprintf(name,"%s/%d/%d",mountpt,d,f);
				result= yaffs_open(name,O_CREAT, 0);
				yaffs_close(result);
				printf("creating file %s result %d\n",name,result);
			}
		}
		yaffs_unmount(mountpt);
	}
	
}
Beispiel #4
0
void scan_pattern_test(const char *path, int fsize, int niterations)
{
	int i;
	int j;
	char fn[3][100];
	int result;
	
	sprintf(fn[0],"%s/%s",path,"f0");
	sprintf(fn[1],"%s/%s",path,"f1");
	sprintf(fn[2],"%s/%s",path,"f2");
	
	yaffs_StartUp();
	
	for(i = 0; i < niterations; i++)
	{
		printf("\n*****************\nIteration %d\n",i);
		yaffs_mount(path);
		printf("\nmount: Directory look-up of %s\n",path);
		dumpDir(path);
		for(j = 0; j < 3; j++)
		{
			result = dump_file_data(fn[j]);
			result = check_pattern_file(fn[j]);
			make_pattern_file(fn[j],fsize); 
			result = dump_file_data(fn[j]);
			result = check_pattern_file(fn[j]);
		}
		yaffs_unmount(path);
	}
}
Beispiel #5
0
int cache_read_test(void)
{
	int a,b,c;
	int i;
	int sizeOfFiles = 500000;
	char buffer[100];
	
	yaffs_StartUp();
	
	yaffs_mount("/boot");
	
	make_a_file("/boot/a",'a',sizeOfFiles);
	make_a_file("/boot/b",'b',sizeOfFiles);

	a = yaffs_open("/boot/a",O_RDONLY,0);
	b = yaffs_open("/boot/b",O_RDONLY,0);
	c = yaffs_open("/boot/c", O_CREAT | O_RDWR | O_TRUNC, S_IREAD | S_IWRITE);

	do{
		i = sizeOfFiles;
		if (i > 100) i = 100;
		sizeOfFiles  -= i;
		yaffs_read(a,buffer,i);
		yaffs_read(b,buffer,i);
		yaffs_write(c,buffer,i);
	} while(sizeOfFiles > 0);
	
	
	
	return 1;
	
}
Beispiel #6
0
void test_flash_traffic(const char *mountpt)
{
	char name0[100];
	char name1[100];
	int i;
	yaffs_Device *dev;

	yaffs_traceMask = 0;

	yaffs_StartUp();

	yaffs_mount(mountpt);
	
	dev = yaffs_getdev(mountpt);

	strcpy(name0,mountpt);
	strcat(name0,"/x");

	strcpy(name1,mountpt);
	strcat(name1,"/y");

	dump_dev_stats(dev,"start");
	create_file_of_size(name0,32 * 1024 * 1024);
	dump_dev_stats(dev,"32MB written");
	for(i = 0; i < 20; i++)
		create_file_of_size(name1,1024 * 1024);
	dump_dev_stats(dev,"20x 1MB files written");

}
Beispiel #7
0
int overwrite_test(const char *path)
{
   char aname[100];
   char bname[100];
   int i;
   int j;   
   int a;
   int b;
   yaffs_StartUp();
   
   yaffs_mount(path);
   
   sprintf(aname,"%s%s",path,"/a");
   sprintf(bname,"%s%s",path,"/b");
   
   b = yaffs_open(bname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
   for(j= 0; j < 500; j++){
   	yaffs_write(b,bname,100);
	a = yaffs_open(aname, O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
   	for(i = 0; i < rand() % 20000; i++)
   		yaffs_write(a,&a,sizeof(a));
	yaffs_close(a);
   }
   
   return 0;
   
}
Beispiel #8
0
int directory_rename_test(void)
{
	int r;
	yaffs_StartUp();
	
	yaffs_mount("/ram");
	yaffs_mkdir("/ram/a",0);
	yaffs_mkdir("/ram/a/b",0);
	yaffs_mkdir("/ram/c",0);
	
	printf("\nDirectory look-up of /ram\n");
	dumpDir("/ram");
	dumpDir("/ram/a");
	dumpDir("/ram/a/b");

	printf("Do rename (should fail)\n");
		
	r = yaffs_rename("/ram/a","/ram/a/b/d");
	printf("\nDirectory look-up of /ram\n");
	dumpDir("/ram");
	dumpDir("/ram/a");
	dumpDir("/ram/a/b");

	printf("Do rename (should not fail)\n");
		
	r = yaffs_rename("/ram/c","/ram/a/b/d");
	printf("\nDirectory look-up of /ram\n");
	dumpDir("/ram");
	dumpDir("/ram/a");
	dumpDir("/ram/a/b");
	
	
	return 1;
	
}
Beispiel #9
0
void rename_over_test(const char *mountpt)
{
	int i;
	char a[100];
	char b[100];
	char c[100];
	
	sprintf(a,"%s/a",mountpt);
	sprintf(b,"%s/b",mountpt);
	sprintf(c,"%s/c",mountpt);
	
	yaffs_StartUp();
	
	yaffs_mount(mountpt);
	
	printf("Existing files\n");
	dumpDirFollow(mountpt);
	
	
	
	i = yaffs_open(c,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
	printf("File c handle is %d\n",i);
	yaffs_close(i);
	i = yaffs_open(a,O_CREAT | O_TRUNC | O_RDWR,  S_IREAD | S_IWRITE); 
	yaffs_close(i);
	i = yaffs_open(b,O_CREAT | O_TRUNC | O_RDWR,  S_IREAD | S_IWRITE);
	yaffs_close(i);
	yaffs_rename(a,b); // rename over
	yaffs_rename(b,a); // rename back again (not renaimng over)
	yaffs_rename(a,b); // rename back again (not renaimng over)
	
	
	yaffs_unmount(mountpt);
	
}
Beispiel #10
0
void check_resize_gc_bug(const char *mountpt)
{

	char a[30];
	char b[30];
	char c[30];
	
	int i;
	
	sprintf(a,"%s/a",mountpt);
	sprintf(b,"%s/b",mountpt);
	sprintf(c,"%s/c",mountpt);
	

	
	
	yaffs_StartUp();
	yaffs_mount(mountpt);
	yaffs_unlink(a);
	yaffs_unlink(b);
	
	for(i = 0; i < 50; i++)
	{  
	   printf("A\n");write_200k_file(a,"",c);
	   printf("B\n");verify_200k_file(a);
	   printf("C\n");write_200k_file(b,a,c);
	   printf("D\n");verify_200k_file(b);
	   yaffs_unmount(mountpt);
	   yaffs_mount(mountpt);
	   printf("E\n");verify_200k_file(a);
	   printf("F\n");verify_200k_file(b);
	}
		
}
Beispiel #11
0
void checkpoint_upgrade_test(const char *mountpt,int nmounts)
{

	char a[50];
	char b[50];
	char c[50];
	char d[50];
	
	int i;
	int j;
	int h;
	
	sprintf(a,"%s/a",mountpt);
	

	
	
	printf("Create start condition\n");
	yaffs_StartUp();
	SetCheckpointReservedBlocks(0);
	yaffs_mount(mountpt);
	yaffs_mkdir(a,0);
	sprintf(b,"%s/zz",a);
	sprintf(c,"%s/xx",a);
	make_file2(b,c,2000000);
	sprintf(d,"%s/aa",a);
	make_file2(d,NULL,500000000);
	dump_directory_tree(mountpt);
	
	printf("Umount/mount attempt full\n");
	yaffs_unmount(mountpt);
	
	SetCheckpointReservedBlocks(10);
	yaffs_mount(mountpt);
	
	printf("unlink small file\n");
	yaffs_unlink(c);
	dump_directory_tree(mountpt);
		
	printf("Umount/mount attempt\n");
	yaffs_unmount(mountpt);
	yaffs_mount(mountpt);
	
	for(j = 0; j < 500; j++){
		printf("***** touch %d\n",j);
		dump_directory_tree(mountpt);
		yaffs_touch(b);
		yaffs_unmount(mountpt);
		yaffs_mount(mountpt);
	}

	for(j = 0; j < 500; j++){
		printf("***** touch %d\n",j);
		dump_directory_tree(mountpt);
		yaffs_touch(b);
		yaffs_unmount(mountpt);
		yaffs_mount(mountpt);
	}
}
Beispiel #12
0
void cmd_yaffs_mount(char *mp)
{
	yaffs_StartUp();
	int retval = yaffs_mount(mp);
	if( retval != -1)
		isMounted = 1;
	else
		printf("Error mounting %s, return value: %d\n", mp, yaffsfs_GetError());
}
Beispiel #13
0
int huge_directory_test_on_path(char *path)
{

	yaffs_DIR *d;
	yaffs_dirent *de;
	struct yaffs_stat s;

	int f;
	int i;

	int total = 0;
	int lastTotal = 0;
	
	char str[100];

	
	yaffs_StartUp();
	
	yaffs_mount(path);
	
	// Create a large number of files
	
	for(i = 0; i < 2000; i++)
	{
	  sprintf(str,"%s/%d",path,i);
	  
	   f = yaffs_open(str,O_CREAT,S_IREAD | S_IWRITE);
	   yaffs_close(f);
	}
	
	
	
	d = yaffs_opendir(path);
	i = 0;
	if (d) {
	while((de = yaffs_readdir(d)) != NULL) {
	if (total >lastTotal+100*9*1024||(i & 1023)==0){
	printf("files = %d, total = %d\n",i, total);
	lastTotal = total;
	}
		i++;
		sprintf(str,"%s/%s",path,de->d_name);
		yaffs_lstat(str,&s);
		switch(s.st_mode & S_IFMT){
		case S_IFREG:
	//printf("data file");
	total += s.st_size;
	break;
	}
	}
	
	yaffs_closedir(d);
	}
	
	return 0;
}
Beispiel #14
0
void scan_deleted_files_test(const char *mountpt)
{
	char fn[100];
	char sub[100];
	
	const char *p;
	
	int i;
	int j;
	int k;
	int h;
	
	sprintf(sub,"%s/sdir",mountpt);
	yaffs_StartUp();
	
	for(j = 0; j < 10; j++)
	{
		printf("\n\n>>>>>>> Run %d <<<<<<<<<<<<<\n\n",j);
		yaffs_mount(mountpt);
		yaffs_mkdir(sub,0);
		
		
		p = (j & 0) ? mountpt: sub;
	
		for(i = 0; i < 100; i++)
		{
		  sprintf(fn,"%s/%d",p,i);  
		  
		  if(i & 1)
		  {
			  h = yaffs_open(fn,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
			  for(k = 0; k < 1000; k++)
				  yaffs_write(h,fn,100);
			  yaffs_close(h);
		  }
		  else
		    	yaffs_mkdir(fn,0);
		}
		
		for(i = 0; i < 10; i++)
		{
		  sprintf(fn,"%s/%d",p,i);  
		  if(i & 1) 
		  	yaffs_unlink(fn);
		  else
		  	yaffs_rmdir(fn);
		  
		}
				
		yaffs_unmount(mountpt);
	}
	
	
	

}
Beispiel #15
0
void small_overwrite_test(const char *mountpt,int nmounts)
{

	char a[30];
	int i;
	int j;

	int h0;
	int h1;

	
	sprintf(a,"%s/a",mountpt);

	yaffs_StartUp();
	
	
	
	for(i = 0; i < nmounts; i++){
		
		static char xx[8000];
		
		printf("############### Iteration %d   Start\n",i);
		if(1)
			yaffs_mount(mountpt);

		dump_directory_tree(mountpt);
		
		yaffs_mkdir(a,0);
		
		sprintf(xx,"%s/0",a);
		h0 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
		sprintf(xx,"%s/1",a);
		h1 = yaffs_open(xx, O_RDWR | O_CREAT | O_TRUNC, S_IREAD | S_IWRITE);
		
		for(j = 0; j < 1000000; j+=1000){
			yaffs_ftruncate(h0,j);
			yaffs_lseek(h0,j,SEEK_SET);
			yaffs_write(h0,xx,7000);
			yaffs_write(h1,xx,7000);
			
			if(early_exit)
				exit(0);
		}
		
		yaffs_close(h0);
		
		printf("########### %d\n",i);
		dump_directory_tree(mountpt);

		if(1)
			yaffs_unmount(mountpt);
	}
}
Beispiel #16
0
int free_space_check(void)
{
	int f;
	
		yaffs_StartUp();
		yaffs_mount("/boot");
	    fill_disk("/boot/",2);
	    f = yaffs_freespace("/boot");
	    
	    printf("%d free when disk full\n",f);           
	    return 1;
}
Beispiel #17
0
void fill_disk_test(const char *mountpt)
{
	int i;
	yaffs_StartUp();
	
	for(i = 0; i < 5; i++)
	{
		yaffs_mount(mountpt);
		fill_disk_and_delete(mountpt,100,i+1);
		yaffs_unmount(mountpt);
	}
	
}
Beispiel #18
0
void fill_files_test(const char *mountpt)
{
	int i;
	yaffs_StartUp();
	
	for(i = 0; i < 5; i++)
	{
		yaffs_mount(mountpt);
		fill_files(mountpt,2,3,100);
		yaffs_unmount(mountpt);
	}
	
}
Beispiel #19
0
void rmdir_test(const char *mountpt)
{
	char name[100];
	yaffs_StartUp();
	
	yaffs_mount(mountpt);
	
	strcpy(name,mountpt);
	strcat(name,"/");
	strcat(name,"hello");
	yaffs_mkdir(name,0666);
	yaffs_rmdir(name);
	yaffs_unmount(mountpt);
}
Beispiel #20
0
void NorStressTestInitialise(const char *prefix)
{
  MakeFullNames(prefix);
  
  yaffs_StartUp();
  yaffs_mount(fullPathName);
  UpdateCounter(fullPowerUpName,&powerUps,1);
  UpdateCounter(fullStartName,&cycleStarts,1);
  UpdateCounter(fullEndName,&cycleEnds,1);
  UpdateCounter(fullPowerUpName,&powerUps,1);
  DoUpdateMainFile();
  DoVerifyMainFile();
  yaffs_unmount(fullPathName);
}
Beispiel #21
0
void basic_xattr_test(const char *mountpt)
{
	char name[100];
	int h;
	int result;
	int val1;

	yaffs_StartUp();

	yaffs_mount(mountpt);

	strcpy(name,mountpt);
	strcat(name,"/");
	strcat(name,"xfile");

	yaffs_unlink(name);
	h = yaffs_open(name,O_CREAT | O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
	yaffs_close(h);

	printf("Start\n");
	list_xattr(name);

	printf("Add an attribute\n");
	val1 = 0x123456;
	result = yaffs_setxattr(name,"foo",&val1,sizeof(val1),0);
	printf("wrote attribute foo: result %d\n",result);
	list_xattr(name);
	printf("Add an attribute\n");
	val1 = 0x7890;
	result = yaffs_setxattr(name,"bar",&val1,sizeof(val1),0);
	printf("wrote attribute bar: result %d\n",result);
	list_xattr(name);

	printf("Get non-existanrt attribute\n");
	print_xattrib_val(name,"not here");

	printf("Delete non existing attribute\n");
	yaffs_removexattr(name,"not here");
	list_xattr(name);

	printf("Remove foo\n");
	yaffs_removexattr(name,"foo");
	list_xattr(name);

	printf("Remove bar\n");
	yaffs_removexattr(name,"bar");
	list_xattr(name);

}
Beispiel #22
0
void simple_rw_test(const char *mountpt)
{
	int i;
	int h;
	char a[100];
	
	int x;
	int result;

	sprintf(a,"%s/aaa",mountpt);
	
	yaffs_StartUp();
	
	yaffs_mount(mountpt);
	
	yaffs_unlink(a);
	
	h = yaffs_open(a,O_CREAT| O_TRUNC | O_RDWR, S_IREAD | S_IWRITE);
	
	for(i = 100000;i < 200000; i++){
		result = yaffs_write(h,&i,sizeof(i));
		
		if(result != 4)
		{
			printf("write error\n");
			exit(1);
		}
	}
	
	//yaffs_close(h);
	
	// h = yaffs_open(a,O_RDWR, S_IREAD | S_IWRITE);
	
	
	yaffs_lseek(h,0,SEEK_SET);
	
	for(i = 100000; i < 200000; i++){
		result = yaffs_read(h,&x,sizeof(x));
		
		if(result != 4 || x != i){
			printf("read error %d %x %x\n",i,result,x);
		}
	}
	
	printf("Simple rw test passed\n");
	
	
	
}
Beispiel #23
0
void null_name_test(const char *path)
{
	char fn[100];
	int h;
	yaffs_StartUp();

	yaffs_mount(path);

	sprintf(fn,"%s",path);

	h = yaffs_open(fn,O_CREAT| O_TRUNC| O_RDWR, 0666);

	printf("%d\n",h);

}
Beispiel #24
0
int cache_bypass_bug_test(void)
{
	// This test reporoduces a bug whereby YAFFS caching *was* buypassed
	// resulting in erroneous reads after writes.
	// This bug has been fixed.
	
	int a;
	int i;
	char buffer1[1000];
	char buffer2[1000];
	
	memset(buffer1,0,sizeof(buffer1));
	memset(buffer2,0,sizeof(buffer2));
		
	yaffs_StartUp();
	
	yaffs_mount("/boot");
	
	// Create a file of 2000 bytes.
	make_a_file("/boot/a",'X',2000);

	a = yaffs_open("/boot/a",O_RDWR, S_IREAD | S_IWRITE);
	
	// Write a short sequence to the file.
	// This will go into the cache.
	yaffs_lseek(a,0,SEEK_SET);
	yaffs_write(a,"abcdefghijklmnopqrstuvwxyz",20); 

	// Read a short sequence from the file.
	// This will come from the cache.
	yaffs_lseek(a,0,SEEK_SET);
	yaffs_read(a,buffer1,30); 

	// Read a page size sequence from the file.
	yaffs_lseek(a,0,SEEK_SET);
	yaffs_read(a,buffer2,512); 
	
	printf("buffer 1 %s\n",buffer1);
	printf("buffer 2 %s\n",buffer2);
	
	if(strncmp(buffer1,buffer2,20))
	{
		printf("Cache bypass bug detected!!!!!\n");
	}
	
	
	return 1;
}
Beispiel #25
0
void huge_array_test(const char *mountpt,int n)
{

	char a[50];

	
	int i;
	int j;
	int h;
	
	int fnum;
	
	sprintf(a,"mount point %s",mountpt);
	

	
	yaffs_StartUp();

	yaffs_mount(mountpt);
	
	while(n>0){
		n--;
		fnum = 0;
		printf("\n\n START run\n\n");
		while(yaffs_freespace(mountpt) > 25000000){
			sprintf(a,"%s/file%d",mountpt,fnum);
			fnum++;
			printf("create file %s\n",a);
			create_file_of_size(a,10000000);
			printf("verifying file %s\n",a);
			verify_file_of_size(a,10000000);
		}
		
		printf("\n\n\ verification/deletion\n\n");
		
		for(i = 0; i < fnum; i++){
			sprintf(a,"%s/file%d",mountpt,i);
			printf("verifying file %s\n",a);
			verify_file_of_size(a,10000000);
			printf("deleting file %s\n",a);
			yaffs_unlink(a);
		}
		printf("\n\n\ done \n\n");
			
		   
	}
}
Beispiel #26
0
int main(int argc, const char *argv[])
{
	yaffs_StartUp();
	if(argc == 3) {
		if(!strcmp(argv[2],"fw_update_init")){
			NorStressTestInitialise(argv[1]);
		}
		else if(!strcmp(argv[2],"fw_update")){
			NorStressTestRun(argv[1]);
		}
		else 
			BadUsage();
	}
	else
		BadUsage();
	return 0;
}
Beispiel #27
0
void long_name_test(const char *mountpt)
{
	int i;
	yaffs_StartUp();
	char fullName[1000];
	char name[300];
	int result = 0;
	
	int f;
	
	// Make a 256 byte name
	memset(name,0,sizeof(name));
	for(i = 0; i < 256; i++)
		name[i] = '0' + i % 10;
		
	sprintf(fullName,"%s/%s",mountpt,name);

	for(i = 0; i < 1; i++)
	{
		yaffs_mount(mountpt);
		
		printf("Files at start\n");
		dumpDir(mountpt);
		
		printf("Creating file %s\n",fullName);
		
		f = yaffs_open(fullName,O_CREAT | O_RDWR,0);
		yaffs_close(f);
		
		printf("Result %d\n",f);
			
		printf("Files\n");
		dumpDir(mountpt);
		
		printf("Deleting %s\n",fullName);
		result = yaffs_unlink(fullName);
		printf("Result %d\n",result);
		
		printf("Files\n");
		
		dumpDir(mountpt);
		
		yaffs_unmount(mountpt);
	}
	
}
Beispiel #28
0
void short_scan_test(const char *path, int fsize, int niterations)
{
	int i;
	char fn[100];
	
	sprintf(fn,"%s/%s",path,"f1");
	
	yaffs_StartUp();
	for(i = 0; i < niterations; i++)
	{
		printf("\n*****************\nIteration %d\n",i);
		yaffs_mount(path);
		printf("\nmount: Directory look-up of %s\n",path);
		dumpDir(path);
		make_a_file(fn,1,fsize);
		yaffs_unmount(path);
	}
}
Beispiel #29
0
void checkpoint_fill_test(const char *mountpt,int nmounts)
{

	char a[50];
	char b[50];
	char c[50];
	
	int i;
	int j;
	int h;
	
	sprintf(a,"%s/a",mountpt);
	

	
	
	yaffs_StartUp();
	
	for(i = 0; i < nmounts; i++){
		printf("############### Iteration %d   Start\n",i);
		yaffs_mount(mountpt);
		dump_directory_tree(mountpt);
		yaffs_mkdir(a,0);
		
		sprintf(b,"%s/zz",a);
		
		h = yaffs_open(b,O_CREAT | O_RDWR,S_IREAD |S_IWRITE);
		
		
		while(yaffs_write(h,c,50) == 50){}
		
		yaffs_close(h);
		
		for(j = 0; j < 2; j++){
			printf("touch %d\n",j);
			yaffs_touch(b);
			yaffs_unmount(mountpt);
			yaffs_mount(mountpt);
		}

		dump_directory_tree(mountpt);		
		yaffs_unmount(mountpt);
	}
}
Beispiel #30
0
void link_test0(const char *mountpt)
{
	char namea[300];
	char nameb[300];
	int result = 0;
	

	yaffs_StartUp();
	yaffs_mount(mountpt);
	
		
	sprintf(namea,"%s/a",mountpt);
	sprintf(nameb,"%s/b",mountpt);

	printf("mounted\n");
        dumpDir(mountpt);

	yaffs_unlink(namea);
	printf("a unlinked\n");
        dumpDir(mountpt);

	yaffs_unlink(nameb);
	printf("b unlinked\n");
        dumpDir(mountpt);
	
	result = yaffs_open(namea,O_CREAT| O_RDWR,0666);
        yaffs_close(result);
	printf("a created\n");
        dumpDir(mountpt);

        yaffs_link(namea,nameb);
        printf("linked\n");
        dumpDir(mountpt);
        yaffs_unlink(namea);
        printf("a ulinked\n");
        dumpDir(mountpt);
        yaffs_unlink(nameb);
        printf("b unlinked\n");
        dumpDir(mountpt);

	yaffs_unmount(mountpt);
}