3rdparty/licenseReport: Add seperate LGPL checks
[haiku.git] / src / add-ons / kernel / file_systems / udf / drive_setup_addon / udf-ds.cpp
blob9b6783567400c358a0230c5fb1443dc7aba68d7e
1 //----------------------------------------------------------------------
2 // This software is part of the OpenBeOS distribution and is covered
3 // by the MIT License.
4 //
5 // Copyright (c) 2003 Tyler Dauwalder, tyler@dauwalder.net
6 //---------------------------------------------------------------------
8 /*! \file DriveSetupAddon.cpp
10 \brief UDF DriveSetup add-on for R5.
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. :-)
17 #include "UdfDebug.h"
18 #include "Recognition.h"
20 struct 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;
35 extern "C" bool ds_fs_id(partition_data*, int32, uint64, int32);
37 bool
38 ds_fs_id(partition_data *data, int32 device, uint64 sessionOffset,
39 int32 blockSize)
41 DEBUG_INIT_ETC(NULL, ("%p, %ld, %Lu, %ld", data,
42 device, sessionOffset, blockSize));
44 if (!data || device < 0)
45 return false;
47 bool result = false;
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.
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;
61 return result;