1*91c21ff4SIngo Weinhold /* 2*91c21ff4SIngo Weinhold * Copyright 2007, Ingo Weinhold, bonefish@users.sf.net. 3*91c21ff4SIngo Weinhold * Distributed under the terms of the MIT License. 4*91c21ff4SIngo Weinhold */ 5*91c21ff4SIngo Weinhold 6*91c21ff4SIngo Weinhold #include <new> 7*91c21ff4SIngo Weinhold 8*91c21ff4SIngo Weinhold #include <List.h> 9*91c21ff4SIngo Weinhold 10*91c21ff4SIngo Weinhold #include <AutoDeleter.h> 11*91c21ff4SIngo Weinhold 12*91c21ff4SIngo Weinhold #include "ExtendedPartitionAddOn.h" 13*91c21ff4SIngo Weinhold #include "PartitionMapAddOn.h" 14*91c21ff4SIngo Weinhold 15*91c21ff4SIngo Weinhold 16*91c21ff4SIngo Weinhold using std::nothrow; 17*91c21ff4SIngo Weinhold 18*91c21ff4SIngo Weinhold 19*91c21ff4SIngo Weinhold // get_disk_system_add_ons 20*91c21ff4SIngo Weinhold status_t get_disk_system_add_ons(BList * addOns)21*91c21ff4SIngo Weinholdget_disk_system_add_ons(BList* addOns) 22*91c21ff4SIngo Weinhold { 23*91c21ff4SIngo Weinhold PartitionMapAddOn* partitionMapAddOn = new(nothrow) PartitionMapAddOn; 24*91c21ff4SIngo Weinhold ExtendedPartitionAddOn* extendedPartitionAddOn 25*91c21ff4SIngo Weinhold = new(nothrow) ExtendedPartitionAddOn; 26*91c21ff4SIngo Weinhold 27*91c21ff4SIngo Weinhold ObjectDeleter<PartitionMapAddOn> mapAddOnDeleter(partitionMapAddOn); 28*91c21ff4SIngo Weinhold ObjectDeleter<ExtendedPartitionAddOn> extendedAddOnDeleter( 29*91c21ff4SIngo Weinhold extendedPartitionAddOn); 30*91c21ff4SIngo Weinhold 31*91c21ff4SIngo Weinhold BList list; 32*91c21ff4SIngo Weinhold if (!partitionMapAddOn || !extendedPartitionAddOn 33*91c21ff4SIngo Weinhold || !list.AddItem(partitionMapAddOn) 34*91c21ff4SIngo Weinhold || !list.AddItem(extendedPartitionAddOn) 35*91c21ff4SIngo Weinhold || !addOns->AddList(&list)) { 36*91c21ff4SIngo Weinhold return B_NO_MEMORY; 37*91c21ff4SIngo Weinhold } 38*91c21ff4SIngo Weinhold 39*91c21ff4SIngo Weinhold mapAddOnDeleter.Detach(); 40*91c21ff4SIngo Weinhold extendedAddOnDeleter.Detach(); 41*91c21ff4SIngo Weinhold 42*91c21ff4SIngo Weinhold return B_OK; 43*91c21ff4SIngo Weinhold } 44