update go-fs

resolves #2421
This commit is contained in:
Matthew Hooker 2016-11-08 11:13:52 -08:00
parent c271c0babf
commit c0a4e6ed7c
No known key found for this signature in database
GPG Key ID: 7B5F933D9CE8C6A1
3 changed files with 24 additions and 13 deletions

View File

@ -7,9 +7,9 @@ import (
"fmt"
"github.com/mitchellh/go-fs"
"math"
"strings"
"time"
"unicode/utf16"
"strings"
)
type DirectoryAttr uint8
@ -160,8 +160,8 @@ func NewFat16RootDirectoryCluster(bs *BootSectorCommon, label string) (*Director
// Create the volume ID entry
result.entries[0] = &DirectoryClusterEntry{
attr: AttrVolumeId,
name: label,
attr: AttrVolumeId,
name: label,
cluster: 0,
}

View File

@ -72,14 +72,24 @@ func (f *superFloppyFormatter) format() error {
label = "FAT16 "
}
// Determine the number of root directory entries
if f.device.Len() > 512*5*32 {
bsCommon.RootEntryCount = 512
// For 1.44MB Floppy, for other floppy formats see https://support.microsoft.com/en-us/kb/75131.
// We make an exception for this most common usecase as the calculations don't create a working image for older operating systems
if f.config.FATType == FAT12 && f.device.Len() == 1474560 {
bsCommon.RootEntryCount = 224
bsCommon.SectorsPerFat = 9
bsCommon.SectorsPerTrack = 18
bsCommon.Media = 240
bsCommon.NumHeads = 2
} else {
bsCommon.RootEntryCount = uint16(f.device.Len() / (5 * 32))
}
// Determine the number of root directory entries
if f.device.Len() > 512*5*32 {
bsCommon.RootEntryCount = 512
} else {
bsCommon.RootEntryCount = uint16(f.device.Len() / (5 * 32))
}
bsCommon.SectorsPerFat = f.sectorsPerFat(bsCommon.RootEntryCount, sectorsPerCluster)
bsCommon.SectorsPerFat = f.sectorsPerFat(bsCommon.RootEntryCount, sectorsPerCluster)
}
bs := &BootSectorFat16{
BootSectorCommon: bsCommon,

9
vendor/vendor.json vendored
View File

@ -461,13 +461,14 @@
{
"checksumSHA1": "mVqDwKcibat0IKAdzAhfGIHPwI8=",
"path": "github.com/mitchellh/go-fs",
"revision": "4f9d2cb031e44bef60d0c00ccb3f31f68867e85e",
"revisionTime": "2016-09-29T19:58:49Z"
"revision": "7bae45d9a684750e82b97ff320c82556614e621b",
"revisionTime": "2016-11-08T19:11:23Z"
},
{
"checksumSHA1": "Z28nPI+n3iAnsqVSLCt5LZh/Zhg=",
"checksumSHA1": "B5dy+Lg6jFPgHYhozztz88z3b4A=",
"path": "github.com/mitchellh/go-fs/fat",
"revision": "4f9d2cb031e44bef60d0c00ccb3f31f68867e85e"
"revision": "7bae45d9a684750e82b97ff320c82556614e621b",
"revisionTime": "2016-11-08T19:11:23Z"
},
{
"checksumSHA1": "z235fRXw4+SW4xWgLTYc8SwkM2M=",