xref: /freebsd/usr.sbin/bsdinstall/partedit/partedit_generic.c (revision 4d846d260e2b9a3d4d0a701462568268cbfe7a5b)
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  * $FreeBSD$
292118f387SNathan Whitehorn  */
302118f387SNathan Whitehorn 
312118f387SNathan Whitehorn #include <string.h>
322118f387SNathan Whitehorn 
332118f387SNathan Whitehorn #include "partedit.h"
342118f387SNathan Whitehorn 
352118f387SNathan Whitehorn const char *
362118f387SNathan Whitehorn default_scheme(void) {
372118f387SNathan Whitehorn 	/*
382118f387SNathan Whitehorn 	 * Our loader can parse GPT, so pick that as the default for lack of
392118f387SNathan Whitehorn 	 * a better idea.
402118f387SNathan Whitehorn 	 */
412118f387SNathan Whitehorn 
422118f387SNathan Whitehorn 	return ("GPT");
432118f387SNathan Whitehorn }
442118f387SNathan Whitehorn 
452118f387SNathan Whitehorn int
462118f387SNathan Whitehorn is_scheme_bootable(const char *part_type) {
472118f387SNathan Whitehorn 	/*
482118f387SNathan Whitehorn 	 * We don't know anything about this platform, so don't irritate the
492118f387SNathan Whitehorn 	 * user by claiming the chosen partition scheme isn't bootable.
502118f387SNathan Whitehorn 	 */
512118f387SNathan Whitehorn 
522118f387SNathan Whitehorn 	return (1);
532118f387SNathan Whitehorn }
542118f387SNathan Whitehorn 
556e15678aSNathan Whitehorn int
566e15678aSNathan Whitehorn is_fs_bootable(const char *part_type, const char *fs) {
576e15678aSNathan Whitehorn 	return (1);
586e15678aSNathan Whitehorn }
596e15678aSNathan Whitehorn 
602118f387SNathan Whitehorn /* No clue => no boot partition, bootcode, or partcode */
612118f387SNathan Whitehorn 
622118f387SNathan Whitehorn size_t
632118f387SNathan Whitehorn bootpart_size(const char *part_type) {
642118f387SNathan Whitehorn 	return (0);
652118f387SNathan Whitehorn }
662118f387SNathan Whitehorn 
672118f387SNathan Whitehorn const char *
6852f39da1SNathan Whitehorn bootpart_type(const char *scheme, const char **mountpoint) {
696b446ed5SNathan Whitehorn 	return ("freebsd-boot");
706b446ed5SNathan Whitehorn }
716b446ed5SNathan Whitehorn 
726b446ed5SNathan Whitehorn const char *
732118f387SNathan Whitehorn bootcode_path(const char *part_type) {
742118f387SNathan Whitehorn 	return (NULL);
752118f387SNathan Whitehorn }
762118f387SNathan Whitehorn 
772118f387SNathan Whitehorn const char *
786e15678aSNathan Whitehorn partcode_path(const char *part_type, const char *fs_type) {
792118f387SNathan Whitehorn 	return (NULL);
802118f387SNathan Whitehorn }
812118f387SNathan Whitehorn 
82