Whamcloud - gitweb
3811b41cec005cf7a82161c2e905c62228d7d211
[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_cookie;
38         struct obd_ioctl_data  oc_data;
39         char                   oc_buffer[8192];
40 };
41
42 struct obdio_barrier {
43         uint64_t               ob_id;
44         uint64_t               ob_oid;
45         uint64_t               ob_npeers;
46         uint64_t               ob_ordinal;
47         uint64_t               ob_count;
48 };
49
50 extern struct obdio_conn * obdio_connect (int device);
51 extern void obdio_disconnect (struct obdio_conn *conn);
52 extern int obdio_open (struct obdio_conn *conn, uint64_t oid,
53                        struct lustre_handle *fh);
54 extern int obdio_close (struct obdio_conn *conn, uint64_t oid,
55                         struct lustre_handle *fh);
56 extern int obdio_pread (struct obdio_conn *conn, uint64_t oid,
57                         char *buffer, uint32_t count, uint64_t offset);
58 extern int obdio_pwrite (struct obdio_conn *conn, uint64_t oid,
59                          char *buffer, uint32_t count, uint64_t offset);
60 extern int obdio_enqueue (struct obdio_conn *conn, uint64_t oid,
61                           int mode, uint64_t offset, uint32_t count,
62                           struct lustre_handle *lh);
63 extern int obdio_cancel (struct obdio_conn *conn, struct lustre_handle *lh);
64 extern void *obdio_alloc_aligned_buffer (void **spacep, int size);
65 extern struct obdio_barrier *obdio_new_barrier (uint64_t oid, uint64_t id, int npeers) ;
66 extern int obdio_setup_barrier (struct obdio_conn *conn, struct obdio_barrier *b);
67 extern int obdio_barrier (struct obdio_conn *conn, struct obdio_barrier *b);
68
69 #endif