Project

General

Profile

Statistics
| Revision:

root / lab4 / .minix-src / include / minix / bdev.h @ 13

History | View | Annotate | Download (1.64 KB)

1
#ifndef _MINIX_BDEV_H
2
#define _MINIX_BDEV_H
3

    
4
/* Common API. */
5
extern void bdev_driver(dev_t dev, char *label);
6

    
7
/* Synchronous API. */
8
extern int bdev_open(dev_t dev, int access);
9
extern int bdev_close(dev_t dev);
10

    
11
extern ssize_t bdev_read(dev_t dev, u64_t pos, char *buf, size_t count,
12
        int flags);
13
extern ssize_t bdev_write(dev_t dev, u64_t pos, char *buf, size_t count,
14
        int flags);
15
extern ssize_t bdev_gather(dev_t dev, u64_t pos, iovec_t *vec, int count,
16
        int flags);
17
extern ssize_t bdev_scatter(dev_t dev, u64_t pos, iovec_t *vec, int count,
18
        int flags);
19
extern int bdev_ioctl(dev_t dev, unsigned long request, void *buf,
20
        endpoint_t user_endpt);
21

    
22
/* Asynchronous API. */
23
typedef int bdev_id_t;
24
typedef void *bdev_param_t;
25

    
26
typedef void (*bdev_callback_t)(dev_t dev, bdev_id_t id, bdev_param_t param,
27
        int result);
28

    
29
extern void bdev_flush_asyn(dev_t dev);
30

    
31
extern bdev_id_t bdev_read_asyn(dev_t dev, u64_t pos, char *buf, size_t count,
32
        int flags, bdev_callback_t callback, bdev_param_t param);
33
extern bdev_id_t bdev_write_asyn(dev_t dev, u64_t pos, char *buf, size_t count,
34
        int flags, bdev_callback_t callback, bdev_param_t param);
35
extern bdev_id_t bdev_gather_asyn(dev_t dev, u64_t pos, iovec_t *vec,
36
        int count, int flags, bdev_callback_t callback, bdev_param_t param);
37
extern bdev_id_t bdev_scatter_asyn(dev_t dev, u64_t pos, iovec_t *vec,
38
        int count, int flags, bdev_callback_t callback, bdev_param_t param);
39
extern bdev_id_t bdev_ioctl_asyn(dev_t dev, unsigned long request, void *buf,
40
        endpoint_t user_endpt, bdev_callback_t callback, bdev_param_t param);
41

    
42
extern int bdev_wait_asyn(bdev_id_t id);
43

    
44
extern void bdev_reply_asyn(message *m);
45

    
46
#endif /* _MINIX_BDEV_H */