root/branches/asyncio/src/client/usrint/aiocommon.h @ 9432

Revision 9432, 3.0 KB (checked in by sdsnyde, 10 months ago)

added truncate operation to aiocommon. pxfs updated with ftruncate(64)

Line 
1/*
2 * (C) 2011 Clemson University and The University of Chicago
3 *
4 * See COPYING in top-level directory.
5 */
6#ifndef AIOCOMMON_H
7#define AIOCOMMON_H
8
9#include <unistd.h>
10#include <pthread.h>
11#include "pvfs2-types.h"
12#include "usrint.h"
13#include "posix-ops.h"
14#include "openfile-util.h"
15#include "iocommon.h"
16#include "aio.h"
17#include "quicklist.h"
18#include "gossip.h"
19#include "pvfs2-aio.h"
20
21#define PVFS_AIO_MAX_RUNNING 10
22#define PVFS_AIO_LISTIO_MAX 10
23
24#define PVFS_AIO_DEFAULT_TIMEOUT_MS 10
25
26enum
27{
28    PVFS_AIO_PROGRESS_IDLE,
29    PVFS_AIO_PROGRESS_RUNNING,
30};
31
32typedef enum
33{
34    PVFS_AIO_IO_OP = 1,
35    PVFS_AIO_IOV_OP,
36    PVFS_AIO_OPEN_OP,
37    PVFS_AIO_RENAME_OP,
38    PVFS_AIO_TRUNC_OP,
39    PVFS_AIO_STAT_OP,
40    PVFS_AIO_STAT64_OP,
41} PVFS_aio_op_code;
42
43/* the following structures contain operation dependent data for aio calls */
44struct PINT_aio_io_cb
45{
46    struct iovec *vector;       /* in */
47    int count;                  /* in (readv writev )*/
48    pvfs_descriptor *pd;        /* in */
49    enum PVFS_io_type which;    /* in */
50    off64_t offset;             /* in */
51    int advance_fp;             /* in */
52    void *sys_buf;             
53    PVFS_Request mem_req;       
54    PVFS_Request file_req;     
55    PVFS_sysresp_io io_resp;   
56    ssize_t *bcnt;              /* out */
57};
58
59struct PINT_aio_open_cb
60{
61    char *path;                     /* in */
62    char *directory;                /* in */
63    char *filename;                 /* in */
64    int flags;                      /* in */
65    PVFS_hint file_creation_param;  /* in */
66    int mode;                       /* in */
67    pvfs_descriptor *pdir;          /* in */
68    int *fd;                        /* in/out */
69    pvfs_descriptor *pd;            /* out */
70};
71
72struct PINT_aio_rename_cb
73{
74    PVFS_object_ref *oldpdir;   /* in */
75    char *olddir;               /* in */
76    char *oldname;              /* in */
77    PVFS_object_ref *newpdir;   /* in */
78    char *newdir;               /* in */
79    char *newname;              /* in */
80};
81
82struct PINT_aio_trunc_cb
83{
84    pvfs_descriptor *pd;    /* in */
85    off64_t length;         /* in */
86};
87
88struct PINT_aio_stat_cb
89{
90    pvfs_descriptor *pd;        /* in */
91    uint32_t mask;              /* in */
92    PVFS_sysresp_getattr getattr_resp;
93    void  *buf;           /* out */
94};
95
96/* a pvfs async control block, used for keeping track of async
97 * operations outstanding in the filesystem
98 */
99struct pvfs_aiocb
100{
101    PVFS_sys_op_id op_id;
102    PVFS_hint hints;
103
104    PVFS_aio_op_code op_code;
105    PVFS_error error_code;
106    struct qlist_head link;
107
108    int (*call_back_fn)(void *c_dat, int status);
109    void *call_back_dat;
110
111    union
112    {
113        struct PINT_aio_io_cb io;
114        struct PINT_aio_open_cb open;
115        struct PINT_aio_rename_cb rename;
116        struct PINT_aio_trunc_cb trunc;
117        struct PINT_aio_stat_cb stat;
118    } u;
119};
120
121int aiocommon_init(void);
122
123void aiocommon_submit_op(struct pvfs_aiocb *p_cb);
124
125/*
126 * Local variables:
127 *  c-indent-level: 4
128 *  c-basic-offset: 4
129 * End:
130 *
131 * vim: ts=8 sts=4 sw=4 expandtab
132 */
133
134#endif
Note: See TracBrowser for help on using the browser.