Udf utility functions

- Added vnode_id to udf_long_address (and vice-versa) conversion functions


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3938 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder 2003-07-10 19:41:03 +00:00
parent cab59b7cf3
commit 24ec5f4377
2 changed files with 67 additions and 0 deletions

View File

@ -0,0 +1,33 @@
//----------------------------------------------------------------------
// This software is part of the OpenBeOS distribution and is covered
// by the OpenBeOS license.
//
// Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
//---------------------------------------------------------------------
/*! \file Utils.cpp
Miscellaneous Udf utility functions.
*/
#include "Utils.h"
namespace Udf {
udf_long_address
to_long_address(vnode_id id, uint32 length)
{
udf_long_address result;
result.set_block(id & 0xffff00);
result.set_partition(id & 0xff);
result.set_length(length);
return result;
}
vnode_id
to_vnode_id(udf_long_address address)
{
return (address.block() << 16) & (address.partition());
}
} // namespace Udf

View File

@ -0,0 +1,34 @@
//----------------------------------------------------------------------
// 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_UTILS_H
#define _UDF_UTILS_H
/*! \file Utils.h
Miscellaneous Udf utility functions.
*/
extern "C" {
#ifndef _IMPEXP_KERNEL
# define _IMPEXP_KERNEL
#endif
#include <fsproto.h>
}
#include "DiskStructures.h"
namespace Udf {
udf_long_address to_long_address(vnode_id id, uint32 length = 0);
vnode_id to_vnode_id(udf_long_address address);
} // namespace Udf
#endif // _UDF_UTILS_H