added yours sincerely for files where I feel that I've made non-trivial contributions.
[openocd.git] / src / helper / fileio.h
1 /***************************************************************************
2 * Copyright (C) 2007 by Dominic Rath *
3 * Dominic.Rath@gmx.de *
4 * *
5 * Copyright (C) 2007,2008 Øyvind Harboe *
6 * oyvind.harboe@zylin.com *
7 * *
8 * This program is free software; you can redistribute it and/or modify *
9 * it under the terms of the GNU General Public License as published by *
10 * the Free Software Foundation; either version 2 of the License, or *
11 * (at your option) any later version. *
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 * You should have received a copy of the GNU General Public License *
19 * along with this program; if not, write to the *
20 * Free Software Foundation, Inc., *
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
22 ***************************************************************************/
23 #ifndef FILEIO_H
24 #define FILEIO_H
25
26 #define FILEIO_MAX_ERROR_STRING (128)
27
28 #include "types.h"
29
30 #include <stdio.h>
31 #include <unistd.h>
32 #include <stdlib.h>
33 #include <sys/types.h>
34 #include <sys/stat.h>
35 #include <errno.h>
36 #include <ctype.h>
37
38 enum fileio_type
39 {
40 FILEIO_TEXT,
41 FILEIO_BINARY,
42 };
43
44
45 enum fileio_access
46 {
47 FILEIO_READ, /* open for reading, position at beginning */
48 FILEIO_WRITE, /* open for writing, position at beginning */
49 FILEIO_READWRITE, /* open for writing, position at beginning, allow reading */
50 FILEIO_APPEND, /* open for writing, position at end */
51 FILEIO_APPENDREAD, /* open for writing, position at end, allow reading */
52 };
53
54 typedef struct fileio_s
55 {
56 char *url;
57 long long size;
58 enum fileio_type type;
59 enum fileio_access access;
60 FILE *file;
61 } fileio_t;
62
63 extern int fileio_write(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_written);
64 extern int fileio_read(fileio_t *fileio, u32 size, u8 *buffer, u32 *size_read);
65 extern int fileio_fgets(fileio_t *fileio, u32 size, char *buffer);
66 extern int fileio_seek(fileio_t *fileio, u32 position);
67 extern int fileio_close(fileio_t *fileio);
68 extern int fileio_open(fileio_t *fileio, char *url, enum fileio_access access, enum fileio_type type);
69 extern int fileio_read_u32(fileio_t *fileio, u32 *data);
70 extern int fileio_write_u32(fileio_t *fileio, u32 data);
71
72 #define ERROR_FILEIO_LOCATION_UNKNOWN (-1200)
73 #define ERROR_FILEIO_NOT_FOUND (-1201)
74 #define ERROR_FILEIO_OPERATION_FAILED (-1202)
75 #define ERROR_FILEIO_ACCESS_NOT_SUPPORTED (-1203)
76 #define ERROR_FILEIO_RESOURCE_TYPE_UNKNOWN (-1204)
77 #define ERROR_FILEIO_OPERATION_NOT_SUPPORTED (-1205)
78
79 #endif /* FILEIO_H */

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)