Home | History | Annotate | Line # | Download | only in sysinst
defs.h revision 1.44
      1  1.44    martin /*	$NetBSD: defs.h,v 1.44 2019/08/27 14:11:00 martin Exp $	*/
      2   1.1  dholland 
      3   1.1  dholland /*
      4   1.1  dholland  * Copyright 1997 Piermont Information Systems Inc.
      5   1.1  dholland  * All rights reserved.
      6   1.1  dholland  *
      7   1.1  dholland  * Written by Philip A. Nelson for Piermont Information Systems Inc.
      8   1.1  dholland  *
      9   1.1  dholland  * Redistribution and use in source and binary forms, with or without
     10   1.1  dholland  * modification, are permitted provided that the following conditions
     11   1.1  dholland  * are met:
     12   1.1  dholland  * 1. Redistributions of source code must retain the above copyright
     13   1.1  dholland  *    notice, this list of conditions and the following disclaimer.
     14   1.1  dholland  * 2. Redistributions in binary form must reproduce the above copyright
     15   1.1  dholland  *    notice, this list of conditions and the following disclaimer in the
     16   1.1  dholland  *    documentation and/or other materials provided with the distribution.
     17   1.1  dholland  * 3. The name of Piermont Information Systems Inc. may not be used to endorse
     18   1.1  dholland  *    or promote products derived from this software without specific prior
     19   1.1  dholland  *    written permission.
     20   1.1  dholland  *
     21   1.1  dholland  * THIS SOFTWARE IS PROVIDED BY PIERMONT INFORMATION SYSTEMS INC. ``AS IS''
     22   1.1  dholland  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     23   1.1  dholland  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     24   1.1  dholland  * ARE DISCLAIMED. IN NO EVENT SHALL PIERMONT INFORMATION SYSTEMS INC. BE
     25   1.1  dholland  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     26   1.1  dholland  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     27   1.1  dholland  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     28   1.1  dholland  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     29   1.1  dholland  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     30   1.1  dholland  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
     31   1.1  dholland  * THE POSSIBILITY OF SUCH DAMAGE.
     32   1.1  dholland  *
     33   1.1  dholland  */
     34   1.1  dholland 
     35   1.1  dholland #ifndef _DEFS_H_
     36   1.1  dholland #define _DEFS_H_
     37   1.1  dholland 
     38   1.1  dholland /* defs.h -- definitions for use in the sysinst program. */
     39   1.1  dholland 
     40   1.1  dholland /* System includes needed for this. */
     41   1.2    martin #include <sys/queue.h>
     42   1.1  dholland #include <sys/types.h>
     43   1.2    martin #include <sys/disk.h>
     44  1.34    martin #include <uuid.h>
     45   1.1  dholland 
     46  1.34    martin const char *getfslabelname(uint, uint);
     47   1.1  dholland 
     48   1.1  dholland #include "msg_defs.h"
     49   1.1  dholland #include "menu_defs.h"
     50  1.34    martin #include "partitions.h"
     51   1.1  dholland 
     52   1.1  dholland #define min(a,b)	((a) < (b) ? (a) : (b))
     53   1.1  dholland #define max(a,b)	((a) > (b) ? (a) : (b))
     54   1.1  dholland 
     55   1.1  dholland /* constants */
     56  1.34    martin #define MEG (1024UL * 1024UL)
     57  1.34    martin #define GIG (1024UL * MEG)
     58  1.34    martin #define STRSIZE		255
     59  1.34    martin #define	MENUSTRSIZE	80
     60  1.34    martin #define SSTRSIZE	30
     61  1.34    martin 
     62  1.34    martin #define	HUGE_DISK_SIZE	(daddr_t)(128 * (GIG / 512))
     63  1.34    martin #define	TINY_DISK_SIZE	(daddr_t)(1800 * (MEG / 512))
     64  1.34    martin 
     65  1.34    martin /* helper macros to create unique internal error messages */
     66  1.34    martin #define STR_NO(STR)	#STR
     67  1.34    martin #define	TO_STR(NO)	STR_NO(NO)
     68  1.34    martin #define	INTERNAL_ERROR __FILE__ ":" TO_STR(__LINE__) ": internal error"
     69   1.1  dholland 
     70   1.1  dholland /* For run.c: collect() */
     71   1.1  dholland #define T_FILE		0
     72   1.1  dholland #define T_OUTPUT	1
     73   1.1  dholland 
     74   1.1  dholland /* Some install status/response values */
     75   1.1  dholland #define	SET_OK		0		/* Set extracted */
     76   1.1  dholland #define	SET_RETRY	1		/* Retry */
     77   1.1  dholland #define	SET_SKIP	2		/* Skip this set */
     78   1.1  dholland #define	SET_SKIP_GROUP	3		/* Skip this set and rest of group */
     79   1.1  dholland #define	SET_ABANDON	4		/* Abandon installation */
     80   1.1  dholland #define	SET_CONTINUE	5		/* Continue (copy from floppy loop) */
     81   1.1  dholland 
     82   1.1  dholland /* run_prog flags */
     83   1.1  dholland #define RUN_DISPLAY	0x0001		/* Display program output */
     84   1.1  dholland #define RUN_FATAL	0x0002		/* errors are fatal */
     85   1.1  dholland #define RUN_CHROOT	0x0004		/* chroot to target disk */
     86   1.1  dholland #define RUN_FULLSCREEN	0x0008		/* fullscreen (use with RUN_DISPLAY) */
     87   1.1  dholland #define RUN_SILENT	0x0010		/* Do not show output */
     88   1.1  dholland #define RUN_ERROR_OK	0x0040		/* Don't wait for error confirmation */
     89   1.1  dholland #define RUN_PROGRESS	0x0080		/* Output is just progess test */
     90   1.1  dholland #define RUN_NO_CLEAR	0x0100		/* Leave program output after error */
     91   1.1  dholland #define RUN_XFER_DIR	0x0200		/* cd to xfer_dir in child */
     92   1.1  dholland 
     93   1.2    martin /* for bsddisklabel.c */
     94  1.34    martin enum layout_type { LY_KEEPEXISTING, LY_SETSIZES, LY_USEDEFAULT, LY_USEFULL };
     95  1.34    martin enum setup_type { SY_NEWRAID, SY_NEWCGD, SY_NEWLVM };
     96   1.2    martin 
     97   1.1  dholland /* Installation sets */
     98   1.1  dholland enum {
     99   1.1  dholland     SET_NONE,
    100   1.1  dholland     SET_KERNEL_FIRST,
    101   1.1  dholland     SET_KERNEL_1,	/* Usually GENERIC */
    102   1.1  dholland     SET_KERNEL_2,	/* MD kernel... */
    103   1.1  dholland     SET_KERNEL_3,	/* MD kernel... */
    104   1.1  dholland     SET_KERNEL_4,	/* MD kernel... */
    105   1.1  dholland     SET_KERNEL_5,	/* MD kernel... */
    106   1.1  dholland     SET_KERNEL_6,	/* MD kernel... */
    107   1.1  dholland     SET_KERNEL_7,	/* MD kernel... */
    108   1.1  dholland     SET_KERNEL_8,	/* MD kernel... */
    109   1.1  dholland     SET_KERNEL_9,	/* MD kernel... */
    110   1.1  dholland     SET_KERNEL_LAST,	/* allow 9 kernels */
    111   1.1  dholland 
    112   1.1  dholland     /* System sets */
    113   1.1  dholland     SET_BASE,		/* base */
    114   1.1  dholland     SET_ETC,		/* /etc */
    115   1.1  dholland     SET_COMPILER,	/* compiler tools */
    116   1.1  dholland     SET_GAMES,		/* text games */
    117   1.1  dholland     SET_MAN_PAGES,	/* online manual pages */
    118   1.1  dholland     SET_MISC,		/* miscellaneuous */
    119   1.1  dholland     SET_MODULES,	/* kernel modules */
    120   1.1  dholland     SET_TESTS,		/* tests */
    121   1.1  dholland     SET_TEXT_TOOLS,	/* text processing tools */
    122   1.1  dholland 
    123   1.1  dholland     /* X11 sets */
    124   1.1  dholland     SET_X11_FIRST,
    125   1.1  dholland     SET_X11_BASE,	/* X11 base and clients */
    126   1.1  dholland     SET_X11_FONTS,	/* X11 fonts */
    127   1.1  dholland     SET_X11_SERVERS,	/* X11 servers */
    128   1.1  dholland     SET_X11_PROG,	/* X11 programming */
    129   1.1  dholland     SET_X11_ETC,	/* X11 config */
    130   1.1  dholland     SET_X11_LAST,
    131   1.1  dholland 
    132   1.1  dholland     /* Machine dependent sets */
    133   1.1  dholland     SET_MD_1,		/* Machine dependent set */
    134   1.1  dholland     SET_MD_2,		/* Machine dependent set */
    135   1.1  dholland     SET_MD_3,		/* Machine dependent set */
    136   1.1  dholland     SET_MD_4,		/* Machine dependent set */
    137   1.1  dholland 
    138   1.1  dholland     /* Source sets */
    139   1.1  dholland     SET_SYSSRC,
    140   1.1  dholland     SET_SRC,
    141   1.1  dholland     SET_SHARESRC,
    142   1.1  dholland     SET_GNUSRC,
    143   1.1  dholland     SET_XSRC,
    144   1.1  dholland 
    145   1.1  dholland     /* Debug sets */
    146   1.1  dholland     SET_DEBUG,
    147   1.1  dholland     SET_X11_DEBUG,
    148   1.1  dholland 
    149   1.1  dholland     SET_LAST,
    150   1.1  dholland     SET_GROUP,		/* Start of submenu */
    151   1.1  dholland     SET_GROUP_END,	/* End of submenu */
    152   1.1  dholland     SET_PKGSRC,		/* pkgsrc, not counted as regular set */
    153   1.1  dholland };
    154   1.1  dholland 
    155   1.1  dholland /* Initialisers to select sets */
    156   1.1  dholland /* All kernels */
    157   1.1  dholland #define SET_KERNEL SET_KERNEL_1, SET_KERNEL_2, SET_KERNEL_3, SET_KERNEL_4, \
    158   1.1  dholland 		    SET_KERNEL_5, SET_KERNEL_6, SET_KERNEL_7, SET_KERNEL_8
    159   1.1  dholland /* Core system sets */
    160   1.1  dholland #define SET_CORE SET_MODULES, SET_BASE, SET_ETC
    161   1.1  dholland /* All system sets */
    162   1.1  dholland #define SET_SYSTEM SET_CORE, SET_COMPILER, SET_GAMES, \
    163   1.1  dholland 		    SET_MAN_PAGES, SET_MISC, SET_TESTS, SET_TEXT_TOOLS
    164   1.1  dholland /* All X11 sets */
    165   1.1  dholland #define SET_X11_NOSERVERS SET_X11_BASE, SET_X11_FONTS, SET_X11_PROG, SET_X11_ETC
    166   1.1  dholland #define SET_X11 SET_X11_NOSERVERS, SET_X11_SERVERS
    167   1.1  dholland 
    168   1.1  dholland /* All machine dependent sets */
    169   1.1  dholland #define SET_MD SET_MD_1, SET_MD_2, SET_MD_3, SET_MD_4
    170   1.1  dholland 
    171   1.1  dholland /* All source sets */
    172   1.1  dholland #define SET_SOURCE SET_SYSSRC, SET_SRC, SET_SHARESRC, SET_GNUSRC, SET_XSRC
    173   1.1  dholland 
    174   1.1  dholland /* All debug sets */
    175   1.1  dholland #define SET_DEBUGGING SET_DEBUG, SET_X11_DEBUG
    176   1.1  dholland 
    177   1.1  dholland /* Set list flags */
    178   1.1  dholland #define SFLAG_MINIMAL	1
    179   1.1  dholland #define	SFLAG_NOX	2
    180   1.1  dholland 
    181   1.1  dholland /* Round up to the next full cylinder size */
    182   1.1  dholland #define NUMSEC(size, sizemult, cylsize) \
    183  1.34    martin 	((sizemult) == 1 ? (size) : \
    184   1.1  dholland 	 roundup((size) * (sizemult), (cylsize)))
    185   1.1  dholland 
    186   1.1  dholland /* What FS type? */
    187  1.34    martin #define PI_ISBSDFS(PI) (PI_FSTYPE(PI) == FS_BSDLFS || \
    188  1.34    martin 		        PI_FSTYPE(PI) == FS_BSDFFS)
    189   1.1  dholland 
    190  1.23    martin /*
    191  1.23    martin  * We do not offer CDs or floppies as installation target usually.
    192  1.23    martin  * Architectures might want to undefine if they want to allow
    193  1.23    martin  * these devices or redefine if they have unusual CD device names.
    194  1.23    martin  * Do not define to empty or an empty string, undefine instead.
    195  1.23    martin  */
    196  1.21    martin #define CD_NAMES "cd*"
    197  1.23    martin #define FLOPPY_NAMES "fd*"
    198   1.1  dholland 
    199   1.1  dholland /* Types */
    200   1.8    martin 
    201   1.8    martin /* pass a void* argument into a menu and also provide a int return value */
    202   1.8    martin typedef struct arg_rv {
    203   1.8    martin 	void *arg;
    204   1.8    martin 	int rv;
    205   1.8    martin } arg_rv;
    206   1.8    martin 
    207  1.34    martin /*
    208  1.34    martin  * A minimal argument for menus using string replacements
    209  1.34    martin  */
    210  1.34    martin typedef struct arg_replace {
    211  1.34    martin 	const char **argv;
    212  1.34    martin 	size_t argc;
    213  1.34    martin } arg_replace;
    214  1.34    martin 
    215  1.34    martin /*
    216  1.34    martin  * pass a parameter array (for string replacements) into a menu and provide
    217  1.34    martin  * an integer return value
    218  1.34    martin  */
    219  1.34    martin typedef struct arg_rep_int {
    220  1.34    martin 	arg_replace args;
    221  1.34    martin 	int rv;
    222  1.34    martin } arg_rep_int;
    223  1.34    martin 
    224   1.1  dholland typedef struct distinfo {
    225   1.1  dholland 	const char	*name;
    226   1.1  dholland 	uint		set;
    227  1.20    martin 	bool		force_tgz;	/* this set is always in .tgz format */
    228   1.1  dholland 	const char	*desc;
    229   1.1  dholland 	const char	*marker_file;	/* set assumed installed if exists */
    230   1.1  dholland } distinfo;
    231   1.1  dholland 
    232   1.2    martin #define MOUNTLEN 20
    233  1.34    martin 
    234  1.34    martin 
    235  1.34    martin /*
    236  1.34    martin  * A description of a future partition and its usage.
    237  1.34    martin  * A list of this is the output of the first stage partition
    238  1.34    martin  * editor, before it gets transformed into a concrete partition
    239  1.34    martin  * layout according to the partitioning scheme backend.
    240  1.34    martin  */
    241  1.34    martin struct part_usage_info {
    242  1.34    martin 	daddr_t	size;			/* thumb guestimate of size [sec] */
    243  1.34    martin 	daddr_t def_size;		/* default size */
    244  1.34    martin 	daddr_t limit;			/* max size */
    245  1.34    martin 	char 	mount[MOUNTLEN];	/* where will we mount this? */
    246  1.34    martin 	enum part_type type;		/* PT_root/PT_swap/PT_EFI_SYSTEM */
    247  1.34    martin 
    248  1.34    martin #define	PUIFLAG_EXTEND		1	/* extend this part if free space
    249  1.34    martin 					 * is available */
    250  1.34    martin #define	PUIFLAG_ADD_OUTER	2	/* Add this partition to the outer
    251  1.34    martin 					 * partitions (if available) */
    252  1.37    martin #define	PUIFLG_IS_OUTER		4	/* this is an existing outer one */
    253  1.37    martin #define	PUIFLAG_ADD_INNER	8	/* add outer also to inner */
    254  1.37    martin #define	PUIFLG_JUST_MOUNTPOINT	16	/* tmpfs of mfs mountpoints */
    255  1.34    martin 	uint flags;
    256  1.34    martin 	struct disk_partitions *parts;	/* Where does this partition live?
    257  1.34    martin 					 * We currently only support
    258  1.34    martin 					 * a single disk, but we plan to
    259  1.34    martin 					 * extend that.
    260  1.34    martin 					 * Use pm->parts to access
    261  1.34    martin 					 * the partitions. */
    262  1.34    martin 	part_id cur_part_id;		/* this may change, but we try to
    263  1.34    martin 					 * fix it up after all changes */
    264  1.34    martin 	daddr_t cur_start;		/* may change during editing, just
    265  1.34    martin 					 * used as a unique identifier */
    266  1.34    martin 	uint32_t cur_flags;		/* PTI_* flags from disk_part_info */
    267  1.34    martin 
    268  1.34    martin #define PUIMNT_ASYNC		0x0001	/* mount -o async */
    269  1.34    martin #define PUIMNT_NOATIME		0x0002	/* mount -o noatime */
    270  1.34    martin #define PUIMNT_NODEV		0x0004	/* mount -o nodev */
    271  1.34    martin #define PUIMNT_NODEVMTIME	0x0008	/* mount -o nodevmtime */
    272  1.34    martin #define PUIMNT_NOEXEC		0x0010	/* mount -o noexec */
    273  1.34    martin #define PUIMNT_NOSUID		0x0020	/* mount -o nosuid */
    274  1.34    martin #define PUIMNT_LOG		0x0040	/* mount -o log */
    275  1.34    martin #define PUIMNT_NOAUTO		0x0080	/* "noauto" fstab flag */
    276  1.34    martin 	unsigned int mountflags;	/* flags for fstab */
    277  1.34    martin #define PUIINST_NEWFS	0x0001		/* need to 'newfs' partition */
    278  1.34    martin #define PUIINST_MOUNT	0x0002		/* need to mount partition */
    279  1.34    martin #define	PUIINST_BOOT	0x0004		/* this is a boot partition */
    280  1.34    martin 	unsigned int instflags;		/* installer handling flags */
    281  1.34    martin 	uint fs_type, fs_version;	/* e.g. FS_LFS, or FS_BSDFS,
    282  1.34    martin 					 * version = 2 for FFSv2 */
    283  1.34    martin };
    284  1.34    martin 
    285  1.34    martin /*
    286  1.34    martin  * A list of partition suggestions, bundled for editing
    287  1.34    martin  */
    288  1.34    martin struct partition_usage_set {
    289  1.34    martin 	struct disk_partitions *parts;
    290  1.34    martin 	size_t num;
    291  1.34    martin 	struct part_usage_info *infos;	/* 0 .. num-1 */
    292  1.34    martin 	daddr_t cur_free_space;		/* estimate of free sectors */
    293  1.34    martin 	menu_ent *menu_opts;		/* 0 .. num+N */
    294  1.34    martin 	int menu;			/* the menu to edit this */
    295  1.34    martin 	bool ok;			/* ok to continue (all fit) */
    296  1.34    martin };
    297  1.34    martin 
    298  1.34    martin /*
    299  1.34    martin  * A structure we pass around in menus that edit a single partition out
    300  1.34    martin  * of a partition_usage_set.
    301  1.34    martin  */
    302  1.34    martin struct single_part_fs_edit {
    303  1.34    martin  	struct partition_usage_set *pset;
    304  1.34    martin 	size_t index, first_custom_attr;
    305  1.34    martin 	part_id id;
    306  1.34    martin 	struct disk_part_info info;	/* current partition data */
    307  1.34    martin 	struct part_usage_info *wanted;	/* points at our edit data */
    308  1.34    martin 
    309  1.34    martin 	/*
    310  1.34    martin 	 * "Backup" of old data, so we can restore previous values
    311  1.34    martin 	 * ("undo").
    312  1.34    martin 	 */
    313  1.34    martin 	struct part_usage_info old_usage;
    314  1.34    martin 	struct disk_part_info old_info;
    315  1.34    martin 
    316  1.34    martin 	/* menu return value */
    317  1.34    martin 	int rv;
    318  1.34    martin };
    319  1.34    martin 
    320  1.34    martin /*
    321  1.34    martin  * Description of a full target installation, all partitions and
    322  1.34    martin  * devices (may be accross several struct pm_devs / disks).
    323  1.34    martin  */
    324  1.34    martin struct install_partition_desc {
    325  1.34    martin 	size_t num;				/* how many entries in infos */
    326  1.34    martin 	struct part_usage_info *infos;		/* individual partitions */
    327  1.41    martin 	bool cur_system;			/* target is the life system */
    328   1.1  dholland };
    329   1.1  dholland 
    330   1.1  dholland /* variables */
    331   1.1  dholland 
    332   1.1  dholland int debug;		/* set by -D option */
    333   1.1  dholland 
    334   1.1  dholland char rel[SSTRSIZE];
    335   1.1  dholland char machine[SSTRSIZE];
    336   1.1  dholland 
    337   1.1  dholland int ignorerror;
    338   1.1  dholland int ttysig_ignore;
    339   1.1  dholland pid_t ttysig_forward;
    340   1.1  dholland int sizemult;
    341  1.34    martin extern const char *multname;
    342  1.34    martin extern const char *err_outofmem;
    343   1.2    martin int partman_go; /* run extended partition manager */
    344   1.1  dholland 
    345   1.2    martin /* logging variables */
    346   1.1  dholland 
    347   1.1  dholland FILE *logfp;
    348   1.1  dholland FILE *script;
    349   1.1  dholland 
    350   1.1  dholland daddr_t tmp_ramdisk_size;
    351   1.2    martin #define MAX_DISKS 15
    352   1.2    martin 
    353  1.34    martin daddr_t root_limit;    /* BIOS (etc) read limit */
    354   1.2    martin 
    355   1.2    martin enum SHRED_T { SHRED_NONE=0, SHRED_ZEROS, SHRED_RANDOM, SHRED_CRYPTO };
    356   1.1  dholland 
    357   1.2    martin /* All information that is unique for each drive */
    358  1.34    martin SLIST_HEAD(pm_head_t, pm_devs) pm_head;
    359   1.2    martin 
    360  1.34    martin struct pm_devs {
    361  1.34    martin 	/*
    362  1.34    martin 	 * If device is blocked (e.g. part of a raid)
    363  1.34    martin 	 * this is a pointers to the  parent dev
    364  1.34    martin 	 */
    365  1.34    martin 	void *refdev;
    366  1.34    martin 
    367  1.34    martin 	char diskdev[SSTRSIZE];		/* Actual name of the disk. */
    368  1.34    martin 	char diskdev_descr[STRSIZE];	/* e.g. IDENTIFY result */
    369  1.34    martin 
    370  1.34    martin 	/*
    371  1.34    martin 	 * What the disk layout should look like.
    372  1.34    martin 	 */
    373  1.34    martin 	struct disk_partitions *parts;
    374  1.34    martin 
    375  1.34    martin 	/*
    376  1.34    martin 	 * The device does not take a MBR, even if we usually use
    377  1.34    martin 	 * MBR master / disklabel secondary partitioning.
    378  1.34    martin 	 * Used e.g. for raid* pseudo-disks.
    379  1.34    martin 	 */
    380  1.34    martin 	bool no_mbr;	/* userd for raid (etc) */
    381  1.34    martin 
    382  1.34    martin 	/*
    383  1.34    martin 	 * This device can not be partitioned (in any way).
    384  1.34    martin 	 * Used for wedges (dk*) or LVM devices.
    385  1.34    martin 	 */
    386  1.34    martin 	bool no_part;
    387  1.34    martin 
    388  1.41    martin 	/*
    389  1.41    martin 	 * This is a pseudo-device representing the currently running
    390  1.41    martin 	 * system (i.e. all mounted file systems).
    391  1.41    martin 	 */
    392  1.41    martin 	bool cur_system;
    393  1.41    martin 
    394  1.34    martin 	/* Actual values for current disk - set by find_disks() or
    395  1.34    martin 	   md_get_info() */
    396  1.34    martin 	int sectorsize, dlcyl, dlhead, dlsec, dlcylsize, current_cylsize;
    397  1.34    martin 	daddr_t dlsize;
    398  1.34    martin 
    399  1.34    martin 	/* Area of disk we can allocate, start and size in disk sectors. */
    400  1.34    martin 	daddr_t ptstart, ptsize;
    401  1.34    martin 
    402  1.34    martin 	/* For some bootblocks we need to know the CHS addressable limit */
    403  1.34    martin 	daddr_t max_chs;	/* bcyl * bhead * bsec */
    404  1.34    martin 
    405  1.34    martin 	/* If we have an MBR boot partition, start and size in sectors */
    406  1.34    martin 	daddr_t bootstart, bootsize;
    407  1.34    martin 
    408  1.34    martin 	/*
    409  1.34    martin 	 * In extended partitioning: all partitions in parts (number of
    410  1.34    martin 	 * entries is parts->num_part) may actually be mounted (temporarily)
    411  1.34    martin 	 * somewhere, e.g. to access a vnd device on them. This list has
    412  1.34    martin 	 * a pointer to the current mount point (strdup()'d) if mounted,
    413  1.34    martin 	 * or NULL if not.
    414  1.34    martin 	 */
    415  1.34    martin 	char **mounted;
    416  1.34    martin 
    417  1.34    martin 	bool bootable;	/* This device is bootable */
    418  1.34    martin 	bool unsaved;	/* Flag indicating to partman that device need saving */
    419  1.34    martin 	bool found;	/* Flag to delete unplugged and unconfigured devices */
    420  1.34    martin 	int blocked;	/* Device is busy and cannot be changed */
    421  1.34    martin 
    422  1.34    martin 	SLIST_ENTRY(pm_devs) l;
    423  1.34    martin };
    424  1.34    martin struct pm_devs *pm; /* Pointer to current device with which we work */
    425  1.34    martin struct pm_devs *pm_new; /* Pointer for next allocating device in find_disks() */
    426   1.2    martin 
    427   1.2    martin /* Generic structure for partman */
    428  1.34    martin struct part_entry {
    429  1.34    martin 	int retvalue;
    430  1.34    martin 	part_id id;
    431  1.34    martin 	struct disk_partitions *parts;
    432  1.34    martin 	void *dev_ptr;
    433  1.34    martin 	size_t index;
    434  1.34    martin 	int dev_ptr_delta;
    435  1.34    martin 	char fullname[SSTRSIZE];
    436  1.34    martin 	enum {PM_DISK=1, PM_PART, PM_SPEC,
    437  1.34    martin 	    PM_RAID, PM_CGD, PM_VND, PM_LVM, PM_LVMLV} type;
    438  1.34    martin };
    439   1.1  dholland 
    440   1.1  dholland /* Relative file name for storing a distribution. */
    441   1.1  dholland char xfer_dir[STRSIZE];
    442   1.1  dholland int  clean_xfer_dir;
    443   1.1  dholland 
    444   1.1  dholland #if !defined(SYSINST_FTP_HOST)
    445   1.1  dholland #define SYSINST_FTP_HOST	"ftp.NetBSD.org"
    446   1.1  dholland #endif
    447   1.1  dholland 
    448  1.16    martin #if !defined(SYSINST_HTTP_HOST)
    449  1.16    martin #define SYSINST_HTTP_HOST	"cdn.NetBSD.org"
    450  1.16    martin #endif
    451  1.16    martin 
    452   1.1  dholland #if !defined(SYSINST_FTP_DIR)
    453  1.12    martin #if defined(NETBSD_OFFICIAL_RELEASE)
    454   1.1  dholland #define SYSINST_FTP_DIR		"pub/NetBSD/NetBSD-" REL
    455  1.13    martin #elif defined(REL_PATH)
    456  1.18    martin #define SYSINST_FTP_DIR		"pub/NetBSD-daily/" REL_PATH "/latest"
    457  1.12    martin #else
    458  1.13    martin #define SYSINST_FTP_DIR		"pub/NetBSD/NetBSD-" REL
    459  1.12    martin #endif
    460   1.1  dholland #endif
    461   1.1  dholland 
    462  1.29    martin #if !defined(ARCH_SUBDIR)
    463  1.29    martin #define	ARCH_SUBDIR	MACH
    464  1.29    martin #endif
    465  1.29    martin #if !defined(PKG_ARCH_SUBDIR)
    466  1.29    martin #define	PKG_ARCH_SUBDIR	MACH
    467  1.29    martin #endif
    468  1.29    martin 
    469   1.1  dholland #if !defined(SYSINST_PKG_HOST)
    470  1.15    martin #define SYSINST_PKG_HOST	"ftp.NetBSD.org"
    471   1.1  dholland #endif
    472  1.16    martin #if !defined(SYSINST_PKG_HTTP_HOST)
    473  1.16    martin #define SYSINST_PKG_HTTP_HOST	"cdn.NetBSD.org"
    474  1.16    martin #endif
    475   1.1  dholland 
    476   1.1  dholland #if !defined(SYSINST_PKG_DIR)
    477   1.1  dholland #define SYSINST_PKG_DIR		"pub/pkgsrc/packages/NetBSD"
    478   1.1  dholland #endif
    479   1.1  dholland 
    480  1.17    martin #if !defined(PKG_SUBDIR)
    481  1.17    martin #define	PKG_SUBDIR		REL
    482  1.17    martin #endif
    483  1.17    martin 
    484   1.1  dholland #if !defined(SYSINST_PKGSRC_HOST)
    485   1.1  dholland #define SYSINST_PKGSRC_HOST	SYSINST_PKG_HOST
    486   1.1  dholland #endif
    487  1.16    martin #if !defined(SYSINST_PKGSRC_HTTP_HOST)
    488  1.16    martin #define SYSINST_PKGSRC_HTTP_HOST	SYSINST_PKG_HTTP_HOST
    489  1.16    martin #endif
    490   1.1  dholland 
    491  1.20    martin #ifndef SETS_TAR_SUFF
    492  1.20    martin #define	SETS_TAR_SUFF	 "tgz"
    493  1.20    martin #endif
    494  1.20    martin 
    495   1.1  dholland /* Abs. path we extract binary sets from */
    496   1.1  dholland char ext_dir_bin[STRSIZE];
    497   1.1  dholland 
    498   1.1  dholland /* Abs. path we extract source sets from */
    499   1.1  dholland char ext_dir_src[STRSIZE];
    500   1.1  dholland 
    501   1.1  dholland /* Abs. path we extract pkgsrc from */
    502   1.1  dholland char ext_dir_pkgsrc[STRSIZE];
    503   1.1  dholland 
    504   1.1  dholland /* Place we look for binary sets in all fs types */
    505   1.1  dholland char set_dir_bin[STRSIZE];
    506   1.1  dholland 
    507   1.1  dholland /* Place we look for source sets in all fs types */
    508   1.1  dholland char set_dir_src[STRSIZE];
    509   1.1  dholland 
    510   1.1  dholland /* Place we look for pkgs in all fs types */
    511   1.1  dholland char pkg_dir[STRSIZE];
    512   1.1  dholland 
    513   1.1  dholland /* Place we look for pkgsrc in all fs types */
    514   1.1  dholland char pkgsrc_dir[STRSIZE];
    515   1.1  dholland 
    516   1.1  dholland /* User shell */
    517   1.1  dholland const char *ushell;
    518   1.1  dholland 
    519  1.16    martin #define	XFER_FTP	0
    520  1.16    martin #define	XFER_HTTP	1
    521  1.16    martin #define	XFER_MAX	XFER_HTTP
    522  1.16    martin 
    523   1.1  dholland struct ftpinfo {
    524  1.34    martin 	char xfer_host[XFER_MAX+1][STRSIZE];
    525  1.34    martin 	char dir[STRSIZE] ;
    526  1.34    martin 	char user[SSTRSIZE];
    527  1.34    martin 	char pass[STRSIZE];
    528  1.34    martin 	char proxy[STRSIZE];
    529  1.34    martin 	unsigned int xfer;	/* XFER_FTP for "ftp" or XFER_HTTP for "http" */
    530   1.1  dholland };
    531   1.1  dholland 
    532   1.1  dholland /* use the same struct for sets ftp and to build pkgpath */
    533   1.1  dholland struct ftpinfo ftp, pkg, pkgsrc;
    534   1.1  dholland 
    535   1.1  dholland int (*fetch_fn)(const char *);
    536   1.1  dholland char nfs_host[STRSIZE];
    537   1.1  dholland char nfs_dir[STRSIZE];
    538   1.1  dholland 
    539   1.1  dholland char cdrom_dev[SSTRSIZE];		/* Typically "cd0a" */
    540   1.1  dholland char fd_dev[SSTRSIZE];			/* Typically "/dev/fd0a" */
    541   1.1  dholland const char *fd_type;			/* "msdos", "ffs" or maybe "ados" */
    542   1.1  dholland 
    543   1.1  dholland char localfs_dev[SSTRSIZE];
    544   1.1  dholland char localfs_fs[SSTRSIZE];
    545   1.1  dholland char localfs_dir[STRSIZE];
    546   1.1  dholland 
    547   1.1  dholland char targetroot_mnt[SSTRSIZE];
    548   1.1  dholland 
    549   1.1  dholland int  mnt2_mounted;
    550   1.1  dholland 
    551   1.1  dholland char dist_postfix[SSTRSIZE];
    552  1.20    martin char dist_tgz_postfix[SSTRSIZE];
    553   1.1  dholland 
    554   1.1  dholland /* needed prototypes */
    555   1.1  dholland void set_menu_numopts(int, int);
    556   1.2    martin void remove_color_options(void);
    557   1.3    martin void remove_raid_options(void);
    558   1.3    martin void remove_lvm_options(void);
    559   1.3    martin void remove_cgd_options(void);
    560   1.3    martin void remove_gpt_options(void);
    561   1.1  dholland 
    562   1.1  dholland /* Machine dependent functions .... */
    563   1.1  dholland void	md_init(void);
    564   1.1  dholland void	md_prelim_menu(void);
    565   1.1  dholland void	md_init_set_status(int); /* SFLAG_foo */
    566   1.1  dholland 
    567   1.1  dholland  /* MD functions if user selects install - in order called */
    568  1.34    martin bool	md_get_info(struct install_partition_desc*);
    569  1.34    martin bool	md_make_bsd_partitions(struct install_partition_desc*);
    570  1.34    martin bool	md_check_partitions(struct install_partition_desc*);
    571  1.34    martin #ifdef HAVE_GPT
    572  1.34    martin /*
    573  1.34    martin  * New GPT partitions have been written, update bootloader or remember
    574  1.34    martin  * data untill needed in md_post_newfs
    575  1.34    martin  */
    576  1.34    martin bool	md_gpt_post_write(struct disk_partitions*, part_id root_id,
    577  1.34    martin 	    bool root_is_new, part_id efi_id, bool efi_is_new);
    578  1.34    martin #endif
    579  1.34    martin /*
    580  1.34    martin  * md_pre_disklabel and md_post_disklabel may be called
    581  1.34    martin  * multiple times, for each affected device, with the
    582  1.34    martin  * "inner" partitions pointer of the relevant partitions
    583  1.34    martin  * passed.
    584  1.34    martin  */
    585  1.34    martin bool	md_pre_disklabel(struct install_partition_desc*, struct disk_partitions*);
    586  1.34    martin bool	md_post_disklabel(struct install_partition_desc*, struct disk_partitions*);
    587  1.38    martin int	md_pre_mount(struct install_partition_desc*, size_t);
    588  1.34    martin int	md_post_newfs(struct install_partition_desc*);
    589  1.34    martin int	md_post_extract(struct install_partition_desc*);
    590  1.34    martin void	md_cleanup_install(struct install_partition_desc*);
    591   1.1  dholland 
    592   1.1  dholland  /* MD functions if user selects upgrade - in order called */
    593  1.34    martin int	md_pre_update(struct install_partition_desc*);
    594  1.34    martin int	md_update(struct install_partition_desc*);
    595   1.1  dholland /* Also calls md_post_extract() */
    596   1.1  dholland 
    597   1.1  dholland /* from main.c */
    598   1.1  dholland void	toplevel(void);
    599   1.1  dholland 
    600   1.1  dholland /* from disks.c */
    601  1.21    martin bool	get_default_cdrom(char *, size_t);
    602  1.41    martin int	find_disks(const char *, bool);
    603  1.22    martin bool enumerate_disks(void *state,bool (*func)(void *state, const char *dev));
    604  1.24    martin bool is_cdrom_device(const char *dev, bool as_target);
    605  1.25    martin bool is_bootable_device(const char *dev);
    606  1.25    martin bool is_partitionable_device(const char *dev);
    607  1.34    martin bool convert_scheme(struct pm_devs *p, bool is_boot_drive, const char **err_msg);
    608  1.22    martin 
    609   1.1  dholland struct menudesc;
    610   1.1  dholland void	disp_cur_fspart(int, int);
    611  1.34    martin int	make_filesystems(struct install_partition_desc *);
    612  1.34    martin int	make_fstab(struct install_partition_desc *);
    613  1.34    martin int	mount_disks(struct install_partition_desc *);
    614  1.34    martin int	set_swap_if_low_ram(struct install_partition_desc *);
    615  1.34    martin int	set_swap(struct install_partition_desc *);
    616   1.1  dholland int	check_swap(const char *, int);
    617  1.34    martin char *bootxx_name(struct install_partition_desc *);
    618   1.2    martin int get_dkwedges(struct dkwedge_info **, const char *);
    619   1.1  dholland 
    620   1.1  dholland /* from disks_lfs.c */
    621   1.1  dholland int	fs_is_lfs(void *);
    622   1.1  dholland 
    623   1.1  dholland /* from label.c */
    624  1.34    martin /*
    625  1.34    martin  * Bits valid for "flags" in get_last_mounted.
    626  1.34    martin  * Currently we return the real last mount from FFS, the volume label
    627  1.34    martin  * from FAT32, and nothing otherwise. The NTFS support is currently
    628  1.34    martin  * restricted to verify the partition has an NTFS (as some partitioning
    629  1.34    martin  * schemes do not tell NTFS from FAT).
    630  1.34    martin  */
    631  1.34    martin #define GLM_LIKELY_FFS		1U
    632  1.34    martin #define	GLM_MAYBE_FAT32		2U
    633  1.34    martin #define	GLM_MAYBE_NTFS		4U
    634  1.34    martin /*
    635  1.34    martin  * possible fs_sub_types are currently:
    636  1.34    martin  *  FS_BSDFFS:
    637  1.34    martin  *	0	unknown
    638  1.34    martin  *	1	FFSv1
    639  1.34    martin  *	2	FFSv2
    640  1.34    martin  * FS_MSDOS:
    641  1.34    martin  *	0	unknown
    642  1.34    martin  *	else	MBR_PTYPE_FAT* for the current FAT variant
    643  1.34    martin  * FS_NTFS:
    644  1.34    martin  *	0	unknown
    645  1.34    martin  *	else	MBR_PTYPE_NTFS (if valid NTFS was found)
    646  1.34    martin  *
    647  1.34    martin  * The fs_type and fs_sub_type pointers may be NULL.
    648  1.34    martin  */
    649  1.34    martin const char *get_last_mounted(int fd, daddr_t offset, uint *fs_type,
    650  1.34    martin      uint *fs_sub_type, uint flags);
    651  1.42    martin void	canonicalize_last_mounted(char*);
    652  1.34    martin int	edit_and_check_label(struct pm_devs *p, struct partition_usage_set *pset);
    653   1.2    martin int edit_ptn(menudesc *, void *);
    654  1.34    martin int checkoverlap(struct disk_partitions *parts);
    655  1.34    martin daddr_t getpartsize(struct disk_partitions *parts, daddr_t partstart,
    656  1.34    martin     daddr_t defpartsize);
    657  1.34    martin daddr_t getpartoff(struct disk_partitions *parts, daddr_t defpartstart);
    658   1.1  dholland 
    659   1.1  dholland /* from install.c */
    660   1.1  dholland void	do_install(void);
    661   1.1  dholland 
    662   1.1  dholland /* from factor.c */
    663   1.1  dholland void	factor(long, long *, int, int *);
    664   1.1  dholland 
    665   1.1  dholland /* from fdisk.c */
    666   1.1  dholland void	get_disk_info(char *);
    667   1.1  dholland void	set_disk_info(char *);
    668   1.1  dholland 
    669   1.1  dholland /* from geom.c */
    670  1.36  christos bool	disk_ioctl(const char *, unsigned long, void *);
    671  1.36  christos bool	get_wedge_list(const char *, struct dkwedge_list *);
    672  1.36  christos bool	get_wedge_info(const char *, struct dkwedge_info *);
    673  1.36  christos bool	get_disk_geom(const char *, struct disk_geom *);
    674  1.36  christos bool	get_label_geom(const char *, struct disklabel *);
    675   1.1  dholland 
    676   1.1  dholland /* from net.c */
    677   1.1  dholland extern int network_up;
    678   1.4       roy extern char net_namesvr[STRSIZE];
    679  1.16    martin int	get_via_ftp(unsigned int);
    680   1.1  dholland int	get_via_nfs(void);
    681   1.1  dholland int	config_network(void);
    682   1.1  dholland void	mnt_net_config(void);
    683   1.1  dholland void	make_url(char *, struct ftpinfo *, const char *);
    684   1.1  dholland int	get_pkgsrc(void);
    685  1.16    martin const char *url_proto(unsigned int);
    686   1.1  dholland 
    687   1.1  dholland /* From run.c */
    688   1.1  dholland int	collect(int, char **, const char *, ...) __printflike(3, 4);
    689   1.1  dholland int	run_program(int, const char *, ...) __printflike(2, 3);
    690   1.1  dholland void	do_logging(void);
    691   1.1  dholland int	do_system(const char *);
    692   1.1  dholland 
    693   1.1  dholland /* from upgrade.c */
    694   1.1  dholland void	do_upgrade(void);
    695  1.40    martin void	do_reinstall_sets(void);
    696   1.1  dholland void	restore_etc(void);
    697   1.1  dholland 
    698  1.34    martin /* from part_edit.c */
    699  1.34    martin int	err_msg_win(const char*);
    700  1.34    martin const struct disk_partitioning_scheme *select_part_scheme(struct pm_devs *dev,
    701  1.34    martin     const struct disk_partitioning_scheme *skip, bool bootable,
    702  1.34    martin     const char *title);
    703  1.34    martin bool	edit_outer_parts(struct disk_partitions*);
    704  1.34    martin bool	parts_use_wholedisk(struct disk_partitions*,
    705  1.34    martin 	     size_t add_ext_parts, const struct disk_part_info *ext_parts);
    706  1.34    martin 
    707  1.34    martin /*
    708  1.34    martin  * Machine dependent partitioning function, only used when
    709  1.34    martin  * innern/outer partitioning schemes are in use - this sets
    710  1.34    martin  * up the outer scheme for maximum NetBSD usage.
    711  1.34    martin  */
    712  1.34    martin bool	md_parts_use_wholedisk(struct disk_partitions*);
    713  1.34    martin 
    714   1.1  dholland /* from util.c */
    715  1.44    martin bool	root_is_read_only(void);
    716  1.34    martin void	get_ptn_alignment(const struct disk_partitions *parts, daddr_t *align, daddr_t *p0off);
    717  1.27    martin char*	str_arg_subst(const char *, size_t, const char **);
    718  1.26    martin void	msg_display_subst(const char *, size_t, ...);
    719  1.34    martin void	msg_display_add_subst(const char *, size_t, ...);
    720   1.9    martin int	ask_yesno(const char *);
    721   1.9    martin int	ask_noyes(const char *);
    722  1.34    martin void	hit_enter_to_continue(const char *msg, const char *title);
    723  1.34    martin /*
    724  1.34    martin  * return value:
    725  1.34    martin  *  0 -> abort
    726  1.34    martin  *  1 -> re-edit
    727  1.34    martin  *  2 -> continue installation
    728  1.34    martin */
    729  1.34    martin int	ask_reedit(const struct disk_partitions *);
    730   1.1  dholland int	dir_exists_p(const char *);
    731   1.1  dholland int	file_exists_p(const char *);
    732   1.1  dholland int	file_mode_match(const char *, unsigned int);
    733  1.34    martin uint64_t	get_ramsize(void);	/* in MB! */
    734   1.1  dholland void	ask_sizemult(int);
    735   1.1  dholland void	run_makedev(void);
    736   1.1  dholland int	boot_media_still_needed(void);
    737   1.1  dholland int	get_via_floppy(void);
    738   1.1  dholland int	get_via_cdrom(void);
    739   1.1  dholland int	get_via_localfs(void);
    740   1.1  dholland int	get_via_localdir(void);
    741   1.1  dholland void	show_cur_distsets(void);
    742   1.1  dholland void	make_ramdisk_dir(const char *);
    743   1.1  dholland void    set_kernel_set(unsigned int);
    744   1.1  dholland unsigned int    get_kernel_set(void);
    745   1.1  dholland unsigned int    set_X11_selected(void);
    746   1.1  dholland int 	get_and_unpack_sets(int, msg, msg, msg);
    747   1.1  dholland int	sanity_check(void);
    748   1.1  dholland int	set_timezone(void);
    749   1.1  dholland void	scripting_fprintf(FILE *, const char *, ...) __printflike(2, 3);
    750   1.1  dholland void	scripting_vfprintf(FILE *, const char *, va_list) __printflike(2, 0);
    751  1.35  christos void	add_rc_conf(const char *, ...) __printflike(1, 2);
    752   1.1  dholland int	del_rc_conf(const char *);
    753   1.1  dholland void	add_sysctl_conf(const char *, ...) __printflike(1, 2);
    754   1.1  dholland void	enable_rc_conf(void);
    755  1.34    martin void	set_sizemult(uint secs);
    756  1.34    martin void	set_default_sizemult(uint secs);
    757   1.1  dholland int	check_lfs_progs(void);
    758   1.1  dholland void	init_set_status(int);
    759   1.1  dholland void	customise_sets(void);
    760   1.1  dholland void	umount_mnt2(void);
    761   1.1  dholland int 	set_is_source(const char *);
    762   1.1  dholland const char *set_dir_for_set(const char *);
    763   1.1  dholland const char *ext_dir_for_set(const char *);
    764  1.35  christos void	replace(const char *, const char *, ...) __printflike(2, 3);
    765   1.1  dholland void	get_tz_default(void);
    766   1.1  dholland int	extract_file(distinfo *, int);
    767   1.2    martin void	do_coloring (unsigned int, unsigned int);
    768   1.2    martin int set_menu_select(menudesc *, void *);
    769   1.5  christos const char *safectime(time_t *);
    770  1.20    martin bool	use_tgz_for_set(const char*);
    771  1.20    martin const char *set_postfix(const char*);
    772  1.34    martin bool	usage_set_from_parts(struct partition_usage_set*,
    773  1.34    martin 	    struct disk_partitions*);
    774  1.34    martin void	free_usage_set(struct partition_usage_set*);
    775  1.34    martin bool	install_desc_from_parts(struct install_partition_desc *,
    776  1.34    martin 	    struct disk_partitions*);
    777  1.34    martin void	free_install_desc(struct install_partition_desc*);
    778   1.1  dholland 
    779   1.1  dholland /* from target.c */
    780   1.1  dholland #if defined(DEBUG)  ||	defined(DEBUG_ROOT)
    781   1.1  dholland void	backtowin(void);
    782   1.1  dholland #endif
    783  1.39    martin bool	is_root_part_mount(const char *);
    784   1.1  dholland const	char *concat_paths(const char *, const char *);
    785   1.1  dholland const	char *target_expand(const char *);
    786  1.34    martin bool	needs_expanding(const char *, size_t);
    787   1.1  dholland void	make_target_dir(const char *);
    788   1.1  dholland void	append_to_target_file(const char *, const char *);
    789   1.1  dholland void	echo_to_target_file(const char *, const char *);
    790   1.1  dholland void	trunc_target_file(const char *);
    791   1.1  dholland const	char *target_prefix(void);
    792   1.1  dholland int	target_chdir(const char *);
    793   1.1  dholland void	target_chdir_or_die(const char *);
    794   1.1  dholland int	target_already_root(void);
    795   1.1  dholland FILE	*target_fopen(const char *, const char *);
    796   1.1  dholland int	target_collect_file(int, char **, const char *);
    797   1.1  dholland int	is_active_rootpart(const char *, int);
    798   1.1  dholland int	cp_to_target(const char *, const char *);
    799   1.1  dholland void	dup_file_into_target(const char *);
    800   1.1  dholland void	mv_within_target_or_die(const char *, const char *);
    801   1.1  dholland int	cp_within_target(const char *, const char *, int);
    802  1.34    martin int	target_mount(const char *, const char *, const char *);
    803  1.34    martin int	target_mount_do(const char *, const char *, const char *);
    804   1.1  dholland int	target_test(unsigned int, const char *);
    805   1.1  dholland int	target_dir_exists_p(const char *);
    806   1.1  dholland int	target_file_exists_p(const char *);
    807   1.1  dholland int	target_symlink_exists_p(const char *);
    808   1.1  dholland void	unwind_mounts(void);
    809   1.1  dholland int	target_mounted(void);
    810  1.43    martin void	umount_root(void);
    811   1.1  dholland 
    812   1.2    martin /* from partman.c */
    813  1.19       rin #ifndef NO_PARTMAN
    814   1.2    martin int partman(void);
    815  1.34    martin int pm_getrefdev(struct pm_devs *);
    816  1.19       rin void update_wedges(const char *);
    817  1.34    martin void pm_destroy_all(void);
    818  1.19       rin #else
    819  1.19       rin static inline int partman(void) { return -1; }
    820  1.34    martin static inline int pm_getrefdev(struct pm_devs *x __unused) { return -1; }
    821  1.19       rin #define update_wedges(x) __nothing
    822  1.19       rin #endif
    823  1.34    martin int pm_partusage(struct pm_devs *, int, int);
    824  1.34    martin void pm_setfstype(struct pm_devs *, part_id, int, int);
    825   1.2    martin int pm_editpart(int);
    826  1.34    martin void pm_rename(struct pm_devs *);
    827  1.34    martin int pm_shred(struct pm_devs *, int, int);
    828  1.34    martin void pm_umount(struct pm_devs *, int);
    829  1.34    martin int pm_unconfigure(struct pm_devs *);
    830  1.34    martin int pm_cgd_edit(void *, struct part_entry *);
    831  1.34    martin void pm_wedges_fill(struct pm_devs *);
    832  1.34    martin 
    833  1.34    martin /*
    834  1.34    martin  * Parse a file system position or size in a common way, return
    835  1.34    martin  * sector count and multiplicator.
    836  1.34    martin  * If "extend" is supported, things like 120+ will be parsed as
    837  1.34    martin  * 120 plus "extend this" flag.
    838  1.34    martin  * Caller needs to init muliplicator upfront to the default value.
    839  1.34    martin  */
    840  1.34    martin daddr_t parse_disk_pos(
    841  1.34    martin 	const char *,	/* in: input string */
    842  1.34    martin 	daddr_t *,	/* in/out: multiplicator for return value */
    843  1.34    martin 	daddr_t,	/* in: cylinder size in blocks */
    844  1.34    martin 	bool *);	/* NULL if "extend" is not supported, & of
    845  1.34    martin 			 * "extend" flag otherwise */
    846   1.7    martin 
    847   1.7    martin /* flags whether to offer the respective options (depending on helper
    848   1.7    martin    programs available on install media */
    849  1.34    martin extern int have_raid, have_vnd, have_cgd, have_lvm, have_gpt, have_dk;
    850   1.7    martin /* initialize above variables */
    851   1.7    martin void check_available_binaries(void);
    852   1.2    martin 
    853   1.1  dholland /* from bsddisklabel.c */
    854  1.34    martin bool	make_bsd_partitions(struct install_partition_desc*);
    855   1.1  dholland void	set_ptn_titles(menudesc *, int, void *);
    856   1.1  dholland int	set_ptn_size(menudesc *, void *);
    857  1.34    martin bool	get_ptn_sizes(struct partition_usage_set*);
    858  1.34    martin bool	check_partitions(struct install_partition_desc*);
    859   1.1  dholland 
    860   1.1  dholland /* from aout2elf.c */
    861   1.1  dholland int move_aout_libs(void);
    862   1.1  dholland 
    863   1.1  dholland #ifdef WSKBD
    864   1.1  dholland void	get_kb_encoding(void);
    865   1.1  dholland void	save_kb_encoding(void);
    866   1.1  dholland #else
    867   1.1  dholland #define	get_kb_encoding()
    868   1.1  dholland #define	save_kb_encoding()
    869   1.1  dholland #endif
    870   1.1  dholland 
    871   1.1  dholland /* from configmenu.c */
    872  1.34    martin void	do_configmenu(struct install_partition_desc*);
    873   1.1  dholland 
    874   1.1  dholland /* from checkrc.c */
    875   1.1  dholland int	check_rcvar(const char *);
    876   1.1  dholland int	check_rcdefault(const char *);
    877   1.2    martin 	WINDOW *mainwin;
    878   1.2    martin 
    879  1.34    martin /* in menus.mi */
    880  1.34    martin void expand_all_option_texts(menudesc *menu, void *arg);
    881  1.34    martin void resize_menu_height(menudesc *);
    882  1.34    martin 
    883   1.1  dholland #endif	/* _DEFS_H_ */
    884