| 787 | } |
| 788 | |
| 789 | int QPhotorec::photorec(alloc_data_t *list_search_space) |
| 790 | { |
| 791 | pstatus_t ind_stop=PSTATUS_OK; |
| 792 | const unsigned int blocksize_is_known=params->blocksize; |
| 793 | params_reset(params, options); |
| 794 | /* make the first recup_dir */ |
| 795 | params->dir_num=photorec_mkdir(params->recup_dir, params->dir_num); |
| 796 | for(params->pass=0; params->status!=STATUS_QUIT; params->pass++) |
| 797 | { |
| 798 | timer->start(); |
| 799 | switch(params->status) |
| 800 | { |
| 801 | case STATUS_UNFORMAT: |
| 802 | /* FIXME */ |
| 803 | break; |
| 804 | case STATUS_FIND_OFFSET: |
| 805 | { |
| 806 | uint64_t start_offset=0; |
| 807 | if(blocksize_is_known>0) |
| 808 | { |
| 809 | ind_stop=PSTATUS_OK; |
| 810 | if(!td_list_empty(&list_search_space->list)) |
| 811 | start_offset=(td_list_entry(list_search_space->list.next, alloc_data_t, list))->start % params->blocksize; |
| 812 | } |
| 813 | else |
| 814 | { |
| 815 | ind_stop=photorec_find_blocksize(list_search_space); |
| 816 | params->blocksize=find_blocksize(list_search_space, params->disk->sector_size, &start_offset); |
| 817 | } |
| 818 | update_blocksize(params->blocksize, list_search_space, start_offset); |
| 819 | } |
| 820 | break; |
| 821 | case STATUS_EXT2_ON_BF: |
| 822 | case STATUS_EXT2_OFF_BF: |
| 823 | /* FIXME */ |
| 824 | break; |
| 825 | default: |
| 826 | ind_stop=photorec_aux(list_search_space); |
| 827 | break; |
| 828 | } |
| 829 | timer->stop(); |
| 830 | qphotorec_search_updateUI(); |
| 831 | session_save(list_search_space, params, options); |
| 832 | switch(ind_stop) |
| 833 | { |
| 834 | case PSTATUS_EACCES: |
| 835 | { |
| 836 | int ret=QMessageBox::warning(this, |
| 837 | tr("QPhotoRec: Failed to create file!"), |
| 838 | tr("Failed to create file! Please choose another destination"), |
| 839 | QMessageBox::Ok| QMessageBox::Cancel, QMessageBox::Ok); |
| 840 | if(ret==QMessageBox::Cancel) |
| 841 | { |
| 842 | params->status=STATUS_QUIT; |
| 843 | } |
| 844 | else |
| 845 | { |
| 846 | setExistingDirectory(); |
nothing calls this directly
no test coverage detected