/*
 * Copyright (c)2004 The DragonFly Project.  All rights reserved.
 * 
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 
 *   Redistributions of source code must retain the above copyright
 *   notice, this list of conditions and the following disclaimer.
 * 
 *   Redistributions in binary form must reproduce the above copyright
 *   notice, this list of conditions and the following disclaimer in
 *   the documentation and/or other materials provided with the
 *   distribution.
 * 
 *   Neither the name of the DragonFly Project nor the names of its
 *   contributors may be used to endorse or promote products derived
 *   from this software without specific prior written permission. 
 * 
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
 * OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

/*
 * functions.h
 * $Id: functions.h,v 1.2 2004/07/10 22:07:47 cpressey Exp $
 */

#include "diskutil.h"

#include <dfui/dfui.h>

#ifndef __FUNCTIONS_H_
#define __FUNCTIONS_H_

/*** PROTOTYPES ***/

/* General */

void		 abort_backend(void);
int		 assert_clean(char *, char *, char *);
void		 fprintfo(FILE *f, char *fmt, ...);
int		 hex_to_int(char *, int *);
int		 first_non_space_char_is(char *, char);
char		*capacity_to_string(long);
int		 string_to_capacity(char *, long *);
long		 next_power_of_two(long);

struct disk	*fn_select_disk(struct system_storage *, char *, char *);
struct slice	*fn_select_slice(struct disk *, char *, char *);

/* Configure an Installed System (only) */

int		 mount_target_system(char *);

void 		 fn_root_passwd(void);
void 		 fn_add_user(void);
void		 fn_cvsup_sources(void);
void		 fn_install_packages(void);
void		 fn_remove_packages(void);

/* Configure the LiveCD Environment -or- an Installed System */

void		 fn_assign_datetime(char *);
void		 fn_set_timezone(char *);
void 		 fn_set_kbdmap(char *);
void 		 fn_set_vidfont(char *);
void 		 fn_set_scrnmap(char *);
void		 fn_assign_hostname_domain(char *);
void		 fn_assign_ip(char *);

/* LiveCD Utilities: Diagnostics */

void		 fn_show_dmesg(void);
void		 fn_show_pciconf(void);
void		 fn_show_pnpinfo(void);
void		 fn_show_atacontrol(void);
void		 fn_memtest(void);

void		 view_memtest_log(struct dfui_connection *);
void		 show_ifconfig(char *ifname);

/* LiveCD Utilties: Disk Utilities */

int		 fn_format_disk(void);
int		 fn_install_bootblocks(char *, char *);
void		 fn_wipe_start_of_disk(void);
void		 fn_wipe_start_of_slice(void);
void		 fn_format_msdos_floppy(void);
void		 fn_create_cdboot_floppy(void);
void		 fn_create_memtest86_floppy(void);

int		 format_slice(char *, int);

int		 fn_create_subpartitions(void);
int		 fn_install_os(void);

#endif /* !__FUNCTIONS_H_ */
