Whamcloud - gitweb
LU-3409 llite: silence lockdep warning in ll_md_blocking_ast
[fs/lustre-release.git] / lustre / include / lustre_linkea.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) 2013, Intel Corporation.
25  * Use is subject to license terms.
26  *
27  * Author: di wang <di.wang@intel.com>
28  */
29
30 struct linkea_data {
31         /**
32          * Buffer to keep link EA body.
33          */
34         struct lu_buf           *ld_buf;
35         /**
36          * The matched header, entry and its lenght in the EA
37          */
38         struct link_ea_header   *ld_leh;
39         struct link_ea_entry    *ld_lee;
40         int                     ld_reclen;
41 };
42
43 int linkea_data_new(struct linkea_data *ldata, struct lu_buf *buf);
44 int linkea_init(struct linkea_data *ldata);
45 void linkea_entry_unpack(const struct link_ea_entry *lee, int *reclen,
46                          struct lu_name *lname, struct lu_fid *pfid);
47 int linkea_add_buf(struct linkea_data *ldata, const struct lu_name *lname,
48                    const struct lu_fid *pfid);
49 void linkea_del_buf(struct linkea_data *ldata, const struct lu_name *lname);
50 int linkea_links_find(struct linkea_data *ldata, const struct lu_name *lname,
51                       const struct lu_fid  *pfid);
52
53 #define LINKEA_NEXT_ENTRY(ldata)        \
54         (struct link_ea_entry *)((char *)ldata.ld_lee + ldata.ld_reclen)
55
56 #define LINKEA_FIRST_ENTRY(ldata)       \
57         (struct link_ea_entry *)(ldata.ld_leh + 1)