+void basic_xattr_test(const char *mountpt)
+{
+ char name[100];
+ int h;
+ int result;
+ int val1;
+ int valread;
+
+ 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);
+
+}
+
+void big_xattr_test(const char *mountpt)
+{
+ char name[100];
+ int h;
+ int result;
+ char val[1000];
+ char valread[1000];
+
+ 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 a large attribute\n");
+ memset(val,0x1,sizeof(val));
+ result = yaffs_setxattr(name,"aaa",val,200,0);
+ printf("wrote attribute aaa: result %d\n",result);
+ list_xattr(name);
+
+ printf("Add a large attribute\n");
+ memset(val,0x2,sizeof(val));
+ result = yaffs_setxattr(name,"bbb",val,1000,0);
+ printf("wrote attribute bbb: result %d\n",result);
+ list_xattr(name);
+
+ printf("Replace attribute\n");
+ memset(val,0x3,sizeof(val));
+ result = yaffs_setxattr(name,"aaa",val,1000,0);
+ printf("wrote attribute aaa: result %d\n",result);
+ list_xattr(name);
+
+}
+
+
+int random_seed;
+int simulate_power_failure;