Initial commit to Gerrit
[profile/ivi/quota.git] / quotacheck.h
1 /*
2  *
3  *      Header file for quota checking utilities
4  *
5  */
6
7 #ifndef GUARD_QUOTACHECK_H
8 #define GUARD_QUOTACHECK_H
9
10 #include <sys/types.h>
11
12 #include "quota.h"
13 #include "quotaio.h"
14
15 #define NODQUOT ((struct dquot *)NULL)
16
17 #define FL_FORCE 1              /* Force check even if quota enabled */
18 #define FL_VERBOSE 2            /* Have verbose input */
19 #define FL_DEBUG 4              /* Have very verbose input */
20 #define FL_INTERACTIVE 8        /* Ask questions when needed */
21 #define FL_GUESSDQ 16           /* When more structures for same user found, use the first */
22 #define FL_NEWFILE 32           /* Don't try to read old file. Just create new one. */
23 #define FL_FORCEREMOUNT 64      /* Force check even when remounting RO fails */
24 #define FL_NOREMOUNT 128        /* Don't try to remount filesystem RO */
25 #define FL_ALL 256              /* Scan all mountpoints with quota? */
26 #define FL_NOROOT 512           /* Scan all mountpoints except root */
27 #define FL_BACKUPS 1024         /* Create backup of old quota file? */
28 #define FL_VERYVERBOSE 2048     /* Print directory names when checking */
29
30 extern int flags;               /* Options from command line */
31 extern struct util_dqinfo old_info[MAXQUOTAS];  /* Loaded info from file */
32
33 #ifdef DEBUG_MALLOC
34 extern size_t malloc_mem = 0;
35 extern size_t free_mem = 0;
36 #endif
37
38 void *xmalloc(size_t size);
39 void debug(int df, char *fmtstr, ...) __attribute__ ((__format__ (__printf__, 2, 3)));
40 int ask_yn(char *q, int def);
41 struct dquot *lookup_dquot(qid_t id, int type);
42 struct dquot *add_dquot(qid_t id, int type);
43 int v2_detect_version(char *filename, int fd, int type);
44 int v2_buffer_file(char *filename, int fd, int type, int version);
45 int v1_buffer_file(char *filename, int fd, int type);
46 void v2_merge_info(struct util_dqinfo *new, struct util_dqinfo *old);
47 #endif