1f9f848faSopenharmony_ci/*	$NetBSD: mkfs_msdos.h,v 1.3 2015/10/16 17:38:17 christos Exp $	*/
2f9f848faSopenharmony_ci
3f9f848faSopenharmony_ci/*-
4f9f848faSopenharmony_ci * Copyright (c) 2013 The NetBSD Foundation, Inc.
5f9f848faSopenharmony_ci * All rights reserved.
6f9f848faSopenharmony_ci *
7f9f848faSopenharmony_ci * This code is derived from software contributed to The NetBSD Foundation
8f9f848faSopenharmony_ci * by Christos Zoulas.
9f9f848faSopenharmony_ci *
10f9f848faSopenharmony_ci * Redistribution and use in source and binary forms, with or without
11f9f848faSopenharmony_ci * modification, are permitted provided that the following conditions
12f9f848faSopenharmony_ci * are met:
13f9f848faSopenharmony_ci * 1. Redistributions of source code must retain the above copyright
14f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer.
15f9f848faSopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
16f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
17f9f848faSopenharmony_ci *    documentation and/or other materials provided with the distribution.
18f9f848faSopenharmony_ci *
19f9f848faSopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20f9f848faSopenharmony_ci * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21f9f848faSopenharmony_ci * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22f9f848faSopenharmony_ci * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23f9f848faSopenharmony_ci * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24f9f848faSopenharmony_ci * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25f9f848faSopenharmony_ci * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26f9f848faSopenharmony_ci * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27f9f848faSopenharmony_ci * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28f9f848faSopenharmony_ci * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29f9f848faSopenharmony_ci * POSSIBILITY OF SUCH DAMAGE.
30f9f848faSopenharmony_ci */
31f9f848faSopenharmony_ci
32f9f848faSopenharmony_ci#include <sys/types.h>
33f9f848faSopenharmony_ci#include <stdbool.h>
34f9f848faSopenharmony_ci
35f9f848faSopenharmony_ci#include "mkfs_define.h"
36f9f848faSopenharmony_ci
37f9f848faSopenharmony_ci#define ALLOPTS \
38f9f848faSopenharmony_ciAOPT('@', off_t, offset, 0, "Offset in device") \
39f9f848faSopenharmony_ciAOPT('A', bool, align, -2, "Attempt to cluster align root directory") \
40f9f848faSopenharmony_ciAOPT('B', const char *, bootstrap, -1, "Bootstrap file") \
41f9f848faSopenharmony_ciAOPT('C', off_t, create_size, 0, "Create file") \
42f9f848faSopenharmony_ciAOPT('F', uint8_t,  fat_type, 12, "FAT type (12, 16, or 32)") \
43f9f848faSopenharmony_ciAOPT('I', uint32_t, volume_id, 0, "Volume ID") \
44f9f848faSopenharmony_ciAOPT('L', const char *, volume_label, -1, "Volume Label") \
45f9f848faSopenharmony_ciAOPT('N', bool, no_create, -2, "Don't create filesystem, print params only") \
46f9f848faSopenharmony_ciAOPT('O', const char *, OEM_string, -1, "OEM string") \
47f9f848faSopenharmony_ciAOPT('S', uint16_t, bytes_per_sector, 1, "Bytes per sector") \
48f9f848faSopenharmony_ciAOPT('T', time_t, timestamp, 0, "Timestamp") \
49f9f848faSopenharmony_ciAOPT('a', uint32_t, sectors_per_fat, 1, "Sectors per FAT") \
50f9f848faSopenharmony_ciAOPT('b', uint32_t, block_size, 1, "Block size") \
51f9f848faSopenharmony_ciAOPT('c', uint8_t, sectors_per_cluster, 1, "Sectors per cluster") \
52f9f848faSopenharmony_ciAOPT('e', uint16_t, directory_entries, 1, "Directory entries") \
53f9f848faSopenharmony_ciAOPT('f', const char *, floppy, -1, "Standard format floppies (160,180,320,360,640,720,1200,1232,1440,2880)") \
54f9f848faSopenharmony_ciAOPT('h', uint16_t, drive_heads, 1, "Drive heads") \
55f9f848faSopenharmony_ciAOPT('i', uint16_t, info_sector, 1, "Info sector") \
56f9f848faSopenharmony_ciAOPT('k', uint16_t, backup_sector, 1, "Backup sector") \
57f9f848faSopenharmony_ciAOPT('m', uint8_t, media_descriptor, 0, "Media descriptor") \
58f9f848faSopenharmony_ciAOPT('n', uint8_t, num_FAT, 1, "Number of FATs") \
59f9f848faSopenharmony_ciAOPT('o', uint32_t, hidden_sectors, 0, "Hidden sectors") \
60f9f848faSopenharmony_ciAOPT('r', uint16_t, reserved_sectors, 1, "Reserved sectors") \
61f9f848faSopenharmony_ciAOPT('s', uint32_t, size, 1, "File System size") \
62f9f848faSopenharmony_ciAOPT('u', uint16_t, sectors_per_track, 1, "Sectors per track")
63f9f848faSopenharmony_ci
64f9f848faSopenharmony_cistruct msdos_options {
65f9f848faSopenharmony_ci#define AOPT(_opt, _type, _name, _min, _desc) _type _name;
66f9f848faSopenharmony_ciALLOPTS
67f9f848faSopenharmony_ci#undef AOPT
68f9f848faSopenharmony_ci	uint32_t timestamp_set:1;
69f9f848faSopenharmony_ci	uint32_t volume_id_set:1;
70f9f848faSopenharmony_ci	uint32_t media_descriptor_set:1;
71f9f848faSopenharmony_ci	uint32_t hidden_sectors_set:1;
72f9f848faSopenharmony_ci};
73f9f848faSopenharmony_ci
74f9f848faSopenharmony_ciint mkfs_msdos(const char *, const char *, const struct msdos_options *);
75