Whamcloud - gitweb
Branch b1_4_mountconf
[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  *   This file is part of Lustre, http://www.lustre.org
5  */
6 #ifndef _OBDIOLIB_H_
7 #define _OBDIOLIB_H_
8
9 #include <unistd.h>
10
11 #include <sys/types.h>
12 #include <sys/stat.h>
13
14 #include <linux/lustre_lib.h>
15 #include <linux/lustre_idl.h>
16 #include <linux/obd_class.h>
17
18 struct obdio_conn {
19         int                    oc_fd;
20         uint32_t               oc_device;
21         struct obd_ioctl_data  oc_data;
22         char                   oc_buffer[8192];
23 };
24
25 struct obdio_barrier {
26         uint64_t               ob_id;
27         uint64_t               ob_oid;
28         uint64_t               ob_npeers;
29         uint64_t               ob_ordinal;
30         uint64_t               ob_count;
31 };
32
33 extern struct obdio_conn * obdio_connect (int device);
34 extern void obdio_disconnect(struct obdio_conn *conn, int flags);
35 extern int obdio_open(struct obdio_conn *conn, uint64_t oid,
36                       struct lustre_handle *fh);
37 extern int obdio_close(struct obdio_conn *conn, uint64_t oid,
38                        struct lustre_handle *fh);
39 extern int obdio_pread(struct obdio_conn *conn, uint64_t oid,
40                        char *buffer, uint32_t count, uint64_t offset);
41 extern int obdio_pwrite(struct obdio_conn *conn, uint64_t oid,
42                         char *buffer, uint32_t count, uint64_t offset);
43 extern int obdio_enqueue(struct obdio_conn *conn, uint64_t oid,
44                          int mode, uint64_t offset, uint32_t count,
45                          struct lustre_handle *lh);
46 extern int obdio_cancel(struct obdio_conn *conn, struct lustre_handle *lh);
47 extern void *obdio_alloc_aligned_buffer(void **spacep, int size);
48 extern struct obdio_barrier *obdio_new_barrier(uint64_t oid, uint64_t id,
49                                                int npeers);
50 extern int obdio_setup_barrier(struct obdio_conn *conn,
51                                struct obdio_barrier *b);
52 extern int obdio_barrier(struct obdio_conn *conn, struct obdio_barrier *b);
53
54 #endif