09321c driver, unit context: remove input-mapping interfaces which are not needed.

Authored and Committed by midipix 6 years ago
    driver, unit context: remove input-mapping interfaces which are not needed.
    
        
file modified
+0 -10
include/apimagic/apimagic.h CHANGED
@@ -78,11 +78,6 @@ enum amgc_output_action {
78
78
AMGC_LIST_FUNCTION,
79
79
};
80
80
81
- struct amgc_input {
82
- void * addr;
83
- size_t size;
84
- };
85
-
86
81
struct amgc_source_version {
87
82
int major;
88
83
int minor;
@@ -180,7 +175,6 @@ struct amgc_unit_entities {
180
175
181
176
struct amgc_unit_ctx {
182
177
const char * const * path;
183
- const struct amgc_input * map;
184
178
const struct amgc_common_ctx * cctx;
185
179
const struct amgc_unit_meta * meta;
186
180
const struct amgc_unit_entities*entities;
@@ -320,10 +314,6 @@ amgc_api int amgc_output_union (const struct amgc_driver_ctx *,
320
314
amgc_api int amgc_output_error_record (const struct amgc_driver_ctx *, const struct amgc_error_info *);
321
315
amgc_api int amgc_output_error_vector (const struct amgc_driver_ctx *);
322
316
323
- /* raw input api */
324
- amgc_api int amgc_map_input (const struct amgc_driver_ctx *, int fd, const char * path, int prot, struct amgc_input *);
325
- amgc_api int amgc_unmap_input (struct amgc_input *);
326
-
327
317
/* low-level api */
328
318
amgc_api int amgc_init_unit_meta (const struct amgc_unit_ctx *, struct amgc_unit_meta *);
329
319
file modified
+0 -1
project/common.mk CHANGED
@@ -6,7 +6,6 @@ API_SRCS = \
6
6
src/driver/amgc_unit_ctx.c \
7
7
src/logic/amgc_enum_members.c \
8
8
src/logic/amgc_init_unit_meta.c \
9
- src/logic/amgc_map_input.c \
10
9
src/logic/amgc_unit_entities.c \
11
10
src/output/amgc_output_compound.c \
12
11
src/output/amgc_output_entities.c \
src/internal/apimagic_driver_impl.h CHANGED
@@ -47,7 +47,6 @@ struct amgc_driver_ctx_impl {
47
47
struct amgc_unit_ctx_impl {
48
48
const struct amgc_driver_ctx * dctx;
49
49
const char * path;
50
- struct amgc_input map;
51
50
struct amgc_common_ctx cctx;
52
51
struct amgc_unit_ctx uctx;
53
52
struct amgc_unit_meta meta;
src/logic/amgc_map_input.c DELETED
@@ -1,62 +0,0 @@
1
- /**********************************************************/
2
- /* apimagic: cparser-based API normalization utility */
3
- /* Copyright (C) 2015--2016 Z. Gilboa */
4
- /* Released under GPLv2 and GPLv3; see COPYING.APIMAGIC. */
5
- /**********************************************************/
6
-
7
- #include <stdint.h>
8
- #include <stdbool.h>
9
- #include <unistd.h>
10
- #include <fcntl.h>
11
- #include <sys/mman.h>
12
- #include <sys/types.h>
13
- #include <sys/stat.h>
14
-
15
- #include <apimagic/apimagic.h>
16
- #include "apimagic_errinfo_impl.h"
17
-
18
- int amgc_map_input(
19
- const struct amgc_driver_ctx * dctx,
20
- int fd,
21
- const char * path,
22
- int prot,
23
- struct amgc_input * map)
24
- {
25
- struct stat st;
26
- bool fnew;
27
- int ret;
28
-
29
- if ((fnew = (fd < 0)))
30
- fd = open(path,O_RDONLY | O_CLOEXEC);
31
-
32
- if (fd < 0)
33
- return AMGC_SYSTEM_ERROR(dctx);
34
-
35
- if ((ret = fstat(fd,&st) < 0) && fnew)
36
- close(fd);
37
-
38
- else if ((st.st_size == 0) && fnew)
39
- close(fd);
40
-
41
- if (ret < 0)
42
- return AMGC_SYSTEM_ERROR(dctx);
43
-
44
- else if (st.st_size == 0)
45
- return AMGC_CUSTOM_ERROR(
46
- dctx,AMGC_ERR_SOURCE_SIZE_ZERO);
47
-
48
- map->size = st.st_size;
49
- map->addr = mmap(0,map->size,prot,MAP_PRIVATE,fd,0);
50
-
51
- if (fnew)
52
- close(fd);
53
-
54
- return (map->addr == MAP_FAILED)
55
- ? AMGC_SYSTEM_ERROR(dctx)
56
- : 0;
57
- }
58
-
59
- int amgc_unmap_input(struct amgc_input * map)
60
- {
61
- return munmap(map->addr,map->size);
62
- }