• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * drivers/block/ublock.c
3  *
4  * Copyright (C) 2010 Google, Inc.
5  *
6  * Author:
7  *     Thomas Tuttle <ttuttle@google.com>
8  *
9  * This software is licensed under the terms of the GNU General Public
10  * License version 2, as published by the Free Software Foundation, and
11  * may be copied, distributed, and modified under those terms.
12  *
13  * This program is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16  * GNU General Public License for more details.
17  *
18  */
19 
20 #ifndef __UBLOCK_H_
21 #define __UBLOCK_H_
22 
23 #include <linux/types.h>
24 
25 #define UBLOCK_VERSION 0
26 
27 enum {
28 	UBLOCK_INIT_IN   = 0,
29 	UBLOCK_INIT_OUT  = 1,
30 	UBLOCK_READY_IN  = 2,
31 	UBLOCK_READY_OUT = 3,
32 	UBLOCK_READ_IN   = 4,
33 	UBLOCK_READ_OUT  = 5,
34 	UBLOCK_WRITE_IN  = 6,
35 	UBLOCK_WRITE_OUT = 7,
36 };
37 
38 struct ublock_in_header {
39 	__u32 seq;
40 	__u32 opcode;
41 };
42 
43 struct ublock_out_header {
44 	__u32 seq;
45 	__u32 opcode;
46 };
47 
48 struct ublock_init_in {
49 	__u32 version;
50 	__u32 max_buf;
51 	__u32 index;
52 };
53 
54 struct ublock_init_out {
55 	__u32 version;
56 	__u32 max_buf;
57 	__u64 size;
58 };
59 
60 struct ublock_ready_in {
61 	__u32 _unused;
62 };
63 
64 struct ublock_ready_out {
65 	__u32 _unused;
66 };
67 
68 struct ublock_read_in {
69 	__u64 offset;
70 	__u64 length;
71 };
72 
73 struct ublock_read_out {
74 	__s32 status;
75 	__u8 data[];
76 };
77 
78 struct ublock_write_in {
79 	__u64 offset;
80 	__u64 length;
81 	__u8 data[];
82 };
83 
84 struct ublock_write_out {
85 	__s32 status;
86 };
87 
88 #endif
89