2 * Copyright (c) 2011 Nathan Whitehorn
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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
29 #ifndef _PARTEDIT_PARTEDIT_H
30 #define _PARTEDIT_PARTEDIT_H
32 #include <sys/queue.h>
40 TAILQ_HEAD(pmetadata_head, partition_metadata);
41 extern struct pmetadata_head part_metadata;
43 struct partition_metadata {
44 char *name; /* name of this partition, as in GEOM */
46 struct fstab *fstab; /* fstab data for this partition */
47 char *newfs; /* shell command to initialize partition */
51 TAILQ_ENTRY(partition_metadata) metadata;
54 struct partition_metadata *get_part_metadata(const char *name, int create);
55 void delete_part_metadata(const char *name);
57 int part_wizard(const char *fstype);
58 int scripted_editor(int argc, const char **argv);
59 int wizard_makeparts(struct gmesh *mesh, const char *disk, const char *fstype,
62 /* gpart operations */
63 void gpart_delete(struct gprovider *pp);
64 void gpart_destroy(struct ggeom *lg_geom);
65 void gpart_edit(struct gprovider *pp);
66 void gpart_create(struct gprovider *pp, char *default_type, char *default_size,
67 char *default_mountpoint, char **output, int interactive);
68 intmax_t gpart_max_free(struct ggeom *gp, intmax_t *start);
69 void gpart_revert(struct gprovider *pp);
70 void gpart_revert_all(struct gmesh *mesh);
71 void gpart_commit(struct gmesh *mesh);
72 int gpart_partition(const char *lg_name, const char *scheme);
73 void set_default_part_metadata(const char *name, const char *scheme,
74 const char *type, const char *mountpoint, const char *newfs);
75 void gpart_set_root(const char *lg_name, const char *attribute);
76 const char *choose_part_type(const char *def_scheme);
78 /* machine-dependent bootability checks */
79 const char *default_scheme(void);
80 int is_scheme_bootable(const char *scheme);
81 int is_fs_bootable(const char *scheme, const char *fs);
82 size_t bootpart_size(const char *scheme);
83 const char *bootpart_type(const char *scheme);
84 const char *bootcode_path(const char *scheme);
85 const char *partcode_path(const char *scheme, const char *fs_type);