-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathhio.h
87 lines (68 loc) · 2.5 KB
/
hio.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
* hio.h - PS2 HDD I/O
* $Id: hio.h,v 1.9 2006/09/01 17:27:43 bobi Exp $
*
* Copyright 2004 Bobi B., w1zard0f07@yahoo.com
*
* This file is part of hdl_dump.
*
* hdl_dump is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* hdl_dump is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with hdl_dump; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
#if !defined(_HIO_H)
#define _HIO_H
#include "config.h"
#include <stddef.h>
#include "dict.h"
C_START
/*
* HD Loader I/O interface below
*/
typedef struct hio_type hio_t;
typedef /*@only@*/ /*@out@*/ /*@null@*/ hio_t *hio_p_t;
typedef int (*hio_stat_t)(hio_t *hio,
/*@out@*/ u_int32_t *size_in_kb);
typedef int (*hio_read_t)(hio_t *hio,
u_int32_t start_sector,
u_int32_t num_sectors,
/*@out@*/ void *output,
/*@out@*/ u_int32_t *bytes);
typedef int (*hio_write_t)(hio_t *hio,
u_int32_t start_sector,
u_int32_t num_sectors,
const void *input,
/*@out@*/ u_int32_t *bytes);
typedef int (*hio_flush_t)(hio_t *hio);
typedef int (*hio_poweroff_t)(hio_t *hio);
typedef int (*hio_close_t)(/*@special@*/ /*@only@*/ hio_t *hio) /*@releases hio@*/;
/* return last error text in a memory buffer, that would be freed by calling hio_dispose_error_t */
typedef /*@only@*/ char *(*hio_last_error_t)(hio_t *hio);
typedef void (*hio_dispose_error_t)(hio_t *hio,
/*@only@*/ char *error);
struct hio_type
{
hio_stat_t stat;
hio_read_t read;
hio_write_t write;
hio_flush_t flush;
hio_close_t close;
hio_poweroff_t poweroff;
hio_last_error_t last_error;
hio_dispose_error_t dispose_error;
};
int hio_probe(const dict_t *config,
const char *path,
/*@special@*/ hio_p_t *hio) /*@allocates *hio@*/ /*@defines *hio@*/;
C_END
#endif /* _HIO_H defined? */