xref: /freebsd/usr.sbin/bsdinstall/partedit/partedit_generic.c (revision b3e7694832e81d7a904a10f525f8797b753bf0d3)
12118f387SNathan Whitehorn /*-
2*4d846d26SWarner Losh  * SPDX-License-Identifier: BSD-2-Clause
31de7b4b8SPedro F. Giffuni  *
42118f387SNathan Whitehorn  * Copyright (c) 2011 Nathan Whitehorn
52118f387SNathan Whitehorn  * All rights reserved.
62118f387SNathan Whitehorn  *
72118f387SNathan Whitehorn  * Redistribution and use in source and binary forms, with or without
82118f387SNathan Whitehorn  * modification, are permitted provided that the following conditions
92118f387SNathan Whitehorn  * are met:
102118f387SNathan Whitehorn  * 1. Redistributions of source code must retain the above copyright
112118f387SNathan Whitehorn  *    notice, this list of conditions and the following disclaimer.
122118f387SNathan Whitehorn  * 2. Redistributions in binary form must reproduce the above copyright
132118f387SNathan Whitehorn  *    notice, this list of conditions and the following disclaimer in the
142118f387SNathan Whitehorn  *    documentation and/or other materials provided with the distribution.
152118f387SNathan Whitehorn  *
162118f387SNathan Whitehorn  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
172118f387SNathan Whitehorn  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
182118f387SNathan Whitehorn  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
192118f387SNathan Whitehorn  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
202118f387SNathan Whitehorn  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
212118f387SNathan Whitehorn  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
222118f387SNathan Whitehorn  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
232118f387SNathan Whitehorn  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
242118f387SNathan Whitehorn  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
252118f387SNathan Whitehorn  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
262118f387SNathan Whitehorn  * SUCH DAMAGE.
272118f387SNathan Whitehorn  */
282118f387SNathan Whitehorn 
292118f387SNathan Whitehorn #include <string.h>
302118f387SNathan Whitehorn 
312118f387SNathan Whitehorn #include "partedit.h"
322118f387SNathan Whitehorn 
332118f387SNathan Whitehorn const char *
default_scheme(void)342118f387SNathan Whitehorn default_scheme(void) {
352118f387SNathan Whitehorn 	/*
362118f387SNathan Whitehorn 	 * Our loader can parse GPT, so pick that as the default for lack of
372118f387SNathan Whitehorn 	 * a better idea.
382118f387SNathan Whitehorn 	 */
392118f387SNathan Whitehorn 
402118f387SNathan Whitehorn 	return ("GPT");
412118f387SNathan Whitehorn }
422118f387SNathan Whitehorn 
432118f387SNathan Whitehorn int
is_scheme_bootable(const char * part_type)442118f387SNathan Whitehorn is_scheme_bootable(const char *part_type) {
452118f387SNathan Whitehorn 	/*
462118f387SNathan Whitehorn 	 * We don't know anything about this platform, so don't irritate the
472118f387SNathan Whitehorn 	 * user by claiming the chosen partition scheme isn't bootable.
482118f387SNathan Whitehorn 	 */
492118f387SNathan Whitehorn 
502118f387SNathan Whitehorn 	return (1);
512118f387SNathan Whitehorn }
522118f387SNathan Whitehorn 
536e15678aSNathan Whitehorn int
is_fs_bootable(const char * part_type,const char * fs)546e15678aSNathan Whitehorn is_fs_bootable(const char *part_type, const char *fs) {
556e15678aSNathan Whitehorn 	return (1);
566e15678aSNathan Whitehorn }
576e15678aSNathan Whitehorn 
582118f387SNathan Whitehorn /* No clue => no boot partition, bootcode, or partcode */
592118f387SNathan Whitehorn 
602118f387SNathan Whitehorn size_t
bootpart_size(const char * part_type)612118f387SNathan Whitehorn bootpart_size(const char *part_type) {
622118f387SNathan Whitehorn 	return (0);
632118f387SNathan Whitehorn }
642118f387SNathan Whitehorn 
652118f387SNathan Whitehorn const char *
bootpart_type(const char * scheme,const char ** mountpoint)6652f39da1SNathan Whitehorn bootpart_type(const char *scheme, const char **mountpoint) {
676b446ed5SNathan Whitehorn 	return ("freebsd-boot");
686b446ed5SNathan Whitehorn }
696b446ed5SNathan Whitehorn 
706b446ed5SNathan Whitehorn const char *
bootcode_path(const char * part_type)712118f387SNathan Whitehorn bootcode_path(const char *part_type) {
722118f387SNathan Whitehorn 	return (NULL);
732118f387SNathan Whitehorn }
742118f387SNathan Whitehorn 
752118f387SNathan Whitehorn const char *
partcode_path(const char * part_type,const char * fs_type)766e15678aSNathan Whitehorn partcode_path(const char *part_type, const char *fs_type) {
772118f387SNathan Whitehorn 	return (NULL);
782118f387SNathan Whitehorn }
792118f387SNathan Whitehorn 
80