From d46406ff843999327784aeca42712f36da750c53 Mon Sep 17 00:00:00 2001 From: ksherlock Date: Sat, 29 May 2010 19:29:59 +0000 Subject: [PATCH] Add Read/Write flags for File::, etc instead of using bool git-svn-id: https://profuse.googlecode.com/svn/branches/v2@297 aa027e90-d47c-11dd-86d7-074df07e0730 --- Device/BlockDevice.cpp | 6 +- Device/BlockDevice.h | 4 +- Device/DavexDiskImage.cpp | 9 +-- Device/DavexDiskImage.h | 4 +- Device/DiskCopy42Image.cpp | 10 +-- Device/DiskCopy42Image.h | 2 +- Device/DiskImage.cpp | 11 +--- Device/DiskImage.h | 7 +- Device/RawDevice.cpp | 14 ++-- Device/RawDevice.h | 11 ++-- Device/UniversalDiskImage.cpp | 13 +--- Device/UniversalDiskImage.h | 2 +- File/File.cpp | 15 +++-- File/File.h | 11 +++- File/MappedFile.cpp | 35 +++++++--- File/MappedFile.h | 7 +- apfm.cpp | 92 ++++++++++++++++++++------ fuse_pascal.cpp | 7 +- newfs_pascal.cpp | 121 ++++++++++++++++++++++------------ 19 files changed, 235 insertions(+), 146 deletions(-) diff --git a/Device/BlockDevice.cpp b/Device/BlockDevice.cpp index e583165..d86f4d7 100644 --- a/Device/BlockDevice.cpp +++ b/Device/BlockDevice.cpp @@ -78,7 +78,7 @@ unsigned BlockDevice::ImageType(const char *type, unsigned defv) return defv; } -BlockDevice *BlockDevice::Open(const char *name, bool readOnly, unsigned imageType) +BlockDevice *BlockDevice::Open(const char *name, File::FileFlags flags, unsigned imageType) { #undef __METHOD__ #define __METHOD__ "BlockDevice::Open" @@ -96,7 +96,7 @@ BlockDevice *BlockDevice::Open(const char *name, bool readOnly, unsigned imageTy { // /dev/xxxx if (S_ISBLK(st.st_mode)) - return RawDevice::Open(name, readOnly); + return RawDevice::Open(name, flags); imageType = ImageType(name, 'PO__'); @@ -105,7 +105,7 @@ BlockDevice *BlockDevice::Open(const char *name, bool readOnly, unsigned imageTy // TODO -- if no image type, guess based on file size? - MappedFile file(name, readOnly); + MappedFile file(name, flags); switch (imageType) diff --git a/Device/BlockDevice.h b/Device/BlockDevice.h index 33680e3..8e8feb5 100644 --- a/Device/BlockDevice.h +++ b/Device/BlockDevice.h @@ -10,6 +10,8 @@ #include +#include + namespace Device { class BlockDevice { @@ -19,7 +21,7 @@ public: // static methods. static unsigned ImageType(const char *type, unsigned defv = 0); - static BlockDevice *Open(const char *name, bool readOnly, unsigned imageType = 0); + static BlockDevice *Open(const char *name, File::FileFlags flags, unsigned imageType = 0); static BlockDevice *Create(const char *fname, const char *vname, unsigned blocks, unsigned imageType = 0); diff --git a/Device/DavexDiskImage.cpp b/Device/DavexDiskImage.cpp index c2e11d6..e63a04f 100644 --- a/Device/DavexDiskImage.cpp +++ b/Device/DavexDiskImage.cpp @@ -28,13 +28,6 @@ using ProFUSE::POSIXException; static const char *IdentityCheck = "\x60VSTORE [Davex]\x00"; -/* -DavexDiskImage::DavexDiskImage(const char *name, bool readOnly) : - DiskImage(name, readOnly) -{ - Validate(file()); -} -*/ // private, validation already performed. DavexDiskImage::DavexDiskImage(MappedFile *file) : @@ -115,7 +108,7 @@ DavexDiskImage *DavexDiskImage::Create(const char *name, size_t blocks, const ch IOBuffer header(tmp,512); - MappedFile *file = new MappedFile(name, blocks * 512 + 512); + MappedFile *file = MappedFile::Create(name, blocks * 512 + 512); data = (uint8_t *)file->address(); diff --git a/Device/DavexDiskImage.h b/Device/DavexDiskImage.h index fa9a432..ff659e0 100644 --- a/Device/DavexDiskImage.h +++ b/Device/DavexDiskImage.h @@ -24,8 +24,8 @@ public: private: - DavexDiskImage(const char *, bool readOnly); - + DavexDiskImage(); + DavexDiskImage(MappedFile *); static void Validate(MappedFile *); diff --git a/Device/DiskCopy42Image.cpp b/Device/DiskCopy42Image.cpp index c8e22bb..9af488b 100644 --- a/Device/DiskCopy42Image.cpp +++ b/Device/DiskCopy42Image.cpp @@ -37,14 +37,6 @@ DiskCopy42Image::DiskCopy42Image(MappedFile *f) : } -/* -DiskCopy42Image::DiskCopy42Image(const char *name, bool readOnly) : - DiskImage(name, readOnly), - _changed(false) -{ - Validate(file()); -} -*/ DiskCopy42Image::~DiskCopy42Image() { @@ -116,7 +108,7 @@ DiskCopy42Image *DiskCopy42Image::Create(const char *name, size_t blocks) DiskCopy42Image *DiskCopy42Image::Create(const char *name, size_t blocks, const char *vname) { - MappedFile *file = new MappedFile(name, blocks * 512 + oUserData); + MappedFile *file = MappedFile::Create(name, blocks * 512 + oUserData); diff --git a/Device/DiskCopy42Image.h b/Device/DiskCopy42Image.h index 2c43da8..f4ce443 100644 --- a/Device/DiskCopy42Image.h +++ b/Device/DiskCopy42Image.h @@ -26,7 +26,7 @@ public: private: - DiskCopy42Image(const char *name, bool readOnly); + DiskCopy42Image(); DiskCopy42Image(MappedFile *); static void Validate(MappedFile *); diff --git a/Device/DiskImage.cpp b/Device/DiskImage.cpp index 024bf15..113eb22 100644 --- a/Device/DiskImage.cpp +++ b/Device/DiskImage.cpp @@ -23,7 +23,7 @@ using ProFUSE::Exception; using ProFUSE::POSIXException; - +/* DiskImage::DiskImage(const char *name, bool readOnly) { File fd(name, readOnly ? O_RDONLY : O_RDWR); @@ -34,7 +34,7 @@ DiskImage::DiskImage(const char *name, bool readOnly) _readOnly = readOnly; _adaptor = NULL; } - +*/ DiskImage::DiskImage(MappedFile *file) { @@ -102,13 +102,6 @@ void DiskImage::sync() -/* -ProDOSOrderDiskImage::ProDOSOrderDiskImage(const char *name, bool readOnly) : - DiskImage(name, readOnly) -{ - Validate(file()); -} -*/ ProDOSOrderDiskImage::ProDOSOrderDiskImage(MappedFile *file) : DiskImage(file) diff --git a/Device/DiskImage.h b/Device/DiskImage.h index 9bd87d9..52a7303 100644 --- a/Device/DiskImage.h +++ b/Device/DiskImage.h @@ -30,10 +30,9 @@ public: protected: + DiskImage(); DiskImage(MappedFile *file = 0); - DiskImage(const char *name, bool readOnly); - void setBlocks(unsigned blocks) { _blocks = blocks; } @@ -65,7 +64,7 @@ public: virtual BlockCache *createBlockCache(); private: - ProDOSOrderDiskImage(const char *name, bool readOnly); + ProDOSOrderDiskImage(); ProDOSOrderDiskImage(MappedFile *); @@ -80,7 +79,7 @@ public: static DOSOrderDiskImage *Open(MappedFile *); private: - DOSOrderDiskImage(const char *name, bool readOnly); + DOSOrderDiskImage(); DOSOrderDiskImage(MappedFile *); static void Validate(MappedFile *); diff --git a/Device/RawDevice.cpp b/Device/RawDevice.cpp index cedb733..7c9dbc4 100644 --- a/Device/RawDevice.cpp +++ b/Device/RawDevice.cpp @@ -122,8 +122,8 @@ void RawDevice::devSize(int fd) #endif -RawDevice::RawDevice(const char *name, bool readOnly) : - _file(name, readOnly) +RawDevice::RawDevice(const char *name, File::FileFlags flags) : + _file(name, flags) { #undef __METHOD__ #define __METHOD__ "RawDevice::RawDevice" @@ -134,7 +134,7 @@ RawDevice::RawDevice(const char *name, bool readOnly) : throw new Exception(__METHOD__ ": Invalid file handle."); } - _readOnly = readOnly; + _readOnly = flags == File::ReadOnly; _size = 0; _blocks = 0; _blockSize = 0; @@ -143,7 +143,7 @@ RawDevice::RawDevice(const char *name, bool readOnly) : devSize(_file.fd()); } -RawDevice::RawDevice(File& file, bool readOnly) : +RawDevice::RawDevice(File& file, File::FileFlags flags) : _file(file) { #undef __METHOD__ @@ -155,7 +155,7 @@ RawDevice::RawDevice(File& file, bool readOnly) : throw new Exception(__METHOD__ ": Invalid file handle."); } - _readOnly = readOnly; + _readOnly = flags == File::ReadOnly; _size = 0; _blocks = 0; _blockSize = 0; @@ -170,9 +170,9 @@ RawDevice::~RawDevice() } -RawDevice *RawDevice::Open(const char *name, bool readOnly) +RawDevice *RawDevice::Open(const char *name, File::FileFlags flags) { - return new RawDevice(name, readOnly); + return new RawDevice(name, flags); } diff --git a/Device/RawDevice.h b/Device/RawDevice.h index df711ac..573ab94 100644 --- a/Device/RawDevice.h +++ b/Device/RawDevice.h @@ -15,11 +15,9 @@ namespace Device { class RawDevice : public BlockDevice { public: - RawDevice(const char *name, bool readOnly); + - RawDevice(File& file, bool readOnly); - - static RawDevice *Open(const char *name, bool readOnly); + static RawDevice *Open(const char *name, File::FileFlags flags); virtual ~RawDevice(); @@ -38,6 +36,11 @@ public: private: + + RawDevice(const char *name, File::FileFlags flags); + + RawDevice(File& file, File::FileFlags flags); + void devSize(int fd); File _file; diff --git a/Device/UniversalDiskImage.cpp b/Device/UniversalDiskImage.cpp index b1162f0..dedb9c9 100644 --- a/Device/UniversalDiskImage.cpp +++ b/Device/UniversalDiskImage.cpp @@ -16,17 +16,6 @@ using ProFUSE::POSIXException; -/* -UniversalDiskImage::UniversalDiskImage(const char *name, bool readOnly) : - DiskImage(name, readOnly) -{ - Validate(file()); - const void *data = file()->fileData(); - - // flags. bit 31 = locked. - _flags = Read32(data, 0x10); -} -*/ UniversalDiskImage::UniversalDiskImage(MappedFile *file) : DiskImage(file) @@ -55,7 +44,7 @@ UniversalDiskImage::UniversalDiskImage(MappedFile *file) : UniversalDiskImage *UniversalDiskImage::Create(const char *name, size_t blocks) { // 64-byte header. - MappedFile *file = new MappedFile(name, blocks * 512 + 64); + MappedFile *file = MappedFile::Create(name, blocks * 512 + 64); uint8_t tmp[64]; diff --git a/Device/UniversalDiskImage.h b/Device/UniversalDiskImage.h index fbaccba..e552af5 100644 --- a/Device/UniversalDiskImage.h +++ b/Device/UniversalDiskImage.h @@ -24,7 +24,7 @@ public: private: - UniversalDiskImage(const char *name, bool readOnly); + UniversalDiskImage(); UniversalDiskImage(MappedFile *); static void Validate(MappedFile *); diff --git a/File/File.cpp b/File/File.cpp index ee9b81d..251ea72 100644 --- a/File/File.cpp +++ b/File/File.cpp @@ -37,9 +37,9 @@ File::File(const char *name, int flags, mode_t mode, const std::nothrow_t&) _fd = ::open(name, flags, mode); } -File::File(const char *name, bool readOnly, const std::nothrow_t&) +File::File(const char *name, FileFlags flags, const std::nothrow_t&) { - _fd = ::open(name, readOnly ? O_RDONLY : O_RDWR); + _fd = ::open(name, flags == ReadOnly ? O_RDONLY : O_RDWR); } File::File(const char *name, int flags) @@ -63,12 +63,12 @@ File::File(const char *name, int flags, mode_t mode) } -File::File(const char *name, bool readOnly) +File::File(const char *name, FileFlags flags) { #undef __METHOD__ #define __METHOD__ "File::File" - _fd = ::open(name, readOnly ? O_RDONLY : O_RDWR); + _fd = ::open(name, flags == ReadOnly ? O_RDONLY : O_RDWR); if (_fd < 0) throw POSIXException( __METHOD__ ": open", errno); } @@ -86,11 +86,14 @@ void File::close() if (_fd >= 0) { - int fd = _fd; + ::close(_fd); _fd = -1; - if (::close(fd) != 0) + // destructor shouldn't throw. + /* + if (::close(fd) != 0) throw POSIXException(__METHOD__ ": close", errno); + */ } } diff --git a/File/File.h b/File/File.h index 1bc5e5d..72bb532 100644 --- a/File/File.h +++ b/File/File.h @@ -7,21 +7,28 @@ #include #include + class File { public: + + enum FileFlags { + ReadOnly = 1, + ReadWrite = 2 + }; + File(); File(File &); File(int fd); File(const char *name, int flags); File(const char *name, int flags, mode_t mode); - File(const char *name, bool readOnly); + File(const char *name, FileFlags flags); File(const char *name, int flags, const std::nothrow_t &); File(const char *name, int flags, mode_t mode, const std::nothrow_t &); - File(const char *name, bool readOnly, const std::nothrow_t &); + File(const char *name, FileFlags flags, const std::nothrow_t &); ~File(); diff --git a/File/MappedFile.cpp b/File/MappedFile.cpp index 0ffd087..2b8eb91 100644 --- a/File/MappedFile.cpp +++ b/File/MappedFile.cpp @@ -27,29 +27,41 @@ MappedFile::MappedFile(MappedFile &mf) mf._readOnly = true; } -MappedFile::MappedFile(const File &f, bool readOnly, size_t size) +MappedFile::MappedFile(const File &f, File::FileFlags flags, size_t size) { _length = -1; _address = MAP_FAILED; - _readOnly = readOnly; + _readOnly = true; - init(f, readOnly, size); + init(f, flags == File::ReadOnly, size); } -MappedFile::MappedFile(const char *name, bool readOnly) +MappedFile::MappedFile(const char *name, File::FileFlags flags) { - File f(name, readOnly); + File f(name, flags); _length = -1; _address = MAP_FAILED; - _readOnly = readOnly; + _readOnly = true; - init(f, readOnly, 0); + init(f, flags == File::ReadOnly, 0); } +MappedFile::MappedFile(const char *name, File::FileFlags flags, const std::nothrow_t ¬hrow) +{ + File f(name, flags, nothrow); + + _length = -1; + _address = MAP_FAILED; + _readOnly = true; + + if (f.isValid()) + init(f, flags == File::ReadOnly, 0); +} + MappedFile::~MappedFile() { @@ -101,15 +113,22 @@ void MappedFile::close() if (_address != MAP_FAILED) { + /* void *address = _address; size_t length = _length; + */ + + ::munmap(_address, _length); _address = MAP_FAILED; _length = -1; _readOnly = true; + // destructor shouldn't throw. + /* if (::munmap(address, length) != 0) throw POSIXException(__METHOD__ ": munmap", errno); + */ } } @@ -164,5 +183,5 @@ MappedFile *MappedFile::Create(const char *name, size_t size) throw POSIXException(__METHOD__ ": Unable to truncate file.", errno); } - return new MappedFile(fd, false, size); + return new MappedFile(fd, File::ReadWrite, size); } \ No newline at end of file diff --git a/File/MappedFile.h b/File/MappedFile.h index 014ef2c..cec519d 100644 --- a/File/MappedFile.h +++ b/File/MappedFile.h @@ -1,6 +1,8 @@ #ifndef __MAPPED_FILE_H__ #define __MAPPED_FILE_H__ + +#include #include #include @@ -12,8 +14,9 @@ class MappedFile { MappedFile(); MappedFile(MappedFile&); - MappedFile(const File &f, bool readOnly, size_t size = -1); - MappedFile(const char *name, bool readOnly); + MappedFile(const File &f, File::FileFlags flags, size_t size = -1); + MappedFile(const char *name, File::FileFlags flags); + MappedFile(const char *name, File::FileFlags flags, const std::nothrow_t ¬hrow); ~MappedFile(); diff --git a/apfm.cpp b/apfm.cpp index 76b249c..ef1c2de 100644 --- a/apfm.cpp +++ b/apfm.cpp @@ -146,17 +146,49 @@ void commandUsage(unsigned command) } -bool isReadOnly(const char *command) +unsigned command(const char *command) { - if (!::strcasecmp(command, "mv")) return false; - if (!::strcasecmp(command, "rm")) return false; - if (!::strcasecmp(command, "cp")) return false; - if (!::strcasecmp(command, "put")) return false; - if (!::strcasecmp(command, "krunch")) return false; + if (!::strcasecmp(command, "ls")) return kCommandLS; + if (!::strcasecmp(command, "list")) return kCommandLS; - return true; + if (!::strcasecmp(command, "cat")) return kCommandCAT; + + if (!::strcasecmp(command, "get")) return kCommandGET; + + if (!::strcasecmp(command, "put")) return kCommandPUT; + + if (!::strcasecmp(command, "cp")) return kCommandCP; + if (!::strcasecmp(command, "copy")) return kCommandCP; + + if (!::strcasecmp(command, "rm")) return kCommandRM; + if (!::strcasecmp(command, "remove")) return kCommandRM; + if (!::strcasecmp(command, "del")) return kCommandRM; + if (!::strcasecmp(command, "delete")) return kCommandRM; + + if (!::strcasecmp(command, "mv")) return kCommandMV; + if (!::strcasecmp(command, "move")) return kCommandMV; + if (!::strcasecmp(command, "rename")) return kCommandMV; + + if (!::strcasecmp(command, "krunch")) return kCommandKRUNCH; + + + return -1; } +File::FileFlags commandFlags(unsigned command) +{ + switch (command) + { + case kCommandPUT: + case kCommandKRUNCH: + case kCommandRM: + case kCommandMV: + case kCommandCP: + return File::ReadWrite; + default: + return File::ReadOnly; + } +} // from BSD rm, prompt question on stderr. bool yes_or_no() @@ -717,9 +749,10 @@ int main(int argc, char **argv) try { - // should we peek at the action to determine if read only? + unsigned actionCode = command(action); - device.reset( Device::BlockDevice::Open(file, isReadOnly(action), fmt) ); + + device.reset( Device::BlockDevice::Open(file, commandFlags(actionCode), fmt) ); @@ -729,18 +762,35 @@ int main(int argc, char **argv) device.release(); - - if (!::strcasecmp("cat", action)) return action_cat(argc - 1, argv + 1, volume.get()); - if (!::strcasecmp("cp", action)) return action_cp(argc - 1, argv + 1, volume.get()); - if (!::strcasecmp("krunch", action)) return action_krunch(argc - 1, argv + 1, volume.get()); - if (!::strcasecmp("ls", action)) return action_ls(argc - 1, argv + 1, volume.get()); - if (!::strcasecmp("mv", action)) return action_mv(argc - 1, argv + 1, volume.get()); - if (!::strcasecmp("rm", action)) return action_rm(argc - 1, argv + 1, volume.get()); - - if (!::strcasecmp("get", action)) return action_get(argc -1, argv + 1, volume.get()); - //if (!::strcasecmp("put", action)) return action_put(argc -1, argv + 1, volume.get()); - - + switch (actionCode) + { + case kCommandCAT: + return action_cat(argc - 1, argv + 1, volume.get()); + break; + case kCommandCP: + return action_cp(argc - 1, argv + 1, volume.get()); + break; + case kCommandKRUNCH: + return action_krunch(argc - 1, argv + 1, volume.get()); + break; + case kCommandLS: + return action_ls(argc - 1, argv + 1, volume.get()); + break; + case kCommandMV: + return action_mv(argc - 1, argv + 1, volume.get()); + break; + case kCommandRM: + return action_rm(argc - 1, argv + 1, volume.get()); + break; + case kCommandGET: + return action_get(argc -1, argv + 1, volume.get()); + break; + /* + case kCommandPUT: + return action_put(argc -1, argv + 1, volume.get()); + break; + */ + } usage(); return 3; } diff --git a/fuse_pascal.cpp b/fuse_pascal.cpp index 40bfd39..876c865 100644 --- a/fuse_pascal.cpp +++ b/fuse_pascal.cpp @@ -23,6 +23,7 @@ #include +#include std::string fDiskImage; @@ -191,15 +192,13 @@ int main(int argc, char **argv) std::fprintf(stderr, "Warning: Unknown image type ``%s''\n", options.format); } - - bool readOnly = true; - + try { std::auto_ptr device; - device.reset( Device::BlockDevice::Open(fDiskImage.c_str(), readOnly, format) ); + device.reset( Device::BlockDevice::Open(fDiskImage.c_str(), File::ReadOnly, format) ); if (!device.get()) diff --git a/newfs_pascal.cpp b/newfs_pascal.cpp index d768ceb..79635a3 100644 --- a/newfs_pascal.cpp +++ b/newfs_pascal.cpp @@ -1,3 +1,15 @@ + +#include +#include +#include +#include +#include +#include + +#include +#include + + #include #include @@ -6,14 +18,12 @@ #include -#include -#include -#include -#include -#include +#include +#include + + + -#include -#include using namespace Pascal; using namespace Device; @@ -108,11 +118,12 @@ void usage() std::printf("newfs_pascal [-v volume_name] [-s size] [-f format] file\n"); std::printf("\n"); - std::printf(" -v volume_name specify the volume name.\n" + std::printf(" -v volume_name Specify the volume name.\n" " Default is Untitled.\n" - " -s size specify size in blocks.\n" + " -s size Specify size in blocks.\n" " Default is 1600 blocks (800K)\n" - " -f format specify the disk image format. Valid values are:\n" + " -b bootfile Specify a file that contains the boot block\n" + " -f format Specify the disk image format. Valid values are:\n" " 2img Universal Disk Image\n" " dc42 DiskCopy 4.2 Image\n" " davex Davex Disk Image\n" @@ -128,6 +139,8 @@ int main(int argc, char **argv) unsigned blocks = 1600; std::string volumeName; std::string fileName; + std::string bootFile; + int format = 0; const char *fname; int c; @@ -137,40 +150,43 @@ int main(int argc, char **argv) { switch(c) { - case '?': - case 'h': - usage(); - return 0; - break; - - case 'v': - volumeName = optarg; - // make sure it's legal. - if (!VolumeEntry::ValidName(optarg)) - { - std::fprintf(stderr, "Error: `%s' is not a valid Pascal volume name.\n", optarg); - return 0x40; - } - break; + case 'h': + default: + usage(); + return c == 'h' ? 0 : 1; + break; - case 's': - blocks = parseBlocks(optarg); - if (blocks > 0xffff) - { - std::fprintf(stderr, "Error: `%s' is not a valid disk size.\n", optarg); - return 0x5a; - } - break; - - case 'f': - { - format = Device::BlockDevice::ImageType(optarg); - if (format == 0) + case 'v': + volumeName = optarg; + // make sure it's legal. + if (!VolumeEntry::ValidName(optarg)) { - std::fprintf(stderr, "Error: `%s' is not a supported disk image format.\n", optarg); - return -1; + std::fprintf(stderr, "Error: `%s' is not a valid Pascal volume name.\n", optarg); + return 0x40; } - } + break; + + case 's': + blocks = parseBlocks(optarg); + if (blocks > 0xffff) + { + std::fprintf(stderr, "Error: `%s' is not a valid disk size.\n", optarg); + return 0x5a; + } + break; + + case 'f': + { + format = Device::BlockDevice::ImageType(optarg); + if (format == 0) + { + std::fprintf(stderr, "Error: `%s' is not a supported disk image format.\n", optarg); + return -1; + } + } + case 'b': + bootFile = optarg; + break; } } @@ -212,7 +228,7 @@ int main(int argc, char **argv) fprintf(stderr, "`%s' is a raw device. Are you sure you want to initialize it? ", fname); if (!yes_or_no()) return -1; - device.reset( RawDevice::Open(fname, false) ); + device.reset( RawDevice::Open(fname, File::ReadWrite) ); blocks = device->blocks(); rawDevice = true; @@ -253,6 +269,27 @@ int main(int argc, char **argv) } + if (!bootFile.empty()) + { + MappedFile bf(bootFile.c_str(), File::ReadOnly , std::nothrow); + + if (!bf.isValid()) + { + std::fprintf(stderr, "Warning: unable to open boot file `%s'.\n", bootFile.c_str()); + } + else + { + size_t length = bf.length(); + + } + + + + + + } + + volume.reset( new VolumeEntry(volumeName.c_str(), device.get()) );