Whamcloud - gitweb
LU-2145 target: move target code to the separate directory
[fs/lustre-release.git] / lustre / target / tgt_internal.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, Intel Corporation.
25  */
26 /*
27  * lustre/target/tgt_internal.h
28  *
29  * Lustre Unified Target header file
30  *
31  * Author: Mikhail Pershin <mike.pershin@intel.com>
32  */
33
34 #ifndef _TG_INTERNAL_H
35 #define _TG_INTERNAL_H
36
37 #include <lustre_net.h>
38 #include <lustre/lustre_idl.h>
39 #include <lu_target.h>
40 #include <lustre_export.h>
41 #include <lustre_fid.h>
42 #include <lustre_fld.h>
43 #include <lustre_req_layout.h>
44 #include <lustre_sec.h>
45
46 extern struct lu_context_key tgt_thread_key;
47
48 /**
49  * Common data shared by tg-level handlers. This is allocated per-thread to
50  * reduce stack consumption.
51  */
52 struct tgt_thread_info {
53         /* server and client data buffers */
54         struct lr_server_data    tti_lsd;
55         struct lsd_client_data   tti_lcd;
56         struct lu_buf            tti_buf;
57         loff_t                   tti_off;
58 };
59
60 static inline struct tgt_thread_info *tgt_th_info(const struct lu_env *env)
61 {
62         struct tgt_thread_info *tti;
63
64         tti = lu_context_key_get(&env->le_ctx, &tgt_thread_key);
65         LASSERT(tti);
66         return tti;
67 }
68
69 #endif /* _TG_INTERNAL_H */