From oruizdorantes at mail.berlios.de Sun Mar 1 14:05:42 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Sun, 1 Mar 2009 14:05:42 +0100 Subject: [Haiku-commits] r29362 - haiku/trunk/src/preferences/bluetooth Message-ID: <200903011305.n21D5gkK018954@sheep.berlios.de> Author: oruizdorantes Date: 2009-03-01 14:05:41 +0100 (Sun, 01 Mar 2009) New Revision: 29362 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29362&view=rev Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp haiku/trunk/src/preferences/bluetooth/InquiryPanel.h haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp Log: - Add device class in listitem - Add scrollbar to the list of remote devices - Draw a Rect where an icon is suposed to be located Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-02-28 20:48:27 UTC (rev 29361) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-03-01 13:05:41 UTC (rev 29362) @@ -14,7 +14,7 @@ #define PIXELS_FOR_ICON 32 -#define INSETS 2 +#define INSETS 5 #define TEXT_ROWS 2 namespace Bluetooth { @@ -83,12 +83,19 @@ font_height finfo; be_plain_font->GetHeight(&finfo); - BPoint point = BPoint(itemRect.left + PIXELS_FOR_ICON + INSETS, itemRect.bottom - finfo.descent + 1); + BPoint point = BPoint(itemRect.left + PIXELS_FOR_ICON + INSETS, itemRect.bottom - finfo.descent + 1); owner->SetFont(be_fixed_font); owner->SetHighColor(kBlack); owner->MovePenTo(point); - owner->DrawString(bdaddrUtils::ToString(fAddress)); + BString secondLine; + + secondLine << bdaddrUtils::ToString(fAddress) << " "; + fClass.GetMajorDeviceClass(secondLine); + secondLine << " / "; + fClass.GetMinorDeviceClass(secondLine); + + owner->DrawString(secondLine.String()); point -= BPoint(0, (finfo.ascent + finfo.descent + finfo.leading)); @@ -97,8 +104,10 @@ owner->DrawString(fName.String()); // TODO: Stroke icon + owner->StrokeRect(BRect(itemRect.left + INSETS, itemRect.top + INSETS, + itemRect.left + PIXELS_FOR_ICON, itemRect.top + PIXELS_FOR_ICON)); + // TODO: Draw rssi - // TODO: Draw rssi } @@ -109,7 +118,6 @@ font_height height; font->GetHeight(&height); - //SetHeight(finfo.leading*TEXT_ROWS + TEXT_ROWS*INSETS + 50); SetHeight((height.ascent + height.descent + height.leading) * TEXT_ROWS + TEXT_ROWS*INSETS); Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-28 20:48:27 UTC (rev 29361) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-03-01 13:05:41 UTC (rev 29362) @@ -6,13 +6,14 @@ #include #include #include +#include +#include +#include +#include #include #include #include #include -#include -#include -#include #include #include @@ -82,7 +83,7 @@ InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice) : BWindow(frame, "Bluetooth", B_FLOATING_WINDOW, - B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS, + B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES ), fScanning(false) , fLocalDevice(lDevice) { @@ -111,6 +112,8 @@ fRemoteList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); + fScrollView = new BScrollView("ScrollView", fRemoteList, 0, false, true); + fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); if (fLocalDevice != NULL) { fMessage->SetText("Check that the bluetooth capabilities of your remote device" @@ -137,7 +140,7 @@ .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(fScanProgress) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) - .Add(fRemoteList) + .Add(fScrollView) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(fAddButton) @@ -185,6 +188,7 @@ message.AddPointer("device", item); be_app->PostMessage(&message); + // TODO: all others listitems can be deleted } break; Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-02-28 20:48:27 UTC (rev 29361) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-03-01 13:05:41 UTC (rev 29362) @@ -15,6 +15,7 @@ class BButton; class BTextView; class BListView; +class BScrollView; class LocalDevice; class DiscoveryAgent; class DiscoveryListener; @@ -32,6 +33,7 @@ BButton* fInquiryButton; BTextView* fMessage; BListView* fRemoteList; + BScrollView* fScrollView; BMessageRunner* fRunner; bool fScanning; Modified: haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-02-28 20:48:27 UTC (rev 29361) +++ haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-03-01 13:05:41 UTC (rev 29362) @@ -58,8 +58,7 @@ SetLayout(new BGroupLayout(B_VERTICAL)); - // TODO: Make list view and scroller use all the additional height - // available! + // TODO: use all the additional height AddChild(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(fScrollView) //.Add(BSpaceLayoutItem::CreateHorizontalStrut(5)) @@ -106,7 +105,7 @@ switch(msg->what) { case kMsgAddDevices: { - InquiryPanel* iPanel = new InquiryPanel(BRect(100,100,400,400), ActiveLocalDevice); + InquiryPanel* iPanel = new InquiryPanel(BRect(100,100,450,450), ActiveLocalDevice); iPanel->Show(); } break; From stippi at mail.berlios.de Sun Mar 1 14:58:28 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 1 Mar 2009 14:58:28 +0100 Subject: [Haiku-commits] r29363 - haiku/trunk/src/apps/tv Message-ID: <200903011358.n21DwS2L026612@sheep.berlios.de> Author: stippi Date: 2009-03-01 14:58:05 +0100 (Sun, 01 Mar 2009) New Revision: 29363 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29363&view=rev Modified: haiku/trunk/src/apps/tv/MainWin.cpp haiku/trunk/src/apps/tv/MainWin.h Log: Patch by Oliver Coursiere: Center the TV window on start. Fixes ticket #3041. Thanks! Modified: haiku/trunk/src/apps/tv/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/tv/MainWin.cpp 2009-03-01 13:05:41 UTC (rev 29362) +++ haiku/trunk/src/apps/tv/MainWin.cpp 2009-03-01 13:58:05 UTC (rev 29363) @@ -132,6 +132,8 @@ SetChannelMenuMarker(); VideoFormatChange(fSourceWidth, fSourceHeight, fWidthScale, fHeightScale); + + CenterWindow(); } @@ -1175,3 +1177,25 @@ } } } + + +void +MainWin::CenterWindow() +{ + BScreen screen(this); + if (!screen.IsValid()) + return; + + BRect frame = screen.Frame(); + BRect windowFrame = Frame(); + + float left = floor((frame.Width() - windowFrame.Width()) / 2); + float top = floor((frame.Height() - windowFrame.Height()) / 2); + + if (left < 20) + left = 20; + if (top < 20) + top = 20; + + MoveTo(left, top); +} Modified: haiku/trunk/src/apps/tv/MainWin.h =================================================================== --- haiku/trunk/src/apps/tv/MainWin.h 2009-03-01 13:05:41 UTC (rev 29362) +++ haiku/trunk/src/apps/tv/MainWin.h 2009-03-01 13:58:05 UTC (rev 29363) @@ -61,7 +61,7 @@ void SetInterfaceMenuMarker(); void SetChannelMenuMarker(); - + void VideoFormatChange(int width, int height, float width_scale, float height_scale); void UpdateWindowTitle(); @@ -75,7 +75,8 @@ void ToggleNoBorder(); void ToggleNoMenu(); void ToggleNoBorderNoMenu(); - + void CenterWindow(); + void ShowContextMenu(const BPoint &screen_point); BMenuBar * fMenuBar; From bonefish at mail.berlios.de Sun Mar 1 15:42:57 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Mar 2009 15:42:57 +0100 Subject: [Haiku-commits] r29364 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on Message-ID: <200903011442.n21EgvLX030119@sheep.berlios.de> Author: bonefish Date: 2009-03-01 15:42:57 +0100 (Sun, 01 Mar 2009) New Revision: 29364 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29364&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp Log: Fixed debug build. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp 2009-03-01 13:58:05 UTC (rev 29363) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp 2009-03-01 14:42:57 UTC (rev 29364) @@ -72,8 +72,8 @@ userlandfs_mount(fs_volume* fsVolume, const char* device, uint32 flags, const char* args, ino_t* rootVnodeID) { - PRINT(("userlandfs_mount(%p (%ld), %s, 0x%lx, %s, %p, %p)\n", fsVolume, - fsVolume->id, device, flags, args, fsCookie, rootVnodeID)); + PRINT(("userlandfs_mount(%p (%ld), %s, 0x%lx, %s, %p)\n", fsVolume, + fsVolume->id, device, flags, args, rootVnodeID)); status_t error = B_OK; @@ -108,7 +108,7 @@ fsVolume->ops = &gUserlandFSVolumeOps; *rootVnodeID = volume->GetRootID(); - PRINT(("userlandfs_mount() done: %p, %lld\n", *fsVolume->private_volume, + PRINT(("userlandfs_mount() done: %p, %lld\n", fsVolume->private_volume, *rootVnodeID)); return error; @@ -292,8 +292,8 @@ int flags) { Volume* volume = (Volume*)fsVolume->private_volume; - PRINT(("userlandfs_set_flags(%p, %p, %p, %d)\n", fs, fsNode->private_node, - cookie, flags)); + PRINT(("userlandfs_set_flags(%p, %p, %p, %d)\n", volume, + fsNode->private_node, cookie, flags)); status_t error = volume->SetFlags(fsNode->private_node, cookie, flags); PRINT(("userlandfs_set_flags() done: (%lx)\n", error)); return error; @@ -372,7 +372,7 @@ { Volume* volume = (Volume*)fsVolume->private_volume; PRINT(("userlandfs_link(%p, %p, `%s', %p)\n", volume, - fsDir->private_node, name, node)); + fsDir->private_node, name, fsNode->private_node)); status_t error = volume->Link(fsDir->private_node, name, fsNode->private_node); PRINT(("userlandfs_link() done: (%lx)\n", error)); From bonefish at mail.berlios.de Sun Mar 1 15:44:56 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Mar 2009 15:44:56 +0100 Subject: [Haiku-commits] r29365 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200903011444.n21EiuIB030271@sheep.berlios.de> Author: bonefish Date: 2009-03-01 15:44:56 +0100 (Sun, 01 Mar 2009) New Revision: 29365 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29365&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp Log: A NULL pointer was dereferenced when mounting failed. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp 2009-03-01 14:42:57 UTC (rev 29364) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp 2009-03-01 14:44:56 UTC (rev 29365) @@ -254,7 +254,8 @@ reply->error = result; reply->volume = volume; reply->rootID = rootID; - volume->GetCapabilities(reply->capabilities); + if (volume != NULL) + volume->GetCapabilities(reply->capabilities); // send the reply return _SendReply(allocator, false); From oruizdorantes at mail.berlios.de Sun Mar 1 15:48:12 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Sun, 1 Mar 2009 15:48:12 +0100 Subject: [Haiku-commits] r29366 - haiku/trunk/src/preferences/bluetooth Message-ID: <200903011448.n21EmCKS030606@sheep.berlios.de> Author: oruizdorantes Date: 2009-03-01 15:48:11 +0100 (Sun, 01 Mar 2009) New Revision: 29366 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29366&view=rev Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.h haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp haiku/trunk/src/preferences/bluetooth/InquiryPanel.h Log: - Add the retrieval of remote names to the discovered devices Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-03-01 14:44:56 UTC (rev 29365) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-03-01 14:48:11 UTC (rev 29366) @@ -27,10 +27,9 @@ void Update(BView *owner, const BFont *font); static int Compare(const void *firstArg, const void *secondArg); - - private: void SetDevice(BluetoothDevice* bDevice); + private: BluetoothDevice* fDevice; bdaddr_t fAddress; DeviceClass fClass; Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-03-01 14:44:56 UTC (rev 29365) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-03-01 14:48:11 UTC (rev 29366) @@ -85,6 +85,7 @@ : BWindow(frame, "Bluetooth", B_FLOATING_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES ), fScanning(false) + , fRetrieving(false) , fLocalDevice(lDevice) { // BRect iDontCare(0,0,0,0); @@ -157,6 +158,7 @@ { static float timer = 0; // expected time of the inquiry process static float scanningTime = 0; + static int32 retrievalIndex = 0; switch (message->what) { case kMsgInquiry: @@ -194,19 +196,19 @@ case kMsgStart: fRemoteList->MakeEmpty(); - fScanProgress->Reset(); + fScanProgress->Reset(); + scanningTime = 0; + fScanning = true; - scanningTime = 0; - fScanning = true; UpdateUIStatus(); - break; case kMsgFinish: - + retrievalIndex = 0; fScanning = false; + fRetrieving = true; + UpdateUIStatus(); - break; case kMsgSecond: @@ -221,11 +223,28 @@ scanningTime = scanningTime + 1; } - - if (fRemoteList->CurrentSelection() < 0 || fScanning) - fAddButton->SetEnabled(false); - else - fAddButton->SetEnabled(true); + + if (fRetrieving) { + + if (retrievalIndex < fDiscoveryAgent->RetrieveDevices(0).CountItems()) { + + ((DeviceListItem*)fRemoteList->ItemAt(retrievalIndex))-> + SetDevice((BluetoothDevice*)fDiscoveryAgent->RetrieveDevices(0).ItemAt(retrievalIndex)); + + fRemoteList->Invalidate(); + retrievalIndex++; + + } else { + + fRetrieving = false; + retrievalIndex = 0; + + fScanProgress->SetBarColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fScanProgress->SetTrailingText("Scanning completed ..."); + } + } + + UpdateUIStatus(); } break; @@ -244,12 +263,19 @@ fInquiryButton->SetEnabled(false); fScanProgress->SetBarColor(activeColor); - } else { + } else if (fRetrieving) { fInquiryButton->SetEnabled(true); - fScanProgress->SetBarColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fScanProgress->SetTo(100); - fScanProgress->SetText("Scan completed"); + fScanProgress->SetTrailingText("Retrieving names ..."); + } else { + } + + if (fRemoteList->CurrentSelection() < 0 || fScanning) + fAddButton->SetEnabled(false); + else + fAddButton->SetEnabled(true); + } Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-03-01 14:44:56 UTC (rev 29365) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-03-01 14:48:11 UTC (rev 29366) @@ -37,6 +37,7 @@ BMessageRunner* fRunner; bool fScanning; + bool fRetrieving; LocalDevice* fLocalDevice; DiscoveryAgent* fDiscoveryAgent; DiscoveryListener* fDiscoveryListener; From bonefish at mail.berlios.de Sun Mar 1 15:51:05 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Mar 2009 15:51:05 +0100 Subject: [Haiku-commits] r29367 - in haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server: . beos Message-ID: <200903011451.n21Ep567030908@sheep.berlios.de> Author: bonefish Date: 2009-03-01 15:51:05 +0100 (Sun, 01 Mar 2009) New Revision: 29367 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29367&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_kernel_emu.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h Log: * FileSystem does now have a list of all volumes. This allows to get a volume by ID. * Added a three parameters version of UserlandFS::KernelEmu::publish_vnode(), which is used by the BeOS new_vnode() emulation. It calls the new Volume::GetVNodeType() to get the type of the node. Theoretically BeOS FS interface style add-ons should work again, but ATM we crash the kernel when trying to mount. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.cpp 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.cpp 2009-03-01 14:51:05 UTC (rev 29367) @@ -2,13 +2,60 @@ #include "FileSystem.h" +#include "AutoLocker.h" +#include "Volume.h" + + +FileSystem* FileSystem::sInstance = NULL; + + // constructor FileSystem::FileSystem() { + sInstance = this; } + // destructor FileSystem::~FileSystem() { + sInstance = NULL; } + +/*static*/ FileSystem* +FileSystem::GetInstance() +{ + return sInstance; +} + + +void +FileSystem::RegisterVolume(Volume* volume) +{ + AutoLocker _(fLock); + fVolumes.Add(volume); +} + + +void +FileSystem::UnregisterVolume(Volume* volume) +{ + AutoLocker _(fLock); + fVolumes.Remove(volume); +} + + +Volume* +FileSystem::VolumeWithID(dev_t id) +{ + AutoLocker _(fLock); + + VolumeList::Iterator it = fVolumes.GetIterator(); + while (Volume* volume = it.Next()) { + if (volume->GetID() == id) + return volume; + } + + return NULL; +} Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.h 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.h 2009-03-01 14:51:05 UTC (rev 29367) @@ -7,8 +7,12 @@ #include #include +#include + #include "FSCapabilities.h" +#include "Locker.h" + namespace UserlandFS { class Volume; @@ -18,9 +22,15 @@ FileSystem(); virtual ~FileSystem(); + static FileSystem* GetInstance(); + virtual status_t CreateVolume(Volume** volume, dev_t id) = 0; virtual status_t DeleteVolume(Volume* volume) = 0; + void RegisterVolume(Volume* volume); + void UnregisterVolume(Volume* volume); + Volume* VolumeWithID(dev_t id); + void GetCapabilities( FSCapabilities& capabilities) const { capabilities = fCapabilities; } @@ -28,8 +38,15 @@ { return fClientFSType; } protected: + typedef DoublyLinkedList VolumeList; + +protected: + Locker fLock; + VolumeList fVolumes; FSCapabilities fCapabilities; client_fs_type fClientFSType; + + static FileSystem* sInstance; }; } // namespace UserlandFS Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp 2009-03-01 14:51:05 UTC (rev 29367) @@ -6,18 +6,22 @@ #include #include +#include "FileSystem.h" #include "kernel_emu.h" + // constructor Volume::Volume(FileSystem* fileSystem, dev_t id) : fFileSystem(fileSystem), fID(id) { + fFileSystem->RegisterVolume(this); } // destructor Volume::~Volume() { + fFileSystem->UnregisterVolume(this); } // GetFileSystem @@ -85,6 +89,15 @@ return B_BAD_VALUE; } + +// GetVNodeType +status_t +Volume::GetVNodeType(void* node, int* type) +{ + return B_NOT_SUPPORTED; +} + + // GetVNodeName status_t Volume::GetVNodeName(void* node, char* buffer, size_t bufferSize) Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.h 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.h 2009-03-01 14:51:05 UTC (rev 29367) @@ -6,15 +6,18 @@ #include #include +#include + #include "FSCapabilities.h" + namespace UserlandFS { class FileSystem; using UserlandFSUtil::FSVolumeCapabilities; -class Volume { +class Volume : public DoublyLinkedListLinkImpl { public: Volume(FileSystem* fileSystem, dev_t id); virtual ~Volume(); @@ -38,6 +41,10 @@ // vnodes virtual status_t Lookup(void* dir, const char* entryName, ino_t* vnid); + virtual status_t GetVNodeType(void* node, int* type); + // Only needs to be implemented when + // the three parameters publish_vnode() is + // used. virtual status_t GetVNodeName(void* node, char* buffer, size_t bufferSize); virtual status_t ReadVNode(ino_t vnid, bool reenter, Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-03-01 14:51:05 UTC (rev 29367) @@ -43,9 +43,11 @@ // constructor BeOSKernelVolume::BeOSKernelVolume(FileSystem* fileSystem, dev_t id, beos_vnode_ops* fsOps) - : Volume(fileSystem, id), - fFSOps(fsOps), - fVolumeCookie(NULL) + : + Volume(fileSystem, id), + fFSOps(fsOps), + fVolumeCookie(NULL), + fMounted(false) { } @@ -66,8 +68,13 @@ return B_BAD_VALUE; size_t len = (parameters ? strlen(parameters) : 0); - return fFSOps->mount(GetID(), device, flags, (void*)parameters, len, - &fVolumeCookie, rootID); + status_t error = fFSOps->mount(GetID(), device, flags, (void*)parameters, + len, &fVolumeCookie, rootID); + if (error != B_OK) + return error; + + fMounted = true; + return B_OK; } // Unmount @@ -123,6 +130,35 @@ return fFSOps->walk(fVolumeCookie, dir, entryName, NULL, vnid); } + +// GetVNodeType +status_t +BeOSKernelVolume::GetVNodeType(void* node, int* type) +{ + if (fMounted) { + // The volume is mounted. We can stat() the node to get its type. + struct stat st; + status_t error = ReadStat(node, &st); + if (error != B_OK) + return error; + + *type = st.st_mode & S_IFMT; + } else { + // Not mounted yet. That particularly means we don't have a volume + // cookie yet and cannot use calls into the FS to get the node type. + // Just assume the node is a directory. That definitely is the case for + // the root node and shouldn't do harm for the index directory or + // indices, which could get published while mounting as well. + *type = S_IFDIR; + // TODO: Store the concerned nodes and check their type as soon as + // possible (at the end of Mount()). The incorrect ones could be + // corrected in the kernel: remove_vnode(), x*put_vnode() (catching + // the "remove_vnode()" callback), publish_vnode(), + // (x-1)*get_vnode(). + } +} + + // ReadVNode status_t BeOSKernelVolume::ReadVNode(ino_t vnid, bool reenter, void** node, int* type, Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h 2009-03-01 14:51:05 UTC (rev 29367) @@ -27,6 +27,10 @@ // vnodes virtual status_t Lookup(void* dir, const char* entryName, ino_t* vnid); + virtual status_t GetVNodeType(void* node, int* type); + // Only needs to be implemented when + // the three parameters publish_vnode() is + // used. virtual status_t ReadVNode(ino_t vnid, bool reenter, void** node, int* type, uint32* flags); virtual status_t WriteVNode(void* node, bool reenter); @@ -153,6 +157,7 @@ private: beos_vnode_ops* fFSOps; void* fVolumeCookie; + bool fMounted; }; } // namespace UserlandFS Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_kernel_emu.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_kernel_emu.cpp 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_kernel_emu.cpp 2009-03-01 14:51:05 UTC (rev 29367) @@ -147,9 +147,7 @@ { // The semantics of new_vnode() has changed. The new publish_vnode() // should work like the former new_vnode(). -// TODO: Implement correctly! Get the type! -// return UserlandFS::KernelEmu::publish_vnode(nsid, vnid, data); -return B_BAD_VALUE; + return UserlandFS::KernelEmu::publish_vnode(nsid, vnid, data); } // remove_vnode Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp 2009-03-01 14:51:05 UTC (rev 29367) @@ -6,11 +6,13 @@ #include #include +#include "FileSystem.h" #include "RequestPort.h" #include "Requests.h" #include "RequestThread.h" #include "UserlandFSServer.h" #include "UserlandRequestHandler.h" +#include "Volume.h" // Taken from the Haiku Storage Kit (storage_support.cpp) @@ -407,6 +409,28 @@ return error; } + +// publish_vnode +status_t +UserlandFS::KernelEmu::publish_vnode(dev_t nsid, ino_t vnid, void* data) +{ + // get the volume + Volume* volume = FileSystem::GetInstance()->VolumeWithID(nsid); + if (volume == NULL) + return B_BAD_VALUE; + + // stat() the node to get its type +// TODO: This must not be called while mounting! + int type; + status_t error = volume->GetVNodeType(data, &type); + if (error != B_OK) + return error; + + // publish the node + return UserlandFS::KernelEmu::publish_vnode(nsid, vnid, data, type, 0); +} + + // remove_vnode status_t UserlandFS::KernelEmu::remove_vnode(dev_t nsid, ino_t vnid) Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h 2009-03-01 14:48:11 UTC (rev 29366) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h 2009-03-01 14:51:05 UTC (rev 29367) @@ -26,6 +26,7 @@ status_t new_vnode(dev_t nsid, ino_t vnid, void* data); status_t publish_vnode(dev_t nsid, ino_t vnid, void* data, int type, uint32 flags); +status_t publish_vnode(dev_t nsid, ino_t vnid, void* data); status_t remove_vnode(dev_t nsid, ino_t vnid); status_t unremove_vnode(dev_t nsid, ino_t vnid); status_t get_vnode_removed(dev_t nsid, ino_t vnid, bool* removed); From bonefish at mail.berlios.de Sun Mar 1 16:29:03 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Mar 2009 16:29:03 +0100 Subject: [Haiku-commits] r29368 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos Message-ID: <200903011529.n21FT3f6001113@sheep.berlios.de> Author: bonefish Date: 2009-03-01 16:29:02 +0100 (Sun, 01 Mar 2009) New Revision: 29368 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29368&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp Log: Missing return. BeOS style add-ons seem to work again (tested with ramfs). Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-03-01 14:51:05 UTC (rev 29367) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-03-01 15:29:02 UTC (rev 29368) @@ -156,6 +156,8 @@ // the "remove_vnode()" callback), publish_vnode(), // (x-1)*get_vnode(). } + + return B_OK; } From ingo_weinhold at gmx.de Sun Mar 1 16:51:46 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 01 Mar 2009 16:51:46 +0100 Subject: [Haiku-commits] r29368 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos In-Reply-To: <200903011529.n21FT3f6001113@sheep.berlios.de> References: <200903011529.n21FT3f6001113@sheep.berlios.de> Message-ID: <20090301165146.362.1@knochen-vm.localdomain> On 2009-03-01 at 16:29:03 [+0100], bonefish at BerliOS wrote: > Author: bonefish > Date: 2009-03-01 16:29:02 +0100 (Sun, 01 Mar 2009) > New Revision: 29368 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29368&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKe > rnelVolume.cpp > Log: > Missing return. BeOS style add-ons seem to work again (tested with ramfs). BTW, this uninitialized, accidentally positive return value was passed back to the kernel, returned by the mount() hook, crashing vfs.cpp:fs_mount() which does "< B_OK" error checking and thus thought everything went fine. I'd strongly suggest that we do strict error checking ("!= B_OK") in all cases where a status_t is returned. Since no-one returns a positive error code on purpose, a positive value is an obvious indicator that something's not right. Also, since we use FreeBSD code which comes from a system with positive error constants I find that particularly advisable. CU, Ingo From oruizdorantes at mail.berlios.de Sun Mar 1 17:01:41 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Sun, 1 Mar 2009 17:01:41 +0100 Subject: [Haiku-commits] r29369 - haiku/trunk/src/preferences/bluetooth Message-ID: <200903011601.n21G1f7O005547@sheep.berlios.de> Author: oruizdorantes Date: 2009-03-01 17:01:41 +0100 (Sun, 01 Mar 2009) New Revision: 29369 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29369&view=rev Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp haiku/trunk/src/preferences/bluetooth/DeviceListItem.h haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp Log: - Fix gcc4 build(Monni) - Remove Items added to Remote List from inquiry list, this fixes elements being shared among more than 1 list. Both lists behave better now. Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-03-01 15:29:02 UTC (rev 29368) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-03-01 16:01:41 UTC (rev 29369) @@ -27,7 +27,7 @@ } -DeviceListItem::DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi = 0) +DeviceListItem::DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi) : BListItem(), fDevice(NULL), fAddress(bdaddr), Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-03-01 15:29:02 UTC (rev 29368) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-03-01 16:01:41 UTC (rev 29369) @@ -19,7 +19,7 @@ { public: DeviceListItem(BluetoothDevice* bDevice); - DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi = 0); + DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi = 0); ~DeviceListItem(); Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-03-01 15:29:02 UTC (rev 29368) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-03-01 16:01:41 UTC (rev 29369) @@ -184,8 +184,8 @@ { message->PrintToStream(); int32 index = fRemoteList->CurrentSelection(0); - DeviceListItem* item = (DeviceListItem*) fRemoteList->ItemAt(index); - + DeviceListItem* item = (DeviceListItem*) fRemoteList->RemoveItem(index);; + BMessage message(kMsgAddToRemoteList); message.AddPointer("device", item); Modified: haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-03-01 15:29:02 UTC (rev 29368) +++ haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-03-01 16:01:41 UTC (rev 29369) @@ -118,6 +118,7 @@ BListItem* device; msg->FindPointer("device", (void**)&device); fDeviceList->AddItem(device); + fDeviceList->Invalidate(); } break; default: From stippi at mail.berlios.de Sun Mar 1 18:09:48 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 1 Mar 2009 18:09:48 +0100 Subject: [Haiku-commits] r29370 - in haiku/trunk/src/preferences: . bluetooth Message-ID: <200903011709.n21H9mjG017877@sheep.berlios.de> Author: stippi Date: 2009-03-01 18:09:47 +0100 (Sun, 01 Mar 2009) New Revision: 29370 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29370&view=rev Added: haiku/trunk/src/preferences/bluetooth/Jamfile Modified: haiku/trunk/src/preferences/Jamfile Log: Properly integrate the Bluetooth preflet with the build system. Modified: haiku/trunk/src/preferences/Jamfile =================================================================== --- haiku/trunk/src/preferences/Jamfile 2009-03-01 16:01:41 UTC (rev 29369) +++ haiku/trunk/src/preferences/Jamfile 2009-03-01 17:09:47 UTC (rev 29370) @@ -2,6 +2,7 @@ SubInclude HAIKU_TOP src preferences appearance ; SubInclude HAIKU_TOP src preferences backgrounds ; +SubInclude HAIKU_TOP src preferences bluetooth ; SubInclude HAIKU_TOP src preferences cpufrequency ; SubInclude HAIKU_TOP src preferences datatranslations ; SubInclude HAIKU_TOP src preferences devices ; Added: haiku/trunk/src/preferences/bluetooth/Jamfile =================================================================== --- haiku/trunk/src/preferences/bluetooth/Jamfile 2009-03-01 16:01:41 UTC (rev 29369) +++ haiku/trunk/src/preferences/bluetooth/Jamfile 2009-03-01 17:09:47 UTC (rev 29370) @@ -0,0 +1,16 @@ +SubDir HAIKU_TOP src preferences bluetooth ; + +UsePrivateHeaders shared ; + +Preference Bluetooth : + BluetoothDeviceView.cpp + BluetoothMain.cpp + BluetoothSettingsView.cpp + BluetoothWindow.cpp + DeviceListItem.cpp + ExtendedLocalDeviceView.cpp + InquiryPanel.cpp + RemoteDevicesView.cpp + : be libbluetooth.so + ; + From anevilyak at mail.berlios.de Sun Mar 1 18:18:46 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Mar 2009 18:18:46 +0100 Subject: [Haiku-commits] r29371 - haiku/trunk/build/jam Message-ID: <200903011718.n21HIkMn018774@sheep.berlios.de> Author: anevilyak Date: 2009-03-01 18:18:45 +0100 (Sun, 01 Mar 2009) New Revision: 29371 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29371&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Update Vision to version 090301 - changes include various visual tweaks by Stephan Assmus to integrate better with Haiku's updated look. Thanks! Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2009-03-01 17:09:47 UTC (rev 29370) +++ haiku/trunk/build/jam/OptionalPackages 2009-03-01 17:18:45 UTC (rev 29371) @@ -468,19 +468,19 @@ if $(TARGET_ARCH) != x86 { Echo "No optional package Vision available for $(TARGET_ARCH)" ; } else if $(HAIKU_GCC_VERSION[1]) >= 4 { - InstallOptionalHaikuImagePackage Vision-0.9.7-H-25012009-gcc4 - : http://vision.sf.net/Vision-0.9.7-H-25012009-gcc4.zip + InstallOptionalHaikuImagePackage Vision-0.9.7-H-090301-gcc4 + : http://vision.sf.net/Vision-0.9.7-H-090301-gcc4.zip : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/Vision-0.9.7-H-25012009/Vision ; + : /boot/apps/Vision-0.9.7-H-090301/Vision ; } else { - InstallOptionalHaikuImagePackage Vision-0.9.7-H-25012009 - : http://vision.sf.net/Vision-0.9.7-H-25012009.zip + InstallOptionalHaikuImagePackage Vision-0.9.7-H-090301 + : http://vision.sf.net/Vision-0.9.7-H-090301.zip : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/Vision-0.9.7-H-25012009/Vision ; + : /boot/apps/Vision-0.9.7-H-090301/Vision ; } } From mmlr at mail.berlios.de Sun Mar 1 21:56:22 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 1 Mar 2009 21:56:22 +0100 Subject: [Haiku-commits] r29372 - in haiku/trunk: headers/os/media src/kits/media Message-ID: <200903012056.n21KuMuM023247@sheep.berlios.de> Author: mmlr Date: 2009-03-01 21:56:19 +0100 (Sun, 01 Mar 2009) New Revision: 29372 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29372&view=rev Modified: haiku/trunk/headers/os/media/Sound.h haiku/trunk/src/kits/media/Sound.cpp haiku/trunk/src/kits/media/TrackReader.h Log: Rewrote Sound.h and implemented most of BSound. Completely untested yet as the BSoundPlayer functionality is yet missing. Modified: haiku/trunk/headers/os/media/Sound.h =================================================================== --- haiku/trunk/headers/os/media/Sound.h 2009-03-01 17:18:45 UTC (rev 29371) +++ haiku/trunk/headers/os/media/Sound.h 2009-03-01 20:56:19 UTC (rev 29372) @@ -1,114 +1,76 @@ -/* BSound.h */ -/* Copyright 1998 Be Incorporated. All rights reserved. */ +/* + * Copyright 2009, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ -#if !defined(_SOUND_H) +#ifndef _SOUND_H #define _SOUND_H #include -class BMediaFile; -class BSoundFile; +class BFile; class BSoundPlayer; struct entry_ref; namespace BPrivate { class BTrackReader; -} +}; class BSound { public: - BSound( - void * data, - size_t size, - const media_raw_audio_format & format, - bool free_when_done = false); - BSound( - const entry_ref * sound_file, - bool load_into_memory = false); + BSound(void *data, size_t size, + const media_raw_audio_format &format, + bool freeWhenDone = false); + BSound(const entry_ref *soundFile, + bool loadIntoMemory = false); - status_t InitCheck(); - BSound * AcquireRef(); - bool ReleaseRef(); - int32 RefCount() const; // unreliable! + status_t InitCheck(); + BSound * AcquireRef(); + bool ReleaseRef(); + int32 RefCount() const; // unreliable! -virtual bigtime_t Duration() const; -virtual const media_raw_audio_format & Format() const; -virtual const void * Data() const; /* returns NULL for files */ -virtual off_t Size() const; +virtual bigtime_t Duration() const; +virtual const media_raw_audio_format &Format() const; +virtual const void * Data() const; // returns NULL for files +virtual off_t Size() const; -virtual bool GetDataAt( - off_t offset, - void * into_buffer, - size_t buffer_size, - size_t * out_used); +virtual bool GetDataAt(off_t offset, + void *intoBuffer, size_t bufferSize, + size_t *outUsed); protected: + BSound(const media_raw_audio_format &format); +virtual status_t Perform(int32 code, ...); - BSound( - const media_raw_audio_format & format); - -virtual status_t Perform( - int32 code, - ...); - private: +friend class DummyFriend; +virtual ~BSound(); - BSound(const BSound &); // unimplemented - BSound & operator=(const BSound &); // unimplemented - - friend class BSoundPlayer; - friend class _HostApp; - - void Reset(); - -virtual ~BSound(); - - void free_data(); -static status_t load_entry(void * arg); - void loader_thread(); - bool check_stop(); - public: +virtual status_t BindTo(BSoundPlayer *player, + const media_raw_audio_format &format); +virtual status_t UnbindFrom(BSoundPlayer *player); -virtual status_t BindTo( - BSoundPlayer * player, - const media_raw_audio_format & format); -virtual status_t UnbindFrom( - BSoundPlayer * player); - private: - status_t _Reserved_Sound_0(void *); // BindTo - status_t _Reserved_Sound_1(void *); // UnbindFrom -virtual status_t _Reserved_Sound_2(void *); -virtual status_t _Reserved_Sound_3(void *); -virtual status_t _Reserved_Sound_4(void *); -virtual status_t _Reserved_Sound_5(void *); + status_t _Reserved_Sound_0(void *); // BindTo + status_t _Reserved_Sound_1(void *); // UnbindFrom +virtual status_t _Reserved_Sound_2(void *); +virtual status_t _Reserved_Sound_3(void *); +virtual status_t _Reserved_Sound_4(void *); +virtual status_t _Reserved_Sound_5(void *); - void * _m_data; - BMediaFile * _m_file; - int32 _m_ref_count; - status_t _m_error; - size_t _m_size; - media_raw_audio_format _m_format; - bool _m_free_when_done; - bool _m_checkStopped; - bool _m_reserved[2]; - area_id _m_area; - sem_id _m_avail_sem; - sem_id _m_free_sem; - thread_id _m_loader_thread; - size_t _m_read_pos; - sem_id _m_check_token; - int32 _m_prev_sem_count; + void * fData; + size_t fDataSize; + BFile * fFile; + int32 fRefCount; + status_t fStatus; + media_raw_audio_format fFormat; - BSoundPlayer * _m_bound_player; - int32 _m_bind_flags; + bool fFreeWhenDone; + bool fReserved[3]; - BPrivate::BTrackReader * _m_trackReader; - char m_tname[32]; - uint32 _reserved_[1]; - + BPrivate::BTrackReader *fTrackReader; + uint32 fReserved2[18]; }; - -#endif /* _SOUND_H */ +#endif // _SOUND_H Modified: haiku/trunk/src/kits/media/Sound.cpp =================================================================== --- haiku/trunk/src/kits/media/Sound.cpp 2009-03-01 17:18:45 UTC (rev 29371) +++ haiku/trunk/src/kits/media/Sound.cpp 2009-03-01 20:56:19 UTC (rev 29372) @@ -1,182 +1,252 @@ -/*********************************************************************** - * AUTHOR: Marcus Overhagen - * FILE: Sound.cpp - * DESCR: - ***********************************************************************/ +/* + * Copyright 2009, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Marcus Overhagen + * Michael Lotz + */ #include -#include "debug.h" +#include -/************************************************************* - * public BSound - *************************************************************/ +#include "TrackReader.h" -BSound::BSound( void * data, - size_t size, - const media_raw_audio_format & format, - bool free_when_done) +#include +#include +#include + + +BSound::BSound(void *data, size_t size, const media_raw_audio_format &format, + bool freeWhenDone) + : fData(data), + fDataSize(size), + fFile(NULL), + fRefCount(1), + fStatus(B_NO_INIT), + fFormat(format), + fFreeWhenDone(freeWhenDone), + fTrackReader(NULL) { - UNIMPLEMENTED(); + if (fData == NULL) + return; + + fStatus = B_OK; } -BSound::BSound( const entry_ref * sound_file, - bool load_into_memory) + +BSound::BSound(const entry_ref *soundFile, bool loadIntoMemory) + : fData(NULL), + fDataSize(0), + fFile(new(std::nothrow) BFile(soundFile, B_READ_ONLY)), + fRefCount(1), + fStatus(B_NO_INIT), + fFreeWhenDone(false), + fTrackReader(NULL) { - UNIMPLEMENTED(); + if (fFile == NULL) { + fStatus = B_NO_MEMORY; + return; + } + + fStatus = fFile->InitCheck(); + if (fStatus != B_OK) + return; + + memset(&fFormat, 0, sizeof(fFormat)); + fTrackReader = new(std::nothrow) BPrivate::BTrackReader(fFile, fFormat); + if (fTrackReader == NULL) { + fStatus = B_NO_MEMORY; + return; + } + + fStatus = fTrackReader->InitCheck(); + if (fStatus != B_OK) + return; + + fFormat = fTrackReader->Format(); + fStatus = B_OK; } -status_t -BSound::InitCheck() + +BSound::BSound(const media_raw_audio_format &format) + : fData(NULL), + fDataSize(0), + fFile(NULL), + fRefCount(1), + fStatus(B_ERROR), + fFormat(format), + fFreeWhenDone(false), + fTrackReader(NULL) { + // unimplemented protected constructor UNIMPLEMENTED(); +} - return B_ERROR; + +BSound::~BSound() +{ + delete fTrackReader; + delete fFile; + + if (fFreeWhenDone) + free(fData); } -BSound * + +status_t +BSound::InitCheck() +{ + return fStatus; +} + + +BSound * BSound::AcquireRef() { - UNIMPLEMENTED(); - return NULL; + atomic_add(&fRefCount, 1); + return this; } -bool +bool BSound::ReleaseRef() { - UNIMPLEMENTED(); - return false; + if (atomic_add(&fRefCount, -1) == 1) { + delete this; + return false; + } + + // TODO: verify those returns + return true; } -int32 + +int32 BSound::RefCount() const { - UNIMPLEMENTED(); - return 0; -} // unreliable! + return fRefCount; +} -/* virtual */ bigtime_t + +bigtime_t BSound::Duration() const { UNIMPLEMENTED(); return 0; } -/* virtual */ const media_raw_audio_format & + +const media_raw_audio_format & BSound::Format() const { - UNIMPLEMENTED(); - return _m_format; + return fFormat; } -/* virtual */ const void * + +const void * BSound::Data() const { - UNIMPLEMENTED(); - return NULL; -} /* returns NULL for files */ + return fData; +} -/* virtual */ off_t + +off_t BSound::Size() const { - UNIMPLEMENTED(); - return 0; -} + if (fFile != NULL) { + off_t result = 0; + fFile->GetSize(&result); + return result; + } -/* virtual */ bool -BSound::GetDataAt(off_t offset, - void * into_buffer, - size_t buffer_size, - size_t * out_used) -{ - UNIMPLEMENTED(); - return false; + return fDataSize; } -/************************************************************* - * protected BSound - *************************************************************/ -BSound::BSound(const media_raw_audio_format & format) +bool +BSound::GetDataAt(off_t offset, void *intoBuffer, size_t bufferSize, + size_t *outUsed) { - UNIMPLEMENTED(); -} + if (intoBuffer == NULL) + return false; -/* virtual */ status_t -BSound::Perform(int32 code,...) -{ - UNIMPLEMENTED(); - return B_ERROR; -} + if (fData != NULL) { + size_t copySize = MIN(bufferSize, fDataSize - offset); + memcpy(intoBuffer, (uint8 *)fData + offset, copySize); + if (outUsed != NULL) + *outUsed = copySize; + return true; + } -/************************************************************* - * private BSound - *************************************************************/ + if (fTrackReader != NULL) { + int32 frameSize = fTrackReader->FrameSize(); + int64 frameCount = fTrackReader->CountFrames(); + int64 startFrame = offset / frameSize; + if (startFrame > frameCount) + return false; -/* -BSound::BSound(const BSound &); // unimplemented -BSound & BSound::operator=(const BSound &); // unimplemented -*/ + if (fTrackReader->SeekToFrame(&startFrame) != B_OK) + return false; -void -BSound::Reset() -{ - UNIMPLEMENTED(); -} + off_t bufferOffset = offset - startFrame * frameSize; + int64 directStartFrame = (offset + frameSize - 1) / frameSize; + int64 directFrameCount = (offset + bufferSize - directStartFrame + * frameSize) / frameSize; -/* virtual */ -BSound::~BSound() -{ - UNIMPLEMENTED(); -} + if (bufferOffset != 0) { + int64 indirectFrameCount = directStartFrame - startFrame; + size_t indirectSize = indirectFrameCount * frameSize; + void *buffer = malloc(indirectSize); + if (buffer == NULL) + return false; -void -BSound::free_data() -{ - UNIMPLEMENTED(); -} + if (fTrackReader->ReadFrames(buffer, indirectFrameCount) != B_OK) + return false; -/* static */ status_t -BSound::load_entry(void * arg) -{ - UNIMPLEMENTED(); - return B_ERROR; -} + memcpy(intoBuffer, (uint8 *)buffer + bufferOffset, + indirectSize - bufferOffset); + if (outUsed != NULL) + *outUsed = indirectSize - bufferOffset; + } else if (outUsed != NULL) + *outUsed = 0; -void -BSound::loader_thread() -{ - UNIMPLEMENTED(); + if (fTrackReader->ReadFrames((uint8 *)intoBuffer + bufferOffset, + directFrameCount) != B_OK) + return false; + + if (outUsed != NULL) + *outUsed += directFrameCount * frameSize; + + return true; + } + + return false; } -bool -BSound::check_stop() + +status_t +BSound::BindTo(BSoundPlayer *player, const media_raw_audio_format &format) { UNIMPLEMENTED(); - return false; + return B_ERROR; } -/************************************************************* - * public BSound - *************************************************************/ -/* virtual */ status_t -BSound::BindTo(BSoundPlayer * player, - const media_raw_audio_format & format) +status_t +BSound::UnbindFrom(BSoundPlayer *player) { UNIMPLEMENTED(); return B_ERROR; } -/* virtual */ status_t -BSound::UnbindFrom(BSoundPlayer * player) + +status_t +BSound::Perform(int32 code, ...) { UNIMPLEMENTED(); return B_ERROR; } -/************************************************************* - * private BSound - *************************************************************/ status_t BSound::_Reserved_Sound_0(void *) { return B_ERROR; } status_t BSound::_Reserved_Sound_1(void *) { return B_ERROR; } @@ -184,4 +254,3 @@ status_t BSound::_Reserved_Sound_3(void *) { return B_ERROR; } status_t BSound::_Reserved_Sound_4(void *) { return B_ERROR; } status_t BSound::_Reserved_Sound_5(void *) { return B_ERROR; } - Modified: haiku/trunk/src/kits/media/TrackReader.h =================================================================== --- haiku/trunk/src/kits/media/TrackReader.h 2009-03-01 17:18:45 UTC (rev 29371) +++ haiku/trunk/src/kits/media/TrackReader.h 2009-03-01 20:56:19 UTC (rev 29372) @@ -8,6 +8,8 @@ #if !defined(_TRACK_READER_H_) #define _TRACK_READER_H_ +#include + namespace BPrivate { From mmlr at mail.berlios.de Sun Mar 1 21:57:26 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 1 Mar 2009 21:57:26 +0100 Subject: [Haiku-commits] r29373 - haiku/trunk/src/kits/media Message-ID: <200903012057.n21KvQL3023527@sheep.berlios.de> Author: mmlr Date: 2009-03-01 21:57:24 +0100 (Sun, 01 Mar 2009) New Revision: 29373 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29373&view=rev Modified: haiku/trunk/src/kits/media/TrackReader.cpp Log: When searching for audio tracks, we are interested in a raw decoded format, not a raw encoded format. Modified: haiku/trunk/src/kits/media/TrackReader.cpp =================================================================== --- haiku/trunk/src/kits/media/TrackReader.cpp 2009-03-01 20:56:19 UTC (rev 29372) +++ haiku/trunk/src/kits/media/TrackReader.cpp 2009-03-01 20:57:24 UTC (rev 29373) @@ -102,7 +102,7 @@ if (track == 0 || track->InitCheck() != B_OK) continue; media_format fmt; - if (track->EncodedFormat(&fmt) != B_OK) + if (track->DecodedFormat(&fmt) != B_OK) continue; if (fmt.type == B_MEDIA_RAW_AUDIO) { audiotrack = track; From mmlr at mail.berlios.de Mon Mar 2 00:22:33 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 2 Mar 2009 00:22:33 +0100 Subject: [Haiku-commits] r29374 - in haiku/trunk: headers/os/media src/kits/media Message-ID: <200903012322.n21NMXfo005109@sheep.berlios.de> Author: mmlr Date: 2009-03-02 00:22:30 +0100 (Mon, 02 Mar 2009) New Revision: 29374 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29374&view=rev Modified: haiku/trunk/headers/os/media/SoundPlayer.h haiku/trunk/src/kits/media/Sound.cpp haiku/trunk/src/kits/media/SoundPlayer.cpp Log: * Implement basic support for the BSound parts of BSoundPlayer. Only one sound at a time is supported and volume as well as start time are not taken into account. For reasons I don't feel like investigating right now all the BMediaTrack calls in the BTrackReader end up as pure virtual function calls though, so it's unusable for now. * Fix leaking the temporary buffer in BSound. * Whitespace cleanup. Modified: haiku/trunk/headers/os/media/SoundPlayer.h =================================================================== --- haiku/trunk/headers/os/media/SoundPlayer.h 2009-03-01 20:57:24 UTC (rev 29373) +++ haiku/trunk/headers/os/media/SoundPlayer.h 2009-03-01 23:22:30 UTC (rev 29374) @@ -123,6 +123,8 @@ status_t in_error); private: +static void _SoundPlayBufferFunc(void *cookie, void *buffer, size_t size, + const media_raw_audio_format &format); virtual status_t _Reserved_SoundPlayer_0(void *, ...); virtual status_t _Reserved_SoundPlayer_1(void *, ...); @@ -134,16 +136,19 @@ virtual status_t _Reserved_SoundPlayer_7(void *, ...); _SoundPlayNode * fPlayerNode; + struct _playing_sound { - _playing_sound * next; - off_t cur_offset; - BSound * sound; + _playing_sound *next; + off_t current_offset; + BSound *sound; play_id id; int32 delta; int32 rate; + sem_id wait_sem; float volume; }; - _playing_sound * _m_sounds; + _playing_sound *fPlayingSounds; + struct _waiting_sound { _waiting_sound * next; bigtime_t start_time; @@ -152,7 +157,8 @@ int32 rate; float volume; }; - _waiting_sound * _m_waiting; + _waiting_sound *fWaitingSounds; + void (*fPlayBufferFunc)(void * cookie, void * buffer, size_t size, const media_raw_audio_format & format); void (*fNotifierFunc)(void * cookie, sound_player_notification what, ...); BLocker fLocker; Modified: haiku/trunk/src/kits/media/Sound.cpp =================================================================== --- haiku/trunk/src/kits/media/Sound.cpp 2009-03-01 20:57:24 UTC (rev 29373) +++ haiku/trunk/src/kits/media/Sound.cpp 2009-03-01 23:22:30 UTC (rev 29374) @@ -207,6 +207,8 @@ indirectSize - bufferOffset); if (outUsed != NULL) *outUsed = indirectSize - bufferOffset; + + free(buffer); } else if (outUsed != NULL) *outUsed = 0; Modified: haiku/trunk/src/kits/media/SoundPlayer.cpp =================================================================== --- haiku/trunk/src/kits/media/SoundPlayer.cpp 2009-03-01 20:57:24 UTC (rev 29373) +++ haiku/trunk/src/kits/media/SoundPlayer.cpp 2009-03-01 23:22:30 UTC (rev 29374) @@ -1,11 +1,12 @@ /*********************************************************************** * AUTHOR: Marcus Overhagen, J?r?me Duval * FILE: SoundPlayer.cpp - * DESCR: + * DESCR: ***********************************************************************/ #include #include #include +#include #include #include @@ -24,6 +25,9 @@ }; +static BSoundPlayer::play_id sCurrentPlayID = 1; + + /************************************************************* * public BSoundPlayer *************************************************************/ @@ -44,7 +48,7 @@ } -BSoundPlayer::BSoundPlayer(const media_raw_audio_format * format, +BSoundPlayer::BSoundPlayer(const media_raw_audio_format * format, const char * name, void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format), void (*Notifier)(void *, sound_player_notification what, ...), @@ -77,9 +81,9 @@ void * cookie) { CALLED(); - + TRACE("BSoundPlayer::BSoundPlayer: multi audio format constructor used\n"); - + if ((toNode.kind & B_BUFFER_CONSUMER) == 0) debugger("BSoundPlayer: toNode must have B_BUFFER_CONSUMER kind!\n"); @@ -99,9 +103,9 @@ *************************************************************/ -void +void BSoundPlayer::Init( const media_node * node, - const media_multi_audio_format * format, + const media_multi_audio_format * format, const char * name, const media_input * input, void (*PlayBuffer)(void *, void * buffer, size_t size, const media_raw_audio_format & format), @@ -109,21 +113,26 @@ void * cookie) { CALLED(); - _m_sounds = NULL; // unused - _m_waiting = NULL; // unused + fPlayingSounds = NULL; + fWaitingSounds = NULL; fPlayerNode = NULL; fPlayBufferFunc = PlayBuffer; + if (fPlayBufferFunc == NULL) { + fPlayBufferFunc = _SoundPlayBufferFunc; + fCookie = this; + } else + fCookie = cookie; + fNotifierFunc = Notifier; fVolumeDB = 0.0f; - fCookie = cookie; fFlags = 0; fInitStatus = B_ERROR; fParameterWeb = NULL; fVolumeSlider = NULL; fLastVolumeUpdate = 0; - status_t err; + status_t err; media_node timeSource; media_node inputNode; media_output _output; @@ -159,7 +168,7 @@ TRACE("BSoundPlayer::Init: Couldn't RegisterNode\n"); goto the_end; } - + // set the producer's time source to be the "default" time source, // which the system audio mixer uses too. err = roster->GetTimeSource(&timeSource); @@ -172,7 +181,7 @@ TRACE("BSoundPlayer::Init: Couldn't SetTimeSourceFor\n"); goto the_end; } - + // find a free media_input if (!input) { err = roster->GetFreeInputsFor(inputNode, &_input, 1, &inputCount, B_MEDIA_RAW_AUDIO); @@ -211,7 +220,7 @@ // setup our requested format (can still have many wildcards) tryFormat.type = B_MEDIA_RAW_AUDIO; tryFormat.u.raw_audio = *format; - + #if DEBUG > 0 char buf[100]; string_for_format(tryFormat, buf, sizeof(buf)); @@ -226,9 +235,9 @@ } fFlags |= F_NODES_CONNECTED; - + get_volume_slider(); - + TRACE("BSoundPlayer node %ld has timesource %ld\n", fPlayerNode->Node().node, fPlayerNode->TimeSource()->Node().node); the_end: @@ -264,18 +273,18 @@ // So, we just disconnect from it, and release our references to the nodes that // we're using. We *are* supposed to do that even for global nodes like the Mixer. err = roster->Disconnect(fMediaOutput, fMediaInput); -#if DEBUG >0 +#if DEBUG >0 if (err) { TRACE("BSoundPlayer::~BSoundPlayer: Error disconnecting nodes: %ld (%s)\n", err, strerror(err)); } #endif } - + if (fFlags & F_MUST_RELEASE_MIXER) { // Release the mixer as it was acquired // through BMediaRoster::GetAudioMixer() err = roster->ReleaseNode(fMediaInput.node); -#if DEBUG >0 +#if DEBUG >0 if (err) { TRACE("BSoundPlayer::~BSoundPlayer: Error releasing input node: %ld (%s)\n", err, strerror(err)); } @@ -283,7 +292,7 @@ } cleanup: - + // Dispose of the player node if (fPlayerNode) { // We do not call BMediaRoster::ReleaseNode(), since @@ -325,7 +334,7 @@ if ((fFlags & F_NODES_CONNECTED) == 0) return B_NO_INIT; - + if (fFlags & F_IS_STARTED) return B_OK; @@ -340,11 +349,11 @@ fPlayerNode->TimeSource()->RealTime()); } - // Add latency and a few ms to the nodes current time to + // Add latency and a few ms to the nodes current time to // make sure that we give the producer enough time to run // buffers through the node chain, otherwise it'll start // up already late - + status_t err = roster->StartNode(fPlayerNode->Node(), fPlayerNode->TimeSource()->Now() + Latency() + 5000); if (err != B_OK) { TRACE("BSoundPlayer::Start: StartNode failed, %ld", err); @@ -353,10 +362,10 @@ if (fNotifierFunc) fNotifierFunc(fCookie, B_STARTED, this); - + SetHasData(true); atomic_or(&fFlags, F_IS_STARTED); - + return B_OK; } @@ -381,21 +390,21 @@ TRACE("BSoundPlayer::Stop: Couldn't get BMediaRoster\n"); return; } - + roster->StopNode(fPlayerNode->Node(), 0, true); - + atomic_and(&fFlags, ~F_IS_STARTED); } - + if (block) { // wait until the node is stopped int maxtrys; for (maxtrys = 250; fPlayerNode->IsPlaying() && maxtrys != 0; maxtrys--) snooze(2000); - + DEBUG_ONLY(if (maxtrys == 0) TRACE("BSoundPlayer::Stop: waiting for node stop failed\n")); - - // wait until all buffers on the way to the physical output have been played + + // wait until all buffers on the way to the physical output have been played snooze(Latency() + 2000); } @@ -409,7 +418,7 @@ BSoundPlayer::Latency() { CALLED(); - + if ((fFlags & F_NODES_CONNECTED) == 0) return 0; @@ -418,7 +427,7 @@ TRACE("BSoundPlayer::Latency: Couldn't get BMediaRoster\n"); return 0; } - + bigtime_t latency; status_t err = roster->GetLatencyFor(fMediaOutput.node, &latency); if (err != B_OK) { @@ -560,70 +569,155 @@ TRACE("BSoundPlayer::Preroll: Couldn't get BMediaRoster\n"); return B_ERROR; } - + status_t err = roster->PrerollNode(fMediaOutput.node); if (err != B_OK) { TRACE("BSoundPlayer::Preroll: Error while PrerollNode: %ld (%s)\n", err, strerror(err)); return err; } - + return B_OK; } BSoundPlayer::play_id -BSoundPlayer::StartPlaying(BSound *sound, - bigtime_t at_time) +BSoundPlayer::StartPlaying(BSound *sound, bigtime_t atTime) { - UNIMPLEMENTED(); - return 1; + return StartPlaying(sound, atTime, 1.0); } - + BSoundPlayer::play_id -BSoundPlayer::StartPlaying(BSound *sound, - bigtime_t at_time, - float with_volume) +BSoundPlayer::StartPlaying(BSound *sound, bigtime_t atTime, float withVolume) { - UNIMPLEMENTED(); - return 1; + CALLED(); + + // TODO: support the at_time and with_volume parameters + _playing_sound *item = (_playing_sound *)malloc(sizeof(_playing_sound)); + if (item == NULL) + return B_NO_MEMORY; + + item->current_offset = 0; + item->sound = sound; + item->id = atomic_add(&sCurrentPlayID, 1); + item->delta = 0; + item->rate = 0; + item->volume = withVolume; + + if (!fLocker.Lock()) { + free(item); + return B_ERROR; + } + + item->next = fPlayingSounds; + fPlayingSounds = item; + fLocker.Unlock(); + + SetHasData(true); + return item->id; } status_t -BSoundPlayer::SetSoundVolume(play_id sound, - float new_volume) +BSoundPlayer::SetSoundVolume(play_id id, float newVolume) { - UNIMPLEMENTED(); + CALLED(); + if (!fLocker.Lock()) + return B_ERROR; - return B_OK; + _playing_sound *item = fPlayingSounds; + while (item) { + if (item->id == id) { + item->volume = newVolume; + fLocker.Unlock(); + return B_OK; + } + + item = item->next; + } + + fLocker.Unlock(); + return B_ENTRY_NOT_FOUND; } bool BSoundPlayer::IsPlaying(play_id id) { - UNIMPLEMENTED(); + CALLED(); + if (!fLocker.Lock()) + return B_ERROR; - return true; + _playing_sound *item = fPlayingSounds; + while (item) { + if (item->id == id) { + fLocker.Unlock(); + return true; + } + + item = item->next; + } + + fLocker.Unlock(); + return false; } status_t BSoundPlayer::StopPlaying(play_id id) { - UNIMPLEMENTED(); + CALLED(); + if (!fLocker.Lock()) + return B_ERROR; - return B_OK; + _playing_sound **link = &fPlayingSounds; + _playing_sound *item = fPlayingSounds; + while (item) { + if (item->id == id) { + *link = item->next; + sem_id waitSem = item->wait_sem; + free(item); + fLocker.Unlock(); + + NotifySoundDone(id, true); + if (waitSem >= 0) + release_sem(waitSem); + + return B_OK; + } + + link = &item->next; + item = item->next; + } + + fLocker.Unlock(); + return B_ENTRY_NOT_FOUND; } status_t BSoundPlayer::WaitForSound(play_id id) { - UNIMPLEMENTED(); + CALLED(); + if (!fLocker.Lock()) + return B_ERROR; - return B_OK; + _playing_sound *item = fPlayingSounds; + while (item) { + if (item->id == id) { + sem_id waitSem = item->wait_sem; + if (waitSem < 0) + waitSem = item->wait_sem = create_sem(0, "wait for sound"); + + fLocker.Unlock(); + return acquire_sem(waitSem); + } + + item = item->next; + } + + fLocker.Unlock(); + return B_ENTRY_NOT_FOUND; } @@ -631,7 +725,6 @@ BSoundPlayer::Volume() { CALLED(); - return pow(10.0, VolumeDB(true) / 20.0); } @@ -650,17 +743,17 @@ CALLED(); if (!fVolumeSlider) return -94.0f; // silence - + if (!forcePoll && (system_time() - fLastVolumeUpdate < 500000)) return fVolumeDB; - - int32 count = fVolumeSlider->CountChannels(); + + int32 count = fVolumeSlider->CountChannels(); float values[count]; size_t size = count * sizeof(float); fVolumeSlider->GetValue(&values, &size, NULL); fLastVolumeUpdate = system_time(); fVolumeDB = values[0]; - + return values[0]; } @@ -671,7 +764,7 @@ CALLED(); if (!fVolumeSlider) return; - + float min_dB = fVolumeSlider->MinValue(); float max_dB = fVolumeSlider->MaxValue(); if (volume_dB < min_dB) @@ -679,7 +772,7 @@ if (volume_dB > max_dB) volume_dB = max_dB; - int count = fVolumeSlider->CountChannels(); + int count = fVolumeSlider->CountChannels(); float values[count]; for (int i = 0; i < count; i++) values[i] = volume_dB; @@ -699,7 +792,7 @@ CALLED(); if (!fVolumeSlider) return B_NO_INIT; - + if (out_node) *out_node = fMediaInput.node; if (out_parameter_id) @@ -730,6 +823,42 @@ * private BSoundPlayer *************************************************************/ +void +BSoundPlayer::_SoundPlayBufferFunc(void *cookie, void *buffer, size_t size, + const media_raw_audio_format &format) +{ + // TODO: support more than one sound and make use of the format parameter + BSoundPlayer *player = (BSoundPlayer *)cookie; + if (!player->fLocker.Lock()) { + memset(buffer, 0, size); + return; + } + + _playing_sound *sound = player->fPlayingSounds; + if (sound == NULL) { + player->SetHasData(false); + player->fLocker.Unlock(); + memset(buffer, 0, size); + return; + } + + size_t used = 0; + if (!sound->sound->GetDataAt(sound->current_offset, buffer, size, &used)) { + // will take care of removing the item and notifying others + player->StopPlaying(sound->id); + player->fLocker.Unlock(); + memset(buffer, 0, size); + return; + } + + sound->current_offset += used; + player->fLocker.Unlock(); + + if (used < size) + memset((uint8 *)buffer + used, 0, size - used); +} + + status_t BSoundPlayer::_Reserved_SoundPlayer_0(void *, ...) { return B_ERROR; } status_t BSoundPlayer::_Reserved_SoundPlayer_1(void *, ...) { return B_ERROR; } status_t BSoundPlayer::_Reserved_SoundPlayer_2(void *, ...) { return B_ERROR; } @@ -741,10 +870,10 @@ void -BSoundPlayer::NotifySoundDone(play_id sound, - bool got_to_play) +BSoundPlayer::NotifySoundDone(play_id id, bool gotToPlay) { - UNIMPLEMENTED(); + CALLED(); + Notify(B_SOUND_DONE, id, gotToPlay); } @@ -754,13 +883,13 @@ CALLED(); ASSERT(fVolumeSlider == NULL); - + BMediaRoster *roster = BMediaRoster::CurrentRoster(); if (!roster) { TRACE("BSoundPlayer::get_volume_slider failed to get BMediaRoster"); return; } - + if (!fParameterWeb && roster->GetParameterWebFor(fMediaInput.node, &fParameterWeb) < B_OK) { TRACE("BSoundPlayer::get_volume_slider couldn't get parameter web"); return; @@ -776,10 +905,10 @@ if (strcmp(parameter->Kind(), B_GAIN) != 0) continue; fVolumeSlider = (BContinuousParameter *)parameter; - break; + break; } -#if DEBUG >0 +#if DEBUG >0 if (!fVolumeSlider) { TRACE("BSoundPlayer::get_volume_slider couldn't find volume control"); } From bonefish at mail.berlios.de Mon Mar 2 01:26:24 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 2 Mar 2009 01:26:24 +0100 Subject: [Haiku-commits] r29375 - in haiku/trunk: headers/private/kernel src/system/kernel src/system/kernel/fs Message-ID: <200903020026.n220QO8Q009632@sheep.berlios.de> Author: bonefish Date: 2009-03-02 01:26:22 +0100 (Mon, 02 Mar 2009) New Revision: 29375 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29375&view=rev Modified: haiku/trunk/headers/private/kernel/team.h haiku/trunk/headers/private/kernel/thread_types.h haiku/trunk/headers/private/kernel/usergroup.h haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/team.cpp haiku/trunk/src/system/kernel/usergroup.cpp Log: * Introduced ref-counting for the I/O contexts. * The I/O context related vfs_*() functions have io_context* instead of void* parameters/return values, now. * vfs_new_io_context(): Lock the parent I/O context before getting its table size. Otherwise the table size could change until we do. * vfs_resize_fd_table(): Fixed use of MutexLocker. We created only a temporary object, not one with function scope. * Renamed load_image_etc() to load_image_internal() and added a parameter for specifying the parent team of the one to create. * Introduced a kernel private load_image_etc() with a few more arguments than load_image(). Modified: haiku/trunk/headers/private/kernel/team.h =================================================================== --- haiku/trunk/headers/private/kernel/team.h 2009-03-01 23:22:30 UTC (rev 29374) +++ haiku/trunk/headers/private/kernel/team.h 2009-03-02 00:26:22 UTC (rev 29375) @@ -14,8 +14,6 @@ #endif status_t team_init(struct kernel_args *args); -team_id team_create_team(const char *path, const char *name, char **args, - int argc, char **envp, int envc, int priority); status_t wait_for_team(team_id id, status_t *returnCode); void team_remove_team(struct team *team); void team_delete_team(struct team *team); @@ -36,6 +34,9 @@ int32 team_max_teams(void); int32 team_used_teams(void); +thread_id load_image_etc(int32 argCount, const char* const* args, + const char* const* env, int32 priority, team_id parentID, uint32 flags); + void team_set_job_control_state(struct team* team, job_control_state newState, int signal, bool threadsLocked); void team_set_controlling_tty(int32 index); Modified: haiku/trunk/headers/private/kernel/thread_types.h =================================================================== --- haiku/trunk/headers/private/kernel/thread_types.h 2009-03-01 23:22:30 UTC (rev 29374) +++ haiku/trunk/headers/private/kernel/thread_types.h 2009-03-02 00:26:22 UTC (rev 29375) @@ -54,6 +54,7 @@ struct image; // defined in image.c +struct io_context; struct realtime_sem_context; // defined in realtime_sem.cpp struct select_info; struct user_thread; // defined in libroot/user_thread.h @@ -172,7 +173,7 @@ int num_threads; // number of threads in this team int state; // current team state, see above int32 flags; - void *io_context; + struct io_context *io_context; struct realtime_sem_context *realtime_sem_context; struct xsi_sem_context *xsi_sem_context; sem_id death_sem; // semaphore to wait on for dying threads Modified: haiku/trunk/headers/private/kernel/usergroup.h =================================================================== --- haiku/trunk/headers/private/kernel/usergroup.h 2009-03-01 23:22:30 UTC (rev 29374) +++ haiku/trunk/headers/private/kernel/usergroup.h 2009-03-02 00:26:22 UTC (rev 29375) @@ -21,6 +21,8 @@ void inherit_parent_user_and_group(struct team* team, struct team* parent); +void inherit_parent_user_and_group_locked(struct team* team, + struct team* parent); status_t update_set_id_user_and_group(struct team* team, const char* file); // syscalls Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2009-03-01 23:22:30 UTC (rev 29374) +++ haiku/trunk/headers/private/kernel/vfs.h 2009-03-02 00:26:22 UTC (rev 29375) @@ -46,6 +46,7 @@ struct vnode *root; struct vnode *cwd; mutex io_mutex; + int32 ref_count; uint32 table_size; uint32 num_used_fds; struct file_descriptor **fds; @@ -69,9 +70,10 @@ status_t vfs_init(struct kernel_args *args); status_t vfs_bootstrap_file_systems(void); void vfs_mount_boot_file_system(struct kernel_args *args); -void vfs_exec_io_context(void *context); -void *vfs_new_io_context(void *parentContext); -status_t vfs_free_io_context(void *context); +void vfs_exec_io_context(io_context *context); +io_context *vfs_new_io_context(io_context *parentContext); +void vfs_get_io_context(io_context *context); +void vfs_put_io_context(io_context *context); struct rlimit; int vfs_getrlimit(int resource, struct rlimit * rlp); Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-03-01 23:22:30 UTC (rev 29374) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-03-02 00:26:22 UTC (rev 29375) @@ -4595,9 +4595,8 @@ have the O_CLOEXEC flag set. */ void -vfs_exec_io_context(void* _context) +vfs_exec_io_context(io_context* context) { - struct io_context* context = (struct io_context*)_context; uint32 i; for (i = 0; i < context->table_size; i++) { @@ -4626,23 +4625,24 @@ /*! Sets up a new io_control structure, and inherits the properties of the parent io_control if it is given. */ -void* -vfs_new_io_context(void* _parentContext) +io_context* +vfs_new_io_context(io_context* parentContext) { size_t tableSize; struct io_context* context; - struct io_context* parentContext; context = (io_context*)malloc(sizeof(struct io_context)); if (context == NULL) return NULL; memset(context, 0, sizeof(struct io_context)); + context->ref_count = 1; - parentContext = (struct io_context*)_parentContext; - if (parentContext) + MutexLocker parentLocker; + if (parentContext) { + parentLocker.SetTo(parentContext->io_mutex, false); tableSize = parentContext->table_size; - else + } else tableSize = DEFAULT_FD_TABLE_SIZE; // allocate space for FDs and their close-on-exec flag @@ -4669,8 +4669,6 @@ if (parentContext) { size_t i; - mutex_lock(&parentContext->io_mutex); - mutex_lock(&sIOContextRootLock); context->root = parentContext->root; if (context->root) @@ -4695,7 +4693,7 @@ } } - mutex_unlock(&parentContext->io_mutex); + parentLocker.Unlock(); } else { context->root = sRoot; context->cwd = sRoot; @@ -4716,10 +4714,9 @@ } -status_t -vfs_free_io_context(void* _ioContext) +static status_t +vfs_free_io_context(io_context* context) { - struct io_context* context = (struct io_context*)_ioContext; uint32 i; if (context->root) @@ -4747,13 +4744,26 @@ } +void vfs_get_io_context(io_context *context) +{ + atomic_add(&context->ref_count, 1); +} + + +void vfs_put_io_context(io_context *context) +{ + if (atomic_add(&context->ref_count, -1) == 1) + vfs_free_io_context(context); +} + + static status_t vfs_resize_fd_table(struct io_context* context, const int newSize) { if (newSize <= 0 || newSize > MAX_FD_TABLE_SIZE) return EINVAL; - MutexLocker(context->io_mutex); + MutexLocker _(context->io_mutex); int oldSize = context->table_size; int oldCloseOnExitBitmapSize = (oldSize + 7) / 8; Modified: haiku/trunk/src/system/kernel/team.cpp =================================================================== --- haiku/trunk/src/system/kernel/team.cpp 2009-03-01 23:22:30 UTC (rev 29374) +++ haiku/trunk/src/system/kernel/team.cpp 2009-03-02 00:26:22 UTC (rev 29375) @@ -1085,37 +1085,33 @@ } -/*! The BeOS kernel exports a function with this name, but most probably with - different parameters; we should not make it public. -*/ static thread_id -load_image_etc(char**& _flatArgs, size_t flatArgsSize, int32 argCount, - int32 envCount, int32 priority, uint32 flags, port_id errorPort, - uint32 errorToken) +load_image_internal(char**& _flatArgs, size_t flatArgsSize, int32 argCount, + int32 envCount, int32 priority, team_id parentID, uint32 flags, + port_id errorPort, uint32 errorToken) { char** flatArgs = _flatArgs; - struct team *team, *parent; + struct team *team; const char *threadName; thread_id thread; status_t status; cpu_status state; struct team_arg *teamArgs; struct team_loading_info loadingInfo; + io_context* parentIOContext = NULL; if (flatArgs == NULL || argCount == 0) return B_BAD_VALUE; const char* path = flatArgs[0]; - TRACE(("load_image_etc: name '%s', args = %p, argCount = %ld\n", + TRACE(("load_image_internal: name '%s', args = %p, argCount = %ld\n", path, flatArgs, argCount)); team = create_team_struct(path, false); if (team == NULL) return B_NO_MEMORY; - parent = thread_get_current_thread()->team; - if (flags & B_WAIT_TILL_LOADED) { loadingInfo.thread = thread_get_current_thread(); loadingInfo.result = B_ERROR; @@ -1123,22 +1119,39 @@ team->loading_info = &loadingInfo; } - // Inherit the parent's user/group, but also check the executable's - // set-user/group-id permission - inherit_parent_user_and_group(team, parent); - update_set_id_user_and_group(team, path); + InterruptsSpinLocker teamLocker(gTeamSpinlock); - state = disable_interrupts(); - GRAB_TEAM_LOCK(); + // get the parent team + struct team* parent; + if (parentID == B_CURRENT_TEAM) + parent = thread_get_current_thread()->team; + else + parent = team_get_team_struct_locked(parentID); + + if (parent == NULL) { + teamLocker.Unlock(); + status = B_BAD_TEAM_ID; + goto err0; + } + + // inherit the parent's user/group + inherit_parent_user_and_group_locked(team, parent); + hash_insert(sTeamHash, team); insert_team_into_parent(parent, team); insert_team_into_group(parent->group, team); sUsedTeams++; - RELEASE_TEAM_LOCK(); - restore_interrupts(state); + // get a reference to the parent's I/O context -- we need it to create ours + parentIOContext = parent->io_context; + vfs_get_io_context(parentIOContext); + teamLocker.Unlock(); + + // check the executable's set-user/group-id permission + update_set_id_user_and_group(team, path); + status = create_team_arg(&teamArgs, path, flatArgs, flatArgsSize, argCount, envCount, errorPort, errorToken); @@ -1149,12 +1162,16 @@ // args are owned by the team_arg structure now // create a new io_context for this team - team->io_context = vfs_new_io_context(parent->io_context); + team->io_context = vfs_new_io_context(parentIOContext); if (!team->io_context) { status = B_NO_MEMORY; goto err2; } + // We don't need the parent's I/O context any longer. + vfs_put_io_context(parentIOContext); + parentIOContext = NULL; + // remove any fds that have the CLOEXEC flag set (emulating BeOS behaviour) vfs_exec_io_context(team->io_context); @@ -1229,21 +1246,25 @@ err4: vm_put_address_space(team->address_space); err3: - vfs_free_io_context(team->io_context); + vfs_put_io_context(team->io_context); err2: free_team_arg(teamArgs); err1: + if (parentIOContext != NULL) + vfs_put_io_context(parentIOContext); + // remove the team structure from the team hash table and delete the team structure state = disable_interrupts(); GRAB_TEAM_LOCK(); remove_team_from_group(team); - remove_team_from_parent(parent, team); + remove_team_from_parent(team->parent, team); hash_remove(sTeamHash, team); RELEASE_TEAM_LOCK(); restore_interrupts(state); +err0: delete_team_struct(team); return status; @@ -1431,7 +1452,8 @@ return B_NOT_ALLOWED; // create a new team - // ToDo: this is very similar to team_create_team() - maybe we can do something about it :) + // TODO: this is very similar to load_image_internal() - maybe we can do + // something about it :) team = create_team_struct(parentTeam->name, false); if (team == NULL) @@ -1562,7 +1584,7 @@ err3: delete_realtime_sem_context(team->realtime_sem_context); err25: - vfs_free_io_context(team->io_context); + vfs_put_io_context(team->io_context); err2: free(forkArgs); err1: @@ -2354,7 +2376,7 @@ // free team resources - vfs_free_io_context(team->io_context); + vfs_put_io_context(team->io_context); delete_realtime_sem_context(team->realtime_sem_context); xsi_sem_undo(team); delete_owned_ports(teamID); @@ -2639,6 +2661,15 @@ thread_id load_image(int32 argCount, const char **args, const char **env) { + return load_image_etc(argCount, args, env, B_NORMAL_PRIORITY, + B_CURRENT_TEAM, B_WAIT_TILL_LOADED); +} + + +thread_id +load_image_etc(int32 argCount, const char* const* args, + const char* const* env, int32 priority, team_id parentID, uint32 flags) +{ // we need to flatten the args and environment if (args == NULL) @@ -2685,11 +2716,11 @@ *slot++ = NULL; - thread_id thread = load_image_etc(flatArgs, size, argCount, envCount, - B_NORMAL_PRIORITY, B_WAIT_TILL_LOADED, -1, 0); + thread_id thread = load_image_internal(flatArgs, size, argCount, envCount, + B_NORMAL_PRIORITY, parentID, B_WAIT_TILL_LOADED, -1, 0); free(flatArgs); - // load_image_etc() unset our variable if it took over ownership + // load_image_internal() unset our variable if it took over ownership return thread; } @@ -3277,7 +3308,7 @@ int32 argCount, int32 envCount, int32 priority, uint32 flags, port_id errorPort, uint32 errorToken) { - TRACE(("_user_load_image_etc: argc = %ld\n", argCount)); + TRACE(("_user_load_image: argc = %ld\n", argCount)); if (argCount < 1) return B_BAD_VALUE; @@ -3289,11 +3320,12 @@ if (error != B_OK) return error; - thread_id thread = load_image_etc(flatArgs, _ALIGN(flatArgsSize), argCount, - envCount, priority, flags, errorPort, errorToken); + thread_id thread = load_image_internal(flatArgs, _ALIGN(flatArgsSize), + argCount, envCount, priority, B_CURRENT_TEAM, flags, errorPort, + errorToken); free(flatArgs); - // load_image_etc() unset our variable if it took over ownership + // load_image_internal() unset our variable if it took over ownership return thread; } Modified: haiku/trunk/src/system/kernel/usergroup.cpp =================================================================== --- haiku/trunk/src/system/kernel/usergroup.cpp 2009-03-01 23:22:30 UTC (rev 29374) +++ haiku/trunk/src/system/kernel/usergroup.cpp 2009-03-02 00:26:22 UTC (rev 29375) @@ -243,10 +243,8 @@ void -inherit_parent_user_and_group(struct team* team, struct team* parent) +inherit_parent_user_and_group_locked(struct team* team, struct team* parent) { - InterruptsSpinLocker _(gTeamSpinlock); - team->saved_set_uid = parent->saved_set_uid; team->real_uid = parent->real_uid; team->effective_uid = parent->effective_uid; @@ -260,6 +258,14 @@ } +void +inherit_parent_user_and_group(struct team* team, struct team* parent) +{ + InterruptsSpinLocker _(gTeamSpinlock); + inherit_parent_user_and_group_locked(team, parent); +} + + status_t update_set_id_user_and_group(struct team* team, const char* file) { From bonefish at mail.berlios.de Mon Mar 2 01:28:17 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 2 Mar 2009 01:28:17 +0100 Subject: [Haiku-commits] r29376 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos Message-ID: <200903020028.n220SHZt019216@sheep.berlios.de> Author: bonefish Date: 2009-03-02 01:28:17 +0100 (Mon, 02 Mar 2009) New Revision: 29376 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29376&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h Log: BeOSKernelVolume didn't initialize the fCapabilities base class member. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp 2009-03-02 00:26:22 UTC (rev 29375) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp 2009-03-02 00:28:17 UTC (rev 29376) @@ -54,7 +54,8 @@ return B_BAD_VALUE; // create the volume - *volume = new(std::nothrow) BeOSKernelVolume(this, id, fFSOps); + *volume = new(std::nothrow) BeOSKernelVolume(this, id, fFSOps, + fVolumeCapabilities); if (!*volume) return B_NO_MEMORY; return B_OK; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-03-02 00:26:22 UTC (rev 29375) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-03-02 00:28:17 UTC (rev 29376) @@ -42,13 +42,14 @@ // constructor BeOSKernelVolume::BeOSKernelVolume(FileSystem* fileSystem, dev_t id, - beos_vnode_ops* fsOps) + beos_vnode_ops* fsOps, const FSVolumeCapabilities& capabilities) : Volume(fileSystem, id), fFSOps(fsOps), fVolumeCookie(NULL), fMounted(false) { + fCapabilities = capabilities; } // destructor Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h 2009-03-02 00:26:22 UTC (rev 29375) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h 2009-03-02 00:28:17 UTC (rev 29376) @@ -12,7 +12,8 @@ class BeOSKernelVolume : public Volume { public: BeOSKernelVolume(FileSystem* fileSystem, - dev_t id, beos_vnode_ops* fsOps); + dev_t id, beos_vnode_ops* fsOps, + const FSVolumeCapabilities& capabilities); virtual ~BeOSKernelVolume(); // FS From bonefish at mail.berlios.de Mon Mar 2 01:37:14 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 2 Mar 2009 01:37:14 +0100 Subject: [Haiku-commits] r29377 - in haiku/trunk: headers/private/userlandfs/private src/add-ons/kernel/file_systems/userlandfs/kernel_add_on src/add-ons/kernel/file_systems/userlandfs/server src/add-ons/kernel/file_systems/userlandfs/server/beos src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200903020037.n220bERg025383@sheep.berlios.de> Author: bonefish Date: 2009-03-02 01:37:14 +0100 (Mon, 02 Mar 2009) New Revision: 29377 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29377&view=rev Modified: haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/main.cpp Log: * Renamed UserlandFSServer to userlandfs_server. It is expected to live in /system/servers, now. * Got rid of the dispatcher application. It was the entity the kernel module talked to when mounting a yet unknown FS. It started the client FS server applications. Now the kernel module starts them directly. They use respectively named ports, so the kernel module can find them when already running. Modified: haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h 2009-03-02 00:37:14 UTC (rev 29377) @@ -3,15 +3,27 @@ #ifndef USERLAND_FS_DISPATCHER_DEFS_H #define USERLAND_FS_DISPATCHER_DEFS_H +#include "FSCapabilities.h" +#include "Port.h" + + namespace UserlandFSUtil { extern const char* kUserlandFSDispatcherPortName; extern const char* kUserlandFSDispatcherReplyPortName; +struct fs_init_info { + FSCapabilities capabilities; + client_fs_type clientFSType; + int32 portInfoCount; + Port::Info portInfos[0]; +}; + } // namespace UserlandFSUtil using UserlandFSUtil::kUserlandFSDispatcherPortName; using UserlandFSUtil::kUserlandFSDispatcherReplyPortName; +using UserlandFSUtil::fs_init_info; enum { UFS_DISPATCHER_CONNECT = 'cnct', Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp 2009-03-02 00:37:14 UTC (rev 29377) @@ -1,76 +1,136 @@ -// FileSystemInitializer.cpp +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include "FileSystemInitializer.h" #include +#include +#include + +#include +#include + +#include "AutoDeleter.h" + +#include "DispatcherDefs.h" #include "FileSystem.h" #include "RequestAllocator.h" #include "RequestPort.h" #include "Requests.h" #include "SingleReplyRequestHandler.h" -using std::nothrow; // constructor -FileSystemInitializer::FileSystemInitializer(const char* name, - RequestPort* initPort) - : fName(name), - fInitPort(initPort), - fFileSystem(NULL) +FileSystemInitializer::FileSystemInitializer(const char* name) + : + fName(name), + fFileSystem(NULL) { // Note: We don't copy the name. It's only needed in FirstTimeInit() and // the UserlandFS makes sure it is valid until then. } + // destructor FileSystemInitializer::~FileSystemInitializer() { delete fFileSystem; } + // FirstTimeInit status_t FileSystemInitializer::FirstTimeInit() { - // prepare the request - RequestAllocator allocator(fInitPort->GetPort()); - FSConnectRequest* request; - status_t error = AllocateRequest(allocator, &request); - if (error != B_OK) - RETURN_ERROR(error); - error = allocator.AllocateString(request->fsName, fName); - if (error != B_OK) - RETURN_ERROR(error); + // First check whether a server for this FS is already loaded. Look for a + // port with the respective name. + char portName[B_OS_NAME_LENGTH]; + snprintf(portName, sizeof(portName), "_userlandfs_%s", fName); - // send the request - SingleReplyRequestHandler handler(FS_CONNECT_REPLY); - FSConnectReply* reply; - error = fInitPort->SendRequest(&allocator, &handler, (Request**)&reply); - if (error != B_OK) + port_id port = find_port(portName); + if (port >= 0) + return _Init(port); + + // We have to start the server ourselves. First create the port we're going + // to use. + port = create_port(1, portName); + if (port < 0) + RETURN_ERROR(port); + + // prepare the command line arguments + char portID[16]; + snprintf(portID, sizeof(portID), "%ld", port); + + const char* args[4] = { + "/system/servers/userlandfs_server", + fName, + portID, + NULL + }; + + // start the server + thread_id thread = load_image_etc(3, args, NULL, B_NORMAL_PRIORITY, + B_SYSTEM_TEAM, 0); + if (thread < 0) { + delete_port(port); + RETURN_ERROR(thread); + } + + // let it own the port and start the team + status_t error = set_port_owner(port, thread); + if (error == B_OK) + resume_thread(thread); + + // and do the initialization + if (error == B_OK) + error = _Init(port); + + if (error != B_OK) { + kill_team(thread); + delete_port(port); RETURN_ERROR(error); - RequestReleaser requestReleaser(fInitPort, reply); + } - // process the reply - if (reply->error != B_OK) - RETURN_ERROR(reply->error); + return B_OK; +} - // get the port infos - int32 count = reply->portInfoCount; - if (count < 2) + +status_t +FileSystemInitializer::_Init(port_id port) +{ + // allocate a buffer for the FS info + const size_t bufferSize = 1024; + fs_init_info* info = (fs_init_info*)malloc(bufferSize); + MemoryDeleter _(info); + + // Read the info -- we peek only, so it won't go away and we can do the + // initialization again, in case we get completely unloaded are reloaded + // later. + ssize_t bytesRead = read_port_etc(port, NULL, info, bufferSize, + B_PEEK_PORT_MESSAGE | B_CAN_INTERRUPT, 0); + if (bytesRead < 0) + RETURN_ERROR(bytesRead); + + // sanity check + if ((size_t)bytesRead < sizeof(fs_init_info) + || info->portInfoCount < 2 + || (size_t)bytesRead < sizeof(fs_init_info) + + info->portInfoCount * sizeof(Port::Info)) { RETURN_ERROR(B_BAD_DATA); - if (reply->portInfos.GetSize() != count * (int32)sizeof(Port::Info)) - RETURN_ERROR(B_BAD_DATA); - Port::Info* infos = (Port::Info*)reply->portInfos.GetData(); + } // create and init the FileSystem - fFileSystem = new(nothrow) FileSystem(); + fFileSystem = new(std::nothrow) FileSystem; if (!fFileSystem) return B_NO_MEMORY; - error = fFileSystem->Init(fName, infos, count, reply->capabilities); + status_t error = fFileSystem->Init(fName, info->portInfos, + info->portInfoCount, info->capabilities); if (error != B_OK) - return B_ERROR; + RETURN_ERROR(error); return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.h 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.h 2009-03-02 00:37:14 UTC (rev 29377) @@ -1,5 +1,7 @@ -// FileSystemInitializer.h - +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_FILE_SYSTEM_INITIALIZER_H #define USERLAND_FS_FILE_SYSTEM_INITIALIZER_H @@ -19,8 +21,7 @@ class FileSystemInitializer : public LazyInitializable, public Referencable { public: - FileSystemInitializer(const char* name, - RequestPort* initPort); + FileSystemInitializer(const char* name); ~FileSystemInitializer(); inline FileSystem* GetFileSystem() { return fFileSystem; } @@ -29,8 +30,10 @@ virtual status_t FirstTimeInit(); private: + status_t _Init(port_id port); + +private: const char* fName; // valid only until FirstTimeInit() - RequestPort* fInitPort; FileSystem* fFileSystem; }; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile 2009-03-02 00:37:14 UTC (rev 29377) @@ -4,6 +4,7 @@ userlandfs ] ; local userlandFSIncludes = [ PrivateHeaders userlandfs ] ; +UsePrivateKernelHeaders ; SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp 2009-03-02 00:37:14 UTC (rev 29377) @@ -1,4 +1,7 @@ -// UserlandFS.cpp +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include "UserlandFS.h" @@ -18,9 +21,9 @@ // constructor UserlandFS::UserlandFS() - : fPort(NULL), - fFileSystems(NULL), - fDebuggerCommandsAdded(false) + : + fFileSystems(NULL), + fDebuggerCommandsAdded(false) { } @@ -28,19 +31,6 @@ UserlandFS::~UserlandFS() { PRINT(("UserlandFS::~UserlandFS()\n")) - if (fPort) { - // send a disconnect request - RequestAllocator allocator(fPort->GetPort()); - UFSDisconnectRequest* request; - if (AllocateRequest(allocator, &request) == B_OK) { - if (fPort->SendRequest(&allocator) != B_OK) - PRINT((" failed to send disconnect request\n")); - } else - PRINT((" failed to allocate disconnect request\n")); - delete fPort; - } else - PRINT((" no port\n")); - delete fFileSystems; if (fDebuggerCommandsAdded) KernelDebug::RemoveDebuggerCommands(); @@ -99,8 +89,8 @@ if (fileSystemInitializer) { fileSystemInitializer->AddReference(); } else { - fileSystemInitializer = new(nothrow) FileSystemInitializer(name, - fPort); + fileSystemInitializer = new(nothrow) FileSystemInitializer(name/*, + fPort*/); if (!fileSystemInitializer) return B_NO_MEMORY; @@ -156,40 +146,7 @@ if (error != B_OK) RETURN_ERROR(error); - // find the dispatcher ports - port_id port = find_port(kUserlandFSDispatcherPortName); - if (port < 0) - RETURN_ERROR(B_ERROR); - port_id replyPort = find_port(kUserlandFSDispatcherReplyPortName); - if (replyPort < 0) - RETURN_ERROR(B_ERROR); - - // create a reply port - // send a connection request - error = write_port(port, UFS_DISPATCHER_CONNECT, NULL, 0); - if (error != B_OK) - RETURN_ERROR(error); - - // receive the reply - int32 replyCode; - Port::Info portInfo; - ssize_t bytesRead = read_port(replyPort, &replyCode, &portInfo, - sizeof(Port::Info)); - if (bytesRead < 0) - RETURN_ERROR(bytesRead); - if (replyCode != UFS_DISPATCHER_CONNECT_ACK) - RETURN_ERROR(B_BAD_DATA); - if (bytesRead != sizeof(Port::Info)) - RETURN_ERROR(B_BAD_DATA); - - // create a request port - fPort = new(nothrow) RequestPort(&portInfo); - if (!fPort) - RETURN_ERROR(B_NO_MEMORY); - if ((error = fPort->InitCheck()) != B_OK) - RETURN_ERROR(error); - - RETURN_ERROR(error); + return B_OK; } // _UnregisterFileSystem Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.h 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.h 2009-03-02 00:37:14 UTC (rev 29377) @@ -1,5 +1,7 @@ -// UserlandFS.h - +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_H #define USERLAND_FS_H @@ -49,7 +51,6 @@ private: static UserlandFS* sUserlandFS; - RequestPort* fPort; FileSystemMap* fFileSystems; bool fDebuggerCommandsAdded; }; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-03-02 00:37:14 UTC (rev 29377) @@ -13,10 +13,10 @@ SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ; DEFINES += USER=1 ; -DEFINES += DEBUG_APP="\\\"UserlandFSServer\\\"" ; +DEFINES += DEBUG_APP="\\\"userlandfs_server\\\"" ; DEFINES += BUILDING_USERLAND_FS_SERVER=1 ; -Application UserlandFSServer +Application userlandfs_server : AreaSupport.cpp Debug.cpp @@ -41,7 +41,7 @@ main.cpp RequestThread.cpp ServerDefs.cpp - UserlandFSDispatcher.cpp +# UserlandFSDispatcher.cpp UserlandFSServer.cpp UserlandRequestHandler.cpp Volume.cpp Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-03-02 00:37:14 UTC (rev 29377) @@ -39,6 +39,7 @@ { } + // destructor UserlandFSServer::~UserlandFSServer() { @@ -55,9 +56,10 @@ unload_add_on(fAddOnImage); } + // Init status_t -UserlandFSServer::Init(const char* fileSystem) +UserlandFSServer::Init(const char* fileSystem, port_id port) { // get the add-on path BPath addOnPath; @@ -118,11 +120,12 @@ if (gServerSettings.ShallEnterDebugger()) debugger("File system ready to use."); - // finally register with the dispatcher - error = _RegisterWithDispatcher(fileSystem); + // finally announce our existence + error = _Announce(fileSystem, port); RETURN_ERROR(error); } + // GetNotificationRequestPort RequestPort* UserlandFSServer::GetNotificationRequestPort() @@ -132,6 +135,7 @@ return NULL; } + // GetFileSystem FileSystem* UserlandFSServer::GetFileSystem() @@ -141,62 +145,37 @@ return NULL; } -// _RegisterWithDispatcher + +// _Announce status_t -UserlandFSServer::_RegisterWithDispatcher(const char* fsName) +UserlandFSServer::_Announce(const char* fsName, port_id port) { - // get the dispatcher messenger from the clipboard - BMessenger messenger; - BClipboard clipboard(kUserlandFSDispatcherClipboardName); - if (AutoLocker locker = clipboard) { - status_t error = B_OK; - if (BMessage* data = clipboard.Data()) { - error = data->FindMessenger("messenger", &messenger); - if (error != B_OK) { - ERROR(("No dispatcher messenger in clipboard.\n")); - return error; - } - if (!messenger.IsValid()) { - ERROR(("Found dispatcher messenger not valid.\n")); - return B_ERROR; - } - } else { - ERROR(("Failed to get clipboard data container\n")); - return B_ERROR; - } - } else { - ERROR(("Failed to lock the clipboard.\n")); - return B_ERROR; + // if not given, create a port + if (port < 0) { + char portName[B_OS_NAME_LENGTH]; + snprintf(portName, sizeof(portName), "_userlandfs_%s", fsName); + + port = create_port(1, portName); + if (port < 0) + RETURN_ERROR(port); } + // allocate stack space for the FS initialization info + const size_t bufferSize = sizeof(fs_init_info) + + sizeof(Port::Info) * (kRequestThreadCount + 1); + char buffer[bufferSize]; + fs_init_info* info = (fs_init_info*)buffer; + // get the port infos - Port::Info infos[kRequestThreadCount + 1]; - infos[0] = *fNotificationRequestPort->GetPortInfo(); + info->portInfoCount = kRequestThreadCount + 1; + info->portInfos[0] = *fNotificationRequestPort->GetPortInfo(); for (int32 i = 0; i < kRequestThreadCount; i++) - infos[i + 1] = *fRequestThreads[i].GetPortInfo(); + info->portInfos[i + 1] = *fRequestThreads[i].GetPortInfo(); // FS capabilities - FSCapabilities capabilities; - fFileSystem->GetCapabilities(capabilities); + fFileSystem->GetCapabilities(info->capabilities); + info->clientFSType = fFileSystem->GetClientFSType(); - // init an FS info - FSInfo info; - status_t error = info.SetTo(fsName, infos, kRequestThreadCount + 1, - capabilities, fFileSystem->GetClientFSType()); - - // prepare the message - BMessage message(UFS_REGISTER_FS); - if (error == B_OK) - error = message.AddInt32("team", Team()); - if (error == B_OK) - error = info.Archive(&message); - - // send the message - BMessage reply; - error = messenger.SendMessage(&message, &reply); - if (error == B_OK && reply.what != UFS_REGISTER_FS_ACK) { - ERROR(("FS registration failed.\n")); - error = B_ERROR; - } - return error; + // send the info to our port + RETURN_ERROR(write_port(port, 0, buffer, bufferSize)); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h 2009-03-02 00:37:14 UTC (rev 29377) @@ -21,13 +21,13 @@ UserlandFSServer(const char* signature); virtual ~UserlandFSServer(); - status_t Init(const char* fileSystem); + status_t Init(const char* fileSystem, port_id port); static RequestPort* GetNotificationRequestPort(); static FileSystem* GetFileSystem(); private: - status_t _RegisterWithDispatcher(const char* fsName); + status_t _Announce(const char* fsName, port_id port); private: image_id fAddOnImage; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile 2009-03-02 00:37:14 UTC (rev 29377) @@ -26,5 +26,5 @@ BeOSKernelVolume.cpp : - UserlandFSServer + userlandfs_server ; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-03-02 00:37:14 UTC (rev 29377) @@ -34,5 +34,5 @@ HaikuKernelVolume.cpp : - UserlandFSServer + userlandfs_server ; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/main.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/main.cpp 2009-03-02 00:28:17 UTC (rev 29376) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/main.cpp 2009-03-02 00:37:14 UTC (rev 29377) @@ -1,11 +1,13 @@ // main.cpp #include +#include #include +#include + #include "Debug.h" #include "ServerDefs.h" -#include "UserlandFSDispatcher.h" #include "UserlandFSServer.h" // server signature @@ -14,19 +16,19 @@ // usage static const char* kUsage = -"Usage: %s \n" -" %s \n" +"Usage: %s [ ]\n" "\n" -"The first version runs the server as the dispatcher, i.e. as the singleton\n" -"app the kernel add-on contacts when it is looking for a file system.\n" -"The dispatcher uses the second version to start a server for a specific file\n" -"system.\n" +"Runs the userlandfs server for a given file system. Typically this is done\n" +"automatically by the kernel module when a volume is requested to be mounted,\n" +"but running the server manually can be useful for debugging purposes. The\n" +" argument specifies the name of the file system to be loaded.\n" +" should not be given when starting the server manually; it is used by\n" +"the kernel module only.\n" "\n" "Options:\n" " --debug - the file system server enters the debugger after the\n" " userland file system add-on has been loaded and is\n" -" ready to be used. If specified for the dispatcher, it\n" -" passes the flag to all file system servers it starts.\n" +" ready to be used.\n" " -h, --help - print this text\n" ; @@ -80,37 +82,36 @@ fileSystem = argv[argi++]; dispatcher = false; } + + // get the port, if any + int32 port = -1; if (argi < argc) { + port = atol(argv[argi++]); + if (port <= 0) { + print_usage(); + return 1; + } + } + + if (argi < argc) { print_usage(); return 1; } // create and init the application - BApplication* app = NULL; status_t error = B_OK; - if (dispatcher) { - UserlandFSDispatcher* dispatcher - = new(nothrow) UserlandFSDispatcher(kServerSignature); - if (!dispatcher) { - fprintf(stderr, "Failed to create dispatcher.\n"); - return 1; - } - error = dispatcher->Init(); - app = dispatcher; - } else { - UserlandFSServer* server - = new(nothrow) UserlandFSServer(kServerSignature); - if (!server) { - fprintf(stderr, "Failed to create server.\n"); - return 1; - } - error = server->Init(fileSystem); - app = server; + UserlandFSServer* server + = new(std::nothrow) UserlandFSServer(kServerSignature); + if (!server) { + fprintf(stderr, "Failed to create server.\n"); + return 1; } + error = server->Init(fileSystem, port); // run it, if everything went fine if (error == B_OK) - app->Run(); - delete app; + server->Run(); + + delete server; return 0; } From korli at users.berlios.de Mon Mar 2 09:02:05 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Mon, 2 Mar 2009 09:02:05 +0100 Subject: [Haiku-commits] r29375 - in haiku/trunk: headers/private/kernel src/system/kernel src/system/kernel/fs In-Reply-To: <200903020026.n220QO8Q009632@sheep.berlios.de> References: <200903020026.n220QO8Q009632@sheep.berlios.de> Message-ID: 2009/3/2 bonefish at BerliOS > * vfs_resize_fd_table(): Fixed use of MutexLocker. We created only a > temporary > object, not one with function scope. > There is the same in fs/fd.cpp in get_fd(). Maybe it needs to be reviewed/fixed there too. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From axeld at mail.berlios.de Mon Mar 2 09:23:18 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 2 Mar 2009 09:23:18 +0100 Subject: [Haiku-commits] r29378 - haiku/trunk/src/system/kernel/fs Message-ID: <200903020823.n228NIeH031623@sheep.berlios.de> Author: axeld Date: 2009-03-02 09:23:16 +0100 (Mon, 02 Mar 2009) New Revision: 29378 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29378&view=rev Modified: haiku/trunk/src/system/kernel/fs/fd.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * Fixed wrong use of MutexLocker as pointed out by Korli - nice catch! This could have caused a number of problems. * Fixed coding style violation Ingo introduced. Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2009-03-02 00:37:14 UTC (rev 29377) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2009-03-02 08:23:16 UTC (rev 29378) @@ -297,7 +297,7 @@ struct file_descriptor * get_fd(struct io_context *context, int fd) { - MutexLocker(context->io_mutex); + MutexLocker _(context->io_mutex); return get_fd_locked(context, fd); } @@ -306,7 +306,7 @@ struct file_descriptor * get_open_fd(struct io_context *context, int fd) { - MutexLocker(context->io_mutex); + MutexLocker _(context->io_mutex); file_descriptor *descriptor = get_fd_locked(context, fd); if (descriptor == NULL) Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-03-02 00:37:14 UTC (rev 29377) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-03-02 08:23:16 UTC (rev 29378) @@ -4744,13 +4744,15 @@ } -void vfs_get_io_context(io_context *context) +void +vfs_get_io_context(io_context* context) { atomic_add(&context->ref_count, 1); } -void vfs_put_io_context(io_context *context) +void +vfs_put_io_context(io_context* context) { if (atomic_add(&context->ref_count, -1) == 1) vfs_free_io_context(context); From axeld at pinc-software.de Mon Mar 2 09:54:50 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 02 Mar 2009 09:54:50 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29375_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate/kernel_src/system/kernel_src/system/kernel/fs?= In-Reply-To: Message-ID: <3419279431-BeMail@zon> J?r?me Duval wrote: > 2009/3/2 bonefish at BerliOS > > * vfs_resize_fd_table(): Fixed use of MutexLocker. We created only > > a > > temporary object, not one with function scope. > There is the same in fs/fd.cpp in get_fd(). Maybe it needs to be > reviewed/fixed there too. Just did so, thanks! I also did a "grep Locker" over the kernel sources, but it seems that was all. Bye, Axel. From superstippi at gmx.de Mon Mar 2 09:55:27 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Mon, 02 Mar 2009 09:55:27 +0100 Subject: [Haiku-commits] r29378 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200903020823.n228NIeH031623@sheep.berlios.de> References: <200903020823.n228NIeH031623@sheep.berlios.de> Message-ID: <49AB9EFF.6030907@gmx.de> axeld at BerliOS schrieb: > Author: axeld > Date: 2009-03-02 09:23:16 +0100 (Mon, 02 Mar 2009) > New Revision: 29378 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29378&view=rev > > Modified: > haiku/trunk/src/system/kernel/fs/fd.cpp > haiku/trunk/src/system/kernel/fs/vfs.cpp > Log: > * Fixed wrong use of MutexLocker as pointed out by Korli - nice catch! This > could have caused a number of problems. Wow, nice catch indeed. What type of problems could have been caused? Would it only affect the files that one process opened? Best regards, -Stephan From axeld at pinc-software.de Mon Mar 2 10:01:52 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 02 Mar 2009 10:01:52 +0100 CET Subject: [Haiku-commits] r29368 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos In-Reply-To: <20090301165146.362.1@knochen-vm.localdomain> Message-ID: <3841675653-BeMail@zon> Ingo Weinhold wrote: > I'd strongly suggest that we do strict error checking ("!= B_OK") in > all > cases where a status_t is returned. Since no-one returns a positive > error > code on purpose, a positive value is an obvious indicator that > something's > not right. Also, since we use FreeBSD code which comes from a system > with > positive error constants I find that particularly advisable. While there might be cases where functions use a status_t and may still return something else than B_OK, I guess we would need to review everything in this regard to not introduce other mistakes this way. After all, if a function returns bogus values, you just cannot expect everything to work out afterwards, no matter if you're using < or != B_OK. Bye, Axel. From ingo_weinhold at gmx.de Mon Mar 2 12:19:45 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 02 Mar 2009 12:19:45 +0100 Subject: [Haiku-commits] r29368 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos In-Reply-To: <3841675653-BeMail@zon> References: <3841675653-BeMail@zon> Message-ID: <20090302121945.365.1@knochen-vm.localdomain> On 2009-03-02 at 10:01:52 [+0100], Axel D?rfler wrote: > Ingo Weinhold wrote: > > I'd strongly suggest that we do strict error checking ("!= B_OK") in > > all > > cases where a status_t is returned. Since no-one returns a positive > > error > > code on purpose, a positive value is an obvious indicator that > > something's > > not right. Also, since we use FreeBSD code which comes from a system > > with > > positive error constants I find that particularly advisable. > > While there might be cases where functions use a status_t and may still > return something else than B_OK, I don't think one needs many fingers of one hand to count those instances. Off the top of my head I don't even recall a single one. > I guess we would need to review > everything in this regard to not introduce other mistakes this way. > After all, if a function returns bogus values, you just cannot expect > everything to work out afterwards, no matter if you're using < or != > B_OK. My point is that everything might appear to work, if you check with "<". E.g. a function propagating errors typically contains code like this: status_t status = foo(...); if (status < B_OK) return status; ... return B_OK; In such a case the bogus value goes completely unnoticed, since it gets replaced by a B_OK. With "!=" the value is treated as an error, which is more likely to get noticed. CU, Ingo From oruizdorantes at mail.berlios.de Mon Mar 2 19:24:25 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Mon, 2 Mar 2009 19:24:25 +0100 Subject: [Haiku-commits] r29379 - in haiku/trunk: build/jam src/add-ons/kernel/network/protocols Message-ID: <200903021824.n22IOPQm025454@sheep.berlios.de> Author: oruizdorantes Date: 2009-03-02 19:24:24 +0100 (Mon, 02 Mar 2009) New Revision: 29379 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29379&view=rev Modified: haiku/trunk/build/jam/OptionalPackages haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile Log: Add new bluetooth components to the bluetooth optional package Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2009-03-02 08:23:16 UTC (rev 29378) +++ haiku/trunk/build/jam/OptionalPackages 2009-03-02 18:24:24 UTC (rev 29379) @@ -146,6 +146,10 @@ AddDriversToHaikuImage bluetooth : $(bluetoothDrivers) ; AddFilesToHaikuImage beos system servers : bluetooth_server ; AddFilesToHaikuImage beos system lib : libbluetooth.so ; + AddFilesToHaikuImage beos system add-ons kernel network devices : bluetooth ; + AddFilesToHaikuImage beos system add-ons kernel network protocols : l2cap ; + AddFilesToHaikuImage beos system add-ons kernel bluetooth : btCoreData ; + AddFilesToHaikuImage beos preferences : Bluetooth ; AddFilesToHaikuImage beos bin : bt_dev_info bt_discovery ; if [ IsOptionalHaikuImagePackageAdded Development ] { Modified: haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile 2009-03-02 08:23:16 UTC (rev 29378) +++ haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile 2009-03-02 18:24:24 UTC (rev 29379) @@ -5,3 +5,4 @@ SubInclude HAIKU_TOP src add-ons kernel network protocols tcp ; SubInclude HAIKU_TOP src add-ons kernel network protocols udp ; SubInclude HAIKU_TOP src add-ons kernel network protocols unix ; +SubInclude HAIKU_TOP src add-ons kernel network protocols l2cap ; From korli at mail.berlios.de Mon Mar 2 20:33:13 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 2 Mar 2009 20:33:13 +0100 Subject: [Haiku-commits] r29380 - haiku/trunk/src/kits/media Message-ID: <200903021933.n22JXD2G023880@sheep.berlios.de> Author: korli Date: 2009-03-02 20:33:13 +0100 (Mon, 02 Mar 2009) New Revision: 29380 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29380&view=rev Modified: haiku/trunk/src/kits/media/TrackReader.h Log: * fixed gcc4 build Modified: haiku/trunk/src/kits/media/TrackReader.h =================================================================== --- haiku/trunk/src/kits/media/TrackReader.h 2009-03-02 18:24:24 UTC (rev 29379) +++ haiku/trunk/src/kits/media/TrackReader.h 2009-03-02 19:33:13 UTC (rev 29380) @@ -10,6 +10,8 @@ #include +class BMediaFile; + namespace BPrivate { From rudolfc at mail.berlios.de Mon Mar 2 20:55:18 2009 From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de) Date: Mon, 2 Mar 2009 20:55:18 +0100 Subject: [Haiku-commits] r29381 - in haiku/trunk: headers/private/graphics/nvidia src/add-ons/accelerants/nvidia src/add-ons/accelerants/nvidia/engine src/add-ons/kernel/drivers/graphics/nvidia Message-ID: <200903021955.n22JtIPZ025726@sheep.berlios.de> Author: rudolfc Date: 2009-03-02 20:55:03 +0100 (Mon, 02 Mar 2009) New Revision: 29381 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29381&view=rev Modified: haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h haiku/trunk/src/add-ons/accelerants/nvidia/EngineManagment.c haiku/trunk/src/add-ons/accelerants/nvidia/GetAccelerantHook.c haiku/trunk/src/add-ons/accelerants/nvidia/InitAccelerant.c haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings Log: added 'block_acc' option in nvidia.settings to completely disable the acceleration engine. This lets my G72 run (not crash) for the first time when enabled. Note: Haiku becomes very slow in drawing in 32bit mode when the driver is running this way compared to vesa mode. I am assuming this is because of (too) fine-grained calling of the engine management functions. Never saw this effect AFAIK in BeOS. Modified: haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h =================================================================== --- haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/headers/private/graphics/nvidia/DriverInterface.h 2009-03-02 19:55:03 UTC (rev 29381) @@ -5,7 +5,7 @@ Other authors: Mark Watson; Apsed; - Rudolf Cornelissen 10/2002-6/2008. + Rudolf Cornelissen 10/2002-3/2009. */ #ifndef DRIVERINTERFACE_H @@ -205,7 +205,7 @@ uint32 size; } int_buf_info; -typedef struct { // apsed, see comments in nv.settings +typedef struct { // apsed, see comments in nvidia.settings // for driver char accelerant[B_FILE_NAME_LENGTH]; char primary[B_FILE_NAME_LENGTH]; @@ -224,6 +224,7 @@ bool vga_on_tv; bool force_sync; bool force_ws; + bool block_acc; uint32 gpu_clk; uint32 ram_clk; } nv_settings; Modified: haiku/trunk/src/add-ons/accelerants/nvidia/EngineManagment.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/EngineManagment.c 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/src/add-ons/accelerants/nvidia/EngineManagment.c 2009-03-02 19:55:03 UTC (rev 29381) @@ -4,7 +4,7 @@ other authors: Mark Watson - Rudolf Cornelissen 3/2004-2/2005 + Rudolf Cornelissen 3/2004-3/2009 */ /* @@ -34,8 +34,8 @@ /* sync if required */ if (st) SYNC_TO_TOKEN(st); - /* make sure all needed engine cmd's are mapped to the FIFO */ - nv_acc_assert_fifo(); + /* make sure all needed engine cmd's are mapped to the FIFO if acceleration isn't blocked */ + if (!si->settings.block_acc) nv_acc_assert_fifo(); /* return an engine token */ *et = &nv_engine_token; @@ -49,8 +49,8 @@ /* sync if required */ if (st) SYNC_TO_TOKEN(st); - /* make sure all needed engine cmd's are mapped to the FIFO */ - nv_acc_assert_fifo_dma(); + /* make sure all needed engine cmd's are mapped to the FIFO if acceleration isn't blocked */ + if (!si->settings.block_acc) nv_acc_assert_fifo_dma(); /* return an engine token */ *et = &nv_engine_token; @@ -69,6 +69,9 @@ void WAIT_ENGINE_IDLE(void) { + /* do nothing if acceleration is te be blocked */ + if (si->settings.block_acc) return; + /*wait for the engine to be totally idle*/ if (!si->settings.dma_acc) nv_acc_wait_idle(); Modified: haiku/trunk/src/add-ons/accelerants/nvidia/GetAccelerantHook.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/GetAccelerantHook.c 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/src/add-ons/accelerants/nvidia/GetAccelerantHook.c 2009-03-02 19:55:03 UTC (rev 29381) @@ -4,7 +4,7 @@ Other authors: Mark Watson, - Rudolf Cornelissen 10/2002-1/2006 + Rudolf Cornelissen 10/2002-3/2009 */ #define MODULE_BIT 0x08000000 @@ -227,8 +227,8 @@ } /* hardware acceleration is only supported in modes with upto a certain - * memory pitch.. */ - if (si->acc_mode) + * memory pitch.. and acceleration must not be blocked */ + if (si->acc_mode && !si->settings.block_acc) { LOG(4, ("Acc: Exporting hook %s.\n", msg)); return B_OK; Modified: haiku/trunk/src/add-ons/accelerants/nvidia/InitAccelerant.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/InitAccelerant.c 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/src/add-ons/accelerants/nvidia/InitAccelerant.c 2009-03-02 19:55:03 UTC (rev 29381) @@ -4,7 +4,7 @@ Other authors: Mark Watson, - Rudolf Cornelissen 10/2002-4/2006. + Rudolf Cornelissen 10/2002-3/2009. */ #define MODULE_BIT 0x00800000 @@ -42,8 +42,8 @@ si->settings.logmask, si->settings.memory, si->settings.hardcursor, si->settings.usebios, si->settings.switchhead, si->settings.force_pci)); LOG(4,("init_common: dumprom %d, unhide_fw %d, pgm_panel %d, dma_acc %d, tv_output %d, vga_on_tv %d\n", si->settings.dumprom, si->settings.unhide_fw, si->settings.pgm_panel, si->settings.dma_acc, si->settings.tv_output, si->settings.vga_on_tv)); - LOG(4,("init_common: force_sync %d, gpu_clk %dMhz, ram_clk %dMhz, force_ws %d\n", - si->settings.force_sync, si->settings.gpu_clk, si->settings.ram_clk, si->settings.force_ws)); + LOG(4,("init_common: force_sync %d, gpu_clk %dMhz, ram_clk %dMhz, force_ws %d, block_acc %d\n", + si->settings.force_sync, si->settings.gpu_clk, si->settings.ram_clk, si->settings.force_ws, si->settings.block_acc)); /*Check for R4.5.0 and if it is running, use work around*/ { Modified: haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/src/add-ons/accelerants/nvidia/SetDisplayMode.c 2009-03-02 19:55:03 UTC (rev 29381) @@ -6,7 +6,7 @@ Other authors: Mark Watson, Apsed, - Rudolf Cornelissen 11/2002-6/2008 + Rudolf Cornelissen 11/2002-3/2009 */ #define MODULE_BIT 0x00200000 @@ -292,10 +292,12 @@ /* note: * Maybe later we can forget about non-DMA mode (depends on 3D acceleration * attempts). */ - if (!si->settings.dma_acc) - nv_acc_init(); - else - nv_acc_init_dma(); + if (!si->settings.block_acc) { + if (!si->settings.dma_acc) + nv_acc_init(); + else + nv_acc_init_dma(); + } /* set up overlay unit for this mode */ nv_bes_init(); Modified: haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c =================================================================== --- haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/src/add-ons/accelerants/nvidia/engine/nv_general.c 2009-03-02 19:55:03 UTC (rev 29381) @@ -92,7 +92,7 @@ { status_t status; - LOG(1,("POWERUP: Haiku nVidia Accelerant 0.85 running.\n")); + LOG(1,("POWERUP: Haiku nVidia Accelerant 0.86 running.\n")); /* log VBLANK INT usability status */ if (si->ps.int_assigned) Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/driver.c 2009-03-02 19:55:03 UTC (rev 29381) @@ -4,7 +4,7 @@ Other authors: Mark Watson; - Rudolf Cornelissen 3/2002-6/2008. + Rudolf Cornelissen 3/2002-3/2009. */ @@ -383,6 +383,7 @@ false, // vga_on_tv false, // force_sync true, // force_ws + false, // block_acc 0, // gpu_clk 0, // ram_clk }; @@ -1441,6 +1442,8 @@ "force_sync", false, false); sSettings.force_ws = get_driver_boolean_parameter(settings, "force_ws", false, false); + sSettings.block_acc = get_driver_boolean_parameter(settings, + "block_acc", false, false); item = get_driver_parameter(settings, "gpu_clk", "0", "0"); value = strtoul(item, &end, 0); Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings 2009-03-02 19:33:13 UTC (rev 29380) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/nvidia/nvidia.settings 2009-03-02 19:55:03 UTC (rev 29381) @@ -4,29 +4,30 @@ # ~/config/settings/kernel/drivers/ # -# nv.driver parameters: +# nvidia driver parameters: #accelerant "nvidia.accelerant" # if enabled selects accelerant filename to be used #primary "10de_0110_010000" # if enabled selects device to be used as primary device ('hack') dumprom false # dump bios rom to file (in home folder) -# nv.accelerant parameters: -usebios true # if true rely on bios to coldstart the card +# nvidia.accelerant parameters: +usebios true # if true rely on bios to coldstart the card #memory 2 # in MB, override builtin memory size detection hardcursor true # if true use on-chip cursor capabilities #logmask 0x00000000 # nothing logged, is default #logmask 0x08000604 # log overlay use in full to file (in home folder) #logmask 0xffffffff # log everything to file (in home folder) -switchhead false # switch head assignment (dualhead cards only) -force_pci false # block AGP mode use if true (AGP cards only) -dma_acc true # if true enable DMA cmd fetching for 2D acc (instead of using PIO) +switchhead false # switch head assignment (dualhead cards only) +force_pci false # block AGP mode use if true (AGP cards only) +dma_acc true # if true enable DMA cmd fetching for 2D acc (instead of using PIO) #tv_output 0 # disabled or 0 = autodetect, 1 = Y/C (and CVBS if possible), 2 = CVBS -force_sync false # if true forces 3D rendering to be synchronized to the vertical retrace -force_ws true # if true forces widescreen type detection for all connected screens +force_sync false # if true forces 3D rendering to be synchronized to the vertical retrace +force_ws true # if true forces widescreen type detection for all connected screens +block_acc false # if true disables the acceleration engine # WARNING: tweak alert! modify stuff below on your own risk... -unhide_fw false # if true 'unhide' cards AGP fastwrite support on cards that hide it -pgm_panel false # if false don't program DVI and laptop panel pixelclocks (refreshrates) -vga_on_tv false # if true enables VGA output on the head outputting to TV +unhide_fw false # if true 'unhide' cards AGP fastwrite support on cards that hide it +pgm_panel false # if false don't program DVI and laptop panel pixelclocks (refreshrates) +vga_on_tv false # if true enables VGA output on the head outputting to TV #gpu_clk 150 # in Mhz, (tries to) override default GPU clockspeed (be carefull!!!) #ram_clk 150 # in Mhz, (tries to) override default cardRAM clockspeed (be carefull!!!) From oruizdorantes at mail.berlios.de Mon Mar 2 22:24:37 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Mon, 2 Mar 2009 22:24:37 +0100 Subject: [Haiku-commits] r29382 - in haiku/trunk/src/add-ons/kernel: . network/protocols Message-ID: <200903022124.n22LObBa002934@sheep.berlios.de> Author: oruizdorantes Date: 2009-03-02 22:24:37 +0100 (Mon, 02 Mar 2009) New Revision: 29382 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29382&view=rev Modified: haiku/trunk/src/add-ons/kernel/Jamfile haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile Log: - Add bluetooth kernel addons to build - keep alphabetic order in network protocols Modified: haiku/trunk/src/add-ons/kernel/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/Jamfile 2009-03-02 19:55:03 UTC (rev 29381) +++ haiku/trunk/src/add-ons/kernel/Jamfile 2009-03-02 21:24:37 UTC (rev 29382) @@ -14,3 +14,4 @@ SubInclude HAIKU_TOP src add-ons kernel media ; SubInclude HAIKU_TOP src add-ons kernel partitioning_systems ; SubInclude HAIKU_TOP src add-ons kernel generic ; +SubInclude HAIKU_TOP src add-ons kernel bluetooth ; Modified: haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile 2009-03-02 19:55:03 UTC (rev 29381) +++ haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile 2009-03-02 21:24:37 UTC (rev 29382) @@ -2,7 +2,7 @@ SubInclude HAIKU_TOP src add-ons kernel network protocols icmp ; SubInclude HAIKU_TOP src add-ons kernel network protocols ipv4 ; +SubInclude HAIKU_TOP src add-ons kernel network protocols l2cap ; SubInclude HAIKU_TOP src add-ons kernel network protocols tcp ; SubInclude HAIKU_TOP src add-ons kernel network protocols udp ; SubInclude HAIKU_TOP src add-ons kernel network protocols unix ; -SubInclude HAIKU_TOP src add-ons kernel network protocols l2cap ; From stippi at mail.berlios.de Tue Mar 3 09:53:48 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 3 Mar 2009 09:53:48 +0100 Subject: [Haiku-commits] r29383 - haiku/trunk/src/add-ons/kernel/network/protocols/l2cap Message-ID: <200903030853.n238rmN4026423@sheep.berlios.de> Author: stippi Date: 2009-03-03 09:53:47 +0100 (Tue, 03 Mar 2009) New Revision: 29383 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29383&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_signal.cpp Log: * Fixed the build and ticket #3515 (multi-line string). * Automatic white space cleanup. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_signal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_signal.cpp 2009-03-02 21:24:37 UTC (rev 29382) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_signal.cpp 2009-03-03 08:53:47 UTC (rev 29383) @@ -240,7 +240,7 @@ ch->dcid = dcid; ch->ident = ident; - + status_t indicationStatus = l2cap_l2ca_con_ind(ch); if ( indicationStatus == B_OK ) { @@ -450,7 +450,7 @@ respond = L2CAP_OPT_CFLAG(le16toh(command->flags)); command.Remove(); // pull configuration header - + /* Check if we have this channel and it is in valid state */ channel = btCoreData->ChannelBySourceID(conn, dcid); if (channel == NULL) { @@ -508,7 +508,7 @@ debugf("Pulled %ld of configuration fields respond=%d remaining=%ld\n", off, respond, buffer->size); gBufferModule->remove_header(buffer, off); - + /* * Now check and see if we have to respond. If everything was OK then * respond contain "C flag" and (if set) we will respond with empty @@ -626,7 +626,7 @@ break; case L2CAP_OPT_QOS: - memcpy(&val.flow, &cmd->channel->configuration->oflow, + memcpy(&val.flow, &cmd->channel->configuration->oflow, sizeof(cmd->channel->configuration->oflow)); break; @@ -710,21 +710,24 @@ /* Check if we have this channel and it is in valid state */ ch = btCoreData->ChannelBySourceID(conn, dcid); if (ch == NULL) { - debugf("unexpected L2CAP_DisconnectReq message.Channel does not exist, cid=%d\n", dcid); + debugf("unexpected L2CAP_DisconnectReq message.Channel does not exist, " + "cid=%d\n", dcid); goto reject; } /* XXX Verify channel state and reject if invalid -- is that true? */ if (ch->state != L2CAP_CHAN_OPEN && ch->state != L2CAP_CHAN_CONFIG && ch->state != L2CAP_CHAN_W4_L2CAP_DISCON_RSP) { - debugf("unexpected L2CAP_DisconnectReq. Invalid channel state, cid=%d, state=%d\n", dcid, ch->state); + debugf("unexpected L2CAP_DisconnectReq. Invalid channel state, cid=%d, " + "state=%d\n", dcid, ch->state); goto reject; } /* Match destination channel ID */ if (ch->dcid != scid || ch->scid != dcid) { - debugf("unexpected L2CAP_DisconnectReq. Channel IDs does not match, channel: scid=%d, dcid=%d, - request: scid=%d, dcid=%d\n", ch->scid, ch->dcid, scid, dcid); + debugf("unexpected L2CAP_DisconnectReq. Channel IDs does not match, " + "channel: scid=%d, dcid=%d, request: scid=%d, dcid=%d\n", + ch->scid, ch->dcid, scid, dcid); goto reject; } @@ -928,7 +931,7 @@ command->result = le16toh(command->result); command.Remove(); - + /* Check if we have pending command descriptor */ cmd = btCoreData->SignalByIdent(conn, ident); if (cmd == NULL) { @@ -983,9 +986,9 @@ } command->reason = le16toh(command->reason); - + command.Remove(); - + /* Check if we have pending command descriptor */ cmd = btCoreData->SignalByIdent(conn, ident); if (cmd != NULL) { @@ -1076,7 +1079,7 @@ { L2capFrame* cmd = NULL; - cmd = btCoreData->SpawnSignal(conn, NULL, l2cap_cfg_rsp(ident, scid, 0, result, opt), + cmd = btCoreData->SpawnSignal(conn, NULL, l2cap_cfg_rsp(ident, scid, 0, result, opt), ident, L2CAP_CFG_RSP); if (cmd == NULL) { gBufferModule->free(opt); From axeld at mail.berlios.de Tue Mar 3 11:39:55 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Mar 2009 11:39:55 +0100 Subject: [Haiku-commits] r29384 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200903031039.n23AdtDA019878@sheep.berlios.de> Author: axeld Date: 2009-03-03 11:39:55 +0100 (Tue, 03 Mar 2009) New Revision: 29384 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29384&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp Log: * Cleanup. Modified: haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp 2009-03-03 08:53:47 UTC (rev 29383) +++ haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp 2009-03-03 10:39:55 UTC (rev 29384) @@ -40,6 +40,10 @@ }; +/*! A service thread for each device interface. It just reads as many packets + as availabe, deframes them, and puts them into the receive queue of the + device interface. +*/ static status_t device_reader_thread(void* _interface) { @@ -108,6 +112,7 @@ } +/*! Removes the default routes as set by add_default_routes() again. */ static void remove_default_routes(net_interface_private* interface, int32 option) { @@ -131,6 +136,9 @@ } +/*! Adds the default routes that every interface needs, ie. the local host + route, and one for the subnet (if set). +*/ static void add_default_routes(net_interface_private* interface, int32 option) { @@ -450,7 +458,7 @@ } -net_interface* +net_interface* datalink_get_interface_with_address(net_domain* _domain, const sockaddr* address) { @@ -480,7 +488,7 @@ } -net_interface* +net_interface* datalink_get_interface(net_domain* domain, uint32 index) { if (index == 0) Modified: haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp 2009-03-03 08:53:47 UTC (rev 29383) +++ haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp 2009-03-03 10:39:55 UTC (rev 29384) @@ -56,13 +56,13 @@ #if 0 static void -dump_routes(net_domain_private *domain) +dump_routes(net_domain_private* domain) { RouteList::Iterator iterator = domain->routes.GetIterator(); uint32 count = 1; while (iterator.HasNext()) { - net_route_private *route = iterator.Next(); + net_route_private* route = iterator.Next(); dprintf(" [%lu] dest %s, mask %s, gw %s, flags %lx\n", count++, AddressString(domain, route->destination ? route->destination : NULL).Data(), @@ -75,7 +75,7 @@ static status_t -user_copy_address(const sockaddr *from, sockaddr **to) +user_copy_address(const sockaddr* from, sockaddr** to) { if (from == NULL) { *to = NULL; @@ -86,7 +86,7 @@ if (user_memcpy(&address, from, sizeof(struct sockaddr)) < B_OK) return B_BAD_ADDRESS; - *to = (sockaddr *)malloc(address.sa_len); + *to = (sockaddr*)malloc(address.sa_len); if (*to == NULL) return B_NO_MEMORY; @@ -101,7 +101,7 @@ static status_t -user_copy_address(const sockaddr *from, sockaddr_storage *to) +user_copy_address(const sockaddr* from, sockaddr_storage* to) { if (from == NULL) return B_BAD_ADDRESS; @@ -120,14 +120,14 @@ } -static net_route_private * -find_route(struct net_domain *_domain, const net_route *description) +static net_route_private* +find_route(struct net_domain* _domain, const net_route* description) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; RouteList::Iterator iterator = domain->routes.GetIterator(); while (iterator.HasNext()) { - net_route_private *route = iterator.Next(); + net_route_private* route = iterator.Next(); if ((route->flags & RTF_DEFAULT) != 0 && (description->flags & RTF_DEFAULT) != 0) { @@ -154,15 +154,15 @@ } -static net_route_private * -find_route(net_domain *_domain, const sockaddr *address) +static net_route_private* +find_route(net_domain* _domain, const sockaddr* address) { - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; // find last matching route RouteList::Iterator iterator = domain->routes.GetIterator(); - net_route_private *candidate = NULL; + net_route_private* candidate = NULL; TRACE(("test address %s for routes...\n", AddressString(domain, address).Data())); @@ -170,7 +170,7 @@ // TODO: alternate equal default routes while (iterator.HasNext()) { - net_route_private *route = iterator.Next(); + net_route_private* route = iterator.Next(); if (route->mask) { sockaddr maskedAddress; @@ -204,9 +204,9 @@ static void -put_route_internal(struct net_domain_private *domain, net_route *_route) +put_route_internal(struct net_domain_private* domain, net_route* _route) { - net_route_private *route = (net_route_private *)_route; + net_route_private* route = (net_route_private*)_route; if (route == NULL || atomic_add(&route->ref_count, -1) != 1) return; @@ -217,11 +217,11 @@ } -static struct net_route * -get_route_internal(struct net_domain_private *domain, - const struct sockaddr *address) +static struct net_route* +get_route_internal(struct net_domain_private* domain, + const struct sockaddr* address) { - net_route_private *route = NULL; + net_route_private* route = NULL; if (address->sa_family == AF_LINK) { // special address to find an interface directly @@ -254,12 +254,12 @@ static void -update_route_infos(struct net_domain_private *domain) +update_route_infos(struct net_domain_private* domain) { RouteInfoList::Iterator iterator = domain->route_infos.GetIterator(); while (iterator.HasNext()) { - net_route_info *info = iterator.Next(); + net_route_info* info = iterator.Next(); put_route_internal(domain, info->route); info->route = get_route_internal(domain, &info->address); @@ -267,21 +267,21 @@ } -static sockaddr * -copy_address(UserBuffer &buffer, sockaddr *address) +static sockaddr* +copy_address(UserBuffer& buffer, sockaddr* address) { if (address == NULL) return NULL; - return (sockaddr *)buffer.Copy(address, address->sa_len); + return (sockaddr*)buffer.Copy(address, address->sa_len); } static status_t -fill_route_entry(route_entry *target, void *_buffer, size_t bufferSize, - net_route *route) +fill_route_entry(route_entry* target, void* _buffer, size_t bufferSize, + net_route* route) { - UserBuffer buffer(((uint8 *)_buffer) + sizeof(route_entry), + UserBuffer buffer(((uint8*)_buffer) + sizeof(route_entry), bufferSize - sizeof(route_entry)); target->destination = copy_address(buffer, route->destination); @@ -298,19 +298,18 @@ // #pragma mark - exported functions -/*! - Determines the size of a buffer large enough to contain the whole +/*! Determines the size of a buffer large enough to contain the whole routing table. */ uint32 -route_table_size(net_domain_private *domain) +route_table_size(net_domain_private* domain) { MutexLocker locker(domain->lock); uint32 size = 0; RouteList::Iterator iterator = domain->routes.GetIterator(); while (iterator.HasNext()) { - net_route_private *route = iterator.Next(); + net_route_private* route = iterator.Next(); size += IF_NAMESIZE + sizeof(route_entry); if (route->destination) @@ -325,13 +324,12 @@ } -/*! - Dumps a list of all routes into the supplied userland buffer. +/*! Dumps a list of all routes into the supplied userland buffer. If the routes don't fit into the buffer, an error (\c ENOBUFS) is returned. */ status_t -list_routes(net_domain_private *domain, void *buffer, size_t size) +list_routes(net_domain_private* domain, void* buffer, size_t size) { RouteList::Iterator iterator = domain->routes.GetIterator(); size_t spaceLeft = size; @@ -342,27 +340,27 @@ zeros.sa_len = sizeof(sockaddr); while (iterator.HasNext()) { - net_route *route = iterator.Next(); + net_route* route = iterator.Next(); size = IF_NAMESIZE + sizeof(route_entry); - sockaddr *destination = NULL; - sockaddr *mask = NULL; - sockaddr *gateway = NULL; - uint8 *next = (uint8 *)buffer + size; + sockaddr* destination = NULL; + sockaddr* mask = NULL; + sockaddr* gateway = NULL; + uint8* next = (uint8*)buffer + size; if (route->destination != NULL) { - destination = (sockaddr *)next; + destination = (sockaddr*)next; next += route->destination->sa_len; size += route->destination->sa_len; } if (route->mask != NULL) { - mask = (sockaddr *)next; + mask = (sockaddr*)next; next += route->mask->sa_len; size += route->mask->sa_len; } if (route->gateway != NULL) { - gateway = (sockaddr *)next; + gateway = (sockaddr*)next; next += route->gateway->sa_len; size += route->gateway->sa_len; } @@ -389,7 +387,7 @@ route->gateway, route->gateway->sa_len) < B_OK)) return B_BAD_ADDRESS; - buffer = (void *)next; + buffer = (void*)next; spaceLeft -= size; } @@ -398,10 +396,10 @@ status_t -control_routes(struct net_interface *interface, int32 option, void *argument, +control_routes(struct net_interface* interface, int32 option, void* argument, size_t length) { - net_domain_private *domain = (net_domain_private *)interface->domain; + net_domain_private* domain = (net_domain_private*)interface->domain; switch (option) { case SIOCADDRT: @@ -412,7 +410,7 @@ return B_BAD_VALUE; route_entry entry; - if (user_memcpy(&entry, &((ifreq *)argument)->ifr_route, + if (user_memcpy(&entry, &((ifreq*)argument)->ifr_route, sizeof(route_entry)) != B_OK) return B_BAD_ADDRESS; @@ -440,9 +438,9 @@ status_t -add_route(struct net_domain *_domain, const struct net_route *newRoute) +add_route(struct net_domain* _domain, const struct net_route* newRoute) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; TRACE(("add route to domain %s: dest %s, mask %s, gw %s, flags %lx\n", domain->name, @@ -458,7 +456,7 @@ || !domain->address_module->check_mask(newRoute->mask)) return B_BAD_VALUE; - net_route_private *route = find_route(domain, newRoute); + net_route_private* route = find_route(domain, newRoute); if (route != NULL) return B_FILE_EXISTS; @@ -488,7 +486,7 @@ // Insert the route sorted by completeness of its mask RouteList::Iterator iterator = domain->routes.GetIterator(); - net_route_private *before = NULL; + net_route_private* before = NULL; while ((before = iterator.Next()) != NULL) { // if the before mask is less specific than the one of the route, @@ -515,9 +513,9 @@ status_t -remove_route(struct net_domain *_domain, const struct net_route *removeRoute) +remove_route(struct net_domain* _domain, const struct net_route* removeRoute) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; TRACE(("remove route from domain %s: dest %s, mask %s, gw %s, flags %lx\n", domain->name, @@ -529,7 +527,7 @@ // TODO: for now... //MutexLocker locker(domain->lock); - net_route_private *route = find_route(domain, removeRoute); + net_route_private* route = find_route(domain, removeRoute); if (route == NULL) return B_ENTRY_NOT_FOUND; @@ -541,9 +539,9 @@ status_t -get_route_information(struct net_domain *_domain, void *value, size_t length) +get_route_information(struct net_domain* _domain, void* value, size_t length) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; if (length < sizeof(route_entry)) return B_BAD_VALUE; @@ -559,7 +557,7 @@ MutexLocker locker(domain->lock); - net_route_private *route = find_route(domain, (sockaddr *)&destination); + net_route_private* route = find_route(domain, (sockaddr*)&destination); if (route == NULL) return B_ENTRY_NOT_FOUND; @@ -572,17 +570,17 @@ void -invalidate_routes(net_domain *_domain, net_interface *interface) +invalidate_routes(net_domain* _domain, net_interface* interface) { // this function is called with the domain locked // (see domain_interface_went_down) - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; dprintf("invalidate_routes(%i, %s)\n", domain->family, interface->name); RouteList::Iterator iterator = domain->routes.GetIterator(); while (iterator.HasNext()) { - net_route *route = iterator.Next(); + net_route* route = iterator.Next(); // TODO If we are removing the interface this will bork. // Consider the following case: @@ -603,10 +601,10 @@ } -struct net_route * -get_route(struct net_domain *_domain, const struct sockaddr *address) +struct net_route* +get_route(struct net_domain* _domain, const struct sockaddr* address) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; MutexLocker locker(domain->lock); return get_route_internal(domain, address); @@ -614,16 +612,16 @@ status_t -get_device_route(struct net_domain *_domain, uint32 index, net_route **_route) +get_device_route(struct net_domain* _domain, uint32 index, net_route** _route) { - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; MutexLocker _(domain->lock); - net_interface_private *interface = NULL; + net_interface_private* interface = NULL; while (true) { - interface = (net_interface_private *)list_get_next_item( + interface = (net_interface_private*)list_get_next_item( &domain->interfaces, interface); if (interface == NULL) break; @@ -640,25 +638,25 @@ status_t -get_buffer_route(net_domain *_domain, net_buffer *buffer, net_route **_route) +get_buffer_route(net_domain* _domain, net_buffer* buffer, net_route** _route) { - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; MutexLocker _(domain->lock); - net_route *route = get_route_internal(domain, buffer->destination); + net_route* route = get_route_internal(domain, buffer->destination); if (route == NULL) return ENETUNREACH; status_t status = B_OK; - sockaddr *source = buffer->source; + sockaddr* source = buffer->source; // TODO we are quite relaxed in the address checking here // as we might proceed with srcaddr=INADDR_ANY. if (route->interface && route->interface->address) { - sockaddr *interfaceAddress = route->interface->address; - net_address_module_info *addressModule = domain->address_module; + sockaddr* interfaceAddress = route->interface->address; + net_address_module_info* addressModule = domain->address_module; if (addressModule->is_empty_address(source, true)) addressModule->set_to(source, interfaceAddress); @@ -676,19 +674,19 @@ void -put_route(struct net_domain *_domain, net_route *route) +put_route(struct net_domain* _domain, net_route* route) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; MutexLocker locker(domain->lock); - put_route_internal(domain, (net_route *)route); + put_route_internal(domain, (net_route*)route); } status_t -register_route_info(struct net_domain *_domain, struct net_route_info *info) +register_route_info(struct net_domain* _domain, struct net_route_info* info) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; MutexLocker locker(domain->lock); domain->route_infos.Add(info); @@ -699,9 +697,9 @@ status_t -unregister_route_info(struct net_domain *_domain, struct net_route_info *info) +unregister_route_info(struct net_domain* _domain, struct net_route_info* info) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; MutexLocker locker(domain->lock); domain->route_infos.Remove(info); @@ -713,9 +711,9 @@ status_t -update_route_info(struct net_domain *_domain, struct net_route_info *info) +update_route_info(struct net_domain* _domain, struct net_route_info* info) { - struct net_domain_private *domain = (net_domain_private *)_domain; + struct net_domain_private* domain = (net_domain_private*)_domain; MutexLocker locker(domain->lock); put_route_internal(domain, info->route); From aldeck at mail.berlios.de Tue Mar 3 13:36:41 2009 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Tue, 3 Mar 2009 13:36:41 +0100 Subject: [Haiku-commits] r29385 - haiku/trunk/src/tests/kits/interface/bshelf Message-ID: <200903031236.n23Caf7f009363@sheep.berlios.de> Author: aldeck Date: 2009-03-03 13:36:41 +0100 (Tue, 03 Mar 2009) New Revision: 29385 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29385&view=rev Modified: haiku/trunk/src/tests/kits/interface/bshelf/Jamfile haiku/trunk/src/tests/kits/interface/bshelf/ShelfTest.cpp Log: * Fix build of ShelfTest Modified: haiku/trunk/src/tests/kits/interface/bshelf/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/interface/bshelf/Jamfile 2009-03-03 10:39:55 UTC (rev 29384) +++ haiku/trunk/src/tests/kits/interface/bshelf/Jamfile 2009-03-03 12:36:41 UTC (rev 29385) @@ -12,7 +12,6 @@ SimpleTest ShelfTest : ShelfTest.cpp - Shelf.cpp : be ; Modified: haiku/trunk/src/tests/kits/interface/bshelf/ShelfTest.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/bshelf/ShelfTest.cpp 2009-03-03 10:39:55 UTC (rev 29384) +++ haiku/trunk/src/tests/kits/interface/bshelf/ShelfTest.cpp 2009-03-03 12:36:41 UTC (rev 29385) @@ -24,7 +24,7 @@ #include #include #include -#include +#include #define MAGIC_1 'pjpp' #define MAGIC_2 'jahh' @@ -162,7 +162,7 @@ { delete fShelf; // by deleting the Shelf we'll save the state fShelf = NULL; - inherited::Quit(); + BWindow::Quit(); } /*------------------------------------------------------------*/ From axeld at mail.berlios.de Tue Mar 3 15:04:58 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Mar 2009 15:04:58 +0100 Subject: [Haiku-commits] r29386 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200903031404.n23E4wGv017986@sheep.berlios.de> Author: axeld Date: 2009-03-03 15:04:57 +0100 (Tue, 03 Mar 2009) New Revision: 29386 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29386&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp haiku/trunk/src/add-ons/kernel/network/stack/domains.cpp haiku/trunk/src/add-ons/kernel/network/stack/domains.h haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp haiku/trunk/src/add-ons/kernel/network/stack/routes.h Log: * The net_domain's lock is now a recursive lock. * Fixed all route locking problems, of which there were numerous ({add|remove}_route(), and list_routes() did not lock at all). Added lock assertions in functions that don't do the locking themselves. * A route will now be removed from the list in remove_route(), not in put_route_internal(). Before, a route could easily be removed twice, causing remove_route() to release references it did not own. This fixes bug #2706. Modified: haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp 2009-03-03 12:36:41 UTC (rev 29385) +++ haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp 2009-03-03 14:04:57 UTC (rev 29386) @@ -195,7 +195,7 @@ if (user_memcpy(&request, value, expected) < B_OK) return B_BAD_ADDRESS; - MutexLocker _(domain->lock); + RecursiveLocker _(domain->lock); net_interface* interface = NULL; if (getByName) @@ -320,7 +320,7 @@ if (user_memcpy(&request, value, sizeof(struct ifreq)) < B_OK) return B_BAD_ADDRESS; - MutexLocker _(domain->lock); + RecursiveLocker _(domain->lock); net_interface* interface = find_interface(domain, request.ifr_name); @@ -413,7 +413,7 @@ if (domain == NULL || address == NULL) return false; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); net_interface* interface = NULL; net_interface* fallback = NULL; @@ -466,7 +466,7 @@ if (domain == NULL) return NULL; - MutexLocker _(domain->lock); + RecursiveLocker _(domain->lock); net_interface* interface = NULL; Modified: haiku/trunk/src/add-ons/kernel/network/stack/domains.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/domains.cpp 2009-03-03 12:36:41 UTC (rev 29385) +++ haiku/trunk/src/add-ons/kernel/network/stack/domains.cpp 2009-03-03 14:04:57 UTC (rev 29386) @@ -36,11 +36,10 @@ static list sDomains; -/*! - Scans the domain list for the specified family. +/*! Scans the domain list for the specified family. You need to hold the sDomainLock when calling this function. */ -static net_domain_private* +static net_domain_private* lookup_domain(int family) { net_domain_private* domain = NULL; @@ -60,10 +59,9 @@ // #pragma mark - -/*! - Gets the domain of the specified family. +/*! Gets the domain of the specified family. */ -net_domain* +net_domain* get_domain(int family) { MutexLocker locker(sDomainLock); @@ -117,7 +115,7 @@ if (domain == NULL) break; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); net_interface* interface = NULL; while (true) { @@ -163,7 +161,7 @@ if (deviceInterface == NULL) return ENODEV; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); net_interface_private* interface = NULL; status_t status; @@ -226,7 +224,7 @@ // and domain locks are required, we MUST obtain the receive // lock before the domain lock. RecursiveLocker _1(device->receive_lock); - MutexLocker _2(domain->lock); + RecursiveLocker _2(domain->lock); net_interface* interface = find_interface(domain, name); if (interface != NULL) { @@ -273,7 +271,7 @@ void domain_interface_went_down(net_interface* interface) { - ASSERT_LOCKED_MUTEX(&((net_domain_private*)interface->domain)->lock); + ASSERT_LOCKED_RECURSIVE(&((net_domain_private*)interface->domain)->lock); TRACE(("domain_interface_went_down(%i, %s)\n", interface->domain->family, interface->name)); @@ -293,7 +291,7 @@ if (domain == NULL) break; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); net_interface_private* interface = find_interface(domain, deviceInterface->device->name); @@ -322,7 +320,7 @@ if (domain == NULL) return B_NO_MEMORY; - mutex_init(&domain->lock, name); + recursive_lock_init(&domain->lock, name); domain->family = family; domain->name = name; @@ -359,7 +357,7 @@ delete_interface(interface); } - mutex_destroy(&domain->lock); + recursive_lock_destroy(&domain->lock); delete domain; return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/network/stack/domains.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/domains.h 2009-03-03 12:36:41 UTC (rev 29385) +++ haiku/trunk/src/add-ons/kernel/network/stack/domains.h 2009-03-03 14:04:57 UTC (rev 29386) @@ -1,5 +1,5 @@ /* - * Copyright 2006-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -22,7 +22,7 @@ struct net_domain_private : net_domain { struct list_link link; - mutex lock; + recursive_lock lock; RouteList routes; RouteInfoList route_infos; @@ -33,19 +33,18 @@ status_t uninit_domains(); uint32 count_domain_interfaces(); -status_t list_domain_interfaces(void *buffer, size_t *_bufferSize); -status_t add_interface_to_domain(net_domain *domain, struct ifreq& request); -status_t remove_interface_from_domain(net_interface *interface); -void domain_interface_went_down(net_interface *); -void domain_removed_device_interface(net_device_interface *); -status_t domain_interface_control(net_domain_private *domain, int32 option, - struct ifreq *request); +status_t list_domain_interfaces(void* buffer, size_t* _bufferSize); +status_t add_interface_to_domain(net_domain* domain, struct ifreq& request); +status_t remove_interface_from_domain(net_interface* interface); +void domain_interface_went_down(net_interface* interface); +void domain_removed_device_interface(net_device_interface* interface); +status_t domain_interface_control(net_domain_private* domain, int32 option, + struct ifreq* request); -net_domain *get_domain(int family); -status_t register_domain(int family, const char *name, - struct net_protocol_module_info *module, - struct net_address_module_info *addressModule, - net_domain **_domain); -status_t unregister_domain(net_domain *domain); +net_domain* get_domain(int family); +status_t register_domain(int family, const char* name, + struct net_protocol_module_info* module, + struct net_address_module_info* addressModule, net_domain* *_domain); +status_t unregister_domain(net_domain* domain); #endif // DOMAINS_H Modified: haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp 2009-03-03 12:36:41 UTC (rev 29385) +++ haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp 2009-03-03 14:04:57 UTC (rev 29386) @@ -327,7 +327,7 @@ { // TODO: reference counting // TODO: better locking scheme - mutex_unlock(&((net_domain_private*)interface->domain)->lock); + recursive_lock_unlock(&((net_domain_private*)interface->domain)->lock); } @@ -335,7 +335,7 @@ get_interface(net_domain* _domain, const char* name) { net_domain_private* domain = (net_domain_private*)_domain; - mutex_lock(&domain->lock); + recursive_lock_lock(&domain->lock); net_interface_private* interface = NULL; while (true) { @@ -344,11 +344,12 @@ if (interface == NULL) break; + // TODO: We keep the domain locked for now if (!strcmp(interface->name, name)) return interface; } - mutex_unlock(&domain->lock); + recursive_lock_unlock(&domain->lock); return NULL; } Modified: haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp 2009-03-03 12:36:41 UTC (rev 29385) +++ haiku/trunk/src/add-ons/kernel/network/stack/routes.cpp 2009-03-03 14:04:57 UTC (rev 29386) @@ -206,13 +206,17 @@ static void put_route_internal(struct net_domain_private* domain, net_route* _route) { + ASSERT_LOCKED_RECURSIVE(&domain->lock); + net_route_private* route = (net_route_private*)_route; if (route == NULL || atomic_add(&route->ref_count, -1) != 1) return; - // remove route + // delete route - it must already have been removed at this point - domain->routes.Remove(route); + ASSERT(route->GetDoublyLinkedListLink()->next == NULL + && route->GetDoublyLinkedListLink()->previous == NULL); + delete route; } @@ -221,6 +225,7 @@ get_route_internal(struct net_domain_private* domain, const struct sockaddr* address) { + ASSERT_LOCKED_RECURSIVE(&domain->lock); net_route_private* route = NULL; if (address->sa_family == AF_LINK) { @@ -256,6 +261,7 @@ static void update_route_infos(struct net_domain_private* domain) { + ASSERT_LOCKED_RECURSIVE(&domain->lock); RouteInfoList::Iterator iterator = domain->route_infos.GetIterator(); while (iterator.HasNext()) { @@ -304,7 +310,7 @@ uint32 route_table_size(net_domain_private* domain) { - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); uint32 size = 0; RouteList::Iterator iterator = domain->routes.GetIterator(); @@ -331,6 +337,8 @@ status_t list_routes(net_domain_private* domain, void* buffer, size_t size) { + RecursiveLocker _(domain->lock); + RouteList::Iterator iterator = domain->routes.GetIterator(); size_t spaceLeft = size; @@ -456,6 +464,8 @@ || !domain->address_module->check_mask(newRoute->mask)) return B_BAD_VALUE; + RecursiveLocker _(domain->lock); + net_route_private* route = find_route(domain, newRoute); if (route != NULL) return B_FILE_EXISTS; @@ -480,9 +490,6 @@ route->mtu = 0; route->ref_count = 1; - // TODO: for now... - //MutexLocker locker(domain->lock); - // Insert the route sorted by completeness of its mask RouteList::Iterator iterator = domain->routes.GetIterator(); @@ -524,13 +531,14 @@ AddressString(domain, removeRoute->gateway ? removeRoute->gateway : NULL).Data(), removeRoute->flags)); - // TODO: for now... - //MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); net_route_private* route = find_route(domain, removeRoute); if (route == NULL) return B_ENTRY_NOT_FOUND; + domain->routes.Remove(route); + put_route_internal(domain, route); update_route_infos(domain); @@ -555,7 +563,7 @@ if (status != B_OK) return status; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); net_route_private* route = find_route(domain, (sockaddr*)&destination); if (route == NULL) @@ -582,19 +590,6 @@ while (iterator.HasNext()) { net_route* route = iterator.Next(); - // TODO If we are removing the interface this will bork. - // Consider the following case: - // [thread 1] ipv4_send_data() - // [thread 1] get_route() [domain locked, unlocked] <- route - // [thread 2] ... [domain locked] - // [thread 2] invalidate_routes() - // [thread 2] remove_route() <- route - // [thread 1] ... ipv4_send_data() accesses `route'. Bork bork. - // - // We could either add per-route locks (expensive) or - // lock the domain throughout the send_data() routine. - // These are the easy solutions, need to think about this. -hugo - if (route->interface->index == interface->index) remove_route(domain, route); } @@ -605,7 +600,7 @@ get_route(struct net_domain* _domain, const struct sockaddr* address) { struct net_domain_private* domain = (net_domain_private*)_domain; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); return get_route_internal(domain, address); } @@ -616,7 +611,7 @@ { net_domain_private* domain = (net_domain_private*)_domain; - MutexLocker _(domain->lock); + RecursiveLocker _(domain->lock); net_interface_private* interface = NULL; @@ -642,7 +637,7 @@ { net_domain_private* domain = (net_domain_private*)_domain; - MutexLocker _(domain->lock); + RecursiveLocker _(domain->lock); net_route* route = get_route_internal(domain, buffer->destination); if (route == NULL) @@ -677,7 +672,7 @@ put_route(struct net_domain* _domain, net_route* route) { struct net_domain_private* domain = (net_domain_private*)_domain; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); put_route_internal(domain, (net_route*)route); } @@ -687,7 +682,7 @@ register_route_info(struct net_domain* _domain, struct net_route_info* info) { struct net_domain_private* domain = (net_domain_private*)_domain; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); domain->route_infos.Add(info); info->route = get_route_internal(domain, &info->address); @@ -700,7 +695,7 @@ unregister_route_info(struct net_domain* _domain, struct net_route_info* info) { struct net_domain_private* domain = (net_domain_private*)_domain; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); domain->route_infos.Remove(info); if (info->route != NULL) @@ -714,7 +709,7 @@ update_route_info(struct net_domain* _domain, struct net_route_info* info) { struct net_domain_private* domain = (net_domain_private*)_domain; - MutexLocker locker(domain->lock); + RecursiveLocker locker(domain->lock); put_route_internal(domain, info->route); info->route = get_route_internal(domain, &info->address); Modified: haiku/trunk/src/add-ons/kernel/network/stack/routes.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/routes.h 2009-03-03 12:36:41 UTC (rev 29385) +++ haiku/trunk/src/add-ons/kernel/network/stack/routes.h 2009-03-03 14:04:57 UTC (rev 29386) @@ -15,7 +15,8 @@ #include -struct net_route_private : net_route, public DoublyLinkedListLinkImpl { +struct net_route_private + : net_route, DoublyLinkedListLinkImpl { int32 ref_count; net_route_private(); From axeld at mail.berlios.de Tue Mar 3 15:13:24 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Mar 2009 15:13:24 +0100 Subject: [Haiku-commits] r29387 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200903031413.n23EDOk6018968@sheep.berlios.de> Author: axeld Date: 2009-03-03 15:13:23 +0100 (Tue, 03 Mar 2009) New Revision: 29387 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29387&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/stack/routes.h Log: * Minor cleanup. Modified: haiku/trunk/src/add-ons/kernel/network/stack/routes.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/routes.h 2009-03-03 14:04:57 UTC (rev 29386) +++ haiku/trunk/src/add-ons/kernel/network/stack/routes.h 2009-03-03 14:13:23 UTC (rev 29387) @@ -1,5 +1,5 @@ /* - * Copyright 2006-2008, Haiku, Inc. All Rights Reserved. + * Copyright 2006-2009, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -28,32 +28,32 @@ DoublyLinkedListCLink > RouteInfoList; -uint32 route_table_size(struct net_domain_private *domain); -status_t list_routes(struct net_domain_private *domain, void *buffer, +uint32 route_table_size(struct net_domain_private* domain); +status_t list_routes(struct net_domain_private* domain, void* buffer, size_t size); -status_t control_routes(struct net_interface *interface, - int32 option, void *argument, size_t length); +status_t control_routes(struct net_interface* interface, + int32 option, void* argument, size_t length); -status_t add_route(struct net_domain *domain, - const struct net_route *route); -status_t remove_route(struct net_domain *domain, - const struct net_route *route); -status_t get_route_information(struct net_domain *domain, void *buffer, +status_t add_route(struct net_domain* domain, + const struct net_route* route); +status_t remove_route(struct net_domain* domain, + const struct net_route* route); +status_t get_route_information(struct net_domain* domain, void* buffer, size_t length); -void invalidate_routes(net_domain *, net_interface *); -struct net_route *get_route(struct net_domain *domain, - const struct sockaddr *address); -status_t get_device_route(struct net_domain *domain, uint32 index, - struct net_route **_route); -status_t get_buffer_route(struct net_domain *domain, - struct net_buffer *buffer, struct net_route **_route); -void put_route(struct net_domain *domain, struct net_route *route); +void invalidate_routes(net_domain* , net_interface* ); +struct net_route* get_route(struct net_domain* domain, + const struct sockaddr* address); +status_t get_device_route(struct net_domain* domain, uint32 index, + struct net_route** _route); +status_t get_buffer_route(struct net_domain* domain, + struct net_buffer* buffer, struct net_route** _route); +void put_route(struct net_domain* domain, struct net_route* route); -status_t register_route_info(struct net_domain *domain, - struct net_route_info *info); -status_t unregister_route_info(struct net_domain *domain, - struct net_route_info *info); -status_t update_route_info(struct net_domain *domain, - struct net_route_info *info); +status_t register_route_info(struct net_domain* domain, + struct net_route_info* info); +status_t unregister_route_info(struct net_domain* domain, + struct net_route_info* info); +status_t update_route_info(struct net_domain* domain, + struct net_route_info* info); #endif // ROUTES_H From axeld at pinc-software.de Tue Mar 3 19:58:40 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Mar 2009 19:58:40 +0100 CET Subject: [Haiku-commits] r29378 - haiku/trunk/src/system/kernel/fs In-Reply-To: <49AB9EFF.6030907@gmx.de> Message-ID: <40138640759-BeMail@zon> Stephan A?mus wrote: > > Log: > > * Fixed wrong use of MutexLocker as pointed out by Korli - nice > > catch! This > > could have caused a number of problems. > Wow, nice catch indeed. What type of problems could have been caused? > Would it only affect the files that one process opened? I could access a file descriptor that was about to be removed, and could therefore access freed (or reused) memory at the worst case. Bye, Axel. From axeld at pinc-software.de Tue Mar 3 20:00:46 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Mar 2009 20:00:46 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29284_-_in_haiku/trunk=3A_build/jam_sr?= =?utf-8?q?c/add-ons/mail=5Fdaemon/inbound=5Ffilters/spam=5Ffilter_src/app?= =?utf-8?q?s/mail_src/bin/bemail=5Futils?= In-Reply-To: <200902221345.n1MDjfa7017161@sheep.berlios.de> Message-ID: <40264577202-BeMail@zon> bga at BerliOS wrote: > Log: > The Spam DBM may not have the best interface in the world but it is > one of the best > anti-spam tool I saw so I am adding it to the image (in fact the > interface with changes > by darkwyrm looks worse than the original one, IMHO). If that means the interface will be redone before R1/alpha (or even removed), I'm okay with this, but I would really not like to have any release with it as is. Bye, Axel. From oruizdorantes at mail.berlios.de Tue Mar 3 20:02:26 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Tue, 3 Mar 2009 20:02:26 +0100 Subject: [Haiku-commits] r29388 - haiku/trunk/src/preferences/bluetooth Message-ID: <200903031902.n23J2QED027161@sheep.berlios.de> Author: oruizdorantes Date: 2009-03-03 20:02:26 +0100 (Tue, 03 Mar 2009) New Revision: 29388 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29388&view=rev Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp haiku/trunk/src/preferences/bluetooth/InquiryPanel.h Log: - Use SetSelectionMessage to enable/disable the possibility to add to general list Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-03-03 14:13:23 UTC (rev 29387) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-03-03 19:02:26 UTC (rev 29388) @@ -36,6 +36,7 @@ static const uint32 kMsgInquiry = 'iQbt'; static const uint32 kMsgAddListDevice = 'aDdv'; +static const uint32 kMsgSelected = 'isLt'; static const uint32 kMsgSecond = 'sCMs'; @@ -112,6 +113,7 @@ fAddButton->SetEnabled(false); fRemoteList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); + fRemoteList->SetSelectionMessage(new BMessage(kMsgSelected)); fScrollView = new BScrollView("ScrollView", fRemoteList, 0, false, true); fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -133,7 +135,7 @@ fInquiryButton->SetEnabled(false); } - fRunner = new BMessageRunner(BMessenger(this), new BMessage(kMsgSecond), 1000000L, -1); + fRunner = new BMessageRunner(BMessenger(this), new BMessage(kMsgSecond), 1000000L); AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) @@ -193,6 +195,10 @@ // TODO: all others listitems can be deleted } break; + + case kMsgSelected: + UpdateListStatus(); + break; case kMsgStart: fRemoteList->MakeEmpty(); @@ -208,6 +214,7 @@ fScanning = false; fRetrieving = true; + UpdateListStatus(); UpdateUIStatus(); break; @@ -227,7 +234,7 @@ if (fRetrieving) { if (retrievalIndex < fDiscoveryAgent->RetrieveDevices(0).CountItems()) { - + ((DeviceListItem*)fRemoteList->ItemAt(retrievalIndex))-> SetDevice((BluetoothDevice*)fDiscoveryAgent->RetrieveDevices(0).ItemAt(retrievalIndex)); @@ -262,6 +269,7 @@ fAddButton->SetEnabled(false); fInquiryButton->SetEnabled(false); fScanProgress->SetBarColor(activeColor); + fAddButton->SetEnabled(false); } else if (fRetrieving) { fInquiryButton->SetEnabled(true); @@ -270,12 +278,16 @@ } else { } - - if (fRemoteList->CurrentSelection() < 0 || fScanning) +} + + +void +InquiryPanel::UpdateListStatus(void) +{ + if (fRemoteList->CurrentSelection() < 0 || fScanning || fRetrieving) fAddButton->SetEnabled(false); else fAddButton->SetEnabled(true); - } Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-03-03 14:13:23 UTC (rev 29387) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-03-03 19:02:26 UTC (rev 29388) @@ -44,6 +44,7 @@ void UpdateUIStatus(void); + void UpdateListStatus(void); rgb_color activeColor; }; From bga at bug-br.org.br Tue Mar 3 20:14:05 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 03 Mar 2009 16:14:05 -0300 Subject: [Haiku-commits] r29284 - in haiku/trunk: build/jam src/add-ons/mail_daemon/inbound_filters/spam_filter src/apps/mail src/bin/bemail_utils In-Reply-To: <40264577202-BeMail@zon> References: <40264577202-BeMail@zon> Message-ID: <49AD817D.7040900@bug-br.org.br> Axel D?rfler wrote: >> The Spam DBM may not have the best interface in the world but it is >> one of the best >> anti-spam tool I saw so I am adding it to the image (in fact the >> interface with changes >> by darkwyrm looks worse than the original one, IMHO). > > If that means the interface will be redone before R1/alpha (or even > removed), I'm okay with this, but I would really not like to have any > release with it as is. I *REALLY* think the functionality trumps the interface being what it is (in fact, as I know how to use it, I have no problems with it whatsoever). Removing something as useful as this just because we think it is not pretty enough or the interface is confusing (a interface that will almost never be used by anyone, other then to set it, BTW) does not seem to be the best course of action. Of course if someone wants to improve the interface, I am all for it. -Bruno From axeld at mail.berlios.de Tue Mar 3 22:48:59 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 3 Mar 2009 22:48:59 +0100 Subject: [Haiku-commits] r29389 - haiku/trunk/src/preferences/virtualmemory Message-ID: <200903032148.n23Lmxc1018603@sheep.berlios.de> Author: axeld Date: 2009-03-03 22:48:59 +0100 (Tue, 03 Mar 2009) New Revision: 29389 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29389&view=rev Modified: haiku/trunk/src/preferences/virtualmemory/SettingsWindow.cpp Log: * Haiku's VM does not need the swap file to be as large as physical memory at minimum to be able to work with it. Modified: haiku/trunk/src/preferences/virtualmemory/SettingsWindow.cpp =================================================================== --- haiku/trunk/src/preferences/virtualmemory/SettingsWindow.cpp 2009-03-03 19:02:26 UTC (rev 29388) +++ haiku/trunk/src/preferences/virtualmemory/SettingsWindow.cpp 2009-03-03 21:48:59 UTC (rev 29389) @@ -1,5 +1,5 @@ /* - * Copyright 2005-2006, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2005-2009, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the MIT License. */ @@ -284,10 +284,8 @@ status_t SettingsWindow::_GetSwapFileLimits(off_t& minSize, off_t& maxSize) { - // minimum size is the installed memory - system_info info; - get_system_info(&info); - minSize = (off_t)info.max_pages * B_PAGE_SIZE; + // minimum size is an arbitrarily chosen MB + minSize = kMegaByte; // maximum size is the free space on the current volume // (minus some safety offset, depending on the disk size) From bonefish at mail.berlios.de Wed Mar 4 00:42:22 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 4 Mar 2009 00:42:22 +0100 Subject: [Haiku-commits] r29390 - in haiku/trunk: headers/private/userlandfs/private src/add-ons/kernel/file_systems/userlandfs/kernel_add_on src/add-ons/kernel/file_systems/userlandfs/private src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200903032342.n23NgMiC007736@sheep.berlios.de> Author: bonefish Date: 2009-03-04 00:42:20 +0100 (Wed, 04 Mar 2009) New Revision: 29390 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29390&view=rev Added: haiku/trunk/headers/private/userlandfs/private/UserlandFSDefs.h Removed: haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/private/DispatcherDefs.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/DispatcherFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/DispatcherFileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FSInfo.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSDispatcher.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSDispatcher.h Modified: haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h Log: Removed the remnants of the dispatcher mechanism. Deleted: haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h Modified: haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h 2009-03-03 23:42:20 UTC (rev 29390) @@ -1,5 +1,7 @@ -// FSCapabilities.h - +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_FS_CAPABILITIES_H #define USERLAND_FS_FS_CAPABILITIES_H Copied: haiku/trunk/headers/private/userlandfs/private/UserlandFSDefs.h (from rev 29377, haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h) =================================================================== --- haiku/trunk/headers/private/userlandfs/private/DispatcherDefs.h 2009-03-02 00:37:14 UTC (rev 29377) +++ haiku/trunk/headers/private/userlandfs/private/UserlandFSDefs.h 2009-03-03 23:42:20 UTC (rev 29390) @@ -0,0 +1,25 @@ +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef USERLAND_FS_USERLAND_FS_DEFS_H +#define USERLAND_FS_USERLAND_FS_DEFS_H + +#include "FSCapabilities.h" +#include "Port.h" + + +namespace UserlandFSUtil { + +struct fs_init_info { + FSCapabilities capabilities; + client_fs_type clientFSType; + int32 portInfoCount; + Port::Info portInfos[0]; +}; + +} // namespace UserlandFSUtil + +using UserlandFSUtil::fs_init_info; + +#endif // USERLAND_FS_USERLAND_FS_DEFS_H Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystemInitializer.cpp 2009-03-03 23:42:20 UTC (rev 29390) @@ -15,12 +15,12 @@ #include "AutoDeleter.h" -#include "DispatcherDefs.h" #include "FileSystem.h" #include "RequestAllocator.h" #include "RequestPort.h" #include "Requests.h" #include "SingleReplyRequestHandler.h" +#include "UserlandFSDefs.h" // constructor Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Jamfile 2009-03-03 23:42:20 UTC (rev 29390) @@ -16,7 +16,6 @@ KernelAddon userlandfs : AreaSupport.cpp Debug.cpp - DispatcherDefs.cpp LazyInitializable.cpp Locker.cpp ObjectTracker.cpp Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/UserlandFS.cpp 2009-03-03 23:42:20 UTC (rev 29390) @@ -9,12 +9,12 @@ #include "Compatibility.h" #include "Debug.h" -#include "DispatcherDefs.h" #include "FileSystem.h" #include "FileSystemInitializer.h" #include "KernelDebug.h" #include "RequestPort.h" #include "Requests.h" +#include "UserlandFSDefs.h" UserlandFS* UserlandFS::sUserlandFS = NULL; Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/private/DispatcherDefs.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/DispatcherFileSystem.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/DispatcherFileSystem.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FSInfo.h Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-03-03 23:42:20 UTC (rev 29390) @@ -20,7 +20,6 @@ : AreaSupport.cpp Debug.cpp - DispatcherDefs.cpp driver_settings.c LazyInitializable.cpp Locker.cpp @@ -35,13 +34,11 @@ SingleReplyRequestHandler.cpp String.cpp - DispatcherFileSystem.cpp FileSystem.cpp kernel_emu.cpp main.cpp RequestThread.cpp ServerDefs.cpp -# UserlandFSDispatcher.cpp UserlandFSServer.cpp UserlandRequestHandler.cpp Volume.cpp Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.cpp 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.cpp 2009-03-03 23:42:20 UTC (rev 29390) @@ -1,4 +1,7 @@ -// ServerDefs.cpp +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include "ServerDefs.h" @@ -29,7 +32,3 @@ // the global settings ServerSettings UserlandFS::gServerSettings; - -const char* UserlandFS::kUserlandFSDispatcherClipboardName - = "userland fs dispatcher"; - Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.h 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/ServerDefs.h 2009-03-03 23:42:20 UTC (rev 29390) @@ -1,5 +1,7 @@ -// ServerDefs.h - +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_SERVER_DEFS_H #define USERLAND_FS_SERVER_DEFS_H @@ -21,21 +23,12 @@ extern ServerSettings gServerSettings; -enum { - UFS_REGISTER_FS = 'rgfs', - UFS_REGISTER_FS_ACK = 'rfsa', - UFS_REGISTER_FS_DENIED = 'rfsd', -}; - -extern const char* kUserlandFSDispatcherClipboardName; - static const int32 kRequestPortSize = B_PAGE_SIZE; } // namespace UserlandFS using UserlandFS::ServerSettings; using UserlandFS::gServerSettings; -using UserlandFS::kUserlandFSDispatcherClipboardName; using UserlandFS::kRequestPortSize; #endif // USERLAND_FS_SERVER_DEFS_H Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSDispatcher.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSDispatcher.h Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-03-03 23:42:20 UTC (rev 29390) @@ -1,4 +1,7 @@ -// UserlandFSServer.cpp +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include "UserlandFSServer.h" @@ -19,11 +22,10 @@ #include "AutoLocker.h" #include "Compatibility.h" #include "Debug.h" -#include "DispatcherDefs.h" #include "FileSystem.h" -#include "FSInfo.h" #include "RequestThread.h" #include "ServerDefs.h" +#include "UserlandFSDefs.h" static const int32 kRequestThreadCount = 10; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h 2009-03-03 21:48:59 UTC (rev 29389) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h 2009-03-03 23:42:20 UTC (rev 29390) @@ -1,5 +1,7 @@ -// UserlandFSServer.h - +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_SERVER_H #define USERLAND_FS_SERVER_H From bonefish at mail.berlios.de Wed Mar 4 01:01:31 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 4 Mar 2009 01:01:31 +0100 Subject: [Haiku-commits] r29391 - in haiku/trunk: headers/private/userlandfs/private src/add-ons/kernel/file_systems/userlandfs/kernel_add_on src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200903040001.n2401Vue022996@sheep.berlios.de> Author: bonefish Date: 2009-03-04 01:01:27 +0100 (Wed, 04 Mar 2009) New Revision: 29391 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29391&view=rev Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp Log: Implemented acquire_vnode() forwarding. Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-03-03 23:42:20 UTC (rev 29390) +++ haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-03-04 00:01:27 UTC (rev 29391) @@ -192,6 +192,8 @@ GET_VNODE_REPLY, PUT_VNODE_REQUEST, PUT_VNODE_REPLY, + ACQUIRE_VNODE_REQUEST, + ACQUIRE_VNODE_REPLY, NEW_VNODE_REQUEST, NEW_VNODE_REPLY, PUBLISH_VNODE_REQUEST, @@ -1465,6 +1467,21 @@ PutVNodeReply() : ReplyRequest(PUT_VNODE_REPLY) {} }; +// AcquireVNodeRequest +class AcquireVNodeRequest : public Request { +public: + AcquireVNodeRequest() : Request(ACQUIRE_VNODE_REQUEST) {} + + dev_t nsid; + ino_t vnid; +}; + +// AcquireVNodeReply +class AcquireVNodeReply : public ReplyRequest { +public: + AcquireVNodeReply() : ReplyRequest(ACQUIRE_VNODE_REPLY) {} +}; + // NewVNodeRequest class NewVNodeRequest : public Request { public: @@ -2073,6 +2090,8 @@ using UserlandFSUtil::GetVNodeReply; using UserlandFSUtil::PutVNodeRequest; using UserlandFSUtil::PutVNodeReply; +using UserlandFSUtil::AcquireVNodeRequest; +using UserlandFSUtil::AcquireVNodeReply; using UserlandFSUtil::NewVNodeRequest; using UserlandFSUtil::NewVNodeReply; using UserlandFSUtil::PublishVNodeRequest; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.cpp 2009-03-03 23:42:20 UTC (rev 29390) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.cpp 2009-03-04 00:01:27 UTC (rev 29391) @@ -72,6 +72,8 @@ return _HandleRequest((GetVNodeRequest*)request); case PUT_VNODE_REQUEST: return _HandleRequest((PutVNodeRequest*)request); + case ACQUIRE_VNODE_REQUEST: + return _HandleRequest((AcquireVNodeRequest*)request); case NEW_VNODE_REQUEST: return _HandleRequest((NewVNodeRequest*)request); case PUBLISH_VNODE_REQUEST: @@ -346,8 +348,33 @@ return fPort->SendRequest(&allocator); } + // _HandleRequest status_t +KernelRequestHandler::_HandleRequest(AcquireVNodeRequest* request) +{ + // check and executed the request + Volume* volume = NULL; + status_t result = _GetVolume(request->nsid, &volume); + VolumePutter _(volume); + if (result == B_OK) + result = volume->AcquireVNode(request->vnid); + + // prepare the reply + RequestAllocator allocator(fPort->GetPort()); + AcquireVNodeReply* reply; + status_t error = AllocateRequest(allocator, &reply); + if (error != B_OK) + return error; + reply->error = result; + + // send the reply + return fPort->SendRequest(&allocator); +} + + +// _HandleRequest +status_t KernelRequestHandler::_HandleRequest(NewVNodeRequest* request) { // check and executed the request Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.h 2009-03-03 23:42:20 UTC (rev 29390) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.h 2009-03-04 00:01:27 UTC (rev 29391) @@ -12,6 +12,7 @@ namespace UserlandFSUtil { +class AcquireVNodeRequest; class GetVNodeRemovedRequest; class GetVNodeRequest; class NewVNodeRequest; @@ -25,6 +26,7 @@ } +using UserlandFSUtil::AcquireVNodeRequest; using UserlandFSUtil::GetVNodeRemovedRequest; using UserlandFSUtil::GetVNodeRequest; using UserlandFSUtil::NewVNodeRequest; @@ -57,6 +59,7 @@ // vnodes status_t _HandleRequest(GetVNodeRequest* request); status_t _HandleRequest(PutVNodeRequest* request); + status_t _HandleRequest(AcquireVNodeRequest* request); status_t _HandleRequest(NewVNodeRequest* request); status_t _HandleRequest(PublishVNodeRequest* request); status_t _HandleRequest(RemoveVNodeRequest* request); Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.cpp 2009-03-03 23:42:20 UTC (rev 29390) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.cpp 2009-03-04 00:01:27 UTC (rev 29391) @@ -151,6 +151,24 @@ return error; } + +// AcquireVNode +status_t +Volume::AcquireVNode(ino_t vnid) +{ +PRINT(("acquire_vnode(%ld, %lld)\n", GetID(), vnid)); + if (IsMounting() && !fMountVNodes->ContainsKey(vnid)) { + ERROR(("Volume::AcquireVNode(): acquire_vnode() invoked for unknown " + "vnode while mounting!\n")); + } + + status_t error = acquire_vnode(fFSVolume, vnid); + if (error == B_OK) + _IncrementVNodeCount(vnid); + return error; +} + + // NewVNode status_t Volume::NewVNode(ino_t vnid, void* node) Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.h 2009-03-03 23:42:20 UTC (rev 29390) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.h 2009-03-04 00:01:27 UTC (rev 29391) @@ -49,6 +49,7 @@ // client methods status_t GetVNode(ino_t vnid, void** node); status_t PutVNode(ino_t vnid); + status_t AcquireVNode(ino_t vnid); status_t NewVNode(ino_t vnid, void* node); status_t PublishVNode(ino_t vnid, void* node, int type, uint32 flags); Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp 2009-03-03 23:42:20 UTC (rev 29390) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp 2009-03-04 00:01:27 UTC (rev 29391) @@ -328,10 +328,37 @@ // acquire_vnode status_t -UserlandFS::KernelEmu::acquire_vnode(dev_t nsid, ino_t vnodeID) +UserlandFS::KernelEmu::acquire_vnode(dev_t nsid, ino_t vnid) { - // TODO: Implement! - return B_BAD_VALUE; + // get the request port and the file system + RequestPort* port; + FileSystem* fileSystem; + status_t error = get_port_and_fs(&port, &fileSystem); + if (error != B_OK) + return error; + + // prepare the request + RequestAllocator allocator(port->GetPort()); + AcquireVNodeRequest* request; + error = AllocateRequest(allocator, &request); + if (error != B_OK) + return error; + + request->nsid = nsid; + request->vnid = vnid; + + // send the request + UserlandRequestHandler handler(fileSystem, ACQUIRE_VNODE_REPLY); + AcquireVNodeReply* reply; + error = port->SendRequest(&allocator, &handler, (Request**)&reply); + if (error != B_OK) + return error; + RequestReleaser requestReleaser(port, reply); + + // process the reply + if (reply->error != B_OK) + return reply->error; + return error; } // new_vnode @@ -420,7 +447,6 @@ return B_BAD_VALUE; // stat() the node to get its type -// TODO: This must not be called while mounting! int type; status_t error = volume->GetVNodeType(data, &type); if (error != B_OK) From bonefish at mail.berlios.de Wed Mar 4 01:44:13 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 4 Mar 2009 01:44:13 +0100 Subject: [Haiku-commits] r29392 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200903040044.n240iDMe013580@sheep.berlios.de> Author: bonefish Date: 2009-03-04 01:44:13 +0100 (Wed, 04 Mar 2009) New Revision: 29392 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29392&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelNode.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h Log: Finished node management. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.cpp 2009-03-04 00:01:27 UTC (rev 29391) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.cpp 2009-03-04 00:44:13 UTC (rev 29392) @@ -59,16 +59,24 @@ // CreateVolume status_t -HaikuKernelFileSystem::CreateVolume(Volume** volume, dev_t id) +HaikuKernelFileSystem::CreateVolume(Volume** _volume, dev_t id) { // check initialization and parameters - if (!fFSModule || !volume) + if (!fFSModule || !_volume) return B_BAD_VALUE; - // create the volume - *volume = new(std::nothrow) HaikuKernelVolume(this, id, fFSModule); - if (!*volume) + // create and init the volume + HaikuKernelVolume* volume + = new(std::nothrow) HaikuKernelVolume(this, id, fFSModule); + if (!volume) return B_NO_MEMORY; + + status_t error = volume->Init(); + if (error != B_OK) { + delete volume; + return error; + } + return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelNode.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelNode.h 2009-03-04 00:01:27 UTC (rev 29391) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelNode.h 2009-03-04 00:44:13 UTC (rev 29392) @@ -18,15 +18,33 @@ struct HaikuKernelNode : fs_vnode { + ino_t id; HaikuKernelVolume* volume; + bool published; public: + inline HaikuKernelNode(HaikuKernelVolume* volume, + ino_t vnodeID, void* privateNode, + fs_vnode_ops* ops); + static HaikuKernelNode* GetNode(fs_vnode* node); HaikuKernelVolume* GetVolume() const { return volume; } }; +HaikuKernelNode::HaikuKernelNode(HaikuKernelVolume* volume, ino_t vnodeID, + void* privateNode, fs_vnode_ops* ops) + : + id(vnodeID), + volume(volume), + published(false) +{ + this->private_node = privateNode; + this->ops = ops; +} + + /*static*/ inline HaikuKernelNode* HaikuKernelNode::GetNode(fs_vnode* node) { Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp 2009-03-04 00:01:27 UTC (rev 29391) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp 2009-03-04 00:44:13 UTC (rev 29392) @@ -7,18 +7,29 @@ #include #include +#include "AutoDeleter.h" +#include "AutoLocker.h" #include "Debug.h" +#include "HashMap.h" #include "../kernel_emu.h" #include "HaikuKernelNode.h" +// NodeMap +class HaikuKernelVolume::NodeMap + : public SynchronizedHashMap, HaikuKernelNode*> { +}; + + // constructor HaikuKernelVolume::HaikuKernelVolume(FileSystem* fileSystem, dev_t id, file_system_module_info* fsModule) - : Volume(fileSystem, id), - fFSModule(fsModule) + : + Volume(fileSystem, id), + fFSModule(fsModule), + fNodes(NULL) { fVolume.id = id; fVolume.partition = -1; @@ -38,41 +49,98 @@ } +// Init +status_t +HaikuKernelVolume::Init() +{ + fNodes = new(std::nothrow) NodeMap; + if (fNodes == NULL) + return B_NO_MEMORY; + + return fNodes->InitCheck(); +} + + // NewVNode status_t HaikuKernelVolume::NewVNode(ino_t vnodeID, void* privateNode, fs_vnode_ops* ops, - HaikuKernelNode** node) + HaikuKernelNode** _node) { - // TODO: Implement! - return B_NOT_SUPPORTED; + AutoLocker _(fNodes); + + // check whether we do already know the node + HaikuKernelNode* node = fNodes->Get(vnodeID); + if (node != NULL) + return B_BAD_VALUE; + + // create a new node + node = new(std::nothrow) HaikuKernelNode(this, vnodeID, privateNode, ops); + if (node == NULL) + return B_NO_MEMORY; + + // add to map + status_t error = fNodes->Put(vnodeID, node); + if (error != B_OK) { + delete node; + return error; + } + + *_node = node; + + return B_OK; } // PublishVNode status_t HaikuKernelVolume::PublishVNode(ino_t vnodeID, void* privateNode, - fs_vnode_ops* ops, int type, uint32 flags, HaikuKernelNode** node) + fs_vnode_ops* ops, int type, uint32 flags, HaikuKernelNode** _node) { - // TODO: Implement! - return B_NOT_SUPPORTED; + AutoLocker _(fNodes); + + // check whether we do already know the node + HaikuKernelNode* node = fNodes->Get(vnodeID); + if (node != NULL) { + if (node->published) + return B_BAD_VALUE; + } else { + // create a new node + node = new(std::nothrow) HaikuKernelNode(this, vnodeID, privateNode, + ops); + if (node == NULL) + return B_NO_MEMORY; + + // add to map + status_t error = fNodes->Put(vnodeID, node); + if (error != B_OK) { + delete node; + return error; + } + } + + node->published = true; + + *_node = node; + + return B_OK; } // UndoNewVNode -status_t +void HaikuKernelVolume::UndoNewVNode(HaikuKernelNode* node) { - // TODO: Implement! - return B_NOT_SUPPORTED; + fNodes->Remove(node->id); + delete node; } // UndoPublishVNode -status_t +void HaikuKernelVolume::UndoPublishVNode(HaikuKernelNode* node) { - // TODO: Implement! - return B_NOT_SUPPORTED; + fNodes->Remove(node->id); + delete node; } @@ -189,21 +257,37 @@ if (!fVolume.ops->get_vnode) return B_BAD_VALUE; - // create a new wrapper node - HaikuKernelNode* node = new(std::nothrow) HaikuKernelNode; + // create a new wrapper node and add it to the map + HaikuKernelNode* node = new(std::nothrow) HaikuKernelNode(this, vnid, NULL, + NULL); if (node == NULL) return B_NO_MEMORY; - node->volume = this; + ObjectDeleter nodeDeleter(node); + AutoLocker locker(fNodes); + if (fNodes->Get(vnid) != NULL) + return B_BAD_VALUE; + + status_t error = fNodes->Put(vnid, node); + if (error != B_OK) + return error; + + locker.Unlock(); + // get the node - status_t error = fVolume.ops->get_vnode(&fVolume, vnid, node, type, flags, - reenter); + error = fVolume.ops->get_vnode(&fVolume, vnid, node, type, flags, reenter); if (error != B_OK) { - delete node; + locker.Lock(); + fNodes->Remove(vnid); return error; } + locker.Lock(); + node->published = true; + nodeDeleter.Detach(); + *_node = node; + return B_OK; } @@ -213,6 +297,8 @@ { HaikuKernelNode* node = (HaikuKernelNode*)_node; + fNodes->Remove(node->id); + if (!node->ops->put_vnode) return B_BAD_VALUE; status_t error = node->ops->put_vnode(&fVolume, node, reenter); @@ -228,6 +314,8 @@ { HaikuKernelNode* node = (HaikuKernelNode*)_node; + fNodes->Remove(node->id); + if (!node->ops->remove_vnode) return B_BAD_VALUE; return node->ops->remove_vnode(&fVolume, node, reenter); Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h 2009-03-04 00:01:27 UTC (rev 29391) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h 2009-03-04 00:44:13 UTC (rev 29392) @@ -23,13 +23,15 @@ inline fs_volume* GetFSVolume() { return &fVolume; } + status_t Init(); + status_t NewVNode(ino_t vnodeID, void* privateNode, fs_vnode_ops* ops, HaikuKernelNode** node); status_t PublishVNode(ino_t vnodeID, void* privateNode, fs_vnode_ops* ops, int type, uint32 flags, HaikuKernelNode** node); - status_t UndoNewVNode(HaikuKernelNode* node); - status_t UndoPublishVNode(HaikuKernelNode* node); + void UndoNewVNode(HaikuKernelNode* node); + void UndoPublishVNode(HaikuKernelNode* node); // FS virtual status_t Mount(const char* device, uint32 flags, @@ -173,12 +175,15 @@ HaikuKernelVolume* haikuVolume; }; + class NodeMap; + private: void _InitCapabilities(); private: file_system_module_info* fFSModule; FSVolume fVolume; + NodeMap* fNodes; }; From bonefish at mail.berlios.de Wed Mar 4 01:53:58 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 4 Mar 2009 01:53:58 +0100 Subject: [Haiku-commits] r29393 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200903040053.n240rwBl014075@sheep.berlios.de> Author: bonefish Date: 2009-03-04 01:53:57 +0100 (Wed, 04 Mar 2009) New Revision: 29393 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29393&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp Log: Implemented vfs_get_file_map() and vfs_lookup_vnode(). Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp 2009-03-04 00:44:13 UTC (rev 29392) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp 2009-03-04 00:53:57 UTC (rev 29393) @@ -144,6 +144,14 @@ } +// NodeWithID +HaikuKernelNode* +HaikuKernelVolume::NodeWithID(ino_t vnodeID) const +{ + return fNodes->Get(vnodeID); +} + + // #pragma mark - // #pragma mark ----- FS ----- Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h 2009-03-04 00:44:13 UTC (rev 29392) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h 2009-03-04 00:53:57 UTC (rev 29393) @@ -33,6 +33,8 @@ void UndoNewVNode(HaikuKernelNode* node); void UndoPublishVNode(HaikuKernelNode* node); + HaikuKernelNode* NodeWithID(ino_t vnodeID) const; + // FS virtual status_t Mount(const char* device, uint32 flags, const char* parameters, ino_t* rootID); Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp 2009-03-04 00:44:13 UTC (rev 29392) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp 2009-03-04 00:53:57 UTC (rev 29393) @@ -1,4 +1,7 @@ -// beos_kernel_emu.cpp +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include #include @@ -12,6 +15,7 @@ #include "Debug.h" +#include "../FileSystem.h" #include "../kernel_emu.h" #include "HaikuKernelNode.h" @@ -251,16 +255,29 @@ vfs_get_file_map(struct vnode *vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count) { - // TODO: Implement! - return B_BAD_VALUE; + HaikuKernelNode* node = (HaikuKernelNode*)vnode; + + return node->volume->GetFileMap(node, offset, size, vecs, _count); } status_t vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode) { - // TODO: Implement! - return B_BAD_VALUE; + // get the volume + HaikuKernelVolume* volume = dynamic_cast( + FileSystem::GetInstance()->VolumeWithID(mountID)); + if (volume == NULL) + return B_BAD_VALUE; + + // get the node + HaikuKernelNode* node = volume->NodeWithID(vnodeID); + if (node == NULL) + return B_BAD_VALUE; + + *_vnode = (struct vnode*)node; + + return B_OK; } From bonefish at mail.berlios.de Wed Mar 4 02:27:35 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 4 Mar 2009 02:27:35 +0100 Subject: [Haiku-commits] r29394 - in haiku/trunk: headers/private/userlandfs/private src/add-ons/kernel/file_systems/userlandfs/private Message-ID: <200903040127.n241RZi1022419@sheep.berlios.de> Author: bonefish Date: 2009-03-04 02:27:32 +0100 (Wed, 04 Mar 2009) New Revision: 29394 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29394&view=rev Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/private/Requests.cpp Log: Added requests for file cache operations. Not used yet. Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-03-04 00:53:57 UTC (rev 29393) +++ haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-03-04 01:27:32 UTC (rev 29394) @@ -205,6 +205,22 @@ GET_VNODE_REMOVED_REQUEST, GET_VNODE_REMOVED_REPLY, + // file cache + FILE_CACHE_CREATE_REQUEST, + FILE_CACHE_CREATE_REPLY, + FILE_CACHE_DELETE_REQUEST, + FILE_CACHE_DELETE_REPLY, + FILE_CACHE_SET_ENABLED_REQUEST, + FILE_CACHE_SET_ENABLED_REPLY, + FILE_CACHE_SET_SIZE_REQUEST, + FILE_CACHE_SET_SIZE_REPLY, + FILE_CACHE_SYNC_REQUEST, + FILE_CACHE_SYNC_REPLY, + FILE_CACHE_READ_REQUEST, + FILE_CACHE_READ_REPLY, + FILE_CACHE_WRITE_REQUEST, + FILE_CACHE_WRITE_REPLY, + // general reply RECEIPT_ACK_REPLY, @@ -290,7 +306,16 @@ void* queryCookie; }; +// FileCacheRequest +class FileCacheRequest : public Request { +public: + FileCacheRequest(uint32 type) : Request(type) {} + dev_t volumeID; + ino_t vnodeID; +}; + + // #pragma mark - administrative @@ -1564,6 +1589,118 @@ }; +// #pragma mark - file cache + + +// FileCacheCreateRequest +class FileCacheCreateRequest : public FileCacheRequest { +public: + FileCacheCreateRequest() : FileCacheRequest(FILE_CACHE_CREATE_REQUEST) {} + + size_t size; +}; + +// FileCacheCreateReply +class FileCacheCreateReply : public ReplyRequest { +public: + FileCacheCreateReply() : ReplyRequest(FILE_CACHE_CREATE_REPLY) {} +}; + +// FileCacheDeleteRequest +class FileCacheDeleteRequest : public FileCacheRequest { +public: + FileCacheDeleteRequest() : FileCacheRequest(FILE_CACHE_DELETE_REQUEST) {} +}; + +// FileCacheDeleteReply +class FileCacheDeleteReply : public ReplyRequest { +public: + FileCacheDeleteReply() : ReplyRequest(FILE_CACHE_DELETE_REPLY) {} +}; + +// FileCacheSetEnabledRequest +class FileCacheSetEnabledRequest : public FileCacheRequest { +public: + FileCacheSetEnabledRequest() + : FileCacheRequest(FILE_CACHE_SET_ENABLED_REQUEST) {} + + bool enabled; +}; + +// FileCacheSetEnabledReply +class FileCacheSetEnabledReply : public ReplyRequest { +public: + FileCacheSetEnabledReply() : ReplyRequest(FILE_CACHE_SET_ENABLED_REPLY) {} +}; + +// FileCacheSetSizeRequest +class FileCacheSetSizeRequest : public FileCacheRequest { +public: + FileCacheSetSizeRequest() : FileCacheRequest(FILE_CACHE_SET_SIZE_REQUEST) {} + + size_t size; +}; + +// FileCacheSetSizeReply +class FileCacheSetSizeReply : public ReplyRequest { +public: + FileCacheSetSizeReply() : ReplyRequest(FILE_CACHE_SET_SIZE_REPLY) {} +}; + + +// FileCacheSyncRequest +class FileCacheSyncRequest : public FileCacheRequest { +public: + FileCacheSyncRequest() : FileCacheRequest(FILE_CACHE_SYNC_REQUEST) {} +}; + +// FileCacheSyncReply +class FileCacheSyncReply : public ReplyRequest { +public: + FileCacheSyncReply() : ReplyRequest(FILE_CACHE_SYNC_REPLY) {} +}; + + +// FileCacheReadRequest +class FileCacheReadRequest : public FileCacheRequest { +public: + FileCacheReadRequest() : FileCacheRequest(FILE_CACHE_READ_REQUEST) {} + + void* cookie; + off_t pos; + size_t size; +}; + +// FileCacheReadReply +class FileCacheReadReply : public ReplyRequest { +public: + FileCacheReadReply() : ReplyRequest(FILE_CACHE_READ_REPLY) {} + status_t GetAddressInfos(AddressInfo* infos, int32* count); + + Address buffer; + size_t bytesRead; +}; + +// FileCacheWriteRequest +class FileCacheWriteRequest : public FileCacheRequest { +public: + FileCacheWriteRequest() : FileCacheRequest(FILE_CACHE_WRITE_REQUEST) {} + status_t GetAddressInfos(AddressInfo* infos, int32* count); + + void* cookie; + Address buffer; + off_t pos; +}; + +// FileCacheWriteReply +class FileCacheWriteReply : public ReplyRequest { +public: + FileCacheWriteReply() : ReplyRequest(FILE_CACHE_WRITE_REPLY) {} + + size_t bytesWritten; +}; + + ////////////////// // General Reply @@ -1887,6 +2024,10 @@ return task((PutVNodeRequest*)request); case PUT_VNODE_REPLY: return task((PutVNodeReply*)request); + case ACQUIRE_VNODE_REQUEST: + return task((PutVNodeRequest*)request); + case ACQUIRE_VNODE_REPLY: + return task((AcquireVNodeReply*)request); case NEW_VNODE_REQUEST: return task((NewVNodeRequest*)request); case NEW_VNODE_REPLY: @@ -1907,6 +2048,35 @@ return task((GetVNodeRemovedRequest*)request); case GET_VNODE_REMOVED_REPLY: return task((GetVNodeRemovedReply*)request); + // file cache + case FILE_CACHE_CREATE_REQUEST: + return task((FileCacheCreateRequest*)request); + case FILE_CACHE_CREATE_REPLY: + return task((FileCacheCreateReply*)request); + case FILE_CACHE_DELETE_REQUEST: + return task((FileCacheDeleteRequest*)request); + case FILE_CACHE_DELETE_REPLY: + return task((FileCacheDeleteReply*)request); + case FILE_CACHE_SET_ENABLED_REQUEST: + return task((FileCacheSetEnabledRequest*)request); + case FILE_CACHE_SET_ENABLED_REPLY: + return task((FileCacheSetEnabledReply*)request); + case FILE_CACHE_SET_SIZE_REQUEST: + return task((FileCacheSetSizeRequest*)request); + case FILE_CACHE_SET_SIZE_REPLY: + return task((FileCacheSetSizeReply*)request); + case FILE_CACHE_SYNC_REQUEST: + return task((FileCacheSyncRequest*)request); + case FILE_CACHE_SYNC_REPLY: + return task((FileCacheSyncReply*)request); + case FILE_CACHE_READ_REQUEST: + return task((FileCacheReadRequest*)request); + case FILE_CACHE_READ_REPLY: + return task((FileCacheReadReply*)request); + case FILE_CACHE_WRITE_REQUEST: + return task((FileCacheWriteRequest*)request); + case FILE_CACHE_WRITE_REPLY: + return task((FileCacheWriteReply*)request); // general reply case RECEIPT_ACK_REPLY: return task((ReceiptAckReply*)request); @@ -2102,6 +2272,21 @@ using UserlandFSUtil::UnremoveVNodeReply; using UserlandFSUtil::GetVNodeRemovedRequest; using UserlandFSUtil::GetVNodeRemovedReply; +// file cache +using UserlandFSUtil::FileCacheCreateRequest; +using UserlandFSUtil::FileCacheCreateReply; +using UserlandFSUtil::FileCacheDeleteRequest; +using UserlandFSUtil::FileCacheDeleteReply; +using UserlandFSUtil::FileCacheSetEnabledRequest; +using UserlandFSUtil::FileCacheSetEnabledReply; +using UserlandFSUtil::FileCacheSetSizeRequest; +using UserlandFSUtil::FileCacheSetSizeReply; +using UserlandFSUtil::FileCacheSyncRequest; +using UserlandFSUtil::FileCacheSyncReply; +using UserlandFSUtil::FileCacheReadRequest; +using UserlandFSUtil::FileCacheReadReply; +using UserlandFSUtil::FileCacheWriteRequest; +using UserlandFSUtil::FileCacheWriteReply; // general reply using UserlandFSUtil::ReceiptAckReply; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/private/Requests.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/private/Requests.cpp 2009-03-04 00:53:57 UTC (rev 29393) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/private/Requests.cpp 2009-03-04 01:27:32 UTC (rev 29394) @@ -297,7 +297,23 @@ return B_OK; } +// FileCacheReadReply +status_t +FileCacheReadReply::GetAddressInfos(AddressInfo* infos, int32* count) +{ + ADD_ADDRESS(buffer); + return B_OK; +} +// FileCacheWriteRequest +status_t +FileCacheWriteRequest::GetAddressInfos(AddressInfo* infos, int32* count) +{ + ADD_ADDRESS(buffer); + return B_OK; +} + + // #pragma mark - // RequestAddressInfoGetter From anevilyak at mail.berlios.de Wed Mar 4 04:54:30 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 4 Mar 2009 04:54:30 +0100 Subject: [Haiku-commits] r29395 - haiku/trunk/src/kits/tracker Message-ID: <200903040354.n243sUNk010299@sheep.berlios.de> Author: anevilyak Date: 2009-03-04 04:54:29 +0100 (Wed, 04 Mar 2009) New Revision: 29395 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29395&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: Second attempt at PoseView population optimizations: We still search for the pose in our list, but now rely on a binary search to do it instead, rather than the previous linear search. This considerably boosts population speed for large folders here, while still preserving correct behavior. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2009-03-04 01:27:32 UTC (rev 29394) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2009-03-04 03:54:29 UTC (rev 29395) @@ -175,6 +175,15 @@ } +static BPose * +BSearch(PoseList *table, const BPose* key, BPoseView *view, + int (*cmp)(const BPose *, const BPose *, BPoseView *), + bool returnClosest = true); + +static int +PoseCompareAddWidget(const BPose *p1, const BPose *p2, BPoseView *view); + + // #pragma mark - @@ -1622,11 +1631,18 @@ float listViewScrollBy = 0; for (int32 modelIndex = 0; modelIndex < count; modelIndex++) { Model *model = models[modelIndex]; - - if (FindPose(model) || FindZombie(model->NodeRef())) { - // we already have this pose, don't add it + + model->OpenNode(); + ASSERT(model->IsNodeOpen()); + PoseInfo *poseInfo = &poseInfoArray[modelIndex]; + + // pose adopts model and deletes it when done + BPose *pose = new BPose(model, this, clipboardMode); + + if (BSearch(fPoseList, pose, this, PoseCompareAddWidget, false) != NULL + || FindZombie(model->NodeRef())) { watch_node(model->NodeRef(), B_STOP_WATCHING, this); - delete model; + delete pose; if (resultingPoses) resultingPoses[modelIndex] = NULL; continue; @@ -1637,13 +1653,6 @@ SetHasPosesInClipboard(true); } - model->OpenNode(); - ASSERT(model->IsNodeOpen()); - PoseInfo *poseInfo = &poseInfoArray[modelIndex]; - - // pose adopts model and deletes it when done - BPose *pose = new BPose(model, this, clipboardMode); - if (resultingPoses) resultingPoses[modelIndex] = pose; @@ -8326,7 +8335,7 @@ static BPose * BSearch(PoseList *table, const BPose* key, BPoseView *view, - int (*cmp)(const BPose *, const BPose *, BPoseView *)) + int (*cmp)(const BPose *, const BPose *, BPoseView *), bool returnClosest) { int32 r = table->CountItems(); BPose *result = 0; @@ -8343,8 +8352,9 @@ else r = m - 1; } - - return result; + if (returnClosest) + return result; + return NULL; } From axeld at pinc-software.de Wed Mar 4 11:29:53 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 04 Mar 2009 11:29:53 +0100 CET Subject: [Haiku-commits] r29180 - haiku/trunk/src/kits/interface In-Reply-To: Message-ID: <2455304462-BeMail@zon> J?r?me Duval wrote: > 2009/2/18 Axel D?rfler > > Yes, I guess that's how it should be; the standard window handling > > should probably not interfere (much) when direct targets are used. > The problem here is that direct targets are not used IMO. > I'm unable to distinguish active and non-active window messages. Messages that stem from Set{Mouse}EventMask() should always result in messages that go to a specific handler, never the preferred one (unless that handler is the preferred one). > > > In the case of B_KEY_DOWN messages, BWindow might want to handle > > > such > > > events for shortcuts, screenshots, etc.. which we don't want in > > > case of > > > non active windows. > > Exactly; the non-active window should never get any such messages > > that > > go to the preferred handler. > A non-active window gets such a message, processes it with > DispatchMessage(), which then handles shortcuts and co, before > forwarding > to the view. Ideas ? I think DispatchMessage() should not do so when the message is not targeted at a preferred handler. I don't have a good idea now, but I could imagine that the current solution is not complete, and will cause similar problems in the future. We might just wait for those, put a TODO into the code, or open a bug report to remember. At least it seems to work for now :-) Bye, Axel. From stippi at mail.berlios.de Wed Mar 4 13:41:12 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 4 Mar 2009 13:41:12 +0100 Subject: [Haiku-commits] r29396 - haiku/trunk/src/add-ons/kernel/bus_managers/firewire Message-ID: <200903041241.n24CfCkG016194@sheep.berlios.de> Author: stippi Date: 2009-03-04 13:41:05 +0100 (Wed, 04 Mar 2009) New Revision: 29396 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29396&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohci.c haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcireg.h haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcivar.h Log: Patch by JiSheng Zhang: * Combine the many small areas created by the Firewire bus manager into one larger one. Needs further testing. Supposed to fix #1519. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohci.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohci.c 2009-03-04 03:54:29 UTC (rev 29395) +++ haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohci.c 2009-03-04 12:41:05 UTC (rev 29396) @@ -134,7 +134,7 @@ static void fwohci_timeout (void *); static void fwohci_set_intr (struct firewire_comm *, int); -static int fwohci_add_rx_buf (struct fwohci_dbch *, struct fwohcidb_tr *, int, struct fwdma_alloc *); +static inline void fwohci_set_rx_buf(struct fw_xferq *, struct fwohcidb_tr *, bus_addr_t dbuf[], int dsiz[]); static int fwohci_add_tx_buf (struct fwohci_dbch *, struct fwohcidb_tr *, int); static void dump_db (struct fwohci_softc *, uint32_t); static void print_db (struct fwohcidb_tr *, struct fwohcidb *, uint32_t , uint32_t); @@ -1217,26 +1217,26 @@ fwohci_db_free(struct fwohci_dbch *dbch) { struct fwohcidb_tr *db_tr; - int idb; +// int idb; if ((dbch->flags & FWOHCI_DBCH_INIT) == 0) return; - for(db_tr = STAILQ_FIRST(&dbch->db_trq), idb = 0; idb < dbch->ndb; +/* for(db_tr = STAILQ_FIRST(&dbch->db_trq), idb = 0; idb < dbch->ndb; db_tr = STAILQ_NEXT(db_tr, link), idb++){ -/* if ((dbch->xferq.flag & FWXFERQ_EXTBUF) == 0 && + if ((dbch->xferq.flag & FWXFERQ_EXTBUF) == 0 && db_tr->buf != NULL) { fwdma_free_size(dbch->dmat, db_tr->dma_map, db_tr->buf, dbch->xferq.psize); - db_tr->buf = NULL;*/ - if ((dbch->xferq.flag & FWXFERQ_EXTBUF) == 0 && - db_tr->Area > B_OK) { - delete_area(db_tr->Area); - db_tr->Area = -1; + db_tr->buf = NULL; + else if (db_tr->dma_map != NULL) + bus_dmamap_destroy(dbch->dmat, db_tr->dma_map); + }*/ + if ((dbch->xferq.flag & FWXFERQ_EXTBUF) == 0 && + dbch->Area > B_OK) { + delete_area(dbch->Area); + dbch->Area = -1; - } -/* else if (db_tr->dma_map != NULL) - bus_dmamap_destroy(dbch->dmat, db_tr->dma_map);*/ } dbch->ndb = 0; db_tr = STAILQ_FIRST(&dbch->db_trq); @@ -1438,6 +1438,10 @@ uint32_t off = 0; struct fwohcidb_tr *db_tr; struct fwohcidb *db; + void *buf_virt, *buf_phy; + struct fw_xferq *ir; + bus_addr_t dbuf[2]; + int dsiz[2]; z = dbch->ndesc; if(&sc->arrq == dbch){ @@ -1471,8 +1475,39 @@ dbch->bottom = STAILQ_NEXT(dbch->bottom, link); } db_tr = dbch->top; + + ir = &dbch->xferq; + if(ir->buf == NULL && (ir->flag & FWXFERQ_EXTBUF) == 0) { + dbch->Area = alloc_mem(&buf_virt, &buf_phy, + ir->psize * dbch->ndb, 0, "fw rx Area"); + if(dbch->Area < B_OK) + return(ENOMEM); + } + for (idb = 0; idb < dbch->ndb; idb ++) { - fwohci_add_rx_buf(dbch, db_tr, idb, &sc->dummy_dma); + //fwohci_add_rx_buf(dbch, db_tr, idb, &sc->dummy_dma); + if(ir->buf == NULL && (ir->flag & FWXFERQ_EXTBUF) == 0) { + db_tr->buf = (caddr_t)buf_virt; + dbuf[0] = (bus_addr_t)buf_phy; + + db_tr->dbcnt = 1; + dsiz[0] = ir->psize; + buf_virt += ir->psize; + buf_phy += ir->psize; + } else { + db_tr->dbcnt = 0; + dsiz[db_tr->dbcnt] = sizeof(uint32_t); + dbuf[db_tr->dbcnt++] = sc->dummy_dma.bus_addr; + dsiz[db_tr->dbcnt] = ir->psize; + if (ir->buf != NULL) { + db_tr->buf = fwdma_v_addr(ir->buf, idb); + dbuf[db_tr->dbcnt] = fwdma_bus_addr( + ir->buf, idb); + } + db_tr->dbcnt++; + } + fwohci_set_rx_buf(ir, db_tr, dbuf, dsiz); + if (STAILQ_NEXT(db_tr, link) == NULL) break; db = db_tr->db; @@ -2566,47 +2601,13 @@ return 0; } -int -fwohci_add_rx_buf(struct fwohci_dbch *dbch, struct fwohcidb_tr *db_tr, - int poffset, struct fwdma_alloc *dummy_dma) +static inline void +fwohci_set_rx_buf(struct fw_xferq *ir, struct fwohcidb_tr *db_tr, + bus_addr_t dbuf[], int dsiz[]) { + int i, ldesc; struct fwohcidb *db = db_tr->db; - struct fw_xferq *ir; - int i, ldesc; - bus_addr_t dbuf[2]; - int dsiz[2]; - void * buf_virt, *buf_phy; - ir = &dbch->xferq; - if (ir->buf == NULL && (dbch->xferq.flag & FWXFERQ_EXTBUF) == 0) { -/* db_tr->buf = fwdma_malloc_size(dbch->dmat, &db_tr->dma_map, - ir->psize, &dbuf[0], BUS_DMA_NOWAIT); - if (db_tr->buf == NULL) - return(ENOMEM);*/ - db_tr->Area = alloc_mem(&buf_virt, &buf_phy, - MIN(ir->psize, MAX_REQCOUNT), 0, "fw ir Area"); - if(db_tr->Area < B_OK) - return(ENOMEM); - db_tr->buf = (caddr_t)buf_virt; - dbuf[0] = (bus_addr_t)buf_phy; - - db_tr->dbcnt = 1; - dsiz[0] = ir->psize; -/* bus_dmamap_sync(dbch->dmat, db_tr->dma_map, - BUS_DMASYNC_PREREAD);*/ - } else { - db_tr->dbcnt = 0; - if (dummy_dma != NULL) { - dsiz[db_tr->dbcnt] = sizeof(uint32_t); - dbuf[db_tr->dbcnt++] = dummy_dma->bus_addr; - } - dsiz[db_tr->dbcnt] = ir->psize; - if (ir->buf != NULL) { - db_tr->buf = fwdma_v_addr(ir->buf, poffset); - dbuf[db_tr->dbcnt] = fwdma_bus_addr( ir->buf, poffset); - } - db_tr->dbcnt++; - } for(i = 0 ; i < db_tr->dbcnt ; i++){ FWOHCI_DMA_WRITE(db[i].db.desc.addr, dbuf[i]); FWOHCI_DMA_WRITE(db[i].db.desc.cmd, OHCI_INPUT_MORE | dsiz[i]); @@ -2620,7 +2621,6 @@ FWOHCI_DMA_SET(db[ldesc].db.desc.cmd, OHCI_INPUT_LAST); } FWOHCI_DMA_SET(db[ldesc].db.desc.cmd, OHCI_BRANCH_ALWAYS); - return 0; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcireg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcireg.h 2009-03-04 03:54:29 UTC (rev 29395) +++ haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcireg.h 2009-03-04 12:41:05 UTC (rev 29396) @@ -340,7 +340,6 @@ caddr_t buf; bus_addr_t bus_addr; int dbcnt; - area_id Area; }; /* Modified: haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcivar.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcivar.h 2009-03-04 03:54:29 UTC (rev 29395) +++ haiku/trunk/src/add-ons/kernel/bus_managers/firewire/fwohcivar.h 2009-03-04 12:41:05 UTC (rev 29396) @@ -57,6 +57,8 @@ struct fwdma_alloc_multi *am; #ifndef __HAIKU__ bus_dma_tag_t dmat; +#else + area_id Area; #endif } arrq, arrs, atrq, atrs, it[OHCI_DMA_ITCH], ir[OHCI_DMA_IRCH]; u_int maxrec; From stippi at mail.berlios.de Wed Mar 4 14:46:57 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 4 Mar 2009 14:46:57 +0100 Subject: [Haiku-commits] r29397 - haiku/trunk/src/servers/app/drawing/Painter Message-ID: <200903041346.n24Dkvw2013868@sheep.berlios.de> Author: stippi Date: 2009-03-04 14:46:56 +0100 (Wed, 04 Mar 2009) New Revision: 29397 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29397&view=rev Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp Log: For the filter indices and wheight calculation, never calculate more pixels than can possibly be visible. Clients may pass very large view rects to layout a zoomed in bitmap. This doesn't only speed things up, but also avoids a stack overflow in the app_server, as reported in #3166. Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2009-03-04 12:41:05 UTC (rev 29396) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2009-03-04 13:46:56 UTC (rev 29397) @@ -1979,6 +1979,26 @@ uint32 srcWidth = srcBuffer.width(); uint32 srcHeight = srcBuffer.height(); + // Do not calculate more filter weights than necessary and also + // keep the stack based allocations reasonably sized + if (fClippingRegion->Frame().IntegerWidth() + 1 < dstWidth) + dstWidth = fClippingRegion->Frame().IntegerWidth() + 1; + if (fClippingRegion->Frame().IntegerHeight() + 1 < dstHeight) + dstHeight = fClippingRegion->Frame().IntegerHeight() + 1; + + // When calculating less filter weights than specified by viewRect, + // we need to compensate the offset. + uint32 filterWeightXIndexOffset = 0; + uint32 filterWeightYIndexOffset = 0; + if (fClippingRegion->Frame().left > viewRect.left) { + filterWeightXIndexOffset = fClippingRegion->Frame().left + - viewRect.left; + } + if (fClippingRegion->Frame().top > viewRect.top) { + filterWeightYIndexOffset = fClippingRegion->Frame().top + - viewRect.top; + } + // should not pose a problem with stack overflows // (needs around 6Kb for 1920x1200) uint16 xIndices[dstWidth]; @@ -1992,7 +2012,8 @@ for (uint32 i = 0; i < dstWidth; i++) { // index into source - uint16 index = (uint16)(i * srcWidth / (srcWidth * xScale)); + uint16 index = (uint16)((i + filterWeightXIndexOffset) * srcWidth + / (srcWidth * xScale)); // round down to get the left pixel xIndices[i] = index; // handle cropped source bitmap @@ -2003,7 +2024,8 @@ for (uint32 i = 0; i < dstHeight; i++) { // index into source - uint16 index = (uint16)(i * srcHeight / (srcHeight * yScale)); + uint16 index = (uint16)((i + filterWeightYIndexOffset) * srcHeight + / (srcHeight * yScale)); // round down to get the top pixel yIndices[i] = index; // handle cropped source bitmap @@ -2041,10 +2063,10 @@ // x and y are needed as indeces into the wheight arrays, so the // offset into the target buffer needs to be compensated - const int32 xIndexL = x1 - left; - const int32 xIndexR = x2 - left; - y1 -= top; - y2 -= top; + const int32 xIndexL = x1 - left - filterWeightXIndexOffset; + const int32 xIndexR = x2 - left - filterWeightXIndexOffset; + y1 -= top + filterWeightYIndexOffset; + y2 -= top + filterWeightYIndexOffset; //printf("x: %ld - %ld\n", xIndexL, xIndexR); //printf("y: %ld - %ld\n", y1, y2); @@ -2078,6 +2100,26 @@ uint32 srcWidth = srcBuffer.width(); uint32 srcHeight = srcBuffer.height(); + // Do not calculate more filter weights than necessary and also + // keep the stack based allocations reasonably sized + if (fClippingRegion->Frame().IntegerWidth() + 1 < dstWidth) + dstWidth = fClippingRegion->Frame().IntegerWidth() + 1; + if (fClippingRegion->Frame().IntegerHeight() + 1 < dstHeight) + dstHeight = fClippingRegion->Frame().IntegerHeight() + 1; + + // When calculating less filter weights than specified by viewRect, + // we need to compensate the offset. + uint32 filterWeightXIndexOffset = 0; + uint32 filterWeightYIndexOffset = 0; + if (fClippingRegion->Frame().left > viewRect.left) { + filterWeightXIndexOffset = fClippingRegion->Frame().left + - viewRect.left; + } + if (fClippingRegion->Frame().top > viewRect.top) { + filterWeightYIndexOffset = fClippingRegion->Frame().top + - viewRect.top; + } + struct FilterInfo { uint16 index; // index into source bitmap row/column uint16 weight; // weight of the pixel at index [0..255] @@ -2114,7 +2156,8 @@ // to access the rightmost pixel of the source with a weighting // of 255. This in turn will trigger an optimization in the loop // that also prevents out of bounds access. - float index = i * (srcWidth - 1) / (srcWidth * xScale - 1); + float index = (i + filterWeightXIndexOffset) * (srcWidth - 1) + / (srcWidth * xScale - 1); // round down to get the left pixel xWeights[i].index = (uint16)index; xWeights[i].weight = 255 - (uint16)((index - xWeights[i].index) * 255); @@ -2132,7 +2175,8 @@ // to access the bottommost pixel of the source with a weighting // of 255. This in turn will trigger an optimization in the loop // that also prevents out of bounds access. - float index = i * (srcHeight - 1) / (srcHeight * yScale - 1); + float index = (i + filterWeightYIndexOffset) * (srcHeight - 1) + / (srcHeight * yScale - 1); // round down to get the top pixel yWeights[i].index = (uint16)index; yWeights[i].weight = 255 - (uint16)((index - yWeights[i].index) * 255); @@ -2179,10 +2223,10 @@ // x and y are needed as indeces into the wheight arrays, so the // offset into the target buffer needs to be compensated - const int32 xIndexL = x1 - left; - const int32 xIndexR = x2 - left; - y1 -= top; - y2 -= top; + const int32 xIndexL = x1 - left - filterWeightXIndexOffset; + const int32 xIndexR = x2 - left - filterWeightXIndexOffset; + y1 -= top + filterWeightYIndexOffset; + y2 -= top + filterWeightYIndexOffset; //printf("x: %ld - %ld\n", xIndexL, xIndexR); //printf("y: %ld - %ld\n", y1, y2); From humdingerb at mail.berlios.de Wed Mar 4 18:29:59 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Wed, 4 Mar 2009 18:29:59 +0100 Subject: [Haiku-commits] r29398 - in haiku/trunk/docs: . userguide/en userguide/en/applications userguide/images/apps-images Message-ID: <200903041729.n24HTxmX013569@sheep.berlios.de> Author: humdingerb Date: 2009-03-04 18:29:50 +0100 (Wed, 04 Mar 2009) New Revision: 29398 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29398&view=rev Added: haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_16.png haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_32.png haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_64.png haiku/trunk/docs/userguide/images/apps-images/diskprobe-about-attr.png haiku/trunk/docs/userguide/images/apps-images/diskprobe.png Removed: haiku/trunk/docs/userguide/en/applications/apps-firefox.html haiku/trunk/docs/userguide/images/apps-images/firefox-icon_16.png haiku/trunk/docs/userguide/images/apps-images/firefox-icon_32.png haiku/trunk/docs/userguide/images/apps-images/firefox-icon_64.png Modified: haiku/trunk/docs/Haiku-doc.css haiku/trunk/docs/userguide/en/applications.html haiku/trunk/docs/userguide/en/applications/apps-bepdf.html haiku/trunk/docs/userguide/en/applications/apps-cdplayer.html haiku/trunk/docs/userguide/en/applications/apps-deskcalc.html haiku/trunk/docs/userguide/en/applications/apps-diskprobe.html haiku/trunk/docs/userguide/en/applications/apps-expander.html haiku/trunk/docs/userguide/en/applications/apps-icon-o-matic.html haiku/trunk/docs/userguide/en/gui.html haiku/trunk/docs/userguide/en/keyboard-shortcuts.html haiku/trunk/docs/userguide/en/preferences.html haiku/trunk/docs/userguide/en/twitcher.html Log: * Added DiskProbe * Changed cursor keys to their respective arrow symbol * As mmadia reminded me: since we cannot use Mozilla's Trademarks I renamed everythig firefoxy to BeZillaBrowser. Modified: haiku/trunk/docs/Haiku-doc.css =================================================================== --- haiku/trunk/docs/Haiku-doc.css 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/Haiku-doc.css 2009-03-04 17:29:50 UTC (rev 29398) @@ -125,7 +125,7 @@ padding: 15px 15px 15px 80px; margin-bottom: 15px; margin-top: 15px; - min-height: 70px; + min-height: 32px; } .box-info { background: #e4ffde url(userguide/images/alert_info_32.png) 15px 15px no-repeat; Modified: haiku/trunk/docs/userguide/en/applications/apps-bepdf.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-bepdf.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications/apps-bepdf.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -30,7 +30,7 @@     Previous: ActivityMonitor     - Next: CDPlayer + Next: BeZillaBrowser

@@ -54,7 +54,7 @@     Previous: ActivityMonitor     - Next: CDPlayer + Next: BeZillaBrowser

--> Added: haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -0,0 +1,62 @@ + + + + + + + + + BeZillaBrowser + + + + + +
+

+ Applications +     + Previous: BePDF +     + Next: CDPlayer +

+
+ +
+ +

bezillabrowser-icon_64.pngFirefox

+ + + + +
Deskbar:Applications
Location:/boot/apps/BeZillaBrowser/BeZillaBrowser
Settings:~/config/settings/Mozilla/Firefox/*
+

BeZillaBrowser is based on Mozilla's source code and uses patches to improve speed, stability, and other UI aspects. Currently, all BeZilla builds use Mozilla's 1.8 CVS Branch.

+

Documentation is still missing. If you want to work on it, please announce it on the Documentation mailing list to avoid duplication.

+ +
+ + + Modified: haiku/trunk/docs/userguide/en/applications/apps-cdplayer.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-cdplayer.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications/apps-cdplayer.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -28,7 +28,7 @@

Applications     - Previous: BePDF + Previous: BeZillaBrowser     Next: CodyCam

@@ -58,7 +58,7 @@

Applications     - Previous: BePDF + Previous: BeZillaBrowser     Next: CodyCam

Modified: haiku/trunk/docs/userguide/en/applications/apps-deskcalc.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-deskcalc.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications/apps-deskcalc.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -61,7 +61,7 @@
  • You can resize the calculator until it fits your needs and then put it as Replicant onto the Desktop via drag&drop of the symbol in the bottom right corner. Make sure Show Replicants is activated in the Deskbar.

  • The keypad can be colored with a drag&drop from any color well, e.g. from Icon-O-Matic.

  • -
  • You can move up and down in a history of past calculations with CURSOR UP/DOWN.

  • +
  • You can move up and down in a history of past calculations with .

  • You can select DeskCalc's contents and drag&drop it into any application. Or you drop it into a Tracker window or onto the Desktop and a text file with that clipping is created there.

    Even better, the reverse is also possible:
    Create clippings as described at various stages of your calculation and go back to them by drag&dropping them back into DeskCalc.
    Modified: haiku/trunk/docs/userguide/en/applications/apps-diskprobe.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-diskprobe.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications/apps-diskprobe.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -5,7 +5,7 @@ + Modified: haiku/trunk/docs/userguide/en/applications/apps-expander.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-expander.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications/apps-expander.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -30,7 +30,7 @@     Previous: DriveSetup     - Next: Firefox + Next: Icon-O-Matic

    @@ -53,7 +53,7 @@     Previous: DriveSetup     - Next: Firefox + Next: Icon-O-Matic

    --> Deleted: haiku/trunk/docs/userguide/en/applications/apps-firefox.html Modified: haiku/trunk/docs/userguide/en/applications/apps-icon-o-matic.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-icon-o-matic.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications/apps-icon-o-matic.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -28,7 +28,7 @@

    Applications     - Previous: Firefox + Previous: Expander     Next: Installer

    @@ -51,7 +51,7 @@

    Applications     - Previous: Firefox + Previous: Expander     Next: Installer

    Modified: haiku/trunk/docs/userguide/en/applications.html =================================================================== --- haiku/trunk/docs/userguide/en/applications.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/applications.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -67,22 +67,23 @@ A tool to track system resources like CPU and memory usage. iconBePDF  A PDF viewer. +iconBeZillaBrowser  + A web browser based on Mozilla's source code. + [still missing] iconCDPlayer  - A player for audio CDs. [still missing] + A player for audio CDs. iconCodyCam  A tool to regularly upload images from a webcam to a server. iconDeskCalc  A calculator. iconDiskProbe  - A HEX editor for files and volumes. [still missing] + A HEX editor for files and devices. iconDiskUsage  A tool to visualize a disk's memory usage. [still missing] iconDriveSetup  A harddisk partitioning tool. [still missing] iconExpander  A tool to unpack common archives. [still missing] - iconFirefox  - Mozilla's famous browser. [still missing] iconIcon-O-Matic  An app to create Haiku's vector icons. [still missing] iconInstaller  Modified: haiku/trunk/docs/userguide/en/gui.html =================================================================== --- haiku/trunk/docs/userguide/en/gui.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/gui.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -63,8 +63,8 @@ - - + +
    ALT N Creates a new folder.
    ALT E Lets you rename the selected entry.
    ALT CURSOR-UP Opens the parent folder.
    ALT CURSOR-DOWN or ENTER Opens the selected folder.
    ALT  Opens the parent folder.
    ALT  or ENTER Opens the selected folder.
    ALT D Takes you to your Desktop.
    ALT H Takes you to your Home folder.
    Modified: haiku/trunk/docs/userguide/en/keyboard-shortcuts.html =================================================================== --- haiku/trunk/docs/userguide/en/keyboard-shortcuts.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/keyboard-shortcuts.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -56,8 +56,8 @@

    Shortcuts for Tracker navigation

    Additionally to the general shortcuts, here are more for navigating with Tracker:

    - - + + @@ -74,9 +74,9 @@ - - - - + Modified: haiku/trunk/docs/userguide/en/twitcher.html =================================================================== --- haiku/trunk/docs/userguide/en/twitcher.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/twitcher.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -38,7 +38,7 @@

    The Twitcher is a task switcher to jump between running applications and their windows.

    twitcher.png -

    Just tap CTRL TAB quickly to switch between the current and the last application/window. Or press CTRL TAB and hold the CTRL key to go through all running applications by repeatedly hitting TAB or CURSOR LEFT/RIGHT. If you need to get to a specific window of a program, move to its icon as described and then go through its open windows with the CURSOR UP/DOWN keys.

    +

    Just tap CTRL TAB quickly to switch between the current and the last application/window. Or press CTRL TAB and hold the CTRL key to go through all running applications by repeatedly hitting TAB or /. If you need to get to a specific window of a program, move to its icon as described and then go through its open windows with the / keys.

    It's also possible to invoke the Twitcher with CTRL TAB and then use the mouse to choose the application/window you'll jump to when releasing the CTRL key.

    Added: haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_16.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_16.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_32.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_32.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_64.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/images/apps-images/bezillabrowser-icon_64.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/images/apps-images/diskprobe-about-attr.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/images/apps-images/diskprobe-about-attr.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/images/apps-images/diskprobe.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/images/apps-images/diskprobe.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Deleted: haiku/trunk/docs/userguide/images/apps-images/firefox-icon_16.png Deleted: haiku/trunk/docs/userguide/images/apps-images/firefox-icon_32.png Deleted: haiku/trunk/docs/userguide/images/apps-images/firefox-icon_64.png From korli at mail.berlios.de Wed Mar 4 22:00:40 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 4 Mar 2009 22:00:40 +0100 Subject: [Haiku-commits] r29399 - haiku/trunk/src/bin/tar Message-ID: <200903042100.n24L0e7Q012619@sheep.berlios.de> Author: korli Date: 2009-03-04 22:00:39 +0100 (Wed, 04 Mar 2009) New Revision: 29399 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29399&view=rev Modified: haiku/trunk/src/bin/tar/config.h Log: * Apply patch provided by Monni for bug #3514 Modified: haiku/trunk/src/bin/tar/config.h =================================================================== --- haiku/trunk/src/bin/tar/config.h 2009-03-04 17:29:50 UTC (rev 29398) +++ haiku/trunk/src/bin/tar/config.h 2009-03-04 21:00:39 UTC (rev 29399) @@ -968,7 +968,7 @@ #define STDC_HEADERS 1 /* Define to 1 if strerror_r returns char *. */ -#define STRERROR_R_CHAR_P 1 +/* #undef STRERROR_R_CHAR_P */ /* Define to 1 if you can safely include both and . */ #define TIME_WITH_SYS_TIME 1 From humdingerb at mail.berlios.de Wed Mar 4 22:01:54 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Wed, 4 Mar 2009 22:01:54 +0100 Subject: [Haiku-commits] r29400 - in haiku/trunk/docs/userguide/en: . applications Message-ID: <200903042101.n24L1sKo012722@sheep.berlios.de> Author: humdingerb Date: 2009-03-04 22:01:52 +0100 (Wed, 04 Mar 2009) New Revision: 29400 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29400&view=rev Modified: haiku/trunk/docs/userguide/en/applications.html haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html Log: Forgot one instance of 'Firefox'. Also, being Mozilla, I guess we can dispense with our own documentation for it. Unless there are interesting Haiku-only features. We'll see. Modified: haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html 2009-03-04 21:00:39 UTC (rev 29399) +++ haiku/trunk/docs/userguide/en/applications/apps-bezillabrowser.html 2009-03-04 21:01:52 UTC (rev 29400) @@ -37,14 +37,14 @@

    bezillabrowser-icon_64.pngFirefox

    +width="64" height="64" />BeZillaBrowser
    ALT CURSOR UPOpens the parent folder.
    ALT CURSOR DOWN or ENTEROpens the selected folder.
    ALT Opens the parent folder.
    ALT  or ENTEROpens the selected folder.
    WIN-KEYHolding it while opening a folder will automatically close the parent folder. This also works when navigating with the mouse.
    right MENU-KEYOpens the Deskbar menu (leave with ESC)
    ALT ZUndo last action. The undo history is only limited by the available memory. Note, that this only works for actions on the file itself, changed attributes and permission settings can't be undone. Also, once a file is removed from Trash it's gone for good.
    ALT GSwitch to the next Terminal window.
    ALT +, -Increase/Decrease font size.
    ALT ENTEREnter/leave fullscreen mode.
    SHIFT CURSOR UP/DOWNScrolls the Terminal +
    SHIFT /Scrolls the Terminal output up/down one line.
    SHIFT PAGE UP/DOWN Scrolls the Terminal +
    SHIFT PAGE UP/DOWN Scrolls the Terminal output up/down one page.
    TABTab-completion. After entering a few letters, press TAB once to auto-complete a filename or path. If @@ -84,7 +84,7 @@ and you have to provide some more letters to further distinguish them. You can also press TAB twice to have all matches listed.
    CURSOR UP/DOWNMoves up or down in a list of +
    /Moves up or down in a list of all previously entered commands.
    CTRL RBash history. All the commands you enter are stored in the file ~/.bash_history. Press CTRL R Modified: haiku/trunk/docs/userguide/en/preferences.html =================================================================== --- haiku/trunk/docs/userguide/en/preferences.html 2009-03-04 13:46:56 UTC (rev 29397) +++ haiku/trunk/docs/userguide/en/preferences.html 2009-03-04 17:29:50 UTC (rev 29398) @@ -58,7 +58,7 @@
    iconMedia  Audio and video settings like volume and in/output devices.
    iconMenu Configure the behaviour of menus and the command key (CTRL//ALT.
    Configure the behaviour of menus and the command key (CTRL//ALT).
    iconMouse  Configure your mouse.
    iconNetwork 
    Deskbar:Applications
    Location:/boot/apps/BeZillaBrowser/BeZillaBrowser
    Settings:~/config/settings/Mozilla/Firefox/*

    BeZillaBrowser is based on Mozilla's source code and uses patches to improve speed, stability, and other UI aspects. Currently, all BeZilla builds use Mozilla's 1.8 CVS Branch.

    -

    Documentation is still missing. If you want to work on it, please announce it on the Documentation mailing list to avoid duplication.

    +

    As the Mozilla browsers are very widely used on many platforms, you'll find a plethora of guides and tips online. You could start from http://support.mozilla.com/.

    + Modified: haiku/trunk/docs/userguide/en/applications.html =================================================================== --- haiku/trunk/docs/userguide/en/applications.html 2009-03-10 14:32:59 UTC (rev 29464) +++ haiku/trunk/docs/userguide/en/applications.html 2009-03-10 18:26:29 UTC (rev 29465) @@ -5,7 +5,7 @@