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