2 * Copyright 2012 GRNET S.A. All rights reserved.
4 * Redistribution and use in source and binary forms, with or
5 * without modification, are permitted provided that the following
8 * 1. Redistributions of source code must retain the above
9 * copyright notice, this list of conditions and the following
11 * 2. Redistributions in binary form must reproduce the above
12 * copyright notice, this list of conditions and the following
13 * disclaimer in the documentation and/or other materials
14 * provided with the distribution.
16 * THIS SOFTWARE IS PROVIDED BY GRNET S.A. ``AS IS'' AND ANY EXPRESS
17 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GRNET S.A OR
20 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
24 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
26 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27 * POSSIBILITY OF SUCH DAMAGE.
29 * The views and conclusions contained in the software and
30 * documentation are those of the authors and should not be
31 * interpreted as representing official policies, either expressed
32 * or implied, of GRNET S.A.
38 #define XSEGBD_NAME "xsegbd"
40 #define XSEGBD_SEGMENT_NAMELEN 32
41 #define XSEGBD_TARGET_NAMELEN 127
43 #include <linux/kernel.h>
44 #include <linux/types.h>
45 #include <linux/wait.h>
46 #include <xseg/xseg.h>
47 #include <xtypes/xq.h>
51 struct xsegbd_pending {
52 struct request *request;
53 struct completion *comp;
54 struct xsegbd_device *dev;
58 char name[XSEGBD_SEGMENT_NAMELEN];
59 struct xseg_config config;
63 struct xsegbd_device {
66 struct request_queue *blk_queue;
72 xport src_portno, dst_portno;
74 struct xq blk_queue_pending;
75 struct xsegbd *xsegbd;
76 struct xsegbd_pending *blk_req_pending;
78 struct list_head node;
79 char target[XSEGBD_TARGET_NAMELEN + 1];
83 void __xsegbd_get(struct xsegbd_device *xsegbd_dev);
84 void __xsegbd_put(struct xsegbd_device *xsegbd_dev);
85 struct xsegbd_device *__xsegbd_get_dev(unsigned long id);