xref: /haiku/src/add-ons/kernel/file_systems/udf/Utils.cpp (revision 8338064665c98c56410b9b129c3ac2b185fdc5b7)
1 //----------------------------------------------------------------------
2 //  This software is part of the OpenBeOS distribution and is covered
3 //  by the OpenBeOS license.
4 //
5 //  Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //---------------------------------------------------------------------
7 
8 /*! \file Utils.cpp
9 
10 	Miscellaneous Udf utility functions.
11 */
12 
13 #include "Utils.h"
14 
15 namespace Udf {
16 
17 udf_long_address
18 to_long_address(vnode_id id, uint32 length)
19 {
20 	DEBUG_INIT_ETC(CF_PUBLIC | CF_HELPER, NULL, ("vnode_id: %lld, length: %ld", id, length));
21 	udf_long_address result;
22 	result.set_block((id >> 16) & 0xffffffff);
23 	result.set_partition(id & 0xffff);
24 	result.set_length(length);
25 	DUMP(result);
26 	return result;
27 }
28 
29 vnode_id
30 to_vnode_id(udf_long_address address)
31 {
32 	return (address.block() << 16) | (address.partition());
33 }
34 
35 } // namespace Udf
36