mirror of
https://github.com/amadvance/snapraid.git
synced 2026-11-26 01:46:32 -05:00
Adds the --find-by-name option to find files by path instead than by inode.
This commit is contained in:
parent
1dbd801dcb
commit
191dcdf3d4
14 changed files with 356 additions and 32 deletions
9
elem.c
9
elem.c
|
|
@ -297,6 +297,13 @@ int file_inode_compare(const void* void_arg, const void* void_data)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int file_path_compare(const void* void_arg, const void* void_data)
|
||||
{
|
||||
const char* arg = void_arg;
|
||||
const struct snapraid_file* file = void_data;
|
||||
return strcmp(arg, file->sub);
|
||||
}
|
||||
|
||||
struct snapraid_link* link_alloc(const char* sub, const char* linkto)
|
||||
{
|
||||
struct snapraid_link* link;
|
||||
|
|
@ -336,6 +343,7 @@ struct snapraid_disk* disk_alloc(const char* name, const char* dir, uint64_t dev
|
|||
disk->first_free_block = 0;
|
||||
tommy_list_init(&disk->filelist);
|
||||
tommy_hashdyn_init(&disk->inodeset);
|
||||
tommy_hashdyn_init(&disk->pathset);
|
||||
tommy_list_init(&disk->linklist);
|
||||
tommy_hashdyn_init(&disk->linkset);
|
||||
tommy_array_init(&disk->blockarr);
|
||||
|
|
@ -352,6 +360,7 @@ void disk_free(struct snapraid_disk* disk)
|
|||
file_free(file);
|
||||
}
|
||||
tommy_hashdyn_done(&disk->inodeset);
|
||||
tommy_hashdyn_done(&disk->pathset);
|
||||
node = disk->linklist;
|
||||
while (node) {
|
||||
struct snapraid_link* link = node->data;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue