1 /* 2 libparted 3 Copyright (C) 1998, 1999, 2000, 2007 Free Software Foundation, Inc. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by 7 the Free Software Foundation; either version 3 of the License, or 8 (at your option) any later version. 9 10 This program is distributed in the hope that it will be useful, 11 but WITHOUT ANY WARRANTY; without even the implied warranty of 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13 GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License 16 along with this program. If not, see <http://www.gnu.org/licenses/>. 17 */ 18 19 #ifndef TRAVERSE_H_INCLUDED 20 #define TRAVERSE_H_INCLUDED 21 22 #include "fatio.h" 23 24 typedef struct _FatTraverseInfo FatTraverseInfo; 25 26 struct _FatTraverseInfo { 27 PedFileSystem* fs; 28 char* dir_name; 29 30 int is_legacy_root_dir; 31 int dirty; 32 int eof; 33 34 FatDirEntry* dir_entries; 35 int current_entry; 36 FatCluster this_buffer, next_buffer; 37 int buffer_size; 38 }; 39 40 extern int fat_traverse_entries_per_buffer (FatTraverseInfo* trav_info); 41 42 /* starts traversal at an arbitary cluster. if start_cluster==0, then uses 43 root directory */ 44 extern FatTraverseInfo* fat_traverse_begin (PedFileSystem* fs, 45 FatCluster start_cluster, char* dir_name); 46 47 extern int fat_traverse_complete (FatTraverseInfo* trav_info); 48 49 extern FatTraverseInfo* fat_traverse_directory (FatTraverseInfo* trav_info, 50 FatDirEntry* parent); 51 52 extern void fat_traverse_mark_dirty (FatTraverseInfo* trav_info); 53 54 extern FatDirEntry* fat_traverse_next_dir_entry (FatTraverseInfo* trav_info); 55 56 extern FatCluster fat_dir_entry_get_first_cluster (FatDirEntry* dir_entry, 57 PedFileSystem* fs); 58 59 extern void fat_dir_entry_set_first_cluster (FatDirEntry* dir_entry, 60 PedFileSystem* fs, FatCluster cluster); 61 62 extern uint32_t fat_dir_entry_get_length (FatDirEntry* dir_entry); 63 64 extern int fat_dir_entry_is_null_term (const FatDirEntry* dir_entry); 65 extern int fat_dir_entry_is_file (FatDirEntry* dir_entry); 66 extern int fat_dir_entry_is_system_file (FatDirEntry* dir_entry); 67 extern int fat_dir_entry_is_directory (FatDirEntry* dir_entry); 68 extern void fat_dir_entry_get_name (FatDirEntry* dir_entry, char* result); 69 extern int fat_dir_entry_is_active (FatDirEntry* dir_entry); 70 extern int fat_dir_entry_has_first_cluster (FatDirEntry* dir_entry, 71 PedFileSystem* fs); 72 73 #endif /* TRAVERSE_H_INCLUDED */