|
Packit |
ae235b |
/*******************************************************************************
|
|
Packit |
ae235b |
Copyright (c) 2011, 2012 Dmitry Matveev <me@dmitrymatveev.co.uk>
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
Packit |
ae235b |
of this software and associated documentation files (the "Software"), to deal
|
|
Packit |
ae235b |
in the Software without restriction, including without limitation the rights
|
|
Packit |
ae235b |
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
Packit |
ae235b |
copies of the Software, and to permit persons to whom the Software is
|
|
Packit |
ae235b |
furnished to do so, subject to the following conditions:
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
The above copyright notice and this permission notice shall be included in
|
|
Packit |
ae235b |
all copies or substantial portions of the Software.
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
Packit |
ae235b |
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
Packit |
ae235b |
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
Packit |
ae235b |
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
Packit |
ae235b |
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
Packit |
ae235b |
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
Packit |
ae235b |
THE SOFTWARE.
|
|
Packit |
ae235b |
*******************************************************************************/
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#ifndef __DEP_LIST_H__
|
|
Packit |
ae235b |
#define __DEP_LIST_H__
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#include <sys/types.h> /* ino_t */
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
typedef struct dep_list {
|
|
Packit |
ae235b |
struct dep_list *next;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
char *path;
|
|
Packit |
ae235b |
ino_t inode;
|
|
Packit |
ae235b |
} dep_list;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
typedef void (* no_entry_cb) (void *udata);
|
|
Packit |
ae235b |
typedef void (* single_entry_cb) (void *udata, const char *path, ino_t inode);
|
|
Packit |
ae235b |
typedef void (* dual_entry_cb) (void *udata,
|
|
Packit |
ae235b |
const char *from_path, ino_t from_inode,
|
|
Packit |
ae235b |
const char *to_path, ino_t to_inode);
|
|
Packit |
ae235b |
typedef void (* list_cb) (void *udata, const dep_list *list);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
typedef struct traverse_cbs {
|
|
Packit |
ae235b |
single_entry_cb added;
|
|
Packit |
ae235b |
single_entry_cb removed;
|
|
Packit |
ae235b |
dual_entry_cb replaced;
|
|
Packit |
ae235b |
single_entry_cb overwritten;
|
|
Packit |
ae235b |
dual_entry_cb moved;
|
|
Packit |
ae235b |
list_cb many_added;
|
|
Packit |
ae235b |
list_cb many_removed;
|
|
Packit |
ae235b |
no_entry_cb names_updated;
|
|
Packit |
ae235b |
} traverse_cbs;
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
dep_list* dl_create (char *path, ino_t inode);
|
|
Packit |
ae235b |
void dl_print (const dep_list *dl);
|
|
Packit |
ae235b |
dep_list* dl_shallow_copy (const dep_list *dl);
|
|
Packit |
ae235b |
void dl_shallow_free (dep_list *dl);
|
|
Packit |
ae235b |
void dl_free (dep_list *dl);
|
|
Packit |
ae235b |
dep_list* dl_listing (const char *path);
|
|
Packit |
ae235b |
void dl_diff (dep_list **before, dep_list **after);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
void
|
|
Packit |
ae235b |
dl_calculate (dep_list *before,
|
|
Packit |
ae235b |
dep_list *after,
|
|
Packit |
ae235b |
const traverse_cbs *cbs,
|
|
Packit |
ae235b |
void *udata);
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
|
|
Packit |
ae235b |
#endif /* __DEP_LIST_H__ */
|