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$ 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 36 struct gprovider; 37 struct gmesh; 38 struct ggeom; 39 40 TAILQ_HEAD(pmetadata_head, partition_metadata); 41 extern struct pmetadata_head part_metadata; 42 43 struct 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 54 struct partition_metadata *get_part_metadata(const char *name, int create); 55 void delete_part_metadata(const char *name); 56 57 int part_wizard(void); 58 int scripted_editor(int argc, const char **argv); 59 int wizard_makeparts(struct gmesh *mesh, const char *disk, int interactive); 60 61 /* gpart operations */ 62 void gpart_delete(struct gprovider *pp); 63 void gpart_destroy(struct ggeom *lg_geom); 64 void gpart_edit(struct gprovider *pp); 65 void gpart_create(struct gprovider *pp, char *default_type, char *default_size, 66 char *default_mountpoint, char **output, int interactive); 67 intmax_t gpart_max_free(struct ggeom *gp, intmax_t *start); 68 void gpart_revert(struct gprovider *pp); 69 void gpart_revert_all(struct gmesh *mesh); 70 void gpart_commit(struct gmesh *mesh); 71 int gpart_partition(const char *lg_name, const char *scheme); 72 void set_default_part_metadata(const char *name, const char *scheme, 73 const char *type, const char *mountpoint, const char *newfs); 74 75 /* machine-dependent bootability checks */ 76 const char *default_scheme(void); 77 int is_scheme_bootable(const char *scheme); 78 size_t bootpart_size(const char *scheme); 79 const char *bootpart_type(const char *scheme); 80 const char *bootcode_path(const char *scheme); 81 const char *partcode_path(const char *scheme); 82 83 #endif 84