8 * 1. Don't have 'errno'
9 * 2. Have a problem with errno.h (it tries to #include_next <errno.h>, which does not exist.
13 #define errno GetLastError()
19 #include "filesystem.h"
22 #include <aros/config.h>
27 char FullName
[1]; /* We need to store the full pathname */
30 struct ELFNode
*FirstELF
= NULL
;
31 static struct ELFNode
*LastELF
= (struct ELFNode
*)&FirstELF
;
33 int AddKernelFile(char *name
)
37 n
= malloc(sizeof(struct ExtELFNode
) + strlen(name
) + 1);
42 strcpy(n
->FullName
, name
);
43 #if AROS_MODULES_DEBUG
44 n
->node
.Name
= n
->FullName
;
46 n
->node
.Name
= namepart(n
->FullName
);
49 LastELF
->Next
= &n
->node
;
55 void FreeKernelList(void)
57 struct ELFNode
*n
, *n2
;
59 for (n
= FirstELF
; n
; n
= n2
)
65 /* Reset list pointers. The list can ocassionally be reused (on Android, for example) */
66 LastELF
= (struct ELFNode
*)&FirstELF
;
69 void *open_file(struct ELFNode
*n
, unsigned int *err
)
73 f
= file_open(((struct ExtELFNode
*)n
)->FullName
, "rb");
79 void close_file(void *file
)
85 * read_block interface. we want to read from files here
87 int read_block(void *file
, unsigned long offset
, void *dest
, unsigned long length
)
91 err
= fseek(file
, offset
, SEEK_SET
);
95 err
= fread(dest
, length
, 1, file
);
103 * load_block also allocates the memory
105 void *load_block(void *file
, unsigned long offset
, unsigned long length
, unsigned int *err
)
107 void *dest
= malloc(length
);
111 *err
= read_block(file
, offset
, dest
, length
);
125 void free_block(void *addr
)