summaryrefslogtreecommitdiffstats
path: root/usr.sbin/makefs
diff options
context:
space:
mode:
authornatano <natano@openbsd.org>2016-10-22 22:20:24 +0000
committernatano <natano@openbsd.org>2016-10-22 22:20:24 +0000
commitbb19b730167e1d900f1730ef71de408d846f03e2 (patch)
treed6a6aaf3b303645b090bc666e43e49aa0387a19f /usr.sbin/makefs
parentTeach tcpdump(8) how to read OpenFlow packets. This initial implementation (diff)
downloadwireguard-openbsd-bb19b730167e1d900f1730ef71de408d846f03e2.tar.xz
wireguard-openbsd-bb19b730167e1d900f1730ef71de408d846f03e2.zip
Dedup msdosfs/{bootsect.h,bpb.h}.
Diffstat (limited to 'usr.sbin/makefs')
-rw-r--r--usr.sbin/makefs/msdos/bootsect.h97
-rw-r--r--usr.sbin/makefs/msdos/bpb.h191
-rw-r--r--usr.sbin/makefs/msdos/msdosfs_denode.c4
-rw-r--r--usr.sbin/makefs/msdos/msdosfs_fat.c4
-rw-r--r--usr.sbin/makefs/msdos/msdosfs_lookup.c4
-rw-r--r--usr.sbin/makefs/msdos/msdosfs_vfsops.c6
-rw-r--r--usr.sbin/makefs/msdos/msdosfs_vnops.c4
7 files changed, 11 insertions, 299 deletions
diff --git a/usr.sbin/makefs/msdos/bootsect.h b/usr.sbin/makefs/msdos/bootsect.h
deleted file mode 100644
index 071f6e975ce..00000000000
--- a/usr.sbin/makefs/msdos/bootsect.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* $OpenBSD: bootsect.h,v 1.1 2016/10/18 17:05:30 natano Exp $ */
-/* $NetBSD: bootsect.h,v 1.6 2016/01/22 22:48:18 dholland Exp $ */
-
-/*
- * Written by Paul Popelka (paulp@uts.amdahl.com)
- *
- * You can do anything you want with this software, just don't say you wrote
- * it, and don't remove this notice.
- *
- * This software is provided "as is".
- *
- * The author supplies this software to be publicly redistributed on the
- * understanding that the author is not responsible for the correct
- * functioning of this software in any circumstances and is not liable for
- * any damages caused by this software.
- *
- * October 1992
- */
-#ifndef _MSDOSFS_BOOTSECT_H_
-#define _MSDOSFS_BOOTSECT_H_
-
-/*
- * Format of a boot sector. This is the first sector on a DOS floppy disk
- * or the fist sector of a partition on a hard disk. But, it is not the
- * first sector of a partitioned hard disk.
- */
-struct bootsector33 {
- uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
- int8_t bsOemName[8]; /* OEM name and version */
- int8_t bsBPB[19]; /* BIOS parameter block */
- int8_t bsDriveNumber; /* drive number (0x80) */
- int8_t bsBootCode[479]; /* pad so struct is 512b */
- uint8_t bsBootSectSig0;
- uint8_t bsBootSectSig1;
-#define BOOTSIG0 0x55
-#define BOOTSIG1 0xaa
-};
-
-struct extboot {
- int8_t exDriveNumber; /* drive number (0x80) */
- int8_t exReserved1; /* reserved */
- int8_t exBootSignature; /* ext. boot signature (0x29) */
-#define EXBOOTSIG 0x29
- int8_t exVolumeID[4]; /* volume ID number */
- int8_t exVolumeLabel[11]; /* volume label */
- int8_t exFileSysType[8]; /* fs type (FAT12 or FAT16) */
-};
-
-struct bootsector50 {
- uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
- int8_t bsOemName[8]; /* OEM name and version */
- int8_t bsBPB[25]; /* BIOS parameter block */
- int8_t bsExt[26]; /* Bootsector Extension */
- int8_t bsBootCode[448]; /* pad so structure is 512b */
- uint8_t bsBootSectSig0;
- uint8_t bsBootSectSig1;
-#define BOOTSIG0 0x55
-#define BOOTSIG1 0xaa
-};
-
-struct bootsector710 {
- uint8_t bsJump[3]; /* jump inst E9xxxx or EBxx90 */
- int8_t bsOEMName[8]; /* OEM name and version */
- int8_t bsBPB[53]; /* BIOS parameter block */
- int8_t bsExt[26]; /* Bootsector Extension */
- int8_t bsBootCode[420]; /* pad so structure is 512b */
- uint8_t bsBootSectSig0;
- uint8_t bsBootSectSig1;
-#define BOOTSIG0 0x55
-#define BOOTSIG1 0xaa
-};
-
-union bootsector {
- struct bootsector33 bs33;
- struct bootsector50 bs50;
- struct bootsector710 bs710;
-};
-
-#if 0
-/*
- * Shorthand for fields in the bpb.
- */
-#define bsBytesPerSec bsBPB.bpbBytesPerSec
-#define bsSectPerClust bsBPB.bpbSectPerClust
-#define bsResSectors bsBPB.bpbResSectors
-#define bsFATS bsBPB.bpbFATS
-#define bsRootDirEnts bsBPB.bpbRootDirEnts
-#define bsSectors bsBPB.bpbSectors
-#define bsMedia bsBPB.bpbMedia
-#define bsFATsecs bsBPB.bpbFATsecs
-#define bsSectPerTrack bsBPB.bpbSectPerTrack
-#define bsHeads bsBPB.bpbHeads
-#define bsHiddenSecs bsBPB.bpbHiddenSecs
-#define bsHugeSectors bsBPB.bpbHugeSectors
-#endif
-
-#endif /* _MSDOSFS_BOOTSECT_H_ */
diff --git a/usr.sbin/makefs/msdos/bpb.h b/usr.sbin/makefs/msdos/bpb.h
deleted file mode 100644
index 7a1f2b69831..00000000000
--- a/usr.sbin/makefs/msdos/bpb.h
+++ /dev/null
@@ -1,191 +0,0 @@
-/* $OpenBSD: bpb.h,v 1.1 2016/10/18 17:05:30 natano Exp $ */
-/* $NetBSD: bpb.h,v 1.8 2016/01/22 22:53:36 dholland Exp $ */
-
-/*
- * Written by Paul Popelka (paulp@uts.amdahl.com)
- *
- * You can do anything you want with this software, just don't say you wrote
- * it, and don't remove this notice.
- *
- * This software is provided "as is".
- *
- * The author supplies this software to be publicly redistributed on the
- * understanding that the author is not responsible for the correct
- * functioning of this software in any circumstances and is not liable for
- * any damages caused by this software.
- *
- * October 1992
- */
-
-#ifndef _MSDOSFS_BPB_H_
-#define _MSDOSFS_BPB_H_
-
-/*
- * BIOS Parameter Block (BPB) for DOS 3.3
- */
-struct bpb33 {
- uint16_t bpbBytesPerSec; /* bytes per sector */
- uint8_t bpbSecPerClust; /* sectors per cluster */
- uint16_t bpbResSectors; /* number of reserved sectors */
- uint8_t bpbFATs; /* number of FATs */
- uint16_t bpbRootDirEnts; /* number of root directory entries */
- uint16_t bpbSectors; /* total number of sectors */
- uint8_t bpbMedia; /* media descriptor */
- uint16_t bpbFATsecs; /* number of sectors per FAT */
- uint16_t bpbSecPerTrack; /* sectors per track */
- uint16_t bpbHeads; /* number of heads */
- uint16_t bpbHiddenSecs; /* number of hidden sectors */
-};
-
-/*
- * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
- * and bpbHugeSectors is not in the 3.3 bpb.
- */
-struct bpb50 {
- uint16_t bpbBytesPerSec; /* bytes per sector */
- uint8_t bpbSecPerClust; /* sectors per cluster */
- uint16_t bpbResSectors; /* number of reserved sectors */
- uint8_t bpbFATs; /* number of FATs */
- uint16_t bpbRootDirEnts; /* number of root directory entries */
- uint16_t bpbSectors; /* total number of sectors */
- uint8_t bpbMedia; /* media descriptor */
- uint16_t bpbFATsecs; /* number of sectors per FAT */
- uint16_t bpbSecPerTrack; /* sectors per track */
- uint16_t bpbHeads; /* number of heads */
- uint32_t bpbHiddenSecs; /* # of hidden sectors */
- uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
-};
-
-/*
- * BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
- */
-struct bpb710 {
- uint16_t bpbBytesPerSec; /* bytes per sector */
- uint8_t bpbSecPerClust; /* sectors per cluster */
- uint16_t bpbResSectors; /* number of reserved sectors */
- uint8_t bpbFATs; /* number of FATs */
- uint16_t bpbRootDirEnts; /* number of root directory entries */
- uint16_t bpbSectors; /* total number of sectors */
- uint8_t bpbMedia; /* media descriptor */
- uint16_t bpbFATsecs; /* number of sectors per FAT */
- uint16_t bpbSecPerTrack; /* sectors per track */
- uint16_t bpbHeads; /* number of heads */
- uint32_t bpbHiddenSecs; /* # of hidden sectors */
- uint32_t bpbHugeSectors; /* # of sectors if bpbSectors == 0 */
- uint32_t bpbBigFATsecs; /* like bpbFATsecs for FAT32 */
- uint16_t bpbExtFlags; /* extended flags: */
-#define FATNUM 0xf /* mask for numbering active FAT */
-#define FATMIRROR 0x80 /* FAT is mirrored (like it always was) */
- uint16_t bpbFSVers; /* filesystem version */
-#define FSVERS 0 /* currently only 0 is understood */
- uint32_t bpbRootClust; /* start cluster for root directory */
- uint16_t bpbFSInfo; /* filesystem info structure sector */
- uint16_t bpbBackup; /* backup boot sector */
- uint8_t bpbReserved[12]; /* Reserved for future expansion */
-};
-
-/*
- * The following structures represent how the bpb's look on disk. shorts
- * and longs are just character arrays of the appropriate length. This is
- * because the compiler forces shorts and longs to align on word or
- * halfword boundaries.
- *
- * XXX The little-endian code here assumes that the processor can access
- * 16-bit and 32-bit quantities on byte boundaries. If this is not true,
- * use the macros for the big-endian case.
- */
-#include <sys/endian.h>
-#if (BYTE_ORDER == LITTLE_ENDIAN) && !defined(__STRICT_ALIGNMENT)
-#define getushort(x) *((u_int16_t *)(x))
-#define getulong(x) *((u_int32_t *)(x))
-#define putushort(p, v) (*((u_int16_t *)(p)) = (v))
-#define putulong(p, v) (*((u_int32_t *)(p)) = (v))
-#else
-#define getushort(x) (((u_int8_t *)(x))[0] + (((u_int8_t *)(x))[1] << 8))
-#define getulong(x) (((u_int8_t *)(x))[0] + (((u_int8_t *)(x))[1] << 8) \
- + (((u_int8_t *)(x))[2] << 16) \
- + (((u_int8_t *)(x))[3] << 24))
-#define putushort(p, v) (((u_int8_t *)(p))[0] = (v), \
- ((u_int8_t *)(p))[1] = (v) >> 8)
-#define putulong(p, v) (((u_int8_t *)(p))[0] = (v), \
- ((u_int8_t *)(p))[1] = (v) >> 8, \
- ((u_int8_t *)(p))[2] = (v) >> 16,\
- ((u_int8_t *)(p))[3] = (v) >> 24)
-#endif
-
-/*
- * BIOS Parameter Block (BPB) for DOS 3.3
- */
-struct byte_bpb33 {
- int8_t bpbBytesPerSec[2]; /* bytes per sector */
- int8_t bpbSecPerClust; /* sectors per cluster */
- int8_t bpbResSectors[2]; /* number of reserved sectors */
- int8_t bpbFATs; /* number of FATs */
- int8_t bpbRootDirEnts[2]; /* number of root directory entries */
- int8_t bpbSectors[2]; /* total number of sectors */
- int8_t bpbMedia; /* media descriptor */
- int8_t bpbFATsecs[2]; /* number of sectors per FAT */
- int8_t bpbSecPerTrack[2]; /* sectors per track */
- int8_t bpbHeads[2]; /* number of heads */
- int8_t bpbHiddenSecs[2]; /* number of hidden sectors */
-};
-
-/*
- * BPB for DOS 5.0 The difference is bpbHiddenSecs is a short for DOS 3.3,
- * and bpbHugeSectors is not in the 3.3 bpb.
- */
-struct byte_bpb50 {
- int8_t bpbBytesPerSec[2]; /* bytes per sector */
- int8_t bpbSecPerClust; /* sectors per cluster */
- int8_t bpbResSectors[2]; /* number of reserved sectors */
- int8_t bpbFATs; /* number of FATs */
- int8_t bpbRootDirEnts[2]; /* number of root directory entries */
- int8_t bpbSectors[2]; /* total number of sectors */
- int8_t bpbMedia; /* media descriptor */
- int8_t bpbFATsecs[2]; /* number of sectors per FAT */
- int8_t bpbSecPerTrack[2]; /* sectors per track */
- int8_t bpbHeads[2]; /* number of heads */
- int8_t bpbHiddenSecs[4]; /* number of hidden sectors */
- int8_t bpbHugeSectors[4]; /* # of sectors if bpbSectors == 0 */
-};
-
-/*
- * BPB for DOS 7.10 (FAT32). This one has a few extensions to bpb50.
- */
-struct byte_bpb710 {
- uint8_t bpbBytesPerSec[2]; /* bytes per sector */
- uint8_t bpbSecPerClust; /* sectors per cluster */
- uint8_t bpbResSectors[2]; /* number of reserved sectors */
- uint8_t bpbFATs; /* number of FATs */
- uint8_t bpbRootDirEnts[2]; /* number of root directory entries */
- uint8_t bpbSectors[2]; /* total number of sectors */
- uint8_t bpbMedia; /* media descriptor */
- uint8_t bpbFATsecs[2]; /* number of sectors per FAT */
- uint8_t bpbSecPerTrack[2]; /* sectors per track */
- uint8_t bpbHeads[2]; /* number of heads */
- uint8_t bpbHiddenSecs[4]; /* # of hidden sectors */
- uint8_t bpbHugeSectors[4]; /* # of sectors if bpbSectors == 0 */
- uint8_t bpbBigFATsecs[4]; /* like bpbFATsecs for FAT32 */
- uint8_t bpbExtFlags[2]; /* extended flags: */
- uint8_t bpbFSVers[2]; /* filesystem version */
- uint8_t bpbRootClust[4]; /* start cluster for root directory */
- uint8_t bpbFSInfo[2]; /* filesystem info structure sector */
- uint8_t bpbBackup[2]; /* backup boot sector */
- uint8_t bpbReserved[12]; /* Reserved for future expansion */
-};
-
-/*
- * FAT32 FSInfo block.
- */
-struct fsinfo {
- uint8_t fsisig1[4];
- uint8_t fsifill1[480];
- uint8_t fsisig2[4];
- uint8_t fsinfree[4];
- uint8_t fsinxtfree[4];
- uint8_t fsifill2[12];
- uint8_t fsisig3[4];
- uint8_t fsifill3[508];
- uint8_t fsisig4[4];
-};
-#endif /* _MSDOSFS_BPB_H_ */
diff --git a/usr.sbin/makefs/msdos/msdosfs_denode.c b/usr.sbin/makefs/msdos/msdosfs_denode.c
index 4e10961f289..d65c4b79a5e 100644
--- a/usr.sbin/makefs/msdos/msdosfs_denode.c
+++ b/usr.sbin/makefs/msdos/msdosfs_denode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_denode.c,v 1.5 2016/10/18 17:05:30 natano Exp $ */
+/* $OpenBSD: msdosfs_denode.c,v 1.6 2016/10/22 22:20:24 natano Exp $ */
/* $NetBSD: msdosfs_denode.c,v 1.7 2015/03/29 05:52:59 agc Exp $ */
/*-
@@ -52,7 +52,7 @@
#include "ffs/buf.h"
-#include "msdos/bpb.h"
+#include <msdosfs/bpb.h>
#include "msdos/msdosfsmount.h"
#include "msdos/direntry.h"
#include "msdos/denode.h"
diff --git a/usr.sbin/makefs/msdos/msdosfs_fat.c b/usr.sbin/makefs/msdos/msdosfs_fat.c
index e498c4d600a..97fe5371564 100644
--- a/usr.sbin/makefs/msdos/msdosfs_fat.c
+++ b/usr.sbin/makefs/msdos/msdosfs_fat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_fat.c,v 1.2 2016/10/22 18:17:14 natano Exp $ */
+/* $OpenBSD: msdosfs_fat.c,v 1.3 2016/10/22 22:20:24 natano Exp $ */
/* $NetBSD: msdosfs_fat.c,v 1.31 2016/05/07 16:43:02 mlelstv Exp $ */
/*-
@@ -59,7 +59,7 @@
/*
* msdosfs include files.
*/
-#include "msdos/bpb.h"
+#include <msdosfs/bpb.h>
#include "msdos/msdosfsmount.h"
#include "msdos/direntry.h"
#include "msdos/denode.h"
diff --git a/usr.sbin/makefs/msdos/msdosfs_lookup.c b/usr.sbin/makefs/msdos/msdosfs_lookup.c
index 2711cdd6b84..87c8ca0ba77 100644
--- a/usr.sbin/makefs/msdos/msdosfs_lookup.c
+++ b/usr.sbin/makefs/msdos/msdosfs_lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_lookup.c,v 1.1 2016/10/18 17:05:30 natano Exp $ */
+/* $OpenBSD: msdosfs_lookup.c,v 1.2 2016/10/22 22:20:24 natano Exp $ */
/* $NetBSD: msdosfs_lookup.c,v 1.35 2016/01/30 09:59:27 mlelstv Exp $ */
/*-
@@ -52,7 +52,7 @@
#include "ffs/buf.h"
-#include "msdos/bpb.h"
+#include <msdosfs/bpb.h>
#include "msdos/direntry.h"
#include "msdos/denode.h"
#include "msdos/msdosfsmount.h"
diff --git a/usr.sbin/makefs/msdos/msdosfs_vfsops.c b/usr.sbin/makefs/msdos/msdosfs_vfsops.c
index edd4d3273a4..4c71bf725fa 100644
--- a/usr.sbin/makefs/msdos/msdosfs_vfsops.c
+++ b/usr.sbin/makefs/msdos/msdosfs_vfsops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vfsops.c,v 1.8 2016/10/18 17:05:30 natano Exp $ */
+/* $OpenBSD: msdosfs_vfsops.c,v 1.9 2016/10/22 22:20:24 natano Exp $ */
/*-
* Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank.
@@ -52,8 +52,8 @@
#include "ffs/buf.h"
-#include "msdos/bpb.h"
-#include "msdos/bootsect.h"
+#include <msdosfs/bpb.h>
+#include <msdosfs/bootsect.h>
#include "msdos/direntry.h"
#include "msdos/denode.h"
#include "msdos/msdosfsmount.h"
diff --git a/usr.sbin/makefs/msdos/msdosfs_vnops.c b/usr.sbin/makefs/msdos/msdosfs_vnops.c
index 295ba94f104..00771e57bd9 100644
--- a/usr.sbin/makefs/msdos/msdosfs_vnops.c
+++ b/usr.sbin/makefs/msdos/msdosfs_vnops.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: msdosfs_vnops.c,v 1.6 2016/10/18 17:05:30 natano Exp $ */
+/* $OpenBSD: msdosfs_vnops.c,v 1.7 2016/10/22 22:20:24 natano Exp $ */
/* $NetBSD: msdosfs_vnops.c,v 1.17 2016/01/30 09:59:27 mlelstv Exp $ */
/*-
@@ -55,7 +55,7 @@
#include "ffs/buf.h"
-#include "msdos/bpb.h"
+#include <msdosfs/bpb.h>
#include "msdos/direntry.h"
#include "msdos/denode.h"
#include "msdos/msdosfsmount.h"