* Seems like GCC4 does not like declaring structures inside unnamed unions;
that looks like a compiler bug to me, though. * Pulled struct data_stream out of the union (now called ext2_data_stream), based on a patch by Maurice, thanks! git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26214 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -110,12 +110,12 @@ Inode::FindBlock(off_t offset, uint32& block)
|
||||
|
||||
if (index < EXT2_DIRECT_BLOCKS) {
|
||||
// direct blocks
|
||||
block = B_LENDIAN_TO_HOST_INT32(Node().u.stream.direct[index]);
|
||||
block = B_LENDIAN_TO_HOST_INT32(Node().stream.direct[index]);
|
||||
} else if ((index -= EXT2_DIRECT_BLOCKS) < perBlock) {
|
||||
// indirect blocks
|
||||
CachedBlock cached(fVolume);
|
||||
uint32* indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32(
|
||||
Node().u.stream.indirect));
|
||||
Node().stream.indirect));
|
||||
if (indirectBlocks == NULL)
|
||||
return B_IO_ERROR;
|
||||
|
||||
@@ -124,7 +124,7 @@ Inode::FindBlock(off_t offset, uint32& block)
|
||||
// double indirect blocks
|
||||
CachedBlock cached(fVolume);
|
||||
uint32* indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32(
|
||||
Node().u.stream.double_indirect));
|
||||
Node().stream.double_indirect));
|
||||
if (indirectBlocks == NULL)
|
||||
return B_IO_ERROR;
|
||||
|
||||
@@ -138,7 +138,7 @@ Inode::FindBlock(off_t offset, uint32& block)
|
||||
// triple indirect blocks
|
||||
CachedBlock cached(fVolume);
|
||||
uint32* indirectBlocks = (uint32*)cached.SetTo(B_LENDIAN_TO_HOST_INT32(
|
||||
Node().u.stream.triple_indirect));
|
||||
Node().stream.triple_indirect));
|
||||
if (indirectBlocks == NULL)
|
||||
return B_IO_ERROR;
|
||||
|
||||
|
||||
@@ -138,6 +138,13 @@ struct ext2_block_group {
|
||||
#define EXT2_ROOT_NODE 2
|
||||
#define EXT2_SHORT_SYMLINK_LENGTH 60
|
||||
|
||||
struct ext2_data_stream {
|
||||
uint32 direct[EXT2_DIRECT_BLOCKS];
|
||||
uint32 indirect;
|
||||
uint32 double_indirect;
|
||||
uint32 triple_indirect;
|
||||
};
|
||||
|
||||
struct ext2_inode {
|
||||
uint16 mode;
|
||||
uint16 uid;
|
||||
@@ -152,14 +159,9 @@ struct ext2_inode {
|
||||
uint32 flags;
|
||||
uint32 _reserved1;
|
||||
union {
|
||||
struct data_stream {
|
||||
uint32 direct[EXT2_DIRECT_BLOCKS];
|
||||
uint32 indirect;
|
||||
uint32 double_indirect;
|
||||
uint32 triple_indirect;
|
||||
} stream;
|
||||
ext2_data_stream stream;
|
||||
char symlink[EXT2_SHORT_SYMLINK_LENGTH];
|
||||
} u;
|
||||
};
|
||||
uint32 generation;
|
||||
uint32 file_access_control;
|
||||
union {
|
||||
|
||||
@@ -414,7 +414,7 @@ ext2_read_link(fs_volume *_volume, fs_vnode *_node, char *buffer,
|
||||
if (inode->Size() > EXT2_SHORT_SYMLINK_LENGTH)
|
||||
return inode->ReadAt(0, (uint8 *)buffer, _bufferSize);
|
||||
|
||||
memcpy(buffer, inode->Node().u.symlink, *_bufferSize);
|
||||
memcpy(buffer, inode->Node().symlink, *_bufferSize);
|
||||
return B_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user