xref: /minix3/sbin/newfs_msdos/mkfs_msdos.h (revision 25d017aa13555ad6275f6d3aa1113d2b0b092534)
1*25d017aaSSevan Janiyan /*	$NetBSD: mkfs_msdos.h,v 1.6 2017/02/17 09:29:35 wiz Exp $	*/
29f988b79SJean-Baptiste Boric 
39f988b79SJean-Baptiste Boric /*-
49f988b79SJean-Baptiste Boric  * Copyright (c) 2013 The NetBSD Foundation, Inc.
59f988b79SJean-Baptiste Boric  * All rights reserved.
69f988b79SJean-Baptiste Boric  *
79f988b79SJean-Baptiste Boric  * This code is derived from software contributed to The NetBSD Foundation
89f988b79SJean-Baptiste Boric  * by Christos Zoulas.
99f988b79SJean-Baptiste Boric  *
109f988b79SJean-Baptiste Boric  * Redistribution and use in source and binary forms, with or without
119f988b79SJean-Baptiste Boric  * modification, are permitted provided that the following conditions
129f988b79SJean-Baptiste Boric  * are met:
139f988b79SJean-Baptiste Boric  * 1. Redistributions of source code must retain the above copyright
149f988b79SJean-Baptiste Boric  *    notice, this list of conditions and the following disclaimer.
159f988b79SJean-Baptiste Boric  * 2. Redistributions in binary form must reproduce the above copyright
169f988b79SJean-Baptiste Boric  *    notice, this list of conditions and the following disclaimer in the
179f988b79SJean-Baptiste Boric  *    documentation and/or other materials provided with the distribution.
189f988b79SJean-Baptiste Boric  *
199f988b79SJean-Baptiste Boric  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
209f988b79SJean-Baptiste Boric  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
219f988b79SJean-Baptiste Boric  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
229f988b79SJean-Baptiste Boric  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
239f988b79SJean-Baptiste Boric  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
249f988b79SJean-Baptiste Boric  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
259f988b79SJean-Baptiste Boric  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
269f988b79SJean-Baptiste Boric  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
279f988b79SJean-Baptiste Boric  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
289f988b79SJean-Baptiste Boric  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
299f988b79SJean-Baptiste Boric  * POSSIBILITY OF SUCH DAMAGE.
309f988b79SJean-Baptiste Boric  */
319f988b79SJean-Baptiste Boric 
329f988b79SJean-Baptiste Boric #include <sys/types.h>
339f988b79SJean-Baptiste Boric #include <stdbool.h>
349f988b79SJean-Baptiste Boric #define ALLOPTS \
359f988b79SJean-Baptiste Boric AOPT('@', off_t, offset, 0, "Offset in device") \
369f988b79SJean-Baptiste Boric AOPT('B', char *, bootstrap, -1, "Bootstrap file") \
379f988b79SJean-Baptiste Boric AOPT('C', off_t, create_size, 0, "Create file") \
389f988b79SJean-Baptiste Boric AOPT('F', uint8_t,  fat_type, 12, "FAT type (12, 16, or 32)") \
399f988b79SJean-Baptiste Boric AOPT('I', uint32_t, volume_id, 0, "Volume ID") \
409f988b79SJean-Baptiste Boric AOPT('L', char *, volume_label, -1, "Volume Label") \
419f988b79SJean-Baptiste Boric AOPT('N', bool, no_create, -2, "Don't create file system, print params only") \
429f988b79SJean-Baptiste Boric AOPT('O', char *, OEM_string, -1, "OEM string") \
439f988b79SJean-Baptiste Boric AOPT('S', uint16_t, bytes_per_sector, 1, "Bytes per sector") \
449f988b79SJean-Baptiste Boric AOPT('a', uint32_t, sectors_per_fat, 1, "Sectors per FAT") \
459f988b79SJean-Baptiste Boric AOPT('b', uint32_t, block_size, 1, "Block size") \
469f988b79SJean-Baptiste Boric AOPT('c', uint8_t, sectors_per_cluster, 1, "Sectors per cluster") \
479f988b79SJean-Baptiste Boric AOPT('e', uint16_t, directory_entries, 1, "Directory entries") \
489f988b79SJean-Baptiste Boric AOPT('f', char *, floppy, -1, "Standard format floppies (160,180,320,360,640,720,1200,1232,1440,2880)") \
499f988b79SJean-Baptiste Boric AOPT('h', uint16_t, drive_heads, 1, "Drive heads") \
509f988b79SJean-Baptiste Boric AOPT('i', uint16_t, info_sector, 1, "Info sector") \
519f988b79SJean-Baptiste Boric AOPT('k', uint16_t, backup_sector, 1, "Backup sector") \
529f988b79SJean-Baptiste Boric AOPT('m', uint8_t, media_descriptor, 0, "Media descriptor") \
539f988b79SJean-Baptiste Boric AOPT('n', uint8_t, num_FAT, 1, "Number of FATs") \
549f988b79SJean-Baptiste Boric AOPT('o', uint32_t, hidden_sectors, 0, "Hidden sectors") \
559f988b79SJean-Baptiste Boric AOPT('r', uint16_t, reserved_sectors, 1, "Reserved sectors") \
569f988b79SJean-Baptiste Boric AOPT('s', uint32_t, size, 1, "File System size") \
579f988b79SJean-Baptiste Boric AOPT('u', uint16_t, sectors_per_track, 1, "Sectors per track")
589f988b79SJean-Baptiste Boric 
599f988b79SJean-Baptiste Boric struct msdos_options {
609f988b79SJean-Baptiste Boric #define AOPT(_opt, _type, _name, _min, _desc) _type _name;
619f988b79SJean-Baptiste Boric ALLOPTS
629f988b79SJean-Baptiste Boric #undef AOPT
63*25d017aaSSevan Janiyan 	time_t	timestamp;
64*25d017aaSSevan Janiyan 	uint32_t timestamp_set:1;
659f988b79SJean-Baptiste Boric 	uint32_t volume_id_set:1;
669f988b79SJean-Baptiste Boric 	uint32_t media_descriptor_set:1;
679f988b79SJean-Baptiste Boric 	uint32_t hidden_sectors_set:1;
689f988b79SJean-Baptiste Boric };
699f988b79SJean-Baptiste Boric 
709f988b79SJean-Baptiste Boric int mkfs_msdos(const char *, const char *, const struct msdos_options *);
71