Statistics
| Branch: | Revision:

root / drivers / tapdisk-driver.h @ abdb293f

History | View | Annotate | Download (2.5 kB)

1
/* 
2
 * Copyright (c) 2008, XenSource Inc.
3
 * All rights reserved.
4
 *
5
 * Redistribution and use in source and binary forms, with or without
6
 * modification, are permitted provided that the following conditions are met:
7
 *     * Redistributions of source code must retain the above copyright
8
 *       notice, this list of conditions and the following disclaimer.
9
 *     * Redistributions in binary form must reproduce the above copyright
10
 *       notice, this list of conditions and the following disclaimer in the
11
 *       documentation and/or other materials provided with the distribution.
12
 *     * Neither the name of XenSource Inc. nor the names of its contributors
13
 *       may be used to endorse or promote products derived from this software
14
 *       without specific prior written permission.
15
 *
16
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
20
 * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
21
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
22
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
23
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
24
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
25
 * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
26
 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27
 */
28
#ifndef _TAPDISK_DRIVER_H_
29
#define _TAPDISK_DRIVER_H_
30

    
31
#include "tapdisk.h"
32
#include "scheduler.h"
33
#include "tapdisk-queue.h"
34
#include "tapdisk-loglimit.h"
35

    
36
#define TD_DRIVER_OPEN               0x0001
37
#define TD_DRIVER_RDONLY             0x0002
38

    
39
struct td_driver_handle {
40
        int                          type;
41
        char                        *name;
42

    
43
        int                          storage;
44

    
45
        int                          refcnt;
46
        td_flag_t                    state;
47

    
48
        td_disk_info_t               info;
49

    
50
        void                        *data;
51
        const struct tap_disk       *ops;
52

    
53
        td_loglimit_t                loglimit;
54
        struct list_head             next;
55
};
56

    
57
td_driver_t *tapdisk_driver_allocate(int, const char *, td_flag_t);
58
void tapdisk_driver_free(td_driver_t *);
59

    
60
void tapdisk_driver_queue_tiocb(td_driver_t *, struct tiocb *);
61

    
62
void tapdisk_driver_debug(td_driver_t *);
63

    
64
void tapdisk_driver_stats(td_driver_t *, td_stats_t *);
65

    
66
int tapdisk_driver_log_pass(td_driver_t *, const char *caller);
67

    
68
#endif