* Volume::Unmount() never put the root node, and never deleted the volume's
block cache. * Some cleanup. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@35069 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008, Axel Dörfler, [email protected].
|
* Copyright 2008-2010, 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.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
//! super block, mounting, etc.
|
|
||||||
|
//! Super block, mounting, etc.
|
||||||
|
|
||||||
|
|
||||||
#include "Volume.h"
|
#include "Volume.h"
|
||||||
@@ -304,7 +305,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
|||||||
if (diskSize < (NumBlocks() << BlockShift()))
|
if (diskSize < (NumBlocks() << BlockShift()))
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
if ((fBlockCache = opener.InitCache(NumBlocks(), fBlockSize)) == NULL)
|
fBlockCache = opener.InitCache(NumBlocks(), fBlockSize);
|
||||||
|
if (fBlockCache == NULL)
|
||||||
return B_ERROR;
|
return B_ERROR;
|
||||||
|
|
||||||
status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode);
|
status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode);
|
||||||
@@ -339,8 +341,8 @@ Volume::Mount(const char* deviceName, uint32 flags)
|
|||||||
status_t
|
status_t
|
||||||
Volume::Unmount()
|
Volume::Unmount()
|
||||||
{
|
{
|
||||||
//put_vnode(fVolume, ToVnode(Root()));
|
put_vnode(fFSVolume, RootNode()->ID());
|
||||||
//block_cache_delete(fBlockCache, !IsReadOnly());
|
block_cache_delete(fBlockCache, !IsReadOnly());
|
||||||
close(fDevice);
|
close(fDevice);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright 2008-2009, Axel Dörfler, [email protected].
|
* Copyright 2008-2010, 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 VOLUME_H
|
#ifndef VOLUME_H
|
||||||
@@ -12,10 +12,12 @@
|
|||||||
|
|
||||||
class Inode;
|
class Inode;
|
||||||
|
|
||||||
|
|
||||||
enum volume_flags {
|
enum volume_flags {
|
||||||
VOLUME_READ_ONLY = 0x0001
|
VOLUME_READ_ONLY = 0x0001
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class Volume {
|
class Volume {
|
||||||
public:
|
public:
|
||||||
Volume(fs_volume* volume);
|
Volume(fs_volume* volume);
|
||||||
@@ -25,26 +27,32 @@ public:
|
|||||||
status_t Unmount();
|
status_t Unmount();
|
||||||
|
|
||||||
bool IsValidSuperBlock();
|
bool IsValidSuperBlock();
|
||||||
bool IsReadOnly() const { return fFlags & VOLUME_READ_ONLY; }
|
bool IsReadOnly() const
|
||||||
|
{ return (fFlags & VOLUME_READ_ONLY) != 0; }
|
||||||
|
|
||||||
Inode* RootNode() const { return fRootNode; }
|
Inode* RootNode() const { return fRootNode; }
|
||||||
int Device() const { return fDevice; }
|
int Device() const { return fDevice; }
|
||||||
|
|
||||||
dev_t ID() const { return fFSVolume ? fFSVolume->id : -1; }
|
dev_t ID() const
|
||||||
|
{ return fFSVolume ? fFSVolume->id : -1; }
|
||||||
fs_volume* FSVolume() const { return fFSVolume; }
|
fs_volume* FSVolume() const { return fFSVolume; }
|
||||||
const char* Name() const;
|
const char* Name() const;
|
||||||
|
|
||||||
off_t NumBlocks() const { return fSuperBlock.NumBlocks(); }
|
off_t NumBlocks() const
|
||||||
off_t FreeBlocks() const { return fSuperBlock.FreeBlocks(); }
|
{ return fSuperBlock.NumBlocks(); }
|
||||||
|
off_t FreeBlocks() const
|
||||||
|
{ return fSuperBlock.FreeBlocks(); }
|
||||||
|
|
||||||
uint32 BlockSize() const { return fBlockSize; }
|
uint32 BlockSize() const { return fBlockSize; }
|
||||||
uint32 BlockShift() const { return fBlockShift; }
|
uint32 BlockShift() const { return fBlockShift; }
|
||||||
uint32 InodeSize() const { return fSuperBlock.InodeSize(); }
|
uint32 InodeSize() const
|
||||||
|
{ return fSuperBlock.InodeSize(); }
|
||||||
ext2_super_block& SuperBlock() { return fSuperBlock; }
|
ext2_super_block& SuperBlock() { return fSuperBlock; }
|
||||||
|
|
||||||
status_t GetInodeBlock(ino_t id, uint32& block);
|
status_t GetInodeBlock(ino_t id, uint32& block);
|
||||||
uint32 InodeBlockIndex(ino_t id) const;
|
uint32 InodeBlockIndex(ino_t id) const;
|
||||||
status_t GetBlockGroup(int32 index, ext2_block_group** _group);
|
status_t GetBlockGroup(int32 index,
|
||||||
|
ext2_block_group** _group);
|
||||||
|
|
||||||
// cache access
|
// cache access
|
||||||
void* BlockCache() { return fBlockCache; }
|
void* BlockCache() { return fBlockCache; }
|
||||||
|
|||||||
Reference in New Issue
Block a user