From e1016e4f8a90133f99af154c826d4f78c1f0ae92 Mon Sep 17 00:00:00 2001 From: Tyler Dauwalder Date: Fri, 4 Jul 2003 06:14:06 +0000 Subject: [PATCH] Icb class initial checkin. git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3826 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/file_systems/udf/Icb.cpp | 33 +++++++++++++++ src/add-ons/kernel/file_systems/udf/Icb.h | 47 +++++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 src/add-ons/kernel/file_systems/udf/Icb.cpp create mode 100644 src/add-ons/kernel/file_systems/udf/Icb.h diff --git a/src/add-ons/kernel/file_systems/udf/Icb.cpp b/src/add-ons/kernel/file_systems/udf/Icb.cpp new file mode 100644 index 0000000000..5c214d6d5e --- /dev/null +++ b/src/add-ons/kernel/file_systems/udf/Icb.cpp @@ -0,0 +1,33 @@ +#include "Icb.h" + +#include "Volume.h" + +using namespace Udf; + +Icb::Icb(Volume *volume, udf_long_address address) + : fVolume(NULL) + , fIcbData(volume ? volume->BlockSize() : 0) + , fInitStatus(B_NO_INIT) + , fId((address.block() << 16) & (address.partition())) +{ + DEBUG_INIT_ETC(CF_PUBLIC, "Icb", ("Volume*(%p), long_address(block: %ld, partition: %d, length: %ld)", volume, address.block(), address.partition(), address.length())); + status_t err = volume ? B_OK : B_BAD_VALUE; + if (!err) { + err = fIcbData.InitCheck(); + if (!err) { + err = volume->Read(address, fIcbData.Size(), fIcbData.Data()); + if (!err) { + udf_icb_header *header = reinterpret_cast(fIcbData.Data()); + PDUMP(header); + err = header->tag().init_check(address.block()); + } + } + } + fInitStatus = err; +} + +status_t +Icb::InitCheck() +{ + return fInitStatus; +} diff --git a/src/add-ons/kernel/file_systems/udf/Icb.h b/src/add-ons/kernel/file_systems/udf/Icb.h new file mode 100644 index 0000000000..87e7371205 --- /dev/null +++ b/src/add-ons/kernel/file_systems/udf/Icb.h @@ -0,0 +1,47 @@ +//---------------------------------------------------------------------- +// This software is part of the OpenBeOS distribution and is covered +// by the OpenBeOS license. +// +// Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net +//--------------------------------------------------------------------- +#ifndef _UDF_ICB_H +#define _UDF_ICB_H + +/*! \file Icb.h +*/ + +extern "C" { + #ifndef _IMPEXP_KERNEL + # define _IMPEXP_KERNEL + #endif + + #include +} + +#include "cpp.h" +#include "UdfDebug.h" + +#include "DiskStructures.h" +#include "MemoryChunk.h" + +namespace Udf { + +class Volume; + +class Icb { +public: + Icb(Volume *volume, udf_long_address address); + status_t InitCheck(); + vnode_id Id() { return fId; } +private: + Icb(); // unimplemented +private: + Volume *fVolume; + MemoryChunk fIcbData; + status_t fInitStatus; + vnode_id fId; +}; + +}; // namespace Udf + +#endif // _UDF_ICB_H