partedit.h revision 273831
1/*- 2 * Copyright (c) 2011 Nathan Whitehorn 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer. 10 * 2. Redistributions in binary form must reproduce the above copyright 11 * notice, this list of conditions and the following disclaimer in the 12 * documentation and/or other materials provided with the distribution. 13 * 14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24 * SUCH DAMAGE. 25 * 26 * $FreeBSD: stable/10/usr.sbin/bsdinstall/partedit/partedit.h 273831 2014-10-29 16:48:18Z nwhitehorn $ 27 */ 28 29#ifndef _PARTEDIT_PARTEDIT_H 30#define _PARTEDIT_PARTEDIT_H 31 32#include <sys/queue.h> 33#include <inttypes.h> 34#include <fstab.h> 35 36struct gprovider; 37struct gmesh; 38struct ggeom; 39 40TAILQ_HEAD(pmetadata_head, partition_metadata); 41extern struct pmetadata_head part_metadata; 42 43struct partition_metadata { 44 char *name; /* name of this partition, as in GEOM */ 45 46 struct fstab *fstab; /* fstab data for this partition */ 47 char *newfs; /* shell command to initialize partition */ 48 49 int bootcode; 50 51 TAILQ_ENTRY(partition_metadata) metadata; 52}; 53 54struct partition_metadata *get_part_metadata(const char *name, int create); 55void delete_part_metadata(const char *name); 56 57int part_wizard(const char *fstype); 58int scripted_editor(int argc, const char **argv); 59int wizard_makeparts(struct gmesh *mesh, const char *disk, const char *fstype, 60 int interactive); 61 62/* gpart operations */ 63void gpart_delete(struct gprovider *pp); 64void gpart_destroy(struct ggeom *lg_geom); 65void gpart_edit(struct gprovider *pp); 66void gpart_create(struct gprovider *pp, char *default_type, char *default_size, 67 char *default_mountpoint, char **output, int interactive); 68intmax_t gpart_max_free(struct ggeom *gp, intmax_t *start); 69void gpart_revert(struct gprovider *pp); 70void gpart_revert_all(struct gmesh *mesh); 71void gpart_commit(struct gmesh *mesh); 72int gpart_partition(const char *lg_name, const char *scheme); 73void set_default_part_metadata(const char *name, const char *scheme, 74 const char *type, const char *mountpoint, const char *newfs); 75 76/* machine-dependent bootability checks */ 77const char *default_scheme(void); 78int is_scheme_bootable(const char *scheme); 79int is_fs_bootable(const char *scheme, const char *fs); 80size_t bootpart_size(const char *scheme); 81const char *bootpart_type(const char *scheme); 82const char *bootcode_path(const char *scheme); 83const char *partcode_path(const char *scheme, const char *fs_type); 84 85#endif 86