X-Git-Url: http://git.tuebingen.mpg.de/?p=adu.git;a=blobdiff_plain;f=adu.h;h=2a15457b4b335bda8d28f219c8f100acfc6c5740;hp=18d9c47c6a3561a2367d5e417b1a466c6180f50b;hb=cecbe8525740b4a899cb1a6c91064e195ae1ada2;hpb=0d786b0b8ce8740abaf3dfa05a79ed085b1f1fab diff --git a/adu.h b/adu.h index 18d9c47..2a15457 100644 --- a/adu.h +++ b/adu.h @@ -8,7 +8,7 @@ #include #include -#include +#include #include #include #include /* time(), localtime() */ @@ -16,11 +16,7 @@ #include #include #include -#include -#include -#include -#include -#include /* needed by create_pf_socket */ +#include #include #include #include @@ -118,6 +114,9 @@ } \ } +/** Evaluates to 1 if x < y, to -1 if x > y and to 0 if x == y. */ +#define NUM_COMPARE(x, y) ((int)((x) < (y)) - (int)((x) > (y))) + /** The columns of the directory table. */ enum dir_table_columns { /** The name of the directory. */ @@ -174,12 +173,12 @@ enum search_uid_flags { CREATE_USER_TABLE = 2, }; +#define FOR_EACH_UID_RANGE(ur, urs) for (ur = urs; ur->low <= ur->high; ur++) + extern uint32_t num_uids; extern struct osl_table *dir_table; -extern uint64_t num_dirs; -extern uint64_t num_files; -extern uint64_t num_bytes; extern struct gengetopt_args_info conf; +extern struct select_args_info select_conf; /* adu.c */ __printf_2_3 void __log(int, const char*, ...); @@ -188,23 +187,16 @@ void check_signals(void); void close_all_tables(void); char *get_uid_list_name(void); void create_hash_table(unsigned bits); -int search_uid(uint32_t uid, enum search_uid_flags flags, - struct user_info **ui_ptr); +int search_uid(uint32_t uid, struct uid_range *urs, + enum search_uid_flags flags, struct user_info **ui_ptr); int for_each_admissible_user(int (*func)(struct user_info *, void *), void *data); +void sort_hash_table(int (*comp)(const void *, const void *)); /* select.c */ +int run_select_query(struct uid_range *admissible_uids); int com_select(void); /* create.h */ int com_create(void); - -static inline int ui_used(struct user_info *ui) -{ - return ui->flags & UI_FL_SLOT_USED; -} - -static inline int ui_admissible(struct user_info *ui) -{ - return ui->flags & UI_FL_ADMISSIBLE; -} +int com_interactive(void);