2 * (C) Copyright 2007-2011 Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
4 * This file is released under the GPLv2. See the COPYING file for more
12 #include <directory.h>
18 struct sysconf sysconf
;
20 static void __load_logos(struct fs
*fs
)
22 struct logo
*logo
, *tmp
;
28 list_for_each_entry_safe(logo
, tmp
, &sysconf
.logos
, list
) {
29 /* look up the config file */
30 file
= edf_lookup(fs
, logo
->fn
, logo
->ft
);
34 if ((file
->FST
.LRECL
!= CONFIG_LRECL
) ||
35 (file
->FST
.RECFM
!= FSTDFIX
))
38 /* parse each record in the config file */
39 for(i
=0; i
<file
->FST
.AIC
; i
++) {
40 rec
= malloc(sizeof(struct logo_rec
) + CONFIG_LRECL
,
45 ret
= edf_read_rec(file
, (char*) rec
->data
, i
);
49 ebcdic2ascii(rec
->data
, CONFIG_LRECL
);
51 list_add_tail(&rec
->list
, &logo
->lines
);
57 list_del(&logo
->list
);
62 static void *_realloc(void *ptr
, size_t n
)
65 return malloc(n
, ZONE_NORMAL
);
71 static void _error(struct parser
*parser
, char *msg
)
73 sclp_msg("config parse error: %s\n", msg
);
77 struct fs
*load_config(u32 iplsch
)
84 sclp_msg("LOADING CONFIG FROM '%*.*s' '%*.*s'\n",
85 8, 8, CONFIG_FILE_NAME
, 8, 8, CONFIG_FILE_TYPE
);
87 memset(&sysconf
, 0, sizeof(struct sysconf
));
88 INIT_LIST_HEAD(&sysconf
.rdevs
);
89 INIT_LIST_HEAD(&sysconf
.logos
);
91 /* find the real device */
92 dev
= find_device_by_sch(iplsch
);
101 /* set up the parser */
102 memset(&p
, 0, sizeof(p
));
105 p
.realloc
= _realloc
;
109 /* set up the lexer */
110 memset(&l
, 0, sizeof(l
));
115 if (config_parse(&p
))
116 return ERR_PTR(-ECORRUPT
);