Whamcloud - gitweb
8d54c8f2292fbad3cd1fe9904d59552a03621496
[fs/lustre-release.git] / lustre / include / lquota.h
1 /*
2  * GPL HEADER START
3  *
4  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License version 2 only,
8  * as published by the Free Software Foundation.
9  *
10  * This program is distributed in the hope that it will be useful, but
11  * WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * General Public License version 2 for more details (a copy is included
14  * in the LICENSE file that accompanied this code).
15  *
16  * You should have received a copy of the GNU General Public License
17  * version 2 along with this program; if not, write to the
18  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19  * Boston, MA 021110-1307, USA
20  *
21  * GPL HEADER END
22  */
23 /*
24  * Copyright (c) 2011, 2012, Whamcloud, Inc.
25  * Use is subject to license terms.
26  */
27
28 #include <dt_object.h>
29 #include <lustre_fid.h>
30 #include <lustre_dlm.h>
31
32 #ifndef _LUSTRE_LQUOTA_H
33 #define _LUSTRE_LQUOTA_H
34
35 /*
36  * Space accounting support
37  * Format of an accounting record, providing disk usage information for a given
38  * user or group
39  */
40 struct acct_rec { /* 16 bytes */
41         __u64 bspace;  /* current space in use */
42         __u64 ispace;  /* current # inodes in use */
43 };
44
45 /*
46  * Quota enforcement support on slaves
47  */
48
49 struct qsd_instance;
50
51 /* The quota slave feature is implemented under the form of a library.
52  * The API is the following:
53  *
54  * - qsd_init(): the user (mostly the OSD layer) should first allocate a qsd
55  *               instance via qsd_init(). This sets up on-disk objects
56  *               associated with the quota slave feature and initiates the quota
57  *               reintegration procedure if needed. qsd_init() should typically
58  *               be called when ->ldo_start is invoked.
59  *
60  * - qsd_fini(): is used to release a qsd_instance structure allocated with
61  *               qsd_init(). This releases all quota slave objects and frees the
62  *               structures associated with the qsd_instance.
63  *
64  * Below are the function prototypes to be used by OSD layer to manage quota
65  * enforcement. Arguments are documented where each function is defined.  */
66
67 struct qsd_instance *qsd_init(const struct lu_env *, char *, struct dt_device *,
68                               cfs_proc_dir_entry_t *);
69
70 void qsd_fini(const struct lu_env *, struct qsd_instance *);
71
72 /* helper function used by MDT & OFD to retrieve quota accounting information
73  * on slave */
74 int lquotactl_slv(const struct lu_env *, struct dt_device *,
75                   struct obd_quotactl *);
76
77 #ifdef LPROCFS
78 /* dumb procfs handler which always report success, for backward compatibility
79  * purpose */
80 int lprocfs_quota_rd_type_dumb(char *, char **, off_t, int, int *, void *);
81 int lprocfs_quota_wr_type_dumb(struct file *, const char *, unsigned long,
82                                void *);
83 #endif /* LPROCFS */
84 #endif /* _LUSTRE_LQUOTA_H */