4 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
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.
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).
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
24 * Copyright (c) 2012 Whamcloud, Inc.
25 * Use is subject to license terms.
31 #ifndef _LQUOTA_INTERNAL_H
32 #define _LQUOTA_INTERNAL_H
34 #define QTYPE_NAME(qtype) ((qtype) == USRQUOTA ? "usr" : "grp")
36 #define QIF_IFLAGS (QIF_INODES | QIF_ITIME | QIF_ILIMITS)
37 #define QIF_BFLAGS (QIF_SPACE | QIF_BTIME | QIF_BLIMITS)
39 /* The biggest filename are the one used for slave index which are in the form
40 * of 0x%x-%s,glb_fid.f_oid,slv_uuid, that's to say:
41 * 2(0x) + 8(f_oid) + 1(-) + 40(UUID_MAX) which means 51 chars + '\0' */
42 #define LQUOTA_NAME_MAX 52
44 /* reserved OID in FID_SEQ_QUOTA for local objects */
45 enum lquota_local_oid {
46 LQUOTA_USR_OID = 1UL, /* slave index copy for user quota */
47 LQUOTA_GRP_OID = 2UL, /* slave index copy for group quota */
48 /* all OIDs after this are allocated dynamically by the QMT */
49 LQUOTA_GENERATED_OID = 4096UL,
52 /* Common data shared by quota-level handlers. This is allocated per-thread to
53 * reduce stack consumption */
54 struct lquota_thread_info {
55 union lquota_rec qti_rec;
57 struct lu_attr qti_attr;
58 struct dt_object_format qti_dof;
59 struct lustre_mdt_attrs qti_lma;
60 struct lu_fid qti_fid;
61 char qti_buf[LQUOTA_NAME_MAX];
64 #define qti_glb_rec qti_rec.lqr_glb_rec
65 #define qti_acct_rec qti_rec.lqr_acct_rec
66 #define qti_slv_rec qti_rec.lqr_slv_rec
68 extern struct lu_context_key lquota_thread_key;
70 /* extract lquota_threa_info context from environment */
72 struct lquota_thread_info *lquota_info(const struct lu_env *env)
74 struct lquota_thread_info *info;
76 info = lu_context_key_get(&env->le_ctx, &lquota_thread_key);
82 struct dt_object *acct_obj_lookup(const struct lu_env *, struct dt_device *,
86 extern struct file_operations lprocfs_quota_seq_fops;
89 * old quota module initialization routines, to be removed */
90 int init_lustre_quota(void);
91 void exit_lustre_quota(void);
93 #endif /* _LQUOTA_INTERNAL_H */