From 08387795ebbba5fe815aa31549703b42f6267ae3 Mon Sep 17 00:00:00 2001 From: Ingo Weinhold Date: Mon, 1 Nov 2004 15:25:37 +0000 Subject: [PATCH] Removed VisitAll(). That's exactly what VisitEachPartition() does (since disk devices are special partitions). git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9708 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- headers/private/storage/DiskDeviceRoster.h | 2 +- src/kits/storage/DiskDeviceRoster.cpp | 35 +++------------------- 2 files changed, 5 insertions(+), 32 deletions(-) diff --git a/headers/private/storage/DiskDeviceRoster.h b/headers/private/storage/DiskDeviceRoster.h index 087cb5a913..1d51dc4dfe 100644 --- a/headers/private/storage/DiskDeviceRoster.h +++ b/headers/private/storage/DiskDeviceRoster.h @@ -15,6 +15,7 @@ class BDirectory; class BDiskDevice; class BDiskDeviceJob; +class BDiskDeviceVisiting; class BDiskDeviceVisitor; class BDiskScannerPartitionAddOn; class BDiskSystem; @@ -108,7 +109,6 @@ public: bool VisitEachPartition(BDiskDeviceVisitor *visitor, BDiskDevice *device = NULL, BPartition **partition = NULL); - bool VisitAll(BDiskDeviceVisitor *visitor); bool VisitEachMountedPartition(BDiskDeviceVisitor *visitor, BDiskDevice *device = NULL, diff --git a/src/kits/storage/DiskDeviceRoster.cpp b/src/kits/storage/DiskDeviceRoster.cpp index 937eafce55..f13cd7262b 100644 --- a/src/kits/storage/DiskDeviceRoster.cpp +++ b/src/kits/storage/DiskDeviceRoster.cpp @@ -202,9 +202,11 @@ BDiskDeviceRoster::VisitEachDevice(BDiskDeviceVisitor *visitor, } // VisitEachPartition -/*! \brief Iterates through the all devices' partitions. +/*! \brief Pre-order traverses the trees spanned by the BDiskDevices and their + subobjects. - The supplied visitor's Visit(BPartition*) is invoked for each partition. + The supplied visitor's Visit(BDiskDevice*) method is invoked for each + disk device and Visit(BPartition*) for each (non-disk device) partition. If Visit() returns \c true, the iteration is terminated and this method returns \c true. If supplied, \a device is set to the concerned device and in \a partition the pointer to the partition object is returned. @@ -232,8 +234,6 @@ BDiskDeviceRoster::VisitEachPartition(BDiskDeviceVisitor *visitor, BPartition *foundPartition = NULL; while (!foundPartition && GetNextDevice(useDevice) == B_OK) foundPartition = useDevice->VisitEachDescendant(visitor); - // TODO: That probably not correct. VisitEachDescendant() - // should also invoke Visit(BDiskDevice*). fDeviceCookie = oldCookie; if (!terminatedEarly) useDevice->Unset(); @@ -243,33 +243,6 @@ BDiskDeviceRoster::VisitEachPartition(BDiskDeviceVisitor *visitor, return terminatedEarly; } -// VisitAll -/*! \brief Pre-order traverses the trees of the spanned by the BDiskDevices - and their subobjects. - - The supplied visitor's Visit() is invoked for each device, for each - session and for each partition. - If Visit() returns \c true, the iteration is terminated and this method - returns \c true as well. - - \param visitor The visitor. - \return \c true, if the iteration was terminated, \c false otherwise. -*/ -bool -BDiskDeviceRoster::VisitAll(BDiskDeviceVisitor *visitor) -{ - bool terminatedEarly = false; - if (visitor) { - int32 oldCookie = fDeviceCookie; - fDeviceCookie = 0; - BDiskDevice device; - while (!terminatedEarly && GetNextDevice(&device) == B_OK) - terminatedEarly = device.VisitEachDescendant(visitor); - fDeviceCookie = oldCookie; - } - return terminatedEarly; -} - // VisitEachMountedPartition /*! \brief Iterates through the all devices' partitions that are mounted.