Coding style cleanup.

This commit is contained in:
Axel Dörfler
2017-01-04 23:26:35 +01:00
parent 9bcf23b1a2
commit 80d54534fa
@@ -1,11 +1,12 @@
/* /*
* Copyright 2001-2008, Axel Dörfler, [email protected]. * Copyright 2001-2017, Axel Dörfler, [email protected].
* This file may be used under the terms of the MIT License. * This file may be used under the terms of the MIT License.
*/ */
#ifndef CACHED_BLOCK_H #ifndef CACHED_BLOCK_H
#define CACHED_BLOCK_H #define CACHED_BLOCK_H
//! interface for the block cache
//! Interface for the block cache
#include "system_dependencies.h" #include "system_dependencies.h"
@@ -21,41 +22,44 @@
// convenient to use them). // convenient to use them).
class CachedBlock { class CachedBlock {
public: public:
CachedBlock(Volume* volume); CachedBlock(Volume* volume);
CachedBlock(Volume* volume, off_t block); CachedBlock(Volume* volume, off_t block);
CachedBlock(Volume* volume, block_run run); CachedBlock(Volume* volume, block_run run);
CachedBlock(CachedBlock* cached); CachedBlock(CachedBlock* cached);
~CachedBlock(); ~CachedBlock();
inline void Keep(); inline void Keep();
inline void Unset(); inline void Unset();
inline const uint8* SetTo(off_t block, off_t base, size_t length); inline const uint8* SetTo(off_t block, off_t base, size_t length);
inline const uint8* SetTo(off_t block); inline const uint8* SetTo(off_t block);
inline const uint8* SetTo(block_run run); inline const uint8* SetTo(block_run run);
inline uint8* SetToWritable(Transaction& transaction, off_t block, inline uint8* SetToWritable(Transaction& transaction,
off_t base, size_t length, bool empty = false); off_t block, off_t base, size_t length,
inline uint8* SetToWritable(Transaction& transaction, off_t block, bool empty = false);
bool empty = false); inline uint8* SetToWritable(Transaction& transaction,
inline uint8* SetToWritable(Transaction& transaction, block_run run, off_t block, bool empty = false);
bool empty = false); inline uint8* SetToWritable(Transaction& transaction,
inline status_t MakeWritable(Transaction& transaction); block_run run, bool empty = false);
inline status_t MakeWritable(Transaction& transaction);
const uint8* Block() const { return fBlock; } const uint8* Block() const { return fBlock; }
off_t BlockNumber() const { return fBlockNumber; } off_t BlockNumber() const { return fBlockNumber; }
uint32 BlockSize() const { return fVolume->BlockSize(); } uint32 BlockSize() const
uint32 BlockShift() const { return fVolume->BlockShift(); } { return fVolume->BlockSize(); }
uint32 BlockShift() const
{ return fVolume->BlockShift(); }
private: private:
CachedBlock(const CachedBlock& other); CachedBlock(const CachedBlock& other);
CachedBlock& operator=(const CachedBlock& other); CachedBlock& operator=(const CachedBlock& other);
// no implementation // no implementation
protected: protected:
Volume *fVolume; Volume* fVolume;
off_t fBlockNumber; off_t fBlockNumber;
uint8 *fBlock; uint8* fBlock;
}; };
@@ -196,4 +200,5 @@ CachedBlock::MakeWritable(Transaction& transaction)
transaction.ID()); transaction.ID());
} }
#endif // CACHED_BLOCK_H #endif // CACHED_BLOCK_H