| 357 | #endif |
| 358 | |
| 359 | dir_partition_t dir_partition_ext2_init(disk_t *disk_car, const partition_t *partition, dir_data_t *dir_data, const int verbose) |
| 360 | { |
| 361 | #if defined(HAVE_LIBEXT2FS) |
| 362 | struct ext2_dir_struct *ls=(struct ext2_dir_struct *)MALLOC(sizeof(*ls)); |
| 363 | io_channel ioch; |
| 364 | my_data_t *my_data; |
| 365 | ls->dir_list=NULL; |
| 366 | /* ls->flags = DIRENT_FLAG_INCLUDE_EMPTY; */ |
| 367 | ls->flags = DIRENT_FLAG_INCLUDE_REMOVED; |
| 368 | ls->dir_data=dir_data; |
| 369 | my_data=(my_data_t *)MALLOC(sizeof(*my_data)); |
| 370 | my_data->partition=partition; |
| 371 | my_data->disk_car=disk_car; |
| 372 | ioch=alloc_io_channel(disk_car,my_data); |
| 373 | shared_ioch=ioch; |
| 374 | /* An alternate superblock may be used if the calling function has set an IO redirection */ |
| 375 | if(ext2fs_open ("/dev/testdisk", 0, 0, 0, &my_struct_manager, &ls->current_fs)!=0) |
| 376 | { |
| 377 | // free(my_data); |
| 378 | free(ls); |
| 379 | return DIR_PART_EIO; |
| 380 | } |
| 381 | strncpy(dir_data->current_directory,"/",sizeof(dir_data->current_directory)); |
| 382 | dir_data->current_inode=EXT2_ROOT_INO; |
| 383 | dir_data->param=FLAG_LIST_DELETED; |
| 384 | dir_data->verbose=verbose; |
| 385 | dir_data->capabilities=CAPA_LIST_DELETED; |
| 386 | dir_data->get_dir=&ext2_dir; |
| 387 | dir_data->copy_file=&ext2_copy; |
| 388 | dir_data->close=&dir_partition_ext2_close; |
| 389 | dir_data->local_dir=NULL; |
| 390 | dir_data->private_dir_data=ls; |
| 391 | return DIR_PART_OK; |
| 392 | #else |
| 393 | return DIR_PART_ENOSYS; |
| 394 | #endif |
| 395 | } |
| 396 | |
| 397 | const char*td_ext2fs_version(void) |
| 398 | { |
no test coverage detected