Whamcloud - gitweb
Merge b_md into HEAD
[fs/lustre-release.git] / lustre / utils / obdiolib.h
1 /* -*- mode: c; c-basic-offset: 8; indent-tabs-mode: nil; -*-
2  * vim:expandtab:shiftwidth=8:tabstop=8:
3  *
4  *  Copyright (C) 2003 Cluster File Systems, Inc.
5  *   Author: Eric Barton <eeb@clusterfs.com> 
6  *
7  *   This file is part of Lustre, http://www.lustre.org.
8  *
9  *   Lustre is free software; you can redistribute it and/or
10  *   modify it under the terms of version 2 of the GNU General Public
11  *   License as published by the Free Software Foundation.
12  *
13  *   Lustre is distributed in the hope that it will be useful,
14  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  *   GNU General Public License for more details.
17  *
18  *   You should have received a copy of the GNU General Public License
19  *   along with Lustre; if not, write to the Free Software
20  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21  *
22  */
23 #ifndef _OBDIOLIB_H_
24 #define _OBDIOLIB_H_
25
26 #include <unistd.h>
27
28 #include <sys/types.h>
29 #include <sys/stat.h>
30
31 #include <linux/lustre_lib.h>
32 #include <linux/lustre_idl.h>
33 #include <linux/obd_class.h>
34
35 struct obdio_conn {
36         int                    oc_fd;
37         uint64_t               oc_conn_addr;
38         uint64_t               oc_conn_cookie;
39         struct obd_ioctl_data  oc_data;
40         char                   oc_buffer[8192];
41 };
42
43 struct obdio_barrier {
44         uint64_t               ob_id;
45         uint64_t               ob_oid;
46         uint64_t               ob_npeers;
47         uint64_t               ob_ordinal;
48         uint64_t               ob_count;
49 };
50         
51 extern struct obdio_conn * obdio_connect (int device);
52 extern void obdio_disconnect (struct obdio_conn *conn);
53 extern int obdio_open (struct obdio_conn *conn, uint64_t oid, 
54                        struct lustre_handle *fh);
55 extern int obdio_close (struct obdio_conn *conn, uint64_t oid, 
56                         struct lustre_handle *fh);
57 extern int obdio_pread (struct obdio_conn *conn, uint64_t oid, 
58                         char *buffer, uint32_t count, uint64_t offset);
59 extern int obdio_pwrite (struct obdio_conn *conn, uint64_t oid, 
60                          char *buffer, uint32_t count, uint64_t offset);
61 extern int obdio_enqueue (struct obdio_conn *conn, uint64_t oid,
62                           int mode, uint64_t offset, uint32_t count,
63                           struct lustre_handle *lh);
64 extern int obdio_cancel (struct obdio_conn *conn, struct lustre_handle *lh);
65 extern void *obdio_alloc_aligned_buffer (void **spacep, int size);
66 extern struct obdio_barrier *obdio_new_barrier (uint64_t oid, uint64_t id, int npeers) ;
67 extern int obdio_setup_barrier (struct obdio_conn *conn, struct obdio_barrier *b);
68 extern int obdio_barrier (struct obdio_conn *conn, struct obdio_barrier *b);
69
70 #endif