Whamcloud - gitweb
Branch 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  *   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 <lustre_lib.h>
15 #include <lustre/lustre_idl.h>
16 #include <obd_class.h>
17
18 struct obdio_conn {
19         int                    oc_fd;
20         __u32                  oc_device;
21         struct obd_ioctl_data  oc_data;
22         char                   oc_buffer[8192];
23 };
24
25 struct obdio_barrier {
26         __u64                  ob_id;
27         __u64                  ob_oid;
28         __u64                  ob_npeers;
29         __u64                  ob_ordinal;
30         __u64                  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, __u64 oid,
36                       struct lustre_handle *fh);
37 extern int obdio_close(struct obdio_conn *conn, __u64 oid,
38                        struct lustre_handle *fh);
39 extern int obdio_pread(struct obdio_conn *conn, __u64 oid,
40                        void *buffer, __u32 count, __u64 offset);
41 extern int obdio_pwrite(struct obdio_conn *conn, __u64 oid,
42                         void *buffer, __u32 count, __u64 offset);
43 extern int obdio_enqueue(struct obdio_conn *conn, __u64 oid,
44                          int mode, __u64 offset, __u32 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(__u64 oid, __u64 id,
49                                                int npeers);
50 extern int obdio_setup_barrier(struct obdio_conn *conn,struct obdio_barrier *b);
51 extern int obdio_barrier(struct obdio_conn *conn, struct obdio_barrier *b);
52
53 #endif