Linux Kernel
3.7.1
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
include
linux
mtd
ubi.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) International Business Machines Corp., 2006
3
*
4
* This program is free software; you can redistribute it and/or modify
5
* it under the terms of the GNU General Public License as published by
6
* the Free Software Foundation; either version 2 of the License, or
7
* (at your option) any later version.
8
*
9
* This program is distributed in the hope that it will be useful,
10
* but WITHOUT ANY WARRANTY; without even the implied warranty of
11
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
12
* the GNU General Public License for more details.
13
*
14
* You should have received a copy of the GNU General Public License
15
* along with this program; if not, write to the Free Software
16
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17
*
18
* Author: Artem Bityutskiy (Битюцкий Артём)
19
*/
20
21
#ifndef __LINUX_UBI_H__
22
#define __LINUX_UBI_H__
23
24
#include <
linux/ioctl.h
>
25
#include <linux/types.h>
26
#include <
mtd/ubi-user.h
>
27
28
/* All voumes/LEBs */
29
#define UBI_ALL -1
30
31
/*
32
* enum ubi_open_mode - UBI volume open mode constants.
33
*
34
* UBI_READONLY: read-only mode
35
* UBI_READWRITE: read-write mode
36
* UBI_EXCLUSIVE: exclusive mode
37
*/
38
enum
{
39
UBI_READONLY
= 1,
40
UBI_READWRITE
,
41
UBI_EXCLUSIVE
42
};
43
102
struct
ubi_volume_info
{
103
int
ubi_num
;
104
int
vol_id
;
105
int
size
;
106
long
long
used_bytes
;
107
int
used_ebs
;
108
int
vol_type
;
109
int
corrupted
;
110
int
upd_marker
;
111
int
alignment
;
112
int
usable_leb_size
;
113
int
name_len
;
114
const
char
*
name
;
115
dev_t
cdev
;
116
};
117
150
struct
ubi_device_info
{
151
int
ubi_num
;
152
int
leb_size
;
153
int
leb_start
;
154
int
min_io_size
;
155
int
max_write_size
;
156
int
ro_mode
;
157
dev_t
cdev
;
158
};
159
160
/*
161
* Volume notification types.
162
* @UBI_VOLUME_ADDED: a volume has been added (an UBI device was attached or a
163
* volume was created)
164
* @UBI_VOLUME_REMOVED: a volume has been removed (an UBI device was detached
165
* or a volume was removed)
166
* @UBI_VOLUME_RESIZED: a volume has been re-sized
167
* @UBI_VOLUME_RENAMED: a volume has been re-named
168
* @UBI_VOLUME_UPDATED: data has been written to a volume
169
*
170
* These constants define which type of event has happened when a volume
171
* notification function is invoked.
172
*/
173
enum
{
174
UBI_VOLUME_ADDED
,
175
UBI_VOLUME_REMOVED
,
176
UBI_VOLUME_RESIZED
,
177
UBI_VOLUME_RENAMED
,
178
UBI_VOLUME_UPDATED
,
179
};
180
181
/*
182
* struct ubi_notification - UBI notification description structure.
183
* @di: UBI device description object
184
* @vi: UBI volume description object
185
*
186
* UBI notifiers are called with a pointer to an object of this type. The
187
* object describes the notification. Namely, it provides a description of the
188
* UBI device and UBI volume the notification informs about.
189
*/
190
struct
ubi_notification
{
191
struct
ubi_device_info
di
;
192
struct
ubi_volume_info
vi
;
193
};
194
195
/* UBI descriptor given to users when they open UBI volumes */
196
struct
ubi_volume_desc
;
197
198
int
ubi_get_device_info
(
int
ubi_num,
struct
ubi_device_info
*di);
199
void
ubi_get_volume_info
(
struct
ubi_volume_desc
*
desc
,
200
struct
ubi_volume_info
*vi);
201
struct
ubi_volume_desc
*
ubi_open_volume
(
int
ubi_num,
int
vol_id
,
int
mode
);
202
struct
ubi_volume_desc
*
ubi_open_volume_nm
(
int
ubi_num,
const
char
*
name
,
203
int
mode
);
204
struct
ubi_volume_desc
*
ubi_open_volume_path
(
const
char
*
pathname
,
int
mode
);
205
206
int
ubi_register_volume_notifier
(
struct
notifier_block
*nb,
207
int
ignore_existing);
208
int
ubi_unregister_volume_notifier
(
struct
notifier_block
*nb);
209
210
void
ubi_close_volume
(
struct
ubi_volume_desc
*
desc
);
211
int
ubi_leb_read
(
struct
ubi_volume_desc
*
desc
,
int
lnum,
char
*
buf
,
int
offset
,
212
int
len,
int
check
);
213
int
ubi_leb_write
(
struct
ubi_volume_desc
*
desc
,
int
lnum,
const
void
*
buf
,
214
int
offset
,
int
len);
215
int
ubi_leb_change
(
struct
ubi_volume_desc
*
desc
,
int
lnum,
const
void
*
buf
,
216
int
len);
217
int
ubi_leb_erase
(
struct
ubi_volume_desc
*
desc
,
int
lnum);
218
int
ubi_leb_unmap
(
struct
ubi_volume_desc
*
desc
,
int
lnum);
219
int
ubi_leb_map
(
struct
ubi_volume_desc
*
desc
,
int
lnum);
220
int
ubi_is_mapped
(
struct
ubi_volume_desc
*
desc
,
int
lnum);
221
int
ubi_sync
(
int
ubi_num);
222
int
ubi_flush
(
int
ubi_num,
int
vol_id
,
int
lnum);
223
224
/*
225
* This function is the same as the 'ubi_leb_read()' function, but it does not
226
* provide the checking capability.
227
*/
228
static
inline
int
ubi_read(
struct
ubi_volume_desc
*
desc
,
int
lnum,
char
*
buf
,
229
int
offset
,
int
len)
230
{
231
return
ubi_leb_read
(desc, lnum, buf, offset, len, 0);
232
}
233
#endif
/* !__LINUX_UBI_H__ */
Generated on Thu Jan 10 2013 13:57:24 for Linux Kernel by
1.8.2