/* This function coordinates the test for each filesystem type. */ static void test_filesystem (guestfs_h *g, const struct filesystem *fs) { if (fs->fs_feature && !feature_available (g, fs->fs_feature)) { printf ("skipped test of %s because %s feature not available\n", fs->fs_name, fs->fs_feature); return; } printf ("testing charset fidelity on %s\n", fs->fs_name); make_filesystem (g, fs); mount_filesystem (g, fs); test_ascii (g, fs); if (fs->fs_8bit_only) goto out; if (!fs->fs_skip_latin1) test_latin1 (g, fs); if (!fs->fs_skip_latin2) test_latin2 (g, fs); test_chinese (g, fs); out: unmount_filesystem (g, fs); }
int main(){ /* struct floppy* f = make_floppy("a.bin",0,(char*)0); writef(f,0,11,"hello world"); char* dest = malloc(sizeof(char)*12); readf(f,0,11,dest); printf("%s\n",dest); printf("%i\n",free_floppy(f)); */ struct llfs_filesystem* llfs_fs = make_filesystem("tempfs"); printf("%i\n",add_file_to_filesystem(llfs_fs, "\\root\\","readme.txt")); free_filesystem(llfs_fs); return 0; }
/* This function coordinates the test for each filesystem type. */ static void test_filesystem (guestfs_h *g, const struct filesystem *fs) { const char *feature[] = { fs->fs_feature, NULL }; char envvar[sizeof (ourenvvar) + 20]; char *str; if (fs->fs_feature && !guestfs_feature_available (g, (char **) feature)) { printf ("skipped test of %s because %s feature not available\n", fs->fs_name, fs->fs_feature); return; } snprintf (envvar, sizeof envvar, "%s_%s", ourenvvar, fs->fs_name); str = getenv (envvar); if (str && STREQ (str, "1")) { printf ("skipped test of %s because environment variable is set\n", fs->fs_name); return; } printf ("testing charset fidelity on %s\n", fs->fs_name); make_filesystem (g, fs); mount_filesystem (g, fs); test_ascii (g, fs); if (fs->fs_8bit_only) goto out; if (!fs->fs_skip_latin1) test_latin1 (g, fs); if (!fs->fs_skip_latin2) test_latin2 (g, fs); test_chinese (g, fs); out: unmount_filesystem (g, fs); }