git-svn-id: https://profuse.googlecode.com/svn/branches/v2@123 aa027e90-d47c-11dd-86d7-074df07e0730

This commit is contained in:
ksherlock 2009-11-28 23:22:37 +00:00
parent da22eb1114
commit b3334ac210
5 changed files with 21 additions and 16 deletions

View File

@ -114,6 +114,7 @@ ProDOSOrderDiskImage::ProDOSOrderDiskImage(MappedFile *file) :
ProDOSOrderDiskImage *ProDOSOrderDiskImage::Create(const char *name, size_t blocks) ProDOSOrderDiskImage *ProDOSOrderDiskImage::Create(const char *name, size_t blocks)
{ {
MappedFile *file = new MappedFile(name, blocks * 512); MappedFile *file = new MappedFile(name, blocks * 512);
file->setBlocks(blocks);
return new ProDOSOrderDiskImage(file); return new ProDOSOrderDiskImage(file);
} }
@ -154,6 +155,7 @@ DOSOrderDiskImage *DOSOrderDiskImage::Create(const char *name, size_t blocks)
{ {
MappedFile *file = new MappedFile(name, blocks * 512); MappedFile *file = new MappedFile(name, blocks * 512);
file->setEncoding(MappedFile::DOSOrder); file->setEncoding(MappedFile::DOSOrder);
file->setBlocks(blocks);
return new DOSOrderDiskImage(file); return new DOSOrderDiskImage(file);
} }

View File

@ -52,7 +52,11 @@ unsigned Entry::ValidName(const char *name)
for (length = 1; length < 17; ++length) for (length = 1; length < 17; ++length)
{ {
if (!isalnumdot(name[length])) return 0; char c = name[length];
if (isalnumdot(c)) continue;
if (c == 0) break;
return 0;
} }
if (length > 15) return 0; if (length > 15) return 0;

View File

@ -1,5 +1,5 @@
CC = g++ CC = g++
CPPFLAGS += -Wall -O2 CPPFLAGS += -Wall -O2 -g
newfs_prodos: \ newfs_prodos: \
newfs_prodos.o \ newfs_prodos.o \

View File

@ -58,12 +58,11 @@ VolumeDirectory::VolumeDirectory(const char *name, BlockDevice *device) :
device->write(i, buffer.buffer()); device->write(i, buffer.buffer());
} }
// TODO -- create/write the volume entry....
// allocate blocks for the bitmap itself // allocate blocks for the bitmap itself
unsigned bb = bitmap->bitmapBlocks(); unsigned bb = bitmap->bitmapBlocks();
for (unsigned i = 0; i < bb; ++i) for (unsigned i = 0; i < bb; ++i)
bitmap->allocBlock(i); bitmap->allocBlock(_bitmapPointer + i);
// now write the bitmap... // now write the bitmap...
const uint8_t *bm = (const uint8_t *)bitmap->bitmap(); const uint8_t *bm = (const uint8_t *)bitmap->bitmap();

View File

@ -1,20 +1,21 @@
#include "BlockDevice.h"
#include "UniversalDiskImage.h"
#include "DiskCopy42Image.h"
#include "DavexDiskImage.h"
#include "RawDevice.h"
#include "Exception.h"
#include <cstring> #include <cstring>
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cctype> #include <cctype>
#include <cerrno> #include <cerrno>
#include <memory> #include <memory>
#include <unistd.h> #include <unistd.h>
#include "BlockDevice.h"
#include "DavexDiskImage.h"
#include "DiskCopy42Image.h"
#include "Entry.h"
#include "Exception.h"
#include "RawDevice.h"
#include "UniversalDiskImage.h"
#define NEWFS_VERSION "0.1" #define NEWFS_VERSION "0.1"
using namespace ProFUSE; using namespace ProFUSE;
@ -244,7 +245,7 @@ int main(int argc, char **argv)
try try
{ {
std::auto_ptr<BlockDevice> device; std::auto_ptr<BlockDevice> device;
//auto_ptr<VolumeDirectory> volume; std::auto_ptr<VolumeDirectory> volume;
// todo -- check if path matches /dev/xxx; if so, use RawDevice. // todo -- check if path matches /dev/xxx; if so, use RawDevice.
// todo -- check if file exists at path? // todo -- check if file exists at path?
@ -252,7 +253,6 @@ int main(int argc, char **argv)
switch(format) switch(format)
{ {
case 'DC42': case 'DC42':
// todo -- pass in volume name
device.reset(DiskCopy42Image::Create(fname, blocks, volumeName.c_str())); device.reset(DiskCopy42Image::Create(fname, blocks, volumeName.c_str()));
break; break;
@ -275,7 +275,7 @@ int main(int argc, char **argv)
// VolumeDirectory assumes ownership of device, // VolumeDirectory assumes ownership of device,
// but doesn't release it on exception. // but doesn't release it on exception.
//volume.reset(new VolumeDirectory(name, device)); volume.reset(new VolumeDirectory(volumeName.c_str(), device.get()));
device.release(); device.release();
} }