]> git.tuebingen.mpg.de Git - adu.git/blob - user.h
Some more source code documentation.
[adu.git] / user.h
1 /*
2  * Copyright (C) 2008 Andre Noll <maan@systemlinux.org>
3  *
4  * Licensed under the GPL v2. For licencing details see COPYING.
5  */
6
7 /** \file user.h \brief User structures and exported symbols from user.c. */
8
9 /** The columns of the id table. */
10 enum user_table_columns {
11         /** The numer of the directory. */
12         UT_DIR_NUM,
13         /** The number of bytes of all regular files in this dir owned by this id. */
14         UT_BYTES,
15         /** The number of files in this dir owned by this id. */
16         UT_FILES,
17         /** Number of columns in this table. */
18         NUM_UT_COLUMNS
19 };
20
21 /** Information about one admissible user. */
22 struct user_info {
23         /** User ID. */
24         uint32_t uid;
25         /** \sa enum uid_info_flags. */
26         uint32_t flags;
27         /** The user name.  */
28         char *pw_name;
29         /** The user table of this user.*/
30         struct osl_table *table;
31         /** Total number of files owned by this user. */
32         uint64_t files;
33         /** Total number of bytes owned by this user. */
34         uint64_t bytes;
35         /** Total number of directories that contain at least one file */
36         uint64_t dirs;
37         /** The description of the user table. */
38         struct osl_table_description *desc;
39 };
40
41 /** An opaque struct that contains info about which users are admissible. */
42 struct uid_range;
43
44 int create_user_table(uint32_t uid, struct user_info **ui_ptr);
45 int read_uid_file(void);
46 int write_uid_file(void);
47
48 void create_hash_table(unsigned bits);
49 void sort_hash_table(int (*comp)(struct user_info *, struct user_info *));
50
51 int for_each_admissible_user(int (*func)(struct user_info *, void *),
52                 void *data);
53 int parse_uid_arg(const char *orig_arg, struct uid_range **ur);
54 int append_users(char **users, int num_users,
55                 struct uid_range **admissible_uids, int num_uid_ranges);
56 void close_user_tables(void);
57 int open_admissible_user_tables(struct uid_range *admissible_uids);