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:
@@ -0,0 +1,33 @@
|
|||||||
|
//----------------------------------------------------------------------
|
||||||
|
// This software is part of the OpenBeOS distribution and is covered
|
||||||
|
// by the OpenBeOS license.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2003 Tyler Dauwalder, [email protected]
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
/*! \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
|
||||||
@@ -0,0 +1,34 @@
|
|||||||
|
//----------------------------------------------------------------------
|
||||||
|
// This software is part of the OpenBeOS distribution and is covered
|
||||||
|
// by the OpenBeOS license.
|
||||||
|
//
|
||||||
|
// Copyright (c) 2003 Tyler Dauwalder, [email protected]
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
#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
|
||||||
|
|
||||||
Reference in New Issue
Block a user