File: vmelilo.h

package info (click to toggle)
vmelilo 1.5.4
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 428 kB
  • ctags: 920
  • sloc: ansic: 8,183; makefile: 157; asm: 122; perl: 18
file content (165 lines) | stat: -rw-r--r-- 5,029 bytes parent folder | download | duplicates (3)
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
/*
 *	VME Linux/m68k Loader
 *
 *	(c) Copyright 1997 by Nick Holgate
 *
 *	This file is subject to the terms and conditions of the GNU General Public
 *	License.  See the file COPYING for more details.
 */

/*--------------------------------------------------------------------------*/

#include <stdio.h>
#include <string.h>
#include <sys/types.h>

#include "version.h"

#define CONFIG_PARSER	1		/* include extra vmelilo config parser stuff*/

#include "loaderdefs.h"

/*--------------------------------------------------------------------------*/

#define LILO_CONFIGFILE			"/etc/vmelilo.conf"
#define LILO_LOADERFILE			"/boot/boot.loader"
#define LILO_BACKUPFILEPREFIX	"/boot/backup"

/*--------------------------------------------------------------------------*/
/* Configuration File Parsing
 */

typedef struct {
	const char			*boot_device_name;
	const char			*default_password;
	const char			*default_kernel;
	const char			*default_cmdline;
	const char			*default_append;
	const char			*default_root;
	const char			*default_console;
	const unsigned long	*default_read_only;
	const unsigned long	*default_restricted;
 	BOOTOPTIONS			options;
	BOOTRECORD			*records;
	FILEDEF				*files;

} CONFIG;

#define with_default(rec, mem) \
  (((rec)->mem != NULL) ? (rec)->mem : config.default_ ## mem)

/*--------------------------------------------------------------------------*/

typedef struct {
	int			maxsize;			/* space allocated for tag data			*/
	int			cursize;			/* amount of tag data so far			*/
	char		*data;				/* pointer to collected tag data		*/

} MEMFILE;

/*--------------------------------------------------------------------------*/

typedef struct {
 const char		*monitor_name;				/* name of debug monitor		*/
 unsigned char	*loader_code;				/* boot loader code				*/
 int			loader_code_size;			/* size of boot loader code		*/
 int			boot_block_size;			/* size of boot block in bytes	*/
 void			(*init_boot_block)(void *);	/* initialise a boot block		*/
 int			(*valid_boot_block)(void *);/* validate a boot block		*/

} SUBARCH;

/*--------------------------------------------------------------------------*/

#ifndef DECLARE_GLOBALS
#define GLOBAL	extern
#define _I_(v)
#else
#define GLOBAL
#define _I_(v)	v
#endif

/*--------------------------------------------------------------------------*/

GLOBAL const char	LiloVersion[]			_I_( = VERSION );

/*--------------------------------------------------------------------------*/
/* Command Line Options
 */
GLOBAL const char		*program_name;
GLOBAL int				f_verbose;
GLOBAL int				f_quiet;
GLOBAL int				f_install;
GLOBAL int				f_backup;
GLOBAL int				f_uninstall;
GLOBAL int				f_force;
GLOBAL int				f_test;
GLOBAL const char		*save_boot_block;
GLOBAL const char		*restore_boot_block;
GLOBAL const char		*root_path;
GLOBAL int				m68k_model _I_( = -1 );
#define MODEL_BVME		0			/* BVME4000/6000 using BVMBug monitor	*/
#define MODEL_MVME		1			/* Motorola SBC using Motorola monitor	*/

/*--------------------------------------------------------------------------*/
/*	Lilo Data
 */
GLOBAL void				*boot_block_buffer;
GLOBAL const FILEMAP	*loader_map;
GLOBAL MEMFILE			map_data;
GLOBAL dev_t			boot_device;
GLOBAL CONFIG			config;

/*--------------------------------------------------------------------------*/
/* Files
 */
GLOBAL const char		*config_file;
GLOBAL const char		*loader_file;
GLOBAL const char		*backup_file;

/*--------------------------------------------------------------------------*/
/* Drivers
 */

extern SUBARCH bvme_subarch;
extern SUBARCH mvme_subarch;

GLOBAL SUBARCH *subarch[]
#ifdef DECLARE_GLOBALS
  =	{	&bvme_subarch,
		&mvme_subarch
	}
#endif
;

#define monitor_name		( subarch[m68k_model]->monitor_name    )
#define loader_code			( subarch[m68k_model]->loader_code     )
#define loader_code_size	( subarch[m68k_model]->loader_code_size)
#define boot_block_size		( subarch[m68k_model]->boot_block_size )
#define init_boot_block		(*subarch[m68k_model]->init_boot_block )
#define valid_boot_block	(*subarch[m68k_model]->valid_boot_block)

/*--------------------------------------------------------------------------*/
/* Function Prototypes
 */

char * skip_white(char *);
int equal_strings (const char *s1, const char *s2);
int case_equal_strings (const char *s1, const char *s2);
void die (const char *fmt, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
void message(const char *fmt, ...) __attribute__ ((format (printf, 1, 2)));
void error_nomemory (void);
void error_open (const char *name);
void error_opendir (const char *name);
void error_read (const char *name);
void error_write (const char *name);
void error_seek (const char *name);
void error_stat (const char *name);
void error_ioctl (const char *name,const char *ioctl);
void read_config_file (void);
int is_scsi_partition (unsigned rdev);
const FILEMAP * create_file_map (const char *name);
const char * create_backup_filename (void);
void remove_file_def(const char *path);

/*-----------------------------< end of file >------------------------------*/