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 DriveSetupAddon.cpp 9 10 \brief UDF DriveSetup add-on for R5. 11 12 The interface implemented here is detailed in the Be Newsletter, 13 Volume II, Issue 23, "Getting Mounted". Thanks to Ingo Weinhold 14 for digging that up. :-) 15*/ 16 17#include "UdfDebug.h" 18#include "Recognition.h" 19 20struct partition_data { 21 char partition_name[B_FILE_NAME_LENGTH]; 22 char partition_type[B_FILE_NAME_LENGTH]; 23 char file_system_short_name[B_FILE_NAME_LENGTH]; 24 char file_system_long_name[B_FILE_NAME_LENGTH]; 25 char volume_name[B_FILE_NAME_LENGTH]; 26 char mounted_at[B_FILE_NAME_LENGTH]; 27 uint32 logical_block_size; 28 uint64 offset; // in logical blocks from start of session 29 uint64 blocks; 30 bool hidden; //"non-file system" partition 31 bool reserved1; 32 uint32 reserved2; 33}; 34 35extern "C" bool ds_fs_id(partition_data*, int32, uint64, int32); 36 37bool 38ds_fs_id(partition_data *data, int32 device, uint64 sessionOffset, 39 int32 blockSize) 40{ 41 DEBUG_INIT_ETC(NULL, ("%p, %ld, %Lu, %ld", data, 42 device, sessionOffset, blockSize)); 43 44 if (!data || device < 0) 45 return false; 46 47 bool result = false; 48 49 char name[256]; 50 // Udf volume names are at most 63 2-byte unicode chars, so 256 UTF-8 51 // chars should cover us. 52 53 status_t error = Udf::udf_recognize(device, (data->offset + sessionOffset), data->blocks, blockSize, name); 54 if (!error) { 55 strcpy(data->file_system_short_name, "udf"); 56 strcpy(data->file_system_long_name, "Universal Disk Format"); 57 strcpy(data->volume_name, name); 58 result = true; 59 } 60 61 return result; 62} 63 64