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