haiku/src/kits/storage/LibBeAdapter.cpp
Tyler Dauwalder 09d84e61b6 + Changed StorageKit namespace to BPrivate::Storage
+ Changed Sniffer namespace to BPrivate::Storage::Sniffer


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@714 a95241bf-73f2-0310-859d-f6bbb57e9c96
2002-08-12 08:42:01 +00:00

48 lines
880 B
C++

// LibBeAdapter.cpp
#include <ByteOrder.h>
#include <Entry.h>
#include <List.h>
#include <Path.h>
status_t
entry_ref_to_path_adapter(dev_t device, ino_t directory, const char *name,
char *buffer, size_t size)
{
status_t error = (name && buffer ? B_OK : B_BAD_VALUE);
BEntry entry;
if (error == B_OK) {
entry_ref ref(device, directory, name);
error = entry.SetTo(&ref);
}
BPath path;
if (error == B_OK)
error = entry.GetPath(&path);
if (error == B_OK) {
if (size >= strlen(path.Path()) + 1)
strcpy(buffer, path.Path());
else
error = B_BAD_VALUE;
}
return error;
}
// swap_data_adapter
status_t
swap_data_adapter(type_code type, void *data, size_t length,
swap_action action)
{
return swap_data(type, data, length, action);
}
// is_type_swapped_adapter
bool
is_type_swapped_adapter(type_code type)
{
return is_type_swapped(type);
}