xref: /netbsd-src/usr.sbin/sysinst/defs.h (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /*	$NetBSD: defs.h,v 1.11 2018/06/03 13:16:30 martin Exp $	*/
2 
3 /*
4  * Copyright 1997 Piermont Information Systems Inc.
5  * All rights reserved.
6  *
7  * Written by Philip A. Nelson for Piermont Information Systems Inc.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. The name of Piermont Information Systems Inc. may not be used to endorse
18  *    or promote products derived from this software without specific prior
19  *    written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
22  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24  * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
25  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
31  * THE POSSIBILITY OF SUCH DAMAGE.
32  *
33  */
34 
35 #ifndef _DEFS_H_
36 #define _DEFS_H_
37 
38 /* defs.h -- definitions for use in the sysinst program. */
39 
40 /* System includes needed for this. */
41 #include <sys/queue.h>
42 #include <sys/types.h>
43 #include <sys/disklabel.h>
44 #include <sys/disk.h>
45 
46 const char *getfslabelname(uint8_t);
47 
48 #include "msg_defs.h"
49 #include "menu_defs.h"
50 
51 #define min(a,b)	((a) < (b) ? (a) : (b))
52 #define max(a,b)	((a) > (b) ? (a) : (b))
53 
54 /* constants */
55 #define MEG (1024 * 1024)
56 #define STRSIZE 255
57 #define SSTRSIZE 30
58 
59 /* For run.c: collect() */
60 #define T_FILE		0
61 #define T_OUTPUT	1
62 
63 /* Some install status/response values */
64 #define	SET_OK		0		/* Set extracted */
65 #define	SET_RETRY	1		/* Retry */
66 #define	SET_SKIP	2		/* Skip this set */
67 #define	SET_SKIP_GROUP	3		/* Skip this set and rest of group */
68 #define	SET_ABANDON	4		/* Abandon installation */
69 #define	SET_CONTINUE	5		/* Continue (copy from floppy loop) */
70 
71 /* run_prog flags */
72 #define RUN_DISPLAY	0x0001		/* Display program output */
73 #define RUN_FATAL	0x0002		/* errors are fatal */
74 #define RUN_CHROOT	0x0004		/* chroot to target disk */
75 #define RUN_FULLSCREEN	0x0008		/* fullscreen (use with RUN_DISPLAY) */
76 #define RUN_SILENT	0x0010		/* Do not show output */
77 #define RUN_ERROR_OK	0x0040		/* Don't wait for error confirmation */
78 #define RUN_PROGRESS	0x0080		/* Output is just progess test */
79 #define RUN_NO_CLEAR	0x0100		/* Leave program output after error */
80 #define RUN_XFER_DIR	0x0200		/* cd to xfer_dir in child */
81 
82 /* for bsddisklabel.c */
83 enum { LY_SETNEW, LY_NEWRAID, LY_NEWCGD, LY_NEWLVM, LY_USEEXIST };
84 
85 /* Installation sets */
86 enum {
87     SET_NONE,
88     SET_KERNEL_FIRST,
89     SET_KERNEL_1,	/* Usually GENERIC */
90     SET_KERNEL_2,	/* MD kernel... */
91     SET_KERNEL_3,	/* MD kernel... */
92     SET_KERNEL_4,	/* MD kernel... */
93     SET_KERNEL_5,	/* MD kernel... */
94     SET_KERNEL_6,	/* MD kernel... */
95     SET_KERNEL_7,	/* MD kernel... */
96     SET_KERNEL_8,	/* MD kernel... */
97     SET_KERNEL_9,	/* MD kernel... */
98     SET_KERNEL_LAST,	/* allow 9 kernels */
99 
100     /* System sets */
101     SET_BASE,		/* base */
102     SET_ETC,		/* /etc */
103     SET_COMPILER,	/* compiler tools */
104     SET_GAMES,		/* text games */
105     SET_MAN_PAGES,	/* online manual pages */
106     SET_MISC,		/* miscellaneuous */
107     SET_MODULES,	/* kernel modules */
108     SET_TESTS,		/* tests */
109     SET_TEXT_TOOLS,	/* text processing tools */
110 
111     /* X11 sets */
112     SET_X11_FIRST,
113     SET_X11_BASE,	/* X11 base and clients */
114     SET_X11_FONTS,	/* X11 fonts */
115     SET_X11_SERVERS,	/* X11 servers */
116     SET_X11_PROG,	/* X11 programming */
117     SET_X11_ETC,	/* X11 config */
118     SET_X11_LAST,
119 
120     /* Machine dependent sets */
121     SET_MD_1,		/* Machine dependent set */
122     SET_MD_2,		/* Machine dependent set */
123     SET_MD_3,		/* Machine dependent set */
124     SET_MD_4,		/* Machine dependent set */
125 
126     /* Source sets */
127     SET_SYSSRC,
128     SET_SRC,
129     SET_SHARESRC,
130     SET_GNUSRC,
131     SET_XSRC,
132 
133     /* Debug sets */
134     SET_DEBUG,
135     SET_X11_DEBUG,
136 
137     SET_LAST,
138     SET_GROUP,		/* Start of submenu */
139     SET_GROUP_END,	/* End of submenu */
140     SET_PKGSRC,		/* pkgsrc, not counted as regular set */
141 };
142 
143 /* Initialisers to select sets */
144 /* All kernels */
145 #define SET_KERNEL SET_KERNEL_1, SET_KERNEL_2, SET_KERNEL_3, SET_KERNEL_4, \
146 		    SET_KERNEL_5, SET_KERNEL_6, SET_KERNEL_7, SET_KERNEL_8
147 /* Core system sets */
148 #define SET_CORE SET_MODULES, SET_BASE, SET_ETC
149 /* All system sets */
150 #define SET_SYSTEM SET_CORE, SET_COMPILER, SET_GAMES, \
151 		    SET_MAN_PAGES, SET_MISC, SET_TESTS, SET_TEXT_TOOLS
152 /* All X11 sets */
153 #define SET_X11_NOSERVERS SET_X11_BASE, SET_X11_FONTS, SET_X11_PROG, SET_X11_ETC
154 #define SET_X11 SET_X11_NOSERVERS, SET_X11_SERVERS
155 
156 /* All machine dependent sets */
157 #define SET_MD SET_MD_1, SET_MD_2, SET_MD_3, SET_MD_4
158 
159 /* All source sets */
160 #define SET_SOURCE SET_SYSSRC, SET_SRC, SET_SHARESRC, SET_GNUSRC, SET_XSRC
161 
162 /* All debug sets */
163 #define SET_DEBUGGING SET_DEBUG, SET_X11_DEBUG
164 
165 /* Set list flags */
166 #define SFLAG_MINIMAL	1
167 #define	SFLAG_NOX	2
168 
169 /* Macros */
170 #define nelem(x) (sizeof (x) / sizeof *(x))
171 
172 /* Round up to the next full cylinder size */
173 #define NUMSEC(size, sizemult, cylsize) \
174 	((size) == ~0u ? ~0u : (sizemult) == 1 ? (size) : \
175 	 roundup((size) * (sizemult), (cylsize)))
176 
177 /* What FS type? */
178 #define PI_ISBSDFS(p) ((p)->pi_fstype == FS_BSDLFS || \
179 		       (p)->pi_fstype == FS_BSDFFS)
180 
181 /* standard cd0 device */
182 #define CD_NAMES "cd0a"
183 
184 /* Types */
185 
186 /* pass a void* argument into a menu and also provide a int return value */
187 typedef struct arg_rv {
188 	void *arg;
189 	int rv;
190 } arg_rv;
191 
192 typedef struct distinfo {
193 	const char	*name;
194 	uint		set;
195 	const char	*desc;
196 	const char	*marker_file;	/* set assumed installed if exists */
197 } distinfo;
198 
199 #define MOUNTLEN 20
200 typedef struct _partinfo {
201 	struct partition pi_partition;
202 #define pi_size		pi_partition.p_size
203 #define pi_offset	pi_partition.p_offset
204 #define pi_fsize	pi_partition.p_fsize
205 #define pi_fstype	pi_partition.p_fstype
206 #define pi_frag		pi_partition.p_frag
207 #define pi_cpg		pi_partition.p_cpg
208 	char	pi_mount[MOUNTLEN];
209 	uint	pi_isize;		/* bytes per inode (for # inodes) */
210 	uint	pi_flags;
211 #define PIF_NEWFS	0x0001		/* need to 'newfs' partition */
212 #define PIF_FFSv2	0x0002		/* newfs with FFSv2, not FFSv1 */
213 #define PIF_MOUNT	0x0004		/* need to mount partition */
214 #define PIF_ASYNC	0x0010		/* mount -o async */
215 #define PIF_NOATIME	0x0020		/* mount -o noatime */
216 #define PIF_NODEV	0x0040		/* mount -o nodev */
217 #define PIF_NODEVMTIME	0x0080		/* mount -o nodevmtime */
218 #define PIF_NOEXEC	0x0100		/* mount -o noexec */
219 #define PIF_NOSUID	0x0200		/* mount -o nosuid */
220 #define PIF__UNUSED	0x0400		/* unused */
221 #define PIF_LOG		0x0800		/* mount -o log */
222 #define PIF_MOUNT_OPTS	0x0ff0		/* all above mount flags */
223 #define PIF_RESET	0x1000		/* internal - restore previous values */
224     const char *mnt_opts;
225     const char *fsname;
226     char mounted[MOUNTLEN];
227     int lvmpv; /* should we use partition as LVM PV? */
228 } partinfo;	/* Single partition from a disklabel */
229 
230 struct ptn_info {
231 	int		menu_no;
232 	struct ptn_size {
233 		int	ptn_id;
234 		char	mount[MOUNTLEN];
235 		daddr_t	dflt_size;
236 		daddr_t	size;
237 		int	limit;
238 		int	changed;
239 	}		ptn_sizes[MAXPARTITIONS + 1];	/* +1 for delete code */
240 	menu_ent	ptn_menus[MAXPARTITIONS + 1];	/* +1 for unit chg */
241 	int		free_parts;
242 	daddr_t		free_space;
243 	struct ptn_size	*pool_part;
244 	char		exit_msg[70];
245 };
246 
247 /* variables */
248 
249 int debug;		/* set by -D option */
250 
251 char rel[SSTRSIZE];
252 char machine[SSTRSIZE];
253 
254 int ignorerror;
255 int ttysig_ignore;
256 pid_t ttysig_forward;
257 int layoutkind;
258 int sizemult;
259 const char *multname;
260 int partman_go; /* run extended partition manager */
261 
262 /* logging variables */
263 
264 FILE *logfp;
265 FILE *script;
266 
267 /* Information for the NetBSD disklabel */
268 
269 enum DLTR { PART_A, PART_B, PART_C, PART_D, PART_E, PART_F, PART_G, PART_H,
270 	    PART_I, PART_J, PART_K, PART_L, PART_M, PART_N, PART_O, PART_P};
271 #define partition_name(x)	('a' + (x))
272 daddr_t tmp_ramdisk_size;
273 #define MAX_DISKS 15
274 
275 unsigned int root_limit;    /* BIOS (etc) read limit */
276 
277 enum SHRED_T { SHRED_NONE=0, SHRED_ZEROS, SHRED_RANDOM, SHRED_CRYPTO };
278 
279 /* All information that is unique for each drive */
280 SLIST_HEAD(pm_head_t, pm_devs_t) pm_head;
281 
282 typedef struct pm_devs_t {
283     int unsaved; /* Flag indicating to partman that device need saving */
284     int found; /* Flag to delete unplugged and unconfigured devices */
285     int blocked; /* Device is busy and cannot be changed */
286     void *refdev; /* If device is blocked thats is a pointers to a parent dev */
287     int isspecial; /* LVM LV or DK device that doesnot accept disklabel */
288     char diskdev[SSTRSIZE]; /* Actual name of the disk. */
289     char diskdev_descr[STRSIZE];
290     int bootable;
291 #define DISKNAME_SIZE 16
292     char bsddiskname[DISKNAME_SIZE];
293     partinfo oldlabel[MAXPARTITIONS]; /* What we found on the disk */
294     partinfo bsdlabel[MAXPARTITIONS]; /* What we want it to look like */
295     int gpt;
296     int no_mbr; /* set for raid (etc) */
297     int no_part;	/* can not be partitioned, e.g. dk0 */
298     int rootpart; /* partition we install into */
299     const char *disktype; /* ST506, SCSI, ... */
300     const char *doessf;
301     /* Actual values for current disk - set by find_disks() or md_get_info() */
302     int sectorsize, dlcyl, dlhead, dlsec, dlcylsize, current_cylsize;
303     daddr_t dlsize;
304     /* Area of disk we can allocate, start and size in disk sectors. */
305     daddr_t ptstart, ptsize;
306     /* If we have an MBR boot partition, start and size in sectors */
307     int bootstart, bootsize;
308     struct ptn_info pi;
309     SLIST_ENTRY(pm_devs_t) l;
310 } pm_devs_t;
311 pm_devs_t *pm; /* Pointer to currend device with which we work */
312 pm_devs_t *pm_new; /* Pointer for next allocating device in find_disks() */
313 
314 #define MAX_WEDGES 16 /* num of dk* devices */
315 typedef struct pm_wedge_t {
316     int allocated;
317     int todel;
318     pm_devs_t *pm;
319     int ptn;
320 } pm_wedge_t;
321 pm_wedge_t wedges[MAX_WEDGES];
322 
323 /* Generic structure for partman */
324 typedef struct {
325     int retvalue;
326     int dev_num;
327     int wedge_num;
328     void *dev_ptr;
329     int dev_ptr_delta;
330     char fullname[SSTRSIZE];
331     enum {PM_DISK_T=1, PM_PART_T, PM_WEDGE_T, PM_SPEC_T, PM_RAID_T, PM_CGD_T,
332         PM_VND_T, PM_LVM_T, PM_LVMLV_T} type;
333 } part_entry_t;
334 
335 /* Relative file name for storing a distribution. */
336 char xfer_dir[STRSIZE];
337 int  clean_xfer_dir;
338 
339 #if !defined(SYSINST_FTP_HOST)
340 #define SYSINST_FTP_HOST	"ftp.NetBSD.org"
341 #endif
342 
343 #if !defined(SYSINST_FTP_DIR)
344 #define SYSINST_FTP_DIR		"pub/NetBSD/NetBSD-" REL
345 #endif
346 
347 #if !defined(SYSINST_PKG_HOST)
348 #define SYSINST_PKG_HOST	SYSINST_FTP_HOST
349 #endif
350 
351 #if !defined(SYSINST_PKG_DIR)
352 #define SYSINST_PKG_DIR		"pub/pkgsrc/packages/NetBSD"
353 #endif
354 
355 #if !defined(SYSINST_PKGSRC_HOST)
356 #define SYSINST_PKGSRC_HOST	SYSINST_PKG_HOST
357 #endif
358 
359 /* Abs. path we extract binary sets from */
360 char ext_dir_bin[STRSIZE];
361 
362 /* Abs. path we extract source sets from */
363 char ext_dir_src[STRSIZE];
364 
365 /* Abs. path we extract pkgsrc from */
366 char ext_dir_pkgsrc[STRSIZE];
367 
368 /* Place we look for binary sets in all fs types */
369 char set_dir_bin[STRSIZE];
370 
371 /* Place we look for source sets in all fs types */
372 char set_dir_src[STRSIZE];
373 
374 /* Place we look for pkgs in all fs types */
375 char pkg_dir[STRSIZE];
376 
377 /* Place we look for pkgsrc in all fs types */
378 char pkgsrc_dir[STRSIZE];
379 
380 /* User shell */
381 const char *ushell;
382 
383 struct ftpinfo {
384     char host[STRSIZE];
385     char dir[STRSIZE] ;
386     char user[SSTRSIZE];
387     char pass[STRSIZE];
388     char proxy[STRSIZE];
389     const char *xfer_type;		/* "ftp" or "http" */
390 };
391 
392 /* use the same struct for sets ftp and to build pkgpath */
393 struct ftpinfo ftp, pkg, pkgsrc;
394 
395 int (*fetch_fn)(const char *);
396 char nfs_host[STRSIZE];
397 char nfs_dir[STRSIZE];
398 
399 char cdrom_dev[SSTRSIZE];		/* Typically "cd0a" */
400 char fd_dev[SSTRSIZE];			/* Typically "/dev/fd0a" */
401 const char *fd_type;			/* "msdos", "ffs" or maybe "ados" */
402 
403 char localfs_dev[SSTRSIZE];
404 char localfs_fs[SSTRSIZE];
405 char localfs_dir[STRSIZE];
406 
407 char targetroot_mnt[SSTRSIZE];
408 
409 int  mnt2_mounted;
410 
411 char dist_postfix[SSTRSIZE];
412 
413 /* needed prototypes */
414 void set_menu_numopts(int, int);
415 void remove_color_options(void);
416 void remove_raid_options(void);
417 void remove_lvm_options(void);
418 void remove_cgd_options(void);
419 void remove_gpt_options(void);
420 
421 /* Machine dependent functions .... */
422 void	md_init(void);
423 void	md_prelim_menu(void);
424 void	md_init_set_status(int); /* SFLAG_foo */
425 
426  /* MD functions if user selects install - in order called */
427 int	md_get_info(void);
428 int	md_make_bsd_partitions(void);
429 int	md_check_partitions(void);
430 int	md_pre_disklabel(void);
431 int	md_post_disklabel(void);
432 int	md_pre_mount(void);
433 int	md_post_newfs(void);
434 int	md_post_extract(void);
435 void	md_cleanup_install(void);
436 
437  /* MD functions if user selects upgrade - in order called */
438 int	md_pre_update(void);
439 int	md_update(void);
440 /* Also calls md_post_extract() */
441 
442 /* from main.c */
443 void	toplevel(void);
444 
445 /* from disks.c */
446 const char *get_default_cdrom(void);
447 int	find_disks(const char *);
448 struct menudesc;
449 void	fmt_fspart(struct menudesc *, int, void *);
450 void	disp_cur_fspart(int, int);
451 int	write_disklabel(void);
452 int	make_filesystems(void);
453 int	make_fstab(void);
454 int	mount_disks(void);
455 int	set_swap_if_low_ram(const char *, partinfo *);
456 int	set_swap(const char *, partinfo *);
457 int	check_swap(const char *, int);
458 char *bootxx_name(void);
459 void label_read(void);
460 int get_dkwedges(struct dkwedge_info **, const char *);
461 const char *get_gptfs_by_id(int);
462 
463 
464 /* from disks_lfs.c */
465 int	fs_is_lfs(void *);
466 
467 /* from label.c */
468 const char *get_last_mounted(int, int, partinfo *);
469 int	savenewlabel(partinfo *, int);
470 int	incorelabel(const char *, partinfo *);
471 int	edit_and_check_label(partinfo *, int, int, int);
472 void	set_bsize(partinfo *, int);
473 void	set_fsize(partinfo *, int);
474 void	set_ptype(partinfo *, int, int);
475 int edit_ptn(menudesc *, void *);
476 int checkoverlap(partinfo *, int, int, int);
477 
478 /* from install.c */
479 void	do_install(void);
480 
481 /* from factor.c */
482 void	factor(long, long *, int, int *);
483 
484 /* from fdisk.c */
485 void	get_disk_info(char *);
486 void	set_disk_info(char *);
487 
488 /* from geom.c */
489 int	get_geom(const char *, struct disklabel *);
490 int	get_real_geom(const char *, struct disklabel *);
491 
492 /* from net.c */
493 extern int network_up;
494 extern char net_namesvr[STRSIZE];
495 int	get_via_ftp(const char *);
496 int	get_via_nfs(void);
497 int	config_network(void);
498 void	mnt_net_config(void);
499 void	make_url(char *, struct ftpinfo *, const char *);
500 int	get_pkgsrc(void);
501 
502 /* From run.c */
503 int	collect(int, char **, const char *, ...) __printflike(3, 4);
504 int	run_program(int, const char *, ...) __printflike(2, 3);
505 void	do_logging(void);
506 int	do_system(const char *);
507 
508 /* from upgrade.c */
509 void	do_upgrade(void);
510 void	do_reinstall_sets(void);
511 void	restore_etc(void);
512 
513 /* from util.c */
514 int	ask_yesno(const char *);
515 int	ask_noyes(const char *);
516 int	dir_exists_p(const char *);
517 int	file_exists_p(const char *);
518 int	file_mode_match(const char *, unsigned int);
519 uint	get_ramsize(void);
520 void	ask_sizemult(int);
521 void	run_makedev(void);
522 int	boot_media_still_needed(void);
523 int	get_via_floppy(void);
524 int	get_via_cdrom(void);
525 int	get_via_localfs(void);
526 int	get_via_localdir(void);
527 void	show_cur_distsets(void);
528 void	make_ramdisk_dir(const char *);
529 void    set_kernel_set(unsigned int);
530 unsigned int    get_kernel_set(void);
531 unsigned int    set_X11_selected(void);
532 int 	get_and_unpack_sets(int, msg, msg, msg);
533 int	sanity_check(void);
534 int	set_timezone(void);
535 void	scripting_fprintf(FILE *, const char *, ...) __printflike(2, 3);
536 void	scripting_vfprintf(FILE *, const char *, va_list) __printflike(2, 0);
537 void	add_rc_conf(const char *, ...);
538 int	del_rc_conf(const char *);
539 void	add_sysctl_conf(const char *, ...) __printflike(1, 2);
540 void	enable_rc_conf(void);
541 void	set_sizemultname_cyl(void);
542 void	set_sizemultname_meg(void);
543 int	binary_available(const char *);
544 int	check_lfs_progs(void);
545 void	init_set_status(int);
546 void	customise_sets(void);
547 void	umount_mnt2(void);
548 int 	set_is_source(const char *);
549 const char *set_dir_for_set(const char *);
550 const char *ext_dir_for_set(const char *);
551 void	replace(const char *, const char *, ...);
552 void	get_tz_default(void);
553 int	extract_file(distinfo *, int);
554 void	do_coloring (unsigned int, unsigned int);
555 int set_menu_select(menudesc *, void *);
556 const char *safectime(time_t *);
557 
558 /* from target.c */
559 #if defined(DEBUG)  ||	defined(DEBUG_ROOT)
560 void	backtowin(void);
561 #endif
562 const	char *concat_paths(const char *, const char *);
563 const	char *target_expand(const char *);
564 void	make_target_dir(const char *);
565 void	append_to_target_file(const char *, const char *);
566 void	echo_to_target_file(const char *, const char *);
567 void	sprintf_to_target_file(const char *, const char *, ...)
568     __printflike(2, 3);
569 void	trunc_target_file(const char *);
570 const	char *target_prefix(void);
571 int	target_chdir(const char *);
572 void	target_chdir_or_die(const char *);
573 int	target_already_root(void);
574 FILE	*target_fopen(const char *, const char *);
575 int	target_collect_file(int, char **, const char *);
576 int	is_active_rootpart(const char *, int);
577 int	cp_to_target(const char *, const char *);
578 void	dup_file_into_target(const char *);
579 void	mv_within_target_or_die(const char *, const char *);
580 int	cp_within_target(const char *, const char *, int);
581 int	target_mount(const char *, const char *, int, const char *);
582 int target_mount_do(const char *, const char *, const char *);
583 int	target_test(unsigned int, const char *);
584 int	target_dir_exists_p(const char *);
585 int	target_file_exists_p(const char *);
586 int	target_symlink_exists_p(const char *);
587 void	unwind_mounts(void);
588 int	target_mounted(void);
589 
590 /* from partman.c */
591 int partman(void);
592 int pm_partusage(pm_devs_t *, int, int);
593 int pm_getrefdev(pm_devs_t *);
594 void pm_setfstype(pm_devs_t *, int, int);
595 int pm_editpart(int);
596 void pm_rename(pm_devs_t *);
597 int pm_shred(pm_devs_t *, int, int);
598 void pm_umount(pm_devs_t *, int);
599 int pm_unconfigure(pm_devs_t *);
600 int pm_cgd_edit(void *, part_entry_t *);
601 int pm_gpt_convert(pm_devs_t *);
602 void pm_wedges_fill(pm_devs_t *);
603 void pm_make_bsd_partitions(pm_devs_t *);
604 void update_wedges(const char *);
605 
606 /* flags whether to offer the respective options (depending on helper
607    programs available on install media */
608 int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk;
609 /* initialize above variables */
610 void check_available_binaries(void);
611 
612 /* from bsddisklabel.c */
613 int	make_bsd_partitions(void);
614 int	save_ptn(int, daddr_t, daddr_t, int, const char *);
615 void	set_ptn_titles(menudesc *, int, void *);
616 void	set_ptn_menu(struct ptn_info *);
617 int	set_ptn_size(menudesc *, void *);
618 void	get_ptn_sizes(daddr_t, daddr_t, int);
619 int check_partitions(void);
620 
621 /* from aout2elf.c */
622 int move_aout_libs(void);
623 
624 #ifdef WSKBD
625 void	get_kb_encoding(void);
626 void	save_kb_encoding(void);
627 #else
628 #define	get_kb_encoding()
629 #define	save_kb_encoding()
630 #endif
631 
632 /* from configmenu.c */
633 void	do_configmenu(void);
634 
635 /* from checkrc.c */
636 int	check_rcvar(const char *);
637 int	check_rcdefault(const char *);
638 	WINDOW *mainwin;
639 
640 #endif	/* _DEFS_H_ */
641