Icb class initial checkin.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3826 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
466c605a47
commit
e1016e4f8a
33
src/add-ons/kernel/file_systems/udf/Icb.cpp
Normal file
33
src/add-ons/kernel/file_systems/udf/Icb.cpp
Normal file
@ -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<udf_icb_header*>(fIcbData.Data());
|
||||
PDUMP(header);
|
||||
err = header->tag().init_check(address.block());
|
||||
}
|
||||
}
|
||||
}
|
||||
fInitStatus = err;
|
||||
}
|
||||
|
||||
status_t
|
||||
Icb::InitCheck()
|
||||
{
|
||||
return fInitStatus;
|
||||
}
|
47
src/add-ons/kernel/file_systems/udf/Icb.h
Normal file
47
src/add-ons/kernel/file_systems/udf/Icb.h
Normal file
@ -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 <fsproto.h>
|
||||
}
|
||||
|
||||
#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
|
Loading…
Reference in New Issue
Block a user