Add missing source code documentation of user.c.
[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 /** The columns of the id table. */
8 enum user_table_columns {
9         /** The numer of the directory. */
10         UT_DIR_NUM,
11         /** The number of bytes of all regular files in this dir owned by this id. */
12         UT_BYTES,
13         /** The number of files in this dir owned by this id. */
14         UT_FILES,
15         /** Number of columns in this table. */
16         NUM_UT_COLUMNS
17 };
18
19 /** Information about one admissible user. */
20 struct user_info {
21         /** User ID. */
22         uint32_t uid;
23         /** \sa enum uid_info_flags. */
24         uint32_t flags;
25         /** The user name.  */
26         char *pw_name;
27         /** The user table of this user.*/
28         struct osl_table *table;
29         /** Total number of files owned by this user. */
30         uint64_t files;
31         /** Total number of bytes owned by this user. */
32         uint64_t bytes;
33         /** Total number of directories that contain at least one file */
34         uint64_t dirs;
35         /** The description of the user table. */
36         struct osl_table_description *desc;
37 };
38
39 /** An opaque struct that contains info about which users are admissible. */
40 struct uid_range;
41
42 int create_user_table(uint32_t uid, struct user_info **ui_ptr);
43 int read_uid_file(void);
44 int write_uid_file(void);
45
46 void create_hash_table(unsigned bits);
47 void sort_hash_table(int (*comp)(struct user_info *, struct user_info *));
48
49 int for_each_admissible_user(int (*func)(struct user_info *, void *),
50                 void *data);
51 int parse_uid_arg(const char *orig_arg, struct uid_range **ur);
52 int append_users(char **users, int num_users,
53                 struct uid_range **admissible_uids, int num_uid_ranges);
54 void close_user_tables(void);
55 int open_admissible_user_tables(struct uid_range *admissible_uids);