int main(int argc, char **argv) { struct fsw_posix_volume *vol; int i; if (argc != 2) { fprintf(stderr, "Usage: lslr <file/device>\n"); return 1; } for (i = 0; fstypes[i]; i++) { vol = fsw_posix_mount(argv[1], fstypes[i]); if (vol != NULL) { fprintf(stderr, "Mounted as '%s'.\n", fstypes[i]->name.data); break; } } if (vol == NULL) { fprintf(stderr, "Mounting failed.\n"); return 1; } listdir(vol, "/boot/", 0); catfile(vol, "/boot/vmlinuz-3.5.0-19-generic"); fsw_posix_unmount(vol); return 0; }
int main(int argc, char **argv) { struct fsw_posix_volume *vol; struct fsw_posix_dir *dir; struct dirent *dent; if (argc != 2) { printf("Usage: lsroot <file/device>\n"); return 1; } //vol = fsw_posix_mount(argv[1], &FSW_FSTYPE_TABLE_NAME(ext2)); //vol = fsw_posix_mount(argv[1], &FSW_FSTYPE_TABLE_NAME(reiserfs)); vol = fsw_posix_mount(argv[1], &FSW_FSTYPE_TABLE_NAME(iso9660)); if (vol == NULL) { printf("Mounting failed.\n"); return 1; } //dir = fsw_posix_opendir(vol, "/drivers/net/"); dir = fsw_posix_opendir(vol, "/"); if (dir == NULL) { printf("opendir call failed.\n"); return 1; } while ((dent = fsw_posix_readdir(dir)) != NULL) { printf("- %s\n", dent->d_name); } fsw_posix_closedir(dir); fsw_posix_unmount(vol); return 0; }