Initial commit to Gerrit
[profile/ivi/quota.git] / quot.h
1 /*
2  * Copyright (c) 1980, 1990 Regents of the University of California.
3  * Copyright (C) 2000, 2001 Silicon Graphics, Inc. [SGI]
4  * All rights reserved.
5  *
6  * [Extensions to support XFS are copyright SGI]
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted provided that the following conditions are
10  * met: 1. Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer. 2.
12  * Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution. 3. All advertising
15  * materials mentioning features or use of this software must display the
16  * following acknowledgement: This product includes software developed by the
17  * University of California, Berkeley and its contributors. 4. Neither the
18  * name of the University nor the names of its contributors may be used to
19  * endorse or promote products derived from this software without specific
20  * prior written permission.
21  *
22  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY
23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25  * DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR
26  * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32  * SUCH DAMAGE.
33  */
34
35 #define SEC24HR (60*60*24)      /* seconds per day */
36
37 typedef struct {
38         __uint32_t id;
39         char name[UT_NAMESIZE + 1];
40 } idcache_t;
41
42 typedef struct du {
43         struct du *next;
44         __uint64_t blocks;
45         __uint64_t blocks30;
46         __uint64_t blocks60;
47         __uint64_t blocks90;
48         __uint64_t nfiles;
49         __uint32_t id;
50 } du_t;
51
52 #define NDU     60000
53 #define DUHASH  8209
54 static du_t du[2][NDU];
55 static du_t *duhash[2][DUHASH];
56 static int ndu[2];
57
58 #define NID     256
59 #define IDMASK  (NID-1)
60
61 /*
62  *      === Start XFS specific types and definitions ===
63  */
64 #include <asm/types.h>
65
66 /* Structures returned from ioctl XFS_IOC_FSBULKSTAT */
67 typedef struct xfs_bstime {
68         time_t tv_sec;          /* seconds                      */
69         __s32 tv_nsec;          /* and nanoseconds              */
70 } xfs_bstime_t;
71
72 typedef struct xfs_bstat {
73         __u64 bs_ino;           /* inode number                 */
74         __u16 bs_mode;          /* type and mode                */
75         __u16 bs_nlink;         /* number of links              */
76         __u32 bs_uid;           /* user id                      */
77         __u32 bs_gid;           /* group id                     */
78         __u32 bs_rdev;          /* device value                 */
79         __s32 bs_blksize;       /* block size                   */
80         __s64 bs_size;          /* file size                    */
81         xfs_bstime_t bs_atime;  /* access time                  */
82         xfs_bstime_t bs_mtime;  /* modify time                  */
83         xfs_bstime_t bs_ctime;  /* inode change time            */
84         int64_t bs_blocks;      /* number of blocks             */
85         __u32 bs_xflags;        /* extended flags               */
86         __s32 bs_extsize;       /* extent size                  */
87         __s32 bs_extents;       /* number of extents            */
88         __u32 bs_gen;           /* generation count             */
89         __u16 bs_projid;        /* project id                   */
90         unsigned char bs_pad[14];       /* pad space, unused            */
91         __u32 bs_dmevmask;      /* DMIG event mask              */
92         __u16 bs_dmstate;       /* DMIG state info              */
93         __u16 bs_aextents;      /* attribute number of extents  */
94 } xfs_bstat_t;
95
96 /* The user-level BulkStat Request interface structure. */
97 typedef struct xfs_fsop_bulkreq {
98         __u64 *lastip;          /* last inode # pointer         */
99         __s32 icount;           /* count of entries in buffer   */
100         void *ubuffer;          /* user buffer for inode desc.  */
101         __s32 *ocount;          /* output count pointer         */
102 } xfs_fsop_bulkreq_t;
103
104 #ifndef XFS_IOC_FSBULKSTAT
105 #define XFS_IOC_FSBULKSTAT      _IOWR('X', 101, struct xfs_fsop_bulkreq)
106 #endif
107
108 #define NBSTAT  4069            /* XFS bulkstat inodes */
109 static void checkXFS(const char *file, char *fsdir);
110
111 /*
112  *      === End of XFS specific types and definitions ===
113  */