Whamcloud - gitweb
4c3a8daec683e5034843ec0a83c8b01ba3437df2
[fs/lustre-release.git] / lustre / include / linux / lustre_fid.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2006 Cluster File Systems, Inc.
5  *
6  *   This file is part of Lustre, http://www.lustre.org.
7  *
8  *   Lustre is free software; you can redistribute it and/or
9  *   modify it under the terms of version 2 of the GNU General Public
10  *   License as published by the Free Software Foundation.
11  *
12  *   Lustre is distributed in the hope that it will be useful,
13  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
14  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15  *   GNU General Public License for more details.
16  *
17  *   You should have received a copy of the GNU General Public License
18  *   along with Lustre; if not, write to the Free Software
19  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20  *
21  */
22
23 #ifndef __LINUX_FID_H
24 #define __LINUX_FID_H
25
26 /*
27  * struct lu_fid
28  */
29 #include <linux/lustre_idl.h>
30
31 #include <libcfs/list.h>
32 #include <libcfs/kp30.h>
33
34 struct lu_context;
35 struct lu_seq_mgr_ops {
36         int (*smo_read) (struct lu_context *, void *opaque, __u64 *);
37         int (*smo_write) (struct lu_context *, void *opaque, __u64 *);
38 };
39
40 struct lu_seq_mgr {
41         /* seq management fields */
42         struct semaphore       m_seq_sem;
43         __u64                  m_seq;
44
45         /* ops related stuff */
46         void                  *m_opaque;
47         struct lu_seq_mgr_ops *m_ops;
48 };
49
50 /* init/fini methods */
51 struct lu_seq_mgr *seq_mgr_init(struct lu_seq_mgr_ops *, void *);
52 void seq_mgr_fini(struct lu_seq_mgr *);
53
54 /* seq management methods */
55 int seq_mgr_setup(struct lu_context *, struct lu_seq_mgr *);
56 int seq_mgr_read(struct lu_context *, struct lu_seq_mgr *);
57 int seq_mgr_write(struct lu_context *, struct lu_seq_mgr *);
58 int seq_mgr_alloc(struct lu_context *, struct lu_seq_mgr *, __u64 *);
59
60 #if 0
61 int fid_is_local(struct lu_site *site, const struct lu_fid *fid);
62 #else
63 static inline int fid_is_local(struct lu_site *site, const struct lu_fid *fid)
64 {
65         return 1;
66 }
67 #endif
68
69 #endif /* __LINUX_OBD_CLASS_H */