From mmlr at mail.berlios.de Sun Feb 1 00:04:10 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 1 Feb 2009 00:04:10 +0100 Subject: [Haiku-commits] r29106 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200901312304.n0VN4Ano003618@sheep.berlios.de> Author: mmlr Date: 2009-02-01 00:04:09 +0100 (Sun, 01 Feb 2009) New Revision: 29106 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29106&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp Log: Don't exit early when encountering an empty slot in the report. There seem to be keyboards that leave gaps. It's not really specified in the docs, they only say that the ordering of keys is indetermined. So I guess intermixing empty slots is equally valid. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2009-01-31 22:55:49 UTC (rev 29105) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2009-01-31 23:04:09 UTC (rev 29106) @@ -324,51 +324,51 @@ uint8 *compare = fTransferBuffer; for (int32 twice = 0; twice < 2; twice++) { for (size_t i = 2; i < fTotalReportSize; i++) { - if (current[i] != 0x00 && current[i] != 0x01) { - bool found = false; - for (size_t j = 2; j < fTotalReportSize; j++) { - if (compare[j] == current[i]) { - found = true; - break; - } + if (current[i] == 0x00 || current[i] == 0x01) + continue; + + bool found = false; + for (size_t j = 2; j < fTotalReportSize; j++) { + if (compare[j] == current[i]) { + found = true; + break; } + } - if (found) - continue; + if (found) + continue; - // a change occured - uint32 key = 0; - if (current[i] < sKeyTableSize) - key = sKeyTable[current[i]]; + // a change occured + uint32 key = 0; + if (current[i] < sKeyTableSize) + key = sKeyTable[current[i]]; - if (key == KEY_Pause && (current[0] & 1)) - key = KEY_Break; - else if (key == 0xe && (current[0] & 1)) - key = KEY_SysRq; + if (key == KEY_Pause && (current[0] & 1)) + key = KEY_Break; + else if (key == 0xe && (current[0] & 1)) + key = KEY_SysRq; #if 0 - else if (keyDown && key == 0x0d) // ToDo: remove again - panic("keyboard requested halt.\n"); + else if (keyDown && key == 0x0d) // ToDo: remove again + panic("keyboard requested halt.\n"); #endif - else if (key == 0) { - // unmapped key - key = 0x200000 + current[i]; - } + else if (key == 0) { + // unmapped key + key = 0x200000 + current[i]; + } - _WriteKey(key, keyDown); + _WriteKey(key, keyDown); - if (keyDown) { - // repeat handling - fCurrentRepeatKey = key; - fCurrentRepeatDelay = fRepeatDelay; - } else { - // cancel the repeats if they are for this key - if (fCurrentRepeatKey == key) { - fCurrentRepeatDelay = B_INFINITE_TIMEOUT; - fCurrentRepeatKey = 0; - } + if (keyDown) { + // repeat handling + fCurrentRepeatKey = key; + fCurrentRepeatDelay = fRepeatDelay; + } else { + // cancel the repeats if they are for this key + if (fCurrentRepeatKey == key) { + fCurrentRepeatDelay = B_INFINITE_TIMEOUT; + fCurrentRepeatKey = 0; } - } else - break; + } } current = fTransferBuffer; From ingo_weinhold at gmx.de Sun Feb 1 01:04:04 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 01 Feb 2009 01:04:04 +0100 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <4984D4A0.20805@googlemail.com> References: <200901251129.n0PBTeGJ018646@sheep.berlios.de> <49849C94.8010200@googlemail.com> <20090131200655.6400.2@bepc.1233406687.fake> <4984BFA2.9050404@googlemail.com> <1e80d8750901311437r2592faf6x726c857eb85fbdd2@mail.gmail.com> <4984D4A0.20805@googlemail.com> Message-ID: <20090201010404.362.1@knochen-vm.localdomain> On 2009-01-31 at 23:45:52 [+0100], Humdinger wrote: > Urias McCullough wrote: > > > Semantics i suppose. > > Sure. > > > It's like saying the address to someone's house ends on a street > > without specifying the actually house address :) > > From another POV it's like saying the path to your house includes your > house. > > > As a user, I expect the filename to be part of the actual path. > > Then you'd have to include it in the Get Info panel under "Path:"... :) > I don't mind terribly, just wanted to point it out... IMHO, what is shown after the "Path" label is useful. The only issue is that the label isn't quite correct. It should correctly say something like "Containing Directory Path", "Directory Path", or just "Directory". CU, Ingo From ingo_weinhold at gmx.de Sun Feb 1 01:20:49 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 01 Feb 2009 01:20:49 +0100 Subject: [Haiku-commits] r29101 - haiku/trunk/src/servers/app In-Reply-To: <200901312011.n0VKBZA8018548@sheep.berlios.de> References: <200901312011.n0VKBZA8018548@sheep.berlios.de> Message-ID: <20090201012049.688.2@knochen-vm.localdomain> On 2009-01-31 at 21:11:35 [+0100], stippi at BerliOS wrote: > Author: stippi > Date: 2009-01-31 21:11:34 +0100 (Sat, 31 Jan 2009) > New Revision: 29101 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29101&view=rev > > Modified: > haiku/trunk/src/servers/app/Window.cpp > Log: > Exclude any dirty regions from scrolling or copybitting. The previous > behavior, > which was also the BeOS behavior IIRC, has annoyed me a bit as an > application > developer. It wasn't possible to avoid display artifacts, if for example > scrolling a view which needed to be redrawn at the same time. It sounds > strange, but makes perfect sense for the situation I have here. Great! I noticed this annoying behavior when working on the Terminal. The cursor artifacts that could be seen flashing up when scrolling heavily seem to be gone now. CU, Ingo From anevilyak at mail.berlios.de Sun Feb 1 02:52:59 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Feb 2009 02:52:59 +0100 Subject: [Haiku-commits] r29107 - haiku/trunk/build/jam Message-ID: <200902010152.n111qx4R017712@sheep.berlios.de> Author: anevilyak Date: 2009-02-01 02:52:59 +0100 (Sun, 01 Feb 2009) New Revision: 29107 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29107&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: (Long overdue) update of the gcc4 Vision package to bring it to version/feature parity with the gcc2 revision. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2009-01-31 23:04:09 UTC (rev 29106) +++ haiku/trunk/build/jam/OptionalPackages 2009-02-01 01:52:59 UTC (rev 29107) @@ -466,8 +466,8 @@ 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-21072008-gcc4 - : http://vision.sf.net/Vision-0.9.7-H-21072008-gcc4.zip + InstallOptionalHaikuImagePackage Vision-0.9.7-H-25012009-gcc4 + : http://vision.sf.net/Vision-0.9.7-H-25012009-gcc4.zip : apps ; AddSymlinkToHaikuImage home config be Applications From humdingerb at googlemail.com Sun Feb 1 08:13:54 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sun, 01 Feb 2009 08:13:54 +0100 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <20090201010404.362.1@knochen-vm.localdomain> References: <200901251129.n0PBTeGJ018646@sheep.berlios.de> <49849C94.8010200@googlemail.com> <20090131200655.6400.2@bepc.1233406687.fake> <4984BFA2.9050404@googlemail.com> <1e80d8750901311437r2592faf6x726c857eb85fbdd2@mail.gmail.com> <4984D4A0.20805@googlemail.com> <20090201010404.362.1@knochen-vm.localdomain> Message-ID: <49854BB2.500@googlemail.com> Ingo Weinhold wrote: > IMHO, what is shown after the "Path" label is useful. The only issue is > that the label isn't quite correct. It should correctly say something like > "Containing Directory Path", "Directory Path", or just "Directory". Not intending to refurbish another of our bikesheds here... :) It odes make sense to define these things and to be consistent in the system. Also, it should preferably be short, best one word. As we've seen, "path" can be interpreted both ways, with and without the filename. So it's a matter of definition and the just sticking to it. My suggestion would be: path with filename == "Path" ["The path of the file is ~/home/.profile"] path w/ filename == "Location" ["The file is located in ~/home"] In that case, the "Get Info" panel would be changed and the Terminal context menu is correct. Which is the opposite of what I suggested in the beginning, but as I said, it's just a matter of definition. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From superstippi at gmx.de Sun Feb 1 11:51:41 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 01 Feb 2009 11:51:41 +0100 Subject: [Haiku-commits] r29101 - haiku/trunk/src/servers/app In-Reply-To: <20090201012049.688.2@knochen-vm.localdomain> References: <200901312011.n0VKBZA8018548@sheep.berlios.de> <20090201012049.688.2@knochen-vm.localdomain> Message-ID: <20090201115141.322.1@bepc.1233485126.fake> Ingo Weinhold wrote: > > On 2009-01-31 at 21:11:35 [+0100], stippi at BerliOS > wrote: > > Author: stippi > > Date: 2009-01-31 21:11:34 +0100 (Sat, 31 Jan 2009) New Revision: 29101 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29101&view=rev > > > > Modified: > > haiku/trunk/src/servers/app/Window.cpp > > Log: > > Exclude any dirty regions from scrolling or copybitting. The previous > > behavior, > > which was also the BeOS behavior IIRC, has annoyed me a bit as an > > application > > developer. It wasn't possible to avoid display artifacts, if for > > example scrolling a view which needed to be redrawn at the same time. > > It sounds strange, but makes perfect sense for the situation I have > > here. > > Great! I noticed this annoying behavior when working on the Terminal. The > cursor artifacts that could be seen flashing up when scrolling heavily > seem to be gone now. Ah, so there are other annoying situations! :-) Plus I have not seen the Tracker artifact when opening folders with files that are popuplated "out of order", ie with a lot of CopyBits() action. That bug may have been caused by a corner case where some dirty region was already inside an update session perhaps, and would have had to be shifted alongside... but who cares... :-) Best regards, -Stephan From superstippi at gmx.de Sun Feb 1 11:57:24 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 01 Feb 2009 11:57:24 +0100 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <49854BB2.500@googlemail.com> References: <200901251129.n0PBTeGJ018646@sheep.berlios.de> <49849C94.8010200@googlemail.com> <20090131200655.6400.2@bepc.1233406687.fake> <4984BFA2.9050404@googlemail.com> <1e80d8750901311437r2592faf6x726c857eb85fbdd2@mail.gmail.com> <4984D4A0.20805@googlemail.com> <20090201010404.362.1@knochen-vm.localdomain> <49854BB2.500@googlemail.com> Message-ID: <20090201115724.350.2@bepc.1233485126.fake> Humdinger wrote: > Ingo Weinhold wrote: > > IMHO, what is shown after the "Path" label is useful. The only issue is > > that the label isn't quite correct. It should correctly say something > > like "Containing Directory Path", "Directory Path", or just "Directory". > > Not intending to refurbish another of our bikesheds here... :) > > It odes make sense to define these things and to be consistent in the > system. Also, it should preferably be short, best one word. As we've > seen, "path" can be interpreted both ways, with and without the filename. > So it's a matter of definition and the just sticking to it. > > My suggestion would be: > path with filename == "Path" ["The path of the file is ~/home/.profile"] > path w/ filename == "Location" ["The file is located in ~/home"] > > In that case, the "Get Info" panel would be changed and the Terminal > context menu is correct. Which is the opposite of what I suggested in the > beginning, but as I said, it's just a matter of definition. Location is quite good, although strictly speaking, it's kind of synonymous to Path. What may work too is naming the Get Info label "Folder". Tracker deals with Folders. It's also "New Folder". When you click on it, it opens the Folder window. Problem is when showing Get Info for folders themselves. And thus, I'd vote for Location. :-) Best regards, -Stephan From alex at zappotek.com Sun Feb 1 13:51:50 2009 From: alex at zappotek.com (Alexandre Deckner) Date: Sun, 01 Feb 2009 13:51:50 +0100 Subject: [Haiku-commits] r29101 - haiku/trunk/src/servers/app In-Reply-To: <20090201115141.322.1@bepc.1233485126.fake> References: <200901312011.n0VKBZA8018548@sheep.berlios.de> <20090201012049.688.2@knochen-vm.localdomain> <20090201115141.322.1@bepc.1233485126.fake> Message-ID: <49859AE6.6010502@zappotek.com> Stephan Assmus wrote: > Ah, so there are other annoying situations! :-) Plus I have not seen the > Tracker artifact when opening folders with files that are popuplated "out > of order", ie with a lot of CopyBits() action. That bug may have been > caused by a corner case where some dirty region was already inside an > update session perhaps, and would have had to be shifted alongside... but > who cares... :-) While you're at it, could you have an eye on #1849 and #2975? I quickly rechecked #1849 but it doesn't seem to be fixed. Best regards, Alex From alex at zappotek.com Sun Feb 1 13:55:22 2009 From: alex at zappotek.com (Alexandre Deckner) Date: Sun, 01 Feb 2009 13:55:22 +0100 Subject: [Haiku-commits] r29101 - haiku/trunk/src/servers/app In-Reply-To: <49859AE6.6010502@zappotek.com> References: <200901312011.n0VKBZA8018548@sheep.berlios.de> <20090201012049.688.2@knochen-vm.localdomain> <20090201115141.322.1@bepc.1233485126.fake> <49859AE6.6010502@zappotek.com> Message-ID: <49859BBA.40208@zappotek.com> Alexandre Deckner wrote: > While you're at it, could you have an eye on #1849 and #2975? > I quickly rechecked #1849 but it doesn't seem to be fixed. > > > Note #3037 too. From stippi at mail.berlios.de Sun Feb 1 14:58:41 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 1 Feb 2009 14:58:41 +0100 Subject: [Haiku-commits] r29108 - haiku/trunk/src/add-ons/kernel/drivers/disk/scsi/scsi_cd Message-ID: <200902011358.n11Dwflp031137@sheep.berlios.de> Author: stippi Date: 2009-02-01 14:58:40 +0100 (Sun, 01 Feb 2009) New Revision: 29108 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29108&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp Log: Specify direction flag in all calls of simple_exec(). Thanks, Marcus! Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp 2009-02-01 01:52:59 UTC (rev 29107) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/scsi/scsi_cd/scsi_cd.cpp 2009-02-01 13:58:40 UTC (rev 29108) @@ -349,7 +349,7 @@ cmd.end_frame = position->end_f; return sSCSIPeripheral->simple_exec(info->scsi_periph_device, - &cmd, sizeof(cmd), NULL, 0, 0); + &cmd, sizeof(cmd), NULL, 0, SCSI_DIR_NONE); } @@ -414,7 +414,7 @@ cmd.opcode = SCSI_OP_STOP_PLAY; return sSCSIPeripheral->simple_exec(info->scsi_periph_device, - &cmd, sizeof(cmd), NULL, 0, 0); + &cmd, sizeof(cmd), NULL, 0, SCSI_DIR_NONE); } @@ -430,7 +430,7 @@ cmd.resume = resume; return sSCSIPeripheral->simple_exec(info->scsi_periph_device, - &cmd, sizeof(cmd), NULL, 0, 0); + &cmd, sizeof(cmd), NULL, 0, SCSI_DIR_NONE); } @@ -479,7 +479,7 @@ */ return sSCSIPeripheral->simple_exec(info->scsi_periph_device, - &cmd, sizeof(cmd), NULL, 0, 0); + &cmd, sizeof(cmd), NULL, 0, SCSI_DIR_NONE); } From humdingerb at googlemail.com Sun Feb 1 15:52:33 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sun, 01 Feb 2009 15:52:33 +0100 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <20090201115724.350.2@bepc.1233485126.fake> References: <200901251129.n0PBTeGJ018646@sheep.berlios.de> <49849C94.8010200@googlemail.com> <20090131200655.6400.2@bepc.1233406687.fake> <4984BFA2.9050404@googlemail.com> <1e80d8750901311437r2592faf6x726c857eb85fbdd2@mail.gmail.com> <4984D4A0.20805@googlemail.com> <20090201010404.362.1@knochen-vm.localdomain> <49854BB2.500@googlemail.com> <20090201115724.350.2@bepc.1233485126.fake> Message-ID: <4985B731.50901@googlemail.com> Stephan Assmus wrote: > Location is quite good, although strictly speaking, it's kind of synonymous > to Path. What may work too is naming the Get Info label "Folder". Tracker > deals with Folders. It's also "New Folder". When you click on it, it opens > the Folder window. Problem is when showing Get Info for folders themselves. This is more or less exactly how I thought about that, too. :) > And thus, I'd vote for Location. :-) I made a diff of the InfoWindow.cpp that I've attached. Since this is the first patch that I haven't sent privately to you, is that the correct way to create a patch: I navigated to haiku/trunk/src/kits/tracker and did a "svn diff > file.diff". I know it's a ridiculously simple little diff, but if you feel the patch<->location distinction has merit, feel free to apply it. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de -------------- next part -------------- A non-text attachment was scrubbed... Name: InfoWindow.diff Type: text/x-patch Size: 522 bytes Desc: not available URL: From anevilyak at mail.berlios.de Sun Feb 1 17:25:32 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Feb 2009 17:25:32 +0100 Subject: [Haiku-commits] r29109 - haiku/trunk/src/kits/tracker Message-ID: <200902011625.n11GPWqu019634@sheep.berlios.de> Author: anevilyak Date: 2009-02-01 17:25:30 +0100 (Sun, 01 Feb 2009) New Revision: 29109 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29109&view=rev Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp Log: Fix Create Link from context menu. Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2009-02-01 13:58:40 UTC (rev 29108) +++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2009-02-01 16:25:30 UTC (rev 29109) @@ -1453,13 +1453,13 @@ if (model.InitCheck() != B_OK) break; - PoseView()->MoveSelectionInto(&model, this, false, true, - message->what == kCreateRelativeLink); + PoseView()->MoveSelectionInto(&model, this, false, false, + message->what == kCreateLink, message->what == kCreateRelativeLink); } else { // no destination specified, create link in same dir as item if (!TargetModel()->IsQuery()) - PoseView()->MoveSelectionInto(TargetModel(), this, false, true, - (message->what == kCreateRelativeLink)); + PoseView()->MoveSelectionInto(TargetModel(), this, false, false, + message->what == kCreateLink, message->what == kCreateRelativeLink); } break; } From mmlr at mail.berlios.de Sun Feb 1 18:29:45 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 1 Feb 2009 18:29:45 +0100 Subject: [Haiku-commits] r29110 - haiku/trunk/headers/private/bluetooth Message-ID: <200902011729.n11HTjuK028469@sheep.berlios.de> Author: mmlr Date: 2009-02-01 18:29:42 +0100 (Sun, 01 Feb 2009) New Revision: 29110 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29110&view=rev Modified: haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h Log: Fix deprecated include. Modified: haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h =================================================================== --- haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h 2009-02-01 16:25:30 UTC (rev 29109) +++ haiku/trunk/headers/private/bluetooth/ConnectionIncoming.h 2009-02-01 17:29:42 UTC (rev 29110) @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include #include From bonefish at mail.berlios.de Sun Feb 1 19:16:48 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Feb 2009 19:16:48 +0100 Subject: [Haiku-commits] r29111 - haiku/trunk/src/tests/system/runtime_loader/test_suite Message-ID: <200902011816.n11IGmux021494@sheep.berlios.de> Author: bonefish Date: 2009-02-01 19:16:46 +0100 (Sun, 01 Feb 2009) New Revision: 29111 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29111&view=rev Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order5 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order6 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order7 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_basic1 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order1 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order2 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order3 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order4 Log: * Link the test programs with --export-dynamic. This shows that my previous assumption, that the program image is ignored when relocating symbols of dlopen()ed objects, is incorrect. * Adjusted the tests that were failing due to that. * The RTLD_NEXT test also fails with openSuse 10.3 -- apparently the semantics has changed between the Linux versions. Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 2009-02-01 18:16:46 UTC (rev 29111) @@ -93,7 +93,6 @@ void* liba; void* libe; void* self; -// int (*a)(); libe = dlopen("./libe.so", RTLD_NOW | RTLD_GLOBAL); if (libe == NULL) { @@ -107,20 +106,12 @@ exit(117); } -/* - a = (int (*)())dlsym(libe, "a"); - if (a == NULL) { - fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); - exit(116); - } -*/ - return a(); } EOI # build -gcc -o program program.c -D_GNU_SOURCE $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c -D_GNU_SOURCE $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 31 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 2009-02-01 18:16:46 UTC (rev 29111) @@ -83,7 +83,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 2009-02-01 18:16:46 UTC (rev 29111) @@ -83,7 +83,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 2 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 2009-02-01 18:16:46 UTC (rev 29111) @@ -79,7 +79,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 2 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 2009-02-01 18:16:46 UTC (rev 29111) @@ -83,7 +83,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 2009-02-01 18:16:46 UTC (rev 29111) @@ -5,8 +5,7 @@ # dlopen(): # liba.so # -# Expected: Undefined symbol in liba.so might resolve to symbol in program, but -# the program image is ignored, so dlopen() on liba.so fails. +# Expected: Undefined symbol in liba.so resolve to symbol in program. . test_setup @@ -54,7 +53,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run -test_run_ok ./program 117 +test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 2009-02-01 18:16:46 UTC (rev 29111) @@ -60,7 +60,7 @@ EOI # build -gcc -o program program.c ./libb.so $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c ./libb.so $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 2009-02-01 18:16:46 UTC (rev 29111) @@ -70,7 +70,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 2009-02-01 18:16:46 UTC (rev 29111) @@ -6,8 +6,8 @@ # libb.so # liba.so # -# Expected: Undefined symbol in liba.so resolves to symbol in libb.so, not -# to symbol in program, since program image is ignored. +# Expected: Undefined symbol in liba.so resolves to symbol in program, not +# to symbol in libb.so. . test_setup @@ -70,8 +70,8 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run -test_run_ok ./program 2 +test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 2009-02-01 18:16:46 UTC (rev 29111) @@ -80,7 +80,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 2 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 2009-02-01 18:16:46 UTC (rev 29111) @@ -77,7 +77,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 2 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 2009-02-01 18:16:46 UTC (rev 29111) @@ -87,7 +87,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 2 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order5 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order5 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order5 2009-02-01 18:16:46 UTC (rev 29111) @@ -97,7 +97,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 2 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order6 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order6 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order6 2009-02-01 18:16:46 UTC (rev 29111) @@ -105,7 +105,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order7 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order7 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order7 2009-02-01 18:16:46 UTC (rev 29111) @@ -77,7 +77,7 @@ EOI # build -gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . +gcc -o program program.c $libdl -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 2009-02-01 18:16:46 UTC (rev 29111) @@ -73,8 +73,8 @@ EOI # build -gcc -o program program.c -D_GNU_SOURCE ./liba.so $libdl -Xlinker -rpath \ - -Xlinker . +gcc -o program program.c -D_GNU_SOURCE ./liba.so $libdl \ + -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 15 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_basic1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_basic1 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_basic1 2009-02-01 18:16:46 UTC (rev 29111) @@ -37,7 +37,7 @@ EOI # build -gcc -o program program.c ./liba.so +gcc -o program program.c ./liba.so -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order1 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order1 2009-02-01 18:16:46 UTC (rev 29111) @@ -50,7 +50,7 @@ EOI # build -gcc -o program program.c ./liba.so ./libb.so -Xlinker -rpath -Xlinker . +gcc -o program program.c ./liba.so ./libb.so -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order2 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order2 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order2 2009-02-01 18:16:46 UTC (rev 29111) @@ -50,7 +50,7 @@ EOI # build -gcc -o program program.c ./libb.so ./liba.so -Xlinker -rpath -Xlinker . +gcc -o program program.c ./libb.so ./liba.so -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order3 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order3 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order3 2009-02-01 18:16:46 UTC (rev 29111) @@ -51,7 +51,7 @@ EOI # build -gcc -o program program.c ./liba.so ./libb.so -Xlinker -rpath -Xlinker . +gcc -o program program.c ./liba.so ./libb.so -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order4 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order4 2009-02-01 17:29:42 UTC (rev 29110) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order4 2009-02-01 18:16:46 UTC (rev 29111) @@ -45,7 +45,7 @@ EOI # build -gcc -o program program.c ./libb.so -Xlinker -rpath -Xlinker . +gcc -o program program.c ./libb.so -Wl,-rpath,.,--export-dynamic # run test_run_ok ./program 1 From bonefish at mail.berlios.de Sun Feb 1 19:40:42 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 1 Feb 2009 19:40:42 +0100 Subject: [Haiku-commits] r29112 - haiku/trunk/src/system/runtime_loader Message-ID: <200902011840.n11Ieg3T019417@sheep.berlios.de> Author: bonefish Date: 2009-02-01 19:40:42 +0100 (Sun, 01 Feb 2009) New Revision: 29112 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29112&view=rev Modified: haiku/trunk/src/system/runtime_loader/elf.cpp Log: The assumption that the program image is not used for relocation of dlopen()ed objects was incorrect. This should fix problems with ports of software with a plugin/add-on interface. Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2009-02-01 18:16:46 UTC (rev 29111) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2009-02-01 18:40:42 UTC (rev 29112) @@ -2141,10 +2141,9 @@ if (status < B_OK) goto err; - // Set RTLD_GLOBAL on all libraries, but clear it on the program image. + // Set RTLD_GLOBAL on all libraries including the program. // This results in the desired symbol resolution for dlopen()ed libraries. set_image_flags_recursively(sProgramImage, RTLD_GLOBAL); - sProgramImage->flags &= ~RTLD_GLOBAL; status = relocate_dependencies(sProgramImage); if (status < B_OK) From axeld at pinc-software.de Sun Feb 1 19:59:37 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 01 Feb 2009 19:59:37 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29103_-_in_haiku/trunk=3A_headers/os/i?= =?utf-8?q?nterface_src/kits/interface?= In-Reply-To: <200901312127.n0VLRpQ3023561@sheep.berlios.de> Message-ID: <693556582-BeMail@zon> julun at BerliOS wrote: > - I'm still unsure if the behavior change introduced with the layout > stuff is nice What are you refering to specifically? It's been some time, but I could have been working on that (or BListView, I don't remember). Since it was a rather quick "fix" (so much I do remember), it might not be what one would usually want. Bye, Axel. From axeld at pinc-software.de Sun Feb 1 20:04:56 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 01 Feb 2009 20:04:56 +0100 CET Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <49854BB2.500@googlemail.com> Message-ID: <1012076034-BeMail@zon> Humdinger wrote: > My suggestion would be: > path with filename == "Path" ["The path of the file is ~/home/ > .profile"] > path w/ filename == "Location" ["The file is located in ~/home"] > > In that case, the "Get Info" panel would be changed and the Terminal > context menu is > correct. Which is the opposite of what I suggested in the beginning, > but as I said, it's > just a matter of definition. +1 :-) Bye, Axel. From host.haiku at gmx.de Sun Feb 1 20:46:08 2009 From: host.haiku at gmx.de (Karsten Heimrich) Date: Sun, 01 Feb 2009 20:46:08 +0100 Subject: [Haiku-commits] r29103 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <693556582-BeMail@zon> References: <693556582-BeMail@zon> Message-ID: <4985FC00.7090608@gmx.de> Hi Axel, Axel D?rfler schrieb: > julun at BerliOS wrote: >> - I'm still unsure if the behavior change introduced with the layout >> stuff is nice > > What are you refering to specifically? > It's been some time, but I could have been working on that (or > BListView, I don't remember). Since it was a rather quick "fix" (so > much I do remember), it might not be what one would usually want. at first i thought it would behave like the one without layout, basically keeping the frame of the target at the same position. Now it moves the target around and resizes it accordingly. Though it is not possible to keep the old behavior. I had extended my test locally and it gave even worse results when having a view with layout, adding the scroll view and a target with fixed size. Then the scrollbars where only partly visible etc. There was some more stuff, i might extend the test app to be able to show this. I guess also SetTarget(...) seems effected by the not added 1px space between the target and the scroll view. Best regards, Karsten From mmlr at mail.berlios.de Sun Feb 1 21:48:15 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 1 Feb 2009 21:48:15 +0100 Subject: [Haiku-commits] r29113 - in haiku/trunk: headers/os/drivers headers/private/kernel/util src/bin/makebootable/platform/bios_ia32 src/system/kernel src/system/kernel/arch/x86 src/system/kernel/cache src/system/kernel/debug src/system/kernel/device_manager src/system/kernel/fs src/system/kernel/slab src/system/kernel/vm Message-ID: <200902012048.n11KmF9e028270@sheep.berlios.de> Author: mmlr Date: 2009-02-01 21:48:02 +0100 (Sun, 01 Feb 2009) New Revision: 29113 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29113&view=rev Modified: haiku/trunk/headers/os/drivers/KernelExport.h haiku/trunk/headers/private/kernel/util/khash.h haiku/trunk/src/bin/makebootable/platform/bios_ia32/makebootable.cpp haiku/trunk/src/system/kernel/Notifications.cpp haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp haiku/trunk/src/system/kernel/cache/block_cache.cpp haiku/trunk/src/system/kernel/cache/file_map.cpp haiku/trunk/src/system/kernel/debug/debug_commands.cpp haiku/trunk/src/system/kernel/device_manager/IOScheduler.cpp haiku/trunk/src/system/kernel/device_manager/devfs.cpp haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp haiku/trunk/src/system/kernel/elf.cpp haiku/trunk/src/system/kernel/fs/fifo.cpp haiku/trunk/src/system/kernel/fs/socket.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/kernel_daemon.cpp haiku/trunk/src/system/kernel/module.cpp haiku/trunk/src/system/kernel/slab/Slab.cpp haiku/trunk/src/system/kernel/thread.cpp haiku/trunk/src/system/kernel/vm/VMAnonymousCache.cpp haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_cache.cpp haiku/trunk/src/system/kernel/vm/vm_page.cpp haiku/trunk/src/system/kernel/wait_for_objects.cpp Log: Fixing warnings under GCC4 in preparation to enable -Werror there as well: * Replaced the use of offsetof() for structs that aren't PODs. Add a offset_of_member() macro to util/khash.h because that's what it's used for in our cases. * Change the signature of add_debugger_command()/remove_debugger_command() on GCC > 2 to avoid the depricated conversion from string constants to char *. * Adding some "suggested" parenthesis. I know that not everyone likes that, but it pointed out at least one bug that is fixed here as well. Modified: haiku/trunk/headers/os/drivers/KernelExport.h =================================================================== --- haiku/trunk/headers/os/drivers/KernelExport.h 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/headers/os/drivers/KernelExport.h 2009-02-01 20:48:02 UTC (rev 29113) @@ -174,9 +174,16 @@ extern void kernel_debugger(const char *message); extern uint64 parse_expression(const char *string); +#if __GNUC__ > 2 +extern int add_debugger_command(const char *name, + debugger_command_hook hook, const char *help); +extern int remove_debugger_command(const char *name, + debugger_command_hook hook); +#else extern int add_debugger_command(char *name, debugger_command_hook hook, char *help); extern int remove_debugger_command(char *name, debugger_command_hook hook); +#endif /* Miscellaneous */ extern void spin(bigtime_t microseconds); Modified: haiku/trunk/headers/private/kernel/util/khash.h =================================================================== --- haiku/trunk/headers/private/kernel/util/khash.h 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/headers/private/kernel/util/khash.h 2009-02-01 20:48:02 UTC (rev 29113) @@ -11,6 +11,12 @@ #include +// The use of offsetof() on non-PODs is invalid. Since many structs use +// templated members (i.e. DoublyLinkedList) which makes them non-PODs we +// can't use offsetof() anymore. This macro does the same, but requires an +// instance of the object in question. +#define offset_of_member(OBJECT, MEMBER) \ + ((size_t)((char*)&OBJECT.MEMBER - (char*)&OBJECT)) // can be allocated on the stack typedef struct hash_iterator { Modified: haiku/trunk/src/bin/makebootable/platform/bios_ia32/makebootable.cpp =================================================================== --- haiku/trunk/src/bin/makebootable/platform/bios_ia32/makebootable.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/bin/makebootable/platform/bios_ia32/makebootable.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -611,7 +611,7 @@ // write the boot code printf("Writing boot code to \"%s\" (partition offset: %lld bytes, " - "start offset = %d) " + "start offset = %lld) " "...\n", fileName, partitionOffset, startOffset); write_boot_code_part(fileName, fd, startOffset, bootCodeData, 0, Modified: haiku/trunk/src/system/kernel/Notifications.cpp =================================================================== --- haiku/trunk/src/system/kernel/Notifications.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/Notifications.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -57,7 +57,7 @@ UserMessagingMessageSender::SendMessage(const KMessage* message, port_id port, int32 token) { - if (message != fMessage && fMessage != NULL + if ((message != fMessage && fMessage != NULL) || fTargetCount == MAX_MESSAGING_TARGET_COUNT) { FlushMessage(); } Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -367,10 +367,10 @@ if (thread == NULL) return IS_KERNEL_ADDRESS(address); - return address >= thread->kernel_stack_base - && address < thread->kernel_stack_top - || thread->cpu != NULL - && is_double_fault_stack_address(thread->cpu->cpu_num, address); + return (address >= thread->kernel_stack_base + && address < thread->kernel_stack_top) + || (thread->cpu != NULL + && is_double_fault_stack_address(thread->cpu->cpu_num, address)); } @@ -508,7 +508,8 @@ threadIndex++; } - if (argc > threadIndex + 1 || argc == 2 && strcmp(argv[1], "--help") == 0) { + if (argc > threadIndex + 1 + || (argc == 2 && strcmp(argv[1], "--help") == 0)) { kprintf(usage, argv[0]); return 0; } Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -47,7 +47,6 @@ // system, like out of memory situations - should only panic for debugging. #define FATAL(x) panic x - static const bigtime_t kTransactionIdleTime = 2000000LL; // a transaction is considered idle after 2 seconds of inactivity @@ -605,8 +604,8 @@ while (iterator.HasNext()) { cache_listener* listener = iterator.Next(); - bool remove = isClosing && !is_written_event(listener->events) - || isWritten && is_written_event(listener->events); + bool remove = (isClosing && !is_written_event(listener->events)) + || (isWritten && is_written_event(listener->events)); if (remove) iterator.Remove(); @@ -804,12 +803,14 @@ if (buffer_cache == NULL) return B_NO_MEMORY; - hash = hash_init(1024, offsetof(cached_block, next), &cached_block::Compare, - &cached_block::Hash); + cached_block dummyBlock; + hash = hash_init(1024, offset_of_member(dummyBlock, next), + &cached_block::Compare, &cached_block::Hash); if (hash == NULL) return B_NO_MEMORY; - transaction_hash = hash_init(16, offsetof(cache_transaction, next), + cache_transaction dummyTransaction; + transaction_hash = hash_init(16, offset_of_member(dummyTransaction, next), &transaction_compare, &::transaction_hash); if (transaction_hash == NULL) return B_NO_MEMORY; Modified: haiku/trunk/src/system/kernel/cache/file_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/file_map.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/cache/file_map.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -242,7 +242,7 @@ if (lastExtent != NULL) { if (lastExtent->disk.offset + lastExtent->disk.length == vecs[i].offset - || lastExtent->disk.offset == -1 && vecs[i].offset == -1) { + || (lastExtent->disk.offset == -1 && vecs[i].offset == -1)) { lastExtent->disk.length += vecs[i].length; offset += vecs[i].length; start--; @@ -368,8 +368,8 @@ MutexLocker _(fLock); - if (mode == FILE_MAP_CACHE_ALL && fCacheAll - || mode == FILE_MAP_CACHE_ON_DEMAND && !fCacheAll) + if ((mode == FILE_MAP_CACHE_ALL && fCacheAll) + || (mode == FILE_MAP_CACHE_ON_DEMAND && !fCacheAll)) return B_OK; if (mode == FILE_MAP_CACHE_ALL) { Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -488,8 +488,8 @@ kprintf_unfiltered("usage: %s ", command->name); kputs_unfiltered(command->usage); } else { - char* args[3] = { NULL, "--help", NULL }; - invoke_debugger_command(command, 2, args); + const char* args[3] = { NULL, "--help", NULL }; + invoke_debugger_command(command, 2, (char**)args); } return true; @@ -498,16 +498,24 @@ // #pragma mark - public API - int +#if __GNUC__ > 2 +add_debugger_command(const char *name, int (*func)(int, char **), + const char *desc) +#else add_debugger_command(char *name, int (*func)(int, char **), char *desc) +#endif { return add_debugger_command_etc(name, func, desc, NULL, 0); } int +#if __GNUC__ > 2 +remove_debugger_command(const char * name, int (*func)(int, char **)) +#else remove_debugger_command(char * name, int (*func)(int, char **)) +#endif { struct debugger_command *cmd = sCommands; struct debugger_command *prev = NULL; Modified: haiku/trunk/src/system/kernel/device_manager/IOScheduler.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/IOScheduler.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/device_manager/IOScheduler.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -513,7 +513,7 @@ off_t offsetA = a->Offset(); off_t offsetB = b->Offset(); return offsetA < offsetB - || offsetA == offsetB && a->Length() > b->Length(); + || (offsetA == offsetB && a->Length() > b->Length()); } }; Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -1746,8 +1746,8 @@ bool isWrite = request->IsWrite(); if (!S_ISCHR(vnode->stream.type) - || ((isWrite && !vnode->stream.u.dev.device->HasWrite() - || !isWrite && !vnode->stream.u.dev.device->HasRead()) + || (((isWrite && !vnode->stream.u.dev.device->HasWrite()) + || (!isWrite && !vnode->stream.u.dev.device->HasRead())) && !vnode->stream.u.dev.device->HasIO()) || cookie == NULL) { return B_NOT_ALLOWED; Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -481,7 +481,7 @@ while (true) { driver = (legacy_driver *)hash_next(sDriverHash, &iterator); if (driver == NULL - || driver->device == device && driver->node == node) + || (driver->device == device && driver->node == node)) break; } @@ -1372,8 +1372,10 @@ extern "C" status_t legacy_driver_init(void) { - sDriverHash = hash_init(DRIVER_HASH_SIZE, offsetof(legacy_driver, next), - &driver_entry_compare, &driver_entry_hash); + legacy_driver dummyDriver; + sDriverHash = hash_init(DRIVER_HASH_SIZE, + offset_of_member(dummyDriver, next), &driver_entry_compare, + &driver_entry_hash); if (sDriverHash == NULL) return B_NO_MEMORY; Modified: haiku/trunk/src/system/kernel/elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/elf.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/elf.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -2049,9 +2049,9 @@ if (_symbolCount == NULL || _stringTableSize == NULL) return B_BAD_VALUE; if (!IS_USER_ADDRESS(_symbolCount) || !IS_USER_ADDRESS(_stringTableSize) - || _imageDelta != NULL && !IS_USER_ADDRESS(_imageDelta) - || symbolTable != NULL && !IS_USER_ADDRESS(symbolTable) - || stringTable != NULL && !IS_USER_ADDRESS(stringTable)) { + || (_imageDelta != NULL && !IS_USER_ADDRESS(_imageDelta)) + || (symbolTable != NULL && !IS_USER_ADDRESS(symbolTable)) + || (stringTable != NULL && !IS_USER_ADDRESS(stringTable))) { return B_BAD_ADDRESS; } @@ -2120,8 +2120,8 @@ if (user_memcpy(_symbolCount, &symbolCount, sizeof(symbolCount)) != B_OK || user_memcpy(_stringTableSize, &stringTableSize, sizeof(stringTableSize)) != B_OK - || _imageDelta != NULL && user_memcpy(_imageDelta, &imageDelta, - sizeof(imageDelta)) != B_OK) { + || (_imageDelta != NULL && user_memcpy(_imageDelta, &imageDelta, + sizeof(imageDelta)) != B_OK)) { return B_BAD_ADDRESS; } Modified: haiku/trunk/src/system/kernel/fs/fifo.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fifo.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/fs/fifo.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -364,7 +364,7 @@ while (dataSize > 0) { // Wait until enough space in the buffer is available. while (!fActive - || fBuffer.Writable() < minToWrite && fReaderCount > 0) { + || (fBuffer.Writable() < minToWrite && fReaderCount > 0)) { if (nonBlocking) return B_WOULD_BLOCK; @@ -639,9 +639,9 @@ // signal right away, if the condition holds already if (writer) { - if (event == B_SELECT_WRITE - && (fBuffer.Writable() > 0 || fReaderCount == 0) - || event == B_SELECT_ERROR && fReaderCount == 0) { + if ((event == B_SELECT_WRITE + && (fBuffer.Writable() > 0 || fReaderCount == 0)) + || (event == B_SELECT_ERROR && fReaderCount == 0)) { return notify_select_event(sync, event); } } else { Modified: haiku/trunk/src/system/kernel/fs/socket.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/socket.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/fs/socket.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -119,9 +119,9 @@ // copy address size and address back to userland if (user_memcpy(userAddressLength, &addressLength, sizeof(socklen_t)) != B_OK - || userAddress != NULL + || (userAddress != NULL && user_memcpy(userAddress, address, - min_c(addressLength, userAddressBufferSize)) != B_OK) { + min_c(addressLength, userAddressBufferSize)) != B_OK)) { return B_BAD_ADDRESS; } @@ -973,10 +973,10 @@ message.msg_name = userAddress; message.msg_iov = userVecs; message.msg_control = userAncillary; - if (userAddress != NULL && user_memcpy(userAddress, address, - message.msg_namelen) != B_OK - || userAncillary != NULL && user_memcpy(userAncillary, ancillary, - message.msg_controllen) != B_OK + if ((userAddress != NULL && user_memcpy(userAddress, address, + message.msg_namelen) != B_OK) + || (userAncillary != NULL && user_memcpy(userAncillary, ancillary, + message.msg_controllen) != B_OK) || user_memcpy(userMessage, &message, sizeof(msghdr)) != B_OK) { return B_BAD_ADDRESS; } Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -1852,8 +1852,8 @@ if (vnodeToDisconnect != NULL) { if (vnode == vnodeToDisconnect) disconnect_fd(descriptor); - } else if (vnode != NULL && vnode->mount == mount - || vnode == NULL && descriptor->u.mount == mount) + } else if ((vnode != NULL && vnode->mount == mount) + || (vnode == NULL && descriptor->u.mount == mount)) disconnect_fd(descriptor); put_fd(descriptor); @@ -4842,15 +4842,17 @@ status_t vfs_init(kernel_args *args) { - sVnodeTable = hash_init(VNODE_HASH_TABLE_SIZE, offsetof(struct vnode, next), - &vnode_compare, &vnode_hash); + struct vnode dummyVnode; + sVnodeTable = hash_init(VNODE_HASH_TABLE_SIZE, + offset_of_member(dummyVnode, next), &vnode_compare, &vnode_hash); if (sVnodeTable == NULL) panic("vfs_init: error creating vnode hash table\n"); - list_init_etc(&sUnusedVnodeList, offsetof(struct vnode, unused_link)); + list_init_etc(&sUnusedVnodeList, offset_of_member(dummyVnode, unused_link)); - sMountsTable = hash_init(MOUNTS_HASH_TABLE_SIZE, offsetof(struct fs_mount, next), - &mount_compare, &mount_hash); + struct fs_mount dummyMount; + sMountsTable = hash_init(MOUNTS_HASH_TABLE_SIZE, + offset_of_member(dummyMount, next), &mount_compare, &mount_hash); if (sMountsTable == NULL) panic("vfs_init: error creating mounts hash table\n"); @@ -5752,10 +5754,10 @@ status = release_advisory_lock(vnode, &flock); } else { // the open mode must match the lock type - if ((descriptor->open_mode & O_RWMASK) == O_RDONLY - && flock.l_type == F_WRLCK - || (descriptor->open_mode & O_RWMASK) == O_WRONLY - && flock.l_type == F_RDLCK) + if (((descriptor->open_mode & O_RWMASK) == O_RDONLY + && flock.l_type == F_WRLCK) + || ((descriptor->open_mode & O_RWMASK) == O_WRONLY + && flock.l_type == F_RDLCK)) status = B_FILE_ERROR; else { status = acquire_advisory_lock(vnode, -1, @@ -6725,7 +6727,7 @@ fs_mount(char* path, const char* device, const char* fsName, uint32 flags, const char* args, bool kernel) { - struct fs_mount* mount; + struct ::fs_mount* mount; status_t status = 0; FUNCTION(("fs_mount: entry. path = '%s', fs_name = '%s'\n", path, fsName)); @@ -6840,7 +6842,7 @@ } } - mount = new(std::nothrow) struct ::fs_mount; + mount = new(std::nothrow) (struct ::fs_mount); if (mount == NULL) return B_NO_MEMORY; @@ -8390,7 +8392,7 @@ return B_BAD_ADDRESS; // open the parent dir - int parentFD = dir_open(fd, "..", kernel); + int parentFD = dir_open(fd, (char*)"..", kernel); if (parentFD < 0) return parentFD; FDCloser fdCloser(parentFD, kernel); Modified: haiku/trunk/src/system/kernel/kernel_daemon.cpp =================================================================== --- haiku/trunk/src/system/kernel/kernel_daemon.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/kernel_daemon.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -83,7 +83,7 @@ if (function == NULL || frequency < 1) return B_BAD_VALUE; - struct daemon* daemon = new(std::nothrow) struct ::daemon; + struct ::daemon* daemon = new(std::nothrow) (struct ::daemon); if (daemon == NULL) return B_NO_MEMORY; Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/module.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -2182,8 +2182,8 @@ module = (struct module*)hash_lookup(sModulesHash, path); // if we don't have it cached yet, search for it - if (module == NULL || (module->flags & B_BUILT_IN_MODULE) == 0 - && module->module_image == NULL) { + if (module == NULL || ((module->flags & B_BUILT_IN_MODULE) == 0 + && module->module_image == NULL)) { module = search_module(path, &moduleImage); if (module == NULL) { FATAL(("module: Search for %s failed.\n", path)); Modified: haiku/trunk/src/system/kernel/slab/Slab.cpp =================================================================== --- haiku/trunk/src/system/kernel/slab/Slab.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/slab/Slab.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -26,6 +26,7 @@ #include #include #include +#include #include #include @@ -597,8 +598,12 @@ static void object_cache_return_object_wrapper(object_depot *depot, void *object) { + // TODO: the offset calculation might be wrong because we hardcode a + // SmallObjectCache instead of a base object_cache. Also this must + // have an unacceptable overhead. + SmallObjectCache dummyCache; object_cache *cache = (object_cache *)(((uint8 *)depot) - - offsetof(object_cache, depot)); + - offset_of_member(dummyCache, depot)); object_cache_free(cache, object); } Modified: haiku/trunk/src/system/kernel/thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/thread.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/thread.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -2724,8 +2724,8 @@ thread_id threadID; if (!IS_USER_ADDRESS(attributes.entry) || attributes.entry == NULL - || attributes.stack_address != NULL - && !IS_USER_ADDRESS(attributes.stack_address) + || (attributes.stack_address != NULL + && !IS_USER_ADDRESS(attributes.stack_address)) || (attributes.name != NULL && (!IS_USER_ADDRESS(attributes.name) || user_strlcpy(name, attributes.name, B_OS_NAME_LENGTH) < 0))) return B_BAD_ADDRESS; Modified: haiku/trunk/src/system/kernel/vm/VMAnonymousCache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/VMAnonymousCache.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/vm/VMAnonymousCache.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -611,7 +611,7 @@ } // create our callback - WriteCallback* callback = (flags & B_VIP_IO_REQUEST != 0) + WriteCallback* callback = (flags & B_VIP_IO_REQUEST) != 0 ? new(vip_io_alloc) WriteCallback(this, _callback) : new(std::nothrow) WriteCallback(this, _callback); if (callback == NULL) { @@ -1211,7 +1211,7 @@ close(fd); - error = swap_file_add("/var/swap"); + error = swap_file_add((char *)"/var/swap"); if (error != B_OK) dprintf("Failed to add swap file /var/swap: %s\n", strerror(error)); } Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -418,7 +418,7 @@ area = (vm_area *)hash_lookup(sAreaHash, &areaID); if (area != NULL && (area->address_space->id == team - || allowKernel && team == vm_kernel_address_space_id())) { + || (allowKernel && team == vm_kernel_address_space_id()))) { fSpace = area->address_space; atomic_add(&fSpace->ref_count, 1); } @@ -1358,9 +1358,9 @@ uint32 pageIndex = (pageAddress - area->base) / B_PAGE_SIZE; uint8& entry = area->page_protections[pageIndex / 2]; if (pageIndex % 2 == 0) - entry = entry & 0xf0 | protection; + entry = (entry & 0xf0) | protection; else - entry = entry & 0x0f | (protection << 4); + entry = (entry & 0x0f) | (protection << 4); } @@ -2280,9 +2280,9 @@ // The FD must open for reading at any rate. For shared mapping with write // access, additionally the FD must be open for writing. if ((openMode & O_ACCMODE) == O_WRONLY - || mapping == REGION_NO_PRIVATE_MAP + || (mapping == REGION_NO_PRIVATE_MAP && (protection & (B_WRITE_AREA | B_KERNEL_WRITE_AREA)) != 0 - && (openMode & O_ACCMODE) == O_RDONLY) { + && (openMode & O_ACCMODE) == O_RDONLY)) { return EACCES; } @@ -3459,7 +3459,7 @@ if (level == 0) kprintf("/%lu", info.page_count); - if (cache->type == CACHE_TYPE_RAM || level == 0 && info.committed > 0) { + if (cache->type == CACHE_TYPE_RAM || (level == 0 && info.committed > 0)) { kprintf(", committed: %lld", cache->committed_size); if (level == 0) @@ -3704,9 +3704,9 @@ hash_open(sAreaHash, &iter); while ((area = (vm_area *)hash_next(sAreaHash, &iter)) != NULL) { if ((area->name != NULL && !strcmp(argv[index], area->name)) - || num != 0 + || (num != 0 && ((addr_t)area->id == num - || area->base <= num && area->base + area->size > num)) { + || (area->base <= num && area->base + area->size > num)))) { dump_area_struct(area, mappings); found = true; } @@ -3736,8 +3736,8 @@ hash_open(sAreaHash, &iter); while ((area = (vm_area *)hash_next(sAreaHash, &iter)) != NULL) { - if (id != 0 && area->address_space->id != id - || name != NULL && strstr(area->name, name) == NULL) + if ((id != 0 && area->address_space->id != id) + || (name != NULL && strstr(area->name, name) == NULL)) continue; kprintf("%p %5lx %p\t%p %4lx\t%4d %s\n", area, area->id, (void *)area->base, @@ -6347,7 +6347,7 @@ if (writeSync && writeAsync) return B_BAD_VALUE; - if (size == 0 || !writeSync && !writeAsync) + if (size == 0 || (!writeSync && !writeAsync)) return B_OK; // iterate through the range and sync all concerned areas Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -389,7 +389,8 @@ VMCache::Init(uint32 cacheType) { mutex_init(&fLock, "vm_cache"); - list_init_etc(&consumers, offsetof(VMCache, consumer_link)); + VMCache dummyCache; + list_init_etc(&consumers, offset_of_member(dummyCache, consumer_link)); areas = NULL; fRefCount = 1; source = NULL; Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -1238,11 +1238,11 @@ // until we're low on pages. Also avoid writing temporary pages that // are active. if (page->wired_count > 0 - || cache->temporary + || (cache->temporary #if ENABLE_SWAP_SUPPORT && (!lowOnPages /*|| page->usage_count > 0*/) #endif - ) { + )) { continue; } @@ -1444,9 +1444,9 @@ InterruptsSpinLocker locker(sPageLock); - if (reserve && sReservedPages <= free_page_queue_count() + if ((reserve && sReservedPages <= free_page_queue_count()) || count == 0 - || !reserve && (sInactivePageQueue.count > 0 + || ((!reserve && (sInactivePageQueue.count > 0)) || free_page_queue_count() > sReservedPages)) return stolen; Modified: haiku/trunk/src/system/kernel/wait_for_objects.cpp =================================================================== --- haiku/trunk/src/system/kernel/wait_for_objects.cpp 2009-02-01 18:40:42 UTC (rev 29112) +++ haiku/trunk/src/system/kernel/wait_for_objects.cpp 2009-02-01 20:48:02 UTC (rev 29113) @@ -564,7 +564,7 @@ int fd = fds[i].fd; // initialize events masks - sync->set[i].selected_events = fds[i].events & ~POLLNVAL + sync->set[i].selected_events = (fds[i].events & ~POLLNVAL) | POLLERR | POLLHUP; sync->set[i].events = 0; From anevilyak at mail.berlios.de Sun Feb 1 22:02:36 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Feb 2009 22:02:36 +0100 Subject: [Haiku-commits] r29114 - haiku/trunk/headers/os/app Message-ID: <200902012102.n11L2axA029394@sheep.berlios.de> Author: anevilyak Date: 2009-02-01 22:02:36 +0100 (Sun, 01 Feb 2009) New Revision: 29114 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29114&view=rev Modified: haiku/trunk/headers/os/app/PropertyInfo.h Log: On gcc4 these need to be declared const. Otherwise any and every app that simply sets up a bunch of property_info structs for its scripting directives triggers many many warnings with respect to deprecated string constant conversions. Modified: haiku/trunk/headers/os/app/PropertyInfo.h =================================================================== --- haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 20:48:02 UTC (rev 29113) +++ haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 21:02:36 UTC (rev 29114) @@ -48,10 +48,16 @@ }; struct property_info { +#if __GNUC__ > 2 + const +#endif char *name; uint32 commands[10]; uint32 specifiers[10]; - char *usage; +#if __GNUC__ > 2 + const +#endif + char *usage; uint32 extra_data; uint32 types[10]; compound_type ctypes[3]; From anevilyak at mail.berlios.de Sun Feb 1 22:05:32 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Feb 2009 22:05:32 +0100 Subject: [Haiku-commits] r29115 - haiku/trunk/headers/os/app Message-ID: <200902012105.n11L5WN5029704@sheep.berlios.de> Author: anevilyak Date: 2009-02-01 22:05:31 +0100 (Sun, 01 Feb 2009) New Revision: 29115 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29115&view=rev Modified: haiku/trunk/headers/os/app/PropertyInfo.h Log: value_info needs that change also. Modified: haiku/trunk/headers/os/app/PropertyInfo.h =================================================================== --- haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 21:02:36 UTC (rev 29114) +++ haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 21:05:31 UTC (rev 29115) @@ -70,9 +70,15 @@ }; struct value_info { +#if __GNUC__ > 2 + const +#endif char *name; uint32 value; value_kind kind; +#if __GNUC__ > 2 + const +#endif char *usage; uint32 extra_data; uint32 _reserved[10]; From anevilyak at mail.berlios.de Sun Feb 1 22:30:25 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 1 Feb 2009 22:30:25 +0100 Subject: [Haiku-commits] r29116 - haiku/trunk/headers/os/app Message-ID: <200902012130.n11LUPYD031713@sheep.berlios.de> Author: anevilyak Date: 2009-02-01 22:30:25 +0100 (Sun, 01 Feb 2009) New Revision: 29116 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29116&view=rev Modified: haiku/trunk/headers/os/app/PropertyInfo.h Log: Remove trailing spaces and add one more needed const. Modified: haiku/trunk/headers/os/app/PropertyInfo.h =================================================================== --- haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 21:05:31 UTC (rev 29115) +++ haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 21:30:25 UTC (rev 29116) @@ -41,6 +41,9 @@ struct compound_type { struct field_pair { +#if __GNUC__ > 2 + const +#endif char *name; // name of entry in message type_code type; // type_code of entry in message }; @@ -49,13 +52,13 @@ struct property_info { #if __GNUC__ > 2 - const + const #endif char *name; uint32 commands[10]; uint32 specifiers[10]; #if __GNUC__ > 2 - const + const #endif char *usage; uint32 extra_data; From nielx at mail.berlios.de Sun Feb 1 22:44:22 2009 From: nielx at mail.berlios.de (nielx at mail.berlios.de) Date: Sun, 1 Feb 2009 22:44:22 +0100 Subject: [Haiku-commits] r29117 - haiku/trunk/docs/user Message-ID: <200902012144.n11LiMdZ032488@sheep.berlios.de> Author: nielx Date: 2009-02-01 22:44:07 +0100 (Sun, 01 Feb 2009) New Revision: 29117 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29117&view=rev Modified: haiku/trunk/docs/user/Doxyfile haiku/trunk/docs/user/book.css haiku/trunk/docs/user/footer.html haiku/trunk/docs/user/header.html Log: Tweak looks of API documentation. WIP: * Only a first subset of CSS has been applied * Look based on Humdinger's and other's work on user guide * Navigation is still ugly. I need to work around the limitations of Doxygen. Maybe by a patch though. * Needs a manual extra step: you need to copy the /trunk/docs/userguide/images/logo.png to the /trunk/generated/doxygen/html directory Modified: haiku/trunk/docs/user/Doxyfile =================================================================== --- haiku/trunk/docs/user/Doxyfile 2009-02-01 21:30:25 UTC (rev 29116) +++ haiku/trunk/docs/user/Doxyfile 2009-02-01 21:44:07 UTC (rev 29117) @@ -683,7 +683,7 @@ # each generated HTML page. If it is left blank doxygen will generate a # standard header. -HTML_HEADER = +HTML_HEADER = header.html # The HTML_FOOTER tag can be used to specify a personal HTML footer for # each generated HTML page. If it is left blank doxygen will generate a @@ -698,7 +698,7 @@ # the style sheet file to the HTML output directory, so don't put your own # stylesheet in the HTML output directory as well, or it will be erased! -HTML_STYLESHEET = +HTML_STYLESHEET = book.css # If the HTML_ALIGN_MEMBERS tag is set to YES, the members of classes, # files or namespaces will be aligned in HTML using tables. If set to Modified: haiku/trunk/docs/user/book.css =================================================================== --- haiku/trunk/docs/user/book.css 2009-02-01 21:30:25 UTC (rev 29116) +++ haiku/trunk/docs/user/book.css 2009-02-01 21:44:07 UTC (rev 29117) @@ -1,78 +1,281 @@ -H1 { - text-align: center; - font-family: Arial, Helvetica, sans-serif; +/* + * Copyright 2008, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fran?ois Revol + * Stephan A?mus + * Braden Ewing + * Humdinger + */ + +/* This is the Doxygen standard (messy) CSS updated with Haiku stuff. + All tags which are lower case have custom CSS, all upper case tags are the original. + I did some reordering. + - nielx + */ + +html { + margin: 0px; + padding: 0px; } -H2 { - font-family: Arial, Helvetica, sans-serif; + +body { + font-family: "DejaVu Sans",Arial,Helvetica,sans-serif; + background: white; + color: #333333; + font-size: 90%; + margin: 0px; + padding: 0px; } + +h1 { + font-size: 1.3em; + font-weight: normal; + color: #0c3762; + border-bottom: dotted thin #e0e0e0; +} + +h2 { + font-size: 1.2em; + font-weight: normal; + color: #0c3762; + border-bottom: dotted thin #e0e0e0; + margin-top: 10px; +} + +h3 { + font-size: 1.1em; + font-weight: normal; + color: #0c3762; + margin-top: 10px; +} + +h4 { + font-size: 1.0em; + font-weight: lighter; + color: #0c3762; + margin-top: 10px; +} + +p { + text-align: justify; + line-height: 1.3; +} + +/* link colors and text decoration */ + +a:link { + font-weight: bold; + text-decoration: none; + color: #dc3c01; +} + +a:visited { + font-weight: bold; + text-decoration: none; + color: #892601; +} + +a:hover, a:active { + text-decoration: underline; + color: #ff4500; +} + +/* Some headers act as anchors, don't give them a hover effect */ + +h1 a:hover, a:active { + text-decoration: none; + color: #0c3762; +} + +h2 a:hover, a:active { + text-decoration: none; + color: #0c3762; +} + +h3 a:hover, a:active { + text-decoration: none; + color: #0c3762; +} + +h4 a:hover, a:active { + text-decoration: none; + color: #0c3762; +} + +/* Custom Header */ + +div.logo { + position: relative; + left: 0px; + top: 0px; + background: #efefef; +} + +div.logo img { + margin-left: 20px; +} + +div.title { + position: absolute; + top: 54px; + right: 40px; + font-size: 1.2em; +} + +/* Navigation Tabs */ +div.tabs { + width: 100%; + background: #e0e0e0; +} + +div.tabs ul { + margin: 0px; + padding-left: 10px; + list-style: none; +} + +div.tabs li { + display: inline; + margin: 0px; + padding: 0px; + font-size: 0,8em; +} + +div.tabs span { + display: inline; + padding: 5px 9px; + white-space: nowrap; +} + +div.tabs li.current a { + color: black; + text-decoration: none; +} + +/* Contents div */ + +div.contents { + padding: 50px 40px; +} + +/* Continue with the rest of the standard Doxygen stuff... */ + CAPTION { font-weight: bold } -DIV.qindex { width: 100%; - font-family: Arial, Helvetica, sans-serif; - background-color: white; - border: 1px solid black; - padding: 2px; - text-align: center; - margin-bottom: 2px +DIV.qindex { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; } -A.qindex { text-decoration: none; font-weight: bold; color: #2222aa } -A.qindex:visited { text-decoration: none; font-weight: bold; color: #2222aa } -A.qindex:hover { text-decoration: none; background-color: #f0f0e0 } -A.qindexHL { text-decoration: underlined; font-weight: bold; - background-color: #e0e0d0 /*#111199;*/ - color: black; /*#cccccc*/ - } -A.qindexHL:hover { text-decoration: none; background-color: #111199; color: #ffffff } -/*A.qindexHL:visited { text-decoration: none; color: #000060 }*/ -A.el { text-decoration: underline; font-weight: bold; color: #2222aa } +DIV.nav { + width: 100%; + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + padding: 2px; + line-height: 140%; +} +DIV.navtab { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +TD.navtab { + font-size: 70%; +} +A.qindex { + text-decoration: none; + font-weight: bold; + color: #1A419D; +} +A.qindex:visited { + text-decoration: none; + font-weight: bold; + color: #1A419D +} +A.qindex:hover { + text-decoration: none; + background-color: #ddddff; +} +A.qindexHL { + text-decoration: none; + font-weight: bold; + background-color: #6666cc; + color: #ffffff; + border: 1px double #9295C2; +} +A.qindexHL:hover { + text-decoration: none; + background-color: #6666cc; + color: #ffffff; +} +A.qindexHL:visited { text-decoration: none; background-color: #6666cc; color: #ffffff } A.elRef { font-weight: bold } -A { text-decoration: underline; color: #2222aa } -A.codeRef { text-decoration: underline; font-weight: normal; color: #2222aa } -A:hover { text-decoration: underline; background-color: #e0e0d0 } -A.el:visited { text-decoration: underline; color: #000060 } +A.code:link { text-decoration: none; font-weight: normal; color: #0000FF} +A.code:visited { text-decoration: none; font-weight: normal; color: #0000FF} +A.codeRef:link { font-weight: normal; color: #0000FF} +A.codeRef:visited { font-weight: normal; color: #0000FF} DL.el { margin-left: -1cm } -DIV.fragment { - width: 98%; +.fragment { + font-family: monospace, fixed; + font-size: 95%; +} +PRE.fragment { border: 1px solid #CCCCCC; background-color: #f5f5f5; - padding-left: 4px; - margin: 4px; + margin-top: 4px; + margin-bottom: 4px; + margin-left: 2px; + margin-right: 8px; + padding-left: 6px; + padding-right: 6px; + padding-top: 4px; + padding-bottom: 4px; } DIV.ah { background-color: black; font-weight: bold; color: #ffffff; margin-bottom: 3px; margin-top: 3px } -TD.md { background-color: #ffffff; font-weight: bold; } -TD.mdname1 { background-color: #ffffff; font-weight: bold; color: #602020; } -TD.mdname { background-color: #ffffff; font-weight: bold; color: #602020; width: 600px; } -DIV.groupHeader { margin-left: 16px; margin-top: 12px; margin-bottom: 6px; font-weight: bold } -DIV.groupText { margin-left: 16px; font-style: italic; font-size: smaller } -BODY { - font-family: Arial, Helvetica, sans-serif; - background: white; - color: black; - margin-right: 20px; - margin-left: 20px; + +DIV.groupHeader { + margin-left: 16px; + margin-top: 12px; + margin-bottom: 6px; + font-weight: bold; } -TD.indexkey { - background-color: white; - font-weight: bold; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px +DIV.groupText { margin-left: 16px; font-style: italic; font-size: 90% } + +TD.indexkey { + background-color: #e8eef2; + font-weight: bold; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; } -TD.indexvalue { - background-color: white; - font-style: italic; - padding-right : 10px; - padding-top : 2px; - padding-left : 10px; - padding-bottom : 2px; - margin-left : 0px; - margin-right : 0px; - margin-top : 2px; - margin-bottom : 2px +TD.indexvalue { + background-color: #e8eef2; + font-style: italic; + padding-right : 10px; + padding-top : 2px; + padding-left : 10px; + padding-bottom : 2px; + margin-left : 0px; + margin-right : 0px; + margin-top : 2px; + margin-bottom : 2px; + border: 1px solid #CCCCCC; } TR.memlist { background-color: #f0f0f0; @@ -87,29 +290,11 @@ SPAN.preprocessor { color: #806020 } SPAN.stringliteral { color: #002080 } SPAN.charliteral { color: #008080 } - -/* this violates anything which is good style - but it seem to work... */ -EM.none { font-style: italic; } -EM, SPAN.var { - font-weight: bold; - font-family: Arial, sans-serif; - font-style: italic; - color: #602020; -} -CODE { color: #3333aa; } - -.mdTable { - border: 4px ridge #868686; - background-color: #ffffff; -} -.mdRow { - padding: 8px 20px; -} .mdescLeft { - font-size: smaller; - font-family: Arial, Helvetica, sans-serif; + padding: 0px 8px 4px 8px; + font-size: 80%; + font-style: italic; background-color: #FAFAFA; - padding-left: 8px; border-top: 1px none #E0E0E0; border-right: 1px none #E0E0E0; border-bottom: 1px none #E0E0E0; @@ -117,18 +302,15 @@ margin: 0px; } .mdescRight { - font-size: smaller; - font-family: Arial, Helvetica, sans-serif; + padding: 0px 8px 4px 8px; + font-size: 80%; font-style: italic; background-color: #FAFAFA; - padding-left: 4px; border-top: 1px none #E0E0E0; border-right: 1px none #E0E0E0; border-bottom: 1px none #E0E0E0; border-left: 1px none #E0E0E0; margin: 0px; - padding-bottom: 0px; - padding-right: 8px; } .memItemLeft { padding: 1px 0px 0px 8px; @@ -137,38 +319,91 @@ border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; border-top-color: #E0E0E0; border-right-color: #E0E0E0; border-bottom-color: #E0E0E0; border-left-color: #E0E0E0; + border-top-style: solid; border-right-style: none; border-bottom-style: none; border-left-style: none; background-color: #FAFAFA; - font-family: Arial, Helvetica, sans-serif; - font-size: 12px; + font-size: 80%; } -.memItemRight { +.memTemplItemLeft { padding: 1px 0px 0px 8px; margin: 4px; border-top-width: 1px; border-right-width: 1px; border-bottom-width: 1px; border-left-width: 1px; - border-top-style: solid; border-top-color: #E0E0E0; border-right-color: #E0E0E0; border-bottom-color: #E0E0E0; border-left-color: #E0E0E0; + border-top-style: none; border-right-style: none; border-bottom-style: none; border-left-style: none; background-color: #FAFAFA; - font-family: Arial, Helvetica, sans-serif; - font-size: 13px; + font-size: 80%; } -.search { color: #0000ee; +.memTemplItemRight { + padding: 1px 8px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: none; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + background-color: #FAFAFA; + font-size: 80%; +} +.memTemplParams { + padding: 1px 0px 0px 8px; + margin: 4px; + border-top-width: 1px; + border-right-width: 1px; + border-bottom-width: 1px; + border-left-width: 1px; + border-top-color: #E0E0E0; + border-right-color: #E0E0E0; + border-bottom-color: #E0E0E0; + border-left-color: #E0E0E0; + border-top-style: solid; + border-right-style: none; + border-bottom-style: none; + border-left-style: none; + color: #606060; + background-color: #FAFAFA; + font-size: 80%; +} +.search { color: #003399; font-weight: bold; } FORM.search { @@ -178,7 +413,82 @@ INPUT.search { font-size: 75%; color: #000080; font-weight: normal; - background-color: #eeeeff; + background-color: #e8eef2; } TD.tiny { font-size: 75%; } + +.dirtab { padding: 4px; + border-collapse: collapse; + border: 1px solid #84b0c7; +} +TH.dirtab { background: #e8eef2; + font-weight: bold; +} +HR { height: 1px; + border: none; + border-top: 1px solid black; +} + +/* Style for detailed member documentation */ +.memtemplate { + font-size: 80%; + color: #606060; + font-weight: normal; +} +.memnav { + background-color: #e8eef2; + border: 1px solid #84b0c7; + text-align: center; + margin: 2px; + margin-right: 15px; + padding: 2px; +} +.memitem { + padding: 4px; + background-color: #eef3f5; + border-width: 1px; + border-style: solid; + border-color: #dedeee; + -moz-border-radius: 8px 8px 8px 8px; +} +.memname { + white-space: nowrap; + font-weight: bold; +} +.memdoc{ + padding-left: 10px; +} +.memproto { + background-color: #d5e1e8; + width: 100%; + border-width: 1px; + border-style: solid; + border-color: #84b0c7; + font-weight: bold; + -moz-border-radius: 8px 8px 8px 8px; +} +.paramkey { + text-align: right; +} +.paramtype { + white-space: nowrap; +} +.paramname { + color: #602020; + font-style: italic; + white-space: nowrap; +} +/* End Styling for detailed member documentation */ + +/* for the tree view */ +.ftvtree { + font-family: sans-serif; + margin:0.5em; +} +.directory { font-size: 9pt; font-weight: bold; } +.directory h3 { margin: 0px; margin-top: 1em; font-size: 11pt; } +.directory > h3 { margin-top: 0; } +.directory p { margin: 0px; white-space: nowrap; } +.directory div { display: none; margin: 0px; } +.directory img { vertical-align: -30%; } Modified: haiku/trunk/docs/user/footer.html =================================================================== --- haiku/trunk/docs/user/footer.html 2009-02-01 21:30:25 UTC (rev 29116) +++ haiku/trunk/docs/user/footer.html 2009-02-01 21:44:07 UTC (rev 29117) @@ -1,3 +1,4 @@ +
$projectname $projectnumber - $title
Modified: haiku/trunk/docs/user/header.html =================================================================== --- haiku/trunk/docs/user/header.html 2009-02-01 21:30:25 UTC (rev 29116) +++ haiku/trunk/docs/user/header.html 2009-02-01 21:44:07 UTC (rev 29117) @@ -1,8 +1,12 @@ - - $projectname: $title + + $title - + + From mmlr at mail.berlios.de Sun Feb 1 23:13:06 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 1 Feb 2009 23:13:06 +0100 Subject: [Haiku-commits] r29118 - in haiku/trunk: build/jam headers/os/app headers/private/storage/sniffer src/kits/app src/kits/interface src/kits/interface/textview_support src/kits/storage src/kits/storage/disk_device src/kits/storage/sniffer Message-ID: <200902012213.n11MD6o2001641@sheep.berlios.de> Author: mmlr Date: 2009-02-01 23:12:55 +0100 (Sun, 01 Feb 2009) New Revision: 29118 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29118&view=rev Modified: haiku/trunk/build/jam/BuildSetup haiku/trunk/headers/os/app/PropertyInfo.h haiku/trunk/headers/private/storage/sniffer/Parser.h haiku/trunk/src/kits/app/Application.cpp haiku/trunk/src/kits/app/Messenger.cpp haiku/trunk/src/kits/app/PropertyInfo.cpp haiku/trunk/src/kits/interface/ColorConversion.cpp haiku/trunk/src/kits/interface/ListView.cpp haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/MenuItem.cpp haiku/trunk/src/kits/interface/Slider.cpp haiku/trunk/src/kits/interface/SplitLayout.cpp haiku/trunk/src/kits/interface/Window.cpp haiku/trunk/src/kits/interface/textview_support/TextGapBuffer.cpp haiku/trunk/src/kits/storage/Entry.cpp haiku/trunk/src/kits/storage/Path.cpp haiku/trunk/src/kits/storage/PathMonitor.cpp haiku/trunk/src/kits/storage/Resources.cpp haiku/trunk/src/kits/storage/ResourcesContainer.cpp haiku/trunk/src/kits/storage/Volume.cpp haiku/trunk/src/kits/storage/disk_device/Partition.cpp haiku/trunk/src/kits/storage/sniffer/Parser.cpp Log: * Resolve further warnings on GCC4. * Enable -Werror on GCC4 builds as well (limited to the same selected targets). Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/build/jam/BuildSetup 2009-02-01 22:12:55 UTC (rev 29118) @@ -1033,15 +1033,12 @@ : $(scope) ; } } else { -# TODO: Enable after updating to a newer gcc 4 version that supports -Wno-error! # -Wuninitialized gives too many false positives. -# rule EnableWerror dirTokens : scope { -# AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) -# : -Werror -Wno-error=uninitialized : $(scope) ; -# AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) -# : -Werror -Wno-error=uninitialized : $(scope) ; -# } rule EnableWerror dirTokens : scope { + AppendToConfigVar CCFLAGS : HAIKU_TOP $(dirTokens) + : -Werror -Wno-error=uninitialized : $(scope) ; + AppendToConfigVar C++FLAGS : HAIKU_TOP $(dirTokens) + : -Werror -Wno-error=uninitialized : $(scope) ; } } Modified: haiku/trunk/headers/os/app/PropertyInfo.h =================================================================== --- haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 22:12:55 UTC (rev 29118) @@ -42,7 +42,7 @@ struct compound_type { struct field_pair { #if __GNUC__ > 2 - const + const #endif char *name; // name of entry in message type_code type; // type_code of entry in message Modified: haiku/trunk/headers/private/storage/sniffer/Parser.h =================================================================== --- haiku/trunk/headers/private/storage/sniffer/Parser.h 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/headers/private/storage/sniffer/Parser.h 2009-02-01 22:12:55 UTC (rev 29118) @@ -54,7 +54,7 @@ CharacterString, Integer, FloatingPoint -}; +} TokenType; /*! \brief Returns a NULL-terminated string contating the name of the given token type Modified: haiku/trunk/src/kits/app/Application.cpp =================================================================== --- haiku/trunk/src/kits/app/Application.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/app/Application.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -1498,7 +1498,7 @@ uint32 count = gLooperList.CountLoopers(); for (uint32 i = 0; i < count && index < count; i++) { BWindow* window = dynamic_cast(gLooperList.LooperAt(i)); - if (window == NULL || window != NULL && window->fOffscreen + if (window == NULL || (window != NULL && window->fOffscreen) || (!includeMenus && dynamic_cast(window) != NULL)) { index++; continue; Modified: haiku/trunk/src/kits/app/Messenger.cpp =================================================================== --- haiku/trunk/src/kits/app/Messenger.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/app/Messenger.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -572,11 +572,11 @@ // 3. fPreferredTarget // fTeam is insignificant return (a.Port() < b.Port() - || a.Port() == b.Port() + || (a.Port() == b.Port() && (a.Token() < b.Token() - || a.Token() == b.Token() + || (a.Token() == b.Token() && !a.IsPreferredTarget() - && b.IsPreferredTarget())); + && b.IsPreferredTarget())))); } Modified: haiku/trunk/src/kits/app/PropertyInfo.cpp =================================================================== --- haiku/trunk/src/kits/app/PropertyInfo.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/app/PropertyInfo.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -501,15 +501,15 @@ if (fPropInfo != NULL) { for (i = 0; i < fPropCount; i++) { - free(fPropInfo[i].name); - free(fPropInfo[i].usage); + free((char *)fPropInfo[i].name); + free((char *)fPropInfo[i].usage); for (j = 0; j < 3; j++) { for (k = 0; k < 5; k++) { if (fPropInfo[i].ctypes[j].pairs[k].name == NULL) break; - free(fPropInfo[i].ctypes[j].pairs[k].name); + free((char *)fPropInfo[i].ctypes[j].pairs[k].name); } if (fPropInfo[i].ctypes[j].pairs[0].name == NULL) @@ -523,8 +523,8 @@ if (fValueInfo != NULL) { for (i = 0; i < fValueCount; i++) { - free(fValueInfo[i].name); - free(fValueInfo[i].usage); + free((char *)fValueInfo[i].name); + free((char *)fValueInfo[i].usage); } free(fValueInfo); fValueInfo = NULL; Modified: haiku/trunk/src/kits/interface/ColorConversion.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorConversion.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/ColorConversion.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -250,7 +250,7 @@ uint8 PaletteConverter::IndexForRGB16(uint16 rgb) const { - return fColorMap->index_map[(rgb >> 1) & 0x7fe0 | rgb & 0x1f]; + return fColorMap->index_map[((rgb >> 1) & 0x7fe0) | (rgb & 0x1f)]; } @@ -487,7 +487,7 @@ void WriteGray8(uint8 **dest, uint8 *data, int32 index) { - **dest = data[2] * 308 + data[1] * 600 + data[0] * 116 >> 10; + **dest = (data[2] * 308 + data[1] * 600 + data[0] * 116) >> 10; // this would boost the speed but is less accurate: //*dest = (data[2] << 8) + (data[1] << 9) + (data[0] << 8) >> 10; (*dest)++; @@ -584,9 +584,9 @@ } srcBits = (srcByte*)((uint8*)srcBits + (srcOffsetY * srcBitsPerRow + srcOffsetX - * srcBitsPerPixel >> 3)); + * (srcBitsPerPixel >> 3))); dstBits = (dstByte*)((uint8*)dstBits + (dstOffsetY * dstBitsPerRow + dstOffsetX - * dstBitsPerPixel >> 3)); + * (dstBitsPerPixel >> 3))); // Ensure that the width fits int32 srcWidth = (srcBitsPerRow - srcOffsetX * srcBitsPerPixel) Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/ListView.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -1527,7 +1527,7 @@ bool BListView::_TryInitiateDrag(BPoint where) { - if (!fTrack->try_drag | fTrack->item_index < 0) + if (!fTrack->try_drag || fTrack->item_index < 0) return false; BPoint offset = where - fTrack->drag_start; Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/Menu.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -2626,8 +2626,8 @@ // TODO: I added the check for BMenuBar to solve a problem with Deskbar. // BeOS seems to do something similar. This could also be a bug in Deskbar, though. if ((buttons != 0 && stickyMode) - || (dynamic_cast(this) == NULL - && (buttons == 0 && !stickyMode) || _HitTestItems(where) != item)) + || ((dynamic_cast(this) == NULL + && (buttons == 0 && !stickyMode)) || _HitTestItems(where) != item)) return false; return true; Modified: haiku/trunk/src/kits/interface/MenuItem.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuItem.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/MenuItem.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -755,7 +755,7 @@ where.x -= fBounds.Height() - 3; const float ascent = MenuPrivate(fSuper).Ascent(); - if (fShortcutChar < B_SPACE && kUTF8ControlMap[fShortcutChar]) + if (fShortcutChar < B_SPACE && kUTF8ControlMap[(int)fShortcutChar]) _DrawControlChar(fShortcutChar, where + BPoint(0, ascent)); else fSuper->DrawChar(fShortcutChar, where + BPoint(0, ascent)); @@ -849,8 +849,8 @@ // TODO: If needed, take another font for the control characters // (or have font overlays in the app_server!) const char* symbol = " "; - if (kUTF8ControlMap[fShortcutChar]) - symbol = kUTF8ControlMap[fShortcutChar]; + if (kUTF8ControlMap[(int)fShortcutChar]) + symbol = kUTF8ControlMap[(int)fShortcutChar]; fSuper->DrawString(symbol, where); } Modified: haiku/trunk/src/kits/interface/Slider.cpp =================================================================== --- haiku/trunk/src/kits/interface/Slider.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/Slider.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -874,10 +874,12 @@ barColor.red = (fBarColor.red + no_tint.red) / 2; barColor.green = (fBarColor.green + no_tint.green) / 2; barColor.blue = (fBarColor.blue + no_tint.blue) / 2; + barColor.alpha = 255; fillColor.red = (fFillColor.red + no_tint.red) / 2; fillColor.green = (fFillColor.green + no_tint.green) / 2; fillColor.blue = (fFillColor.blue + no_tint.blue) / 2; + fillColor.alpha = 255; } // exclude the block thumb from the bar filling @@ -1172,8 +1174,8 @@ const char* oldUpdateText = fUpdateText; fUpdateText = UpdateText(); - bool updateTextOnOff = fUpdateText == NULL && oldUpdateText != NULL - || fUpdateText != NULL && oldUpdateText == NULL; + bool updateTextOnOff = (fUpdateText == NULL && oldUpdateText != NULL) + || (fUpdateText != NULL && oldUpdateText == NULL); float newWidth = 0.0; if (fUpdateText != NULL) Modified: haiku/trunk/src/kits/interface/SplitLayout.cpp =================================================================== --- haiku/trunk/src/kits/interface/SplitLayout.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/SplitLayout.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -563,8 +563,8 @@ // Things shouldn't be draggable, if we have a >= max layout. BSize size = _SubtractInsets(View()->Frame().Size()); - if (fOrientation == B_HORIZONTAL && size.width >= fMax.width - || fOrientation == B_VERTICAL && size.height >= fMax.height) { + if ((fOrientation == B_HORIZONTAL && size.width >= fMax.width) + || (fOrientation == B_VERTICAL && size.height >= fMax.height)) { return false; } @@ -1133,8 +1133,8 @@ BSplitLayout::_InternalGetHeightForWidth(float width, bool realLayout, float* minHeight, float* maxHeight, float* preferredHeight) { - if (realLayout && fHeightForWidthVerticalLayouterWidth != width - || !realLayout && fCachedHeightForWidthWidth != width) { + if ((realLayout && fHeightForWidthVerticalLayouterWidth != width) + || (!realLayout && fCachedHeightForWidthWidth != width)) { // The general strategy is to clone the vertical layouter, which only // knows the general min/max constraints, do a horizontal layout for the // given width, and add the children's height for width constraints to Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/Window.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -1595,7 +1595,7 @@ BWindow::SetPulseRate(bigtime_t rate) { // TODO: What about locking?!? - if (rate < 0 || (rate == fPulseRate && !(rate == 0 ^ fPulseRunner == NULL))) + if (rate < 0 || (rate == fPulseRate && !((rate == 0) ^ (fPulseRunner == NULL)))) return; fPulseRate = rate; Modified: haiku/trunk/src/kits/interface/textview_support/TextGapBuffer.cpp =================================================================== --- haiku/trunk/src/kits/interface/textview_support/TextGapBuffer.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/interface/textview_support/TextGapBuffer.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -172,7 +172,7 @@ const char * TextGapBuffer::GetString(int32 fromOffset, int32 *_numBytes) { - char *result = ""; + char *result = (char *)""; if (_numBytes == NULL) return result; Modified: haiku/trunk/src/kits/storage/Entry.cpp =================================================================== --- haiku/trunk/src/kits/storage/Entry.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/Entry.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -135,8 +135,8 @@ return (device == ref.device && directory == ref.directory && (name == ref.name - || name != NULL && ref.name != NULL - && strcmp(name, ref.name) == 0)); + || (name != NULL && ref.name != NULL + && strcmp(name, ref.name) == 0))); } /*! \brief Compares the entry_ref with another entry_ref, returning true if they are not equal. @@ -1095,11 +1095,7 @@ || (a.device == b.device && (a.directory < b.directory || (a.directory == b.directory - && (a.name == NULL && b.name != NULL + && ((a.name == NULL && b.name != NULL) || (a.name != NULL && b.name != NULL && strcmp(a.name, b.name) < 0)))))); } - - - - Modified: haiku/trunk/src/kits/storage/Path.cpp =================================================================== --- haiku/trunk/src/kits/storage/Path.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/Path.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -390,8 +390,8 @@ bool BPath::operator==(const char *path) const { - return (InitCheck() != B_OK && path == NULL - || fName && path && strcmp(fName, path) == 0); + return ((InitCheck() != B_OK && path == NULL) + || (fName != NULL && path != NULL && strcmp(fName, path) == 0)); } //! Performs a simple (string-wise) comparison of paths. Modified: haiku/trunk/src/kits/storage/PathMonitor.cpp =================================================================== --- haiku/trunk/src/kits/storage/PathMonitor.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/PathMonitor.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -359,8 +359,8 @@ } // a new directory to watch for us - if (!entryContained && !_CloserToPath(entry) - || parentContained && !_WatchRecursively() + if ((!entryContained && !_CloserToPath(entry)) + || (parentContained && !_WatchRecursively()) || _AddDirectory(entry, true) != B_OK || _WatchFilesOnly()) notify = parentContained; @@ -446,7 +446,7 @@ && (entryContained || _CloserToPath(entry))) { // there is a new directory to watch for us if (entryContained - || parentContained && !_WatchRecursively()) { + || (parentContained && !_WatchRecursively())) { _AddDirectory(entry, true); // NOTE: entry is toast now! } else if (_GetClosest(fPath.Path(), false, Modified: haiku/trunk/src/kits/storage/Resources.cpp =================================================================== --- haiku/trunk/src/kits/storage/Resources.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/Resources.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -288,10 +288,10 @@ int32 cookie = 0; while (get_next_image_info(B_CURRENT_TEAM, &cookie, &info) == B_OK) { - if ((addr_t)info.text <= address - && address - (addr_t)info.text < (addr_t)info.text_size - || (addr_t)info.data <= address - && address - (addr_t)info.data < (addr_t)info.data_size) { + if (((addr_t)info.text <= address + && address - (addr_t)info.text < (addr_t)info.text_size) + || ((addr_t)info.data <= address + && address - (addr_t)info.data < (addr_t)info.data_size)) { return SetTo(info.name, clobber); } } Modified: haiku/trunk/src/kits/storage/ResourcesContainer.cpp =================================================================== --- haiku/trunk/src/kits/storage/ResourcesContainer.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/ResourcesContainer.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -143,9 +143,9 @@ for (int32 i = 0; index == -1 && i < count; i++) { ResourceItem *item = ResourceAt(i); const char *itemName = item->Name(); - if (item->Type() == type && (name == NULL && itemName == NULL - || name != NULL && itemName != NULL - && !strcmp(name, itemName))) { + if (item->Type() == type && ((name == NULL && itemName == NULL) + || (name != NULL && itemName != NULL + && strcmp(name, itemName) == 0))) { index = i; } } Modified: haiku/trunk/src/kits/storage/Volume.cpp =================================================================== --- haiku/trunk/src/kits/storage/Volume.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/Volume.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -493,7 +493,7 @@ bool BVolume::operator==(const BVolume &volume) const { - return (InitCheck() != B_OK && volume.InitCheck() != B_OK + return ((InitCheck() != B_OK && volume.InitCheck() != B_OK) || fDevice == volume.fDevice); } Modified: haiku/trunk/src/kits/storage/disk_device/Partition.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/Partition.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/disk_device/Partition.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -1543,7 +1543,7 @@ bool BPartition::_SupportsChildOperation(const BPartition* child, uint32 flag) const { - if (!fDelegate || child && !child->fDelegate) + if (!fDelegate || (child && !child->fDelegate)) return false; uint32 supported = fDelegate->SupportedChildOperations( Modified: haiku/trunk/src/kits/storage/sniffer/Parser.cpp =================================================================== --- haiku/trunk/src/kits/storage/sniffer/Parser.cpp 2009-02-01 21:44:07 UTC (rev 29117) +++ haiku/trunk/src/kits/storage/sniffer/Parser.cpp 2009-02-01 22:12:55 UTC (rev 29118) @@ -260,7 +260,7 @@ tsssEscapeOneOctal, tsssEscapeTwoOctal, tsssEscapeOneHex, - }; + } TokenStreamScannerState; TokenStreamScannerState state = tsssStart; TokenStreamScannerState escapedState = tsssStart; From stippi at mail.berlios.de Sun Feb 1 23:15:30 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 1 Feb 2009 23:15:30 +0100 Subject: [Haiku-commits] r29119 - haiku/trunk/src/tests/kits/interface/look Message-ID: <200902012215.n11MFUxs001834@sheep.berlios.de> Author: stippi Date: 2009-02-01 23:15:16 +0100 (Sun, 01 Feb 2009) New Revision: 29119 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29119&view=rev Modified: haiku/trunk/src/tests/kits/interface/look/Look.cpp Log: Get a lot more views and controls on display. Modified: haiku/trunk/src/tests/kits/interface/look/Look.cpp =================================================================== --- haiku/trunk/src/tests/kits/interface/look/Look.cpp 2009-02-01 22:12:55 UTC (rev 29118) +++ haiku/trunk/src/tests/kits/interface/look/Look.cpp 2009-02-01 22:15:16 UTC (rev 29119) @@ -13,13 +13,16 @@ #include #include #include +#include #include #include #include +#include #include #include #include #include +#include #include #include #include @@ -46,6 +49,75 @@ } +void +add_menu_fields(BGridLayout* layout, int32& row) +{ + BPopUpMenu* menu1 = new BPopUpMenu("Selection"); + BMenuField* control1 = new BMenuField("Enabled", menu1, NULL); + BPopUpMenu* menu2 = new BPopUpMenu("Selection"); + BMenuField* control2 = new BMenuField("Disabled", menu2, NULL); + control2->SetEnabled(false); + + layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5) + .Add(control1) + .Add(control2), 0, row, 3); + + row++; +} + + +void +add_text_controls(BGridLayout* layout, int32& row) +{ + BTextControl* control1 = new BTextControl("Enabled", "Some Text", NULL); + BTextControl* control2 = new BTextControl("Disabled", "More Text", NULL); + control2->SetEnabled(false); + + layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5) + .Add(control1) + .Add(control2), 0, row, 3); + + row++; +} + + +void +add_sliders(BGridLayout* layout, int32& row) +{ + BSlider* control1 = new BSlider("slider 1", "Enabled", NULL, 1, 100, + B_HORIZONTAL); + BSlider* control2 = new BSlider("slider 2", "Disabled", NULL, 1, 100, + B_HORIZONTAL); + control2->SetEnabled(false); + + control1->SetHashMarkCount(10); + control1->SetHashMarks(B_HASH_MARKS_BOTTOM); + control2->SetHashMarkCount(10); + control2->SetHashMarks(B_HASH_MARKS_BOTTOM); + + layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5) + .Add(control1) + .Add(control2), 0, row, 3); + + row++; + + control1 = new BSlider("slider 3", "Enabled", NULL, 1, 100, + B_HORIZONTAL, B_TRIANGLE_THUMB); + control2 = new BSlider("slider 4", "Disabled", NULL, 1, 100, + B_HORIZONTAL, B_TRIANGLE_THUMB); + control2->SetEnabled(false); + + control1->SetLimitLabels("Min", "Max"); + control2->SetLimitLabels("1", "100"); + + layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5) + .Add(control1) + .Add(control2), 0, row, 3); + + row++; +} + + int main(int argc, char** argv) { @@ -60,18 +132,81 @@ // create some controls - BGridView* view = new BGridView(5.0f, 5.0f); - BGridLayout* layout = view->GridLayout(); - layout->SetInsets(5, 5, 5, 5); - view->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); + BListView* listView = new BListView(); + listView->AddItem(new BStringItem("List Item 1")); + listView->AddItem(new BStringItem("List Item 2")); + BScrollView* scrollView = new BScrollView("scroller", listView, 0, + true, true); + scrollView->SetExplicitMinSize(BSize(300, 80)); + BGridView* controls = new BGridView(5.0f, 5.0f); + BGridLayout* layout = controls->GridLayout(); + controls->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNLIMITED)); + int32 row = 0; add_controls(layout, row); add_controls(layout, row); add_controls(layout, row); + add_menu_fields(layout, row); + add_text_controls(layout, row); + add_sliders(layout, row); - window->AddChild(view); + BStatusBar* statusBar = new BStatusBar("status bar", "Status", + "Completed"); + statusBar->SetMaxValue(100); + statusBar->SetTo(40); + statusBar->SetBarHeight(12); + layout->AddView(statusBar, 0, row, 3); + row++; + + BColorControl* colorControl = new BColorControl(B_ORIGIN, B_CELLS_32x8, + 8.0f, "color control"); + layout->AddView(colorControl, 0, row, 3); + + BTabView* tabView = new BTabView("tab view", B_WIDTH_FROM_WIDEST); + BView* content = BGroupLayoutBuilder(B_VERTICAL, 5) + .Add(scrollView) + .Add(controls) + .SetInsets(5, 5, 5, 5); + + content->SetName("Tab 1"); + + tabView->AddTab(content); + tabView->AddTab(new BView("Tab 2", 0)); + tabView->AddTab(new BView("Tab 3", 0)); + + BMenuBar* menuBar = new BMenuBar("menu bar"); + BMenu* menu = new BMenu("File"); + BMenuItem* item = new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED)); + menu->AddItem(item); + menuBar->AddItem(menu); + menu = new BMenu("Edit"); + menu->SetEnabled(false); + menu->AddItem(new BMenuItem("Cut", NULL)); + menu->AddItem(new BMenuItem("Copy", NULL)); + menu->AddSeparatorItem(); + menu->AddItem(new BMenuItem("Past", NULL)); + menuBar->AddItem(menu); + + BButton* okButton = new BButton("Ok", new BMessage(B_QUIT_REQUESTED)); + + window->AddChild(BGroupLayoutBuilder(B_VERTICAL) + .Add(menuBar) + .Add(BGroupLayoutBuilder(B_VERTICAL, 5) + .Add(tabView) + .Add(BGroupLayoutBuilder(B_HORIZONTAL, 5) + .Add(new BButton("Revert", NULL)) + .Add(BSpaceLayoutItem::CreateGlue()) + .Add(new BButton("Cancel", NULL)) + .Add(okButton) + ) + .SetInsets(5, 5, 5, 5) + ) + ); + + window->SetDefaultButton(okButton); + window->Show(); app.Run(); return 0; From mmlr at mail.berlios.de Sun Feb 1 23:16:50 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 1 Feb 2009 23:16:50 +0100 Subject: [Haiku-commits] r29120 - haiku/trunk/src/kits/media Message-ID: <200902012216.n11MGopq001901@sheep.berlios.de> Author: mmlr Date: 2009-02-01 23:16:49 +0100 (Sun, 01 Feb 2009) New Revision: 29120 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29120&view=rev Modified: haiku/trunk/src/kits/media/SoundPlayer.cpp Log: Fix wrong check. Modified: haiku/trunk/src/kits/media/SoundPlayer.cpp =================================================================== --- haiku/trunk/src/kits/media/SoundPlayer.cpp 2009-02-01 22:15:16 UTC (rev 29119) +++ haiku/trunk/src/kits/media/SoundPlayer.cpp 2009-02-01 22:16:49 UTC (rev 29120) @@ -80,7 +80,7 @@ TRACE("BSoundPlayer::BSoundPlayer: multi audio format constructor used\n"); - if (toNode.kind & B_BUFFER_CONSUMER == 0) + if ((toNode.kind & B_BUFFER_CONSUMER) == 0) debugger("BSoundPlayer: toNode must have B_BUFFER_CONSUMER kind!\n"); #if DEBUG > 0 From axeld at pinc-software.de Sun Feb 1 23:22:43 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 01 Feb 2009 23:22:43 +0100 CET Subject: [Haiku-commits] r29114 - haiku/trunk/headers/os/app In-Reply-To: <200902012102.n11L2axA029394@sheep.berlios.de> Message-ID: <12825333406-BeMail@zon> anevilyak at BerliOS wrote: > Log: > On gcc4 these need to be declared const. Otherwise any and every app > that > simply sets up a bunch of property_info structs for its scripting > directives triggers > many many warnings with respect to deprecated string constant > conversions. Since those are just structures, why would it hurt to make them const with GCC2, too? Bye, Axel. From anevilyak at gmail.com Sun Feb 1 23:24:19 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 1 Feb 2009 16:24:19 -0600 Subject: [Haiku-commits] r29114 - haiku/trunk/headers/os/app In-Reply-To: <12825333406-BeMail@zon> References: <200902012102.n11L2axA029394@sheep.berlios.de> <12825333406-BeMail@zon> Message-ID: On Sun, Feb 1, 2009 at 4:22 PM, Axel D?rfler wrote: > Since those are just structures, why would it hurt to make them const > with GCC2, too? Michael and I were uncertain if they'd be affected by name mangling or not, as they're not extern "C"'d or anything, so I thought better safe than sorry. Regards, Rene From axeld at pinc-software.de Sun Feb 1 23:36:47 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 01 Feb 2009 23:36:47 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29113_-_in_haiku/trunk=3A_headers/os/d?= =?utf-8?q?rivers_headers/private/kernel/util_src/bin/makebootable/platfor?= =?utf-8?q?m/bios=5Fia32_src/system/kernel_src/system/kernel/arch/x86_src/?= =?utf-8?q?system/kernel/cache_src/system/kernel/debug_src/system/kernel/d?= =?utf-8?q?evice=5Fmanager_src/system/kernel/fs__src/system/kernel/slab_sr?= =?utf-8?q?c/system/kernel/vm?= In-Reply-To: <200902012048.n11KmF9e028270@sheep.berlios.de> Message-ID: <13669650853-BeMail@zon> mmlr at mail.berlios.de wrote: > * Replaced the use of offsetof() for structs that aren't PODs. Add a > offset_of_member() macro to util/khash.h because that's what it's > used for > in our cases. Are you sure you cannot trick the compiler by using a cast to NULL or 1 or a similar bogus value? It's pretty ugly to need to create potentially heavy objects on the stack just for that. If that's really not possible, we should still remove that macro and use C++ only for those things (like class OpenHashTable over the khash stuff). > * Change the signature of add_debugger_command()/ > remove_debugger_command() on > GCC > 2 to avoid the depricated conversion from string constants to > char *. Since this is just a C function, why can't we just change it's signature for all compilers? "char*" doesn't make more sense there with GCC2. > * Adding some "suggested" parenthesis. I know that not everyone likes > that, but > it pointed out at least one bug that is fixed here as well. [...] > +++ haiku/trunk/src/system/kernel/vm/VMAnonymousCache.cpp 2009-02-01 > 20:48:02 UTC (rev 29113) > @@ -611,7 +611,7 @@ > - WriteCallback* callback = (flags & B_VIP_IO_REQUEST != 0) > + WriteCallback* callback = (flags & B_VIP_IO_REQUEST) != 0 The above is the only potential problem I spotted, but it would be * very* helpful if you could mention what exactly you fixed in your commit message :-) Bye, Axel. From mmlr at mlotz.ch Sun Feb 1 23:53:35 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 1 Feb 2009 23:53:35 +0100 Subject: [Haiku-commits] r29113 - in haiku/trunk: headers/os/drivers headers/private/kernel/util src/bin/makebootable/platform/bios_ia32 src/system/kernel src/system/kernel/arch/x86 src/system/kernel/cache src/system/kernel/debug src/system/kernel/device_manager src/system/kernel/fs src/system/kernel/slab src/system/kernel/vm In-Reply-To: <13669650853-BeMail@zon> References: <200902012048.n11KmF9e028270@sheep.berlios.de> <13669650853-BeMail@zon> Message-ID: <20090201224854.M88470@mlotz.ch> On Sun, 01 Feb 2009 23:36:47 +0100 CET, Axel D?rfler wrote > mmlr at mail.berlios.de wrote: >> * Replaced the use of offsetof() for structs that aren't PODs. Add a >> offset_of_member() macro to util/khash.h because that's what it's >> used for >> in our cases. > > Are you sure you cannot trick the compiler by using a cast to NULL > or 1 or a similar bogus value? It's pretty ugly to need to create > potentially heavy objects on the stack just for that. If that's > really not possible, we should still remove that macro and use C++ > only for those things (like class OpenHashTable over the khash stuff). The thing is that it explicitly states that it can't do that for a NULL object. I guess you could trick it somehow, but since these things are done only on hash_init() or list_init() I deemed it acceptable to create a temporary object on the stack. It'd certainly be cleaner to not require that at all by using the templated classes. Feel free to rework ;-) >> * Change the signature of add_debugger_command()/ >> remove_debugger_command() on >> GCC > 2 to avoid the depricated conversion from string constants to >> char *. > > Since this is just a C function, why can't we just change it's > signature for all compilers? "char*" doesn't make more sense there > with GCC2. I didn't want to touch it because of binary compatibility concerns. But now that you point it out it won't be affected of course. Will change that to always just be const char *. >> * Adding some "suggested" parenthesis. I know that not everyone likes >> that, but >> it pointed out at least one bug that is fixed here as well. >[...] >> +++ haiku/trunk/src/system/kernel/vm/VMAnonymousCache.cpp 2009-02-01 >> 20:48:02 UTC (rev 29113) >> @@ -611,7 +611,7 @@ >> - WriteCallback* callback = (flags & B_VIP_IO_REQUEST != 0) >> + WriteCallback* callback = (flags & B_VIP_IO_REQUEST) != 0 > > The above is the only potential problem I spotted, but it would be * > very* helpful if you could mention what exactly you fixed in your > commit message :-) Hehe, yeah I'm usually a fan of that as well. Sorry about that, it got lost among the other changes. Regards Michael From mmlr at mail.berlios.de Mon Feb 2 00:25:04 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 2 Feb 2009 00:25:04 +0100 Subject: [Haiku-commits] r29121 - in haiku/trunk/src: add-ons/kernel/cpu/x86 add-ons/kernel/drivers/audio/echo add-ons/kernel/network/protocols/udp add-ons/print/drivers/pdf/source add-ons/translators/tga apps/deskcalc bin/screen_blanker preferences/screen system/boot/loader/file_systems/fat Message-ID: <200902012325.n11NP47k006210@sheep.berlios.de> Author: mmlr Date: 2009-02-02 00:24:55 +0100 (Mon, 02 Feb 2009) New Revision: 29121 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29121&view=rev Modified: haiku/trunk/src/add-ons/kernel/cpu/x86/generic_x86.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp haiku/trunk/src/add-ons/kernel/network/protocols/udp/udp.cpp haiku/trunk/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp haiku/trunk/src/add-ons/translators/tga/TGATranslator.cpp haiku/trunk/src/apps/deskcalc/CalcView.cpp haiku/trunk/src/bin/screen_blanker/ScreenBlanker.cpp haiku/trunk/src/preferences/screen/ScreenMode.cpp haiku/trunk/src/system/boot/loader/file_systems/fat/Directory.cpp haiku/trunk/src/system/boot/loader/file_systems/fat/Volume.cpp Log: Fix more operator precedence errors. These do not do what you'd expect at first sight. The comparison operator takes precedence over the binary ones. Modified: haiku/trunk/src/add-ons/kernel/cpu/x86/generic_x86.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/cpu/x86/generic_x86.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/add-ons/kernel/cpu/x86/generic_x86.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -139,7 +139,7 @@ cpuid_info cpuInfo; if (get_current_cpuid(&cpuInfo, 0x80000000) == B_OK - && cpuInfo.eax_0.max_eax & 0xff >= 8) { + && (cpuInfo.eax_0.max_eax & 0xff) >= 8) { get_current_cpuid(&cpuInfo, 0x80000008); bits = cpuInfo.regs.eax & 0xff; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -740,7 +740,7 @@ if ((stream->state & ECHO_STATE_STARTED) != 0) continue; echo_stream_start(stream, - (stream->use & ECHO_USE_PLAY == 0) ? echo_record_inth : echo_play_inth, stream); + ((stream->use & ECHO_USE_PLAY) == 0) ? echo_record_inth : echo_play_inth, stream); } if (acquire_sem_etc(card->buffer_ready_sem, 1, B_RELATIVE_TIMEOUT | B_CAN_INTERRUPT, 50000) Modified: haiku/trunk/src/add-ons/kernel/network/protocols/udp/udp.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/udp/udp.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/add-ons/kernel/network/protocols/udp/udp.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -389,14 +389,14 @@ if (otherEndpoint->LocalAddress().EqualPorts(address)) { // port is already bound, SO_REUSEADDR or SO_REUSEPORT is required: - if (otherEndpoint->Socket()->options & (SO_REUSEADDR | SO_REUSEPORT) == 0 - || socketOptions & (SO_REUSEADDR | SO_REUSEPORT) == 0) + if ((otherEndpoint->Socket()->options & (SO_REUSEADDR | SO_REUSEPORT)) == 0 + || (socketOptions & (SO_REUSEADDR | SO_REUSEPORT)) == 0) return EADDRINUSE; // if both addresses are the same, SO_REUSEPORT is required: if (otherEndpoint->LocalAddress().EqualTo(address, false) - && (otherEndpoint->Socket()->options & SO_REUSEPORT == 0 - || socketOptions & SO_REUSEPORT == 0)) + && ((otherEndpoint->Socket()->options & SO_REUSEPORT) == 0 + || (socketOptions & SO_REUSEPORT) == 0)) return EADDRINUSE; } } Modified: haiku/trunk/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp =================================================================== --- haiku/trunk/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/add-ons/print/drivers/pdf/source/PDFWriter.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -746,7 +746,7 @@ for (int8 y = 0; y <= 7; y ++, data ++) { uint8 d = *data; for (int8 x = 0; x <= 7; x ++, d >>= 1) { - if (d & 1 == 1) { // foreground + if ((d & 1) == 1) { // foreground if (pass != kPassForeground) continue; } else { // background if (pass != kPassBackground) continue; @@ -1059,7 +1059,7 @@ // 01234567 01234567 // 01201234 00123434 // GGGBBBBB ARRRRRGG - return in[1] & 1 == 0 || IsTransparentRGB15(in); + return (in[1] & 1) == 0 || IsTransparentRGB15(in); } @@ -1070,7 +1070,7 @@ // 01234567 01234567 // 00123434 01201234 // ARRRRRGG GGGBBBBB - return in[0] & 1 == 0 || IsTransparentRGB15_BIG(in); + return (in[0] & 1) == 0 || IsTransparentRGB15_BIG(in); } Modified: haiku/trunk/src/add-ons/translators/tga/TGATranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/tga/TGATranslator.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/add-ons/translators/tga/TGATranslator.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -328,7 +328,7 @@ imagespec.descriptor = buf[17]; // images ordered from Right to Left (rather than Left to Right) // are not supported - if (imagespec.descriptor & TGA_ORIGIN_HORZ_BIT == TGA_ORIGIN_RIGHT) + if ((imagespec.descriptor & TGA_ORIGIN_HORZ_BIT) == TGA_ORIGIN_RIGHT) return B_NO_TRANSLATOR; // unused descriptor bits, these bits must be zero if (imagespec.descriptor & TGA_DESC_BITS76) @@ -336,23 +336,23 @@ if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR || fileheader.imagetype == TGA_RLE_TRUECOLOR) && imagespec.depth == 32 && - imagespec.descriptor & TGA_DESC_ALPHABITS != 8 && - imagespec.descriptor & TGA_DESC_ALPHABITS != 0) + (imagespec.descriptor & TGA_DESC_ALPHABITS) != 8 && + (imagespec.descriptor & TGA_DESC_ALPHABITS) != 0) return B_NO_TRANSLATOR; if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR || fileheader.imagetype == TGA_RLE_TRUECOLOR) && imagespec.depth == 24 && - imagespec.descriptor & TGA_DESC_ALPHABITS != 0) + (imagespec.descriptor & TGA_DESC_ALPHABITS) != 0) return B_NO_TRANSLATOR; if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR || fileheader.imagetype == TGA_RLE_TRUECOLOR) && imagespec.depth == 16 && - imagespec.descriptor & TGA_DESC_ALPHABITS != 1 && - imagespec.descriptor & TGA_DESC_ALPHABITS != 0) + (imagespec.descriptor & TGA_DESC_ALPHABITS) != 1 && + (imagespec.descriptor & TGA_DESC_ALPHABITS) != 0) if ((fileheader.imagetype == TGA_NOCOMP_TRUECOLOR || fileheader.imagetype == TGA_RLE_TRUECOLOR) && imagespec.depth == 15 && - imagespec.descriptor & TGA_DESC_ALPHABITS != 0) + (imagespec.descriptor & TGA_DESC_ALPHABITS) != 0) return B_NO_TRANSLATOR; // Fill in headers passed to this function Modified: haiku/trunk/src/apps/deskcalc/CalcView.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -335,7 +335,7 @@ FillRect(updateRect & keypadRect); // render key main grid - BeginLineArray((fColums + fRows) << 1 + 1); + BeginLineArray(((fColums + fRows) << 1) + 1); // render cols AddLine(BPoint(0.0, sizeDisp), Modified: haiku/trunk/src/bin/screen_blanker/ScreenBlanker.cpp =================================================================== --- haiku/trunk/src/bin/screen_blanker/ScreenBlanker.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/bin/screen_blanker/ScreenBlanker.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -172,10 +172,10 @@ return; if (fSettings.OffTime() == fSettings.SuspendTime() - && (flags & (ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND)) == ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND) + && (flags & (ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND)) == (ENABLE_DPMS_OFF | ENABLE_DPMS_SUSPEND)) flags &= ~ENABLE_DPMS_SUSPEND; if (fSettings.SuspendTime() == fSettings.StandByTime() - && (flags & (ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY)) == ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY) + && (flags & (ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY)) == (ENABLE_DPMS_SUSPEND | ENABLE_DPMS_STAND_BY)) flags &= ~ENABLE_DPMS_STAND_BY; // start them off again Modified: haiku/trunk/src/preferences/screen/ScreenMode.cpp =================================================================== --- haiku/trunk/src/preferences/screen/ScreenMode.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/preferences/screen/ScreenMode.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -31,7 +31,7 @@ static combine_mode get_combine_mode(display_mode& mode) { - if (mode.flags & B_SCROLL == 0) + if ((mode.flags & B_SCROLL) == 0) return kCombineDisable; if (mode.virtual_width == mode.timing.h_display * 2) Modified: haiku/trunk/src/system/boot/loader/file_systems/fat/Directory.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/file_systems/fat/Directory.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/system/boot/loader/file_systems/fat/Directory.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -282,7 +282,7 @@ continue; if (c->entry.Flags() == 0x0f) // LFN entry continue; - if (c->entry.Flags() & (FAT_VOLUME|FAT_SUBDIR) == FAT_VOLUME) { + if ((c->entry.Flags() & (FAT_VOLUME|FAT_SUBDIR)) == FAT_VOLUME) { // TODO handle Volume name (set fVolume's name) continue; } Modified: haiku/trunk/src/system/boot/loader/file_systems/fat/Volume.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/file_systems/fat/Volume.cpp 2009-02-01 22:16:49 UTC (rev 29120) +++ haiku/trunk/src/system/boot/loader/file_systems/fat/Volume.cpp 2009-02-01 23:24:55 UTC (rev 29121) @@ -253,7 +253,7 @@ bool Volume::IsLastCluster(uint32 cluster) const { - if (cluster >= fTotalClusters && (cluster & 0xff8 == 0xff8)) + if (cluster >= fTotalClusters && ((cluster & 0xff8) == 0xff8)) return true; return false; } From mmlr at mail.berlios.de Mon Feb 2 00:25:42 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 2 Feb 2009 00:25:42 +0100 Subject: [Haiku-commits] r29122 - haiku/trunk/src/servers/registrar Message-ID: <200902012325.n11NPgFJ006233@sheep.berlios.de> Author: mmlr Date: 2009-02-02 00:25:41 +0100 (Mon, 02 Feb 2009) New Revision: 29122 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29122&view=rev Modified: haiku/trunk/src/servers/registrar/TRoster.cpp Log: This was most probably a typo. Modified: haiku/trunk/src/servers/registrar/TRoster.cpp =================================================================== --- haiku/trunk/src/servers/registrar/TRoster.cpp 2009-02-01 23:24:55 UTC (rev 29121) +++ haiku/trunk/src/servers/registrar/TRoster.cpp 2009-02-01 23:25:41 UTC (rev 29122) @@ -376,7 +376,7 @@ // check the parameters // entry_ref - if (error == B_OK & !BEntry(&ref).Exists()) + if (error == B_OK && !BEntry(&ref).Exists()) SET_ERROR(error, B_ENTRY_NOT_FOUND); // team/token if (error == B_OK && team < 0 && token == 0) From anevilyak at mail.berlios.de Mon Feb 2 00:28:37 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 2 Feb 2009 00:28:37 +0100 Subject: [Haiku-commits] r29123 - haiku/trunk/headers/os/app Message-ID: <200902012328.n11NSbCZ006482@sheep.berlios.de> Author: anevilyak Date: 2009-02-02 00:28:37 +0100 (Mon, 02 Feb 2009) New Revision: 29123 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29123&view=rev Modified: haiku/trunk/headers/os/app/PropertyInfo.h Log: Adding const for gcc2 as well shouldn't cause any issues. Thanks Axel! Modified: haiku/trunk/headers/os/app/PropertyInfo.h =================================================================== --- haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 23:25:41 UTC (rev 29122) +++ haiku/trunk/headers/os/app/PropertyInfo.h 2009-02-01 23:28:37 UTC (rev 29123) @@ -41,26 +41,17 @@ struct compound_type { struct field_pair { -#if __GNUC__ > 2 - const -#endif - char *name; // name of entry in message + const char *name; // name of entry in message type_code type; // type_code of entry in message }; field_pair pairs[5]; }; struct property_info { -#if __GNUC__ > 2 - const -#endif - char *name; + const char *name; uint32 commands[10]; uint32 specifiers[10]; -#if __GNUC__ > 2 - const -#endif - char *usage; + const char *usage; uint32 extra_data; uint32 types[10]; compound_type ctypes[3]; @@ -73,16 +64,10 @@ }; struct value_info { -#if __GNUC__ > 2 - const -#endif - char *name; + const char *name; uint32 value; value_kind kind; -#if __GNUC__ > 2 - const -#endif - char *usage; + const char *usage; uint32 extra_data; uint32 _reserved[10]; }; From mmlr at mail.berlios.de Mon Feb 2 00:32:28 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 2 Feb 2009 00:32:28 +0100 Subject: [Haiku-commits] r29124 - in haiku/trunk: headers/os/drivers src/system/kernel/debug Message-ID: <200902012332.n11NWSbb008841@sheep.berlios.de> Author: mmlr Date: 2009-02-02 00:32:25 +0100 (Mon, 02 Feb 2009) New Revision: 29124 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29124&view=rev Modified: haiku/trunk/headers/os/drivers/KernelExport.h haiku/trunk/src/system/kernel/debug/debug_commands.cpp Log: Remove separate GCC4 versions of add_debug_command()/remove_debug_command() and add the const in any case. As Axel points out these are C functions and we do not affect binary compatibility by changing their signature. Modified: haiku/trunk/headers/os/drivers/KernelExport.h =================================================================== --- haiku/trunk/headers/os/drivers/KernelExport.h 2009-02-01 23:28:37 UTC (rev 29123) +++ haiku/trunk/headers/os/drivers/KernelExport.h 2009-02-01 23:32:25 UTC (rev 29124) @@ -174,16 +174,10 @@ extern void kernel_debugger(const char *message); extern uint64 parse_expression(const char *string); -#if __GNUC__ > 2 extern int add_debugger_command(const char *name, debugger_command_hook hook, const char *help); extern int remove_debugger_command(const char *name, debugger_command_hook hook); -#else -extern int add_debugger_command(char *name, debugger_command_hook hook, char *help); -extern int remove_debugger_command(char *name, - debugger_command_hook hook); -#endif /* Miscellaneous */ extern void spin(bigtime_t microseconds); Modified: haiku/trunk/src/system/kernel/debug/debug_commands.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2009-02-01 23:28:37 UTC (rev 29123) +++ haiku/trunk/src/system/kernel/debug/debug_commands.cpp 2009-02-01 23:32:25 UTC (rev 29124) @@ -499,23 +499,15 @@ // #pragma mark - public API int -#if __GNUC__ > 2 add_debugger_command(const char *name, int (*func)(int, char **), const char *desc) -#else -add_debugger_command(char *name, int (*func)(int, char **), char *desc) -#endif { return add_debugger_command_etc(name, func, desc, NULL, 0); } int -#if __GNUC__ > 2 remove_debugger_command(const char * name, int (*func)(int, char **)) -#else -remove_debugger_command(char * name, int (*func)(int, char **)) -#endif { struct debugger_command *cmd = sCommands; struct debugger_command *prev = NULL; From mmlr at mail.berlios.de Mon Feb 2 00:47:47 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 2 Feb 2009 00:47:47 +0100 Subject: [Haiku-commits] r29125 - haiku/trunk/src/kits/interface Message-ID: <200902012347.n11Nllqs025689@sheep.berlios.de> Author: mmlr Date: 2009-02-02 00:47:38 +0100 (Mon, 02 Feb 2009) New Revision: 29125 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29125&view=rev Modified: haiku/trunk/src/kits/interface/ColorConversion.cpp Log: Should fix bug #3401. Put the parenthesis at the wrong spot resulting in wrong offsets. Modified: haiku/trunk/src/kits/interface/ColorConversion.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorConversion.cpp 2009-02-01 23:32:25 UTC (rev 29124) +++ haiku/trunk/src/kits/interface/ColorConversion.cpp 2009-02-01 23:47:38 UTC (rev 29125) @@ -583,10 +583,10 @@ dstOffsetY = 0; } - srcBits = (srcByte*)((uint8*)srcBits + (srcOffsetY * srcBitsPerRow + srcOffsetX - * (srcBitsPerPixel >> 3))); - dstBits = (dstByte*)((uint8*)dstBits + (dstOffsetY * dstBitsPerRow + dstOffsetX - * (dstBitsPerPixel >> 3))); + srcBits = (srcByte*)((uint8*)srcBits + ((srcOffsetY * srcBitsPerRow + srcOffsetX + * srcBitsPerPixel) >> 3)); + dstBits = (dstByte*)((uint8*)dstBits + ((dstOffsetY * dstBitsPerRow + dstOffsetX + * dstBitsPerPixel) >> 3)); // Ensure that the width fits int32 srcWidth = (srcBitsPerRow - srcOffsetX * srcBitsPerPixel) From anevilyak at mail.berlios.de Mon Feb 2 02:37:03 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 2 Feb 2009 02:37:03 +0100 Subject: [Haiku-commits] r29126 - in haiku/trunk: headers/private/interface src/kits/interface Message-ID: <200902020137.n121b3QP006946@sheep.berlios.de> Author: anevilyak Date: 2009-02-02 02:36:54 +0100 (Mon, 02 Feb 2009) New Revision: 29126 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29126&view=rev Modified: haiku/trunk/headers/private/interface/ColumnListView.h haiku/trunk/src/kits/interface/ColumnListView.cpp Log: BColumnListView was hiding BView::ScrollTo(BPoint), due to its own child variant ScrollTo(BRow *). Fixed. Modified: haiku/trunk/headers/private/interface/ColumnListView.h =================================================================== --- haiku/trunk/headers/private/interface/ColumnListView.h 2009-02-01 23:47:38 UTC (rev 29125) +++ haiku/trunk/headers/private/interface/ColumnListView.h 2009-02-02 01:36:54 UTC (rev 29126) @@ -304,6 +304,7 @@ void AddRow(BRow*, int32 index, BRow *parent = 0); void ScrollTo(const BRow* Row); + void ScrollTo(BPoint point); // Does not delete row or children at this time. // todo: Make delete row and children Modified: haiku/trunk/src/kits/interface/ColumnListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColumnListView.cpp 2009-02-01 23:47:38 UTC (rev 29125) +++ haiku/trunk/src/kits/interface/ColumnListView.cpp 2009-02-02 01:36:54 UTC (rev 29126) @@ -1143,6 +1143,11 @@ fOutlineView->ScrollTo(Row); } +void BColumnListView::ScrollTo(BPoint point) +{ + fOutlineView->ScrollTo(point); +} + void BColumnListView::Clear() { fOutlineView->Clear(); From humdingerb at googlemail.com Mon Feb 2 19:03:16 2009 From: humdingerb at googlemail.com (Humdinger) Date: Mon, 02 Feb 2009 19:03:16 +0100 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <4985B731.50901@googlemail.com> References: <200901251129.n0PBTeGJ018646@sheep.berlios.de> <49849C94.8010200@googlemail.com> <20090131200655.6400.2@bepc.1233406687.fake> <4984BFA2.9050404@googlemail.com> <1e80d8750901311437r2592faf6x726c857eb85fbdd2@mail.gmail.com> <4984D4A0.20805@googlemail.com> <20090201010404.362.1@knochen-vm.localdomain> <49854BB2.500@googlemail.com> <20090201115724.350.2@bepc.1233485126.fake> <4985B731.50901@googlemail.com> Message-ID: <49873564.4040109@googlemail.com> Humdinger wrote: > I made a diff of the InfoWindow.cpp that I've attached. > Since this is the first patch that I haven't sent privately to you, is > that the correct way to create a patch: I navigated to > haiku/trunk/src/kits/tracker and did a "svn diff > file.diff". I have an updated diff, as "Path" also appears as Attribute column in Tracker windows. I hope I found all places. One thing that's puzzling me a bit: The OpenWith panel still starts up the first time with "Path". After removing it I can display "Location" from the Attribute menu... Oh, and this time I did the diff from trunk/ with: svn diff src/kits/tracker/ > Path2Location.diff If everything's OK I can also commit it myself... Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de -------------- next part -------------- A non-text attachment was scrubbed... Name: Path2Location.diff Type: text/x-patch Size: 2557 bytes Desc: not available URL: From superstippi at gmx.de Mon Feb 2 20:06:03 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Mon, 02 Feb 2009 20:06:03 +0100 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <49873564.4040109@googlemail.com> References: <200901251129.n0PBTeGJ018646@sheep.berlios.de> <49849C94.8010200@googlemail.com> <20090131200655.6400.2@bepc.1233406687.fake> <4984BFA2.9050404@googlemail.com> <1e80d8750901311437r2592faf6x726c857eb85fbdd2@mail.gmail.com> <4984D4A0.20805@googlemail.com> <20090201010404.362.1@knochen-vm.localdomain> <49854BB2.500@googlemail.com> <20090201115724.350.2@bepc.1233485126.fake> <4985B731.50901@googlemail.com> <49873564.4040109@googlemail.com> Message-ID: <4987441B.8010302@gmx.de> Humdinger schrieb: > Humdinger wrote: >> I made a diff of the InfoWindow.cpp that I've attached. >> Since this is the first patch that I haven't sent privately to you, is >> that the correct way to create a patch: I navigated to >> haiku/trunk/src/kits/tracker and did a "svn diff > file.diff". > > I have an updated diff, as "Path" also appears as Attribute column in > Tracker windows. I hope I found all places. One thing that's puzzling me > a bit: The OpenWith panel still starts up the first time with "Path". > After removing it I can display "Location" from the Attribute menu... > > Oh, and this time I did the diff from trunk/ with: > svn diff src/kits/tracker/ > Path2Location.diff > > If everything's OK I can also commit it myself... Looks good, please go ahead! :-) Location is much less technical than Path anyways. Best regards, -Stephan From anevilyak at mail.berlios.de Tue Feb 3 00:07:48 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Tue, 3 Feb 2009 00:07:48 +0100 Subject: [Haiku-commits] r29127 - haiku/trunk/build/jam Message-ID: <200902022307.n12N7mPo029663@sheep.berlios.de> Author: anevilyak Date: 2009-02-03 00:07:47 +0100 (Tue, 03 Feb 2009) New Revision: 29127 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29127&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Forgot to update the symlink path in the Be menu when updating that package. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2009-02-02 01:36:54 UTC (rev 29126) +++ haiku/trunk/build/jam/OptionalPackages 2009-02-02 23:07:47 UTC (rev 29127) @@ -471,7 +471,7 @@ : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/Vision-0.9.7-H-21072008/Vision ; + : /boot/apps/Vision-0.9.7-H-25012009/Vision ; } else { InstallOptionalHaikuImagePackage Vision-0.9.7-H-25012009 : http://vision.sf.net/Vision-0.9.7-H-25012009.zip From axeld at pinc-software.de Tue Feb 3 00:44:26 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 03 Feb 2009 00:44:26 +0100 CET Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <4987441B.8010302@gmx.de> Message-ID: <50024144324-BeMail@zon> Stephan A?mus wrote: > Location is much less technical than Path anyways. I'm not really sure about that; "path" alone is not really a very technical term, and it's a pretty good description of the location of a file (as it indeed is the path to that file) :-) Bye, Axel. From bonefish at mail.berlios.de Tue Feb 3 02:08:41 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 3 Feb 2009 02:08:41 +0100 Subject: [Haiku-commits] r29128 - haiku/trunk Message-ID: <200902030108.n1318fLE030418@sheep.berlios.de> Author: bonefish Date: 2009-02-03 02:08:40 +0100 (Tue, 03 Feb 2009) New Revision: 29128 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29128&view=rev Modified: haiku/trunk/configure Log: Patch by Matt Madia (slightly modified): Extended the usage text by some info regarding non-default output directories. Modified: haiku/trunk/configure =================================================================== --- haiku/trunk/configure 2009-02-02 23:07:47 UTC (rev 29127) +++ haiku/trunk/configure 2009-02-03 01:08:40 UTC (rev 29128) @@ -76,6 +76,19 @@ Defaults to "ru". HAIKU_UNARFLAGS The flags passed to HAIKU_AR for unarchiving. Defaults to "x". + +Non-standard output directories: + By default all objects, build configuration, and other related files are + stored in /path/to/haiku_source/generated. To store objects in a non-default + location, run "../../relative/path/to/haiku_source/configure " from + within your non-default location. "jam [ options ] targets" can then be run + directly inside your non-default location. Another option is to invoke "jam + [ options ] targets" from within haiku_source. This can be accomplished by + either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking + jam or by creating a symlink of haiku_source/generated pointing to your + non-default location and running jam. + + EOF } From jackburton at mail.berlios.de Tue Feb 3 15:04:56 2009 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 3 Feb 2009 15:04:56 +0100 Subject: [Haiku-commits] r29129 - haiku/trunk/src/apps/terminal Message-ID: <200902031404.n13E4u60009735@sheep.berlios.de> Author: jackburton Date: 2009-02-03 15:04:52 +0100 (Tue, 03 Feb 2009) New Revision: 29129 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29129&view=rev Modified: haiku/trunk/src/apps/terminal/AppearPrefView.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h haiku/trunk/src/apps/terminal/CodeConv.cpp haiku/trunk/src/apps/terminal/Coding.cpp haiku/trunk/src/apps/terminal/TermParse.cpp haiku/trunk/src/apps/terminal/TermView.cpp Log: Applied patch by h.z. (slightly modified by myself) included in bug #2715. I tested it briefly with Konatu Tohaba font and it seems to work correctly. Please review. Modified: haiku/trunk/src/apps/terminal/AppearPrefView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/AppearPrefView.cpp 2009-02-03 01:08:40 UTC (rev 29128) +++ haiku/trunk/src/apps/terminal/AppearPrefView.cpp 2009-02-03 14:04:52 UTC (rev 29129) @@ -18,9 +18,34 @@ #include #include +#include #include +static bool +IsFontUsable(const BFont &font) +{ + // TODO: If BFont::IsFullAndHalfFixed() was implemented, we could + // use that. But I don't think it's easily implementable using + // Freetype. + + if (font.IsFixed()) + return true; + + bool widthOk = true; + int lastWidth; + for (int c = 0x20 ; c <= 0x7e; c++){ + char buf[4]; + snprintf(buf, sizeof(buf), "%c", c); + int tmpWidth = (int)font.StringWidth(buf); + if (c > 0x20 &&(tmpWidth != lastWidth)) + widthOk = false; + lastWidth = tmpWidth; + } + return widthOk; +} + + AppearancePrefView::AppearancePrefView(BRect frame, const char *name, BMessenger messenger) : PrefView(frame, name), @@ -170,7 +195,7 @@ if (get_font_family(i, &family, &flags) == B_OK) { BFont font; font.SetFamilyAndStyle(family, NULL); - if (font.IsFixed()) { + if (IsFontUsable(font)) { BMenuItem *item = new BMenuItem(family, new BMessage(command)); menu->AddItem(item); if (!strcmp(defaultFontName, family)) Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2009-02-03 01:08:40 UTC (rev 29128) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.cpp 2009-02-03 14:04:52 UTC (rev 29129) @@ -537,11 +537,12 @@ void -BasicTerminalBuffer::InsertChar(UTF8Char c, uint32 attributes) +BasicTerminalBuffer::InsertChar(UTF8Char c, uint32 width, uint32 attributes) { //debug_printf("BasicTerminalBuffer::InsertChar('%.*s' (%d), %#lx)\n", //(int)c.ByteCount(), c.bytes, c.bytes[0], attributes); - int width = CodeConv::UTF8GetFontWidth(c.bytes); + // TODO: Check if this method can be removed completely + //int width = CodeConv::UTF8GetFontWidth(c.bytes); if (width == FULL_WIDTH) attributes |= A_WIDTH; Modified: haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h =================================================================== --- haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2009-02-03 01:08:40 UTC (rev 29128) +++ haiku/trunk/src/apps/terminal/BasicTerminalBuffer.h 2009-02-03 14:04:52 UTC (rev 29129) @@ -96,9 +96,14 @@ TermPos& matchEnd) const; // insert chars/lines - void InsertChar(UTF8Char c, uint32 attributes); - inline void InsertChar(const char* c, int32 length, - uint32 attributes); + inline void InsertChar(UTF8Char c, uint32 attributes); + void InsertChar(UTF8Char c, uint32 width, + uint32 attributes); + inline void InsertChar(const char* c, int32 length, + uint32 attributes); + inline void InsertChar(const char* c, int32 length, + uint32 width, uint32 attributes); + void InsertCR(); void InsertLF(); void SetInsertMode(int flag); @@ -210,13 +215,27 @@ void +BasicTerminalBuffer::InsertChar(UTF8Char c, uint32 attributes) +{ + return InsertChar(c, 1, attributes); +} + + +void BasicTerminalBuffer::InsertChar(const char* c, int32 length, uint32 attributes) { - return InsertChar(UTF8Char(c, length), attributes); + return InsertChar(UTF8Char(c, length), 1, attributes); } void +BasicTerminalBuffer::InsertChar(const char* c, int32 length, uint32 width, uint32 attributes) +{ + return InsertChar(UTF8Char(c, length), width, attributes); +} + + +void BasicTerminalBuffer::SetCursorX(int32 x) { SetCursor(x, fCursor.y); Modified: haiku/trunk/src/apps/terminal/CodeConv.cpp =================================================================== --- haiku/trunk/src/apps/terminal/CodeConv.cpp 2009-02-03 01:08:40 UTC (rev 29128) +++ haiku/trunk/src/apps/terminal/CodeConv.cpp 2009-02-03 14:04:52 UTC (rev 29129) @@ -38,7 +38,6 @@ int32 CodeConv::UTF8GetFontWidth(const char *string) { - return 1; ushort unicode = UTF8toUnicode(string); uchar width = gUTF8WidthTable[unicode >> 3]; ushort offset = unicode & 0x07; Modified: haiku/trunk/src/apps/terminal/Coding.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Coding.cpp 2009-02-03 01:08:40 UTC (rev 29128) +++ haiku/trunk/src/apps/terminal/Coding.cpp 2009-02-03 14:04:52 UTC (rev 29129) @@ -30,11 +30,11 @@ {"Shift-JIS", "SJIS", 'S', B_SJIS_CONVERSION}, {"EUC-jp", "EUCJ", 'E', B_EUC_CONVERSION}, {"EUC-kr", "EUCK", 'K', B_EUC_KR_CONVERSION}, + {"GB18030", "GB18030", 'G', B_GBK_CONVERSION}, + {"Big5", "Big5", 'B', B_BIG5_CONVERSION}, - /* Not Implemented. {"EUC-tw", "EUCT", "T", M_EUC_TW}, - {"Big5", "Big5", 'B', M_BIG5}, {"ISO-2022-cn", "ISOC", 'C', M_ISO_2022_CN}, {"ISO-2022-kr", "ISOK", 'R', M_ISO_2022_KR}, */ Modified: haiku/trunk/src/apps/terminal/TermParse.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermParse.cpp 2009-02-03 01:08:40 UTC (rev 29128) +++ haiku/trunk/src/apps/terminal/TermParse.cpp 2009-02-03 14:04:52 UTC (rev 29129) @@ -326,6 +326,7 @@ int *groundtable = gUTF8GroundTable; int *parsestate = groundtable; + int width = 1; BAutolock locker(fBuffer); while (!fQuitting) { @@ -358,6 +359,8 @@ case B_EUC_CONVERSION: case B_EUC_KR_CONVERSION: case B_JIS_CONVERSION: + case B_GBK_CONVERSION: + case B_BIG5_CONVERSION: groundtable = gISO8859GroundTable; break; case M_UTF8: @@ -378,10 +381,14 @@ case CASE_PRINT_GR: /* case iso8859 gr character, or euc */ ptr = cbuf; - if (now_coding == B_EUC_CONVERSION || now_coding == B_EUC_KR_CONVERSION - || now_coding == B_JIS_CONVERSION) { + if (now_coding == B_EUC_CONVERSION + || now_coding == B_EUC_KR_CONVERSION + || now_coding == B_JIS_CONVERSION + || now_coding == B_GBK_CONVERSION + || now_coding == B_BIG5_CONVERSION) { switch (parsestate[curess]) { case CASE_SS2: /* JIS X 0201 */ + width = 1; *ptr++ = curess; *ptr++ = c; *ptr = 0; @@ -389,6 +396,7 @@ break; case CASE_SS3: /* JIS X 0212 */ + width = 1; *ptr++ = curess; *ptr++ = c; _NextParseChar(c); @@ -398,6 +406,7 @@ break; default: /* JIS X 0208 */ + width = 2; *ptr++ = c; _NextParseChar(c); *ptr++ = c; @@ -417,7 +426,7 @@ B_EUC_CONVERSION); } - fBuffer->InsertChar(dstbuf, 4, attr); + fBuffer->InsertChar(dstbuf, 4, width, attr); break; case CASE_PRINT_CS96: Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2009-02-03 01:08:40 UTC (rev 29128) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2009-02-03 14:04:52 UTC (rev 29129) @@ -1025,6 +1025,9 @@ continue; } + if (IS_WIDTH(attr)) + count = 2; + _DrawLinePart(fFontWidth * i, (int32)_LineOffset(j), attr, buf, count, insideSelection, false, this); i += count; From humdingerb at mail.berlios.de Tue Feb 3 17:16:29 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Tue, 3 Feb 2009 17:16:29 +0100 Subject: [Haiku-commits] r29130 - haiku/trunk/src/kits/tracker Message-ID: <200902031616.n13GGT2U025827@sheep.berlios.de> Author: humdingerb Date: 2009-02-03 17:16:26 +0100 (Tue, 03 Feb 2009) New Revision: 29130 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29130&view=rev Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp haiku/trunk/src/kits/tracker/InfoWindow.cpp haiku/trunk/src/kits/tracker/OpenWithWindow.cpp haiku/trunk/src/kits/tracker/QueryPoseView.cpp Log: As discussed here: https://lists.berlios.de/pipermail/haiku-commits/2009-February/014198.html We decided on a distinction between path+filename and only the path to a file. I changed the places a user is exposed to the issue, using the definition: Path with filename: "Path" Path without filename: "Location" Modified: haiku/trunk/src/kits/tracker/ContainerWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2009-02-03 14:04:52 UTC (rev 29129) +++ haiku/trunk/src/kits/tracker/ContainerWindow.cpp 2009-02-03 16:16:26 UTC (rev 29130) @@ -3040,7 +3040,7 @@ menu->AddItem(NewAttributeMenuItem ("Original name", kAttrOriginalPath, B_STRING_TYPE, 225, B_ALIGN_LEFT, false, false)); else - menu->AddItem(NewAttributeMenuItem ("Path", kAttrPath, B_STRING_TYPE, + menu->AddItem(NewAttributeMenuItem ("Location", kAttrPath, B_STRING_TYPE, 225, B_ALIGN_LEFT, false, false)); #ifdef OWNER_GROUP_ATTRIBUTES Modified: haiku/trunk/src/kits/tracker/InfoWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/InfoWindow.cpp 2009-02-03 14:04:52 UTC (rev 29129) +++ haiku/trunk/src/kits/tracker/InfoWindow.cpp 2009-02-03 16:16:26 UTC (rev 29130) @@ -1746,9 +1746,9 @@ GetFont(&normalFont); // Path - MovePenTo(BPoint(fDivider - (StringWidth("Path:")), lineBase)); + MovePenTo(BPoint(fDivider - (StringWidth("Location:")), lineBase)); SetHighColor(kAttrTitleColor); - DrawString("Path:"); + DrawString("Location:"); MovePenTo(BPoint(fDivider + kDrawMargin, lineBase)); SetHighColor(kLinkColor); Modified: haiku/trunk/src/kits/tracker/OpenWithWindow.cpp =================================================================== --- haiku/trunk/src/kits/tracker/OpenWithWindow.cpp 2009-02-03 14:04:52 UTC (rev 29129) +++ haiku/trunk/src/kits/tracker/OpenWithWindow.cpp 2009-02-03 16:16:26 UTC (rev 29130) @@ -761,7 +761,7 @@ BColumn *relationColumn = new BColumn("Relation", 180, 100, B_ALIGN_LEFT, kAttrOpenWithRelation, B_STRING_TYPE, false, false); fColumnList->AddItem(relationColumn); - fColumnList->AddItem(new BColumn("Path", 290, 225, B_ALIGN_LEFT, + fColumnList->AddItem(new BColumn("Location", 290, 225, B_ALIGN_LEFT, kAttrPath, B_STRING_TYPE, true, false)); fColumnList->AddItem(new BColumn("Version", 525, 70, B_ALIGN_LEFT, kAttrAppVersion, B_STRING_TYPE, false, false)); Modified: haiku/trunk/src/kits/tracker/QueryPoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/QueryPoseView.cpp 2009-02-03 14:04:52 UTC (rev 29129) +++ haiku/trunk/src/kits/tracker/QueryPoseView.cpp 2009-02-03 16:16:26 UTC (rev 29130) @@ -115,7 +115,7 @@ fColumnList->AddItem(new BColumn("Name", kColumnStart, 145, B_ALIGN_LEFT, kAttrStatName, B_STRING_TYPE, true, true)); - fColumnList->AddItem(new BColumn("Path", 200, 225, B_ALIGN_LEFT, + fColumnList->AddItem(new BColumn("Location", 200, 225, B_ALIGN_LEFT, kAttrPath, B_STRING_TYPE, true, false)); fColumnList->AddItem(new BColumn("Size", 440, 80, B_ALIGN_RIGHT, kAttrStatSize, B_OFF_T_TYPE, true, false)); From superstippi at gmx.de Tue Feb 3 17:18:13 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Tue, 03 Feb 2009 17:18:13 +0100 Subject: [Haiku-commits] r29129 - haiku/trunk/src/apps/terminal In-Reply-To: <200902031404.n13E4u60009735@sheep.berlios.de> References: <200902031404.n13E4u60009735@sheep.berlios.de> Message-ID: <49886E45.7000108@gmx.de> Hi, jackburton at mail.berlios.de schrieb: > Author: jackburton > Date: 2009-02-03 15:04:52 +0100 (Tue, 03 Feb 2009) > New Revision: 29129 > +static bool > +IsFontUsable(const BFont &font) > +{ > + // TODO: If BFont::IsFullAndHalfFixed() was implemented, we could > + // use that. But I don't think it's easily implementable using > + // Freetype. > + > + if (font.IsFixed()) > + return true; > + > + bool widthOk = true; > + int lastWidth; > + for (int c = 0x20 ; c <= 0x7e; c++){ > + char buf[4]; > + snprintf(buf, sizeof(buf), "%c", c); > + int tmpWidth = (int)font.StringWidth(buf); > + if (c > 0x20 &&(tmpWidth != lastWidth)) > + widthOk = false; > + lastWidth = tmpWidth; > + } > + return widthOk; it's probably not speed critical at this place, but if you wanted, you could speed this up a lot by using BFont::GetEscapements() or whatever it was, using one buffer with all the chars you're interested in and then iterating over the widths in the returned array. Best regards, -Stephan From leavengood at gmail.com Tue Feb 3 18:46:08 2009 From: leavengood at gmail.com (Ryan Leavengood) Date: Tue, 3 Feb 2009 12:46:08 -0500 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <50024144324-BeMail@zon> References: <4987441B.8010302@gmx.de> <50024144324-BeMail@zon> Message-ID: On Mon, Feb 2, 2009 at 6:44 PM, Axel D?rfler wrote: > Stephan A?mus wrote: >> Location is much less technical than Path anyways. > > I'm not really sure about that; "path" alone is not really a very > technical term, and it's a pretty good description of the location of a > file (as it indeed is the path to that file) :-) Indeed this is a good point. In fact a large number of computing terms in English were just borrowed from other words with a similar concept and they are not inherently complicated. The idea of a kernel of corn, or a semaphore at a traffic stop, or the path through a park isn't really all that more complicated than the location of a store. But they might seem more complicated to those of us who have learned about the computer equivalent, like the kernel of an OS, or a semaphore resource lock. But in the case of path or location I don't know if path is automatically more technical. But I do think for this case it makes more sense so I agree with the change :) Ryan From humdingerb at googlemail.com Tue Feb 3 18:59:49 2009 From: humdingerb at googlemail.com (Humdinger) Date: Tue, 03 Feb 2009 18:59:49 +0100 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: References: <4987441B.8010302@gmx.de> <50024144324-BeMail@zon> Message-ID: <49888615.8090605@googlemail.com> Ryan Leavengood wrote: > But in the case of path or location I don't know if path is > automatically more technical. But I do think for this case it makes > more sense so I agree with the change :) Just to be clear, I don't think introducing "Location" was necessary because "Path" was too technical. And in most situations "path" and "location" are synonyms. We just needed a definition to distinguish between path+filename and the sole path without the filename. At least it's better than to mix these slightly different meanings. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From leavengood at gmail.com Tue Feb 3 19:18:51 2009 From: leavengood at gmail.com (Ryan Leavengood) Date: Tue, 3 Feb 2009 13:18:51 -0500 Subject: [Haiku-commits] r29007 - haiku/trunk/src/apps/terminal In-Reply-To: <49888615.8090605@googlemail.com> References: <4987441B.8010302@gmx.de> <50024144324-BeMail@zon> <49888615.8090605@googlemail.com> Message-ID: On Tue, Feb 3, 2009 at 12:59 PM, Humdinger wrote: > > Just to be clear, I don't think introducing "Location" was necessary because "Path" was > too technical. And in most situations "path" and "location" are synonyms. We just needed a > definition to distinguish between path+filename and the sole path without the filename. > At least it's better than to mix these slightly different meanings. Yes that is what I meant when I said I thought this made sense in this case. So I think it is a good change. Regards, Ryan From anevilyak at mail.berlios.de Wed Feb 4 00:08:43 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 4 Feb 2009 00:08:43 +0100 Subject: [Haiku-commits] r29131 - haiku/trunk/build/jam Message-ID: <200902032308.n13N8hRr022998@sheep.berlios.de> Author: anevilyak Date: 2009-02-04 00:08:42 +0100 (Wed, 04 Feb 2009) New Revision: 29131 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29131&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Update location of p7zip package. Thanks to Scott McCreary for the patch. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2009-02-03 16:16:26 UTC (rev 29130) +++ haiku/trunk/build/jam/OptionalPackages 2009-02-03 23:08:42 UTC (rev 29131) @@ -395,7 +395,7 @@ Echo "No optional package P7zip available for gcc4" ; } else { InstallOptionalHaikuImagePackage p7zip-4.61-gcc2-2008-12-03 - : http://ports.haiku-files.org/downloads/82 + : http://haiku-files.org/files/optional-packages/p7zip-4.61-gcc2-2008-12-03.zip : ; From mmu_man at mail.berlios.de Wed Feb 4 13:59:03 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 4 Feb 2009 13:59:03 +0100 Subject: [Haiku-commits] r29132 - haiku/trunk/3rdparty/mmu_man/scripts Message-ID: <200902041259.n14Cx3bP031351@sheep.berlios.de> Author: mmu_man Date: 2009-02-04 13:59:02 +0100 (Wed, 04 Feb 2009) New Revision: 29132 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29132&view=rev Modified: haiku/trunk/3rdparty/mmu_man/scripts/dev-perso Log: No line break here. Modified: haiku/trunk/3rdparty/mmu_man/scripts/dev-perso =================================================================== --- haiku/trunk/3rdparty/mmu_man/scripts/dev-perso 2009-02-03 23:08:42 UTC (rev 29131) +++ haiku/trunk/3rdparty/mmu_man/scripts/dev-perso 2009-02-04 12:59:02 UTC (rev 29132) @@ -101,7 +101,7 @@ #export PS1='\[\033]0;['$1':\W]\a\]\[\033[1m\][\u@\h \w]\[\033[0m\]\$ ' #export PS1='\033]0;['$1':\W]\a\033[1m[\u@\h \w]\033[0m\$ ' export PS1='\[\033[1m\][\u@\h \w]\[\033[0m\]\$ ' - export PROMPT_COMMAND='echo -e "\033]0;['$1':${PWD##*/}]\a"' + export PROMPT_COMMAND='echo -en "\033]0;['$1':${PWD##*/}]\a"' ;; esac # lower priority so background builds don't slow the GUI too much From mmu_man at mail.berlios.de Wed Feb 4 13:59:42 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 4 Feb 2009 13:59:42 +0100 Subject: [Haiku-commits] r29133 - in haiku/trunk/src/bin: . bemail_utils Message-ID: <200902041259.n14CxgS2031420@sheep.berlios.de> Author: mmu_man Date: 2009-02-04 13:59:41 +0100 (Wed, 04 Feb 2009) New Revision: 29133 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29133&view=rev Modified: haiku/trunk/src/bin/bemail_utils/spamdbm.cpp haiku/trunk/src/bin/urlwrapper.cpp Log: Return native error codes. Modified: haiku/trunk/src/bin/bemail_utils/spamdbm.cpp =================================================================== --- haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-02-04 12:59:02 UTC (rev 29132) +++ haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-02-04 12:59:41 UTC (rev 29133) @@ -2612,7 +2612,7 @@ sprintf (ErrorMessage, "The database is full! There are %lu messages in " "it and we can't add any more without overflowing the maximum integer " "representation in 32 bits", NewAge); - return ENOMEM; + return B_NO_MEMORY; } /* Check that this file hasn't already been added to the database. */ @@ -2724,7 +2724,7 @@ sprintf (ErrorMessage, "Failed to insert new database entry for " "word \"%s\", while processing file \"%s\"", WordIter->c_str (), OptionalFileName); - return ENOMEM; + return B_NO_MEMORY; } DataIter = InsertResult.first; m_WordCount++; Modified: haiku/trunk/src/bin/urlwrapper.cpp =================================================================== --- haiku/trunk/src/bin/urlwrapper.cpp 2009-02-04 12:59:02 UTC (rev 29132) +++ haiku/trunk/src/bin/urlwrapper.cpp 2009-02-04 12:59:41 UTC (rev 29133) @@ -102,7 +102,7 @@ v = FindFirst(":"); if (v < 0) - return EINVAL; + return B_BAD_VALUE; // TODO: proto and host should be lowercased. // see http://en.wikipedia.org/wiki/URL_normalization From korli at mail.berlios.de Thu Feb 5 00:03:40 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 5 Feb 2009 00:03:40 +0100 Subject: [Haiku-commits] r29134 - haiku/trunk/src/kits/interface Message-ID: <200902042303.n14N3eQL028052@sheep.berlios.de> Author: korli Date: 2009-02-05 00:03:40 +0100 (Thu, 05 Feb 2009) New Revision: 29134 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29134&view=rev Modified: haiku/trunk/src/kits/interface/TextControl.cpp Log: Should fix Shift+TAB on text controls, as it was broken since r29028. Noticed by Karsten Heimrich. Modified: haiku/trunk/src/kits/interface/TextControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextControl.cpp 2009-02-04 12:59:41 UTC (rev 29133) +++ haiku/trunk/src/kits/interface/TextControl.cpp 2009-02-04 23:03:40 UTC (rev 29134) @@ -451,6 +451,10 @@ if (Window()) { fText->MakeEditable(enabled); + if (enabled) + fText->SetFlags(fText->Flags() | B_NAVIGABLE); + else + fText->SetFlags(fText->Flags() & ~B_NAVIGABLE); _UpdateTextViewColors(enabled); @@ -512,6 +516,9 @@ fText->SetFlags(fText->Flags() | B_NAVIGABLE); } + // Don't make this one navigable + flags &= ~B_NAVIGABLE; + BView::SetFlags(flags); } @@ -925,6 +932,8 @@ fDivider = floorf(bounds.Width() / 2.0f); uint32 navigableFlags = Flags() & B_NAVIGABLE; + if (navigableFlags != 0) + BView::SetFlags(Flags() & ~B_NAVIGABLE); if (archive) fText = static_cast(FindView("_input_")); From korli at users.berlios.de Thu Feb 5 00:04:40 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Thu, 5 Feb 2009 00:04:40 +0100 Subject: [Haiku-commits] r29028 - haiku/trunk/src/kits/interface In-Reply-To: <49844FBF.8070808@gmx.de> References: <200901252218.n0PMIj60026512@sheep.berlios.de> <49844FBF.8070808@gmx.de> Message-ID: 2009/1/31 Karsten Heimrich > > This change will break SHIFT+TAB out of a text control. Just check > FileTypes using backward TAB navigation. > In fact. I changed it a bit in r29134. I hope it works better now. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From host.haiku at gmx.de Thu Feb 5 00:09:05 2009 From: host.haiku at gmx.de (Karsten Heimrich) Date: Thu, 05 Feb 2009 00:09:05 +0100 Subject: [Haiku-commits] r29028 - haiku/trunk/src/kits/interface In-Reply-To: References: <200901252218.n0PMIj60026512@sheep.berlios.de> <49844FBF.8070808@gmx.de> Message-ID: <498A2011.4040404@gmx.de> J?r?me Duval schrieb: > 2009/1/31 Karsten Heimrich > >> This change will break SHIFT+TAB out of a text control. Just check >> FileTypes using backward TAB navigation. >> > > In fact. I changed it a bit in r29134. I hope it works better now. Thanks J?r?me. :) Best, Karsten From axeld at mail.berlios.de Thu Feb 5 00:37:15 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 5 Feb 2009 00:37:15 +0100 Subject: [Haiku-commits] r29135 - haiku/trunk/src/servers/input Message-ID: <200902042337.n14NbFAY005838@sheep.berlios.de> Author: axeld Date: 2009-02-05 00:37:10 +0100 (Thu, 05 Feb 2009) New Revision: 29135 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29135&view=rev Modified: haiku/trunk/src/servers/input/InputServer.cpp haiku/trunk/src/servers/input/InputServer.h Log: * The input_server now updates its internal state only from the messages that actually made it through (ie. after filtering). * This should fix filters that change the current mouse position to work as expected. Modified: haiku/trunk/src/servers/input/InputServer.cpp =================================================================== --- haiku/trunk/src/servers/input/InputServer.cpp 2009-02-04 23:03:40 UTC (rev 29134) +++ haiku/trunk/src/servers/input/InputServer.cpp 2009-02-04 23:37:10 UTC (rev 29135) @@ -729,7 +729,7 @@ InputServer::HandleGetModifierKey(BMessage* message, BMessage* reply) { int32 modifier; - + if (message->FindInt32("modifier", &modifier) == B_OK) { switch (modifier) { case B_CAPS_LOCK: @@ -1451,24 +1451,83 @@ if (_SanitizeEvents(events) && _MethodizeEvents(events) - && _FilterEvents(events)) + && _FilterEvents(events)) { + _UpdateMouseAndKeys(events); _DispatchEvents(events); + } } } +/*! Updates the internal mouse position and keyboard info. */ +void +InputServer::_UpdateMouseAndKeys(EventList& events) +{ + for (int32 index = 0;BMessage* event = (BMessage*)events.ItemAt(index); + index++) { + switch (event->what) { + case B_MOUSE_DOWN: + case B_MOUSE_UP: + case B_MOUSE_MOVED: + event->FindPoint("where", &fMousePos); + break; + + case B_KEY_DOWN: + case B_UNMAPPED_KEY_DOWN: + // update modifiers + uint32 modifiers; + if (event->FindInt32("modifiers", (int32*)&modifiers) == B_OK) + fKeyInfo.modifiers = modifiers; + + // update key states + const uint8 *data; + ssize_t size; + if (event->FindData("states", B_UINT8_TYPE, + (const void**)&data, &size) == B_OK) { + PRINT(("updated keyinfo\n")); + if (size == sizeof(fKeyInfo.key_states)) + memcpy(fKeyInfo.key_states, data, size); + } + + if (fActiveMethod == NULL) + break; + + // we scan for Alt+Space key down events which means we change + // to next input method + // (pressing "shift" will let us switch to the previous method) + + PRINT(("SanitizeEvents: %lx, %x\n", fKeyInfo.modifiers, + fKeyInfo.key_states[KEY_Spacebar >> 3])); + + uint8 byte; + if (event->FindInt8("byte", (int8*)&byte) < B_OK) + byte = 0; + + if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') + || byte == B_ZENKAKU_HANKAKU) { + SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); + + // this event isn't sent to the user + events.RemoveItemAt(index); + delete event; + continue; + } + break; + } + } +} + + /*! Frees events from unwanted fields, adds missing fields, and removes unwanted events altogether. - As a side effect, it will also update the internal mouse states. */ bool InputServer::_SanitizeEvents(EventList& events) { CALLED(); - int32 index = 0; - BMessage *event; - while ((event = (BMessage*)events.ItemAt(index)) != NULL) { + for (int32 index = 0; BMessage* event = (BMessage*)events.ItemAt(index); + index++) { switch (event->what) { #ifndef HAIKU_TARGET_PLATFORM_HAIKU case IS_SCREEN_BOUNDS_UPDATED: @@ -1509,39 +1568,37 @@ if (event->FindInt32("x", &x) == B_OK && event->FindInt32("y", &y) == B_OK) { - fMousePos.x += x; - fMousePos.y -= y; - fMousePos.ConstrainTo(fFrame); + where.x = fMousePos.x + x; + where.y = fMousePos.y - y; + where.ConstrainTo(fFrame); event->RemoveName("x"); event->RemoveName("y"); - event->AddPoint("where", fMousePos); + event->AddPoint("where", where); event->AddInt32("be:delta_x", x); event->AddInt32("be:delta_y", y); PRINT(("new position: %f, %f, %ld, %ld\n", - fMousePos.x, fMousePos.y, x, y)); + where.x, where.y, x, y)); } else if (event->FindFloat("x", &absX) == B_OK && event->FindFloat("y", &absY) == B_OK) { - // device gives us absolute screen coords - // in range 0..1 - // convert to absolute screen pos - // (the message is supposed to contain the original - // absolute coordinates as "be:tablet_x/y") - fMousePos.x = absX * fFrame.Width(); - fMousePos.y = absY * fFrame.Height(); - fMousePos.ConstrainTo(fFrame); + // The device gives us absolute screen coords in range 0..1; + // convert them to absolute screen position + // (the message is supposed to contain the original + // absolute coordinates as "be:tablet_x/y"). + where.x = absX * fFrame.Width(); + where.y = absY * fFrame.Height(); + where.ConstrainTo(fFrame); event->RemoveName("x"); event->RemoveName("y"); - event->AddPoint("where", fMousePos); - PRINT(("new position : %f, %f\n", fMousePos.x, fMousePos.y)); + event->AddPoint("where", where); + PRINT(("new position : %f, %f\n", where.x, where.y)); } else if (event->FindPoint("where", &where) == B_OK) { - fMousePos = where; - fMousePos.ConstrainTo(fFrame); + where.ConstrainTo(fFrame); - event->ReplacePoint("where", fMousePos); - PRINT(("new position : %f, %f\n", fMousePos.x, fMousePos.y)); + event->ReplacePoint("where", where); + PRINT(("new position : %f, %f\n", where.x, where.y)); } if (!event->HasInt64("when")) @@ -1552,52 +1609,17 @@ } case B_KEY_DOWN: case B_UNMAPPED_KEY_DOWN: - // update or add modifiers - uint32 modifiers; - if (event->FindInt32("modifiers", (int32*)&modifiers) == B_OK) - fKeyInfo.modifiers = modifiers; - else + // add modifiers + if (!event->HasInt32("modifiers")) event->AddInt32("modifiers", fKeyInfo.modifiers); - // update or add key states - const uint8 *data; - ssize_t size; - if (event->FindData("states", B_UINT8_TYPE, - (const void**)&data, &size) == B_OK) { - PRINT(("updated keyinfo\n")); - if (size == sizeof(fKeyInfo.key_states)) - memcpy(fKeyInfo.key_states, data, size); - } else { + // add key states + if (!event->HasData("states", B_UINT8_TYPE)) { event->AddData("states", B_UINT8_TYPE, fKeyInfo.key_states, sizeof(fKeyInfo.key_states)); } - if (fActiveMethod == NULL) - break; - - // we scan for Alt+Space key down events which means we change - // to next input method - // (pressing "shift" will let us switch to the previous method) - - PRINT(("SanitizeEvents: %lx, %x\n", fKeyInfo.modifiers, - fKeyInfo.key_states[KEY_Spacebar >> 3])); - - uint8 byte; - if (event->FindInt8("byte", (int8*)&byte) < B_OK) - byte = 0; - - if (((fKeyInfo.modifiers & B_COMMAND_KEY) != 0 && byte == ' ') - || byte == B_ZENKAKU_HANKAKU) { - SetNextMethod(!(fKeyInfo.modifiers & B_SHIFT_KEY)); - - // this event isn't sent to the user - events.RemoveItemAt(index); - delete event; - continue; - } break; } - - index++; } return true; Modified: haiku/trunk/src/servers/input/InputServer.h =================================================================== --- haiku/trunk/src/servers/input/InputServer.h 2009-02-04 23:03:40 UTC (rev 29134) +++ haiku/trunk/src/servers/input/InputServer.h 2009-02-04 23:37:10 UTC (rev 29135) @@ -195,6 +195,7 @@ void _EventLoop(); static status_t _EventLooper(void *arg); + void _UpdateMouseAndKeys(EventList& events); bool _SanitizeEvents(EventList& events); bool _MethodizeEvents(EventList& events); bool _FilterEvents(EventList& events); From bonefish at mail.berlios.de Thu Feb 5 12:07:21 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 5 Feb 2009 12:07:21 +0100 Subject: [Haiku-commits] r29136 - haiku/trunk/headers/posix Message-ID: <200902051107.n15B7L79014893@sheep.berlios.de> Author: bonefish Date: 2009-02-05 12:07:20 +0100 (Thu, 05 Feb 2009) New Revision: 29136 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29136&view=rev Modified: haiku/trunk/headers/posix/fcntl.h Log: Added O_NDELAY as synonym of O_NONBLOCK. Modified: haiku/trunk/headers/posix/fcntl.h =================================================================== --- haiku/trunk/headers/posix/fcntl.h 2009-02-04 23:37:10 UTC (rev 29135) +++ haiku/trunk/headers/posix/fcntl.h 2009-02-05 11:07:20 UTC (rev 29136) @@ -46,6 +46,7 @@ /* flags for open() and fcntl() */ #define O_CLOEXEC 0x00000040 /* close on exec */ #define O_NONBLOCK 0x00000080 /* non blocking io */ +#define O_NDELAY O_NONBLOCK #define O_APPEND 0x00000800 /* to end of file */ #define O_TEXT 0x00004000 /* CR-LF translation */ #define O_BINARY 0x00008000 /* no translation */ From bonefish at mail.berlios.de Fri Feb 6 13:35:02 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 6 Feb 2009 13:35:02 +0100 Subject: [Haiku-commits] r29137 - haiku/trunk/headers/posix Message-ID: <200902061235.n16CZ2QA024289@sheep.berlios.de> Author: bonefish Date: 2009-02-06 13:35:01 +0100 (Fri, 06 Feb 2009) New Revision: 29137 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29137&view=rev Modified: haiku/trunk/headers/posix/unistd.h Log: Fixed value of _POSIX_VDISABLE. cc_t is unsigned in Haiku. ATM we don't support _POSIX_VDISABLE at all. It's even questionable whether the value (unsigned char)-2 is a good choice. Modified: haiku/trunk/headers/posix/unistd.h =================================================================== --- haiku/trunk/headers/posix/unistd.h 2009-02-05 11:07:20 UTC (rev 29136) +++ haiku/trunk/headers/posix/unistd.h 2009-02-06 12:35:01 UTC (rev 29137) @@ -34,7 +34,8 @@ #define _POSIX_JOB_CONTROL 1 #define _POSIX_NO_TRUNC 0 #define _POSIX_SAVED_IDS 1 -#define _POSIX_VDISABLE ((char) - 2) /* TODO: Check this! */ +#define _POSIX_VDISABLE ((unsigned char)-2) + /* TODO: Check this! */ #define _POSIX_SEMAPHORES (200112L) #define _POSIX_THREADS (200112L) From mmu_man at mail.berlios.de Fri Feb 6 17:21:18 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 6 Feb 2009 17:21:18 +0100 Subject: [Haiku-commits] r29138 - haiku/trunk/src/apps/login Message-ID: <200902061621.n16GLImj001570@sheep.berlios.de> Author: mmu_man Date: 2009-02-06 17:21:17 +0100 (Fri, 06 Feb 2009) New Revision: 29138 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29138&view=rev Modified: haiku/trunk/src/apps/login/LoginApp.cpp haiku/trunk/src/apps/login/LoginApp.h Log: add a --nonmodal option. Modified: haiku/trunk/src/apps/login/LoginApp.cpp =================================================================== --- haiku/trunk/src/apps/login/LoginApp.cpp 2009-02-06 12:35:01 UTC (rev 29137) +++ haiku/trunk/src/apps/login/LoginApp.cpp 2009-02-06 16:21:17 UTC (rev 29138) @@ -30,7 +30,8 @@ LoginApp::LoginApp() : BApplication(kLoginAppSig), - fEditShelfMode(false) + fEditShelfMode(false), + fModalMode(true) { } @@ -107,9 +108,22 @@ { int i; for (i = 1; i < argc; i++) { - printf("[%d]: %s\n", i, argv[i]); - if (argv[i] == BString("--edit")) + BString arg(argv[i]); + //printf("[%d]: %s\n", i, argv[i]); + if (arg == "--edit") fEditShelfMode = true; + else if (arg == "--nonmodal") + fModalMode = false; + else /*if (arg == "--help")*/ { + printf("Login application for Haiku\nUsage:\n"); + printf("%s [--nonmodal] [--edit]\n", argv[0]); + printf("--nonmodal Do not make the window modal\n"); + printf("--edit Launch in Shelf editting mode to " + "allow customizing the desktop.\n"); + // just return to the shell + exit((arg == "--help") ? 0 : 1); + return; + } } } Modified: haiku/trunk/src/apps/login/LoginApp.h =================================================================== --- haiku/trunk/src/apps/login/LoginApp.h 2009-02-06 12:35:01 UTC (rev 29137) +++ haiku/trunk/src/apps/login/LoginApp.h 2009-02-06 16:21:17 UTC (rev 29138) @@ -35,6 +35,7 @@ DesktopWindow* fDesktopWindow; LoginWindow* fLoginWindow; bool fEditShelfMode; + bool fModalMode; }; #endif // _LOGINAPP_H_ From mmu_man at mail.berlios.de Fri Feb 6 17:48:03 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 6 Feb 2009 17:48:03 +0100 Subject: [Haiku-commits] r29139 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200902061648.n16Gm3Q5011937@sheep.berlios.de> Author: mmu_man Date: 2009-02-06 17:48:03 +0100 (Fri, 06 Feb 2009) New Revision: 29139 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29139&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp Log: Do proper unlocking of the KPath when find_directory() fails. This should help with CD boot where find_directory() can't create folders on a read-only media. Modified: haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2009-02-06 16:21:17 UTC (rev 29138) +++ haiku/trunk/src/system/kernel/device_manager/legacy_drivers.cpp 2009-02-06 16:48:03 UTC (rev 29139) @@ -837,7 +837,8 @@ pathBuffer.UnlockBuffer(); pathBuffer.Append("kernel"); AddPath(pathBuffer.Path(), subPath); - } + } else + pathBuffer.UnlockBuffer(); } } else AddPath(path, subPath); @@ -1359,7 +1360,8 @@ start_watching(path.Path(), "dev"); start_watching(path.Path(), "bin"); - } + } else + path.UnlockBuffer(); } sWatching = true; From stippi at mail.berlios.de Fri Feb 6 19:05:14 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Fri, 6 Feb 2009 19:05:14 +0100 Subject: [Haiku-commits] r29140 - haiku/trunk/src/kits/interface/textview_support Message-ID: <200902061805.n16I5EoF024277@sheep.berlios.de> Author: stippi Date: 2009-02-06 19:05:12 +0100 (Fri, 06 Feb 2009) New Revision: 29140 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29140&view=rev Modified: haiku/trunk/src/kits/interface/textview_support/UndoBuffer.cpp Log: Tiny style cleanup. Modified: haiku/trunk/src/kits/interface/textview_support/UndoBuffer.cpp =================================================================== --- haiku/trunk/src/kits/interface/textview_support/UndoBuffer.cpp 2009-02-06 16:48:03 UTC (rev 29139) +++ haiku/trunk/src/kits/interface/textview_support/UndoBuffer.cpp 2009-02-06 18:05:12 UTC (rev 29140) @@ -111,8 +111,8 @@ if ((clip = clipboard->Data())) { clip->AddData("text/plain", B_MIME_TYPE, fTextData, fTextLength); if (fRunArray) - clip->AddData("application/x-vnd.Be-text_run_array", B_MIME_TYPE, - fRunArray, fRunArrayLength); + clip->AddData("application/x-vnd.Be-text_run_array", + B_MIME_TYPE, fRunArray, fRunArrayLength); clipboard->Commit(); } clipboard->Unlock(); From mmlr at mail.berlios.de Fri Feb 6 23:05:21 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Fri, 6 Feb 2009 23:05:21 +0100 Subject: [Haiku-commits] r29141 - buildtools/trunk/gcc/libgcc Message-ID: <200902062205.n16M5Lf2014431@sheep.berlios.de> Author: mmlr Date: 2009-02-06 23:05:19 +0100 (Fri, 06 Feb 2009) New Revision: 29141 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29141&view=rev Modified: buildtools/trunk/gcc/libgcc/config.host Log: Add missing support for ppc and m68k targets. Modified: buildtools/trunk/gcc/libgcc/config.host =================================================================== --- buildtools/trunk/gcc/libgcc/config.host 2009-02-06 18:05:12 UTC (rev 29140) +++ buildtools/trunk/gcc/libgcc/config.host 2009-02-06 22:05:19 UTC (rev 29141) @@ -313,7 +313,7 @@ ;; x86_64-*-freebsd*) ;; -i[34567]86-*-haikuelf* | i[34567]86-*-haiku*) +i[34567]86-*-haiku*) ;; i[34567]86-*-netbsdelf*) ;; @@ -417,6 +417,8 @@ ;; m68k-*-coff*) ;; +m68k-*-haiku*) + ;; m68020-*-elf* | m68k-*-elf*) ;; m68010-*-netbsdelf* | m68k*-*-netbsdelf*) @@ -495,6 +497,8 @@ ;; powerpc*-*-freebsd*) ;; +powerpc-*-haiku*) + ;; powerpc-*-netbsd*) ;; powerpc-*-chorusos*) From mmlr at mail.berlios.de Sat Feb 7 00:09:51 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 7 Feb 2009 00:09:51 +0100 Subject: [Haiku-commits] r29142 - haiku/trunk Message-ID: <200902062309.n16N9p0d022186@sheep.berlios.de> Author: mmlr Date: 2009-02-07 00:09:47 +0100 (Sat, 07 Feb 2009) New Revision: 29142 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29142&view=rev Modified: haiku/trunk/configure Log: Add support for the arm target as well. Not that we'd support it in any way yet. Modified: haiku/trunk/configure =================================================================== --- haiku/trunk/configure 2009-02-06 22:05:19 UTC (rev 29141) +++ haiku/trunk/configure 2009-02-06 23:09:47 UTC (rev 29142) @@ -291,6 +291,7 @@ x86) haikuGCCMachine=i586-pc-haiku;; ppc) haikuGCCMachine=powerpc-apple-haiku;; m68k) haikuGCCMachine=m68k-unknown-haiku;; + arm) haikuGCCMachine=arm-unknown-haiku;; *) echo "Unsupported target architecture: $2" exit 1;; esac From mmlr at mail.berlios.de Sat Feb 7 00:10:35 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 7 Feb 2009 00:10:35 +0100 Subject: [Haiku-commits] r29143 - buildtools/trunk/gcc/libgcc Message-ID: <200902062310.n16NAZvr022350@sheep.berlios.de> Author: mmlr Date: 2009-02-07 00:10:34 +0100 (Sat, 07 Feb 2009) New Revision: 29143 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29143&view=rev Modified: buildtools/trunk/gcc/libgcc/config.host Log: Make the arm target valid as well. Modified: buildtools/trunk/gcc/libgcc/config.host =================================================================== --- buildtools/trunk/gcc/libgcc/config.host 2009-02-06 23:09:47 UTC (rev 29142) +++ buildtools/trunk/gcc/libgcc/config.host 2009-02-06 23:10:34 UTC (rev 29143) @@ -222,6 +222,8 @@ ;; arm*-*-netbsd*) ;; +arm-*-haiku*) + ;; arm*-*-linux*) # ARM GNU/Linux with ELF ;; arm*-*-uclinux*) # ARM ucLinux From mmlr at mail.berlios.de Sat Feb 7 00:47:06 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 7 Feb 2009 00:47:06 +0100 Subject: [Haiku-commits] r29144 - buildtools/trunk/gcc/gcc Message-ID: <200902062347.n16Nl65F006677@sheep.berlios.de> Author: mmlr Date: 2009-02-07 00:46:58 +0100 (Sat, 07 Feb 2009) New Revision: 29144 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29144&view=rev Modified: buildtools/trunk/gcc/gcc/config.gcc Log: Add missing default CPU setting for m68k. Modified: buildtools/trunk/gcc/gcc/config.gcc =================================================================== --- buildtools/trunk/gcc/gcc/config.gcc 2009-02-06 23:10:34 UTC (rev 29143) +++ buildtools/trunk/gcc/gcc/config.gcc 2009-02-06 23:46:58 UTC (rev 29144) @@ -1645,6 +1645,8 @@ extra_parts="crtbegin.o crtend.o" ;; m68k-*-haiku*) + default_m68k_cpu=68020 + default_cf_cpu=5206 tmake_file="m68k/t-m68kbare m68k/t-crtstuff t-haiku" #?? tm_file="${tm_file} dbxelf.h elfos.h haiku.h m68k/haiku.h" tm_defines="MOTOROLA USE_GAS" From mmu_man at mail.berlios.de Sat Feb 7 00:54:40 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 7 Feb 2009 00:54:40 +0100 Subject: [Haiku-commits] r29145 - haiku/trunk/src/apps/login Message-ID: <200902062354.n16Nseql015817@sheep.berlios.de> Author: mmu_man Date: 2009-02-07 00:54:39 +0100 (Sat, 07 Feb 2009) New Revision: 29145 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29145&view=rev Modified: haiku/trunk/src/apps/login/LoginView.cpp Log: Focus the password field on Enter if it's empty and not yet active. Modified: haiku/trunk/src/apps/login/LoginView.cpp =================================================================== --- haiku/trunk/src/apps/login/LoginView.cpp 2009-02-06 23:46:58 UTC (rev 29144) +++ haiku/trunk/src/apps/login/LoginView.cpp 2009-02-06 23:54:39 UTC (rev 29145) @@ -158,6 +158,14 @@ break; case kAttemptLogin: { + // if no pass specified and we were selecting the user, + // give a chance to enter the password + // else we might want to enter an empty password. + if (strlen(fPasswordControl->Text()) < 1 + && (fUserList->IsFocus() || fLoginControl->IsFocus())) { + fPasswordControl->MakeFocus(); + break; + } BMessage *m = new BMessage(kAttemptLogin); m->AddString("login", fLoginControl->Text()); m->AddString("password", fPasswordControl->Text()); From mmlr at mail.berlios.de Sat Feb 7 01:11:25 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 7 Feb 2009 01:11:25 +0100 Subject: [Haiku-commits] r29146 - haiku/trunk/src/kits/device Message-ID: <200902070011.n170BPDM000982@sheep.berlios.de> Author: mmlr Date: 2009-02-07 01:11:22 +0100 (Sat, 07 Feb 2009) New Revision: 29146 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29146&view=rev Modified: haiku/trunk/src/kits/device/USBEndpoint.cpp Log: Fix wrong usage of endpoint address. Modified: haiku/trunk/src/kits/device/USBEndpoint.cpp =================================================================== --- haiku/trunk/src/kits/device/USBEndpoint.cpp 2009-02-06 23:54:39 UTC (rev 29145) +++ haiku/trunk/src/kits/device/USBEndpoint.cpp 2009-02-07 00:11:22 UTC (rev 29146) @@ -223,7 +223,7 @@ uint16 status = 0; Device()->ControlTransfer(USB_REQTYPE_ENDPOINT_IN, USB_REQUEST_GET_STATUS, USB_FEATURE_ENDPOINT_HALT, - fDescriptor.endpoint_address & 0x0f, sizeof(status), &status); + fDescriptor.endpoint_address, sizeof(status), &status); return status != 0; } @@ -233,5 +233,5 @@ { return Device()->ControlTransfer(USB_REQTYPE_ENDPOINT_OUT, USB_REQUEST_CLEAR_FEATURE, USB_FEATURE_ENDPOINT_HALT, - fDescriptor.endpoint_address & 0x0f, 0, NULL); + fDescriptor.endpoint_address, 0, NULL); } From humdingerb at mail.berlios.de Sat Feb 7 15:02:19 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Sat, 7 Feb 2009 15:02:19 +0100 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation Message-ID: <200902071402.n17E2Juo027034@sheep.berlios.de> Author: humdingerb Date: 2009-02-07 15:02:16 +0100 (Sat, 07 Feb 2009) New Revision: 29147 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29147&view=rev Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html Log: Corrected jamming of images, not unnecessarily create root files by first doing a {jam -q} and then {sudo jam -q}. Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html =================================================================== --- haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-02-07 00:11:22 UTC (rev 29146) +++ haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-02-07 14:02:16 UTC (rev 29147) @@ -198,8 +198,14 @@

Now the Haiku image is built and installed on the partition:

+
jam -q @disk
+ +

This takes some time and will abort at some point, because some root permissions are needed. That's OK, we'll continue with:

+
sudo jam -q @disk
+

If you do it all in one go by going straight with the sudo-line, some files are created under the "root" user, among them the image itself. This would then have to be rededicate with chown etc., so best to stick with the 2-stage approach as described.

+

Installing to its own partition offers some interesting possibilities:

sudo jam -q @disk update-all
@@ -214,13 +220,12 @@

Building a VMWare Image

Just enter:

-
sudo jam -q @vmware
+
jam -q @vmware
+sudo jam -q @vmware
-

You'll now have to rededicate the generated image to satisfy the VMPlayer, before you can run it with an associated .vmx file (There's also a .vmx file in haiku/3rdparty/vmware/):

+

The created image can be run in VMPlayer with an associated .vmx file (There's also a .vmx file in haiku/3rdparty/vmware/).

-
sudo chown [YourUsername] haiku.image
-

Booting with GRUB

If you installed Haiku directly onto a USB-stick, you just have to From korli at mail.berlios.de Sat Feb 7 16:18:13 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 7 Feb 2009 16:18:13 +0100 Subject: [Haiku-commits] r29148 - haiku/trunk/src/apps/installer Message-ID: <200902071518.n17FIDAD002035@sheep.berlios.de> Author: korli Date: 2009-02-07 16:18:12 +0100 (Sat, 07 Feb 2009) New Revision: 29148 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29148&view=rev Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp Log: * Truncates Installer menu fields volume labels. This fixes bug #2192. Modified: haiku/trunk/src/apps/installer/InstallerWindow.cpp =================================================================== --- haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-02-07 14:02:16 UTC (rev 29147) +++ haiku/trunk/src/apps/installer/InstallerWindow.cpp 2009-02-07 15:18:12 UTC (rev 29148) @@ -370,28 +370,31 @@ InstallerWindow::AdjustMenus() { PartitionMenuItem *item1 = (PartitionMenuItem *)fSrcMenu->FindMarked(); + BString label; if (item1) { - fSrcMenuField->MenuItem()->SetLabel(item1->MenuLabel()); + label = item1->MenuLabel(); } else { if (fSrcMenu->CountItems() == 0) - fSrcMenuField->MenuItem()->SetLabel(""); + label = ""; else { - fSrcMenuField->MenuItem()->SetLabel( - ((PartitionMenuItem *)fSrcMenu->ItemAt(0))->MenuLabel()); + label = ((PartitionMenuItem *)fSrcMenu->ItemAt(0))->MenuLabel(); } } + fSrcMenuField->TruncateString(&label, B_TRUNCATE_END, 260); + fSrcMenuField->MenuItem()->SetLabel(label.String()); PartitionMenuItem *item2 = (PartitionMenuItem *)fDestMenu->FindMarked(); if (item2) { - fDestMenuField->MenuItem()->SetLabel(item2->MenuLabel()); + label = item2->MenuLabel(); } else { if (fDestMenu->CountItems() == 0) - fDestMenuField->MenuItem()->SetLabel(""); + label = ""; else { - fDestMenuField->MenuItem()->SetLabel( - ((PartitionMenuItem *)fDestMenu->ItemAt(0))->MenuLabel()); + label = ((PartitionMenuItem *)fDestMenu->ItemAt(0))->MenuLabel(); } } + fDestMenuField->TruncateString(&label, B_TRUNCATE_END, 260); + fDestMenuField->MenuItem()->SetLabel(label.String()); char message[255]; sprintf(message, "Press the Begin button to install from '%s' onto '%s'", item1 ? item1->Name() : "null", item2 ? item2->Name() : "null"); From korli at mail.berlios.de Sat Feb 7 16:43:19 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 7 Feb 2009 16:43:19 +0100 Subject: [Haiku-commits] r29149 - haiku/trunk/src/apps/drivesetup Message-ID: <200902071543.n17FhJv8004503@sheep.berlios.de> Author: korli Date: 2009-02-07 16:43:19 +0100 (Sat, 07 Feb 2009) New Revision: 29149 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29149&view=rev Modified: haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp Log: added a max length for the name text control in DriveSetup. it's atm the max value for bfs volumes. added a TODO as it should depend of the fs type. Modified: haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp =================================================================== --- haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp 2009-02-07 15:18:12 UTC (rev 29148) +++ haiku/trunk/src/apps/drivesetup/InitParamsPanel.cpp 2009-02-07 15:43:19 UTC (rev 29149) @@ -81,6 +81,8 @@ AddCommonFilter(fEscapeFilter); fNameTC = new BTextControl("Name", NULL, NULL); + // TODO find out what is the max length for this specific FS partition name + fNameTC->TextView()->SetMaxBytes(31); BPopUpMenu* blocksizeMenu = new BPopUpMenu("Blocksize"); BMessage* message = new BMessage(MSG_BLOCK_SIZE); From umccullough at gmail.com Sat Feb 7 16:47:27 2009 From: umccullough at gmail.com (Urias McCullough) Date: Sat, 7 Feb 2009 07:47:27 -0800 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <200902071402.n17E2Juo027034@sheep.berlios.de> References: <200902071402.n17E2Juo027034@sheep.berlios.de> Message-ID: <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> On Sat, Feb 7, 2009 at 6:02 AM, wrote: > Author: humdingerb > Date: 2009-02-07 15:02:16 +0100 (Sat, 07 Feb 2009) > New Revision: 29147 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29147&view=rev > > Modified: > haiku/trunk/docs/userguide/en/installation/install-source-linux.html > Log: > Corrected jamming of images, not unnecessarily create root files by first doing a {jam -q} and then {sudo jam -q}. IMO, we shouldn't be telling people to use "sudo jam" at all any longer... From anevilyak at mail.berlios.de Sat Feb 7 17:17:38 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 7 Feb 2009 17:17:38 +0100 Subject: [Haiku-commits] r29150 - haiku/trunk/src/bin/desklink Message-ID: <200902071617.n17GHcg5007472@sheep.berlios.de> Author: anevilyak Date: 2009-02-07 17:17:38 +0100 (Sat, 07 Feb 2009) New Revision: 29150 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29150&view=rev Modified: haiku/trunk/src/bin/desklink/VolumeSlider.cpp Log: Fix uninitialized string that was causing the deskbar volume control replicant to crash randomly. Modified: haiku/trunk/src/bin/desklink/VolumeSlider.cpp =================================================================== --- haiku/trunk/src/bin/desklink/VolumeSlider.cpp 2009-02-07 15:43:19 UTC (rev 29149) +++ haiku/trunk/src/bin/desklink/VolumeSlider.cpp 2009-02-07 16:17:38 UTC (rev 29150) @@ -250,7 +250,7 @@ float value = 0.0; fDontBeep = dontBeep; - const char *errString; + const char *errString = NULL; fMixerControl = new MixerControl(volumeWhich, &value, &errString); BBox *box = new BBox(Bounds(), "sliderbox", B_FOLLOW_LEFT | B_FOLLOW_TOP, @@ -381,8 +381,7 @@ SetHighColor(156,154,156); FillRect(BRect(position,3,192,13)); - BFont font; - float width = font.StringWidth(fTitle); + float width = be_plain_font->StringWidth(fTitle); SetHighColor(49,154,49); DrawString(fTitle, BPoint(11 + (192-11-width)/2, 12)); From anevilyak at mail.berlios.de Sat Feb 7 17:55:14 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 7 Feb 2009 17:55:14 +0100 Subject: [Haiku-commits] r29151 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200902071655.n17GtEQX011270@sheep.berlios.de> Author: anevilyak Date: 2009-02-07 17:55:13 +0100 (Sat, 07 Feb 2009) New Revision: 29151 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29151&view=rev Modified: haiku/trunk/headers/os/interface/ChannelSlider.h haiku/trunk/src/kits/interface/ChannelSlider.cpp Log: ChannelSlider now sends notifications while being dragged, thus allowing the volume to be manipulated in realtime from the media prefs, rather than on mouseup only. Fixes ticket #3338. Modified: haiku/trunk/headers/os/interface/ChannelSlider.h =================================================================== --- haiku/trunk/headers/os/interface/ChannelSlider.h 2009-02-07 16:17:38 UTC (rev 29150) +++ haiku/trunk/headers/os/interface/ChannelSlider.h 2009-02-07 16:55:13 UTC (rev 29151) @@ -121,7 +121,7 @@ uint32 _reserved_[12]; void _InitData(); - void _FinishChange(); + void _FinishChange(bool update = false); void _UpdateFontDimens(); void _DrawThumbs(); void _DrawGrooveFrame(BView* where, const BRect& area); Modified: haiku/trunk/src/kits/interface/ChannelSlider.cpp =================================================================== --- haiku/trunk/src/kits/interface/ChannelSlider.cpp 2009-02-07 16:17:38 UTC (rev 29150) +++ haiku/trunk/src/kits/interface/ChannelSlider.cpp 2009-02-07 16:55:13 UTC (rev 29151) @@ -677,7 +677,7 @@ void -BChannelSlider::_FinishChange() +BChannelSlider::_FinishChange(bool update) { if (fInitialValues != NULL) { bool *inMask = NULL; @@ -690,11 +690,13 @@ inMask[fCurrentChannel] = true; } } - InvokeChannel(NULL, 0, numChannels, inMask); + InvokeChannel(update ? NULL : ModificationMessage(), 0, numChannels, inMask); } - SetTracking(false); - _Redraw(); + if (!update) { + SetTracking(false); + _Redraw(); + } } @@ -863,6 +865,9 @@ else SetValueFor(fCurrentChannel, value); + if (ModificationMessage()) + _FinishChange(true); + _DrawThumbs(); } From anevilyak at mail.berlios.de Sat Feb 7 17:59:09 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 7 Feb 2009 17:59:09 +0100 Subject: [Haiku-commits] r29152 - haiku/trunk/src/kits/interface Message-ID: <200902071659.n17Gx9ZS011545@sheep.berlios.de> Author: anevilyak Date: 2009-02-07 17:59:09 +0100 (Sat, 07 Feb 2009) New Revision: 29152 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29152&view=rev Modified: haiku/trunk/src/kits/interface/ChannelSlider.cpp Log: Oops. Fix backwards conditional. Modified: haiku/trunk/src/kits/interface/ChannelSlider.cpp =================================================================== --- haiku/trunk/src/kits/interface/ChannelSlider.cpp 2009-02-07 16:55:13 UTC (rev 29151) +++ haiku/trunk/src/kits/interface/ChannelSlider.cpp 2009-02-07 16:59:09 UTC (rev 29152) @@ -690,7 +690,7 @@ inMask[fCurrentChannel] = true; } } - InvokeChannel(update ? NULL : ModificationMessage(), 0, numChannels, inMask); + InvokeChannel(update ? ModificationMessage() : NULL, 0, numChannels, inMask); } if (!update) { From humdingerb at googlemail.com Sat Feb 7 18:18:06 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sat, 07 Feb 2009 18:18:06 +0100 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> References: <200902071402.n17E2Juo027034@sheep.berlios.de> <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> Message-ID: <498DC24E.30002@googlemail.com> Urias McCullough wrote: >> Corrected jamming of images, not unnecessarily create root files by first doing a {jam -q} and then {sudo jam -q}. > > IMO, we shouldn't be telling people to use "sudo jam" at all any longer... I don't know any better. :) How are you supposed to jam an image? Without "sudo" the process aborts at some point. For me, i.e. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From umccullough at gmail.com Sat Feb 7 18:39:09 2009 From: umccullough at gmail.com (Urias McCullough) Date: Sat, 7 Feb 2009 09:39:09 -0800 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <498DC24E.30002@googlemail.com> References: <200902071402.n17E2Juo027034@sheep.berlios.de> <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> <498DC24E.30002@googlemail.com> Message-ID: <1e80d8750902070939r5f250b95r25654d6f2c339a77@mail.gmail.com> On Sat, Feb 7, 2009 at 9:18 AM, Humdinger wrote: > Urias McCullough wrote: >>> Corrected jamming of images, not unnecessarily create root files by first doing a {jam -q} and then {sudo jam -q}. >> >> IMO, we shouldn't be telling people to use "sudo jam" at all any longer... > > I don't know any better. :) > How are you supposed to jam an image? Without "sudo" the process aborts at some point. For > me, i.e. Probably because root owns everything in your generated folder :( (you can probably chown them back to yourself - or even delete attributes/objects/temp, etc. and re-create them) The only reason to use sudo would be to gain root privs when writing it to a partition, but that can be avoided by chmod'ing the necessary /dev nodes I use the following process to jam to my partitions: sudo chmod o+r /dev/sda sudo chmod o+rw /dev/sda2 jam -q @disk Note the @disk assumes the use of a build profile named "disk" (much better than setting the HAIKU_IMAGE_DIR/HAIKU_IMAGE_NAME variables) On another slightly related note, I'm a bit surprised to see that we have instructions in the user guide for building Haiku to a partition - that just seems so not-user-oriented. There are a large number of configurations and variables that are bound to pop up for people trying to build Haiku from their host system moving forward, and it just seems like such a pointless thing to document in a user guide. - Urias From anevilyak at gmail.com Sat Feb 7 18:39:42 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 7 Feb 2009 11:39:42 -0600 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <498DC24E.30002@googlemail.com> References: <200902071402.n17E2Juo027034@sheep.berlios.de> <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> <498DC24E.30002@googlemail.com> Message-ID: On Sat, Feb 7, 2009 at 11:18 AM, Humdinger wrote: > I don't know any better. :) > How are you supposed to jam an image? Without "sudo" the process aborts at some point. For > me, i.e. You just have to set the permissions on the device (i.e. /dev/sda1) such that your user can write to them. In most cases doing a sudo chmod o+w /dev/sda1 once will suffice, and then just a regular jam -q will be able to write the image without sudo ever being needed again. Regards, Rene From humdingerb at googlemail.com Sat Feb 7 20:01:14 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sat, 07 Feb 2009 20:01:14 +0100 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <1e80d8750902070939r5f250b95r25654d6f2c339a77@mail.gmail.com> References: <200902071402.n17E2Juo027034@sheep.berlios.de> <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> <498DC24E.30002@googlemail.com> <1e80d8750902070939r5f250b95r25654d6f2c339a77@mail.gmail.com> Message-ID: <498DDA7A.5070500@googlemail.com> Urias McCullough wrote: > Probably because root owns everything in your generated folder :( (you > can probably chown them back to yourself - or even delete > attributes/objects/temp, etc. and re-create them) I just deleted everything in the generated folder aside from downloads and re-configured. > The only reason to use sudo would be to gain root privs when writing > it to a partition, but that can be avoided by chmod'ing the necessary > /dev nodes > > I use the following process to jam to my partitions: > > sudo chmod o+r /dev/sda > sudo chmod o+rw /dev/sda2 > jam -q @disk The chmods are in the guide. Now, I did just the above and you're totally right! Obviously, I have messed up some permissions in the generated folder. I'll change instructions accordingly. > On another slightly related note, I'm a bit surprised to see that we > have instructions in the user guide for building Haiku to a partition > - that just seems so not-user-oriented. That was my thought in the beginning also. OTOH since the need for compiling/installing from source will probably remain until R1 or at least a beta, and that may be many months off, I was convinced that it makes sense to include instructions for the early adopting, beleadingedge users out there. Once R1 (or some advanced beta) is out with the final installation method working (mayhaps an iso), these instruction will be replaced with the Haiku Approved Method(tm) or at least relegated to an advanced section. I followed these instructions, which were garnered from various forum posts, and didn't have any problems. That, being a relative Linux newbie and almost never having to build stuff myself. OK, that sudo business wasn't quite right, but with your help we're getting there. :) Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From humdingerb at googlemail.com Sat Feb 7 20:03:05 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sat, 07 Feb 2009 20:03:05 +0100 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: References: <200902071402.n17E2Juo027034@sheep.berlios.de> <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> <498DC24E.30002@googlemail.com> Message-ID: <498DDAE9.2070505@googlemail.com> Rene Gollent wrote: > You just have to set the permissions on the device (i.e. /dev/sda1) > such that your user can write to them. In most cases doing a sudo > chmod o+w /dev/sda1 once will suffice, and then just a regular jam -q > will be able to write the image without sudo ever being needed again. Yeah. Apparently I bungled some permissions in the generated folder. Probably by being lazy and doing a "sudo jam -q" because I forgot to chmod the partition... Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From umccullough at gmail.com Sat Feb 7 20:23:28 2009 From: umccullough at gmail.com (Urias McCullough) Date: Sat, 7 Feb 2009 11:23:28 -0800 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <498DDA7A.5070500@googlemail.com> References: <200902071402.n17E2Juo027034@sheep.berlios.de> <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> <498DC24E.30002@googlemail.com> <1e80d8750902070939r5f250b95r25654d6f2c339a77@mail.gmail.com> <498DDA7A.5070500@googlemail.com> Message-ID: <1e80d8750902071123oc55fdbbj194d8e61e15df245@mail.gmail.com> On Sat, Feb 7, 2009 at 11:01 AM, Humdinger wrote: > Urias McCullough wrote: >> On another slightly related note, I'm a bit surprised to see that we >> have instructions in the user guide for building Haiku to a partition >> - that just seems so not-user-oriented. > > That was my thought in the beginning also. OTOH since the need for compiling/installing > from source will probably remain until R1 or at least a beta, and that may be many months > off, I was convinced that it makes sense to include instructions for the early adopting, > beleadingedge users out there. > Once R1 (or some advanced beta) is out with the final installation method working (mayhaps > an iso), these instruction will be replaced with the Haiku Approved Method(tm) or at least > relegated to an advanced section. > > I followed these instructions, which were garnered from various forum posts, and didn't > have any problems. That, being a relative Linux newbie and almost never having to build > stuff myself. OK, that sudo business wasn't quite right, but with your help we're getting > there. :) I think my current dislike for the "guides" and "forum posts" is that there's no collaborative location where people can improve on the instructions and add information for other platforms and configurations. For example, there's very little explanation of how to add optional packages, or include extra drivers that aren't in the default image, no central location that explains building on Mac OSX or Cygwin as well as Linux, nor is there much information on build profiles, etc. It just seems that people stumble across a guide and use it, and then land in #haiku when it doesn't work as they expected. I'd personally prefer a wiki that anyone can edit for this type of documentation, with collaborative, centralized, multi-page content. At that point, I'd recommend going back to every guide or forum post and place a giant link at the top pointing to the wiki content. Often times, there is some small bit of advice that is given when someone is reading the guide and trying to make it work on their own environment (like for example, 64bit arch linux)... the situation screams wiki to me. From korli at mail.berlios.de Sat Feb 7 21:05:40 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 7 Feb 2009 21:05:40 +0100 Subject: [Haiku-commits] r29153 - haiku/trunk/src/system/libroot/posix/glibc/libio Message-ID: <200902072005.n17K5e6D015113@sheep.berlios.de> Author: korli Date: 2009-02-07 21:05:39 +0100 (Sat, 07 Feb 2009) New Revision: 29153 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29153&view=rev Modified: haiku/trunk/src/system/libroot/posix/glibc/libio/Jamfile haiku/trunk/src/system/libroot/posix/glibc/libio/wfileops.c Log: activated wfileops.c instead of wfilestubs.c, commented out mmap stuff (as in fileops.c) Modified: haiku/trunk/src/system/libroot/posix/glibc/libio/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/libio/Jamfile 2009-02-07 16:59:09 UTC (rev 29152) +++ haiku/trunk/src/system/libroot/posix/glibc/libio/Jamfile 2009-02-07 20:05:39 UTC (rev 29153) @@ -88,7 +88,7 @@ vasprintf.c vscanf.c vsnprintf.c - wfile_stubs.c +# wfile_stubs.c # wide character @@ -115,8 +115,8 @@ vswprintf.c vwprintf.c # vwscanf.c -# wfiledoalloc.c -# wfileops.c + wfiledoalloc.c + wfileops.c wgenops.c wprintf.c # wscanf.c Modified: haiku/trunk/src/system/libroot/posix/glibc/libio/wfileops.c =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/libio/wfileops.c 2009-02-07 16:59:09 UTC (rev 29152) +++ haiku/trunk/src/system/libroot/posix/glibc/libio/wfileops.c 2009-02-07 20:05:39 UTC (rev 29153) @@ -292,6 +292,7 @@ INTDEF(_IO_wfile_underflow) +#ifdef HAVE_MMAP static wint_t _IO_wfile_underflow_mmap (_IO_FILE *fp) { @@ -365,6 +366,7 @@ return _IO_WUNDERFLOW (fp); } +#endif wint_t @@ -882,6 +884,7 @@ INTVARDEF(_IO_wfile_jumps) +#ifdef HAVE_MMAP struct _IO_jump_t _IO_wfile_jumps_mmap = { JUMP_INIT_DUMMY, @@ -929,3 +932,4 @@ JUMP_INIT(showmanyc, _IO_default_showmanyc), JUMP_INIT(imbue, _IO_default_imbue) }; +#endif From mmlr at mail.berlios.de Sun Feb 8 00:09:01 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 8 Feb 2009 00:09:01 +0100 Subject: [Haiku-commits] r29154 - haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid Message-ID: <200902072309.n17N91Up001839@sheep.berlios.de> Author: mmlr Date: 2009-02-08 00:09:00 +0100 (Sun, 08 Feb 2009) New Revision: 29154 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29154&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp Log: * Correctly handle the phantom state. In this state we don't have any valid key information and we must not overwrite the last valid buffer. Otherwise we generate spurious key ups when entering and spurious key downs when leaving the phantom state. * Implement getting/setting of keyboard repeat delay and rate so they become settable by the keyboard preferences. * Rework repeat handling a bit. With a large enough repeat delay (i.e. bigger than the report interval of the device) we would never get the timeout case and therefore never start repeating. Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2009-02-07 20:05:39 UTC (rev 29153) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2009-02-07 23:09:00 UTC (rev 29154) @@ -65,6 +65,8 @@ { switch (op) { case KB_READ: + { + bigtime_t enterTime = system_time(); while (_RingBufferReadable() == 0) { if (!_IsTransferUnprocessed()) { status_t result = _ScheduleTransfer(); @@ -82,24 +84,69 @@ _SetTransferProcessed(); if (result != B_OK) return result; - } else if (result == B_TIMED_OUT && IsOpen()) { - // this case is for handling key repeats, it means - // no interrupt transfer has happened + } else if (result != B_TIMED_OUT) + return result; + + if (!IsOpen()) + return B_ERROR; + + if (_RingBufferReadable() == 0 && fCurrentRepeatKey != 0 + && system_time() - enterTime > fCurrentRepeatDelay) { + // this case is for handling key repeats, it means no + // interrupt transfer has happened or it didn't produce any + // new key events, but a repeated key down is due _WriteKey(fCurrentRepeatKey, true); + // the next timeout is reduced to the repeat_rate fCurrentRepeatDelay = fRepeatRate; break; - } else - return result; + } } // process what is in the ring_buffer, it could be written // there because we handled an interrupt transfer or because // we wrote the current repeat key return _RingBufferRead(buffer, sizeof(raw_key_info)); + } case KB_SET_LEDS: - return _SetLEDs((uint8 *)buffer); + { + uint8 ledData[4]; + if (user_memcpy(ledData, buffer, sizeof(ledData)) != B_OK) + return B_BAD_ADDRESS; + return _SetLEDs(ledData); + } + + case KB_SET_KEY_REPEAT_RATE: + { + int32 repeatRate; + if (user_memcpy(&repeatRate, buffer, sizeof(repeatRate)) != B_OK) + return B_BAD_ADDRESS; + + if (repeatRate == 0 || repeatRate > 1000000) + return B_BAD_VALUE; + + fRepeatRate = 10000000 / repeatRate; + return B_OK; + } + + case KB_GET_KEY_REPEAT_RATE: + { + int32 repeatRate = 10000000 / fRepeatRate; + if (user_memcpy(buffer, &repeatRate, sizeof(repeatRate)) != B_OK) + return B_BAD_ADDRESS; + return B_OK; + } + + case KB_SET_KEY_REPEAT_DELAY: + if (user_memcpy(&fRepeatDelay, buffer, sizeof(fRepeatDelay)) != B_OK) + return B_BAD_ADDRESS; + return B_OK; + + case KB_GET_KEY_REPEAT_DELAY: + if (user_memcpy(buffer, &fRepeatDelay, sizeof(fRepeatDelay)) != B_OK) + return B_BAD_ADDRESS; + return B_OK; } TRACE_ALWAYS("keyboard device unhandled control 0x%08lx\n", op); @@ -319,6 +366,22 @@ _WriteKey(sModifierTable[i], (fTransferBuffer[0] >> i) & 1); } + bool phantomState = true; + for (size_t i = 2; i < fTotalReportSize; i++) { + if (fTransferBuffer[i] != 0x01) { + phantomState = false; + break; + } + } + + if (phantomState) { + // no valid key information is present in this state and we don't + // want to overwrite our last buffer as otherwise we generate + // spurious key ups now and spurious key downs when leaving the + // phantom state again + return B_OK; + } + bool keyDown = false; uint8 *current = fLastTransferBuffer; uint8 *compare = fTransferBuffer; From anevilyak at mail.berlios.de Sun Feb 8 02:05:35 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 8 Feb 2009 02:05:35 +0100 Subject: [Haiku-commits] r29155 - haiku/trunk/src/kits/tracker Message-ID: <200902080105.n1815Zkv004939@sheep.berlios.de> Author: anevilyak Date: 2009-02-08 02:05:34 +0100 (Sun, 08 Feb 2009) New Revision: 29155 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29155&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp haiku/trunk/src/kits/tracker/PoseView.h Log: Tracker now alters the cursor to indicate the resulting FS op when drag and dropping files. If the op is determined to be a copy, the copy cursor from Wonderbrush (thanks Stephan!) is displayed. Otherwise, the default hand cursor is used to indicate move. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-07 23:09:00 UTC (rev 29154) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-08 01:05:34 UTC (rev 29155) @@ -131,6 +131,18 @@ // maximum size of the transparent drag bitmap, use a drag rect // if larger in any direction +const unsigned char kCopyCursor[] = { 16, 1, 1, 1, + 0x00, 0x00, 0x70, 0x00, 0x48, 0x00, 0x48, 0x00, + 0x27, 0xc0, 0x24, 0xb8, 0x12, 0x54, 0x10, 0x02, + 0x79, 0xe2, 0x99, 0x22, 0x85, 0x7a, 0x61, 0x4a, + 0x19, 0xca, 0x04, 0x4a, 0x02, 0x78, 0x00, 0x00, + + 0x00, 0x00, 0x70, 0x00, 0x78, 0x00, 0x78, 0x00, + 0x3f, 0xc0, 0x3f, 0xf8, 0x1f, 0xfc, 0x1f, 0xfe, + 0x7f, 0xfe, 0xff, 0xfe, 0xff, 0xfe, 0x7f, 0xfe, + 0x1f, 0xfe, 0x07, 0xfe, 0x03, 0xf8, 0x00, 0x00 +}; + const char *kNoCopyToTrashStr = "Sorry, you can't copy items to the Trash."; const char *kNoLinkToTrashStr = "Sorry, you can't create links in the Trash."; const char *kNoCopyToRootStr = "You must drop items on one of the disk icons " @@ -217,6 +229,7 @@ fIsDesktopWindow(false), fIsWatchingDateFormatChange(false), fHasPosesInClipboard(false), + fCursorCheck(false), fLastKeyTime(0), fLastDeskbarFrameCheckTime(LONGLONG_MIN), fDeskbarFrame(0, 0, -1, -1) @@ -3854,6 +3867,10 @@ BPoseView::HandleMessageDropped(BMessage *message) { ASSERT(message->WasDropped()); + + // reset system cursor in case it was altered by drag and drop + SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); + fCursorCheck = false; if (!fDropEnabled) return false; @@ -4345,6 +4362,18 @@ } +static bool +CheckDevicesEqual(const entry_ref *srcRef, Model *targetModel) +{ + BDirectory destDir (targetModel->EntryRef()); + struct stat deststat; + destDir.GetStat(&deststat); + + return srcRef->device == deststat.st_dev; + +} + + void BPoseView::MoveSelectionInto(Model *destFolder, BContainerWindow *srcWindow, bool forceCopy, bool forceMove, bool createLink, bool relativeLink) @@ -4487,12 +4516,7 @@ moveMode = kCreateLink; else { moveMode = kMoveSelectionTo; - entry_ref *srcRef = srcList->ItemAt(0); - BDirectory destDir (destEntry); - struct stat deststat; - destDir.GetStat(&deststat); - - if (srcRef->device != deststat.st_dev) + if (!CheckDevicesEqual(srcList->ItemAt(0), destFolder)) moveMode = kCopySelectionTo; } @@ -7556,7 +7580,7 @@ if (onlyQueries) // this is used to make query templates come up in a special edit window - message.AddBool("editQueryOnPose", &onlyQueries); + message.AddBool("editQueryOnPose", onlyQueries); BMessenger(kTrackerSignature).SendMessage(&message); } @@ -8604,6 +8628,9 @@ } case B_EXITED_VIEW: + // reset cursor in case we set it to the copy cursor in UpdateDropTarget + SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); + fCursorCheck = false; // TODO: autoscroll here if (!window->ContextMenu()) { HiliteDropTarget(false); @@ -8623,11 +8650,12 @@ int32 index; BPose *targetPose = FindPose(mouseLoc, &index); - if (targetPose == fDropTarget + if (fCursorCheck && targetPose == fDropTarget || (trackingContextMenu && !targetPose)) // no change return false; - + + fCursorCheck = true; if (fDropTarget && !DragSelectionContains(fDropTarget, dragMessage)) HiliteDropTarget(false); @@ -8645,10 +8673,24 @@ bool ignoreTypes = (modifiers() & B_CONTROL_KEY) != 0; if (targetPose && CanHandleDragSelection(targetModel, dragMessage, ignoreTypes)) { // new target is valid, select it - HiliteDropTarget(true); - } else + HiliteDropTarget(true); + } else { fDropTarget = NULL; + if (targetPose == NULL) + targetModel = TargetModel(); + } + entry_ref srcRef; + if (targetModel->IsDirectory() && dragMessage->HasRef("refs") + && dragMessage->FindRef("refs", &srcRef) == B_OK) { + if (!CheckDevicesEqual(&srcRef, targetModel)) { + BCursor copyCursor(kCopyCursor); + SetViewCursor(©Cursor); + return true; + } + } + + SetViewCursor(B_CURSOR_SYSTEM_DEFAULT); return true; } Modified: haiku/trunk/src/kits/tracker/PoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.h 2009-02-07 23:09:00 UTC (rev 29154) +++ haiku/trunk/src/kits/tracker/PoseView.h 2009-02-08 01:05:34 UTC (rev 29155) @@ -648,7 +648,7 @@ bool fIsDesktopWindow : 1; bool fIsWatchingDateFormatChange : 1; bool fHasPosesInClipboard : 1; - + bool fCursorCheck : 1; BRect fStartFrame; BRect fSelectionRect; From oruizdorantes at mail.berlios.de Sun Feb 8 02:56:18 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Sun, 8 Feb 2009 02:56:18 +0100 Subject: [Haiku-commits] r29156 - haiku/trunk/src/servers/bluetooth Message-ID: <200902080156.n181uI7A013516@sheep.berlios.de> Author: oruizdorantes Date: 2009-02-08 02:56:16 +0100 (Sun, 08 Feb 2009) New Revision: 29156 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29156&view=rev Modified: haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp Log: This allows that 2 or more LocalDevices can be retrieved with repeated calls of LocalDevice::GetLocalDevice() Modified: haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp =================================================================== --- haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp 2009-02-08 01:05:34 UTC (rev 29155) +++ haiku/trunk/src/servers/bluetooth/BluetoothServer.cpp 2009-02-08 01:56:16 UTC (rev 29156) @@ -226,7 +226,7 @@ ssize_t size; bdaddr_t bdaddr; LocalDeviceImpl* ldi = NULL; - int32 index = 0; + static int32 lastIndex = 0; if (message->FindInt32("hci_id", &hid) == B_OK) { @@ -239,38 +239,56 @@ /* Try to find out when the user specified the address */ Output::Instance()->Post("GetLocalDevice requested with bdaddr\n", BLACKBOARD_KIT); - for (index = 0; index < fLocalDevicesList.CountItems(); index ++) { - bdaddr_t local; - ldi = fLocalDevicesList.ItemAt(index); - // TODO: Only if the property is available + for (lastIndex = 0; lastIndex < fLocalDevicesList.CountItems(); lastIndex ++) { + //TODO: Only possible if the property is available + //bdaddr_t local; + //ldi = fLocalDevicesList.ItemAt(lastIndex); //if ((ldi->GetAddress(&local, message) == B_OK) // && bacmp(&local, &bdaddr)) { // break; //} } - } else { - /* Careless, any device not performing operations will be fine */ - Output::Instance()->Post("GetLocalDevice requested\n", BLACKBOARD_KIT); - for (index = 0; index < fLocalDevicesList.CountItems(); index ++) { + } else { + // Careless, any device not performing operations will be fine + Output::Instance()->Post("GetLocalDevice plain request\n", BLACKBOARD_KIT); + // from last assigned till end + for ( int index = lastIndex + 1; index < fLocalDevicesList.CountItems(); index ++) { + ldi = fLocalDevicesList.ItemAt(index); + printf("Requesting local device %ld\n", ldi->GetID()); + if (ldi != NULL && ldi->Available()) + { + Output::Instance()->Postf(BLACKBOARD_KIT, "Device available: %lx\n", ldi->GetID()); + lastIndex = index; + break; + } + } + + // from starting till last assigned if not yet found + if (ldi == NULL) { + for ( int index = 0; index <= lastIndex ; index ++) { ldi = fLocalDevicesList.ItemAt(index); printf("Requesting local device %ld\n", ldi->GetID()); if (ldi != NULL && ldi->Available()) { - printf("dev ours %ld\n", ldi->GetID()); + Output::Instance()->Postf(BLACKBOARD_KIT, "Device available: %lx\n", ldi->GetID()); + lastIndex = index; break; } - } + } } + } - if (index <= fLocalDevicesList.CountItems() && ldi != NULL && ldi->Available()) { - Output::Instance()->Post("Device acquired\n", BLACKBOARD_KIT); + if (lastIndex <= fLocalDevicesList.CountItems() && ldi != NULL && ldi->Available()) { + hid = ldi->GetID(); ldi->Acquire(); + + Output::Instance()->Postf(BLACKBOARD_KIT, "Device acquired %lx\n", hid); return reply->AddInt32("hci_id", hid); } - + return B_ERROR; - + } From humdingerb at googlemail.com Sun Feb 8 08:52:15 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sun, 08 Feb 2009 08:52:15 +0100 Subject: [Haiku-commits] r29147 - haiku/trunk/docs/userguide/en/installation In-Reply-To: <1e80d8750902071123oc55fdbbj194d8e61e15df245@mail.gmail.com> References: <200902071402.n17E2Juo027034@sheep.berlios.de> <1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com> <498DC24E.30002@googlemail.com> <1e80d8750902070939r5f250b95r25654d6f2c339a77@mail.gmail.com> <498DDA7A.5070500@googlemail.com> <1e80d8750902071123oc55fdbbj194d8e61e15df245@mail.gmail.com> Message-ID: <498E8F2F.1090809@googlemail.com> Urias McCullough wrote: > I think my current dislike for the "guides" and "forum posts" is that > there's no collaborative location where people can improve on the > instructions and add information for other platforms and > configurations. Originally, the user guide was supposed to be created as a wiki. But for some reason it never happened on haiku-os.org, so it was started at haikuware.com. Since using and reading their Hiki isn't ideal, it soon wandered directly into SVN. Right now, with the additional requirement of translations, it goes back to more of a wiki approach. Maybe that will help relieve your dislike. OTOH, there won't be write permission for everyone as it naturally needs some coordination. IMO corrections and additions should be discussed on the doc mailing list. > For example, there's very little explanation of how to add optional > packages, or include extra drivers that aren't in the default image, > no central location that explains building on Mac OSX or Cygwin as > well as Linux, nor is there much information on build profiles, etc. Philippe Groake is still working on those other platforms. Let's see how it turns out. I admit that the topic of optional packages and build profiles could be much more detailed. But this would quickly turn into more of a buildsystem guide. And though the whole installation-from-source business is only temporarily a user guide issue, I think we should keep the intended reader in focus. > It just seems that people stumble across a guide and use it, and then > land in #haiku when it doesn't work as they expected. If a #haiku denizen could collect these FAQs we could see where exactly things need more explaining. This isn't quite the right place for this discussion. The general or doc mailing list would be more appropriate. :) Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From humdingerb at mail.berlios.de Sun Feb 8 09:12:28 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Sun, 8 Feb 2009 09:12:28 +0100 Subject: [Haiku-commits] r29157 - haiku/trunk/docs/userguide/en/installation Message-ID: <200902080812.n188CSqT005793@sheep.berlios.de> Author: humdingerb Date: 2009-02-08 09:12:26 +0100 (Sun, 08 Feb 2009) New Revision: 29157 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29157&view=rev Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html Log: Hopefully now correct procedure without use of sudo. Also added OptionalPackages to the mix. Some formatting stuff. Modified: haiku/trunk/docs/userguide/en/installation/install-source-linux.html =================================================================== --- haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-02-08 01:56:16 UTC (rev 29156) +++ haiku/trunk/docs/userguide/en/installation/install-source-linux.html 2009-02-08 08:12:26 UTC (rev 29157) @@ -84,20 +84,30 @@

You start by duplicating the UserBuildConfig.sample and the remove the.sample suffix to get your UserBuildConfig. From the .ReadMe you can copy interesting parts into your config and customize them there.

    -
  1. First, the line needed for the optional "OpenSSH" package:

    +
  2. First, the line is needed for the optional "OpenSSH" package:

    HAIKU_IMAGE_HOST_NAME = "TEST" ;
  3. +
  4. There are several optional software packages available, that are dowloaded at build time if they haven't been so already. For a list of all available packages, see haiku/trunk/build/jam/OptionalPackages. Here's an example:

    +
    # Add these optional packages.
    +AddOptionalHaikuImagePackages Beam ;
    +AddOptionalHaikuImagePackages BeHappy ;
    +AddOptionalHaikuImagePackages BePDF ;
    +AddOptionalHaikuImagePackages Firefox ;
    +AddOptionalHaikuImagePackages NetSurf ;
    +AddOptionalHaikuImagePackages OpenSSL ;
    +AddOptionalHaikuImagePackages OpenSSH ;
    +AddOptionalHaikuImagePackages Pe ;
    +AddOptionalHaikuImagePackages Vision ;
    +AddOptionalHaikuImagePackages Welcome ;
    +AddOptionalHaikuImagePackages WonderBrush ;
    +
  5. Now the block that sets the defaults for timezone and keymap:

    # Add symlink/file (timezone and keymap settings) to the image.
     AddSymlinkToHaikuImage home config settings
     	: /boot/beos/etc/timezones/Europe/Paris : timezone ;
     AddFilesToHaikuImage home config settings : German 
     	: Key_map ;
  6. -
  7. The build process can be fine tuned until it fits your needs. You could create your own folder haiku/trunk/user_data/ -and put files there that are then copied or unzipped into the image. -Zipping is important when dealing with Haiku files with their -attributes, because zipping them up will preserve them on non-BFS -partitions.
    +

  8. The build process can be fine tuned until it fits your needs. You could create your own folder haiku/trunk/user_data/ and put files there that are then copied or unzipped into the image. Zipping is important when dealing with Haiku files with their attributes, because zipping them up will preserve them on non-BFS partitions.
    For example:

    # Zip up your emails between each system update and place the archive into the
    @@ -108,33 +118,26 @@
     The second line is the location of the zip file. $(HAIKU_TOP) is the lowest level of the checked out source tree, normally haiku/trunk/.

    In the same way, you use CopyDirectoryToHaikuImage and AddFilesToHaikuImage to copy whole directories or single files into the image.

  9. -
  10. The above commands are executed when building any kind of image. -"Build Profiles" provide the means to set commands specifically for -different configurations.
    -These are two profiles, one for building and installing an image -directly onto a partition and the other to generate a VMWare image:

    +
  11. The above commands are executed when building any kind of image. "Build Profiles" provide the means to set commands specifically for different configurations.
    +These are two profiles, one for building and installing an image directly onto a partition and the other to generate a VMWare image:

    DefineBuildProfile disk : disk : "/dev/sda7" ;
     DefineBuildProfile vmware : vmware-image ;
     
     switch $(HAIKU_BUILD_PROFILE) {
     	case "disk" : {
    -		HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ;
     	}
     
     
     	case "vmware" : {
     		HAIKU_IMAGE_SIZE = 900 ;
     		HAIKU_DONT_CLEAR_IMAGE = 1 ;
    -		HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1
     	}
     
     }

    The first line is especially important and dangerous: "/dev/sda7"
    The so defined partition will be irretrievably overwritten!

    -

    Before you use this profile, you should make sure that it's really -the correct partition on the right harddisk or USB-stick, for example -by using Ubuntu's partition editor GParted.

  12. +

    Before you use this profile, you should make sure that it's really the correct partition on the right harddisk or USB-stick, for example by using Ubuntu's partition editor GParted.


@@ -145,6 +148,19 @@ # Optional package OpenSSH needs this variable set HAIKU_IMAGE_HOST_NAME = "TEST" ; +# Add these optional packages. +AddOptionalHaikuImagePackages Beam ; +AddOptionalHaikuImagePackages BeHappy ; +AddOptionalHaikuImagePackages BePDF ; +AddOptionalHaikuImagePackages Firefox ; +AddOptionalHaikuImagePackages NetSurf ; +AddOptionalHaikuImagePackages OpenSSL ; +AddOptionalHaikuImagePackages OpenSSH ; +AddOptionalHaikuImagePackages Pe ; +AddOptionalHaikuImagePackages Vision ; +AddOptionalHaikuImagePackages Welcome ; +AddOptionalHaikuImagePackages WonderBrush ; + # Add symlink/file (timezone and keymap settings) to the image. AddSymlinkToHaikuImage home config settings : /boot/beos/etc/timezones/Europe/Paris : timezone ; @@ -156,19 +172,17 @@ switch $(HAIKU_BUILD_PROFILE) { case "disk" : { - HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ; } case "vmware" : { HAIKU_IMAGE_SIZE = 900 ; HAIKU_DONT_CLEAR_IMAGE = 1 ; - HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ; } } -

Note: when building an a USB memory stick, you wouldn't specify the partition number in the disk entry (ex. /dev/sdb instead of /dev/sdb1). This will erase your whole flash drive and it's partitions, so be cautious the drive name is exact.

+

Note: when building an a USB memory stick, you wouldn't specify the partition number in the disk entry (ex. /dev/sdb instead of /dev/sdb1). This will erase your whole flash drive and it's partitions, so be cautious to use the correct drive name!

Besides these user build profiles, there are also official release profiles, see ReleaseBuildProfiles in the same folder. The profiles alpha-raw and alpha-vmware will build all officially planned components for the alpha release. They are invoked just like the user profiles, see Building a VMWare Image a bit further down.

@@ -179,18 +193,14 @@

Installing on a partition/USB-stick

-

To install Haiku directly onto a partition/USB-stick, you have to -set the according read and write permissions.
+

To install Haiku directly onto a partition/USB-stick, you have to set the according read and write permissions.
When installing to a hard drive partition, replace the drive name and use:

-
-sudo chmod o+r /dev/sda
+
sudo chmod o+r /dev/sda
 sudo chmod o+rw /dev/sda7
 
-

Note that the read permission is set for the whole disk (1st line) -while the write permission is limited to one specific partition (2nd -line).

+

Note that the read permission is set for the whole disk (1st line) while the write permission is limited to one specific partition (2nd line).

When installing to a USB flashdrive, replace the drive name, and type:

sudo chmod o+r /dev/sda
@@ -200,40 +210,30 @@
jam -q @disk
-

This takes some time and will abort at some point, because some root permissions are needed. That's OK, we'll continue with:

- -
sudo jam -q @disk
- -

If you do it all in one go by going straight with the sudo-line, some files are created under the "root" user, among them the image itself. This would then have to be rededicate with chown etc., so best to stick with the 2-stage approach as described.

-

Installing to its own partition offers some interesting possibilities:

-
sudo jam -q @disk update-all
+
jam -q @disk update-all
-

This updates all of the system, but leaves the home folder untouched, so all your data will still be there.

+

This updates all of the system, but leaves the home folder untouched, so all your data will still be there.

You can also decide to only update certain components:

-
sudo jam -q @disk update {components}
+
jam -q @disk update {components}
-

Just replace the {components} with the program/component to be updated, e.g. kernel, StyledEdit or libmedia.so or more than one, separated with blanks. haiku/build/jam/HaikuImage lists all possible "targets".

+

Just replace the {components} with the program/component to be updated, e.g. kernel, StyledEdit or libmedia.so or more than one, separated with blanks. haiku/build/jam/HaikuImage lists all possible "targets".

Building a VMWare Image

Just enter:

-
jam -q @vmware
-sudo jam -q @vmware
+
jam -q @vmware
-

The created image can be run in VMPlayer with an associated .vmx file (There's also a .vmx file in haiku/3rdparty/vmware/).

+

The resulting image can be run in VMPlayer with an associated .vmx file (There's also a .vmx file in haiku/3rdparty/vmware/).

Booting with GRUB

-

If you installed Haiku directly onto a USB-stick, you just have to -make sure the boot order in the BIOS looks first for USB devices to -have Haiku boot right up from the stick.

+

If you installed Haiku directly onto a USB-stick, you just have to make sure the boot order in the BIOS looks first for USB devices to have Haiku boot right up from the stick.

-

If Haiku was installed on a partition on your hard drive, you have to -adjust the boot loader accordingly. This is how it's done with GRUB:

+

If Haiku was installed on a partition on your hard drive, you have to adjust the boot loader accordingly. This is how it's done with GRUB:

sudo gedit /boot/grub/menu.lst
@@ -243,7 +243,6 @@

All harddisks start with "hd"
"N" is the hard disk number, starting with "0".
"n is the partition number, also starting with "0".
- The first logical partition always have the number 4, regardless of the number of primary partitions.

If you're still unsure, check out the GRUB manual.

@@ -264,16 +263,13 @@

Accessing images/partitions

-

Using build profiles has another advantage: You can mount a VMWare -image or the partition of a Haiku installation to transfer data. -Navigate to haiku/trunk/ and simply enter:

-
sudo jam @disk mount
+

Using build profiles has another advantage: You can mount a VMWare image or the partition of a Haiku installation to transfer data. Navigate to haiku/trunk/ and simply enter:

+
jam @disk mount

or

-
sudo jam @vmware mount
+
jam @vmware mount

You are now in the bfs_shell. Enter help to get a list of all supported commands:

-
fssh:/> help
-supported commands:
+
fssh:/> help supported commands:
 cd               - change current directory
 chmod            - change file permissions
 cp               - copy files and directories



From mmlr at mail.berlios.de  Sun Feb  8 13:40:21 2009
From: mmlr at mail.berlios.de (mmlr at mail.berlios.de)
Date: Sun, 8 Feb 2009 13:40:21 +0100
Subject: [Haiku-commits] r29158 - haiku/trunk/build/jam
Message-ID: <200902081240.n18CeLDQ014549@sheep.berlios.de>

Author: mmlr
Date: 2009-02-08 13:40:16 +0100 (Sun, 08 Feb 2009)
New Revision: 29158
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29158&view=rev

Modified:
   haiku/trunk/build/jam/OptionalPackages
Log:
* Always install the "other tools" as part of the development optional package.
  These all work on pure GCC4 images as well because they do not use any of our
  C++ APIs.
* Remove the GCC4 package from hybrid installs though, as it's not usable
  without proper setup. Also the trick with rewriting the symlink obviously
  doesn't work because symlinks are done way earlier than unzipping the optional
  packages when building the image.


Modified: haiku/trunk/build/jam/OptionalPackages
===================================================================
--- haiku/trunk/build/jam/OptionalPackages	2009-02-08 08:12:26 UTC (rev 29157)
+++ haiku/trunk/build/jam/OptionalPackages	2009-02-08 12:40:16 UTC (rev 29158)
@@ -230,57 +230,49 @@
 			: $(baseURL)/gcc-2.95.3-haiku-081024.zip
 			:
 		;
-		# other tools
-		InstallOptionalHaikuImagePackage autoconf-2.63-gcc2-2008-11-05
-			: $(baseURL)/autoconf-2.63-gcc2-2008-11-05.zip
-			:
-		;
-		InstallOptionalHaikuImagePackage automake-1.10.1-gcc2-2008-11-06
-			: $(baseURL)/automake-1.10.1-gcc2-2008-11-06.zip
-			:
-		;
-		InstallOptionalHaikuImagePackage bison-2.4-gcc2-2008-11-09
-			: $(baseURL)/bison-2.4-gcc2-2008-11-09.zip
-			:
-		;
-		InstallOptionalHaikuImagePackage flex-2.5.35-gcc2-2008-11-09
-			: $(baseURL)/flex-2.5.35-gcc2-2008-11-09.zip
-			:
-		;
-		InstallOptionalHaikuImagePackage jam-haiku-gcc2-2008-03-27-2
-			: $(baseURL)/jam-haiku-gcc2-2008-03-27-2.zip
-			:
-		;
-		InstallOptionalHaikuImagePackage libtool-2.2.6a-gcc2-2008-11-09
-			: $(baseURL)/libtool-2.2.6a-gcc2-2008-11-09.zip
-			:
-		;
-		InstallOptionalHaikuImagePackage m4-1.4.12-gcc2-2008-11-04
-			: $(baseURL)/m4-1.4.12-gcc2-2008-11-04.zip
-			:
-		;
-		InstallOptionalHaikuImagePackage texinfo-4.13a-gcc2-2008-11-09
-			: $(baseURL)/texinfo-4.13a-gcc2-2008-11-09.zip
-			:
-		;
 	}
 
-	if $(HAIKU_GCC_VERSION[1]) = 4 || $(isHybridBuild) = 1 {
+	# other tools
+	InstallOptionalHaikuImagePackage autoconf-2.63-gcc2-2008-11-05
+		: $(baseURL)/autoconf-2.63-gcc2-2008-11-05.zip
+		:
+	;
+	InstallOptionalHaikuImagePackage automake-1.10.1-gcc2-2008-11-06
+		: $(baseURL)/automake-1.10.1-gcc2-2008-11-06.zip
+		:
+	;
+	InstallOptionalHaikuImagePackage bison-2.4-gcc2-2008-11-09
+		: $(baseURL)/bison-2.4-gcc2-2008-11-09.zip
+		:
+	;
+	InstallOptionalHaikuImagePackage flex-2.5.35-gcc2-2008-11-09
+		: $(baseURL)/flex-2.5.35-gcc2-2008-11-09.zip
+		:
+	;
+	InstallOptionalHaikuImagePackage jam-haiku-gcc2-2008-03-27-2
+		: $(baseURL)/jam-haiku-gcc2-2008-03-27-2.zip
+		:
+	;
+	InstallOptionalHaikuImagePackage libtool-2.2.6a-gcc2-2008-11-09
+		: $(baseURL)/libtool-2.2.6a-gcc2-2008-11-09.zip
+		:
+	;
+	InstallOptionalHaikuImagePackage m4-1.4.12-gcc2-2008-11-04
+		: $(baseURL)/m4-1.4.12-gcc2-2008-11-04.zip
+		:
+	;
+	InstallOptionalHaikuImagePackage texinfo-4.13a-gcc2-2008-11-09
+		: $(baseURL)/texinfo-4.13a-gcc2-2008-11-09.zip
+		:
+	;
+
+	if $(HAIKU_GCC_VERSION[1]) = 4 {
 		# gcc and binutils
 		local baseURL = http://haiku.mlotz.ch ;
 		InstallOptionalHaikuImagePackage gcc-4.3.3-haiku-090129
 			: $(baseURL)/gcc-4.3.3-haiku-090129.zip
 			:
 		;
-
-		# Setup the proper gnupro symlink. Both packages provide one and on
-		# a GCC2 based hybrid the GCC4 package will overwrite the one present.
-		# Since we want to use GCC2 as the host compiler on a GCC2 base we have
-		# to correct this again.
-		if $(HAIKU_GCC_VERSION[1]) = 2 {
-			AddSymlinkToHaikuImage develop tools
-				: /boot/develop/tools/gcc-2.95.3-haiku-081024 : gnupro ;
-		}
 	}
 }
 



From korli at mail.berlios.de  Sun Feb  8 13:46:06 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 8 Feb 2009 13:46:06 +0100
Subject: [Haiku-commits] r29159 - haiku/trunk/src/apps/packageinstaller
Message-ID: <200902081246.n18Ck6oj023881@sheep.berlios.de>

Author: korli
Date: 2009-02-08 13:46:05 +0100 (Sun, 08 Feb 2009)
New Revision: 29159
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29159&view=rev

Modified:
   haiku/trunk/src/apps/packageinstaller/PackageView.cpp
Log:
* exits on invalid packages
* added messages on errors


Modified: haiku/trunk/src/apps/packageinstaller/PackageView.cpp
===================================================================
--- haiku/trunk/src/apps/packageinstaller/PackageView.cpp	2009-02-08 12:40:16 UTC (rev 29158)
+++ haiku/trunk/src/apps/packageinstaller/PackageView.cpp	2009-02-08 12:46:05 UTC (rev 29159)
@@ -71,19 +71,7 @@
 	status_t ret = fInfo.InitCheck();
 	if (ret == B_OK) 
 		_InitProfiles();
-	else if (ret != B_NO_INIT) {
-		BAlert *warning = new BAlert(T("parsing_failed"),
-			T("I was unable to read the given package file.\nOne of the possible "
-				"reasons for this might be that the requested file is not a valid "
-				"BeOS .pkg package."), T("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
-			B_WARNING_ALERT);
-		warning->Go();
 
-		BWindow *parent = Window();
-		if (parent && parent->Lock())
-			parent->Quit();
-	}
-
 	ResizeTo(Bounds().Width(), fInstall->Frame().bottom + 4);
 }
 
@@ -97,6 +85,19 @@
 void
 PackageView::AttachedToWindow()
 {
+	status_t ret = fInfo.InitCheck();
+	if (ret != B_OK && ret != B_NO_INIT) {
+		BAlert *warning = new BAlert(T("parsing_failed"),
+				T("I was unable to read the given package file.\nOne of the possible "
+				"reasons for this might be that the requested file is not a valid "
+				"BeOS .pkg package."), T("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
+				B_WARNING_ALERT);
+		warning->Go();
+
+		Window()->PostMessage(B_QUIT_REQUESTED);
+		return;
+	}
+
 	// Set the window title
 	BWindow *parent = Window();
 	BString title;
@@ -170,12 +171,14 @@
 			else if (ret == B_FILE_EXISTS)
 				notify = new BAlert("installation_aborted",
 					T("The installation of the package has been aborted."), T("OK"));
-			else
+			else {
 				notify = new BAlert("installation_failed", // TODO: Review this
 					T("The requested package failed to install on your system. This "
 						"might be a problem with the target package file. Please consult "
 						"this issue with the package distributor."), T("OK"), NULL, 
 					NULL, B_WIDTH_AS_USUAL, B_WARNING_ALERT);
+				fprintf(stderr, "Error while installing the package : %s\n", strerror(ret));
+			}
 			notify->Go();
 			fStatusWindow->Hide();
 			fInstall->SetEnabled(true);
@@ -267,12 +270,16 @@
 		if (reinstall->Go() == 0) {
 			// Uninstall the package
 			err = packageInfo.Uninstall();
-			if (err != B_OK)
+			if (err != B_OK) {
+				fprintf(stderr, "Error on uninstall\n");
 				return err;
+			}
 
 			err = packageInfo.SetTo(fInfo.GetName(), fInfo.GetVersion(), true);
-			if (err != B_OK)
+			if (err != B_OK) {
+				fprintf(stderr, "Error on SetTo\n");
 				return err;
+			}
 		}
 		else {
 			// Abort the installation
@@ -281,13 +288,17 @@
 	}
 	else if (err == B_ENTRY_NOT_FOUND) {
 		err = packageInfo.SetTo(fInfo.GetName(), fInfo.GetVersion(), true);
-		if (err != B_OK)
+		if (err != B_OK) {
+			fprintf(stderr, "Error on SetTo\n");
 			return err;
+		}
 	}
 	else if (fStatusWindow->Stopped())
 		return B_FILE_EXISTS;
-	else
+	else {
+		fprintf(stderr, "returning on error\n");
 		return err;
+	}
 
 	fStatusWindow->StageStep(1, "Installing files and directories");
 
@@ -310,11 +321,13 @@
 	packageInfo.SetDescription(description.String());
 	packageInfo.SetSpaceNeeded(type->space_needed);
 
-	for (i = 0;i < n;i++) {
+	for (i = 0; i < n; i++) {
 		iter = static_cast(type->items.ItemAt(i));
 		err = iter->WriteToPath(fCurrentPath.Path(), &installedTo);
-		if (err != B_OK)
+		if (err != B_OK) {
+			fprintf(stderr, "Error while writing path %s\n", fCurrentPath.Path());
 			return err;
+		}
 		if (fStatusWindow->Stopped())
 			return B_FILE_EXISTS;
 		label = "";



From mmlr at mail.berlios.de  Sun Feb  8 13:47:31 2009
From: mmlr at mail.berlios.de (mmlr at mail.berlios.de)
Date: Sun, 8 Feb 2009 13:47:31 +0100
Subject: [Haiku-commits] r29160 - haiku/trunk/build/jam
Message-ID: <200902081247.n18ClVPM023959@sheep.berlios.de>

Author: mmlr
Date: 2009-02-08 13:47:29 +0100 (Sun, 08 Feb 2009)
New Revision: 29160
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29160&view=rev

Modified:
   haiku/trunk/build/jam/OptionalPackages
Log:
* Clean that up a bit and combine the ifs for GCC2/4.
* Also don't install the GCC2 package on a GCC4 based hybrid, as it's again not
  usable without proper manual setup.


Modified: haiku/trunk/build/jam/OptionalPackages
===================================================================
--- haiku/trunk/build/jam/OptionalPackages	2009-02-08 12:46:05 UTC (rev 29159)
+++ haiku/trunk/build/jam/OptionalPackages	2009-02-08 12:47:29 UTC (rev 29160)
@@ -211,25 +211,28 @@
 	AddHeaderDirectoryToHaikuImage libs png : 3rdparty ;
 	AddHeaderDirectoryToHaikuImage libs zlib : 3rdparty ;
 
-	if $(HAIKU_GCC_VERSION[1]) > 2 {
-		# gcc 4
+	if $(HAIKU_GCC_VERSION[1]) = 2 {
+		# gcc and binutils
+		local baseURL = http://haiku-files.org/files/optional-packages ;
+		InstallOptionalHaikuImagePackage gcc-2.95.3-haiku-081024
+			: $(baseURL)/gcc-2.95.3-haiku-081024.zip
+			:
+		;
 
-		# symlink cpp to g++'s headers
-		AddSymlinkToHaikuImage develop headers
-			: /boot/develop/tools/gnupro/include/g++ : cpp ;
-	} else {
-		# gcc 2.95.3
-
 		AddHeaderDirectoryToHaikuImage cpp ;
 	}
 
-	if $(HAIKU_GCC_VERSION[1]) = 2 || $(isHybridBuild) = 1 {
+	if $(HAIKU_GCC_VERSION[1]) = 4 {
 		# gcc and binutils
-		local baseURL = http://haiku-files.org/files/optional-packages ;
-		InstallOptionalHaikuImagePackage gcc-2.95.3-haiku-081024
-			: $(baseURL)/gcc-2.95.3-haiku-081024.zip
+		local baseURL = http://haiku.mlotz.ch ;
+		InstallOptionalHaikuImagePackage gcc-4.3.3-haiku-090129
+			: $(baseURL)/gcc-4.3.3-haiku-090129.zip
 			:
 		;
+
+		# symlink cpp to g++'s headers
+		AddSymlinkToHaikuImage develop headers
+			: /boot/develop/tools/gnupro/include/g++ : cpp ;
 	}
 
 	# other tools
@@ -265,15 +268,6 @@
 		: $(baseURL)/texinfo-4.13a-gcc2-2008-11-09.zip
 		:
 	;
-
-	if $(HAIKU_GCC_VERSION[1]) = 4 {
-		# gcc and binutils
-		local baseURL = http://haiku.mlotz.ch ;
-		InstallOptionalHaikuImagePackage gcc-4.3.3-haiku-090129
-			: $(baseURL)/gcc-4.3.3-haiku-090129.zip
-			:
-		;
-	}
 }
 
 



From superstippi at gmx.de  Sun Feb  8 14:03:20 2009
From: superstippi at gmx.de (Stephan Assmus)
Date: Sun, 08 Feb 2009 14:03:20 +0100
Subject: [Haiku-commits] r29159 - haiku/trunk/src/apps/packageinstaller
In-Reply-To: <200902081246.n18Ck6oj023881@sheep.berlios.de>
References: <200902081246.n18Ck6oj023881@sheep.berlios.de>
Message-ID: <20090208140320.2893.1@bepc.1234090311.fake>


korli at BerliOS  wrote:
> Author: korli
> Date: 2009-02-08 13:46:05 +0100 (Sun, 08 Feb 2009) New Revision: 29159
> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29159&view=rev
> 
> Modified:
>    haiku/trunk/src/apps/packageinstaller/PackageView.cpp
> Log:
> * exits on invalid packages
> * added messages on errors

BTW, can we reword the invalid package error message into a passive 
statement? Somehow I feel whenever the computer speaks of itself as a 
person that it sound less professional.

Best regards,
-Stephan


From mmlr at mail.berlios.de  Sun Feb  8 14:20:21 2009
From: mmlr at mail.berlios.de (mmlr at mail.berlios.de)
Date: Sun, 8 Feb 2009 14:20:21 +0100
Subject: [Haiku-commits] r29161 - haiku/trunk
Message-ID: <200902081320.n18DKL7t030164@sheep.berlios.de>

Author: mmlr
Date: 2009-02-08 14:20:19 +0100 (Sun, 08 Feb 2009)
New Revision: 29161
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29161&view=rev

Modified:
   haiku/trunk/Jamrules
Log:
Allow for a separate UserBuildConfig directly in the output directory (i.e.
generated). When not using build profiles this allows for separate configuration
per output directory. When using build profiles you could for example have a
different profile per output directory with the same name (so an @disk with
different settings per output dir for example).


Modified: haiku/trunk/Jamrules
===================================================================
--- haiku/trunk/Jamrules	2009-02-08 12:47:29 UTC (rev 29160)
+++ haiku/trunk/Jamrules	2009-02-08 13:20:19 UTC (rev 29161)
@@ -57,6 +57,13 @@
 	if $(userBuildConfig) {
 		include $(userBuildConfig) ;
 	}
+
+	# allow for a separate UserBuildConfig per output directory
+	local userBuildConfig
+		= [ GLOB $(HAIKU_OUTPUT_DIR) : UserBuildConfig ] ;
+	if $(userBuildConfig) {
+		include $(userBuildConfig) ;
+	}
 }
 
 include [ FDirName $(HAIKU_BUILD_RULES_DIR) ReleaseBuildProfiles ] ;



From korli at mail.berlios.de  Sun Feb  8 15:19:06 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Sun, 8 Feb 2009 15:19:06 +0100
Subject: [Haiku-commits] r29162 - haiku/trunk/src/apps/packageinstaller
Message-ID: <200902081419.n18EJ6V0004318@sheep.berlios.de>

Author: korli
Date: 2009-02-08 15:19:06 +0100 (Sun, 08 Feb 2009)
New Revision: 29162
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29162&view=rev

Modified:
   haiku/trunk/src/apps/packageinstaller/PackageView.cpp
Log:
Changed the error message for unreadable packages to be a passive one, as suggested by Stephan.


Modified: haiku/trunk/src/apps/packageinstaller/PackageView.cpp
===================================================================
--- haiku/trunk/src/apps/packageinstaller/PackageView.cpp	2009-02-08 13:20:19 UTC (rev 29161)
+++ haiku/trunk/src/apps/packageinstaller/PackageView.cpp	2009-02-08 14:19:06 UTC (rev 29162)
@@ -88,7 +88,7 @@
 	status_t ret = fInfo.InitCheck();
 	if (ret != B_OK && ret != B_NO_INIT) {
 		BAlert *warning = new BAlert(T("parsing_failed"),
-				T("I was unable to read the given package file.\nOne of the possible "
+				T("The package file is not readable.\nOne of the possible "
 				"reasons for this might be that the requested file is not a valid "
 				"BeOS .pkg package."), T("OK"), NULL, NULL, B_WIDTH_AS_USUAL,
 				B_WARNING_ALERT);



From korli at users.berlios.de  Sun Feb  8 15:19:29 2009
From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=)
Date: Sun, 8 Feb 2009 15:19:29 +0100
Subject: [Haiku-commits] r29159 - haiku/trunk/src/apps/packageinstaller
In-Reply-To: <20090208140320.2893.1@bepc.1234090311.fake>
References: <200902081246.n18Ck6oj023881@sheep.berlios.de>
	<20090208140320.2893.1@bepc.1234090311.fake>
Message-ID: 

2009/2/8 Stephan Assmus 

> BTW, can we reword the invalid package error message into a passive
> statement? Somehow I feel whenever the computer speaks of itself as a
> person that it sound less professional.
>

Done in r29162.

Bye,
J?r?me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From anevilyak at mail.berlios.de  Sun Feb  8 15:33:22 2009
From: anevilyak at mail.berlios.de (anevilyak at BerliOS)
Date: Sun, 8 Feb 2009 15:33:22 +0100
Subject: [Haiku-commits] r29163 - haiku/trunk/src/kits/tracker
Message-ID: <200902081433.n18EXMK3005983@sheep.berlios.de>

Author: anevilyak
Date: 2009-02-08 15:33:22 +0100 (Sun, 08 Feb 2009)
New Revision: 29163
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29163&view=rev

Modified:
   haiku/trunk/src/kits/tracker/PoseView.cpp
Log:
Disallow move to trash and/or delete operations from read-only volumes. This fixes ticket #3421.



Modified: haiku/trunk/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-08 14:19:06 UTC (rev 29162)
+++ haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-08 14:33:22 UTC (rev 29163)
@@ -5351,6 +5351,22 @@
 }
 
 
+static bool
+CheckVolumeReadOnly(const entry_ref *ref)
+{
+	BVolume volume (ref->device);
+	if (volume.IsReadOnly()) {
+		BAlert *alert (new BAlert ("", "Files cannot be moved or deleted "
+			"from a read-only volume.", "Cancel", NULL, NULL, 
+			B_WIDTH_AS_USUAL, B_STOP_ALERT));
+		alert->Go();
+		return false;
+	}
+	
+	return true;
+}
+
+
 void
 BPoseView::MoveSelectionOrEntryToTrash(const entry_ref *ref, bool selectNext)
 {
@@ -5361,9 +5377,13 @@
 	std::map deviceHasTrash;
 
 	if (ref) {
+		if (!CheckVolumeReadOnly(ref))
+			return;
 		CopyOneTrashedRefAsEntry(ref, entriesToTrash, entriesToDeleteOnTheSpot,
 			&deviceHasTrash);
 	} else {
+		if (!CheckVolumeReadOnly(fSelectionList->ItemAt(0)->TargetModel()->EntryRef()))
+			return;
 		EachListItem(fSelectionList, CopyPoseOneAsEntry, entriesToTrash,
 			entriesToDeleteOnTheSpot, &deviceHasTrash);
 	}
@@ -5416,6 +5436,9 @@
 	if (count <= 0)
 		return;
 
+	if (!CheckVolumeReadOnly(fSelectionList->ItemAt(0)->TargetModel()->EntryRef()))
+		return;
+
 	BObjectList *entriesToDelete = new BObjectList(count, true);
 
 	for (int32 index = 0; index < count; index++)



From superstippi at gmx.de  Sun Feb  8 15:34:09 2009
From: superstippi at gmx.de (Stephan Assmus)
Date: Sun, 08 Feb 2009 15:34:09 +0100
Subject: [Haiku-commits] r29159 - haiku/trunk/src/apps/packageinstaller
In-Reply-To: 
References: <200902081246.n18Ck6oj023881@sheep.berlios.de>
	<20090208140320.2893.1@bepc.1234090311.fake>
	
Message-ID: <20090208153409.3471.3@bepc.1234090311.fake>


J?r?me Duval  wrote:
> 2009/2/8 Stephan Assmus 
> 
> > BTW, can we reword the invalid package error message into a passive 
> > statement? Somehow I feel whenever the computer speaks of itself as a 
> > person that it sound less professional.
> >
> 
> Done in r29162.

Cool, thanks!

Best regards,
-Stephan


From mmlr at mail.berlios.de  Sun Feb  8 15:53:54 2009
From: mmlr at mail.berlios.de (mmlr at mail.berlios.de)
Date: Sun, 8 Feb 2009 15:53:54 +0100
Subject: [Haiku-commits] r29164 - haiku/trunk/build/jam
Message-ID: <200902081453.n18Ers4f008099@sheep.berlios.de>

Author: mmlr
Date: 2009-02-08 15:53:53 +0100 (Sun, 08 Feb 2009)
New Revision: 29164
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29164&view=rev

Modified:
   haiku/trunk/build/jam/OptionalPackages
Log:
Fix base URL I accidently messed up.

Modified: haiku/trunk/build/jam/OptionalPackages
===================================================================
--- haiku/trunk/build/jam/OptionalPackages	2009-02-08 14:33:22 UTC (rev 29163)
+++ haiku/trunk/build/jam/OptionalPackages	2009-02-08 14:53:53 UTC (rev 29164)
@@ -236,6 +236,7 @@
 	}
 
 	# other tools
+	local baseURL = http://haiku-files.org/files/optional-packages ;
 	InstallOptionalHaikuImagePackage autoconf-2.63-gcc2-2008-11-05
 		: $(baseURL)/autoconf-2.63-gcc2-2008-11-05.zip
 		:



From anevilyak at mail.berlios.de  Sun Feb  8 17:00:46 2009
From: anevilyak at mail.berlios.de (anevilyak at BerliOS)
Date: Sun, 8 Feb 2009 17:00:46 +0100
Subject: [Haiku-commits] r29165 - haiku/trunk/src/kits/tracker
Message-ID: <200902081600.n18G0krI019345@sheep.berlios.de>

Author: anevilyak
Date: 2009-02-08 17:00:46 +0100 (Sun, 08 Feb 2009)
New Revision: 29165
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29165&view=rev

Modified:
   haiku/trunk/src/kits/tracker/PoseView.cpp
Log:
Don't leak memory when aborting operations due to read-only volume.



Modified: haiku/trunk/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-08 14:53:53 UTC (rev 29164)
+++ haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-08 16:00:46 UTC (rev 29165)
@@ -5377,13 +5377,19 @@
 	std::map deviceHasTrash;
 
 	if (ref) {
-		if (!CheckVolumeReadOnly(ref))
+		if (!CheckVolumeReadOnly(ref)) {
+			delete entriesToTrash;
+			delete entriesToDeleteOnTheSpot;
 			return;
+		}
 		CopyOneTrashedRefAsEntry(ref, entriesToTrash, entriesToDeleteOnTheSpot,
 			&deviceHasTrash);
 	} else {
-		if (!CheckVolumeReadOnly(fSelectionList->ItemAt(0)->TargetModel()->EntryRef()))
+		if (!CheckVolumeReadOnly(fSelectionList->ItemAt(0)->TargetModel()->EntryRef())) {
+			delete entriesToTrash;
+			delete entriesToDeleteOnTheSpot;
 			return;
+		}
 		EachListItem(fSelectionList, CopyPoseOneAsEntry, entriesToTrash,
 			entriesToDeleteOnTheSpot, &deviceHasTrash);
 	}



From mmlr at mail.berlios.de  Sun Feb  8 17:55:46 2009
From: mmlr at mail.berlios.de (mmlr at mail.berlios.de)
Date: Sun, 8 Feb 2009 17:55:46 +0100
Subject: [Haiku-commits] r29166 -
	haiku/trunk/src/add-ons/kernel/file_systems/cdda
Message-ID: <200902081655.n18Gtk3f025143@sheep.berlios.de>

Author: mmlr
Date: 2009-02-08 17:55:45 +0100 (Sun, 08 Feb 2009)
New Revision: 29166
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29166&view=rev

Modified:
   haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
Log:
Only try to store attributes on destruction if the required root node is available. Should fix bug #3426 where an incompletely constructed volume object is deleted.

Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-02-08 16:00:46 UTC (rev 29165)
+++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-02-08 16:55:45 UTC (rev 29166)
@@ -508,10 +508,13 @@
 
 Volume::~Volume()
 {
-	_StoreAttributes();
-	_StoreSharedAttributes();
+	if (fRootNode) {
+		_StoreAttributes();
+		_StoreSharedAttributes();
+	}
 
-	close(fDevice);
+	if (fDevice >= 0)
+		close(fDevice);
 
 	// put_vnode on the root to release the ref to it
 	if (fRootNode)



From umccullough at gmail.com  Sun Feb  8 17:57:31 2009
From: umccullough at gmail.com (Urias McCullough)
Date: Sun, 8 Feb 2009 08:57:31 -0800
Subject: [Haiku-commits] r29147 -
	haiku/trunk/docs/userguide/en/installation
In-Reply-To: <498E8F2F.1090809@googlemail.com>
References: <200902071402.n17E2Juo027034@sheep.berlios.de>
	<1e80d8750902070747hfac80ebu6425efcdfe778dd9@mail.gmail.com>
	<498DC24E.30002@googlemail.com>
	<1e80d8750902070939r5f250b95r25654d6f2c339a77@mail.gmail.com>
	<498DDA7A.5070500@googlemail.com>
	<1e80d8750902071123oc55fdbbj194d8e61e15df245@mail.gmail.com>
	<498E8F2F.1090809@googlemail.com>
Message-ID: <1e80d8750902080857xd949cf3t8467237edeca6585@mail.gmail.com>

On Sat, Feb 7, 2009 at 11:52 PM, Humdinger  wrote:
> Urias McCullough wrote:
>> I think my current dislike for the "guides" and "forum posts" is that
>> there's no collaborative location where people can improve on the
>> instructions and add information for other platforms and
>> configurations.
>
> Originally, the user guide was supposed to be created as a wiki. But for some reason it
> never happened on haiku-os.org, so it was started at haikuware.com. Since using and

Goes back to my original point - why is compiling haiku in the user guide?

Anyhow, I guess I'll raise this question again on the haiku doc
list... when it itches me again, otherwise I'm pretty much too lazy
these days.


From anevilyak at mail.berlios.de  Sun Feb  8 19:39:41 2009
From: anevilyak at mail.berlios.de (anevilyak at BerliOS)
Date: Sun, 8 Feb 2009 19:39:41 +0100
Subject: [Haiku-commits] r29167 - haiku/trunk/src/kits/tracker
Message-ID: <200902081839.n18Idf8E020969@sheep.berlios.de>

Author: anevilyak
Date: 2009-02-08 19:39:39 +0100 (Sun, 08 Feb 2009)
New Revision: 29167
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29167&view=rev

Modified:
   haiku/trunk/src/kits/tracker/PoseView.cpp
Log:
Reset the cursor check state if we drag over a pose that's not a suitable DnD destination for the drag. Otherwise we'll reset the cursor back to the move state and never set to copy again unless we exit/reenter the window. Thanks to luroh for reporting.


Modified: haiku/trunk/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-08 16:55:45 UTC (rev 29166)
+++ haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-08 18:39:39 UTC (rev 29167)
@@ -8704,6 +8704,7 @@
 		// new target is valid, select it
 		HiliteDropTarget(true);	 
 	} else {
+		fCursorCheck = false;
 		fDropTarget = NULL;
 		if (targetPose == NULL)
 			targetModel = TargetModel();



From stippi at mail.berlios.de  Sun Feb  8 22:14:15 2009
From: stippi at mail.berlios.de (stippi at BerliOS)
Date: Sun, 8 Feb 2009 22:14:15 +0100
Subject: [Haiku-commits] r29168 - haiku/trunk/src/tests/kits/interface/look
Message-ID: <200902082114.n18LEFrb007980@sheep.berlios.de>

Author: stippi
Date: 2009-02-08 22:14:15 +0100 (Sun, 08 Feb 2009)
New Revision: 29168
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29168&view=rev

Modified:
   haiku/trunk/src/tests/kits/interface/look/Look.cpp
Log:
Show more controls.


Modified: haiku/trunk/src/tests/kits/interface/look/Look.cpp
===================================================================
--- haiku/trunk/src/tests/kits/interface/look/Look.cpp	2009-02-08 18:39:39 UTC (rev 29167)
+++ haiku/trunk/src/tests/kits/interface/look/Look.cpp	2009-02-08 21:14:15 UTC (rev 29168)
@@ -38,12 +38,16 @@
 	ControlType* control1 = new ControlType("Enabled", NULL);
 	ControlType* control2 = new ControlType("Disabled", NULL);
 	control2->SetEnabled(false);
-	ControlType* control3 = new ControlType("On", NULL);
+	ControlType* control3 = new ControlType("Enabled", NULL);
 	control3->SetValue(B_CONTROL_ON);
+	ControlType* control4 = new ControlType("Disabled", NULL);
+	control4->SetValue(B_CONTROL_ON);
+	control4->SetEnabled(false);
 
 	layout->AddView(control1, 0, row);
 	layout->AddView(control2, 1, row);
 	layout->AddView(control3, 2, row);
+	layout->AddView(control4, 3, row);
 
 	row++;
 }
@@ -58,9 +62,8 @@
 	BMenuField* control2 = new BMenuField("Disabled", menu2, NULL);
 	control2->SetEnabled(false);
 
-	layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5)
-		.Add(control1)
-		.Add(control2), 0, row, 3);
+	layout->AddView(control1, 0, row, 2);
+	layout->AddView(control2, 2, row, 2);
 
 	row++;
 }
@@ -73,9 +76,8 @@
 	BTextControl* control2 = new BTextControl("Disabled", "More Text", NULL);
 	control2->SetEnabled(false);
 
-	layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5)
-		.Add(control1)
-		.Add(control2), 0, row, 3);
+	layout->AddView(control1, 0, row, 2);
+	layout->AddView(control2, 2, row, 2);
 
 	row++;
 }
@@ -95,9 +97,8 @@
 	control2->SetHashMarkCount(10);
 	control2->SetHashMarks(B_HASH_MARKS_BOTTOM);
 
-	layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5)
-		.Add(control1)
-		.Add(control2), 0, row, 3);
+	layout->AddView(control1, 0, row, 2);
+	layout->AddView(control2, 2, row, 2);
 
 	row++;
 
@@ -107,17 +108,60 @@
 		B_HORIZONTAL, B_TRIANGLE_THUMB);
 	control2->SetEnabled(false);
 
+	rgb_color fillColor = (rgb_color){ 255, 115, 0, 255 };
+
 	control1->SetLimitLabels("Min", "Max");
+	control1->UseFillColor(true, &fillColor);
+	control1->SetValue(20);
+
 	control2->SetLimitLabels("1", "100");
+	control2->UseFillColor(true, &fillColor);
+	control2->SetValue(10);
 
-	layout->AddView(BGroupLayoutBuilder(B_HORIZONTAL, 5)
-		.Add(control1)
-		.Add(control2), 0, row, 3);
+	layout->AddView(control1, 0, row, 2);
+	layout->AddView(control2, 2, row, 2);
 
 	row++;
 }
 
 
+void
+add_status_bars(BGridLayout* layout, int32& row)
+{
+	BBox* box = new BBox(B_FANCY_BORDER, NULL);
+	box->SetLabel("Info");
+
+	BGroupLayout* boxLayout = new BGroupLayout(B_VERTICAL, 5);
+	boxLayout->SetInsets(8, 8 + box->TopBorderOffset(), 8, 8);
+	box->SetLayout(boxLayout);
+
+	BStatusBar* statusBar = new BStatusBar("status bar", "Status",
+		"Completed");
+	statusBar->SetMaxValue(100);
+	statusBar->SetTo(0);
+	statusBar->SetBarHeight(12);
+	boxLayout->AddView(statusBar);
+
+	statusBar = new BStatusBar("status bar", "Progress",
+		"Completed");
+	statusBar->SetMaxValue(100);
+	statusBar->SetTo(40);
+	statusBar->SetBarHeight(12);
+	boxLayout->AddView(statusBar);
+
+	statusBar = new BStatusBar("status bar", "Lifespan of capitalism",
+		"Completed");
+	statusBar->SetMaxValue(100);
+	statusBar->SetTo(100);
+	statusBar->SetBarHeight(12);
+	boxLayout->AddView(statusBar);
+
+	layout->AddView(box, 0, row, 4);
+
+	row++;
+}
+
+
 int
 main(int argc, char** argv)
 {
@@ -133,11 +177,14 @@
 	// create some controls
 
 	BListView* listView = new BListView();
-	listView->AddItem(new BStringItem("List Item 1"));
-	listView->AddItem(new BStringItem("List Item 2"));
+	for (int32 i = 0; i < 20; i++) {
+		BString itemLabel("List Item ");
+		itemLabel << i + 1;
+		listView->AddItem(new BStringItem(itemLabel.String()));
+	}
 	BScrollView* scrollView = new BScrollView("scroller", listView, 0,
 		true, true);
-	scrollView->SetExplicitMinSize(BSize(300, 80));
+	scrollView->SetExplicitMinSize(BSize(300, 140));
 
 	BGridView* controls = new BGridView(5.0f, 5.0f);
 	BGridLayout* layout = controls->GridLayout();
@@ -150,19 +197,11 @@
 	add_menu_fields(layout, row);
 	add_text_controls(layout, row);
 	add_sliders(layout, row);
+	add_status_bars(layout, row);
 
-	BStatusBar* statusBar = new BStatusBar("status bar", "Status",
-		"Completed");
-	statusBar->SetMaxValue(100);
-	statusBar->SetTo(40);
-	statusBar->SetBarHeight(12);
-	layout->AddView(statusBar, 0, row, 3);
-
-	row++;
-
 	BColorControl* colorControl = new BColorControl(B_ORIGIN, B_CELLS_32x8,
 		8.0f, "color control");
-	layout->AddView(colorControl, 0, row, 3);
+	layout->AddView(colorControl, 0, row, 4);
 
 	BTabView* tabView = new BTabView("tab view", B_WIDTH_FROM_WIDEST);
 	BView* content = BGroupLayoutBuilder(B_VERTICAL, 5)



From mmlr at mail.berlios.de  Sun Feb  8 22:38:31 2009
From: mmlr at mail.berlios.de (mmlr at mail.berlios.de)
Date: Sun, 8 Feb 2009 22:38:31 +0100
Subject: [Haiku-commits] r29169 - haiku/trunk/src/system/kernel/debug
Message-ID: <200902082138.n18LcVbi011514@sheep.berlios.de>

Author: mmlr
Date: 2009-02-08 22:38:30 +0100 (Sun, 08 Feb 2009)
New Revision: 29169
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29169&view=rev

Modified:
   haiku/trunk/src/system/kernel/debug/blue_screen.cpp
Log:
Allow pressing 'p' to disable paging during boot debug output.

Modified: haiku/trunk/src/system/kernel/debug/blue_screen.cpp
===================================================================
--- haiku/trunk/src/system/kernel/debug/blue_screen.cpp	2009-02-08 21:14:15 UTC (rev 29168)
+++ haiku/trunk/src/system/kernel/debug/blue_screen.cpp	2009-02-08 21:38:30 UTC (rev 29169)
@@ -125,7 +125,7 @@
 		// output
 		const char *text = in_command_invocation()
 			? "Press key to continue, Q to quit, S to skip output"
-			: "Press key to continue, Q or S to skip output";
+			: "Press key to continue, S to skip output, P to disable paging";
 		int32 length = strlen(text);
 		if (sScreen.x + length > sScreen.columns) {
 			// make sure we don't overwrite too much
@@ -142,10 +142,11 @@
 		char c = blue_screen_getchar();
 		if (c == 's') {
 			sScreen.ignore_output = true;
-		} else if (c == 'q') {
-			abortCommand = in_command_invocation();
+		} else if (c == 'q' && in_command_invocation()) {
+			abortCommand = true;
 			sScreen.ignore_output = true;
-		}
+		} else if (c == 'p' && !in_command_invocation())
+			sScreen.paging = false;
 
 		// remove on screen text again
 		sModule->fill_glyph(sScreen.columns - length, sScreen.y, length,



From anevilyak at mail.berlios.de  Sun Feb  8 23:59:07 2009
From: anevilyak at mail.berlios.de (anevilyak at BerliOS)
Date: Sun, 8 Feb 2009 23:59:07 +0100
Subject: [Haiku-commits] r29170 - haiku/trunk/src/preferences/touchpad
Message-ID: <200902082259.n18Mx7mB020966@sheep.berlios.de>

Author: anevilyak
Date: 2009-02-08 23:59:06 +0100 (Sun, 08 Feb 2009)
New Revision: 29170
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29170&view=rev

Modified:
   haiku/trunk/src/preferences/touchpad/main.cpp
Log:
Minor fix I noticed by accident: touchpad pref's BApplication signature didn't match the one declared in its rdef.



Modified: haiku/trunk/src/preferences/touchpad/main.cpp
===================================================================
--- haiku/trunk/src/preferences/touchpad/main.cpp	2009-02-08 21:38:30 UTC (rev 29169)
+++ haiku/trunk/src/preferences/touchpad/main.cpp	2009-02-08 22:59:06 UTC (rev 29170)
@@ -27,7 +27,7 @@
 int 
 main(int argc, char* argv[])
 {
-	BApplication	*app = new BApplication("application/touchpadpref");
+	BApplication	*app = new BApplication("application/x-vnd.Haiku-Touchpad");
 	TouchpadPrefWindow *window = new TouchpadPrefWindow(BRect(50, 50, 450, 350),"Touchpad", B_TITLED_WINDOW,
 			 	B_NOT_RESIZABLE | B_NOT_ZOOMABLE | B_AVOID_FRONT | B_ASYNCHRONOUS_CONTROLS);
 	window->AddChild(new TouchpadPrefView(window->Bounds(), "TouchpadPrefView"));



From anevilyak at mail.berlios.de  Mon Feb  9 06:19:52 2009
From: anevilyak at mail.berlios.de (anevilyak at BerliOS)
Date: Mon, 9 Feb 2009 06:19:52 +0100
Subject: [Haiku-commits] r29171 - haiku/trunk/src/kits/tracker
Message-ID: <200902090519.n195JqtM021958@sheep.berlios.de>

Author: anevilyak
Date: 2009-02-09 06:19:50 +0100 (Mon, 09 Feb 2009)
New Revision: 29171
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29171&view=rev

Modified:
   haiku/trunk/src/kits/tracker/PoseView.cpp
Log:
Slight logic cleanup that prevents excessively rechecking the drop target in some instances.



Modified: haiku/trunk/src/kits/tracker/PoseView.cpp
===================================================================
--- haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-08 22:59:06 UTC (rev 29170)
+++ haiku/trunk/src/kits/tracker/PoseView.cpp	2009-02-09 05:19:50 UTC (rev 29171)
@@ -8700,16 +8700,18 @@
 		targetModel = &tmpTarget;
 
 	bool ignoreTypes = (modifiers() & B_CONTROL_KEY) != 0;
-	if (targetPose && CanHandleDragSelection(targetModel, dragMessage, ignoreTypes)) {
-		// new target is valid, select it
-		HiliteDropTarget(true);	 
-	} else {
-		fCursorCheck = false;
-		fDropTarget = NULL;
-		if (targetPose == NULL)
-			targetModel = TargetModel();
-	}
-
+	if (targetPose) {
+		if (CanHandleDragSelection(targetModel, dragMessage, ignoreTypes)) {
+			// new target is valid, select it
+			HiliteDropTarget(true);
+		} else {
+			fDropTarget = NULL;
+			fCursorCheck = false;
+		}
+	} 
+	if (targetModel == NULL)
+		targetModel = TargetModel();
+	
 	entry_ref srcRef;
 	if (targetModel->IsDirectory() && dragMessage->HasRef("refs") 
 			&& dragMessage->FindRef("refs", &srcRef) == B_OK) {



From colacoder at mail.berlios.de  Mon Feb  9 17:42:21 2009
From: colacoder at mail.berlios.de (colacoder at mail.berlios.de)
Date: Mon, 9 Feb 2009 17:42:21 +0100
Subject: [Haiku-commits] r29172 -
	haiku/trunk/src/add-ons/kernel/drivers/audio/hda
Message-ID: <200902091642.n19GgLOF004815@sheep.berlios.de>

Author: colacoder
Date: 2009-02-09 17:42:04 +0100 (Mon, 09 Feb 2009)
New Revision: 29172
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29172&view=rev

Modified:
   haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp
Log:
Do not enable interrupts on codec status change, since we do not handle those. This fixes the lockup on the EeePC, and follows the description in the HDA specs.

Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp	2009-02-09 05:19:50 UTC (rev 29171)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp	2009-02-09 16:42:04 UTC (rev 29172)
@@ -789,9 +789,15 @@
 		dprintf("hda: init_corb_rirb_pos failed\n");
 		goto corb_rirb_failed;
 	}
-	
-	controller->Write16(HDAC_WAKE_ENABLE, 0x7fff);
 
+	/*
+         * Don't enable codec state change interrupts. We don't handle
+         * them, as we want to use the STATE_STATUS register to identify
+         * available codecs. We'd have to clear that register in the interrupt
+         * handler to 'ack' the codec change.
+         */
+	controller->Write16(HDAC_WAKE_ENABLE, 0x0);
+
 	/* Enable controller interrupts */
 	controller->Write32(HDAC_INTR_CONTROL, INTR_CONTROL_GLOBAL_ENABLE
 		| INTR_CONTROL_CONTROLLER_ENABLE);



From anevilyak at gmail.com  Mon Feb  9 19:27:05 2009
From: anevilyak at gmail.com (Rene Gollent)
Date: Mon, 9 Feb 2009 12:27:05 -0600
Subject: [Haiku-commits] r29172 -
	haiku/trunk/src/add-ons/kernel/drivers/audio/hda
In-Reply-To: <200902091642.n19GgLOF004815@sheep.berlios.de>
References: <200902091642.n19GgLOF004815@sheep.berlios.de>
Message-ID: 

On Mon, Feb 9, 2009 at 10:42 AM,   wrote:
> Author: colacoder
> Log:
> Do not enable interrupts on codec status change, since we do not handle those. This fixes the lockup on the EeePC, and follows the description in the HDA specs.

Nice! :) Does the driver now work correctly on the Eee as well, or
does it just not lock up any more? :)

Regards,

Rene


From korli at mail.berlios.de  Mon Feb  9 20:06:45 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Mon, 9 Feb 2009 20:06:45 +0100
Subject: [Haiku-commits] r29173 - haiku/trunk/headers/build
Message-ID: <200902091906.n19J6jLi010007@sheep.berlios.de>

Author: korli
Date: 2009-02-09 20:06:44 +0100 (Mon, 09 Feb 2009)
New Revision: 29173
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29173&view=rev

Modified:
   haiku/trunk/headers/build/HaikuBuildCompatibility.h
Log:
add spinlock initializer constant for BeOS


Modified: haiku/trunk/headers/build/HaikuBuildCompatibility.h
===================================================================
--- haiku/trunk/headers/build/HaikuBuildCompatibility.h	2009-02-09 16:42:04 UTC (rev 29172)
+++ haiku/trunk/headers/build/HaikuBuildCompatibility.h	2009-02-09 19:06:44 UTC (rev 29173)
@@ -61,6 +61,10 @@
 #	define B_FIRST_REAL_TIME_PRIORITY B_REAL_TIME_DISPLAY_PRIORITY
 #endif
 
+#ifndef B_SPINLOCK_INITIALIZER
+#	define B_SPINLOCK_INITIALIZER 0
+#endif
+
 #if __GNUC__
 #	define _PRINTFLIKE(_format_, _args_) \
 		__attribute__((format(__printf__, _format_, _args_)))



From korli at mail.berlios.de  Mon Feb  9 22:03:33 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Mon, 9 Feb 2009 22:03:33 +0100
Subject: [Haiku-commits] r29174 -
	haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode
Message-ID: <200902092103.n19L3Xad022325@sheep.berlios.de>

Author: korli
Date: 2009-02-09 22:03:31 +0100 (Mon, 09 Feb 2009)
New Revision: 29174
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29174&view=rev

Modified:
   haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/driver.cpp
   haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_controller.cpp
Log:
* actually allocates and frees geode_multi struct
* also detect NS version of the chip


Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/driver.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/driver.cpp	2009-02-09 19:06:44 UTC (rev 29173)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/driver.cpp	2009-02-09 21:03:31 UTC (rev 29174)
@@ -55,8 +55,10 @@
 
 	for (i = 0; gPci->get_nth_pci_info(i, &info) == B_OK
 			&& gNumCards < MAX_CARDS; i++) {
-		if (info.vendor_id == AMD_VENDOR_ID
-			&& info.device_id == AMD_CS5536_AUDIO_DEVICE_ID) {
+		if ((info.vendor_id == AMD_VENDOR_ID
+			&& info.device_id == AMD_CS5536_AUDIO_DEVICE_ID)
+			|| (info.vendor_id == NS_VENDOR_ID
+				&& info.device_id == NS_CS5535_AUDIO_DEVICE_ID)) {
 			memset(&gCards[gNumCards], 0, sizeof(geode_controller));
 			gCards[gNumCards].pci_info = info;
 			gCards[gNumCards].opened = 0;

Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_controller.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_controller.cpp	2009-02-09 19:06:44 UTC (rev 29173)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_controller.cpp	2009-02-09 21:03:31 UTC (rev 29174)
@@ -425,6 +425,10 @@
 		
 	snooze(1000);
 
+	controller->multi = (geode_multi*)calloc(1, sizeof(geode_multi));
+        if (controller->multi == NULL)
+                return B_NO_MEMORY;
+
 	controller->playback_stream = geode_stream_new(controller, STREAM_PLAYBACK);
         controller->record_stream = geode_stream_new(controller, STREAM_RECORD);
 
@@ -482,6 +486,8 @@
 		controller->regs = NULL;
 	}
 
+	free(controller->multi);
+
 	geode_stream_delete(controller->playback_stream);
         geode_stream_delete(controller->record_stream);
 



From korli at mail.berlios.de  Mon Feb  9 23:31:12 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Mon, 9 Feb 2009 23:31:12 +0100
Subject: [Haiku-commits] r29175 -
	haiku/trunk/src/add-ons/kernel/drivers/audio/hda
Message-ID: <200902092231.n19MVC01000520@sheep.berlios.de>

Author: korli
Date: 2009-02-09 23:31:10 +0100 (Mon, 09 Feb 2009)
New Revision: 29175
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29175&view=rev

Modified:
   haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp
Log:
fix beeper widget on more codecs


Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp	2009-02-09 21:03:31 UTC (rev 29174)
+++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp	2009-02-09 22:31:10 UTC (rev 29175)
@@ -537,8 +537,15 @@
 		
 		/* Check specific node ids declared as inputs as beepers */
 		switch ((audioGroup->codec->vendor_id << 16) | audioGroup->codec->product_id) {
+			case 0x11d41882:
+			case 0x11d41883:
+			case 0x11d41884:
+			case 0x11d4194a:
+			case 0x11d4194b:
+			case 0x11d41987:
 			case 0x11d41988:
 			case 0x11d4198b:
+			case 0x11d4989b:
 				if (nodeID == 26)
 					widget.type = WT_BEEP_GENERATOR;
 				break;



From korli at mail.berlios.de  Mon Feb  9 23:33:02 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Mon, 9 Feb 2009 23:33:02 +0100
Subject: [Haiku-commits] r29176 - haiku/trunk/src/preferences/keymap
Message-ID: <200902092233.n19MX26A001090@sheep.berlios.de>

Author: korli
Date: 2009-02-09 23:33:01 +0100 (Mon, 09 Feb 2009)
New Revision: 29176
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29176&view=rev

Modified:
   haiku/trunk/src/preferences/keymap/KeymapWindow.cpp
Log:
fix #3414. Quits when the window is active.


Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp	2009-02-09 22:31:10 UTC (rev 29175)
+++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp	2009-02-09 22:33:01 UTC (rev 29176)
@@ -226,6 +226,8 @@
 bool 
 KeymapWindow::QuitRequested()
 {
+	if (!IsActive())
+		return false;
 	be_app->PostMessage(B_QUIT_REQUESTED);
 	return true;
 }



From korli at users.berlios.de  Mon Feb  9 23:34:43 2009
From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=)
Date: Mon, 9 Feb 2009 23:34:43 +0100
Subject: [Haiku-commits] r29176 - haiku/trunk/src/preferences/keymap
In-Reply-To: <200902092233.n19MX26A001090@sheep.berlios.de>
References: <200902092233.n19MX26A001090@sheep.berlios.de>
Message-ID: 

2009/2/9 korli at BerliOS 

> Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp
> ===================================================================
> --- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-02-09 22:31:10
> UTC (rev 29175)
> +++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2009-02-09 22:33:01
> UTC (rev 29176)
> @@ -226,6 +226,8 @@
>  bool
>  KeymapWindow::QuitRequested()
>  {
> +       if (!IsActive())
> +               return false;
>        be_app->PostMessage(B_QUIT_REQUESTED);
>        return true;
>  }
>

The shutdown process fails with this. Any ideas ?

Bye,
J?r?me
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 

From anevilyak at gmail.com  Tue Feb 10 00:05:53 2009
From: anevilyak at gmail.com (Rene Gollent)
Date: Mon, 9 Feb 2009 17:05:53 -0600
Subject: [Haiku-commits] r29176 - haiku/trunk/src/preferences/keymap
In-Reply-To: 
References: <200902092233.n19MX26A001090@sheep.berlios.de>
	
Message-ID: 

On Mon, Feb 9, 2009 at 4:34 PM, J?r?me Duval  wrote:
>
> The shutdown process fails with this. Any ideas ?
>

What you could do instead is override KeymapWindow::DispatchMessage()
and skip handling B_KEY_DOWN if it contains modifier cmd, key 'q', and
the window isn't currently focused. This way you wouldn't need to do
any special casing for B_QUIT_REQUESTED.

Regards,

Rene


From mmlr at mail.berlios.de  Tue Feb 10 00:06:49 2009
From: mmlr at mail.berlios.de (mmlr at mail.berlios.de)
Date: Tue, 10 Feb 2009 00:06:49 +0100
Subject: [Haiku-commits] r29177 - in haiku/trunk: headers/os/drivers
	headers/private/fs_shell src/add-ons/kernel/file_systems/bfs
	src/add-ons/kernel/file_systems/cdda
	src/add-ons/kernel/file_systems/ext2
	src/add-ons/kernel/file_systems/fat
	src/add-ons/kernel/file_systems/iso9660
	src/add-ons/kernel/file_systems/nfs
	src/add-ons/kernel/file_systems/reiserfs
	src/system/kernel/device_manager src/system/kernel/fs
	src/tools/fs_shell
Message-ID: <200902092306.n19N6nIn005885@sheep.berlios.de>

Author: mmlr
Date: 2009-02-10 00:06:31 +0100 (Tue, 10 Feb 2009)
New Revision: 29177
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29177&view=rev

Added:
   haiku/trunk/src/system/kernel/fs/overlay.cpp
   haiku/trunk/src/system/kernel/fs/overlay.h
Modified:
   haiku/trunk/headers/os/drivers/fs_interface.h
   haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h
   haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h
   haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c
   haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c
   haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp
   haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c
   haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Volume.cpp
   haiku/trunk/src/system/kernel/device_manager/devfs.cpp
   haiku/trunk/src/system/kernel/fs/Jamfile
   haiku/trunk/src/system/kernel/fs/rootfs.cpp
   haiku/trunk/src/system/kernel/fs/vfs.cpp
   haiku/trunk/src/system/kernel/fs/vfs_request_io.cpp
   haiku/trunk/src/tools/fs_shell/vfs.cpp
Log:
* Add an additional argument to get_vnode() that gets the fs_vnode_ops of the
  node. That is needed for a layered filesystem to be able to construct a full
  fs_vnode out of a volume/inode pair.
* Adapt places where get_vnode is used. Sadly this is a C API and we can't just
  use a default NULL for that argument.
* Introduce a flag B_VNODE_WANTS_OVERLAY_SUB_NODE that can be returned in the
  flags field of a fs get_vnode call. A filesystem can use this flag to indicate
  that it doesn't support the full set of fs features (attributes, write support)
  and it'd like to have unsupported calls emulated by an overlay sub node.
* Add a perliminary overlay filesystem that emulates file attributes using files
  on a filesystem where attributes aren't supported. It does currently only
  support reading attributes/attribute directories though. All other calls are
  just passed through to the super filesystem.
* Adjust places where a HAS_FS_CALL() is taken as a guarantee that the operation
  is supported. For the overlay filesystem we may later return a B_UNSUPPORTED,
  so make sure that in that case proper fallback options are taken.
* Make the iso9660 filesystem request overlay sub nodes. This can be fine tuned
  later to only trigger where there are features on a CD that need emulation
  at all.

If you happened to know the attribute file format and location you could build
an iso with read-only attribute support now. Note that this won't be enough to
get a bootable iso-only image as the query and index support is yet missing.


Modified: haiku/trunk/headers/os/drivers/fs_interface.h
===================================================================
--- haiku/trunk/headers/os/drivers/fs_interface.h	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/headers/os/drivers/fs_interface.h	2009-02-09 23:06:31 UTC (rev 29177)
@@ -43,6 +43,7 @@
 // flags for publish_vnode() and fs_volume_ops::get_vnode()
 #define B_VNODE_PUBLISH_REMOVED					0x01
 #define B_VNODE_DONT_CREATE_SPECIAL_SUB_NODE	0x02
+#define B_VNODE_WANTS_OVERLAY_SUB_NODE			0x04
 
 
 #ifdef __cplusplus
@@ -307,7 +308,7 @@
 					void *privateNode, fs_vnode_ops *ops, int type,
 					uint32 flags);
 extern status_t get_vnode(fs_volume *volume, ino_t vnodeID,
-					void **_privateNode);
+					void **_privateNode, fs_vnode_ops **_vnodeOps);
 extern status_t put_vnode(fs_volume *volume, ino_t vnodeID);
 extern status_t acquire_vnode(fs_volume *volume, ino_t vnodeID);
 extern status_t remove_vnode(fs_volume *volume, ino_t vnodeID);

Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h
===================================================================
--- haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h	2009-02-09 23:06:31 UTC (rev 29177)
@@ -344,7 +344,8 @@
 				fssh_vnode_id vnodeID, void *privateNode,
 				fssh_fs_vnode_ops *ops, int type, uint32_t flags);
 extern fssh_status_t fssh_get_vnode(fssh_fs_volume *volume,
-				fssh_vnode_id vnodeID, void **_privateNode);
+				fssh_vnode_id vnodeID, void **_privateNode,
+				fssh_fs_vnode_ops **_vnodeOps);
 extern fssh_status_t fssh_put_vnode(fssh_fs_volume *volume,
 				fssh_vnode_id vnodeID);
 extern fssh_status_t fssh_acquire_vnode(fssh_fs_volume *volume,

Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp	2009-02-09 23:06:31 UTC (rev 29177)
@@ -2701,7 +2701,7 @@
 	// if you haven't yet access to the attributes directory, get it
 	if (fAttributes == NULL) {
 		if (get_vnode(volume->FSVolume(), volume->ToVnode(fInode->Attributes()),
-				(void**)&fAttributes) != B_OK) {
+				(void**)&fAttributes, NULL) != B_OK) {
 			FATAL(("get_vnode() failed in AttributeIterator::GetNext(ino_t"
 				" = %Ld,name = \"%s\")\n", fInode->ID(), name));
 			return B_ENTRY_NOT_FOUND;

Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h	2009-02-09 23:06:31 UTC (rev 29177)
@@ -354,7 +354,8 @@
 	{
 		Unset();
 
-		return fStatus = get_vnode(volume->FSVolume(), id, (void**)&fInode);
+		return fStatus = get_vnode(volume->FSVolume(), id, (void**)&fInode,
+			NULL);
 	}
 
 	status_t SetTo(Volume* volume, block_run run)

Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp	2009-02-09 23:06:31 UTC (rev 29177)
@@ -556,7 +556,7 @@
 	locker.Unlock();
 
 	Inode* inode;
-	status = get_vnode(volume->FSVolume(), *_vnodeID, (void**)&inode);
+	status = get_vnode(volume->FSVolume(), *_vnodeID, (void**)&inode, NULL);
 	if (status != B_OK) {
 		REPORT_ERROR(status);
 		return B_ENTRY_NOT_FOUND;

Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp	2009-02-09 23:06:31 UTC (rev 29177)
@@ -1493,7 +1493,7 @@
 	if (inode == NULL)
 		return B_ENTRY_NOT_FOUND;
 
-	status = get_vnode(volume->FSVolume(), inode->ID(), NULL);
+	status = get_vnode(volume->FSVolume(), inode->ID(), NULL, NULL);
 	if (status < B_OK)
 		return status;
 

Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp	2009-02-09 23:06:31 UTC (rev 29177)
@@ -310,7 +310,7 @@
 	if ((fBlockCache = opener.InitCache(NumBlocks(), fBlockSize)) == NULL)
 		return B_ERROR;
 
-	status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode);
+	status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode, NULL);
 	if (status != B_OK) {
 		TRACE("could not create root node: get_vnode() failed!\n");
 		return status;

Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp	2009-02-09 23:06:31 UTC (rev 29177)
@@ -319,7 +319,7 @@
 			break;
 	}
 
-	return get_vnode(volume->FSVolume(), *_vnodeID, NULL);
+	return get_vnode(volume->FSVolume(), *_vnodeID, NULL, NULL);
 }
 
 

Modified: haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c	2009-02-09 23:06:31 UTC (rev 29177)
@@ -433,7 +433,7 @@
 		if (vnid)
 			*vnid = found_vnid;
 		if (node)
-			result = get_vnode(vol->volume, found_vnid, (void **)node);
+			result = get_vnode(vol->volume, found_vnid, (void **)node, NULL);
 		result = B_OK;
 	} else {
 		result = ENOENT;

Modified: haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c	2009-02-09 23:06:31 UTC (rev 29177)
@@ -890,7 +890,7 @@
 		*vnid = dummy.vnid;
 		dummy.magic = ~VNODE_MAGIC;
 
-		result = get_vnode(_vol, *vnid, (void **)&file);
+		result = get_vnode(_vol, *vnid, (void **)&file, NULL);
 		if (result < B_OK) {
 			if (vol->fs_flags & FS_FLAGS_OP_SYNC)
 				_dosfs_sync(vol);
@@ -1155,7 +1155,7 @@
 			if (vnid == vol->root_vnode.vnid)
 				break;
 
-			result = get_vnode(_vol, vnid, (void **)&dir);
+			result = get_vnode(_vol, vnid, (void **)&dir, NULL);
 			if (result < B_OK)
 				goto bi1;
 			parent = dir->dir_vnid;

Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp	2009-02-09 23:06:31 UTC (rev 29177)
@@ -224,12 +224,12 @@
 		// base directory
 		TRACE(("fs_walk - found \".\" file.\n"));
 		*_vnodeID = baseNode->id;
-		return get_vnode(_vol, *_vnodeID, (void **)&newNode);
+		return get_vnode(_vol, *_vnodeID, NULL, NULL);
 	} else if (strcmp(file, "..") == 0) {
 		// parent directory
 		TRACE(("fs_walk - found \"..\" file.\n"));
 		*_vnodeID = baseNode->parID;
-		return get_vnode(_vol, *_vnodeID, (void **)&newNode);
+		return get_vnode(_vol, *_vnodeID, NULL, NULL);
 	}
 
 	// look up file in the directory
@@ -272,7 +272,7 @@
 						TRACE(("fs_walk - New vnode id is %Ld\n", *_vnodeID));
 
 						result = get_vnode(_vol, *_vnodeID,
-							(void **)&newNode);
+							(void **)&newNode, NULL);
 						if (result == B_OK) {
 							newNode->parID = baseNode->id;
 							done = true;
@@ -349,7 +349,7 @@
 	_node->private_node = newNode;
 	_node->ops = &gISO9660VnodeOps;
 	*_type = newNode->attr.stat[FS_DATA_FORMAT].st_mode & ~(S_IWUSR | S_IWGRP | S_IWOTH);
-	*_flags = 0;
+	*_flags = B_VNODE_WANTS_OVERLAY_SUB_NODE;
 
 	if ((newNode->flags & ISO_ISDIR) == 0) {
 		newNode->cache = file_cache_create(ns->id, vnodeID,

Modified: haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c
===================================================================
--- haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c	2009-02-09 23:06:31 UTC (rev 29177)
@@ -898,7 +898,7 @@
 		isLink=S_ISLNK(st.st_mode);
 	}
 
-	if ((result=get_vnode (_volume,*vnid,(void **)&dummy))volume, device->id, (void**)&partition->raw_device);
+	status = get_vnode(fs->volume, device->id, (void**)&partition->raw_device,
+		NULL);
 	if (status < B_OK)
 		goto err1;
 
@@ -937,7 +938,7 @@
 {
 	struct devfs *fs = (struct devfs *)_volume->private_volume;
 	struct devfs_vnode *dir = (struct devfs_vnode *)_dir->private_node;
-	struct devfs_vnode *vnode, *vdummy;
+	struct devfs_vnode *vnode;
 	status_t status;
 
 	TRACE(("devfs_lookup: entry dir %p, name '%s'\n", dir, name));
@@ -958,7 +959,7 @@
 		return B_ENTRY_NOT_FOUND;
 	}
 
-	status = get_vnode(fs->volume, vnode->id, (void**)&vdummy);
+	status = get_vnode(fs->volume, vnode->id, NULL, NULL);
 	if (status < B_OK)
 		return status;
 
@@ -1062,7 +1063,7 @@
 	if (openMode & O_EXCL)
 		return B_FILE_EXISTS;
 
-	status = get_vnode(fs->volume, vnode->id, NULL);
+	status = get_vnode(fs->volume, vnode->id, NULL, NULL);
 	if (status < B_OK)
 		return status;
 
@@ -2091,7 +2092,7 @@
 {
 	devfs_vnode* node;
 	status_t status = get_vnode(sDeviceFileSystem->volume, device->ID(),
-		(void**)&node);
+		(void**)&node, NULL);
 	if (status != B_OK)
 		return status;
 

Modified: haiku/trunk/src/system/kernel/fs/Jamfile
===================================================================
--- haiku/trunk/src/system/kernel/fs/Jamfile	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/system/kernel/fs/Jamfile	2009-02-09 23:06:31 UTC (rev 29177)
@@ -12,6 +12,7 @@
 	fifo.cpp
 	KPath.cpp
 	node_monitor.cpp
+	overlay.cpp
 	rootfs.cpp
 	socket.cpp
 	vfs.cpp

Added: haiku/trunk/src/system/kernel/fs/overlay.cpp
===================================================================
--- haiku/trunk/src/system/kernel/fs/overlay.cpp	2009-02-09 22:33:01 UTC (rev 29176)
+++ haiku/trunk/src/system/kernel/fs/overlay.cpp	2009-02-09 23:06:31 UTC (rev 29177)
@@ -0,0 +1,1097 @@
+/*
+ * Copyright 2009, Haiku Inc. All rights reserved.
+ * Distributed under the terms of the MIT License.
+ *
+ * Authors:
+ *		Michael Lotz 
+ */
+
+#include 
+#include 
+#include 
+
+#include 
+
+#include 
+#include 
+#include 
+
+#include "overlay.h"
+
+
+//#define TRACE_OVERLAY
+#ifdef TRACE_OVERLAY
+#define TRACE(x...)			dprintf("overlay: " x)
+#define TRACE_ALWAYS(x...)	dprintf("overlay: " x)
+#else
+#define TRACE(x...)			/* nothing */
+#define TRACE_ALWAYS(x...)	dprintf("overlay: " x)
+#endif
+
+
+namespace overlay {
+
+class AttributeFile;
+class AttributeEntry;
+
+
+class OverlayInode {
+public:
+							OverlayInode(fs_volume *superVolume,
+								fs_vnode *superVnode);
+							~OverlayInode();
+
+		status_t			InitCheck();
+
+		fs_vnode *			SuperVnode() { return &fSuperVnode; }
+
+		AttributeFile *		GetAttributeFile();
+
+private:
+		fs_volume			fSuperVolume;
+		fs_vnode			fSuperVnode;
+		AttributeFile *		fAttributeFile;
+};
+
+
+class AttributeFile {
+public:
+							AttributeFile(fs_volume *volume, fs_vnode *vnode);
+							~AttributeFile();
+
+		status_t			InitCheck() { return fStatus; }
+
+		dev_t				VolumeID() { return fVolumeID; }
+		ino_t				ParentInode() { return fParentInode; }
+
+		uint32				CountAttributes();
+		AttributeEntry *	FindAttribute(const char *name);
+
+		status_t			ReadAttributeDir(struct dirent *dirent,
+								size_t bufferSize, uint32 *numEntries);
+		status_t			RewindAttributeDir()
+							{
+								fAttributeDirIndex = 0;
+								return B_OK;
+							}
+
+private:
+		#define ATTRIBUTE_OVERLAY_FILE_MAGIC			'attr'
+		#define ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME	"_HAIKU"
+
+		struct attribute_file {
+			uint32			magic; // 'attr'
+			uint32			entry_count;
+			uint8			entries[1];
+		} _PACKED;
+
+		status_t			fStatus;
+		dev_t				fVolumeID;
+		ino_t				fParentInode;
+		attribute_file *	fFile;
+		uint32				fAttributeDirIndex;
+		AttributeEntry **	fEntries;
+};
+
+
+class AttributeEntry {
+public:
+							AttributeEntry(AttributeFile *parent,
+								uint8 *buffer);
+							~AttributeEntry();
+
+		size_t				EntrySize();
+
+		uint8				NameLength() { return fEntry->name_length; }
+		const char *		Name() { return fEntry->name; }
+
+		status_t			FillDirent(struct dirent *dirent,
+								size_t bufferSize, uint32 *numEntries);
+
+		status_t			Read(off_t position, void *buffer, size_t *length);
+		status_t			ReadStat(struct stat *stat);
+
+private:
+		struct attribute_entry {
+			type_code		type;
+			uint32			size;
+			uint8			name_length; // including 0 byte
+			char			name[1]; // 0 terminated, followed by data
+		} _PACKED;
+
+		AttributeFile *		fParent;
+		attribute_entry *	fEntry;
+		uint8 *				fData;
+};
+
+
+//	#pragma mark OverlayInode
+
+
+OverlayInode::OverlayInode(fs_volume *superVolume, fs_vnode *superVnode)
+	:	fSuperVolume(*superVolume),
+		fSuperVnode(*superVnode),
+		fAttributeFile(NULL)
+{
+	TRACE("inode created\n");
+}
+
+
+OverlayInode::~OverlayInode()
+{
+	TRACE("inode destroyed\n");
+	delete fAttributeFile;
+}
+
+
+status_t
+OverlayInode::InitCheck()
+{
+	return B_OK;
+}
+
+
+AttributeFile *
+OverlayInode::GetAttributeFile()
+{
+	if (fAttributeFile == NULL) {
+		fAttributeFile = new(std::nothrow) AttributeFile(&fSuperVolume,
+			&fSuperVnode);
+		if (fAttributeFile == NULL) {
+			TRACE_ALWAYS("no memory to allocate attribute file\n");
+			return NULL;
+		}
+	}
+
+	if (fAttributeFile->InitCheck() != B_OK)
+		return NULL;
+
+	return fAttributeFile;
+}
+
+
+//	#pragma mark AttributeFile
+
+
+AttributeFile::AttributeFile(fs_volume *volume, fs_vnode *vnode)
+	:	fStatus(B_NO_INIT),
+		fVolumeID(volume->id),
+		fParentInode(0),
+		fFile(NULL),
+		fAttributeDirIndex(0),
+		fEntries(NULL)
+{
+	if (vnode->ops->get_vnode_name == NULL) {
+		TRACE_ALWAYS("cannot get vnode name, hook missing\n");
+		fStatus = B_UNSUPPORTED;
+		return;
+	}
+
+	char nameBuffer[B_FILE_NAME_LENGTH];
+	nameBuffer[sizeof(nameBuffer) - 1] = 0;
+	fStatus = vnode->ops->get_vnode_name(volume, vnode, nameBuffer,
+		sizeof(nameBuffer) - 1);
+	if (fStatus != B_OK) {
+		TRACE_ALWAYS("failed to get vnode name: %s\n", strerror(fStatus));
+		return;
+	}
+
+	if (strcmp(nameBuffer, ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME) == 0) {
+		// we don't want attribute overlays on the attribute dir itself
+		fStatus = B_UNSUPPORTED;
+		return;
+	}
+
+	struct stat stat;
+	if (vnode->ops->read_stat != NULL
+		&& vnode->ops->read_stat(volume, vnode, &stat) == B_OK) {
+		fParentInode = stat.st_ino;
+	}
+
+	// TODO: the ".." lookup is not actually valid for non-directory vnodes.
+	// we make use of the fact that a filesystem probably still provides the
+	// lookup hook and has hardcoded ".." to resolve to the parent entry. if we
+	// wanted to do this correctly we need some other way to relate this vnode
+	// to its parent directory vnode.
+	const char *lookup[]
+		= { "..", ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME, nameBuffer };
+	int32 lookupCount = sizeof(lookup) / sizeof(lookup[0]);
+	fs_vnode currentVnode = *vnode;
+	ino_t lastInodeNumber = 0;
+
+	for (int32 i = 0; i < lookupCount; i++) {
+		if (currentVnode.ops->lookup == NULL) {
+			TRACE_ALWAYS("lookup not possible, lookup hook missing\n");
+			fStatus = B_UNSUPPORTED;
+			if (i > 0)
+				put_vnode(volume, lastInodeNumber);
+			return;
+		}
+
+		ino_t inodeNumber;
+		fStatus = currentVnode.ops->lookup(volume, ¤tVnode, lookup[i],
+			&inodeNumber);
+
+		if (i > 0)
+			put_vnode(volume, lastInodeNumber);
+
+		if (fStatus != B_OK) {
+			if (fStatus != B_ENTRY_NOT_FOUND) {
+				TRACE_ALWAYS("lookup of \"%s\" failed: %s\n", lookup[i],
+					strerror(fStatus));
+			}
+			return;
+		}
+
+		fStatus = get_vnode(volume, inodeNumber, ¤tVnode.private_node,
+			¤tVnode.ops);
+		if (fStatus != B_OK) {
+			TRACE_ALWAYS("getting vnode failed: %s\n", strerror(fStatus));
+			return;
+		}
+
+		lastInodeNumber = inodeNumber;
+	}
+
+	if (currentVnode.ops->read_stat == NULL || currentVnode.ops->open == NULL
+		|| currentVnode.ops->read == NULL) {
+		TRACE_ALWAYS("can't use attribute file, hooks missing\n");
+		put_vnode(volume, lastInodeNumber);
+		fStatus = B_UNSUPPORTED;
+		return;
+	}
+
+	fStatus = currentVnode.ops->read_stat(volume, ¤tVnode, &stat);
+	if (fStatus != B_OK) {
+		TRACE_ALWAYS("failed to stat attribute file: %s\n", strerror(fStatus));
+		put_vnode(volume, lastInodeNumber);
+		return;
+	}
+
+	void *attrFileCookie = NULL;
+	fStatus = currentVnode.ops->open(volume, ¤tVnode, O_RDONLY,
+		&attrFileCookie);
+	if (fStatus != B_OK) {
+		TRACE_ALWAYS("failed to open attribute file: %s\n", strerror(fStatus));
+		put_vnode(volume, lastInodeNumber);
+		return;
+	}
+
+	size_t readLength = stat.st_size;
+	uint8 *buffer = (uint8 *)malloc(readLength);
+	if (buffer == NULL) {
+		TRACE_ALWAYS("cannot allocate memory for read buffer\n");
+		put_vnode(volume, lastInodeNumber);
+		fStatus = B_NO_MEMORY;
+		return;
+	}
+
+	fStatus = currentVnode.ops->read(volume, ¤tVnode, attrFileCookie, 0,
+		buffer, &readLength);
+	if (fStatus != B_OK) {
+		TRACE_ALWAYS("failed to read from file: %s\n", strerror(fStatus));
+		put_vnode(volume, lastInodeNumber);
+		return;
+	}
+
+	if (currentVnode.ops->close != NULL)
+		currentVnode.ops->close(volume, ¤tVnode, attrFileCookie);
+	if (currentVnode.ops->free_cookie != NULL)
+		currentVnode.ops->free_cookie(volume, ¤tVnode, attrFileCookie);
+
+	put_vnode(volume, lastInodeNumber);
+
+	fFile = (attribute_file *)buffer;
+	if (fFile->magic != ATTRIBUTE_OVERLAY_FILE_MAGIC) {
+		TRACE_ALWAYS("attribute file has bad magic\n");
+		fStatus = B_BAD_VALUE;
+		return;
+	}
+
+	fEntries = new(std::nothrow) AttributeEntry *[fFile->entry_count];
+	if (fEntries == NULL) {
+		TRACE_ALWAYS("no memory to allocate entry pointers\n");
+		fStatus = B_NO_MEMORY;
+		return;
+	}
+
+	for (uint32 i = 0; i < fFile->entry_count; i++)
+		fEntries[i] = NULL;
+
+	size_t totalSize = 0;
+	readLength -= sizeof(attribute_file) - 1;
+	for (uint32 i = 0; i < fFile->entry_count; i++) {
+		fEntries[i] = new(std::nothrow) AttributeEntry(this,
+			fFile->entries + totalSize);
+		if (fEntries[i] == NULL) {
+			TRACE_ALWAYS("no memory to allocate attribute entry\n");
+			fStatus = B_NO_MEMORY;
+			return;
+		}
+
+		totalSize += fEntries[i]->EntrySize();
+		if (totalSize > readLength) {
+			TRACE_ALWAYS("attribute entries are too large for buffer\n");
+			fStatus = B_BAD_VALUE;
+			return;
+		}
+	}
+}
+
+
+AttributeFile::~AttributeFile()
+{
+	if (fFile == NULL)
+		return;
+
+	if (fEntries != NULL) {
+		for (uint32 i = 0; i < fFile->entry_count; i++)
+			delete fEntries[i];
+
+		delete [] fEntries;
+	}
+
+	free(fFile);
+}
+
+
+uint32
+AttributeFile::CountAttributes()
+{
+	if (fFile == NULL)
+		return 0;
+
+	return fFile->entry_count;
+}
+
+
+AttributeEntry *
+AttributeFile::FindAttribute(const char *name)
+{
+	if (fFile == NULL)
+		return NULL;
+
+	for (uint32 i = 0; i < fFile->entry_count; i++) {
+		if (strncmp(fEntries[i]->Name(), name, fEntries[i]->NameLength()) == 0)
+			return fEntries[i];
+	}
+
+	return NULL;
+}
+
+
+status_t
+AttributeFile::ReadAttributeDir(struct dirent *dirent, size_t bufferSize,
+	uint32 *numEntries)
+{
+	if (fFile == NULL || fAttributeDirIndex >= fFile->entry_count) {
+		*numEntries = 0;
+		return B_OK;
+	}
+
+	return fEntries[fAttributeDirIndex++]->FillDirent(dirent, bufferSize,
+		numEntries);
+}
+
+
+//	#pragma mark AttributeEntry
+
+
+AttributeEntry::AttributeEntry(AttributeFile *parent, uint8 *buffer)
+	:	fParent(parent),
+		fEntry(NULL),
+		fData(NULL)
+{
+	fEntry = (attribute_entry *)buffer;
+	fData = (uint8 *)fEntry->name + fEntry->name_length;
+}
+
+
+AttributeEntry::~AttributeEntry()
+{
+}
+
+
+size_t
+AttributeEntry::EntrySize()
+{
+	return sizeof(attribute_entry) - 1 + fEntry->name_length + fEntry->size;
+}
+
+
+status_t
+AttributeEntry::FillDirent(struct dirent *dirent, size_t bufferSize,
+	uint32 *numEntries)
+{
+	dirent->d_dev = dirent->d_pdev = fParent->VolumeID();
+	dirent->d_ino = (ino_t)this;
+	dirent->d_pino = fParent->ParentInode();
+	dirent->d_reclen = sizeof(struct dirent) + fEntry->name_length;
+	if (bufferSize < dirent->d_reclen) {
+		*numEntries = 0;
+		return B_BAD_VALUE;
+	}
+
+	strncpy(dirent->d_name, fEntry->name, fEntry->name_length);
+	dirent->d_name[fEntry->name_length - 1] = 0;
+	*numEntries = 1;
+	return B_OK;
+}
+
+
+status_t
+AttributeEntry::Read(off_t position, void *buffer, size_t *length)
+{
+	*length = min_c(*length, fEntry->size);
+	if (*length <= position) {
+		*length = 0;
+		return B_OK;
+	}
+
+	*length -= position;
+	memcpy(buffer, fData + position, *length);
+	return B_OK;
+}
+
+
+status_t
+AttributeEntry::ReadStat(struct stat *stat)
+{
+	stat->st_dev = fParent->VolumeID();
+	stat->st_ino = (ino_t)this;
+	stat->st_nlink = 1;
+	stat->st_blksize = 512;
+	stat->st_uid = 1;
+	stat->st_gid = 1;
+	stat->st_size = fEntry->size;
+	stat->st_mode = S_ATTR | 0x0777;
+	stat->st_type = fEntry->type;
+	stat->st_atime = stat->st_mtime = stat->st_crtime = time(NULL);
+	stat->st_blocks = (fEntry->size + stat->st_blksize - 1) / stat->st_blksize;
+	return B_OK;
+}
+
+
+//	#pragma mark -
+
+
+static status_t
+overlay_put_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter)
+{
+	OverlayInode *node = (OverlayInode *)vnode->private_node;
+	fs_vnode *superVnode = node->SuperVnode();
+
+	status_t result = B_OK;
+	if (superVnode->ops->put_vnode != NULL)
+		result = superVnode->ops->put_vnode(volume, superVnode, reenter);
+
+	delete node;
+	return result;
+}
+
+
+static status_t
+overlay_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter)
+{
+	OverlayInode *node = (OverlayInode *)vnode->private_node;
+	fs_vnode *superVnode = node->SuperVnode();
+
+	status_t result = B_OK;
+	if (superVnode->ops->remove_vnode != NULL)
+		result = superVnode->ops->remove_vnode(volume, superVnode, reenter);
+
+	delete node;
+	return result;
+}
+
+
+static status_t
+overlay_get_super_vnode(fs_volume *volume, fs_vnode *vnode,
+	fs_volume *superVolume, fs_vnode *_superVnode)
+{
+	OverlayInode *node = (OverlayInode *)vnode->private_node;
+	fs_vnode *superVnode = node->SuperVnode();
+
+	if (superVnode->ops->get_super_vnode != NULL) {
+		return superVnode->ops->get_super_vnode(volume, superVnode, superVolume,
+			_superVnode);
+	}
+
+	*_superVnode = *superVnode;
+	return B_OK;
+}
+
+
+//	#pragma mark -
+
+
+#define OVERLAY_CALL(op, params...) \
+	TRACE("relaying op: " #op "\n"); \
+	OverlayInode *node = (OverlayInode *)vnode->private_node; \
+	fs_vnode *superVnode = node->SuperVnode(); \
+	if (superVnode->ops->op != NULL) \
+		return superVnode->ops->op(volume, superVnode, params);
+
+
+static status_t
+overlay_lookup(fs_volume *volume, fs_vnode *vnode, const char *name, ino_t *id)
+{
+	OVERLAY_CALL(lookup, name, id)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_get_vnode_name(fs_volume *volume, fs_vnode *vnode, char *buffer,
+	size_t bufferSize)
+{
+	OVERLAY_CALL(get_vnode_name, buffer, bufferSize)
+	return B_UNSUPPORTED;
+}
+
+
+static bool
+overlay_can_page(fs_volume *volume, fs_vnode *vnode, void *cookie)
+{
+	OVERLAY_CALL(can_page, cookie)
+	return false;
+}
+
+
+static status_t
+overlay_read_pages(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos,
+	const iovec *vecs, size_t count, size_t *numBytes)
+{
+	OVERLAY_CALL(read_pages, cookie, pos, vecs, count, numBytes)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_write_pages(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos,
+	const iovec *vecs, size_t count, size_t *numBytes)
+{
+	OVERLAY_CALL(write_pages, cookie, pos, vecs, count, numBytes)
+	return B_UNSUPPORTED;
+}
+
+
+#if 0
+static status_t
+overlay_io(fs_volume *volume, fs_vnode *vnode, void *cookie,
+	io_request *request)
+{
+	OVERLAY_CALL(io, cookie, request)
+	return B_UNSUPPORTED;
+}
+#endif
+
+
+static status_t
+overlay_cancel_io(fs_volume *volume, fs_vnode *vnode, void *cookie,
+	io_request *request)
+{
+	OVERLAY_CALL(cancel_io, cookie, request)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_get_file_map(fs_volume *volume, fs_vnode *vnode, off_t offset,
+	size_t size, struct file_io_vec *vecs, size_t *count)
+{
+	OVERLAY_CALL(get_file_map, offset, size, vecs, count)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_ioctl(fs_volume *volume, fs_vnode *vnode, void *cookie, ulong op,
+	void *buffer, size_t length)
+{
+	OVERLAY_CALL(ioctl, cookie, op, buffer, length)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_set_flags(fs_volume *volume, fs_vnode *vnode, void *cookie,
+	int flags)
+{
+	OVERLAY_CALL(set_flags, cookie, flags)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_select(fs_volume *volume, fs_vnode *vnode, void *cookie, uint8 event,
+	selectsync *sync)
+{
+	OVERLAY_CALL(select, cookie, event, sync)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_deselect(fs_volume *volume, fs_vnode *vnode, void *cookie, uint8 event,
+	selectsync *sync)
+{
+	OVERLAY_CALL(deselect, cookie, event, sync)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_fsync(fs_volume *volume, fs_vnode *vnode)
+{
+	OverlayInode *node = (OverlayInode *)vnode->private_node;
+	fs_vnode *superVnode = node->SuperVnode();
+
+	if (superVnode->ops->fsync != NULL)
+		return superVnode->ops->fsync(volume, superVnode);
+
+	return B_OK;
+}
+
+
+static status_t
+overlay_read_symlink(fs_volume *volume, fs_vnode *vnode, char *buffer,
+	size_t *bufferSize)
+{
+	OVERLAY_CALL(read_symlink, buffer, bufferSize)
+	return B_UNSUPPORTED;
+}
+
+
+static status_t
+overlay_create_symlink(fs_volume *volume, fs_vnode *vnode, const char *name,
+	const char *path, int mode)
+{
+	OVERLAY_CALL(create_symlink, name, path, mode)

[... truncated: 636 lines follow ...]


From korli at mail.berlios.de  Tue Feb 10 00:27:02 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Tue, 10 Feb 2009 00:27:02 +0100
Subject: [Haiku-commits] r29178 - haiku/trunk/src/preferences/keymap
Message-ID: <200902092327.n19NR2ZJ008645@sheep.berlios.de>

Author: korli
Date: 2009-02-10 00:27:02 +0100 (Tue, 10 Feb 2009)
New Revision: 29178
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29178&view=rev

Modified:
   haiku/trunk/src/preferences/keymap/KeymapWindow.cpp
Log:
reverted r29176. it's not OK with shutdown and it could also be a bug in interface kit.


Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp
===================================================================
--- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp	2009-02-09 23:06:31 UTC (rev 29177)
+++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp	2009-02-09 23:27:02 UTC (rev 29178)
@@ -226,8 +226,6 @@
 bool 
 KeymapWindow::QuitRequested()
 {
-	if (!IsActive())
-		return false;
 	be_app->PostMessage(B_QUIT_REQUESTED);
 	return true;
 }



From korli at mail.berlios.de  Tue Feb 10 00:48:26 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Tue, 10 Feb 2009 00:48:26 +0100
Subject: [Haiku-commits] r29179 - haiku/trunk/src/kits/interface
Message-ID: <200902092348.n19NmQZ6024588@sheep.berlios.de>

Author: korli
Date: 2009-02-10 00:48:25 +0100 (Tue, 10 Feb 2009)
New Revision: 29179
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29179&view=rev

Modified:
   haiku/trunk/src/kits/interface/Window.cpp
Log:
* Handles shortcuts only when the window is active. This fixes bug #3414 (and hopefully is the R5 behavior).


Modified: haiku/trunk/src/kits/interface/Window.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Window.cpp	2009-02-09 23:27:02 UTC (rev 29178)
+++ haiku/trunk/src/kits/interface/Window.cpp	2009-02-09 23:48:25 UTC (rev 29179)
@@ -3400,8 +3400,8 @@
 		}
 	}
 
-	// Handle shortcuts
-	if ((modifiers & B_COMMAND_KEY) != 0) {
+	// Handle shortcuts when window is active
+	if ((modifiers & B_COMMAND_KEY) != 0 && fActive) {
 		// Command+q has been pressed, so, we will quit
 		// the shortcut mechanism doesn't allow handlers outside the window
 		if (!fNoQuitShortcut && (key == 'Q' || key == 'q')) {



From korli at mail.berlios.de  Tue Feb 10 00:58:38 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Tue, 10 Feb 2009 00:58:38 +0100
Subject: [Haiku-commits] r29180 - haiku/trunk/src/kits/interface
Message-ID: <200902092358.n19Nwchc004002@sheep.berlios.de>

Author: korli
Date: 2009-02-10 00:58:36 +0100 (Tue, 10 Feb 2009)
New Revision: 29180
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29180&view=rev

Modified:
   haiku/trunk/src/kits/interface/Window.cpp
Log:
* it seems we can skip _HandleKeyDown() when not active (keyboard navigation, shortcuts and screenshots).


Modified: haiku/trunk/src/kits/interface/Window.cpp
===================================================================
--- haiku/trunk/src/kits/interface/Window.cpp	2009-02-09 23:48:25 UTC (rev 29179)
+++ haiku/trunk/src/kits/interface/Window.cpp	2009-02-09 23:58:36 UTC (rev 29180)
@@ -1028,7 +1028,7 @@
 
 		case B_KEY_DOWN:
 		{
-			if (!_HandleKeyDown(msg)) {
+			if (!fActive || !_HandleKeyDown(msg)) {
 				if (BView* view = dynamic_cast(target)) {
 					// TODO: cannot use "string" here if we support having different
 					//	font encoding per view (it's supposed to be converted by
@@ -3400,8 +3400,8 @@
 		}
 	}
 
-	// Handle shortcuts when window is active
-	if ((modifiers & B_COMMAND_KEY) != 0 && fActive) {
+	// Handle shortcuts
+	if ((modifiers & B_COMMAND_KEY) != 0) {
 		// Command+q has been pressed, so, we will quit
 		// the shortcut mechanism doesn't allow handlers outside the window
 		if (!fNoQuitShortcut && (key == 'Q' || key == 'q')) {



From korli at mail.berlios.de  Tue Feb 10 23:18:06 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Tue, 10 Feb 2009 23:18:06 +0100
Subject: [Haiku-commits] r29181 - haiku/trunk/build/jam
Message-ID: <200902102218.n1AMI6bB017134@sheep.berlios.de>

Author: korli
Date: 2009-02-10 23:18:06 +0100 (Tue, 10 Feb 2009)
New Revision: 29181
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29181&view=rev

Modified:
   haiku/trunk/build/jam/OptionalPackages
Log:
added a tar optional package


Modified: haiku/trunk/build/jam/OptionalPackages
===================================================================
--- haiku/trunk/build/jam/OptionalPackages	2009-02-09 23:58:36 UTC (rev 29180)
+++ haiku/trunk/build/jam/OptionalPackages	2009-02-10 22:18:06 UTC (rev 29181)
@@ -31,6 +31,7 @@
 #	Pe
 #	Perl
 #	Subversion
+#	Tar
 #	Vision
 #	VLC
 #	Welcome
@@ -448,6 +449,20 @@
 }
 
 
+# Tar
+if [ IsOptionalHaikuImagePackageAdded Tar ] {
+        if $(TARGET_ARCH) != x86 {
+                Echo "No optional package Tar available for $(TARGET_ARCH)" ;
+        } else {
+		local baseURL = http://haiku-files.org/files/optional-packages ;
+                InstallOptionalHaikuImagePackage tar-1.21-gcc2-2009-02-08
+                        : $(baseURL)/tar-1.21-gcc2-2009-02-08.zip
+                        : 
+                ;
+        }
+}
+
+
 # Vision
 if [ IsOptionalHaikuImagePackageAdded Vision ] {
 	if $(TARGET_ARCH) != x86 {



From korli at mail.berlios.de  Wed Feb 11 00:36:57 2009
From: korli at mail.berlios.de (korli at BerliOS)
Date: Wed, 11 Feb 2009 00:36:57 +0100
Subject: [Haiku-commits] r29182 - haiku/trunk/src/apps/mail
Message-ID: <200902102336.n1ANava0032001@sheep.berlios.de>

Author: korli
Date: 2009-02-11 00:36:56 +0100 (Wed, 11 Feb 2009)
New Revision: 29182
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29182&view=rev

Modified:
   haiku/trunk/src/apps/mail/Header.cpp
Log:
* place the Encoding before the To. this fixes bug #1206


Modified: haiku/trunk/src/apps/mail/Header.cpp
===================================================================
--- haiku/trunk/src/apps/mail/Header.cpp	2009-02-10 22:18:06 UTC (rev 29181)
+++ haiku/trunk/src/apps/mail/Header.cpp	2009-02-10 23:36:56 UTC (rev 29182)
@@ -295,12 +295,12 @@
 		r.Set(windowRect.Width() - widestCharacterSet -
 			StringWidth(ENCODING_TEXT) - 2 * SEPARATOR_MARGIN,
 			y - 2, windowRect.Width() - SEPARATOR_MARGIN, y + menuFieldHeight);
-		field = new BMenuField (r, "encoding", ENCODING_TEXT, fEncodingMenu,
+		BMenuField *encodingField = new BMenuField (r, "encoding", ENCODING_TEXT, fEncodingMenu,
 			true /* fixedSize */,
 			B_FOLLOW_TOP | B_FOLLOW_RIGHT,
 			B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP);
-		field->SetDivider(field->StringWidth(ENCODING_TEXT) + 5);
-		AddChild(field);
+		encodingField->SetDivider(encodingField->StringWidth(ENCODING_TEXT) + 5);
+		AddChild(encodingField);
 
 		// And now the "from account" pop-up menu, on the left side, taking the
 		// remaining space.
@@ -353,7 +353,7 @@
 			true /* fixedSize */,
 			B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT,
 			B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP);
-		AddChild(field);
+		AddChild(field, encodingField);
 		field->SetDivider(x - 12 - SEPARATOR_MARGIN + kMenuFieldDividerOffset);
 		field->SetAlignment(B_ALIGN_RIGHT);
 #ifndef __HAIKU__



From humdingerb at mail.berlios.de  Wed Feb 11 17:29:38 2009
From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de)
Date: Wed, 11 Feb 2009 17:29:38 +0100
Subject: [Haiku-commits] r29183 - in haiku/trunk/docs: userguide/en
	userguide/en/preferences userguide/images/prefs-images welcome
Message-ID: <200902111629.n1BGTcg8014537@sheep.berlios.de>

Author: humdingerb
Date: 2009-02-11 17:29:31 +0100 (Wed, 11 Feb 2009)
New Revision: 29183
ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29183&view=rev

Added:
   haiku/trunk/docs/userguide/en/preferences/prefs-tracker.html
   haiku/trunk/docs/userguide/images/prefs-images/tracker-icon_16.png
   haiku/trunk/docs/userguide/images/prefs-images/tracker-icon_32.png
   haiku/trunk/docs/userguide/images/prefs-images/tracker-icon_64.png
Modified:
   haiku/trunk/docs/userguide/en/contents.html
   haiku/trunk/docs/userguide/en/preferences.html
   haiku/trunk/docs/userguide/en/preferences/prefs-time.html
   haiku/trunk/docs/userguide/en/preferences/prefs-virtualmemory.html
   haiku/trunk/docs/userguide/en/tracker.html
   haiku/trunk/docs/welcome/welcome.html
Log:
* Added the Tracker preference panel which points to the Tracker chapter,
  which in turn mentions the new Tracker preferences. Thanks aldeck for
  reminding me.
* Added Tracker icons.
* Added Tracker on the Preferences contents page.
* Small tweaks and corrections here and there.


Modified: haiku/trunk/docs/userguide/en/contents.html
===================================================================
--- haiku/trunk/docs/userguide/en/contents.html	2009-02-10 23:36:56 UTC (rev 29182)
+++ haiku/trunk/docs/userguide/en/contents.html	2009-02-11 16:29:31 UTC (rev 29183)
@@ -94,7 +94,7 @@
 	Attributes
-		One of Haiku's main features lets you add and manage any kind of data to any file.		
+		One of Haiku's main features lets you manage and add any kind of data to any file.		
 	Index
 		Use indexing to be able to search for attributes.
 	Queries
    @@ -120,7 +120,7 @@ Games and demo applications. --> Bash and Scripting - Learn of some interesting scripts in the system and about online resources for working in the shell and scripting. + Learn of some interesting scripts used by the system and about online resources for working in the shell and scripting. Modified: haiku/trunk/docs/userguide/en/preferences/prefs-time.html =================================================================== --- haiku/trunk/docs/userguide/en/preferences/prefs-time.html 2009-02-10 23:36:56 UTC (rev 29182) +++ haiku/trunk/docs/userguide/en/preferences/prefs-time.html 2009-02-11 16:29:31 UTC (rev 29183) @@ -30,7 +30,7 @@     Previous: Sounds     - Next: VirtualMemory + Next: Tracker

    @@ -68,7 +68,7 @@     Previous: Sounds     - Next: VirtualMemory + Next: Tracker

    Added: haiku/trunk/docs/userguide/en/preferences/prefs-tracker.html =================================================================== --- haiku/trunk/docs/userguide/en/preferences/prefs-tracker.html 2009-02-10 23:36:56 UTC (rev 29182) +++ haiku/trunk/docs/userguide/en/preferences/prefs-tracker.html 2009-02-11 16:29:31 UTC (rev 29183) @@ -0,0 +1,62 @@ + + + + + + + + + Tracker + + + + + +
    +

    + Preferences +     + Previous: Time +     + Next: VirtualMemory +

    +
    + +
    + +

    tracker-icon_64.pngTracker

    + + + + +
    Deskbar:Preferences
    Location:/boot/beos/preferences/Tracker
    Settings:~/config/settings/Tracker/TrackerSettings
    +


    +

    The Tracker preference panel is also available from every Tracker window with the menu Window | Preferences....
    +It's functions are discussed in the topic on Tracker.

    + + + + + Modified: haiku/trunk/docs/userguide/en/preferences/prefs-virtualmemory.html =================================================================== --- haiku/trunk/docs/userguide/en/preferences/prefs-virtualmemory.html 2009-02-10 23:36:56 UTC (rev 29182) +++ haiku/trunk/docs/userguide/en/preferences/prefs-virtualmemory.html 2009-02-11 16:29:31 UTC (rev 29183) @@ -28,7 +28,7 @@

    Preferences     - Previous: Time + Previous: Tracker

    @@ -57,7 +57,7 @@

    Preferences     - Previous: Time + Previous: Tracker

    --> Modified: haiku/trunk/docs/userguide/en/preferences.html =================================================================== --- haiku/trunk/docs/userguide/en/preferences.html 2009-02-10 23:36:56 UTC (rev 29182) +++ haiku/trunk/docs/userguide/en/preferences.html 2009-02-11 16:29:31 UTC (rev 29183) @@ -5,7 +5,7 @@ set %x\n", request.ifr_flags); if (ioctl(socket, SIOCSIFFLAGS, &request, sizeof(struct ifreq)) < 0) { fprintf(stderr, "%s: Setting flags failed: %s\n", kProgramName, strerror(errno)); From mmu_man at mail.berlios.de Sun Feb 15 19:11:57 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 15 Feb 2009 19:11:57 +0100 Subject: [Haiku-commits] r29219 - haiku/trunk/data/boot_cd Message-ID: <200902151811.n1FIBviL020430@sheep.berlios.de> Author: mmu_man Date: 2009-02-15 19:11:56 +0100 (Sun, 15 Feb 2009) New Revision: 29219 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29219&view=rev Modified: haiku/trunk/data/boot_cd/hfs.map Log: Partially revert r28610 as this is the correct way. Added a default case. Modified: haiku/trunk/data/boot_cd/hfs.map =================================================================== --- haiku/trunk/data/boot_cd/hfs.map 2009-02-15 17:28:49 UTC (rev 29218) +++ haiku/trunk/data/boot_cd/hfs.map 2009-02-15 18:11:56 UTC (rev 29219) @@ -2,7 +2,6 @@ # from treating everything like a text file (ugly!) # # EXTN XLate CREATOR TYPE Comment -#.b Raw 'UNIX' 'tbxi' "bootstrap" -#boot_loader_openfirmware Raw 'UNIX' 'boot' "bootstrap" -boot_loader_openfirmware Raw 'UNIX' 'tbxi' "bootstrap" +.b Raw 'UNIX' 'tbxi' "bootstrap" +boot_loader_openfirmware Raw 'UNIX' 'boot' "bootstrap" * Raw 'UNIX' 'UNIX' "unix" From stippi at mail.berlios.de Sun Feb 15 19:14:36 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 15 Feb 2009 19:14:36 +0100 Subject: [Haiku-commits] r29220 - haiku/trunk/src/servers/app/drawing/Painter Message-ID: <200902151814.n1FIEaNZ023329@sheep.berlios.de> Author: stippi Date: 2009-02-15 19:14:35 +0100 (Sun, 15 Feb 2009) New Revision: 29220 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29220&view=rev Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp haiku/trunk/src/servers/app/drawing/Painter/Painter.h Log: Finished the optimization for vertical gradients. This code is about 8.3 times faster than using the AGG pipeline, but about 3 times slower than drawing a solid color square. It can probably still be improved. The second version of _MakeGradient() is more powerful than the old one and should replace it. It handles some corner cases, which the other one does not. Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2009-02-15 18:11:56 UTC (rev 29219) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp 2009-02-15 18:14:35 UTC (rev 29220) @@ -864,20 +864,36 @@ BPoint b(max_c(r.left, r.right), max_c(r.top, r.bottom)); _Transform(&a, false); _Transform(&b, false); - + + // first, try an optimized version + if (gradient.GetType() == BGradient::TYPE_LINEAR + && (fDrawingMode == B_OP_COPY || fDrawingMode == B_OP_OVER)) { + const BGradientLinear* linearGradient + = dynamic_cast(&gradient); + if (linearGradient->Start().x == linearGradient->End().x + // TODO: Remove this second check once the optimized method + // handled "upside down" gradients as well... + && linearGradient->Start().y <= linearGradient->End().y) { + // a vertical gradient + BRect rect(a, b); + FillRectVerticalGradient(rect, *linearGradient); + return _Clipped(rect); + } + } + // account for stricter interpretation of coordinates in AGG // the rectangle ranges from the top-left (.0, .0) // to the bottom-right (.9999, .9999) corner of pixels b.x += 1.0; b.y += 1.0; - + fPath.remove_all(); fPath.move_to(a.x, a.y); fPath.line_to(b.x, a.y); fPath.line_to(b.x, b.y); fPath.line_to(a.x, b.y); fPath.close_polygon(); - + return _FillPath(fPath, gradient); } @@ -920,32 +936,37 @@ } while (fBaseRenderer.next_clip_box()); } -#if 0 // FillRectVerticalGradient void -Painter::FillRectVerticalGradient(const BRect& r, +Painter::FillRectVerticalGradient(BRect r, const BGradientLinear& gradient) const { if (!fValidClipping) return; + // Make sure the color array is no larger than the screen height. + r = r & fClippingRegion->Frame(); + int32 gradientArraySize = r.IntegerHeight() + 1; - rgb_color gradientArray[gradientArraySize]; - for (int32 i = 0; i < gradientArraySize; i++) { + uint32 gradientArray[gradientArraySize]; + int32 gradientTop = gradient.Start().y; + int32 gradientBottom = gradient.End().y; + int32 colorCount = gradientBottom - gradientTop + 1; + if (colorCount < 0) { + // Gradient is upside down. That's currently not supported by this + // method. + return; } + _MakeGradient(gradient, colorCount, gradientArray, + gradientTop - (int32)r.top, gradientArraySize); + uint8* dst = fBuffer.row_ptr(0); uint32 bpr = fBuffer.stride(); int32 left = (int32)r.left; int32 top = (int32)r.top; int32 right = (int32)r.right; int32 bottom = (int32)r.bottom; - // get a 32 bit pixel ready with the color - pixel32 color; - color.data8[0] = c.blue; - color.data8[1] = c.green; - color.data8[2] = c.red; - color.data8[3] = c.alpha; // fill rects, iterate over clipping boxes fBaseRenderer.first_clip_box(); do { @@ -958,14 +979,13 @@ for (; y1 <= y2; y1++) { // uint32* handle = (uint32*)(offset + y1 * bpr); // for (int32 x = x1; x <= x2; x++) { -// *handle++ = color.data32; +// *handle++ = gradientArray[y1 - top]; // } -gfxset32(offset + y1 * bpr, color.data32, (x2 - x1 + 1) * 4); +gfxset32(offset + y1 * bpr, gradientArray[y1 - top], (x2 - x1 + 1) * 4); } } } while (fBaseRenderer.next_clip_box()); } -#endif // FillRectNoClipping void @@ -2609,6 +2629,85 @@ } // _MakeGradient +void +Painter::_MakeGradient(const BGradient& gradient, int32 colorCount, + uint32* colors, int32 arrayOffset, int32 arraySize) const +{ + BGradient::ColorStop* from = gradient.ColorStopAt(0); + + if (!from) + return; + + // current index into "colors" array +// int32 index = (int32)floorf(colorCount * from->offset + 0.5) +// + arrayOffset; + int32 index = (int32)floorf(colorCount * from->offset / 255 + 0.5) + + arrayOffset; + if (index > arraySize) + index = arraySize; + // Make sure we fill the entire array in case the gradient is outside. + if (index > 0) { + uint8* c = (uint8*)&colors[0]; + for (int32 i = 0; i < index; i++) { + c[0] = from->color.blue; + c[1] = from->color.green; + c[2] = from->color.red; + c[3] = from->color.alpha; + c += 4; + } + } + + // interpolate "from" to "to" + int32 stopCount = gradient.CountColorStops(); + for (int32 i = 1; i < stopCount; i++) { + // find the step with the next offset + BGradient::ColorStop* to = gradient.ColorStopAtFast(i); + + // interpolate +// int32 offset = (int32)floorf((colorCount - 1) * to->offset + 0.5); + int32 offset = (int32)floorf((colorCount - 1) + * to->offset / 255 + 0.5); + if (offset > colorCount - 1) + offset = colorCount - 1; + offset += arrayOffset; + int32 dist = offset - index; + if (dist >= 0) { + int32 startIndex = max_c(index, 0); + int32 stopIndex = min_c(offset, arraySize - 1); + uint8* c = (uint8*)&colors[startIndex]; + for (int32 i = startIndex; i <= stopIndex; i++) { + float f = (float)(offset - i) / (float)(dist + 1); + float t = 1.0 - f; + c[0] = (uint8)floorf(from->color.blue * f + + to->color.blue * t + 0.5); + c[1] = (uint8)floorf(from->color.green * f + + to->color.green * t + 0.5); + c[2] = (uint8)floorf(from->color.red * f + + to->color.red * t + 0.5); + c[3] = (uint8)floorf(from->color.alpha * f + + to->color.alpha * t + 0.5); + c += 4; + } + } + index = offset + 1; + // the current "to" will be the "from" in the next interpolation + from = to; + } + // make sure we fill the entire array + if (index < arraySize - 1) { + int32 startIndex = max_c(index, 0); + uint8* c = (uint8*)&colors[startIndex]; + for (int32 i = startIndex; i < arraySize; i++) { + c[0] = from->color.red; + c[1] = from->color.green; + c[2] = from->color.blue; + c[3] = from->color.alpha; + c += 4; + } + } +} + +// _MakeGradient template void Painter::_MakeGradient(Array& array, const BGradient& gradient) const Modified: haiku/trunk/src/servers/app/drawing/Painter/Painter.h =================================================================== --- haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2009-02-15 18:11:56 UTC (rev 29219) +++ haiku/trunk/src/servers/app/drawing/Painter/Painter.h 2009-02-15 18:14:35 UTC (rev 29220) @@ -144,6 +144,14 @@ // fills a solid rect with color c, no blending void FillRect(const BRect& r, const rgb_color& c) const; + + // fills a rect with a linear gradient, the caller should be + // sure that the gradient is indeed vertical. The start point of + // the gradient should be above the end point, or this function + // will not draw anything. + void FillRectVerticalGradient(BRect r, + const BGradientLinear& gradient) const; + // fills a solid rect with color c, no blending, no clipping void FillRectNoClipping(const clipping_rect& r, const rgb_color& c) const; @@ -278,6 +286,11 @@ void _CalcLinearGradientTransform(BPoint startPoint, BPoint endPoint, agg::trans_affine& mtx, float gradient_d2 = 100.0f) const; + + void _MakeGradient(const BGradient& gradient, + int32 colorCount, uint32* colors, + int32 arrayOffset, int32 arraySize) const; + template void _MakeGradient(Array& array, const BGradient& gradient) const; From stippi at mail.berlios.de Sun Feb 15 19:23:29 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 15 Feb 2009 19:23:29 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker Message-ID: <200902151823.n1FINTFg001250@sheep.berlios.de> Author: stippi Date: 2009-02-15 19:23:19 +0100 (Sun, 15 Feb 2009) New Revision: 29221 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29221&view=rev Added: haiku/trunk/headers/os/interface/ControlLook.h haiku/trunk/src/kits/interface/ControlLook.cpp Modified: haiku/trunk/headers/os/interface/ChannelSlider.h haiku/trunk/headers/os/interface/Menu.h haiku/trunk/headers/os/interface/ScrollBar.h haiku/trunk/headers/os/interface/Slider.h haiku/trunk/src/apps/launchbox/IconButton.cpp haiku/trunk/src/apps/launchbox/LaunchButton.cpp haiku/trunk/src/kits/interface/BMCPrivate.cpp haiku/trunk/src/kits/interface/Box.cpp haiku/trunk/src/kits/interface/Button.cpp haiku/trunk/src/kits/interface/ChannelSlider.cpp haiku/trunk/src/kits/interface/CheckBox.cpp haiku/trunk/src/kits/interface/ColorControl.cpp haiku/trunk/src/kits/interface/Dragger.cpp haiku/trunk/src/kits/interface/InterfaceDefs.cpp haiku/trunk/src/kits/interface/Jamfile haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/MenuBar.cpp haiku/trunk/src/kits/interface/MenuField.cpp haiku/trunk/src/kits/interface/MenuItem.cpp haiku/trunk/src/kits/interface/MenuWindow.cpp haiku/trunk/src/kits/interface/RadioButton.cpp haiku/trunk/src/kits/interface/ScrollBar.cpp haiku/trunk/src/kits/interface/ScrollView.cpp haiku/trunk/src/kits/interface/Slider.cpp haiku/trunk/src/kits/interface/StatusBar.cpp haiku/trunk/src/kits/interface/TabView.cpp haiku/trunk/src/kits/interface/TextControl.cpp haiku/trunk/src/kits/interface/TextInput.cpp haiku/trunk/src/kits/interface/TextView.cpp haiku/trunk/src/kits/tracker/ContainerWindow.cpp haiku/trunk/src/kits/tracker/CountView.cpp haiku/trunk/src/kits/tracker/TitleView.cpp haiku/trunk/src/kits/tracker/TitleView.h Log: Implemented a new look for the Haiku interface controls. It was overheard that they looked too ninety-ish. TODO: The code behind this is work in progress. The basic idea is to extract all drawing code into a new class BControlLook, of which there is a global instance be_control_look, instantiated in InterfaceDefs.cpp. At the moment, all the old drawing code is still there, and the usage of be_control_look is inside if-bodies checking the instance against NULL. In another words, by not instanitating be_control_look, you can revert back to the old look. BControlLook's job is to provide reusable methods for drawing certain types of frames, backgrounds and labels, so that application developers can make controls that re-use the same drawing code as built-in controls and adopt to changes made there. I have added the notion of "borders". Each of the frame drawing methods can be made to draw certain borders only, which is supposed to help when controls shall visually attach. This feature is not fully explored at all ATM. TODO: Update BColumnListView header view and BStringItem text spacing. Update other apps where it makes sense to use BControlLook. For the moment, only Tracker and LaunchBox are updated. More... NOTE: The new look is not very radically different, so that existing apps do not immediately look too ugly or out of place. Modified: haiku/trunk/headers/os/interface/ChannelSlider.h =================================================================== --- haiku/trunk/headers/os/interface/ChannelSlider.h 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/headers/os/interface/ChannelSlider.h 2009-02-15 18:23:19 UTC (rev 29221) @@ -17,58 +17,67 @@ #include -class BChannelSlider : public BChannelControl -{ +class BChannelSlider : public BChannelControl { public: - BChannelSlider(BRect area, const char* name, - const char* label, BMessage* message, - int32 channels = 1, - uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 flags = B_WILL_DRAW); - BChannelSlider(BRect area, const char* name, - const char* label, BMessage* message, - orientation o, int32 channels = 1, - uint32 resize = B_FOLLOW_LEFT | B_FOLLOW_TOP, - uint32 flags = B_WILL_DRAW); - BChannelSlider(BMessage* archive); -virtual ~BChannelSlider(); + BChannelSlider(BRect area, const char* name, + const char* label, BMessage* message, + int32 channels = 1, + uint32 resizeMode + = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW); + BChannelSlider(BRect area, const char* name, + const char* label, BMessage* message, + enum orientation orientation, + int32 channels = 1, + uint32 resizeMode + = B_FOLLOW_LEFT | B_FOLLOW_TOP, + uint32 flags = B_WILL_DRAW); + BChannelSlider(const char* name, + const char* label, BMessage* message, + enum orientation orientation, + int32 channels = 1, + uint32 flags = B_WILL_DRAW); + BChannelSlider(BMessage* archive); + virtual ~BChannelSlider(); -static BArchivable* Instantiate(BMessage* from); -virtual status_t Archive(BMessage* into, bool deep = true) const; + static BArchivable* Instantiate(BMessage* from); + virtual status_t Archive(BMessage* into, bool deep = true) const; -virtual orientation Orientation() const; - void SetOrientation(orientation o); + virtual orientation Orientation() const; + void SetOrientation(enum orientation orientation); -virtual int32 MaxChannelCount() const; -virtual bool SupportsIndividualLimits() const; + virtual int32 MaxChannelCount() const; + virtual bool SupportsIndividualLimits() const; -virtual void AttachedToWindow(); -virtual void AllAttached(); -virtual void DetachedFromWindow(); -virtual void AllDetached(); + virtual void AttachedToWindow(); + virtual void AllAttached(); + virtual void DetachedFromWindow(); + virtual void AllDetached(); -virtual void MessageReceived(BMessage* msg); + virtual void MessageReceived(BMessage* message); -virtual void Draw(BRect area); -virtual void MouseDown(BPoint where); -virtual void MouseUp(BPoint pt); -virtual void MouseMoved(BPoint pt,uint32 code, - const BMessage* message); -virtual void WindowActivated(bool state); -virtual void KeyDown(const char* bytes, int32 numBytes); -virtual void KeyUp(const char* bytes, int32 numBytes); -virtual void FrameResized(float width, float height); + virtual void Draw(BRect area); + virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage); + virtual void WindowActivated(bool state); + virtual void KeyDown(const char* bytes, int32 numBytes); + virtual void KeyUp(const char* bytes, int32 numBytes); + virtual void FrameResized(float width, float height); -virtual void SetFont(const BFont* font, uint32 mask = B_FONT_ALL); -virtual void MakeFocus(bool focusState = true); + virtual void SetFont(const BFont* font, + uint32 mask = B_FONT_ALL); + virtual void MakeFocus(bool focusState = true); -virtual void SetEnabled(bool on); + virtual void SetEnabled(bool on); -virtual void GetPreferredSize(float* width, float* height); + virtual void GetPreferredSize(float* _width, float* _height); -virtual BHandler* ResolveSpecifier(BMessage* msg, int32 index, - BMessage* specifier, int32 form, const char* p); -virtual status_t GetSupportedSuites(BMessage* data); + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 form, + const char* p); + virtual status_t GetSupportedSuites(BMessage* data); // Perform rendering for an entire slider channel. virtual void DrawChannel(BView* into, int32 channel, BRect area, Added: haiku/trunk/headers/os/interface/ControlLook.h =================================================================== --- haiku/trunk/headers/os/interface/ControlLook.h 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/headers/os/interface/ControlLook.h 2009-02-15 18:23:19 UTC (rev 29221) @@ -0,0 +1,297 @@ +/* + * Copyright 2009, Stephan A?mus + * Distributed under the terms of the MIT License. + */ +#ifndef _CONTROL_LOOK_H +#define _CONTROL_LOOK_H + +#include +#include +#include +#include + + +class BControl; +class BGradientLinear; +class BView; + + +namespace BPrivate { + + +class BControlLook { +public: + BControlLook(); + virtual ~BControlLook(); + + enum frame_type { + B_BUTTON_FRAME, + B_MENU_FRAME, + B_LISTVIEW_FRAME, + B_INPUT_FRAME + }; + + enum background_type { + B_BUTTON_BACKGROUND, + B_MENU_BACKGROUND, + B_LISTVIEW_BACKGROUND, + B_INPUT_BACKGROUND + }; + + enum { + B_LEFT_BORDER = 1 << 0, + B_RIGHT_BORDER = 1 << 1, + B_TOP_BORDER = 1 << 2, + B_BOTTOM_BORDER = 1 << 3, + + B_ALL_BORDERS = B_LEFT_BORDER | B_RIGHT_BORDER + | B_TOP_BORDER | B_BOTTOM_BORDER + }; + + enum { + B_FOCUSED = 1 << 0, + B_CLICKED = 1 << 1, // some controls activate on mouse up + B_ACTIVATED = 1 << 2, + B_HOVER = 1 << 3, + B_DISABLED = 1 << 4, + B_DEFAULT_BUTTON = 1 << 5 + }; + + virtual BAlignment DefaultLabelAlignment() const; + virtual float DefaultLabelSpacing() const; + uint32 Flags(BControl* control) const; + + virtual void DrawButtonFrame(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawButtonBackground(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + uint32 flags = 0, + uint32 borders = B_ALL_BORDERS, + enum orientation orientation + = B_HORIZONTAL); + + virtual void DrawMenuBarBackground(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawMenuFieldBackground(BView* view, + BRect& rect, const BRect& updateRect, + const rgb_color& base, bool popupIndicator, + uint32 flags = 0); + + virtual void DrawMenuFieldBackground(BView* view, + BRect& rect, const BRect& updateRect, + const rgb_color& base, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawMenuBackground(BView* view, + BRect& rect, const BRect& updateRect, + const rgb_color& base, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawMenuItemBackground(BView* view, + BRect& rect, const BRect& updateRect, + const rgb_color& base, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawStatusBar(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + const rgb_color& barColor, + float progressPosition); + + virtual void DrawCheckBox(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + uint32 flags = 0); + + virtual void DrawRadioButton(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + uint32 flags = 0); + + virtual void DrawScrollBarBackground(BView* view, + BRect& rect1, BRect& rect2, + const BRect& updateRect, + const rgb_color& base, uint32 flags, + enum orientation orientation); + + virtual void DrawScrollBarBackground(BView* view, + BRect& rect, const BRect& updateRect, + const rgb_color& base, uint32 flags, + enum orientation orientation); + + virtual rgb_color SliderBarColor(const rgb_color& base); + + virtual void DrawSliderBar(BView* view, BRect rect, + const BRect& updateRect, + const rgb_color& base, + rgb_color leftFillColor, + rgb_color rightFillColor, + float sliderScale, uint32 flags, + enum orientation orientation); + + virtual void DrawSliderBar(BView* view, BRect rect, + const BRect& updateRect, + const rgb_color& base, rgb_color fillColor, + uint32 flags, enum orientation orientation); + + virtual void DrawSliderThumb(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, uint32 flags, + enum orientation orientation); + + virtual void DrawSliderTriangle(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, uint32 flags, + enum orientation orientation); + + virtual void DrawSliderHashMarks(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, int32 count, + hash_mark_location location, + uint32 flags, enum orientation orientation); + + virtual void DrawActiveTab(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawInctiveTab(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + // various borders + + virtual void DrawBorder(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + border_style border, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawRaisedBorder(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawGroupFrame(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + uint32 borders = B_ALL_BORDERS); + + virtual void DrawTextControlBorder(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + + // aligned labels + + void DrawLabel(BView* view, const char* label, + BRect rect, const BRect& updateRect, + const rgb_color& base, uint32 flags); + + virtual void DrawLabel(BView* view, const char* label, + BRect rect, const BRect& updateRect, + const rgb_color& base, uint32 flags, + const BAlignment& alignment); + +protected: + void _DrawOuterResessedFrame(BView* view, + BRect& rect, const rgb_color& base, + float contrast = 1.0f, + float brightness = 1.0f, + uint32 borders = B_ALL_BORDERS); + + void _DrawFrame(BView* view, BRect& rect, + const rgb_color& left, + const rgb_color& top, + const rgb_color& right, + const rgb_color& bottom, + uint32 borders = B_ALL_BORDERS); + + void _DrawFrame(BView* view, BRect& rect, + const rgb_color& left, + const rgb_color& top, + const rgb_color& right, + const rgb_color& bottom, + const rgb_color& rightTop, + const rgb_color& leftBottom, + uint32 borders = B_ALL_BORDERS); + + void _FillGradient(BView* view, const BRect& rect, + const rgb_color& base, float topTint, + float bottomTint, + enum orientation orientation + = B_HORIZONTAL); + + void _FillGlossyGradient(BView* view, + const BRect& rect, const rgb_color& base, + float topTint, float middle1Tint, + float middle2Tint, float bottomTint, + enum orientation orientation + = B_HORIZONTAL); + + void _MakeGradient(BGradientLinear& gradient, + const BRect& rect, const rgb_color& base, + float topTint, float bottomTint, + enum orientation orientation + = B_HORIZONTAL) const; + + void _MakeGlossyGradient(BGradientLinear& gradient, + const BRect& rect, const rgb_color& base, + float topTint, float middle1Tint, + float middle2Tint, float bottomTint, + enum orientation orientation + = B_HORIZONTAL) const; + + bool _RadioButtonAndCheckBoxMarkColor( + const rgb_color& base, rgb_color& color, + uint32 flags) const; + + void _DrawRoundBarCorner(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& edgeLightColor, + const rgb_color& edgeShadowColor, + const rgb_color& frameLightColor, + const rgb_color& frameShadowColor, + const rgb_color& fillLightColor, + const rgb_color& fillShadowColor, + float leftInset, float topInset, + float rightInset, float bottomInset, + enum orientation orientation); + + void _DrawRoundCornerLeftTop(BView* view, + BRect& rect, const BRect& updateRect, + const rgb_color& base, + const rgb_color& edgeColor, + const rgb_color& frameColor, + const rgb_color& bevelColor, + const BGradientLinear& fillGradient); + void _DrawRoundCornerRightTop(BView* view, + BRect& rect, const BRect& updateRect, + const rgb_color& base, + const rgb_color& edgeTopColor, + const rgb_color& edgeRightColor, + const rgb_color& frameTopColor, + const rgb_color& frameRightColor, + const rgb_color& bevelTopColor, + const rgb_color& bevelRightColor, + const BGradientLinear& fillGradient); +}; + +extern BControlLook* be_control_look; + + +} // namespace BPrivate + +using BPrivate::BControlLook; +using BPrivate::be_control_look; + +#endif // _CONTROL_LOOK_H Modified: haiku/trunk/headers/os/interface/Menu.h =================================================================== --- haiku/trunk/headers/os/interface/Menu.h 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/headers/os/interface/Menu.h 2009-02-15 18:23:19 UTC (rev 29221) @@ -206,8 +206,10 @@ BRect _CalcFrame(BPoint where, bool* scrollOn); +protected: void _DrawItems(BRect updateRect); +private: bool _OverSuper(BPoint loc); bool _OverSubmenu(BMenuItem* item, BPoint loc); BPrivate::BMenuWindow* _MenuWindow(); Modified: haiku/trunk/headers/os/interface/ScrollBar.h =================================================================== --- haiku/trunk/headers/os/interface/ScrollBar.h 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/headers/os/interface/ScrollBar.h 2009-02-15 18:23:19 UTC (rev 29221) @@ -56,6 +56,13 @@ void SetOrientation(enum orientation orientation); orientation Orientation() const; + // TODO: make this a virtual method, it should be one, + // but it's not important right now. This is supposed + // to be used in case the BScrollBar should draw part of + // the focus indication of the target view for aesthetical + // reasons. BScrollView will forward this method. + status_t SetBorderHighlighted(bool state); + virtual void MessageReceived(BMessage* message); virtual void MouseDown(BPoint pt); virtual void MouseUp(BPoint pt); Modified: haiku/trunk/headers/os/interface/Slider.h =================================================================== --- haiku/trunk/headers/os/interface/Slider.h 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/headers/os/interface/Slider.h 2009-02-15 18:23:19 UTC (rev 29221) @@ -177,6 +177,7 @@ BSlider& operator=(const BSlider &); + void _InitBarColor(); void _InitObject(); private: Modified: haiku/trunk/src/apps/launchbox/IconButton.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/IconButton.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/apps/launchbox/IconButton.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -1,5 +1,5 @@ /* - * Copyright 2006-2008, Haiku. + * Copyright 2006-2009, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -80,8 +81,47 @@ rgb_color background = LowColor(); if (BView* parent = Parent()) background = parent->LowColor(); + + BRect r(Bounds()); + + if (be_control_look != NULL) { + uint32 flags = 0; + BBitmap* bitmap = fNormalBitmap; + if (!IsEnabled()) { + flags |= BControlLook::B_DISABLED; + bitmap = fDisabledBitmap; + } + if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED)) + flags |= BControlLook::B_ACTIVATED; + + if (DrawBorder()) { + be_control_look->DrawButtonFrame(this, r, area, background, flags); + be_control_look->DrawButtonBackground(this, r, area, background, + flags); + } else { + SetHighColor(background); + FillRect(r); + } + + if (bitmap && bitmap->IsValid()) { + float x = r.left + floorf((r.Width() + - bitmap->Bounds().Width()) / 2.0 + 0.5); + float y = r.top + floorf((r.Height() + - bitmap->Bounds().Height()) / 2.0 + 0.5); + BPoint point(x, y); + if (_HasFlags(STATE_PRESSED) || _HasFlags(STATE_FORCE_PRESSED)) + point += BPoint(1.0, 1.0); + if (bitmap->ColorSpace() == B_RGBA32 + || bitmap->ColorSpace() == B_RGBA32_BIG) { + SetDrawingMode(B_OP_ALPHA); + SetBlendingMode(B_PIXEL_ALPHA, B_ALPHA_OVERLAY); + } + DrawBitmap(bitmap, point); + } + return; + } + rgb_color lightShadow, shadow, darkShadow, light; - BRect r(Bounds()); BBitmap* bitmap = fNormalBitmap; // adjust colors and bitmap according to flags if (IsEnabled()) { @@ -151,7 +191,7 @@ // background SetDrawingMode(B_OP_COPY); FillRect(r, B_SOLID_LOW); - ConstrainClippingRegion(&originalClippingRegion); + ConstrainClippingRegion(NULL); // label if (fLabel.CountChars() > 0) { SetDrawingMode(B_OP_COPY); @@ -243,8 +283,8 @@ if (minHeight < MIN_SPACE) minHeight = MIN_SPACE; - float hPadding = max_c(4.0, ceilf(minHeight / 4.0)); - float vPadding = max_c(4.0, ceilf(minWidth / 4.0)); + float hPadding = max_c(6.0, ceilf(minHeight / 4.0)); + float vPadding = max_c(6.0, ceilf(minWidth / 4.0)); if (fLabel.CountChars() > 0) { font_height fh; Modified: haiku/trunk/src/apps/launchbox/LaunchButton.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/LaunchButton.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/apps/launchbox/LaunchButton.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -253,8 +253,8 @@ float minWidth = fIconSize; float minHeight = fIconSize; - float hPadding = max_c(4.0, ceilf(minHeight / 4.0)); - float vPadding = max_c(4.0, ceilf(minWidth / 4.0)); + float hPadding = max_c(6.0, ceilf(minHeight / 3.0)); + float vPadding = max_c(6.0, ceilf(minWidth / 3.0)); if (fLabel.CountChars() > 0) { font_height fh; Modified: haiku/trunk/src/kits/interface/BMCPrivate.cpp =================================================================== --- haiku/trunk/src/kits/interface/BMCPrivate.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/kits/interface/BMCPrivate.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -7,9 +7,11 @@ * Stephan A?mus */ +#include + #include -#include +#include #include #include #include @@ -122,12 +124,44 @@ if (fFixedSize) SetResizingMode(B_FOLLOW_LEFT_RIGHT | B_FOLLOW_TOP); Window()->SetKeyMenuBar(menuBar); + + float left, top, right, bottom; + GetItemMargins(&left, &top, &right, &bottom); + + // TODO: Better fix would be to make BMenuItem draw text properly + // centered + font_height fontHeight; + GetFontHeight(&fontHeight); + top = ceilf((Bounds().Height() - ceilf(fontHeight.ascent) + - ceilf(fontHeight.descent)) / 2) + 1; + bottom = top - 1; + + if (be_control_look) + left = right = be_control_look->DefaultLabelSpacing(); + + SetItemMargins(left, top, right + fShowPopUpMarker ? 10 : 0, bottom); } void _BMCMenuBar_::Draw(BRect updateRect) { + if (be_control_look != NULL) { + BRect rect(Bounds()); + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + uint32 flags = 0; + if (!IsEnabled()) + flags |= BControlLook::B_DISABLED; + if (IsFocus()) + flags |= BControlLook::B_FOCUSED; + be_control_look->DrawMenuFieldBackground(this, rect, + updateRect, base, fShowPopUpMarker, flags); + + _DrawItems(updateRect); + + return; + } + if (!fShowPopUpMarker) { BMenuBar::Draw(updateRect); return; Modified: haiku/trunk/src/kits/interface/Box.cpp =================================================================== --- haiku/trunk/src/kits/interface/Box.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/kits/interface/Box.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -16,6 +16,7 @@ #include #include +#include #include #include #include @@ -53,8 +54,7 @@ BBox::BBox(const char* name, uint32 flags, border_style border, BView* child) - : BView(BRect(0, 0, -1, -1), name, B_FOLLOW_NONE, - flags | B_WILL_DRAW | B_FRAME_EVENTS | B_SUPPORTS_LAYOUT), + : BView(name, flags | B_WILL_DRAW | B_FRAME_EVENTS), fStyle(border) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -68,8 +68,7 @@ BBox::BBox(border_style border, BView* child) - : BView(BRect(0, 0, -1, -1), NULL, B_FOLLOW_NONE, - B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP | B_SUPPORTS_LAYOUT), + : BView(NULL, B_WILL_DRAW | B_FRAME_EVENTS | B_NAVIGABLE_JUMP), fStyle(border) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); @@ -639,15 +638,27 @@ BRect rect = Bounds(); rect.top += TopBorderOffset(); - rgb_color shadow = tint_color(ViewColor(), B_DARKEN_3_TINT); + float lightTint; + float shadowTint; + if (be_control_look != NULL) { + lightTint = B_LIGHTEN_1_TINT; + shadowTint = B_DARKEN_1_TINT; + } else { + lightTint = B_LIGHTEN_MAX_TINT; + shadowTint = B_DARKEN_3_TINT; + } if (rect.Height() == 0.0 || rect.Width() == 0.0) { // used as separator + rgb_color shadow = tint_color(ViewColor(), B_DARKEN_2_TINT); + SetHighColor(shadow); StrokeLine(rect.LeftTop(),rect.RightBottom()); } else { // used as box - rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT); + rgb_color light = tint_color(ViewColor(), lightTint); + rgb_color shadow = tint_color(ViewColor(), shadowTint); + BeginLineArray(4); AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.top), light); @@ -668,6 +679,23 @@ BRect rect = Bounds(); rect.top += TopBorderOffset(); + if (be_control_look != NULL) { + rgb_color base = ViewColor(); + if (rect.Height() == 1.0) { + // used as horizontal separator + be_control_look->DrawGroupFrame(this, rect, rect, base, + BControlLook::B_TOP_BORDER); + } else if (rect.Width() == 1.0) { + // used as vertical separator + be_control_look->DrawGroupFrame(this, rect, rect, base, + BControlLook::B_LEFT_BORDER); + } else { + // used as box + be_control_look->DrawGroupFrame(this, rect, rect, base); + } + return; + } + rgb_color light = tint_color(ViewColor(), B_LIGHTEN_MAX_TINT); rgb_color shadow = tint_color(ViewColor(), B_DARKEN_3_TINT); Modified: haiku/trunk/src/kits/interface/Button.cpp =================================================================== --- haiku/trunk/src/kits/interface/Button.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/kits/interface/Button.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -15,6 +15,7 @@ #include +#include #include #include #include @@ -102,6 +103,24 @@ void BButton::Draw(BRect updateRect) { + if (be_control_look != NULL) { + BRect rect(Bounds()); + rgb_color base = LowColor(); + uint32 flags = be_control_look->Flags(this); + if (IsDefault()) + flags |= BControlLook::B_DEFAULT_BUTTON; + be_control_look->DrawButtonFrame(this, rect, updateRect, + base, flags); + be_control_look->DrawButtonBackground(this, rect, updateRect, + base, flags); + + // always leave some room around the label + rect.InsetBy(3.0, 3.0); + be_control_look->DrawLabel(this, Label(), rect, updateRect, + base, flags, BAlignment(B_ALIGN_CENTER, B_ALIGN_MIDDLE)); + return; + } + font_height fh; GetFontHeight(&fh); Modified: haiku/trunk/src/kits/interface/ChannelSlider.cpp =================================================================== --- haiku/trunk/src/kits/interface/ChannelSlider.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/kits/interface/ChannelSlider.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -4,8 +4,10 @@ * Distributed under the terms of the MIT License. */ +#include + #include -#include +#include #include #include #include @@ -79,15 +81,27 @@ BChannelSlider::BChannelSlider(BRect area, const char *name, const char *label, - BMessage *model, orientation o, int32 channels, uint32 resizeMode, uint32 flags) + BMessage *model, enum orientation orientation, int32 channels, + uint32 resizeMode, uint32 flags) : BChannelControl(area, name, label, model, channels, resizeMode, flags) { _InitData(); - SetOrientation(o); + SetOrientation(orientation); } +BChannelSlider::BChannelSlider(const char *name, const char *label, + BMessage *model, enum orientation orientation, int32 channels, + uint32 flags) + : BChannelControl(name, label, model, channels, flags) + +{ + _InitData(); + SetOrientation(orientation); +} + + BChannelSlider::BChannelSlider(BMessage *archive) : BChannelControl(archive) { @@ -138,9 +152,9 @@ void -BChannelSlider::SetOrientation(orientation _orientation) +BChannelSlider::SetOrientation(enum orientation orientation) { - bool isVertical = _orientation == B_VERTICAL; + bool isVertical = orientation == B_VERTICAL; if (isVertical != _Vertical()) { fVertical = isVertical; Invalidate(Bounds()); @@ -415,6 +429,10 @@ BChannelSlider::FrameResized(float newWidth, float newHeight) { BChannelControl::FrameResized(newWidth, newHeight); + + delete fBacking; + fBacking = NULL; + Invalidate(Bounds()); } @@ -533,6 +551,20 @@ ASSERT(into != NULL); BRect rect(leftTop, bottomRight); + if (be_control_look != NULL) { + rect.InsetBy(-2.5, -2.5); + rect.left = floorf(rect.left); + rect.top = floorf(rect.top); + rect.right = floorf(rect.right); + rect.bottom = floorf(rect.bottom); + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color barColor = be_control_look->SliderBarColor(base); + uint32 flags = 0; + be_control_look->DrawSliderBar(into, rect, rect, base, + barColor, flags, Orientation()); + return; + } + _DrawGrooveFrame(fBackingView, rect.InsetByCopy(-2.5, -2.5)); rect.InsetBy(-0.5, -0.5); @@ -553,6 +585,22 @@ where.x -= bitmapBounds.right / 2.0; where.y -= bitmapBounds.bottom / 2.0; + + if (be_control_look != NULL) { + BRect rect(bitmapBounds.OffsetToCopy(where)); + rect.InsetBy(1, 1); + rect.left = floorf(rect.left); + rect.top = floorf(rect.top); + rect.right = ceilf(rect.right + 0.5); + rect.bottom = ceilf(rect.bottom + 0.5); + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + uint32 flags = 0; + be_control_look->DrawSliderThumb(into, rect, rect, base, + flags, Orientation()); + return; + } + + into->PushState(); into->SetDrawingMode(B_OP_OVER); Modified: haiku/trunk/src/kits/interface/CheckBox.cpp =================================================================== --- haiku/trunk/src/kits/interface/CheckBox.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/kits/interface/CheckBox.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -11,6 +11,7 @@ #include +#include #include #include @@ -82,6 +83,26 @@ void BCheckBox::Draw(BRect updateRect) { + if (be_control_look) { + rgb_color base = ui_color(B_PANEL_BACKGROUND_COLOR); + + uint32 flags = be_control_look->Flags(this); + if (fOutlined) + flags |= BControlLook::B_CLICKED; + + BRect checkBoxRect(_CheckBoxFrame()); + BRect rect(checkBoxRect); + be_control_look->DrawCheckBox(this, rect, updateRect,base, flags); + + BRect labelRect(Bounds()); + labelRect.left = checkBoxRect.right + + be_control_look->DefaultLabelSpacing(); + + be_control_look->DrawLabel(this, Label(), labelRect, updateRect, + base, flags); + return; + } + font_height fontHeight; GetFontHeight(&fontHeight); @@ -551,7 +572,7 @@ font_height fontHeight; GetFontHeight(&fontHeight); - return BRect(1.0f, 3.0f, ceilf(3.0f + fontHeight.ascent), + return BRect(0.0f, 2.0f, ceilf(3.0f + fontHeight.ascent), ceilf(5.0f + fontHeight.ascent)); } Modified: haiku/trunk/src/kits/interface/ColorControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorControl.cpp 2009-02-15 18:14:35 UTC (rev 29220) +++ haiku/trunk/src/kits/interface/ColorControl.cpp 2009-02-15 18:23:19 UTC (rev 29221) @@ -11,11 +11,12 @@ /** BColorControl displays a palette of selectable colors. */ +#include #include #include -#include +#include #include #include #include @@ -391,16 +392,12 @@ if (!fBitmap->Lock()) return; - if (fOffscreenView->Bounds().Intersects(updateRect)) { - BRegion region(updateRect); - ConstrainClippingRegion(®ion); + if (fOffscreenView->Bounds().Intersects(updateRect)) DrawBitmap(fBitmap, B_ORIGIN); - ConstrainClippingRegion(NULL); - } fBitmap->Unlock(); _DrawSelectors(this); - + } else { _DrawColorArea(this, updateRect); _DrawSelectors(this); @@ -413,45 +410,57 @@ { BRegion region(update); target->ConstrainClippingRegion(®ion); - - rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR); - rgb_color lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT); - rgb_color lightenmax = tint_color(noTint, B_LIGHTEN_MAX_TINT); - rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT); - rgb_color darken2 = tint_color(noTint, B_DARKEN_2_TINT); - rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT); - + BRect bevelRect = fPaletteFrame.InsetByCopy(-2.0,-2.0); //bevel - bool enabled = IsEnabled(); - - // First bevel - if (enabled) - target->SetHighColor(darken1); - else - target->SetHighColor(noTint); - target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop()); - target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop()); - if (enabled) - target->SetHighColor(lightenmax); - else - target->SetHighColor(lighten1); - target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom), bevelRect.RightBottom()); - target->StrokeLine(bevelRect.RightBottom(), BPoint(bevelRect.right, bevelRect.top + 1.0f)); - bevelRect.InsetBy(1.0f, 1.0f); + rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT); - // Second bevel - if (enabled) - target->SetHighColor(darken4); - else - target->SetHighColor(darken2); - target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop()); - target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop()); [... truncated: 4026 lines follow ...] From phoudoin at mail.berlios.de Sun Feb 15 19:26:44 2009 From: phoudoin at mail.berlios.de (phoudoin at mail.berlios.de) Date: Sun, 15 Feb 2009 19:26:44 +0100 Subject: [Haiku-commits] r29222 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200902151826.n1FIQhtc004365@sheep.berlios.de> Author: phoudoin Date: 2009-02-15 19:26:13 +0100 (Sun, 15 Feb 2009) New Revision: 29222 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29222&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp Log: Applied patch supplied by jkeeping in #3445: smp_do_mp_config wasn't checking MPS table CPU entries for the enabled flag. This caused Haiku to fail to boot under KVM on Linux. Thanks you, jkeeping. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 18:23:19 UTC (rev 29221) +++ haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 18:26:13 UTC (rev 29222) @@ -151,6 +151,10 @@ struct mp_base_processor *processor = (struct mp_base_processor *)pointer; + /* skip if the processor is not enabled. */ + if(!(processor->cpu_flags & 0x1)) + break; + gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = processor->apic_id; gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = processor->apic_version; From oruizdorantes at mail.berlios.de Sun Feb 15 19:32:23 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Sun, 15 Feb 2009 19:32:23 +0100 Subject: [Haiku-commits] r29223 - haiku/trunk/src/preferences/bluetooth Message-ID: <200902151832.n1FIWNL9010882@sheep.berlios.de> Author: oruizdorantes Date: 2009-02-15 19:32:23 +0100 (Sun, 15 Feb 2009) New Revision: 29223 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29223&view=rev Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp haiku/trunk/src/preferences/bluetooth/InquiryPanel.h haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h Log: - Implement ADD button for remote devices list - Shape a bit more the skeleton panel for scanning devices Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-15 18:26:13 UTC (rev 29222) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-15 18:32:23 UTC (rev 29223) @@ -2,22 +2,19 @@ * Copyright 2008-09, Oliver Ruiz Dorantes, * All rights reserved. Distributed under the terms of the MIT License. */ -#include "BluetoothWindow.h" #include #include #include -#include +#include #include +#include #include - -#include "RemoteDevicesView.h" - -//#include "ConnChanView.h" +#include #include "defs.h" -static const uint32 kMsgSetDefaults = 'dflt'; +static const uint32 kMsgUpdate = 'dflt'; static const uint32 kMsgRevert = 'rvrt'; static const uint32 kMsgStartServices = 'SrSR'; @@ -25,61 +22,43 @@ static const uint32 kMsgShowDebug = 'ShDG'; -BluetoothWindow::BluetoothWindow(BRect frame) +InquiryPanel::InquiryPanel(BRect frame) : BWindow(frame, "Bluetooth", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, B_ALL_WORKSPACES) { + BRect iDontCare(0,0,0,0); + BRect iDontCareToo(0,0,5,5); + SetLayout(new BGroupLayout(B_HORIZONTAL)); - fDefaultsButton = new BButton("defaults", "Defaults", - new BMessage(kMsgSetDefaults), B_WILL_DRAW); + fScanProgress = new BStatusBar(iDontCare, "status", "Scanning", "Scan time"); + fScanProgress->SetMaxValue(52); - fRevertButton = new BButton("revert", "Revert", + fMessage = new BTextView(iDontCare, "description", + iDontCare2, B_FOLLOW_LEFT_RIGHT, + B_WILL_DRAW | B_FRAME_EVENTS); + fMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fMessage->SetLowColor(fMessage->ViewColor()); + fMessage->MakeEditable(false); + fMessage->SetText("asdfdasas asdfas asdfasd a dfad asdf dfasdf a"); + + fInquiryButton = new BButton("Inquiry", "Inquiry", new BMessage(kMsgRevert), B_WILL_DRAW); + + fAddButton = new BButton("ad", "Add device to list", + new BMessage(kMsgRevert), B_WILL_DRAW); - // Add the menu bar - fMenubar = new BMenuBar(Bounds(), "menu_bar"); - // Add File menu to menu bar - BMenu *menu = new BMenu("Server"); - menu->AddItem(new BMenuItem("Start Bluetooth Services" B_UTF8_ELLIPSIS, new BMessage(kMsgStartServices), 0)); - menu->AddItem(new BMenuItem("Stop Bluetooth Services" B_UTF8_ELLIPSIS, new BMessage(kMsgStopServices), 0)); - menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Show Bluetooth console" B_UTF8_ELLIPSIS, new BMessage(kMsgStartServices), 0)); - fMenubar->AddItem(menu); - - menu = new BMenu("View"); - menu->AddItem(new BMenuItem("Connections & Channels list" B_UTF8_ELLIPSIS, NULL, 0)); - menu->AddItem(new BMenuItem("Remote Devices List" B_UTF8_ELLIPSIS, NULL, 0)); - fMenubar->AddItem(menu); - - menu = new BMenu("Help"); - menu->AddItem(new BMenuItem("About" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED), 0)); - fMenubar->AddItem(menu); - - BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); - - fSettingsView = new BluetoothSettingsView("Settings"); -// fConnChan = new ConnChanView("Connections & Channels", B_WILL_DRAW); - fRemoteDevices = new RemoteDevicesView("Remote Devices", B_WILL_DRAW); - - tabView->AddTab(fRemoteDevices); -// tabView->AddTab(fConnChan); - tabView->AddTab(fSettingsView); - - - fRevertButton->SetEnabled(false); - AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) - .Add(fMenubar) + .Add(fScanProgress) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) - .Add(tabView) + .Add(fMessage) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) - .Add(fRevertButton) + .Add(fAddButton) .AddGlue() - .Add(fDefaultsButton) + .Add(fInquiryButton) ) .SetInsets(5, 5, 5, 5) ); @@ -87,7 +66,7 @@ void -BluetoothWindow::MessageReceived(BMessage *message) +InquiryPanel::MessageReceived(BMessage *message) { switch (message->what) { case kMsgUpdate: @@ -96,76 +75,30 @@ fRevertButton->SetEnabled(true);*/ break; - case kMsgSetDefaults: -/* fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS)); +/* case kMsgSetDefaults: + fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS)); fAntialiasingSettings->SetDefaults(); fDefaultsButton->SetEnabled(false); fRevertButton->SetEnabled(true); -*/ break; + break; case kMsgRevert: -/* fColorsView -> MessageReceived(new BMessage(REVERT_SETTINGS)); + fColorsView -> MessageReceived(new BMessage(REVERT_SETTINGS)); fAntialiasingSettings->Revert(); fDefaultsButton->SetEnabled(fColorsView->IsDefaultable() || fAntialiasingSettings->IsDefaultable()); fRevertButton->SetEnabled(false); -*/ break; - case B_ABOUT_REQUESTED: - AboutRequested(); - break; - default: + break; +*/ default: BWindow::MessageReceived(message); break; } } -void -BluetoothWindow::AboutRequested() -{ - - (new BAlert("about", "Haiku Bluetooth System, (ARCE) -Created by Oliver Ruiz Dorantes - -With support of: - - Mika Lindqvist - - Maksym Yevmenkin - -Thanks to the individuals who helped... - -Shipping/donating hardware: - - Henry Jair Abril Florez(el Colombian) - & Stefanie Bartolich - - Dennis d'Entremont - - Luroh - - Pieter Panman - -Economically: - - Karl von Dorf, Andrea Bernardi (OSDrawer), - - Matt M, Doug F, Hubert H, - - Sebastian B, Andrew M, Jared E, - - Frederik H, Tom S, Ferry B, - - Greg G, David F, Richard S, Martin W: - -With patches: - - Fredrik Ekdahl - - Andreas F?rber - -Testing: - - Petter H. Juliussen - - Raynald Lesieur - - Adrien Destugues - - J?rg Meyer - -Who gave me all the knowledge: - - the yellowTAB team", "OK"))->Go(); - -} - - bool -BluetoothWindow::QuitRequested(void) +InquiryPanel::QuitRequested(void) { - be_app->PostMessage(B_QUIT_REQUESTED); + return true; } Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-02-15 18:26:13 UTC (rev 29222) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-02-15 18:32:23 UTC (rev 29223) @@ -11,28 +11,23 @@ #include #include +class BStatusBar; +class BButton; +class BTextView; -#include "InquirySettingsView.h" - -class RemoteDevicesView; -class ConnChanView; - -class InquiryWindow : public BWindow +class InquiryPanel : public BWindow { public: - InquiryWindow(BRect frame); + InquiryPanel(BRect frame); bool QuitRequested(void); void MessageReceived(BMessage *message); -private: - RemoteDevicesView* fRemoteDevices; - ConnChanView* fConnChan; - BButton* fDefaultsButton; - BButton* fRevertButton; - BMenuBar* fMenubar; +private: + BStatusBar* fScanProgress; + BButton* fAddButton; + BButton* fInquiryButton; + BTextView* fMessage; }; - - #endif Modified: haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-02-15 18:26:13 UTC (rev 29222) +++ haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-02-15 18:32:23 UTC (rev 29223) @@ -15,6 +15,7 @@ #include +#include "InquiryPanel.h" #include "BluetoothWindow.h" #include "defs.h" @@ -28,7 +29,7 @@ { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - BButton* addButton = new BButton(BRect(5,5,5,5), "add", "Add" B_UTF8_ELLIPSIS, + addButton = new BButton(BRect(5,5,5,5), "add", "Add" B_UTF8_ELLIPSIS, new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT); BButton* removeButton = new BButton(BRect(5,5,5,5), "remove", "Remove", @@ -86,6 +87,7 @@ RemoteDevicesView::AttachedToWindow(void) { fAttrList->SetTarget(this); + addButton->SetTarget(this); LoadSettings(); fAttrList->Select(0); @@ -104,7 +106,12 @@ } switch(msg->what) { - + case kMsgAddDevices: + { + InquiryPanel* iPanel = new InquiryPanel(BRect(0,0,50,50)); + iPanel->Show(); + } + break; default: BView::MessageReceived(msg); break; Modified: haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h 2009-02-15 18:26:13 UTC (rev 29222) +++ haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h 2009-02-15 18:32:23 UTC (rev 29223) @@ -39,8 +39,9 @@ void UpdateControls(); void UpdateAllColors(); - BListView *fAttrList; - BScrollView *fScrollView; + BButton* addButton; + BListView* fAttrList; + BScrollView* fScrollView; }; From phoudoin at mail.berlios.de Sun Feb 15 19:43:05 2009 From: phoudoin at mail.berlios.de (phoudoin at mail.berlios.de) Date: Sun, 15 Feb 2009 19:43:05 +0100 Subject: [Haiku-commits] r29224 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200902151843.n1FIh5iA003050@sheep.berlios.de> Author: phoudoin Date: 2009-02-15 19:43:02 +0100 (Sun, 15 Feb 2009) New Revision: 29224 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29224&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp Log: Fixed the patch: on disabled processor entry, next entry pointer wasn't computed, leading to an infinite loop... Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 18:32:23 UTC (rev 29223) +++ haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 18:43:02 UTC (rev 29224) @@ -151,24 +151,25 @@ struct mp_base_processor *processor = (struct mp_base_processor *)pointer; - /* skip if the processor is not enabled. */ - if(!(processor->cpu_flags & 0x1)) - break; - - gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = processor->apic_id; - gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; - gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = processor->apic_version; + /* is processor enabled? */ + if(processor->cpu_flags & 0x1) { + gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = processor->apic_id; + gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; + gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = processor->apic_version; + #ifdef TRACE_SMP - const char *cpuFamily[] = { "", "", "", "", "Intel 486", - "Intel Pentium", "Intel Pentium Pro", "Intel Pentium II" }; + const char *cpuFamily[] = { "", "", "", "", "Intel 486", + "Intel Pentium", "Intel Pentium Pro", "Intel Pentium II" }; #endif - TRACE(("smp: cpu#%ld: %s, apic id %d, version %d%s\n", - gKernelArgs.num_cpus, cpuFamily[(processor->signature & 0xf00) >> 8], - processor->apic_id, processor->apic_version, (processor->cpu_flags & 0x2) ? - ", BSP" : "")); + TRACE(("smp: cpu#%ld: %s, apic id %d, version %d%s\n", + gKernelArgs.num_cpus, cpuFamily[(processor->signature & 0xf00) >> 8], + processor->apic_id, processor->apic_version, (processor->cpu_flags & 0x2) ? + ", BSP" : "")); - gKernelArgs.num_cpus++; + gKernelArgs.num_cpus++; + } + pointer += sizeof(struct mp_base_processor); break; } From korli at users.berlios.de Sun Feb 15 19:48:47 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Sun, 15 Feb 2009 19:48:47 +0100 Subject: [Haiku-commits] r29224 - haiku/trunk/src/system/boot/platform/bios_ia32 In-Reply-To: <200902151843.n1FIh5iA003050@sheep.berlios.de> References: <200902151843.n1FIh5iA003050@sheep.berlios.de> Message-ID: 2009/2/15 > Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp > =================================================================== > --- haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 > 18:32:23 UTC (rev 29223) > +++ haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 > 18:43:02 UTC (rev 29224) > @@ -151,24 +151,25 @@ > > struct mp_base_processor *processor = > (struct mp_base_processor *)pointer; > > - /* skip if the processor is not enabled. */ > - if(!(processor->cpu_flags & 0x1)) > - break; > - > - > gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = > processor->apic_id; > - > gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; > - > gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = > processor->apic_version; > + /* is processor enabled? */ > + if(processor->cpu_flags & 0x1) { > > + > gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = > processor->apic_id; > + > gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; > + > gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = > processor->apic_version; > + > Why not a "continue" instead of "break" ? pointer can be augmented before this test. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From revol at free.fr Sun Feb 15 19:56:51 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sun, 15 Feb 2009 19:56:51 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29221_-_in_haiku/trunk=3A_headers/os/i?= =?utf-8?q?nterface_src/apps/launchbox_src/kits/interface_src/kits/tracker?= In-Reply-To: <200902151823.n1FINTFg001250@sheep.berlios.de> Message-ID: <12832070685-BeMail@laptop> > Log: > Implemented a new look for the Haiku interface controls. It was > overheard that they looked too ninety-ish. OH MY GOD WHAT HAVE YOU DONE !!!???!!?? Hmm you're asking for trouble ;) [19:42] ohhh now, what has stippi done [19:42] hmm [19:42] seems like that might be a little dangerous [19:43] some rabid 90s beos ui fan might come slit your throat in your sleep Oh well, let's see... > Added: > haiku/trunk/headers/os/interface/ControlLook.h > haiku/trunk/src/kits/interface/ControlLook.cpp At least it seems you used a separate skin class. I should probably port Skin-O-Be to it someday... http://revolf.free.fr/beos/apps/skinobe/ Oh and add support in Themes as well... And I thought we couldn't make Haiku even more uglier than possible with ZETA themes :D > BControlLook's job is to provide reusable methods for drawing > certain types of frames, backgrounds and labels, so that application > developers can make controls that re-use the same drawing code > as built-in controls and adopt to changes made there. I have added Actually that might also help with toolkit ports like GTK or Qt, that usually require going through skin-like crap, but also provides a "native" skin that uses the system's theme class. Though I'd rather have real "heavyweight" ports (ie. real BButtons BCheckbox... behind). > TODO: Update BColumnListView header view and BStringItem text > spacing. Update other apps where it makes sense to use BControlLook. > For the moment, only Tracker and LaunchBox are updated. More... Are you sure you want apps to depend on that ? > NOTE: The new look is not very radically different, so that existing > apps do not immediately look too ugly or out of place. Well in the other case it means it's not done correctly, it's supposed to make the look and feel independant from each other, right ? Fran?ois. From alex at zappotek.com Sun Feb 15 20:07:36 2009 From: alex at zappotek.com (Alexandre Deckner) Date: Sun, 15 Feb 2009 20:07:36 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <200902151823.n1FINTFg001250@sheep.berlios.de> References: <200902151823.n1FINTFg001250@sheep.berlios.de> Message-ID: <499867F8.5090006@zappotek.com> stippi at BerliOS wrote: > Author: stippi > Date: 2009-02-15 19:23:19 +0100 (Sun, 15 Feb 2009) > New Revision: 29221 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29221&view=rev > > [...] Very nice :) Lots of nice things here, i like what you've done to tracker (still miss the new buttons in single window mode), tabs are really going in a nice direction too. So does this mean the UI will support full theming? This way mmu_man will be able to develop his citrus theme ;-P http://revolf.free.fr/beos/shots/shot_haiku_theme_citrus.png Best regards, Alex From phoudoin at mail.berlios.de Sun Feb 15 20:27:40 2009 From: phoudoin at mail.berlios.de (phoudoin at mail.berlios.de) Date: Sun, 15 Feb 2009 20:27:40 +0100 Subject: [Haiku-commits] r29225 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200902151927.n1FJRejP007707@sheep.berlios.de> Author: phoudoin Date: 2009-02-15 20:27:36 +0100 (Sun, 15 Feb 2009) New Revision: 29225 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29225&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp Log: Refactor the code, computing next entry earlier and use continue as suggested by Jerome. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 18:43:02 UTC (rev 29224) +++ haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 19:27:36 UTC (rev 29225) @@ -143,62 +143,64 @@ switch (*pointer) { case MP_BASE_PROCESSOR: { + struct mp_base_processor *processor = (struct mp_base_processor *)pointer; + pointer += sizeof(struct mp_base_processor); + if (gKernelArgs.num_cpus == MAX_BOOT_CPUS) { TRACE(("smp: already reached maximum boot CPUs (%d)\n", MAX_BOOT_CPUS)); - pointer += sizeof(struct mp_base_processor); - break; + continue; } - struct mp_base_processor *processor = (struct mp_base_processor *)pointer; + /* skip if the processor is not enabled. */ + if(!(processor->cpu_flags & 0x1)) { + TRACE(("smp: skip apic id %d: disabled\n", processor->apic_id)); + continue; + } - /* is processor enabled? */ - if(processor->cpu_flags & 0x1) { + gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = processor->apic_id; + gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; + gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = processor->apic_version; - gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = processor->apic_id; - gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; - gKernelArgs.arch_args.cpu_apic_version[gKernelArgs.num_cpus] = processor->apic_version; - #ifdef TRACE_SMP - const char *cpuFamily[] = { "", "", "", "", "Intel 486", - "Intel Pentium", "Intel Pentium Pro", "Intel Pentium II" }; + const char *cpuFamily[] = { "", "", "", "", "Intel 486", + "Intel Pentium", "Intel Pentium Pro", "Intel Pentium II" }; #endif - TRACE(("smp: cpu#%ld: %s, apic id %d, version %d%s\n", - gKernelArgs.num_cpus, cpuFamily[(processor->signature & 0xf00) >> 8], - processor->apic_id, processor->apic_version, (processor->cpu_flags & 0x2) ? - ", BSP" : "")); + TRACE(("smp: cpu#%ld: %s, apic id %d, version %d%s\n", + gKernelArgs.num_cpus, cpuFamily[(processor->signature & 0xf00) >> 8], + processor->apic_id, processor->apic_version, (processor->cpu_flags & 0x2) ? + ", BSP" : "")); - gKernelArgs.num_cpus++; - } - - pointer += sizeof(struct mp_base_processor); + gKernelArgs.num_cpus++; break; } case MP_BASE_BUS: { struct mp_base_bus *bus = (struct mp_base_bus *)pointer; + pointer += sizeof(struct mp_base_bus); TRACE(("smp: bus %d: %c%c%c%c%c%c\n", bus->bus_id, bus->name[0], bus->name[1], bus->name[2], bus->name[3], bus->name[4], bus->name[5])); - pointer += sizeof(struct mp_base_bus); break; } case MP_BASE_IO_APIC: { struct mp_base_ioapic *io = (struct mp_base_ioapic *)pointer; + pointer += sizeof(struct mp_base_ioapic); + gKernelArgs.arch_args.ioapic_phys = (uint32)io->addr; TRACE(("smp: found io apic with apic id %d, version %d\n", io->ioapic_id, io->ioapic_version)); - pointer += sizeof(struct mp_base_ioapic); break; } case MP_BASE_IO_INTR: case MP_BASE_LOCAL_INTR: { struct mp_base_interrupt *interrupt = (struct mp_base_interrupt *)pointer; + pointer += sizeof(struct mp_base_interrupt); dprintf("smp: %s int: type %d, source bus %d, irq %3d, dest apic %d, int %3d, polarity %d, trigger mode %d\n", interrupt->type == MP_BASE_IO_INTR ? "I/O" : "local", @@ -206,7 +208,6 @@ interrupt->source_bus_irq, interrupt->dest_apic_id, interrupt->dest_apic_int, interrupt->polarity, interrupt->trigger_mode); - pointer += sizeof(struct mp_base_interrupt); break; } } From korli at mail.berlios.de Sun Feb 15 20:43:38 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 15 Feb 2009 20:43:38 +0100 Subject: [Haiku-commits] r29226 - haiku/trunk/src/apps/soundrecorder Message-ID: <200902151943.n1FJhcmC009308@sheep.berlios.de> Author: korli Date: 2009-02-15 20:43:38 +0100 (Sun, 15 Feb 2009) New Revision: 29226 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29226&view=rev Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp Log: * fix spacing between scope and vu views Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2009-02-15 19:27:36 UTC (rev 29225) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2009-02-15 19:43:38 UTC (rev 29226) @@ -249,13 +249,13 @@ r = background->Bounds(); r.left = 0; - r.right = r.left + 35; + r.right = r.left + 38; r.bottom = r.top + 104; fVUView = new VUView(r, B_FOLLOW_LEFT|B_FOLLOW_TOP); background->AddChild(fVUView); r = background->Bounds(); - r.left = r.left + 38; + r.left = r.left + 40; r.bottom = r.top + 104; fScopeView = new ScopeView(r, B_FOLLOW_LEFT_RIGHT|B_FOLLOW_TOP); background->AddChild(fScopeView); From anevilyak at gmail.com Sun Feb 15 21:35:48 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 15 Feb 2009 14:35:48 -0600 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <499867F8.5090006@zappotek.com> References: <200902151823.n1FINTFg001250@sheep.berlios.de> <499867F8.5090006@zappotek.com> Message-ID: On Sun, Feb 15, 2009 at 1:07 PM, Alexandre Deckner wrote: > Very nice :) Lots of nice things here, i like what you've done to +1 :) My only critique from a quick glance is that the default BMenuField looks almost like it's in a disabled state, maybe a slightly more active color for the drop down arrow might be a good idea? Regards, Rene From axeld at pinc-software.de Sun Feb 15 21:52:58 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 15 Feb 2009 21:52:58 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29225_-_haiku/trunk/src/system/boot/pl?= =?utf-8?q?atform/bios=5Fia32?= In-Reply-To: <200902151927.n1FJRejP007707@sheep.berlios.de> Message-ID: <36288484558-BeMail@zon> phoudoin at mail.berlios.de wrote: > + if(!(processor->cpu_flags & 0x1)) { > + TRACE(("smp: skip apic id %d: disabled\n", > processor->apic_id)); > + continue; > + } You seem to have messed up indentation here (spaces instead of tabs). Also, there is a space between "if" and the opening parenthesis. Bye, Axel. From mmlr at mail.berlios.de Sun Feb 15 22:10:03 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 15 Feb 2009 22:10:03 +0100 Subject: [Haiku-commits] r29227 - haiku/trunk/src/build/libroot Message-ID: <200902152110.n1FLA3Uu016988@sheep.berlios.de> Author: mmlr Date: 2009-02-15 22:10:02 +0100 (Sun, 15 Feb 2009) New Revision: 29227 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29227&view=rev Modified: haiku/trunk/src/build/libroot/fs.cpp Log: _kern_open_parent_dir has different semantics for the supplied name argument. It's supposed to be filled with the entry name of the directory and not as in all the other cases used as a leaf name to be appended to the dir. This would lead to some errors with operations based on directory fds in the build libroot and build libbe and in the end make generate_attribute_stores fail on platforms that don't have an 0 initialized stack (since the supplied name buffer would contain garbage later attached to the directory path). Modified: haiku/trunk/src/build/libroot/fs.cpp =================================================================== --- haiku/trunk/src/build/libroot/fs.cpp 2009-02-15 19:43:38 UTC (rev 29226) +++ haiku/trunk/src/build/libroot/fs.cpp 2009-02-15 21:10:02 UTC (rev 29227) @@ -418,7 +418,7 @@ { // get a usable path string realPath; - status_t error = get_path(fd, name, realPath); + status_t error = get_path(fd, NULL, realPath); if (error != B_OK) return error; From stefano.ceccherini at gmail.com Sun Feb 15 22:16:32 2009 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Sun, 15 Feb 2009 22:16:32 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <200902151823.n1FINTFg001250@sheep.berlios.de> References: <200902151823.n1FINTFg001250@sheep.berlios.de> Message-ID: <894b9700902151316w147bda4bv538c857246ba113b@mail.gmail.com> 2009/2/15 stippi at BerliOS : > Author: stippi > Date: 2009-02-15 19:23:19 +0100 (Sun, 15 Feb 2009) > New Revision: 29221 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29221&view=rev >> Log: > Implemented a new look for the Haiku interface controls. It was > overheard that they looked too ninety-ish. Very nice! Both the look and the implementation. The only thing I'd point out (besides the menufields "problem", already pointed out by Rene) is you that unselected tabs look like they are all joint. IOW: You can't immediately tell how many tabs are there. Very nice work, though. From umccullough at gmail.com Sun Feb 15 22:40:53 2009 From: umccullough at gmail.com (Urias McCullough) Date: Sun, 15 Feb 2009 13:40:53 -0800 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <894b9700902151316w147bda4bv538c857246ba113b@mail.gmail.com> References: <200902151823.n1FINTFg001250@sheep.berlios.de> <894b9700902151316w147bda4bv538c857246ba113b@mail.gmail.com> Message-ID: <1e80d8750902151340k7aefe82fp7672fffa3955772@mail.gmail.com> On Sun, Feb 15, 2009 at 1:16 PM, Stefano Ceccherini wrote: > 2009/2/15 stippi at BerliOS : >> Author: stippi >> Date: 2009-02-15 19:23:19 +0100 (Sun, 15 Feb 2009) >> New Revision: 29221 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29221&view=rev >>> Log: >> Implemented a new look for the Haiku interface controls. It was >> overheard that they looked too ninety-ish. > > Very nice! Both the look and the implementation. > The only thing I'd point out (besides the menufields "problem", > already pointed out by Rene) is you that unselected tabs look like > they are all joint. IOW: You can't immediately tell how many tabs are > there. > Very nice work, though. I agree on the tabs - it seems like there should be some hint of distinction between the inactive tabs. Overall, the flatter look with tasteful application of gradients is nice though :) - Urias From phoudoin at mail.berlios.de Sun Feb 15 22:56:29 2009 From: phoudoin at mail.berlios.de (phoudoin at mail.berlios.de) Date: Sun, 15 Feb 2009 22:56:29 +0100 Subject: [Haiku-commits] r29228 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200902152156.n1FLuTSG020517@sheep.berlios.de> Author: phoudoin Date: 2009-02-15 22:56:27 +0100 (Sun, 15 Feb 2009) New Revision: 29228 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29228&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp Log: Fixed broken style I've introduced. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 21:10:02 UTC (rev 29227) +++ haiku/trunk/src/system/boot/platform/bios_ia32/smp.cpp 2009-02-15 21:56:27 UTC (rev 29228) @@ -152,10 +152,10 @@ } /* skip if the processor is not enabled. */ - if(!(processor->cpu_flags & 0x1)) { + if (!(processor->cpu_flags & 0x1)) { TRACE(("smp: skip apic id %d: disabled\n", processor->apic_id)); continue; - } + } gKernelArgs.arch_args.cpu_apic_id[gKernelArgs.num_cpus] = processor->apic_id; gKernelArgs.arch_args.cpu_os_id[processor->apic_id] = gKernelArgs.num_cpus; From superstippi at gmx.de Sun Feb 15 23:40:53 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 15 Feb 2009 23:40:53 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <1e80d8750902151340k7aefe82fp7672fffa3955772@mail.gmail.com> References: <200902151823.n1FINTFg001250@sheep.berlios.de> <894b9700902151316w147bda4bv538c857246ba113b@mail.gmail.com> <1e80d8750902151340k7aefe82fp7672fffa3955772@mail.gmail.com> Message-ID: <20090215234054.501.1@bepc.1234726482.fake> Urias McCullough wrote: > On Sun, Feb 15, 2009 at 1:16 PM, Stefano Ceccherini > wrote: > > 2009/2/15 stippi at BerliOS : > >> Author: stippi > >> Date: 2009-02-15 19:23:19 +0100 (Sun, 15 Feb 2009) New Revision: 29221 > >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29221&view=rev > >>> Log: > >> Implemented a new look for the Haiku interface controls. It was > >> overheard that they looked too ninety-ish. > > > > Very nice! Both the look and the implementation. > > The only thing I'd point out (besides the menufields "problem", already > > pointed out by Rene) is you that unselected tabs look like they are all > > joint. IOW: You can't immediately tell how many tabs are there. > > Very nice work, though. > > I agree on the tabs - it seems like there should be some hint of > distinction between the inactive tabs. > > Overall, the flatter look with tasteful application of gradients is nice > though :) Thanks for all the feedback so far! It's interesting how individual points of critique are felt by multiple people, as with the inactive tabs distinction. The higher contrast of the BMenuField popup marker was also something Axel mentioned to me before. I will try to work on these things some more. Also, I already mentioned a couple of TODO items in the commit message with regard to the implementation. The code is really WIP, while I felt that the look was already enough of an improvement and complete enough to go ahead and commit the patch. (Besides, it was also getting a bit of a pain to keep four Haiku trees on two different computers all in sync... ;-) Best regards, -Stephan From aldeck at mail.berlios.de Mon Feb 16 11:39:26 2009 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Mon, 16 Feb 2009 11:39:26 +0100 Subject: [Haiku-commits] r29229 - haiku/trunk/src/kits/tracker Message-ID: <200902161039.n1GAdQYo003937@sheep.berlios.de> Author: aldeck Date: 2009-02-16 11:39:26 +0100 (Mon, 16 Feb 2009) New Revision: 29229 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29229&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: * Revert one the changes done in r29198 has it happen to be wrong. See #3450 and #3011 Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-15 21:56:27 UTC (rev 29228) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-16 10:39:26 UTC (rev 29229) @@ -1622,8 +1622,8 @@ float listViewScrollBy = 0; for (int32 modelIndex = 0; modelIndex < count; modelIndex++) { Model *model = models[modelIndex]; - ASSERT(!FindPose(model)); - if (FindZombie(model->NodeRef())) { + + if (FindPose(model) || FindZombie(model->NodeRef())) { // we already have this pose, don't add it watch_node(model->NodeRef(), B_STOP_WATCHING, this); delete model; From philippe.houdoin at free.fr Mon Feb 16 11:14:00 2009 From: philippe.houdoin at free.fr (philippe.houdoin at free.fr) Date: Mon, 16 Feb 2009 11:14:00 +0100 (CET) Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <740686847.1952271234778981300.JavaMail.root@zimbra20-e3.priv.proxad.net> Message-ID: <2040477519.1953501234779240390.JavaMail.root@zimbra20-e3.priv.proxad.net> > Thanks for all the feedback so far! It's interesting how individual > points of critique are felt by multiple people, as with the inactive > tabs distinction. The higher contrast of the BMenuField popup marker > was also something Axel mentioned to me before. Here mine, many shared by others but, oh well: 1) Inactive tabs are not distinctable, but you know that one, don't you ;-) 2) Inactive tabs extending to a full width dark bar doesn't looks that fine, they're not headers but tabs, and if real world metaphor should applied, tabs don't extend full width. Having full width tabs in a OS cloning the "yellow tabs" BeOS sounds like blasphem, but maybe I'm going religious here :-) 3) Disabled unselected BCheck/RadioButtons looks less disabled than previous look, mostly due to the lighter grey color used to fill box/circle. Could be confusing for visual impaired people. 4) Enabled & selected BRadioButton looks to flat to me. I miss the "ball/LED" R5 effect which was a very distinctive BeOS widget from others GUIs. I hope one could still keep this quite unique visual identity while going to a flatter look... 5) BMenuField looks too much like a BButton, which can be confusing. But everybody told you so already ;-) 6) Drop shadow of the two kind of BSlider's thumbs are not consistent. I like the rectangular one better, but I can't tell from all widgets what's your choice regarding drop shadows, which could be a sign of inconsistency... or that I'm simply too picky/dumb/old/becoming blind. 7) BSlider bars and active BTab are rounded, when everything else moved from the R5 more rounded look to Haiku's sharper one. This seems inconsistent, and rounding looks dated these days. 8) BProgressBar, BGroupBox and BMenuBar are splendids! I also noticed that some gradients are in fact only composed of two colors. It's very visible on scrollbars, and I'm not sure it's expected. But, hey, GUI looks are like everything: it take times to get used to it, and then you can't lives without anymore! Please take no offense with the above remarks, taste are very subjective topic, and everyone think he has good one. > The code is really WIP, while I > felt that the look was already enough of an improvement and complete > enough to go ahead and commit the patch. (Besides, it was also getting > a bit of a pain to keep four Haiku trees on two different computers > all in sync... ;-) Isn't what our subversion branches/... root is for? ;-) Anyway, Stephan, like always, your graphic "touch" is well appreciated. I bet Haiku will have less audience without it: people loves screenshots, and your touch is on everyone but the oldests. ;-) Regards, Philippe, now daddy of 3. From axeld at mail.berlios.de Mon Feb 16 12:03:16 2009 From: axeld at mail.berlios.de (axeld at mail.berlios.de) Date: Mon, 16 Feb 2009 12:03:16 +0100 Subject: [Haiku-commits] r29230 - haiku/trunk/src/servers/net Message-ID: <200902161103.n1GB3G1E006900@sheep.berlios.de> Author: axeld Date: 2009-02-16 12:03:13 +0100 (Mon, 16 Feb 2009) New Revision: 29230 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29230&view=rev Modified: haiku/trunk/src/servers/net/AutoconfigLooper.cpp haiku/trunk/src/servers/net/DHCPClient.cpp haiku/trunk/src/servers/net/NetServer.cpp Log: * The auto-config looper now correctly sets the IFF_CONFIGURING flag - it cannot be set in the AF_LINK level. * It now also checks for this flag, so that the fallback configuration won't overwrite a manually configured interface anymore. * When an interface is configured, the IFF_CONFIGURING flag is now cleared as it should. Modified: haiku/trunk/src/servers/net/AutoconfigLooper.cpp =================================================================== --- haiku/trunk/src/servers/net/AutoconfigLooper.cpp 2009-02-16 10:39:26 UTC (rev 29229) +++ haiku/trunk/src/servers/net/AutoconfigLooper.cpp 2009-02-16 11:03:13 UTC (rev 29230) @@ -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: @@ -63,17 +63,15 @@ // set IFF_CONFIGURING flag on interface - int socket = ::socket(AF_LINK, SOCK_DGRAM, 0); + int socket = ::socket(AF_INET, SOCK_DGRAM, 0); if (socket < 0) return; if (ioctl(socket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0) { request.ifr_flags |= IFF_CONFIGURING; - ioctl(socket, SIOCSIFFLAGS, &request, sizeof(struct ifreq)); + ioctl(socket, SIOCSIFFLAGS, &request, sizeof(struct ifreq))); } - close(socket); - // remove current handler _RemoveClient(); @@ -83,8 +81,10 @@ fCurrentClient = new DHCPClient(fTarget, fDevice.String()); AddHandler(fCurrentClient); - if (fCurrentClient->Initialize() == B_OK) + if (fCurrentClient->Initialize() == B_OK) { + close(socket); return; + } _RemoveClient(); @@ -94,6 +94,15 @@ // TODO: have a look at zeroconf // TODO: this could also be done add-on based + if (ioctl(socket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0 + && (request.ifr_flags & IFF_CONFIGURING) == 0) { + // Someone else configured the interface in the mean time + close(socket); + return; + } + + close(socket); + BMessage interface(kMsgConfigureInterface); interface.AddString("device", fDevice.String()); interface.AddBool("auto", true); Modified: haiku/trunk/src/servers/net/DHCPClient.cpp =================================================================== --- haiku/trunk/src/servers/net/DHCPClient.cpp 2009-02-16 10:39:26 UTC (rev 29229) +++ haiku/trunk/src/servers/net/DHCPClient.cpp 2009-02-16 11:03:13 UTC (rev 29230) @@ -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: @@ -788,7 +788,8 @@ status_t -DHCPClient::_SendMessage(int socket, dhcp_message& message, sockaddr_in& address) const +DHCPClient::_SendMessage(int socket, dhcp_message& message, + sockaddr_in& address) const { ssize_t bytesSent = sendto(socket, &message, message.Size(), address.sin_addr.s_addr == INADDR_BROADCAST ? MSG_BCAST : 0, Modified: haiku/trunk/src/servers/net/NetServer.cpp =================================================================== --- haiku/trunk/src/servers/net/NetServer.cpp 2009-02-16 10:39:26 UTC (rev 29229) +++ haiku/trunk/src/servers/net/NetServer.cpp 2009-02-16 11:03:13 UTC (rev 29230) @@ -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: @@ -660,7 +660,7 @@ // set flags if (flags != 0) { - request.ifr_flags = currentFlags | flags; + request.ifr_flags = (currentFlags & ~IFF_CONFIGURING) | flags; if (ioctl(familySocket, SIOCSIFFLAGS, &request, sizeof(struct ifreq)) < 0) fprintf(stderr, "%s: Setting flags failed: %s\n", Name(), strerror(errno)); } From axeld at mail.berlios.de Mon Feb 16 12:05:33 2009 From: axeld at mail.berlios.de (axeld at mail.berlios.de) Date: Mon, 16 Feb 2009 12:05:33 +0100 Subject: [Haiku-commits] r29231 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200902161105.n1GB5X8Q007142@sheep.berlios.de> Author: axeld Date: 2009-02-16 12:05:25 +0100 (Mon, 16 Feb 2009) New Revision: 29231 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29231&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/stack/link.cpp Log: * You can now use SIOCGIFFLAGS on the AF_LINK level as well. * Cleanup. Modified: haiku/trunk/src/add-ons/kernel/network/stack/link.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/link.cpp 2009-02-16 11:03:13 UTC (rev 29230) +++ haiku/trunk/src/add-ons/kernel/network/stack/link.cpp 2009-02-16 11:05:25 UTC (rev 29231) @@ -1,12 +1,12 @@ /* - * 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: * Axel D?rfler, axeld at pinc-software.de */ -//! The net_protocol you talk to when using the AF_LINK protocol +//! The net_protocol one talks to when using the AF_LINK protocol #include "datalink.h" #include "domains.h" @@ -32,37 +32,37 @@ class LocalStackBundle { public: - static net_stack_module_info *Stack() { return &gNetStackModule; } - static net_buffer_module_info *Buffer() { return &gNetBufferModule; } + static net_stack_module_info* Stack() { return &gNetStackModule; } + static net_buffer_module_info* Buffer() { return &gNetBufferModule; } }; typedef DatagramSocket LocalDatagramSocket; class LinkProtocol : public net_protocol, public LocalDatagramSocket { public: - LinkProtocol(net_socket *socket); + LinkProtocol(net_socket* socket); ~LinkProtocol(); - status_t StartMonitoring(const char *); + status_t StartMonitoring(const char* deviceName); status_t StopMonitoring(); private: status_t _SocketStatus() const; status_t _Unregister(); - net_device_monitor fMonitor; - net_device_interface *fMonitoredDevice; + static status_t _MonitorData(net_device_monitor* monitor, + net_buffer* buffer); + static void _MonitorEvent(net_device_monitor* monitor, int32 event); - static status_t _MonitorData(net_device_monitor *monitor, - net_buffer *buffer); - static void _MonitorEvent(net_device_monitor *monitor, int32 event); + net_device_monitor fMonitor; + net_device_interface* fMonitoredDevice; }; -struct net_domain *sDomain; +struct net_domain* sDomain; -LinkProtocol::LinkProtocol(net_socket *socket) +LinkProtocol::LinkProtocol(net_socket* socket) : LocalDatagramSocket("packet capture", socket) { fMonitor.cookie = this; @@ -82,14 +82,14 @@ status_t -LinkProtocol::StartMonitoring(const char *deviceName) +LinkProtocol::StartMonitoring(const char* deviceName) { MutexLocker _(fLock); if (fMonitoredDevice) return B_BUSY; - net_device_interface *interface = get_device_interface(deviceName); + net_device_interface* interface = get_device_interface(deviceName); if (interface == NULL) return ENODEV; @@ -138,16 +138,16 @@ status_t -LinkProtocol::_MonitorData(net_device_monitor *monitor, net_buffer *packet) +LinkProtocol::_MonitorData(net_device_monitor* monitor, net_buffer* packet) { - return ((LinkProtocol *)monitor->cookie)->SocketEnqueue(packet); + return ((LinkProtocol*)monitor->cookie)->SocketEnqueue(packet); } void -LinkProtocol::_MonitorEvent(net_device_monitor *monitor, int32 event) +LinkProtocol::_MonitorEvent(net_device_monitor* monitor, int32 event) { - LinkProtocol *protocol = (LinkProtocol *)monitor->cookie; + LinkProtocol* protocol = (LinkProtocol*)monitor->cookie; if (event == B_DEVICE_GOING_DOWN) { MutexLocker _(protocol->fLock); @@ -164,11 +164,26 @@ // #pragma mark - -net_protocol * -link_init_protocol(net_socket *socket) +static bool +user_request_get_device_interface(void* value, struct ifreq& request, + net_device_interface*& interface) { - LinkProtocol *protocol = new (std::nothrow) LinkProtocol(socket); - if (protocol && protocol->InitCheck() < B_OK) { + if (user_memcpy(&request, value, IF_NAMESIZE) < B_OK) + return false; + + interface = get_device_interface(request.ifr_name); + return true; +} + + +// #pragma mark - + + +net_protocol* +link_init_protocol(net_socket* socket) +{ + LinkProtocol* protocol = new (std::nothrow) LinkProtocol(socket); + if (protocol != NULL && protocol->InitCheck() < B_OK) { delete protocol; return NULL; } @@ -178,64 +193,63 @@ status_t -link_uninit_protocol(net_protocol *protocol) +link_uninit_protocol(net_protocol* protocol) { - delete (LinkProtocol *)protocol; + delete (LinkProtocol*)protocol; return B_OK; } status_t -link_open(net_protocol *protocol) +link_open(net_protocol* protocol) { return B_OK; } status_t -link_close(net_protocol *protocol) +link_close(net_protocol* protocol) { return B_OK; } status_t -link_free(net_protocol *protocol) +link_free(net_protocol* protocol) { return B_OK; } status_t -link_connect(net_protocol *protocol, const struct sockaddr *address) +link_connect(net_protocol* protocol, const struct sockaddr* address) { return EOPNOTSUPP; } status_t -link_accept(net_protocol *protocol, struct net_socket **_acceptedSocket) +link_accept(net_protocol* protocol, struct net_socket** _acceptedSocket) { return EOPNOTSUPP; } status_t -link_control(net_protocol *_protocol, int level, int option, void *value, - size_t *_length) +link_control(net_protocol* _protocol, int level, int option, void* value, + size_t* _length) { - LinkProtocol *protocol = (LinkProtocol *)_protocol; + LinkProtocol* protocol = (LinkProtocol*)_protocol; switch (option) { case SIOCGIFINDEX: { // get index of interface + net_device_interface* interface; struct ifreq request; - if (user_memcpy(&request, value, IF_NAMESIZE) < B_OK) + if (!user_request_get_device_interface(value, request, interface)) return B_BAD_ADDRESS; - net_device_interface *interface - = get_device_interface(request.ifr_name); if (interface != NULL) { request.ifr_index = interface->device->index; put_device_interface(interface); @@ -251,14 +265,14 @@ if (user_memcpy(&request, value, sizeof(struct ifreq)) < B_OK) return B_BAD_ADDRESS; - net_device_interface *interface + net_device_interface* interface = get_device_interface(request.ifr_index); - if (interface != NULL) { - strlcpy(request.ifr_name, interface->device->name, IF_NAMESIZE); - put_device_interface(interface); - } else + if (interface == NULL) return ENODEV; + strlcpy(request.ifr_name, interface->device->name, IF_NAMESIZE); + put_device_interface(interface); + return user_memcpy(value, &request, sizeof(struct ifreq)); } @@ -279,7 +293,7 @@ return B_BAD_ADDRESS; status_t result = list_device_interfaces(config.ifc_buf, - (size_t *)&config.ifc_len); + (size_t*)&config.ifc_len); if (result != B_OK) return result; @@ -289,22 +303,39 @@ case SIOCGIFADDR: { // get address of interface + net_device_interface* interface; struct ifreq request; - if (user_memcpy(&request, value, IF_NAMESIZE) < B_OK) + if (!user_request_get_device_interface(value, request, interface)) return B_BAD_ADDRESS; - net_device_interface *interface - = get_device_interface(request.ifr_name); - if (interface != NULL) { - get_device_interface_address(interface, &request.ifr_addr); - put_device_interface(interface); - } else + if (interface == NULL) return ENODEV; - return user_memcpy(&((struct ifreq *)value)->ifr_addr, + get_device_interface_address(interface, &request.ifr_addr); + put_device_interface(interface); + + return user_memcpy(&((struct ifreq*)value)->ifr_addr, &request.ifr_addr, request.ifr_addr.sa_len); } + case SIOCGIFFLAGS: + { + // get flags of interface + net_device_interface* interface; + struct ifreq request; + if (!user_request_get_device_interface(value, request, interface)) + return B_BAD_ADDRESS; + + if (interface == NULL) + return ENODEV; + + request.ifr_flags = interface->device->flags; + put_device_interface(interface); + + return user_memcpy(&((struct ifreq*)value)->ifr_flags, + &request.ifr_flags, sizeof(request.ifr_flags)); + } + case SIOCSPACKETCAP: { struct ifreq request; @@ -323,8 +354,8 @@ status_t -link_getsockopt(net_protocol *protocol, int level, int option, void *value, - int *length) +link_getsockopt(net_protocol* protocol, int level, int option, void* value, + int* length) { if (protocol->next != NULL) { return protocol->next->module->getsockopt(protocol, level, option, @@ -337,8 +368,8 @@ status_t -link_setsockopt(net_protocol *protocol, int level, int option, - const void *value, int length) +link_setsockopt(net_protocol* protocol, int level, int option, + const void* value, int length) { if (protocol->next != NULL) { return protocol->next->module->setsockopt(protocol, level, option, @@ -351,7 +382,7 @@ status_t -link_bind(net_protocol *protocol, const struct sockaddr *address) +link_bind(net_protocol* protocol, const struct sockaddr* address) { // TODO: bind to a specific interface and ethernet type return B_ERROR; @@ -359,72 +390,72 @@ status_t -link_unbind(net_protocol *protocol, struct sockaddr *address) +link_unbind(net_protocol* protocol, struct sockaddr* address) { return B_ERROR; } status_t -link_listen(net_protocol *protocol, int count) +link_listen(net_protocol* protocol, int count) { return EOPNOTSUPP; } status_t -link_shutdown(net_protocol *protocol, int direction) +link_shutdown(net_protocol* protocol, int direction) { return EOPNOTSUPP; } status_t -link_send_data(net_protocol *protocol, net_buffer *buffer) +link_send_data(net_protocol* protocol, net_buffer* buffer) { return B_NOT_ALLOWED; } status_t -link_send_routed_data(net_protocol *protocol, struct net_route *route, - net_buffer *buffer) +link_send_routed_data(net_protocol* protocol, struct net_route* route, + net_buffer* buffer) { return B_NOT_ALLOWED; } ssize_t -link_send_avail(net_protocol *protocol) +link_send_avail(net_protocol* protocol) { return B_ERROR; } status_t -link_read_data(net_protocol *protocol, size_t numBytes, uint32 flags, - net_buffer **_buffer) +link_read_data(net_protocol* protocol, size_t numBytes, uint32 flags, + net_buffer** _buffer) { - return ((LinkProtocol *)protocol)->SocketDequeue(flags, _buffer); + return ((LinkProtocol*)protocol)->SocketDequeue(flags, _buffer); } ssize_t -link_read_avail(net_protocol *protocol) +link_read_avail(net_protocol* protocol) { - return ((LinkProtocol *)protocol)->AvailableData(); + return ((LinkProtocol*)protocol)->AvailableData(); } -struct net_domain * -link_get_domain(net_protocol *protocol) +struct net_domain* +link_get_domain(net_protocol* protocol) { return sDomain; } size_t -link_get_mtu(net_protocol *protocol, const struct sockaddr *address) +link_get_mtu(net_protocol* protocol, const struct sockaddr* address) { // TODO: for now return 0; @@ -432,22 +463,22 @@ status_t -link_receive_data(net_buffer *buffer) +link_receive_data(net_buffer* buffer) { return B_ERROR; } status_t -link_error(uint32 code, net_buffer *data) +link_error(uint32 code, net_buffer* data) { return B_ERROR; } status_t -link_error_reply(net_protocol *protocol, net_buffer *causedError, uint32 code, - void *errorData) +link_error_reply(net_protocol* protocol, net_buffer* causedError, uint32 code, + void* errorData) { return B_ERROR; } From axeld at mail.berlios.de Mon Feb 16 12:13:30 2009 From: axeld at mail.berlios.de (axeld at mail.berlios.de) Date: Mon, 16 Feb 2009 12:13:30 +0100 Subject: [Haiku-commits] r29232 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200902161113.n1GBDUNF007760@sheep.berlios.de> Author: axeld Date: 2009-02-16 12:13:28 +0100 (Mon, 16 Feb 2009) New Revision: 29232 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29232&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/interfaces.cpp haiku/trunk/src/add-ons/kernel/network/stack/interfaces.h Log: * Renamed net_device_interface::rx_lock to receive_lock. * Cleanup, improved comments, removed useless ones. Modified: haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp 2009-02-16 11:05:25 UTC (rev 29231) +++ haiku/trunk/src/add-ons/kernel/network/stack/datalink.cpp 2009-02-16 11:13:28 UTC (rev 29232) @@ -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: @@ -31,28 +31,28 @@ struct datalink_protocol : net_protocol { - struct net_domain_private *domain; + struct net_domain_private* domain; }; struct interface_protocol : net_datalink_protocol { - struct net_device_module_info *device_module; - struct net_device *device; + struct net_device_module_info* device_module; + struct net_device* device; }; static status_t -device_reader_thread(void *_interface) +device_reader_thread(void* _interface) { - net_device_interface *interface = (net_device_interface *)_interface; - net_device *device = interface->device; + net_device_interface* interface = (net_device_interface*)_interface; + net_device* device = interface->device; status_t status = B_OK; - RecursiveLocker locker(interface->rx_lock); + RecursiveLocker locker(interface->receive_lock); - while (device->flags & IFF_UP) { + while ((device->flags & IFF_UP) != 0) { locker.Unlock(); - net_buffer *buffer; + net_buffer* buffer; status = device->module->receive_data(device, &buffer); locker.Lock(); @@ -61,8 +61,7 @@ // feed device monitors DeviceMonitorList::Iterator iterator = interface->monitor_funcs.GetIterator(); - while (iterator.HasNext()) { - net_device_monitor *monitor = iterator.Next(); + while (net_device_monitor* monitor = iterator.Next()) { monitor->receive(monitor, buffer); } @@ -76,26 +75,17 @@ fifo_enqueue_buffer(&interface->receive_queue, buffer); } else { // In case of error, give the other threads some - // time to run since this is a near real time thread. - // - // TODO: can this value be lower? 1000 works fine in - // my system. 10ms seems a bit too much and adds - // as latency. + // time to run since this is a high priority time thread. snooze(10000); } - - // if the interface went down IFF_UP was removed - // and the receive_data() above should have been - // interrupted. One check should be enough, specially - // considering the snooze above. } return status; } -static struct sockaddr ** -interface_address(net_interface *interface, int32 option) +static struct sockaddr** +interface_address(net_interface* interface, int32 option) { switch (option) { case SIOCSIFADDR: @@ -118,8 +108,8 @@ } -void -remove_default_routes(net_interface_private *interface, int32 option) +static void +remove_default_routes(net_interface_private* interface, int32 option) { net_route route; route.destination = interface->address; @@ -141,8 +131,8 @@ } -void -add_default_routes(net_interface_private *interface, int32 option) +static void +add_default_routes(net_interface_private* interface, int32 option) { net_route route; route.destination = interface->address; @@ -164,16 +154,16 @@ } -sockaddr * -reallocate_address(sockaddr **_address, uint32 size) +static sockaddr* +reallocate_address(sockaddr** _address, uint32 size) { - sockaddr *address = *_address; + sockaddr* address = *_address; size = max_c(size, sizeof(struct sockaddr)); if (address != NULL && address->sa_len >= size) return address; - address = (sockaddr *)malloc(size); + address = (sockaddr*)malloc(size); if (address == NULL) return NULL; @@ -185,8 +175,8 @@ static status_t -datalink_control_interface(net_domain_private *domain, int32 option, - void *value, size_t *_length, size_t expected, bool getByName) +datalink_control_interface(net_domain_private* domain, int32 option, + void* value, size_t* _length, size_t expected, bool getByName) { if (*_length < expected) return B_BAD_VALUE; @@ -198,14 +188,14 @@ return B_BAD_ADDRESS; MutexLocker _(domain->lock); - net_interface *interface = NULL; + net_interface* interface = NULL; if (getByName) interface = find_interface(domain, request.ifr_name); else interface = find_interface(domain, request.ifr_index); - status_t status = (interface == NULL) ? ENODEV : B_OK; + status_t status = interface == NULL ? ENODEV : B_OK; switch (option) { case SIOCGIFINDEX: @@ -234,10 +224,10 @@ status_t -datalink_control(net_domain *_domain, int32 option, void *value, - size_t *_length) +datalink_control(net_domain* _domain, int32 option, void* value, + size_t* _length) { - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; if (domain == NULL || domain->family == AF_LINK) { // the AF_LINK family is already handled completely in the link protocol return B_BAD_VALUE; @@ -288,7 +278,7 @@ return B_BAD_ADDRESS; status_t result = list_domain_interfaces(config.ifc_buf, - (size_t *)&config.ifc_len); + (size_t*)&config.ifc_len); if (result != B_OK) return result; @@ -324,7 +314,7 @@ MutexLocker _(domain->lock); - net_interface *interface = find_interface(domain, + net_interface* interface = find_interface(domain, request.ifr_name); if (interface == NULL) return B_BAD_VALUE; @@ -339,10 +329,10 @@ status_t -datalink_send_data(struct net_route *route, net_buffer *buffer) +datalink_send_data(struct net_route* route, net_buffer* buffer) { - net_interface_private *interface = - (net_interface_private *)route->interface; + net_interface_private* interface = + (net_interface_private*)route->interface; //dprintf("send buffer (%ld bytes) to interface %s (route flags %lx)\n", // buffer->size, interface->name, route->flags); @@ -373,19 +363,19 @@ status_t -datalink_send_datagram(net_protocol *protocol, net_domain *domain, - net_buffer *buffer) +datalink_send_datagram(net_protocol* protocol, net_domain* domain, + net_buffer* buffer) { if (protocol == NULL && domain == NULL) return B_BAD_VALUE; - net_protocol_module_info *module = protocol ? protocol->module + net_protocol_module_info* module = protocol ? protocol->module : domain->module; if (domain == NULL) domain = protocol->module->get_domain(protocol); - net_route *route = NULL; + net_route* route = NULL; status_t status; if (protocol != NULL && protocol->socket->bound_to_device > 0) { status = get_device_route(domain, protocol->socket->bound_to_device, @@ -408,21 +398,21 @@ \param _matchedType will be set to either zero or MSG_BCAST if non-NULL. */ bool -datalink_is_local_address(net_domain *_domain, const struct sockaddr *address, - net_interface **_interface, uint32 *_matchedType) +datalink_is_local_address(net_domain* _domain, const struct sockaddr* address, + net_interface** _interface, uint32* _matchedType) { - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; if (domain == NULL || address == NULL) return false; MutexLocker locker(domain->lock); - net_interface *interface = NULL; - net_interface *fallback = NULL; + net_interface* interface = NULL; + net_interface* fallback = NULL; uint32 matchedType = 0; while (true) { - interface = (net_interface *)list_get_next_item( + interface = (net_interface*)list_get_next_item( &domain->interfaces, interface); if (interface == NULL) break; @@ -460,20 +450,20 @@ } -net_interface * -datalink_get_interface_with_address(net_domain *_domain, - const sockaddr *address) +net_interface* +datalink_get_interface_with_address(net_domain* _domain, + const sockaddr* address) { - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; if (domain == NULL) return NULL; MutexLocker _(domain->lock); - net_interface *interface = NULL; + net_interface* interface = NULL; while (true) { - interface = (net_interface *)list_get_next_item( + interface = (net_interface*)list_get_next_item( &domain->interfaces, interface); if (interface == NULL) break; @@ -490,8 +480,8 @@ } -net_interface * -datalink_get_interface(net_domain *domain, uint32 index) +net_interface* +datalink_get_interface(net_domain* domain, uint32 index) { if (index == 0) return datalink_get_interface_with_address(domain, NULL); @@ -518,12 +508,12 @@ status_t -interface_protocol_init(struct net_interface *_interface, - net_datalink_protocol **_protocol) +interface_protocol_init(struct net_interface* _interface, + net_datalink_protocol** _protocol) { - net_interface_private *interface = (net_interface_private *)_interface; + net_interface_private* interface = (net_interface_private*)_interface; - interface_protocol *protocol = new (std::nothrow) interface_protocol; + interface_protocol* protocol = new (std::nothrow) interface_protocol; if (protocol == NULL) return B_NO_MEMORY; @@ -536,7 +526,7 @@ status_t -interface_protocol_uninit(net_datalink_protocol *protocol) +interface_protocol_uninit(net_datalink_protocol* protocol) { delete protocol; return B_OK; @@ -544,12 +534,12 @@ status_t -interface_protocol_send_data(net_datalink_protocol *_protocol, - net_buffer *buffer) +interface_protocol_send_data(net_datalink_protocol* _protocol, + net_buffer* buffer) { - interface_protocol *protocol = (interface_protocol *)_protocol; - net_interface_private *interface - = (net_interface_private *)protocol->interface; + interface_protocol* protocol = (interface_protocol*)_protocol; + net_interface_private* interface + = (net_interface_private*)protocol->interface; // TODO: Need to think about this locking. We can't obtain the // RX Lock here (nor would it make sense) as the ARP @@ -560,7 +550,7 @@ DeviceMonitorList::Iterator iterator = interface->device_interface->monitor_funcs.GetIterator(); while (iterator.HasNext()) { - net_device_monitor *monitor = iterator.Next(); + net_device_monitor* monitor = iterator.Next(); monitor->receive(monitor, buffer); } @@ -569,12 +559,12 @@ status_t -interface_protocol_up(net_datalink_protocol *_protocol) +interface_protocol_up(net_datalink_protocol* _protocol) { - interface_protocol *protocol = (interface_protocol *)_protocol; - net_device_interface *deviceInterface = - ((net_interface_private *)protocol->interface)->device_interface; - net_device *device = protocol->device; + interface_protocol* protocol = (interface_protocol*)_protocol; + net_device_interface* deviceInterface = + ((net_interface_private*)protocol->interface)->device_interface; + net_device* device = protocol->device; // This function is called with the RX lock held. @@ -610,11 +600,11 @@ void -interface_protocol_down(net_datalink_protocol *_protocol) +interface_protocol_down(net_datalink_protocol* _protocol) { - interface_protocol *protocol = (interface_protocol *)_protocol; - net_device_interface *deviceInterface = - ((net_interface_private *)protocol->interface)->device_interface; + interface_protocol* protocol = (interface_protocol*)_protocol; + net_device_interface* deviceInterface = + ((net_interface_private*)protocol->interface)->device_interface; // This function is called with the RX lock held. if (deviceInterface->up_count == 0) @@ -632,11 +622,12 @@ status_t -interface_protocol_control(net_datalink_protocol *_protocol, - int32 option, void *argument, size_t length) +interface_protocol_control(net_datalink_protocol* _protocol, int32 option, + void* argument, size_t length) { - interface_protocol *protocol = (interface_protocol *)_protocol; - net_interface_private *interface = (net_interface_private *)protocol->interface; + interface_protocol* protocol = (interface_protocol*)_protocol; + net_interface_private* interface + = (net_interface_private*)protocol->interface; switch (option) { case SIOCSIFADDR: @@ -649,12 +640,12 @@ if (user_memcpy(&request, argument, sizeof(struct ifreq)) < B_OK) return B_BAD_ADDRESS; - sockaddr **_address = interface_address(interface, option); + sockaddr** _address = interface_address(interface, option); if (_address == NULL) return B_BAD_VALUE; // allocate new address if needed - sockaddr *address = reallocate_address(_address, + sockaddr* address = reallocate_address(_address, request.ifr_addr.sa_len); // copy new address over @@ -664,15 +655,15 @@ if (option == SIOCSIFADDR || option == SIOCSIFNETMASK) { // reset netmask and broadcast addresses to defaults - sockaddr *netmask = NULL; - sockaddr *oldNetmask = NULL; + sockaddr* netmask = NULL; + sockaddr* oldNetmask = NULL; if (option == SIOCSIFADDR) { netmask = reallocate_address(&interface->mask, request.ifr_addr.sa_len); } else oldNetmask = address; - sockaddr *broadcast = reallocate_address( + sockaddr* broadcast = reallocate_address( &interface->destination, request.ifr_addr.sa_len); interface->domain->address_module->set_to_defaults( @@ -691,13 +682,13 @@ case SIOCGIFDSTADDR: { // get logical interface address - sockaddr **_address = interface_address(interface, option); + sockaddr** _address = interface_address(interface, option); if (_address == NULL) return B_BAD_VALUE; struct ifreq request; - sockaddr *address = *_address; + sockaddr* address = *_address; if (address != NULL) memcpy(&request.ifr_addr, address, address->sa_len); else { @@ -706,7 +697,7 @@ } // copy address over - return user_memcpy(&((struct ifreq *)argument)->ifr_addr, + return user_memcpy(&((struct ifreq*)argument)->ifr_addr, &request.ifr_addr, request.ifr_addr.sa_len); } @@ -716,7 +707,7 @@ struct ifreq request; request.ifr_flags = interface->flags | interface->device->flags; - return user_memcpy(&((struct ifreq *)argument)->ifr_flags, + return user_memcpy(&((struct ifreq*)argument)->ifr_flags, &request.ifr_flags, sizeof(request.ifr_flags)); } @@ -730,14 +721,14 @@ request.ifr_parameter.sub_type = 0; // TODO: for now, we ignore the sub type... - return user_memcpy(&((struct ifreq *)argument)->ifr_parameter, + return user_memcpy(&((struct ifreq*)argument)->ifr_parameter, &request.ifr_parameter, sizeof(request.ifr_parameter)); } case SIOCGIFSTATS: { // get stats - return user_memcpy(&((struct ifreq *)argument)->ifr_stats, + return user_memcpy(&((struct ifreq*)argument)->ifr_stats, &interface->device_interface->device->stats, sizeof(struct ifreq_stats)); } @@ -748,7 +739,7 @@ struct ifreq request; request.ifr_type = interface->type; - return user_memcpy(&((struct ifreq *)argument)->ifr_type, + return user_memcpy(&((struct ifreq*)argument)->ifr_type, &request.ifr_type, sizeof(request.ifr_type)); } @@ -758,7 +749,7 @@ struct ifreq request; request.ifr_mtu = interface->mtu; - return user_memcpy(&((struct ifreq *)argument)->ifr_mtu, + return user_memcpy(&((struct ifreq*)argument)->ifr_mtu, &request.ifr_mtu, sizeof(request.ifr_mtu)); } case SIOCSIFMTU: @@ -793,7 +784,7 @@ struct ifreq request; request.ifr_media = interface->device->media; - return user_memcpy(&((struct ifreq *)argument)->ifr_media, + return user_memcpy(&((struct ifreq*)argument)->ifr_media, &request.ifr_media, sizeof(request.ifr_media)); } @@ -803,7 +794,7 @@ struct ifreq request; request.ifr_metric = interface->metric; - return user_memcpy(&((struct ifreq *)argument)->ifr_metric, + return user_memcpy(&((struct ifreq*)argument)->ifr_metric, &request.ifr_metric, sizeof(request.ifr_metric)); } case SIOCSIFMETRIC: @@ -829,20 +820,20 @@ static status_t -interface_protocol_join_multicast(net_datalink_protocol *_protocol, - const sockaddr *address) +interface_protocol_join_multicast(net_datalink_protocol* _protocol, + const sockaddr* address) { - interface_protocol *protocol = (interface_protocol *)_protocol; + interface_protocol* protocol = (interface_protocol*)_protocol; return protocol->device_module->add_multicast(protocol->device, address); } static status_t -interface_protocol_leave_multicast(net_datalink_protocol *_protocol, - const sockaddr *address) +interface_protocol_leave_multicast(net_datalink_protocol* _protocol, + const sockaddr* address) { - interface_protocol *protocol = (interface_protocol *)_protocol; + interface_protocol* protocol = (interface_protocol*)_protocol; return protocol->device_module->remove_multicast(protocol->device, address); Modified: haiku/trunk/src/add-ons/kernel/network/stack/domains.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/domains.cpp 2009-02-16 11:05:25 UTC (rev 29231) +++ haiku/trunk/src/add-ons/kernel/network/stack/domains.cpp 2009-02-16 11:13:28 UTC (rev 29232) @@ -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: @@ -40,12 +40,12 @@ 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; + net_domain_private* domain = NULL; while (true) { - domain = (net_domain_private *)list_get_next_item(&sDomains, domain); + domain = (net_domain_private*)list_get_next_item(&sDomains, domain); if (domain == NULL) break; @@ -63,7 +63,7 @@ /*! Gets the domain of the specified family. */ -net_domain * +net_domain* get_domain(int family) { MutexLocker locker(sDomainLock); @@ -76,17 +76,17 @@ { MutexLocker locker(sDomainLock); - net_domain_private *domain = NULL; + net_domain_private* domain = NULL; uint32 count = 0; while (true) { - domain = (net_domain_private *)list_get_next_item(&sDomains, domain); + domain = (net_domain_private*)list_get_next_item(&sDomains, domain); if (domain == NULL) break; - net_interface *interface = NULL; + net_interface* interface = NULL; while (true) { - interface = (net_interface *)list_get_next_item(&domain->interfaces, + interface = (net_interface*)list_get_next_item(&domain->interfaces, interface); if (interface == NULL) break; @@ -105,23 +105,23 @@ returned. */ status_t -list_domain_interfaces(void *_buffer, size_t *bufferSize) +list_domain_interfaces(void* _buffer, size_t* bufferSize) { MutexLocker locker(sDomainLock); UserBuffer buffer(_buffer, *bufferSize); - net_domain_private *domain = NULL; + net_domain_private* domain = NULL; while (true) { - domain = (net_domain_private *)list_get_next_item(&sDomains, domain); + domain = (net_domain_private*)list_get_next_item(&sDomains, domain); if (domain == NULL) break; MutexLocker locker(domain->lock); - net_interface *interface = NULL; + net_interface* interface = NULL; while (true) { - interface = (net_interface *)list_get_next_item(&domain->interfaces, + interface = (net_interface*)list_get_next_item(&domain->interfaces, interface); if (interface == NULL) break; @@ -149,23 +149,23 @@ status_t -add_interface_to_domain(net_domain *_domain, +add_interface_to_domain(net_domain* _domain, struct ifreq& request) { - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; - const char *deviceName = request.ifr_parameter.device[0] + const char* deviceName = request.ifr_parameter.device[0] ? request.ifr_parameter.device : request.ifr_name; - const char *baseName = request.ifr_parameter.base_name[0] + const char* baseName = request.ifr_parameter.base_name[0] ? request.ifr_parameter.base_name : request.ifr_name; - net_device_interface *deviceInterface = get_device_interface(deviceName); + net_device_interface* deviceInterface = get_device_interface(deviceName); if (deviceInterface == NULL) return ENODEV; MutexLocker locker(domain->lock); - net_interface_private *interface = NULL; + net_interface_private* interface = NULL; status_t status; if (find_interface(domain, request.ifr_name) == NULL) { @@ -200,140 +200,129 @@ You need to hold the domain's lock when calling this function. */ status_t -remove_interface_from_domain(net_interface *interface) +remove_interface_from_domain(net_interface* interface) { - net_domain_private *domain = (net_domain_private *)interface->domain; + net_domain_private* domain = (net_domain_private*)interface->domain; list_remove_item(&domain->interfaces, interface); notify_interface_removed(interface); - delete_interface((net_interface_private *)interface); + delete_interface((net_interface_private*)interface); return B_OK; } status_t -domain_interface_control(net_domain_private *domain, int32 option, - ifreq *request) +domain_interface_control(net_domain_private* domain, int32 option, + ifreq* request) { - const char *name = request->ifr_name; + const char* name = request->ifr_name; status_t status = B_OK; - net_device_interface *device = get_device_interface(name, false); + net_device_interface* device = get_device_interface(name, false); if (device == NULL) return ENODEV; - else { - // The locking protocol dictates that if both the RX lock - // and domain locks are required, we MUST obtain the RX - // lock before the domain lock. This order MUST NOT ever - // be reversed under the penalty of deadlock. - RecursiveLocker _1(device->rx_lock); - MutexLocker _2(domain->lock); - net_interface *interface = find_interface(domain, name); - if (interface != NULL) { - switch (option) { - case SIOCDIFADDR: - remove_interface_from_domain(interface); - break; + // The locking protocol dictates that if both the receive lock + // and domain locks are required, we MUST obtain the receive + // lock before the domain lock. + RecursiveLocker _1(device->receive_lock); + MutexLocker _2(domain->lock); - case SIOCSIFFLAGS: - { - uint32 requestFlags = request->ifr_flags; - request->ifr_flags &= ~(IFF_UP | IFF_LINK | IFF_BROADCAST); + net_interface* interface = find_interface(domain, name); + if (interface != NULL) { + switch (option) { + case SIOCDIFADDR: + remove_interface_from_domain(interface); + break; - if ((requestFlags & IFF_UP) != (interface->flags & IFF_UP)) { - if (requestFlags & IFF_UP) { - status = interface->first_info->interface_up( - interface->first_protocol); - if (status == B_OK) - interface->flags |= IFF_UP; - } else { - interface_set_down(interface); - } - } + case SIOCSIFFLAGS: + { + uint32 requestFlags = request->ifr_flags; + request->ifr_flags &= ~(IFF_UP | IFF_LINK | IFF_BROADCAST); - if (status == B_OK) { - // TODO: why shouldn't we able to delete IFF_BROADCAST? - interface->flags &= IFF_UP | IFF_LINK | IFF_BROADCAST; - interface->flags |= request->ifr_flags; + if ((requestFlags & IFF_UP) != (interface->flags & IFF_UP)) { + if (requestFlags & IFF_UP) { + status = interface->first_info->interface_up( + interface->first_protocol); + if (status == B_OK) + interface->flags |= IFF_UP; + } else { + interface_set_down(interface); } - break; } + + if (status == B_OK) { + // TODO: why shouldn't we able to delete IFF_BROADCAST? + interface->flags &= IFF_UP | IFF_LINK | IFF_BROADCAST; + interface->flags |= request->ifr_flags; + } + break; } } } - // If the SIOCDIFADDR call above removed the last interface - // associated with the device interface, this put_() will - // effectively remove the interface + // If the SIOCDIFADDR call above removed the last interface associated with + // the device interface, this will effectively remove the interface put_device_interface(device); return status; } +/*! You need to hold the domain lock when calling this function. */ void -domain_interface_went_down(net_interface *interface) +domain_interface_went_down(net_interface* interface) { - // the domain should be locked here. always check - // all callers to be sure. We get here via - // interface_set_down(). + ASSERT_LOCKED_MUTEX(&((net_domain_private*)interface->domain)->lock); - dprintf("domain_interface_went_down(%i, %s)\n", - interface->domain->family, interface->name); + TRACE(("domain_interface_went_down(%i, %s)\n", + interface->domain->family, interface->name)); - // domain might have been locked by: - // - domain_removed_device_interface() <--- here - // remove_interface_from_domain() - // delete_interface() - // interface_set_down() - // - datalink_control() <--- here - // interface_set_down() invalidate_routes(interface->domain, interface); } void -domain_removed_device_interface(net_device_interface *interface) +domain_removed_device_interface(net_device_interface* deviceInterface) { MutexLocker locker(sDomainLock); - net_domain_private *domain = NULL; + net_domain_private* domain = NULL; while (true) { - domain = (net_domain_private *)list_get_next_item(&sDomains, domain); + domain = (net_domain_private*)list_get_next_item(&sDomains, domain); if (domain == NULL) break; MutexLocker locker(domain->lock); - net_interface_private *priv = find_interface(domain, - interface->device->name); - if (priv == NULL) + net_interface_private* interface = find_interface(domain, + deviceInterface->device->name); + if (interface == NULL) continue; - remove_interface_from_domain(priv); + remove_interface_from_domain(interface); } } status_t -register_domain(int family, const char *name, - struct net_protocol_module_info *module, - struct net_address_module_info *addressModule, - net_domain **_domain) +register_domain(int family, const char* name, + struct net_protocol_module_info* module, + struct net_address_module_info* addressModule, + net_domain** _domain) { TRACE(("register_domain(%d, %s)\n", family, name)); MutexLocker locker(sDomainLock); - struct net_domain_private *domain = lookup_domain(family); + struct net_domain_private* domain = lookup_domain(family); if (domain != NULL) return B_NAME_IN_USE; - domain = new (std::nothrow) net_domain_private; + domain = new(std::nothrow) net_domain_private; if (domain == NULL) return B_NO_MEMORY; - mutex_init_etc(&domain->lock, name, MUTEX_FLAG_CLONE_NAME); + mutex_init(&domain->lock, name); domain->family = family; domain->name = name; @@ -350,18 +339,20 @@ status_t -unregister_domain(net_domain *_domain) +unregister_domain(net_domain* _domain) { - TRACE(("unregister_domain(%p, %d, %s)\n", _domain, _domain->family, _domain->name)); + TRACE(("unregister_domain(%p, %d, %s)\n", _domain, _domain->family, + _domain->name)); - net_domain_private *domain = (net_domain_private *)_domain; + net_domain_private* domain = (net_domain_private*)_domain; MutexLocker locker(sDomainLock); list_remove_item(&sDomains, domain); - net_interface_private *interface = NULL; + net_interface_private* interface = NULL; while (true) { - interface = (net_interface_private *)list_remove_head_item(&domain->interfaces); + interface = (net_interface_private*)list_remove_head_item( + &domain->interfaces); if (interface == NULL) break; Modified: haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp 2009-02-16 11:05:25 UTC (rev 29231) +++ haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp 2009-02-16 11:13:28 UTC (rev 29232) @@ -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: @@ -41,11 +41,11 @@ static status_t -device_consumer_thread(void *_interface) +device_consumer_thread(void* _interface) { - net_device_interface *interface = (net_device_interface *)_interface; - net_device *device = interface->device; - net_buffer *buffer; + net_device_interface* interface = (net_device_interface*)_interface; + net_device* device = interface->device; + net_buffer* buffer; while (true) { ssize_t status = fifo_dequeue_buffer(&interface->receive_queue, 0, @@ -56,19 +56,16 @@ break; if (buffer->interface != NULL) { - // if the interface is already specified this buffer was + // if the interface is already specified, this buffer was // delivered locally. - - net_domain *domain = buffer->interface->domain; - - if (domain->module->receive_data(buffer) == B_OK) + if (buffer->interface->domain->module->receive_data(buffer) == B_OK) buffer = NULL; } else { // find handler for this packet - DeviceHandlerList::Iterator it2 = + DeviceHandlerList::Iterator iterator = interface->receive_funcs.GetIterator(); - while (buffer && it2.HasNext()) { - net_device_handler *handler = it2.Next(); + while (buffer && iterator.HasNext()) { + net_device_handler* handler = iterator.Next(); // if the handler returns B_OK, it consumed the buffer if (handler->type == buffer->type @@ -77,7 +74,7 @@ } } - if (buffer) + if (buffer != NULL) gNetBufferModule.free(buffer); } @@ -85,14 +82,12 @@ } -static net_device_interface * -find_device_interface(const char *name) +static net_device_interface* +find_device_interface(const char* name) { DeviceInterfaceList::Iterator iterator = sInterfaces.GetIterator(); - while (iterator.HasNext()) { - net_device_interface *interface = iterator.Next(); - + while (net_device_interface* interface = iterator.Next()) { if (!strcmp(interface->device->name, name)) return interface; } @@ -101,30 +96,33 @@ } +/*! The domain's device receive handler - this will inject the net_buffers into + the protocol layer (the domain's registered receive handler). +*/ static status_t -domain_receive_adapter(void *cookie, net_device *device, net_buffer *buffer) +domain_receive_adapter(void* cookie, net_device* device, net_buffer* buffer) { - net_domain_private *domain = (net_domain_private *)cookie; + net_domain_private* domain = (net_domain_private*)cookie; buffer->interface = find_interface(domain, device->index); return domain->module->receive_data(buffer); } -static net_device_interface * -allocate_device_interface(net_device *device, net_device_module_info *module) +static net_device_interface* +allocate_device_interface(net_device* device, net_device_module_info* module) { - net_device_interface *interface = new (std::nothrow) net_device_interface; + net_device_interface* interface = new(std::nothrow) net_device_interface; if (interface == NULL) - goto error_0; + return NULL; [... truncated: 784 lines follow ...] From superstippi at gmx.de Mon Feb 16 12:21:16 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Mon, 16 Feb 2009 12:21:16 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <2040477519.1953501234779240390.JavaMail.root@zimbra20-e3.priv.proxad.net> References: <2040477519.1953501234779240390.JavaMail.root@zimbra20-e3.priv.proxad.net> Message-ID: <49994C2C.3060407@gmx.de> philippe.houdoin at free.fr schrieb: >> Thanks for all the feedback so far! It's interesting how individual >> points of critique are felt by multiple people, as with the inactive >> tabs distinction. The higher contrast of the BMenuField popup marker >> was also something Axel mentioned to me before. > > Here mine, many shared by others but, oh well: > > 1) Inactive tabs are not distinctable, but you know that one, don't you ;-) Yes, going to look into that one. > 2) Inactive tabs extending to a full width dark bar doesn't looks that fine, they're not headers but tabs, and if real world metaphor should applied, tabs don't extend full width. Having full width tabs in a OS cloning the "yellow tabs" BeOS sounds like blasphem, but maybe I'm going religious here :-) I intend to keep it this way. I wanted to give the tab view a unique feature and move away somewhat from the real-world look. My emphasis was on both an appealing/unique look and a very good distinction of the active tab. I believe that the look of the active tab helps a lot to transport the function of the control. Adjusting the inactive tabs to be more tab-like seems like it wouldn't improve this any further, only make it less unique. > 3) Disabled unselected BCheck/RadioButtons looks less disabled than previous look, mostly due to the lighter grey color used to fill box/circle. Could be confusing for visual impaired people. Ok, I can tweak that. > 4) Enabled & selected BRadioButton looks to flat to me. I miss the "ball/LED" R5 effect which was a very distinctive BeOS widget from others GUIs. I hope one could still keep this quite unique visual identity while going to a flatter look... Sorry, but I found the ball quite non-stylish and out of place, even during the actual BeOS timeframe. > 5) BMenuField looks too much like a BButton, which can be confusing. But everybody told you so already ;-) I would like to keep it this way, but I was thinking to reduce the contrast of the outermost edged-in frame. To me, the re-use of certain surface looks, like buttons, scrollbars and menufields, help make a consistent look. > 6) Drop shadow of the two kind of BSlider's thumbs are not consistent. I like the rectangular one better, but I can't tell from all widgets what's your choice regarding drop shadows, which could be a sign of inconsistency... or that I'm simply too picky/dumb/old/becoming blind. Yes, the triangle thumb was not done. I forgot about that when I commited. > 7) BSlider bars and active BTab are rounded, when everything else moved from the R5 more rounded look to Haiku's sharper one. This seems inconsistent, and rounding looks dated these days. While I was designing, I continually got the feedback that things were not round enough. I had hoped to integrate some roundness with this, while not making things too inconsistent. I was thinking to also give the progress bar round corners like the slider bar to get more consistency. > 8) BProgressBar, BGroupBox and BMenuBar are splendids! > > I also noticed that some gradients are in fact only composed of two colors. It's very visible on scrollbars, and I'm not sure it's expected. No, that is a gloss effect. These gradients are actually composed of four colors, but I may have used too little contrast. I have noticed that the effect is more visible on my very good monitor, and less visible on my laptop. So I may have to tweak the contrast a bit, however, I don't like strong glossy effects too much. > But, hey, GUI looks are like everything: it take times to get used to it, and then you can't lives without anymore! > Please take no offense with the above remarks, taste are very subjective topic, and everyone think he has good one. No offense taken! Thanks for the feedback! >> The code is really WIP, while I >> felt that the look was already enough of an improvement and complete >> enough to go ahead and commit the patch. (Besides, it was also getting >> a bit of a pain to keep four Haiku trees on two different computers >> all in sync... ;-) > > Isn't what our subversion branches/... root is for? > ;-) Yeah, probably, but I also didn't want too many people to be able to look at something half-finished... ;-) > Anyway, Stephan, like always, your graphic "touch" is well appreciated. I bet Haiku will have less audience without it: people loves screenshots, and your touch is on everyone but the oldests. ;-) Thanks a lot! I have also tried to incorporate some ideas from the existing GUI patches, while I wanted to solve some problems that I felt myself. > Philippe, now daddy of 3. Wow! Congratulations! Best regards, -Stephan From host.haiku at gmx.de Mon Feb 16 12:43:54 2009 From: host.haiku at gmx.de (julun) Date: Mon, 16 Feb 2009 12:43:54 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <49994C2C.3060407@gmx.de> References: <2040477519.1953501234779240390.JavaMail.root@zimbra20-e3.priv.proxad.net> <49994C2C.3060407@gmx.de> Message-ID: <4999517A.6020209@gmx.de> Hi Stephan, great work so far! :) Stephan A?mus wrote: > philippe.houdoin at free.fr schrieb: >>> Thanks for all the feedback so far! It's interesting how individual >>> points of critique are felt by multiple people, as with the inactive >>> tabs distinction. The higher contrast of the BMenuField popup marker >>> was also something Axel mentioned to me before. >> Here mine, many shared by others but, oh well: >> >> 1) Inactive tabs are not distinctable, but you know that one, don't you ;-) > > Yes, going to look into that one. > >> 2) Inactive tabs extending to a full width dark bar doesn't looks that fine, they're not headers but tabs, and if real world metaphor should applied, tabs don't extend full width. Having full width tabs in a OS cloning the "yellow tabs" BeOS sounds like blasphem, but maybe I'm going religious here :-) > > I intend to keep it this way. I wanted to give the tab view a unique > feature and move away somewhat from the real-world look. My emphasis was > on both an appealing/unique look and a very good distinction of the > active tab. I believe that the look of the active tab helps a lot to > transport the function of the control. Adjusting the inactive tabs to be > more tab-like seems like it wouldn't improve this any further, only make > it less unique. Please note the one can use BTab without a BTabView, which then will look wired. See for example some of the Data-Translation settings views. >> 3) Disabled unselected BCheck/RadioButtons looks less disabled than previous look, mostly due to the lighter grey color used to fill box/circle. Could be confusing for visual impaired people. > > Ok, I can tweak that. > >> 4) Enabled & selected BRadioButton looks to flat to me. I miss the "ball/LED" R5 effect which was a very distinctive BeOS widget from others GUIs. I hope one could still keep this quite unique visual identity while going to a flatter look... > > Sorry, but I found the ball quite non-stylish and out of place, even > during the actual BeOS timeframe. I fully agree here :) >> 5) BMenuField looks too much like a BButton, which can be confusing. But everybody told you so already ;-) > > I would like to keep it this way, but I was thinking to reduce the > contrast of the outermost edged-in frame. To me, the re-use of certain > surface looks, like buttons, scrollbars and menufields, help make a > consistent look. I like the new look very much! But please don't forget about the fact that a BMenuField can have the fixed length. As you can see in the Mouse prefs focus follows mouse thing, long text will draw over the menu field arrow area. Also the menu field in Diskprobe is cut off on the right. >> 6) Drop shadow of the two kind of BSlider's thumbs are not consistent. I like the rectangular one better, but I can't tell from all widgets what's your choice regarding drop shadows, which could be a sign of inconsistency... or that I'm simply too picky/dumb/old/becoming blind. > > Yes, the triangle thumb was not done. I forgot about that when I commited. > >> 7) BSlider bars and active BTab are rounded, when everything else moved from the R5 more rounded look to Haiku's sharper one. This seems inconsistent, and rounding looks dated these days. > > While I was designing, I continually got the feedback that things were > not round enough. I had hoped to integrate some roundness with this, > while not making things too inconsistent. I was thinking to also give > the progress bar round corners like the slider bar to get more consistency. I would also vote for less rounded corners, maybe going with 2x2 px edges. >> 8) BProgressBar, BGroupBox and BMenuBar are splendids! >> >> I also noticed that some gradients are in fact only composed of two colors. It's very visible on scrollbars, and I'm not sure it's expected. > > No, that is a gloss effect. These gradients are actually composed of > four colors, but I may have used too little contrast. I have noticed > that the effect is more visible on my very good monitor, and less > visible on my laptop. So I may have to tweak the contrast a bit, > however, I don't like strong glossy effects too much. If you change the e.g, B_PANEL_BACKGROUND_COLOR in appearance pref to something like yellow, the BTabView looks totally broken. Anyway, this was a major step in the right direction! Thanks for the hard work. :) Regards, Karsten From superstippi at gmx.de Mon Feb 16 12:52:40 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Mon, 16 Feb 2009 12:52:40 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <4999517A.6020209@gmx.de> References: <2040477519.1953501234779240390.JavaMail.root@zimbra20-e3.priv.proxad.net> <49994C2C.3060407@gmx.de> <4999517A.6020209@gmx.de> Message-ID: <49995388.5000506@gmx.de> Hi Karsten, julun schrieb: > Please note the one can use BTab without a BTabView, which then will > look wired. See for example some of the Data-Translation settings views. I saw that and it was on my mental TODO list. :-) >>> 5) BMenuField looks too much like a BButton, which can be confusing. But everybody told you so already ;-) >> I would like to keep it this way, but I was thinking to reduce the >> contrast of the outermost edged-in frame. To me, the re-use of certain >> surface looks, like buttons, scrollbars and menufields, help make a >> consistent look. > > I like the new look very much! But please don't forget about the fact > that a BMenuField can have the fixed length. As you can see in the Mouse > prefs focus follows mouse thing, long text will draw over the menu field > arrow area. Also the menu field in Diskprobe is cut off on the right. Yes, thanks for noticing. >>> 7) BSlider bars and active BTab are rounded, when everything else moved from the R5 more rounded look to Haiku's sharper one. This seems inconsistent, and rounding looks dated these days. >> While I was designing, I continually got the feedback that things were >> not round enough. I had hoped to integrate some roundness with this, >> while not making things too inconsistent. I was thinking to also give >> the progress bar round corners like the slider bar to get more consistency. > > I would also vote for less rounded corners, maybe going with 2x2 px edges. The BTabView should be the only control with actual round *corners*, while the sliders use a half circle. I like that very much for it's simplicity. Actual round corners are a visually more complicated shape, and therefore I would like to keep the slider look. I particularly like the slider bar look. Only the triangle thumb is giving me trouble. >>> 8) BProgressBar, BGroupBox and BMenuBar are splendids! >>> >>> I also noticed that some gradients are in fact only composed of two colors. It's very visible on scrollbars, and I'm not sure it's expected. >> No, that is a gloss effect. These gradients are actually composed of >> four colors, but I may have used too little contrast. I have noticed >> that the effect is more visible on my very good monitor, and less >> visible on my laptop. So I may have to tweak the contrast a bit, >> however, I don't like strong glossy effects too much. > > If you change the e.g, B_PANEL_BACKGROUND_COLOR in appearance pref to > something like yellow, the BTabView looks totally broken. I have tested a bit with changing the main panel bg color, but that was before I got around to the BTabView... :-) Anyways, I am not happy with how that works yet. The current implementation uses a lot of tint_color() around a "base" color. But that is flawed, since the current tints are optimized for the 216 gray. What would work better is to determine the maximum shine and shadow color based on the current bg color and then place all other tints between those. I believe that would give better results to make the maximum shine/shadow colors a fixed (scaled) brightness away from the base color, instead of always tinting between black and white extremes. That will involve some refactoring in BControlLook, but it's something I wanted to do yet. Best regards, -Stephan From stippi at mail.berlios.de Mon Feb 16 13:19:06 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 16 Feb 2009 13:19:06 +0100 Subject: [Haiku-commits] r29233 - haiku/trunk/src/apps/midiplayer Message-ID: <200902161219.n1GCJ6uZ032654@sheep.berlios.de> Author: stippi Date: 2009-02-16 13:19:04 +0100 (Mon, 16 Feb 2009) New Revision: 29233 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29233&view=rev Modified: haiku/trunk/src/apps/midiplayer/MidiPlayerWindow.cpp Log: Resolved a couple minor TODOs to use layout friendly constructors, which have become available meanwhile. Modified: haiku/trunk/src/apps/midiplayer/MidiPlayerWindow.cpp =================================================================== --- haiku/trunk/src/apps/midiplayer/MidiPlayerWindow.cpp 2009-02-16 11:13:28 UTC (rev 29232) +++ haiku/trunk/src/apps/midiplayer/MidiPlayerWindow.cpp 2009-02-16 12:19:04 UTC (rev 29233) @@ -236,37 +236,30 @@ // Set up needed views scopeView = new ScopeView; - showScope = new BCheckBox( - BRect(0, 0, 1, 1), "showScope", "Scope", - new BMessage(MSG_SHOW_SCOPE), B_FOLLOW_LEFT); + showScope = new BCheckBox("showScope", "Scope", + new BMessage(MSG_SHOW_SCOPE)); showScope->SetValue(B_CONTROL_ON); CreateInputMenu(); CreateReverbMenu(); - volumeSlider = new BSlider( - BRect(0, 0, 1, 1), "volumeSlider", NULL, NULL, - 0, 100, B_TRIANGLE_THUMB); + volumeSlider = new BSlider("volumeSlider", NULL, NULL, 0, 100, + B_HORIZONTAL); rgb_color col = { 152, 152, 255 }; volumeSlider->UseFillColor(true, &col); volumeSlider->SetModificationMessage(new BMessage(MSG_VOLUME)); - playButton = new BButton( - BRect(0, 1, 80, 1), "playButton", "Play", new BMessage(MSG_PLAY_STOP), - B_FOLLOW_RIGHT); + playButton = new BButton("playButton", "Play", new BMessage(MSG_PLAY_STOP)); playButton->SetEnabled(false); - BBox* divider = new BBox( - BRect(0, 0, 1, 1), B_EMPTY_STRING, B_FOLLOW_ALL_SIDES, - B_WILL_DRAW | B_FRAME_EVENTS, B_FANCY_BORDER); + BBox* divider = new BBox(B_EMPTY_STRING, B_WILL_DRAW | B_FRAME_EVENTS, + B_FANCY_BORDER); divider->SetExplicitMaxSize( BSize(B_SIZE_UNLIMITED, 1)); - BStringView* volumeLabel = new BStringView( - BRect(0, 0, 1, 1), NULL, "Volume:"); + BStringView* volumeLabel = new BStringView(NULL, "Volume:"); volumeLabel->SetAlignment(B_ALIGN_LEFT); - volumeLabel->SetExplicitMaxSize( - BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); + volumeLabel->SetExplicitMaxSize(BSize(B_SIZE_UNLIMITED, B_SIZE_UNSET)); // Build the layout SetLayout(new BGroupLayout(B_HORIZONTAL)); From host.haiku at gmx.de Mon Feb 16 13:36:08 2009 From: host.haiku at gmx.de (julun) Date: Mon, 16 Feb 2009 13:36:08 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <49995388.5000506@gmx.de> References: <2040477519.1953501234779240390.JavaMail.root@zimbra20-e3.priv.proxad.net> <49994C2C.3060407@gmx.de> <4999517A.6020209@gmx.de> <49995388.5000506@gmx.de> Message-ID: <49995DB8.5040803@gmx.de> Hi Stephan, >> I would also vote for less rounded corners, maybe going with 2x2 px edges. > > The BTabView should be the only control with actual round *corners*, > while the sliders use a half circle. I like that very much for it's > simplicity. Actual round corners are a visually more complicated shape, > and therefore I would like to keep the slider look. I particularly like > the slider bar look. Only the triangle thumb is giving me trouble. I'm fine with the BTab/View, i more meant the slider bar. Maybe the edges are to round or the knob is to square. ;) I have no problem with the triangle at all. Oh and i would prefer if we could have the fill color enabled be default, at least for Haiku. >>>> 8) BProgressBar, BGroupBox and BMenuBar are splendids! >>>> >>>> I also noticed that some gradients are in fact only composed of two colors. It's very visible on scrollbars, and I'm not sure it's expected. >>> No, that is a gloss effect. These gradients are actually composed of >>> four colors, but I may have used too little contrast. I have noticed >>> that the effect is more visible on my very good monitor, and less >>> visible on my laptop. So I may have to tweak the contrast a bit, >>> however, I don't like strong glossy effects too much. >> If you change the e.g, B_PANEL_BACKGROUND_COLOR in appearance pref to >> something like yellow, the BTabView looks totally broken. > > I have tested a bit with changing the main panel bg color, but that was > before I got around to the BTabView... :-) Well no problem, i know its work in progress. :) > Anyways, I am not happy with how that works yet. The current > implementation uses a lot of tint_color() around a "base" color. But > that is flawed, since the current tints are optimized for the 216 gray. > What would work better is to determine the maximum shine and shadow > color based on the current bg color and then place all other tints > between those. I believe that would give better results to make the > maximum shine/shadow colors a fixed (scaled) brightness away from the > base color, instead of always tinting between black and white extremes. > That will involve some refactoring in BControlLook, but it's something I > wanted to do yet. Yeah, i wondered anyway why we have to do all this tint stuff. Isn't there everything in place to have a defined set of colors to draw a control? Karsten From alex at zappotek.com Mon Feb 16 13:48:43 2009 From: alex at zappotek.com (Alexandre Deckner) Date: Mon, 16 Feb 2009 13:48:43 +0100 Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <49995DB8.5040803@gmx.de> References: <2040477519.1953501234779240390.JavaMail.root@zimbra20-e3.priv.proxad.net> <49994C2C.3060407@gmx.de> <4999517A.6020209@gmx.de> <49995388.5000506@gmx.de> <49995DB8.5040803@gmx.de> Message-ID: <499960AB.6090906@zappotek.com> julun wrote: > Hi Stephan, > > > > > >>> I would also vote for less rounded corners, maybe going with 2x2 px edges. >>> >> The BTabView should be the only control with actual round *corners*, >> while the sliders use a half circle. I like that very much for it's >> simplicity. Actual round corners are a visually more complicated shape, >> and therefore I would like to keep the slider look. I particularly like >> the slider bar look. Only the triangle thumb is giving me trouble. >> > > I'm fine with the BTab/View, i more meant the slider bar. Maybe the > edges are to round or the knob is to square. ;) I have no problem with > the triangle at all. Oh and i would prefer if we could have the fill > color enabled be default, at least for Haiku. > > Just to balance a bit, i for one really like the new sliders :) I agree the triangle might need some tweaking maybe. I also wanted to comment on the new radio buttons and check boxes, i find them a _lot_ better than before. Best regards, Alex From stippi at mail.berlios.de Mon Feb 16 14:05:33 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 16 Feb 2009 14:05:33 +0100 Subject: [Haiku-commits] r29234 - haiku/trunk/src/kits/interface Message-ID: <200902161305.n1GD5XYc007035@sheep.berlios.de> Author: stippi Date: 2009-02-16 14:05:31 +0100 (Mon, 16 Feb 2009) New Revision: 29234 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29234&view=rev Modified: haiku/trunk/src/kits/interface/ControlLook.cpp Log: * Give the inactive tabs a slight separation. * Removed some dead WIP code. Modified: haiku/trunk/src/kits/interface/ControlLook.cpp =================================================================== --- haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-16 12:19:04 UTC (rev 29233) +++ haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-16 13:05:31 UTC (rev 29234) @@ -1216,40 +1216,6 @@ } -#if 0 -static void -_MakeTabShape(BShape& shape, const BRect& rect, float cornerRadius, - float slopeRadius) -{ - BPoint curve[3]; - - shape.Clear(); - shape.MoveTo(BPoint(rect.left, rect.bottom)); - shape.LineTo(BPoint(rect.left, rect.top + cornerRadius)); - - curve[0].x = rect.left; - curve[0].y = rect.top + 0.56 * cornerRadius; - curve[1].x = rect.left + 0.56 * cornerRadius; - curve[1].y = rect.top; - curve[2].x = rect.left + cornerRadius; - curve[2].y = rect.top; - - shape.BezierTo(curve); - - shape.LineTo(BPoint(rect.right - slopeRadius, rect.top)); - - curve[0].x = rect.right - slopeRadius / 5; - curve[0].y = rect.top; - curve[1].x = rect.right; - curve[1].y = rect.bottom - slopeRadius / 5; - curve[2].x = rect.right; - curve[2].y = rect.bottom; - - shape.BezierTo(curve); -} -#endif - - void BControlLook::DrawActiveTab(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, uint32 borders) @@ -1286,7 +1252,7 @@ fillGradient.AddColor(tint_color(base, 0.75), 0); fillGradient.AddColor(tint_color(base, 1.03), 255); } -#if 1 + static const float kRoundCornerRadius = 4; // left/top corner @@ -1316,7 +1282,6 @@ _DrawFrame(view, rect, edgeShadowColor, edgeShadowColor, edgeLightColor, edgeLightColor, borders & (B_LEFT_BORDER | B_TOP_BORDER | B_RIGHT_BORDER)); -// B_LEFT_BORDER | B_TOP_BORDER | B_RIGHT_BORDER); if ((borders & B_LEFT_BORDER) == 0) rect.left++; if ((borders & B_RIGHT_BORDER) == 0) @@ -1331,42 +1296,6 @@ view->FillRect(rect, fillGradient); view->ConstrainClippingRegion(NULL); -#else - - view->MovePenTo(B_ORIGIN); - - uint32 viewFlags = view->Flags(); - view->SetFlags(viewFlags | B_SUBPIXEL_PRECISE); - - rect.InsetBy(0.5, 0.5); - - float cornerRadius = 4; - float slopeRadius = 20; - BShape shape; - - _MakeTabShape(shape, rect, cornerRadius, slopeRadius); - view->SetHighColor(edgeShadowColor); - view->StrokeShape(&shape); - - rect.left += 1; - rect.top += 1; - rect.right -= 1; - cornerRadius -= 1; - - _MakeTabShape(shape, rect, cornerRadius, slopeRadius); - view->SetHighColor(frameLightColor); - view->StrokeShape(&shape); - - rect.left += 0.5; - rect.top += 0.5; - rect.right -= 0.5; - cornerRadius -= 1; - - _MakeTabShape(shape, rect, cornerRadius, slopeRadius); - view->FillShape(&shape, fillGradient); - - view->SetFlags(viewFlags); -#endif } @@ -1401,7 +1330,7 @@ edgeLightColor = tint_color(base, 0.80); frameShadowColor = tint_color(base, 1.30); frameLightColor = tint_color(base, 1.30); - bevelShadowColor = tint_color(base, 1.15); + bevelShadowColor = tint_color(base, 1.17); bevelLightColor = tint_color(base, 1.10); fillGradient.AddColor(tint_color(base, 1.12), 0); fillGradient.AddColor(tint_color(base, 1.08), 255); @@ -1419,13 +1348,10 @@ _DrawFrame(view, rect, frameLightColor, frameLightColor, frameShadowColor, frameShadowColor, - //B_LEFT_BORDER | B_TOP_BORDER | B_RIGHT_BORDER); borders & (B_LEFT_BORDER | B_TOP_BORDER | B_RIGHT_BORDER)); - _DrawFrame(view, rect, bevelLightColor, bevelLightColor, bevelShadowColor, - bevelShadowColor, - //B_BOTTOM_BORDER); - 0); + _DrawFrame(view, rect, bevelShadowColor, bevelShadowColor, bevelLightColor, + bevelLightColor, B_LEFT_BORDER & ~borders); view->FillRect(rect, fillGradient); } From stippi at mail.berlios.de Mon Feb 16 14:57:34 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 16 Feb 2009 14:57:34 +0100 Subject: [Haiku-commits] r29235 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200902161357.n1GDvYGt011001@sheep.berlios.de> Author: stippi Date: 2009-02-16 14:57:31 +0100 (Mon, 16 Feb 2009) New Revision: 29235 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29235&view=rev Modified: haiku/trunk/headers/os/interface/ControlLook.h haiku/trunk/src/kits/interface/ControlLook.cpp haiku/trunk/src/kits/interface/MenuField.cpp Log: * Stronger BMenuField popup indicator. * Softer recessed frame for BMenuField to distinguish more from BButton and make it slightly more similar to BTextControl. Modified: haiku/trunk/headers/os/interface/ControlLook.h =================================================================== --- haiku/trunk/headers/os/interface/ControlLook.h 2009-02-16 13:05:31 UTC (rev 29234) +++ haiku/trunk/headers/os/interface/ControlLook.h 2009-02-16 13:57:31 UTC (rev 29235) @@ -61,7 +61,7 @@ virtual float DefaultLabelSpacing() const; uint32 Flags(BControl* control) const; - virtual void DrawButtonFrame(BView* view, BRect& rect, + virtual void DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, @@ -80,6 +80,12 @@ const rgb_color& base, uint32 borders = B_ALL_BORDERS); + virtual void DrawMenuFieldFrame(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + virtual void DrawMenuFieldBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, bool popupIndicator, @@ -203,6 +209,13 @@ const BAlignment& alignment); protected: + void _DrawButtonFrame(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + float contrast, float brightness = 1.0, + uint32 flags = 0, + uint32 borders = B_ALL_BORDERS); + void _DrawOuterResessedFrame(BView* view, BRect& rect, const rgb_color& base, float contrast = 1.0f, Modified: haiku/trunk/src/kits/interface/ControlLook.cpp =================================================================== --- haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-16 13:05:31 UTC (rev 29234) +++ haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-16 13:57:31 UTC (rev 29235) @@ -68,68 +68,7 @@ BControlLook::DrawButtonFrame(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, uint32 borders) { - // colors - rgb_color dark1BorderColor; - rgb_color dark2BorderColor; - - if ((flags & B_DISABLED) == 0) { - dark1BorderColor = tint_color(base, 1.33); - dark2BorderColor = tint_color(base, 1.45); - - if (flags & B_DEFAULT_BUTTON) { - dark2BorderColor = tint_color(dark1BorderColor, 1.5); - dark1BorderColor = tint_color(dark1BorderColor, 1.35); - } - } else { - dark1BorderColor = tint_color(base, 1.147); - dark2BorderColor = tint_color(base, 1.24); - - if (flags & B_DEFAULT_BUTTON) { - dark1BorderColor = tint_color(dark1BorderColor, 1.12); - dark2BorderColor = tint_color(dark1BorderColor, 1.16); - } - } - - if (flags & B_ACTIVATED) { - rgb_color temp = dark2BorderColor; - dark2BorderColor = dark1BorderColor; - dark1BorderColor = temp; - } - - // indicate focus by changing main button border - if (flags & B_FOCUSED) { - dark1BorderColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); - dark2BorderColor = dark1BorderColor; - } - - if (flags & B_DEFAULT_BUTTON) { - float focusTint = 1.2; - if (flags & B_DISABLED) - focusTint = (B_NO_TINT + focusTint) / 2; - - rgb_color focusColor = tint_color(base, focusTint); - view->SetHighColor(base); - - view->StrokeRect(rect); - rect.InsetBy(1.0, 1.0); - - view->SetHighColor(focusColor); - view->StrokeRect(rect); - rect.InsetBy(1.0, 1.0); - view->StrokeRect(rect); - rect.InsetBy(1.0, 1.0); - - // bevel around external border - _DrawOuterResessedFrame(view, rect, focusColor, - (flags & B_DISABLED) ? 0.5 : 0.8, 0.9, borders); - } else { - // bevel around external border - _DrawOuterResessedFrame(view, rect, base, - (flags & B_DISABLED) ? 0.0 : 1.0, 1.0, borders); - } - - _DrawFrame(view, rect, dark1BorderColor, dark1BorderColor, - dark2BorderColor, dark2BorderColor, borders); + _DrawButtonFrame(view, rect, updateRect, base, 1.0, 1.0, flags, borders); } @@ -264,6 +203,14 @@ void +BControlLook::DrawMenuFieldFrame(BView* view, BRect& rect, const BRect& updateRect, + const rgb_color& base, uint32 flags, uint32 borders) +{ + _DrawButtonFrame(view, rect, updateRect, base, 0.6, 1.0, flags, borders); +} + + +void BControlLook::DrawMenuFieldBackground(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, bool popupIndicator, uint32 flags) @@ -282,10 +229,10 @@ rgb_color markColor; if (flags & B_DISABLED) { indicatorBase = tint_color(base, 1.05); - markColor = tint_color(base, B_DARKEN_3_TINT); + markColor = tint_color(base, 1.35); } else { - indicatorBase = tint_color(base, 1.09); - markColor = tint_color(base, B_DARKEN_4_TINT); + indicatorBase = tint_color(base, 1.12); + markColor = tint_color(base, 1.65); } DrawMenuFieldBackground(view, rightRect, updateRect, indicatorBase, @@ -1548,6 +1495,78 @@ void +BControlLook::_DrawButtonFrame(BView* view, BRect& rect, + const BRect& updateRect, const rgb_color& base, + float contrast, float brightness, uint32 flags, uint32 borders) +{ + // colors + rgb_color dark1BorderColor; + rgb_color dark2BorderColor; + + if ((flags & B_DISABLED) == 0) { + dark1BorderColor = tint_color(base, 1.33); + dark2BorderColor = tint_color(base, 1.45); + + if (flags & B_DEFAULT_BUTTON) { + dark2BorderColor = tint_color(dark1BorderColor, 1.5); + dark1BorderColor = tint_color(dark1BorderColor, 1.35); + } + } else { + dark1BorderColor = tint_color(base, 1.147); + dark2BorderColor = tint_color(base, 1.24); + + if (flags & B_DEFAULT_BUTTON) { + dark1BorderColor = tint_color(dark1BorderColor, 1.12); + dark2BorderColor = tint_color(dark1BorderColor, 1.16); + } + } + + if (flags & B_ACTIVATED) { + rgb_color temp = dark2BorderColor; + dark2BorderColor = dark1BorderColor; + dark1BorderColor = temp; + } + + // indicate focus by changing main button border + if (flags & B_FOCUSED) { + dark1BorderColor = ui_color(B_KEYBOARD_NAVIGATION_COLOR); + dark2BorderColor = dark1BorderColor; + } + + if (flags & B_DEFAULT_BUTTON) { + float focusTint = 1.2; + if (flags & B_DISABLED) + focusTint = (B_NO_TINT + focusTint) / 2; + + rgb_color focusColor = tint_color(base, focusTint); + view->SetHighColor(base); + + view->StrokeRect(rect); + rect.InsetBy(1.0, 1.0); + + view->SetHighColor(focusColor); + view->StrokeRect(rect); + rect.InsetBy(1.0, 1.0); + view->StrokeRect(rect); + rect.InsetBy(1.0, 1.0); + + // bevel around external border + _DrawOuterResessedFrame(view, rect, focusColor, + contrast * (((flags & B_DISABLED) ? 0.5 : 0.8)), brightness * 0.9, + borders); + } else { + // bevel around external border + _DrawOuterResessedFrame(view, rect, base, + contrast * ((flags & B_DISABLED) ? 0.0 : 1.0), brightness * 1.0, + borders); + } + + _DrawFrame(view, rect, dark1BorderColor, dark1BorderColor, + dark2BorderColor, dark2BorderColor, borders); +} + + +void BControlLook::_DrawOuterResessedFrame(BView* view, BRect& rect, const rgb_color& base, float contrast, float brightness, uint32 borders) { Modified: haiku/trunk/src/kits/interface/MenuField.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuField.cpp 2009-02-16 13:05:31 UTC (rev 29234) +++ haiku/trunk/src/kits/interface/MenuField.cpp 2009-02-16 13:57:31 UTC (rev 29235) @@ -275,7 +275,7 @@ flags |= BControlLook::B_DISABLED; if (active) flags |= BControlLook::B_FOCUSED; - be_control_look->DrawButtonFrame(this, frame, update, base, flags); + be_control_look->DrawMenuFieldFrame(this, frame, update, base, flags); return; } From revol at free.fr Mon Feb 16 17:35:42 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Mon, 16 Feb 2009 17:35:42 +0100 CET Subject: [Haiku-commits] r29221 - in haiku/trunk: headers/os/interface src/apps/launchbox src/kits/interface src/kits/tracker In-Reply-To: <49995388.5000506@gmx.de> Message-ID: <1537712543-BeMail@laptop> > I have tested a bit with changing the main panel bg color, but that > was > before I got around to the BTabView... :-) Feel free to use Themes :p > Anyways, I am not happy with how that works yet. The current > implementation uses a lot of tint_color() around a "base" color. But > that is flawed, since the current tints are optimized for the 216 > gray. > What would work better is to determine the maximum shine and shadow > color based on the current bg color and then place all other tints > between those. I believe that would give better results to make the > maximum shine/shadow colors a fixed (scaled) brightness away from the IIRC ZETA (well, Dano0) uses shine and shadow colors in tints, it's visible when you set them to red or some other one. Fran?ois. From mmlr at mail.berlios.de Mon Feb 16 17:44:53 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 16 Feb 2009 17:44:53 +0100 Subject: [Haiku-commits] r29236 - haiku/trunk/src/servers/net Message-ID: <200902161644.n1GGirLG031157@sheep.berlios.de> Author: mmlr Date: 2009-02-16 17:44:51 +0100 (Mon, 16 Feb 2009) New Revision: 29236 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29236&view=rev Modified: haiku/trunk/src/servers/net/AutoconfigLooper.cpp Log: Fix the build. Modified: haiku/trunk/src/servers/net/AutoconfigLooper.cpp =================================================================== --- haiku/trunk/src/servers/net/AutoconfigLooper.cpp 2009-02-16 13:57:31 UTC (rev 29235) +++ haiku/trunk/src/servers/net/AutoconfigLooper.cpp 2009-02-16 16:44:51 UTC (rev 29236) @@ -69,7 +69,7 @@ if (ioctl(socket, SIOCGIFFLAGS, &request, sizeof(struct ifreq)) == 0) { request.ifr_flags |= IFF_CONFIGURING; - ioctl(socket, SIOCSIFFLAGS, &request, sizeof(struct ifreq))); + ioctl(socket, SIOCSIFFLAGS, &request, sizeof(struct ifreq)); } // remove current handler From axeld at pinc-software.de Mon Feb 16 17:54:21 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 16 Feb 2009 17:54:21 +0100 CET Subject: [Haiku-commits] r29214 - in haiku/trunk: headers/os/interface src/apps/gradients src/apps/icon-o-matic/gui src/apps/icon-o-matic/import_export/flat_icon src/apps/icon-o-matic/import_export/svg src/kits/app src/kits/interface src/libs/icon/style src/servers/app src/servers/app/drawing src/servers/app/drawing/Painter In-Reply-To: <20090215165509.673.2@bepc.1234711087.fake> Message-ID: <34660281485-BeMail@zon> Stephan Assmus wrote: > Axel D?rfler wrote: > > Enumerations and dumb classes (like rgb_color) are usually in lower > > case > > throughout our current API. > > Of course we could change this, but until we do so, I wouldn't make > > those > > changes. > I know, but this is an internal type, although public to the outside. > The > Be API never did make use of these sub-types AFAIR. So this being a > new > class/API, I thought I'd go ahead and stop this ugliness. I don't > know why > there needs to be a distinction between structs and classes in the > naming > conventions and I have been annoyed more than once by stuff like > "enum > orientation orientation" or "orientation o". I hope we will change > this > when cleaning the API at some point. I know this day is not today, > but > might as well start doing it for new API, no? Fine by me, I just wanted to mention it for the sake of consistency :-) Bye, Axel. From axeld at pinc-software.de Mon Feb 16 20:00:09 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 16 Feb 2009 20:00:09 +0100 CET Subject: [Haiku-commits] r29236 - haiku/trunk/src/servers/net In-Reply-To: <200902161644.n1GGirLG031157@sheep.berlios.de> Message-ID: <42208261353-BeMail@zon> mmlr at mail.berlios.de wrote: > Log: > Fix the build. Thanks; I removed some debug output, and didn't notice the extra parenthesis, sorry. Bye, Axel. From korli at mail.berlios.de Mon Feb 16 20:09:34 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 16 Feb 2009 20:09:34 +0100 Subject: [Haiku-commits] r29237 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200902161909.n1GJ9YXA031400@sheep.berlios.de> Author: korli Date: 2009-02-16 20:09:34 +0100 (Mon, 16 Feb 2009) New Revision: 29237 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29237&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp Log: * fix get_mix() * style improvements Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2009-02-16 16:44:51 UTC (rev 29236) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2009-02-16 19:09:34 UTC (rev 29237) @@ -461,16 +461,13 @@ static status_t list_mix_controls(hda_audio_group* audioGroup, multi_mix_control_info* MMCI) { - multi_mix_control *MMC; - uint32 i; - - MMC = MMCI->controls; + multi_mix_control *MMC = MMCI->controls; if (MMCI->control_count < 24) return B_ERROR; if (hda_create_controls_list(audioGroup->multi) < B_OK) return B_ERROR; - for (i=0; imulti->control_count; i++) { + for (uint32 i = 0; imulti->control_count; i++) { MMC[i] = audioGroup->multi->controls[i].mix_control; } @@ -516,10 +513,9 @@ static status_t get_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI) { - int32 i; uint32 id; hda_multi_mixer_control *control = NULL; - for (i=0; i < MMVI->item_count; i++) { + for (int32 i = 0; i < MMVI->item_count; i++) { id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= audioGroup->multi->control_count) { dprintf("hda: get_mix : invalid control id requested : %li\n", id); @@ -539,7 +535,7 @@ value = resp[0] & AMP_GAIN_MASK; else value = resp[1] & AMP_GAIN_MASK; - MMVI->values[i].gain = (value - AMP_CAP_OFFSET(control->capabilities)) + MMVI->values[i].gain = (0.0 + value - AMP_CAP_OFFSET(control->capabilities)) * AMP_CAP_STEP_SIZE(control->capabilities); TRACE("get_mix: %ld gain: %f (%ld)\n", control->nid, MMVI->values[i].gain, value); } @@ -560,10 +556,9 @@ static status_t set_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI) { - int32 i; uint32 id; hda_multi_mixer_control *control = NULL; - for (i=0; i < MMVI->item_count; i++) { + for (int32 i = 0; i < MMVI->item_count; i++) { id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= audioGroup->multi->control_count) { dprintf("set_mix : invalid control id requested : %li\n", id); @@ -619,7 +614,7 @@ if (control->mix_control.master == MULTI_CONTROL_MASTERID) control->gain = (uint32)(MMVI->values[i].gain / AMP_CAP_STEP_SIZE(control->capabilities) - + AMP_CAP_OFFSET(control->capabilities)); + + AMP_CAP_OFFSET(control->capabilities)); if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID) control2->gain = (uint32)(MMVI->values[i+1].gain / AMP_CAP_STEP_SIZE(control2->capabilities) @@ -663,7 +658,7 @@ hda_send_verbs(audioGroup->codec, verb, NULL, control2 ? 2 : 1); if (control2) - i++; + i++; } /*if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { From axeld at pinc-software.de Mon Feb 16 23:09:44 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 16 Feb 2009 23:09:44 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29237_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/drivers/audio/hda?= In-Reply-To: <200902161909.n1GJ9YXA031400@sheep.berlios.de> Message-ID: <53583363399-BeMail@zon> korli at BerliOS wrote: > + multi_mix_control *MMC = MMCI->controls; How about lower case variable names? :-) Bye, Axel. From dlmcpaul at gmail.com Mon Feb 16 23:58:40 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Tue, 17 Feb 2009 09:58:40 +1100 Subject: [Haiku-commits] r29237 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda In-Reply-To: <53583363399-BeMail@zon> References: <200902161909.n1GJ9YXA031400@sheep.berlios.de> <53583363399-BeMail@zon> Message-ID: On 2009-02-17, Axel D?rfler wrote: > korli at BerliOS wrote: > > + multi_mix_control *MMC = MMCI->controls; > > How about lower case variable names? :-) WAHHH!!! Leave Korli Alone! He is fixing all my HDA issues :-) Go Korli Go. -- Cheers David From korli at mail.berlios.de Tue Feb 17 00:05:57 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 17 Feb 2009 00:05:57 +0100 Subject: [Haiku-commits] r29238 - in haiku/trunk/src/add-ons/kernel/drivers/audio: ac97/auich ac97/auvia ac97/geode echo emuxki hda Message-ID: <200902162305.n1GN5vub029252@sheep.berlios.de> Author: korli Date: 2009-02-17 00:05:54 +0100 (Tue, 17 Feb 2009) New Revision: 29238 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29238&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/io.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_multi.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp Log: * some style improvements again (ie lower case variables as pointed by Axel) Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c 2009-02-16 23:05:54 UTC (rev 29238) @@ -210,7 +210,7 @@ page = stream->dmaops_log_base; - for (i=0; i < AUICH_DMALIST_MAX; i++) { + for (i = 0; i < AUICH_DMALIST_MAX; i++) { page[2*i] = ((uint32)stream->buffer->phy_base) + (i % stream->bufcount) * stream->blksize; page[2*i + 1] = AUICH_DMAF_IOC | (stream->blksize Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/multi.c 2009-02-16 23:05:54 UTC (rev 29238) @@ -206,7 +206,7 @@ count = source_info_size; //Note that we ignore first item in source_info //It's for recording, but do match this with ac97.c's source_info - for (i=1; i < count ; i++) { + for (i = 1; i < count ; i++) { info = &source_info[i]; PRINT(("name : %s\n", info->name)); @@ -387,12 +387,12 @@ static status_t -auich_get_mix(auich_dev *card, multi_mix_value_info * MMVI) +auich_get_mix(auich_dev *card, multi_mix_value_info * mmvi) { int32 i, id; multi_mixer_control *control = NULL; - for (i=0; iitem_count; i++) { - id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; + for (i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("auich_get_mix : invalid control id requested : %li\n", id)); continue; @@ -404,22 +404,22 @@ float values[2]; control->get(card, control->cookie, control->type, values); if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) - MMVI->values[i].u.gain = values[0]; + mmvi->values[i].u.gain = values[0]; else - MMVI->values[i].u.gain = values[1]; + mmvi->values[i].u.gain = values[1]; } } if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); - MMVI->values[i].u.enable = (values[0] == 1.0); + mmvi->values[i].u.enable = (values[0] == 1.0); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); - MMVI->values[i].u.mux = (int32)values[0]; + mmvi->values[i].u.mux = (int32)values[0]; } } return B_OK; @@ -427,12 +427,12 @@ static status_t -auich_set_mix(auich_dev *card, multi_mix_value_info * MMVI) +auich_set_mix(auich_dev *card, multi_mix_value_info * mmvi) { int32 i, id; multi_mixer_control *control = NULL; - for (i=0; iitem_count; i++) { - id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; + for (i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("auich_set_mix : invalid control id requested : %li\n", id)); continue; @@ -441,8 +441,8 @@ if (control->mix_control.flags & B_MULTI_MIX_GAIN) { multi_mixer_control *control2 = NULL; - if (i+1item_count) { - id = MMVI->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; + if (i+1item_count) { + id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("auich_set_mix : invalid control id requested : %li\n", id)); } else { @@ -458,12 +458,12 @@ values[1] = 0.0; if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) - values[0] = MMVI->values[i].u.gain; + values[0] = mmvi->values[i].u.gain; else - values[1] = MMVI->values[i].u.gain; + values[1] = mmvi->values[i].u.gain; if (control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID) - values[1] = MMVI->values[i+1].u.gain; + values[1] = mmvi->values[i+1].u.gain; control->set(card, control->cookie, control->type, values); } @@ -475,14 +475,14 @@ if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { float values[1]; - values[0] = MMVI->values[i].u.enable ? 1.0 : 0.0; + values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0; control->set(card, control->cookie, control->type, values); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { float values[1]; - values[0] = (float)MMVI->values[i].u.mux; + values[0] = (float)mmvi->values[i].u.mux; control->set(card, control->cookie, control->type, values); } } @@ -491,22 +491,22 @@ static status_t -auich_list_mix_controls(auich_dev *card, multi_mix_control_info * MMCI) +auich_list_mix_controls(auich_dev *card, multi_mix_control_info * mmci) { - multi_mix_control *MMC; + multi_mix_control *mmc; int32 i; - MMC = MMCI->controls; - if (MMCI->control_count < 24) + mmc = mmci->controls; + if (mmci->control_count < 24) return B_ERROR; if (auich_create_controls_list(&card->multi) < B_OK) return B_ERROR; - for (i=0; imulti.control_count; i++) { - MMC[i] = card->multi.controls[i].mix_control; + for (i = 0; i < card->multi.control_count; i++) { + mmc[i] = card->multi.controls[i].mix_control; } - MMCI->control_count = card->multi.control_count; + mmci->control_count = card->multi.control_count; return B_OK; } @@ -586,7 +586,7 @@ else designations = B_CHANNEL_SURROUND_BUS; - for (i=0; ichannels; i++) { + for (i = 0; i < stream->channels; i++) { chans[index].channel_id = index; chans[index].kind = (mode == AUICH_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : B_MULTI_INPUT_CHANNEL; chans[index].designations = designations | chan_designations[i]; @@ -794,7 +794,7 @@ if (bufcount > data->request_playback_buffers) bufcount = data->request_playback_buffers; - for (i=0; ipstream, j, i, &data->playback_buffers[i][j].base, @@ -808,7 +808,7 @@ if (bufcount > data->request_record_buffers) bufcount = data->request_record_buffers; - for (i=0; irstream, j, i, &data->record_buffers[i][j].base, Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c 2009-02-16 23:05:54 UTC (rev 29238) @@ -162,7 +162,7 @@ page = stream->dmaops_log_base; - for(i=0; ibufcount; i++) { + for(i = 0; i < stream->bufcount; i++) { page[2*i] = ((uint32)stream->buffer->phy_base) + i * stream->blksize; page[2*i + 1] = AUVIA_DMAOP_FLAG | stream->blksize; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/io.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/io.c 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/io.c 2009-02-16 23:05:54 UTC (rev 29238) @@ -83,7 +83,7 @@ int i; /* poll until codec not busy */ - for(i=0; (iread_io_32(config->nabmbar + for(i = 0; (i < AUVIA_TIMEOUT) && (pci->read_io_32(config->nabmbar + AUVIA_CODEC_CTL) & AUVIA_CODEC_BUSY) ; i++) spin(1); if(i>=AUVIA_TIMEOUT) { @@ -99,7 +99,7 @@ int i; /* poll until codec valid */ - for(i=0; (iread_io_32(config->nabmbar + for(i = 0; (i < AUVIA_TIMEOUT) && !(pci->read_io_32(config->nabmbar + AUVIA_CODEC_CTL) & AUVIA_CODEC_PRIVALID) ; i++) spin(1); if(i>=AUVIA_TIMEOUT) { Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/multi.c 2009-02-16 23:05:54 UTC (rev 29238) @@ -309,7 +309,7 @@ count = source_info_size; count--; - for(i=1; i < count ; i++) { + for(i = 1; i < count ; i++) { info = &source_info[i]; PRINT(("name : %s\n", info->name)); @@ -386,12 +386,12 @@ } static status_t -auvia_get_mix(auvia_dev *card, multi_mix_value_info * MMVI) +auvia_get_mix(auvia_dev *card, multi_mix_value_info * mmvi) { int32 i, id; multi_mixer_control *control = NULL; - for(i=0; iitem_count; i++) { - id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; + for(i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID; if(id < 0 || id >= card->multi.control_count) { PRINT(("auvia_get_mix : invalid control id requested : %li\n", id)); continue; @@ -403,34 +403,34 @@ float values[2]; control->get(card, control->cookie, control->type, values); if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) - MMVI->values[i].u.gain = values[0]; + mmvi->values[i].u.gain = values[0]; else - MMVI->values[i].u.gain = values[1]; + mmvi->values[i].u.gain = values[1]; } } if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); - MMVI->values[i].u.enable = (values[0] == 1.0); + mmvi->values[i].u.enable = (values[0] == 1.0); } if(control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); - MMVI->values[i].u.mux = (int32)values[0]; + mmvi->values[i].u.mux = (int32)values[0]; } } return B_OK; } static status_t -auvia_set_mix(auvia_dev *card, multi_mix_value_info * MMVI) +auvia_set_mix(auvia_dev *card, multi_mix_value_info * mmvi) { int32 i, id; multi_mixer_control *control = NULL; - for(i=0; iitem_count; i++) { - id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; + for(i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID; if(id < 0 || id >= card->multi.control_count) { PRINT(("auvia_set_mix : invalid control id requested : %li\n", id)); continue; @@ -439,8 +439,8 @@ if(control->mix_control.flags & B_MULTI_MIX_GAIN) { multi_mixer_control *control2 = NULL; - if(i+1item_count) { - id = MMVI->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; + if(i+1item_count) { + id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; if(id < 0 || id >= card->multi.control_count) { PRINT(("auvia_set_mix : invalid control id requested : %li\n", id)); } else { @@ -456,12 +456,12 @@ values[1] = 0.0; if(control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) - values[0] = MMVI->values[i].u.gain; + values[0] = mmvi->values[i].u.gain; else - values[1] = MMVI->values[i].u.gain; + values[1] = mmvi->values[i].u.gain; if(control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID) - values[1] = MMVI->values[i+1].u.gain; + values[1] = mmvi->values[i+1].u.gain; control->set(card, control->cookie, control->type, values); } @@ -473,14 +473,14 @@ if(control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { float values[1]; - values[0] = MMVI->values[i].u.enable ? 1.0 : 0.0; + values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0; control->set(card, control->cookie, control->type, values); } if(control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { float values[1]; - values[0] = (float)MMVI->values[i].u.mux; + values[0] = (float)mmvi->values[i].u.mux; control->set(card, control->cookie, control->type, values); } } @@ -488,22 +488,22 @@ } static status_t -auvia_list_mix_controls(auvia_dev *card, multi_mix_control_info * MMCI) +auvia_list_mix_controls(auvia_dev *card, multi_mix_control_info * mmci) { - multi_mix_control *MMC; + multi_mix_control *mmc; int32 i; - MMC = MMCI->controls; - if(MMCI->control_count < 24) + mmc = mmci->controls; + if(mmci->control_count < 24) return B_ERROR; if(auvia_create_controls_list(&card->multi) < B_OK) return B_ERROR; - for(i=0; imulti.control_count; i++) { - MMC[i] = card->multi.controls[i].mix_control; + for(i = 0; i < card->multi.control_count; i++) { + mmc[i] = card->multi.controls[i].mix_control; } - MMCI->control_count = card->multi.control_count; + mmci->control_count = card->multi.control_count; return B_OK; } @@ -581,7 +581,7 @@ else designations = B_CHANNEL_SURROUND_BUS; - for(i=0; ichannels; i++) { + for(i = 0; i < stream->channels; i++) { chans[index].channel_id = index; chans[index].kind = (mode == AUVIA_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : B_MULTI_INPUT_CHANNEL; chans[index].designations = designations | chan_designations[i]; @@ -794,7 +794,7 @@ data->return_playback_channels = pchannels; /* playback_buffers[][c] */ data->return_playback_buffer_size = BUFFER_FRAMES; /* frames */ - for(i=0; ipstream, j, i, &data->playback_buffers[i][j].base, @@ -804,7 +804,7 @@ data->return_record_channels = rchannels; data->return_record_buffer_size = BUFFER_FRAMES; /* frames */ - for(i=0; irstream, j, i, &data->record_buffers[i][j].base, Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_multi.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_multi.cpp 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/geode/geode_multi.cpp 2009-02-16 23:05:54 UTC (rev 29238) @@ -344,7 +344,7 @@ count = source_info_size; //Note that we ignore first item in source_info //It's for recording, but do match this with ac97.c's source_info - for (i=1; i < count ; i++) { + for (i = 1; i < count ; i++) { info = &source_info[i]; TRACE("name : %s\n", info->name); @@ -525,19 +525,19 @@ static status_t -list_mix_controls(geode_controller* controller, multi_mix_control_info* MMCI) +list_mix_controls(geode_controller* controller, multi_mix_control_info* mmci) { - multi_mix_control* MMC = MMCI->controls; - if (MMCI->control_count < 24) + multi_mix_control* mmc = mmci->controls; + if (mmci->control_count < 24) return B_ERROR; if (create_controls_list(controller->multi) < B_OK) return B_ERROR; for (uint32 i = 0; i < controller->multi->control_count; i++) { - MMC[i] = controller->multi->controls[i].mix_control; + mmc[i] = controller->multi->controls[i].mix_control; } - MMCI->control_count = controller->multi->control_count; + mmci->control_count = controller->multi->control_count; return B_OK; } @@ -559,10 +559,10 @@ static status_t -get_mix(geode_controller *controller, multi_mix_value_info * MMVI) +get_mix(geode_controller *controller, multi_mix_value_info * mmvi) { - for (int32 i = 0; i < MMVI->item_count; i++) { - uint32 id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; + for (int32 i = 0; i < mmvi->item_count; i++) { + uint32 id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= controller->multi->control_count) { dprintf("geode_get_mix : invalid control id requested : %li\n", id); continue; @@ -574,22 +574,22 @@ float values[2]; control->get(controller, control->cookie, control->type, values); if (control->mix_control.master == MULTI_CONTROL_MASTERID) - MMVI->values[i].gain = values[0]; + mmvi->values[i].gain = values[0]; else - MMVI->values[i].gain = values[1]; + mmvi->values[i].gain = values[1]; } } if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { float values[1]; control->get(controller, control->cookie, control->type, values); - MMVI->values[i].enable = (values[0] == 1.0); + mmvi->values[i].enable = (values[0] == 1.0); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { float values[1]; control->get(controller, control->cookie, control->type, values); - MMVI->values[i].mux = (int32)values[0]; + mmvi->values[i].mux = (int32)values[0]; } } return B_OK; @@ -597,11 +597,11 @@ static status_t -set_mix(geode_controller *controller, multi_mix_value_info * MMVI) +set_mix(geode_controller *controller, multi_mix_value_info * mmvi) { geode_multi *multi = controller->multi; - for (int32 i = 0; i < MMVI->item_count; i++) { - uint32 id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; + for (int32 i = 0; i < mmvi->item_count; i++) { + uint32 id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= multi->control_count) { dprintf("geode_set_mix : invalid control id requested : %li\n", id); continue; @@ -610,8 +610,8 @@ if (control->mix_control.flags & B_MULTI_MIX_GAIN) { multi_mixer_control *control2 = NULL; - if (i+1item_count) { - id = MMVI->values[i + 1].id - MULTI_CONTROL_FIRSTID; + if (i+1item_count) { + id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= multi->control_count) { dprintf("geode_set_mix : invalid control id requested : %li\n", id); } else { @@ -627,12 +627,12 @@ values[1] = 0.0; if (control->mix_control.master == MULTI_CONTROL_MASTERID) - values[0] = MMVI->values[i].gain; + values[0] = mmvi->values[i].gain; else - values[1] = MMVI->values[i].gain; + values[1] = mmvi->values[i].gain; if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID) - values[1] = MMVI->values[i+1].gain; + values[1] = mmvi->values[i+1].gain; control->set(controller, control->cookie, control->type, values); } @@ -644,14 +644,14 @@ if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { float values[1]; - values[0] = MMVI->values[i].enable ? 1.0 : 0.0; + values[0] = mmvi->values[i].enable ? 1.0 : 0.0; control->set(controller, control->cookie, control->type, values); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { float values[1]; - values[0] = (float)MMVI->values[i].mux; + values[0] = (float)mmvi->values[i].mux; control->set(controller, control->cookie, control->type, values); } } Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp 2009-02-16 23:05:54 UTC (rev 29238) @@ -262,7 +262,7 @@ uint32 dwNumFreeEntries = 0; - for (i=0; ibufcount; i++) { + for (i = 0; i < stream->bufcount; i++) { duck->AddMapping(((uint32)stream->buffer->phy_base) + i * stream->blksize, stream->blksize, 0, TRUE, dwNumFreeEntries); } Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/multi.cpp 2009-02-16 23:05:54 UTC (rev 29238) @@ -221,7 +221,7 @@ MIXER_AUDIO_CHANNEL channel; channel.wCardId = 0; channel.dwType = ECHO_BUS_OUT; - for (i=0; i < card->caps.wNumBussesOut / 2; i++) { + for (i = 0; i < card->caps.wNumBussesOut / 2; i++) { channel.wChannel = i * 2; parent2 = echo_create_group_control(multi, &index, parent, S_null, "Output"); @@ -232,7 +232,7 @@ parent = echo_create_group_control(multi, &index, 0, S_INPUT, NULL); channel.dwType = ECHO_BUS_IN; - for (i=0; i < card->caps.wNumBussesIn / 2; i++) { + for (i = 0; i < card->caps.wNumBussesIn / 2; i++) { channel.wChannel = i * 2; parent2 = echo_create_group_control(multi, &index, parent, S_null, "Input"); @@ -247,13 +247,13 @@ } static status_t -echo_get_mix(echo_dev *card, multi_mix_value_info * MMVI) +echo_get_mix(echo_dev *card, multi_mix_value_info * mmvi) { int32 i; uint32 id; multi_mixer_control *control = NULL; - for (i=0; iitem_count; i++) { - id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; + for (i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("echo_get_mix : invalid control id requested : %li\n", id)); continue; @@ -265,22 +265,22 @@ float values[2]; control->get(card, control->channel, control->type, values); if (control->mix_control.master == MULTI_CONTROL_MASTERID) - MMVI->values[i].gain = values[0]; + mmvi->values[i].gain = values[0]; else - MMVI->values[i].gain = values[1]; + mmvi->values[i].gain = values[1]; } } if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { float values[1]; control->get(card, control->channel, control->type, values); - MMVI->values[i].enable = (values[0] == 1.0); + mmvi->values[i].enable = (values[0] == 1.0); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { float values[1]; control->get(card, control->channel, control->type, values); - MMVI->values[i].mux = (int32)values[0]; + mmvi->values[i].mux = (int32)values[0]; } } return B_OK; @@ -288,13 +288,13 @@ static status_t -echo_set_mix(echo_dev *card, multi_mix_value_info * MMVI) +echo_set_mix(echo_dev *card, multi_mix_value_info * mmvi) { int32 i; uint32 id; multi_mixer_control *control = NULL; - for (i=0; iitem_count; i++) { - id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; + for (i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("echo_set_mix : invalid control id requested : %li\n", id)); continue; @@ -303,8 +303,8 @@ if (control->mix_control.flags & B_MULTI_MIX_GAIN) { multi_mixer_control *control2 = NULL; - if (i+1item_count) { - id = MMVI->values[i + 1].id - MULTI_CONTROL_FIRSTID; + if (i+1item_count) { + id = mmvi->values[i + 1].id - MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("echo_set_mix : invalid control id requested : %li\n", id)); } else { @@ -320,12 +320,12 @@ values[1] = 0.0; if (control->mix_control.master == MULTI_CONTROL_MASTERID) - values[0] = MMVI->values[i].gain; + values[0] = mmvi->values[i].gain; else - values[1] = MMVI->values[i].gain; + values[1] = mmvi->values[i].gain; if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID) - values[1] = MMVI->values[i+1].gain; + values[1] = mmvi->values[i+1].gain; control->set(card, control->channel, control->type, values); } @@ -337,14 +337,14 @@ if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { float values[1]; - values[0] = MMVI->values[i].enable ? 1.0 : 0.0; + values[0] = mmvi->values[i].enable ? 1.0 : 0.0; control->set(card, control->channel, control->type, values); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { float values[1]; - values[0] = (float)MMVI->values[i].mux; + values[0] = (float)mmvi->values[i].mux; control->set(card, control->channel, control->type, values); } } @@ -353,22 +353,22 @@ static status_t -echo_list_mix_controls(echo_dev *card, multi_mix_control_info * MMCI) +echo_list_mix_controls(echo_dev *card, multi_mix_control_info * mmci) { - multi_mix_control *MMC; + multi_mix_control *mmc; uint32 i; - MMC = MMCI->controls; - if (MMCI->control_count < 24) + mmc = mmci->controls; + if (mmci->control_count < 24) return B_ERROR; if (echo_create_controls_list(&card->multi) < B_OK) return B_ERROR; - for (i=0; imulti.control_count; i++) { - MMC[i] = card->multi.controls[i].mix_control; + for (i = 0; i < card->multi.control_count; i++) { + mmc[i] = card->multi.controls[i].mix_control; } - MMCI->control_count = card->multi.control_count; + mmci->control_count = card->multi.control_count; return B_OK; } @@ -449,7 +449,7 @@ else designations = B_CHANNEL_SURROUND_BUS; - for (i=0; ichannels; i++) { + for (i = 0; i < stream->channels; i++) { chans[index].channel_id = index; chans[index].kind = (mode == ECHO_USE_PLAY) ? B_MULTI_OUTPUT_CHANNEL : B_MULTI_INPUT_CHANNEL; chans[index].designations = designations | chan_designations[i]; @@ -645,7 +645,7 @@ if (data->request_playback_channels < data->return_playback_channels) { LOG(("not enough channels\n")); } - for (i=0; ichannels; j++) echo_stream_get_nth_buffer(stream, j, i, &data->playback_buffers[i][channels+j].base, @@ -665,7 +665,7 @@ if (data->request_record_channels < data->return_record_channels) { LOG(("not enough channels\n")); } - for (i=0; ichannels; j++) echo_stream_get_nth_buffer(stream, j, i, &data->record_buffers[i][channels+j].base, @@ -926,7 +926,7 @@ } } #else - for (i=0; ib16 + 1; frame_size = sample_size * (stream->stereo ? 2 : 1); - for (i=0; iuse, i); if (voice) { if (!stream->first_voice) @@ -1709,15 +1709,15 @@ case EMU_MIX_MUTE: gpr->mute = (values[0] == 1.0); if (gpr->mute) { - for (i=0; iconfig, gpr->gpr + i, 0); break; } - for (i=0; icurrent[i]; } case EMU_MIX_GAIN: - for (i=0; igpr->max_gain || values[i]min_gain) return; index = (int32)(values[i] / gpr->granularity); @@ -1746,7 +1746,7 @@ switch(type) { case EMU_MIX_GAIN: - for (i=0; icurrent[i]; } break; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/multi.c 2009-02-16 23:05:54 UTC (rev 29238) @@ -262,7 +262,7 @@ parent = emuxki_create_group_control(multi, &index, 0, 0, "Playback"); - for (i=EMU_GPR_FIRST_MIX; igpr_count; i++) { + for (i = EMU_GPR_FIRST_MIX; i < card->gpr_count; i++) { const emuxki_gpr *gpr = &card->gpr[i]; if ((gpr->type & EMU_MIX_PLAYBACK) == 0) continue; @@ -276,7 +276,7 @@ parent = emuxki_create_group_control(multi, &index, 0, 0, "Record"); - for (i=EMU_GPR_FIRST_MIX; igpr_count; i++) { + for (i = EMU_GPR_FIRST_MIX; i < card->gpr_count; i++) { const emuxki_gpr *gpr = &card->gpr[i]; if ((gpr->type & EMU_MIX_RECORD) == 0) continue; @@ -401,7 +401,7 @@ if (!IS_LIVE_5_1(&card->config) && !IS_AUDIGY(&card->config)) count--; - for (i=1; i < count ; i++) { + for (i = 1; i < count ; i++) { info = &source_info[i]; PRINT(("name : %s\n", info->name)); @@ -520,13 +520,13 @@ } static status_t -emuxki_get_mix(emuxki_dev *card, multi_mix_value_info * MMVI) +emuxki_get_mix(emuxki_dev *card, multi_mix_value_info * mmvi) { int32 i; uint32 id; multi_mixer_control *control = NULL; - for (i=0; iitem_count; i++) { - id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; + for (i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("emuxki_get_mix : invalid control id requested : %li\n", id)); continue; @@ -538,35 +538,35 @@ float values[2]; control->get(card, control->cookie, control->type, values); if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) - MMVI->values[i].u.gain = values[0]; + mmvi->values[i].u.gain = values[0]; else - MMVI->values[i].u.gain = values[1]; + mmvi->values[i].u.gain = values[1]; } } if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); - MMVI->values[i].u.enable = (values[0] == 1.0); + mmvi->values[i].u.enable = (values[0] == 1.0); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { float values[1]; control->get(card, control->cookie, control->type, values); - MMVI->values[i].u.mux = (int32)values[0]; + mmvi->values[i].u.mux = (int32)values[0]; } } return B_OK; } static status_t -emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * MMVI) +emuxki_set_mix(emuxki_dev *card, multi_mix_value_info * mmvi) { int32 i; uint32 id; multi_mixer_control *control = NULL; - for (i=0; iitem_count; i++) { - id = MMVI->values[i].id - EMU_MULTI_CONTROL_FIRSTID; + for (i = 0; i < mmvi->item_count; i++) { + id = mmvi->values[i].id - EMU_MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("emuxki_set_mix : invalid control id requested : %li\n", id)); continue; @@ -575,8 +575,8 @@ if (control->mix_control.flags & B_MULTI_MIX_GAIN) { multi_mixer_control *control2 = NULL; - if (i+1item_count) { - id = MMVI->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; + if (i+1item_count) { + id = mmvi->values[i + 1].id - EMU_MULTI_CONTROL_FIRSTID; if (id < 0 || id >= card->multi.control_count) { PRINT(("emuxki_set_mix : invalid control id requested : %li\n", id)); } else { @@ -592,12 +592,12 @@ values[1] = 0.0; if (control->mix_control.master == EMU_MULTI_CONTROL_MASTERID) - values[0] = MMVI->values[i].u.gain; + values[0] = mmvi->values[i].u.gain; else - values[1] = MMVI->values[i].u.gain; + values[1] = mmvi->values[i].u.gain; if (control2 && control2->mix_control.master != EMU_MULTI_CONTROL_MASTERID) - values[1] = MMVI->values[i+1].u.gain; + values[1] = mmvi->values[i+1].u.gain; control->set(card, control->cookie, control->type, values); } @@ -609,14 +609,14 @@ if (control->mix_control.flags & B_MULTI_MIX_ENABLE && control->set) { float values[1]; - values[0] = MMVI->values[i].u.enable ? 1.0 : 0.0; + values[0] = mmvi->values[i].u.enable ? 1.0 : 0.0; control->set(card, control->cookie, control->type, values); } if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { float values[1]; - values[0] = (float)MMVI->values[i].u.mux; + values[0] = (float)mmvi->values[i].u.mux; control->set(card, control->cookie, control->type, values); } } @@ -624,22 +624,22 @@ } static status_t -emuxki_list_mix_controls(emuxki_dev *card, multi_mix_control_info * MMCI) +emuxki_list_mix_controls(emuxki_dev *card, multi_mix_control_info * mmci) { - multi_mix_control *MMC; + multi_mix_control *mmc; uint32 i; - MMC = MMCI->controls; - if (MMCI->control_count < EMU_MULTICONTROLSNUM) + mmc = mmci->controls; + if (mmci->control_count < EMU_MULTICONTROLSNUM) return B_ERROR; if (emuxki_create_controls_list(&card->multi) < B_OK) return B_ERROR; - for (i=0; imulti.control_count; i++) { - MMC[i] = card->multi.controls[i].mix_control; + for (i = 0; i < card->multi.control_count; i++) { + mmc[i] = card->multi.controls[i].mix_control; } - MMCI->control_count = card->multi.control_count; + mmci->control_count = card->multi.control_count; return B_OK; } @@ -719,7 +719,7 @@ else designations = B_CHANNEL_SURROUND_BUS; - for (i=0; ireturn_playback_channels = pchannels + pchannels2; /* playback_buffers[][c] */ data->return_playback_buffer_size = current_settings.buffer_frames; /* frames */ - for (i=0; ipstream, j, i, &data->playback_buffers[i][j].base, &data->playback_buffers[i][j].stride); - for (i=0; ipstream2, j, i, &data->playback_buffers[i][pchannels + j].base, @@ -937,13 +937,13 @@ data->return_record_channels = rchannels + rchannels2; data->return_record_buffer_size = current_settings.buffer_frames; /* frames */ - for (i=0; irstream, j, i, &data->record_buffers[i][j].base, &data->record_buffers[i][j].stride); - for (i=0; irstream2, j, i, &data->record_buffers[i][rchannels + j].base, Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2009-02-16 19:09:34 UTC (rev 29237) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2009-02-16 23:05:54 UTC (rev 29238) @@ -459,19 +459,19 @@ [... truncated: 131 lines follow ...] From mmlr at mail.berlios.de Tue Feb 17 03:06:01 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 17 Feb 2009 03:06:01 +0100 Subject: [Haiku-commits] r29239 - haiku/trunk/src/add-ons/kernel/file_systems/overlay Message-ID: <200902170206.n1H261Bx000801@sheep.berlios.de> Author: mmlr Date: 2009-02-17 03:05:58 +0100 (Tue, 17 Feb 2009) New Revision: 29239 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29239&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp Log: * Added create/write/remove/rename support for attributes to the overlay fs. * Implemented writing attributes back to attribute files. Not tested or enabled. * Fix reading attribute dirs, they need a separate cookie that links attribute files to the dir index as multiple read-dirs could happen at the same time. * Fix some obvious bugs in size calculations. Modified: haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp 2009-02-16 23:05:54 UTC (rev 29238) +++ haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp 2009-02-17 02:05:58 UTC (rev 29239) @@ -40,6 +40,12 @@ class AttributeEntry; +struct attribute_dir_cookie { + AttributeFile * file; + uint32 index; +}; + + class OverlayInode { public: OverlayInode(fs_volume *superVolume, @@ -51,12 +57,14 @@ fs_volume * SuperVolume() { return fSuperVolume; } fs_vnode * SuperVnode() { return &fSuperVnode; } - AttributeFile * GetAttributeFile(); + status_t GetAttributeFile(AttributeFile **attributeFile); + status_t WriteAttributeFile(); private: fs_volume * fSuperVolume; fs_vnode fSuperVnode; AttributeFile * fAttributeFile; + bool fAttributeFileMissing; }; @@ -68,19 +76,28 @@ status_t InitCheck() { return fStatus; } dev_t VolumeID() { return fVolumeID; } - ino_t ParentInode() { return fParentInode; } + ino_t FileInode() { return fFileInode; } - uint32 CountAttributes(); - AttributeEntry * FindAttribute(const char *name); + status_t CreateEmpty(); + status_t WriteAttributeFile(fs_volume *volume, + fs_vnode *vnode); status_t ReadAttributeDir(struct dirent *dirent, - size_t bufferSize, uint32 *numEntries); - status_t RewindAttributeDir() - { - fAttributeDirIndex = 0; - return B_OK; - } + size_t bufferSize, uint32 *numEntries, + uint32 *index); + uint32 CountAttributes(); + AttributeEntry * FindAttribute(const char *name, + uint32 *index = NULL); + + status_t CreateAttribute(const char *name, type_code type, + int openMode, AttributeEntry **entry); + status_t OpenAttribute(const char *name, int openMode, + AttributeEntry **entry); + status_t RemoveAttribute(const char *name, + AttributeEntry **entry); + status_t AddAttribute(AttributeEntry *entry); + private: #define ATTRIBUTE_OVERLAY_FILE_MAGIC 'attr' #define ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME "_HAIKU" @@ -93,7 +110,10 @@ status_t fStatus; dev_t fVolumeID; - ino_t fParentInode; + ino_t fFileInode; + ino_t fDirectoryInode; + ino_t fAttributeDirInode; + ino_t fAttributeFileInode; attribute_file * fFile; uint32 fAttributeDirIndex; AttributeEntry ** fEntries; @@ -104,18 +124,36 @@ public: AttributeEntry(AttributeFile *parent, uint8 *buffer); + AttributeEntry(AttributeFile *parent, + const char *name, type_code type); ~AttributeEntry(); + status_t InitCheck() { return fStatus; } + + uint8 * Entry() { return (uint8 *)fEntry; } size_t EntrySize(); + uint8 * Data() { return fData; } + size_t DataSize() { return fEntry->size; } + status_t SetType(type_code type); + type_code Type() { return fEntry->type; } + + status_t SetSize(size_t size); + uint32 Size() { return fEntry->size; } + + status_t SetName(const char *name); + const char * Name() { return fEntry->name; } uint8 NameLength() { return fEntry->name_length; } - const char * Name() { return fEntry->name; } status_t FillDirent(struct dirent *dirent, size_t bufferSize, uint32 *numEntries); status_t Read(off_t position, void *buffer, size_t *length); + status_t Write(off_t position, const void *buffer, + size_t *length); + status_t ReadStat(struct stat *stat); + status_t WriteStat(const struct stat *stat, uint32 statMask); private: struct attribute_entry { @@ -128,6 +166,9 @@ AttributeFile * fParent; attribute_entry * fEntry; uint8 * fData; + status_t fStatus; + bool fAllocatedEntry; + bool fAllocatedData; }; @@ -137,7 +178,8 @@ OverlayInode::OverlayInode(fs_volume *superVolume, fs_vnode *superVnode) : fSuperVolume(superVolume), fSuperVnode(*superVnode), - fAttributeFile(NULL) + fAttributeFile(NULL), + fAttributeFileMissing(false) { TRACE("inode created\n"); } @@ -157,32 +199,59 @@ } -AttributeFile * -OverlayInode::GetAttributeFile() +status_t +OverlayInode::GetAttributeFile(AttributeFile **attributeFile) { if (fAttributeFile == NULL) { fAttributeFile = new(std::nothrow) AttributeFile(fSuperVolume, &fSuperVnode); if (fAttributeFile == NULL) { TRACE_ALWAYS("no memory to allocate attribute file\n"); - return NULL; + return B_NO_MEMORY; } } - if (fAttributeFile->InitCheck() != B_OK) - return NULL; + status_t result = fAttributeFile->InitCheck(); + if (result != B_OK) { + if (result == B_ENTRY_NOT_FOUND) { + // TODO: need to check if we're able to create the file + // but at least allow virtual attributes for now + } - return fAttributeFile; + result = fAttributeFile->CreateEmpty(); + if (result != B_OK) + return result; + } + + *attributeFile = fAttributeFile; + return B_OK; } +status_t +OverlayInode::WriteAttributeFile() +{ + if (fAttributeFile == NULL) + return B_NO_INIT; + + status_t result = fAttributeFile->InitCheck(); + if (result != B_OK) + return result; + + return fAttributeFile->WriteAttributeFile(fSuperVolume, &fSuperVnode); +} + + // #pragma mark AttributeFile AttributeFile::AttributeFile(fs_volume *volume, fs_vnode *vnode) : fStatus(B_NO_INIT), fVolumeID(volume->id), - fParentInode(0), + fFileInode(0), + fDirectoryInode(0), + fAttributeDirInode(0), + fAttributeFileInode(0), fFile(NULL), fAttributeDirIndex(0), fEntries(NULL) @@ -211,7 +280,7 @@ struct stat stat; if (vnode->ops->read_stat != NULL && vnode->ops->read_stat(volume, vnode, &stat) == B_OK) { - fParentInode = stat.st_ino; + fFileInode = stat.st_ino; } // TODO: the ".." lookup is not actually valid for non-directory vnodes. @@ -249,6 +318,13 @@ return; } + if (i == 0) + fDirectoryInode = inodeNumber; + else if (i == 1) + fAttributeDirInode = inodeNumber; + else if (i == 2) + fAttributeFileInode = inodeNumber; + fStatus = get_vnode(volume, inodeNumber, ¤tVnode.private_node, ¤tVnode.ops); if (fStatus != B_OK) { @@ -314,7 +390,8 @@ return; } - fEntries = new(std::nothrow) AttributeEntry *[fFile->entry_count]; + fEntries = (AttributeEntry **)malloc(fFile->entry_count + * sizeof(AttributeEntry *)); if (fEntries == NULL) { TRACE_ALWAYS("no memory to allocate entry pointers\n"); fStatus = B_NO_MEMORY; @@ -335,7 +412,7 @@ return; } - totalSize += fEntries[i]->EntrySize(); + totalSize += fEntries[i]->EntrySize() + fEntries[i]->DataSize(); if (totalSize > readLength) { TRACE_ALWAYS("attribute entries are too large for buffer\n"); fStatus = B_BAD_VALUE; @@ -354,13 +431,170 @@ for (uint32 i = 0; i < fFile->entry_count; i++) delete fEntries[i]; - delete [] fEntries; + free(fEntries); } free(fFile); } +status_t +AttributeFile::CreateEmpty() +{ + if (fFile == NULL) { + fFile = (attribute_file *)malloc(sizeof(attribute_file) - 1); + if (fFile == NULL) { + TRACE_ALWAYS("failed to allocate file buffer\n"); + fStatus = B_NO_MEMORY; + return fStatus; + } + + fFile->entry_count = 0; + fFile->magic = ATTRIBUTE_OVERLAY_FILE_MAGIC; + } + + fStatus = B_OK; + return B_OK; +} + + +status_t +AttributeFile::WriteAttributeFile(fs_volume *volume, fs_vnode *vnode) +{ + if (fFile == NULL) + return B_NO_INIT; + + if (fDirectoryInode == 0) { + TRACE_ALWAYS("directory inode not known\n"); + return B_NO_INIT; + } + + char nameBuffer[B_FILE_NAME_LENGTH]; + nameBuffer[sizeof(nameBuffer) - 1] = 0; + status_t result = vnode->ops->get_vnode_name(volume, vnode, nameBuffer, + sizeof(nameBuffer) - 1); + if (result != B_OK) { + TRACE_ALWAYS("failed to get vnode name: %s\n", strerror(result)); + return result; + } + + fs_vnode currentVnode; + if (fAttributeDirInode == 0) { + result = get_vnode(volume, fDirectoryInode, + ¤tVnode.private_node, ¤tVnode.ops); + if (result != B_OK) { + TRACE_ALWAYS("failed to get directory vnode: %s\n", + strerror(result)); + return result; + } + + // create the attribute directory + result = currentVnode.ops->create_dir(volume, ¤tVnode, + ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME, S_IRWXU | S_IRWXG | S_IRWXO, + &fAttributeDirInode); + + put_vnode(volume, fDirectoryInode); + + if (result != B_OK) { + TRACE_ALWAYS("failed to create attribute directory: %s\n", + strerror(result)); + fAttributeDirInode = 0; + return result; + } + } + + void *attrFileCookie = NULL; + if (fAttributeFileInode == 0) { + result = get_vnode(volume, fAttributeDirInode, + ¤tVnode.private_node, ¤tVnode.ops); + if (result != B_OK) { + TRACE_ALWAYS("failed to get attribute directory vnode: %s\n", + strerror(result)); + return result; + } + + // create the attribute file + result = currentVnode.ops->create(volume, ¤tVnode, + nameBuffer, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP + | S_IWGRP | S_IROTH | S_IWOTH, &attrFileCookie, + &fAttributeFileInode); + + put_vnode(volume, fAttributeDirInode); + + if (result != B_OK) { + TRACE_ALWAYS("failed to create attribute file: %s\n", + strerror(result)); + return result; + } + + result = get_vnode(volume, fAttributeFileInode, + ¤tVnode.private_node, ¤tVnode.ops); + if (result != B_OK) { + TRACE_ALWAYS("getting attribute file vnode after create failed: %s\n", + strerror(result)); + return result; + } + } else { + result = get_vnode(volume, fAttributeFileInode, + ¤tVnode.private_node, ¤tVnode.ops); + if (result != B_OK) { + TRACE_ALWAYS("getting attribute file vnode failed: %s\n", + strerror(result)); + return result; + } + + // open the attribute file + result = currentVnode.ops->open(volume, ¤tVnode, O_RDWR | O_TRUNC, + &attrFileCookie); + if (result != B_OK) { + TRACE_ALWAYS("failed to open attribute file for writing: %s\n", + strerror(result)); + put_vnode(volume, fAttributeFileInode); + return result; + } + } + + off_t position = 0; + size_t writeLength = sizeof(attribute_file) - 1; + result = currentVnode.ops->write(volume, ¤tVnode, attrFileCookie, + position, fFile, &writeLength); + if (result != B_OK) { + TRACE_ALWAYS("failed to write to attribute file: %s\n", + strerror(result)); + goto close_and_put; + } + + for (uint32 i = 0; i < fFile->entry_count; i++) { + writeLength = fEntries[i]->EntrySize(); + result = currentVnode.ops->write(volume, ¤tVnode, attrFileCookie, + position, fEntries[i]->Entry(), &writeLength); + if (result != B_OK) { + TRACE_ALWAYS("failed to write to attribute file: %s\n", + strerror(result)); + goto close_and_put; + } + + writeLength = fEntries[i]->DataSize(); + result = currentVnode.ops->write(volume, ¤tVnode, attrFileCookie, + position, fEntries[i]->Data(), &writeLength); + if (result != B_OK) { + TRACE_ALWAYS("failed to write to attribute file: %s\n", + strerror(result)); + goto close_and_put; + } + } + +close_and_put: + if (currentVnode.ops->close != NULL) + currentVnode.ops->close(volume, ¤tVnode, attrFileCookie); + if (currentVnode.ops->free_cookie != NULL) + currentVnode.ops->free_cookie(volume, ¤tVnode, attrFileCookie); + + put_vnode(volume, fAttributeFileInode); + return B_OK; +} + + uint32 AttributeFile::CountAttributes() { @@ -372,14 +606,15 @@ AttributeEntry * -AttributeFile::FindAttribute(const char *name) +AttributeFile::FindAttribute(const char *name, uint32 *index) { - if (fFile == NULL) - return NULL; + for (uint32 i = 0; i < fFile->entry_count; i++) { + if (strncmp(fEntries[i]->Name(), name, fEntries[i]->NameLength()) == 0) { + if (index) + *index = i; - for (uint32 i = 0; i < fFile->entry_count; i++) { - if (strncmp(fEntries[i]->Name(), name, fEntries[i]->NameLength()) == 0) return fEntries[i]; + } } return NULL; @@ -387,16 +622,115 @@ status_t +AttributeFile::CreateAttribute(const char *name, type_code type, int openMode, + AttributeEntry **_entry) +{ + AttributeEntry *existing = FindAttribute(name); + if (existing != NULL) { + if (openMode & O_TRUNC) + existing->SetSize(0); + + // attribute already exists, only allow if the attribute type is + // compatible or the attribute size is 0 + if (existing->Type() != type) { + if (existing->Size() != 0) + return B_FILE_EXISTS; + existing->SetType(type); + } + + if (existing->InitCheck() == B_OK) { + *_entry = existing; + return B_OK; + } + + // we tried to change the existing item but failed, try to just + // remove it instead and creating a new one + RemoveAttribute(name, NULL); + } + + AttributeEntry *entry = new(std::nothrow) AttributeEntry(this, name, type); + if (entry == NULL) + return B_NO_MEMORY; + + status_t result = AddAttribute(entry); + if (result != B_OK) { + delete entry; + return result; + } + + *_entry = entry; + return B_OK; +} + + +status_t +AttributeFile::OpenAttribute(const char *name, int openMode, + AttributeEntry **_entry) +{ + AttributeEntry *entry = FindAttribute(name); + if (entry == NULL) + return B_ENTRY_NOT_FOUND; + + if (openMode & O_TRUNC) + entry->SetSize(0); + + *_entry = entry; + return B_OK; +} + + +status_t +AttributeFile::RemoveAttribute(const char *name, AttributeEntry **_entry) +{ + uint32 index = 0; + AttributeEntry *entry = FindAttribute(name, &index); + if (entry == NULL) + return B_ENTRY_NOT_FOUND; + + for (uint32 i = index + 1; i < fFile->entry_count; i++) + fEntries[i - 1] = fEntries[i]; + fFile->entry_count--; + + if (_entry) + *_entry = entry; + else + delete entry; + + return B_OK; +} + + +status_t +AttributeFile::AddAttribute(AttributeEntry *entry) +{ + status_t result = entry->InitCheck(); + if (result != B_OK) + return result; + + if (FindAttribute(entry->Name()) != NULL) + return B_FILE_EXISTS; + + AttributeEntry **newEntries = (AttributeEntry **)realloc(fEntries, + (fFile->entry_count + 1) * sizeof(AttributeEntry *)); + if (newEntries == NULL) + return B_NO_MEMORY; + + fEntries = newEntries; + fEntries[fFile->entry_count++] = entry; + return B_OK; +} + + +status_t AttributeFile::ReadAttributeDir(struct dirent *dirent, size_t bufferSize, - uint32 *numEntries) + uint32 *numEntries, uint32 *index) { - if (fFile == NULL || fAttributeDirIndex >= fFile->entry_count) { + if (fFile == NULL || *index >= fFile->entry_count) { *numEntries = 0; return B_OK; } - return fEntries[fAttributeDirIndex++]->FillDirent(dirent, bufferSize, - numEntries); + return fEntries[(*index)++]->FillDirent(dirent, bufferSize, numEntries); } @@ -406,32 +740,134 @@ AttributeEntry::AttributeEntry(AttributeFile *parent, uint8 *buffer) : fParent(parent), fEntry(NULL), - fData(NULL) + fData(NULL), + fStatus(B_NO_INIT), + fAllocatedEntry(false), + fAllocatedData(false) { + if (buffer == NULL) + return; + fEntry = (attribute_entry *)buffer; fData = (uint8 *)fEntry->name + fEntry->name_length; + fStatus = B_OK; } +AttributeEntry::AttributeEntry(AttributeFile *parent, const char *name, + type_code type) + : fParent(parent), + fEntry(NULL), + fData(NULL), + fStatus(B_NO_INIT), + fAllocatedEntry(false), + fAllocatedData(false) +{ + fStatus = SetName(name); + if (fStatus != B_OK) + return; + + fEntry->type = type; + fEntry->size = 0; +} + + AttributeEntry::~AttributeEntry() { + if (fAllocatedEntry) + free(fEntry); + if (fAllocatedData) + free(fData); } size_t AttributeEntry::EntrySize() { - return sizeof(attribute_entry) - 1 + fEntry->name_length + fEntry->size; + return sizeof(attribute_entry) - 1 + fEntry->name_length; } status_t +AttributeEntry::SetType(type_code type) +{ + fEntry->type = type; + return B_OK; +} + + +status_t +AttributeEntry::SetSize(size_t size) +{ + if (size <= fEntry->size) { + fEntry->size = size; + return B_OK; + } + + if (fAllocatedData) { + uint8 *newData = (uint8 *)realloc(fData, size); + if (newData == NULL) { + fStatus = B_NO_MEMORY; + return fStatus; + } + + fData = newData; + fEntry->size = size; + return B_OK; + } + + uint8 *newData = (uint8 *)malloc(size); + if (newData == NULL) { + fStatus = B_NO_MEMORY; + return fStatus; + } + + memcpy(newData, fData, min_c(fEntry->size, size)); + fAllocatedData = true; + fData = newData; + return B_OK; +} + + +status_t +AttributeEntry::SetName(const char *name) +{ + size_t nameLength = strlen(name) + 1; + if (nameLength > 255) { + fStatus = B_NAME_TOO_LONG; + return fStatus; + } + + if (!fAllocatedEntry || fEntry->name_length < nameLength) { + attribute_entry *newEntry = (attribute_entry *)malloc( + sizeof(attribute_entry) - 1 + nameLength); + if (newEntry == NULL) { + fStatus = B_NO_MEMORY; + return fStatus; + } + + if (fEntry != NULL) + memcpy(newEntry, fEntry, sizeof(attribute_entry) - 1); + if (fAllocatedEntry) + free(fEntry); + + fAllocatedEntry = true; + fEntry = newEntry; + } + + fEntry->name_length = nameLength; + strlcpy(fEntry->name, name, nameLength); + return B_OK; +} + + +status_t AttributeEntry::FillDirent(struct dirent *dirent, size_t bufferSize, uint32 *numEntries) { dirent->d_dev = dirent->d_pdev = fParent->VolumeID(); dirent->d_ino = (ino_t)this; - dirent->d_pino = fParent->ParentInode(); + dirent->d_pino = fParent->FileInode(); dirent->d_reclen = sizeof(struct dirent) + fEntry->name_length; if (bufferSize < dirent->d_reclen) { *numEntries = 0; @@ -448,14 +884,25 @@ status_t AttributeEntry::Read(off_t position, void *buffer, size_t *length) { - *length = min_c(*length, fEntry->size); - if (*length <= position) { - *length = 0; - return B_OK; + *length = min_c(*length, fEntry->size - position); + memcpy(buffer, fData + position, *length); + return B_OK; +} + + +status_t +AttributeEntry::Write(off_t position, const void *buffer, size_t *length) +{ + size_t neededSize = position + *length; + if (neededSize > fEntry->size) { + status_t result = SetSize(neededSize); + if (result != B_OK) { + *length = 0; + return result; + } } - *length -= position; - memcpy(buffer, fData + position, *length); + memcpy(fData + position, buffer, *length); return B_OK; } @@ -478,6 +925,13 @@ } +status_t +AttributeEntry::WriteStat(const struct stat *stat, uint32 statMask) +{ + return B_UNSUPPORTED; +} + + // #pragma mark - vnode ops @@ -860,11 +1314,20 @@ overlay_open_attr_dir(fs_volume *volume, fs_vnode *vnode, void **cookie) { OVERLAY_CALL(open_attr_dir, cookie) - AttributeFile *attributeFile = node->GetAttributeFile(); - if (attributeFile == NULL) - return B_UNSUPPORTED; - *cookie = attributeFile; + AttributeFile *attributeFile = NULL; + status_t result = node->GetAttributeFile(&attributeFile); + if (result != B_OK) + return result; + + attribute_dir_cookie *dirCookie = (attribute_dir_cookie *)malloc( + sizeof(attribute_dir_cookie)); + if (dirCookie == NULL) + return B_NO_MEMORY; + + dirCookie->file = attributeFile; + dirCookie->index = 0; + *cookie = dirCookie; return B_OK; } @@ -881,6 +1344,7 @@ overlay_free_attr_dir_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie) { OVERLAY_CALL(free_attr_dir_cookie, cookie) + free(cookie); return B_OK; } @@ -890,8 +1354,9 @@ struct dirent *buffer, size_t bufferSize, uint32 *num) { OVERLAY_CALL(read_attr_dir, cookie, buffer, bufferSize, num) - AttributeFile *attributeFile = (AttributeFile *)cookie; - return attributeFile->ReadAttributeDir(buffer, bufferSize, num); + attribute_dir_cookie *dirCookie = (attribute_dir_cookie *)cookie; + return dirCookie->file->ReadAttributeDir(buffer, bufferSize, num, + &dirCookie->index); } @@ -899,8 +1364,9 @@ overlay_rewind_attr_dir(fs_volume *volume, fs_vnode *vnode, void *cookie) { OVERLAY_CALL(rewind_attr_dir, cookie) - AttributeFile *attributeFile = (AttributeFile *)cookie; - return attributeFile->RewindAttributeDir(); + attribute_dir_cookie *dirCookie = (attribute_dir_cookie *)cookie; + dirCookie->index = 0; + return B_OK; } @@ -909,7 +1375,14 @@ uint32 type, int openMode, void **cookie) { OVERLAY_CALL(create_attr, name, type, openMode, cookie) - return B_UNSUPPORTED; + + AttributeFile *attributeFile = NULL; + status_t result = node->GetAttributeFile(&attributeFile); + if (result != B_OK) + return result; + + return attributeFile->CreateAttribute(name, type, openMode, + (AttributeEntry **)cookie); } @@ -919,16 +1392,13 @@ { OVERLAY_CALL(open_attr, name, openMode, cookie) - AttributeFile *attributeFile = node->GetAttributeFile(); - if (attributeFile == NULL) - return B_UNSUPPORTED; + AttributeFile *attributeFile = NULL; + status_t result = node->GetAttributeFile(&attributeFile); + if (result != B_OK) + return result; - AttributeEntry *entry = attributeFile->FindAttribute(name); - if (entry == NULL) - return B_ENTRY_NOT_FOUND; - - *cookie = entry; - return B_OK; + return attributeFile->OpenAttribute(name, openMode, + (AttributeEntry **)cookie); } @@ -963,7 +1433,8 @@ const void *buffer, size_t *length) { OVERLAY_CALL(write_attr, cookie, pos, buffer, length) - return B_UNSUPPORTED; + AttributeEntry *entry = (AttributeEntry *)cookie; + return entry->Write(pos, buffer, length); } @@ -982,7 +1453,8 @@ const struct stat *stat, int statMask) { OVERLAY_CALL(write_attr_stat, cookie, stat, statMask) - return B_UNSUPPORTED; + AttributeEntry *entry = (AttributeEntry *)cookie; + return entry->WriteStat(stat, statMask); } @@ -991,7 +1463,41 @@ const char *fromName, fs_vnode *toVnode, const char *toName) { OVERLAY_CALL(rename_attr, fromName, toVnode, toName) - return B_UNSUPPORTED; + + AttributeFile *attributeFile = NULL; + status_t result = node->GetAttributeFile(&attributeFile); + if (result != B_OK) + return B_OK; + + AttributeFile *toAttributeFile = attributeFile; + if (vnode->private_node != toVnode->private_node) { + OverlayInode *toNode = (OverlayInode *)toVnode->private_node; + result = toNode->GetAttributeFile(&toAttributeFile); + if (result != B_OK) + return result; + } + + AttributeEntry *entry = NULL; + result = attributeFile->RemoveAttribute(fromName, &entry); + if (result != B_OK) + return result; + + result = entry->SetName(toName); + if (result != B_OK) { + if (attributeFile->AddAttribute(entry) != B_OK) + delete entry; + return result; + } + + result = toAttributeFile->AddAttribute(entry); + if (result != B_OK) { + if (entry->SetName(fromName) != B_OK + || attributeFile->AddAttribute(entry) != B_OK) + delete entry; + return result; + } + + return B_OK; } @@ -999,7 +1505,13 @@ overlay_remove_attr(fs_volume *volume, fs_vnode *vnode, const char *name) { OVERLAY_CALL(remove_attr, name) - return B_UNSUPPORTED; + + AttributeFile *attributeFile = NULL; + status_t result = node->GetAttributeFile(&attributeFile); + if (result != B_OK) + return result; + + return attributeFile->RemoveAttribute(name, NULL); } From phoudoin at mail.berlios.de Tue Feb 17 11:37:02 2009 From: phoudoin at mail.berlios.de (phoudoin at mail.berlios.de) Date: Tue, 17 Feb 2009 11:37:02 +0100 Subject: [Haiku-commits] r29240 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200902171037.n1HAb2nT003517@sheep.berlios.de> Author: phoudoin Date: 2009-02-17 11:36:58 +0100 (Tue, 17 Feb 2009) New Revision: 29240 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29240&view=rev Modified: haiku/trunk/headers/os/interface/ControlLook.h haiku/trunk/src/kits/interface/ControlLook.cpp haiku/trunk/src/kits/interface/TabView.cpp Log: Fixed BTabs focus underline offset. Fixed a typo in method name. Please forgive me Stephan if I just screw your next commit... Modified: haiku/trunk/headers/os/interface/ControlLook.h =================================================================== --- haiku/trunk/headers/os/interface/ControlLook.h 2009-02-17 02:05:58 UTC (rev 29239) +++ haiku/trunk/headers/os/interface/ControlLook.h 2009-02-17 10:36:58 UTC (rev 29240) @@ -169,7 +169,7 @@ const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); - virtual void DrawInctiveTab(BView* view, BRect& rect, + virtual void DrawInactiveTab(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags = 0, uint32 borders = B_ALL_BORDERS); Modified: haiku/trunk/src/kits/interface/ControlLook.cpp =================================================================== --- haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-17 02:05:58 UTC (rev 29239) +++ haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-17 10:36:58 UTC (rev 29240) @@ -1247,7 +1247,7 @@ void -BControlLook::DrawInctiveTab(BView* view, BRect& rect, const BRect& updateRect, +BControlLook::DrawInactiveTab(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, uint32 borders) { if (!rect.IsValid() || !rect.Intersects(updateRect)) Modified: haiku/trunk/src/kits/interface/TabView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TabView.cpp 2009-02-17 02:05:58 UTC (rev 29239) +++ haiku/trunk/src/kits/interface/TabView.cpp 2009-02-17 10:36:58 UTC (rev 29240) @@ -223,12 +223,12 @@ float width = owner->StringWidth(Label()); owner->SetHighColor(ui_color(B_KEYBOARD_NAVIGATION_COLOR)); - // TODO: remove offset - float offset = frame.Height() / 2.0; - owner->StrokeLine(BPoint((frame.left + frame.right - width + offset) / 2.0, - frame.bottom - 3), - BPoint((frame.left + frame.right + width + offset) / 2.0, - frame.bottom - 3)); + + float offset = IsSelected() ? 3 : 2; + owner->StrokeLine(BPoint((frame.left + frame.right - width) / 2.0, + frame.bottom - offset), + BPoint((frame.left + frame.right + width) / 2.0, + frame.bottom - offset)); } @@ -290,7 +290,7 @@ be_control_look->DrawActiveTab(owner, frame, frame, no_tint, 0, borders); } else { - be_control_look->DrawInctiveTab(owner, frame, frame, no_tint, 0, + be_control_look->DrawInactiveTab(owner, frame, frame, no_tint, 0, borders); } @@ -858,7 +858,7 @@ | BControlLook::B_BOTTOM_BORDER | BControlLook::B_RIGHT_BORDER; if (left == 0) borders |= BControlLook::B_LEFT_BORDER; - be_control_look->DrawInctiveTab(this, frame, frame, base, 0, borders); + be_control_look->DrawInactiveTab(this, frame, frame, base, 0, borders); } if (fSelection < CountTabs()) From mmlr at mail.berlios.de Tue Feb 17 22:43:15 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 17 Feb 2009 22:43:15 +0100 Subject: [Haiku-commits] r29241 - in haiku/trunk: headers/os/drivers headers/private/kernel src/system/kernel src/system/kernel/arch/x86/timers Message-ID: <200902172143.n1HLhFcv004529@sheep.berlios.de> Author: mmlr Date: 2009-02-17 22:41:51 +0100 (Tue, 17 Feb 2009) New Revision: 29241 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29241&view=rev Modified: haiku/trunk/headers/os/drivers/KernelExport.h haiku/trunk/headers/private/kernel/int.h haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.c haiku/trunk/src/system/kernel/int.c Log: * Introduce a (private) flag B_NO_HANDLED_INFO for install_io_interrupt_handler. It causes the interrupt handler to be inserted at the very end of the list instead of at the top. It is intended to be used as a workaround when a interrupt handler cannot know if it actually handled the interrupt. This should never be used by native drivers. Also if we know that the result is not valid because of this flag we won't disable the vector in case we count many unhandled interrupts as those numbers are then unreliable. * Moved B_NO_LOCK_VECTOR to be a private flag as well. * Made the interrupt handler list a simple manually maintaned singly linked list instead of the doubly linked one used with insque and remque as it greatly simplifies things for such an easy use case and is more compact. Modified: haiku/trunk/headers/os/drivers/KernelExport.h =================================================================== --- haiku/trunk/headers/os/drivers/KernelExport.h 2009-02-17 10:36:58 UTC (rev 29240) +++ haiku/trunk/headers/os/drivers/KernelExport.h 2009-02-17 21:41:51 UTC (rev 29241) @@ -51,7 +51,6 @@ /* Flags that can be passed to install_io_interrupt_handler() */ #define B_NO_ENABLE_COUNTER 1 -#define B_NO_LOCK_VECTOR 2 /* timer interrupts services */ Modified: haiku/trunk/headers/private/kernel/int.h =================================================================== --- haiku/trunk/headers/private/kernel/int.h 2009-02-17 10:36:58 UTC (rev 29240) +++ haiku/trunk/headers/private/kernel/int.h 2009-02-17 21:41:51 UTC (rev 29241) @@ -12,6 +12,10 @@ #include #include +// private install_io_interrupt_handler() flags +#define B_NO_LOCK_VECTOR 0x100 +#define B_NO_HANDLED_INFO 0x200 + struct kernel_args; Modified: haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.c 2009-02-17 10:36:58 UTC (rev 29240) +++ haiku/trunk/src/system/kernel/arch/x86/timers/x86_hpet.c 2009-02-17 21:41:51 UTC (rev 29241) @@ -11,6 +11,7 @@ #include #include +#include #include "hpet.h" Modified: haiku/trunk/src/system/kernel/int.c =================================================================== --- haiku/trunk/src/system/kernel/int.c 2009-02-17 10:36:58 UTC (rev 29240) +++ haiku/trunk/src/system/kernel/int.c 2009-02-17 21:41:51 UTC (rev 29241) @@ -33,14 +33,14 @@ struct io_handler { struct io_handler *next; - struct io_handler *prev; interrupt_handler func; void *data; bool use_enable_counter; + bool no_handled_info; }; struct io_vector { - struct io_handler handler_list; + struct io_handler * handler_list; spinlock vector_lock; int32 enable_count; bool no_lock_vector; @@ -67,18 +67,16 @@ && sVectors[i].enable_count == 0 && sVectors[i].handled_count == 0 && sVectors[i].unhandled_count == 0 - && sVectors[i].handler_list.next == &sVectors[i].handler_list) + && sVectors[i].handler_list == NULL) continue; kprintf("int %3d, enabled %ld, handled %8lld, unhandled %8lld%s%s\n", i, sVectors[i].enable_count, sVectors[i].handled_count, sVectors[i].unhandled_count, B_SPINLOCK_IS_LOCKED(&sVectors[i].vector_lock) ? ", ACTIVE" : "", - sVectors[i].handler_list.next == &sVectors[i].handler_list - ? ", no handler" : ""); + sVectors[i].handler_list == NULL ? ", no handler" : ""); - for (io = sVectors[i].handler_list.next; - io != &sVectors[i].handler_list; io = io->next) { + for (io = sVectors[i].handler_list; io != NULL; io = io->next) { const char *symbol, *imageName; bool exactMatch; @@ -134,7 +132,7 @@ sVectors[i].trigger_count = 0; sVectors[i].ignored_count = 0; #endif - initque(&sVectors[i].handler_list); /* initialize handler queue */ + sVectors[i].handler_list = NULL; } #if DEBUG_INTERRUPTS @@ -168,13 +166,15 @@ if (!sVectors[vector].no_lock_vector) acquire_spinlock(&sVectors[vector].vector_lock); +#if !DEBUG_INTERRUPTS // The list can be empty at this place - if (sVectors[vector].handler_list.next == &sVectors[vector].handler_list) { + if (sVectors[vector].handler_list == NULL) { dprintf("unhandled io interrupt %d\n", vector); if (!sVectors[vector].no_lock_vector) release_spinlock(&sVectors[vector].vector_lock); return B_UNHANDLED_INTERRUPT; } +#endif /* For level-triggered interrupts, we actually handle the return * value (ie. B_HANDLED_INTERRUPT) to decide wether or not we @@ -185,9 +185,7 @@ * whatever the driver thought would be useful (ie. B_INVOKE_SCHEDULER) */ - for (io = sVectors[vector].handler_list.next; - io != &sVectors[vector].handler_list; - io = io->next) { + for (io = sVectors[vector].handler_list; io != NULL; io = io->next) { status = io->func(io->data); if (levelTriggered && status != B_UNHANDLED_INTERRUPT) @@ -210,16 +208,27 @@ if (sVectors[vector].trigger_count > 10000) { if (sVectors[vector].ignored_count > 9900) { - if (sVectors[vector].handler_list.next == NULL - || sVectors[vector].handler_list.next->next == NULL) { - // this interrupt vector is not shared, disable it - sVectors[vector].enable_count = -100; - arch_int_disable_io_interrupt(vector); - dprintf("Disabling unhandled io interrupt %d\n", vector); + struct io_handler *last = sVectors[vector].handler_list; + while (last && last->next) + last = last->next; + + if (last != NULL && last->no_handled_info) { + // we have an interrupt handler installed that does not + // know whether or not it has actually handled the interrupt, + // so this unhandled count is inaccurate and we can't just + // disable } else { - // this is a shared interrupt vector, we cannot just disable it - dprintf("More than 99%% interrupts of vector %d are unhandled\n", - vector); + if (sVectors[vector].handler_list == NULL + || sVectors[vector].handler_list->next == NULL) { + // this interrupt vector is not shared, disable it + sVectors[vector].enable_count = -100; + arch_int_disable_io_interrupt(vector); + dprintf("Disabling unhandled io interrupt %d\n", vector); + } else { + // this is a shared interrupt vector, we cannot just disable it + dprintf("More than 99%% interrupts of vector %d are unhandled\n", + vector); + } } } @@ -290,14 +299,34 @@ io->func = handler; io->data = data; io->use_enable_counter = (flags & B_NO_ENABLE_COUNTER) == 0; + io->no_handled_info = (flags & B_NO_HANDLED_INFO) == 0; // Disable the interrupts, get the spinlock for this irq only // and then insert the handler state = disable_interrupts(); acquire_spinlock(&sVectors[vector].vector_lock); - insque(io, &sVectors[vector].handler_list); + if ((flags & B_NO_HANDLED_INFO) != 0 + && sVectors[vector].handler_list != NULL) { + // The driver registering this interrupt handler doesn't know + // whether or not it actually handled the interrupt after the + // handler returns. This is incompatible with shared interrupts + // as we'd potentially steal interrupts from other handlers + // resulting in interrupt storms. Therefore we enqueue this interrupt + // handler as the very last one, meaning all other handlers will + // get their go at any interrupt first. + struct io_handler *last = sVectors[vector].handler_list; + while (last->next) + last = last->next; + io->next = NULL; + last->next = io; + } else { + // A normal interrupt handler, just add it to the head of the list. + io->next = sVectors[vector].handler_list; + sVectors[vector].handler_list = io; + } + // If B_NO_ENABLE_COUNTER is set, we're being asked to not alter // whether the interrupt should be enabled or not if (io->use_enable_counter) { @@ -328,6 +357,7 @@ { status_t status = B_BAD_VALUE; struct io_handler *io = NULL; + struct io_handler *last = NULL; cpu_status state; if (vector < 0 || vector >= NUM_IO_VECTORS) @@ -341,12 +371,13 @@ * We go forward through the list but this means we start with the * most recently added handlers. */ - for (io = sVectors[vector].handler_list.next; - io != &sVectors[vector].handler_list; - io = io->next) { + for (io = sVectors[vector].handler_list; io != NULL; io = io->next) { /* we have to match both function and data */ if (io->func == handler && io->data == data) { - remque(io); + if (last != NULL) + last->next = io->next; + else + sVectors[vector].handler_list = io->next; // Check if we need to disable the interrupt if (io->use_enable_counter && --sVectors[vector].enable_count == 0) @@ -355,6 +386,8 @@ status = B_OK; break; } + + last = io; } release_spinlock(&sVectors[vector].vector_lock); From mmlr at mail.berlios.de Tue Feb 17 22:49:36 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Tue, 17 Feb 2009 22:49:36 +0100 Subject: [Haiku-commits] r29242 - haiku/trunk/src/libs/compat/freebsd_network Message-ID: <200902172149.n1HLnaRl004922@sheep.berlios.de> Author: mmlr Date: 2009-02-17 22:49:34 +0100 (Tue, 17 Feb 2009) New Revision: 29242 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29242&view=rev Modified: haiku/trunk/src/libs/compat/freebsd_network/Jamfile haiku/trunk/src/libs/compat/freebsd_network/bus.c Log: Make use of the new private B_NO_HANDLED_INFO in the FreeBSD compatibility layer for now. This is a workaround and should be removed once we have proper interrupt return values from FreeBSD drivers. Should work around interrupt storms for shared interrupts with some network cards that use a FreeBSD driver. Modified: haiku/trunk/src/libs/compat/freebsd_network/Jamfile =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/Jamfile 2009-02-17 21:41:51 UTC (rev 29241) +++ haiku/trunk/src/libs/compat/freebsd_network/Jamfile 2009-02-17 21:49:34 UTC (rev 29242) @@ -4,6 +4,7 @@ UseHeaders [ FDirName $(SUBDIR) ] : true ; UseHeaders [ FDirName $(SUBDIR) compat ] : true ; UsePrivateHeaders net ; +UsePrivateKernelHeaders ; UseHeaders $(HAIKU_PRIVATE_KERNEL_HEADERS) : true ; SubDirCcFlags [ FDefines _KERNEL=1 ] ; Modified: haiku/trunk/src/libs/compat/freebsd_network/bus.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/bus.c 2009-02-17 21:41:51 UTC (rev 29241) +++ haiku/trunk/src/libs/compat/freebsd_network/bus.c 2009-02-17 21:49:34 UTC (rev 29242) @@ -17,6 +17,8 @@ #include #include +// private kernel header to get B_NO_HANDLED_INFO +#include //#define DEBUG_BUS_SPACE_RW #ifdef DEBUG_BUS_SPACE_RW @@ -313,10 +315,10 @@ if (filter != NULL) { status = install_io_interrupt_handler(intr->irq, - (interrupt_handler)intr->filter, intr->arg, 0); + (interrupt_handler)intr->filter, intr->arg, B_NO_HANDLED_INFO); } else if (flags & INTR_FAST) { status = install_io_interrupt_handler(intr->irq, - intr_fast_wrapper, intr, 0); + intr_fast_wrapper, intr, B_NO_HANDLED_INFO); } else { snprintf(semName, sizeof(semName), "%s intr", dev->device_name); @@ -337,7 +339,7 @@ } status = install_io_interrupt_handler(intr->irq, - intr_wrapper, intr, 0); + intr_wrapper, intr, B_NO_HANDLED_INFO); } if (status < B_OK) { From axeld at pinc-software.de Wed Feb 18 00:14:50 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Wed, 18 Feb 2009 00:14:50 +0100 Subject: [Haiku-commits] r29241 - in haiku/trunk: headers/os/drivers headers/private/kernel src/system/kernel src/system/kernel/arch/x86/timers In-Reply-To: <200902172143.n1HLhFcv004529@sheep.berlios.de> References: <200902172143.n1HLhFcv004529@sheep.berlios.de> Message-ID: <499B44EA.6090000@pinc-software.de> mmlr at mail.berlios.de wrote: > Modified: haiku/trunk/src/system/kernel/int.c > =================================================================== > struct io_vector { > - struct io_handler handler_list; > + struct io_handler * handler_list; Following the '*' style used in that file, the asterisk should directly prepend "handler_list" :-) > @@ -290,14 +299,34 @@ > io->func = handler; > io->data = data; > io->use_enable_counter = (flags & B_NO_ENABLE_COUNTER) == 0; > + io->no_handled_info = (flags & B_NO_HANDLED_INFO) == 0; This probably should have been != 0... Bye, Axel. From korli at users.berlios.de Wed Feb 18 09:37:39 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Wed, 18 Feb 2009 09:37:39 +0100 Subject: [Haiku-commits] r29180 - haiku/trunk/src/kits/interface In-Reply-To: <17344772461-BeMail@zon> References: <200902092358.n19Nwchc004002@sheep.berlios.de> <17344772461-BeMail@zon> Message-ID: Hi Axel, 2009/2/15 Axel D?rfler > korli at BerliOS wrote: > > Log: > > * it seems we can skip _HandleKeyDown() when not active (keyboard > > navigation, > > shortcuts and screenshots). > > I'm not sure if fActive is the right thing to test for; maybe checking > if the message was for the preferred handler would be better. At least > messages that applications get when they use SetEventHandler() > shouldn't get to the preferred handler, but specifically to the one > that requests those messages. You probably mean SetEventMask() ? Do you mean this should be handled at the task_looper() level instead of DispatchMessage() ? 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. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From axeld at pinc-software.de Wed Feb 18 10:49:02 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Wed, 18 Feb 2009 10:49:02 +0100 Subject: [Haiku-commits] r29180 - haiku/trunk/src/kits/interface In-Reply-To: References: <200902092358.n19Nwchc004002@sheep.berlios.de> <17344772461-BeMail@zon> Message-ID: <499BD98E.7020000@pinc-software.de> Hi J?r?me, J?r?me Duval wrote: > I'm not sure if fActive is the right thing to test for; maybe checking > if the message was for the preferred handler would be better. At least > messages that applications get when they use SetEventHandler() > shouldn't get to the preferred handler, but specifically to the one > that requests those messages. > You probably mean SetEventMask() ? Do you mean this should be handled at > the task_looper() level instead of DispatchMessage() ? Yes, I guess that's how it should be; the standard window handling should probably not interfere (much) when direct targets are used. > 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. Bye, Axel. From nielx at mail.berlios.de Wed Feb 18 12:04:27 2009 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Wed, 18 Feb 2009 12:04:27 +0100 Subject: [Haiku-commits] r29243 - haiku/trunk/docs/user/drivers Message-ID: <200902181104.n1IB4RIi018484@sheep.berlios.de> Author: nielx Date: 2009-02-18 12:04:27 +0100 (Wed, 18 Feb 2009) New Revision: 29243 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29243&view=rev Removed: haiku/trunk/docs/user/drivers/fs_interface.dox haiku/trunk/docs/user/drivers/fs_modules.dox Log: Removing the file system interface documentation for now. This needs to be replaced with a completely new version that accounts for all the new features (including the overlay modules) Deleted: haiku/trunk/docs/user/drivers/fs_interface.dox Deleted: haiku/trunk/docs/user/drivers/fs_modules.dox From mmlr at mail.berlios.de Wed Feb 18 18:52:57 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Wed, 18 Feb 2009 18:52:57 +0100 Subject: [Haiku-commits] r29244 - haiku/trunk/src/system/kernel Message-ID: <200902181752.n1IHqvSh003748@sheep.berlios.de> Author: mmlr Date: 2009-02-18 18:52:51 +0100 (Wed, 18 Feb 2009) New Revision: 29244 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29244&view=rev Modified: haiku/trunk/src/system/kernel/int.c Log: Fix wrong check, thanks Axel :-) Modified: haiku/trunk/src/system/kernel/int.c =================================================================== --- haiku/trunk/src/system/kernel/int.c 2009-02-18 11:04:27 UTC (rev 29243) +++ haiku/trunk/src/system/kernel/int.c 2009-02-18 17:52:51 UTC (rev 29244) @@ -40,7 +40,7 @@ }; struct io_vector { - struct io_handler * handler_list; + struct io_handler *handler_list; spinlock vector_lock; int32 enable_count; bool no_lock_vector; @@ -299,7 +299,7 @@ io->func = handler; io->data = data; io->use_enable_counter = (flags & B_NO_ENABLE_COUNTER) == 0; - io->no_handled_info = (flags & B_NO_HANDLED_INFO) == 0; + io->no_handled_info = (flags & B_NO_HANDLED_INFO) != 0; // Disable the interrupts, get the spinlock for this irq only // and then insert the handler From mmlr at mlotz.ch Wed Feb 18 21:33:39 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Wed, 18 Feb 2009 21:33:39 Subject: [Haiku-commits] r29199 - in haiku/trunk: headers/os/drivers src/add-ons/kernel/file_systems/iso9660 src/system/kernel/fs In-Reply-To: <20090215165815.358.1@knochen-vm.localdomain> Message-ID: <14448352655-BeMail@haiku> > On 2009-02-15 at 15:06:47 [+0100], Michael Lotz wrote: > > > On 2009-02-14 at 21:30:53 [+0100], mmlr at mail.berlios.de wrote: > > > > Author: mmlr > > > > Date: 2009-02-14 21:30:49 +0100 (Sat, 14 Feb 2009) > > > > New Revision: 29199 > > > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29199&view=rev > > > > > > > > Modified: > > > > haiku/trunk/headers/os/drivers/fs_interface.h > > > > haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_ > > > > interface.cpp > > > > haiku/trunk/src/system/kernel/fs/vfs.cpp > > > > Log: > > > > * Adding volume ops to the overlay filesystem. > > > > * Remove the previous method of applying the overlay by flags. > > > > In > > > > the > > > > future the > > > > overlay can just be mounted as a filesystem layer. This is > > > > probably how > > > > layers > > > > were intended to work in the first place. > > > > > > Exactly. Also the new get_vnode() parameter should be > > > superfluous, > > > since > > > vnode cookie and operations of the underlying FS layer are passed > > > to > > > the > > > create_sub_vnode() hook of your layer. > > > > Actually I need it not only for the sub nodes I create. When > > resolving > > the attribute files I need to resolve the parent directory and then > > the > > attribute directory. So I use get_vnode() on the parent and > > attribute > > directory and need to get the vnode ops of them. > > Yep, but those are still nodes of the underlying layer and respective > subnodes are created for your layer. So you could just get the node's > cookie for your layer (by passing your layer's fs_volume to get_ > vnode()) -- > which should contain the underlying layer's cookie and ops (stored by > the > create_sub_vnode() hook). I see that now, but what I don't see is how the get_vnode() call would work. Right now it will always call get_super_vnode() to resolve to the super vnode and return that. Of course I could supply my own fs_volume to that call, but how would I know in get_super_vnode() that I should return my own private node? Because as it is currently, I will always get my own fs_volume in get_super_vnode() due to FS_CALL() resolving and passing the sub-most volume (overlay in that case) anyway. > At least that was how I intended it to work. If you insist on get_ > vnode() > returning the ops, too, I'd prefer a single fs_vnode* parameter, > though. That was my first thought as well and I did make it a fs_vnode. But when later adjusting the file system modules I quickly realized it was pretty impractical to use. As most of the time you just use some pointer, for example residing inside an existing structure, it means adding a fs_vnode to be filled and then extracting the pointer again. That's why I then just made it an additional argument. Regards Michael From julun at mail.berlios.de Wed Feb 18 21:40:12 2009 From: julun at mail.berlios.de (julun at BerliOS) Date: Wed, 18 Feb 2009 21:40:12 +0100 Subject: [Haiku-commits] r29245 - in haiku/vendor/freebsd: . RELENG_7 RELENG_7/dev RELENG_7/dev/e1000 Message-ID: <200902182040.n1IKeCvf015481@sheep.berlios.de> Author: julun Date: 2009-02-18 21:40:07 +0100 (Wed, 18 Feb 2009) New Revision: 29245 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29245&view=rev Added: haiku/vendor/freebsd/RELENG_7/ haiku/vendor/freebsd/RELENG_7/dev/ haiku/vendor/freebsd/RELENG_7/dev/e1000/ haiku/vendor/freebsd/RELENG_7/dev/e1000/LICENSE haiku/vendor/freebsd/RELENG_7/dev/e1000/README haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_80003es2lan.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_80003es2lan.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82540.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82541.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82541.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82542.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82543.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82543.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82571.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82571.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82575.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_82575.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_api.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_api.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_defines.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_hw.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_ich8lan.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_ich8lan.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_mac.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_mac.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_manage.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_manage.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_nvm.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_nvm.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_osdep.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_osdep.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_phy.c haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_phy.h haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_regs.h haiku/vendor/freebsd/RELENG_7/dev/e1000/if_em.c haiku/vendor/freebsd/RELENG_7/dev/e1000/if_em.h haiku/vendor/freebsd/RELENG_7/dev/e1000/if_igb.c haiku/vendor/freebsd/RELENG_7/dev/e1000/if_igb.h Log: * e1000 FreeBSD driver (formerly known as separate em and igb drivers) Added: haiku/vendor/freebsd/RELENG_7/dev/e1000/LICENSE =================================================================== --- haiku/vendor/freebsd/RELENG_7/dev/e1000/LICENSE 2009-02-18 17:52:51 UTC (rev 29244) +++ haiku/vendor/freebsd/RELENG_7/dev/e1000/LICENSE 2009-02-18 20:40:07 UTC (rev 29245) @@ -0,0 +1,31 @@ +$FreeBSD: src/sys/dev/e1000/LICENSE,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $ + + Copyright (c) 2001-2008, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + Added: haiku/vendor/freebsd/RELENG_7/dev/e1000/README =================================================================== --- haiku/vendor/freebsd/RELENG_7/dev/e1000/README 2009-02-18 17:52:51 UTC (rev 29244) +++ haiku/vendor/freebsd/RELENG_7/dev/e1000/README 2009-02-18 20:40:07 UTC (rev 29245) @@ -0,0 +1,405 @@ +$FreeBSD: src/sys/dev/e1000/README,v 1.1.2.1 2008/08/11 18:33:10 jfv Exp $ +FreeBSD* Driver for Intel Network Connection +============================================= + +May 30, 2007 + + +Contents +======== + +- Overview +- Identifying Your Adapter +- Building and Installation +- Speed and Duplex Configuration +- Additional Configurations +- Known Limitations +- Support +- License + + +Overview +======== + +This file describes the FreeBSD* driver for Intel Network Connection. +This driver has been developed for use with FreeBSD, Release 7.x. + +For questions related to hardware requirements, refer to the documentation +supplied with your Gigabit adapter. All hardware requirements listed +apply to use with FreeBSD. + + +Identifying Your Adapter +======================== + +For information on how to identify your adapter, go to the Adapter & +Driver ID Guide at: + +http://support.intel.com/support/network/sb/cs-012904.htm + + +For the latest Intel network drivers for FreeBSD, see: + +http://downloadfinder.intel.com/scripts-df-external/support_intel.aspx + + +NOTE: Mobile adapters are not fully supported. +NOTE: The Intel(R) 82562v 10/100 Network Connection only provides 10/100 +support. + +Building and Installation +========================= + +NOTE: The driver can be installed as a dynamic loadable kernel module or + compiled into the kernel. You must have kernel sources installed in + order to compile the driver module. + +In the instructions below, x.x.x is the driver version as indicated in the +name of the driver tar file. + +1. Move the base driver tar file to the directory of your choice. For + example, use /home/username/em or /usr/local/src/em. + +2. Untar/unzip the archive: + + tar xzvf em-x.x.x.tar.gz + + This will create an em-x.x.x directory. + +3. To create a loadable module, perform the following steps. + NOTE: To compile the driver into the kernel, go directly to step 4. + + a. To compile the module + + cd em-x.x.x + make + + b. To install the compiled module to the system directory: + + make install + + c. If you want the driver to load automatically when the system is booted: + + 1. Edit /boot/loader.conf, and add the following line: + + if_em_load="YES" + +4. To compile the driver into the kernel, enter: + + cd em-x.x.x/src + cp *.[ch] /usr/src/sys/dev/em + + Edit the kernel configuration file (i.e., GENERIC or MYKERNEL) in + /usr/src/sys/i386/conf, and ensure the following line is present: + + device em + + Compile and install the kernel. The system must be rebooted for the + kernel updates to take effect. For additional information on compiling + the kernel, consult the FreeBSD operating system documentation. + +5. To assign an IP address to the interface, enter the following: + + ifconfig em + +6. Verify that the interface works. Enter the following, where + is the IP address for another machine on the same subnet as the interface + that is being tested: + + ping + +7. To configure the IP address to remain after reboot, edit /etc/rc.conf, + and create the appropriate ifconfig_ementry: + + ifconfig_em="" + + Example usage: + + ifconfig_em0="inet 192.168.10.1 netmask 255.255.255.0" + + NOTE: For assistance, see the ifconfig man page. + + +Speed and Duplex Configuration +============================== + +By default, the adapter auto-negotiates the speed and duplex of the +connection. If there is a specific need, the ifconfig utility can be used to +configure the speed and duplex settings on the adapter. Example usage: + + ifconfig em media 100baseTX mediaopt + full-duplex + + NOTE: Only use mediaopt to set the driver to full-duplex. If mediaopt is + not specified and you are not running at gigabit speed, the driver + defaults to half-duplex. + +If the interface is currently forced to 100 full duplex, in order to change +to half duplex you must use this command: + + ifconfig em media 100baseTX -mediaopt + full-duplex + + +This driver supports the following media type options: + + autoselect - Enables auto-negotiation for speed and duplex. + + 10baseT/UTP - Sets speed to 10 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. + + 100baseTX - Sets speed to 100 Mbps. Use the ifconfig mediaopt + option to select full-duplex mode. + + 1000baseTX - Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. + + 1000baseSX - Sets speed to 1000 Mbps. In this case, the driver + supports only full-duplex mode. + +For more information on the ifconfig utility, see the ifconfig man page. + + +Additional Configurations +========================= + +The driver supports Transmit/Receive Checksum Offload and Jumbo Frames on +all but the 82542-based adapters. For specific adapters, refer to the +Identifying Your Adapter section. + + Jumbo Frames + ------------ + To enable Jumbo Frames, use the ifconfig utility to set the Maximum + Transport Unit (MTU) frame size above its default of 1500 bytes. + + The Jumbo Frames MTU range for Intel Adapters is 1500 to 16110. To modify + the setting, enter the following: + + ifconfig em mtu 9000 + + To confirm the MTU used between two specific devices, use: + + route get + + Notes: + + - Only enable Jumbo Frames if your network infrastructure supports them. + + - To enable Jumbo Frames, increase the MTU size on the interface beyond + 1500. + + - The Jumbo Frames setting on the switch must be set to at least 22 bytes + larger than that of the MTU. + + - The maximum MTU setting for Jumbo Frames is 16110. This value coincides + with the maximum Jumbo Frames size of 16128. + + - Some Intel gigabit adapters that support Jumbo Frames have a frame size + limit of 9238 bytes, with a corresponding MTU size limit of 9216 bytes. + The adapters with this limitation are based on the Intel(R) 82571EB, + 82572EI, 82573L, 82566, 82562, and 80003ES2LAN controller. These + correspond to the following product names: + Intel(R) PRO/1000 PT Server Adapter + Intel(R) PRO/1000 PT Desktop Adapter + Intel(R) PRO/1000 PT Network Connection + Intel(R) PRO/1000 PT Dual Port Server Adapter + Intel(R) PRO/1000 PT Dual Port Network Connection + Intel(R) PRO/1000 PT Quad Port Server Adapter + Intel(R) PRO/1000 PF Quad Port Server Adapter + Intel(R) PRO/1000 PF Server Adapter + Intel(R) PRO/1000 PF Network Connection + Intel(R) PRO/1000 PF Dual Port Server Adapter + Intel(R) PRO/1000 PB Server Connection + Intel(R) PRO/1000 PL Network Connection + Intel(R) PRO/1000 EB Network Connection with I/O Acceleration + Intel(R) PRO/1000 EB Backplane Connection with I/O Acceleration + Intel(R) 82566DM-2 Gigabit Network Connection + + - Adapters based on the Intel(R) 82542 and 82573V/E controller do not + support Jumbo Frames. These correspond to the following product names: + Intel(R) PRO/1000 Gigabit Server Adapter + Intel(R) PRO/1000 PM Network Connection + + - Using Jumbo Frames at 10 or 100 Mbps may result in poor performance or + loss of link. + + - The following adapters do not support Jumbo Frames: + Intel(R) 82562V 10/100 Network Connection + Intel(R) 82566DM Gigabit Network Connection + Intel(R) 82566DC Gigabit Network Connection + Intel(R) 82566MM Gigabit Network Connection + Intel(R) 82566MC Gigabit Network Connection + Intel(R) 82562GT 10/100 Network Connection + Intel(R) 82562G 10/100 Network Connection + Intel(R) 82566DC-2 Gigabit Network Connection + Intel(R) 82562V-2 10/100 Network Connection + Intel(R) 82562G-2 10/100 Network Connection + Intel(R) 82562GT-2 10/100 Network Connection + + VLANs + ----- + To create a new VLAN interface: + + ifconfig create + + To associate the VLAN interface with a physical interface and + assign a VLAN ID, IP address, and netmask: + + ifconfig netmask vlan + vlandev + + Example: + + ifconfig vlan10 10.0.0.1 netmask 255.255.255.0 vlan 10 vlandev em0 + + In this example, all packets will be marked on egress with 802.1Q VLAN + tags, specifying a VLAN ID of 10. + + To remove a VLAN interface: + + Intel Network Connection ifconfig destroy + + + Polling + ------- + + To enable polling in the driver, add the following options to the kernel + configuration, and then recompile the kernel: + + options DEVICE_POLLING + options HZ=1000 + + At runtime use: + ifconfig emX polling (to turn polling on) + and: + ifconfig emX -polling (to turn it off) + + + Checksum Offload + ---------------- + Checksum offloading is not supported on 82542 Gigabit adapters. + + Checksum offloading supports both TCP and UDP packets and is + supported for both transmit and receive. + + Checksum offloading can be enabled or disabled using ifconfig. + Both transmit and receive offloading will be either enabled or + disabled together. You cannot enable/disable one without the other. + + To enable checksum offloading: + + ifconfig rxcsum + + To disable checksum offloading: + + ifconfig -rxcsum + + To confirm the current setting: + + ifconfig + + Look for the presence or absence of the following line: + + options=3 + + See the ifconfig man page for further information. + + + TSO + --- + The FreeBSD driver offers support for TSO (TCP Segmentation Offload). + + You can enable/disable it in two ways/places: + + - sysctl net.inet.tcp.tso=0 (or 1 to enable it) + + Doing this disables TSO in the stack and will affect all adapters. + + - ifconfig emX -tso + + Doing this will disable TSO only for this adapter. + + To enable: + + - ifconfig emX tso + + NOTES: By default only PCI-Express adapters are ENABLED to do TSO. Others + can be enabled by the user at their own risk + TSO is not supported on 82547 and 82544-based adapters, as well as older adapters. + + +Known Limitations +================= + + Detected Tx Unit Hang in Quad Port Adapters + ------------------------------------------- + + In some cases ports 3 and 4 wont pass traffic. Ports 1 and 2 don't show + any errors and will pass traffic. + + This issue MAY be resolved by updating to the latest BIOS. You can + check your system's BIOS by downloading the Linux Firmware Developer Kit + that can be obtained at http://www.linuxfirmwarekit.org/ + + + There are known performance issues with this driver when running UDP traffic + with Jumbo Frames. + ---------------------------------------------------------------------------- + + 82541/82547 can't link or is slow to link with some link partners + ----------------------------------------------------------------- + + There is a known compatibility issue where time to link is slow or link is not + established between 82541/82547 controllers and some switches. Known switches + include: + Planex FXG-08TE + I-O Data ETG-SH8 + + The driver can be compiled with the following changes: + + Edit ./em.x.x.x/src/if_em.h to change the #define EM_MASTER_SLAVE + For example, change from: + + #define EM_MASTER_SLAVE e1000_ms_hw_default + to: + #define EM_MASTER_SLAVE 2 + + Use one of the following options: + 1 = Master mode + 2 = Slave mode + 3 = Auto master/slave + Setting 2 is recommended. + + Recompile the module: + a. To compile the module + cd em-x.x.x + make clean + make + + b. To install the compiled module in system directory: + make install + + +Support +======= + +For general information and support, go to the Intel support website at: + + http://support.intel.com + +If an issue is identified, support is through email only at: +freebsdnic at mailbox.intel.com + + +License +======= + +This software program is released under the terms of a license agreement +between you ('Licensee') and Intel. Do not use or load this software or any +associated materials (collectively, the 'Software') until you have carefully +read the full terms and conditions of the LICENSE located in this software +package. By loading or using the Software, you agree to the terms of this +Agreement. If you do not agree with the terms of this Agreement, do not +install or use the Software. + +* Other names and brands may be claimed as the property of others. Added: haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_80003es2lan.c =================================================================== --- haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_80003es2lan.c 2009-02-18 17:52:51 UTC (rev 29244) +++ haiku/vendor/freebsd/RELENG_7/dev/e1000/e1000_80003es2lan.c 2009-02-18 20:40:07 UTC (rev 29245) @@ -0,0 +1,1533 @@ +/****************************************************************************** + + Copyright (c) 2001-2008, Intel Corporation + All rights reserved. + + Redistribution and use in source and binary forms, with or without + modification, are permitted provided that the following conditions are met: + + 1. Redistributions of source code must retain the above copyright notice, + this list of conditions and the following disclaimer. + + 2. Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + + 3. Neither the name of the Intel Corporation nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + + THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + POSSIBILITY OF SUCH DAMAGE. + +******************************************************************************/ +/*$FreeBSD: src/sys/dev/e1000/e1000_80003es2lan.c,v 1.1.2.2 2008/12/01 07:13:52 jfv Exp $*/ + +/* + * 80003ES2LAN Gigabit Ethernet Controller (Copper) + * 80003ES2LAN Gigabit Ethernet Controller (Serdes) + */ + +#include "e1000_api.h" + +static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw); +static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw); +static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw); +static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw); +static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw); +static void e1000_release_phy_80003es2lan(struct e1000_hw *hw); +static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw); +static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw); +static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw); +static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, + u32 offset, + u16 *data); +static s32 e1000_write_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, + u32 offset, + u16 data); +static s32 e1000_write_nvm_80003es2lan(struct e1000_hw *hw, u16 offset, + u16 words, u16 *data); +static s32 e1000_get_cfg_done_80003es2lan(struct e1000_hw *hw); +static s32 e1000_phy_force_speed_duplex_80003es2lan(struct e1000_hw *hw); +static s32 e1000_get_cable_length_80003es2lan(struct e1000_hw *hw); +static s32 e1000_get_link_up_info_80003es2lan(struct e1000_hw *hw, u16 *speed, + u16 *duplex); +static s32 e1000_reset_hw_80003es2lan(struct e1000_hw *hw); +static s32 e1000_init_hw_80003es2lan(struct e1000_hw *hw); +static s32 e1000_setup_copper_link_80003es2lan(struct e1000_hw *hw); +static void e1000_clear_hw_cntrs_80003es2lan(struct e1000_hw *hw); +static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); +static s32 e1000_cfg_kmrn_10_100_80003es2lan(struct e1000_hw *hw, u16 duplex); +static s32 e1000_cfg_kmrn_1000_80003es2lan(struct e1000_hw *hw); +static s32 e1000_cfg_on_link_up_80003es2lan(struct e1000_hw *hw); +static s32 e1000_read_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, + u16 *data); +static s32 e1000_write_kmrn_reg_80003es2lan(struct e1000_hw *hw, u32 offset, + u16 data); +static s32 e1000_copper_link_setup_gg82563_80003es2lan(struct e1000_hw *hw); +static void e1000_initialize_hw_bits_80003es2lan(struct e1000_hw *hw); +static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask); +static s32 e1000_read_mac_addr_80003es2lan(struct e1000_hw *hw); +static void e1000_power_down_phy_copper_80003es2lan(struct e1000_hw *hw); + +/* + * A table for the GG82563 cable length where the range is defined + * with a lower bound at "index" and the upper bound at + * "index + 5". + */ +static const u16 e1000_gg82563_cable_length_table[] = + { 0, 60, 115, 150, 150, 60, 115, 150, 180, 180, 0xFF }; +#define GG82563_CABLE_LENGTH_TABLE_SIZE \ + (sizeof(e1000_gg82563_cable_length_table) / \ + sizeof(e1000_gg82563_cable_length_table[0])) + +/** + * e1000_init_phy_params_80003es2lan - Init ESB2 PHY func ptrs. + * @hw: pointer to the HW structure + **/ +static s32 e1000_init_phy_params_80003es2lan(struct e1000_hw *hw) +{ + struct e1000_phy_info *phy = &hw->phy; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_init_phy_params_80003es2lan"); + + if (hw->phy.media_type != e1000_media_type_copper) { + phy->type = e1000_phy_none; + goto out; + } else { + phy->ops.power_up = e1000_power_up_phy_copper; + phy->ops.power_down = e1000_power_down_phy_copper_80003es2lan; + } + + phy->addr = 1; + phy->autoneg_mask = AUTONEG_ADVERTISE_SPEED_DEFAULT; + phy->reset_delay_us = 100; + phy->type = e1000_phy_gg82563; + + phy->ops.acquire = e1000_acquire_phy_80003es2lan; + phy->ops.check_polarity = e1000_check_polarity_m88; + phy->ops.check_reset_block = e1000_check_reset_block_generic; + phy->ops.commit = e1000_phy_sw_reset_generic; + phy->ops.get_cfg_done = e1000_get_cfg_done_80003es2lan; + phy->ops.get_info = e1000_get_phy_info_m88; + phy->ops.release = e1000_release_phy_80003es2lan; + phy->ops.reset = e1000_phy_hw_reset_generic; + phy->ops.set_d3_lplu_state = e1000_set_d3_lplu_state_generic; + + phy->ops.force_speed_duplex = e1000_phy_force_speed_duplex_80003es2lan; + phy->ops.get_cable_length = e1000_get_cable_length_80003es2lan; + phy->ops.read_reg = e1000_read_phy_reg_gg82563_80003es2lan; + phy->ops.write_reg = e1000_write_phy_reg_gg82563_80003es2lan; + + phy->ops.cfg_on_link_up = e1000_cfg_on_link_up_80003es2lan; + + /* This can only be done after all function pointers are setup. */ + ret_val = e1000_get_phy_id(hw); + + /* Verify phy id */ + if (phy->id != GG82563_E_PHY_ID) { + ret_val = -E1000_ERR_PHY; + goto out; + } + +out: + return ret_val; +} + +/** + * e1000_init_nvm_params_80003es2lan - Init ESB2 NVM func ptrs. + * @hw: pointer to the HW structure + **/ +static s32 e1000_init_nvm_params_80003es2lan(struct e1000_hw *hw) +{ + struct e1000_nvm_info *nvm = &hw->nvm; + u32 eecd = E1000_READ_REG(hw, E1000_EECD); + u16 size; + + DEBUGFUNC("e1000_init_nvm_params_80003es2lan"); + + nvm->opcode_bits = 8; + nvm->delay_usec = 1; + switch (nvm->override) { + case e1000_nvm_override_spi_large: + nvm->page_size = 32; + nvm->address_bits = 16; + break; + case e1000_nvm_override_spi_small: + nvm->page_size = 8; + nvm->address_bits = 8; + break; + default: + nvm->page_size = eecd & E1000_EECD_ADDR_BITS ? 32 : 8; + nvm->address_bits = eecd & E1000_EECD_ADDR_BITS ? 16 : 8; + break; + } + + nvm->type = e1000_nvm_eeprom_spi; + + size = (u16)((eecd & E1000_EECD_SIZE_EX_MASK) >> + E1000_EECD_SIZE_EX_SHIFT); + + /* + * Added to a constant, "size" becomes the left-shift value + * for setting word_size. + */ + size += NVM_WORD_SIZE_BASE_SHIFT; + + /* EEPROM access above 16k is unsupported */ + if (size > 14) + size = 14; + nvm->word_size = 1 << size; + + /* Function Pointers */ + nvm->ops.acquire = e1000_acquire_nvm_80003es2lan; + nvm->ops.read = e1000_read_nvm_eerd; + nvm->ops.release = e1000_release_nvm_80003es2lan; + nvm->ops.update = e1000_update_nvm_checksum_generic; + nvm->ops.valid_led_default = e1000_valid_led_default_generic; + nvm->ops.validate = e1000_validate_nvm_checksum_generic; + nvm->ops.write = e1000_write_nvm_80003es2lan; + + return E1000_SUCCESS; +} + +/** + * e1000_init_mac_params_80003es2lan - Init ESB2 MAC func ptrs. + * @hw: pointer to the HW structure + **/ +static s32 e1000_init_mac_params_80003es2lan(struct e1000_hw *hw) +{ + struct e1000_mac_info *mac = &hw->mac; + s32 ret_val = E1000_SUCCESS; + + DEBUGFUNC("e1000_init_mac_params_80003es2lan"); + + /* Set media type */ + switch (hw->device_id) { + case E1000_DEV_ID_80003ES2LAN_SERDES_DPT: + hw->phy.media_type = e1000_media_type_internal_serdes; + break; + default: + hw->phy.media_type = e1000_media_type_copper; + break; + } + + /* Set mta register count */ + mac->mta_reg_count = 128; + /* Set rar entry count */ + mac->rar_entry_count = E1000_RAR_ENTRIES; + /* Set if part includes ASF firmware */ + mac->asf_firmware_present = TRUE; + /* Set if manageability features are enabled. */ + mac->arc_subsystem_valid = + (E1000_READ_REG(hw, E1000_FWSM) & E1000_FWSM_MODE_MASK) + ? TRUE : FALSE; + + /* Function pointers */ + + /* bus type/speed/width */ + mac->ops.get_bus_info = e1000_get_bus_info_pcie_generic; + /* reset */ + mac->ops.reset_hw = e1000_reset_hw_80003es2lan; + /* hw initialization */ + mac->ops.init_hw = e1000_init_hw_80003es2lan; + /* link setup */ + mac->ops.setup_link = e1000_setup_link_generic; + /* physical interface link setup */ + mac->ops.setup_physical_interface = + (hw->phy.media_type == e1000_media_type_copper) + ? e1000_setup_copper_link_80003es2lan + : e1000_setup_fiber_serdes_link_generic; + /* check for link */ + switch (hw->phy.media_type) { + case e1000_media_type_copper: + mac->ops.check_for_link = e1000_check_for_copper_link_generic; + break; + case e1000_media_type_fiber: + mac->ops.check_for_link = e1000_check_for_fiber_link_generic; + break; + case e1000_media_type_internal_serdes: + mac->ops.check_for_link = e1000_check_for_serdes_link_generic; + break; + default: + ret_val = -E1000_ERR_CONFIG; + goto out; + break; + } + /* check management mode */ + mac->ops.check_mng_mode = e1000_check_mng_mode_generic; + /* multicast address update */ + mac->ops.update_mc_addr_list = e1000_update_mc_addr_list_generic; + /* writing VFTA */ + mac->ops.write_vfta = e1000_write_vfta_generic; + /* clearing VFTA */ + mac->ops.clear_vfta = e1000_clear_vfta_generic; + /* setting MTA */ + mac->ops.mta_set = e1000_mta_set_generic; + /* read mac address */ + mac->ops.read_mac_addr = e1000_read_mac_addr_80003es2lan; + /* blink LED */ + mac->ops.blink_led = e1000_blink_led_generic; + /* setup LED */ + mac->ops.setup_led = e1000_setup_led_generic; + /* cleanup LED */ + mac->ops.cleanup_led = e1000_cleanup_led_generic; + /* turn on/off LED */ + mac->ops.led_on = e1000_led_on_generic; + mac->ops.led_off = e1000_led_off_generic; + /* clear hardware counters */ + mac->ops.clear_hw_cntrs = e1000_clear_hw_cntrs_80003es2lan; + /* link info */ + mac->ops.get_link_up_info = e1000_get_link_up_info_80003es2lan; + +out: + return ret_val; +} + +/** + * e1000_init_function_pointers_80003es2lan - Init ESB2 func ptrs. + * @hw: pointer to the HW structure + * + * Called to initialize all function pointers and parameters. + **/ +void e1000_init_function_pointers_80003es2lan(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_init_function_pointers_80003es2lan"); + + hw->mac.ops.init_params = e1000_init_mac_params_80003es2lan; + hw->nvm.ops.init_params = e1000_init_nvm_params_80003es2lan; + hw->phy.ops.init_params = e1000_init_phy_params_80003es2lan; + e1000_get_bus_info_pcie_generic(hw); +} + +/** + * e1000_acquire_phy_80003es2lan - Acquire rights to access PHY + * @hw: pointer to the HW structure + * + * A wrapper to acquire access rights to the correct PHY. + **/ +static s32 e1000_acquire_phy_80003es2lan(struct e1000_hw *hw) +{ + u16 mask; + + DEBUGFUNC("e1000_acquire_phy_80003es2lan"); + + mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; + return e1000_acquire_swfw_sync_80003es2lan(hw, mask); +} + +/** + * e1000_release_phy_80003es2lan - Release rights to access PHY + * @hw: pointer to the HW structure + * + * A wrapper to release access rights to the correct PHY. + **/ +static void e1000_release_phy_80003es2lan(struct e1000_hw *hw) +{ + u16 mask; + + DEBUGFUNC("e1000_release_phy_80003es2lan"); + + mask = hw->bus.func ? E1000_SWFW_PHY1_SM : E1000_SWFW_PHY0_SM; + e1000_release_swfw_sync_80003es2lan(hw, mask); +} + + +/** + * e1000_acquire_mac_csr_80003es2lan - Acquire rights to access Kumeran register + * @hw: pointer to the HW structure + * + * Acquire the semaphore to access the Kumeran interface. + * + **/ +static s32 e1000_acquire_mac_csr_80003es2lan(struct e1000_hw *hw) +{ + u16 mask; + + DEBUGFUNC("e1000_acquire_mac_csr_80003es2lan"); + + mask = E1000_SWFW_CSR_SM; + + return e1000_acquire_swfw_sync_80003es2lan(hw, mask); +} + +/** + * e1000_release_mac_csr_80003es2lan - Release rights to access Kumeran Register + * @hw: pointer to the HW structure + * + * Release the semaphore used to access the Kumeran interface + **/ +static void e1000_release_mac_csr_80003es2lan(struct e1000_hw *hw) +{ + u16 mask; + + DEBUGFUNC("e1000_release_mac_csr_80003es2lan"); + + mask = E1000_SWFW_CSR_SM; + + e1000_release_swfw_sync_80003es2lan(hw, mask); +} + +/** + * e1000_acquire_nvm_80003es2lan - Acquire rights to access NVM + * @hw: pointer to the HW structure + * + * Acquire the semaphore to access the EEPROM. + **/ +static s32 e1000_acquire_nvm_80003es2lan(struct e1000_hw *hw) +{ + s32 ret_val; + + DEBUGFUNC("e1000_acquire_nvm_80003es2lan"); + + ret_val = e1000_acquire_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); + if (ret_val) + goto out; + + ret_val = e1000_acquire_nvm_generic(hw); + + if (ret_val) + e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); + +out: + return ret_val; +} + +/** + * e1000_release_nvm_80003es2lan - Relinquish rights to access NVM + * @hw: pointer to the HW structure + * + * Release the semaphore used to access the EEPROM. + **/ +static void e1000_release_nvm_80003es2lan(struct e1000_hw *hw) +{ + DEBUGFUNC("e1000_release_nvm_80003es2lan"); + + e1000_release_nvm_generic(hw); + e1000_release_swfw_sync_80003es2lan(hw, E1000_SWFW_EEP_SM); +} + +/** + * e1000_acquire_swfw_sync_80003es2lan - Acquire SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Acquire the SW/FW semaphore to access the PHY or NVM. The mask + * will also specify which port we're acquiring the lock for. + **/ +static s32 e1000_acquire_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + u32 swmask = mask; + u32 fwmask = mask << 16; + s32 ret_val = E1000_SUCCESS; + s32 i = 0, timeout = 50; + + DEBUGFUNC("e1000_acquire_swfw_sync_80003es2lan"); + + while (i < timeout) { + if (e1000_get_hw_semaphore_generic(hw)) { + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + if (!(swfw_sync & (fwmask | swmask))) + break; + + /* + * Firmware currently using resource (fwmask) + * or other software thread using resource (swmask) + */ + e1000_put_hw_semaphore_generic(hw); + msec_delay_irq(5); + i++; + } + + if (i == timeout) { + DEBUGOUT("Driver can't access resource, SW_FW_SYNC timeout.\n"); + ret_val = -E1000_ERR_SWFW_SYNC; + goto out; + } + + swfw_sync |= swmask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); + +out: + return ret_val; +} + +/** + * e1000_release_swfw_sync_80003es2lan - Release SW/FW semaphore + * @hw: pointer to the HW structure + * @mask: specifies which semaphore to acquire + * + * Release the SW/FW semaphore used to access the PHY or NVM. The mask + * will also specify which port we're releasing the lock for. + **/ +static void e1000_release_swfw_sync_80003es2lan(struct e1000_hw *hw, u16 mask) +{ + u32 swfw_sync; + + DEBUGFUNC("e1000_release_swfw_sync_80003es2lan"); + + while (e1000_get_hw_semaphore_generic(hw) != E1000_SUCCESS) + ; /* Empty */ + + swfw_sync = E1000_READ_REG(hw, E1000_SW_FW_SYNC); + swfw_sync &= ~mask; + E1000_WRITE_REG(hw, E1000_SW_FW_SYNC, swfw_sync); + + e1000_put_hw_semaphore_generic(hw); +} + +/** + * e1000_read_phy_reg_gg82563_80003es2lan - Read GG82563 PHY register + * @hw: pointer to the HW structure + * @offset: offset of the register to read + * @data: pointer to the data returned from the operation + * + * Read the GG82563 PHY register. + **/ +static s32 e1000_read_phy_reg_gg82563_80003es2lan(struct e1000_hw *hw, + u32 offset, u16 *data) +{ + s32 ret_val; + u32 page_select; + u16 temp; + + DEBUGFUNC("e1000_read_phy_reg_gg82563_80003es2lan"); + + ret_val = e1000_acquire_phy_80003es2lan(hw); + if (ret_val) + goto out; + + /* Select Configuration Page */ + if ((offset & MAX_PHY_REG_ADDRESS) < GG82563_MIN_ALT_REG) { + page_select = GG82563_PHY_PAGE_SELECT; + } else { + /* + * Use Alternative Page Select register to access + * registers 30 and 31 + */ + page_select = GG82563_PHY_PAGE_SELECT_ALT; + } + + temp = (u16)((u16)offset >> GG82563_PAGE_SHIFT); + ret_val = e1000_write_phy_reg_mdic(hw, page_select, temp); + if (ret_val) { + e1000_release_phy_80003es2lan(hw); + goto out; + } + + /* + * The "ready" bit in the MDIC register may be incorrectly set + * before the device has completed the "Page Select" MDI + * transaction. So we wait 200us after each MDI command... + */ + usec_delay(200); + + /* ...and verify the command was successful. */ + ret_val = e1000_read_phy_reg_mdic(hw, page_select, &temp); + + if (((u16)offset >> GG82563_PAGE_SHIFT) != temp) { + ret_val = -E1000_ERR_PHY; + e1000_release_phy_80003es2lan(hw); [... truncated: 34166 lines follow ...] From julun at mail.berlios.de Wed Feb 18 21:52:02 2009 From: julun at mail.berlios.de (julun at BerliOS) Date: Wed, 18 Feb 2009 21:52:02 +0100 Subject: [Haiku-commits] r29246 - haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev Message-ID: <200902182052.n1IKq2YE017793@sheep.berlios.de> Author: julun Date: 2009-02-18 21:52:02 +0100 (Wed, 18 Feb 2009) New Revision: 29246 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29246&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/ Log: * integrate e1000 FreeBSD driver Copied: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000 (from rev 29245, haiku/vendor/freebsd/RELENG_7/dev/e1000) From ingo_weinhold at gmx.de Wed Feb 18 23:15:58 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 18 Feb 2009 23:15:58 +0100 Subject: [Haiku-commits] r29199 - in haiku/trunk: headers/os/drivers src/add-ons/kernel/file_systems/iso9660 src/system/kernel/fs In-Reply-To: <14448352655-BeMail@haiku> References: <14448352655-BeMail@haiku> Message-ID: <20090218231558.350.1@knochen-vm.localdomain> On 2009-02-18 at 21:33:39 [+0100], Michael Lotz wrote: > > On 2009-02-15 at 15:06:47 [+0100], Michael Lotz wrote: > > > > Exactly. Also the new get_vnode() parameter should be > > > > superfluous, > > > > since > > > > vnode cookie and operations of the underlying FS layer are passed > > > > to > > > > the > > > > create_sub_vnode() hook of your layer. > > > > > > Actually I need it not only for the sub nodes I create. When > > > resolving > > > the attribute files I need to resolve the parent directory and then > > > the > > > attribute directory. So I use get_vnode() on the parent and > > > attribute > > > directory and need to get the vnode ops of them. > > > > Yep, but those are still nodes of the underlying layer and respective > > subnodes are created for your layer. So you could just get the node's > > cookie for your layer (by passing your layer's fs_volume to get_ > > vnode()) -- > > which should contain the underlying layer's cookie and ops (stored by > > the > > create_sub_vnode() hook). > > I see that now, but what I don't see is how the get_vnode() call would > work. Right now it will always call get_super_vnode() to resolve to the > super vnode and return that. Of course I could supply my own fs_volume > to that call, but how would I know in get_super_vnode() that I should > return my own private node? Because as it is currently, I will always > get my own fs_volume in get_super_vnode() due to FS_CALL() resolving > and passing the sub-most volume (overlay in that case) anyway. get_super_vnode() has two fs_volume* parameters. The first one is the usual pointer to the struct for your layer. The second one ("superVolume") is the one specifying the layer for which the fs_vnode is requested. The get_super_vnode() hook of an FS layer implementation should check whether superVolume refers to this layer. If so, it would return its own fs_vnode. If not, if would invoke the get_super_vnode() of the underlying layer, if that hook exists, or directly return the super node, if it doesn't. The only previously existing implementation of the hook, src/system/kernel/fs/fifo.cpp:fifo_get_super_vnode(), does at least the second part. I doesn't have to check superVolume, since FIFO nodes don't belong to any FS layer -- they just sit on top of individual nodes. > > At least that was how I intended it to work. If you insist on get_ > > vnode() > > returning the ops, too, I'd prefer a single fs_vnode* parameter, > > though. > > That was my first thought as well and I did make it a fs_vnode. But > when later adjusting the file system modules I quickly realized it was > pretty impractical to use. As most of the time you just use some > pointer, for example residing inside an existing structure, it means > adding a fs_vnode to be filled and then extracting the pointer again. > That's why I then just made it an additional argument. Yeah, good point. It's still a bit ugly to have parameter that is almost always unused. CU, Ingo From julun at mail.berlios.de Wed Feb 18 23:34:53 2009 From: julun at mail.berlios.de (julun at BerliOS) Date: Wed, 18 Feb 2009 23:34:53 +0100 Subject: [Haiku-commits] r29247 - in haiku/trunk/src: add-ons/kernel/drivers/network/ipro1000/dev add-ons/kernel/drivers/network/ipro1000/dev/e1000 libs/compat/freebsd_network libs/compat/freebsd_network/compat/net Message-ID: <200902182234.n1IMYr0s031355@sheep.berlios.de> Author: julun Date: 2009-02-18 23:34:52 +0100 (Wed, 18 Feb 2009) New Revision: 29247 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29247&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c haiku/trunk/src/libs/compat/freebsd_network/eventhandler.c Modified: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c haiku/trunk/src/libs/compat/freebsd_network/Jamfile haiku/trunk/src/libs/compat/freebsd_network/compat/net/if.h haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h Log: * update freebsd compat with stubbed eventhandler * get e1000 to compile * remove dev/em from the build (might be removed later on) * tested on VirtualBox (gcc2,gcc4), VMware(gcc4) and natively on ThinkPad T500 (gcc4) * courtesy of Michael Weirauch (emwe) Modified: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/Jamfile 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/Jamfile 2009-02-18 22:34:52 UTC (rev 29247) @@ -1,3 +1,3 @@ SubDir HAIKU_TOP src add-ons kernel drivers network ipro1000 dev ; -SubInclude HAIKU_TOP src add-ons kernel drivers network ipro1000 dev em ; +SubInclude HAIKU_TOP src add-ons kernel drivers network ipro1000 dev e1000 ; Added: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/Jamfile 2009-02-18 22:34:52 UTC (rev 29247) @@ -0,0 +1,30 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network ipro1000 dev e1000 ; + +UsePrivateHeaders kernel net ; + +UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ; + +SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 EM_FAST_INTR=1 ] ; + +KernelAddon ipro1000 : + e1000_80003es2lan.c + e1000_82540.c + e1000_82541.c + e1000_82542.c + e1000_82543.c + e1000_82571.c + e1000_82575.c + e1000_api.c + e1000_ich8lan.c + e1000_mac.c + e1000_manage.c + e1000_nvm.c + e1000_osdep.c + e1000_phy.c + if_em.c + + glue.c + : libfreebsd_network.a + ; + Modified: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/e1000_osdep.h 2009-02-18 22:34:52 UTC (rev 29247) @@ -73,9 +73,9 @@ #define STATIC static #define FALSE 0 -#define false FALSE /* shared code stupidity */ +//#define false FALSE /* shared code stupidity */ #define TRUE 1 -#define true TRUE +//#define true TRUE #define CMD_MEM_WRT_INVALIDATE 0x0010 /* BIT_4 */ #define PCI_COMMAND_REGISTER PCIR_COMMAND @@ -91,7 +91,7 @@ typedef int32_t s32; typedef int16_t s16; typedef int8_t s8; -typedef boolean_t bool; +//typedef boolean_t bool; #define __le16 u16 #define __le32 u32 Added: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/glue.c 2009-02-18 22:34:52 UTC (rev 29247) @@ -0,0 +1,13 @@ +#include + +HAIKU_FBSD_DRIVER_GLUE(ipro1000, em, pci) + +NO_HAIKU_CHECK_DISABLE_INTERRUPTS(); +NO_HAIKU_REENABLE_INTERRUPTS(); +NO_HAIKU_FBSD_MII_DRIVER(); + +#ifdef EM_FAST_INTR + HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE); +#else + HAIKU_DRIVER_REQUIREMENTS(0); +#endif Modified: haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/add-ons/kernel/drivers/network/ipro1000/dev/e1000/if_em.c 2009-02-18 22:34:52 UTC (rev 29247) @@ -2703,7 +2703,7 @@ em_allocate_pci_resources(struct adapter *adapter) { device_t dev = adapter->dev; - int val, rid, error = E1000_SUCCESS; + int i, val, rid, error = E1000_SUCCESS; rid = PCIR_BAR(0); adapter->memory = bus_alloc_resource_any(dev, SYS_RES_MEMORY, @@ -2755,7 +2755,7 @@ ** Init the resource arrays ** used by MSIX setup */ - for (int i = 0; i < 3; i++) { + for (i = 0; i < 3; i++) { adapter->rid[i] = i + 1; /* MSI/X RID starts at 1 */ adapter->tag[i] = NULL; adapter->res[i] = NULL; @@ -2853,13 +2853,13 @@ em_allocate_msix(struct adapter *adapter) { device_t dev = adapter->dev; - int error; + int error, i; /* Make sure all interrupts are disabled */ E1000_WRITE_REG(&adapter->hw, E1000_IMC, 0xffffffff); /* First get the resources */ - for (int i = 0; i < adapter->msi; i++) { + for (i = 0; i < adapter->msi; i++) { adapter->res[i] = bus_alloc_resource_any(dev, SYS_RES_IRQ, &adapter->rid[i], RF_ACTIVE); if (adapter->res[i] == NULL) { @@ -2928,6 +2928,7 @@ em_free_pci_resources(struct adapter *adapter) { device_t dev = adapter->dev; + int i; /* Make sure the for loop below runs once */ if (adapter->msi == 0) @@ -2939,7 +2940,7 @@ * in an array we can do the same logic * whether its MSIX or just legacy. */ - for (int i = 0; i < adapter->msi; i++) { + for (i = 0; i < adapter->msi; i++) { if (adapter->tag[i] != NULL) { bus_teardown_intr(dev, adapter->res[i], adapter->tag[i]); @@ -3357,7 +3358,7 @@ { device_t dev = adapter->dev; struct em_buffer *tx_buffer; - int error; + int error, i; /* * Create DMA tags for tx descriptors @@ -3391,7 +3392,7 @@ } /* Create the descriptor buffer dma maps */ - for (int i = 0; i < adapter->num_tx_desc; i++) { + for (i = 0; i < adapter->num_tx_desc; i++) { tx_buffer = &adapter->tx_buffer_area[i]; error = bus_dmamap_create(adapter->txtag, 0, &tx_buffer->map); if (error != 0) { @@ -3416,13 +3417,14 @@ em_setup_transmit_structures(struct adapter *adapter) { struct em_buffer *tx_buffer; + int i; /* Clear the old ring contents */ bzero(adapter->tx_desc_base, (sizeof(struct e1000_tx_desc)) * adapter->num_tx_desc); /* Free any existing TX buffers */ - for (int i = 0; i < adapter->num_tx_desc; i++, tx_buffer++) { + for (i = 0; i < adapter->num_tx_desc; i++, tx_buffer++) { tx_buffer = &adapter->tx_buffer_area[i]; bus_dmamap_sync(adapter->txtag, tx_buffer->map, BUS_DMASYNC_POSTWRITE); @@ -3542,11 +3544,12 @@ em_free_transmit_structures(struct adapter *adapter) { struct em_buffer *tx_buffer; + int i; INIT_DEBUGOUT("free_transmit_structures: begin"); if (adapter->tx_buffer_area != NULL) { - for (int i = 0; i < adapter->num_tx_desc; i++) { + for (i = 0; i < adapter->num_tx_desc; i++) { tx_buffer = &adapter->tx_buffer_area[i]; if (tx_buffer->m_head != NULL) { bus_dmamap_sync(adapter->txtag, tx_buffer->map, @@ -4199,6 +4202,7 @@ struct ifnet *ifp = adapter->ifp; u64 bus_addr; u32 rctl, rxcsum; + int i; INIT_DEBUGOUT("em_initialize_receive_unit: begin"); @@ -4224,7 +4228,7 @@ ** using the EITR register (82574 only) */ if (adapter->msix) - for (int i = 0; i < 4; i++) + for (i = 0; i < 4; i++) E1000_WRITE_REG(&adapter->hw, E1000_EITR_82574(i), DEFAULT_ITR); @@ -4375,7 +4379,7 @@ static int em_rxeof(struct adapter *adapter, int count) { - struct ifnet *ifp = adapter->ifp;; + struct ifnet *ifp = adapter->ifp; struct mbuf *mp; u8 status, accept_frame = 0, eop = 0; u16 len, desc_len, prev_len_adj; Modified: haiku/trunk/src/libs/compat/freebsd_network/Jamfile =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/Jamfile 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/libs/compat/freebsd_network/Jamfile 2009-02-18 22:34:52 UTC (rev 29247) @@ -15,6 +15,7 @@ compat.c device.c driver.c + eventhandler.c fbsd_busdma_x86.c fbsd_ether.c fbsd_if_media.c Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/net/if.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/net/if.h 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/net/if.h 2009-02-18 22:34:52 UTC (rev 29247) @@ -26,6 +26,7 @@ #define IFCAP_POLLING 0x0040 /* driver supports polling */ #define IFCAP_VLAN_HWCSUM 0x0080 #define IFCAP_TSO4 0x0100 /* supports TCP segmentation offload */ +#define IFCAP_VLAN_HWFILTER 0x10000 /* interface hw can filter vlan tag */ #define IFCAP_HWCSUM (IFCAP_RXCSUM | IFCAP_TXCSUM) Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_var.h 2009-02-18 22:34:52 UTC (rev 29247) @@ -137,7 +137,7 @@ struct bpf_if *if_bpf; /* packet filter structure */ u_short if_index; /* numeric abbreviation for this if */ short if_timer; /* time 'til if_watchdog called */ - u_short if_nvlans; /* number of active vlans */ + struct ifvlantrunk *if_vlantrunk; /* pointer to 802.1q data */ int if_flags; /* up/down, broadcast, etc. */ int if_capabilities; /* interface capabilities */ int if_capenable; /* enabled features */ Added: haiku/trunk/src/libs/compat/freebsd_network/eventhandler.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/eventhandler.c 2009-02-18 20:52:02 UTC (rev 29246) +++ haiku/trunk/src/libs/compat/freebsd_network/eventhandler.c 2009-02-18 22:34:52 UTC (rev 29247) @@ -0,0 +1,40 @@ +/* + * Copyright 2009, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Weirauch, dev at m-phasis.de + */ + +#include + +#include + +eventhandler_tag +eventhandler_register(struct eventhandler_list *list, + const char *name, void *func, void *arg, int priority) +{ + return NULL; +}; + + +void +eventhandler_deregister(struct eventhandler_list *list, + eventhandler_tag tag) +{ + // +}; + + +struct eventhandler_list * +eventhandler_find_list(const char *name) +{ + return NULL; +}; + + +void +eventhandler_prune_list(struct eventhandler_list *list) +{ + // +}; From mmlr at mail.berlios.de Thu Feb 19 02:16:11 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 02:16:11 +0100 Subject: [Haiku-commits] r29248 - in haiku/trunk: headers/os/drivers src/system/kernel/fs Message-ID: <200902190116.n1J1GBTB000729@sheep.berlios.de> Author: mmlr Date: 2009-02-19 02:16:07 +0100 (Thu, 19 Feb 2009) New Revision: 29248 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29248&view=rev Modified: haiku/trunk/headers/os/drivers/fs_interface.h haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Add a new fs_volume op all_layers_mounted() that is called when all layers have been mounted. This is to allow layered filesystems to setup internal data that requires all the sub/super volumes to be available. Modified: haiku/trunk/headers/os/drivers/fs_interface.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_interface.h 2009-02-18 22:34:52 UTC (rev 29247) +++ haiku/trunk/headers/os/drivers/fs_interface.h 2009-02-19 01:16:07 UTC (rev 29248) @@ -107,6 +107,7 @@ status_t (*rewind_query)(fs_volume *volume, void *cookie); /* support for FS layers */ + status_t (*all_layers_mounted)(fs_volume *volume); status_t (*create_sub_vnode)(fs_volume *volume, ino_t id, fs_vnode *vnode); status_t (*delete_sub_vnode)(fs_volume *volume, fs_vnode *vnode); }; Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-18 22:34:52 UTC (rev 29247) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-19 01:16:07 UTC (rev 29248) @@ -7023,6 +7023,13 @@ volume = volume->super_volume; } + + volume = mount->volume; + while (volume) { + if (volume->ops->all_layers_mounted != NULL) + volume->ops->all_layers_mounted(volume); + volume = volume->super_volume; + } } // the root node is supposed to be owned by the file system - it must From mmlr at mail.berlios.de Thu Feb 19 02:20:12 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 02:20:12 +0100 Subject: [Haiku-commits] r29249 - haiku/trunk/src/add-ons/kernel/file_systems/overlay Message-ID: <200902190120.n1J1KCfL001347@sheep.berlios.de> Author: mmlr Date: 2009-02-19 02:20:10 +0100 (Thu, 19 Feb 2009) New Revision: 29249 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29249&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp Log: * Add preliminary write support to the overlay filesystem when the underlying fs is read-only. Not yet fully working, also directory operations like file creation/removal are yet missing. * Add notifications for stat and attribute changes. Modified: haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp 2009-02-19 01:16:07 UTC (rev 29248) +++ haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp 2009-02-19 01:20:10 UTC (rev 29249) @@ -40,31 +40,75 @@ class AttributeEntry; +struct open_cookie { + int open_mode; + void * super_cookie; +}; + +struct write_buffer { + write_buffer * next; + off_t position; + size_t length; + uint8 buffer[1]; +}; + struct attribute_dir_cookie { AttributeFile * file; uint32 index; }; +class OverlayVolume { +public: + OverlayVolume(fs_volume *volume); + ~OverlayVolume(); + + status_t AllLayersMounted(); + + fs_volume * SuperVolume() { return fVolume->super_volume; } + + bool WriteSupport() { return fWriteSupport; } + +private: + fs_volume * fVolume; + bool fWriteSupport; +}; + + class OverlayInode { public: - OverlayInode(fs_volume *superVolume, - fs_vnode *superVnode); + OverlayInode(OverlayVolume *volume, + fs_vnode *superVnode, ino_t inodeNumber); ~OverlayInode(); status_t InitCheck(); - fs_volume * SuperVolume() { return fSuperVolume; } + fs_volume * SuperVolume() { return fVolume->SuperVolume(); } fs_vnode * SuperVnode() { return &fSuperVnode; } + ino_t InodeNumber() { return fInodeNumber; } status_t GetAttributeFile(AttributeFile **attributeFile); status_t WriteAttributeFile(); + status_t ReadStat(struct stat *stat); + + status_t Open(int openMode, void **cookie); + status_t Close(void *cookie); + status_t FreeCookie(void *cookie); + status_t Read(void *cookie, off_t position, void *buffer, + size_t *length); + status_t Write(void *cookie, off_t position, + const void *buffer, size_t *length); + private: - fs_volume * fSuperVolume; + OverlayVolume * fVolume; fs_vnode fSuperVnode; + ino_t fInodeNumber; AttributeFile * fAttributeFile; - bool fAttributeFileMissing; + write_buffer * fWriteBuffers; + off_t fOriginalNodeLength; + off_t fCurrentNodeLength; + time_t fModificationTime; }; @@ -172,14 +216,46 @@ }; +// #pragma mark OverlayVolume + + +OverlayVolume::OverlayVolume(fs_volume *volume) + : fVolume(volume), + fWriteSupport(false) +{ +} + + +OverlayVolume::~OverlayVolume() +{ +} + + +status_t +OverlayVolume::AllLayersMounted() +{ + fs_info info; + fs_volume *superVolume = fVolume->super_volume; + if (superVolume->ops->read_fs_info != NULL + && superVolume->ops->read_fs_info(superVolume, &info) == B_OK) + fWriteSupport = (info.flags & B_FS_IS_READONLY) != 0; + + return B_OK; +} + + // #pragma mark OverlayInode -OverlayInode::OverlayInode(fs_volume *superVolume, fs_vnode *superVnode) - : fSuperVolume(superVolume), +OverlayInode::OverlayInode(OverlayVolume *volume, fs_vnode *superVnode, + ino_t inodeNumber) + : fVolume(volume), fSuperVnode(*superVnode), + fInodeNumber(inodeNumber), fAttributeFile(NULL), - fAttributeFileMissing(false) + fWriteBuffers(NULL), + fOriginalNodeLength(-1), + fCurrentNodeLength(-1) { TRACE("inode created\n"); } @@ -189,6 +265,13 @@ { TRACE("inode destroyed\n"); delete fAttributeFile; + + write_buffer *element = fWriteBuffers; + while (element) { + write_buffer *next = element->next; + free(element); + element = next; + } } @@ -203,7 +286,7 @@ OverlayInode::GetAttributeFile(AttributeFile **attributeFile) { if (fAttributeFile == NULL) { - fAttributeFile = new(std::nothrow) AttributeFile(fSuperVolume, + fAttributeFile = new(std::nothrow) AttributeFile(SuperVolume(), &fSuperVnode); if (fAttributeFile == NULL) { TRACE_ALWAYS("no memory to allocate attribute file\n"); @@ -238,10 +321,235 @@ if (result != B_OK) return result; - return fAttributeFile->WriteAttributeFile(fSuperVolume, &fSuperVnode); + return fAttributeFile->WriteAttributeFile(SuperVolume(), &fSuperVnode); } +status_t +OverlayInode::ReadStat(struct stat *stat) +{ + if (fSuperVnode.ops->read_stat == NULL) + return B_UNSUPPORTED; + + status_t result = fSuperVnode.ops->read_stat(SuperVolume(), &fSuperVnode, + stat); + if (result != B_OK) + return result; + + if (fVolume->WriteSupport() && fCurrentNodeLength >= 0) { + stat->st_size = fCurrentNodeLength; + stat->st_blocks = (stat->st_size + stat->st_blksize - 1) + / stat->st_blksize; + stat->st_mtime = fModificationTime; + } + + return B_OK; +} + + +status_t +OverlayInode::Open(int openMode, void **_cookie) +{ + if (fSuperVnode.ops->open == NULL) + return B_UNSUPPORTED; + + if (fVolume->WriteSupport()) { + open_cookie *cookie = (open_cookie *)malloc(sizeof(open_cookie)); + if (cookie == NULL) + return B_NO_MEMORY; + + if (fOriginalNodeLength < 0) { + struct stat stat; + status_t result = fSuperVnode.ops->read_stat(SuperVolume(), + &fSuperVnode, &stat); + if (result != B_OK) + return result; + + fOriginalNodeLength = stat.st_size; + fCurrentNodeLength = stat.st_size; + fModificationTime = stat.st_mtime; + } + + cookie->open_mode = openMode; + *_cookie = cookie; + + if (openMode & O_TRUNC) + fCurrentNodeLength = 0; + + openMode &= ~(O_RDWR | O_WRONLY | O_TRUNC | O_CREAT); + return fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, openMode, + &cookie->super_cookie); + } + + return fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, openMode, + _cookie); +} + + +status_t +OverlayInode::Close(void *_cookie) +{ + if (fVolume->WriteSupport()) { + open_cookie *cookie = (open_cookie *)_cookie; + return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, + cookie->super_cookie); + } + + return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, _cookie); +} + + +status_t +OverlayInode::FreeCookie(void *_cookie) +{ + if (fVolume->WriteSupport()) { + open_cookie *cookie = (open_cookie *)_cookie; + status_t result = fSuperVnode.ops->free_cookie(SuperVolume(), + &fSuperVnode, cookie->super_cookie); + free(cookie); + return result; + } + + return fSuperVnode.ops->free_cookie(SuperVolume(), &fSuperVnode, _cookie); +} + + +status_t +OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length) +{ + if (fVolume->WriteSupport()) { + if (position < fOriginalNodeLength) { + open_cookie *cookie = (open_cookie *)_cookie; + size_t readLength = MIN(fOriginalNodeLength - position, *length); + status_t result = fSuperVnode.ops->read(SuperVolume(), &fSuperVnode, + cookie->super_cookie, position, buffer, &readLength); + if (result != B_OK) + return result; + } + + // overlay the read with whatever chunks we have written + write_buffer *element = fWriteBuffers; + *length = MIN(fCurrentNodeLength - position, *length); + off_t end = position + *length; + while (element) { + off_t elementEnd = element->position + element->length; + if (elementEnd > position && element->position < end) { + off_t copyPosition = MAX(position, element->position); + size_t copyLength = MIN(elementEnd - position, *length); + memcpy((uint8 *)buffer + (copyPosition - position), + element->buffer + (copyPosition - element->position), + copyLength); + } + + element = element->next; + } + + return B_OK; + } + + return fSuperVnode.ops->read(SuperVolume(), &fSuperVnode, _cookie, + position, buffer, length); +} + + +status_t +OverlayInode::Write(void *_cookie, off_t position, const void *buffer, + size_t *length) +{ + if (fVolume->WriteSupport()) { + // find insertion point + write_buffer **link = &fWriteBuffers; + write_buffer *other = fWriteBuffers; + write_buffer *swallow = NULL; + off_t newPosition = position; + size_t newLength = *length; + uint32 swallowCount = 0; + + while (other) { + off_t newEnd = newPosition + newLength; + off_t otherEnd = other->position + other->length; + if (otherEnd < newPosition) { + // other completely before us + link = &other->next; + other = other->next; + continue; + } + + if (other->position > newEnd) { + // other is completely past us + break; + } + + swallowCount++; + if (swallow == NULL) + swallow = other; + + if (other->position <= newPosition) { + // other chunk overlaps us or is adjacent + if (otherEnd < newEnd) { + // extend the chunk to completely overlap us + newPosition = other->position; + newLength = other->length + (newEnd - otherEnd); + } else { + // other chunk completely overlaps us already + } + + other = other->next; + continue; + } + + // we overlap the other chunk - swallow it + if (otherEnd > newEnd) + newLength += otherEnd - newEnd; + + other = other->next; + } + + write_buffer *element = (write_buffer *)malloc(sizeof(write_buffer) - 1 + + newLength); + if (element == NULL) + return B_NO_MEMORY; + + element->next = *link; + element->position = newPosition; + element->length = newLength; + *link = element; + + bool sizeChanged = false; + off_t newEnd = newPosition + newLength; + if (newEnd > fCurrentNodeLength) { + fCurrentNodeLength = newEnd; + sizeChanged = true; + } + + // populate the buffer with the existing chunks + if (swallowCount > 0) { + while (swallowCount-- > 0) { + off_t swallowEnd = swallow->position + swallow->length; + if (swallow->position < position || swallowEnd > newEnd) { + memcpy(element->buffer + (swallow->position - newPosition), + swallow->buffer, swallow->length); + } + + element->next = swallow->next; + free(swallow); + } + } + + memcpy(element->buffer + (position - newPosition), buffer, *length); + + fModificationTime = time(NULL); + notify_stat_changed(SuperVolume()->id, fInodeNumber, + B_STAT_MODIFICATION_TIME | (sizeChanged ? B_STAT_SIZE : 0)); + + return B_OK; + } + + return fSuperVnode.ops->write(SuperVolume(), &fSuperVnode, _cookie, + position, buffer, length); +} + + // #pragma mark AttributeFile @@ -696,6 +1004,7 @@ else delete entry; + notify_attribute_changed(fVolumeID, fFileInode, name, B_ATTR_REMOVED); return B_OK; } @@ -717,6 +1026,10 @@ fEntries = newEntries; fEntries[fFile->entry_count++] = entry; + + notify_attribute_changed(fVolumeID, fFileInode, entry->Name(), + B_ATTR_CREATED); + return B_OK; } @@ -903,6 +1216,8 @@ } memcpy(fData + position, buffer, *length); + notify_attribute_changed(fParent->VolumeID(), fParent->FileInode(), + fEntry->name, B_ATTR_CHANGED); return B_OK; } @@ -1170,8 +1485,7 @@ static status_t overlay_read_stat(fs_volume *volume, fs_vnode *vnode, struct stat *stat) { - OVERLAY_CALL(read_stat, stat) - return B_UNSUPPORTED; + return ((OverlayInode *)vnode->private_node)->ReadStat(stat); } @@ -1196,24 +1510,21 @@ static status_t overlay_open(fs_volume *volume, fs_vnode *vnode, int openMode, void **cookie) { - OVERLAY_CALL(open, openMode, cookie) - return B_UNSUPPORTED; + return ((OverlayInode *)vnode->private_node)->Open(openMode, cookie); } static status_t overlay_close(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(close, cookie) - return B_UNSUPPORTED; + return ((OverlayInode *)vnode->private_node)->Close(cookie); } static status_t overlay_free_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(free_cookie, cookie) - return B_UNSUPPORTED; + return ((OverlayInode *)vnode->private_node)->FreeCookie(cookie); } @@ -1221,8 +1532,8 @@ overlay_read(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, void *buffer, size_t *length) { - OVERLAY_CALL(read, cookie, pos, buffer, length) - return B_UNSUPPORTED; + return ((OverlayInode *)vnode->private_node)->Read(cookie, pos, buffer, + length); } @@ -1230,8 +1541,8 @@ overlay_write(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const void *buffer, size_t *length) { - OVERLAY_CALL(write, cookie, pos, buffer, length) - return B_UNSUPPORTED; + return ((OverlayInode *)vnode->private_node)->Write(cookie, pos, buffer, + length); } @@ -1616,9 +1927,13 @@ overlay_unmount(fs_volume *volume) { TRACE_VOLUME("relaying volume op: unmount\n"); - if (volume->super_volume->ops->unmount != NULL) - return volume->super_volume->ops->unmount(volume->super_volume); - return B_UNSUPPORTED; + if (volume->super_volume != NULL + && volume->super_volume->ops != NULL + && volume->super_volume->ops->unmount != NULL) + volume->super_volume->ops->unmount(volume->super_volume); + + delete (OverlayVolume *)volume->private_volume; + return B_OK; } @@ -1633,7 +1948,10 @@ if (result != B_OK) return result; - info->flags |= B_FS_HAS_MIME | B_FS_HAS_ATTR | B_FS_HAS_QUERY; + OverlayVolume *overlayVolume = (OverlayVolume *)volume->private_volume; + if (overlayVolume->WriteSupport()) + info->flags &= ~B_FS_IS_READONLY; + info->flags |= B_FS_HAS_MIME | B_FS_HAS_ATTR /*| B_FS_HAS_QUERY*/; return B_OK; } @@ -1672,7 +1990,7 @@ return status; OverlayInode *node = new(std::nothrow) OverlayInode( - volume->super_volume, vnode); + (OverlayVolume *)volume->private_volume, vnode, id); if (node == NULL) { vnode->ops->put_vnode(volume->super_volume, vnode, reenter); return B_NO_MEMORY; @@ -1802,10 +2120,17 @@ static status_t +overlay_all_layers_mounted(fs_volume *volume) +{ + return ((OverlayVolume *)volume->private_volume)->AllLayersMounted(); +} + + +static status_t overlay_create_sub_vnode(fs_volume *volume, ino_t id, fs_vnode *vnode) { - OverlayInode *node = new(std::nothrow) OverlayInode(volume->super_volume, - vnode); + OverlayInode *node = new(std::nothrow) OverlayInode( + (OverlayVolume *)volume->private_volume, vnode, id); if (node == NULL) return B_NO_MEMORY; @@ -1853,6 +2178,7 @@ &overlay_read_query, &overlay_rewind_query, + &overlay_all_layers_mounted, &overlay_create_sub_vnode, &overlay_delete_sub_vnode }; @@ -1866,6 +2192,10 @@ const char *args, ino_t *rootID) { TRACE_VOLUME("mounting overlay\n"); + volume->private_volume = new(std::nothrow) OverlayVolume(volume); + if (volume->private_volume == NULL) + return B_NO_MEMORY; + volume->ops = &sOverlayVolumeOps; return B_OK; } From mmlr at mail.berlios.de Thu Feb 19 19:13:19 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 19:13:19 +0100 Subject: [Haiku-commits] r29250 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/add-ons/kernel/file_systems/bfs src/add-ons/kernel/file_systems/cdda src/add-ons/kernel/file_systems/ext2 src/add-ons/kernel/file_systems/fat src/add-ons/kernel/file_systems/iso9660 src/add-ons/kernel/file_systems/nfs src/add-ons/kernel/file_systems/overlay src/add-ons/kernel/file_systems/reiserfs src/system/kernel/device_manager src/system/kernel/fs src/tools/fs_shell Message-ID: <200902191813.n1JIDJCA023012@sheep.berlios.de> Author: mmlr Date: 2009-02-19 19:13:01 +0100 (Thu, 19 Feb 2009) New Revision: 29250 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29250&view=rev Modified: haiku/trunk/headers/os/drivers/fs_interface.h haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Volume.cpp haiku/trunk/src/system/kernel/device_manager/devfs.cpp haiku/trunk/src/system/kernel/fs/rootfs.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/tools/fs_shell/vfs.cpp Log: Remove the additional fs_vnode_ops arugment from get_vnode() again as it's not needed at all when used as intended. Thanks Ingo for the explanation on how this is intended to work. Adjusted the overlay fs accordingly and updated/reverted the changes to the other filesystems. Modified: haiku/trunk/headers/os/drivers/fs_interface.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_interface.h 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/headers/os/drivers/fs_interface.h 2009-02-19 18:13:01 UTC (rev 29250) @@ -310,7 +310,7 @@ void *privateNode, fs_vnode_ops *ops, int type, uint32 flags); extern status_t get_vnode(fs_volume *volume, ino_t vnodeID, - void **_privateNode, fs_vnode_ops **_vnodeOps); + void **_privateNode); extern status_t put_vnode(fs_volume *volume, ino_t vnodeID); extern status_t acquire_vnode(fs_volume *volume, ino_t vnodeID); extern status_t remove_vnode(fs_volume *volume, ino_t vnodeID); Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h 2009-02-19 18:13:01 UTC (rev 29250) @@ -344,8 +344,7 @@ fssh_vnode_id vnodeID, void *privateNode, fssh_fs_vnode_ops *ops, int type, uint32_t flags); extern fssh_status_t fssh_get_vnode(fssh_fs_volume *volume, - fssh_vnode_id vnodeID, void **_privateNode, - fssh_fs_vnode_ops **_vnodeOps); + fssh_vnode_id vnodeID, void **_privateNode); extern fssh_status_t fssh_put_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID); extern fssh_status_t fssh_acquire_vnode(fssh_fs_volume *volume, Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -2701,7 +2701,7 @@ // if you haven't yet access to the attributes directory, get it if (fAttributes == NULL) { if (get_vnode(volume->FSVolume(), volume->ToVnode(fInode->Attributes()), - (void**)&fAttributes, NULL) != B_OK) { + (void**)&fAttributes) != B_OK) { FATAL(("get_vnode() failed in AttributeIterator::GetNext(ino_t" " = %Ld,name = \"%s\")\n", fInode->ID(), name)); return B_ENTRY_NOT_FOUND; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.h 2009-02-19 18:13:01 UTC (rev 29250) @@ -354,8 +354,7 @@ { Unset(); - return fStatus = get_vnode(volume->FSVolume(), id, (void**)&fInode, - NULL); + return fStatus = get_vnode(volume->FSVolume(), id, (void**)&fInode); } status_t SetTo(Volume* volume, block_run run) Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -556,7 +556,7 @@ locker.Unlock(); Inode* inode; - status = get_vnode(volume->FSVolume(), *_vnodeID, (void**)&inode, NULL); + status = get_vnode(volume->FSVolume(), *_vnodeID, (void**)&inode); if (status != B_OK) { REPORT_ERROR(status); return B_ENTRY_NOT_FOUND; Modified: haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/cdda/kernel_interface.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -1493,7 +1493,7 @@ if (inode == NULL) return B_ENTRY_NOT_FOUND; - status = get_vnode(volume->FSVolume(), inode->ID(), NULL, NULL); + status = get_vnode(volume->FSVolume(), inode->ID(), NULL); if (status < B_OK) return status; Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -310,7 +310,7 @@ if ((fBlockCache = opener.InitCache(NumBlocks(), fBlockSize)) == NULL) return B_ERROR; - status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode, NULL); + status = get_vnode(fFSVolume, EXT2_ROOT_NODE, (void**)&fRootNode); if (status != B_OK) { TRACE("could not create root node: get_vnode() failed!\n"); return status; Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -319,7 +319,7 @@ break; } - return get_vnode(volume->FSVolume(), *_vnodeID, NULL, NULL); + return get_vnode(volume->FSVolume(), *_vnodeID, NULL); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/fat/dir.c 2009-02-19 18:13:01 UTC (rev 29250) @@ -433,7 +433,7 @@ if (vnid) *vnid = found_vnid; if (node) - result = get_vnode(vol->volume, found_vnid, (void **)node, NULL); + result = get_vnode(vol->volume, found_vnid, (void **)node); result = B_OK; } else { result = ENOENT; Modified: haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/fat/file.c 2009-02-19 18:13:01 UTC (rev 29250) @@ -890,7 +890,7 @@ *vnid = dummy.vnid; dummy.magic = ~VNODE_MAGIC; - result = get_vnode(_vol, *vnid, (void **)&file, NULL); + result = get_vnode(_vol, *vnid, (void **)&file); if (result < B_OK) { if (vol->fs_flags & FS_FLAGS_OP_SYNC) _dosfs_sync(vol); @@ -1155,7 +1155,7 @@ if (vnid == vol->root_vnode.vnid) break; - result = get_vnode(_vol, vnid, (void **)&dir, NULL); + result = get_vnode(_vol, vnid, (void **)&dir); if (result < B_OK) goto bi1; parent = dir->dir_vnid; Modified: haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/iso9660/kernel_interface.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -225,12 +225,12 @@ // base directory TRACE(("fs_walk - found \".\" file.\n")); *_vnodeID = baseNode->id; - return get_vnode(_vol, *_vnodeID, NULL, NULL); + return get_vnode(_vol, *_vnodeID, NULL); } else if (strcmp(file, "..") == 0) { // parent directory TRACE(("fs_walk - found \"..\" file.\n")); *_vnodeID = baseNode->parID; - return get_vnode(_vol, *_vnodeID, NULL, NULL); + return get_vnode(_vol, *_vnodeID, NULL); } // look up file in the directory @@ -273,7 +273,7 @@ TRACE(("fs_walk - New vnode id is %Ld\n", *_vnodeID)); result = get_vnode(_vol, *_vnodeID, - (void **)&newNode, NULL); + (void **)&newNode); if (result == B_OK) { newNode->parID = baseNode->id; done = true; Modified: haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/nfs/nfs_add_on.c 2009-02-19 18:13:01 UTC (rev 29250) @@ -898,7 +898,7 @@ isLink=S_ISLNK(st.st_mode); } - if ((result=get_vnode (_volume,*vnid,(void **)&dummy,NULL))super_volume; } bool WriteSupport() { return fWriteSupport; } @@ -83,6 +84,7 @@ status_t InitCheck(); + fs_volume * Volume() { return fVolume->Volume(); } fs_volume * SuperVolume() { return fVolume->SuperVolume(); } fs_vnode * SuperVnode() { return &fSuperVnode; } ino_t InodeNumber() { return fInodeNumber; } @@ -114,7 +116,8 @@ class AttributeFile { public: - AttributeFile(fs_volume *volume, fs_vnode *vnode); + AttributeFile(fs_volume *overlay, fs_volume *volume, + fs_vnode *vnode); ~AttributeFile(); status_t InitCheck() { return fStatus; } @@ -123,8 +126,8 @@ ino_t FileInode() { return fFileInode; } status_t CreateEmpty(); - status_t WriteAttributeFile(fs_volume *volume, - fs_vnode *vnode); + status_t WriteAttributeFile(fs_volume *overlay, + fs_volume *volume, fs_vnode *vnode); status_t ReadAttributeDir(struct dirent *dirent, size_t bufferSize, uint32 *numEntries, @@ -286,8 +289,8 @@ OverlayInode::GetAttributeFile(AttributeFile **attributeFile) { if (fAttributeFile == NULL) { - fAttributeFile = new(std::nothrow) AttributeFile(SuperVolume(), - &fSuperVnode); + fAttributeFile = new(std::nothrow) AttributeFile(Volume(), + SuperVolume(), &fSuperVnode); if (fAttributeFile == NULL) { TRACE_ALWAYS("no memory to allocate attribute file\n"); return B_NO_MEMORY; @@ -321,7 +324,8 @@ if (result != B_OK) return result; - return fAttributeFile->WriteAttributeFile(SuperVolume(), &fSuperVnode); + return fAttributeFile->WriteAttributeFile(Volume(), SuperVolume(), + &fSuperVnode); } @@ -553,7 +557,8 @@ // #pragma mark AttributeFile -AttributeFile::AttributeFile(fs_volume *volume, fs_vnode *vnode) +AttributeFile::AttributeFile(fs_volume *overlay, fs_volume *volume, + fs_vnode *vnode) : fStatus(B_NO_INIT), fVolumeID(volume->id), fFileInode(0), @@ -633,13 +638,14 @@ else if (i == 2) fAttributeFileInode = inodeNumber; - fStatus = get_vnode(volume, inodeNumber, ¤tVnode.private_node, - ¤tVnode.ops); + OverlayInode *overlayInode = NULL; + fStatus = get_vnode(overlay, inodeNumber, (void **)&overlayInode); if (fStatus != B_OK) { TRACE_ALWAYS("getting vnode failed: %s\n", strerror(fStatus)); return; } + currentVnode = *overlayInode->SuperVnode(); lastInodeNumber = inodeNumber; } @@ -767,7 +773,8 @@ status_t -AttributeFile::WriteAttributeFile(fs_volume *volume, fs_vnode *vnode) +AttributeFile::WriteAttributeFile(fs_volume *overlay, fs_volume *volume, + fs_vnode *vnode) { if (fFile == NULL) return B_NO_INIT; @@ -787,15 +794,17 @@ } fs_vnode currentVnode; + OverlayInode *overlayInode = NULL; if (fAttributeDirInode == 0) { - result = get_vnode(volume, fDirectoryInode, - ¤tVnode.private_node, ¤tVnode.ops); + result = get_vnode(overlay, fDirectoryInode, (void **)&overlayInode); if (result != B_OK) { TRACE_ALWAYS("failed to get directory vnode: %s\n", strerror(result)); return result; } + currentVnode = *overlayInode->SuperVnode(); + // create the attribute directory result = currentVnode.ops->create_dir(volume, ¤tVnode, ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME, S_IRWXU | S_IRWXG | S_IRWXO, @@ -813,14 +822,15 @@ void *attrFileCookie = NULL; if (fAttributeFileInode == 0) { - result = get_vnode(volume, fAttributeDirInode, - ¤tVnode.private_node, ¤tVnode.ops); + result = get_vnode(overlay, fAttributeDirInode, (void **)&overlayInode); if (result != B_OK) { TRACE_ALWAYS("failed to get attribute directory vnode: %s\n", strerror(result)); return result; } + currentVnode = *overlayInode->SuperVnode(); + // create the attribute file result = currentVnode.ops->create(volume, ¤tVnode, nameBuffer, O_RDWR | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP @@ -835,22 +845,24 @@ return result; } - result = get_vnode(volume, fAttributeFileInode, - ¤tVnode.private_node, ¤tVnode.ops); + result = get_vnode(overlay, fAttributeFileInode, (void **)&overlayInode); if (result != B_OK) { TRACE_ALWAYS("getting attribute file vnode after create failed: %s\n", strerror(result)); return result; } + + currentVnode = *overlayInode->SuperVnode(); } else { - result = get_vnode(volume, fAttributeFileInode, - ¤tVnode.private_node, ¤tVnode.ops); + result = get_vnode(overlay, fAttributeFileInode, (void **)&overlayInode); if (result != B_OK) { TRACE_ALWAYS("getting attribute file vnode failed: %s\n", strerror(result)); return result; } + currentVnode = *overlayInode->SuperVnode(); + // open the attribute file result = currentVnode.ops->open(volume, ¤tVnode, O_RDWR | O_TRUNC, &attrFileCookie); @@ -1296,6 +1308,11 @@ overlay_get_super_vnode(fs_volume *volume, fs_vnode *vnode, fs_volume *superVolume, fs_vnode *_superVnode) { + if (volume == superVolume) { + *_superVnode = *vnode; + return B_OK; + } + OverlayInode *node = (OverlayInode *)vnode->private_node; fs_vnode *superVnode = node->SuperVnode(); Modified: haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Volume.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/add-ons/kernel/file_systems/reiserfs/Volume.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -294,7 +294,7 @@ status_t Volume::GetVNode(ino_t id, VNode **node) { - return get_vnode(GetFSVolume(), id, (void**)node, NULL); + return get_vnode(GetFSVolume(), id, (void**)node); } // PutVNode Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -407,8 +407,7 @@ // increase reference count of raw device - // the partition device really needs it - status = get_vnode(fs->volume, device->id, (void**)&partition->raw_device, - NULL); + status = get_vnode(fs->volume, device->id, (void**)&partition->raw_device); if (status < B_OK) goto err1; @@ -959,7 +958,7 @@ return B_ENTRY_NOT_FOUND; } - status = get_vnode(fs->volume, vnode->id, NULL, NULL); + status = get_vnode(fs->volume, vnode->id, NULL); if (status < B_OK) return status; @@ -1063,7 +1062,7 @@ if (openMode & O_EXCL) return B_FILE_EXISTS; - status = get_vnode(fs->volume, vnode->id, NULL, NULL); + status = get_vnode(fs->volume, vnode->id, NULL); if (status < B_OK) return status; @@ -2092,7 +2091,7 @@ { devfs_vnode* node; status_t status = get_vnode(sDeviceFileSystem->volume, device->ID(), - (void**)&node, NULL); + (void**)&node); if (status != B_OK) return status; Modified: haiku/trunk/src/system/kernel/fs/rootfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/rootfs.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/system/kernel/fs/rootfs.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -284,7 +284,7 @@ { // schedule this vnode to be removed when it's ref goes to zero - bool gotNode = (get_vnode(fs->volume, vnode->id, NULL, NULL) == B_OK); + bool gotNode = (get_vnode(fs->volume, vnode->id, NULL) == B_OK); status_t status = B_OK; if (gotNode) @@ -447,7 +447,7 @@ goto err; } - status = get_vnode(fs->volume, vnode->id, NULL, NULL); + status = get_vnode(fs->volume, vnode->id, NULL); if (status < B_OK) goto err; Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -3626,8 +3626,7 @@ extern "C" status_t -get_vnode(fs_volume *volume, ino_t vnodeID, void **_privateNode, - fs_vnode_ops **_vnodeOps) +get_vnode(fs_volume *volume, ino_t vnodeID, void **_privateNode) { struct vnode *vnode; @@ -3653,14 +3652,8 @@ if (_privateNode != NULL) *_privateNode = resolvedNode.private_node; - if (_vnodeOps != NULL) - *_vnodeOps = resolvedNode.ops; - } else { - if (_privateNode != NULL) - *_privateNode = vnode->private_node; - if (_vnodeOps != NULL) - *_vnodeOps = vnode->ops; - } + } else if (_privateNode != NULL) + *_privateNode = vnode->private_node; return B_OK; } @@ -4054,7 +4047,7 @@ } // Use get_vnode() to resolve the cookie for the right layer. - status = get_vnode(volume, vnode->id, _node, NULL); + status = get_vnode(volume, vnode->id, _node); put_vnode(vnode); return status; Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/vfs.cpp 2009-02-19 01:20:10 UTC (rev 29249) +++ haiku/trunk/src/tools/fs_shell/vfs.cpp 2009-02-19 18:13:01 UTC (rev 29250) @@ -1986,7 +1986,7 @@ extern "C" fssh_status_t fssh_get_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID, - void **privateNode, fssh_fs_vnode_ops **vnodeOps) + void **privateNode) { struct vnode *vnode; @@ -2012,14 +2012,8 @@ if (privateNode != NULL) *privateNode = resolvedNode.private_node; - if (vnodeOps != NULL) - *vnodeOps = resolvedNode.ops; - } else { - if (privateNode != NULL) - *privateNode = vnode->private_node; - if (vnodeOps != NULL) - *vnodeOps = vnode->ops; - } + } else if (privateNode != NULL) + *privateNode = vnode->private_node; return FSSH_B_OK; } @@ -2451,7 +2445,7 @@ } // Use get_vnode() to resolve the cookie for the right layer. - status = ::fssh_get_vnode(volume, vnode->id, _node, NULL); + status = ::fssh_get_vnode(volume, vnode->id, _node); put_vnode(vnode); return FSSH_B_OK; From axeld at pinc-software.de Thu Feb 19 20:50:36 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Thu, 19 Feb 2009 20:50:36 +0100 Subject: [Haiku-commits] r29249 - haiku/trunk/src/add-ons/kernel/file_systems/overlay In-Reply-To: <200902190120.n1J1KCfL001347@sheep.berlios.de> References: <200902190120.n1J1KCfL001347@sheep.berlios.de> Message-ID: <499DB80C.6060207@pinc-software.de> mmlr at mail.berlios.de wrote: > Log: > * Add preliminary write support to the overlay filesystem when the underlying > fs is read-only. Not yet fully working, also directory operations like file > creation/removal are yet missing. I don't really like the direction this is taking; the idea of the layers is that you can have more than just one - ie. there is no need for one layer to provide all the (eventually) missing functionality. Rather, I think there should be several layers, each providing just one kind of functionality. Bye, Axel. From revol at free.fr Thu Feb 19 20:56:48 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Thu, 19 Feb 2009 20:56:48 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29249_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/file=5Fsystems/overlay?= In-Reply-To: <499DB80C.6060207@pinc-software.de> Message-ID: <5405057164-BeMail@laptop> > mmlr at mail.berlios.de wrote: > > Log: > > * Add preliminary write support to the overlay filesystem when the > > underlying > > fs is read-only. Not yet fully working, also directory operations > > like file > > creation/removal are yet missing. > > I don't really like the direction this is taking; the idea of the > layers > is that you can have more than just one - ie. there is no need for > one > layer to provide all the (eventually) missing functionality. > > Rather, I think there should be several layers, each providing just > one > kind of functionality. > +1 also, this seems to make CDs writable with isvolume I was told... Fran?ois. From mmlr at mail.berlios.de Thu Feb 19 21:03:07 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 21:03:07 +0100 Subject: [Haiku-commits] r29251 - haiku/trunk/src/add-ons/kernel/file_systems/overlay Message-ID: <200902192003.n1JK37d8016132@sheep.berlios.de> Author: mmlr Date: 2009-02-19 21:03:05 +0100 (Thu, 19 Feb 2009) New Revision: 29251 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29251&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp Log: * Fix missing initialization of the entry size on SetSize() that'd cause some attribute writes to not be visible. * Don't read past the current node size when emulating write support. * Fix writing calculations so that writing actually works as intended. * Actually follow the linked list when joining write_buffers instead of using the same pointer that becomes invalid after the first iteration. * Small optimizations. Modified: haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp 2009-02-19 18:13:01 UTC (rev 29250) +++ haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp 2009-02-19 20:03:05 UTC (rev 29251) @@ -422,6 +422,11 @@ OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length) { if (fVolume->WriteSupport()) { + if (position >= fCurrentNodeLength) { + *length = 0; + return B_OK; + } + if (position < fOriginalNodeLength) { open_cookie *cookie = (open_cookie *)_cookie; size_t readLength = MIN(fOriginalNodeLength - position, *length); @@ -436,8 +441,11 @@ *length = MIN(fCurrentNodeLength - position, *length); off_t end = position + *length; while (element) { + if (element->position > end) + break; + off_t elementEnd = element->position + element->length; - if (elementEnd > position && element->position < end) { + if (elementEnd > position) { off_t copyPosition = MAX(position, element->position); size_t copyLength = MIN(elementEnd - position, *length); memcpy((uint8 *)buffer + (copyPosition - position), @@ -473,7 +481,7 @@ off_t newEnd = newPosition + newLength; off_t otherEnd = other->position + other->length; if (otherEnd < newPosition) { - // other completely before us + // other is completely before us link = &other->next; other = other->next; continue; @@ -489,20 +497,21 @@ swallow = other; if (other->position <= newPosition) { - // other chunk overlaps us or is adjacent - if (otherEnd < newEnd) { - // extend the chunk to completely overlap us - newPosition = other->position; - newLength = other->length + (newEnd - otherEnd); - } else { - // other chunk completely overlaps us already + if (swallowCount == 1 && otherEnd >= newEnd) { + // other chunk completely covers us, just copy + memcpy(other->buffer + (newPosition - other->position), + buffer, *length); + + fModificationTime = time(NULL); + notify_stat_changed(SuperVolume()->id, fInodeNumber, + B_STAT_MODIFICATION_TIME); + return B_OK; } - other = other->next; - continue; + newLength += newPosition - other->position; + newPosition = other->position; } - // we overlap the other chunk - swallow it if (otherEnd > newEnd) newLength += otherEnd - newEnd; @@ -529,14 +538,12 @@ // populate the buffer with the existing chunks if (swallowCount > 0) { while (swallowCount-- > 0) { - off_t swallowEnd = swallow->position + swallow->length; - if (swallow->position < position || swallowEnd > newEnd) { - memcpy(element->buffer + (swallow->position - newPosition), - swallow->buffer, swallow->length); - } + memcpy(element->buffer + (swallow->position - newPosition), + swallow->buffer, swallow->length); element->next = swallow->next; free(swallow); + swallow = element->next; } } @@ -1148,6 +1155,7 @@ } memcpy(newData, fData, min_c(fEntry->size, size)); + fEntry->size = size; fAllocatedData = true; fData = newData; return B_OK; From mmlr at mlotz.ch Thu Feb 19 21:18:54 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Thu, 19 Feb 2009 21:18:54 Subject: [Haiku-commits] r29249 - haiku/trunk/src/add-ons/kernel/file_systems/overlay In-Reply-To: <5405057164-BeMail@laptop> Message-ID: <6035180693-BeMail@haiku> > > mmlr at mail.berlios.de wrote: > > > Log: > > > * Add preliminary write support to the overlay filesystem when > > > the > > > underlying > > > fs is read-only. Not yet fully working, also directory > > > operations > > > like file > > > creation/removal are yet missing. > > > > I don't really like the direction this is taking; the idea of the > > layers > > is that you can have more than just one - ie. there is no need for > > one > > layer to provide all the (eventually) missing functionality. > > > > Rather, I think there should be several layers, each providing just > > one > > kind of functionality. Please don't worry. I'm currently just prototyping it into this one layer. I intended to split it up when it was reasonably working and then also rename/move the layer. But I guess I can do that just as well now. > also, this seems to make CDs writable with isvolume I was told... It obviously does, yes. It's intended for the live CD mode later on. Determining whether or not to start the installer should later be done based on the persistance of the storage instead of read-only. Regards Michael From mmu_man at mail.berlios.de Thu Feb 19 21:28:43 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 19 Feb 2009 21:28:43 +0100 Subject: [Haiku-commits] r29252 - in haiku/trunk/docs/welcome: . en Message-ID: <200902192028.n1JKShxx021160@sheep.berlios.de> Author: mmu_man Date: 2009-02-19 21:28:43 +0100 (Thu, 19 Feb 2009) New Revision: 29252 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29252&view=rev Modified: haiku/trunk/docs/welcome/en/bugreports.html haiku/trunk/docs/welcome/welcome.html Log: Test setting mime type property to text/html. It should help previewing the html from trac or at least the normal svnweb as I tested elsewhere. Property changes on: haiku/trunk/docs/welcome/en/bugreports.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/welcome/welcome.html ___________________________________________________________________ Name: svn:mime-type + text/html From mmlr at mail.berlios.de Thu Feb 19 21:30:53 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 21:30:53 +0100 Subject: [Haiku-commits] r29253 - in haiku/trunk/src/add-ons/kernel/file_systems: . layers layers/attribute_overlay layers/write_overlay Message-ID: <200902192030.n1JKUr85021740@sheep.berlios.de> Author: mmlr Date: 2009-02-19 21:30:51 +0100 (Thu, 19 Feb 2009) New Revision: 29253 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29253&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/layers/ haiku/trunk/src/add-ons/kernel/file_systems/layers/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/ haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/ haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp Modified: haiku/trunk/src/add-ons/kernel/file_systems/Jamfile Log: Preparing to split the overlay filesystem into an attribute_overlay and write_overlay module. Modified: haiku/trunk/src/add-ons/kernel/file_systems/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/Jamfile 2009-02-19 20:28:43 UTC (rev 29252) +++ haiku/trunk/src/add-ons/kernel/file_systems/Jamfile 2009-02-19 20:30:51 UTC (rev 29253) @@ -7,10 +7,11 @@ SubInclude HAIKU_TOP src add-ons kernel file_systems googlefs ; SubInclude HAIKU_TOP src add-ons kernel file_systems iso9660 ; SubInclude HAIKU_TOP src add-ons kernel file_systems nfs ; -SubInclude HAIKU_TOP src add-ons kernel file_systems overlay ; SubInclude HAIKU_TOP src add-ons kernel file_systems ramfs ; SubInclude HAIKU_TOP src add-ons kernel file_systems udf ; SubInclude HAIKU_TOP src add-ons kernel file_systems userlandfs ; SubIncludeGPL HAIKU_TOP src add-ons kernel file_systems ntfs ; SubIncludeGPL HAIKU_TOP src add-ons kernel file_systems reiserfs ; + +SubInclude HAIKU_TOP src add-ons kernel file_systems layers ; Added: haiku/trunk/src/add-ons/kernel/file_systems/layers/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/Jamfile 2009-02-19 20:28:43 UTC (rev 29252) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/Jamfile 2009-02-19 20:30:51 UTC (rev 29253) @@ -0,0 +1,4 @@ +SubDir HAIKU_TOP src add-ons kernel file_systems layers ; + +SubInclude HAIKU_TOP src add-ons kernel file_systems layers attribute_overlay ; +SubInclude HAIKU_TOP src add-ons kernel file_systems layers write_overlay ; Added: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/Jamfile 2009-02-19 20:28:43 UTC (rev 29252) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/Jamfile 2009-02-19 20:30:51 UTC (rev 29253) @@ -0,0 +1,7 @@ +SubDir HAIKU_TOP src add-ons kernel file_systems layers attribute_overlay ; + +UsePrivateKernelHeaders ; + +KernelAddon attribute_overlay : + attribute_overlay.cpp + ; Copied: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp (from rev 29251, haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp) Added: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/Jamfile 2009-02-19 20:28:43 UTC (rev 29252) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/Jamfile 2009-02-19 20:30:51 UTC (rev 29253) @@ -0,0 +1,7 @@ +SubDir HAIKU_TOP src add-ons kernel file_systems layers write_overlay ; + +UsePrivateKernelHeaders ; + +KernelAddon write_overlay : + write_overlay.cpp + ; Copied: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp (from rev 29251, haiku/trunk/src/add-ons/kernel/file_systems/overlay/overlay.cpp) From mmu_man at mail.berlios.de Thu Feb 19 22:05:17 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 19 Feb 2009 22:05:17 +0100 Subject: [Haiku-commits] r29254 - haiku/trunk/docs Message-ID: <200902192105.n1JL5HxE026223@sheep.berlios.de> Author: mmu_man Date: 2009-02-19 22:05:17 +0100 (Thu, 19 Feb 2009) New Revision: 29254 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29254&view=rev Modified: haiku/trunk/docs/Haiku-doc.css Log: Set mime on the css (hmm not sure it's a good idea to use mixed case to name this!). The pages are viewable from http://svn.berlios.de/wsvn/haiku/haiku/trunk/docs/welcome/welcome.html for ex. though TracBrowser doesn't seem to care. Property changes on: haiku/trunk/docs/Haiku-doc.css ___________________________________________________________________ Name: svn:mime-type + text/css From mmlr at mail.berlios.de Thu Feb 19 22:12:01 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 22:12:01 +0100 Subject: [Haiku-commits] r29255 - in haiku/trunk/src/add-ons/kernel/file_systems/layers: attribute_overlay write_overlay Message-ID: <200902192112.n1JLC1W5027143@sheep.berlios.de> Author: mmlr Date: 2009-02-19 22:11:59 +0100 (Thu, 19 Feb 2009) New Revision: 29255 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29255&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp Log: Split overlay filesystem into attribute_overlay and write_overlay. Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp 2009-02-19 21:05:17 UTC (rev 29254) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp 2009-02-19 21:11:59 UTC (rev 29255) @@ -34,24 +34,12 @@ #endif -namespace overlay { +namespace attribute_overlay { class AttributeFile; class AttributeEntry; -struct open_cookie { - int open_mode; - void * super_cookie; -}; - -struct write_buffer { - write_buffer * next; - off_t position; - size_t length; - uint8 buffer[1]; -}; - struct attribute_dir_cookie { AttributeFile * file; uint32 index; @@ -63,16 +51,11 @@ OverlayVolume(fs_volume *volume); ~OverlayVolume(); - status_t AllLayersMounted(); - fs_volume * Volume() { return fVolume; } fs_volume * SuperVolume() { return fVolume->super_volume; } - bool WriteSupport() { return fWriteSupport; } - private: fs_volume * fVolume; - bool fWriteSupport; }; @@ -92,25 +75,11 @@ status_t GetAttributeFile(AttributeFile **attributeFile); status_t WriteAttributeFile(); - status_t ReadStat(struct stat *stat); - - status_t Open(int openMode, void **cookie); - status_t Close(void *cookie); - status_t FreeCookie(void *cookie); - status_t Read(void *cookie, off_t position, void *buffer, - size_t *length); - status_t Write(void *cookie, off_t position, - const void *buffer, size_t *length); - private: OverlayVolume * fVolume; fs_vnode fSuperVnode; ino_t fInodeNumber; AttributeFile * fAttributeFile; - write_buffer * fWriteBuffers; - off_t fOriginalNodeLength; - off_t fCurrentNodeLength; - time_t fModificationTime; }; @@ -223,8 +192,7 @@ OverlayVolume::OverlayVolume(fs_volume *volume) - : fVolume(volume), - fWriteSupport(false) + : fVolume(volume) { } @@ -234,19 +202,6 @@ } -status_t -OverlayVolume::AllLayersMounted() -{ - fs_info info; - fs_volume *superVolume = fVolume->super_volume; - if (superVolume->ops->read_fs_info != NULL - && superVolume->ops->read_fs_info(superVolume, &info) == B_OK) - fWriteSupport = (info.flags & B_FS_IS_READONLY) != 0; - - return B_OK; -} - - // #pragma mark OverlayInode @@ -255,10 +210,7 @@ : fVolume(volume), fSuperVnode(*superVnode), fInodeNumber(inodeNumber), - fAttributeFile(NULL), - fWriteBuffers(NULL), - fOriginalNodeLength(-1), - fCurrentNodeLength(-1) + fAttributeFile(NULL) { TRACE("inode created\n"); } @@ -268,13 +220,6 @@ { TRACE("inode destroyed\n"); delete fAttributeFile; - - write_buffer *element = fWriteBuffers; - while (element) { - write_buffer *next = element->next; - free(element); - element = next; - } } @@ -329,238 +274,6 @@ } -status_t -OverlayInode::ReadStat(struct stat *stat) -{ - if (fSuperVnode.ops->read_stat == NULL) - return B_UNSUPPORTED; - - status_t result = fSuperVnode.ops->read_stat(SuperVolume(), &fSuperVnode, - stat); - if (result != B_OK) - return result; - - if (fVolume->WriteSupport() && fCurrentNodeLength >= 0) { - stat->st_size = fCurrentNodeLength; - stat->st_blocks = (stat->st_size + stat->st_blksize - 1) - / stat->st_blksize; - stat->st_mtime = fModificationTime; - } - - return B_OK; -} - - -status_t -OverlayInode::Open(int openMode, void **_cookie) -{ - if (fSuperVnode.ops->open == NULL) - return B_UNSUPPORTED; - - if (fVolume->WriteSupport()) { - open_cookie *cookie = (open_cookie *)malloc(sizeof(open_cookie)); - if (cookie == NULL) - return B_NO_MEMORY; - - if (fOriginalNodeLength < 0) { - struct stat stat; - status_t result = fSuperVnode.ops->read_stat(SuperVolume(), - &fSuperVnode, &stat); - if (result != B_OK) - return result; - - fOriginalNodeLength = stat.st_size; - fCurrentNodeLength = stat.st_size; - fModificationTime = stat.st_mtime; - } - - cookie->open_mode = openMode; - *_cookie = cookie; - - if (openMode & O_TRUNC) - fCurrentNodeLength = 0; - - openMode &= ~(O_RDWR | O_WRONLY | O_TRUNC | O_CREAT); - return fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, openMode, - &cookie->super_cookie); - } - - return fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, openMode, - _cookie); -} - - -status_t -OverlayInode::Close(void *_cookie) -{ - if (fVolume->WriteSupport()) { - open_cookie *cookie = (open_cookie *)_cookie; - return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, - cookie->super_cookie); - } - - return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, _cookie); -} - - -status_t -OverlayInode::FreeCookie(void *_cookie) -{ - if (fVolume->WriteSupport()) { - open_cookie *cookie = (open_cookie *)_cookie; - status_t result = fSuperVnode.ops->free_cookie(SuperVolume(), - &fSuperVnode, cookie->super_cookie); - free(cookie); - return result; - } - - return fSuperVnode.ops->free_cookie(SuperVolume(), &fSuperVnode, _cookie); -} - - -status_t -OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length) -{ - if (fVolume->WriteSupport()) { - if (position >= fCurrentNodeLength) { - *length = 0; - return B_OK; - } - - if (position < fOriginalNodeLength) { - open_cookie *cookie = (open_cookie *)_cookie; - size_t readLength = MIN(fOriginalNodeLength - position, *length); - status_t result = fSuperVnode.ops->read(SuperVolume(), &fSuperVnode, - cookie->super_cookie, position, buffer, &readLength); - if (result != B_OK) - return result; - } - - // overlay the read with whatever chunks we have written - write_buffer *element = fWriteBuffers; - *length = MIN(fCurrentNodeLength - position, *length); - off_t end = position + *length; - while (element) { - if (element->position > end) - break; - - off_t elementEnd = element->position + element->length; - if (elementEnd > position) { - off_t copyPosition = MAX(position, element->position); - size_t copyLength = MIN(elementEnd - position, *length); - memcpy((uint8 *)buffer + (copyPosition - position), - element->buffer + (copyPosition - element->position), - copyLength); - } - - element = element->next; - } - - return B_OK; - } - - return fSuperVnode.ops->read(SuperVolume(), &fSuperVnode, _cookie, - position, buffer, length); -} - - -status_t -OverlayInode::Write(void *_cookie, off_t position, const void *buffer, - size_t *length) -{ - if (fVolume->WriteSupport()) { - // find insertion point - write_buffer **link = &fWriteBuffers; - write_buffer *other = fWriteBuffers; - write_buffer *swallow = NULL; - off_t newPosition = position; - size_t newLength = *length; - uint32 swallowCount = 0; - - while (other) { - off_t newEnd = newPosition + newLength; - off_t otherEnd = other->position + other->length; - if (otherEnd < newPosition) { - // other is completely before us - link = &other->next; - other = other->next; - continue; - } - - if (other->position > newEnd) { - // other is completely past us - break; - } - - swallowCount++; - if (swallow == NULL) - swallow = other; - - if (other->position <= newPosition) { - if (swallowCount == 1 && otherEnd >= newEnd) { - // other chunk completely covers us, just copy - memcpy(other->buffer + (newPosition - other->position), - buffer, *length); - - fModificationTime = time(NULL); - notify_stat_changed(SuperVolume()->id, fInodeNumber, - B_STAT_MODIFICATION_TIME); - return B_OK; - } - - newLength += newPosition - other->position; - newPosition = other->position; - } - - if (otherEnd > newEnd) - newLength += otherEnd - newEnd; - - other = other->next; - } - - write_buffer *element = (write_buffer *)malloc(sizeof(write_buffer) - 1 - + newLength); - if (element == NULL) - return B_NO_MEMORY; - - element->next = *link; - element->position = newPosition; - element->length = newLength; - *link = element; - - bool sizeChanged = false; - off_t newEnd = newPosition + newLength; - if (newEnd > fCurrentNodeLength) { - fCurrentNodeLength = newEnd; - sizeChanged = true; - } - - // populate the buffer with the existing chunks - if (swallowCount > 0) { - while (swallowCount-- > 0) { - memcpy(element->buffer + (swallow->position - newPosition), - swallow->buffer, swallow->length); - - element->next = swallow->next; - free(swallow); - swallow = element->next; - } - } - - memcpy(element->buffer + (position - newPosition), buffer, *length); - - fModificationTime = time(NULL); - notify_stat_changed(SuperVolume()->id, fInodeNumber, - B_STAT_MODIFICATION_TIME | (sizeChanged ? B_STAT_SIZE : 0)); - - return B_OK; - } - - return fSuperVnode.ops->write(SuperVolume(), &fSuperVnode, _cookie, - position, buffer, length); -} - - // #pragma mark AttributeFile @@ -1510,7 +1223,8 @@ static status_t overlay_read_stat(fs_volume *volume, fs_vnode *vnode, struct stat *stat) { - return ((OverlayInode *)vnode->private_node)->ReadStat(stat); + OVERLAY_CALL(read_stat, stat) + return B_UNSUPPORTED; } @@ -1535,21 +1249,24 @@ static status_t overlay_open(fs_volume *volume, fs_vnode *vnode, int openMode, void **cookie) { - return ((OverlayInode *)vnode->private_node)->Open(openMode, cookie); + OVERLAY_CALL(open, openMode, cookie) + return B_UNSUPPORTED; } static status_t overlay_close(fs_volume *volume, fs_vnode *vnode, void *cookie) { - return ((OverlayInode *)vnode->private_node)->Close(cookie); + OVERLAY_CALL(close, cookie) + return B_UNSUPPORTED; } static status_t overlay_free_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie) { - return ((OverlayInode *)vnode->private_node)->FreeCookie(cookie); + OVERLAY_CALL(free_cookie, cookie) + return B_UNSUPPORTED; } @@ -1557,8 +1274,8 @@ overlay_read(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, void *buffer, size_t *length) { - return ((OverlayInode *)vnode->private_node)->Read(cookie, pos, buffer, - length); + OVERLAY_CALL(read, cookie, pos, buffer, length) + return B_UNSUPPORTED; } @@ -1566,8 +1283,8 @@ overlay_write(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const void *buffer, size_t *length) { - return ((OverlayInode *)vnode->private_node)->Write(cookie, pos, buffer, - length); + OVERLAY_CALL(write, cookie, pos, buffer, length) + return B_UNSUPPORTED; } @@ -1759,8 +1476,7 @@ void *buffer, size_t *length) { OVERLAY_CALL(read_attr, cookie, pos, buffer, length) - AttributeEntry *entry = (AttributeEntry *)cookie; - return entry->Read(pos, buffer, length); + return ((AttributeEntry *)cookie)->Read(pos, buffer, length); } @@ -1769,8 +1485,7 @@ const void *buffer, size_t *length) { OVERLAY_CALL(write_attr, cookie, pos, buffer, length) - AttributeEntry *entry = (AttributeEntry *)cookie; - return entry->Write(pos, buffer, length); + return ((AttributeEntry *)cookie)->Write(pos, buffer, length); } @@ -1779,8 +1494,7 @@ struct stat *stat) { OVERLAY_CALL(read_attr_stat, cookie, stat) - AttributeEntry *entry = (AttributeEntry *)cookie; - return entry->ReadStat(stat); + return ((AttributeEntry *)cookie)->ReadStat(stat); } @@ -1789,8 +1503,7 @@ const struct stat *stat, int statMask) { OVERLAY_CALL(write_attr_stat, cookie, stat, statMask) - AttributeEntry *entry = (AttributeEntry *)cookie; - return entry->WriteStat(stat, statMask); + return ((AttributeEntry *)cookie)->WriteStat(stat, statMask); } @@ -1973,9 +1686,6 @@ if (result != B_OK) return result; - OverlayVolume *overlayVolume = (OverlayVolume *)volume->private_volume; - if (overlayVolume->WriteSupport()) - info->flags &= ~B_FS_IS_READONLY; info->flags |= B_FS_HAS_MIME | B_FS_HAS_ATTR /*| B_FS_HAS_QUERY*/; return B_OK; } @@ -2147,7 +1857,7 @@ static status_t overlay_all_layers_mounted(fs_volume *volume) { - return ((OverlayVolume *)volume->private_volume)->AllLayersMounted(); + return B_OK; } @@ -2241,14 +1951,14 @@ static file_system_module_info sOverlayFileSystem = { { - "file_systems/overlay"B_CURRENT_FS_API_VERSION, + "file_systems/attribute_overlay"B_CURRENT_FS_API_VERSION, 0, overlay_std_ops, }, - "overlay", // short_name - "Overlay File System", // pretty_name - 0, // DDM flags + "attribute_overlay", // short_name + "Attribute Overlay File System", // pretty_name + 0, // DDM flags // scanning NULL, // identify_partition @@ -2281,9 +1991,9 @@ NULL // initialize }; -} // namespace _overlay +} // namespace attribute_overlay -using namespace overlay; +using namespace attribute_overlay; module_info *modules[] = { (module_info *)&sOverlayFileSystem, Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-19 21:05:17 UTC (rev 29254) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-19 21:11:59 UTC (rev 29255) @@ -34,12 +34,8 @@ #endif -namespace overlay { +namespace write_overlay { -class AttributeFile; -class AttributeEntry; - - struct open_cookie { int open_mode; void * super_cookie; @@ -52,27 +48,17 @@ uint8 buffer[1]; }; -struct attribute_dir_cookie { - AttributeFile * file; - uint32 index; -}; - class OverlayVolume { public: OverlayVolume(fs_volume *volume); ~OverlayVolume(); - status_t AllLayersMounted(); - fs_volume * Volume() { return fVolume; } fs_volume * SuperVolume() { return fVolume->super_volume; } - bool WriteSupport() { return fWriteSupport; } - private: fs_volume * fVolume; - bool fWriteSupport; }; @@ -89,9 +75,6 @@ fs_vnode * SuperVnode() { return &fSuperVnode; } ino_t InodeNumber() { return fInodeNumber; } - status_t GetAttributeFile(AttributeFile **attributeFile); - status_t WriteAttributeFile(); - status_t ReadStat(struct stat *stat); status_t Open(int openMode, void **cookie); @@ -106,7 +89,6 @@ OverlayVolume * fVolume; fs_vnode fSuperVnode; ino_t fInodeNumber; - AttributeFile * fAttributeFile; write_buffer * fWriteBuffers; off_t fOriginalNodeLength; off_t fCurrentNodeLength; @@ -114,117 +96,11 @@ }; -class AttributeFile { -public: - AttributeFile(fs_volume *overlay, fs_volume *volume, - fs_vnode *vnode); - ~AttributeFile(); - - status_t InitCheck() { return fStatus; } - - dev_t VolumeID() { return fVolumeID; } - ino_t FileInode() { return fFileInode; } - - status_t CreateEmpty(); - status_t WriteAttributeFile(fs_volume *overlay, - fs_volume *volume, fs_vnode *vnode); - - status_t ReadAttributeDir(struct dirent *dirent, - size_t bufferSize, uint32 *numEntries, - uint32 *index); - - uint32 CountAttributes(); - AttributeEntry * FindAttribute(const char *name, - uint32 *index = NULL); - - status_t CreateAttribute(const char *name, type_code type, - int openMode, AttributeEntry **entry); - status_t OpenAttribute(const char *name, int openMode, - AttributeEntry **entry); - status_t RemoveAttribute(const char *name, - AttributeEntry **entry); - status_t AddAttribute(AttributeEntry *entry); - -private: - #define ATTRIBUTE_OVERLAY_FILE_MAGIC 'attr' - #define ATTRIBUTE_OVERLAY_ATTRIBUTE_DIR_NAME "_HAIKU" - - struct attribute_file { - uint32 magic; // 'attr' - uint32 entry_count; - uint8 entries[1]; - } _PACKED; - - status_t fStatus; - dev_t fVolumeID; - ino_t fFileInode; - ino_t fDirectoryInode; - ino_t fAttributeDirInode; - ino_t fAttributeFileInode; - attribute_file * fFile; - uint32 fAttributeDirIndex; - AttributeEntry ** fEntries; -}; - - -class AttributeEntry { -public: - AttributeEntry(AttributeFile *parent, - uint8 *buffer); - AttributeEntry(AttributeFile *parent, - const char *name, type_code type); - ~AttributeEntry(); - - status_t InitCheck() { return fStatus; } - - uint8 * Entry() { return (uint8 *)fEntry; } - size_t EntrySize(); - uint8 * Data() { return fData; } - size_t DataSize() { return fEntry->size; } - - status_t SetType(type_code type); - type_code Type() { return fEntry->type; } - - status_t SetSize(size_t size); - uint32 Size() { return fEntry->size; } - - status_t SetName(const char *name); - const char * Name() { return fEntry->name; } - uint8 NameLength() { return fEntry->name_length; } - - status_t FillDirent(struct dirent *dirent, - size_t bufferSize, uint32 *numEntries); - - status_t Read(off_t position, void *buffer, size_t *length); - status_t Write(off_t position, const void *buffer, - size_t *length); - - status_t ReadStat(struct stat *stat); - status_t WriteStat(const struct stat *stat, uint32 statMask); - -private: - struct attribute_entry { - type_code type; - uint32 size; - uint8 name_length; // including 0 byte - char name[1]; // 0 terminated, followed by data - } _PACKED; - - AttributeFile * fParent; - attribute_entry * fEntry; - uint8 * fData; - status_t fStatus; - bool fAllocatedEntry; - bool fAllocatedData; -}; - - // #pragma mark OverlayVolume OverlayVolume::OverlayVolume(fs_volume *volume) - : fVolume(volume), - fWriteSupport(false) + : fVolume(volume) { } @@ -234,19 +110,6 @@ } -status_t -OverlayVolume::AllLayersMounted() -{ - fs_info info; - fs_volume *superVolume = fVolume->super_volume; - if (superVolume->ops->read_fs_info != NULL - && superVolume->ops->read_fs_info(superVolume, &info) == B_OK) - fWriteSupport = (info.flags & B_FS_IS_READONLY) != 0; - - return B_OK; -} - - // #pragma mark OverlayInode @@ -255,7 +118,6 @@ : fVolume(volume), fSuperVnode(*superVnode), fInodeNumber(inodeNumber), - fAttributeFile(NULL), fWriteBuffers(NULL), fOriginalNodeLength(-1), fCurrentNodeLength(-1) @@ -267,8 +129,6 @@ OverlayInode::~OverlayInode() { TRACE("inode destroyed\n"); - delete fAttributeFile; - write_buffer *element = fWriteBuffers; while (element) { write_buffer *next = element->next; @@ -286,50 +146,6 @@ status_t -OverlayInode::GetAttributeFile(AttributeFile **attributeFile) -{ - if (fAttributeFile == NULL) { - fAttributeFile = new(std::nothrow) AttributeFile(Volume(), - SuperVolume(), &fSuperVnode); - if (fAttributeFile == NULL) { - TRACE_ALWAYS("no memory to allocate attribute file\n"); - return B_NO_MEMORY; - } - } - - status_t result = fAttributeFile->InitCheck(); - if (result != B_OK) { - if (result == B_ENTRY_NOT_FOUND) { - // TODO: need to check if we're able to create the file - // but at least allow virtual attributes for now - } - - result = fAttributeFile->CreateEmpty(); - if (result != B_OK) - return result; - } - - *attributeFile = fAttributeFile; - return B_OK; -} - - -status_t -OverlayInode::WriteAttributeFile() -{ - if (fAttributeFile == NULL) - return B_NO_INIT; - - status_t result = fAttributeFile->InitCheck(); - if (result != B_OK) - return result; - - return fAttributeFile->WriteAttributeFile(Volume(), SuperVolume(), - &fSuperVnode); -} - - -status_t OverlayInode::ReadStat(struct stat *stat) { if (fSuperVnode.ops->read_stat == NULL) @@ -340,7 +156,7 @@ if (result != B_OK) return result; - if (fVolume->WriteSupport() && fCurrentNodeLength >= 0) { + if (fCurrentNodeLength >= 0) { stat->st_size = fCurrentNodeLength; stat->st_blocks = (stat->st_size + stat->st_blksize - 1) / stat->st_blksize; @@ -357,110 +173,100 @@ if (fSuperVnode.ops->open == NULL) return B_UNSUPPORTED; - if (fVolume->WriteSupport()) { - open_cookie *cookie = (open_cookie *)malloc(sizeof(open_cookie)); - if (cookie == NULL) - return B_NO_MEMORY; + open_cookie *cookie = (open_cookie *)malloc(sizeof(open_cookie)); + if (cookie == NULL) + return B_NO_MEMORY; - if (fOriginalNodeLength < 0) { - struct stat stat; - status_t result = fSuperVnode.ops->read_stat(SuperVolume(), - &fSuperVnode, &stat); - if (result != B_OK) - return result; - - fOriginalNodeLength = stat.st_size; - fCurrentNodeLength = stat.st_size; - fModificationTime = stat.st_mtime; + if (fOriginalNodeLength < 0) { + struct stat stat; + status_t result = fSuperVnode.ops->read_stat(SuperVolume(), + &fSuperVnode, &stat); + if (result != B_OK) { + free(cookie); + return result; } - cookie->open_mode = openMode; - *_cookie = cookie; + fOriginalNodeLength = stat.st_size; + fCurrentNodeLength = stat.st_size; + fModificationTime = stat.st_mtime; + } - if (openMode & O_TRUNC) - fCurrentNodeLength = 0; + cookie->open_mode = openMode; + *_cookie = cookie; - openMode &= ~(O_RDWR | O_WRONLY | O_TRUNC | O_CREAT); - return fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, openMode, - &cookie->super_cookie); + if (openMode & O_TRUNC) + fCurrentNodeLength = 0; + + openMode &= ~(O_RDWR | O_WRONLY | O_TRUNC | O_CREAT); + status_t result = fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, + openMode, &cookie->super_cookie); + if (result != B_OK) { + free(cookie); + return result; } - return fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, openMode, - _cookie); + return B_OK; } status_t OverlayInode::Close(void *_cookie) { - if (fVolume->WriteSupport()) { - open_cookie *cookie = (open_cookie *)_cookie; - return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, - cookie->super_cookie); - } - - return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, _cookie); + open_cookie *cookie = (open_cookie *)_cookie; + return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, + cookie->super_cookie); } status_t OverlayInode::FreeCookie(void *_cookie) { - if (fVolume->WriteSupport()) { - open_cookie *cookie = (open_cookie *)_cookie; - status_t result = fSuperVnode.ops->free_cookie(SuperVolume(), - &fSuperVnode, cookie->super_cookie); - free(cookie); - return result; - } - - return fSuperVnode.ops->free_cookie(SuperVolume(), &fSuperVnode, _cookie); + open_cookie *cookie = (open_cookie *)_cookie; + status_t result = fSuperVnode.ops->free_cookie(SuperVolume(), + &fSuperVnode, cookie->super_cookie); + free(cookie); + return result; } status_t OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length) { - if (fVolume->WriteSupport()) { - if (position >= fCurrentNodeLength) { - *length = 0; - return B_OK; - } + if (position >= fCurrentNodeLength) { + *length = 0; + return B_OK; + } - if (position < fOriginalNodeLength) { - open_cookie *cookie = (open_cookie *)_cookie; - size_t readLength = MIN(fOriginalNodeLength - position, *length); - status_t result = fSuperVnode.ops->read(SuperVolume(), &fSuperVnode, - cookie->super_cookie, position, buffer, &readLength); - if (result != B_OK) - return result; - } + if (position < fOriginalNodeLength) { + open_cookie *cookie = (open_cookie *)_cookie; + size_t readLength = MIN(fOriginalNodeLength - position, *length); + status_t result = fSuperVnode.ops->read(SuperVolume(), &fSuperVnode, + cookie->super_cookie, position, buffer, &readLength); + if (result != B_OK) + return result; + } - // overlay the read with whatever chunks we have written - write_buffer *element = fWriteBuffers; - *length = MIN(fCurrentNodeLength - position, *length); - off_t end = position + *length; - while (element) { - if (element->position > end) - break; + // overlay the read with whatever chunks we have written + write_buffer *element = fWriteBuffers; + *length = MIN(fCurrentNodeLength - position, *length); + off_t end = position + *length; + while (element) { + if (element->position > end) + break; - off_t elementEnd = element->position + element->length; - if (elementEnd > position) { - off_t copyPosition = MAX(position, element->position); - size_t copyLength = MIN(elementEnd - position, *length); - memcpy((uint8 *)buffer + (copyPosition - position), - element->buffer + (copyPosition - element->position), - copyLength); - } - - element = element->next; + off_t elementEnd = element->position + element->length; + if (elementEnd > position) { + off_t copyPosition = MAX(position, element->position); + size_t copyLength = MIN(elementEnd - position, *length); + memcpy((uint8 *)buffer + (copyPosition - position), + element->buffer + (copyPosition - element->position), + copyLength); } - return B_OK; + element = element->next; } - return fSuperVnode.ops->read(SuperVolume(), &fSuperVnode, _cookie, - position, buffer, length); + return B_OK; } @@ -468,805 +274,94 @@ OverlayInode::Write(void *_cookie, off_t position, const void *buffer, size_t *length) { - if (fVolume->WriteSupport()) { - // find insertion point - write_buffer **link = &fWriteBuffers; - write_buffer *other = fWriteBuffers; - write_buffer *swallow = NULL; - off_t newPosition = position; - size_t newLength = *length; - uint32 swallowCount = 0; + // find insertion point + write_buffer **link = &fWriteBuffers; + write_buffer *other = fWriteBuffers; + write_buffer *swallow = NULL; + off_t newPosition = position; + size_t newLength = *length; + uint32 swallowCount = 0; - while (other) { - off_t newEnd = newPosition + newLength; - off_t otherEnd = other->position + other->length; - if (otherEnd < newPosition) { - // other is completely before us - link = &other->next; - other = other->next; - continue; [... truncated: 1136 lines follow ...] From mmlr at mail.berlios.de Thu Feb 19 22:13:04 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 22:13:04 +0100 Subject: [Haiku-commits] r29256 - in haiku/trunk/src/add-ons/kernel/file_systems/layers: attribute_overlay write_overlay Message-ID: <200902192113.n1JLD4Pn027416@sheep.berlios.de> Author: mmlr Date: 2009-02-19 22:13:02 +0100 (Thu, 19 Feb 2009) New Revision: 29256 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29256&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp Log: Rename the trace output as well. Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp 2009-02-19 21:11:59 UTC (rev 29255) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp 2009-02-19 21:13:02 UTC (rev 29256) @@ -24,13 +24,13 @@ //#define TRACE_OVERLAY #ifdef TRACE_OVERLAY -#define TRACE(x...) dprintf("overlay: " x) -#define TRACE_VOLUME(x...) dprintf("overlay: " x) -#define TRACE_ALWAYS(x...) dprintf("overlay: " x) +#define TRACE(x...) dprintf("attribute_overlay: " x) +#define TRACE_VOLUME(x...) dprintf("attribute_overlay: " x) +#define TRACE_ALWAYS(x...) dprintf("attribute_overlay: " x) #else #define TRACE(x...) /* nothing */ #define TRACE_VOLUME(x...) /* nothing */ -#define TRACE_ALWAYS(x...) dprintf("overlay: " x) +#define TRACE_ALWAYS(x...) dprintf("attribute_overlay: " x) #endif @@ -1926,7 +1926,7 @@ overlay_mount(fs_volume *volume, const char *device, uint32 flags, const char *args, ino_t *rootID) { - TRACE_VOLUME("mounting overlay\n"); + TRACE_VOLUME("mounting attribute overlay\n"); volume->private_volume = new(std::nothrow) OverlayVolume(volume); if (volume->private_volume == NULL) return B_NO_MEMORY; Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-19 21:11:59 UTC (rev 29255) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-19 21:13:02 UTC (rev 29256) @@ -24,13 +24,13 @@ //#define TRACE_OVERLAY #ifdef TRACE_OVERLAY -#define TRACE(x...) dprintf("overlay: " x) -#define TRACE_VOLUME(x...) dprintf("overlay: " x) -#define TRACE_ALWAYS(x...) dprintf("overlay: " x) +#define TRACE(x...) dprintf("write_overlay: " x) +#define TRACE_VOLUME(x...) dprintf("write_overlay: " x) +#define TRACE_ALWAYS(x...) dprintf("write_overlay: " x) #else #define TRACE(x...) /* nothing */ #define TRACE_VOLUME(x...) /* nothing */ -#define TRACE_ALWAYS(x...) dprintf("overlay: " x) +#define TRACE_ALWAYS(x...) dprintf("write_overlay: " x) #endif From mmu_man at mail.berlios.de Thu Feb 19 22:29:28 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 19 Feb 2009 22:29:28 +0100 Subject: [Haiku-commits] r29257 - in haiku/trunk/docs/userguide: . en en/applications en/desktop-applets en/installation en/preferences Message-ID: <200902192129.n1JLTSIf030039@sheep.berlios.de> Author: mmu_man Date: 2009-02-19 22:29:27 +0100 (Thu, 19 Feb 2009) New Revision: 29257 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29257&view=rev Modified: haiku/trunk/docs/userguide/en/applications.html haiku/trunk/docs/userguide/en/applications/apps-activitymonitor.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-codycam.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-diskusage.html haiku/trunk/docs/userguide/en/applications/apps-drivesetup.html haiku/trunk/docs/userguide/en/applications/apps-expander.html haiku/trunk/docs/userguide/en/applications/apps-firefox.html haiku/trunk/docs/userguide/en/applications/apps-icon-o-matic.html haiku/trunk/docs/userguide/en/applications/apps-installer.html haiku/trunk/docs/userguide/en/applications/apps-magnify.html haiku/trunk/docs/userguide/en/applications/apps-mail.html haiku/trunk/docs/userguide/en/applications/apps-mediaplayer.html haiku/trunk/docs/userguide/en/applications/apps-midiplayer.html haiku/trunk/docs/userguide/en/applications/apps-packageinstaller.html haiku/trunk/docs/userguide/en/applications/apps-pe.html haiku/trunk/docs/userguide/en/applications/apps-people.html haiku/trunk/docs/userguide/en/applications/apps-screenshot.html haiku/trunk/docs/userguide/en/applications/apps-showimage.html haiku/trunk/docs/userguide/en/applications/apps-soundrecorder.html haiku/trunk/docs/userguide/en/applications/apps-stylededit.html haiku/trunk/docs/userguide/en/applications/apps-terminal.html haiku/trunk/docs/userguide/en/applications/apps-textsearch.html haiku/trunk/docs/userguide/en/applications/apps-tv.html haiku/trunk/docs/userguide/en/applications/apps-vision.html haiku/trunk/docs/userguide/en/applications/apps-vlc.html haiku/trunk/docs/userguide/en/applications/apps-wonderbrush.html haiku/trunk/docs/userguide/en/attributes.html haiku/trunk/docs/userguide/en/bash-scripting.html haiku/trunk/docs/userguide/en/bootloader.html haiku/trunk/docs/userguide/en/contents.html haiku/trunk/docs/userguide/en/demos.html haiku/trunk/docs/userguide/en/deskbar.html haiku/trunk/docs/userguide/en/desktop-applets.html haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-launchbox.html haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-networkstatus.html haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-processcontroller.html haiku/trunk/docs/userguide/en/filesystem-layout.html haiku/trunk/docs/userguide/en/filetypes.html haiku/trunk/docs/userguide/en/gui.html haiku/trunk/docs/userguide/en/index.html haiku/trunk/docs/userguide/en/installation.html haiku/trunk/docs/userguide/en/installation/install-boot-process.html haiku/trunk/docs/userguide/en/installation/install-raw.html haiku/trunk/docs/userguide/en/installation/install-source-beos.html haiku/trunk/docs/userguide/en/installation/install-source-linux.html haiku/trunk/docs/userguide/en/installation/install-source-mac.html haiku/trunk/docs/userguide/en/installation/install-source-windows.html haiku/trunk/docs/userguide/en/installation/install-usb.html haiku/trunk/docs/userguide/en/installation/install-vm.html haiku/trunk/docs/userguide/en/installing.html haiku/trunk/docs/userguide/en/keyboard-shortcuts.html haiku/trunk/docs/userguide/en/preferences.html haiku/trunk/docs/userguide/en/preferences/prefs-appearance.html haiku/trunk/docs/userguide/en/preferences/prefs-backgrounds.html haiku/trunk/docs/userguide/en/preferences/prefs-datatranslations.html haiku/trunk/docs/userguide/en/preferences/prefs-e-mail.html haiku/trunk/docs/userguide/en/preferences/prefs-filetypes.html haiku/trunk/docs/userguide/en/preferences/prefs-fonts.html haiku/trunk/docs/userguide/en/preferences/prefs-keyboard.html haiku/trunk/docs/userguide/en/preferences/prefs-keymap.html haiku/trunk/docs/userguide/en/preferences/prefs-media.html haiku/trunk/docs/userguide/en/preferences/prefs-menu.html haiku/trunk/docs/userguide/en/preferences/prefs-mouse.html haiku/trunk/docs/userguide/en/preferences/prefs-network.html haiku/trunk/docs/userguide/en/preferences/prefs-printers.html haiku/trunk/docs/userguide/en/preferences/prefs-screen.html haiku/trunk/docs/userguide/en/preferences/prefs-screensaver.html haiku/trunk/docs/userguide/en/preferences/prefs-sounds.html haiku/trunk/docs/userguide/en/preferences/prefs-time.html haiku/trunk/docs/userguide/en/preferences/prefs-tracker.html haiku/trunk/docs/userguide/en/preferences/prefs-virtualmemory.html haiku/trunk/docs/userguide/en/queries.html haiku/trunk/docs/userguide/en/teammonitor.html haiku/trunk/docs/userguide/en/tracker-add-ons.html haiku/trunk/docs/userguide/en/tracker.html haiku/trunk/docs/userguide/en/twitcher.html haiku/trunk/docs/userguide/en/workshop-filetypes+attributes.html haiku/trunk/docs/userguide/en/workspaces.html haiku/trunk/docs/userguide/languages.html Log: Set mimetype to text/html on userguide too, it will be viewable on http://svn.berlios.de/wsvn/haiku/haiku/trunk/docs/userguide/languages.html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-activitymonitor.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-bepdf.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-cdplayer.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-codycam.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-deskcalc.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-diskprobe.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-diskusage.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-drivesetup.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-expander.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-firefox.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-icon-o-matic.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-installer.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-magnify.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-mail.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-mediaplayer.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-midiplayer.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-packageinstaller.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-pe.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-people.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-screenshot.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-showimage.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-soundrecorder.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-stylededit.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-terminal.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-textsearch.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-tv.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-vision.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-vlc.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications/apps-wonderbrush.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/applications.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/attributes.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/bash-scripting.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/bootloader.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/contents.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/demos.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/deskbar.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-launchbox.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-networkstatus.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-processcontroller.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/desktop-applets.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/filesystem-layout.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/filetypes.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/gui.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/index.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-boot-process.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-raw.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-source-beos.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-source-linux.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-source-mac.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-source-windows.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-usb.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation/install-vm.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installation.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/installing.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/keyboard-shortcuts.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-appearance.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-backgrounds.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-datatranslations.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-e-mail.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-filetypes.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-fonts.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-keyboard.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-keymap.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-media.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-menu.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-mouse.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-network.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-printers.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-screen.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-screensaver.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-sounds.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-time.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-tracker.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences/prefs-virtualmemory.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/preferences.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/queries.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/teammonitor.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/tracker-add-ons.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/tracker.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/twitcher.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/workshop-filetypes+attributes.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/en/workspaces.html ___________________________________________________________________ Name: svn:mime-type + text/html Property changes on: haiku/trunk/docs/userguide/languages.html ___________________________________________________________________ Name: svn:mime-type + text/html From mmlr at mail.berlios.de Thu Feb 19 22:45:47 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 22:45:47 +0100 Subject: [Haiku-commits] r29258 - haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay Message-ID: <200902192145.n1JLjl8Z002419@sheep.berlios.de> Author: mmlr Date: 2009-02-19 22:45:46 +0100 (Thu, 19 Feb 2009) New Revision: 29258 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29258&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp Log: No need to relay the attribute calls. Fixes attribute overlays when used with another layer. Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp 2009-02-19 21:29:27 UTC (rev 29257) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/attribute_overlay/attribute_overlay.cpp 2009-02-19 21:45:46 UTC (rev 29258) @@ -1366,8 +1366,7 @@ static status_t overlay_open_attr_dir(fs_volume *volume, fs_vnode *vnode, void **cookie) { - OVERLAY_CALL(open_attr_dir, cookie) - + OverlayInode *node = (OverlayInode *)vnode->private_node; AttributeFile *attributeFile = NULL; status_t result = node->GetAttributeFile(&attributeFile); if (result != B_OK) @@ -1388,7 +1387,6 @@ static status_t overlay_close_attr_dir(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(close_attr_dir, cookie) return B_OK; } @@ -1396,7 +1394,6 @@ static status_t overlay_free_attr_dir_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(free_attr_dir_cookie, cookie) free(cookie); return B_OK; } @@ -1406,7 +1403,6 @@ overlay_read_attr_dir(fs_volume *volume, fs_vnode *vnode, void *cookie, struct dirent *buffer, size_t bufferSize, uint32 *num) { - OVERLAY_CALL(read_attr_dir, cookie, buffer, bufferSize, num) attribute_dir_cookie *dirCookie = (attribute_dir_cookie *)cookie; return dirCookie->file->ReadAttributeDir(buffer, bufferSize, num, &dirCookie->index); @@ -1416,7 +1412,6 @@ static status_t overlay_rewind_attr_dir(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(rewind_attr_dir, cookie) attribute_dir_cookie *dirCookie = (attribute_dir_cookie *)cookie; dirCookie->index = 0; return B_OK; @@ -1427,8 +1422,7 @@ overlay_create_attr(fs_volume *volume, fs_vnode *vnode, const char *name, uint32 type, int openMode, void **cookie) { - OVERLAY_CALL(create_attr, name, type, openMode, cookie) - + OverlayInode *node = (OverlayInode *)vnode->private_node; AttributeFile *attributeFile = NULL; status_t result = node->GetAttributeFile(&attributeFile); if (result != B_OK) @@ -1443,8 +1437,7 @@ overlay_open_attr(fs_volume *volume, fs_vnode *vnode, const char *name, int openMode, void **cookie) { - OVERLAY_CALL(open_attr, name, openMode, cookie) - + OverlayInode *node = (OverlayInode *)vnode->private_node; AttributeFile *attributeFile = NULL; status_t result = node->GetAttributeFile(&attributeFile); if (result != B_OK) @@ -1458,7 +1451,6 @@ static status_t overlay_close_attr(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(close_attr, cookie) return B_OK; } @@ -1466,7 +1458,6 @@ static status_t overlay_free_attr_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(free_attr_cookie, cookie) return B_OK; } @@ -1475,7 +1466,6 @@ overlay_read_attr(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, void *buffer, size_t *length) { - OVERLAY_CALL(read_attr, cookie, pos, buffer, length) return ((AttributeEntry *)cookie)->Read(pos, buffer, length); } @@ -1484,7 +1474,6 @@ overlay_write_attr(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const void *buffer, size_t *length) { - OVERLAY_CALL(write_attr, cookie, pos, buffer, length) return ((AttributeEntry *)cookie)->Write(pos, buffer, length); } @@ -1493,7 +1482,6 @@ overlay_read_attr_stat(fs_volume *volume, fs_vnode *vnode, void *cookie, struct stat *stat) { - OVERLAY_CALL(read_attr_stat, cookie, stat) return ((AttributeEntry *)cookie)->ReadStat(stat); } @@ -1502,7 +1490,6 @@ overlay_write_attr_stat(fs_volume *volume, fs_vnode *vnode, void *cookie, const struct stat *stat, int statMask) { - OVERLAY_CALL(write_attr_stat, cookie, stat, statMask) return ((AttributeEntry *)cookie)->WriteStat(stat, statMask); } @@ -1511,8 +1498,7 @@ overlay_rename_attr(fs_volume *volume, fs_vnode *vnode, const char *fromName, fs_vnode *toVnode, const char *toName) { - OVERLAY_CALL(rename_attr, fromName, toVnode, toName) - + OverlayInode *node = (OverlayInode *)vnode->private_node; AttributeFile *attributeFile = NULL; status_t result = node->GetAttributeFile(&attributeFile); if (result != B_OK) @@ -1553,8 +1539,7 @@ static status_t overlay_remove_attr(fs_volume *volume, fs_vnode *vnode, const char *name) { - OVERLAY_CALL(remove_attr, name) - + OverlayInode *node = (OverlayInode *)vnode->private_node; AttributeFile *attributeFile = NULL; status_t result = node->GetAttributeFile(&attributeFile); if (result != B_OK) From mmlr at mail.berlios.de Thu Feb 19 23:39:54 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 23:39:54 +0100 Subject: [Haiku-commits] r29259 - haiku/trunk/src/system/kernel/fs Message-ID: <200902192239.n1JMds6a009472@sheep.berlios.de> Author: mmlr Date: 2009-02-19 23:39:52 +0100 (Thu, 19 Feb 2009) New Revision: 29259 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29259&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: We need a longer filesystem string here to fit in all the possible layers. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-19 21:45:46 UTC (rev 29258) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-19 22:39:52 UTC (rev 29259) @@ -8146,7 +8146,7 @@ _user_mount(const char *userPath, const char *userDevice, const char *userFileSystem, uint32 flags, const char *userArgs, size_t argsLength) { - char fileSystem[B_OS_NAME_LENGTH]; + char fileSystem[B_FILE_NAME_LENGTH]; KPath path, device; char *args = NULL; status_t status; From mmlr at mail.berlios.de Thu Feb 19 23:40:31 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Thu, 19 Feb 2009 23:40:31 +0100 Subject: [Haiku-commits] r29260 - haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay Message-ID: <200902192240.n1JMeVOB009664@sheep.berlios.de> Author: mmlr Date: 2009-02-19 23:40:30 +0100 (Thu, 19 Feb 2009) New Revision: 29260 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29260&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp Log: Implemented write stat. Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-19 22:39:52 UTC (rev 29259) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-19 22:40:30 UTC (rev 29260) @@ -76,6 +76,7 @@ ino_t InodeNumber() { return fInodeNumber; } status_t ReadStat(struct stat *stat); + status_t WriteStat(const struct stat *stat, uint32 statMask); status_t Open(int openMode, void **cookie); status_t Close(void *cookie); @@ -91,8 +92,8 @@ ino_t fInodeNumber; write_buffer * fWriteBuffers; off_t fOriginalNodeLength; - off_t fCurrentNodeLength; - time_t fModificationTime; + struct stat fStat; + bool fHasStat; }; @@ -120,7 +121,7 @@ fInodeNumber(inodeNumber), fWriteBuffers(NULL), fOriginalNodeLength(-1), - fCurrentNodeLength(-1) + fHasStat(false) { TRACE("inode created\n"); } @@ -148,26 +149,60 @@ status_t OverlayInode::ReadStat(struct stat *stat) { - if (fSuperVnode.ops->read_stat == NULL) - return B_UNSUPPORTED; + if (!fHasStat) { + if (fSuperVnode.ops->read_stat == NULL) + return B_UNSUPPORTED; - status_t result = fSuperVnode.ops->read_stat(SuperVolume(), &fSuperVnode, - stat); - if (result != B_OK) - return result; + status_t result = fSuperVnode.ops->read_stat(SuperVolume(), + &fSuperVnode, &fStat); + if (result != B_OK) + return result; - if (fCurrentNodeLength >= 0) { - stat->st_size = fCurrentNodeLength; - stat->st_blocks = (stat->st_size + stat->st_blksize - 1) - / stat->st_blksize; - stat->st_mtime = fModificationTime; + fHasStat = true; } + if (stat == NULL) + return B_OK; + + memcpy(stat, &fStat, sizeof(struct stat)); + stat->st_blocks = (stat->st_size + stat->st_blksize - 1) / stat->st_blksize; return B_OK; } status_t +OverlayInode::WriteStat(const struct stat *stat, uint32 statMask) +{ + if (!fHasStat) + ReadStat(NULL); + + if (statMask & B_STAT_SIZE) + fStat.st_size = stat->st_size; + + if (statMask & B_STAT_MODE) + fStat.st_mode = stat->st_mode; + if (statMask & B_STAT_UID) + fStat.st_uid = stat->st_uid; + if (statMask & B_STAT_GID) + fStat.st_gid = stat->st_gid; + + if (statMask & B_STAT_MODIFICATION_TIME) + fStat.st_mtime = stat->st_mtime; + if (statMask & B_STAT_CREATION_TIME) + fStat.st_crtime = stat->st_crtime; + + if ((statMask & (B_STAT_MODE | B_STAT_UID | B_STAT_GID)) != 0 + && (statMask & B_STAT_MODIFICATION_TIME) == 0) { + fStat.st_mtime = time(NULL); + statMask |= B_STAT_MODIFICATION_TIME; + } + + notify_stat_changed(SuperVolume()->id, fInodeNumber, statMask); + return B_OK; +} + + +status_t OverlayInode::Open(int openMode, void **_cookie) { if (fSuperVnode.ops->open == NULL) @@ -181,21 +216,17 @@ struct stat stat; status_t result = fSuperVnode.ops->read_stat(SuperVolume(), &fSuperVnode, &stat); - if (result != B_OK) { - free(cookie); + if (result != B_OK) return result; - } fOriginalNodeLength = stat.st_size; - fCurrentNodeLength = stat.st_size; - fModificationTime = stat.st_mtime; } cookie->open_mode = openMode; *_cookie = cookie; if (openMode & O_TRUNC) - fCurrentNodeLength = 0; + fStat.st_size = 0; openMode &= ~(O_RDWR | O_WRONLY | O_TRUNC | O_CREAT); status_t result = fSuperVnode.ops->open(SuperVolume(), &fSuperVnode, @@ -232,7 +263,7 @@ status_t OverlayInode::Read(void *_cookie, off_t position, void *buffer, size_t *length) { - if (position >= fCurrentNodeLength) { + if (position >= fStat.st_size) { *length = 0; return B_OK; } @@ -244,11 +275,15 @@ cookie->super_cookie, position, buffer, &readLength); if (result != B_OK) return result; - } + if (readLength < *length) + memset((uint8 *)buffer + readLength, 0, *length - readLength); + } else + memset(buffer, 0, *length); + // overlay the read with whatever chunks we have written write_buffer *element = fWriteBuffers; - *length = MIN(fCurrentNodeLength - position, *length); + *length = MIN(fStat.st_size - position, *length); off_t end = position + *length; while (element) { if (element->position > end) @@ -307,7 +342,7 @@ memcpy(other->buffer + (newPosition - other->position), buffer, *length); - fModificationTime = time(NULL); + fStat.st_mtime = time(NULL); notify_stat_changed(SuperVolume()->id, fInodeNumber, B_STAT_MODIFICATION_TIME); return B_OK; @@ -335,8 +370,8 @@ bool sizeChanged = false; off_t newEnd = newPosition + newLength; - if (newEnd > fCurrentNodeLength) { - fCurrentNodeLength = newEnd; + if (newEnd > fStat.st_size) { + fStat.st_size = newEnd; sizeChanged = true; } @@ -354,10 +389,9 @@ memcpy(element->buffer + (position - newPosition), buffer, *length); - fModificationTime = time(NULL); + fStat.st_mtime = time(NULL); notify_stat_changed(SuperVolume()->id, fInodeNumber, B_STAT_MODIFICATION_TIME | (sizeChanged ? B_STAT_SIZE : 0)); - return B_OK; } @@ -613,8 +647,7 @@ overlay_write_stat(fs_volume *volume, fs_vnode *vnode, const struct stat *stat, uint32 statMask) { - OVERLAY_CALL(write_stat, stat, statMask) - return B_UNSUPPORTED; + return ((OverlayInode *)vnode->private_node)->WriteStat(stat, statMask); } @@ -974,7 +1007,7 @@ if (result != B_OK) return result; - info->flags &= ~(B_FS_IS_READONLY | B_FS_IS_PERSISTENT); + info->flags &= ~B_FS_IS_READONLY; return B_OK; } From axeld at pinc-software.de Fri Feb 20 00:01:35 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Fri, 20 Feb 2009 00:01:35 +0100 Subject: [Haiku-commits] r29249 - haiku/trunk/src/add-ons/kernel/file_systems/overlay In-Reply-To: <6035180693-BeMail@haiku> References: <6035180693-BeMail@haiku> Message-ID: <499DE4CF.2060009@pinc-software.de> Michael Lotz wrote: >>> Rather, I think there should be several layers, each providing just >>> one kind of functionality. > Please don't worry. I'm currently just prototyping it into this one > layer. I intended to split it up when it was reasonably working and > then also rename/move the layer. But I guess I can do that just as well > now. Ah, great to know :-) >> also, this seems to make CDs writable with isvolume I was told... > It obviously does, yes. It's intended for the live CD mode later on. > Determining whether or not to start the installer should later be done > based on the persistance of the storage instead of read-only. Actually, the persistance flag in BeOS is pretty much misused (or understood in a different way one would, intuitively): IIRC Tracker ignores all file systems that aren't persistent to hide them from the user (like /dev, and /pipe). Also, if there is HD installed, the layer could actually store the data there (maybe when configured like this). Not sure if this is a good idea, but the Bootscript could also launch into a special live/install environment when the boot device is removable. That would include USB sticks as well. Bye, Axel. From mmlr at mail.berlios.de Fri Feb 20 00:01:45 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Fri, 20 Feb 2009 00:01:45 +0100 Subject: [Haiku-commits] r29261 - in haiku/trunk: build/jam src/add-ons/kernel/file_systems src/system/kernel/fs Message-ID: <200902192301.n1JN1jYt011876@sheep.berlios.de> Author: mmlr Date: 2009-02-20 00:01:42 +0100 (Fri, 20 Feb 2009) New Revision: 29261 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29261&view=rev Removed: haiku/trunk/src/add-ons/kernel/file_systems/overlay/ Modified: haiku/trunk/build/jam/FloppyBootImage haiku/trunk/build/jam/HaikuImage haiku/trunk/src/system/kernel/fs/vfs_boot.cpp Log: * Remove the original overlay filesystem. * Add attribute_overlay and write_overlay to the image/floppy instead. * Mount a iso9660 boot volume with both write and attribute overlay for now. Modified: haiku/trunk/build/jam/FloppyBootImage =================================================================== --- haiku/trunk/build/jam/FloppyBootImage 2009-02-19 22:40:30 UTC (rev 29260) +++ haiku/trunk/build/jam/FloppyBootImage 2009-02-19 23:01:42 UTC (rev 29261) @@ -33,7 +33,7 @@ BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)isa ide scsi config_manager agp_gart usb ; -BEOS_ADD_ONS_FILE_SYSTEMS = bfs iso9660 overlay ; +BEOS_ADD_ONS_FILE_SYSTEMS = bfs iso9660 attribute_overlay write_overlay ; #cdda fat googlefs nfs ; Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-02-19 22:40:30 UTC (rev 29260) +++ haiku/trunk/build/jam/HaikuImage 2009-02-19 23:01:42 UTC (rev 29261) @@ -138,7 +138,8 @@ BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi config_manager agp_gart usb firewire $(X86_ONLY)acpi ; -BEOS_ADD_ONS_FILE_SYSTEMS = bfs cdda ext2 fat iso9660 nfs overlay $(GPL_ONLY)reiserfs ; +BEOS_ADD_ONS_FILE_SYSTEMS = bfs cdda ext2 fat iso9660 nfs attribute_overlay + write_overlay $(GPL_ONLY)reiserfs ; #googlefs $(GPL_ONLY)ntfs ; Modified: haiku/trunk/src/system/kernel/fs/vfs_boot.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs_boot.cpp 2009-02-19 22:40:30 UTC (rev 29260) +++ haiku/trunk/src/system/kernel/fs/vfs_boot.cpp 2009-02-19 23:01:42 UTC (rev 29261) @@ -444,7 +444,7 @@ const char *fsName = NULL; if (strcmp(bootPartition->ContentType(), "ISO9660 File System") == 0) - fsName = "iso9660:overlay"; + fsName = "iso9660:write_overlay:attribute_overlay"; TRACE(("trying to mount boot partition: %s\n", path.Path())); gBootDevice = _kern_mount("/boot", path.Path(), fsName, 0, NULL, 0); From nielx at mail.berlios.de Fri Feb 20 11:20:54 2009 From: nielx at mail.berlios.de (nielx at BerliOS) Date: Fri, 20 Feb 2009 11:20:54 +0100 Subject: [Haiku-commits] r29262 - haiku/trunk/docs/user/app Message-ID: <200902201020.n1KAKsNg030253@sheep.berlios.de> Author: nielx Date: 2009-02-20 11:20:54 +0100 (Fri, 20 Feb 2009) New Revision: 29262 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29262&view=rev Modified: haiku/trunk/docs/user/app/_app_intro.dox Log: Rewording by Tim Howe with some suggestions by Bob Colwell. Thanks guys. Modified: haiku/trunk/docs/user/app/_app_intro.dox =================================================================== --- haiku/trunk/docs/user/app/_app_intro.dox 2009-02-19 23:01:42 UTC (rev 29261) +++ haiku/trunk/docs/user/app/_app_intro.dox 2009-02-20 10:20:54 UTC (rev 29262) @@ -10,16 +10,17 @@ /*! \page app_intro Introduction to the Application Kit. - The Application Kit is a kit you will have to get to know in case you - want to effectively write Haiku applications with a GUI. The application - kit does exactly as the name might inform you: it is the basis for Haiku - applications. It is advised to read through this document, and the - documents referenced before going to any other part of the API. + The Application Kit should be your starting point if you want to write + native Haiku applications with a GUI. The application kit does + exactly as its name suggests; it is the basis for Haiku applications. You + should read through this document and the documents referenced here before + moving on to any other part of the API. - We can divide the classes in the application kit up in two categories. The - biggest part of the classes are in the 'messaging' classes. Have a look at - the \link app_messaging Introduction to Messaging \endlink for more - information. The following classes are part of it: + The Application Kit classes can be divided into two groups: the "messaging" + classes and the "system interaction" classes. The larger group contains + the messaging classes. Have a look at the \link app_messaging + Introduction to Messaging \endlink for more information. + The following classes are messaging classes: - BHandler - BInvoker - BLooper @@ -29,13 +30,13 @@ - BMessageRunner - BMessenger - The second category is the 'system interaction' category. These classes - provides hooks for you application to interact with the rest of the system. + The second group is the system interaction classes. These classes + provide hooks for your application to interact with the rest of the system. The most important class is BApplication. This is a list of all the - classes: + system interaction classes: - BApplication - BClipboard - BCursor - BPropertyInfo - BRoster -*/ \ No newline at end of file +*/ From humdingerb at googlemail.com Fri Feb 20 16:27:04 2009 From: humdingerb at googlemail.com (Humdinger) Date: Fri, 20 Feb 2009 16:27:04 +0100 Subject: [Haiku-commits] r29252 - in haiku/trunk/docs/welcome: . en In-Reply-To: <200902192028.n1JKShxx021160@sheep.berlios.de> References: <200902192028.n1JKShxx021160@sheep.berlios.de> Message-ID: <499ECBC8.2030103@googlemail.com> mmu_man at BerliOS wrote: > Log: Test setting mime type property to text/html. It should help previewing the html > from trac or at least the normal svnweb as I tested elsewhere. How do you set a mime type (if I add a new page) and will I have to do something special if I commit an update to an existing page? I'll soon have to commit an update to every page as I plan to use more CSS styles and the nearing migration to the (translation) website lends itself to this change. I wouldn't want to undo your mime setting... Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From mmlr at mlotz.ch Fri Feb 20 17:25:53 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 20 Feb 2009 17:25:53 Subject: [Haiku-commits] =?windows-1252?q?r29249_-_haiku/trunk/src/add-ons?= =?windows-1252?q?/kernel/file=5Fsystems/overlay?= In-Reply-To: <499DE4CF.2060009@pinc-software.de> Message-ID: <1105911235-BeMail@haiku> > Michael Lotz wrote: > > > also, this seems to make CDs writable with isvolume I was told... > > > > > It obviously does, yes. It's intended for the live CD mode later on > > . > > Determining whether or not to start the installer should later be > > done > > based on the persistance of the storage instead of read-only. > > Actually, the persistance flag in BeOS is pretty much misused (or > understood in a different way one would, intuitively): IIRC Tracker > ignores all file systems that aren't persistent to hide them from the > user (like /dev, and /pipe). Yes, I realized that after trying that flag. Though I'd classify that as fixable and certainly having a non-persistent volume declared as such is the right thing to do. > Also, if there is HD installed, the layer could actually store the > data > there (maybe when configured like this). That should be relatively easily doable, yes. > Not sure if this is a good idea, but the Bootscript could also launch > into a special live/install environment when the boot device is > removable. That would include USB sticks as well. I'd very much like to see this. Because right now (well, when the write _overlay is finished) you could use a CD as a live CD automatically, but the user would need to know that he needs to use the ctrl-alt-delete trick and restart the desktop. This is not very user friendly and could so easily just be added as a question popup to the boot process where you could select whether to run the installer or just launch into a normal desktop. Regards Michael From revol at free.fr Fri Feb 20 17:57:05 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Fri, 20 Feb 2009 17:57:05 +0100 CET Subject: [Haiku-commits] r29252 - in haiku/trunk/docs/welcome: . en In-Reply-To: <499ECBC8.2030103@googlemail.com> Message-ID: <12343323256-BeMail@laptop> > mmu_man at BerliOS wrote: > > Log: Test setting mime type property to text/html. It should help > > previewing the html > > from trac or at least the normal svnweb as I tested elsewhere. > > How do you set a mime type (if I add a new page) and will I have to > do something special > if I commit an update to an existing page? > I'll soon have to commit an update to every page as I plan to use > more CSS > styles and the > nearing migration to the (translation) website lends itself to this > change. > I wouldn't > want to undo your mime setting... For the CSS something like: svn propset svn:mime-type text/css docs/Haiku-doc.css For the html: svn propset svn:mime-type text/html docs/welcome/welcome.html You can recurse with find docs/userguide/ -name '*.htm*' -a -not -path '*.svn*' -exec svn propset svn:mime-type text/html {} \; Fran?ois. From humdingerb at googlemail.com Fri Feb 20 18:19:16 2009 From: humdingerb at googlemail.com (Humdinger) Date: Fri, 20 Feb 2009 18:19:16 +0100 Subject: [Haiku-commits] r29252 - in haiku/trunk/docs/welcome: . en In-Reply-To: <12343323256-BeMail@laptop> References: <12343323256-BeMail@laptop> Message-ID: <499EE614.8090400@googlemail.com> Fran?ois Revol wrote: > You can recurse with > > find docs/userguide/ -name '*.htm*' -a -not -path '*.svn*' -exec svn > propset svn:mime-type text/html {} \; Easy as that... :) Thanks Fran?ois. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From oruizdorantes at mail.berlios.de Fri Feb 20 18:32:49 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Fri, 20 Feb 2009 18:32:49 +0100 Subject: [Haiku-commits] r29263 - haiku/trunk/src/preferences/bluetooth Message-ID: <200902201732.n1KHWntZ015181@sheep.berlios.de> Author: oruizdorantes Date: 2009-02-20 18:32:48 +0100 (Fri, 20 Feb 2009) New Revision: 29263 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29263&view=rev Modified: haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp haiku/trunk/src/preferences/bluetooth/BluetoothSettingsView.cpp haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp haiku/trunk/src/preferences/bluetooth/InquiryPanel.h haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp haiku/trunk/src/preferences/bluetooth/defs.h Log: Implement functionality to the InquiryPanel Modified: haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp 2009-02-20 10:20:54 UTC (rev 29262) +++ haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp 2009-02-20 17:32:48 UTC (rev 29263) @@ -10,6 +10,8 @@ #include "BluetoothWindow.h" #include "defs.h" + + BluetoothApplication::BluetoothApplication(void) : BApplication(BLUETOOTH_APP_SIGNATURE) { Modified: haiku/trunk/src/preferences/bluetooth/BluetoothSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/BluetoothSettingsView.cpp 2009-02-20 10:20:54 UTC (rev 29262) +++ haiku/trunk/src/preferences/bluetooth/BluetoothSettingsView.cpp 2009-02-20 17:32:48 UTC (rev 29263) @@ -21,6 +21,7 @@ #include #include "ExtendedLocalDeviceView.h" +#include "defs.h" #include "BluetoothWindow.h" static const int32 kMsgSetAntialiasing = 'anti'; @@ -119,35 +120,13 @@ BluetoothSettingsView::MessageReceived(BMessage *msg) { switch (msg->what) { - case kMsgSetAntialiasing: - { -/* bool subpixelAntialiasing; - if (msg->FindBool("antialiasing", &subpixelAntialiasing) != B_OK - || subpixelAntialiasing == fCurrentSubpixelAntialiasing) - break; - fCurrentSubpixelAntialiasing = subpixelAntialiasing; - fAverageWeightControl->SetEnabled(fCurrentSubpixelAntialiasing); - - Window()->PostMessage(kMsgUpdate); -*/ break; - } - case kMsgSetHinting: - { -/* bool hinting; - if (msg->FindBool("hinting", &hinting) != B_OK - || hinting == fCurrentHinting) - break; - fCurrentHinting = hinting; - - Window()->PostMessage(kMsgUpdate); -*/ break; - } case kMsgLocalSwitched: { LocalDevice* lDevice; if (msg->FindPointer("LocalDevice", (void**) &lDevice) == B_OK) { // Device integrity should be rechecked - fExtDeviceView->SetLocalDevice(lDevice); + fExtDeviceView->SetLocalDevice(lDevice); + ActiveLocalDevice = lDevice; } break; } Modified: haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp 2009-02-20 10:20:54 UTC (rev 29262) +++ haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp 2009-02-20 17:32:48 UTC (rev 29263) @@ -11,10 +11,9 @@ #include #include - +#include #include "RemoteDevicesView.h" -//#include "ConnChanView.h" #include "defs.h" static const uint32 kMsgSetDefaults = 'dflt'; @@ -24,7 +23,9 @@ static const uint32 kMsgStopServices = 'StST'; static const uint32 kMsgShowDebug = 'ShDG'; +LocalDevice* ActiveLocalDevice = NULL; + BluetoothWindow::BluetoothWindow(BRect frame) : BWindow(frame, "Bluetooth", B_TITLED_WINDOW, B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-20 10:20:54 UTC (rev 29262) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-20 17:32:48 UTC (rev 29263) @@ -10,57 +10,225 @@ #include #include #include +#include +#include +#include -#include -#include "defs.h" +#include +#include +#include +#include -static const uint32 kMsgUpdate = 'dflt'; -static const uint32 kMsgRevert = 'rvrt'; +#include "InquiryPanel.h" -static const uint32 kMsgStartServices = 'SrSR'; -static const uint32 kMsgStopServices = 'StST'; +// private funcionaility provided by kit +extern uint8 GetInquiryTime(); + +static const uint32 kMsgStart = 'InSt'; +static const uint32 kMsgFinish = 'InFn'; static const uint32 kMsgShowDebug = 'ShDG'; +static const uint32 kMsgInquiry = 'iQbt'; +static const uint32 kMsgAddListDevice = 'aDdv'; -InquiryPanel::InquiryPanel(BRect frame) - : BWindow(frame, "Bluetooth", B_TITLED_WINDOW, - B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, - B_ALL_WORKSPACES) +static const uint32 kMsgAddToRemoteList = 'aDdL'; +static const uint32 kMsgSecond = 'sCMs'; + +// TODO: Implement a BluetoothDeviceListItem class, this one is stolen from somewhere ..... +class RangeItem : public BListItem { + public: + RangeItem(uint32 lowAddress, uint32 highAddress, const char* name); + ~RangeItem(); + virtual void DrawItem(BView *, BRect, bool = false); + static int Compare(const void *firstArg, const void *secondArg); + private: + char* fName; + uint32 fLowAddress, fHighAddress; +}; + +RangeItem::RangeItem(uint32 lowAddress, uint32 highAddress, const char* name) + : BListItem(), + fLowAddress(lowAddress), + fHighAddress(highAddress) +{ + fName = strdup(name); +} + +RangeItem::~RangeItem() +{ + delete fName; +} + +/*********************************************************** + * DrawItem + ***********************************************************/ +void +RangeItem::DrawItem(BView *owner, BRect itemRect, bool complete) +{ + rgb_color kBlack = { 0,0,0,0 }; + rgb_color kHighlight = { 156,154,156,0 }; + + if (IsSelected() || complete) { + rgb_color color; + if (IsSelected()) + color = kHighlight; + else + color = owner->ViewColor(); + + owner->SetHighColor(color); + owner->SetLowColor(color); + owner->FillRect(itemRect); + owner->SetHighColor(kBlack); + + } else { + owner->SetLowColor(owner->ViewColor()); + } + + BFont font = be_plain_font; + font_height finfo; + font.GetHeight(&finfo); + + BPoint point = BPoint(itemRect.left + 17, itemRect.bottom - finfo.descent + 1); + owner->SetFont(be_fixed_font); + owner->SetHighColor(kBlack); + owner->MovePenTo(point); + +/* if (fLowAddress >= 0) { + char string[255]; + sprintf(string, "0x%04lx - 0x%04lx", fLowAddress, fHighAddress); + owner->DrawString(string); + } + point += BPoint(174, 0);*/ + owner->SetFont(be_plain_font); + owner->MovePenTo(point); + owner->DrawString(fName); +} + +int +RangeItem::Compare(const void *firstArg, const void *secondArg) +{ + const RangeItem *item1 = *static_cast(firstArg); + const RangeItem *item2 = *static_cast(secondArg); + + if (item1->fLowAddress < item2->fLowAddress) { + return -1; + } else if (item1->fLowAddress > item2->fLowAddress) { + return 1; + } else + return 0; + +} + + + +class PanelDiscoveryListener : public DiscoveryListener { + +public: + + PanelDiscoveryListener(InquiryPanel* iPanel) : DiscoveryListener() , fInquiryPanel(iPanel) + { + + } + + + void + DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod) + { + BMessage* message = new BMessage(kMsgAddListDevice); + message->AddPointer("remote", btDevice); + + fInquiryPanel->PostMessage(message); + } + + + void + InquiryCompleted(int discType) + { + BMessage* message = new BMessage(kMsgFinish); + fInquiryPanel->PostMessage(message); + } + + + void + InquiryStarted(status_t status) + { + BMessage* message = new BMessage(kMsgStart); + fInquiryPanel->PostMessage(message); + } + +private: + InquiryPanel* fInquiryPanel; + +}; + + +InquiryPanel::InquiryPanel(BRect frame, LocalDevice* lDevice) + : BWindow(frame, "Bluetooth", B_FLOATING_WINDOW, + B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AUTO_UPDATE_SIZE_LIMITS, + B_ALL_WORKSPACES ), fScanning(false) + , fLocalDevice(lDevice) +{ BRect iDontCare(0,0,0,0); - BRect iDontCareToo(0,0,5,5); SetLayout(new BGroupLayout(B_HORIZONTAL)); - fScanProgress = new BStatusBar(iDontCare, "status", "Scanning", "Scan time"); - fScanProgress->SetMaxValue(52); + fScanProgress = new BStatusBar(iDontCare, "status", "Scanning progress", ""); + activeColor = fScanProgress->BarColor(); + if (fLocalDevice == NULL) + fLocalDevice = LocalDevice::GetLocalDevice(); + fMessage = new BTextView(iDontCare, "description", - iDontCare2, B_FOLLOW_LEFT_RIGHT, - B_WILL_DRAW | B_FRAME_EVENTS); + iDontCare, B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT); fMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fMessage->SetLowColor(fMessage->ViewColor()); fMessage->MakeEditable(false); - fMessage->SetText("asdfdasas asdfas asdfasd a dfad asdf dfasdf a"); - + fMessage->MakeSelectable(false); + fInquiryButton = new BButton("Inquiry", "Inquiry", - new BMessage(kMsgRevert), B_WILL_DRAW); + new BMessage(kMsgInquiry), B_WILL_DRAW); - fAddButton = new BButton("ad", "Add device to list", - new BMessage(kMsgRevert), B_WILL_DRAW); + fAddButton = new BButton("add", "Add device to list", + new BMessage(kMsgAddToRemoteList), B_WILL_DRAW); + fAddButton->SetEnabled(false); + fRemoteList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); - AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) + + if (fLocalDevice != NULL) { + fMessage->SetText("Check that the bluetooth capabilities of your remote device" + " are activated. Press Inquiry to start scanning"); + fInquiryButton->SetEnabled(true); + fDiscoveryAgent = fLocalDevice->GetDiscoveryAgent(); + fDiscoveryListener = new PanelDiscoveryListener(this); + + + SetTitle((const char*)(fLocalDevice->GetFriendlyName().String())); + + + } else { + fMessage->SetText("There has not been found any bluetooth LocalDevice device registered" + " on the system"); + fInquiryButton->SetEnabled(false); + } + + fRunner = new BMessageRunner(BMessenger(this), new BMessage(kMsgSecond), 1000000L, -1); + + + AddChild(BGroupLayoutBuilder(B_VERTICAL, 10) + .Add(fMessage) + .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) .Add(fScanProgress) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) - .Add(fMessage) + .Add(fRemoteList) .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) - .Add(BGroupLayoutBuilder(B_HORIZONTAL, 0) + .Add(BGroupLayoutBuilder(B_HORIZONTAL, 10) .Add(fAddButton) .AddGlue() .Add(fInquiryButton) ) - .SetInsets(5, 5, 5, 5) + .SetInsets(15, 25, 15, 15) ); } @@ -68,34 +236,90 @@ void InquiryPanel::MessageReceived(BMessage *message) { + static float timer = 0; // expected time of the inquiry process + static float scanningTime = 0; + switch (message->what) { - case kMsgUpdate: -/* fDefaultsButton->SetEnabled(fRemoteDevices->IsDefaultable() - || fAntialiasingSettings->IsDefaultable()); + case kMsgInquiry: + + fDiscoveryAgent->StartInquiry(BT_GIAC, fDiscoveryListener, GetInquiryTime()); + + timer = BT_BASE_INQUIRY_TIME * GetInquiryTime(); + fScanProgress->SetMaxValue(timer); // does it works as expected? - fRevertButton->SetEnabled(true);*/ - break; -/* case kMsgSetDefaults: - fColorsView -> MessageReceived(new BMessage(DEFAULT_SETTINGS)); - fAntialiasingSettings->SetDefaults(); - fDefaultsButton->SetEnabled(false); - fRevertButton->SetEnabled(true); - break; + break; + + case kMsgAddListDevice: + { + RemoteDevice* rDevice; + + message->FindPointer("remote", (void **)&rDevice); + + fRemoteList->AddItem(new RangeItem(0,1,bdaddrUtils::ToString(rDevice->GetBluetoothAddress()))); + } + break; - case kMsgRevert: - fColorsView -> MessageReceived(new BMessage(REVERT_SETTINGS)); - fAntialiasingSettings->Revert(); - fDefaultsButton->SetEnabled(fColorsView->IsDefaultable() - || fAntialiasingSettings->IsDefaultable()); - fRevertButton->SetEnabled(false); - break; -*/ default: + case kMsgStart: + fRemoteList->MakeEmpty(); + fScanProgress->Reset(); + + scanningTime = 0; + fScanning = true; + UpdateUIStatus(); + + break; + + case kMsgFinish: + + fScanning = false; + UpdateUIStatus(); + + break; + + case kMsgSecond: + { + if (fScanning) { + BString elapsedTime = "Remaining "; + + fScanProgress->SetTo(scanningTime*100/timer); // TODO should not be needed if SetMaxValue works... + + elapsedTime << (int)(timer - scanningTime) << " seconds"; + fScanProgress->SetTrailingText(elapsedTime.String()); + + scanningTime = scanningTime + 1; + } + + if (fRemoteList->CurrentSelection() < 0) + fAddButton->SetEnabled(false); + else + fAddButton->SetEnabled(true); + } + break; + + default: BWindow::MessageReceived(message); break; } } +void +InquiryPanel::UpdateUIStatus(void) +{ + if (fScanning) { + fAddButton->SetEnabled(false); + fInquiryButton->SetEnabled(false); + fScanProgress->SetBarColor(activeColor); + + } else { + fInquiryButton->SetEnabled(true); + fScanProgress->SetBarColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + fScanProgress->SetTo(100); + fScanProgress->SetText("Scan completed"); + } +} + + bool InquiryPanel::QuitRequested(void) { Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-02-20 10:20:54 UTC (rev 29262) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.h 2009-02-20 17:32:48 UTC (rev 29263) @@ -14,20 +14,35 @@ class BStatusBar; class BButton; class BTextView; +class BListView; +class LocalDevice; +class DiscoveryAgent; +class DiscoveryListener; class InquiryPanel : public BWindow { public: - InquiryPanel(BRect frame); + InquiryPanel(BRect frame, LocalDevice* lDevice = NULL); bool QuitRequested(void); void MessageReceived(BMessage *message); private: - BStatusBar* fScanProgress; - BButton* fAddButton; - BButton* fInquiryButton; - BTextView* fMessage; + BStatusBar* fScanProgress; + BButton* fAddButton; + BButton* fInquiryButton; + BTextView* fMessage; + BListView* fRemoteList; + BMessageRunner* fRunner; + + bool fScanning; + LocalDevice* fLocalDevice; + DiscoveryAgent* fDiscoveryAgent; + DiscoveryListener* fDiscoveryListener; + + void UpdateUIStatus(void); + + rgb_color activeColor; }; #endif Modified: haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-02-20 10:20:54 UTC (rev 29262) +++ haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-02-20 17:32:48 UTC (rev 29263) @@ -2,7 +2,7 @@ * Copyright 2008-09, Oliver Ruiz Dorantes, * All rights reserved. Distributed under the terms of the MIT License. */ -#include "RemoteDevicesView.h" +#include #include #include @@ -13,17 +13,16 @@ #include #include -#include +#include "defs.h" #include "InquiryPanel.h" #include "BluetoothWindow.h" -#include "defs.h" +#include "RemoteDevicesView.h" + static const uint32 kMsgAddDevices = 'ddDv'; - - RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags) : BView(name, flags) { @@ -75,7 +74,7 @@ .SetInsets(5, 5, 5, 100) ); - fAttrList->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN)); + fAttrList->SetSelectionMessage(NULL); } RemoteDevicesView::~RemoteDevicesView(void) @@ -108,7 +107,7 @@ switch(msg->what) { case kMsgAddDevices: { - InquiryPanel* iPanel = new InquiryPanel(BRect(0,0,50,50)); + InquiryPanel* iPanel = new InquiryPanel(BRect(100,100,400,400), ActiveLocalDevice); iPanel->Show(); } break; Modified: haiku/trunk/src/preferences/bluetooth/defs.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/defs.h 2009-02-20 10:20:54 UTC (rev 29262) +++ haiku/trunk/src/preferences/bluetooth/defs.h 2009-02-20 17:32:48 UTC (rev 29263) @@ -1,14 +1,7 @@ #ifndef DEFS_H_ #define DEFS_H_ -// If these paths are changed, ensure that they all end in a '/' character -/* -#define SETTINGS_DIR "/boot/home/config/settings/app_server/" -#define COLOR_SET_DIR "/boot/home/config/settings/color_sets/" -#define CURSOR_SET_DIR "/boot/home/config/settings/cursor_sets/" -#define DECORATORS_DIR "/boot/home/config/add-ons/decorators/" -#define COLOR_SETTINGS_NAME "system_colors" -*/ +#include #define BLUETOOTH_APP_SIGNATURE "application/x-vnd.haiku-BluetoothPrefs" @@ -33,4 +26,6 @@ const uint32 kBorderSpace = 10; const uint32 kItemSpace = 7; +extern LocalDevice* ActiveLocalDevice; + #endif From oruizdorantes at mail.berlios.de Fri Feb 20 19:25:50 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Fri, 20 Feb 2009 19:25:50 +0100 Subject: [Haiku-commits] r29264 - in haiku/trunk: headers/os/bluetooth src/kits/bluetooth Message-ID: <200902201825.n1KIPooY001965@sheep.berlios.de> Author: oruizdorantes Date: 2009-02-20 19:25:41 +0100 (Fri, 20 Feb 2009) New Revision: 29264 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29264&view=rev Modified: haiku/trunk/headers/os/bluetooth/DiscoveryAgent.h haiku/trunk/headers/os/bluetooth/DiscoveryListener.h haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp haiku/trunk/src/kits/bluetooth/KitSupport.cpp haiku/trunk/src/kits/bluetooth/KitSupport.h Log: Add prototypes to keep/use global Inquiry time Modified: haiku/trunk/headers/os/bluetooth/DiscoveryAgent.h =================================================================== --- haiku/trunk/headers/os/bluetooth/DiscoveryAgent.h 2009-02-20 17:32:48 UTC (rev 29263) +++ haiku/trunk/headers/os/bluetooth/DiscoveryAgent.h 2009-02-20 18:25:41 UTC (rev 29264) @@ -7,6 +7,7 @@ #include #include +#include #define BT_CACHED 0x00 @@ -17,13 +18,15 @@ #define BT_LIAC 0x9E8B00 #define BT_MAX_RESPONSES (32) + #define BT_BASE_INQUIRY_TIME (1.28) -#define BT_DEFAULT_INQUIRY_TIME (0x15*BT_BASE_INQUIRY_TIME) /* TODO: REVIEW SPECS! */ +#define BT_DEFAULT_INQUIRY_TIME (0x0A) +#define BT_MIN_INQUIRY_TIME (0x01) // 1.18 secs +#define BT_MAX_INQUIRY_TIME (0x30) // 61.44 secs namespace Bluetooth { -class DiscoveryListener; -class RemoteDevice; +class LocalDevice; class DiscoveryAgent { Modified: haiku/trunk/headers/os/bluetooth/DiscoveryListener.h =================================================================== --- haiku/trunk/headers/os/bluetooth/DiscoveryListener.h 2009-02-20 17:32:48 UTC (rev 29263) +++ haiku/trunk/headers/os/bluetooth/DiscoveryListener.h 2009-02-20 18:25:41 UTC (rev 29264) @@ -8,6 +8,7 @@ #include #include +#include #include @@ -20,8 +21,6 @@ typedef BObjectList RemoteDevicesList; -class RemoteDevice; -class DeviceClass; class LocalDevice; class DiscoveryListener : public BLooper { Modified: haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp 2009-02-20 17:32:48 UTC (rev 29263) +++ haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp 2009-02-20 18:25:41 UTC (rev 29264) @@ -36,7 +36,7 @@ status_t DiscoveryAgent::StartInquiry(int accessCode, DiscoveryListener* listener) { - return StartInquiry(accessCode, listener, BT_DEFAULT_INQUIRY_TIME); + return StartInquiry(accessCode, listener, GetInquiryTime()); } Modified: haiku/trunk/src/kits/bluetooth/KitSupport.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/KitSupport.cpp 2009-02-20 17:32:48 UTC (rev 29263) +++ haiku/trunk/src/kits/bluetooth/KitSupport.cpp 2009-02-20 18:25:41 UTC (rev 29264) @@ -4,16 +4,13 @@ * All rights reserved. Distributed under the terms of the MIT License. * */ +#include +#include - -#include #include #include "KitSupport.h" - - - BMessenger* _RetrieveBluetoothMessenger(void) { // Fix/review: leaking memory here @@ -24,3 +21,16 @@ else return fMessenger; } + + +uint8 GetInquiryTime() +{ + return BT_DEFAULT_INQUIRY_TIME; +} + + +void SetInquiryTime(uint8 time) +{ + ((void)(time)); + +} Modified: haiku/trunk/src/kits/bluetooth/KitSupport.h =================================================================== --- haiku/trunk/src/kits/bluetooth/KitSupport.h 2009-02-20 17:32:48 UTC (rev 29263) +++ haiku/trunk/src/kits/bluetooth/KitSupport.h 2009-02-20 18:25:41 UTC (rev 29264) @@ -5,3 +5,6 @@ #include BMessenger* _RetrieveBluetoothMessenger(void); + +uint8 GetInquiryTime(); +void SetInquiryTime(uint8 time); From mmu_man at mail.berlios.de Fri Feb 20 22:10:13 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 20 Feb 2009 22:10:13 +0100 Subject: [Haiku-commits] r29265 - haiku/trunk/build/jam Message-ID: <200902202110.n1KLADMW022127@sheep.berlios.de> Author: mmu_man Date: 2009-02-20 22:10:10 +0100 (Fri, 20 Feb 2009) New Revision: 29265 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29265&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Update Firefox to a newer build courtesy mmadia. It's actually named BeZilla this time to avoid the usual trademark vs non official problem. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2009-02-20 18:25:41 UTC (rev 29264) +++ haiku/trunk/build/jam/OptionalPackages 2009-02-20 21:10:10 UTC (rev 29265) @@ -280,12 +280,12 @@ } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { Echo "No optional package Firefox available for gcc4" ; } else { - InstallOptionalHaikuImagePackage Firefox-2.0.0.17 - : http://www.yellowbites.com/downloads/Firefox-2.0.0.17.zip + InstallOptionalHaikuImagePackage BeZillaBrowser-gcc2-20090218 + : http://bezilla.beuser.de/builds/BeZillaBrowser-gcc2-20090218.zip : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/Firefox/Firefox ; + : /boot/apps/BeZillaBrowser/BeZillaBrowser ; } } From axeld at pinc-software.de Fri Feb 20 23:26:52 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Fri, 20 Feb 2009 23:26:52 +0100 Subject: [Haiku-commits] r29252 - in haiku/trunk/docs/welcome: . en In-Reply-To: <499ECBC8.2030103@googlemail.com> References: <200902192028.n1JKShxx021160@sheep.berlios.de> <499ECBC8.2030103@googlemail.com> Message-ID: <499F2E2C.3040202@pinc-software.de> Humdinger wrote: > I'll soon have to commit an update to every page as I plan to use more CSS styles and the > nearing migration to the (translation) website lends itself to this change. I wouldn't > want to undo your mime setting... You don't need to mind about that; unless you replace the file (ie. delete it, and add a new one), the properties are preserved. Bye, Axel. From mmu_man at mail.berlios.de Sat Feb 21 00:37:44 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Feb 2009 00:37:44 +0100 Subject: [Haiku-commits] r29266 - haiku/trunk/src/bin Message-ID: <200902202337.n1KNbitR021969@sheep.berlios.de> Author: mmu_man Date: 2009-02-21 00:37:43 +0100 (Sat, 21 Feb 2009) New Revision: 29266 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29266&view=rev Modified: haiku/trunk/src/bin/ps.c Log: Patch by Bjoern Herzig, adds -a option, some cleanup. Modified: haiku/trunk/src/bin/ps.c =================================================================== --- haiku/trunk/src/bin/ps.c 2009-02-20 21:10:10 UTC (rev 29265) +++ haiku/trunk/src/bin/ps.c 2009-02-20 23:37:43 UTC (rev 29266) @@ -5,29 +5,102 @@ * Authors: * Francois Revol (mmu_man) * Salvatore Benedetto + * Bjoern Herzig (xRaich[o]2x) */ #include +#include #include #include #define SNOOZE_TIME 100000 +char *states[] = {"run", "rdy", "msg", "zzz", "sus", "wait" }; -int -main(int argc, char **argv) +void printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo); +void printTeamInfo(team_info *teamInfo, bool printHeader); + +void printTeamInfo(team_info *teamInfo, bool printHeader) { + // Print team info + if (printHeader) + printf("%-49s %5s %8s %4s %4s\n", "Team", "Id", "#Threads", "Gid", "Uid"); + + printf("%-49s %5ld %8ld %4d %4d\n", teamInfo->args, teamInfo->team, + teamInfo->thread_count, teamInfo->uid, teamInfo->gid); +} + +void printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo) { + char *threadState; + uint32 threadCookie = 0; + sem_info semaphoreInfo; + thread_info threadInfo; + + // Print all info about its threads too + while (get_next_thread_info(teamInfo->team, &threadCookie, &threadInfo) + >= B_OK) { + if (threadInfo.state < B_THREAD_RUNNING + || threadInfo.state > B_THREAD_WAITING) + // This should never happen + threadState = "???"; + else + threadState = states[threadInfo.state - 1]; + + printf("%-29s %5ld %8s %4ld %8llu %8llu ", + threadInfo.name, threadInfo.thread, threadState, + threadInfo.priority, (threadInfo.user_time / 1000), + (threadInfo.kernel_time / 1000)); + + if (printSemaphoreInfo) { + if (threadInfo.state == B_THREAD_WAITING && threadInfo.sem != -1) { + status_t status = get_sem_info(threadInfo.sem, &semaphoreInfo); + if (status == B_OK) + printf("%s(%ld)\n", semaphoreInfo.name, semaphoreInfo.sem); + else + printf("%s(%ld)\n", strerror(status), threadInfo.sem); + } else + puts(""); + } + else + puts(""); + } +} + +int main(int argc, char **argv) +{ team_info teamInfo; - thread_info threadInfo; uint32 teamCookie = 0; - uint32 threadCookie = 0; - sem_info semaphoreInfo; - char *threadState; - char *states[] = {"run", "rdy", "msg", "zzz", "sus", "wait" }; system_info systemInfo; - bool printSystemInfo = true; + bool printSystemInfo = false; + bool printThreads = false; + bool printHeader = true; + bool printSemaphoreInfo = false; // match this in team name char *string_to_match; + + int c; + + while ((c = getopt(argc, argv,"ihas")) != EOF) { + switch(c) { + case 'i': + printSystemInfo = true; + break; + case 'h': + printf( "usage: ps [-hais] [team]\n" + "-h : show help\n" + "-i : show system info\n" + "-s : show semaphore info\n" + "-a : show threads too (by default only teams are displayed)\n"); + return 0; + break; + case 'a': + printThreads = true; + break; + case 's': + printSemaphoreInfo = true; + break; + } + } // TODO: parse command line // Possible command line options: @@ -38,11 +111,27 @@ // -a show threads too (by default only teams are displayed) // -s show semaphore info // -i show system info - string_to_match = (argc == 2) ? argv[1] : NULL; - - printf("%-50s %4s %8s %4s %4s\n", "Team", "Id", "#Threads", "Gid", "Uid"); - while (get_next_team_info(&teamCookie, &teamInfo) >= B_OK) { - if (string_to_match) { + + if (argc == 2 && (printSystemInfo||printThreads)) + string_to_match = NULL; + else + string_to_match = (argc >= 2) ? argv[argc-1] : NULL; + + if (!string_to_match) { + while (get_next_team_info(&teamCookie, &teamInfo) >= B_OK) { + + printTeamInfo(&teamInfo,printHeader); + printHeader = false; + if (printThreads) { + printf("\n%-29s %5s %8s %4s %8s %8s\n", "Thread", "Id", "State","Prio", "UTime", "KTime"); + printTeamThreads(&teamInfo,printSemaphoreInfo); + printf("--------------------------------------------------------------------------\n"); + printHeader = true; + } + } + } + else { + while (get_next_team_info(&teamCookie, &teamInfo) >= B_OK) { char *p; p = teamInfo.args; if ((p = strchr(p, ' '))) @@ -52,41 +141,9 @@ p = teamInfo.args; if (strstr(p, string_to_match) == NULL) continue; - // Print team info - printf("%-50s %4ld %8ld %4d %4d\n\n", teamInfo.args, teamInfo.team, - teamInfo.thread_count, teamInfo.uid, teamInfo.gid); - - printf("%-30s %4s %8s %4s %8s %8s\n", "Thread", "Id", "State", - "Prio", "UTime", "KTime"); - // Print all info about its threads too - while (get_next_thread_info(teamInfo.team, &threadCookie, &threadInfo) - >= B_OK) { - if (threadInfo.state < B_THREAD_RUNNING - || threadInfo.state > B_THREAD_WAITING) - // This should never happen - threadState = "???"; - else - threadState = states[threadInfo.state - 1]; - - printf("%-30s %4ld %8s %4ld %8llu %8llu ", - threadInfo.name, threadInfo.thread, threadState, - threadInfo.priority, (threadInfo.user_time / 1000), - (threadInfo.kernel_time / 1000)); - - if (threadInfo.state == B_THREAD_WAITING && threadInfo.sem != -1) { - status_t status = get_sem_info(threadInfo.sem, &semaphoreInfo); - if (status == B_OK) - printf("%s(%ld)\n", semaphoreInfo.name, semaphoreInfo.sem); - else - printf("%s(%ld)\n", strerror(status), threadInfo.sem); - } else - puts(""); - } - break; - - } else { - printf("%-50s %4ld %8ld %4d %4d\n", teamInfo.args, teamInfo.team, - teamInfo.thread_count, teamInfo.uid, teamInfo.gid); + printTeamInfo(&teamInfo,true); + printf("\n%-29s %5s %8s %4s %8s %8s\n", "Thread", "Id", "State","Prio", "UTime", "KTime"); + printTeamThreads(&teamInfo,printSemaphoreInfo); } } From umccullough at gmail.com Sat Feb 21 00:43:07 2009 From: umccullough at gmail.com (Urias McCullough) Date: Fri, 20 Feb 2009 15:43:07 -0800 Subject: [Haiku-commits] r29266 - haiku/trunk/src/bin In-Reply-To: <200902202337.n1KNbitR021969@sheep.berlios.de> References: <200902202337.n1KNbitR021969@sheep.berlios.de> Message-ID: <1e80d8750902201543q2d34581du3b85d33b7274f017@mail.gmail.com> On Fri, Feb 20, 2009 at 3:37 PM, mmu_man at BerliOS wrote: > Author: mmu_man > Date: 2009-02-21 00:37:43 +0100 (Sat, 21 Feb 2009) > New Revision: 29266 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29266&view=rev > > Modified: > haiku/trunk/src/bin/ps.c > Log: > Patch by Bjoern Herzig, adds -a option, some cleanup. > > + while ((c = getopt(argc, argv,"ihas")) != EOF) { > + switch(c) { > + case 'i': > + printSystemInfo = true; > + break; > + case 'h': > + printf( "usage: ps [-hais] [team]\n" > + "-h : show help\n" > + "-i : show system info\n" > + "-s : show semaphore info\n" > + "-a : show threads too (by default only teams are displayed)\n"); > + return 0; > + break; > + case 'a': > + printThreads = true; > + break; > + case 's': > + printSemaphoreInfo = true; > + break; > + } > + } > > // TODO: parse command line > // Possible command line options: > @@ -38,11 +111,27 @@ > // -a show threads too (by default only teams are displayed) > // -s show semaphore info > // -i show system info Does the TODO go away now? From revol at free.fr Sat Feb 21 00:48:12 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sat, 21 Feb 2009 00:48:12 +0100 CET Subject: [Haiku-commits] r29266 - haiku/trunk/src/bin In-Reply-To: <1e80d8750902201543q2d34581du3b85d33b7274f017@mail.gmail.com> Message-ID: <37010043410-BeMail@laptop> > > Does the TODO go away now? I'd suppose so. Fran?ois. From mmu_man at mail.berlios.de Sat Feb 21 00:48:24 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Feb 2009 00:48:24 +0100 Subject: [Haiku-commits] r29267 - haiku/trunk/src/bin Message-ID: <200902202348.n1KNmORD030954@sheep.berlios.de> Author: mmu_man Date: 2009-02-21 00:48:20 +0100 (Sat, 21 Feb 2009) New Revision: 29267 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29267&view=rev Modified: haiku/trunk/src/bin/ps.c Log: Update TODO Modified: haiku/trunk/src/bin/ps.c =================================================================== --- haiku/trunk/src/bin/ps.c 2009-02-20 23:37:43 UTC (rev 29266) +++ haiku/trunk/src/bin/ps.c 2009-02-20 23:48:20 UTC (rev 29267) @@ -104,13 +104,7 @@ // TODO: parse command line // Possible command line options: - // -h show help - // ps - by default it only shows all team info - // ps [team] - shows info about this team with all its threads // -t pstree like output - // -a show threads too (by default only teams are displayed) - // -s show semaphore info - // -i show system info if (argc == 2 && (printSystemInfo||printThreads)) string_to_match = NULL; From mmlr at mail.berlios.de Sat Feb 21 03:35:58 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 21 Feb 2009 03:35:58 +0100 Subject: [Haiku-commits] r29268 - haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay Message-ID: <200902210235.n1L2ZwQL024224@sheep.berlios.de> Author: mmlr Date: 2009-02-21 03:35:55 +0100 (Sat, 21 Feb 2009) New Revision: 29268 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29268&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp Log: * Implemented create/create dir/create symlink and remove/remove dir in the write_overlay and add the necessary infrastructure for it. * Fix setting permissions through write stat. Modified: haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-20 23:48:20 UTC (rev 29267) +++ haiku/trunk/src/add-ons/kernel/file_systems/layers/write_overlay/write_overlay.cpp 2009-02-21 02:35:55 UTC (rev 29268) @@ -36,11 +36,28 @@ namespace write_overlay { +status_t publish_overlay_vnode(fs_volume *volume, ino_t inodeNumber, + void *privateNode, int type); + +class OverlayInode; + struct open_cookie { int open_mode; void * super_cookie; }; + +struct open_dir_cookie { + uint32 index; +}; + + +struct overlay_dirent { + ino_t inode_number; + char * name; +}; + + struct write_buffer { write_buffer * next; off_t position; @@ -57,27 +74,38 @@ fs_volume * Volume() { return fVolume; } fs_volume * SuperVolume() { return fVolume->super_volume; } + ino_t BuildInodeNumber() { return fCurrentInodeNumber++; } + private: fs_volume * fVolume; + ino_t fCurrentInodeNumber; }; class OverlayInode { public: OverlayInode(OverlayVolume *volume, - fs_vnode *superVnode, ino_t inodeNumber); + fs_vnode *superVnode, ino_t inodeNumber, + OverlayInode *parentDir = NULL, + mode_t mode = 0); ~OverlayInode(); status_t InitCheck(); + bool IsVirtual() { return fIsVirtual; } + fs_volume * Volume() { return fVolume->Volume(); } fs_volume * SuperVolume() { return fVolume->SuperVolume(); } fs_vnode * SuperVnode() { return &fSuperVnode; } ino_t InodeNumber() { return fInodeNumber; } + status_t Lookup(const char *name, ino_t *inodeNumber); + status_t ReadStat(struct stat *stat); status_t WriteStat(const struct stat *stat, uint32 statMask); + status_t Create(const char *name, int openMode, int perms, + void **cookie, ino_t *newInodeNumber); status_t Open(int openMode, void **cookie); status_t Close(void *cookie); status_t FreeCookie(void *cookie); @@ -86,14 +114,41 @@ status_t Write(void *cookie, off_t position, const void *buffer, size_t *length); + status_t CreateDir(const char *name, + int perms, ino_t *newInodeNumber); + status_t RemoveDir(const char *name); + status_t OpenDir(void **cookie); + status_t CloseDir(void *cookie); + status_t FreeDirCookie(void *cookie); + status_t ReadDir(void *cookie, struct dirent *buffer, + size_t bufferSize, uint32 *num); + status_t RewindDir(void *cookie); + + status_t CreateSymlink(const char *name, const char *path, + int mode); + status_t ReadSymlink(char *buffer, size_t *bufferSize); + + status_t AddEntry(overlay_dirent *entry); + status_t RemoveEntry(const char *name, + overlay_dirent **entry); + private: + status_t _PopulateDirents(); + status_t _CreateCommon(const char *name, int type, int perms, + ino_t *newInodeNumber, OverlayInode **node); + OverlayVolume * fVolume; + OverlayInode * fParentDir; fs_vnode fSuperVnode; ino_t fInodeNumber; write_buffer * fWriteBuffers; off_t fOriginalNodeLength; + overlay_dirent ** fDirents; + uint32 fDirentCount; struct stat fStat; bool fHasStat; + bool fHasDirents; + bool fIsVirtual; }; @@ -101,7 +156,8 @@ OverlayVolume::OverlayVolume(fs_volume *volume) - : fVolume(volume) + : fVolume(volume), + fCurrentInodeNumber((ino_t)1 << 32) { } @@ -115,27 +171,53 @@ OverlayInode::OverlayInode(OverlayVolume *volume, fs_vnode *superVnode, - ino_t inodeNumber) + ino_t inodeNumber, OverlayInode *parentDir, mode_t mode) : fVolume(volume), - fSuperVnode(*superVnode), + fParentDir(parentDir), fInodeNumber(inodeNumber), fWriteBuffers(NULL), fOriginalNodeLength(-1), - fHasStat(false) + fDirents(NULL), + fDirentCount(0), + fHasStat(false), + fHasDirents(false), + fIsVirtual(superVnode == NULL) { - TRACE("inode created\n"); + TRACE("inode created %lld\n", fInodeNumber); + + if (superVnode != NULL) + fSuperVnode = *superVnode; + else { + fStat.st_dev = SuperVolume()->id; + fStat.st_ino = fInodeNumber; + fStat.st_mode = mode; + fStat.st_nlink = 1; + fStat.st_uid = 0; + fStat.st_gid = 0; + fStat.st_size = 0; + fStat.st_rdev = 0; + fStat.st_blksize = 1024; + fStat.st_atime = fStat.st_mtime = fStat.st_ctime = fStat.st_crtime + = time(NULL); + fStat.st_type = 0; + fHasStat = true; + } } OverlayInode::~OverlayInode() { - TRACE("inode destroyed\n"); + TRACE("inode destroyed %lld\n", fInodeNumber); write_buffer *element = fWriteBuffers; while (element) { write_buffer *next = element->next; free(element); element = next; } + + for (uint32 i = 0; i < fDirentCount; i++) + free(fDirents[i]); + free(fDirents); } @@ -147,6 +229,35 @@ status_t +OverlayInode::Lookup(const char *name, ino_t *inodeNumber) +{ + if (strcmp(name, ".") == 0) { + *inodeNumber = fInodeNumber; + return get_vnode(SuperVolume(), *inodeNumber, NULL); + } + + if (fIsVirtual && strcmp(name, "..") == 0) { + *inodeNumber = fParentDir->InodeNumber(); + return get_vnode(Volume(), *inodeNumber, NULL); + } + + for (uint32 i = 0; i < fDirentCount; i++) { + if (strcmp(fDirents[i]->name, name) == 0) { + *inodeNumber = fDirents[i]->inode_number; + return get_vnode(SuperVolume(), *inodeNumber, NULL); + } + } + + if (!fHasDirents && !fIsVirtual && fSuperVnode.ops->lookup != NULL) { + return fSuperVnode.ops->lookup(SuperVolume(), &fSuperVnode, name, + inodeNumber); + } + + return B_ENTRY_NOT_FOUND; +} + + +status_t OverlayInode::ReadStat(struct stat *stat) { if (!fHasStat) { @@ -180,7 +291,7 @@ fStat.st_size = stat->st_size; if (statMask & B_STAT_MODE) - fStat.st_mode = stat->st_mode; + fStat.st_mode = (fStat.st_mode & ~S_IUMSK) | (stat->st_mode & S_IUMSK); if (statMask & B_STAT_UID) fStat.st_uid = stat->st_uid; if (statMask & B_STAT_GID) @@ -203,8 +314,30 @@ status_t +OverlayInode::Create(const char *name, int openMode, int perms, void **cookie, + ino_t *newInodeNumber) +{ + OverlayInode *newNode = NULL; + status_t result = _CreateCommon(name, S_IFREG, perms, newInodeNumber, + &newNode); + if (result != B_OK) + return result; + + return newNode->Open(openMode, cookie); +} + + +status_t OverlayInode::Open(int openMode, void **_cookie) { + if (fIsVirtual) { + if (openMode & O_TRUNC) + fStat.st_size = 0; + + *_cookie = NULL; + return B_OK; + } + if (fSuperVnode.ops->open == NULL) return B_UNSUPPORTED; @@ -243,6 +376,9 @@ status_t OverlayInode::Close(void *_cookie) { + if (fIsVirtual) + return B_OK; + open_cookie *cookie = (open_cookie *)_cookie; return fSuperVnode.ops->close(SuperVolume(), &fSuperVnode, cookie->super_cookie); @@ -252,6 +388,9 @@ status_t OverlayInode::FreeCookie(void *_cookie) { + if (fIsVirtual) + return B_OK; + open_cookie *cookie = (open_cookie *)_cookie; status_t result = fSuperVnode.ops->free_cookie(SuperVolume(), &fSuperVnode, cookie->super_cookie); @@ -396,12 +535,325 @@ } +status_t +OverlayInode::CreateDir(const char *name, int perms, ino_t *newInodeNumber) +{ + return _CreateCommon(name, S_IFDIR, perms, newInodeNumber, NULL); +} + + +status_t +OverlayInode::RemoveDir(const char *name) +{ + return RemoveEntry(name, NULL); +} + + +status_t +OverlayInode::OpenDir(void **cookie) +{ + if (!fHasDirents) + _PopulateDirents(); + + open_dir_cookie *dirCookie = (open_dir_cookie *)malloc( + sizeof(open_dir_cookie)); + if (dirCookie == NULL) + return B_NO_MEMORY; + + dirCookie->index = 0; + *cookie = dirCookie; + return B_OK; +} + + +status_t +OverlayInode::CloseDir(void *cookie) +{ + return B_OK; +} + + +status_t +OverlayInode::FreeDirCookie(void *cookie) +{ + free(cookie); + return B_OK; +} + + +status_t +OverlayInode::ReadDir(void *cookie, struct dirent *buffer, size_t bufferSize, + uint32 *num) +{ + open_dir_cookie *dirCookie = (open_dir_cookie *)cookie; + if (dirCookie->index >= fDirentCount) { + *num = 0; + return B_OK; + } + + overlay_dirent *dirent = fDirents[dirCookie->index++]; + size_t nameLength = MIN(strlen(dirent->name), + bufferSize - sizeof(struct dirent)) + 1; + + buffer->d_dev = SuperVolume()->id; + buffer->d_pdev = 0; + buffer->d_ino = dirent->inode_number; + buffer->d_pino = 0; + buffer->d_reclen = sizeof(struct dirent) + nameLength; + strlcpy(buffer->d_name, dirent->name, nameLength); + + *num = 1; + return B_OK; +} + + +status_t +OverlayInode::RewindDir(void *cookie) +{ + open_dir_cookie *dirCookie = (open_dir_cookie *)cookie; + dirCookie->index = 0; + return B_OK; +} + + +status_t +OverlayInode::CreateSymlink(const char *name, const char *path, int perms) +{ + OverlayInode *newNode = NULL; + status_t result = _CreateCommon(name, S_IFLNK, perms, NULL, &newNode); + if (result != B_OK) + return result; + + size_t writeLength = strlen(path); + return newNode->Write(NULL, 0, path, &writeLength); +} + + +status_t +OverlayInode::ReadSymlink(char *buffer, size_t *bufferSize) +{ + if (fIsVirtual) { + if (!S_ISLNK(fStat.st_mode)) + return B_BAD_VALUE; + + return Read(NULL, 0, buffer, bufferSize); + } + + if (fSuperVnode.ops->read_symlink == NULL) + return B_UNSUPPORTED; + + return fSuperVnode.ops->read_symlink(SuperVolume(), &fSuperVnode, buffer, + bufferSize); +} + + +status_t +OverlayInode::AddEntry(overlay_dirent *entry) +{ + if (!fHasDirents) + _PopulateDirents(); + + for (uint32 i = 0; i < fDirentCount; i++) + if (strcmp(fDirents[i]->name, entry->name) == 0) + return B_FILE_EXISTS; + + overlay_dirent **newDirents = (overlay_dirent **)realloc(fDirents, + sizeof(overlay_dirent *) * (fDirentCount + 1)); + if (newDirents == NULL) + return B_NO_MEMORY; + + fDirents = newDirents; + fDirents[fDirentCount++] = entry; + + notify_entry_created(SuperVolume()->id, fInodeNumber, entry->name, + entry->inode_number); + + return B_OK; +} + + +status_t +OverlayInode::RemoveEntry(const char *name, overlay_dirent **_entry) +{ + if (!fHasDirents) + _PopulateDirents(); + + for (uint32 i = 0; i < fDirentCount; i++) { + overlay_dirent *entry = fDirents[i]; + if (strcmp(entry->name, name) == 0) { + for (uint32 j = i + 1; j < fDirentCount; j++) + fDirents[j - 1] = fDirents[j]; + fDirentCount--; + + notify_entry_removed(SuperVolume()->id, fInodeNumber, entry->name, + entry->inode_number); + + if (_entry != NULL) + *_entry = entry; + else { + free(entry->name); + free(entry); + } + + return B_OK; + } + } + + return B_ENTRY_NOT_FOUND; +} + + +status_t +OverlayInode::_PopulateDirents() +{ + if (fHasDirents) + return B_OK; + + if (fIsVirtual || fSuperVnode.ops->open_dir == NULL + || fSuperVnode.ops->read_dir == NULL) { + fDirents = (overlay_dirent **)malloc(sizeof(overlay_dirent *) * 2); + if (fDirents == NULL) + return B_NO_MEMORY; + + const char *names[] = { ".", ".." }; + ino_t inodes[] = { fInodeNumber, + fParentDir != NULL ? fParentDir->InodeNumber() : 0 }; + for (uint32 i = 0; i < 2; i++) { + fDirents[i] = (overlay_dirent *)malloc(sizeof(overlay_dirent)); + if (fDirents[i] == NULL) + return B_NO_MEMORY; + + fDirents[i]->inode_number = inodes[i]; + fDirents[i]->name = strdup(names[i]); + if (fDirents[i]->name == NULL) { + free(fDirents[i]); + return B_NO_MEMORY; + } + + fDirentCount++; + } + + fHasDirents = true; + return B_OK; + } + + fHasDirents = true; + void *superCookie = NULL; + status_t result = fSuperVnode.ops->open_dir(SuperVolume(), + &fSuperVnode, &superCookie); + if (result != B_OK) + return result; + + size_t bufferSize = sizeof(struct dirent) + B_FILE_NAME_LENGTH; + struct dirent *buffer = (struct dirent *)malloc(bufferSize); + if (buffer == NULL) + return B_NO_MEMORY; + + while (result == B_OK) { + uint32 num = 1; + result = fSuperVnode.ops->read_dir(SuperVolume(), + &fSuperVnode, superCookie, buffer, bufferSize, &num); + if (result != B_OK || num == 0) + break; + + overlay_dirent **newDirents = (overlay_dirent **)realloc(fDirents, + sizeof(overlay_dirent *) * (fDirentCount + num)); + if (newDirents == NULL) + break; + + fDirents = newDirents; + struct dirent *dirent = buffer; + for (uint32 i = 0; i < num; i++) { + overlay_dirent *entry = (overlay_dirent *)malloc( + sizeof(overlay_dirent)); + if (entry == NULL) + break; + + entry->inode_number = dirent->d_ino; + entry->name = strdup(dirent->d_name); + if (entry->name == NULL) { + free(entry); + break; + } + + fDirents[fDirentCount++] = entry; + dirent = (struct dirent *)((uint8 *)dirent + dirent->d_reclen); + } + } + + if (fSuperVnode.ops->close_dir != NULL) + fSuperVnode.ops->close_dir(SuperVolume(), &fSuperVnode, superCookie); + + if (fSuperVnode.ops->free_dir_cookie != NULL) + fSuperVnode.ops->free_dir_cookie(SuperVolume(), &fSuperVnode, superCookie); + + free(buffer); + return B_OK; +} + + +status_t +OverlayInode::_CreateCommon(const char *name, int type, int perms, + ino_t *newInodeNumber, OverlayInode **_node) +{ + if (!fHasStat) + ReadStat(NULL); + + if (!S_ISDIR(fStat.st_mode)) + return B_NOT_A_DIRECTORY; + + overlay_dirent *entry = (overlay_dirent *)malloc(sizeof(overlay_dirent)); + if (entry == NULL) + return B_NO_MEMORY; + + entry->name = strdup(name); + if (entry->name == NULL) { + free(entry); + return B_NO_MEMORY; + } + + entry->inode_number = fVolume->BuildInodeNumber(); + + OverlayInode *node = new(std::nothrow) OverlayInode(fVolume, NULL, + entry->inode_number, this, perms | type); + if (node == NULL) { + free(entry->name); + free(entry); + return B_NO_MEMORY; + } + + status_t result = AddEntry(entry); + if (result != B_OK) { + free(entry->name); + free(entry); + delete node; + } + + result = publish_overlay_vnode(fVolume->Volume(), entry->inode_number, + node, type); + if (result != B_OK) { + RemoveEntry(entry->name, NULL); + delete node; + return result; + } + + if (newInodeNumber != NULL) + *newInodeNumber = entry->inode_number; + if (_node != NULL) + *_node = node; + + return B_OK; +} + + // #pragma mark - vnode ops #define OVERLAY_CALL(op, params...) \ TRACE("relaying op: " #op "\n"); \ OverlayInode *node = (OverlayInode *)vnode->private_node; \ + if (node->IsVirtual()) \ + return B_UNSUPPORTED; \ fs_vnode *superVnode = node->SuperVnode(); \ if (superVnode->ops->op != NULL) \ return superVnode->ops->op(volume->super_volume, superVnode, params); @@ -410,10 +862,15 @@ static status_t overlay_put_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter) { + TRACE("put_vnode\n"); OverlayInode *node = (OverlayInode *)vnode->private_node; - fs_vnode *superVnode = node->SuperVnode(); + if (node->IsVirtual()) { + delete node; + return B_OK; + } status_t result = B_OK; + fs_vnode *superVnode = node->SuperVnode(); if (superVnode->ops->put_vnode != NULL) { result = superVnode->ops->put_vnode(volume->super_volume, superVnode, reenter); @@ -427,10 +884,15 @@ static status_t overlay_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter) { + TRACE("remove_vnode\n"); OverlayInode *node = (OverlayInode *)vnode->private_node; - fs_vnode *superVnode = node->SuperVnode(); + if (node->IsVirtual()) { + delete node; + return B_OK; + } status_t result = B_OK; + fs_vnode *superVnode = node->SuperVnode(); if (superVnode->ops->remove_vnode != NULL) { result = superVnode->ops->remove_vnode(volume->super_volume, superVnode, reenter); @@ -451,8 +913,12 @@ } OverlayInode *node = (OverlayInode *)vnode->private_node; + if (node->IsVirtual()) { + *_superVnode = *vnode; + return B_OK; + } + fs_vnode *superVnode = node->SuperVnode(); - if (superVnode->ops->get_super_vnode != NULL) { return superVnode->ops->get_super_vnode(volume->super_volume, superVnode, superVolume, _superVnode); @@ -466,8 +932,8 @@ static status_t overlay_lookup(fs_volume *volume, fs_vnode *vnode, const char *name, ino_t *id) { - OVERLAY_CALL(lookup, name, id) - return B_UNSUPPORTED; + TRACE("lookup: \"%s\"\n", name); + return ((OverlayInode *)vnode->private_node)->Lookup(name, id); } @@ -574,12 +1040,6 @@ static status_t overlay_fsync(fs_volume *volume, fs_vnode *vnode) { - OverlayInode *node = (OverlayInode *)vnode->private_node; - fs_vnode *superVnode = node->SuperVnode(); - - if (superVnode->ops->fsync != NULL) - return superVnode->ops->fsync(volume->super_volume, superVnode); - return B_OK; } @@ -588,8 +1048,9 @@ overlay_read_symlink(fs_volume *volume, fs_vnode *vnode, char *buffer, size_t *bufferSize) { - OVERLAY_CALL(read_symlink, buffer, bufferSize) - return B_UNSUPPORTED; + TRACE("read_symlink\n"); + return ((OverlayInode *)vnode->private_node)->ReadSymlink(buffer, + bufferSize); } @@ -597,8 +1058,9 @@ overlay_create_symlink(fs_volume *volume, fs_vnode *vnode, const char *name, const char *path, int mode) { - OVERLAY_CALL(create_symlink, name, path, mode) - return B_UNSUPPORTED; + TRACE("create_symlink: \"%s\" -> \"%s\"\n", name, path); + return ((OverlayInode *)vnode->private_node)->CreateSymlink(name, path, + mode); } @@ -606,7 +1068,6 @@ overlay_link(fs_volume *volume, fs_vnode *vnode, const char *name, fs_vnode *target) { - OVERLAY_CALL(link, name, target) return B_UNSUPPORTED; } @@ -614,31 +1075,64 @@ static status_t overlay_unlink(fs_volume *volume, fs_vnode *vnode, const char *name) { - OVERLAY_CALL(unlink, name) - return B_UNSUPPORTED; + TRACE("unlink: \"%s\"\n", name); + return ((OverlayInode *)vnode->private_node)->RemoveEntry(name, NULL); } static status_t overlay_rename(fs_volume *volume, fs_vnode *vnode, - const char *fromName, fs_vnode *toDir, const char *toName) + const char *fromName, fs_vnode *toVnode, const char *toName) { - OVERLAY_CALL(rename, fromName, toDir, toName) - return B_UNSUPPORTED; + TRACE("rename: \"%s\" -> \"%s\"\n", fromName, toName); + OverlayInode *fromNode = (OverlayInode *)vnode->private_node; + OverlayInode *toNode = (OverlayInode *)toVnode->private_node; + overlay_dirent *entry = NULL; + + status_t result = fromNode->RemoveEntry(fromName, &entry); + if (result != B_OK) + return result; + + char *oldName = entry->name; + entry->name = strdup(toName); + if (entry->name == NULL) { + entry->name = oldName; + if (fromNode->AddEntry(entry) != B_OK) { + free(entry->name); + free(entry); + } + + return B_NO_MEMORY; + } + + result = toNode->AddEntry(entry); + if (result != B_OK) { + free(entry->name); + entry->name = oldName; + if (fromNode->AddEntry(entry) != B_OK) { + free(entry->name); + free(entry); + } + + return result; + } + + return B_OK; } static status_t overlay_access(fs_volume *volume, fs_vnode *vnode, int mode) { - OVERLAY_CALL(access, mode) - return B_UNSUPPORTED; + // TODO: implement + return B_OK; } static status_t overlay_read_stat(fs_volume *volume, fs_vnode *vnode, struct stat *stat) { + TRACE("read_stat\n"); return ((OverlayInode *)vnode->private_node)->ReadStat(stat); } @@ -647,6 +1141,7 @@ overlay_write_stat(fs_volume *volume, fs_vnode *vnode, const struct stat *stat, uint32 statMask) { + TRACE("write_stat\n"); return ((OverlayInode *)vnode->private_node)->WriteStat(stat, statMask); } @@ -655,14 +1150,16 @@ overlay_create(fs_volume *volume, fs_vnode *vnode, const char *name, int openMode, int perms, void **cookie, ino_t *newVnodeID) { - OVERLAY_CALL(create, name, openMode, perms, cookie, newVnodeID) - return B_UNSUPPORTED; + TRACE("create: \"%s\"\n", name); + return ((OverlayInode *)vnode->private_node)->Create(name, openMode, + perms, cookie, newVnodeID); } static status_t overlay_open(fs_volume *volume, fs_vnode *vnode, int openMode, void **cookie) { + TRACE("open\n"); return ((OverlayInode *)vnode->private_node)->Open(openMode, cookie); } @@ -670,6 +1167,7 @@ static status_t overlay_close(fs_volume *volume, fs_vnode *vnode, void *cookie) { + TRACE("close\n"); return ((OverlayInode *)vnode->private_node)->Close(cookie); } @@ -677,6 +1175,7 @@ static status_t overlay_free_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie) { + TRACE("free_cookie\n"); return ((OverlayInode *)vnode->private_node)->FreeCookie(cookie); } @@ -685,6 +1184,7 @@ overlay_read(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, void *buffer, size_t *length) { + TRACE("read\n"); return ((OverlayInode *)vnode->private_node)->Read(cookie, pos, buffer, length); } @@ -694,6 +1194,7 @@ overlay_write(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const void *buffer, size_t *length) { + TRACE("write\n"); return ((OverlayInode *)vnode->private_node)->Write(cookie, pos, buffer, length); } @@ -703,40 +1204,41 @@ overlay_create_dir(fs_volume *volume, fs_vnode *vnode, const char *name, int perms, ino_t *newVnodeID) { - OVERLAY_CALL(create_dir, name, perms, newVnodeID) - return B_UNSUPPORTED; + TRACE("create_dir: \"%s\"\n", name); + return ((OverlayInode *)vnode->private_node)->CreateDir(name, perms, + newVnodeID); } static status_t overlay_remove_dir(fs_volume *volume, fs_vnode *vnode, const char *name) { - OVERLAY_CALL(remove_dir, name) - return B_UNSUPPORTED; + TRACE("remove_dir: \"%s\"\n", name); + return ((OverlayInode *)vnode->private_node)->RemoveDir(name); } static status_t overlay_open_dir(fs_volume *volume, fs_vnode *vnode, void **cookie) { - OVERLAY_CALL(open_dir, cookie) - return B_UNSUPPORTED; + TRACE("open_dir\n"); + return ((OverlayInode *)vnode->private_node)->OpenDir(cookie); } static status_t overlay_close_dir(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(close_dir, cookie) - return B_UNSUPPORTED; + TRACE("close_dir\n"); + return ((OverlayInode *)vnode->private_node)->CloseDir(cookie); } static status_t overlay_free_dir_cookie(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(free_dir_cookie, cookie) - return B_UNSUPPORTED; + TRACE("free_dir_cookie\n"); + return ((OverlayInode *)vnode->private_node)->FreeDirCookie(cookie); } @@ -744,16 +1246,17 @@ overlay_read_dir(fs_volume *volume, fs_vnode *vnode, void *cookie, struct dirent *buffer, size_t bufferSize, uint32 *num) { - OVERLAY_CALL(read_dir, cookie, buffer, bufferSize, num) - return B_UNSUPPORTED; + TRACE("read_dir\n"); + return ((OverlayInode *)vnode->private_node)->ReadDir(cookie, buffer, + bufferSize, num); } static status_t overlay_rewind_dir(fs_volume *volume, fs_vnode *vnode, void *cookie) { - OVERLAY_CALL(rewind_dir, cookie) - return B_UNSUPPORTED; + TRACE("rewind_dir\n"); + return ((OverlayInode *)vnode->private_node)->RewindDir(cookie); } @@ -1312,6 +1815,15 @@ NULL // initialize }; + +status_t +publish_overlay_vnode(fs_volume *volume, ino_t inodeNumber, void *privateNode, + int type) +{ + return publish_vnode(volume, inodeNumber, privateNode, &sOverlayVnodeOps, + type, 0); +} + } // namespace write_overlay using namespace write_overlay; From humdingerb at googlemail.com Sat Feb 21 07:43:35 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sat, 21 Feb 2009 07:43:35 +0100 Subject: [Haiku-commits] r29252 - in haiku/trunk/docs/welcome: . en In-Reply-To: <499F2E2C.3040202@pinc-software.de> References: <200902192028.n1JKShxx021160@sheep.berlios.de> <499ECBC8.2030103@googlemail.com> <499F2E2C.3040202@pinc-software.de> Message-ID: <499FA297.4060602@googlemail.com> Axel D?rfler wrote: > Humdinger wrote: >> I wouldn't >> want to undo your mime setting... > > You don't need to mind about that; unless you replace the file (ie. > delete it, and add a new one), the properties are preserved. OK, that's good. Thanks. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From humdingerb at mail.berlios.de Sat Feb 21 12:41:26 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Sat, 21 Feb 2009 12:41:26 +0100 Subject: [Haiku-commits] r29269 - in haiku/trunk/docs: . userguide/en userguide/en/applications userguide/en/desktop-applets userguide/en/installation userguide/en/preferences userguide/images welcome welcome/en Message-ID: <200902211141.n1LBfQBw024065@sheep.berlios.de> Author: humdingerb Date: 2009-02-21 12:40:17 +0100 (Sat, 21 Feb 2009) New Revision: 29269 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29269&view=rev Added: haiku/trunk/docs/userguide/images/alert_info_16.png haiku/trunk/docs/userguide/images/alert_info_32.png haiku/trunk/docs/userguide/images/alert_info_64.png haiku/trunk/docs/userguide/images/alert_stop_16.png haiku/trunk/docs/userguide/images/alert_stop_32.png haiku/trunk/docs/userguide/images/alert_stop_64.png haiku/trunk/docs/userguide/images/alert_warning_16.png haiku/trunk/docs/userguide/images/alert_warning_32.png haiku/trunk/docs/userguide/images/alert_warning_64.png Modified: haiku/trunk/docs/Haiku-doc.css haiku/trunk/docs/userguide/en/applications.html haiku/trunk/docs/userguide/en/applications/apps-activitymonitor.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-codycam.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-diskusage.html haiku/trunk/docs/userguide/en/applications/apps-drivesetup.html haiku/trunk/docs/userguide/en/applications/apps-expander.html haiku/trunk/docs/userguide/en/applications/apps-firefox.html haiku/trunk/docs/userguide/en/applications/apps-icon-o-matic.html haiku/trunk/docs/userguide/en/applications/apps-installer.html haiku/trunk/docs/userguide/en/applications/apps-magnify.html haiku/trunk/docs/userguide/en/applications/apps-mail.html haiku/trunk/docs/userguide/en/applications/apps-mediaplayer.html haiku/trunk/docs/userguide/en/applications/apps-midiplayer.html haiku/trunk/docs/userguide/en/applications/apps-packageinstaller.html haiku/trunk/docs/userguide/en/applications/apps-pe.html haiku/trunk/docs/userguide/en/applications/apps-people.html haiku/trunk/docs/userguide/en/applications/apps-screenshot.html haiku/trunk/docs/userguide/en/applications/apps-showimage.html haiku/trunk/docs/userguide/en/applications/apps-soundrecorder.html haiku/trunk/docs/userguide/en/applications/apps-stylededit.html haiku/trunk/docs/userguide/en/applications/apps-terminal.html haiku/trunk/docs/userguide/en/applications/apps-textsearch.html haiku/trunk/docs/userguide/en/applications/apps-tv.html haiku/trunk/docs/userguide/en/applications/apps-vision.html haiku/trunk/docs/userguide/en/applications/apps-vlc.html haiku/trunk/docs/userguide/en/applications/apps-wonderbrush.html haiku/trunk/docs/userguide/en/attributes.html haiku/trunk/docs/userguide/en/bash-scripting.html haiku/trunk/docs/userguide/en/bootloader.html haiku/trunk/docs/userguide/en/contents.html haiku/trunk/docs/userguide/en/deskbar.html haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-launchbox.html haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-networkstatus.html haiku/trunk/docs/userguide/en/desktop-applets/desktop-applets-processcontroller.html haiku/trunk/docs/userguide/en/filesystem-layout.html haiku/trunk/docs/userguide/en/filetypes.html haiku/trunk/docs/userguide/en/gui.html haiku/trunk/docs/userguide/en/index.html haiku/trunk/docs/userguide/en/installation/install-boot-process.html haiku/trunk/docs/userguide/en/installation/install-raw.html haiku/trunk/docs/userguide/en/installation/install-source-beos.html haiku/trunk/docs/userguide/en/installation/install-source-linux.html haiku/trunk/docs/userguide/en/installation/install-source-mac.html haiku/trunk/docs/userguide/en/installation/install-usb.html haiku/trunk/docs/userguide/en/installation/install-vm.html haiku/trunk/docs/userguide/en/installing.html haiku/trunk/docs/userguide/en/keyboard-shortcuts.html haiku/trunk/docs/userguide/en/preferences.html haiku/trunk/docs/userguide/en/preferences/prefs-appearance.html haiku/trunk/docs/userguide/en/preferences/prefs-backgrounds.html haiku/trunk/docs/userguide/en/preferences/prefs-datatranslations.html haiku/trunk/docs/userguide/en/preferences/prefs-e-mail.html haiku/trunk/docs/userguide/en/preferences/prefs-filetypes.html haiku/trunk/docs/userguide/en/preferences/prefs-fonts.html haiku/trunk/docs/userguide/en/preferences/prefs-keyboard.html haiku/trunk/docs/userguide/en/preferences/prefs-keymap.html haiku/trunk/docs/userguide/en/preferences/prefs-media.html haiku/trunk/docs/userguide/en/preferences/prefs-menu.html haiku/trunk/docs/userguide/en/preferences/prefs-mouse.html haiku/trunk/docs/userguide/en/preferences/prefs-network.html haiku/trunk/docs/userguide/en/preferences/prefs-printers.html haiku/trunk/docs/userguide/en/preferences/prefs-screen.html haiku/trunk/docs/userguide/en/preferences/prefs-screensaver.html haiku/trunk/docs/userguide/en/preferences/prefs-sounds.html haiku/trunk/docs/userguide/en/preferences/prefs-time.html haiku/trunk/docs/userguide/en/preferences/prefs-tracker.html haiku/trunk/docs/userguide/en/preferences/prefs-virtualmemory.html haiku/trunk/docs/userguide/en/queries.html haiku/trunk/docs/userguide/en/teammonitor.html haiku/trunk/docs/userguide/en/tracker-add-ons.html haiku/trunk/docs/userguide/en/tracker.html haiku/trunk/docs/userguide/en/twitcher.html haiku/trunk/docs/userguide/en/workshop-filetypes+attributes.html haiku/trunk/docs/userguide/en/workspaces.html haiku/trunk/docs/welcome/en/bugreports.html haiku/trunk/docs/welcome/welcome.html Log: * Added more CSS control for menus, buttons, app names, shell commands, paths. * Always wanting keyboard graphics for shortcuts, Jorge suggested simple borders for simplicity. Great idea! Added. * Added Jorge's rounded boxes for note/warning/stop plus symbols. * If anyone wants to fine tune esp. colours, go ahead. Jorge and I are both challenged in that department. :) * A few small corrections and reformatting here and there. * Excluded the topic "Installation" from the contents until it's further along. Modified: haiku/trunk/docs/Haiku-doc.css =================================================================== --- haiku/trunk/docs/Haiku-doc.css 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/Haiku-doc.css 2009-02-21 11:40:17 UTC (rev 29269) @@ -15,6 +15,7 @@ } body { color: #333333; + line-height: 1.5; margin: 0px; padding: 0px; font-family: "DejaVu Sans",Arial,Helvetica,sans-serif; @@ -56,6 +57,7 @@ color: #0c3762; } + /* basic text elements */ div.content { @@ -64,46 +66,7 @@ margin-right: 40px; margin-bottom: 50px; } -h1 { - font-size: 1.3em; - font-weight: normal; - color: #0c3762; - border-bottom: dotted thin #e0e0e0; - margin-top: 50px; -} -h2 { - font-size: 1.2em; - font-weight: normal; - color: #0c3762; - border-bottom: dotted thin #e0e0e0; - margin-top: 40px; -} -h3 { - font-size: 1.1em; - font-weight: normal; - color: #0c3762; - margin-top: 30px; -} -h4 { - font-size: 1.0em; - font-weight: lighter; - color: #0c3762; - margin-top: 30px; -} -p { - text-align: justify; - line-height: 1.3; -} -ol { - padding-left: 20px; -} -ul { - padding-left: 14px; -} -li { - line-height: 1.3; -} - + /* heading and navigation */ div.logo { @@ -120,9 +83,11 @@ top: 54px; right: 40px; font-size: 1.2em; + line-height: 1.0; } div.topnav { background: #e0e0e0; + line-height: 1.0; } div.topnav p { margin-left: 40px; @@ -144,23 +109,143 @@ font-size: 0.8em; } -/* layout elements */ -td { - vertical-align: top; +/* Haiku User Guide styles and layout */ + +/* Rounded corner boxes */ +/* Common declarations */ +.box-info, .box-stop, .box-warning { + -webkit-border-radius: 10px; + -khtml-border-radius: 10px; + -moz-border-radius: 10px; + border-radius: 10px; + border-style: dotted; + border-width: thin; + border-color: #dcdcdc; + padding: 15px 15px 15px 80px; + margin-bottom: 15px; + margin-top: 15px; + min-height: 70px; +} +.box-info { + background: #e4ffde url(userguide/images/alert_info_32.png) 15px 15px no-repeat; +} +.box-warning { + background: #fffbc6 url(userguide/images/alert_warning_32.png) 15px 15px no-repeat; +} +.box-stop { + background: #ffeae6 url(userguide/images/alert_stop_32.png) 15px 15px no-repeat; +} + +/* More layout and styles */ +h1 { + font-size: 1.3em; + font-weight: normal; + color: #0c3762; + border-bottom: dotted thin #e0e0e0; + margin-top: 50px; } -td.onelinetop { - vertical-align: top; - white-space: nowrap; +h2 { + font-size: 1.2em; + font-weight: normal; + color: #0c3762; + border-bottom: dotted thin #e0e0e0; + margin-top: 40px; } -tt { - background-color: #f0f0f0; +h3 { + font-size: 1.1em; + font-weight: normal; + color: #0c3762; + margin-top: 30px; } -pre.terminal { - border-color: #0c3762; - border-style: dotted; - border-width: thin; - margin: 0em; - padding: 1.5em; - background-color: #f0f0f0; +h4 { + font-size: 1.0em; + font-weight: normal; + color: #0c3762; + margin-top: 30px; } +p { + text-align: justify; +} +ol { + padding-left: 20px; +} +ul { + padding-left: 14px; +} +li { + line-height: 1.3; +} +td { + vertical-align: top; +} +td.onelinetop { + vertical-align: top; + white-space: nowrap; +} +tt { + background-color: #e2e2e2; + font-size: 1.0em; + font-family: monospace; +} +pre { + border-color: #0c3762; + border-style: dotted; + border-width: thin; + margin: 0em; + padding: 1.5em; + background-color: #f0f0f0; +} +pre.terminal { /* Terminal output*/ + border-color: #ffb11f; + border-style: dotted; + border-width: thin; + margin: 0em; + padding: 1.5em; + background-color: #3a3a3a; + color: #ffb11f; +} +.menu { /* Menu */ + font-size: 1.0em; + font-family: serif; + font-style: italic; + color: #24225e; +} +.button { /* Button */ + font-size: 1.0em; + font-family: serif; + font-style: italic; + color: #33583c; +} +.app { /* GUI Application name */ + font-size: 1.0em; + font-family: serif; + font-style: italic; +/* color: #5e1c1c; */ + color: #5e1c1c; +} +.cli { /* Shell command or file */ + background-color: #e8e8e8; + font-size: 0.9em; + font-family: monospace; +} +.path { /* File path */ + background-color: #e8e8e8; + font-size: 0.9em; + font-family: monospace; +} +.key { /* Shortcut (separate with   */ + -webkit-border-radius: 3px; + -khtml-border-radius: 3px; + -moz-border-radius: 3px; + border-radius: 3px; + border-color: #c7c7c7; + border-style: solid; + border-width: 1px; + padding: 0px 2px 0px 2px; + background-color: #e8e8e8; + font-family: serif; + font-variant: small-caps; + font-size: 0.8em; +} + Modified: haiku/trunk/docs/userguide/en/applications/apps-activitymonitor.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-activitymonitor.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-activitymonitor.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -37,17 +37,17 @@

    activitymonitor-icon_64.pngActivityMonitor

    - - - + + +
    Deskbar:Applications
    Location:/boot/beos/apps/ActivityMonitor
    Settings:~/config/settings/ActivityMonitor settings
    Deskbar:Applications
    Location:/boot/beos/apps/ActivityMonitor
    Settings:~/config/settings/ActivityMonitor settings

    You can track system resources by launching the ActivityMonitor and activating different items of interest.

    activitymonitor.png

    By right-clicking into the window, you can toggle the display of all kinds of resources:
    Used/Cached Memory, Swap Space, CPU Usage, Network Receive/Send, Page faults, Semaphores, Ports, Threads, Teams, Running Applications, Raw/Text Clipboard Size, Media Nodes

    -

    Below the graphics is a legend (hideable from the context menu). You can change their colors and that of the graph's background via drag&drop from any color picker, e.g. from Icon-O-Matic.

    -

    You can add more views from the File menu if it gets too crowded.

    +

    Below the graphics is a legend (hideable from the context menu). You can change their colors and that of the graph's background via drag&drop from any color picker, e.g. from Icon-O-Matic.

    +

    You can add more views from the File menu if it gets too crowded.

    Each view has it's own Replicator handle and can thus be arranged, for example, on the Desktop.

    Modified: haiku/trunk/docs/userguide/en/applications/apps-bepdf.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-bepdf.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-bepdf.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -39,13 +39,13 @@

    bepdf-icon_64.pngBePDF

    - - - - + + + +
    Deskbar:Applications
    Location:/boot/apps/BePDF/BePDF
    Documentation:/boot/apps/BePDF/docs/*
    Settings:/boot/common/settings/BePDF
    Deskbar:Applications
    Location:/boot/apps/BePDF/BePDF
    Documentation:/boot/apps/BePDF/docs/*
    Settings:/boot/common/settings/BePDF

    BePDF is Haiku's fast launching PDF viewer. Besides viewing, it supports annotating and user-defined bookmarking for unencrypted PDFs. It's fully localized for 20 languages at the moment with additional languages being easily added via text files.

    -

    BePDF comes with its own documentation as HTML or as PDF. The later will also open from the menu Help | Show Help...

    +

    BePDF comes with its own documentation as HTML or as PDF. The later will also open from the menu Help | Show Help...


    cdplayer.png

    Usage is pretty much what you'd expect from looking at the control buttons.
    -Activate the Repeat button to the left of Shuffle to loop the complete CD.

    -

    If you need more control like playlists, try MediaPlayer instead.

    +Activate the Repeat button to the left of Shuffle to loop the complete CD.

    +

    If you need more control like playlists, try MediaPlayer instead.

    + Modified: haiku/trunk/docs/userguide/en/applications/apps-terminal.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-terminal.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-terminal.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -38,30 +38,30 @@

    terminal-icon_64.pngTerminal

    - - - + + +
    Deskbar:Applications
    Location:/boot/beos/apps/Terminal
    Settings:~/config/settings/Terminal_settings
    -~/.profile - adds/overrides defaults in /boot/beos/etc/profile
    -~/.inputrc - adds/overrides defaults in /boot/beos/etc/inputrc
    Deskbar:Applications
    Location:/boot/beos/apps/Terminal
    Settings:~/config/settings/Terminal_settings
    +~/.profile - adds/overrides defaults in /boot/beos/etc/profile
    +~/.inputrc - adds/overrides defaults in /boot/beos/etc/inputrc

    The Terminal is Haiku's interface to bash, the Bourne Again Shell.

    Please refer to the topic on Scripting for a few links to online tutorials on working in the shell. Here, we'll concentrate on the Terminal application itself.

    Appearance

    -

    You can open as many Terminals as needed, either each in it's own window by simply launching more Terminals or with ALT+N from an already running Terminal. Or you use Terminal's tabbed view and open another tab with ALT+T.

    -

    A Terminal window can be resized like any other window or you use the presets from the Ssettings | Window Size menu. ALT+RETURN toggles fullscreen mode.

    -

    Changed window size and text encoding are only kept choosing Settings | Save as default.

    +

    You can open as many Terminals as needed, either each in it's own window by simply launching more Terminals or with ALT N from an already running Terminal. Or you use Terminal's tabbed view and open another tab with ALT T.

    +

    A Terminal window can be resized like any other window or you use the presets from the Settings | Window Size menu. ALT ENTER toggles fullscreen mode.

    +

    Changed window size and text encoding are only kept choosing Settings | Save as default.

    terminal.png
    -

    Settings | Preferences opens a panel where you can set font type, font size and the different text and background colors. You can save different settings as separate profiles, which on double-click open an accordingly configured Terminal.
    -Pressing OK will save the current settings as default.

    +

    Settings | Preferences opens a panel where you can set font type, font size and the different text and background colors. You can save different settings as separate profiles, which on double-click open an accordingly configured Terminal.
    +Pressing OK will save the current settings as default.

    Bash customization

    -

    Coming from Unix, there are countless possibilities to customize the bash itself. There are two files that are especially important to the user: .profile and .inputrc
    -Both files can be created in the home/ folder and add or override the system defaults that are defined in /boot/beos/etc/.

    +

    Coming from Unix, there are countless possibilities to customize the bash itself. There are two files that are especially important to the user: .profile and .inputrc
    +Both files can be created in the home/ folder and add or override the system defaults that are defined in /boot/beos/etc/.

    .profile

    -

    The .profile is loaded every time you open a new Terminal. It sets all kinds of aliases and variables that will affect bash's behavior and appearance. You'll find many online resources that will detail all possibilities.

    +

    The .profile is loaded every time you open a new Terminal. It sets all kinds of aliases and variables that will affect bash's behavior and appearance. You'll find many online resources that will detail all possibilities.

    The Haiku/BeOS Tip Server has quite a few tips to get you started, for example:

    • Customize your Terminal prompt
    • @@ -72,7 +72,7 @@

      There are more, have a look.

      .inputrc

      -

      The .inputrc deals with keybindings. Since Haiku provides useful defaults, you probably don't have to mess with these more involved settings. If you do have special needs here, consult one of the many online resources, e.g. The GNU Readline Library.

      +

      The .inputrc deals with keybindings. Since Haiku provides useful defaults, you probably don't have to mess with these more involved settings. If you do have special needs here, consult one of the many online resources, e.g. The GNU Readline Library.

      Keyboard shortcuts

      You'll find a list of useful shortcuts in Shortcuts and key combinations.

      @@ -80,13 +80,13 @@

      Hints for working with the Terminal

      • Dragging a file or folder from a Tracker window into the Terminal will insert its path at the location of the cursor. Dragging with the right mouse button offers additional actions in a context menu:

        - - - - - + + + + +
        Insert Path Inserts the location of the file, same as drag&dropping with the left mouse button.
        Change Directory Changes to the folder of the dragged file.
        Create Link Here Creates a link to the dragged file in the current working directory of the Terminal.
        Move Here Moves the dragged file into the current working directory of the Terminal.
        Copy Here Copies the dragged file into the current working directory of the Terminal.
        Insert Path Inserts the location of the file, same as drag&dropping with the left mouse button.
        Change Directory Changes to the folder of the dragged file.
        Create Link Here Creates a link to the dragged file in the current working directory of the Terminal.
        Move Here Moves the dragged file into the current working directory of the Terminal.
        Copy Here Copies the dragged file into the current working directory of the Terminal.
      • -
      • You can open any file with its preferred application with the command open [filename]. This also works with the representation of the current (".") and parent ("..") folder which then open in a Tracker window. So, to open the current working directory, you type:

        +
      • You can open any file with its preferred application with the command open [filename]. This also works with the representation of the current (".") and parent ("..") folder which then open in a Tracker window. So, to open the current working directory, you type:

        open .
      Modified: haiku/trunk/docs/userguide/en/applications/apps-textsearch.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-textsearch.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-textsearch.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -40,8 +40,8 @@ width="64" height="64" />TextSearch - - + +
      Deskbar:No entry, normally launched via Tracker Add-On
      Location:/boot/beos/apps/TextSearch
      Settings:~/config/settings/TextSearch
      Location:/boot/beos/apps/TextSearch
      Settings:~/config/settings/TextSearch

      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-tv.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-tv.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-tv.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -39,9 +39,9 @@

      tv-icon_64.pngTV

      - - - + + +
      Deskbar:Applications
      Location:/boot/beos/apps/TV
      Settings:~/config/settings/???
      Deskbar:Applications
      Location:/boot/beos/apps/TV
      Settings:~/config/settings/???

      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-vision.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-vision.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-vision.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -39,9 +39,9 @@

      vision-icon_64.pngVision

      - - - + + +
      Deskbar:Applications
      Location:/boot/apps/Vision{version}/Vision
      Settings:~/config/settings/Vision/*
      Deskbar:Applications
      Location:/boot/apps/Vision{version}/Vision
      Settings:~/config/settings/Vision/*

      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-vlc.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-vlc.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-vlc.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -39,9 +39,9 @@

      vlc-icon_64.pngVLC

      - - - + + +
      Deskbar:Applications
      Location:/boot/apps/vlc{version}/VLC media player
      Settings:~/config/settings/VideoLAN Client/*
      Deskbar:Applications
      Location:/boot/apps/vlc{version}/VLC media player
      Settings:~/config/settings/VideoLAN Client/*

      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-wonderbrush.html =================================================================== --- haiku/trunk/docs/userguide/en/applications/apps-wonderbrush.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications/apps-wonderbrush.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -37,10 +37,10 @@

      wonderbrush-icon_64.pngWonderBrush

      - - - - + + + +
      Deskbar:Applications
      Location:/boot/apps/WonderBrush/WonderBrush
      Documentation:/boot/apps/WonderBrush/Documentation {language}
      Settings:~/config/settings/WonderBrush
      Deskbar:Applications
      Location:/boot/apps/WonderBrush/WonderBrush
      Documentation:/boot/apps/WonderBrush/Documentation {language}
      Settings:~/config/settings/WonderBrush

      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.html =================================================================== --- haiku/trunk/docs/userguide/en/applications.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/applications.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -42,26 +42,26 @@

      Installing applications

      Haiku software always comes as an archive. Most of the time it's a ZIP, some old BeOS packages come in Software Valet's PKG format. Software Valet was able to automatically execute installation scripts, so after double-clicking you just select a destination folder and everything's taken care of.
      -If it's a ZIP archive, double-clicking opens Expander where you also set the destination and unpack it. As explained in the topic Filesystem layout, that destination is either

      +If it's a ZIP archive, double-clicking opens Expander where you also set the destination and unpack it. As explained in the topic Filesystem layout, that destination is either

      - - + +
      /boot/common/apps/    for applications available to every user
      /boot/home/apps/    for applications only available to yourself
      /boot/common/apps/    for applications available to every user
      /boot/home/apps/    for applications only available to yourself

      This distinction will only become relevant once Haiku gets multi-user support, of course.

      Once the archive is unpacked, you should have a look into the newly created folder. Often you find ReadMe files or other documentation of interest.

      -

      Some programs need further configurations. For example, Tracker Add-Ons, Translators or other system enhancing components have to be put into the right folders. Either you'll find a little script file (often with the suffix .sh) like install that you simply double click to have all taken care of.
      -Sometimes you'll find folders that link to the correct destination named "drag [filename] here...". So, you simply follow that instruction and you're done.

      +

      Some programs need further configurations. For example, Tracker Add-Ons, Translators or other system enhancing components have to be put into the right folders. Either you'll find a little script file (often with the suffix .sh) like install that you simply double click to have all taken care of.
      +Sometimes you'll find folders that link to the correct destination named "drag [filename] here...". So, you simply follow that instruction and you're done.

      Most of the time, however, nothing of the sort is necessary and you're done after unpacking.
      See topic Deskbar or LaunchBox to see how to add shortcuts to your newly installed application.

      Uninstalling applications

      If the installation was done with an install script, chances are, there's an uninstall script as well. In that case, double-click it and you're done.
      Otherwise, uninstalling is simply done by deleting the application's folder.

      -

      This, of course, leaves back possible configuration files in your ~/config/settings folder. This may be on purpose, if you want to keep those settings in case you'll install it again in the future. Also, when the installation involved those "drag [filename] here..." folders, those files are also left behind.

      +

      This, of course, leaves back possible configuration files in your ~/config/settings folder. This may be on purpose, if you want to keep those settings in case you'll install it again in the future. Also, when the installation involved those "drag [filename] here..." folders, those files are also left behind.

      One method to quickly get to all the app's files is to do a quick query for a significant part of the application's name. This will reveal the app's binary, its installation folder and its settings as well as possible links in the Deskbar etc. Simply select all relevant files and delete them.

      Haiku's applications

      -

      Haiku comes with a set of mostly small but essential applications. You'll find all of them at /boot/beos/apps/ or /boot/common/apps/. Applications that are not usually launched by a double-click on a data file (e.g. ShowImage for image files) can be found in the Applications menu of the Deskbar.

      +

      Haiku comes with a set of mostly small but essential applications. You'll find all of them at /boot/beos/apps/ or /boot/common/apps/. Applications that are not usually launched by a double-click on a data file (e.g. ShowImage for image files) can be found in the Applications menu of the Deskbar.

      Modified: haiku/trunk/docs/userguide/en/attributes.html =================================================================== --- haiku/trunk/docs/userguide/en/attributes.html 2009-02-21 02:35:55 UTC (rev 29268) +++ haiku/trunk/docs/userguide/en/attributes.html 2009-02-21 11:40:17 UTC (rev 29269) @@ -46,10 +46,10 @@

      Attributes in Tracker

      Attributes are displayed quite similar to a database or spreadsheet. Using Tracker you can choose which attributes to display (columns) and sort file listings (rows) accordingly.

      -

      To do this, open a Tracker window, click on the Attributes menu, and select the attributes you want to display. Alternatively, simply right-click onto a column heading and mark the items in the context menu. You can rearrange the columns by a simple drag&drop of the column heading. Moving a column out of a window, is a fast way to get rid of columns you don't need.

      +

      To do this, open a Tracker window, click on the Attributes menu, and select the attributes you want to display. Alternatively, simply right-click onto a column heading and mark the items in the context menu. You can rearrange the columns by a simple drag&drop of the column heading. Moving a column out of a window, is a fast way to get rid of columns you don't need.

      Double-click on the line between two attributes in the heading to automatically resize a column to its optimal width.

      -

      Click on a column heading to toggle the sorting order from ascending to descending. You can establish a secondary sort order by pressing the SHIFT key while clicking on a column heading. Doing that you can, for example, sort your People files by company and within that order sort by contact name. See the above screenshot as an example. The secondary sort order is marked by a dotted line under the heading.

      -

      Editing these attributes is as simple as renaming a file: Either click on an entry or press ALT+E and move between the attibutes with TAB and SHIFT+TAB. ESC leaves the editing mode without applying the changes.

      +

      Click on a column heading to toggle the sorting order from ascending to descending. You can establish a secondary sort order by pressing the SHIFT key while clicking on a column heading. Doing that you can, for example, sort your People files by company and within that order sort by contact name. See the above screenshot as an example. The secondary sort order is marked by a dotted line under the heading.

      +

      Editing these attributes is as simple as renaming a file: Either click on an entry or press ALT E and move between the attibutes with TAB and SHIFT TAB. ESC leaves the editing mode without applying the changes.

      [... truncated: 2730 lines follow ...] From korli at mail.berlios.de Sat Feb 21 15:58:42 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 21 Feb 2009 15:58:42 +0100 Subject: [Haiku-commits] r29270 - haiku/trunk/src/apps/deskcalc Message-ID: <200902211458.n1LEwgaI024938@sheep.berlios.de> Author: korli Date: 2009-02-21 15:58:41 +0100 (Sat, 21 Feb 2009) New Revision: 29270 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29270&view=rev Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp Log: Applied patch from richy_rich for bug #3034. Seems like 100*100 is a good minimum size. Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-02-21 11:40:17 UTC (rev 29269) +++ haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-02-21 14:58:41 UTC (rev 29270) @@ -45,7 +45,7 @@ AddChild(fCalcView); fCalcView->AddChild(dragger); - SetSizeLimits(50.0, 400.0, 22.0, 400.0); + SetSizeLimits(100.0, 400.0, 100.0, 400.0); } From superstippi at gmx.de Sat Feb 21 16:00:54 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sat, 21 Feb 2009 16:00:54 +0100 Subject: [Haiku-commits] r29270 - haiku/trunk/src/apps/deskcalc In-Reply-To: <200902211458.n1LEwgaI024938@sheep.berlios.de> References: <200902211458.n1LEwgaI024938@sheep.berlios.de> Message-ID: <49A01726.70902@gmx.de> korli at BerliOS schrieb: > Author: korli > Date: 2009-02-21 15:58:41 +0100 (Sat, 21 Feb 2009) > New Revision: 29270 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29270&view=rev > > Modified: > haiku/trunk/src/apps/deskcalc/CalcWindow.cpp > Log: > Applied patch from richy_rich for bug #3034. Seems like 100*100 is a good minimum size. > > > Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp > =================================================================== > --- haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-02-21 11:40:17 UTC (rev 29269) > +++ haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-02-21 14:58:41 UTC (rev 29270) > @@ -45,7 +45,7 @@ > AddChild(fCalcView); > fCalcView->AddChild(dragger); > > - SetSizeLimits(50.0, 400.0, 22.0, 400.0); > + SetSizeLimits(100.0, 400.0, 100.0, 400.0); > } What about hiding the key pad, will this still work? Best regards, -Stephan From humdingerb at mail.berlios.de Sat Feb 21 16:46:00 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Sat, 21 Feb 2009 16:46:00 +0100 Subject: [Haiku-commits] r29271 - haiku/trunk/build/jam Message-ID: <200902211546.n1LFk0Bi029671@sheep.berlios.de> Author: humdingerb Date: 2009-02-21 16:45:55 +0100 (Sat, 21 Feb 2009) New Revision: 29271 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29271&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/build/jam/OptionalPackages Log: Added Haiku-doc.css to image. Thanks for noticing luroh Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-02-21 14:58:41 UTC (rev 29270) +++ haiku/trunk/build/jam/HaikuImage 2009-02-21 15:45:55 UTC (rev 29271) @@ -119,7 +119,7 @@ Print\ To\ File Serial\ Port USB\ Port ; BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider Message ; -BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki ; #hda +BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki hda ; BEOS_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia sis7018 usb_audio ; BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2009-02-21 14:58:41 UTC (rev 29270) +++ haiku/trunk/build/jam/OptionalPackages 2009-02-21 15:45:55 UTC (rev 29271) @@ -512,6 +512,9 @@ CopyDirectoryToHaikuImage beos documentation : [ FDirName $(HAIKU_TOP) docs userguide ] : userguide : -x .svn ; + AddFilesToHaikuImage beos documentation + : [ FDirName $(HAIKU_TOP) docs Haiku-doc.css ] + : Haiku-doc.css ; AddSymlinkToHaikuImage home Desktop : /boot/beos/documentation/welcome/welcome.html : Welcome ; } From korli at users.berlios.de Sat Feb 21 16:14:35 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Sat, 21 Feb 2009 16:14:35 +0100 Subject: [Haiku-commits] r29270 - haiku/trunk/src/apps/deskcalc In-Reply-To: <49A01726.70902@gmx.de> References: <200902211458.n1LEwgaI024938@sheep.berlios.de> <49A01726.70902@gmx.de> Message-ID: 2009/2/21 Stephan A?mus > > - SetSizeLimits(50.0, 400.0, 22.0, 400.0); > > + SetSizeLimits(100.0, 400.0, 100.0, 400.0); > > } > > What about hiding the key pad, will this still work? Alas no. Is this needed ? Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From humdingerb at mail.berlios.de Sat Feb 21 16:50:39 2009 From: humdingerb at mail.berlios.de (humdingerb at mail.berlios.de) Date: Sat, 21 Feb 2009 16:50:39 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam Message-ID: <200902211550.n1LFod66030168@sheep.berlios.de> Author: humdingerb Date: 2009-02-21 16:50:37 +0100 (Sat, 21 Feb 2009) New Revision: 29272 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29272&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Accidentally committed changed HaikuImage. Sorry. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-02-21 15:45:55 UTC (rev 29271) +++ haiku/trunk/build/jam/HaikuImage 2009-02-21 15:50:37 UTC (rev 29272) @@ -119,7 +119,7 @@ Print\ To\ File Serial\ Port USB\ Port ; BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider Message ; -BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki hda ; +BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki ; #hda BEOS_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia sis7018 usb_audio ; BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme From superstippi at gmx.de Sat Feb 21 17:26:27 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sat, 21 Feb 2009 17:26:27 +0100 Subject: [Haiku-commits] r29270 - haiku/trunk/src/apps/deskcalc In-Reply-To: References: <200902211458.n1LEwgaI024938@sheep.berlios.de> <49A01726.70902@gmx.de> Message-ID: <49A02B33.5090504@gmx.de> J?r?me Duval schrieb: > > > 2009/2/21 Stephan A?mus > > > > - SetSizeLimits(50.0, 400.0, 22.0, 400.0); > > + SetSizeLimits(100.0, 400.0, 100.0, 400.0); > > } > > What about hiding the key pad, will this still work? > > > Alas no. Is this needed ? Of course. What would work is setting the limits on the keypad show/hide event. But the view would need to check if the container window is actually the DescCalc window, not for example the Tracker desktop. Best regards, -Stephan From axeld at pinc-software.de Sat Feb 21 18:34:54 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sat, 21 Feb 2009 18:34:54 +0100 Subject: [Haiku-commits] r29266 - haiku/trunk/src/bin In-Reply-To: <200902202337.n1KNbitR021969@sheep.berlios.de> References: <200902202337.n1KNbitR021969@sheep.berlios.de> Message-ID: <49A03B3E.4090905@pinc-software.de> mmu_man at BerliOS wrote: > Log: > Patch by Bjoern Herzig, adds -a option, some cleanup. [...] -int -main(int argc, char **argv) [...] > + > +void printTeamInfo(team_info *teamInfo, bool printHeader) [...] > +void printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo) { [...] > + } > + else [...] > +int main(int argc, char **argv) > +{ [...] > + } > + else { Can you please a) fix those coding style violations, and b) always tell committers to at least try to adhere to it when they don't? Bye, Axel. From axeld at pinc-software.de Sat Feb 21 18:38:53 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sat, 21 Feb 2009 18:38:53 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <200902211550.n1LFod66030168@sheep.berlios.de> References: <200902211550.n1LFod66030168@sheep.berlios.de> Message-ID: <49A03C2D.5070000@pinc-software.de> humdingerb at mail.berlios.de wrote: > Log: > Accidentally committed changed HaikuImage. Sorry. "svn status" shows the changes you are about to commit; and you can always use "svn commit" either with a file/directory argument, or just call it within the subdirectory with your changes. BTW, I guess we could add "hda" to the image now, anyway, don't we? :-) Bye, Axel. From superstippi at gmx.de Sat Feb 21 18:59:33 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sat, 21 Feb 2009 18:59:33 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A03C2D.5070000@pinc-software.de> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> Message-ID: <49A04105.5090707@gmx.de> Axel D?rfler schrieb: > humdingerb at mail.berlios.de wrote: >> Log: >> Accidentally committed changed HaikuImage. Sorry. > > "svn status" shows the changes you are about to commit; and you can > always use "svn commit" either with a file/directory argument, or just > call it within the subdirectory with your changes. > > BTW, I guess we could add "hda" to the image now, anyway, don't we? :-) Could potentially cause a lot of problems for people when they already use OSS. Best regards, -Stephan From jackburton at mail.berlios.de Sat Feb 21 19:08:18 2009 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Sat, 21 Feb 2009 19:08:18 +0100 Subject: [Haiku-commits] r29273 - haiku/trunk/src/apps/terminal Message-ID: <200902211808.n1LI8IxY010998@sheep.berlios.de> Author: jackburton Date: 2009-02-21 19:08:11 +0100 (Sat, 21 Feb 2009) New Revision: 29273 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29273&view=rev Modified: haiku/trunk/src/apps/terminal/Shell.cpp haiku/trunk/src/apps/terminal/Shell.h haiku/trunk/src/apps/terminal/TermView.cpp Log: Remove TermView dependency from Shell. It now depends on TerminalBuffer instead. Modified: haiku/trunk/src/apps/terminal/Shell.cpp =================================================================== --- haiku/trunk/src/apps/terminal/Shell.cpp 2009-02-21 15:50:37 UTC (rev 29272) +++ haiku/trunk/src/apps/terminal/Shell.cpp 2009-02-21 18:08:11 UTC (rev 29273) @@ -30,10 +30,9 @@ #include "TermConst.h" #include "TermParse.h" -#include "TermView.h" - // TODO: Fix dependency! +#include "TerminalBuffer.h" + - #ifndef CEOF #define CEOF ('D'&037) #endif @@ -227,17 +226,16 @@ } -// TODO: Fix this dependency! void -Shell::ViewAttached(TermView *view) +Shell::AttachBuffer(TerminalBuffer *buffer) { if (fAttached) return; - status_t status = fTermParse->StartThreads(view->TextBuffer()); + status_t status = fTermParse->StartThreads(buffer); if (status < B_OK) { // TODO: What can we do here ? - fprintf(stderr, "Shell:ViewAttached():" + fprintf(stderr, "Shell:AttachBuffer():" " cannot start parser threads: %s", strerror(status)); } @@ -245,7 +243,7 @@ void -Shell::ViewDetached() +Shell::DetachBuffer() { if (fAttached) fTermParse->StopThreads(); Modified: haiku/trunk/src/apps/terminal/Shell.h =================================================================== --- haiku/trunk/src/apps/terminal/Shell.h 2009-02-21 15:50:37 UTC (rev 29272) +++ haiku/trunk/src/apps/terminal/Shell.h 2009-02-21 18:08:11 UTC (rev 29273) @@ -16,8 +16,8 @@ #include // TODO: Maybe merge TermParse and Shell classes ? +class TerminalBuffer; class TermParse; -class TermView; class Shell { public: @@ -40,8 +40,8 @@ int FD() const; pid_t ProcessID() const { return fProcessID; } - virtual void ViewAttached(TermView *view); - virtual void ViewDetached(); + virtual void AttachBuffer(TerminalBuffer *buffer); + virtual void DetachBuffer(); private: int fFd; Modified: haiku/trunk/src/apps/terminal/TermView.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermView.cpp 2009-02-21 15:50:37 UTC (rev 29272) +++ haiku/trunk/src/apps/terminal/TermView.cpp 2009-02-21 18:08:11 UTC (rev 29273) @@ -720,7 +720,7 @@ return B_BAD_VALUE; fShell = shell; - fShell->ViewAttached(this); + fShell->AttachBuffer(TextBuffer()); return B_OK; } @@ -729,7 +729,7 @@ void TermView::_DetachShell() { - fShell->ViewDetached(); + fShell->DetachBuffer(); fShell = NULL; } From mmu_man at mail.berlios.de Sat Feb 21 19:16:37 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 21 Feb 2009 19:16:37 +0100 Subject: [Haiku-commits] r29274 - haiku/trunk/src/bin Message-ID: <200902211816.n1LIGbxn023982@sheep.berlios.de> Author: mmu_man Date: 2009-02-21 19:16:36 +0100 (Sat, 21 Feb 2009) New Revision: 29274 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29274&view=rev Modified: haiku/trunk/src/bin/ps.c Log: Fix columns. Fix style. Modified: haiku/trunk/src/bin/ps.c =================================================================== --- haiku/trunk/src/bin/ps.c 2009-02-21 18:08:11 UTC (rev 29273) +++ haiku/trunk/src/bin/ps.c 2009-02-21 18:16:36 UTC (rev 29274) @@ -15,22 +15,27 @@ #define SNOOZE_TIME 100000 -char *states[] = {"run", "rdy", "msg", "zzz", "sus", "wait" }; +char *sStates[] = {"run", "rdy", "msg", "zzz", "sus", "wait" }; -void printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo); -void printTeamInfo(team_info *teamInfo, bool printHeader); +static void printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo); +static void printTeamInfo(team_info *teamInfo, bool printHeader); -void printTeamInfo(team_info *teamInfo, bool printHeader) +static void +printTeamInfo(team_info *teamInfo, bool printHeader) { // Print team info if (printHeader) - printf("%-49s %5s %8s %4s %4s\n", "Team", "Id", "#Threads", "Gid", "Uid"); + printf("%-50s %5s %8s %4s %4s\n", "Team", "Id", "#Threads", "Gid", \ + "Uid"); - printf("%-49s %5ld %8ld %4d %4d\n", teamInfo->args, teamInfo->team, + printf("%-50s %5ld %8ld %4d %4d\n", teamInfo->args, teamInfo->team, teamInfo->thread_count, teamInfo->uid, teamInfo->gid); } -void printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo) { + +static void +printTeamThreads(team_info *teamInfo, bool printSemaphoreInfo) +{ char *threadState; uint32 threadCookie = 0; sem_info semaphoreInfo; @@ -44,9 +49,9 @@ // This should never happen threadState = "???"; else - threadState = states[threadInfo.state - 1]; + threadState = sStates[threadInfo.state - 1]; - printf("%-29s %5ld %8s %4ld %8llu %8llu ", + printf("%-37s %5ld %8s %4ld %8llu %8llu ", threadInfo.name, threadInfo.thread, threadState, threadInfo.priority, (threadInfo.user_time / 1000), (threadInfo.kernel_time / 1000)); @@ -60,13 +65,13 @@ printf("%s(%ld)\n", strerror(status), threadInfo.sem); } else puts(""); - } - else + } else puts(""); } } -int main(int argc, char **argv) +int +main(int argc, char **argv) { team_info teamInfo; uint32 teamCookie = 0; @@ -90,7 +95,8 @@ "-h : show help\n" "-i : show system info\n" "-s : show semaphore info\n" - "-a : show threads too (by default only teams are displayed)\n"); + "-a : show threads too (by default only teams are " \ + "displayed)\n"); return 0; break; case 'a': @@ -117,14 +123,15 @@ printTeamInfo(&teamInfo,printHeader); printHeader = false; if (printThreads) { - printf("\n%-29s %5s %8s %4s %8s %8s\n", "Thread", "Id", "State","Prio", "UTime", "KTime"); + printf("\n%-37s %5s %8s %4s %8s %8s\n", "Thread", "Id", \ + "State", "Prio", "UTime", "KTime"); printTeamThreads(&teamInfo,printSemaphoreInfo); - printf("--------------------------------------------------------------------------\n"); + printf("----------------------------------------------" \ + "-----------------------------\n"); printHeader = true; } } - } - else { + } else { while (get_next_team_info(&teamCookie, &teamInfo) >= B_OK) { char *p; p = teamInfo.args; @@ -136,7 +143,8 @@ if (strstr(p, string_to_match) == NULL) continue; printTeamInfo(&teamInfo,true); - printf("\n%-29s %5s %8s %4s %8s %8s\n", "Thread", "Id", "State","Prio", "UTime", "KTime"); + printf("\n%-37s %5s %8s %4s %8s %8s\n", "Thread", "Id", "State", \ + "Prio", "UTime", "KTime"); printTeamThreads(&teamInfo,printSemaphoreInfo); } } From humdingerb at googlemail.com Sat Feb 21 19:44:02 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sat, 21 Feb 2009 19:44:02 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A03C2D.5070000@pinc-software.de> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> Message-ID: <49A04B72.1090503@googlemail.com> Axel D?rfler wrote: > "svn status" shows the changes you are about to commit; and you can > always use "svn commit" either with a file/directory argument, or just > call it within the subdirectory with your changes. Noted. I'll be more careful in the future. > BTW, I guess we could add "hda" to the image now, anyway, don't we? :-) That's for you guys to decide, if it's mature enough... Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From colacoder at mail.berlios.de Sat Feb 21 21:50:09 2009 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Sat, 21 Feb 2009 21:50:09 +0100 Subject: [Haiku-commits] r29275 - haiku/trunk/src/kits/device Message-ID: <200902212050.n1LKo95V017787@sheep.berlios.de> Author: colacoder Date: 2009-02-21 21:50:08 +0100 (Sat, 21 Feb 2009) New Revision: 29275 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29275&view=rev Modified: haiku/trunk/src/kits/device/USBInterface.cpp Log: Fix problem in BUSBInterface::OtherDescriptorAt(). It will now correctly return available non-standard descriptors. This makes listusb useful again with usb audio & video devices... Modified: haiku/trunk/src/kits/device/USBInterface.cpp =================================================================== --- haiku/trunk/src/kits/device/USBInterface.cpp 2009-02-21 18:16:36 UTC (rev 29274) +++ haiku/trunk/src/kits/device/USBInterface.cpp 2009-02-21 20:50:08 UTC (rev 29275) @@ -127,7 +127,7 @@ BUSBInterface::OtherDescriptorAt(uint32 index, usb_descriptor *descriptor, size_t length) const { - if (length > 0 && descriptor == NULL) + if (length <= 0 && descriptor == NULL) return B_BAD_VALUE; usb_raw_command command; @@ -137,7 +137,7 @@ command.generic_etc.alternate_index = fAlternate; command.generic_etc.generic_index = index; command.generic_etc.length = length; - if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR, &command, + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR_ETC, &command, sizeof(command)) || command.generic.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; From umccullough at gmail.com Sat Feb 21 23:15:53 2009 From: umccullough at gmail.com (Urias McCullough) Date: Sat, 21 Feb 2009 14:15:53 -0800 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A04B72.1090503@googlemail.com> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04B72.1090503@googlemail.com> Message-ID: <1e80d8750902211415o3ced843vae09781e33e03fa6@mail.gmail.com> On Sat, Feb 21, 2009 at 10:44 AM, Humdinger wrote: > Axel D?rfler wrote: >> "svn status" shows the changes you are about to commit; and you can >> always use "svn commit" either with a file/directory argument, or just >> call it within the subdirectory with your changes. > > Noted. I'll be more careful in the future. Instead of hacking HaikuImage just add this to your UserBuildConfig: AddDriversToHaikuImage audio hmulti : hda ; That will do the same thing. From umccullough at gmail.com Sat Feb 21 23:30:48 2009 From: umccullough at gmail.com (Urias McCullough) Date: Sat, 21 Feb 2009 14:30:48 -0800 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A04105.5090707@gmx.de> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04105.5090707@gmx.de> Message-ID: <1e80d8750902211430qf9ee05fo2bf6c3119e58f8ae@mail.gmail.com> On Sat, Feb 21, 2009 at 9:59 AM, Stephan A?mus wrote: > Axel D?rfler schrieb: >> BTW, I guess we could add "hda" to the image now, anyway, don't we? :-) > > Could potentially cause a lot of problems for people when they already > use OSS. But how will HDA ever get fully tested if everyone keeps using OSS instead ;) OSS also conflicts with many other drivers already in the image - so that seems like a poor reason not to include HDA still. As another example, I have heard several people using Senryu in the past complain that it crashes in VirtualBox because Senryu comes with OpenSound, and VirtualBox audio apparently uses auich and conflicts with it. Out of curiosity, what does HDA lack still? Just my .02 - I'm not a decision maker :) From dlmcpaul at gmail.com Sat Feb 21 23:34:12 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Sun, 22 Feb 2009 09:34:12 +1100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A04B72.1090503@googlemail.com> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04B72.1090503@googlemail.com> Message-ID: 2009/2/22 Humdinger : > Axel D?rfler wrote: >> "svn status" shows the changes you are about to commit; and you can >> always use "svn commit" either with a file/directory argument, or just >> call it within the subdirectory with your changes. > > Noted. I'll be more careful in the future. > >> BTW, I guess we could add "hda" to the image now, anyway, don't we? :-) > > That's for you guys to decide, if it's mature enough... I think it is working well enough to get added. and if we add it, then it will get more testing. -- Cheers David From anevilyak at mail.berlios.de Sun Feb 22 00:07:39 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 22 Feb 2009 00:07:39 +0100 Subject: [Haiku-commits] r29276 - haiku/trunk/src/kits/tracker Message-ID: <200902212307.n1LN7dMR030000@sheep.berlios.de> Author: anevilyak Date: 2009-02-22 00:07:38 +0100 (Sun, 22 Feb 2009) New Revision: 29276 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29276&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: Never show the copy cursor if the item being dragged is a volume or the disks icon. Fixes ticket #3468. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-21 20:50:08 UTC (rev 29275) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-21 23:07:38 UTC (rev 29276) @@ -4380,7 +4380,6 @@ destDir.GetStat(&deststat); return srcRef->device == deststat.st_dev; - } @@ -8725,7 +8724,10 @@ entry_ref srcRef; if (targetModel->IsDirectory() && dragMessage->HasRef("refs") && dragMessage->FindRef("refs", &srcRef) == B_OK) { - if (!CheckDevicesEqual(&srcRef, targetModel)) { + Model srcModel (&srcRef); + if (!CheckDevicesEqual(&srcRef, targetModel) + && !srcModel.IsVolume() + && !srcModel.IsRoot()) { BCursor copyCursor(kCopyCursor); SetViewCursor(©Cursor); return true; From anevilyak at mail.berlios.de Sun Feb 22 00:41:57 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 22 Feb 2009 00:41:57 +0100 Subject: [Haiku-commits] r29277 - haiku/trunk/src/kits/tracker Message-ID: <200902212341.n1LNfva7013326@sheep.berlios.de> Author: anevilyak Date: 2009-02-22 00:41:48 +0100 (Sun, 22 Feb 2009) New Revision: 29277 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29277&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: Revert the PoseView change from r29190. This is incorrect since the outline setting only applies to the desktop poseviews, and is explicitly set there by the backgrounds settings code in BackgroundImage.cpp. This fixes the font rendering artifacts reported in ticket #3467. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-21 23:07:38 UTC (rev 29276) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-21 23:41:48 UTC (rev 29277) @@ -209,7 +209,7 @@ fRefFilter(NULL), fAutoScrollInc(20), fAutoScrollState(kAutoScrollOff), - fWidgetTextOutline(true), + fWidgetTextOutline(false), fSelectionPivotPose(NULL), fRealPivotPose(NULL), fKeyRunner(NULL), From phoudoin at mail.berlios.de Sun Feb 22 02:35:22 2009 From: phoudoin at mail.berlios.de (phoudoin at mail.berlios.de) Date: Sun, 22 Feb 2009 02:35:22 +0100 Subject: [Haiku-commits] r29278 - haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169 Message-ID: <200902220135.n1M1ZMQx001496@sheep.berlios.de> Author: phoudoin Date: 2009-02-22 02:35:15 +0100 (Sun, 22 Feb 2009) New Revision: 29278 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29278&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.h Log: Implemented ETHER_GET_LINK_STATE and ETHER_SET_LINK_STATE_SEM for rtl8169. Modified: haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c 2009-02-21 23:41:48 UTC (rev 29277) +++ haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.c 2009-02-22 01:35:15 UTC (rev 29278) @@ -24,7 +24,11 @@ #include #include #include +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + #include +#endif + #include "debug.h" #include "device.h" #include "driver.h" @@ -379,6 +383,55 @@ } +static status_t +rtl8169_get_link_state(rtl8169_device *device) +{ + bool link_ok = false; + bool full_duplex = false; + uint32 speed = 0; + bool linkStateChange = false; + uint32 phy; + + dump_phy_stat(device); + print_link_status(device); + + phy = read8(REG_PHY_STAT); + if (phy & PHY_STAT_EnTBI) { + link_ok = (read32(REG_TBICSR) & TBICSR_TBILinkOk); + if (link_ok) { + speed = 1000000; + full_duplex = true; + } + } else { + if (phy & PHY_STAT_LinkSts) { + link_ok = true; + if (phy & PHY_STAT_1000MF) { + speed = 1000000; + full_duplex = true; + } else { + speed = (phy & PHY_STAT_100M) ? 100000 : 10000; + full_duplex = (phy & PHY_STAT_FullDup); + } + } + } + + linkStateChange = (link_ok != device->link_ok + || full_duplex != device->full_duplex + || speed != device->speed); + + device->link_ok = link_ok; + device->full_duplex = full_duplex; + device->speed = speed; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + if (linkStateChange && device->linkChangeSem >= B_OK) + release_sem_etc(device->linkChangeSem, 1, B_DO_NOT_RESCHEDULE); +#endif + + return B_OK; +} + + static int32 rtl8169_int(void *data) { @@ -406,8 +459,7 @@ } if (stat & INT_PUN) { - dump_phy_stat(device); - print_link_status(device); + rtl8169_get_link_state(device); } if (stat & (INT_TOK | INT_TER)) { @@ -571,9 +623,12 @@ // configure PHY phy_config(device); - dump_phy_stat(device); - print_link_status(device); +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + device->linkChangeSem = -1; +#endif + rtl8169_get_link_state(device); + // initialize MAC address for (i = 0; i < 6; i++) device->macaddr[i] = read8(i); @@ -914,6 +969,37 @@ *(uint32*)arg = device->maxframesize; return B_OK; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + case ETHER_GET_LINK_STATE: + { + ether_link_state_t state; + + state.media = IFM_ETHER; + state.media |= (device->link_ok ? IFM_ACTIVE : 0); + state.media |= (device->full_duplex ? IFM_FULL_DUPLEX : IFM_HALF_DUPLEX); + if (device->speed == 1000000) + state.media |= IFM_1000_T; + else if (device->speed == 100000) + state.media |= IFM_100_TX; + else if (device->speed == 10000) + state.media |= IFM_10_T; + + state.speed = device->speed; + state.quality = 1000; + + return user_memcpy(arg, &state, sizeof(ether_link_state_t)); + } + + case ETHER_SET_LINK_STATE_SEM: + { + if (user_memcpy(&device->linkChangeSem, arg, sizeof(sem_id)) < B_OK) { + device->linkChangeSem = -1; + return B_BAD_ADDRESS; + } + return B_OK; + } +#endif + default: TRACE("rtl8169_control() Invalid command\n"); break; Modified: haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.h 2009-02-21 23:41:48 UTC (rev 29277) +++ haiku/trunk/src/add-ons/kernel/drivers/network/rtl8169/device.h 2009-02-22 01:35:15 UTC (rev 29278) @@ -92,6 +92,15 @@ int maxframesize; int mac_version; int phy_version; + + bool link_ok; + uint32 speed; + bool full_duplex; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + sem_id linkChangeSem; +#endif + } rtl8169_device; #define read8(offset) (*(volatile uint8 *) ((char *)(device->regAddr) + (offset))) From humdingerb at googlemail.com Sun Feb 22 08:01:23 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sun, 22 Feb 2009 08:01:23 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <1e80d8750902211415o3ced843vae09781e33e03fa6@mail.gmail.com> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04B72.1090503@googlemail.com> <1e80d8750902211415o3ced843vae09781e33e03fa6@mail.gmail.com> Message-ID: <49A0F843.9000105@googlemail.com> Urias McCullough wrote: > Instead of hacking HaikuImage just add this to your UserBuildConfig: > > AddDriversToHaikuImage audio hmulti : hda ; > > That will do the same thing. Ah. Didn't know that one. Thanks! Now can I finally build with hda to run natively and OpenSound for vmware (if that works for getting sound there). Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From umccullough at gmail.com Sun Feb 22 09:08:07 2009 From: umccullough at gmail.com (Urias McCullough) Date: Sun, 22 Feb 2009 00:08:07 -0800 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A0F843.9000105@googlemail.com> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04B72.1090503@googlemail.com> <1e80d8750902211415o3ced843vae09781e33e03fa6@mail.gmail.com> <49A0F843.9000105@googlemail.com> Message-ID: <1e80d8750902220008l2d0a0ecbh161cb45c30eac404@mail.gmail.com> On Sat, Feb 21, 2009 at 11:01 PM, Humdinger wrote: > Now can I finally build with hda to run natively and OpenSound for vmware (if that works > for getting sound there). Sounds like a job for build profiles :) You can change vmware to emulate es1370/es1371 which is a PCI chipset that OpenSound does support. - Urias From humdingerb at googlemail.com Sun Feb 22 11:24:01 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sun, 22 Feb 2009 11:24:01 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <1e80d8750902220008l2d0a0ecbh161cb45c30eac404@mail.gmail.com> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04B72.1090503@googlemail.com> <1e80d8750902211415o3ced843vae09781e33e03fa6@mail.gmail.com> <49A0F843.9000105@googlemail.com> <1e80d8750902220008l2d0a0ecbh161cb45c30eac404@mail.gmail.com> Message-ID: <49A127C1.4020500@googlemail.com> Urias McCullough wrote: > Sounds like a job for build profiles :) Yep. Already using one for @disk and one @vmware, though these builds were pretty identical. > You can change vmware to emulate es1370/es1371 which is a PCI chipset > that OpenSound does support. Ah. How do you do that? My haiku.vmx just says 'sound.present = "TRUE"'. Maybe we should update http://haiku-files.org/files/haiku.vmx and haiku/3rdparty/vmware/haiku.vmx accordingly. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From colacoder at mail.berlios.de Sun Feb 22 11:39:31 2009 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Sun, 22 Feb 2009 11:39:31 +0100 Subject: [Haiku-commits] r29279 - haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam Message-ID: <200902221039.n1MAdVbV011746@sheep.berlios.de> Author: colacoder Date: 2009-02-22 11:39:31 +0100 (Sun, 22 Feb 2009) New Revision: 29279 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29279&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp Log: * Make usb device detection in usb_webcam identical to the way the usb bus_manager handles it. * Fix some minor printf()-style warnings in the debug build of usb_webcam. Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2009-02-22 01:35:15 UTC (rev 29278) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2009-02-22 10:39:31 UTC (rev 29279) @@ -491,7 +491,7 @@ len = fBulkIn->BulkTransfer(fBuffer, fBufferLen); #endif - PRINT((CH ": got %d bytes" CT, len)); + PRINT((CH ": got %ld bytes" CT, len)); #ifdef DEBUG_WRITE_DUMP write(fDumpFD, fBuffer, len); #endif @@ -618,23 +618,48 @@ return ENODEV; if (!device) return EINVAL; - for (uint32 i = 0; fSupportedDevices[i].vendor; i++) + + bool supported = false; + for (uint32 i = 0; !supported && fSupportedDevices[i].vendor; i++) { -/* PRINT((CH "{%u,%u,%u,0x%x,0x%x} <> {%u,%u,%u,0x%x,0x%x}" CT, - device.Class(), device.Subclass(), device.Protocol(), device.VendorID(), device.ProductID(), - fSupportedDevices[i].desc.dev_class, fSupportedDevices[i].desc.dev_subclass, fSupportedDevices[i].desc.dev_protocol, fSupportedDevices[i].desc.vendor, fSupportedDevices[i].desc.product));*/ -/* if (device.Class() != fSupportedDevices[i].desc.dev_class) + if ((fSupportedDevices[i].desc.vendor != 0 + && device->VendorID() != fSupportedDevices[i].desc.vendor) + || (fSupportedDevices[i].desc.product != 0 + && device->ProductID() != fSupportedDevices[i].desc.product)) continue; - if (device.Subclass() != fSupportedDevices[i].desc.dev_subclass) - continue; - if (device.Protocol() != fSupportedDevices[i].desc.dev_protocol) - continue;*/ - if (device->VendorID() != fSupportedDevices[i].desc.vendor) - continue; - if (device->ProductID() != fSupportedDevices[i].desc.product) - continue; - return i; + + if ((fSupportedDevices[i].desc.dev_class == 0 + || device->Class() == fSupportedDevices[i].desc.dev_class) + && (fSupportedDevices[i].desc.dev_subclass == 0 + || device->Subclass() == fSupportedDevices[i].desc.dev_subclass) + && (fSupportedDevices[i].desc.dev_protocol == 0 + || device->Protocol() == fSupportedDevices[i].desc.dev_protocol)) { + supported = true; + } + + // we have to check all interfaces for matching class/subclass/protocol + for (uint32 j = 0; !supported && j < device->CountConfigurations(); j++) { + const BUSBConfiguration* cfg = device->ConfigurationAt(j); + for (uint32 k = 0; !supported && k < cfg->CountInterfaces(); k++) { + const BUSBInterface* intf = cfg->InterfaceAt(k); + for (uint32 l = 0; !supported && l < intf->CountAlternates(); l++) { + const BUSBInterface* alt = intf->AlternateAt(l); + if ((fSupportedDevices[i].desc.dev_class == 0 + || alt->Class() == fSupportedDevices[i].desc.dev_class) + && (fSupportedDevices[i].desc.dev_subclass == 0 + || alt->Subclass() == fSupportedDevices[i].desc.dev_subclass) + && (fSupportedDevices[i].desc.dev_protocol == 0 + || alt->Protocol() == fSupportedDevices[i].desc.dev_protocol)) { + supported = true; + } + } + } + } + + if (supported) + return i; } + return ENODEV; } Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp 2009-02-22 01:35:15 UTC (rev 29278) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamRoster.cpp 2009-02-22 10:39:31 UTC (rev 29279) @@ -88,7 +88,7 @@ { int32 count; fLocker.Lock(); - PRINT((CH "(): %d cameras" CT, fCameras.CountItems())); + PRINT((CH "(): %ld cameras" CT, fCameras.CountItems())); count = fCameras.CountItems(); fLocker.Unlock(); return count; From dlmcpaul at gmail.com Sun Feb 22 11:46:55 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Sun, 22 Feb 2009 21:46:55 +1100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A127C1.4020500@googlemail.com> References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04B72.1090503@googlemail.com> <1e80d8750902211415o3ced843vae09781e33e03fa6@mail.gmail.com> <49A0F843.9000105@googlemail.com> <1e80d8750902220008l2d0a0ecbh161cb45c30eac404@mail.gmail.com> <49A127C1.4020500@googlemail.com> Message-ID: 2009/2/22 Humdinger : > Urias McCullough wrote: >> Sounds like a job for build profiles :) > > Yep. Already using one for @disk and one @vmware, though these builds were pretty identical. > >> You can change vmware to emulate es1370/es1371 which is a PCI chipset >> that OpenSound does support. > > Ah. How do you do that? My haiku.vmx just says 'sound.present = "TRUE"'. sound.virtualDev = "es1371" > Maybe we should update http://haiku-files.org/files/haiku.vmx and > haiku/3rdparty/vmware/haiku.vmx accordingly. You can also turn on usb devices with usb.present = "TRUE" I also have a second disk that I put things on that I want to keep when I recreate the haiku image. ide0:1.present = "TRUE" ide0:1.fileName = "spare.vmdk" ide0:1.deviceType = "disk" ide0:1.mode = "persistent" ide0:1.redo = "" ide0:1.writeThrough = "FALSE" ide0:1.startConnected = "FALSE" -- Cheers David From colacoder at mail.berlios.de Sun Feb 22 11:53:13 2009 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Sun, 22 Feb 2009 11:53:13 +0100 Subject: [Haiku-commits] r29280 - haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam Message-ID: <200902221053.n1MArD3D013444@sheep.berlios.de> Author: colacoder Date: 2009-02-22 11:53:13 +0100 (Sun, 22 Feb 2009) New Revision: 29280 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29280&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp Log: * Fix initialisation of CamDevice::fIsoIn. * Fix debug message on IsoIn path. Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2009-02-22 10:39:31 UTC (rev 29279) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2009-02-22 10:53:13 UTC (rev 29280) @@ -35,6 +35,8 @@ CamDevice::CamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) : fInitStatus(B_NO_INIT), fSensor(NULL), + fBulkIn(NULL), + fIsoIn(NULL), fLastParameterChanges(0), fCamDeviceAddon(_addon), fDevice(_device), @@ -104,6 +106,7 @@ { fDevice = NULL; fBulkIn = NULL; + fIsoIn = NULL; } @@ -539,7 +542,7 @@ #endif if (len <= 0) { - PRINT((CH ": BulkIn: %s" CT, strerror(len))); + PRINT((CH ": IsoIn: %s" CT, strerror(len))); break; } From colacoder at mail.berlios.de Sun Feb 22 13:58:24 2009 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Sun, 22 Feb 2009 13:58:24 +0100 Subject: [Haiku-commits] r29281 - haiku/trunk/src/kits/device Message-ID: <200902221258.n1MCwO8a009663@sheep.berlios.de> Author: colacoder Date: 2009-02-22 13:58:24 +0100 (Sun, 22 Feb 2009) New Revision: 29281 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29281&view=rev Modified: haiku/trunk/src/kits/device/USBInterface.cpp Log: Complete my previous fix :$ Modified: haiku/trunk/src/kits/device/USBInterface.cpp =================================================================== --- haiku/trunk/src/kits/device/USBInterface.cpp 2009-02-22 10:53:13 UTC (rev 29280) +++ haiku/trunk/src/kits/device/USBInterface.cpp 2009-02-22 12:58:24 UTC (rev 29281) @@ -127,7 +127,7 @@ BUSBInterface::OtherDescriptorAt(uint32 index, usb_descriptor *descriptor, size_t length) const { - if (length <= 0 && descriptor == NULL) + if (length <= 0 || descriptor == NULL) return B_BAD_VALUE; usb_raw_command command; From colacoder at mail.berlios.de Sun Feb 22 14:19:14 2009 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Sun, 22 Feb 2009 14:19:14 +0100 Subject: [Haiku-commits] r29282 - in haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam: . addons addons/uvc Message-ID: <200902221319.n1MDJENV013283@sheep.berlios.de> Author: colacoder Date: 2009-02-22 14:19:13 +0100 (Sun, 22 Feb 2009) New Revision: 29282 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29282&view=rev Added: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/USB_video.h haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile Log: Some initial code for USB Video-based Webcams. It currently parses the USB Video descriptors and dumps the information out via stdout. I'd be very pleased if anyone with a USB Video webcam (or other device) could take the following steps: * hey media_server QUIT * /system/servers/media_server > /boot/home/media_server.log * listusb -v > /boot/home/listusb.log and mail the two resulting files to ithamar AT unet DOT nl. Thanks! Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile 2009-02-22 12:58:24 UTC (rev 29281) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile 2009-02-22 13:19:13 UTC (rev 29282) @@ -16,6 +16,7 @@ local sourceDirs = addons/quickcam addons/sonix + addons/uvc addons cstransforms sensors @@ -29,7 +30,7 @@ ## addon sources local addonSources ; -addonSources = QuickCamDevice.cpp SonixCamDevice.cpp NW80xCamDevice.cpp ; +addonSources = QuickCamDevice.cpp SonixCamDevice.cpp NW80xCamDevice.cpp UVCCamDevice.cpp ; ## colorspace transforms sources local csTransformsSources ; Added: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/USB_video.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/USB_video.h 2009-02-22 12:58:24 UTC (rev 29281) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/USB_video.h 2009-02-22 13:19:13 UTC (rev 29282) @@ -0,0 +1,92 @@ +/* + * Copyright 2009, Ithamar Adema, . + * Distributed under the terms of the MIT License. + */ + +#ifndef _USB_VIDEO_H +#define _USB_VIDEO_H + +/* Class/Subclass/Protocol */ +#define CC_VIDEO 0xE +#define SC_UNDEFINED 0x0 +#define SC_VIDEOCONTROL 0x1 +#define SC_VIDEOSTREAMING 0x2 +#define SC_VIDEO_INTERFACE_COLLECTION 0x3 +#define PC_PROTOCOL_UNDEFINED 0x0 + +#define CS_UNDEFINED 0x20 +#define CS_DEVICE 0x21 +#define CS_CONFIGURATION 0x22 +#define CS_STRING 0x23 +#define CS_INTERFACE 0x24 +#define CS_ENDPOINT 0x25 + +/* Video Control Class Descriptors */ +#define VC_DESCRIPTOR_UNDEFINED 0x0 +#define VC_HEADER 0x1 +#define VC_INPUT_TERMINAL 0x2 +#define VC_OUTPUT_TERMINAL 0x3 +#define VC_SELECTOR_UNIT 0x4 +#define VC_PROCESSING_UNIT 0x5 +#define VC_EXTENSION_UNIT 0x6 + +/* Video Streaming Class Descriptors */ +#define VS_UNDEFINED 0x00 +#define VS_INPUT_HEADER 0x01 +#define VS_OUTPUT_HEADER 0x02 +#define VS_STILL_IMAGE_FRAME 0x03 +#define VS_FORMAT_UNCOMPRESSED 0x04 +#define VS_FRAME_UNCOMPRESSED 0x05 +#define VS_FORMAT_MJPEG 0x06 +#define VS_FRAME_MJPEG 0x07 +#define VS_FORMAT_MPEG2TS 0x0a +#define VS_FORMAT_DV 0x0c +#define VS_COLORFORMAT 0x0d +#define VS_FORMAT_FRAME_BASED 0x10 +#define VS_FRAME_FRAME_BASED 0x11 +#define VS_FORMAT_STREAM_BASED 0x12 + +#define EP_UNDEFINED 0x0 +#define EP_GENERAL 0x1 +#define EP_ENDPOINT 0x2 +#define EP_INTERRUPT 0x3 + +#define RC_UNDEFINED 0x00 +#define SET_CUR 0x01 +#define GET_CUR 0x81 +#define GET_MIN 0x82 +#define GET_MAX 0x83 +#define GET_RES 0x84 +#define GET_LEN 0x85 +#define GET_INFO 0x86 +#define GET_DEF 0x87 + +#define VC_CONTROL_UNDEFINED 0x0 +#define VC_VIDEO_POWER_MODE_CONTROL 0x1 +#define VC_REQUEST_ERROR_CODE_CONTROL 0x2 + +#define TE_CONTROL_UNDEFINED 0x0 + +#define SU_CONTROL_UNDEFINED 0x0 +#define SU_INPUT_SELECT_CONTROL 0x1 + +#define CT_CONTROL_UNDEFINED 0x0 +#define CT_SCANNING_MODE_CONTROL 0x1 +#define CT_AE_MODE_CONTROL 0x2 +#define CT_AE_PRIORITY_CONTROL 0x3 +#define CT_EXPOSURE_TIME_ABSOLUTE_CONTROL 0x4 +#define CT_EXPOSURE_TIME_RELATIVE_CONTROL 0x5 +#define CT_FOCUS_ABSOLUTE_CONTROL 0x6 +#define CT_FOCUS_RELATIVE_CONTROL 0x7 +#define CT_FOCUS_AUTO_CONTROL 0x8 +#define CT_IRIS_ABSOLUTE_CONTROL 0x9 +#define CT_IRIS_RELATIVE_CONTROL 0xa +#define CT_ZOOM_ABSOLUTE_CONTROL 0xb +#define CT_ZOOM_RELATIVE_CONTROL 0xc +#define CT_PANTILT_ABSOLUTE_CONTROL 0xd +#define CT_PANTILT_RELATIVE_CONTROL 0xe +#define CT_ROLL_ABSOLUTE_CONTROL 0xf +#define CT_ROLL_RELATIVE_CONTROL 0x10 +#define CT_PRIVACY_CONTROL 0x11 + +#endif /* _USB_VIDEO_H */ Added: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp 2009-02-22 12:58:24 UTC (rev 29281) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp 2009-02-22 13:19:13 UTC (rev 29282) @@ -0,0 +1,329 @@ +/* + * Copyright 2009, Ithamar Adema, . + * Distributed under the terms of the MIT License. + */ + +#include "UVCCamDevice.h" +#include "USB_video.h" +#include + +usb_webcam_support_descriptor kSupportedDevices[] = { + // ofcourse we support a generic UVC device... + {{ CC_VIDEO, SC_VIDEOCONTROL, 0, 0, 0 }, "USB", "Video Class", "??" }, + // ...whilst the following IDs were 'stolen' from a recent Linux driver: + {{ 0, 0, 0, 0x045e, 0x00f8, }, "Microsoft", "Lifecam NX-6000", "??" }, + {{ 0, 0, 0, 0x045e, 0x0723, }, "Microsoft", "Lifecam VX-7000", "??" }, + {{ 0, 0, 0, 0x046d, 0x08c1, }, "Logitech", "QuickCam Fusion", "??" }, + {{ 0, 0, 0, 0x046d, 0x08c2, }, "Logitech", "QuickCam Orbit MP", "??" }, + {{ 0, 0, 0, 0x046d, 0x08c3, }, "Logitech", "QuickCam Pro for Notebook", "??" }, + {{ 0, 0, 0, 0x046d, 0x08c5, }, "Logitech", "QuickCam Pro 5000", "??" }, + {{ 0, 0, 0, 0x046d, 0x08c6, }, "Logitech", "QuickCam OEM Dell Notebook", "??" }, + {{ 0, 0, 0, 0x046d, 0x08c7, }, "Logitech", "QuickCam OEM Cisco VT Camera II", "??" }, + {{ 0, 0, 0, 0x05ac, 0x8501, }, "Apple", "Built-In iSight", "??" }, + {{ 0, 0, 0, 0x05e3, 0x0505, }, "Genesys Logic", "USB 2.0 PC Camera", "??" }, + {{ 0, 0, 0, 0x0e8d, 0x0004, }, "N/A", "MT6227", "??" }, + {{ 0, 0, 0, 0x174f, 0x5212, }, "Syntek", "(HP Spartan)", "??" }, + {{ 0, 0, 0, 0x174f, 0x5931, }, "Syntek", "(Samsung Q310)", "??" }, + {{ 0, 0, 0, 0x174f, 0x8a31, }, "Syntek", "Asus F9SG", "??" }, + {{ 0, 0, 0, 0x174f, 0x8a33, }, "Syntek", "Asus U3S", "??" }, + {{ 0, 0, 0, 0x17ef, 0x480b, }, "N/A", "Lenovo Thinkpad SL500", "??" }, + {{ 0, 0, 0, 0x18cd, 0xcafe, }, "Ecamm", "Pico iMage", "??" }, + {{ 0, 0, 0, 0x19ab, 0x1000, }, "Bodelin", "ProScopeHR", "??" }, + {{ 0, 0, 0, 0x1c4f, 0x3000, }, "SiGma Micro", "USB Web Camera", "??" }, + {{ 0, 0, 0, 0, 0}, NULL, NULL, NULL } +}; + +static void print_guid(const uint8* buf) +{ + printf("%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x", + buf[0], buf[1], buf[2], buf[3], buf[4], buf[5], buf[6], buf[7], + buf[8], buf[9], buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); +} + + +UVCCamDevice::UVCCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device) + : CamDevice(_addon, _device) +{ + const BUSBConfiguration* uc; + const BUSBInterface* ui; + usb_descriptor *generic; + uint32 cfg, intf, di; + uint8 buffer[1024]; + + generic = (usb_descriptor *)buffer; + + for (cfg=0; cfg < _device->CountConfigurations(); cfg++) { + uc = _device->ConfigurationAt(cfg); + for (intf=0; intf < uc->CountInterfaces(); intf++) { + ui = uc->InterfaceAt(intf); + + if (ui->Class() == CC_VIDEO && ui->Subclass() == SC_VIDEOCONTROL) { + printf("UVCCamDevice: (%lu,%lu): Found Video Control interface.\n", cfg, intf); + + // look for class specific interface descriptors and parse them + for (di=0; ui->OtherDescriptorAt(di,generic,sizeof(buffer)) == B_OK; ++di) + if (generic->generic.descriptor_type == (USB_REQTYPE_CLASS | USB_DESCRIPTOR_INTERFACE)) + ParseVideoControl(buffer, generic->generic.length); + + fInitStatus = B_OK; + } else if (ui->Class() == CC_VIDEO && ui->Subclass() == SC_VIDEOSTREAMING) { + printf("UVCCamDevice: (%lu,%lu): Found Video Control interface.\n", cfg, intf); + + // look for class specific interface descriptors and parse them + for (di=0; ui->OtherDescriptorAt(di,generic,sizeof(buffer)) == B_OK; ++di) + if (generic->generic.descriptor_type == (USB_REQTYPE_CLASS | USB_DESCRIPTOR_INTERFACE)) + ParseVideoStreaming(buffer, generic->generic.length); + } + } + } +} + +void UVCCamDevice::ParseVideoStreaming(const uint8* buffer, size_t len) +{ + int c, i, sz; + + switch(buffer[2]) { + case VS_INPUT_HEADER: + c = buffer[3]; + printf("VS_INPUT_HEADER:\t#fmts=%d,ept=0x%x\n", c, buffer[6]); + if (buffer[7] & 1) printf("\tDynamic Format Change supported\n"); + printf("\toutput terminal id=%d\n", buffer[8]); + printf("\tstill capture method=%d\n", buffer[9]); + if (buffer[10]) + printf("\ttrigger button fixed to still capture=%s\n", buffer[11] ? "no" : "yes"); + sz = buffer[12]; + for (i=0; i < c; i++) { + printf("\tfmt%d: %s %s %s %s - %s %s\n", i, + (buffer[13+(sz*i)] & 1) ? "wKeyFrameRate" : "", + (buffer[13+(sz*i)] & 2) ? "wPFrameRate" : "", + (buffer[13+(sz*i)] & 4) ? "wCompQuality" : "", + (buffer[13+(sz*i)] & 8) ? "wCompWindowSize" : "", + (buffer[13+(sz*i)] & 16) ? "" : "", + (buffer[13+(sz*i)] & 32) ? "" : ""); + } + break; + case VS_FORMAT_UNCOMPRESSED: + c = buffer[4]; + printf("VS_FORMAT_UNCOMPRESSED:\tbFormatIdx=%d,#frmdesc=%d,guid=", buffer[3], c); + print_guid(buffer+5); + printf("\n\t#bpp=%d,optfrmidx=%d,aspRX=%d,aspRY=%d\n", buffer[21], buffer[22], + buffer[23], buffer[24]); + printf("\tbmInterlaceFlags:\n"); + if (buffer[25] & 1) printf("\tInterlaced stream or variable\n"); + printf("\t%d fields per frame\n", (buffer[25] & 2) ? 1 : 2); + if (buffer[25] & 4) printf("\tField 1 first\n"); + printf("\tField Pattern: "); + switch((buffer[25] & 0x30) >> 4) { + case 0: printf("Field 1 only\n"); break; + case 1: printf("Field 2 only\n"); break; + case 2: printf("Regular pattern of fields 1 and 2\n"); break; + case 3: printf("Random pattern of fields 1 and 2\n"); break; + } + if (buffer[26]) printf("\tRestrict duplication\n"); break; + break; + case VS_FRAME_UNCOMPRESSED: + printf("VS_FRAME_UNCOMPRESSED:\tbFrameIdx=%d,stillsupported=%s,fixedfrmrate=%s\n", + buffer[3], (buffer[4]&1)?"yes":"no", (buffer[4]&2)?"yes":"no"); + printf("\twidth=%u,height=%u,min/max bitrate=%lu/%lu, maxbuf=%lu\n", + *(uint16*)(buffer+5), *(uint16*)(buffer+7), + *(uint32*)(buffer+9), *(uint32*)(buffer+13), + *(uint32*)(buffer+17)); + printf("\tframe interval: %lu, #intervals(0=cont): %d\n", *(uint32*)(buffer+21), buffer[25]); + //TODO print interval table + break; + case VS_COLORFORMAT: + printf("VS_COLORFORMAT:\n\tbColorPrimaries: "); + switch(buffer[3]) { + case 0: printf("Unspecified\n"); break; + case 1: printf("BT.709,sRGB\n"); break; + case 2: printf("BT.470-2(M)\n"); break; + case 3: printf("BT.470-2(B,G)\n"); break; + case 4: printf("SMPTE 170M\n"); break; + case 5: printf("SMPTE 240M\n"); break; + default: printf("Invalid (%d)\n", buffer[3]); + } + printf("\tbTransferCharacteristics: "); + switch(buffer[4]) { + case 0: printf("Unspecified\n"); break; + case 1: printf("BT.709\n"); break; + case 2: printf("BT.470-2(M)\n"); break; + case 3: printf("BT.470-2(B,G)\n"); break; + case 4: printf("SMPTE 170M\n"); break; + case 5: printf("SMPTE 240M\n"); break; + case 6: printf("Linear (V=Lc)\n"); break; + case 7: printf("sRGB\n"); break; + default: printf("Invalid (%d)\n", buffer[4]); + } + printf("\tbMatrixCoefficients: "); + switch(buffer[5]) { + case 0: printf("Unspecified\n"); break; + case 1: printf("BT.709\n"); break; + case 2: printf("FCC\n"); break; + case 3: printf("BT.470-2(B,G)\n"); break; + case 4: printf("SMPTE 170M (BT.601)\n"); break; + case 5: printf("SMPTE 240M\n"); break; + default: printf("Invalid (%d)\n", buffer[5]); + } + break; + + case VS_OUTPUT_HEADER: + printf("VS_OUTPUT_HEADER:\t\n"); + break; + case VS_STILL_IMAGE_FRAME: + printf("VS_STILL_IMAGE_FRAME:\t\n"); + break; + case VS_FORMAT_MJPEG: + printf("VS_FORMAT_MJPEG:\t\n"); + break; + case VS_FRAME_MJPEG: + printf("VS_FRAME_MJPEG:\t\n"); + break; + case VS_FORMAT_MPEG2TS: + printf("VS_FORMAT_MPEG2TS:\t\n"); + break; + case VS_FORMAT_DV: + printf("VS_FORMAT_DV:\t\n"); + break; + case VS_FORMAT_FRAME_BASED: + printf("VS_FORMAT_FRAME_BASED:\t\n"); + break; + case VS_FRAME_FRAME_BASED: + printf("VS_FRAME_FRAME_BASED:\t\n"); + break; + case VS_FORMAT_STREAM_BASED: + printf("VS_FORMAT_STREAM_BASED:\t\n"); + break; + default: + printf("INVALID STREAM UNIT TYPE=%d!\n", buffer[2]); + } +} + +void UVCCamDevice::ParseVideoControl(const uint8* buffer, size_t len) +{ + int c, i; + + switch(buffer[2]) { + case VC_HEADER: + printf("VC_HEADER:\tUVC v%04x, clk %lu Hz\n", *(uint16*)(buffer+3), *(uint32*)(buffer+7)); + c = (len >= 12) ? buffer[11] : 0; + for (i=0; i < c; i++) + printf("\tStreaming Interface %d\n", buffer[12+i]); + break; + + case VC_INPUT_TERMINAL: + printf("VC_INPUT_TERMINAL:\tid=%d,type=%04x,associated terminal=%d\n", buffer[3], *(uint16*)(buffer+4), buffer[6]); + printf("\tDesc: %s\n", fDevice->DecodeStringDescriptor(buffer[7])); + break; + + case VC_OUTPUT_TERMINAL: + printf("VC_OUTPUT_TERMINAL:\tid=%d,type=%04x,associated terminal=%d, src id=%d\n", buffer[3], *(uint16*)(buffer+4), buffer[6], buffer[7]); + printf("\tDesc: %s\n", fDevice->DecodeStringDescriptor(buffer[8])); + break; + + case VC_SELECTOR_UNIT: + printf("VC_SELECTOR_UNIT:\tid=%d,#pins=%d\n", buffer[3], buffer[4]); + printf("\t"); + for (i=0; i < buffer[4]; i++) + printf("%d ", buffer[5+i]); + printf("\n"); + printf("\tDesc: %s\n", fDevice->DecodeStringDescriptor(buffer[5+buffer[4]])); + break; + + case VC_PROCESSING_UNIT: + printf("VC_PROCESSING_UNIT:\tid=%d,src id=%d, digmul=%d\n", buffer[3], buffer[4], *(uint16*)(buffer+5)); + c = buffer[7]; + printf("\tbControlSize=%d\n", c); + if (c >= 1) { + if (buffer[8] & 1) printf("\tBrightness\n"); + if (buffer[8] & 2) printf("\tContrast\n"); + if (buffer[8] & 4) printf("\tHue\n"); + if (buffer[8] & 8) printf("\tSaturation\n"); + if (buffer[8] & 16) printf("\tSharpness\n"); + if (buffer[8] & 32) printf("\tGamma\n"); + if (buffer[8] & 64) printf("\tWhite Balance Temperature\n"); + if (buffer[8] & 128) printf("\tWhite Balance Component\n"); + } + if (c >= 2) { + if (buffer[9] & 1) printf("\tBacklight Compensation\n"); + if (buffer[9] & 2) printf("\tGain\n"); + if (buffer[9] & 4) printf("\tPower Line Frequency\n"); + if (buffer[9] & 8) printf("\t[AUTO] Hue\n"); + if (buffer[9] & 16) printf("\t[AUTO] White Balance Temperature\n"); + if (buffer[9] & 32) printf("\t[AUTO] White Balance Component\n"); + if (buffer[9] & 64) printf("\tDigital Multiplier\n"); + if (buffer[9] & 128) printf("\tDigital Multiplier Limit\n"); + } + if (c >= 3) { + if (buffer[10] & 1) printf("\tAnalog Video Standard\n"); + if (buffer[10] & 2) printf("\tAnalog Video Lock Status\n"); + } + printf("\tDesc: %s\n", fDevice->DecodeStringDescriptor(buffer[8+c])); + i=buffer[9+c]; + if (i & 2) printf("\tNTSC 525/60\n"); + if (i & 4) printf("\tPAL 625/50\n"); + if (i & 8) printf("\tSECAM 625/50\n"); + if (i & 16) printf("\tNTSC 625/50\n"); + if (i & 32) printf("\tPAL 525/60\n"); + break; + + case VC_EXTENSION_UNIT: + printf("VC_EXTENSION_UNIT:\tid=%d, guid=", buffer[3]); + print_guid(buffer+4); + printf("\n\t#ctrls=%d, #pins=%d\n", buffer[20], buffer[21]); + c = buffer[21]; + printf("\t"); + for (i=0; i < c; i++) + printf("%d ", buffer[22+i]); + printf("\n"); + printf("\tDesc: %s\n", fDevice->DecodeStringDescriptor(buffer[23+c+buffer[22+c]])); + break; + + default: + printf("Unknown control %d\n", buffer[2]); + } +} + +UVCCamDevice::~UVCCamDevice() +{ +} + +bool UVCCamDevice::SupportsIsochronous() +{ + return true; +} + +status_t UVCCamDevice::StartTransfer() +{ + return CamDevice::StartTransfer(); +} + +status_t UVCCamDevice::StopTransfer() +{ + return CamDevice::StopTransfer(); +} + +UVCCamDeviceAddon::UVCCamDeviceAddon(WebCamMediaAddOn* webcam) + : CamDeviceAddon(webcam) +{ + SetSupportedDevices(kSupportedDevices); +} + + +UVCCamDeviceAddon::~UVCCamDeviceAddon() +{ +} + +UVCCamDevice * +UVCCamDeviceAddon::Instantiate(CamRoster &roster, BUSBDevice *from) +{ + return new UVCCamDevice(*this, from); +} + + +extern "C" status_t +B_WEBCAM_MKINTFUNC(uvccam) +(WebCamMediaAddOn* webcam, CamDeviceAddon **addon) +{ + *addon = new UVCCamDeviceAddon(webcam); + return B_OK; +} Added: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h 2009-02-22 12:58:24 UTC (rev 29281) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h 2009-02-22 13:19:13 UTC (rev 29282) @@ -0,0 +1,34 @@ +/* + * Copyright 2009, Ithamar Adema, . + * Distributed under the terms of the MIT License. + */ + +#ifndef _UVC_CAM_DEVICE_H +#define _UVC_CAM_DEVICE_H + +#include "CamDevice.h" + +class UVCCamDevice : public CamDevice +{ +public: + UVCCamDevice(CamDeviceAddon &_addon, BUSBDevice* _device); + ~UVCCamDevice(); + + virtual bool SupportsIsochronous(); + virtual status_t StartTransfer(); + virtual status_t StopTransfer(); +private: + void ParseVideoControl(const uint8* buf, size_t len); + void ParseVideoStreaming(const uint8* buf, size_t len); +}; + +class UVCCamDeviceAddon : public CamDeviceAddon +{ + public: + UVCCamDeviceAddon(WebCamMediaAddOn* webcam); + virtual ~UVCCamDeviceAddon(); + + virtual UVCCamDevice *Instantiate(CamRoster &roster, BUSBDevice *from); +}; + +#endif /* _UVC_CAM_DEVICE_H */ From bga at bug-br.org.br Sun Feb 22 13:37:27 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Sun, 22 Feb 2009 13:37:27 Subject: [Haiku-commits] =?utf-8?q?r29282_-_in_haiku/trunk/src/add-ons/med?= =?utf-8?q?ia/media-add-ons/usb=5Fwebcam=3A_=2E_addons_addons/uvc?= In-Reply-To: <200902221319.n1MDJENV013283@sheep.berlios.de> Message-ID: <4416182277-BeMail@Gaspode> On Sun, 22 Feb 2009 14:19:14 +0100, colacoder at BerliOS said: > Some initial code for USB Video-based Webcams. It currently parses > the USB Video descriptors and dumps the information out via stdout. I'd be very pleased if anyone with a USB Video webcam (or other device) could take the following steps: > > * hey media_server QUIT > * /system/servers/media_server > /boot/home/media_server.log > * listusb -v > /boot/home/listusb.log > > and mail the two resulting files to ithamar AT unet DOT nl. Thanks! I guess you forgot to mention that the usb_webcam add-on is not installed by default. :) Do you know if the QuickCam Pro 5000 is an UVC camera? -Bruno From korli at mail.berlios.de Sun Feb 22 14:38:58 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 22 Feb 2009 14:38:58 +0100 Subject: [Haiku-commits] r29283 - haiku/trunk/src/kits/tracker Message-ID: <200902221338.n1MDcwWO015512@sheep.berlios.de> Author: korli Date: 2009-02-22 14:38:57 +0100 (Sun, 22 Feb 2009) New Revision: 29283 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29283&view=rev Modified: haiku/trunk/src/kits/tracker/DesktopPoseView.cpp Log: set widget outline to true on DesktopPoseView creation as default. It might not be set by the BackgroundImage code if there is none. Modified: haiku/trunk/src/kits/tracker/DesktopPoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/DesktopPoseView.cpp 2009-02-22 13:19:13 UTC (rev 29282) +++ haiku/trunk/src/kits/tracker/DesktopPoseView.cpp 2009-02-22 13:38:57 UTC (rev 29283) @@ -84,6 +84,7 @@ uint32 resizeMask) : BPoseView(model, frame, viewMode, resizeMask) { + SetWidgetTextOutline(true); } From bga at mail.berlios.de Sun Feb 22 14:45:41 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Sun, 22 Feb 2009 14:45:41 +0100 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 Message-ID: <200902221345.n1MDjfa7017161@sheep.berlios.de> Author: bga Date: 2009-02-22 14:45:40 +0100 (Sun, 22 Feb 2009) New Revision: 29284 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29284&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilter.cpp haiku/trunk/src/apps/mail/MailSupport.cpp haiku/trunk/src/apps/mail/MailWindow.cpp haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 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). Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-02-22 13:38:57 UTC (rev 29283) +++ haiku/trunk/build/jam/HaikuImage 2009-02-22 13:45:40 UTC (rev 29284) @@ -38,8 +38,8 @@ printf profile ps ptx pwd query quit rc readlink release renice rescan rlog rm rmattr rmindex rmdir roster route safemode screen_blanker screenmode sed setdecor settype setversion setvolume - seq sh sha1sum shar shred shuf shutdown sleep sort split stat strace stty su - sum sync sysinfo + seq sh sha1sum shar shred shuf shutdown sleep sort spamdbm split stat strace + stty su sum sync sysinfo tac tail tar tcpdump tcptester tee telnet telnetd test top touch tput tr traceroute translate true tsort tty uname unchop unexpand unmount uniq unrar unshar unzip unzipsfx updatedb Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilter.cpp =================================================================== --- haiku/trunk/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilter.cpp 2009-02-22 13:38:57 UTC (rev 29283) +++ haiku/trunk/src/add-ons/mail_daemon/inbound_filters/spam_filter/SpamFilter.cpp 2009-02-22 13:45:40 UTC (rev 29284) @@ -126,7 +126,7 @@ static const char *kAGMSBayesBeepSpamName = "SpamFilter-Spam"; static const char *kAGMSBayesBeepUncertainName = "SpamFilter-Uncertain"; -static const char *kServerSignature = "application/x-vnd.agmsmith.AGMSBayesianSpamServer"; +static const char *kServerSignature = "application/x-vnd.agmsmith.spamdbm"; AGMSBayesianSpamFilter::AGMSBayesianSpamFilter (BMessage *settings) @@ -237,7 +237,7 @@ directory_which places[] = {B_COMMON_BIN_DIRECTORY,B_BEOS_BIN_DIRECTORY}; for (int32 i = 0; i < 2; i++) { find_directory(places[i],&path); - path.Append("AGMSBayesianSpamServer"); + path.Append("spamdbm"); if (!BEntry(path.Path()).Exists()) continue; get_ref_for_path(path.Path(),&ref); Modified: haiku/trunk/src/apps/mail/MailSupport.cpp =================================================================== --- haiku/trunk/src/apps/mail/MailSupport.cpp 2009-02-22 13:38:57 UTC (rev 29283) +++ haiku/trunk/src/apps/mail/MailSupport.cpp 2009-02-22 13:45:40 UTC (rev 29284) @@ -89,7 +89,7 @@ // int32 level = L_BEGINNER; const char* kSpamServerSignature = - "application/x-vnd.agmsmith.AGMSBayesianSpamServer"; + "application/x-vnd.agmsmith.spamdbm"; const char* kDraftPath = "mail/draft"; const char* kDraftType = "text/x-vnd.Be-MailDraft"; const char* kMailFolder = "mail"; Modified: haiku/trunk/src/apps/mail/MailWindow.cpp =================================================================== --- haiku/trunk/src/apps/mail/MailWindow.cpp 2009-02-22 13:38:57 UTC (rev 29283) +++ haiku/trunk/src/apps/mail/MailWindow.cpp 2009-02-22 13:45:40 UTC (rev 29284) @@ -2591,7 +2591,7 @@ directory_which places[] = {B_COMMON_BIN_DIRECTORY,B_BEOS_BIN_DIRECTORY}; for (int32 i = 0; i < 2; i++) { find_directory(places[i],&path); - path.Append("AGMSBayesianSpamServer"); + path.Append("spamdbm"); if (!BEntry(path.Path()).Exists()) continue; get_ref_for_path(path.Path(),&ref); Modified: haiku/trunk/src/bin/bemail_utils/spamdbm.cpp =================================================================== --- haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-02-22 13:38:57 UTC (rev 29283) +++ haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-02-22 13:45:40 UTC (rev 29284) @@ -544,11 +544,11 @@ */ static float g_MarginBetweenControls; /* Space of a letter "M" between them. */ -//static float g_LineOfTextHeight; /* Height of text the current font. */ +static float g_LineOfTextHeight; /* Height of text the current font. */ static float g_StringViewHeight; /* Height of a string view text box. */ static float g_ButtonHeight; /* How many pixels tall buttons are. */ static float g_CheckBoxHeight; /* Same for check boxes. */ -//static float g_RadioButtonHeight; /* Also for radio buttons. */ +static float g_RadioButtonHeight; /* Also for radio buttons. */ static float g_PopUpMenuHeight; /* Again for pop-up menus. */ static float g_TextBoxHeight; /* Ditto for editable text controls. */ @@ -1689,7 +1689,7 @@ OutputStream << "Buggy Command: " << PropInfoPntr->name << endl; break; } - WrapTextToStream (OutputStream, PropInfoPntr->usage); + WrapTextToStream (OutputStream, (char *)PropInfoPntr->usage); OutputStream << endl; } @@ -4762,8 +4762,6 @@ void ABSApp::ReadyToRun () { - -#if 0 DatabaseWindow *DatabaseWindowPntr; float JunkFloat; BButton *TempButtonPntr; @@ -4914,14 +4912,12 @@ DisplayErrorMessage ("Unable to create window."); g_QuitCountdown = 0; } - else + else { DatabaseWindowPntr->Show (); /* Starts the window's message loop. */ + DatabaseWindowPntr->Minimize (g_ServerMode); + } } -#endif // end all the unnecessary #if 0'ed code - - SetPulseRate (500000); - g_AppReadyToRunCompleted = true; } @@ -7072,14 +7068,6 @@ goto ErrorExit; AddChild (m_WordsViewPntr); - - /* Minimize the window if we are starting up in server mode. This is done - before the window is open so it doesn't flash onto the screen, and possibly - steal a keystroke or two. The ControlsView will further update the minimize - mode when it detects changes in the server mode. */ - - Minimize (g_ServerMode); - return; ErrorExit: From korli at users.berlios.de Sun Feb 22 14:48:35 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Sun, 22 Feb 2009 14:48:35 +0100 Subject: [Haiku-commits] r29277 - haiku/trunk/src/kits/tracker In-Reply-To: <200902212341.n1LNfva7013326@sheep.berlios.de> References: <200902212341.n1LNfva7013326@sheep.berlios.de> Message-ID: 2009/2/22 anevilyak at BerliOS > Revert the PoseView change from r29190. This is incorrect since the outline > setting only applies to the desktop poseviews, and is explicitly set there > by the backgrounds settings code in BackgroundImage.cpp. This fixes the font > rendering artifacts reported in ticket #3467. > My intention was to default to true for the desktop view. Hopefully done correctly in r29283. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From olive at deep-ocean.net Sun Feb 22 14:40:52 2009 From: olive at deep-ocean.net (=?UTF-8?Q?Olivier_Cort=C3=A8s?=) Date: Sun, 22 Feb 2009 14:40:52 +0100 Subject: [Haiku-commits] r29282 - in haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam: . addons addons/uvc In-Reply-To: <4416182277-BeMail@Gaspode> References: <200902221319.n1MDJENV013283@sheep.berlios.de> <4416182277-BeMail@Gaspode> Message-ID: <97fd606d0902220540g738d59c1maac6d2ee3423f758@mail.gmail.com> 2009/2/22 Bruno Albuquerque : > I guess you forgot to mention that the usb_webcam add-on is not > installed by default. :) Do you know if the QuickCam Pro 5000 is an UVC > camera? It is, I've got one and it works with UVC driver under linux. regards, -- Olivier Cort?s http://noyaudolive.net/ From superstippi at gmx.de Sun Feb 22 14:54:08 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sun, 22 Feb 2009 14:54:08 +0100 Subject: [Haiku-commits] r29283 - haiku/trunk/src/kits/tracker In-Reply-To: <200902221338.n1MDcwWO015512@sheep.berlios.de> References: <200902221338.n1MDcwWO015512@sheep.berlios.de> Message-ID: <49A15900.3050408@gmx.de> korli at BerliOS schrieb: > Author: korli > Date: 2009-02-22 14:38:57 +0100 (Sun, 22 Feb 2009) > New Revision: 29283 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29283&view=rev > > Modified: > haiku/trunk/src/kits/tracker/DesktopPoseView.cpp > Log: > set widget outline to true on DesktopPoseView creation as default. It might not be set by the BackgroundImage code if there is none. > > > Modified: haiku/trunk/src/kits/tracker/DesktopPoseView.cpp > =================================================================== > --- haiku/trunk/src/kits/tracker/DesktopPoseView.cpp 2009-02-22 13:19:13 UTC (rev 29282) > +++ haiku/trunk/src/kits/tracker/DesktopPoseView.cpp 2009-02-22 13:38:57 UTC (rev 29283) > @@ -84,6 +84,7 @@ > uint32 resizeMask) > : BPoseView(model, frame, viewMode, resizeMask) > { > + SetWidgetTextOutline(true); > } I still don't really understand this change. I thought the important thing is that both Tracker and Backgrounds are in line with regards to defaults, and isn't the text outline off by default? That being said, I have a patch comming that greatly improves the visuals on the outline mode... hopefully in a couple of days. Best regards, -Stephan From superstippi at gmx.de Sun Feb 22 14:56:36 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sun, 22 Feb 2009 14:56:36 +0100 Subject: [Haiku-commits] r29277 - haiku/trunk/src/kits/tracker In-Reply-To: References: <200902212341.n1LNfva7013326@sheep.berlios.de> Message-ID: <49A15994.5070104@gmx.de> J?r?me Duval schrieb: > 2009/2/22 anevilyak at BerliOS > > > Revert the PoseView change from r29190. This is incorrect since the > outline setting only applies to the desktop poseviews, and is > explicitly set there by the backgrounds settings code in > BackgroundImage.cpp. This fixes the font rendering artifacts > reported in ticket #3467. > > > My intention was to default to true for the desktop view. Hopefully done > correctly in r29283. Ah! So you wanted to change the default. With the current trunk version of the outline rendering, I am not so sure, but I have a (hopefully much) better look coming soon. Best regards, -Stephan From superstippi at gmx.de Sun Feb 22 15:01:19 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sun, 22 Feb 2009 15:01:19 +0100 Subject: [Haiku-commits] r29282 - in haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam: . addons addons/uvc In-Reply-To: <200902221319.n1MDJENV013283@sheep.berlios.de> References: <200902221319.n1MDJENV013283@sheep.berlios.de> Message-ID: <49A15AAF.5090908@gmx.de> colacoder at BerliOS schrieb: > Author: colacoder > Date: 2009-02-22 14:19:13 +0100 (Sun, 22 Feb 2009) > New Revision: 29282 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29282&view=rev > > Added: > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/ > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/USB_video.h > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.cpp > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/addons/uvc/UVCCamDevice.h > Modified: > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile > Log: > Some initial code for USB Video-based Webcams. It currently parses the USB Video descriptors and dumps the information out via stdout. I'd be very pleased if anyone with a USB Video webcam (or other device) could take the following steps: > > * hey media_server QUIT > * /system/servers/media_server > /boot/home/media_server.log > * listusb -v > /boot/home/listusb.log Awesome news! A Logitec QuickCam Pro 9000 is among my proud collection, which is a UVC device! :-D Best regards, -Stephan From bga at mail.berlios.de Sun Feb 22 15:31:04 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Sun, 22 Feb 2009 15:31:04 +0100 Subject: [Haiku-commits] r29285 - haiku/trunk/src/apps/mail Message-ID: <200902221431.n1MEV4AK021843@sheep.berlios.de> Author: bga Date: 2009-02-22 15:31:03 +0100 (Sun, 22 Feb 2009) New Revision: 29285 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29285&view=rev Modified: haiku/trunk/src/apps/mail/Header.cpp Log: - Fix displaying of the From: popup menu when composing a new message. This actually show a bug in BPopUpMenu. It seesm to think that its size includes the arrow at its right size and so it draws the menu item string over it. Stippi? Modified: haiku/trunk/src/apps/mail/Header.cpp =================================================================== --- haiku/trunk/src/apps/mail/Header.cpp 2009-02-22 13:45:40 UTC (rev 29284) +++ haiku/trunk/src/apps/mail/Header.cpp 2009-02-22 14:31:03 UTC (rev 29285) @@ -301,6 +301,8 @@ B_WILL_DRAW | B_NAVIGABLE | B_NAVIGABLE_JUMP); encodingField->SetDivider(encodingField->StringWidth(ENCODING_TEXT) + 5); AddChild(encodingField); + + field = encodingField; // And now the "from account" pop-up menu, on the left side, taking the // remaining space. @@ -349,6 +351,7 @@ } r.Set(SEPARATOR_MARGIN, y - 2, field->Frame().left - SEPARATOR_MARGIN, y + menuFieldHeight); + r.PrintToStream(); field = new BMenuField(r, "account", FROM_TEXT, fAccountMenu, true /* fixedSize */, B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT, From bga at mail.berlios.de Sun Feb 22 15:31:45 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Sun, 22 Feb 2009 15:31:45 +0100 Subject: [Haiku-commits] r29286 - haiku/trunk/src/apps/mail Message-ID: <200902221431.n1MEVjTo021989@sheep.berlios.de> Author: bga Date: 2009-02-22 15:31:45 +0100 (Sun, 22 Feb 2009) New Revision: 29286 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29286&view=rev Modified: haiku/trunk/src/apps/mail/Header.cpp Log: - Removed debug output. Modified: haiku/trunk/src/apps/mail/Header.cpp =================================================================== --- haiku/trunk/src/apps/mail/Header.cpp 2009-02-22 14:31:03 UTC (rev 29285) +++ haiku/trunk/src/apps/mail/Header.cpp 2009-02-22 14:31:45 UTC (rev 29286) @@ -351,7 +351,6 @@ } r.Set(SEPARATOR_MARGIN, y - 2, field->Frame().left - SEPARATOR_MARGIN, y + menuFieldHeight); - r.PrintToStream(); field = new BMenuField(r, "account", FROM_TEXT, fAccountMenu, true /* fixedSize */, B_FOLLOW_TOP | B_FOLLOW_LEFT_RIGHT, From korli at users.berlios.de Sun Feb 22 16:04:01 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Sun, 22 Feb 2009 16:04:01 +0100 Subject: [Haiku-commits] r29283 - haiku/trunk/src/kits/tracker In-Reply-To: <49A15900.3050408@gmx.de> References: <200902221338.n1MDcwWO015512@sheep.berlios.de> <49A15900.3050408@gmx.de> Message-ID: 2009/2/22 Stephan A?mus > I still don't really understand this change. I thought the important > thing is that both Tracker and Backgrounds are in line with regards to > defaults, and isn't the text outline off by default? > > The default is on, as you committed in r22040. It's in sync with Backgrounds. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From korli at mail.berlios.de Sun Feb 22 16:26:17 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 22 Feb 2009 16:26:17 +0100 Subject: [Haiku-commits] r29287 - haiku/trunk/src/bin/bemail_utils Message-ID: <200902221526.n1MFQHPH028245@sheep.berlios.de> Author: korli Date: 2009-02-22 16:26:17 +0100 (Sun, 22 Feb 2009) New Revision: 29287 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29287&view=rev Modified: haiku/trunk/src/bin/bemail_utils/Jamfile Log: fix linking with stdc++ Modified: haiku/trunk/src/bin/bemail_utils/Jamfile =================================================================== --- haiku/trunk/src/bin/bemail_utils/Jamfile 2009-02-22 14:31:45 UTC (rev 29286) +++ haiku/trunk/src/bin/bemail_utils/Jamfile 2009-02-22 15:26:17 UTC (rev 29287) @@ -28,7 +28,7 @@ StdBinCommands spamdbm.cpp - : be tracker stdc++.r4 libmail.so + : be tracker $(TARGET_LIBSTDC++) libmail.so : spamdbm.rdef ; Package haiku-maildaemon-cvs : From mmu_man at mail.berlios.de Sun Feb 22 16:27:40 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 22 Feb 2009 16:27:40 +0100 Subject: [Haiku-commits] r29288 - haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam Message-ID: <200902221527.n1MFReSj028545@sheep.berlios.de> Author: mmu_man Date: 2009-02-22 16:27:39 +0100 (Sun, 22 Feb 2009) New Revision: 29288 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29288&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp Log: Fix ZETA build, USBKit doesn't have the AltInterface stuff. Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2009-02-22 15:26:17 UTC (rev 29287) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/CamDevice.cpp 2009-02-22 15:27:39 UTC (rev 29288) @@ -640,6 +640,7 @@ supported = true; } +#ifdef __HAIKU__ // we have to check all interfaces for matching class/subclass/protocol for (uint32 j = 0; !supported && j < device->CountConfigurations(); j++) { const BUSBConfiguration* cfg = device->ConfigurationAt(j); @@ -658,6 +659,7 @@ } } } +#endif if (supported) return i; From superstippi at gmx.de Sun Feb 22 16:29:09 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sun, 22 Feb 2009 16:29:09 +0100 Subject: [Haiku-commits] r29283 - haiku/trunk/src/kits/tracker In-Reply-To: References: <200902221338.n1MDcwWO015512@sheep.berlios.de> <49A15900.3050408@gmx.de> Message-ID: <49A16F45.60507@gmx.de> J?r?me Duval schrieb: > 2009/2/22 Stephan A?mus > > > I still don't really understand this change. I thought the important > thing is that both Tracker and Backgrounds are in line with regards to > defaults, and isn't the text outline off by default? > > > The default is on, as you committed in r22040. It's in sync with > Backgrounds. Hm. That was not intended, and in some places, I changed it to "false" indeed, especially the default background setting (it seems). This patch seems pretty broken to me anyways, now that I read it again... I should look over that when I have time. It appears that I repurposed something which I didn't understand the meaning of in the first place. :-) Best regards, -Stephan From mmu_man at mail.berlios.de Sun Feb 22 17:05:02 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 22 Feb 2009 17:05:02 +0100 Subject: [Haiku-commits] r29289 - haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam Message-ID: <200902221605.n1MG52IU000682@sheep.berlios.de> Author: mmu_man Date: 2009-02-22 17:05:02 +0100 (Sun, 22 Feb 2009) New Revision: 29289 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29289&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/ Log: Ignore generated files. Property changes on: haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam ___________________________________________________________________ Name: svn:ignore + obj.x86 dep CamInternalColorSpaceTransforms.h CamInternalSensors.h CamInternalAddons.h From humdingerb at googlemail.com Sun Feb 22 17:26:09 2009 From: humdingerb at googlemail.com (Humdinger) Date: Sun, 22 Feb 2009 17:26:09 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: References: <200902211550.n1LFod66030168@sheep.berlios.de> <49A03C2D.5070000@pinc-software.de> <49A04B72.1090503@googlemail.com> <1e80d8750902211415o3ced843vae09781e33e03fa6@mail.gmail.com> <49A0F843.9000105@googlemail.com> <1e80d8750902220008l2d0a0ecbh161cb45c30eac404@mail.gmail.com> <49A127C1.4020500@googlemail.com> Message-ID: <49A17CA1.8030201@googlemail.com> David McPaul wrote: >> Ah. How do you do that? My haiku.vmx just says 'sound.present = "TRUE"'. > > sound.virtualDev = "es1371" Oh, cool. Now I have at least an audio device listed in Haiku at vmware, though I only get crackling when playing an audio file. But, it's a start. Thanks! >> Maybe we should update http://haiku-files.org/files/haiku.vmx and >> haiku/3rdparty/vmware/haiku.vmx accordingly. Now, should update the .vmx? Makes sense IMO. > You can also turn on usb devices with > > usb.present = "TRUE" Knew that one. > I also have a second disk that I put things on that I want to keep > when I recreate the haiku image. > > ide0:1.present = "TRUE" > ide0:1.fileName = "spare.vmdk" > ide0:1.deviceType = "disk" > ide0:1.mode = "persistent" > ide0:1.redo = "" > ide0:1.writeThrough = "FALSE" > ide0:1.startConnected = "FALSE" Have that one too for a long time. While we're on vmx config, is there a way to have a native resolution (1658x1050) in vmware? Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From korli at mail.berlios.de Sun Feb 22 19:26:20 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 22 Feb 2009 19:26:20 +0100 Subject: [Haiku-commits] r29290 - in haiku/trunk/src/bin: . bemail_utils chkbfs Message-ID: <200902221826.n1MIQKl1011573@sheep.berlios.de> Author: korli Date: 2009-02-22 19:26:19 +0100 (Sun, 22 Feb 2009) New Revision: 29290 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29290&view=rev Modified: haiku/trunk/src/bin/bemail_utils/spamdbm.cpp haiku/trunk/src/bin/chkbfs/chkbfs.cpp haiku/trunk/src/bin/dpms.cpp haiku/trunk/src/bin/modifiers.cpp Log: * fix gcc4 build * some style cleanup Modified: haiku/trunk/src/bin/bemail_utils/spamdbm.cpp =================================================================== --- haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-02-22 16:05:02 UTC (rev 29289) +++ haiku/trunk/src/bin/bemail_utils/spamdbm.cpp 2009-02-22 18:26:19 UTC (rev 29290) @@ -494,6 +494,8 @@ #include #include +using namespace std; + /* BeOS (Be Operating System) headers. */ #include @@ -1184,6 +1186,11 @@ }; +/* Various message codes for various buttons etc. */ +static const uint32 MSG_LINE_DOWN = 'LnDn'; +static const uint32 MSG_LINE_UP = 'LnUp'; +static const uint32 MSG_PAGE_DOWN = 'PgDn'; +static const uint32 MSG_PAGE_UP = 'PgUp'; /****************************************************************************** * This view contains the list of words. It displays as many as can fit in the @@ -1207,12 +1214,6 @@ virtual void Pulse (); private: - /* Various message codes for various buttons etc. */ - static const uint32 MSG_LINE_DOWN = 'LnDn'; - static const uint32 MSG_LINE_UP = 'LnUp'; - static const uint32 MSG_PAGE_DOWN = 'PgDn'; - static const uint32 MSG_PAGE_UP = 'PgUp'; - /* Our member functions. */ void MoveTextUpOrDown (uint32 MovementType); void RefsDroppedHere (BMessage *MessagePntr); @@ -1524,7 +1525,7 @@ * result on the given output stream. */ -static void WrapTextToStream (ostream& OutputStream, char *TextPntr) +static void WrapTextToStream (ostream& OutputStream, const char *TextPntr) { const int LineLength = 79; char *StringPntr; Modified: haiku/trunk/src/bin/chkbfs/chkbfs.cpp =================================================================== --- haiku/trunk/src/bin/chkbfs/chkbfs.cpp 2009-02-22 16:05:02 UTC (rev 29289) +++ haiku/trunk/src/bin/chkbfs/chkbfs.cpp 2009-02-22 18:26:19 UTC (rev 29290) @@ -1,3 +1,4 @@ +#include #include "bfs_control.h" #include Modified: haiku/trunk/src/bin/dpms.cpp =================================================================== --- haiku/trunk/src/bin/dpms.cpp 2009-02-22 16:05:02 UTC (rev 29289) +++ haiku/trunk/src/bin/dpms.cpp 2009-02-22 18:26:19 UTC (rev 29290) @@ -4,6 +4,7 @@ */ #include +#include #include #include #include Modified: haiku/trunk/src/bin/modifiers.cpp =================================================================== --- haiku/trunk/src/bin/modifiers.cpp 2009-02-22 16:05:02 UTC (rev 29289) +++ haiku/trunk/src/bin/modifiers.cpp 2009-02-22 18:26:19 UTC (rev 29290) @@ -11,29 +11,33 @@ #include #include + int32 modifier_bits[] = { -B_SHIFT_KEY, -B_COMMAND_KEY, -B_CONTROL_KEY, -B_CAPS_LOCK, -B_SCROLL_LOCK, -B_NUM_LOCK, -B_OPTION_KEY, -B_MENU_KEY, -B_LEFT_SHIFT_KEY, -B_RIGHT_SHIFT_KEY, -B_LEFT_COMMAND_KEY, -B_RIGHT_COMMAND_KEY, -B_LEFT_CONTROL_KEY, -B_RIGHT_CONTROL_KEY, -B_LEFT_OPTION_KEY, -B_RIGHT_OPTION_KEY, -0 + B_SHIFT_KEY, + B_COMMAND_KEY, + B_CONTROL_KEY, + B_CAPS_LOCK, + B_SCROLL_LOCK, + B_NUM_LOCK, + B_OPTION_KEY, + B_MENU_KEY, + B_LEFT_SHIFT_KEY, + B_RIGHT_SHIFT_KEY, + B_LEFT_COMMAND_KEY, + B_RIGHT_COMMAND_KEY, + B_LEFT_CONTROL_KEY, + B_RIGHT_CONTROL_KEY, + B_LEFT_OPTION_KEY, + B_RIGHT_OPTION_KEY, + 0 }; + const char *modifier_names[] = { "shift", "command", "control", "capslock", "scrolllock", "numlock", "option", "menu", "lshift", "rshift", "lcommand", "rcommand", "lcontrol", "rcontrol", "loption", "roption", NULL }; -int usage(char *progname, int error) + +int +usage(char *progname, int error) { FILE *outstr; outstr = error?stderr:stdout; @@ -43,7 +47,9 @@ return error; } -int list_modifiers(int mods) + +int +list_modifiers(int mods) { int i; int gotone = 0; @@ -61,7 +67,9 @@ return 0; } -int main(int argc, char **argv) + +int +main(int argc, char **argv) { int32 mods; int32 mask_xor = 0x0; @@ -69,7 +77,6 @@ int i, j; mods = modifiers(); -// printf("mods = 0x%08lx\n", mods); if (argc == 1) return usage(argv[0], 1); for (i=1; i Author: mmlr Date: 2009-02-22 21:46:27 +0100 (Sun, 22 Feb 2009) New Revision: 29291 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29291&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/headers/private/kernel/debug.h haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h haiku/trunk/src/add-ons/kernel/debugger/Jamfile haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp haiku/trunk/src/system/kernel/debug/blue_screen.cpp haiku/trunk/src/system/kernel/debug/debug.cpp Log: * Added simplified possibility to schedule UHCI transfers from within KDL. * Added debugger commands to resolve usb_ids to pipes. * Adjusted the physical memory allocator to be usable in a slimmed down mode when running inside the kernel debugger. * Implemented USB keyboard support for KDL through a kernel debugger add-on. * Added kgetc() and made use of it where previously individual methods were used to ensure that reading characters always goes through the kernel debugger add-ons and the other methods. This has some preconditions to meet though: 1) The keyboard must be in the boot protocol (currently the case but needs to be revisited once we have a full usb_hid). 2) The keyboard must be attached to a UHCI root port (i.e. not use EHCI or OHCI, also not through hubs unless those are USB 1.1). 3) the usb_hid driver has to be opened for this to work. This means that for the time between initializing USB and when usb_hid is opened by the input_server there is no keyboard support. Also note that this has no way of detecting hot-plug, meaning that you can't re-attach your USB keyboard from the hub to the root port once in KDL. On the bright side of things, since this is a non-destructive mechanism it is possible to enter and leave KDL without loosing the USB state. Tested OK in QEMU, not tested on real hardware yet, will see in a few minutes. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/build/jam/HaikuImage 2009-02-22 20:46:27 UTC (rev 29291) @@ -156,7 +156,8 @@ : uhci ohci ehci ; AddFilesToHaikuImage beos system add-ons kernel console : vga_text ; AddFilesToHaikuImage beos system add-ons kernel debugger - : $(X86_ONLY)disasm hangman invalidate_on_exit ; + : $(X86_ONLY)disasm hangman invalidate_on_exit + usb_keyboard ; AddFilesToHaikuImage beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; AddFilesToHaikuImage beos system add-ons kernel generic Modified: haiku/trunk/headers/private/kernel/debug.h =================================================================== --- haiku/trunk/headers/private/kernel/debug.h 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/headers/private/kernel/debug.h 2009-02-22 20:46:27 UTC (rev 29291) @@ -115,6 +115,7 @@ extern debug_page_fault_info* debug_get_page_fault_info(); extern void debug_trap_cpu_in_kdl(bool returnIfHandedOver); +extern char kgetc(void); extern void kputs(const char *string); extern void kputs_unfiltered(const char *string); extern void kprintf_unfiltered(const char *format, ...) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp 2009-02-22 20:46:27 UTC (rev 29291) @@ -66,6 +66,12 @@ fManagedMemory = fBlockSize[0] * fArrayLength[0]; size_t roundedSize = biggestSize * minCountPerBlock; +#if KDEBUG + fDebugBase = roundedSize; + fDebugChunkSize = 64; + fDebugUseMap = 0; + roundedSize += sizeof(fDebugUseMap) * 8 * fDebugChunkSize; +#endif roundedSize = (roundedSize + B_PAGE_SIZE - 1) & ~(B_PAGE_SIZE - 1); fArea = create_area(fName, &fLogicalBase, B_ANY_KERNEL_ADDRESS, @@ -122,6 +128,24 @@ PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress, void **physicalAddress) { +#if KDEBUG + if (debug_debugger_running()) { + for (int32 i = 0; i < 64; i++) { + uint64 mask = 1LL << i; + if ((fDebugUseMap & mask) == 0) { + fDebugUseMap |= mask; + *logicalAddress = (void *)((uint8 *)fLogicalBase + fDebugBase + + i * fDebugChunkSize); + *physicalAddress = (void *)((uint8 *)fPhysicalBase + fDebugBase + + i * fDebugChunkSize); + return B_OK; + } + } + + return B_NO_MEMORY; + } +#endif + if (size == 0 || size > fBlockSize[fArrayCount - 1]) { TRACE_ERROR(("PMA: bad value for allocate (%ld bytes)\n", size)); return B_BAD_VALUE; @@ -198,6 +222,15 @@ PhysicalMemoryAllocator::Deallocate(size_t size, void *logicalAddress, void *physicalAddress) { +#if KDEBUG + if (debug_debugger_running()) { + uint32 index = ((uint8 *)logicalAddress - (uint8 *)fLogicalBase + - fDebugBase) / fDebugChunkSize; + fDebugUseMap &= ~(1LL << index); + return B_OK; + } +#endif + if (size == 0 || size > fBlockSize[fArrayCount - 1]) { TRACE_ERROR(("PMA: bad value for deallocate (%ld bytes)\n", size)); return B_BAD_VALUE; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h 2009-02-22 20:46:27 UTC (rev 29291) @@ -57,6 +57,12 @@ size_t *fArrayLength; size_t *fArrayOffset; uint8 **fArray; + +#if KDEBUG + uint32 fDebugBase; + uint32 fDebugChunkSize; + uint64 fDebugUseMap; +#endif }; #endif // !_PHYSICAL_MEMORY_ALLOCATOR_H_ Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp 2009-02-22 20:46:27 UTC (rev 29291) @@ -206,6 +206,15 @@ } +Object * +Stack::GetObjectNoLock(usb_id id) +{ + if (id >= fObjectMaxCount) + return NULL; + return fObjectArray[id]; +} + + int32 Stack::ExploreThread(void *data) { Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp 2009-02-22 20:46:27 UTC (rev 29291) @@ -16,6 +16,25 @@ Stack *gUSBStack = NULL; +static int +debug_get_pipe_for_id(int argc, char **argv) +{ + if (gUSBStack == NULL) + return 1; + + if (!is_debug_variable_defined("_usbPipeID")) + return 2; + + uint64 id = get_debug_variable("_usbPipeID", 0); + Object *object = gUSBStack->GetObjectNoLock((usb_id)id); + if (!object || (object->Type() & USB_OBJECT_PIPE) == 0) + return 3; + + set_debug_variable("_usbPipe", (uint64)object); + return 0; +} + + static int32 bus_std_ops(int32 op, ...) { @@ -58,6 +77,9 @@ } gUSBStack = stack; + add_debugger_command("get_usb_pipe_for_id", + &debug_get_pipe_for_id, + "Gets the config for a USB pipe"); #ifndef __HAIKU__ // Plain R5 workaround, see comment above. shared = create_area("shared usb stack", &address, @@ -73,6 +95,8 @@ TRACE_MODULE("uninit\n"); delete gUSBStack; gUSBStack = NULL; + remove_debugger_command("get_usb_pipe_for_id", + &debug_get_pipe_for_id); break; default: Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2009-02-22 20:46:27 UTC (rev 29291) @@ -126,6 +126,9 @@ void PutUSBID(usb_id id); Object * GetObject(usb_id id); + // only for the kernel debugger + Object * GetObjectNoLock(usb_id id); + void AddBusManager(BusManager *bus); int32 IndexOfBusManager(BusManager *bus); BusManager * BusManagerAt(int32 index); Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2009-02-22 20:46:27 UTC (rev 29291) @@ -19,7 +19,34 @@ pci_module_info *UHCI::sPCIModule = NULL; +static int32 sDebuggerCommandAdded = 0; + +static int +debug_process_transfer(int argc, char **argv) +{ + Pipe *pipe = (Pipe *)get_debug_variable("_usbPipe", 0); + if (pipe == NULL) + return 2; + + // check if we have a UHCI bus at all + if (pipe->GetBusManager()->TypeName()[0] != 'u') + return 3; + + uint8 *data = (uint8 *)get_debug_variable("_usbTransferData", 0); + if (data == NULL) + return 4; + + size_t length = (size_t)get_debug_variable("_usbTransferLength", 0); + if (length == 0) + return 5; + + Transfer transfer(pipe); + transfer.SetData(data, length); + return ((UHCI *)pipe->GetBusManager())->ProcessDebugTransfer(&transfer); +} + + static int32 uhci_std_ops(int32 op, ...) { @@ -197,9 +224,9 @@ status_t -Queue::AppendTransfer(uhci_qh *transfer) +Queue::AppendTransfer(uhci_qh *transfer, bool lock) { - if (!Lock()) + if (lock && !Lock()) return B_ERROR; transfer->link_log = NULL; @@ -219,15 +246,16 @@ element->link_phy = transfer->this_phy | QH_NEXT_IS_QH; } - Unlock(); + if (lock) + Unlock(); return B_OK; } status_t -Queue::RemoveTransfer(uhci_qh *transfer) +Queue::RemoveTransfer(uhci_qh *transfer, bool lock) { - if (!Lock()) + if (lock && !Lock()) return B_ERROR; if (fQueueTop == transfer) { @@ -241,7 +269,8 @@ fQueueHead->element_phy = transfer->link_phy; } - Unlock(); + if (lock) + Unlock(); return B_OK; } else { uhci_qh *element = fQueueTop; @@ -249,7 +278,8 @@ if (element->link_log == transfer) { element->link_log = transfer->link_log; element->link_phy = transfer->link_phy; - Unlock(); + if (lock) + Unlock(); return B_OK; } @@ -257,7 +287,8 @@ } } - Unlock(); + if (lock) + Unlock(); return B_BAD_VALUE; } @@ -374,8 +405,9 @@ // 1: low speed control transfers // 2: full speed control transfers // 3: bulk transfers + // 4: debug queue // TODO: 4: bandwidth reclamation queue - fQueueCount = 4; + fQueueCount = 5; fQueues = new(std::nothrow) Queue *[fQueueCount]; if (!fQueues) { delete_area(fFrameArea); @@ -462,6 +494,12 @@ WriteReg16(UHCI_USBINTR, UHCI_USBINTR_CRC | UHCI_USBINTR_IOC | UHCI_USBINTR_SHORT); + if (atomic_add(&sDebuggerCommandAdded, 1) == 0) { + add_debugger_command("uhci_process_transfer", + &debug_process_transfer, + "Processes a USB transfer with the given variables"); + } + TRACE("UHCI host controller driver constructed\n"); fInitOK = true; } @@ -469,6 +507,11 @@ UHCI::~UHCI() { + if (atomic_add(&sDebuggerCommandAdded, -1) == 1) { + remove_debugger_command("uhci_process_transfer", + &debug_process_transfer); + } + int32 result = 0; fStopFinishThread = true; fStopFinishIsochronousThread = true; @@ -608,6 +651,77 @@ status_t +UHCI::ProcessDebugTransfer(Transfer *transfer) +{ + uhci_td *firstDescriptor = NULL; + uhci_qh *transferQueue = NULL; + status_t result = CreateFilledTransfer(transfer, &firstDescriptor, + &transferQueue); + if (result < B_OK) + return result; + + fQueues[UHCI_DEBUG_QUEUE]->AppendTransfer(transferQueue, false); + + while (true) { + bool transferOK = false; + bool transferError = false; + uhci_td *descriptor = firstDescriptor; + + while (descriptor) { + uint32 status = descriptor->status; + if (status & TD_STATUS_ACTIVE) + break; + + if (status & TD_ERROR_MASK) { + transferError = true; + break; + } + + if ((descriptor->link_phy & TD_TERMINATE) + || (descriptor->status & TD_STATUS_ACTLEN_MASK) + < (descriptor->token >> TD_TOKEN_MAXLEN_SHIFT)) { + transferOK = true; + break; + } + + descriptor = (uhci_td *)descriptor->link_log; + } + + if (!transferOK && !transferError) { + spin(200); + continue; + } + + if (transferOK) { + size_t actualLength = 0; + uint8 lastDataToggle = 0; + if (transfer->TransferPipe()->Direction() == Pipe::In) { + // data to read out + iovec *vector = transfer->Vector(); + size_t vectorCount = transfer->VectorCount(); + + actualLength = ReadDescriptorChain(firstDescriptor, + vector, vectorCount, &lastDataToggle); + } else { + // read the actual length that was sent + actualLength = ReadActualLength(firstDescriptor, + &lastDataToggle); + } + + transfer->TransferPipe()->SetDataToggle(lastDataToggle == 0); + } + + fQueues[UHCI_DEBUG_QUEUE]->RemoveTransfer(transferQueue, false); + FreeDescriptorChain(firstDescriptor); + FreeTransferQueue(transferQueue); + return transferOK ? B_OK : B_IO_ERROR; + } + + return B_ERROR; +} + + +status_t UHCI::CancelQueuedTransfers(Pipe *pipe, bool force) { if (pipe->Type() & USB_OBJECT_ISO_PIPE) Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h 2009-02-22 20:46:27 UTC (rev 29291) @@ -20,6 +20,7 @@ #define UHCI_FULL_SPEED_CONTROL_QUEUE 2 #define UHCI_BULK_QUEUE 3 #define UHCI_BANDWIDTH_RECLAMATION_QUEUE 4 +#define UHCI_DEBUG_QUEUE 4 struct pci_info; struct pci_module_info; @@ -39,8 +40,10 @@ status_t LinkTo(Queue *other); status_t TerminateByStrayDescriptor(); - status_t AppendTransfer(uhci_qh *transfer); - status_t RemoveTransfer(uhci_qh *transfer); + status_t AppendTransfer(uhci_qh *transfer, + bool lock = true); + status_t RemoveTransfer(uhci_qh *transfer, + bool lock = true); addr_t PhysicalAddress(); @@ -94,6 +97,7 @@ status_t Start(); virtual status_t SubmitTransfer(Transfer *transfer); + status_t ProcessDebugTransfer(Transfer *transfer); virtual status_t CancelQueuedTransfers(Pipe *pipe, bool force); status_t CancelQueuedIsochronousTransfers(Pipe *pipe, bool force); status_t SubmitRequest(Transfer *transfer); Modified: haiku/trunk/src/add-ons/kernel/debugger/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/debugger/Jamfile 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/debugger/Jamfile 2009-02-22 20:46:27 UTC (rev 29291) @@ -7,3 +7,4 @@ SubInclude HAIKU_TOP src add-ons kernel debugger hangman ; SubInclude HAIKU_TOP src add-ons kernel debugger invalidate_on_exit ; SubInclude HAIKU_TOP src add-ons kernel debugger laplinkll ; +SubInclude HAIKU_TOP src add-ons kernel debugger usb_keyboard ; Modified: haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp 2009-02-22 20:46:27 UTC (rev 29291) @@ -10,11 +10,26 @@ #include "KeyboardDevice.h" #include #include +#include // input server private for raw_key_info, KB_READ, etc... #include "kb_mouse_driver.h" +static usb_id sDebugKeyboardPipe = 0; +static size_t sDebugKeyboardReportSize = 0; +static int32 sDebuggerCommandAdded = 0; + + +static int +debug_get_keyboard_config(int argc, char **argv) +{ + set_debug_variable("_usbPipeID", (uint64)sDebugKeyboardPipe); + set_debug_variable("_usbReportSize", (uint64)sDebugKeyboardReportSize); + return 0; +} + + KeyboardDevice::KeyboardDevice(usb_device device, usb_pipe interruptPipe, size_t interfaceIndex, report_insn *instructions, size_t instructionCount, size_t totalReportSize) @@ -34,12 +49,23 @@ } SetBaseName("input/keyboard/usb/"); + + if (atomic_add(&sDebuggerCommandAdded, 1) == 0) { + add_debugger_command("get_usb_keyboard_config", + &debug_get_keyboard_config, + "Gets the required config of the USB keyboard"); + } } KeyboardDevice::~KeyboardDevice() { free(fLastTransferBuffer); + + if (atomic_add(&sDebuggerCommandAdded, -1) == 1) { + remove_debugger_command("get_usb_keyboard_config", + &debug_get_keyboard_config); + } } @@ -410,9 +436,13 @@ key = KEY_Break; else if (key == 0xe && (current[0] & 1)) key = KEY_SysRq; -#if 0 - else if (keyDown && key == 0x0d) // ToDo: remove again +#if 1 + else if (keyDown && key == 0x0d) { + // ToDo: remove again + sDebugKeyboardPipe = fInterruptPipe; + sDebugKeyboardReportSize = fTotalReportSize; panic("keyboard requested halt.\n"); + } #endif else if (key == 0) { // unmapped key Modified: haiku/trunk/src/system/kernel/debug/blue_screen.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/blue_screen.cpp 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/system/kernel/debug/blue_screen.cpp 2009-02-22 20:46:27 UTC (rev 29291) @@ -9,6 +9,7 @@ #include #include #include +#include #include #include @@ -139,7 +140,7 @@ text[i], sScreen.boot_debug_output ? 0x6f : 0xf6); } - char c = blue_screen_getchar(); + char c = kgetc(); if (c == 's') { sScreen.ignore_output = true; } else if (c == 'q' && in_command_invocation()) { Modified: haiku/trunk/src/system/kernel/debug/debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/debug.cpp 2009-02-22 18:26:19 UTC (rev 29290) +++ haiku/trunk/src/system/kernel/debug/debug.cpp 2009-02-22 20:46:27 UTC (rev 29291) @@ -408,28 +408,9 @@ bool done = false; char c = 0; - char (*readChar)(void); - if (sBlueScreenOutput) - readChar = blue_screen_getchar; - else - readChar = arch_debug_serial_getchar; - while (!done) { - bool hasChar = false; - for (uint32 i = 0; i < kMaxDebuggerModules; i++) { - if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_getchar) { - int getChar = sDebuggerModules[i]->debugger_getchar(); - if (getChar >= 0) { - hasChar = true; - c = (char)getChar; - break; - } - } - } + c = kgetc(); - if (!hasChar) - c = readChar(); - switch (c) { case '\n': case '\r': @@ -487,12 +468,12 @@ } break; case 27: // escape sequence - c = readChar(); + c = kgetc(); if (c != '[') { // ignore broken escape sequence break; } - c = readChar(); + c = kgetc(); switch (c) { case 'C': // right arrow if (position < length) { @@ -548,7 +529,7 @@ case '5': // if "5~", it's PAGE UP case '6': // if "6~", it's PAGE DOWN { - if (readChar() != '~') + if (kgetc() != '~') break; // PAGE UP: search backward, PAGE DOWN: forward @@ -603,7 +584,7 @@ } case '3': // if "3~", it's DEL { - if (readChar() != '~') + if (kgetc() != '~') break; if (position < length) @@ -649,6 +630,25 @@ } +char +kgetc(void) +{ + // give the kernel debugger modules a chance first + for (uint32 i = 0; i < kMaxDebuggerModules; i++) { + if (sDebuggerModules[i] && sDebuggerModules[i]->debugger_getchar) { + int getChar = sDebuggerModules[i]->debugger_getchar(); + if (getChar >= 0) + return (char)getChar; + } + } + + if (sBlueScreenOutput) + return blue_screen_getchar(); + + return arch_debug_serial_getchar(); +} + + int kgets(char* buffer, int length) { From mmlr at mail.berlios.de Sun Feb 22 21:47:16 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sun, 22 Feb 2009 21:47:16 +0100 Subject: [Haiku-commits] r29292 - in haiku/trunk/src/add-ons/kernel/debugger: . usb_keyboard Message-ID: <200902222047.n1MKlGqw013989@sheep.berlios.de> Author: mmlr Date: 2009-02-22 21:47:14 +0100 (Sun, 22 Feb 2009) New Revision: 29292 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29292&view=rev Added: haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/ haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/Jamfile haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp Log: Obviously forgot this in the last commit... Added: haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/Jamfile 2009-02-22 20:46:27 UTC (rev 29291) +++ haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/Jamfile 2009-02-22 20:47:14 UTC (rev 29292) @@ -0,0 +1,7 @@ +SubDir HAIKU_TOP src add-ons kernel debugger usb_keyboard ; + +UsePrivateHeaders kernel ; + +KernelAddon usb_keyboard : + usb_keyboard.cpp + ; Added: haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp 2009-02-22 20:46:27 UTC (rev 29291) +++ haiku/trunk/src/add-ons/kernel/debugger/usb_keyboard/usb_keyboard.cpp 2009-02-22 20:47:14 UTC (rev 29292) @@ -0,0 +1,300 @@ +/* + * Copyright 2009, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Lotz + */ + +#include +#include + +static bool sUseUSBKeyboard = false; +static uint8 sUSBTransferData[64]; +static uint8 sLastTransferData[64]; +static size_t sUSBTransferLength = 0; +static void *sUSBPipe = NULL; + +// simple ring buffer +static int sBufferedChars[32]; +static uint8 sBufferSize = sizeof(sBufferedChars) / sizeof(sBufferedChars[0]); +static uint8 sBufferedCharCount = 0; +static uint8 sBufferWriteIndex = 0; +static uint8 sBufferReadIndex = 0; + +#define MODIFIER_CONTROL 0x01 +#define MODIFIER_SHIFT 0x02 +#define MODIFIER_ALT 0x04 + +static uint32 sModifierTable[] = { + MODIFIER_CONTROL, + MODIFIER_SHIFT, + MODIFIER_ALT, + 0, + MODIFIER_CONTROL, + MODIFIER_SHIFT, + MODIFIER_ALT, + 0 +}; + +static uint8 sKeyTable[] = { + 0, // ERROR + 0, // ERROR + 0, // ERROR + 0, // ERROR + 30, // A + 48, // B + 46, // C + 32, // D + 18, // E + 33, // F + 34, // G + 35, // H + 23, // I + 36, // J + 37, // K + 38, // L + 50, // M + 49, // N + 24, // O + 25, // P + 16, // Q + 19, // R + 31, // S + 20, // T + 22, // U + 47, // V + 17, // W + 45, // X + 21, // Y + 44, // Z + 2, // 1 + 3, // 2 + 4, // 3 + 5, // 4 + 6, // 5 + 7, // 6 + 8, // 7 + 9, // 8 + 10, // 9 + 11, // 0 + 28, // enter + 1, // Esc + 14, // Backspace + 15, // Tab + 57, // Space + 12, // - + 13, // = + 26, // [ + 27, // ] + 43, // backslash + 80, // backslash + 39, // ; + 40, // ' + 41, // ` + 51, // , + 52, // . + 53, // / + 0, // Caps + 0, // F1 + 0, // F2 + 0, // F3 + 0, // F4 + 0, // F5 + 0, // F6 + 0, // F7 + 0, // F8 + 0, // F9 + 0, // F10 + 0, // F11 + 0, // F12 + 0, // PrintScreen + 0, // Scroll Lock + 0, // Pause (0x7f with Ctrl) + 0, // Insert + 0x80 | 'H', // Home + 0x80 | '5', // Page up + 0x80 | '3', // Delete + 0x80 | 'F', // End + 0x80 | '6', // Page down + 0x80 | 'C', // Right arrow + 0x80 | 'D', // Left arrow + 0x80 | 'B', // Down arrow + 0x80 | 'A', // Up arrow + 0, // Num Lock + 53, // Pad / + 55, // Pad * + 12, // Pad - + 54, // Pad + + 28, // Pad Enter + 2, // Pad 1 + 3, // Pad 2 + 4, // Pad 3 + 5, // Pad 4 + 6, // Pad 5 + 7, // Pad 6 + 8, // Pad 7 + 9, // Pad 8 + 10, // Pad 9 + 11, // Pad 0 + 52, // Pad . + 86, // < + 0, // Menu + 0, // Power + 13 // Pad = +}; + +static size_t sKeyTableSize = sizeof(sKeyTable) / sizeof(sKeyTable[0]); + + +static void +enter_debugger(void) +{ + evaluate_debug_command("get_usb_keyboard_config"); + sUSBTransferLength = get_debug_variable("_usbReportSize", 0); + if (sUSBTransferLength == 0 || sUSBTransferLength > sizeof(sUSBTransferData)) + return; + + evaluate_debug_command("get_usb_pipe_for_id"); + sUSBPipe = (void *)get_debug_variable("_usbPipe", 0); + if (sUSBPipe == NULL) + return; + + sUseUSBKeyboard = true; +} + + +static void +exit_debugger(void) +{ + sUseUSBKeyboard = false; +} + + +static void +write_key(int key) +{ + sBufferedChars[sBufferWriteIndex++] = key; + sBufferWriteIndex %= sBufferSize; + sBufferedCharCount++; +} + + +static int +debugger_getchar(void) +{ + if (!sUseUSBKeyboard) + return -1; + + while (sBufferedCharCount == 0) { + set_debug_variable("_usbPipe", (uint64)sUSBPipe); + set_debug_variable("_usbTransferData", (uint64)sUSBTransferData); + set_debug_variable("_usbTransferLength", (uint64)sUSBTransferLength); + evaluate_debug_command("uhci_process_transfer"); + + bool phantomState = true; + for (size_t i = 2; i < sUSBTransferLength; i++) { + if (sUSBTransferData[i] != 0x01) { + phantomState = false; + break; + } + } + + if (phantomState) + continue; + + uint8 modifiers = 0; + for (uint32 i = 0; i < 8; i++) { + if (sUSBTransferData[0] & (1 << i)) + modifiers |= sModifierTable[i]; + } + + uint8 *current = sUSBTransferData; + uint8 *compare = sLastTransferData; + for (uint32 i = 2; i < sUSBTransferLength; i++) { + if (current[i] == 0x00 || current[i] == 0x01) + continue; + + bool found = false; + for (uint32 j = 2; j < sUSBTransferLength; j++) { + if (compare[j] == current[i]) { + found = true; + break; + } + } + + if (found) + continue; + + if (current[i] >= sKeyTableSize) + continue; + + int result = -1; + uint8 key = sKeyTable[current[i]]; + if (key & 0x80) { + write_key(27); + write_key('['); + + key &= ~0x80; + write_key(key); + + if (key == '5' || key == '6' || key == '3') + write_key('~'); + + continue; + } else if (modifiers & MODIFIER_CONTROL) { + char c = kShiftedKeymap[key]; + if (c >= 'A' && c <= 'Z') + result = 0x1f & c; + } else if (modifiers & MODIFIER_ALT) + result = kAltedKeymap[key]; + else if (modifiers & MODIFIER_SHIFT) + result = kShiftedKeymap[key]; + else + result = kUnshiftedKeymap[key]; + + if (result < 0) + continue; + + write_key(result); + } + + for (uint32 i = 0; i < sUSBTransferLength; i++) + sLastTransferData[i] = sUSBTransferData[i]; + } + + int result = sBufferedChars[sBufferReadIndex++]; + sBufferReadIndex %= sBufferSize; + sBufferedCharCount--; + return result; +} + + +static status_t +std_ops(int32 op, ...) +{ + if (op == B_MODULE_INIT || op == B_MODULE_UNINIT) + return B_OK; + + return B_BAD_VALUE; +} + + +static struct debugger_module_info sModuleInfo = { + { + "debugger/usb_keyboard/v1", + 0, + &std_ops + }, + + &enter_debugger, + &exit_debugger, + NULL, + &debugger_getchar +}; + +module_info *modules[] = { + (module_info *)&sModuleInfo, + NULL +}; + From axeld at pinc-software.de Sun Feb 22 23:11:32 2009 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sun, 22 Feb 2009 23:11:32 +0100 Subject: [Haiku-commits] r29289 - haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam In-Reply-To: <200902221605.n1MG52IU000682@sheep.berlios.de> References: <200902221605.n1MG52IU000682@sheep.berlios.de> Message-ID: <49A1CD94.10800@pinc-software.de> mmu_man at BerliOS wrote: > Modified: > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/ > Log: > Ignore generated files. Last time I looked we were using a very powerful jam-based build system. Can we please not pollute our tree with separate build files for no good reason? Bye, Axel. From dlmcpaul at gmail.com Sun Feb 22 23:22:44 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Mon, 23 Feb 2009 09:22:44 +1100 Subject: [Haiku-commits] r29291 - in haiku/trunk: build/jam headers/private/kernel src/add-ons/kernel/bus_managers/usb src/add-ons/kernel/busses/usb src/add-ons/kernel/debugger src/add-ons/kernel/drivers/input/usb_hid src/system/kernel/debug In-Reply-To: <200902222046.n1MKkYZs013948@sheep.berlios.de> References: <200902222046.n1MKkYZs013948@sheep.berlios.de> Message-ID: On 2009-02-23, mmlr at mail.berlios.de wrote: > Author: mmlr > Date: 2009-02-22 21:46:27 +0100 (Sun, 22 Feb 2009) > New Revision: 29291 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29291&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > haiku/trunk/headers/private/kernel/debug.h > haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.cpp > haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h > haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp > haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp > haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h > haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp > haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h > haiku/trunk/src/add-ons/kernel/debugger/Jamfile > haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp > haiku/trunk/src/system/kernel/debug/blue_screen.cpp > haiku/trunk/src/system/kernel/debug/debug.cpp > Log: > * Added simplified possibility to schedule UHCI transfers from within KDL. > * Added debugger commands to resolve usb_ids to pipes. > * Adjusted the physical memory allocator to be usable in a slimmed down mode > when running inside the kernel debugger. > * Implemented USB keyboard support for KDL through a kernel debugger add-on. > * Added kgetc() and made use of it where previously individual methods were used > to ensure that reading characters always goes through the kernel debugger > add-ons and the other methods. > > This has some preconditions to meet though: > 1) The keyboard must be in the boot protocol (currently the case but needs to > be revisited once we have a full usb_hid). > 2) The keyboard must be attached to a UHCI root port (i.e. not use EHCI or OHCI, > also not through hubs unless those are USB 1.1). > 3) the usb_hid driver has to be opened for this to work. This means that for the > time between initializing USB and when usb_hid is opened by the input_server > there is no keyboard support. > > Also note that this has no way of detecting hot-plug, meaning that you can't > re-attach your USB keyboard from the hub to the root port once in KDL. > > On the bright side of things, since this is a non-destructive mechanism it is > possible to enter and leave KDL without loosing the USB state. > > Tested OK in QEMU, not tested on real hardware yet, will see in a few minutes. Ooh! Excellent. Does this patch remove the code that prevents F12 working for USB keyboards? -- Cheers David From ingo_weinhold at gmx.de Sun Feb 22 23:18:24 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 22 Feb 2009 23:18:24 +0100 Subject: [Haiku-commits] r29291 - in haiku/trunk: build/jam headers/private/kernel src/add-ons/kernel/bus_managers/usb src/add-ons/kernel/busses/usb src/add-ons/kernel/debugger src/add-ons/kernel/drivers/input/usb_hid src/system/kernel/debug In-Reply-To: <200902222046.n1MKkYZs013948@sheep.berlios.de> References: <200902222046.n1MKkYZs013948@sheep.berlios.de> Message-ID: <20090222231824.482.1@knochen-vm.localdomain> On 2009-02-22 at 21:46:34 [+0100], mmlr at mail.berlios.de wrote: > Author: mmlr > Date: 2009-02-22 21:46:27 +0100 (Sun, 22 Feb 2009) > New Revision: 29291 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29291&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > haiku/trunk/headers/private/kernel/debug.h > haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.c > pp > haiku/trunk/src/add-ons/kernel/bus_managers/usb/PhysicalMemoryAllocator.h > haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp > haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp > haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h > haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp > haiku/trunk/src/add-ons/kernel/busses/usb/uhci.h > haiku/trunk/src/add-ons/kernel/debugger/Jamfile > haiku/trunk/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp > haiku/trunk/src/system/kernel/debug/blue_screen.cpp > haiku/trunk/src/system/kernel/debug/debug.cpp > Log: > * Added simplified possibility to schedule UHCI transfers from within KDL. > * Added debugger commands to resolve usb_ids to pipes. > * Adjusted the physical memory allocator to be usable in a slimmed down mode > when running inside the kernel debugger. > * Implemented USB keyboard support for KDL through a kernel debugger add-on. > * Added kgetc() and made use of it where previously individual methods were > used > to ensure that reading characters always goes through the kernel debugger > add-ons and the other methods. > > This has some preconditions to meet though: > 1) The keyboard must be in the boot protocol (currently the case but needs > to > be revisited once we have a full usb_hid). > 2) The keyboard must be attached to a UHCI root port (i.e. not use EHCI or > OHCI, > also not through hubs unless those are USB 1.1). > 3) the usb_hid driver has to be opened for this to work. This means that > for the > time between initializing USB and when usb_hid is opened by the > input_server > there is no keyboard support. > > Also note that this has no way of detecting hot-plug, meaning that you can't > re-attach your USB keyboard from the hub to the root port once in KDL. > > On the bright side of things, since this is a non-destructive mechanism it > is > possible to enter and leave KDL without loosing the USB state. > > Tested OK in QEMU, not tested on real hardware yet, will see in a few > minutes. Woot! :-) CU, Ingo From revol at free.fr Sun Feb 22 23:35:17 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sun, 22 Feb 2009 23:35:17 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29289_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?media-add-ons/usb=5Fwebcam?= In-Reply-To: <49A1CD94.10800@pinc-software.de> Message-ID: <26603597010-BeMail@laptop> > mmu_man at BerliOS wrote: > > Modified: > > haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/ > > Log: > > Ignore generated files. > > Last time I looked we were using a very powerful jam-based build > system. > Can we please not pollute our tree with separate build files for no > good > reason? Actually now that I notice, the Jamfile already relocates them, those are only generated by the makefile, which I don't even use anymore anyway. Fran?ois. From korli at mail.berlios.de Sun Feb 22 23:45:42 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 22 Feb 2009 23:45:42 +0100 Subject: [Haiku-commits] r29293 - haiku/trunk/src/apps/deskcalc Message-ID: <200902222245.n1MMjg6h027062@sheep.berlios.de> Author: korli Date: 2009-02-22 23:45:41 +0100 (Sun, 22 Feb 2009) New Revision: 29293 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29293&view=rev Modified: haiku/trunk/src/apps/deskcalc/CalcApplication.cpp haiku/trunk/src/apps/deskcalc/CalcApplication.h haiku/trunk/src/apps/deskcalc/CalcView.cpp haiku/trunk/src/apps/deskcalc/CalcView.h haiku/trunk/src/apps/deskcalc/CalcWindow.cpp haiku/trunk/src/apps/deskcalc/CalcWindow.h Log: * load settings before building the window: the behavior is then similar with the replicant version. * change window limits when keypad option is off * style cleanup Modified: haiku/trunk/src/apps/deskcalc/CalcApplication.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcApplication.cpp 2009-02-22 20:47:14 UTC (rev 29292) +++ haiku/trunk/src/apps/deskcalc/CalcApplication.cpp 2009-02-22 22:45:41 UTC (rev 29293) @@ -44,12 +44,12 @@ void CalcApplication::ReadyToRun() { + BMessage settings; + _LoadSettings(settings); + BRect frame(0, 0, kDefaultWindowWidth - 1, kDefaultWindowHeight - 1); - fCalcWindow = new CalcWindow(frame); + fCalcWindow = new CalcWindow(frame, &settings); - if (!_LoadSettings()) - fCalcWindow->SetFrame(frame, true); - // reveal window fCalcWindow->Show(); } @@ -76,25 +76,20 @@ // #pragma mark - -bool -CalcApplication::_LoadSettings() +void +CalcApplication::_LoadSettings(BMessage &archive) { // locate preferences file BFile prefsFile; if (_InitSettingsFile(&prefsFile, false) < B_OK) { printf("no preference file found.\n"); - return false; + return; } // unflatten settings data - BMessage archive; if (archive.Unflatten(&prefsFile) < B_OK) { printf("error unflattening settings.\n"); - return false; } - - // apply settings - return fCalcWindow->LoadSettings(&archive); } Modified: haiku/trunk/src/apps/deskcalc/CalcApplication.h =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcApplication.h 2009-02-22 20:47:14 UTC (rev 29292) +++ haiku/trunk/src/apps/deskcalc/CalcApplication.h 2009-02-22 22:45:41 UTC (rev 29293) @@ -28,7 +28,7 @@ virtual bool QuitRequested(); private: - bool _LoadSettings(); + void _LoadSettings(BMessage &settings); void _SaveSettings(); status_t _InitSettingsFile(BFile* file, bool write); Modified: haiku/trunk/src/apps/deskcalc/CalcView.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-02-22 20:47:14 UTC (rev 29292) +++ haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-02-22 22:45:41 UTC (rev 29293) @@ -74,7 +74,7 @@ } -CalcView::CalcView(BRect frame, rgb_color rgbBaseColor) +CalcView::CalcView(BRect frame, rgb_color rgbBaseColor, BMessage *settings) : BView(frame, "DeskCalc", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS), fColums(5), @@ -108,6 +108,8 @@ fExpressionTextView = new ExpressionTextView(_ExpressionRect(), this); AddChild(fExpressionTextView); + _LoadSettings(settings); + // tell the app server not to erase our b/g SetViewColor(B_TRANSPARENT_32_BIT); @@ -116,7 +118,7 @@ // colorize based on base color. _Colorize(); - + // create pop-up menu system _CreatePopUpMenu(); @@ -158,7 +160,7 @@ AddChild(fExpressionTextView); // read data from archive - LoadSettings(archive); + _LoadSettings(archive); // create pop-up menu system _CreatePopUpMenu(); @@ -184,14 +186,13 @@ FrameResized(frame.Width(), frame.Height()); fPopUpMenu->SetTargetForItems(this); + _ShowKeypad(fOptions->show_keypad); } void CalcView::MessageReceived(BMessage* message) { - //message->PrintToStream(); - // check if message was dropped if (message->WasDropped()) { // pass message on to paste @@ -412,7 +413,8 @@ // display popup menu if not primary mouse button if ((B_PRIMARY_MOUSE_BUTTON & buttons) == 0) { BMenuItem* selected; - if ((selected = fPopUpMenu->Go(ConvertToScreen(point))) != NULL) + if ((selected = fPopUpMenu->Go(ConvertToScreen(point))) != NULL + && selected->Message() != NULL) MessageReceived(selected->Message()); return; } @@ -654,7 +656,7 @@ status_t -CalcView::LoadSettings(BMessage* archive) +CalcView::_LoadSettings(BMessage* archive) { if (!archive) return B_BAD_VALUE; @@ -697,7 +699,6 @@ // load options fOptions->LoadSettings(archive); - fShowKeypad = fOptions->show_keypad; // load display text const char* display; @@ -727,13 +728,13 @@ status_t ret = archive ? B_OK : B_BAD_VALUE; // record grid dimensions - if (ret == B_OK) + if (ret == B_OK) ret = archive->AddInt16("cols", fColums); - if (ret == B_OK) + if (ret == B_OK) ret = archive->AddInt16("rows", fRows); // record color scheme - if (ret == B_OK) + if (ret == B_OK) ret = archive->AddData("rgbBaseColor", B_RGB_COLOR_TYPE, &fBaseColor, sizeof(rgb_color)); if (ret == B_OK) @@ -953,7 +954,7 @@ // construct items fAutoNumlockItem = new BMenuItem("Enable Num Lock on start up", new BMessage(K_OPTIONS_AUTO_NUM_LOCK)); - fAudioFeedbackItem = new BMenuItem("Audio Feedback" B_UTF8_ELLIPSIS, + fAudioFeedbackItem = new BMenuItem("Audio Feedback", new BMessage(K_OPTIONS_AUDIO_FEEDBACK)); fShowKeypadItem = new BMenuItem("Show Keypad", new BMessage(K_OPTIONS_SHOW_KEYPAD)); @@ -1007,15 +1008,20 @@ return; fShowKeypad = show; + if (fShowKeypadItem && fShowKeypadItem->IsMarked() ^ fShowKeypad) + fShowKeypadItem->SetMarked(fShowKeypad); float height = fShowKeypad ? fHeight / K_DISPLAY_YPROP : fHeight * K_DISPLAY_YPROP; BWindow* window = Window(); - if (window->Bounds() == Frame()) - window->ResizeTo(fWidth, height); - else - ResizeTo(fWidth, height); + if (window) { + if (window->Bounds() == Frame()) { + window->ResizeTo(fWidth, height); + window->SetSizeLimits(100.0, 400.0, fShowKeypad ? 100.0 : 20.0, 400.0); + } else + ResizeTo(fWidth, height); + } } Modified: haiku/trunk/src/apps/deskcalc/CalcView.h =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcView.h 2009-02-22 20:47:14 UTC (rev 29292) +++ haiku/trunk/src/apps/deskcalc/CalcView.h 2009-02-22 22:45:41 UTC (rev 29293) @@ -28,7 +28,8 @@ CalcView(BRect frame, - rgb_color rgbBaseColor); + rgb_color rgbBaseColor, + BMessage *settings); CalcView(BMessage* archive); @@ -57,8 +58,7 @@ // Paste contents of system clipboard to view. void Paste(BMessage *message); - // Load/Save current settings - status_t LoadSettings(BMessage* archive); + // Save current settings status_t SaveSettings(BMessage* archive) const; void Evaluate(); @@ -87,6 +87,8 @@ void _ShowKeypad(bool show); void _FetchAppIcon(BBitmap* into); + status_t _LoadSettings(BMessage* archive); + // grid dimensions int16 fColums; int16 fRows; Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-02-22 20:47:14 UTC (rev 29292) +++ haiku/trunk/src/apps/deskcalc/CalcWindow.cpp 2009-02-22 22:45:41 UTC (rev 29293) @@ -24,7 +24,7 @@ static const char* kWindowTitle = "DeskCalc"; -CalcWindow::CalcWindow(BRect frame) +CalcWindow::CalcWindow(BRect frame, BMessage *settings) : BWindow(frame, kWindowTitle, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS) { // create calculator view with calculator description and @@ -32,8 +32,10 @@ BScreen screen(this); rgb_color baseColor = screen.DesktopColor(); + SetSizeLimits(100.0, 400.0, 100.0, 400.0); + frame.OffsetTo(B_ORIGIN); - fCalcView = new CalcView(frame, baseColor); + fCalcView = new CalcView(frame, baseColor, settings); // create replicant dragger frame.top = frame.bottom - 7.0f; @@ -45,7 +47,11 @@ AddChild(fCalcView); fCalcView->AddChild(dragger); - SetSizeLimits(100.0, 400.0, 100.0, 400.0); + BRect rect; + if (settings->FindRect("window frame", &rect) == B_OK) + SetFrame(rect); + else + SetFrame(frame, true); } @@ -78,25 +84,6 @@ } -bool -CalcWindow::LoadSettings(BMessage* archive) -{ - status_t ret = fCalcView->LoadSettings(archive); - - if (ret < B_OK) - return false; - - BRect frame; - ret = archive->FindRect("window frame", &frame); - if (ret < B_OK) - return false; - - SetFrame(frame); - - return true; -} - - status_t CalcWindow::SaveSettings(BMessage* archive) const { Modified: haiku/trunk/src/apps/deskcalc/CalcWindow.h =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcWindow.h 2009-02-22 20:47:14 UTC (rev 29292) +++ haiku/trunk/src/apps/deskcalc/CalcWindow.h 2009-02-22 22:45:41 UTC (rev 29293) @@ -18,13 +18,12 @@ class CalcWindow : public BWindow { public: - CalcWindow(BRect frame); + CalcWindow(BRect frame, BMessage *settings); virtual ~CalcWindow(); virtual void Show(); virtual bool QuitRequested(); - bool LoadSettings(BMessage* archive); status_t SaveSettings(BMessage* archive) const; void SetFrame(BRect frame, From korli at users.berlios.de Sun Feb 22 23:46:40 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Sun, 22 Feb 2009 23:46:40 +0100 Subject: [Haiku-commits] r29270 - haiku/trunk/src/apps/deskcalc In-Reply-To: <49A02B33.5090504@gmx.de> References: <200902211458.n1LEwgaI024938@sheep.berlios.de> <49A01726.70902@gmx.de> <49A02B33.5090504@gmx.de> Message-ID: 2009/2/21 Stephan A?mus > Of course. What would work is setting the limits on the keypad show/hide > event. But the view would need to check if the container window is > actually the DescCalc window, not for example the Tracker desktop. > Done in r29293. Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From korli at users.berlios.de Mon Feb 23 01:11:44 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Mon, 23 Feb 2009 01:11:44 +0100 Subject: [Haiku-commits] r29180 - haiku/trunk/src/kits/interface In-Reply-To: <499BD98E.7020000@pinc-software.de> References: <200902092358.n19Nwchc004002@sheep.berlios.de> <17344772461-BeMail@zon> <499BD98E.7020000@pinc-software.de> Message-ID: 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. > > > > 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 ? Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From superstippi at gmx.de Mon Feb 23 09:37:30 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Mon, 23 Feb 2009 09:37:30 +0100 Subject: [Haiku-commits] r29270 - haiku/trunk/src/apps/deskcalc In-Reply-To: References: <200902211458.n1LEwgaI024938@sheep.berlios.de> <49A01726.70902@gmx.de> <49A02B33.5090504@gmx.de> Message-ID: <49A2604A.4000709@gmx.de> J?r?me Duval schrieb: > 2009/2/21 Stephan A?mus > > > Of course. What would work is setting the limits on the keypad show/hide > event. But the view would need to check if the container window is > actually the DescCalc window, not for example the Tracker desktop. > > > Done in r29293. Thanks a lot! Best regards, -Stephan From bga at mail.berlios.de Mon Feb 23 19:05:37 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Mon, 23 Feb 2009 19:05:37 +0100 Subject: [Haiku-commits] r29294 - haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap Message-ID: <200902231805.n1NI5b6B026075@sheep.berlios.de> Author: bga Date: 2009-02-23 19:05:36 +0100 (Mon, 23 Feb 2009) New Revision: 29294 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29294&view=rev Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile Log: - Small update. Modified: haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile =================================================================== --- haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile 2009-02-22 22:45:41 UTC (rev 29293) +++ haiku/trunk/src/add-ons/mail_daemon/inbound_protocols/imap/Jamfile 2009-02-23 18:05:36 UTC (rev 29294) @@ -11,6 +11,8 @@ SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; +local sslDir ; + if $(USE_SSL) { SubDirC++Flags -DUSE_SSL ; if ! $(SSL_DIR) { From korli at mail.berlios.de Mon Feb 23 20:31:51 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 23 Feb 2009 20:31:51 +0100 Subject: [Haiku-commits] r29295 - haiku/trunk/src/apps/deskcalc Message-ID: <200902231931.n1NJVpZs020955@sheep.berlios.de> Author: korli Date: 2009-02-23 20:31:51 +0100 (Mon, 23 Feb 2009) New Revision: 29295 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29295&view=rev Modified: haiku/trunk/src/apps/deskcalc/CalcView.cpp Log: replicant view is already sized correctly Modified: haiku/trunk/src/apps/deskcalc/CalcView.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-02-23 18:05:36 UTC (rev 29294) +++ haiku/trunk/src/apps/deskcalc/CalcView.cpp 2009-02-23 19:31:51 UTC (rev 29295) @@ -161,6 +161,8 @@ // read data from archive _LoadSettings(archive); + // replicant means size and window limit dont need changes + fShowKeypad = fOptions->show_keypad; // create pop-up menu system _CreatePopUpMenu(); From mmlr at mail.berlios.de Mon Feb 23 20:55:05 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 23 Feb 2009 20:55:05 +0100 Subject: [Haiku-commits] r29296 - haiku/trunk/src/system/kernel/fs Message-ID: <200902231955.n1NJt5LK023086@sheep.berlios.de> Author: mmlr Date: 2009-02-23 20:55:03 +0100 (Mon, 23 Feb 2009) New Revision: 29296 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29296&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Disallow removing the "." entry. We do the same for ".." already and it seems to be in line with what other systems do as well. Also fixes bug #3476. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-23 19:31:51 UTC (rev 29295) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-23 19:55:03 UTC (rev 29296) @@ -5644,7 +5644,7 @@ // "name/" -> "name", or "name/." -> "name" lastSlash[0] = '\0'; } - } else if (!strcmp(path, "..")) + } else if (!strcmp(path, ".") || !strcmp(path, "..")) return B_NOT_ALLOWED; } From mmlr at mail.berlios.de Mon Feb 23 21:51:21 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 23 Feb 2009 21:51:21 +0100 Subject: [Haiku-commits] r29297 - in buildtools/trunk/gcc/gcc/config: . i386 Message-ID: <200902232051.n1NKpLoH029666@sheep.berlios.de> Author: mmlr Date: 2009-02-23 21:51:17 +0100 (Mon, 23 Feb 2009) New Revision: 29297 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29297&view=rev Modified: buildtools/trunk/gcc/gcc/config/haiku.h buildtools/trunk/gcc/gcc/config/i386/haiku.h Log: * Amend link and startfile specs for the -shared option. * Remove the part of the link specs that automatically names the output after the last source file. Therefore we'll produce a.out for now. Sadly the %b variable does also evaluate to libraries in GCC4 which makes it unusable for this case. A "gcc file.cpp -lstdc++" would for example produce an output named libstdc++... Modified: buildtools/trunk/gcc/gcc/config/haiku.h =================================================================== --- buildtools/trunk/gcc/gcc/config/haiku.h 2009-02-23 19:55:03 UTC (rev 29296) +++ buildtools/trunk/gcc/gcc/config/haiku.h 2009-02-23 20:51:17 UTC (rev 29297) @@ -62,7 +62,7 @@ it was i386-mcount.o, but that doesn't exist in gcc 2.95.3 either. */ #undef STARTFILE_SPEC -#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!nostart:start_dyn.o%s} init_term_dyn.o%s %{p:mcount.o%s}" +#define STARTFILE_SPEC "crti.o%s crtbegin.o%s %{!shared:%{!nostart:start_dyn.o%s}} init_term_dyn.o%s %{p:mcount.o%s}" #undef ENDFILE_SPEC #define ENDFILE_SPEC "crtend.o%s crtn.o%s" Modified: buildtools/trunk/gcc/gcc/config/i386/haiku.h =================================================================== --- buildtools/trunk/gcc/gcc/config/i386/haiku.h 2009-02-23 19:55:03 UTC (rev 29296) +++ buildtools/trunk/gcc/gcc/config/i386/haiku.h 2009-02-23 20:51:17 UTC (rev 29297) @@ -69,7 +69,7 @@ /* If ELF is the default format, we should not use /lib/elf. */ #undef LINK_SPEC -#define LINK_SPEC "%{!o*:-o %b} -m elf_i386_haiku -shared -no-undefined -Bsymbolic %{nostart:-e 0}" +#define LINK_SPEC "-m elf_i386_haiku -shared -no-undefined -Bsymbolic %{nostart:-e 0} %{shared:-e 0}" /* A C statement (sans semicolon) to output to the stdio stream FILE the assembler definition of uninitialized global DECL named From bonefish at mail.berlios.de Mon Feb 23 23:33:10 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 23 Feb 2009 23:33:10 +0100 Subject: [Haiku-commits] r29298 - in haiku/trunk: . build/jam Message-ID: <200902232233.n1NMXAhm008100@sheep.berlios.de> Author: bonefish Date: 2009-02-23 23:33:09 +0100 (Mon, 23 Feb 2009) New Revision: 29298 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29298&view=rev Added: haiku/trunk/build/jam/CommandLineArguments Modified: haiku/trunk/Jamfile haiku/trunk/Jamrules haiku/trunk/build/jam/BuildSetup haiku/trunk/build/jam/ImageRules haiku/trunk/build/jam/MiscRules Log: * Moved jam argument processing to new build/jam/CommandLineArguments. * Check the first argument for "help" as well. If given print a somewhat helpful text. Consider this my excuse to close ticket #1883. :-) * Track available and added optional packages and fail, if an optional package is requested that doesn't exist. Closes ticket #3332. * Check for duplicate build profile definitions and fail if encountered. Closes ticket #3333. Modified: haiku/trunk/Jamfile =================================================================== --- haiku/trunk/Jamfile 2009-02-23 20:51:17 UTC (rev 29297) +++ haiku/trunk/Jamfile 2009-02-23 22:33:09 UTC (rev 29298) @@ -161,3 +161,17 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootImage ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootPPCImage ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) HaikuCD ] ; + +# Check whether all requested optional packages do actually exist. +local package ; +local packageError ; +for package in $(HAIKU_ADDED_OPTIONAL_PACKAGES) { + if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_EXISTS) ] { + Echo "ERROR: Requested optional package \"$(package)\" does not" + "exist." ; + packageError = 1 ; + } +} +if $(packageError) { + Exit ; +} Modified: haiku/trunk/Jamrules =================================================================== --- haiku/trunk/Jamrules 2009-02-23 20:51:17 UTC (rev 29297) +++ haiku/trunk/Jamrules 2009-02-23 22:33:09 UTC (rev 29298) @@ -31,6 +31,7 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) HelperRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) MathRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) BeOSRules ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) CommandLineArguments ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) ConfigRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) DocumentationRules ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) FileRules ] ; Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2009-02-23 20:51:17 UTC (rev 29297) +++ haiku/trunk/build/jam/BuildSetup 2009-02-23 22:33:09 UTC (rev 29298) @@ -64,60 +64,10 @@ HAIKU_DEFAULT_CD_DIR = $(HAIKU_OUTPUT_DIR) ; HAIKU_DEFAULT_CD_LABEL = Haiku ; -# analyze an optionally replace jam's target parameters -HAIKU_ORIGINAL_JAM_TARGETS = $(JAM_TARGETS) ; -HAIKU_BUILD_PROFILE = ; -if $(JAM_TARGETS) { - switch $(JAM_TARGETS[1]) { - # If the target to be built is "all" (i.e. the default) and we're in - # the output directory, the root directory of the build system, or - # in "src/", we change the target to be built to "haiku-image". - case all : { - if ! $(INVOCATION_SUBDIR) || $(INVOCATION_SUBDIR) = src { - JAM_TARGETS = haiku-image ; - } - } +# analyze and optionally replace jam's target parameters +ProcessCommandLineArguments ; - # The "run" target allows for running arbitrary command lines containing - # build system targets, which are built and replaced accordingly. - case run : { - if $(JAM_TARGETS[2]) { - JAM_TARGETS = [ RunCommandLine $(JAM_TARGETS[2-]) ] ; - } else { - Exit "\"jam run\" requires parameters!" ; - } - } - # A target starting with "@" is a build profile. - case @* : { - HAIKU_BUILD_PROFILE = [ Match "@(.*)" : $(JAM_TARGETS[1]) ] ; - HAIKU_BUILD_PROFILE_ACTION = $(JAM_TARGETS[2]:E=build) ; - HAIKU_BUILD_PROFILE_PARAMETERS = $(JAM_TARGETS[3-]) ; - HAIKU_BUILD_PROFILE_DEFINED = ; - } - - case * : { - # "update-image", "update-vmware-image", and "update-install" - # targets allow for updating only specific targets in the - # image/installation dir. - if $(JAM_TARGETS[1]) in update-image update-vmware-image - update-install { - SetUpdateHaikuImageOnly 1 ; - HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; - - if $(JAM_TARGETS[1]) = update-image { - JAM_TARGETS = haiku-image ; - } else if $(JAM_TARGETS[1]) = update-vmware-image { - JAM_TARGETS = haiku-vmware-image ; - } else { - JAM_TARGETS = install-haiku ; - } - } - } - } -} - - # include Timezones/libgccObjects { local timezones = [ GLOB $(HAIKU_BUILD_OUTPUT_DIR) : Timezones ] ; Added: haiku/trunk/build/jam/CommandLineArguments =================================================================== --- haiku/trunk/build/jam/CommandLineArguments 2009-02-23 20:51:17 UTC (rev 29297) +++ haiku/trunk/build/jam/CommandLineArguments 2009-02-23 22:33:09 UTC (rev 29298) @@ -0,0 +1,95 @@ +# Rules related to processing of jam command line arguments. + +rule ProcessCommandLineArguments +{ + # analyze and optionally replace jam's target parameters + HAIKU_ORIGINAL_JAM_TARGETS = $(JAM_TARGETS) ; + HAIKU_BUILD_PROFILE = ; + if $(JAM_TARGETS) { + switch $(JAM_TARGETS[1]) { + # If the target to be built is "all" (i.e. the default) and we're in + # the output directory, the root directory of the build system, or + # in "src/", we change the target to be built to "haiku-image". + case all : { + if ! $(INVOCATION_SUBDIR) || $(INVOCATION_SUBDIR) = src { + JAM_TARGETS = haiku-image ; + } + } + + # Print usage text. + case help : { + Echo "Individual targets (applications, libraries, drivers,...)" + " can be built by just" ; + Echo "passing them as arguments to jam. The recommended method" + "to build or update a" ; + Echo "Haiku image or installation is to use a build profile" + "with one of the build" ; + Echo "profile actions. Typical command lines using a build" + "profile looks like this:" ; + Echo " jam @image" ; + Echo " jam @install update libbe.so" ; + Echo " jam @vmware-image mount" ; + Echo ; + Echo "Default build profiles:" ; + Echo " image - A raw disk image." ; + Echo " vmware-image - A VMware disk image." ; + Echo " install - A Haiku installation in a directory." ; + Echo ; + Echo "Build profile actions:" ; + Echo " build - Build a Haiku" + "image/installation. This is the default" ; + Echo " action, i.e. it can be" + "omitted." ; + Echo " update ... - Update the specified targets in" + " the Haiku" ; + Echo " image/installation." ; + Echo " update-all - Update all targets in the Haiku" + "image/installation." ; + Echo " mount - Mount the Haiku image in the" + "bfs_shell." ; + Echo ; + Echo "For more details on how to customize Haiku builds read" ; + Echo "build/jam/UserBuildConfig.ReadMe." ; + Exit ; + } + + # The "run" target allows for running arbitrary command lines + # containing build system targets, which are built and replaced + # accordingly. + case run : { + if $(JAM_TARGETS[2]) { + JAM_TARGETS = [ RunCommandLine $(JAM_TARGETS[2-]) ] ; + } else { + Exit "\"jam run\" requires parameters!" ; + } + } + + # A target starting with "@" is a build profile. + case @* : { + HAIKU_BUILD_PROFILE = [ Match "@(.*)" : $(JAM_TARGETS[1]) ] ; + HAIKU_BUILD_PROFILE_ACTION = $(JAM_TARGETS[2]:E=build) ; + HAIKU_BUILD_PROFILE_PARAMETERS = $(JAM_TARGETS[3-]) ; + HAIKU_BUILD_PROFILE_DEFINED = ; + } + + case * : { + # "update-image", "update-vmware-image", and "update-install" + # targets allow for updating only specific targets in the + # image/installation dir. + if $(JAM_TARGETS[1]) in update-image update-vmware-image + update-install { + SetUpdateHaikuImageOnly 1 ; + HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; + + if $(JAM_TARGETS[1]) = update-image { + JAM_TARGETS = haiku-image ; + } else if $(JAM_TARGETS[1]) = update-vmware-image { + JAM_TARGETS = haiku-vmware-image ; + } else { + JAM_TARGETS = install-haiku ; + } + } + } + } + } +} Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2009-02-23 20:51:17 UTC (rev 29297) +++ haiku/trunk/build/jam/ImageRules 2009-02-23 22:33:09 UTC (rev 29298) @@ -698,16 +698,33 @@ rule AddOptionalHaikuImagePackages packages { - HAIKU_OPTIONAL_PACKAGE_ADDED on $(packages) = 1 ; + local package ; + for package in $(packages) { + if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] { + HAIKU_OPTIONAL_PACKAGE_ADDED on $(package) = 1 ; + HAIKU_ADDED_OPTIONAL_PACKAGES += $(package) ; + } + } } rule IsOptionalHaikuImagePackageAdded package { + if ! [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_EXISTS) ] { + HAIKU_OPTIONAL_PACKAGE_EXISTS on $(package) = 1 ; + HAIKU_EXISTING_OPTIONAL_PACKAGES += $(package) ; + } + if [ on $(package) return $(HAIKU_OPTIONAL_PACKAGE_ADDED) ] { return 1 ; } - return $(HAIKU_ADD_ALL_OPTIONAL_PACKAGES) ; + # If all optional packages are installed, make sure this one is added, too. + if $(HAIKU_ADD_ALL_OPTIONAL_PACKAGES) { + AddOptionalHaikuImagePackages $(package) ; + return 1 ; + } + + return ; } rule OptionalPackageDependencies package : dependencies Modified: haiku/trunk/build/jam/MiscRules =================================================================== --- haiku/trunk/build/jam/MiscRules 2009-02-23 20:51:17 UTC (rev 29297) +++ haiku/trunk/build/jam/MiscRules 2009-02-23 22:33:09 UTC (rev 29298) @@ -254,6 +254,11 @@ # HAIKU_IMAGE_DIR, respectively HAIKU_INSTALL_DIR or their default # values will be used instead. + if [ on $(name) return $(HAIKU_BUILD_PROFILE_SPECIFIED) ] { + Exit "ERROR: Build profile \"$(name)\" defined twice!" ; + } + HAIKU_BUILD_PROFILE_SPECIFIED on $(name) = 1 ; + if ! $(HAIKU_BUILD_PROFILE) || $(HAIKU_BUILD_PROFILE) != $(name) { return ; } From mmlr at mail.berlios.de Mon Feb 23 23:48:18 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Mon, 23 Feb 2009 23:48:18 +0100 Subject: [Haiku-commits] r29299 - haiku/trunk/src/system/kernel/fs Message-ID: <200902232248.n1NMmI0V009148@sheep.berlios.de> Author: mmlr Date: 2009-02-23 23:48:16 +0100 (Mon, 23 Feb 2009) New Revision: 29299 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29299&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Better do the check for "." and ".." after stripping off superflous leafs as otherwise a "rmdir ./" would still have caused the corruption. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-23 22:33:09 UTC (rev 29298) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-23 22:48:16 UTC (rev 29299) @@ -5644,7 +5644,9 @@ // "name/" -> "name", or "name/." -> "name" lastSlash[0] = '\0'; } - } else if (!strcmp(path, ".") || !strcmp(path, "..")) + } + + if (!strcmp(path, ".") || !strcmp(path, "..")) return B_NOT_ALLOWED; } From bonefish at mail.berlios.de Mon Feb 23 23:51:01 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 23 Feb 2009 23:51:01 +0100 Subject: [Haiku-commits] r29300 - haiku/trunk/src/servers/debug Message-ID: <200902232251.n1NMp11m009653@sheep.berlios.de> Author: bonefish Date: 2009-02-23 23:51:01 +0100 (Mon, 23 Feb 2009) New Revision: 29300 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29300&view=rev Modified: haiku/trunk/src/servers/debug/DebugServer.cpp Log: TeamDebugHandler::_HandlerThread(): Remove and delete the team handler in any case, not only when we kill the team, i.e. also when the team just died or we handed it over to another debugger. We can do this, since it is also safe to assume that we won't get any further debug messages from the team after a B_DEBUGGER_MESSAGE_TEAM_DELETED or B_DEBUGGER_MESSAGE_HANDED_OVER. We were leaking (well, keeping) the team handler in those cases, which was a problem in the latter one, since we silently ate all debug messages for the team in case it would be re-attached later. Fixes bug #2942. Modified: haiku/trunk/src/servers/debug/DebugServer.cpp =================================================================== --- haiku/trunk/src/servers/debug/DebugServer.cpp 2009-02-23 22:48:16 UTC (rev 29299) +++ haiku/trunk/src/servers/debug/DebugServer.cpp 2009-02-23 22:51:01 UTC (rev 29300) @@ -419,7 +419,6 @@ } // _EnterDebugger - thread_id TeamDebugHandler::_EnterDebugger() { @@ -798,12 +797,12 @@ if (kill) { // kill the team _KillTeam(); + } - // remove this handler from the roster and delete it - TeamDebugHandlerRoster::Default()->RemoveHandler(fTeam); + // remove this handler from the roster and delete it + TeamDebugHandlerRoster::Default()->RemoveHandler(fTeam); - delete this; - } + delete this; return B_OK; } From bonefish at mail.berlios.de Mon Feb 23 23:53:46 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 23 Feb 2009 23:53:46 +0100 Subject: [Haiku-commits] r29301 - haiku/trunk/src/tests/servers/debug Message-ID: <200902232253.n1NMrkH1009824@sheep.berlios.de> Author: bonefish Date: 2009-02-23 23:53:46 +0100 (Mon, 23 Feb 2009) New Revision: 29301 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29301&view=rev Modified: haiku/trunk/src/tests/servers/debug/crashing_app.cpp Log: Added option "--multi", which creates another thread and crashes both, the new thread and the main thread in this order. Allows to reproduce #2956 quite often. Modified: haiku/trunk/src/tests/servers/debug/crashing_app.cpp =================================================================== --- haiku/trunk/src/tests/servers/debug/crashing_app.cpp 2009-02-23 22:51:01 UTC (rev 29300) +++ haiku/trunk/src/tests/servers/debug/crashing_app.cpp 2009-02-23 22:53:46 UTC (rev 29301) @@ -23,6 +23,7 @@ "Options:\n" " -d - call disable_debugger() first\n" " -h, --help - print this info text\n" + " --multi - crash in multiple threads\n" " --signal - crash in a signal handler\n" " --thread - crash in a separate thread\n" "\n" @@ -123,6 +124,7 @@ Options() : inThread(false), + multipleThreads(false), inSignalHandler(false), disableDebugger(false) { @@ -130,6 +132,7 @@ crash_function_t* function; bool inThread; + bool multipleThreads; bool inSignalHandler; bool disableDebugger; }; @@ -204,6 +207,9 @@ print_usage_and_exit(false); } else if (strcmp(arg, "-d") == 0) { sOptions.disableDebugger = true; + } else if (strcmp(arg, "--multi") == 0) { + sOptions.inThread = true; + sOptions.multipleThreads = true; } else if (strcmp(arg, "--signal") == 0) { sOptions.inSignalHandler = true; } else if (strcmp(arg, "--thread") == 0) { @@ -236,8 +242,14 @@ } resume_thread(thread); - status_t result; - while (wait_for_thread(thread, &result) == B_INTERRUPTED) { + + if (sOptions.multipleThreads) { + snooze(200000); + do_crash(); + } else { + status_t result; + while (wait_for_thread(thread, &result) == B_INTERRUPTED) { + } } } else { do_crash(); From bonefish at mail.berlios.de Mon Feb 23 23:59:45 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 23 Feb 2009 23:59:45 +0100 Subject: [Haiku-commits] r29302 - in haiku/trunk: headers/os/kernel headers/private/kernel src/system/kernel/debug Message-ID: <200902232259.n1NMxjrq010102@sheep.berlios.de> Author: bonefish Date: 2009-02-23 23:59:45 +0100 (Mon, 23 Feb 2009) New Revision: 29302 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29302&view=rev Modified: haiku/trunk/headers/os/kernel/debugger.h haiku/trunk/headers/private/kernel/user_debugger.h haiku/trunk/src/system/kernel/debug/user_debugger.cpp Log: * When a team debugger is installed automatically, the thread causing that is stored now. * Extended the debugger message for B_DEBUGGER_MESSAGE_HANDED_OVER by the causing thread. * Also send B_DEBUGGER_MESSAGE_HANDED_OVER to the debugger to which the team was handed over. The message will be the very first one the debugger gets from the team in question. * Some harmless refactoring (added thread_hit_serious_debug_event()). Modified: haiku/trunk/headers/os/kernel/debugger.h =================================================================== --- haiku/trunk/headers/os/kernel/debugger.h 2009-02-23 22:53:46 UTC (rev 29301) +++ haiku/trunk/headers/os/kernel/debugger.h 2009-02-23 22:59:45 UTC (rev 29302) @@ -176,7 +176,8 @@ // thread B_DEBUGGER_MESSAGE_HANDED_OVER, // the debugged team has been - // handed over to another debugger + // handed over to another debugger, + // sent to both debuggers } debug_debugger_message; @@ -589,6 +590,9 @@ // (asynchronous message) team_id debugger; // the new debugger port_id debugger_port; // the port the new debugger uses + thread_id causing_thread; // the thread that caused entering the + // debugger in the first place, -1 if the + // debugger wasn't attached automatically } debug_handed_over; // union of all messages structures sent to the debugger Modified: haiku/trunk/headers/private/kernel/user_debugger.h =================================================================== --- haiku/trunk/headers/private/kernel/user_debugger.h 2009-02-23 22:53:46 UTC (rev 29301) +++ haiku/trunk/headers/private/kernel/user_debugger.h 2009-02-23 22:59:45 UTC (rev 29302) @@ -54,6 +54,9 @@ sem_id debugger_write_lock; // synchronizes writes to the debugger port with the setting (but not // clearing) of the B_TEAM_DEBUG_DEBUGGER_HANDOVER flag + thread_id causing_thread; + // thread that caused the debugger to be attached; -1 for manual + // debugger attachment (or no debugger installed) vint32 image_event; // counter incremented whenever an image is created/deleted @@ -123,13 +126,14 @@ // team debugging flags (user-specifiable flags are in ) enum { - B_TEAM_DEBUG_DEBUGGER_INSTALLED = 0x0001, - B_TEAM_DEBUG_DEBUGGER_HANDOVER = 0x0002, - B_TEAM_DEBUG_DEBUGGER_DISABLED = 0x0004, + B_TEAM_DEBUG_DEBUGGER_INSTALLED = 0x0001, + B_TEAM_DEBUG_DEBUGGER_HANDOVER = 0x0002, // marked for hand-over + B_TEAM_DEBUG_DEBUGGER_HANDING_OVER = 0x0004, // handing over + B_TEAM_DEBUG_DEBUGGER_DISABLED = 0x0008, - B_TEAM_DEBUG_KERNEL_FLAG_MASK = 0xffff, + B_TEAM_DEBUG_KERNEL_FLAG_MASK = 0xffff, - B_TEAM_DEBUG_DEFAULT_FLAGS = 0, + B_TEAM_DEBUG_DEFAULT_FLAGS = 0, }; // thread debugging flags (user-specifiable flags are in ) Modified: haiku/trunk/src/system/kernel/debug/user_debugger.cpp =================================================================== --- haiku/trunk/src/system/kernel/debug/user_debugger.cpp 2009-02-23 22:53:46 UTC (rev 29301) +++ haiku/trunk/src/system/kernel/debug/user_debugger.cpp 2009-02-23 22:59:45 UTC (rev 29302) @@ -50,7 +50,7 @@ static void schedule_profiling_timer(struct thread* thread, bigtime_t interval); static int32 profiling_event(timer* unused); -static status_t ensure_debugger_installed(team_id teamID, port_id *port = NULL); +static status_t ensure_debugger_installed(); static void get_team_debug_info(team_debug_info &teamDebugInfo); @@ -219,6 +219,7 @@ info->nub_thread = -1; info->nub_port = -1; info->debugger_write_lock = -1; + info->causing_thread = -1; info->image_event = 0; if (initLock) @@ -270,6 +271,7 @@ atomic_set(&info->flags, 0); info->debugger_team = -1; info->debugger_port = -1; + info->causing_thread = -1; info->image_event = -1; } } @@ -694,6 +696,24 @@ } +static status_t +thread_hit_serious_debug_event(debug_debugger_message event, + const void *message, int32 messageSize) +{ + // ensure that a debugger is installed for this team + status_t error = ensure_debugger_installed(); + if (error != B_OK) { + struct thread *thread = thread_get_current_thread(); + dprintf("thread_hit_serious_debug_event(): Failed to install debugger: " + "thread: %ld: %s\n", thread->id, strerror(error)); + return true; + } + + // enter the debug loop + return thread_hit_debug_event(event, message, messageSize, true); +} + + void user_debug_pre_syscall(uint32 syscall, void *args) { @@ -782,23 +802,13 @@ return true; } - // ensure that a debugger is installed for this team - struct thread *thread = thread_get_current_thread(); - port_id nubPort; - status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort); - if (error != B_OK) { - dprintf("user_debug_exception_occurred(): Failed to install debugger: " - "thread: %ld: %s\n", thread->id, strerror(error)); - return true; - } - // prepare the message debug_exception_occurred message; message.exception = exception; message.signal = signal; - status_t result = thread_hit_debug_event( - B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED, &message, sizeof(message), true); + status_t result = thread_hit_serious_debug_event( + B_DEBUGGER_MESSAGE_EXCEPTION_OCCURRED, &message, sizeof(message)); return (result != B_THREAD_DEBUG_IGNORE_EVENT); } @@ -829,21 +839,11 @@ void user_debug_stop_thread() { - // ensure that a debugger is installed for this team - struct thread *thread = thread_get_current_thread(); - port_id nubPort; - status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort); - if (error != B_OK) { - dprintf("user_debug_stop_thread(): Failed to install debugger: " - "thread: %ld: %s\n", thread->id, strerror(error)); - return; - } - // prepare the message debug_thread_debugged message; - thread_hit_debug_event(B_DEBUGGER_MESSAGE_THREAD_DEBUGGED, &message, - sizeof(message), true); + thread_hit_serious_debug_event(B_DEBUGGER_MESSAGE_THREAD_DEBUGGED, &message, + sizeof(message)); } @@ -1106,67 +1106,37 @@ void user_debug_breakpoint_hit(bool software) { - // ensure that a debugger is installed for this team - struct thread *thread = thread_get_current_thread(); - port_id nubPort; - status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort); - if (error != B_OK) { - dprintf("user_debug_breakpoint_hit(): Failed to install debugger: " - "thread: %ld: %s\n", thread->id, strerror(error)); - return; - } - // prepare the message debug_breakpoint_hit message; message.software = software; arch_get_debug_cpu_state(&message.cpu_state); - thread_hit_debug_event(B_DEBUGGER_MESSAGE_BREAKPOINT_HIT, &message, - sizeof(message), true); + thread_hit_serious_debug_event(B_DEBUGGER_MESSAGE_BREAKPOINT_HIT, &message, + sizeof(message)); } void user_debug_watchpoint_hit() { - // ensure that a debugger is installed for this team - struct thread *thread = thread_get_current_thread(); - port_id nubPort; - status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort); - if (error != B_OK) { - dprintf("user_debug_watchpoint_hit(): Failed to install debugger: " - "thread: %ld: %s\n", thread->id, strerror(error)); - return; - } - // prepare the message debug_watchpoint_hit message; arch_get_debug_cpu_state(&message.cpu_state); - thread_hit_debug_event(B_DEBUGGER_MESSAGE_WATCHPOINT_HIT, &message, - sizeof(message), true); + thread_hit_serious_debug_event(B_DEBUGGER_MESSAGE_WATCHPOINT_HIT, &message, + sizeof(message)); } void user_debug_single_stepped() { - // ensure that a debugger is installed for this team - struct thread *thread = thread_get_current_thread(); - port_id nubPort; - status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort); - if (error != B_OK) { - dprintf("user_debug_watchpoint_hit(): Failed to install debugger: " - "thread: %ld: %s\n", thread->id, strerror(error)); - return; - } - // prepare the message debug_single_step message; arch_get_debug_cpu_state(&message.cpu_state); - thread_hit_debug_event(B_DEBUGGER_MESSAGE_SINGLE_STEP, &message, - sizeof(message), true); + thread_hit_serious_debug_event(B_DEBUGGER_MESSAGE_SINGLE_STEP, &message, + sizeof(message)); } @@ -2449,7 +2419,7 @@ static void install_team_debugger_init_debug_infos(struct team *team, team_id debuggerTeam, port_id debuggerPort, port_id nubPort, thread_id nubThread, - sem_id debuggerPortWriteLock) + sem_id debuggerPortWriteLock, thread_id causingThread) { atomic_set(&team->debug_info.flags, B_TEAM_DEBUG_DEFAULT_FLAGS | B_TEAM_DEBUG_DEBUGGER_INSTALLED); @@ -2458,6 +2428,7 @@ team->debug_info.debugger_team = debuggerTeam; team->debug_info.debugger_port = debuggerPort; team->debug_info.debugger_write_lock = debuggerPortWriteLock; + team->debug_info.causing_thread = causingThread; arch_clear_team_debug_info(&team->debug_info.arch_info); @@ -2491,11 +2462,11 @@ static port_id -install_team_debugger(team_id teamID, port_id debuggerPort, bool useDefault, - bool dontFail) +install_team_debugger(team_id teamID, port_id debuggerPort, + thread_id causingThread, bool useDefault, bool dontReplace) { TRACE(("install_team_debugger(team: %ld, port: %ld, default: %d, " - "dontFail: %d)\n", teamID, debuggerPort, useDefault, dontFail)); + "dontReplace: %d)\n", teamID, debuggerPort, useDefault, dontReplace)); if (useDefault) debuggerPort = atomic_get(&sDefaultDebuggerPort); @@ -2547,37 +2518,54 @@ // don't allow to debug the kernel error = B_NOT_ALLOWED; } else if (teamDebugFlags & B_TEAM_DEBUG_DEBUGGER_INSTALLED) { + // There's already a debugger installed. if (teamDebugFlags & B_TEAM_DEBUG_DEBUGGER_HANDOVER) { - // a handover to another debugger is requested - // clear the flag - atomic_and(& team->debug_info.flags, - ~B_TEAM_DEBUG_DEBUGGER_HANDOVER); + if (dontReplace) { + // We're fine with already having a debugger. + error = B_OK; + done = true; + result = team->debug_info.nub_port; + } else if ( + teamDebugFlags & B_TEAM_DEBUG_DEBUGGER_HANDING_OVER) { + // Another debugger is in the process of installing itself + // as the team's debugger. + error = (dontReplace ? B_OK : B_BAD_VALUE); + done = true; + result = team->debug_info.nub_port; + } else { + // a handover to another debugger is requested + // Set the handing-over flag -- we'll clear both flags after + // having sent the handed-over message to the new debugger. + atomic_or(&team->debug_info.flags, + B_TEAM_DEBUG_DEBUGGER_HANDING_OVER); - oldDebuggerPort = team->debug_info.debugger_port; - result = nubPort = team->debug_info.nub_port; + oldDebuggerPort = team->debug_info.debugger_port; + result = nubPort = team->debug_info.nub_port; + if (causingThread < 0) + causingThread = team->debug_info.causing_thread; - // set the new debugger - install_team_debugger_init_debug_infos(team, debuggerTeam, - debuggerPort, nubPort, team->debug_info.nub_thread, - team->debug_info.debugger_write_lock); + // set the new debugger + install_team_debugger_init_debug_infos(team, debuggerTeam, + debuggerPort, nubPort, team->debug_info.nub_thread, + team->debug_info.debugger_write_lock, causingThread); - releaseDebugInfoLock = false; - handOver = true; - done = true; + releaseDebugInfoLock = false; + handOver = true; + done = true; - // finally set the new port owner - if (set_port_owner(nubPort, debuggerTeam) != B_OK) { - // The old debugger must just have died. Just proceed as - // if there was no debugger installed. We may still be too - // early, in which case we'll fail, but this race condition - // should be unbelievably rare and relatively harmless. - handOver = false; - done = false; + // finally set the new port owner + if (set_port_owner(nubPort, debuggerTeam) != B_OK) { + // The old debugger must just have died. Just proceed as + // if there was no debugger installed. We may still be too + // early, in which case we'll fail, but this race condition + // should be unbelievably rare and relatively harmless. + handOver = false; + done = false; + } } - } else { // there's already a debugger installed - error = (dontFail ? B_OK : B_BAD_VALUE); + error = (dontReplace ? B_OK : B_BAD_VALUE); done = true; result = team->debug_info.nub_port; } @@ -2598,18 +2586,55 @@ restore_interrupts(state); if (handOver) { - // notify the nub thread - kill_interruptable_write_port(nubPort, B_DEBUG_MESSAGE_HANDED_OVER, - NULL, 0); - - // notify the old debugger + // prepare the handed-over message debug_handed_over notification; notification.origin.thread = -1; notification.origin.team = teamID; notification.origin.nub_port = nubPort; notification.debugger = debuggerTeam; notification.debugger_port = debuggerPort; + notification.causing_thread = causingThread; + // notify the new debugger + error = write_port_etc(debuggerPort, + B_DEBUGGER_MESSAGE_HANDED_OVER, ¬ification, + sizeof(notification), B_RELATIVE_TIMEOUT, 0); + if (error != B_OK) { + dprintf("install_team_debugger(): Failed to send message to new " + "debugger: %s\n", strerror(error)); + } + + // clear the handed-over and handing-over flags + cpu_status state = disable_interrupts(); + GRAB_TEAM_LOCK(); + + team = team_get_team_struct_locked(teamID); + + if (team) { + GRAB_TEAM_DEBUG_INFO_LOCK(team->debug_info); + + int32 teamDebugFlags = team->debug_info.flags; + + if ((teamDebugFlags & B_TEAM_DEBUG_DEBUGGER_INSTALLED) != 0 + && (teamDebugFlags & B_TEAM_DEBUG_DEBUGGER_HANDING_OVER) != 0 + && team->debug_info.debugger_port == debuggerPort) { + // Everything is as we left it above, so just clear the flags. + atomic_and(&team->debug_info.flags, + ~(B_TEAM_DEBUG_DEBUGGER_HANDOVER + | B_TEAM_DEBUG_DEBUGGER_HANDING_OVER)); + } + + RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info); + } + + RELEASE_TEAM_LOCK(); + restore_interrupts(state); + + // notify the nub thread + kill_interruptable_write_port(nubPort, B_DEBUG_MESSAGE_HANDED_OVER, + NULL, 0); + + // notify the old debugger error = write_port_etc(oldDebuggerPort, B_DEBUGGER_MESSAGE_HANDED_OVER, ¬ification, sizeof(notification), B_RELATIVE_TIMEOUT, 0); @@ -2676,14 +2701,15 @@ if (team->debug_info.flags & B_TEAM_DEBUG_DEBUGGER_INSTALLED) { // there's already a debugger installed - error = (dontFail ? B_OK : B_BAD_VALUE); + error = (dontReplace ? B_OK : B_BAD_VALUE); done = true; result = team->debug_info.nub_port; RELEASE_TEAM_DEBUG_INFO_LOCK(team->debug_info); } else { install_team_debugger_init_debug_infos(team, debuggerTeam, - debuggerPort, nubPort, nubThread, debuggerWriteLock); + debuggerPort, nubPort, nubThread, debuggerWriteLock, + causingThread); } } else error = B_BAD_TEAM_ID; @@ -2714,15 +2740,11 @@ static status_t -ensure_debugger_installed(team_id teamID, port_id *_port) +ensure_debugger_installed() { - port_id port = install_team_debugger(teamID, -1, true, true); - if (port < 0) - return port; - - if (_port) - *_port = port; - return B_OK; + port_id port = install_team_debugger(B_CURRENT_TEAM, -1, + thread_get_current_thread_id(), true, true); + return port >= 0 ? B_OK : port; } @@ -2733,8 +2755,7 @@ _user_debugger(const char *userMessage) { // install the default debugger, if there is none yet - port_id nubPort; - status_t error = ensure_debugger_installed(B_CURRENT_TEAM, &nubPort); + status_t error = ensure_debugger_installed(); if (error != B_OK) { // time to commit suicide char buffer[128]; @@ -2809,7 +2830,7 @@ port_id _user_install_team_debugger(team_id teamID, port_id debuggerPort) { - return install_team_debugger(teamID, debuggerPort, false, false); + return install_team_debugger(teamID, debuggerPort, -1, false, false); } From bonefish at mail.berlios.de Tue Feb 24 00:02:31 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 24 Feb 2009 00:02:31 +0100 Subject: [Haiku-commits] r29303 - haiku/trunk/src/bin/gdb/gdb Message-ID: <200902232302.n1NN2VOB010372@sheep.berlios.de> Author: bonefish Date: 2009-02-24 00:02:28 +0100 (Tue, 24 Feb 2009) New Revision: 29303 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29303&view=rev Modified: haiku/trunk/src/bin/gdb/gdb/haiku-nat.c Log: * Automatic white-space cleanup. * Handle the new B_DEBUGGER_MESSAGE_HANDED_OVER and pick the "causing thread" as our first victim. Fixes #2956. Modified: haiku/trunk/src/bin/gdb/gdb/haiku-nat.c =================================================================== --- haiku/trunk/src/bin/gdb/gdb/haiku-nat.c 2009-02-23 22:59:45 UTC (rev 29302) +++ haiku/trunk/src/bin/gdb/gdb/haiku-nat.c 2009-02-23 23:02:28 UTC (rev 29303) @@ -280,7 +280,7 @@ thread_debug_info *thread = teamDebugInfo->threads; teamDebugInfo->threads = thread->next; xfree(thread); - } + } // clear gdb's thread DB init_thread_list(); @@ -380,7 +380,7 @@ extended_image_info *image = teamDebugInfo->images; teamDebugInfo->images = image->next; xfree(image); - } + } } @@ -577,7 +577,7 @@ delete_port(sTeamDebugInfo.debugger_port); sTeamDebugInfo.debugger_port = -1; sTeamDebugInfo.team = -1; - + haiku_cleanup_thread_list(&sTeamDebugInfo); haiku_cleanup_image_list(&sTeamDebugInfo); } @@ -759,7 +759,7 @@ // We should check, whether we really got an event for the thread in // question, but the only possible other event is that the team has // been delete, which ends the game anyway. - + // TODO: That's actually not true. We also get messages when an add-on // has been loaded/unloaded, a signal arrives, or a thread calls the // debugger. @@ -1008,7 +1008,7 @@ static ptid_t haiku_child_wait_internal (team_debug_info *teamDebugInfo, ptid_t ptid, - struct target_waitstatus *ourstatus, bool *ignore) + struct target_waitstatus *ourstatus, bool *ignore, bool *selectThread) { team_id teamID = ptid_get_pid(ptid); team_id threadID = ptid_get_tid(ptid); @@ -1019,6 +1019,8 @@ pending_signal_status pendingSignalStatus = SIGNAL_FAKED; int reprocessEvent = -1; + *selectThread = false; + if (teamID < 0 || threadID == 0) threadID = -1; @@ -1253,6 +1255,23 @@ ourstatus->value.integer = 0; break; + case B_DEBUGGER_MESSAGE_HANDED_OVER: + { +TRACE(("haiku_child_wait_internal(): B_DEBUGGER_MESSAGE_HANDED_OVER: causing " +"thread: %ld\n", event->data.handed_over.causing_thread)); + // The debugged team has been handed over to us by another debugger + // (likely the debug server). This event also tells us, which + // thread has caused the original debugger to be installed (if any). + // So, if we're not looking for any particular thread, select that + // thread. + if (threadID < 0 && event->data.handed_over.causing_thread >= 0) { + *selectThread = true; + retval = ptid_build(event->data.origin.team, 0, + event->data.handed_over.causing_thread); + } + *ignore = true; + } + default: // unknown message, ignore *ignore = true; @@ -1294,13 +1313,16 @@ { ptid_t retval; bool ignore = true; + bool selectThread = false; TRACE(("haiku_child_wait(`%s', %p)\n", haiku_pid_to_str(ptid), ourstatus)); do { retval = haiku_child_wait_internal(&sTeamDebugInfo, ptid, ourstatus, - &ignore); + &ignore, &selectThread); + if (selectThread) + ptid = retval; } while (ignore); TRACE(("haiku_child_wait() done: `%s'\n", haiku_pid_to_str(retval))); @@ -1556,7 +1578,7 @@ //"message\n")); // break; // } -// +// // resume (0, stop_signal); // } } From revol at free.fr Tue Feb 24 00:27:40 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Tue, 24 Feb 2009 00:27:40 +0100 CET Subject: [Haiku-commits] r29297 - in buildtools/trunk/gcc/gcc/config: . i386 In-Reply-To: <200902232051.n1NKpLoH029666@sheep.berlios.de> Message-ID: <668358564-BeMail@laptop> > Author: mmlr > Date: 2009-02-23 21:51:17 +0100 (Mon, 23 Feb 2009) > New Revision: 29297 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29297&view=rev > > Modified: > buildtools/trunk/gcc/gcc/config/haiku.h > buildtools/trunk/gcc/gcc/config/i386/haiku.h > Log: > * Amend link and startfile specs for the -shared option. > * Remove the part of the link specs that automatically names the > output after > the last source file. Therefore we'll produce a.out for now. Sadly > the %b > variable does also evaluate to libraries in GCC4 which makes it > unusable for > this case. A "gcc file.cpp -lstdc++" would for example produce an > output > named libstdc++... Aw, that's ugly, what do other platforms do ??? Fran?ois. From dlmcpaul at mail.berlios.de Tue Feb 24 08:56:25 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Tue, 24 Feb 2009 08:56:25 +0100 Subject: [Haiku-commits] r29304 - haiku/trunk/src/add-ons/media/plugins/avcodec Message-ID: <200902240756.n1O7uPQt010151@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-24 08:56:25 +0100 (Tue, 24 Feb 2009) New Revision: 29304 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29304&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp Log: add additional motion jpeg fourcc Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp 2009-02-23 23:02:28 UTC (rev 29303) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp 2009-02-24 07:56:25 UTC (rev 29304) @@ -106,6 +106,7 @@ #endif #ifdef HAS_MOTION_JPEG {CODEC_ID_MJPEG, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('MJPG'), "Motion JPEG"}, + {CODEC_ID_MJPEG, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, FOURCC('mjpg'), "Motion JPEG"}, {CODEC_ID_MJPEG, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'AVDJ', "Motion JPEG"}, {CODEC_ID_MJPEG, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'mjpa', "Motion JPEG"}, {CODEC_ID_MJPEGB, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'mjpb', "Motion JPEG"}, From dlmcpaul at mail.berlios.de Tue Feb 24 09:00:08 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Tue, 24 Feb 2009 09:00:08 +0100 Subject: [Haiku-commits] r29305 - haiku/trunk/src/add-ons/media/plugins/avcodec Message-ID: <200902240800.n1O8088B010868@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-24 09:00:06 +0100 (Tue, 24 Feb 2009) New Revision: 29305 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29305&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.h Log: implement seek function Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp 2009-02-24 07:56:25 UTC (rev 29304) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp 2009-02-24 08:00:06 UTC (rev 29305) @@ -205,8 +205,9 @@ status_t -avCodec::Seek(uint32 in_towhat,int64 in_requiredFrame, int64 *inout_frame, - bigtime_t in_requiredTime, bigtime_t *inout_time) +avCodec::Seek(uint32 seekTo, + int64 seekFrame, int64 *frame, + bigtime_t seekTime, bigtime_t *time) { // reset the ffmpeg codec // to flush buffers, so we keep the sync @@ -215,7 +216,25 @@ avcodec_close(ffc); fCodecInitDone = (avcodec_open(ffc, fCodec) >= 0); } - fFrame = *inout_frame; + + if (seekTo == B_MEDIA_SEEK_TO_TIME) { + TRACE("avCodec::Seek by time "); + TRACE("from frame %Ld and time %.6f TO Required Time %.6f. ", fFrame, fStartTime / 1000000.0, seekTime / 1000000.0); + + *frame = (int64)(seekTime * fOutputFrameRate / 1000000LL); + *time = seekTime; + } else if (seekTo == B_MEDIA_SEEK_TO_FRAME) { + TRACE("avCodec::Seek by Frame "); + TRACE("from time %.6f and frame %Ld TO Required Frame %Ld. ", fStartTime / 1000000.0, fFrame, seekFrame); + + *time = (bigtime_t)(seekFrame * 1000000LL / fOutputFrameRate); + *frame = seekFrame; + } else + return B_BAD_VALUE; + + fFrame = *frame; + fStartTime = *time; + TRACE("so new frame is %Ld at time %.6f\n", *frame, *time / 1000000.0); return B_OK; } @@ -300,6 +319,8 @@ // ffc->frame_rate = (int)(fOutputVideoFormat.field_rate // * ffc->frame_rate_base); + fOutputFrameRate = fOutputVideoFormat.field_rate; + if (fInputFormat.MetaDataSize() > 0) { ffc->extradata = (uint8_t *)fInputFormat.MetaData(); ffc->extradata_size = fInputFormat.MetaDataSize(); @@ -331,6 +352,7 @@ // XXX set n-th ffc->pix_fmt here if (avcodec_open(ffc, fCodec) >= 0) { fCodecInitDone = true; + conv_func = resolve_colorspace( fOutputVideoFormat.display.format, ffc->pix_fmt); } @@ -339,11 +361,12 @@ } if (!fCodecInitDone) { - TRACE("avcodec_open() failed!\n"); + TRACE("avcodec_open() failed to init codec!\n"); return B_ERROR; } + if (!conv_func) { - TRACE("no conv_func!\n"); + TRACE("no conv_func found!\n"); return B_ERROR; } @@ -393,10 +416,10 @@ // TRACE("[%c] avCodec::Decode()\n", isAudio?('a'):('v')); + mh->start_time = fStartTime; + if (isAudio) { - mh->start_time = fStartTime; - // TRACE("audio start_time %.6f\n", mh->start_time / 1000000.0); char *output_buffer = (char *)out_buffer; @@ -462,6 +485,7 @@ fOutputBufferSize = out_size; } } + fFrame += *out_frameCount; } else { // Video @@ -477,9 +501,7 @@ } mh->type = B_MEDIA_RAW_VIDEO; -// mh->start_time = (bigtime_t) (1000000.0 * fFrame -// / fOutputVideoFormat.field_rate); - mh->start_time = chunk_mh.start_time; +// mh->start_time = chunk_mh.start_time; mh->file_pos = 0; mh->orig_size = 0; mh->u.raw_video.field_gamma = 1.0; @@ -561,6 +583,9 @@ #endif } } + + fStartTime = (bigtime_t) (1000000LL * fFrame / fOutputFrameRate); + // TRACE("END of avCodec::Decode()\n"); return B_OK; } Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.h 2009-02-24 07:56:25 UTC (rev 29304) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.h 2009-02-24 08:00:06 UTC (rev 29305) @@ -45,9 +45,8 @@ virtual status_t Decode(void *out_buffer, int64 *out_frameCount, media_header *mh, media_decode_info *info); - virtual status_t Seek(uint32 in_towhat, - int64 in_requiredFrame, int64 *inout_frame, - bigtime_t in_requiredTime, bigtime_t *inout_time); + virtual status_t Seek(uint32 seekTo, int64 seekFrame, int64 *frame, + bigtime_t seekTime, bigtime_t *time); protected: From dlmcpaul at mail.berlios.de Tue Feb 24 09:00:47 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Tue, 24 Feb 2009 09:00:47 +0100 Subject: [Haiku-commits] r29306 - haiku/trunk/src/add-ons/media/plugins/avcodec Message-ID: <200902240800.n1O80lUA010977@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-24 09:00:46 +0100 (Tue, 24 Feb 2009) New Revision: 29306 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29306&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.cpp haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.h haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp Log: implement basic C yuv422toRGB function Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.cpp 2009-02-24 08:00:06 UTC (rev 29305) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.cpp 2009-02-24 08:00:46 UTC (rev 29306) @@ -268,3 +268,64 @@ } #endif + +#define CLIP(a) if (0xffffff00 & (uint32)a) { if (a < 0) a = 0; else a = 255; } + +// http://en.wikipedia.org/wiki/YUV +uint32 YUV444TORGBA8888(uint8 y, uint8 u, uint8 v) +{ + uint32 pixel = 0; + int32 c, d, e; + int32 r,g,b; + + c = y - 16; + d = u - 128; + e = v - 128; + + r = (298 * c + 409 * e + 128) >> 8; + g = (298 * c - 100 * d - 208 * e + 128) >> 8; + b = (298 * c + 516 * d + 128) >> 8; + + CLIP(r); + CLIP(g); + CLIP(b); + + pixel = (r << 16) | (g << 8) | b; + + return pixel; +} + +void gfx_conv_YCbCr422_RGB32_c(AVFrame *in, AVFrame *out, int width, int height) +{ + uint8 *ybase = (uint8 *)in->data[0]; + uint8 *ubase = (uint8 *)in->data[1]; + uint8 *vbase = (uint8 *)in->data[2]; + + uint32 *rgbbase = (uint32 *)out->data[0]; + + int uv_index; + + for (uint32 i = 0; i < height; i++) { + + uv_index = 0; + + for (uint32 j=0; j < width; j+=2) { + rgbbase[j] = YUV444TORGBA8888(ybase[j] ,ubase[uv_index],vbase[uv_index]); + rgbbase[j+1] = YUV444TORGBA8888(ybase[j+1],ubase[uv_index],vbase[uv_index]); + + uv_index++; + } + + ybase += in->linesize[0]; + ubase += in->linesize[1]; + vbase += in->linesize[2]; + + rgbbase += out->linesize[0] / 4; + } + + if (height & 1) { + // XXX special case for last line if height not multiple of 2 goes here + memset((height - 1) * out->linesize[0] + (uint8 *)out->data[0], 0, width * 4); + } + +} Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.h 2009-02-24 08:00:06 UTC (rev 29305) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_conv_c.h 2009-02-24 08:00:46 UTC (rev 29306) @@ -14,5 +14,6 @@ void gfx_conv_yuv410p_rgb32_c(AVFrame *in, AVFrame *out, int width, int height); void gfx_conv_yuv411p_rgb32_c(AVFrame *in, AVFrame *out, int width, int height); void gfx_conv_YCbCr420p_RGB32_c(AVFrame *in, AVFrame *out, int width, int height); +void gfx_conv_YCbCr422_RGB32_c(AVFrame *in, AVFrame *out, int width, int height); #endif Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp 2009-02-24 08:00:06 UTC (rev 29305) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp 2009-02-24 08:00:46 UTC (rev 29306) @@ -68,6 +68,10 @@ } } + if (pixelFormat == PIX_FMT_YUV422P || pixelFormat == PIX_FMT_YUVJ422P) { + return gfx_conv_YCbCr422_RGB32_c; + } + TRACE("resolve_colorspace: %s => B_RGB32: NULL\n", pixfmt_to_string(pixelFormat)); return NULL; @@ -120,7 +124,7 @@ } } - if (pixelFormat == PIX_FMT_YUV422) { + if (pixelFormat == PIX_FMT_YUV422 || PIX_FMT_YUVJ422P) { #if INCLUDE_MMX if (mmx) { TRACE("resolve_colorspace: PIX_FMT_YUV422 => B_YCbCr422: gfx_conv_null_mmx\n"); @@ -134,7 +138,7 @@ } TRACE("resolve_colorspace: %s => B_YCbCr422: NULL\n", pixfmt_to_string(pixelFormat)); - return NULL; + return gfx_conv_null_c; default: TRACE("resolve_colorspace: default: NULL !!!\n"); @@ -159,6 +163,8 @@ return "PIX_FMT_BGR24"; case PIX_FMT_YUV422P: return "PIX_FMT_YUV422P"; + case PIX_FMT_YUVJ422P: + return "PIX_FMT_YUVJ422P - YUV422P (Jpeg)"; case PIX_FMT_YUV444P: return "PIX_FMT_YUV444P"; case PIX_FMT_RGBA32: From dlmcpaul at mail.berlios.de Tue Feb 24 09:05:19 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Tue, 24 Feb 2009 09:05:19 +0100 Subject: [Haiku-commits] r29307 - haiku/trunk/src/add-ons/media/plugins/mp3_decoder Message-ID: <200902240805.n1O85JDv011487@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-24 09:05:18 +0100 (Tue, 24 Feb 2009) New Revision: 29307 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29307&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.h Log: Seek functionality changes Modified: haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp 2009-02-24 08:00:46 UTC (rev 29306) +++ haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.cpp 2009-02-24 08:05:18 UTC (rev 29307) @@ -103,6 +103,7 @@ fOutputBufferSize = 0; fNeedSync = true; // some files start with garbage fDecodingError = false; + fSampleNo = 0; } @@ -163,19 +164,20 @@ ioDecodedFormat->u.raw_audio.format = media_raw_audio_format::B_AUDIO_SHORT; ioDecodedFormat->u.raw_audio.byte_order = B_MEDIA_HOST_ENDIAN; - int frame_size = (ioDecodedFormat->u.raw_audio.format & 0xf) * ioDecodedFormat->u.raw_audio.channel_count; + fFrameSize = (ioDecodedFormat->u.raw_audio.format & 0xf) * ioDecodedFormat->u.raw_audio.channel_count; if (ioDecodedFormat->u.raw_audio.buffer_size == 0) ioDecodedFormat->u.raw_audio.buffer_size = AudioBufferSize(ioDecodedFormat->u.raw_audio); else - ioDecodedFormat->u.raw_audio.buffer_size = (ioDecodedFormat->u.raw_audio.buffer_size / frame_size) * frame_size; + ioDecodedFormat->u.raw_audio.buffer_size = (ioDecodedFormat->u.raw_audio.buffer_size / fFrameSize) * fFrameSize; if (ioDecodedFormat->u.raw_audio.channel_mask == 0) ioDecodedFormat->u.raw_audio.channel_mask = (fChannelCount == 1) ? B_CHANNEL_LEFT : B_CHANNEL_LEFT | B_CHANNEL_RIGHT; // setup rest of the needed variables - fFrameSize = frame_size; fOutputBufferSize = ioDecodedFormat->u.raw_audio.buffer_size; + TRACE("mp3Decoder::NegotiateOutputFormat: BufferSize %d, FrameSize %d\n", fOutputBufferSize, fFrameSize); + return B_OK; } @@ -187,22 +189,24 @@ { fNeedSync = true; - TRACE("MP3Decoder::Seek called\n"); - if (seekTo == B_MEDIA_SEEK_TO_TIME) { TRACE("MP3Decoder::Seek by time "); - TRACE("from frame %Ld and time %Ld TO Required Time %Ld. ", *frame, *time, seekTime); + TRACE("from frame %Ld and time %.6f TO Required Time %.6f. ", fSampleNo, fStartTime / 1000000.0, seekTime / 1000000.0); - *frame = (int64)(*time / (fFrameSize * 1000000.0 / fFrameRate)); + *frame = (int64)(seekTime * fFrameRate / 1000000LL); + *time = seekTime; } else if (seekTo == B_MEDIA_SEEK_TO_FRAME) { TRACE("MP3Decoder::Seek by Frame "); - TRACE("from Current Time %Ld and frame %Ld TO Required Frame %Ld. ", *time, *frame, seekFrame); + TRACE("from time %.6f and frame %Ld TO Required Frame %Ld. ", fStartTime / 1000000.0, fSampleNo, seekFrame); - *time = (bigtime_t)(*frame * fFrameSize * 1000000.0 / fFrameRate); + *time = (bigtime_t)(seekFrame * 1000000LL / fFrameRate); + *frame = seekFrame; } else return B_BAD_VALUE; - TRACE("so new frame is %Ld at time %Ld\n", *frame, *time); + fSampleNo = *frame; + fStartTime = *time; + TRACE("so new frame is %Ld at time %.6f\n", *frame, *time / 1000000.0); return B_OK; } @@ -217,8 +221,8 @@ int32 out_bytes_needed = fOutputBufferSize; int32 out_bytes = 0; + fStartTime = (bigtime_t)(fSampleNo *1000000LL / fFrameRate); mediaHeader->start_time = fStartTime; - //TRACE("mp3Decoder: Decoding start time %.6f\n", fStartTime / 1000000.0); while (out_bytes_needed > 0) { @@ -228,7 +232,6 @@ InitMP3(&fMpgLibPrivate); fDecodingError = false; fResidualBytes = 0; - mediaHeader->start_time = -1; // fNeedSync is reset in DecodeNextChunk } @@ -244,9 +247,6 @@ out_bytes += bytes; out_bytes_needed -= bytes; - fStartTime += (1000000LL * (bytes / fFrameSize)) / fFrameRate; - - //TRACE("mp3Decoder: fStartTime inc'd to %.6f\n", fStartTime / 1000000.0); continue; } @@ -255,13 +255,12 @@ fDecodingError = true; break; } - if (mediaHeader->start_time == -1) - mediaHeader->start_time = fStartTime; } *frameCount = out_bytes / fFrameSize; + fSampleNo += *frameCount; - TRACE("framecount %Ld, time %Ld\n",*frameCount, mediaHeader->start_time); + TRACE("framecount %Ld, time %.6f\n", *frameCount, mediaHeader->start_time / 1000000.0); return (out_bytes > 0) ? B_OK : last_err; } Modified: haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.h 2009-02-24 08:00:46 UTC (rev 29306) +++ haiku/trunk/src/add-ons/media/plugins/mp3_decoder/mp3DecoderPlugin.h 2009-02-24 08:05:18 UTC (rev 29307) @@ -67,6 +67,7 @@ int fOutputBufferSize; bool fNeedSync; bool fDecodingError; + uint64 fSampleNo; }; From dlmcpaul at mail.berlios.de Tue Feb 24 09:12:30 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Tue, 24 Feb 2009 09:12:30 +0100 Subject: [Haiku-commits] r29308 - in haiku/trunk/src/add-ons/media/plugins/avi_reader: . libOpenDML Message-ID: <200902240812.n1O8CUC2011914@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-24 09:12:27 +0100 (Tue, 24 Feb 2009) New Revision: 29308 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29308&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h Log: First cut at improving avi seeking Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp 2009-02-24 08:12:27 UTC (rev 29308) @@ -65,6 +65,13 @@ // video only: uint32 line_count; + + // audio only: + uint32 sample_size; + uint32 frame_size; + int64 byte_pos; + uint16 bytes_per_second; + bool is_vbr; }; @@ -150,6 +157,9 @@ cookie->buffer_size = 0; cookie->is_audio = false; cookie->is_video = false; + cookie->byte_pos = 0; + cookie->is_vbr = false; + cookie->bytes_per_second = 0; BMediaFormats formats; media_format *format = &cookie->format; @@ -182,6 +192,9 @@ TRACE("audio frame_count %Ld, duration %.6f\n", cookie->frame_count, cookie->duration / 1E6); + cookie->bytes_per_second = audio_format->avg_bytes_per_sec; + cookie->sample_size = stream_header->sample_size == 0 ? audio_format->bits_per_sample / 8 * audio_format->channels : stream_header->sample_size; + if (audio_format->format_tag == 0x0001) { // a raw PCM format description.family = B_BEOS_FORMAT_FAMILY; @@ -205,6 +218,7 @@ format->u.raw_audio.format |= B_AUDIO_FORMAT_CHANNEL_ORDER_WAVE; format->u.raw_audio.byte_order = B_MEDIA_LITTLE_ENDIAN; format->u.raw_audio.buffer_size = stream_header->suggested_buffer_size; + cookie->frame_size = cookie->sample_size; } else { // some encoded format description.family = B_WAV_FORMAT_FAMILY; @@ -214,11 +228,18 @@ format->u.encoded_audio.bit_rate = 8 * audio_format->avg_bytes_per_sec; format->u.encoded_audio.output.frame_rate = audio_format->frames_per_sec; format->u.encoded_audio.output.channel_count = audio_format->channels; - TRACE("audio: bit_rate %.3f, frame_rate %.1f, channel_count %lu\n", + cookie->frame_size = audio_format->block_align == 0 ? 1 : audio_format->block_align; + + // detect vbr audio in avi hack + cookie->is_vbr = cookie->frame_size >= 960; + + TRACE("audio: bit_rate %.3f, frame_rate %.1f, channel_count %lu, frame_size %ld, is vbr %s\n", format->u.encoded_audio.bit_rate, format->u.encoded_audio.output.frame_rate, - format->u.encoded_audio.output.channel_count); + format->u.encoded_audio.output.channel_count, + cookie->frame_size, cookie->is_vbr ? "true" : "false"); } + // TODO: this doesn't seem to work (it's not even a fourcc) format->user_data_type = B_CODEC_TYPE_INFO; *(uint32 *)format->user_data = audio_format->format_tag; format->user_data[4] = 0; @@ -252,6 +273,7 @@ cookie->frames_per_sec_rate = fFile->StreamInfo(streamNumber)->frames_per_sec_rate; cookie->frames_per_sec_scale = fFile->StreamInfo(streamNumber)->frames_per_sec_scale; cookie->line_count = fFile->AviMainHeader()->height; + cookie->frame_size = 1; TRACE("video frame_count %Ld, duration %.6f\n", cookie->frame_count, cookie->duration / 1E6); @@ -338,9 +360,10 @@ status_t aviReader::Seek(void *_cookie, uint32 seekTo, int64 *frame, bigtime_t *time) { + // Seek changes the position of the stream avi_cookie *cookie = (avi_cookie *)_cookie; - TRACE("aviReader::Seek: stream %d, seekTo%s%s%s%s, time %Ld, frame %Ld\n", + TRACE("aviReader::Seek: stream %d, seekTo%s%s%s%s, time %.6f, frame %Ld\n", cookie->stream, (seekTo & B_MEDIA_SEEK_TO_TIME) ? " B_MEDIA_SEEK_TO_TIME" : "", (seekTo & B_MEDIA_SEEK_TO_FRAME) ? " B_MEDIA_SEEK_TO_FRAME" : "", @@ -348,25 +371,29 @@ " B_MEDIA_SEEK_CLOSEST_FORWARD" : "", (seekTo & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "", - *time, *frame); + *time / 1000000.0, *frame); status_t rv = fFile->Seek(cookie->stream, seekTo, frame, time, false); if (rv == B_OK) { cookie->frame_pos = *frame; - TRACE("aviReader::Seek: stream %d, success, setting frame_pos " - "to %lld\n", cookie->stream, cookie->frame_pos); + if (cookie->is_audio && !cookie->is_vbr) { + // calculate byte_pos from time + cookie->byte_pos = *time * cookie->bytes_per_second / 1000000LL; + } + TRACE("aviReader::Seek: stream %d, success, frame_pos = %Ld, time = %.6f\n", cookie->stream, cookie->frame_pos, *time / 1000000.0); } + return rv; } status_t -aviReader::FindKeyFrame(void *_cookie, uint32 flags, int64 *frame, - bigtime_t *time) +aviReader::FindKeyFrame(void *_cookie, uint32 flags, int64 *frame, bigtime_t *time) { + // FindKeyFrame does not change the position of the stream avi_cookie *cookie = (avi_cookie *)_cookie; - TRACE("aviReader::FindKeyFrame: stream %d, flags%s%s%s%s, time %Ld, " + TRACE("aviReader::FindKeyFrame: stream %d, flags%s%s%s%s, time %.6f, " "frame %Ld\n", cookie->stream, (flags & B_MEDIA_SEEK_TO_TIME) ? " B_MEDIA_SEEK_TO_TIME" : "", @@ -375,12 +402,11 @@ " B_MEDIA_SEEK_CLOSEST_FORWARD" : "", (flags & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "", - *time, *frame); + *time / 1000000.0, *frame); status_t rv = fFile->Seek(cookie->stream, flags, frame, time, true); if (rv == B_OK) { - TRACE("aviReader::FindKeyFrame: stream %d, success\n", - cookie->stream); + TRACE("aviReader::FindKeyFrame: stream %d, success\n", cookie->stream); } return rv; } @@ -393,6 +419,7 @@ avi_cookie *cookie = (avi_cookie *)_cookie; int64 start; uint32 size; bool keyframe; + if (fFile->GetNextChunkInfo(cookie->stream, &start, &size, &keyframe) < B_OK) return B_LAST_BUFFER_ERROR; @@ -412,30 +439,41 @@ } } - mediaHeader->start_time = (cookie->frame_pos * 1000000 + mediaHeader->start_time = (cookie->frame_pos * 1000000LL * cookie->frames_per_sec_scale) / cookie->frames_per_sec_rate; + TRACE("stream %d (%s): start_time %.6f, pos %.3f %%, frame %Ld chunk size %ld\n", + cookie->stream, cookie->is_audio ? "A" : cookie->is_video ? "V" : "?", + mediaHeader->start_time / 1000000.0, cookie->frame_pos * 100.0 + / cookie->frame_count, cookie->frame_pos, size); + if (cookie->is_audio) { mediaHeader->type = B_MEDIA_ENCODED_AUDIO; mediaHeader->u.encoded_audio.buffer_flags = keyframe ? B_MEDIA_KEY_FRAME : 0; - cookie->frame_pos += size; + + cookie->frame_pos += (uint64)(ceil((double)size / (double)cookie->frame_size)) * cookie->frames_per_sec_scale; + cookie->byte_pos += size; + // frame_pos is sample no for vbr encoded audio and byte position for everything else +// if (cookie->is_vbr) { + // advance by frame_size +// } else { +// cookie->frame_pos += (uint64)(ceil((double)size / (double)cookie->frame_size)) * cookie->frames_per_sec / cookie->avg_bytes_per_sec; + // advance by bytes in chunk and calculate frame_pos +// time = cookie->byte_pos * 1000000LL / cookie->bytes_per_second; +// cookie->frame_pos = time * cookie->frames_per_sec_rate / cookie->frames_per_sec_scale / 1000000LL; +// } } else if (cookie->is_video) { mediaHeader->type = B_MEDIA_ENCODED_VIDEO; mediaHeader->u.encoded_video.field_flags = keyframe ? B_MEDIA_KEY_FRAME : 0; mediaHeader->u.encoded_video.first_active_line = 0; mediaHeader->u.encoded_video.line_count = cookie->line_count; - cookie->frame_pos += 1; + cookie->frame_pos += cookie->frame_size; } else { return B_BAD_VALUE; } -// TRACE("stream %d (%s): start_time %.6f, pos %.3f %%\n", -// cookie->stream, cookie->is_audio ? "A" : cookie->is_video ? "V" : "?", -// mediaHeader->start_time / 1000000.0, cookie->frame_pos * 100.0 -// / cookie->frame_count); - *chunkBuffer = cookie->buffer; *chunkSize = size; return (int)size == fFile->Source()->ReadAt(start, cookie->buffer, size) ? Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp 2009-02-24 08:12:27 UTC (rev 29308) @@ -23,10 +23,25 @@ * OF THE POSSIBILITY OF SUCH DAMAGE. */ #include +#include #include #include "FallbackIndex.h" +#include "OpenDMLParser.h" +//#define TRACE_START_INDEX +#ifdef TRACE_START_INDEX + #define TRACE printf +#else + #define TRACE(a...) +#endif +#define ERROR(a...) fprintf(stderr, a) + +struct chunk { + uint32 chunk_id; + uint32 size; +}; + FallbackIndex::FallbackIndex(BPositionIO *source, OpenDMLParser *parser) : Index(source, parser) { @@ -41,22 +56,101 @@ status_t FallbackIndex::Init() { - return B_ERROR; -} + // Attempt to build an index by parsing the movi chunk + bool end_of_movi = false; + chunk aChunk; -status_t -FallbackIndex::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, - bool *keyframe) -{ - return B_ERROR; -} + TRACE("Building Fallback index\n"); + int stream_index; + off_t position; + uint32 size; + uint64 frame[fStreamCount]; + uint64 frame_no; + bigtime_t pts = 0; + bool keyframe = false; + uint32 sample_size; + uint64 entries = 0; + + const OpenDMLStream *stream; -status_t -FallbackIndex::Seek(int stream_index, uint32 seekTo, int64 *frame, - bigtime_t *time, bool readOnly) -{ - return B_ERROR; + for (uint32 i=0;i < fStreamCount; i++) { + frame[i] = 0; + } + + position = fParser->MovieListStart(); + + while (end_of_movi == false) { + + if ((int32)8 != fSource->ReadAt(position, &aChunk, 8)) { + ERROR("libOpenDML: FallbackIndex::Init file reading failed\n"); + return B_IO_ERROR; + } + + position += 8; + + stream_index = ((aChunk.chunk_id & 0xff) - '0') * 10; + stream_index += ((aChunk.chunk_id >> 8) & 0xff) - '0'; + + if ((stream_index < 0) || (stream_index >= fStreamCount)) { + if (entries == 0) { + ERROR("libOpenDML: FallbackIndex::Init - Failed to build an index, file is too corrupt\n"); + return B_IO_ERROR; + } else { + ERROR("libOpenDML: FallbackIndex::Init - Error while trying to build index, file is corrupt but will continue after creating %Ld entries in index\n",entries); + return B_OK; + } + } + + entries++; + + stream = fParser->StreamInfo(stream_index); + + size = aChunk.size; + frame_no = frame[stream_index]; + + if (stream->is_video) { + // Video is easy enough, it is always 1 frame = 1 index + pts = frame[stream_index] * 1000000LL * stream->frames_per_sec_scale / stream->frames_per_sec_rate; + frame[stream_index]++; + } else if (stream->is_audio) { + pts = frame[stream_index] * 1000000LL / stream->audio_format->frames_per_sec; + + // Audio varies based on many different hacks over the years + // The simplest is chunk size / sample size = no of samples in the chunk for uncompressed audio + // ABR Compressed audio is more difficult and VBR Compressed audio is even harder + // What follows is what I have worked out from various sources across the internet. + if (stream->audio_format->format_tag != 0x0001) { + // VBR audio is detected as having a block_align >= 960 + if (stream->audio_format->block_align >= 960) { + // VBR Audio so block_align is the largest no of samples in a chunk + // scale is the no of samples in a frame + // rate is the sample rate + // but we must round up when calculating no of frames in a chunk + frame[stream_index] += (uint64)(ceil((double)size / (double)stream->audio_format->block_align)) * stream->frames_per_sec_scale; + } else { + // ABR Audio so use Chunk Size and avergae bytes per second to determine how many samples there are in the chunk + frame[stream_index] += (uint64)(ceil((double)size / (double)stream->audio_format->block_align)) * stream->audio_format->frames_per_sec / stream->audio_format->avg_bytes_per_sec; + } + } else { + // sample size can be corrupt + if (stream->stream_header.sample_size > 0) { + sample_size = stream->stream_header.sample_size; + } else { + // compute sample size + sample_size = stream->audio_format->bits_per_sample * stream->audio_format->channels / 8; + } + frame[stream_index] += size / stream->stream_header.sample_size; + } + } + + AddIndex(stream_index, position, size, frame_no, pts, keyframe); + + position += aChunk.size; + + end_of_movi = position >= fParser->MovieListSize(); + } + + return B_OK; } - Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp 2009-02-24 08:12:27 UTC (rev 29308) @@ -24,15 +24,182 @@ */ #include #include +#include "ReaderPlugin.h" // B_MEDIA_* #include "Index.h" +#include "OpenDMLParser.h" +//#define TRACE_INDEX +#ifdef TRACE_INDEX + #define TRACE printf +#else + #define TRACE(a...) +#endif + +#define ERROR(a...) fprintf(stderr, a) + Index::Index(BPositionIO *source, OpenDMLParser *parser) : fSource(source) , fParser(parser) { + fStreamCount = parser->StreamCount(); + fStreamData.resize(fStreamCount); } - Index::~Index() { + fStreamData.clear(); } + +status_t +Index::GetNextChunkInfo(int stream_index, off_t *start, + uint32 *size, bool *keyframe) { + MediaStream *data = &fStreamData[stream_index]; + + if (data->current_chunk < data->seek_index_next) { + *keyframe = data->seek_index[data->current_chunk].keyframe; + // skip 8 bytes (chunk id + chunk size) + *start = data->seek_index[data->current_chunk].position + 8; + *size = data->seek_index[data->current_chunk].size; + data->current_chunk++; + return B_OK; + } + + data->current_chunk = 0; + + return B_LAST_BUFFER_ERROR; // should this be end of chunk? +} + +status_t +Index::Seek(int stream_index, uint32 seekTo, int64 *frame, + bigtime_t *time, bool readOnly) { + TRACE("Index::Seek: stream %d, seekTo%s%s%s%s, time %Ld, " + "frame %Ld\n", stream_index, + (seekTo & B_MEDIA_SEEK_TO_TIME) ? " B_MEDIA_SEEK_TO_TIME" : "", + (seekTo & B_MEDIA_SEEK_TO_FRAME) ? " B_MEDIA_SEEK_TO_FRAME" : "", + (seekTo & B_MEDIA_SEEK_CLOSEST_FORWARD) ? + " B_MEDIA_SEEK_CLOSEST_FORWARD" : "", + (seekTo & B_MEDIA_SEEK_CLOSEST_BACKWARD) ? + " B_MEDIA_SEEK_CLOSEST_BACKWARD" : "", + *time, *frame); + + const OpenDMLStream *stream = fParser->StreamInfo(stream_index); + MediaStream *data = &fStreamData[stream_index]; + + int64 frame_pos; + if (seekTo & B_MEDIA_SEEK_TO_FRAME) + frame_pos = *frame; + else if (seekTo & B_MEDIA_SEEK_TO_TIME) { + frame_pos = (*time * stream->frames_per_sec_rate) + / (1000000LL * stream->frames_per_sec_scale); + } else + return B_BAD_VALUE; + + if (stream->is_audio) { + // frame_pos is sample no for audio + // Scan index for the chunk that contains the sample no asked for + for (uint32 i = 1; i < data->seek_index_next; i++) { + if (data->seek_index[i].frame_no > frame_pos) { + // previous chunk contains the frame we wanted + // we can only seek to chunk boundaries + frame_pos = data->seek_index[i-1].frame_no; + if (!readOnly) { + data->current_chunk = i-1; // position file to start of chunk + } + goto done; + } + + if (i+1 == data->seek_index_next) { + // Last chunk + frame_pos = data->seek_index[i].frame_no; + if (!readOnly) { + data->current_chunk = i; // position file to start of chunk + } + goto done; + } + } + } else if (stream->is_video) { + // iterate over all index entries of the stream, + // there is one entry per frame (TODO: actually one per field, + // if I interprete the documentation correctly...) + int64 pos = 0; + int64 lastKeyframePos = 0; + int64 lastKeyframeIndex = 0; + for (uint32 i = 0; i < data->seek_index_next; i++) { + // remember the last known keyframe index/frame + if (data->seek_index[i].keyframe) { + lastKeyframePos = pos; + lastKeyframeIndex = i; + TRACE("keyframe at index %ld, frame %ld (seek: %ld)\n", i, + pos, frame_pos); + } + + if (seekTo & B_MEDIA_SEEK_CLOSEST_BACKWARD) { + // use the index and frame of the last keyframe + if (pos == frame_pos) { + frame_pos = lastKeyframePos; + if (!readOnly) + data->current_chunk = lastKeyframeIndex; + goto done; + } + } else if (seekTo & B_MEDIA_SEEK_CLOSEST_FORWARD) { + // use the index and frame of the last keyframe + // if this frame is a keyframe and we at or past + // the seek position + if (pos >= frame_pos && pos == lastKeyframePos) { + frame_pos = lastKeyframePos; + if (!readOnly) + data->current_chunk = lastKeyframeIndex; + goto done; + } + } else { + // ignore keyframes + if (pos == frame_pos) { + if (!readOnly) + data->current_chunk = i; + goto done; + } + } + pos++; + } + } else { + return B_BAD_VALUE; + } + + ERROR("libOpenDML: seek failed, position not found\n"); + return B_ERROR; + +done: + TRACE("seek done: index: pos %d\n", data->current_chunk); + // recalculate frame and time after seek + *frame = frame_pos; + *time = (frame_pos * 1000000LL * stream->frames_per_sec_scale) + / stream->frames_per_sec_rate; + return B_OK; +} + +void +Index::AddIndex(int stream_index, off_t position, uint32 size, uint64 frame, bigtime_t pts, bool keyframe) { + + IndexEntry seek_index; + + // Should be in a constructor + seek_index.frame_no = frame; + seek_index.position = position; + seek_index.size = size; + seek_index.pts = pts; + seek_index.keyframe = keyframe; + + fStreamData[stream_index].seek_index.push_back(seek_index); + fStreamData[stream_index].seek_index_next++; +} + +void +Index::DumpIndex(int stream_index) +{ + IndexEntry _index; + for (uint32 i = 0; i < fStreamData[stream_index].seek_index_next; i++) { + _index = fStreamData[stream_index].seek_index[i]; + printf("Frame %Ld, pos %Ld, size %ld, pts %Ld\n",_index.frame_no, _index.position, _index.size, _index.pts); + } +} + Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h 2009-02-24 08:12:27 UTC (rev 29308) @@ -25,13 +25,46 @@ #ifndef _INDEX_H #define _INDEX_H - #include +#include +/* + This class handles all indexing of an AVI file + Subclasses should override Init and create index entries based on the + specialised index. + + Seek and GetNextChunk will then work. + + Current known subclasses are: + Standard Index - Original AVI index idx1 + OpenDMLIndex - Open DML Standard Index + FallBackIndex - Index created from the movi chunk +*/ + + class BPositionIO; class OpenDMLParser; +class IndexEntry { +public: + IndexEntry() {frame_no = 0;position=0;size=0;pts=0;keyframe=false;}; + + uint64 frame_no; // frame_no or sample_no + off_t position; // The offset in the stream where the frame is + uint32 size; // The size of the data available + bigtime_t pts; // Presentation Time Stamp for this frame + bool keyframe; // Is this a keyframe. +}; +class MediaStream { +public: + MediaStream() {seek_index_next=0;current_chunk=0;} ; + ~MediaStream() {seek_index.clear();}; + std::vector seek_index; + uint64 seek_index_next; + uint64 current_chunk; +}; + class Index { public: Index(BPositionIO *source, OpenDMLParser *parser); @@ -39,14 +72,22 @@ virtual status_t Init() = 0; - virtual status_t GetNextChunkInfo(int stream_index, int64 *start, - uint32 *size, bool *keyframe) = 0; - virtual status_t Seek(int stream_index, uint32 seekTo, int64 *frame, - bigtime_t *time, bool readOnly) = 0; + status_t GetNextChunkInfo(int stream_index, off_t *start, + uint32 *size, bool *keyframe); + status_t Seek(int stream_index, uint32 seekTo, int64 *frame, + bigtime_t *time, bool readOnly); + + void AddIndex(int stream_index, off_t position, uint32 size, uint64 frame, bigtime_t pts, bool keyframe); + void DumpIndex(int stream_index); + protected: BPositionIO * fSource; OpenDMLParser * fParser; + int fStreamCount; + +private: + std::vector fStreamData; }; #endif // _INDEX_H Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp 2009-02-24 08:12:27 UTC (rev 29308) @@ -108,6 +108,7 @@ fIndex = NULL; } } + if (!fIndex && fParser->StandardIndexSize() != 0) { fIndex = new StandardIndex(fSource, fParser); if (fIndex->Init() < B_OK) { @@ -115,6 +116,7 @@ fIndex = NULL; } } + if (!fIndex) { fIndex = new FallbackIndex(fSource, fParser); if (fIndex->Init() < B_OK) { @@ -125,6 +127,8 @@ } } +// fIndex->DumpIndex(1); + TRACE("OpenDMLFile::SetTo: this is a %s AVI file with %d streams\n", fParser->OdmlExtendedHeader() ? "OpenDML" : "standard", fParser->StreamCount()); return B_OK; @@ -385,7 +389,7 @@ status_t -OpenDMLFile::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, +OpenDMLFile::GetNextChunkInfo(int stream_index, off_t *start, uint32 *size, bool *keyframe) { return fIndex->GetNextChunkInfo(stream_index, start, size, keyframe); @@ -470,7 +474,7 @@ &fParser->StreamInfo(stream_index)->stream_header : 0; } -const stream_info * +const OpenDMLStream * OpenDMLFile::StreamInfo(int index) { return fParser->StreamInfo(index); Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h 2009-02-24 08:12:27 UTC (rev 29308) @@ -41,7 +41,7 @@ int StreamCount(); - const stream_info * StreamInfo(int index); + const OpenDMLStream * StreamInfo(int index); /* bigtime_t Duration(); @@ -57,7 +57,7 @@ const bitmap_info_header * VideoFormat(int stream_index); const avi_stream_header * StreamFormat(int stream_index); - status_t GetNextChunkInfo(int stream_index, int64 *start, + status_t GetNextChunkInfo(int stream_index, off_t *start, uint32 *size, bool *keyframe); status_t Seek(int stream_index, uint32 seekTo, int64 *frame, bigtime_t *time, bool readOnly); Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp 2009-02-24 08:12:27 UTC (rev 29308) @@ -43,21 +43,3 @@ { return B_ERROR; } - - -status_t -OpenDMLIndex::GetNextChunkInfo(int stream_index, int64 *start, uint32 *size, - bool *keyframe) -{ - return B_ERROR; -} - - -status_t -OpenDMLIndex::Seek(int stream_index, uint32 seekTo, int64 *frame, - bigtime_t *time, bool readOnly) -{ - return B_ERROR; -} - - Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h 2009-02-24 08:12:27 UTC (rev 29308) @@ -34,11 +34,6 @@ ~OpenDMLIndex(); status_t Init(); - - status_t GetNextChunkInfo(int stream_index, int64* start, - uint32* size, bool* keyframe); - status_t Seek(int stream_index, uint32 seekTo, int64* frame, - bigtime_t* time, bool readOnly); }; #endif Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2009-02-24 08:12:27 UTC (rev 29308) @@ -27,7 +27,7 @@ #include "OpenDMLParser.h" #include "avi.h" -//#define TRACE_ODML_PARSER +#define TRACE_ODML_PARSER #ifdef TRACE_ODML_PARSER #define TRACE printf #else @@ -68,16 +68,13 @@ return fStreamCount; } -const stream_info * +const OpenDMLStream * OpenDMLParser::StreamInfo(int index) { if (index < 0 || index >= fStreamCount) return NULL; - stream_info *info = fStreams; - while (index--) - info = info->next; - return info; + return &fStreams[index]; } int64 @@ -113,30 +110,23 @@ void OpenDMLParser::CreateNewStreamInfo() { - stream_info *info = new stream_info; - info->next = 0; - info->is_audio = false; - info->is_video = false; - info->stream_header_valid = false; - info->audio_format = 0; - info->video_format_valid = false; - info->odml_index_start = 0; - info->odml_index_size = 0; - info->duration = 0; - info->frame_count = 0; - info->frames_per_sec_rate = 1; - info->frames_per_sec_scale = 1; + OpenDMLStream info; + + info.is_audio = false; + info.is_video = false; + info.stream_header_valid = false; + info.audio_format = 0; + info.video_format_valid = false; + info.odml_index_start = 0; + info.odml_index_size = 0; + info.duration = 0; + info.frame_count = 0; + info.frames_per_sec_rate = 1; + info.frames_per_sec_scale = 1; - // append the new stream_info to the fStreams list and point fCurrentStream to it - if (fStreams) { - stream_info *cur = fStreams; - while (cur->next) - cur = cur->next; - cur->next = info; - } else { - fStreams = info; - } - fCurrentStream = info; + fStreams.push_back(info); + + fCurrentStream = fStreams.last(); } status_t @@ -176,13 +166,13 @@ #endif for (int i = 0; i < fStreamCount; i++) { - SetupStreamLength(const_cast(StreamInfo(i))); + SetupStreamLength(const_cast(StreamInfo(i))); } return B_OK; } void -OpenDMLParser::SetupStreamLength(stream_info *stream) +OpenDMLParser::SetupStreamLength(OpenDMLStream *stream) { if (stream->is_audio) SetupAudioStreamLength(stream); @@ -193,7 +183,7 @@ // F:\avi-info\Information on AVI file.htm void -OpenDMLParser::SetupAudioStreamLength(stream_info *stream) +OpenDMLParser::SetupAudioStreamLength(OpenDMLStream *stream) { stream->frame_count = stream->stream_header.length; @@ -201,43 +191,50 @@ && stream->stream_header.sample_size != 0 && stream->stream_header.sample_size != 1) { // PCM stream->frame_count /= (stream->stream_header.sample_size + 7) / 8; - TRACE("audio: messing up PCM frame_count?\n"); + TRACE("audio: messed up PCM frame_count?\n"); } if (stream->stream_header.rate && stream->stream_header.scale) { stream->frames_per_sec_rate = stream->stream_header.rate; stream->frames_per_sec_scale = stream->stream_header.scale; - stream->duration = (stream->frame_count * stream->frames_per_sec_scale * 1000000) / stream->frames_per_sec_rate; - TRACE("audio: using rate+scale\n"); + stream->duration = (stream->frame_count * stream->frames_per_sec_scale * 1000000LL) / stream->frames_per_sec_rate; + TRACE("audio: duration calculated using rate+scale\n"); } else if (stream->audio_format->avg_bytes_per_sec) { stream->frames_per_sec_rate = stream->audio_format->avg_bytes_per_sec; stream->frames_per_sec_scale = 1; - stream->duration = (stream->frame_count * stream->frames_per_sec_scale * 1000000) / stream->frames_per_sec_rate; - TRACE("audio: using avg_bytes_per_sec\n"); + stream->duration = (stream->frame_count * stream->frames_per_sec_scale * 1000000LL) / stream->frames_per_sec_rate; + TRACE("audio: duration calculated using avg_bytes_per_sec\n"); } else if (AviMainHeader()->micro_sec_per_frame) { uint32 video_frame_count = OdmlExtendedHeader() ? OdmlExtendedHeader()->total_frames : AviMainHeader()->total_frames; stream->duration = video_frame_count * AviMainHeader()->micro_sec_per_frame; - stream->frames_per_sec_rate = (stream->frame_count * 1000 * 1000000) / stream->duration; + stream->frames_per_sec_rate = (stream->frame_count * 1000 * 1000000LL) / stream->duration; stream->frames_per_sec_scale = 1000; - TRACE("audio: using micro_sec_per_frame\n"); + TRACE("audio: duration calculated using micro_sec_per_frame\n"); } else { - TRACE("audio: no idea what to do\n"); + TRACE("audio: duration could not be calculated no idea what to do\n"); } - if (stream->audio_format->avg_bytes_per_sec) { - int64 expectedFrameCount - = (stream->duration * stream->audio_format->avg_bytes_per_sec) - / 1000000; - TRACE("audio: expected frame_count %lld, calculated stream " - "frame_count %lld\n", expectedFrameCount, stream->frame_count); - if (expectedFrameCount * 9 > stream->frame_count * 10) { - TRACE("audio: something is wrong, ignoring calculated stream " - "frame_count, rate and scale\n"); - stream->frame_count = expectedFrameCount; - stream->frames_per_sec_rate - = stream->audio_format->avg_bytes_per_sec; + // The stream details are often wrong, if there is a audio format structure we attempt to use that + if (stream->audio_format->format_tag == 0x0001) { // RAW PCM + if (stream->audio_format->avg_bytes_per_sec) { + int64 expectedFrameCount + = (stream->duration * stream->audio_format->avg_bytes_per_sec) + / 1000000; + TRACE("audio: expected frame_count %lld, stream " + "frame_count %lld\n", expectedFrameCount, stream->frame_count); + if (expectedFrameCount * 9 > stream->frame_count * 10) { + TRACE("audio: something is wrong, ignoring stream frame_count\n"); + stream->frame_count = expectedFrameCount; + } + + stream->frames_per_sec_rate = stream->audio_format->avg_bytes_per_sec; stream->frames_per_sec_scale = 1; } + } else { + // encoded format usually has audio format details correct so always use them +// stream->frames_per_sec_rate = stream->audio_format->frames_per_sec; +// stream->frames_per_sec_scale = 1; + stream->frame_count = stream->duration * stream->audio_format->frames_per_sec / 1000000LL; } TRACE("audio: frame_count %lld, duration %.6f, fps %.3f\n", @@ -246,7 +243,7 @@ } void -OpenDMLParser::SetupVideoStreamLength(stream_info *stream) +OpenDMLParser::SetupVideoStreamLength(OpenDMLStream *stream) { stream->frame_count = stream->stream_header.length; if (stream->stream_header.rate && stream->stream_header.scale) { @@ -410,8 +407,8 @@ } if (Chunksize == 0) { - ERROR("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc)); - return B_ERROR; + TRACE("OpenDMLParser::ParseChunk_AVI: chunk '"FOURCC_FORMAT"' has size 0\n", FOURCC_PARAM(Chunkfcc)); + return B_OK; } if (Chunkfcc == FOURCC('L','I','S','T')) { @@ -893,8 +890,10 @@ { TRACE("OpenDMLParser::ParseList_movi, size %lu\n", size); - if (fMovieListStart == 0) + if (fMovieListStart == 0) { fMovieListStart = start; + fMovieListSize = size; + } fMovieChunkCount++; return B_OK; Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2009-02-24 08:05:18 UTC (rev 29307) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2009-02-24 08:12:27 UTC (rev 29308) @@ -26,19 +26,30 @@ #define _OPEN_DML_PARSER_H #include +#include + #include "avi.h" -struct stream_info +class OpenDMLStream { - stream_info * next; // TODO: replace with a vector<> +public: + OpenDMLStream(); + ~OpenDMLStream(); + bool is_audio; bool is_video; + bool is_subtitle; + bool stream_header_valid; avi_stream_header stream_header; + + bool audio_format_valid; wave_format_ex *audio_format; size_t audio_format_size; + bool video_format_valid; bitmap_info_header video_format; + int64 odml_index_start; uint32 odml_index_size; @@ -58,12 +69,13 @@ int StreamCount(); - const stream_info * StreamInfo(int index); + const OpenDMLStream * StreamInfo(int index); int64 StandardIndexStart(); uint32 StandardIndexSize(); int64 MovieListStart(); + uint32 MovieListSize() {return fMovieListSize;}; const avi_main_header * AviMainHeader(); const odml_extended_header * OdmlExtendedHeader(); @@ -85,16 +97,18 @@ status_t ParseList_strl(uint64 start, uint32 size); void CreateNewStreamInfo(); - void SetupStreamLength(stream_info *stream); - void SetupAudioStreamLength(stream_info *stream); - void SetupVideoStreamLength(stream_info *stream); + void SetupStreamLength(OpenDMLStream *stream); + void SetupAudioStreamLength(OpenDMLStream *stream); + void SetupVideoStreamLength(OpenDMLStream *stream); private: [... truncated: 385 lines follow ...] From superstippi at gmx.de Tue Feb 24 11:39:23 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Tue, 24 Feb 2009 11:39:23 +0100 Subject: [Haiku-commits] r29308 - in haiku/trunk/src/add-ons/media/plugins/avi_reader: . libOpenDML In-Reply-To: <200902240812.n1O8CUC2011914@sheep.berlios.de> References: <200902240812.n1O8CUC2011914@sheep.berlios.de> Message-ID: <49A3CE5B.9080500@gmx.de> dlmcpaul at BerliOS schrieb: > Author: dlmcpaul > Date: 2009-02-24 09:12:27 +0100 (Tue, 24 Feb 2009) > New Revision: 29308 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29308&view=rev > > Modified: > haiku/trunk/src/add-ons/media/plugins/avi_reader/avi_reader.cpp > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/FallbackIndex.cpp > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.cpp > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/Index.h > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.cpp > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLFile.h > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.cpp > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLIndex.h > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.cpp > haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/StandardIndex.h > Log: > First cut at improving avi seeking Cool stuff, David! Best regards, -Stephan From stippi at mail.berlios.de Tue Feb 24 11:50:49 2009 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 24 Feb 2009 11:50:49 +0100 Subject: [Haiku-commits] r29309 - haiku/trunk/src/servers/app Message-ID: <200902241050.n1OAoncL018578@sheep.berlios.de> Author: stippi Date: 2009-02-24 11:50:47 +0100 (Tue, 24 Feb 2009) New Revision: 29309 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29309&view=rev Modified: haiku/trunk/src/servers/app/View.cpp Log: * When painting the view background bitmap, make sure to do this with a reasonable drawing mode. Otherwise the current graphics state setup may not be what we need. * Automatic white space cleanup. Modified: haiku/trunk/src/servers/app/View.cpp =================================================================== --- haiku/trunk/src/servers/app/View.cpp 2009-02-24 08:12:27 UTC (rev 29308) +++ haiku/trunk/src/servers/app/View.cpp 2009-02-24 10:50:47 UTC (rev 29309) @@ -333,7 +333,7 @@ count += child->CountChildren(deep); } } - return count; + return count; } @@ -490,7 +490,7 @@ View::SetUserClipping(const BRegion* region) { fDrawState->SetClippingRegion(region); - + // rebuild clipping (for just this view) RebuildClipping(false); } @@ -667,7 +667,7 @@ fScrollingOffset.y - fFrame.top); } -//! converts a point from local to screen coordinate system +//! converts a point from local to screen coordinate system void View::ConvertToScreen(BPoint* pt) const { @@ -678,7 +678,7 @@ } -//! converts a point from local to screen coordinate system +//! converts a point from local to screen coordinate system void View::ConvertToScreen(IntPoint* pt) const { @@ -689,7 +689,7 @@ } -//! converts a rect from local to screen coordinate system +//! converts a rect from local to screen coordinate system void View::ConvertToScreen(BRect* rect) const { @@ -700,7 +700,7 @@ } -//! converts a rect from local to screen coordinate system +//! converts a rect from local to screen coordinate system void View::ConvertToScreen(IntRect* rect) const { @@ -711,7 +711,7 @@ } -//! converts a region from local to screen coordinate system +//! converts a region from local to screen coordinate system void View::ConvertToScreen(BRegion* region) const { @@ -722,7 +722,7 @@ } -//! converts a point from screen to local coordinate system +//! converts a point from screen to local coordinate system void View::ConvertFromScreen(BPoint* pt) const { @@ -733,7 +733,7 @@ } -//! converts a point from screen to local coordinate system +//! converts a point from screen to local coordinate system void View::ConvertFromScreen(IntPoint* pt) const { @@ -744,7 +744,7 @@ } -//! converts a rect from screen to local coordinate system +//! converts a rect from screen to local coordinate system void View::ConvertFromScreen(BRect* rect) const { @@ -755,7 +755,7 @@ } -//! converts a rect from screen to local coordinate system +//! converts a rect from screen to local coordinate system void View::ConvertFromScreen(IntRect* rect) const { @@ -766,7 +766,7 @@ } -//! converts a region from screen to local coordinate system +//! converts a region from screen to local coordinate system void View::ConvertFromScreen(BRegion* region) const { @@ -777,7 +777,7 @@ } -//! converts a point from local *drawing* to screen coordinate system +//! converts a point from local *drawing* to screen coordinate system void View::ConvertToScreenForDrawing(BPoint* point) const { @@ -788,7 +788,7 @@ } -//! converts a rect from local *drawing* to screen coordinate system +//! converts a rect from local *drawing* to screen coordinate system void View::ConvertToScreenForDrawing(BRect* rect) const { @@ -875,7 +875,7 @@ } -//! converts points from local *drawing* to screen coordinate system +//! converts points from local *drawing* to screen coordinate system void View::ConvertToScreenForDrawing(BPoint* dst, const BPoint* src, int32 num) const { @@ -892,7 +892,7 @@ } -//! converts rects from local *drawing* to screen coordinate system +//! converts rects from local *drawing* to screen coordinate system void View::ConvertToScreenForDrawing(BRect* dst, const BRect* src, int32 num) const { @@ -909,7 +909,7 @@ } -//! converts regions from local *drawing* to screen coordinate system +//! converts regions from local *drawing* to screen coordinate system void View::ConvertToScreenForDrawing(BRegion* dst, const BRegion* src, int32 num) const { @@ -926,7 +926,7 @@ } -//! converts a point from screen to local coordinate system +//! converts a point from screen to local coordinate system void View::ConvertFromScreenForDrawing(BPoint* point) const { @@ -1352,6 +1352,9 @@ if (rect.IsValid()/* && drawingEngine->Lock()*/) { drawingEngine->ConstrainClippingRegion(redraw); + drawing_mode oldMode; + drawingEngine->SetDrawingMode(B_OP_COPY, oldMode); + if (fBitmapOptions & B_TILE_BITMAP) { // tile across entire view @@ -1398,6 +1401,8 @@ redraw->Exclude(rect); } + drawingEngine->SetDrawingMode(oldMode); + // NOTE: It is ok not to reset the clipping, that // would only waste time // drawingEngine->Unlock(); From marcusoverhagen at arcor.de Tue Feb 24 12:04:03 2009 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Tue, 24 Feb 2009 12:04:03 +0100 (CET) Subject: [Haiku-commits] r29306 - haiku/trunk/src/add-ons/media/plugins/avcodec In-Reply-To: <200902240800.n1O80lUA010977@sheep.berlios.de> References: <200902240800.n1O80lUA010977@sheep.berlios.de> Message-ID: <1983263.1235473443208.JavaMail.ngmail@webmail12.arcor-online.net> > - if (pixelFormat == PIX_FMT_YUV422) { > + if (pixelFormat == PIX_FMT_YUV422 || PIX_FMT_YUVJ422P) { oops whats this? Marcus Erwischt! Bei Arcor sehen Sie die besten Promi-Bilder riesengro? und in Top-Qualit?t. Hier finden Sie die sch?nsten Schnappsch?sse auf dem roten Teppich, lernen die Frauen des Womanizers Boris Becker kennen und schauen den Royals ins Wohnzimmer. Viel Spa? auf Ihrer virtuellen Reise durch die Welt der Stars und Sternchen: http://vip.arcor.de. From stippi at mail.berlios.de Tue Feb 24 12:07:22 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 24 Feb 2009 12:07:22 +0100 Subject: [Haiku-commits] r29310 - haiku/trunk/src/kits/tracker Message-ID: <200902241107.n1OB7MkC019900@sheep.berlios.de> Author: stippi Date: 2009-02-24 12:07:22 +0100 (Tue, 24 Feb 2009) New Revision: 29310 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29310&view=rev Modified: haiku/trunk/src/kits/tracker/TextWidget.cpp Log: Improved the look of the icon label outline, at least the white text version should look much better now. Not so sure about the dark text version, but if you don't want that, just make sure your desktop bg color is dark enough to get white text. Modified: haiku/trunk/src/kits/tracker/TextWidget.cpp =================================================================== --- haiku/trunk/src/kits/tracker/TextWidget.cpp 2009-02-24 10:50:47 UTC (rev 29309) +++ haiku/trunk/src/kits/tracker/TextWidget.cpp 2009-02-24 11:07:22 UTC (rev 29310) @@ -517,33 +517,55 @@ // draw a halo around the text by using the "false bold" // feature for text rendering. Either black or white is used for // the glow (whatever acts as contrast) with a some alpha value, - // two passes are used to achive a blur effect drawView->SetDrawingMode(B_OP_ALPHA); drawView->SetBlendingMode(B_CONSTANT_ALPHA, B_ALPHA_OVERLAY); BFont font; drawView->GetFont(&font); -// NOTE: commented out first pass for halo, since just a plain -// outline looks better IMHO -stippi -// font.SetFalseBoldWidth(2.0); -// drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + rgb_color textColor = drawView->HighColor(); - rgb_color glow = textColor.red - + textColor.green + textColor.blue > 128 * 3 ? kBlack : kWhite; -// glow.alpha = 40; -// drawView->SetHighColor(glow); + rgb_color outlineColor; + if (textColor.red + textColor.green + textColor.blue < 128 * 3) { + // dark text on light outline + rgb_color glowColor = kWhite; -// drawView->DrawString(fittingText, loc); + font.SetFalseBoldWidth(2.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + glowColor.alpha = 30; + drawView->SetHighColor(glowColor); - font.SetFalseBoldWidth(1.0); - drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); - glow.alpha = 220; - drawView->SetHighColor(glow); + drawView->DrawString(fittingText, loc); - drawView->DrawString(fittingText, loc); + font.SetFalseBoldWidth(1.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + glowColor.alpha = 65; + drawView->SetHighColor(glowColor); - font.SetFalseBoldWidth(0.0); - drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + drawView->DrawString(fittingText, loc); + + font.SetFalseBoldWidth(0.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + } else { + // light text on dark outline + rgb_color outlineColor = kBlack; + + font.SetFalseBoldWidth(1.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + outlineColor.alpha = 30; + drawView->SetHighColor(outlineColor); + + drawView->DrawString(fittingText, loc); + + font.SetFalseBoldWidth(0.0); + drawView->SetFont(&font, B_FONT_FALSE_BOLD_WIDTH); + + outlineColor.alpha = 200; + drawView->SetHighColor(outlineColor); + + drawView->DrawString(fittingText, loc + BPoint(1, 1)); + } + + drawView->SetDrawingMode(B_OP_OVER); drawView->SetHighColor(textColor); } #endif // __HAIKU__ From stippi at mail.berlios.de Tue Feb 24 12:09:27 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 24 Feb 2009 12:09:27 +0100 Subject: [Haiku-commits] r29311 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200902241109.n1OB9R2b020091@sheep.berlios.de> Author: stippi Date: 2009-02-24 12:09:27 +0100 (Tue, 24 Feb 2009) New Revision: 29311 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29311&view=rev Modified: haiku/trunk/headers/os/interface/ControlLook.h haiku/trunk/src/kits/interface/ControlLook.cpp Log: Improved the look of the slider triangle thumb. Still missing is the vertical version. Modified: haiku/trunk/headers/os/interface/ControlLook.h =================================================================== --- haiku/trunk/headers/os/interface/ControlLook.h 2009-02-24 11:07:22 UTC (rev 29310) +++ haiku/trunk/headers/os/interface/ControlLook.h 2009-02-24 11:09:27 UTC (rev 29311) @@ -153,11 +153,17 @@ const rgb_color& base, uint32 flags, enum orientation orientation); - virtual void DrawSliderTriangle(BView* view, BRect& rect, + void DrawSliderTriangle(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, uint32 flags, enum orientation orientation); + virtual void DrawSliderTriangle(BView* view, BRect& rect, + const BRect& updateRect, + const rgb_color& base, + const rgb_color& fill, uint32 flags, + enum orientation orientation); + virtual void DrawSliderHashMarks(BView* view, BRect& rect, const BRect& updateRect, const rgb_color& base, int32 count, Modified: haiku/trunk/src/kits/interface/ControlLook.cpp =================================================================== --- haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-24 11:07:22 UTC (rev 29310) +++ haiku/trunk/src/kits/interface/ControlLook.cpp 2009-02-24 11:09:27 UTC (rev 29311) @@ -932,6 +932,15 @@ const BRect& updateRect, const rgb_color& base, uint32 flags, enum orientation orientation) { + DrawSliderTriangle(view, rect, updateRect, base, base, flags, orientation); +} + + +void +BControlLook::DrawSliderTriangle(BView* view, BRect& rect, + const BRect& updateRect, const rgb_color& base, const rgb_color& fill, + uint32 flags, enum orientation orientation) +{ if (!rect.IsValid() || !rect.Intersects(updateRect)) return; @@ -980,94 +989,53 @@ frameShadowColor = tint_color(base, frameShadowTint); } -// BRect originalRect(rect); -// rect.right--; -// rect.bottom--; + // make room for the shadow + rect.right--; + rect.bottom--; - float center = (rect.left + rect.right) / 2; - -// BShape shape; -// shape.MoveTo(BPoint(rect.left + 0.5, rect.bottom + 0.5)); -// shape.LineTo(BPoint(rect.right + 0.5, rect.bottom + 0.5)); -// shape.LineTo(BPoint(rect.right + 0.5, rect.bottom - 1 + 0.5)); -// shape.LineTo(BPoint(rect.right + 0.5, rect.bottom - 1 + 0.5)); -// shape.LineTo(BPoint(center + 0.5, rect.top + 0.5)); -// shape.LineTo(BPoint(rect.left + 0.5, rect.bottom - 1 + 0.5)); -// shape.Close(); -// -// BGradientLinear gradient; -// gradient.AddColor(frameLightColor, 0); -// gradient.AddColor(frameShadowColor, 255); -// gradient.SetStart(rect.LeftTop()); -// gradient.SetEnd(rect.RightBottom()); -// -// view->SetHighColor(frameLightColor); -// view->StrokeShape(&shape); -// -// view->StrokeRect(rect); - uint32 viewFlags = view->Flags(); view->SetFlags(viewFlags | B_SUBPIXEL_PRECISE); view->SetLineMode(B_ROUND_CAP, B_ROUND_JOIN); - BPoint triangle[3]; - triangle[0] = BPoint(rect.left + 0.5, rect.bottom - 1 + 0.5); - triangle[1] = BPoint(rect.right + 0.5, rect.bottom - 1 + 0.5); - triangle[2] = BPoint(center + 0.5, rect.top + 0.5); + float center = (rect.left + rect.right) / 2; + BShape shape; + shape.MoveTo(BPoint(rect.left + 0.5, rect.bottom + 0.5)); + shape.LineTo(BPoint(rect.right + 0.5, rect.bottom + 0.5)); + shape.LineTo(BPoint(rect.right + 0.5, rect.bottom - 1 + 0.5)); + shape.LineTo(BPoint(center + 0.5, rect.top + 0.5)); + shape.LineTo(BPoint(rect.left + 0.5, rect.bottom - 1 + 0.5)); + shape.Close(); + + view->MovePenTo(BPoint(1, 1)); + + view->SetDrawingMode(B_OP_ALPHA); + view->SetHighColor(shadowColor); + view->StrokeShape(&shape); + + view->MovePenTo(B_ORIGIN); + + view->SetDrawingMode(B_OP_COPY); view->SetHighColor(frameLightColor); - view->StrokeTriangle(triangle[0], triangle[1], triangle[2]); - view->StrokeLine(BPoint(rect.left, rect.bottom), - BPoint(rect.right + 1, rect.bottom)); + view->StrokeShape(&shape); rect.InsetBy(1, 1); + shape.Clear(); + shape.MoveTo(BPoint(rect.left, rect.bottom + 1)); + shape.LineTo(BPoint(rect.right + 1, rect.bottom + 1)); + shape.LineTo(BPoint(center + 0.5, rect.top)); + shape.Close(); - triangle[0] = BPoint(rect.left, rect.bottom); - triangle[1] = BPoint(rect.right + 1, rect.bottom); - triangle[2] = BPoint(center, rect.top); - BGradientLinear gradient; if (flags & B_DISABLED) { - _MakeGradient(gradient, rect, base, topTint, bottomTint); + _MakeGradient(gradient, rect, fill, topTint, bottomTint); } else { - _MakeGlossyGradient(gradient, rect, base, topTint, middleTint1, + _MakeGlossyGradient(gradient, rect, fill, topTint, middleTint1, middleTint2, bottomTint); } - view->FillTriangle(triangle[0], triangle[1], triangle[2], gradient); + view->FillShape(&shape, gradient); - -// -// _DrawFrame(view, rect, frameLightColor, frameLightColor, -// frameShadowColor, frameShadowColor); -// -// flags &= ~B_ACTIVATED; -// DrawButtonBackground(view, rect, updateRect, base, flags); -// -// // thumb shadow -// view->SetDrawingMode(B_OP_ALPHA); -// view->SetHighColor(shadowColor); -// originalRect.left++; -// originalRect.top++; -// view->StrokeLine(originalRect.LeftBottom(), originalRect.RightBottom()); -// originalRect.bottom--; -// view->StrokeLine(originalRect.RightTop(), originalRect.RightBottom()); -// -// // thumb edge -// rect.InsetBy(0, 2); -// rect.left = floorf((rect.left + rect.right) / 2); -// rect.right = rect.left + 1; -// shadowColor = tint_color(base, B_DARKEN_2_TINT); -// shadowColor.alpha = 128; -// view->SetHighColor(shadowColor); -// view->StrokeLine(rect.LeftTop(), rect.LeftBottom()); -// rgb_color lightColor = tint_color(base, B_LIGHTEN_2_TINT); -// lightColor.alpha = 128; -// view->SetHighColor(lightColor); -// view->StrokeLine(rect.RightTop(), rect.RightBottom()); -// -// view->SetDrawingMode(B_OP_COPY); - view->SetFlags(viewFlags); } From stippi at mail.berlios.de Tue Feb 24 13:15:50 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 24 Feb 2009 13:15:50 +0100 Subject: [Haiku-commits] r29312 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML Message-ID: <200902241215.n1OCFo8C007900@sheep.berlios.de> Author: stippi Date: 2009-02-24 13:15:40 +0100 (Tue, 24 Feb 2009) New Revision: 29312 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29312&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h Log: Fix GCC 4 build. Implemented constructors/destructors and standard operators. Hopefully, I am not stepping on your toes, David! Please check these changes, I've added some TODOs where problems may be lurking. Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2009-02-24 11:09:27 UTC (rev 29311) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp 2009-02-24 12:15:40 UTC (rev 29312) @@ -42,6 +42,67 @@ #endif +OpenDMLStream::OpenDMLStream() + : + is_audio(false), + is_video(false), + is_subtitle(false), + stream_header_valid(false), + audio_format_valid(false), + audio_format(NULL), + audio_format_size(0), + video_format_valid(false), + odml_index_start(0), + odml_index_size(0), + duration(0), + frame_count(0), + frames_per_sec_rate(1), + frames_per_sec_scale(1) +{ +} + + +OpenDMLStream::OpenDMLStream(const OpenDMLStream& other) +{ + *this = other; +} + + +OpenDMLStream::~OpenDMLStream() +{ +} + + +OpenDMLStream& +OpenDMLStream::operator=(const OpenDMLStream& other) +{ + // TODO: implement for real + if (&other != this) + memcpy(this, &other, sizeof(OpenDMLStream)); + return *this; +} + + +bool +OpenDMLStream::operator==(const OpenDMLStream& other) const +{ + // TODO: should probably check "valid" flags + if (this == &other) + return true; + return memcmp(this, &other, sizeof(OpenDMLStream)) == 0; +} + + +bool +OpenDMLStream::operator!=(const OpenDMLStream& other) const +{ + return !(*this == other); +} + + +// #pragma mark - + + OpenDMLParser::OpenDMLParser(BPositionIO *source) : fSource(source), fSize(source->Seek(0, SEEK_END)), @@ -111,22 +172,9 @@ OpenDMLParser::CreateNewStreamInfo() { OpenDMLStream info; - - info.is_audio = false; - info.is_video = false; - info.stream_header_valid = false; - info.audio_format = 0; - info.video_format_valid = false; - info.odml_index_start = 0; - info.odml_index_size = 0; - info.duration = 0; - info.frame_count = 0; - info.frames_per_sec_rate = 1; - info.frames_per_sec_scale = 1; - fStreams.push_back(info); - fCurrentStream = fStreams.last(); + fCurrentStream = &fStreams[fStreams.size() - 1];// fStreams.last(); } status_t Modified: haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2009-02-24 11:09:27 UTC (rev 29311) +++ haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h 2009-02-24 12:15:40 UTC (rev 29312) @@ -30,100 +30,103 @@ #include "avi.h" -class OpenDMLStream -{ +class OpenDMLStream { public: - OpenDMLStream(); - ~OpenDMLStream(); + OpenDMLStream(); + OpenDMLStream(const OpenDMLStream& other); + virtual ~OpenDMLStream(); + + OpenDMLStream& operator=(const OpenDMLStream& other); + bool operator==(const OpenDMLStream& other) const; + bool operator!=(const OpenDMLStream& other) const; - bool is_audio; - bool is_video; - bool is_subtitle; + bool is_audio; + bool is_video; + bool is_subtitle; - bool stream_header_valid; - avi_stream_header stream_header; + bool stream_header_valid; + avi_stream_header stream_header; - bool audio_format_valid; - wave_format_ex *audio_format; - size_t audio_format_size; + bool audio_format_valid; + wave_format_ex* audio_format; + size_t audio_format_size; - bool video_format_valid; - bitmap_info_header video_format; + bool video_format_valid; + bitmap_info_header video_format; - int64 odml_index_start; - uint32 odml_index_size; + int64 odml_index_start; + uint32 odml_index_size; - bigtime_t duration; - int64 frame_count; - uint32 frames_per_sec_rate; - uint32 frames_per_sec_scale; + bigtime_t duration; + int64 frame_count; + uint32 frames_per_sec_rate; + uint32 frames_per_sec_scale; }; -class OpenDMLParser -{ +class OpenDMLParser { public: - OpenDMLParser(BPositionIO *source); - ~OpenDMLParser(); + OpenDMLParser(BPositionIO *source); + virtual ~OpenDMLParser(); - status_t Init(); + status_t Init(); - int StreamCount(); + int StreamCount(); - const OpenDMLStream * StreamInfo(int index); + const OpenDMLStream* StreamInfo(int index); - int64 StandardIndexStart(); - uint32 StandardIndexSize(); + int64 StandardIndexStart(); + uint32 StandardIndexSize(); - int64 MovieListStart(); - uint32 MovieListSize() {return fMovieListSize;}; + int64 MovieListStart(); + uint32 MovieListSize() {return fMovieListSize;}; - const avi_main_header * AviMainHeader(); - const odml_extended_header * OdmlExtendedHeader(); + const avi_main_header* AviMainHeader(); + const odml_extended_header* OdmlExtendedHeader(); private: - status_t Parse(); - status_t ParseChunk_AVI(int number, uint64 start, uint32 size); - status_t ParseChunk_LIST(uint64 start, uint32 size); - status_t ParseChunk_idx1(uint64 start, uint32 size); - status_t ParseChunk_indx(uint64 start, uint32 size); - status_t ParseChunk_avih(uint64 start, uint32 size); - status_t ParseChunk_strh(uint64 start, uint32 size); - status_t ParseChunk_strf(uint64 start, uint32 size); - status_t ParseChunk_strn(uint64 start, uint32 size); - status_t ParseChunk_dmlh(uint64 start, uint32 size); - status_t ParseList_movi(uint64 start, uint32 size); - status_t ParseList_generic(uint64 start, uint32 size); - status_t ParseList_INFO(uint64 start, uint32 size); - status_t ParseList_strl(uint64 start, uint32 size); + status_t Parse(); + status_t ParseChunk_AVI(int number, uint64 start, + uint32 size); + status_t ParseChunk_LIST(uint64 start, uint32 size); + status_t ParseChunk_idx1(uint64 start, uint32 size); + status_t ParseChunk_indx(uint64 start, uint32 size); + status_t ParseChunk_avih(uint64 start, uint32 size); + status_t ParseChunk_strh(uint64 start, uint32 size); + status_t ParseChunk_strf(uint64 start, uint32 size); + status_t ParseChunk_strn(uint64 start, uint32 size); + status_t ParseChunk_dmlh(uint64 start, uint32 size); + status_t ParseList_movi(uint64 start, uint32 size); + status_t ParseList_generic(uint64 start, uint32 size); + status_t ParseList_INFO(uint64 start, uint32 size); + status_t ParseList_strl(uint64 start, uint32 size); - void CreateNewStreamInfo(); - void SetupStreamLength(OpenDMLStream *stream); - void SetupAudioStreamLength(OpenDMLStream *stream); - void SetupVideoStreamLength(OpenDMLStream *stream); + void CreateNewStreamInfo(); + void SetupStreamLength(OpenDMLStream *stream); + void SetupAudioStreamLength(OpenDMLStream *stream); + void SetupVideoStreamLength(OpenDMLStream *stream); private: - - BPositionIO * fSource; - int64 fSize; + BPositionIO* fSource; + int64 fSize; - // TODO can be multiple Movi Lists - int64 fMovieListStart; - uint32 fMovieListSize; + // TODO can be multiple Movi Lists + int64 fMovieListStart; + uint32 fMovieListSize; - int64 fStandardIndexStart; - uint32 fStandardIndexSize; + int64 fStandardIndexStart; + uint32 fStandardIndexSize; - int fStreamCount; - int fMovieChunkCount; + int fStreamCount; + int fMovieChunkCount; - avi_main_header fAviMainHeader; - bool fAviMainHeaderValid; + avi_main_header fAviMainHeader; + bool fAviMainHeaderValid; - odml_extended_header fOdmlExtendedHeader; - bool fOdmlExtendedHeaderValid; + odml_extended_header fOdmlExtendedHeader; + bool fOdmlExtendedHeaderValid; - vector fStreams; - OpenDMLStream * fCurrentStream; + std::vector fStreams; + OpenDMLStream * fCurrentStream; }; #endif From dlmcpaul at mail.berlios.de Tue Feb 24 13:50:32 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Tue, 24 Feb 2009 13:50:32 +0100 Subject: [Haiku-commits] r29313 - haiku/trunk/src/add-ons/media/plugins/avcodec Message-ID: <200902241250.n1OCoWCd010073@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-24 13:50:31 +0100 (Tue, 24 Feb 2009) New Revision: 29313 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29313&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp Log: Remove wrong format Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp 2009-02-24 12:15:40 UTC (rev 29312) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp 2009-02-24 12:50:31 UTC (rev 29313) @@ -124,7 +124,7 @@ } } - if (pixelFormat == PIX_FMT_YUV422 || PIX_FMT_YUVJ422P) { + if (pixelFormat == PIX_FMT_YUV422) { #if INCLUDE_MMX if (mmx) { TRACE("resolve_colorspace: PIX_FMT_YUV422 => B_YCbCr422: gfx_conv_null_mmx\n"); From dlmcpaul at gmail.com Tue Feb 24 13:51:04 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Tue, 24 Feb 2009 23:51:04 +1100 Subject: [Haiku-commits] r29306 - haiku/trunk/src/add-ons/media/plugins/avcodec In-Reply-To: <1983263.1235473443208.JavaMail.ngmail@webmail12.arcor-online.net> References: <200902240800.n1O80lUA010977@sheep.berlios.de> <1983263.1235473443208.JavaMail.ngmail@webmail12.arcor-online.net> Message-ID: 2009/2/24 Marcus Overhagen : > >> - ? ? ? ? ? ? ? ? ? ? if (pixelFormat == PIX_FMT_YUV422) { >> + ? ? ? ? ? ? ? ? ? ? if (pixelFormat == PIX_FMT_YUV422 || PIX_FMT_YUVJ422P) { > > oops whats this? Clearly wrong :-) Fixed. -- Cheers David From dlmcpaul at gmail.com Tue Feb 24 13:55:24 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Tue, 24 Feb 2009 23:55:24 +1100 Subject: [Haiku-commits] r29312 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML In-Reply-To: <200902241215.n1OCFo8C007900@sheep.berlios.de> References: <200902241215.n1OCFo8C007900@sheep.berlios.de> Message-ID: 2009/2/24 stippi at BerliOS : > Author: stippi > Date: 2009-02-24 13:15:40 +0100 (Tue, 24 Feb 2009) > New Revision: 29312 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29312&view=rev > > Modified: > ? haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.cpp > ? haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML/OpenDMLParser.h > Log: > Fix GCC 4 build. Implemented constructors/destructors and standard operators. > Hopefully, I am not stepping on your toes, David! Please check these changes, > I've added some TODOs where problems may be lurking. Thats fine, this is very much a work in progress. I want to try and define a standard index type that can be used across all readers but I thought I would start with avi. -- Cheers David From bonefish at mail.berlios.de Tue Feb 24 15:14:41 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 24 Feb 2009 15:14:41 +0100 Subject: [Haiku-commits] r29314 - haiku/trunk Message-ID: <200902241414.n1OEEfOc017983@sheep.berlios.de> Author: bonefish Date: 2009-02-24 15:14:40 +0100 (Tue, 24 Feb 2009) New Revision: 29314 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29314&view=rev Modified: haiku/trunk/configure Log: Patch by Matt Madia: Added automatic detection of 32 or 64 bit mode. Modified: haiku/trunk/configure =================================================================== --- haiku/trunk/configure 2009-02-24 12:50:31 UTC (rev 29313) +++ haiku/trunk/configure 2009-02-24 14:14:40 UTC (rev 29314) @@ -238,6 +238,7 @@ # default parameter values # platform=`uname` +platform_machine=`uname -m` haikuGCCVersion= haikuGCCMachine=i586-pc-haiku haikuStaticLibStdCxx= @@ -335,6 +336,13 @@ esac done +# check for a 64bit platform +case "${platform_machine}" in + x86_64) use_32bit=1 ;; + *) echo Assuming 32-bit machine: "$platform_machine" + use_32bit=0 ;; +esac + # detect the build platform case "${platform}" in BeOS) revision=`uname -r` @@ -348,7 +356,11 @@ esac ;; Darwin) buildPlatform=darwin ;; - FreeBSD) buildPlatform=freebsd ;; + FreeBSD) buildPlatform=freebsd + if [ "$use_32bit" = 1 ] ; then + echo Unsupported platform: FreeBSD ${platform_machine} + exit 1 + fi ;; Haiku) buildPlatform=haiku_host ;; Linux) buildPlatform=linux ;; OpenBSD) buildPlatform=openbsd ;; From bonefish at mail.berlios.de Tue Feb 24 15:20:24 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 24 Feb 2009 15:20:24 +0100 Subject: [Haiku-commits] r29315 - haiku/trunk Message-ID: <200902241420.n1OEKOYE018461@sheep.berlios.de> Author: bonefish Date: 2009-02-24 15:20:24 +0100 (Tue, 24 Feb 2009) New Revision: 29315 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29315&view=rev Modified: haiku/trunk/configure Log: Whitespace cleanup and variable renaming for consistency. No functional change. Modified: haiku/trunk/configure =================================================================== --- haiku/trunk/configure 2009-02-24 14:14:40 UTC (rev 29314) +++ haiku/trunk/configure 2009-02-24 14:20:24 UTC (rev 29315) @@ -76,16 +76,16 @@ Defaults to "ru". HAIKU_UNARFLAGS The flags passed to HAIKU_AR for unarchiving. Defaults to "x". - + Non-standard output directories: - By default all objects, build configuration, and other related files are + By default all objects, build configuration, and other related files are stored in /path/to/haiku_source/generated. To store objects in a non-default - location, run "../../relative/path/to/haiku_source/configure " from - within your non-default location. "jam [ options ] targets" can then be run - directly inside your non-default location. Another option is to invoke "jam - [ options ] targets" from within haiku_source. This can be accomplished by - either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking - jam or by creating a symlink of haiku_source/generated pointing to your + location, run "../../relative/path/to/haiku_source/configure " from + within your non-default location. "jam [ options ] targets" can then be run + directly inside your non-default location. Another option is to invoke "jam + [ options ] targets" from within haiku_source. This can be accomplished by + either "export HAIKU_OUTPUT_DIR=your non-default location" before invoking + jam or by creating a symlink of haiku_source/generated pointing to your non-default location and running jam. @@ -238,7 +238,7 @@ # default parameter values # platform=`uname` -platform_machine=`uname -m` +platformMachine=`uname -m` haikuGCCVersion= haikuGCCMachine=i586-pc-haiku haikuStaticLibStdCxx= @@ -247,15 +247,15 @@ haikuSharedLibSupCxx= haikuCxxHeadersDir= hostGCCVersion=`gcc -dumpversion` -bochs_debug=0 -include_gpl_addons=0 -include_3rdparty=0 -enable_multiuser=0 +bochsDebug=0 +includeGPLAddOns=0 +include3rdParty=0 +enableMultiuser=0 distroCompatibility=default target=haiku -use_gcc_pipe=0 -use_32bit=0 -use_xattr=0 +useGCCPipe=0 +use32bit=0 +useXattr=0 crossToolsPrefix= buildCrossTools= buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools" @@ -282,7 +282,7 @@ # while [ $# -gt 0 ] ; do case "$1" in - --bochs-debug) bochs_debug=1; shift 1;; + --bochs-debug) bochsDebug=1; shift 1;; --build-cross-tools) assertparam "$1" $#; buildCrossTools=$2; shift 2;; --build-cross-tools-gcc4) assertparams "$1" 2 $# @@ -312,9 +312,9 @@ shift 2 ;; --help | -h) usage; exit 0;; - --include-gpl-addons) include_gpl_addons=1; shift 1;; - --include-3rdparty) include_3rdparty=1; shift 1;; - --enable-multiuser) enable_multiuser=1; shift 1;; + --include-gpl-addons) includeGPLAddOns=1; shift 1;; + --include-3rdparty) include3rdParty=1; shift 1;; + --enable-multiuser) enableMultiuser=1; shift 1;; --distro-compatibility) assertparam "$1" $# distroCompatibility=$2 @@ -329,18 +329,18 @@ shift 2 ;; --target=*) target=`echo $1 | cut -d'=' -f2-`; shift 1;; - --use-gcc-pipe) use_gcc_pipe=1; shift 1;; - --use-32bit) use_32bit=1; shift 1;; - --use-xattr) use_xattr=1; shift 1;; + --use-gcc-pipe) useGCCPipe=1; shift 1;; + --use-32bit) use32bit=1; shift 1;; + --use-xattr) useXattr=1; shift 1;; *) echo Invalid argument: \`$1\'; exit 1;; esac done # check for a 64bit platform -case "${platform_machine}" in - x86_64) use_32bit=1 ;; - *) echo Assuming 32-bit machine: "$platform_machine" - use_32bit=0 ;; +case "${platformMachine}" in + x86_64) use32bit=1 ;; + *) echo Assuming 32-bit machine: "$platformMachine" + use32bit=0 ;; esac # detect the build platform @@ -357,9 +357,9 @@ ;; Darwin) buildPlatform=darwin ;; FreeBSD) buildPlatform=freebsd - if [ "$use_32bit" = 1 ] ; then - echo Unsupported platform: FreeBSD ${platform_machine} - exit 1 + if [ "$use32bit" = 1 ] ; then + echo Unsupported platform: FreeBSD ${platformMachine} + exit 1 fi ;; Haiku) buildPlatform=haiku_host ;; Linux) buildPlatform=linux ;; @@ -418,14 +418,14 @@ TARGET_PLATFORM ?= "${target}" ; HOST_PLATFORM ?= "${buildPlatform}" ; -BOCHS_DEBUG_HACK ?= "${bochs_debug}" ; -INCLUDE_GPL_ADDONS ?= "${include_gpl_addons}" ; -HAIKU_INCLUDE_3RDPARTY ?= "${include_3rdparty}" ; -HAIKU_ENABLE_MULTIUSER ?= "${enable_multiuser}" ; +BOCHS_DEBUG_HACK ?= "${bochsDebug}" ; +INCLUDE_GPL_ADDONS ?= "${includeGPLAddOns}" ; +HAIKU_INCLUDE_3RDPARTY ?= "${include3rdParty}" ; +HAIKU_ENABLE_MULTIUSER ?= "${enableMultiuser}" ; HAIKU_DISTRO_COMPATIBILITY ?= "${distroCompatibility}" ; -HAIKU_USE_GCC_PIPE ?= "${use_gcc_pipe}" ; -HAIKU_HOST_USE_32BIT ?= "${use_32bit}" ; -HAIKU_HOST_USE_XATTR ?= "${use_xattr}" ; +HAIKU_USE_GCC_PIPE ?= "${useGCCPipe}" ; +HAIKU_HOST_USE_32BIT ?= "${use32bit}" ; +HAIKU_HOST_USE_XATTR ?= "${useXattr}" ; HAIKU_ALTERNATIVE_GCC_OUTPUT_DIR ?= ${alternativeGCCOutputDir} ; HAIKU_GCC_RAW_VERSION ?= ${haikuGCCVersion} ; From axeld at pinc-software.de Tue Feb 24 17:14:54 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 24 Feb 2009 17:14:54 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29312_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?plugins/avi=5Freader/libOpenDML?= In-Reply-To: <200902241215.n1OCFo8C007900@sheep.berlios.de> Message-ID: <20505147305-BeMail@zon> stippi at BerliOS wrote: > +OpenDMLStream::OpenDMLStream() > + : > + is_audio(false), > + is_video(false), > + is_subtitle(false), Whatever happened to the coding style with this one? Bye, Axel. From superstippi at gmx.de Tue Feb 24 18:05:27 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 24 Feb 2009 18:05:27 +0100 Subject: [Haiku-commits] r29312 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML In-Reply-To: <20505147305-BeMail@zon> References: <20505147305-BeMail@zon> Message-ID: <20090224180527.1610.1@bepc.1235487142.fake> Axel D?rfler wrote: > stippi at BerliOS wrote: > > +OpenDMLStream::OpenDMLStream() > > + : > > + is_audio(false), > > + is_video(false), > > + is_subtitle(false), > > Whatever happened to the coding style with this one? Huh? You mean it should be +OpenDMLStream::OpenDMLStream() + : is_audio(false), + is_video(false), ? Best regards, -Stephan From anevilyak at gmail.com Tue Feb 24 18:08:52 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 24 Feb 2009 11:08:52 -0600 Subject: [Haiku-commits] r29312 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML In-Reply-To: <20090224180527.1610.1@bepc.1235487142.fake> References: <20505147305-BeMail@zon> <20090224180527.1610.1@bepc.1235487142.fake> Message-ID: On Tue, Feb 24, 2009 at 11:05 AM, Stephan Assmus wrote: > +OpenDMLStream::OpenDMLStream() > + ? ?: is_audio(false), > + ? ?is_video(false), I'd assume he's referring to the member variable naming scheme. Regards, Rene From mmlr at mlotz.ch Tue Feb 24 18:11:56 2009 From: mmlr at mlotz.ch (Michael Lotz) Date: Tue, 24 Feb 2009 18:11:56 Subject: [Haiku-commits] r29297 - in buildtools/trunk/gcc/gcc/config: . i386 In-Reply-To: <668358564-BeMail@laptop> Message-ID: <240626921-BeMail@haiku> > > * Remove the part of the link specs that automatically names the > > output after > > the last source file. Therefore we'll produce a.out for now. > > Sadly > > the %b > > variable does also evaluate to libraries in GCC4 which makes it > > unusable for > > this case. A "gcc file.cpp -lstdc++" would for example produce an > > output > > named libstdc++... > > Aw, that's ugly, what do other platforms do ??? They produce a.out mostly. Regards Michael From aldeck at mail.berlios.de Tue Feb 24 19:55:26 2009 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Tue, 24 Feb 2009 19:55:26 +0100 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker Message-ID: <200902241855.n1OItQXe031763@sheep.berlios.de> Author: aldeck Date: 2009-02-24 19:55:23 +0100 (Tue, 24 Feb 2009) New Revision: 29316 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29316&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: * Round mouse coords before doing BRegion ops for the transparent selection rect, as BRegion behaves unpredictably with non-integral values (cf bebook). Fixes #1527 Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-24 14:20:24 UTC (rev 29315) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-24 18:55:23 UTC (rev 29316) @@ -6735,11 +6735,17 @@ return; } + // BRegion doesn't like non-integral values, see below + startPoint.x = roundf(startPoint.x); + startPoint.y = roundf(startPoint.y); + // clearing the selection could take a while so poll the mouse again BPoint newMousePoint; uint32 button; GetMouse(&newMousePoint, &button); - + newMousePoint.x = roundf(newMousePoint.x); + newMousePoint.y = roundf(newMousePoint.y); + // draw initial empty selection rectangle BRect lastSelectionRect; fSelectionRect = lastSelectionRect = BRect(startPoint, startPoint - BPoint(1, 1)); @@ -6755,6 +6761,9 @@ BPoint oldMousePoint(startPoint); while (button) { GetMouse(&newMousePoint, &button, false); + newMousePoint.x = roundf(newMousePoint.x); + newMousePoint.y = roundf(newMousePoint.y); + if (newMousePoint != oldMousePoint) { oldMousePoint = newMousePoint; BRect oldRect = fSelectionRect; From superstippi at gmx.de Tue Feb 24 20:33:11 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 24 Feb 2009 20:33:11 +0100 Subject: [Haiku-commits] r29312 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML In-Reply-To: References: <20505147305-BeMail@zon> <20090224180527.1610.1@bepc.1235487142.fake> Message-ID: <20090224203311.2080.2@bepc.1235487142.fake> Rene Gollent wrote: > On Tue, Feb 24, 2009 at 11:05 AM, Stephan Assmus > wrote: > > +OpenDMLStream::OpenDMLStream() > > + : is_audio(false), > > + is_video(false), > > I'd assume he's referring to the member variable naming scheme. I didn't write the class in the first place, but it's more like a struct (probably should be one) and those members are public. AFAICT, they fit with many other such use cases. Best regards, -Stephan From anevilyak at gmail.com Tue Feb 24 20:37:28 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 24 Feb 2009 13:37:28 -0600 Subject: [Haiku-commits] r29312 - haiku/trunk/src/add-ons/media/plugins/avi_reader/libOpenDML In-Reply-To: <20090224203311.2080.2@bepc.1235487142.fake> References: <20505147305-BeMail@zon> <20090224180527.1610.1@bepc.1235487142.fake> <20090224203311.2080.2@bepc.1235487142.fake> Message-ID: On Tue, Feb 24, 2009 at 1:33 PM, Stephan Assmus wrote: > > I didn't write the class in the first place, but it's more like a struct > (probably should be one) and those members are public. AFAICT, they fit > with many other such use cases. Right, but as I read our coding guidelines, those members should be named alternating case without underscores. Relevant section of guidelines: " * Classes, structs, type names, namespaces and function names start with uppercase letters and use InterCapsFormatting (no underlines). * variables start with lowercase letters and use interCapsFormatting. * member variables start with f like so: int32 fImAMemberVariable; " Admittedly the 'f' prefix in this case isn't completely clear on struct members since those aren't necessarily private, but the underscore naming at least seems unambiguous. If Axel meant something else entirely, then I have no idea and sorry for the noise :) Regards, Rene From superstippi at gmx.de Tue Feb 24 20:37:50 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 24 Feb 2009 20:37:50 +0100 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker In-Reply-To: <200902241855.n1OItQXe031763@sheep.berlios.de> References: <200902241855.n1OItQXe031763@sheep.berlios.de> Message-ID: <20090224203750.2118.3@bepc.1235487142.fake> aldeck at BerliOS wrote: > Author: aldeck > Date: 2009-02-24 19:55:23 +0100 (Tue, 24 Feb 2009) New Revision: 29316 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29316&view=rev > > Modified: > haiku/trunk/src/kits/tracker/PoseView.cpp > Log: > * Round mouse coords before doing BRegion ops for the transparent > selection rect, as BRegion behaves unpredictably with non-integral values > (cf bebook). > Fixes #1527 Darn. I was looking at the totally wrong place. Also explains why I couldn't reproduce this in the app_server test environment back when I tried to track this (BeOS input_server doesn't produce fractional mouse coords)... Very glad you could fix this!! Anyways, the mouse input_device should probably be fixed, since it appears to hand out fractional coords because of speed/acceleration, but probably shouldn't do this. Or maybe app_server should filter the coords before dispatching to applications. What do other think? Best regards, -Stephan From anevilyak at gmail.com Tue Feb 24 20:42:52 2009 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 24 Feb 2009 13:42:52 -0600 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker In-Reply-To: <20090224203750.2118.3@bepc.1235487142.fake> References: <200902241855.n1OItQXe031763@sheep.berlios.de> <20090224203750.2118.3@bepc.1235487142.fake> Message-ID: On Tue, Feb 24, 2009 at 1:37 PM, Stephan Assmus wrote: > > Darn. I was looking at the totally wrong place. Also explains why I > couldn't reproduce this in the app_server test environment back when I > tried to track this (BeOS input_server doesn't produce fractional mouse > coords)... Very glad you could fix this!! Anyways, the mouse input_device > should probably be fixed, since it appears to hand out fractional coords > because of speed/acceleration, but probably shouldn't do this. Or maybe > app_server should filter the coords before dispatching to applications. > What do other think? Depends, is there any case when fractional coordinates could have a practical use? For most GUI applications you're going to want them on pixel boundaries for detecting what part of your view or whatever the cursor is over, but I can't personally think of a case where fractional coordinates are helpful offhand, unless it helps in some way for high dpi pointing devices or whatnot. Regards, Rene From alex at zappotek.com Tue Feb 24 20:46:55 2009 From: alex at zappotek.com (Alexandre Deckner) Date: Tue, 24 Feb 2009 20:46:55 +0100 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker In-Reply-To: <20090224203750.2118.3@bepc.1235487142.fake> References: <200902241855.n1OItQXe031763@sheep.berlios.de> <20090224203750.2118.3@bepc.1235487142.fake> Message-ID: <49A44EAF.3070802@zappotek.com> Stephan Assmus wrote: > aldeck at BerliOS wrote: > >> Author: aldeck >> Date: 2009-02-24 19:55:23 +0100 (Tue, 24 Feb 2009) New Revision: 29316 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29316&view=rev >> >> Modified: >> haiku/trunk/src/kits/tracker/PoseView.cpp >> Log: >> * Round mouse coords before doing BRegion ops for the transparent >> selection rect, as BRegion behaves unpredictably with non-integral values >> (cf bebook). >> Fixes #1527 >> > > Darn. I was looking at the totally wrong place. Also explains why I > couldn't reproduce this in the app_server test environment back when I > tried to track this (BeOS input_server doesn't produce fractional mouse > coords)... Very glad you could fix this!! Anyways, the mouse input_device > should probably be fixed, since it appears to hand out fractional coords > because of speed/acceleration, but probably shouldn't do this. Or maybe > app_server should filter the coords before dispatching to applications. > What do other think? Glad i noticed the similarity with #333, note we already had this discussion :D (r25930) Best regards, Alex From umccullough at gmail.com Tue Feb 24 20:47:40 2009 From: umccullough at gmail.com (Urias McCullough) Date: Tue, 24 Feb 2009 11:47:40 -0800 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker In-Reply-To: <200902241855.n1OItQXe031763@sheep.berlios.de> References: <200902241855.n1OItQXe031763@sheep.berlios.de> Message-ID: <1e80d8750902241147j5b983d78h4b60e787d10bb825@mail.gmail.com> On Tue, Feb 24, 2009 at 10:55 AM, aldeck at BerliOS wrote: > Author: aldeck > Date: 2009-02-24 19:55:23 +0100 (Tue, 24 Feb 2009) > New Revision: 29316 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29316&view=rev > > Modified: > ? haiku/trunk/src/kits/tracker/PoseView.cpp > Log: > * Round mouse coords before doing BRegion ops for the transparent > selection rect, as BRegion behaves unpredictably with non-integral > values (cf bebook). > ?Fixes #1527 But, I still don't understand why the behavior actually disappeared after a while of messing with the selection box :) - did it eventually stop sending fractional values by accident? From alex at zappotek.com Tue Feb 24 20:54:32 2009 From: alex at zappotek.com (Alexandre Deckner) Date: Tue, 24 Feb 2009 20:54:32 +0100 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker In-Reply-To: <1e80d8750902241147j5b983d78h4b60e787d10bb825@mail.gmail.com> References: <200902241855.n1OItQXe031763@sheep.berlios.de> <1e80d8750902241147j5b983d78h4b60e787d10bb825@mail.gmail.com> Message-ID: <49A45078.4070401@zappotek.com> Urias McCullough wrote: > On Tue, Feb 24, 2009 at 10:55 AM, aldeck at BerliOS > wrote: > >> Author: aldeck >> Date: 2009-02-24 19:55:23 +0100 (Tue, 24 Feb 2009) >> New Revision: 29316 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29316&view=rev >> >> Modified: >> haiku/trunk/src/kits/tracker/PoseView.cpp >> Log: >> * Round mouse coords before doing BRegion ops for the transparent >> selection rect, as BRegion behaves unpredictably with non-integral >> values (cf bebook). >> Fixes #1527 >> > > But, I still don't understand why the behavior actually disappeared > after a while of messing with the selection box :) - did it eventually > stop sending fractional values by accident? Probably because the mouse accel code depends on time, and some "error" accumulates over time or something. Damn, now my pastas are overcooked, side effect of time too :D Alex From stippi at mail.berlios.de Tue Feb 24 21:13:50 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 24 Feb 2009 21:13:50 +0100 Subject: [Haiku-commits] r29317 - haiku/trunk/src/servers/input Message-ID: <200902242013.n1OKDo1K006029@sheep.berlios.de> Author: stippi Date: 2009-02-24 21:13:49 +0100 (Tue, 24 Feb 2009) New Revision: 29317 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29317&view=rev Modified: haiku/trunk/src/servers/input/InputServer.cpp Log: * Refactored _SanitizeEvents() a bit to remove small bits of duplicate code. * Round the mouse coordinate to be compatible with BeOS behavior. I know that in WonderBrush, I had to extract the fractional coords using the be:tablet_x and y fields. This may actually be a better fix for #1527, now that we know what caused it. Modified: haiku/trunk/src/servers/input/InputServer.cpp =================================================================== --- haiku/trunk/src/servers/input/InputServer.cpp 2009-02-24 18:55:23 UTC (rev 29316) +++ haiku/trunk/src/servers/input/InputServer.cpp 2009-02-24 20:13:49 UTC (rev 29317) @@ -1570,11 +1570,9 @@ && event->FindInt32("y", &y) == B_OK) { where.x = fMousePos.x + x; where.y = fMousePos.y - y; - where.ConstrainTo(fFrame); event->RemoveName("x"); event->RemoveName("y"); - event->AddPoint("where", where); event->AddInt32("be:delta_x", x); event->AddInt32("be:delta_y", y); @@ -1588,19 +1586,22 @@ // absolute coordinates as "be:tablet_x/y"). where.x = absX * fFrame.Width(); where.y = absY * fFrame.Height(); - where.ConstrainTo(fFrame); event->RemoveName("x"); event->RemoveName("y"); - event->AddPoint("where", where); PRINT(("new position : %f, %f\n", where.x, where.y)); } else if (event->FindPoint("where", &where) == B_OK) { - where.ConstrainTo(fFrame); - - event->ReplacePoint("where", where); PRINT(("new position : %f, %f\n", where.x, where.y)); } + // Constrain and filter the mouse coords and add the final + // point to the message. + where.x = roundf(where.x); + where.y = roundf(where.y); + where.ConstrainTo(fFrame); + if (event->ReplacePoint("where", where) != B_OK) + event->AddPoint("where", where); + if (!event->HasInt64("when")) event->AddInt64("when", system_time()); From superstippi at gmx.de Tue Feb 24 21:14:23 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 24 Feb 2009 21:14:23 +0100 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker In-Reply-To: References: <200902241855.n1OItQXe031763@sheep.berlios.de> <20090224203750.2118.3@bepc.1235487142.fake> Message-ID: <20090224211424.576.1@bepc.1235505932.fake> Rene Gollent wrote: > On Tue, Feb 24, 2009 at 1:37 PM, Stephan Assmus > wrote: > > > > Darn. I was looking at the totally wrong place. Also explains why I > > couldn't reproduce this in the app_server test environment back when I > > tried to track this (BeOS input_server doesn't produce fractional mouse > > coords)... Very glad you could fix this!! Anyways, the mouse > > input_device should probably be fixed, since it appears to hand out > > fractional coords because of speed/acceleration, but probably shouldn't > > do this. Or maybe app_server should filter the coords before > > dispatching to applications. What do other think? > > Depends, is there any case when fractional coordinates could have a > practical use? For most GUI applications you're going to want them on > pixel boundaries for detecting what part of your view or whatever the > cursor is over, but I can't personally think of a case where fractional > coordinates are helpful offhand, unless it helps in some way for high dpi > pointing devices or whatnot. IIRC the BeBook even explains how to get to the fractional coordinates (important for drawing apps and tablets). I think since there is a way to get to them, and there may be other applications depending on the BeOS behavior, I implemented that in r29317. Best regards, -Stephan From alex at zappotek.com Tue Feb 24 21:22:35 2009 From: alex at zappotek.com (Alexandre Deckner) Date: Tue, 24 Feb 2009 21:22:35 +0100 Subject: [Haiku-commits] r29316 - haiku/trunk/src/kits/tracker In-Reply-To: <20090224211424.576.1@bepc.1235505932.fake> References: <200902241855.n1OItQXe031763@sheep.berlios.de> <20090224203750.2118.3@bepc.1235487142.fake> <20090224211424.576.1@bepc.1235505932.fake> Message-ID: <49A4570B.6050706@zappotek.com> Stephan Assmus wrote: > Rene Gollent wrote: > >> >> Depends, is there any case when fractional coordinates could have a >> practical use? For most GUI applications you're going to want them on >> pixel boundaries for detecting what part of your view or whatever the >> cursor is over, but I can't personally think of a case where fractional >> coordinates are helpful offhand, unless it helps in some way for high dpi >> pointing devices or whatnot. >> > > IIRC the BeBook even explains how to get to the fractional coordinates > (important for drawing apps and tablets). I think since there is a way to > get to them, and there may be other applications depending on the BeOS > behavior, I implemented that in r29317. Ok cool! I'm gonna revert r29316 then :) Alex From korli at users.berlios.de Tue Feb 24 21:42:04 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Tue, 24 Feb 2009 21:42:04 +0100 Subject: [Haiku-commits] r29317 - haiku/trunk/src/servers/input In-Reply-To: <200902242013.n1OKDo1K006029@sheep.berlios.de> References: <200902242013.n1OKDo1K006029@sheep.berlios.de> Message-ID: 2009/2/24 stippi at BerliOS > * Round the mouse coordinate to be compatible with BeOS behavior. I know > that > in WonderBrush, I had to extract the fractional coords using the > be:tablet_x > and y fields. This may actually be a better fix for #1527, now that we > know > what caused it. > I'm wondering though if this could generate duplicate mouse moved events with same coordinates. Is it possible at all ? Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From bonefish at mail.berlios.de Tue Feb 24 22:07:41 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 24 Feb 2009 22:07:41 +0100 Subject: [Haiku-commits] r29318 - in haiku/trunk: headers/private/userlandfs/private src/add-ons/kernel/file_systems/userlandfs/kernel_add_on Message-ID: <200902242107.n1OL7fpo011254@sheep.berlios.de> Author: bonefish Date: 2009-02-24 22:07:40 +0100 (Tue, 24 Feb 2009) New Revision: 29318 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29318&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.h Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.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/kernel_add_on/kernel_interface.cpp Log: First work towards adjusting the UserlandFS to the changed FS API. The kernel module compiles again, though newer features like VM file support, asynchronous I/O, and FS layers aren't supported yet. The userland code is still completely out of sync and won't even compile. Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-02-24 20:13:49 UTC (rev 29317) +++ haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-02-24 21:07:40 UTC (rev 29318) @@ -1,5 +1,7 @@ -// Requests.h - +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_REQUESTS_H #define USERLAND_FS_REQUESTS_H @@ -227,7 +229,7 @@ public: VolumeRequest(uint32 type) : Request(type) {} - fs_volume volume; + void* volume; }; // NodeRequest @@ -235,7 +237,7 @@ public: NodeRequest(uint32 type) : VolumeRequest(type) {} - fs_vnode node; + void* node; }; // FileRequest @@ -243,7 +245,7 @@ public: FileRequest(uint32 type) : NodeRequest(type) {} - fs_cookie fileCookie; + void* fileCookie; }; // DirRequest @@ -251,7 +253,7 @@ public: DirRequest(uint32 type) : NodeRequest(type) {} - fs_cookie dirCookie; + void* dirCookie; }; // AttrDirRequest @@ -259,7 +261,7 @@ public: AttrDirRequest(uint32 type) : NodeRequest(type) {} - fs_cookie attrDirCookie; + void* attrDirCookie; }; // AttributeRequest @@ -267,7 +269,7 @@ public: AttributeRequest(uint32 type) : NodeRequest(type) {} - fs_cookie attrCookie; + void* attrCookie; }; // IndexDirRequest @@ -275,7 +277,7 @@ public: IndexDirRequest(uint32 type) : VolumeRequest(type) {} - fs_cookie indexDirCookie; + void* indexDirCookie; }; // QueryRequest @@ -283,7 +285,7 @@ public: QueryRequest(uint32 type) : VolumeRequest(type) {} - fs_cookie queryCookie; + void* queryCookie; }; @@ -339,7 +341,7 @@ MountVolumeReply() : ReplyRequest(MOUNT_VOLUME_REPLY) {} ino_t rootID; - fs_volume volume; + void* volume; }; // UnmountVolumeRequest @@ -431,7 +433,6 @@ LookupReply() : ReplyRequest(LOOKUP_REPLY) {} ino_t vnid; - int type; }; // GetVNodeNameRequest @@ -465,7 +466,9 @@ public: ReadVNodeReply() : ReplyRequest(READ_VNODE_REPLY) {} - fs_vnode node; + void* node; + int type; + uint32 flags; }; // WriteVNodeRequest @@ -625,7 +628,7 @@ status_t GetAddressInfos(AddressInfo* infos, int32* count); Address name; - fs_vnode target; + void* target; }; // LinkReply @@ -655,9 +658,9 @@ RenameRequest() : VolumeRequest(RENAME_REQUEST) {} status_t GetAddressInfos(AddressInfo* infos, int32* count); - fs_vnode oldDir; + void* oldDir; Address oldName; - fs_vnode newDir; + void* newDir; Address newName; }; @@ -731,7 +734,7 @@ CreateReply() : ReplyRequest(CREATE_REPLY) {} ino_t vnid; - fs_cookie fileCookie; + void* fileCookie; }; // OpenRequest @@ -747,7 +750,7 @@ public: OpenReply() : ReplyRequest(OPEN_REPLY) {} - fs_cookie fileCookie; + void* fileCookie; }; // CloseRequest @@ -859,7 +862,7 @@ public: OpenDirReply() : ReplyRequest(OPEN_DIR_REPLY) {} - fs_cookie dirCookie; + void* dirCookie; }; // CloseDirRequest @@ -932,7 +935,7 @@ public: OpenAttrDirReply() : ReplyRequest(OPEN_ATTR_DIR_REPLY) {} - fs_cookie attrDirCookie; + void* attrDirCookie; }; // CloseAttrDirRequest @@ -1010,7 +1013,7 @@ public: CreateAttrReply() : ReplyRequest(CREATE_ATTR_REPLY) {} - fs_cookie attrCookie; + void* attrCookie; }; // OpenAttrRequest @@ -1028,7 +1031,7 @@ public: OpenAttrReply() : ReplyRequest(OPEN_ATTR_REPLY) {} - fs_cookie attrCookie; + void* attrCookie; }; // CloseAttrRequest @@ -1128,8 +1131,8 @@ RenameAttrRequest() : VolumeRequest(RENAME_ATTR_REQUEST) {} status_t GetAddressInfos(AddressInfo* infos, int32* count); - fs_vnode oldNode; - fs_vnode newNode; + void* oldNode; + void* newNode; Address oldName; Address newName; }; @@ -1170,7 +1173,7 @@ public: OpenIndexDirReply() : ReplyRequest(OPEN_INDEX_DIR_REPLY) {} - fs_cookie indexDirCookie; + void* indexDirCookie; }; // CloseIndexDirRequest @@ -1299,7 +1302,7 @@ public: OpenQueryReply() : ReplyRequest(OPEN_QUERY_REPLY) {} - fs_cookie queryCookie; + void* queryCookie; }; // CloseQueryRequest @@ -1442,7 +1445,7 @@ public: GetVNodeReply() : ReplyRequest(GET_VNODE_REPLY) {} - fs_vnode node; + void* node; }; // PutVNodeRequest @@ -1467,7 +1470,7 @@ dev_t nsid; ino_t vnid; - fs_vnode node; + void* node; }; // NewVNodeReply @@ -1483,7 +1486,9 @@ dev_t nsid; ino_t vnid; - fs_vnode node; + void* node; + int type; + uint32 flags; }; // PublishVNodeReply Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.cpp 2009-02-24 20:13:49 UTC (rev 29317) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.cpp 2009-02-24 21:07:40 UTC (rev 29318) @@ -1,4 +1,7 @@ -// FileSystem.cpp +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include "AutoLocker.h" #include "Compatibility.h" @@ -179,7 +182,7 @@ // Mount status_t -FileSystem::Mount(dev_t id, const char* device, uint32 flags, +FileSystem::Mount(fs_volume* fsVolume, const char* device, uint32 flags, const char* parameters, Volume** _volume) { // check initialization and parameters @@ -187,7 +190,7 @@ return B_BAD_VALUE; // create volume - Volume* volume = new(nothrow) Volume(this, id); + Volume* volume = new(nothrow) Volume(this, fsVolume); if (!volume) return B_NO_MEMORY; Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.h 2009-02-24 20:13:49 UTC (rev 29317) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/FileSystem.h 2009-02-24 21:07:40 UTC (rev 29318) @@ -1,5 +1,7 @@ -// FileSystem.h - +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_FILE_SYSTEM_H #define USERLAND_FS_FILE_SYSTEM_H @@ -35,7 +37,7 @@ RequestPortPool* GetPortPool(); - status_t Mount(dev_t id, const char* device, + status_t Mount(fs_volume* fsVolume, const char* device, ulong flags, const char* parameters, Volume** volume); // status_t Initialize(const char* deviceName, 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-02-24 20:13:49 UTC (rev 29317) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.cpp 2009-02-24 21:07:40 UTC (rev 29318) @@ -1,4 +1,7 @@ -// KernelRequestHandler.cpp +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include "Compatibility.h" #include "Debug.h" @@ -121,7 +124,7 @@ if (!oldName) { ERROR(("NotifyListenerRequest: NULL oldName for " "B_ENTRY_MOVED\n")); - result = B_BAD_VALUE; + result = B_BAD_VALUE; break; } // fall through... @@ -131,7 +134,7 @@ if (!name) { ERROR(("NotifyListenerRequest: NULL name for opcode: %ld\n", request->operation)); - result = B_BAD_VALUE; + result = B_BAD_VALUE; } break; case B_STAT_CHANGED: @@ -183,7 +186,7 @@ default: ERROR(("NotifyQueryRequest: unsupported operation: %ld\n", request->operation)); - result = B_BAD_VALUE; + result = B_BAD_VALUE; break; } } @@ -249,7 +252,7 @@ int32 nameLen = request->name.GetSize(); if (!name || nameLen <= 0) { ERROR(("NotifyQueryRequest: NULL name!\n")); - result = B_BAD_VALUE; + result = B_BAD_VALUE; } else name[nameLen - 1] = '\0'; // NULL-terminate to be safe @@ -278,7 +281,7 @@ default: ERROR(("NotifyQueryRequest: unsupported operation: %ld\n", request->operation)); - result = B_BAD_VALUE; + result = B_BAD_VALUE; break; } } @@ -372,8 +375,10 @@ Volume* volume = NULL; status_t result = _GetVolume(request->nsid, &volume); VolumePutter _(volume); - if (result == B_OK) - result = volume->PublishVNode(request->vnid, request->node); + if (result == B_OK) { + result = volume->PublishVNode(request->vnid, request->node, + request->type, request->flags); + } // prepare the reply RequestAllocator allocator(fPort->GetPort()); 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-02-24 20:13:49 UTC (rev 29317) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/KernelRequestHandler.h 2009-02-24 21:07:40 UTC (rev 29318) @@ -1,4 +1,7 @@ -// KernelRequestHandler.h +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #ifndef USERLAND_FS_KERNEL_REQUEST_HANDLER_H #define USERLAND_FS_KERNEL_REQUEST_HANDLER_H 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-02-24 20:13:49 UTC (rev 29317) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.cpp 2009-02-24 21:07:40 UTC (rev 29318) @@ -1,4 +1,7 @@ -// Volume.cpp +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ #include "Volume.h" @@ -13,6 +16,7 @@ #include "FileSystem.h" #include "HashMap.h" #include "IOCtlInfo.h" +#include "kernel_interface.h" #include "KernelRequestHandler.h" #include "PortReleaser.h" #include "RequestAllocator.h" @@ -66,10 +70,10 @@ }; // constructor -Volume::Volume(FileSystem* fileSystem, dev_t id) +Volume::Volume(FileSystem* fileSystem, fs_volume* fsVolume) : Referencable(true), fFileSystem(fileSystem), - fID(id), + fFSVolume(fsVolume), fUserlandVolume(NULL), fRootID(0), fRootNode(NULL), @@ -97,13 +101,6 @@ return fFileSystem; } -// GetID -dev_t -Volume::GetID() const -{ - return fID; -} - // GetUserlandVolume void* Volume::GetUserlandVolume() const @@ -130,14 +127,14 @@ // GetVNode status_t -Volume::GetVNode(ino_t vnid, fs_vnode* node) +Volume::GetVNode(ino_t vnid, void** node) { -PRINT(("get_vnode(%ld, %lld)\n", fID, vnid)); +PRINT(("get_vnode(%ld, %lld)\n", GetID(), vnid)); if (IsMounting() && !fMountVNodes->ContainsKey(vnid)) { ERROR(("Volume::GetVNode(): get_vnode() invoked for unknown vnode " "while mounting!\n")); } - status_t error = get_vnode(fID, vnid, node); + status_t error = get_vnode(fFSVolume, vnid, node); if (error == B_OK) _IncrementVNodeCount(vnid); return error; @@ -147,8 +144,8 @@ status_t Volume::PutVNode(ino_t vnid) { -PRINT(("put_vnode(%ld, %lld)\n", fID, vnid)); - status_t error = put_vnode(fID, vnid); +PRINT(("put_vnode(%ld, %lld)\n", GetID(), vnid)); + status_t error = put_vnode(fFSVolume, vnid); if (error == B_OK) _DecrementVNodeCount(vnid); return error; @@ -156,18 +153,19 @@ // NewVNode status_t -Volume::NewVNode(ino_t vnid, fs_vnode node) +Volume::NewVNode(ino_t vnid, void* node) { -PRINT(("new_vnode(%ld, %lld)\n", fID, vnid)); - status_t error = new_vnode(fID, vnid, node); +PRINT(("new_vnode(%ld, %lld)\n", GetID(), vnid)); + status_t error = new_vnode(fFSVolume, vnid, node, &gUserlandFSVnodeOps); if (error == B_OK) { if (IsMounting()) { error = fMountVNodes->Put(vnid, node); if (error != B_OK) { ERROR(("Volume::NewVNode(): Failed to add vnode to mount " "vnode map!\n")); - publish_vnode(fID, vnid, node); - put_vnode(fID, vnid); + publish_vnode(fFSVolume, vnid, node, &gUserlandFSVnodeOps, + S_IFDIR, 0); // dummy type and flags + put_vnode(fFSVolume, vnid); return error; } } @@ -179,17 +177,18 @@ // PublishVNode status_t -Volume::PublishVNode(ino_t vnid, fs_vnode node) +Volume::PublishVNode(ino_t vnid, void* node, int type, uint32 flags) { -PRINT(("publish_vnode(%ld, %lld, %p)\n", fID, vnid, node)); - status_t error = publish_vnode(fID, vnid, node); +PRINT(("publish_vnode(%ld, %lld, %p)\n", GetID(), vnid, node)); + status_t error = publish_vnode(fFSVolume, vnid, node, &gUserlandFSVnodeOps, + type, flags); if (error == B_OK) { if (IsMounting()) { error = fMountVNodes->Put(vnid, node); if (error != B_OK) { ERROR(("Volume::PublishVNode(): Failed to add vnode to mount " "vnode map!\n")); - put_vnode(fID, vnid); + put_vnode(fFSVolume, vnid); return error; } } @@ -202,24 +201,24 @@ status_t Volume::RemoveVNode(ino_t vnid) { -PRINT(("remove_vnode(%ld, %lld)\n", fID, vnid)); - return remove_vnode(fID, vnid); +PRINT(("remove_vnode(%ld, %lld)\n", GetID(), vnid)); + return remove_vnode(fFSVolume, vnid); } // UnremoveVNode status_t Volume::UnremoveVNode(ino_t vnid) { -PRINT(("unremove_vnode(%ld, %lld)\n", fID, vnid)); - return unremove_vnode(fID, vnid); +PRINT(("unremove_vnode(%ld, %lld)\n", GetID(), vnid)); + return unremove_vnode(fFSVolume, vnid); } // GetVNodeRemoved status_t Volume::GetVNodeRemoved(ino_t vnid, bool* removed) { -PRINT(("get_vnode_removed(%ld, %lld, %p)\n", fID, vnid, removed)); - return get_vnode_removed(fID, vnid, removed); +PRINT(("get_vnode_removed(%ld, %lld, %p)\n", GetID(), vnid, removed)); + return get_vnode_removed(fFSVolume, vnid, removed); } @@ -323,7 +322,7 @@ // read_fs_info() requests manually. status_t error = _ReadFSInfo(info); if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) { - WARN(("Volume::Lookup(): connection lost, emulating lookup `.'\n")); + WARN(("Volume::ReadFSInfo(): connection lost, emulating lookup `.'\n")); info->flags = B_FS_IS_PERSISTENT | B_FS_IS_READONLY; info->block_size = 512; @@ -384,11 +383,11 @@ // Lookup status_t -Volume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, int* type) +Volume::Lookup(void* dir, const char* entryName, ino_t* vnid) { // When the connection to the userland server is lost, we serve // lookup(fRootNode, `.') requests manually to allow clean unmounting. - status_t error = _Lookup(dir, entryName, vnid, type); + status_t error = _Lookup(dir, entryName, vnid); if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected() && dir == fRootNode && strcmp(entryName, ".") == 0) { WARN(("Volume::Lookup(): connection lost, emulating lookup `.'\n")); @@ -396,7 +395,6 @@ if (GetVNode(fRootID, &entryNode) != B_OK) RETURN_ERROR(B_BAD_VALUE); *vnid = fRootID; - *type = S_IFDIR; // The VFS will balance the get_vnode() call for the FS. _DecrementVNodeCount(*vnid); return B_OK; @@ -406,7 +404,7 @@ // GetVNodeName status_t -Volume::GetVNodeName(fs_vnode node, char* buffer, size_t bufferSize) +Volume::GetVNodeName(void* node, char* buffer, size_t bufferSize) { // We don't check the capability -- if not implemented by the client FS, // the functionality is emulated in userland. @@ -455,7 +453,8 @@ // ReadVNode status_t -Volume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node) +Volume::ReadVNode(ino_t vnid, bool reenter, void** node, int* type, + uint32* flags) { // get a free port RequestPort* port = fFileSystem->GetPortPool()->AcquirePort(); @@ -486,12 +485,14 @@ if (reply->error != B_OK) return reply->error; *node = reply->node; + *type = reply->type; + *flags = reply->flags; return error; } // WriteVNode status_t -Volume::WriteVNode(fs_vnode node, bool reenter) +Volume::WriteVNode(void* node, bool reenter) { status_t error = _WriteVNode(node, reenter); if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) { @@ -506,7 +507,7 @@ // RemoveVNode status_t -Volume::RemoveVNode(fs_vnode node, bool reenter) +Volume::RemoveVNode(void* node, bool reenter) { // get a free port RequestPort* port = fFileSystem->GetPortPool()->AcquirePort(); @@ -545,7 +546,7 @@ // IOCtl status_t -Volume::IOCtl(fs_vnode node, fs_cookie cookie, uint32 command, void *buffer, +Volume::IOCtl(void* node, void* cookie, uint32 command, void *buffer, size_t len) { // check the command and its parameters @@ -691,7 +692,7 @@ // SetFlags status_t -Volume::SetFlags(fs_vnode node, fs_cookie cookie, int flags) +Volume::SetFlags(void* node, void* cookie, int flags) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_SET_FLAGS)) @@ -731,8 +732,7 @@ // Select status_t -Volume::Select(fs_vnode node, fs_cookie cookie, uint8 event, uint32 ref, - selectsync* sync) +Volume::Select(void* node, void* cookie, uint8 event, selectsync* sync) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_SELECT)) { @@ -784,7 +784,7 @@ // Deselect status_t -Volume::Deselect(fs_vnode node, fs_cookie cookie, uint8 event, selectsync* sync) +Volume::Deselect(void* node, void* cookie, uint8 event, selectsync* sync) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_DESELECT)) @@ -834,7 +834,7 @@ // FSync status_t -Volume::FSync(fs_vnode node) +Volume::FSync(void* node) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_FSYNC)) @@ -872,7 +872,7 @@ // ReadSymlink status_t -Volume::ReadSymlink(fs_vnode node, char* buffer, size_t bufferSize, +Volume::ReadSymlink(void* node, char* buffer, size_t bufferSize, size_t* bytesRead) { *bytesRead = 0; @@ -923,7 +923,7 @@ // CreateSymlink status_t -Volume::CreateSymlink(fs_vnode dir, const char* name, const char* target, +Volume::CreateSymlink(void* dir, const char* name, const char* target, int mode) { // check capability @@ -968,7 +968,7 @@ // Link status_t -Volume::Link(fs_vnode dir, const char* name, fs_vnode node) +Volume::Link(void* dir, const char* name, void* node) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_LINK)) @@ -1010,7 +1010,7 @@ // Unlink status_t -Volume::Unlink(fs_vnode dir, const char* name) +Volume::Unlink(void* dir, const char* name) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_UNLINK)) @@ -1051,7 +1051,7 @@ // Rename status_t -Volume::Rename(fs_vnode oldDir, const char* oldName, fs_vnode newDir, +Volume::Rename(void* oldDir, const char* oldName, void* newDir, const char* newName) { // check capability @@ -1096,7 +1096,7 @@ // Access status_t -Volume::Access(fs_vnode node, int mode) +Volume::Access(void* node, int mode) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_ACCESS)) @@ -1135,7 +1135,7 @@ // ReadStat status_t -Volume::ReadStat(fs_vnode node, struct stat* st) +Volume::ReadStat(void* node, struct stat* st) { // When the connection to the userland server is lost, we serve // read_stat(fRootNode) requests manually to allow clean unmounting. @@ -1145,7 +1145,7 @@ WARN(("Volume::ReadStat(): connection lost, emulating stat for the " "root node\n")); - st->st_dev = fID; + st->st_dev = GetID(); st->st_ino = fRootID; st->st_mode = ACCESSPERMS; st->st_nlink = 1; @@ -1165,7 +1165,7 @@ // WriteStat status_t -Volume::WriteStat(fs_vnode node, const struct stat* st, uint32 mask) +Volume::WriteStat(void* node, const struct stat* st, uint32 mask) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_WRITE_STAT)) @@ -1208,7 +1208,7 @@ // Create status_t -Volume::Create(fs_vnode dir, const char* name, int openMode, int mode, +Volume::Create(void* dir, const char* name, int openMode, int mode, void** cookie, ino_t* vnid) { // check capability @@ -1259,7 +1259,7 @@ // Open status_t -Volume::Open(fs_vnode node, int openMode, fs_cookie* cookie) +Volume::Open(void* node, int openMode, void** cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN)) @@ -1300,7 +1300,7 @@ // Close status_t -Volume::Close(fs_vnode node, fs_cookie cookie) +Volume::Close(void* node, void* cookie) { status_t error = _Close(node, cookie); if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) { @@ -1315,7 +1315,7 @@ // FreeCookie status_t -Volume::FreeCookie(fs_vnode node, fs_cookie cookie) +Volume::FreeCookie(void* node, void* cookie) { status_t error = _FreeCookie(node, cookie); bool disconnected = false; @@ -1335,7 +1335,7 @@ // Read status_t -Volume::Read(fs_vnode node, fs_cookie cookie, off_t pos, void* buffer, +Volume::Read(void* node, void* cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead) { *bytesRead = 0; @@ -1388,7 +1388,7 @@ // Write status_t -Volume::Write(fs_vnode node, fs_cookie cookie, off_t pos, const void* buffer, +Volume::Write(void* node, void* cookie, off_t pos, const void* buffer, size_t size, size_t* bytesWritten) { *bytesWritten = 0; @@ -1438,7 +1438,7 @@ // CreateDir status_t -Volume::CreateDir(fs_vnode dir, const char* name, int mode, ino_t *newDir) +Volume::CreateDir(void* dir, const char* name, int mode, ino_t *newDir) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_DIR)) @@ -1481,7 +1481,7 @@ // RemoveDir status_t -Volume::RemoveDir(fs_vnode dir, const char* name) +Volume::RemoveDir(void* dir, const char* name) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_REMOVE_DIR)) @@ -1522,7 +1522,7 @@ // OpenDir status_t -Volume::OpenDir(fs_vnode node, fs_cookie* cookie) +Volume::OpenDir(void* node, void** cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_DIR)) @@ -1563,7 +1563,7 @@ // CloseDir status_t -Volume::CloseDir(fs_vnode node, fs_vnode cookie) +Volume::CloseDir(void* node, void* cookie) { status_t error = _CloseDir(node, cookie); if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) { @@ -1598,7 +1598,7 @@ // ReadDir status_t -Volume::ReadDir(fs_vnode node, fs_vnode cookie, void* buffer, size_t bufferSize, +Volume::ReadDir(void* node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { *countRead = 0; @@ -1660,7 +1660,7 @@ // RewindDir status_t -Volume::RewindDir(fs_vnode node, fs_vnode cookie) +Volume::RewindDir(void* node, void* cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_DIR)) @@ -1703,7 +1703,7 @@ // OpenAttrDir status_t -Volume::OpenAttrDir(fs_vnode node, fs_cookie *cookie) +Volume::OpenAttrDir(void* node, void** cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_ATTR_DIR)) @@ -1744,7 +1744,7 @@ // CloseAttrDir status_t -Volume::CloseAttrDir(fs_vnode node, fs_cookie cookie) +Volume::CloseAttrDir(void* node, void* cookie) { status_t error = _CloseAttrDir(node, cookie); if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) { @@ -1781,7 +1781,7 @@ // ReadAttrDir status_t -Volume::ReadAttrDir(fs_vnode node, fs_cookie cookie, void* buffer, +Volume::ReadAttrDir(void* node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { // check capability @@ -1840,7 +1840,7 @@ // RewindAttrDir status_t -Volume::RewindAttrDir(fs_vnode node, fs_cookie cookie) +Volume::RewindAttrDir(void* node, void* cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_ATTR_DIR)) @@ -1882,8 +1882,8 @@ // CreateAttr status_t -Volume::CreateAttr(fs_vnode node, const char* name, uint32 type, int openMode, - fs_cookie* cookie) +Volume::CreateAttr(void* node, const char* name, uint32 type, int openMode, + void** cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_ATTR)) @@ -1929,8 +1929,8 @@ // OpenAttr status_t -Volume::OpenAttr(fs_vnode node, const char* name, int openMode, - fs_cookie* cookie) +Volume::OpenAttr(void* node, const char* name, int openMode, + void** cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_ATTR)) @@ -1975,7 +1975,7 @@ // CloseAttr status_t -Volume::CloseAttr(fs_vnode node, fs_cookie cookie) +Volume::CloseAttr(void* node, void* cookie) { status_t error = _CloseAttr(node, cookie); if (error != B_OK && fFileSystem->GetPortPool()->IsDisconnected()) { @@ -1990,7 +1990,7 @@ // FreeAttrCookie status_t -Volume::FreeAttrCookie(fs_vnode node, fs_cookie cookie) +Volume::FreeAttrCookie(void* node, void* cookie) { status_t error = _FreeAttrCookie(node, cookie); bool disconnected = false; @@ -2011,7 +2011,7 @@ // ReadAttr status_t -Volume::ReadAttr(fs_vnode node, fs_cookie cookie, off_t pos, +Volume::ReadAttr(void* node, void* cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead) { *bytesRead = 0; @@ -2064,7 +2064,7 @@ // WriteAttr status_t -Volume::WriteAttr(fs_vnode node, fs_cookie cookie, off_t pos, +Volume::WriteAttr(void* node, void* cookie, off_t pos, const void* buffer, size_t bufferSize, size_t* bytesWritten) { *bytesWritten = 0; @@ -2111,7 +2111,7 @@ // ReadAttrStat status_t -Volume::ReadAttrStat(fs_vnode node, fs_cookie cookie, struct stat *st) +Volume::ReadAttrStat(void* node, void* cookie, struct stat *st) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_ATTR_STAT)) @@ -2151,7 +2151,7 @@ // WriteAttrStat status_t -Volume::WriteAttrStat(fs_vnode node, fs_cookie cookie, const struct stat *st, +Volume::WriteAttrStat(void* node, void* cookie, const struct stat *st, int statMask) { // check capability @@ -2193,7 +2193,7 @@ // RenameAttr status_t -Volume::RenameAttr(fs_vnode oldNode, const char* oldName, fs_vnode newNode, +Volume::RenameAttr(void* oldNode, const char* oldName, void* newNode, const char* newName) { // check capability @@ -2238,7 +2238,7 @@ // RemoveAttr status_t -Volume::RemoveAttr(fs_vnode node, const char* name) +Volume::RemoveAttr(void* node, const char* name) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_REMOVE_ATTR)) @@ -2283,7 +2283,7 @@ // OpenIndexDir status_t -Volume::OpenIndexDir(fs_cookie *cookie) +Volume::OpenIndexDir(void** cookie) { // check capability if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_INDEX_DIR)) @@ -2323,7 +2323,7 @@ // CloseIndexDir status_t -Volume::CloseIndexDir(fs_cookie cookie) [... truncated: 1885 lines follow ...] From superstippi at gmx.de Tue Feb 24 22:15:02 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 24 Feb 2009 22:15:02 +0100 Subject: [Haiku-commits] r29317 - haiku/trunk/src/servers/input In-Reply-To: References: <200902242013.n1OKDo1K006029@sheep.berlios.de> Message-ID: <20090224221502.625.2@bepc.1235505932.fake> J?r?me Duval wrote: > 2009/2/24 stippi at BerliOS > > > * Round the mouse coordinate to be compatible with BeOS behavior. I know > > that > > in WonderBrush, I had to extract the fractional coords using the > > be:tablet_x > > and y fields. This may actually be a better fix for #1527, now that we > > know > > what caused it. > > > > I'm wondering though if this could generate duplicate mouse moved events > with same coordinates. Is it possible at all ? Good point. I will have a look at the mouse add-on later to see whether the code needs to be moved there (or duplicated there). I thought it would be best in the input_server, if the point is to prevent fractional coordinates entirely. Best regards, -Stephan From aldeck at mail.berlios.de Tue Feb 24 22:41:33 2009 From: aldeck at mail.berlios.de (aldeck at BerliOS) Date: Tue, 24 Feb 2009 22:41:33 +0100 Subject: [Haiku-commits] r29319 - haiku/trunk/src/kits/tracker Message-ID: <200902242141.n1OLfX0K013917@sheep.berlios.de> Author: aldeck Date: 2009-02-24 22:41:32 +0100 (Tue, 24 Feb 2009) New Revision: 29319 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29319&view=rev Modified: haiku/trunk/src/kits/tracker/PoseView.cpp Log: * Revert the changes in r29316 as it's now fixed upstream. Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-24 21:07:40 UTC (rev 29318) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2009-02-24 21:41:32 UTC (rev 29319) @@ -6735,17 +6735,11 @@ return; } - // BRegion doesn't like non-integral values, see below - startPoint.x = roundf(startPoint.x); - startPoint.y = roundf(startPoint.y); - // clearing the selection could take a while so poll the mouse again BPoint newMousePoint; uint32 button; GetMouse(&newMousePoint, &button); - newMousePoint.x = roundf(newMousePoint.x); - newMousePoint.y = roundf(newMousePoint.y); - + // draw initial empty selection rectangle BRect lastSelectionRect; fSelectionRect = lastSelectionRect = BRect(startPoint, startPoint - BPoint(1, 1)); @@ -6761,8 +6755,6 @@ BPoint oldMousePoint(startPoint); while (button) { GetMouse(&newMousePoint, &button, false); - newMousePoint.x = roundf(newMousePoint.x); - newMousePoint.y = roundf(newMousePoint.y); if (newMousePoint != oldMousePoint) { oldMousePoint = newMousePoint; From axeld at pinc-software.de Tue Feb 24 23:28:30 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 24 Feb 2009 23:28:30 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29312_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?plugins/avi=5Freader/libOpenDML?= In-Reply-To: Message-ID: <42920564274-BeMail@zon> Rene Gollent wrote: > On Tue, Feb 24, 2009 at 11:05 AM, Stephan Assmus > wrote: > > +OpenDMLStream::OpenDMLStream() > > + ? ?: is_audio(false), > > + ? ?is_video(false), > I'd assume he's referring to the member variable naming scheme. Exactly! :-) Bye, Axel. From bga at mail.berlios.de Wed Feb 25 11:37:43 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Wed, 25 Feb 2009 11:37:43 +0100 Subject: [Haiku-commits] r29320 - haiku/trunk/src/preferences/mail Message-ID: <200902251037.n1PAbhpe027986@sheep.berlios.de> Author: bga Date: 2009-02-25 11:37:42 +0100 (Wed, 25 Feb 2009) New Revision: 29320 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29320&view=rev Modified: haiku/trunk/src/preferences/mail/Jamfile Log: Works around problem with runtime loader described here: http://www.freelists.org/post/haiku-development/Runtime-loader-problem The problem seems to be related to loading/unloading add-ons linked against the recent OpenSSL. Linking the E-mail preferences against the SSL libraries (when USE_SSL is enable) fixes this as the SSL libraries are not unloaded then. I am still investigating this but will have no more time this week so I am commiting this workaround until I look at it again. Modified: haiku/trunk/src/preferences/mail/Jamfile =================================================================== --- haiku/trunk/src/preferences/mail/Jamfile 2009-02-24 21:41:32 UTC (rev 29319) +++ haiku/trunk/src/preferences/mail/Jamfile 2009-02-25 10:37:42 UTC (rev 29320) @@ -7,18 +7,36 @@ } UsePrivateHeaders mail ; + SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; +local sslDir ; + +if $(USE_SSL) { + SubDirC++Flags -DUSE_SSL ; + if ! $(SSL_DIR) { + sslDir = [ FDirName $(HAIKU_OUTPUT_DIR) cross-ssl common ] ; + } else { + sslDir = $(SSL_DIR) ; + } + SubDirSysHdrs [ FDirName $(sslDir) include ] ; +} + + Preference E-mail : Account.cpp CenterContainer.cpp ConfigViews.cpp ConfigWindow.cpp - main.cpp - : be libmail.so + main.cpp + : be libmail.so : e-mail.rdef ; +if $(USE_SSL) { + LinkAgainst E-mail : $(sslDir)/lib/libssl.so $(sslDir)/lib/libcrypto.so ; +} + Package haiku-maildaemon-cvs : E-mail : boot beos preferences ; From bga at mail.berlios.de Wed Feb 25 11:41:12 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Wed, 25 Feb 2009 11:41:12 +0100 Subject: [Haiku-commits] r29321 - haiku/trunk/src/preferences/mail Message-ID: <200902251041.n1PAfCZw028413@sheep.berlios.de> Author: bga Date: 2009-02-25 11:41:12 +0100 (Wed, 25 Feb 2009) New Revision: 29321 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29321&view=rev Modified: haiku/trunk/src/preferences/mail/Jamfile Log: Added a TODO related to the runtime loader + OpenSSL problem. Modified: haiku/trunk/src/preferences/mail/Jamfile =================================================================== --- haiku/trunk/src/preferences/mail/Jamfile 2009-02-25 10:37:42 UTC (rev 29320) +++ haiku/trunk/src/preferences/mail/Jamfile 2009-02-25 10:41:12 UTC (rev 29321) @@ -10,6 +10,12 @@ SubDirHdrs [ FDirName $(HAIKU_TOP) headers os add-ons mail_daemon ] ; +# TODO(bga): E-mail preferences does not really need to link against the +# OpenSSL libraries. Remove this after problems with the runtile loader are +# sorted up. Details here: +# +# http://www.freelists.org/post/haiku-development/Runtime-loader-problem + local sslDir ; if $(USE_SSL) { From korli at mail.berlios.de Wed Feb 25 20:12:24 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 25 Feb 2009 20:12:24 +0100 Subject: [Haiku-commits] r29322 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200902251912.n1PJCOFe014649@sheep.berlios.de> Author: korli Date: 2009-02-25 20:12:23 +0100 (Wed, 25 Feb 2009) New Revision: 29322 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29322&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp Log: * Stream interrupts seem to arrive too early on most HDA chips: we adjust buffer descriptors to take this into account. It defaults to one sample, but it should depend also on the sample rate or the chip vendor. Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2009-02-25 10:41:12 UTC (rev 29321) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2009-02-25 19:12:23 UTC (rev 29322) @@ -109,7 +109,7 @@ stream->real_time = system_time(); stream->frames_count += stream->buffer_length; - stream->buffer_cycle = 1 - (position / (bufferSize + 1)); // added 1 to avoid having 2 + stream->buffer_cycle = ((position / bufferSize) + 1) % stream->num_buffers; release_spinlock(&stream->lock); @@ -523,13 +523,18 @@ stream->buffer_descriptors_area = B_ERROR; } + // Stream interrupts seem to arrive too early on most HDA + // so we adjust buffer descriptors to take this into account + // TODO compute this value based on sample rate and depending on the hardware + uint32 offset = 1 * (stream->sample_size * stream->num_channels); + /* Calculate size of buffer (aligned to 128 bytes) */ bufferSize = stream->sample_size * stream->num_channels * stream->buffer_length; bufferSize = ALIGN(bufferSize, 128); - dprintf("HDA: sample size %ld, num channels %ld, buffer length %ld ****************\n", - stream->sample_size, stream->num_channels, stream->buffer_length); + dprintf("HDA: sample size %ld, num channels %ld, buffer length %ld, offset %ld **********\n", + stream->sample_size, stream->num_channels, stream->buffer_length, offset); /* Calculate total size of all buffers (aligned to size of B_PAGE_SIZE) */ alloc = bufferSize * stream->num_buffers; @@ -561,7 +566,7 @@ } /* Now allocate BDL for buffer range */ - alloc = stream->num_buffers * sizeof(bdl_entry_t); + alloc = (stream->num_buffers + ((offset > 0) ? 1 : 0)) * sizeof(bdl_entry_t); alloc = PAGE_ALIGN(alloc); stream->buffer_descriptors_area = create_area("hda buffer descriptors", @@ -585,13 +590,29 @@ dprintf("%s(%s): Allocated %ld bytes for %ld BDLEs\n", __func__, desc, alloc, stream->num_buffers); + uint32 fragments = 0; + if (offset > 0) { + bufferDescriptors->lower = stream->physical_buffers[0]; + bufferDescriptors->upper = 0; + bufferDescriptors->length = offset; + bufferDescriptors->ioc = 1; + bufferDescriptors++; + fragments++; + } + /* Setup buffer descriptor list (BDL) entries */ for (index = 0; index < stream->num_buffers; index++, bufferDescriptors++) { - bufferDescriptors->lower = stream->physical_buffers[index]; + bufferDescriptors->lower = stream->physical_buffers[index] + offset; bufferDescriptors->upper = 0; - bufferDescriptors->length = bufferSize; - bufferDescriptors->ioc = 1; + fragments++; + if (index == (stream->num_buffers - 1) && offset > 0) { + bufferDescriptors->length = bufferSize - offset; + bufferDescriptors->ioc = 0; + } else { + bufferDescriptors->length = bufferSize; + bufferDescriptors->ioc = 1; // we want an interrupt after every buffer + } } /* Configure stream registers */ @@ -624,7 +645,7 @@ stream->Write32(HDAC_STREAM_BUFFERS_BASE_LOWER, stream->physical_buffer_descriptors); stream->Write32(HDAC_STREAM_BUFFERS_BASE_UPPER, 0); - stream->Write16(HDAC_STREAM_LAST_VALID, stream->num_buffers - 1); + stream->Write16(HDAC_STREAM_LAST_VALID, fragments); /* total cyclic buffer size in _bytes_ */ stream->Write32(HDAC_STREAM_BUFFER_SIZE, bufferSize * stream->num_buffers); From bonefish at mail.berlios.de Thu Feb 26 01:09:45 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 26 Feb 2009 01:09:45 +0100 Subject: [Haiku-commits] r29323 - 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: <200902260009.n1Q09jqJ019162@sheep.berlios.de> Author: bonefish Date: 2009-02-26 01:09:43 +0100 (Thu, 26 Feb 2009) New Revision: 29323 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29323&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelNode.h Modified: haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h haiku/trunk/headers/private/userlandfs/private/Requests.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/kernel_add_on/kernel_interface.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FSInfo.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSDispatcher.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp 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/haiku_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: Some more work towards adjusting the UserlandFS to the current FS interface: * Split the FSCapabilities bit mask into three bit masks for the FS, the volume, and the vnodes, since we have three independent FS interface structures, now. The latter is not supported in the kernel add-on, yet. * Server: - Temporarily removed some things from the build (the BeOS interface and the cache implementations). - Some WIP in HaikuKernelVolume and [haiku_]kernel_emu.{h,cpp}. - Added HaikuKernelNode, which wraps fs_vnode for the client FS. The server is still quite a bit away from being buildable again. Modified: haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h 2009-02-25 19:12:23 UTC (rev 29322) +++ haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h 2009-02-26 00:09:43 UTC (rev 29323) @@ -13,113 +13,139 @@ CLIENT_FS_HAIKU_KERNEL, }; +// FS capabilities enum { // FS operations FS_CAPABILITY_MOUNT = 0, - FS_CAPABILITY_UNMOUNT, - FS_CAPABILITY_READ_FS_INFO, - FS_CAPABILITY_WRITE_FS_INFO, - FS_CAPABILITY_SYNC, + FS_CAPABILITY_COUNT +}; +// Volume capabilities +enum { + // general operations + FS_VOLUME_CAPABILITY_UNMOUNT, + + FS_VOLUME_CAPABILITY_READ_FS_INFO, + FS_VOLUME_CAPABILITY_WRITE_FS_INFO, + FS_VOLUME_CAPABILITY_SYNC, + + FS_VOLUME_CAPABILITY_GET_VNODE, + + // index directory & index operations + FS_VOLUME_CAPABILITY_OPEN_INDEX_DIR, + FS_VOLUME_CAPABILITY_CLOSE_INDEX_DIR, + FS_VOLUME_CAPABILITY_FREE_INDEX_DIR_COOKIE, + FS_VOLUME_CAPABILITY_READ_INDEX_DIR, + FS_VOLUME_CAPABILITY_REWIND_INDEX_DIR, + + FS_VOLUME_CAPABILITY_CREATE_INDEX, + FS_VOLUME_CAPABILITY_REMOVE_INDEX, + FS_VOLUME_CAPABILITY_READ_INDEX_STAT, + + // query operations + FS_VOLUME_CAPABILITY_OPEN_QUERY, + FS_VOLUME_CAPABILITY_CLOSE_QUERY, + FS_VOLUME_CAPABILITY_FREE_QUERY_COOKIE, + FS_VOLUME_CAPABILITY_READ_QUERY, + FS_VOLUME_CAPABILITY_REWIND_QUERY, + + // support for FS layers + FS_VOLUME_CAPABILITY_ALL_LAYERS_MOUNTED, + FS_VOLUME_CAPABILITY_CREATE_SUB_VNODE, + FS_VOLUME_CAPABILITY_DELETE_SUB_VNODE, + + FS_VOLUME_CAPABILITY_COUNT +}; + +// VNode capabilities +enum { // vnode operations - FS_CAPABILITY_LOOKUP, - FS_CAPABILITY_GET_VNODE_NAME, + FS_VNODE_CAPABILITY_LOOKUP, + FS_VNODE_CAPABILITY_GET_VNODE_NAME, - FS_CAPABILITY_GET_VNODE, - FS_CAPABILITY_PUT_VNODE, - FS_CAPABILITY_REMOVE_VNODE, + FS_VNODE_CAPABILITY_PUT_VNODE, + FS_VNODE_CAPABILITY_REMOVE_VNODE, // VM file access - FS_CAPABILITY_CAN_PAGE, - FS_CAPABILITY_READ_PAGES, - FS_CAPABILITY_WRITE_PAGES, + FS_VNODE_CAPABILITY_CAN_PAGE, + FS_VNODE_CAPABILITY_READ_PAGES, + FS_VNODE_CAPABILITY_WRITE_PAGES, + // asynchronous I/O + FS_VNODE_CAPABILITY_IO, + FS_VNODE_CAPABILITY_CANCEL_IO, + // cache file access - FS_CAPABILITY_GET_FILE_MAP, + FS_VNODE_CAPABILITY_GET_FILE_MAP, // common operations - FS_CAPABILITY_IOCTL, - FS_CAPABILITY_SET_FLAGS, - FS_CAPABILITY_SELECT, - FS_CAPABILITY_DESELECT, - FS_CAPABILITY_FSYNC, + FS_VNODE_CAPABILITY_IOCTL, + FS_VNODE_CAPABILITY_SET_FLAGS, + FS_VNODE_CAPABILITY_SELECT, + FS_VNODE_CAPABILITY_DESELECT, + FS_VNODE_CAPABILITY_FSYNC, - FS_CAPABILITY_READ_SYMLINK, - FS_CAPABILITY_CREATE_SYMLINK, + FS_VNODE_CAPABILITY_READ_SYMLINK, + FS_VNODE_CAPABILITY_CREATE_SYMLINK, - FS_CAPABILITY_LINK, - FS_CAPABILITY_UNLINK, - FS_CAPABILITY_RENAME, + FS_VNODE_CAPABILITY_LINK, + FS_VNODE_CAPABILITY_UNLINK, + FS_VNODE_CAPABILITY_RENAME, - FS_CAPABILITY_ACCESS, - FS_CAPABILITY_READ_STAT, - FS_CAPABILITY_WRITE_STAT, + FS_VNODE_CAPABILITY_ACCESS, + FS_VNODE_CAPABILITY_READ_STAT, + FS_VNODE_CAPABILITY_WRITE_STAT, // file operations - FS_CAPABILITY_CREATE, - FS_CAPABILITY_OPEN, - FS_CAPABILITY_CLOSE, - FS_CAPABILITY_FREE_COOKIE, - FS_CAPABILITY_READ, - FS_CAPABILITY_WRITE, + FS_VNODE_CAPABILITY_CREATE, + FS_VNODE_CAPABILITY_OPEN, + FS_VNODE_CAPABILITY_CLOSE, + FS_VNODE_CAPABILITY_FREE_COOKIE, + FS_VNODE_CAPABILITY_READ, + FS_VNODE_CAPABILITY_WRITE, // directory operations - FS_CAPABILITY_CREATE_DIR, - FS_CAPABILITY_REMOVE_DIR, - FS_CAPABILITY_OPEN_DIR, - FS_CAPABILITY_CLOSE_DIR, - FS_CAPABILITY_FREE_DIR_COOKIE, - FS_CAPABILITY_READ_DIR, - FS_CAPABILITY_REWIND_DIR, + FS_VNODE_CAPABILITY_CREATE_DIR, + FS_VNODE_CAPABILITY_REMOVE_DIR, + FS_VNODE_CAPABILITY_OPEN_DIR, + FS_VNODE_CAPABILITY_CLOSE_DIR, + FS_VNODE_CAPABILITY_FREE_DIR_COOKIE, + FS_VNODE_CAPABILITY_READ_DIR, + FS_VNODE_CAPABILITY_REWIND_DIR, // attribute directory operations - FS_CAPABILITY_OPEN_ATTR_DIR, - FS_CAPABILITY_CLOSE_ATTR_DIR, - FS_CAPABILITY_FREE_ATTR_DIR_COOKIE, - FS_CAPABILITY_READ_ATTR_DIR, - FS_CAPABILITY_REWIND_ATTR_DIR, + FS_VNODE_CAPABILITY_OPEN_ATTR_DIR, + FS_VNODE_CAPABILITY_CLOSE_ATTR_DIR, + FS_VNODE_CAPABILITY_FREE_ATTR_DIR_COOKIE, + FS_VNODE_CAPABILITY_READ_ATTR_DIR, + FS_VNODE_CAPABILITY_REWIND_ATTR_DIR, // attribute operations - FS_CAPABILITY_CREATE_ATTR, - FS_CAPABILITY_OPEN_ATTR, - FS_CAPABILITY_CLOSE_ATTR, - FS_CAPABILITY_FREE_ATTR_COOKIE, - FS_CAPABILITY_READ_ATTR, - FS_CAPABILITY_WRITE_ATTR, + FS_VNODE_CAPABILITY_CREATE_ATTR, + FS_VNODE_CAPABILITY_OPEN_ATTR, + FS_VNODE_CAPABILITY_CLOSE_ATTR, + FS_VNODE_CAPABILITY_FREE_ATTR_COOKIE, + FS_VNODE_CAPABILITY_READ_ATTR, + FS_VNODE_CAPABILITY_WRITE_ATTR, - FS_CAPABILITY_READ_ATTR_STAT, - FS_CAPABILITY_WRITE_ATTR_STAT, - FS_CAPABILITY_RENAME_ATTR, - FS_CAPABILITY_REMOVE_ATTR, + FS_VNODE_CAPABILITY_READ_ATTR_STAT, + FS_VNODE_CAPABILITY_WRITE_ATTR_STAT, + FS_VNODE_CAPABILITY_RENAME_ATTR, + FS_VNODE_CAPABILITY_REMOVE_ATTR, - // index directory & index operations - FS_CAPABILITY_OPEN_INDEX_DIR, - FS_CAPABILITY_CLOSE_INDEX_DIR, - FS_CAPABILITY_FREE_INDEX_DIR_COOKIE, - FS_CAPABILITY_READ_INDEX_DIR, - FS_CAPABILITY_REWIND_INDEX_DIR, + // support for node and FS layers + FS_VNODE_CAPABILITY_CREATE_SPECIAL_NODE, + FS_VNODE_CAPABILITY_GET_SUPER_VNODE, - FS_CAPABILITY_CREATE_INDEX, - FS_CAPABILITY_REMOVE_INDEX, - FS_CAPABILITY_READ_INDEX_STAT, - - // query operations - FS_CAPABILITY_OPEN_QUERY, - FS_CAPABILITY_CLOSE_QUERY, - FS_CAPABILITY_FREE_QUERY_COOKIE, - FS_CAPABILITY_READ_QUERY, - FS_CAPABILITY_REWIND_QUERY, - - FS_CAPABILITY_COUNT, + FS_VNODE_CAPABILITY_COUNT }; - namespace UserlandFSUtil { -struct FSCapabilities { - client_fs_type clientFSType; - uint8 capabilities[(FS_CAPABILITY_COUNT + 7) / 8]; +template +struct FSCapabilitiesBase { + uint8 capabilities[(CapabilityCount + 7) / 8]; inline void ClearAll(); @@ -131,17 +157,19 @@ }; // ClearAll +template inline void -FSCapabilities::ClearAll() +FSCapabilitiesBase::ClearAll() { memset(capabilities, 0, sizeof(capabilities)); } // Set +template inline void -FSCapabilities::Set(uint32 capability, bool set) +FSCapabilitiesBase::Set(uint32 capability, bool set) { - if (capability >= FS_CAPABILITY_COUNT) + if (capability >= CapabilityCount) return; uint8 flag = uint8(1 << (capability % 8)); @@ -152,17 +180,19 @@ } // Clear +template inline void -FSCapabilities::Clear(uint32 capability) +FSCapabilitiesBase::Clear(uint32 capability) { Set(capability, false); } // Get +template inline bool -FSCapabilities::Get(uint32 capability) const +FSCapabilitiesBase::Get(uint32 capability) const { - if (capability >= FS_CAPABILITY_COUNT) + if (capability >= CapabilityCount) return false; uint8 flag = uint8(1 << (capability % 8)); @@ -170,8 +200,9 @@ } // Dump +template inline void -FSCapabilities::Dump() const +FSCapabilitiesBase::Dump() const { D( char buffer[128]; @@ -179,11 +210,15 @@ for (int i = 0; i < byteCount; i++) sprintf(buffer + 2 * i, "%02x", (int)capabilities[i]); - PRINT(("FSCapabilities[%d, %s]\n", clientFSType, buffer)); + PRINT(("FSCapabilities[%s]\n", buffer)); ) } +typedef FSCapabilitiesBase FSCapabilities; +typedef FSCapabilitiesBase FSVolumeCapabilities; +typedef FSCapabilitiesBase FSVNodeCapabilities; + } // namespace UserlandFSUtil using UserlandFSUtil::FSCapabilities; Modified: haiku/trunk/headers/private/userlandfs/private/Requests.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-02-25 19:12:23 UTC (rev 29322) +++ haiku/trunk/headers/private/userlandfs/private/Requests.h 2009-02-26 00:09:43 UTC (rev 29323) @@ -316,6 +316,7 @@ Address portInfos; int32 portInfoCount; FSCapabilities capabilities; + client_fs_type clientFSType; }; @@ -340,8 +341,9 @@ public: MountVolumeReply() : ReplyRequest(MOUNT_VOLUME_REPLY) {} - ino_t rootID; - void* volume; + ino_t rootID; + void* volume; + FSVolumeCapabilities capabilities; }; // UnmountVolumeRequest 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-02-25 19:12:23 UTC (rev 29322) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.cpp 2009-02-26 00:09:43 UTC (rev 29323) @@ -282,7 +282,7 @@ Volume::Sync() { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_SYNC)) + if (!HasCapability(FS_VOLUME_CAPABILITY_SYNC)) return B_BAD_VALUE; // get a free port @@ -343,7 +343,7 @@ Volume::WriteFSInfo(const struct fs_info *info, uint32 mask) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_WRITE_FS_INFO)) + if (!HasCapability(FS_VOLUME_CAPABILITY_WRITE_FS_INFO)) return B_BAD_VALUE; // get a free port @@ -635,7 +635,7 @@ } // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_IOCTL)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_IOCTL)) return B_BAD_VALUE; // get a free port @@ -695,7 +695,7 @@ Volume::SetFlags(void* node, void* cookie, int flags) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_SET_FLAGS)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_SET_FLAGS)) return B_BAD_VALUE; // get a free port @@ -735,7 +735,7 @@ Volume::Select(void* node, void* cookie, uint8 event, selectsync* sync) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_SELECT)) { + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_SELECT)) { notify_select_event(sync, event); return B_OK; } @@ -787,7 +787,7 @@ Volume::Deselect(void* node, void* cookie, uint8 event, selectsync* sync) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_DESELECT)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_DESELECT)) return B_OK; struct SyncRemover { @@ -837,7 +837,7 @@ Volume::FSync(void* node) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_FSYNC)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_FSYNC)) return B_BAD_VALUE; // get a free port @@ -878,7 +878,7 @@ *bytesRead = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_SYMLINK)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_READ_SYMLINK)) return B_BAD_VALUE; // get a free port @@ -927,7 +927,7 @@ int mode) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_SYMLINK)) + if (!HasVNodeCapability(dir, FS_VNODE_CAPABILITY_CREATE_SYMLINK)) return B_BAD_VALUE; // get a free port @@ -971,7 +971,7 @@ Volume::Link(void* dir, const char* name, void* node) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_LINK)) + if (!HasVNodeCapability(dir, FS_VNODE_CAPABILITY_LINK)) return B_BAD_VALUE; // get a free port @@ -1013,7 +1013,7 @@ Volume::Unlink(void* dir, const char* name) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_UNLINK)) + if (!HasVNodeCapability(dir, FS_VNODE_CAPABILITY_UNLINK)) return B_BAD_VALUE; // get a free port @@ -1055,7 +1055,7 @@ const char* newName) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_RENAME)) + if (!HasVNodeCapability(oldDir, FS_VNODE_CAPABILITY_RENAME)) return B_BAD_VALUE; // get a free port @@ -1099,7 +1099,7 @@ Volume::Access(void* node, int mode) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_ACCESS)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_ACCESS)) return B_OK; // get a free port @@ -1168,7 +1168,7 @@ Volume::WriteStat(void* node, const struct stat* st, uint32 mask) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_WRITE_STAT)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_WRITE_STAT)) return B_BAD_VALUE; // get a free port @@ -1212,7 +1212,7 @@ void** cookie, ino_t* vnid) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE)) + if (!HasVNodeCapability(dir, FS_VNODE_CAPABILITY_CREATE)) return B_BAD_VALUE; // get a free port @@ -1262,7 +1262,7 @@ Volume::Open(void* node, int openMode, void** cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_OPEN)) return B_BAD_VALUE; // get a free port @@ -1341,7 +1341,7 @@ *bytesRead = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_READ)) return B_BAD_VALUE; // get a free port @@ -1394,7 +1394,7 @@ *bytesWritten = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_WRITE)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_WRITE)) return B_BAD_VALUE; // get a free port @@ -1441,7 +1441,7 @@ Volume::CreateDir(void* dir, const char* name, int mode, ino_t *newDir) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_DIR)) + if (!HasVNodeCapability(dir, FS_VNODE_CAPABILITY_CREATE_DIR)) return B_BAD_VALUE; // get a free port @@ -1484,7 +1484,7 @@ Volume::RemoveDir(void* dir, const char* name) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_REMOVE_DIR)) + if (!HasVNodeCapability(dir, FS_VNODE_CAPABILITY_REMOVE_DIR)) return B_BAD_VALUE; // get a free port @@ -1525,7 +1525,7 @@ Volume::OpenDir(void* node, void** cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_OPEN_DIR)) return B_BAD_VALUE; // get a free port @@ -1604,7 +1604,7 @@ *countRead = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_READ_DIR)) return B_BAD_VALUE; // get a free port @@ -1663,7 +1663,7 @@ Volume::RewindDir(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_REWIND_DIR)) return B_BAD_VALUE; // get a free port @@ -1706,7 +1706,7 @@ Volume::OpenAttrDir(void* node, void** cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_ATTR_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_OPEN_ATTR_DIR)) return B_BAD_VALUE; // get a free port @@ -1785,7 +1785,7 @@ size_t bufferSize, uint32 count, uint32* countRead) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_ATTR_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_READ_ATTR_DIR)) return B_BAD_VALUE; *countRead = 0; @@ -1843,7 +1843,7 @@ Volume::RewindAttrDir(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_ATTR_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_REWIND_ATTR_DIR)) return B_BAD_VALUE; // get a free port @@ -1886,7 +1886,7 @@ void** cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_ATTR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_CREATE_ATTR)) return B_BAD_VALUE; // get a free port @@ -1933,7 +1933,7 @@ void** cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_ATTR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_OPEN_ATTR)) return B_BAD_VALUE; // get a free port @@ -2017,7 +2017,7 @@ *bytesRead = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_ATTR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_READ_ATTR)) return B_BAD_VALUE; // get a free port @@ -2070,7 +2070,7 @@ *bytesWritten = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_WRITE_ATTR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_WRITE_ATTR)) return B_BAD_VALUE; // get a free port @@ -2114,7 +2114,7 @@ Volume::ReadAttrStat(void* node, void* cookie, struct stat *st) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_ATTR_STAT)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_READ_ATTR_STAT)) return B_BAD_VALUE; // get a free port @@ -2155,7 +2155,7 @@ int statMask) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_WRITE_ATTR_STAT)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_WRITE_ATTR_STAT)) return B_BAD_VALUE; // get a free port @@ -2197,7 +2197,7 @@ const char* newName) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_RENAME_ATTR)) + if (!HasVNodeCapability(oldNode, FS_VNODE_CAPABILITY_RENAME_ATTR)) return B_BAD_VALUE; // get a free port @@ -2241,7 +2241,7 @@ Volume::RemoveAttr(void* node, const char* name) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_REMOVE_ATTR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_REMOVE_ATTR)) return B_BAD_VALUE; // get a free port @@ -2286,7 +2286,7 @@ Volume::OpenIndexDir(void** cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_INDEX_DIR)) + if (!HasCapability(FS_VOLUME_CAPABILITY_OPEN_INDEX_DIR)) return B_BAD_VALUE; // get a free port @@ -2366,7 +2366,7 @@ *countRead = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_INDEX_DIR)) + if (!HasCapability(FS_VOLUME_CAPABILITY_READ_INDEX_DIR)) return B_BAD_VALUE; // get a free port @@ -2422,7 +2422,7 @@ Volume::RewindIndexDir(void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_INDEX_DIR)) + if (!HasCapability(FS_VOLUME_CAPABILITY_REWIND_INDEX_DIR)) return B_BAD_VALUE; // get a free port @@ -2460,7 +2460,7 @@ Volume::CreateIndex(const char* name, uint32 type, uint32 flags) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CREATE_INDEX)) + if (!HasCapability(FS_VOLUME_CAPABILITY_CREATE_INDEX)) return B_BAD_VALUE; // get a free port @@ -2502,7 +2502,7 @@ Volume::RemoveIndex(const char* name) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_REMOVE_INDEX)) + if (!HasCapability(FS_VOLUME_CAPABILITY_REMOVE_INDEX)) return B_BAD_VALUE; // get a free port @@ -2542,7 +2542,7 @@ Volume::ReadIndexStat(const char* name, struct stat *st) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_INDEX_STAT)) + if (!HasCapability(FS_VOLUME_CAPABILITY_READ_INDEX_STAT)) return B_BAD_VALUE; // get a free port @@ -2588,7 +2588,7 @@ uint32 token, void** cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_OPEN_QUERY)) + if (!HasCapability(FS_VOLUME_CAPABILITY_OPEN_QUERY)) return B_BAD_VALUE; // get a free port @@ -2673,7 +2673,7 @@ *countRead = 0; // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_QUERY)) + if (!HasCapability(FS_VOLUME_CAPABILITY_READ_QUERY)) return B_BAD_VALUE; // get a free port @@ -2729,7 +2729,7 @@ Volume::RewindQuery(void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_REWIND_QUERY)) + if (!HasCapability(FS_VOLUME_CAPABILITY_REWIND_QUERY)) return B_BAD_VALUE; // get a free port @@ -2810,6 +2810,7 @@ return reply->error; fRootID = reply->rootID; fUserlandVolume = reply->volume; + fCapabilities = reply->capabilities; // enable vnode counting fVNodeCountMap = new(nothrow) VNodeCountMap; @@ -2858,7 +2859,7 @@ Volume::_ReadFSInfo(fs_info* info) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_FS_INFO)) + if (!HasCapability(FS_VOLUME_CAPABILITY_READ_FS_INFO)) return B_BAD_VALUE; // get a free port @@ -2970,7 +2971,7 @@ Volume::_ReadStat(void* node, struct stat* st) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_READ_STAT)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_READ_STAT)) return B_BAD_VALUE; // get a free port @@ -3009,7 +3010,7 @@ Volume::_Close(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_CLOSE)) return B_OK; // get a free port @@ -3048,7 +3049,7 @@ Volume::_FreeCookie(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_COOKIE)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_FREE_COOKIE)) return B_OK; // get a free port @@ -3087,7 +3088,7 @@ Volume::_CloseDir(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_CLOSE_DIR)) return B_OK; // get a free port @@ -3126,7 +3127,7 @@ Volume::_FreeDirCookie(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_DIR_COOKIE)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_FREE_DIR_COOKIE)) return B_OK; // get a free port @@ -3165,7 +3166,7 @@ Volume::_CloseAttrDir(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_ATTR_DIR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_CLOSE_ATTR_DIR)) return B_OK; // get a free port @@ -3204,7 +3205,7 @@ Volume::_FreeAttrDirCookie(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_ATTR_DIR_COOKIE)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_FREE_ATTR_DIR_COOKIE)) return B_OK; // get a free port @@ -3243,7 +3244,7 @@ Volume::_CloseAttr(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_ATTR)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_CLOSE_ATTR)) return B_OK; // get a free port @@ -3282,7 +3283,7 @@ Volume::_FreeAttrCookie(void* node, void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_ATTR_COOKIE)) + if (!HasVNodeCapability(node, FS_VNODE_CAPABILITY_FREE_ATTR_COOKIE)) return B_OK; // get a free port @@ -3321,7 +3322,7 @@ Volume::_CloseIndexDir(void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_INDEX_DIR)) + if (!HasCapability(FS_VOLUME_CAPABILITY_CLOSE_INDEX_DIR)) return B_OK; // get a free port @@ -3359,7 +3360,7 @@ Volume::_FreeIndexDirCookie(void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_INDEX_DIR_COOKIE)) + if (!HasCapability(FS_VOLUME_CAPABILITY_FREE_INDEX_DIR_COOKIE)) return B_OK; // get a free port @@ -3397,7 +3398,7 @@ Volume::_CloseQuery(void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_CLOSE_QUERY)) + if (!HasCapability(FS_VOLUME_CAPABILITY_CLOSE_QUERY)) return B_OK; // get a free port @@ -3435,7 +3436,7 @@ Volume::_FreeQueryCookie(void* cookie) { // check capability - if (!fFileSystem->HasCapability(FS_CAPABILITY_FREE_QUERY_COOKIE)) + if (!HasCapability(FS_VOLUME_CAPABILITY_FREE_QUERY_COOKIE)) return B_OK; // get a free port 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-02-25 19:12:23 UTC (rev 29322) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/Volume.h 2009-02-26 00:09:43 UTC (rev 29323) @@ -7,6 +7,7 @@ #include +#include "FSCapabilities.h" #include "Referencable.h" namespace UserlandFSUtil { @@ -19,6 +20,7 @@ } +using UserlandFSUtil::FSVolumeCapabilities; using UserlandFSUtil::Request; using UserlandFSUtil::RequestAllocator; using UserlandFSUtil::RequestHandler; @@ -36,6 +38,10 @@ FileSystem* GetFileSystem() const; inline dev_t GetID() const; + inline bool HasCapability(int capability) const; + inline bool HasVNodeCapability(void* vnode, + int capability) const; + void* GetUserlandVolume() const; ino_t GetRootID() const; bool IsMounting() const; @@ -226,6 +232,7 @@ FileSystem* fFileSystem; fs_volume* fFSVolume; + FSVolumeCapabilities fCapabilities; void* fUserlandVolume; ino_t fRootID; void* fRootNode; @@ -252,4 +259,19 @@ } +inline bool +Volume::HasCapability(int capability) const +{ + return fCapabilities.Get(capability); +} + + +inline bool +Volume::HasVNodeCapability(void* vnode, int capability) const +{ + // TODO: Implement for real! + return true; +} + + #endif // USERLAND_FS_VOLUME_H 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-02-25 19:12:23 UTC (rev 29322) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/kernel_add_on/kernel_interface.cpp 2009-02-26 00:09:43 UTC (rev 29323) @@ -1168,13 +1168,11 @@ &userlandfs_put_vnode, &userlandfs_remove_vnode, - // VM file access NULL, // &userlandfs_can_page, NULL, // &userlandfs_read_pages, NULL, // &userlandfs_write_pages, - // asynchronous I/O NULL, // &userlandfs_io NULL, // &userlandfs_cancel_io Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp 2009-02-25 19:12:23 UTC (rev 29322) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp 2009-02-26 00:09:43 UTC (rev 29323) @@ -114,8 +114,7 @@ // Lookup status_t -BeOSKernelVolume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid, - int* type) +BeOSKernelVolume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid) { if (!fFSOps->walk) return B_BAD_VALUE; @@ -147,7 +146,7 @@ if (error == B_OK) *type = (st.st_mode & S_IFMT); - // put the node for our get_vnode() + // put the node for our get_vnode() UserlandFS::KernelEmu::put_vnode(GetID(), *vnid); // on error put the node for walk()'s get_vnode() @@ -169,8 +168,10 @@ // ReadVNode status_t -BeOSKernelVolume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node) +BeOSKernelVolume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node, int* type, + uint32* flags) { +#error Return type and flags! if (!fFSOps->read_vnode) return B_BAD_VALUE; return fFSOps->read_vnode(fVolumeCookie, vnid, (char)reenter, node); @@ -221,13 +222,13 @@ // Select status_t BeOSKernelVolume::Select(fs_vnode node, fs_cookie cookie, uint8 event, - uint32 ref, selectsync* sync) + selectsync* sync) { if (!fFSOps->select) { UserlandFS::KernelEmu::notify_select_event(sync, event, false); return B_OK; } - return fFSOps->select(fVolumeCookie, node, cookie, event, ref, sync); + return fFSOps->select(fVolumeCookie, node, cookie, event, 0, sync); } // Deselect @@ -326,7 +327,7 @@ { if (!fFSOps->wstat) return B_BAD_VALUE; - + // Haiku's struct stat has an additional st_type field (for an attribute // type), but that doesn't matter here return fFSOps->wstat(fVolumeCookie, node, (struct beos_stat*)st, @@ -472,7 +473,7 @@ return B_BAD_VALUE; *countRead = count; - + // Haiku's struct dirent equals BeOS's version return fFSOps->readdir(fVolumeCookie, node, cookie, (long*)countRead, (beos_dirent*)buffer, bufferSize); Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h 2009-02-25 19:12:23 UTC (rev 29322) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h 2009-02-26 00:09:43 UTC (rev 29323) @@ -26,12 +26,12 @@ [... truncated: 2669 lines follow ...] From oruizdorantes at mail.berlios.de Thu Feb 26 21:52:14 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Thu, 26 Feb 2009 21:52:14 +0100 Subject: [Haiku-commits] r29324 - haiku/trunk/src/bin Message-ID: <200902262052.n1QKqESr002087@sheep.berlios.de> Author: oruizdorantes Date: 2009-02-26 21:52:14 +0100 (Thu, 26 Feb 2009) New Revision: 29324 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29324&view=rev Modified: haiku/trunk/src/bin/bt_dev_info.cpp Log: Discoverability can be set through preferences now Modified: haiku/trunk/src/bin/bt_dev_info.cpp =================================================================== --- haiku/trunk/src/bin/bt_dev_info.cpp 2009-02-26 00:09:43 UTC (rev 29323) +++ haiku/trunk/src/bin/bt_dev_info.cpp 2009-02-26 20:52:14 UTC (rev 29324) @@ -27,8 +27,6 @@ classString << " |"; cod.GetMinorDeviceClass(classString); printf("\t\t%s: \n", classString.String()); - - printf("Discovery %ld\n", device->SetDiscoverable(3)); } static status_t From oruizdorantes at mail.berlios.de Thu Feb 26 21:56:28 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Thu, 26 Feb 2009 21:56:28 +0100 Subject: [Haiku-commits] r29325 - haiku/trunk/src/preferences/bluetooth Message-ID: <200902262056.n1QKuSfJ002421@sheep.berlios.de> Author: oruizdorantes Date: 2009-02-26 21:56:27 +0100 (Thu, 26 Feb 2009) New Revision: 29325 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29325&view=rev Added: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp haiku/trunk/src/preferences/bluetooth/DeviceListItem.h Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp Log: Separate stolen ListItem subclass to work on a new one for bluetooth devices Added: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-02-26 20:52:14 UTC (rev 29324) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-02-26 20:56:27 UTC (rev 29325) @@ -0,0 +1,87 @@ +/* + * Copyright 2009, Oliver Ruiz Dorantes, + * All rights reserved. Distributed under the terms of the MIT License. + */ +#include "DeviceListItem.h" +#include + + +#include +#include + +namespace bluetooth { + +RangeItem::RangeItem(uint32 lowAddress, uint32 highAddress, const char* name) + : BListItem(), + fLowAddress(lowAddress), + fHighAddress(highAddress) +{ + fName = strdup(name); +} + +RangeItem::~RangeItem() +{ + delete fName; +} + +/*********************************************************** + * DrawItem + ***********************************************************/ +void +RangeItem::DrawItem(BView *owner, BRect itemRect, bool complete) +{ + rgb_color kBlack = { 0,0,0,0 }; + rgb_color kHighlight = { 156,154,156,0 }; + + if (IsSelected() || complete) { + rgb_color color; + if (IsSelected()) + color = kHighlight; + else + color = owner->ViewColor(); + + owner->SetHighColor(color); + owner->SetLowColor(color); + owner->FillRect(itemRect); + owner->SetHighColor(kBlack); + + } else { + owner->SetLowColor(owner->ViewColor()); + } + + BFont font = be_plain_font; + font_height finfo; + font.GetHeight(&finfo); + + BPoint point = BPoint(itemRect.left + 17, itemRect.bottom - finfo.descent + 1); + owner->SetFont(be_fixed_font); + owner->SetHighColor(kBlack); + owner->MovePenTo(point); + +/* if (fLowAddress >= 0) { + char string[255]; + sprintf(string, "0x%04lx - 0x%04lx", fLowAddress, fHighAddress); + owner->DrawString(string); + } + point += BPoint(174, 0);*/ + owner->SetFont(be_plain_font); + owner->MovePenTo(point); + owner->DrawString(fName); +} + +int +RangeItem::Compare(const void *firstArg, const void *secondArg) +{ + const RangeItem *item1 = *static_cast(firstArg); + const RangeItem *item2 = *static_cast(secondArg); + + if (item1->fLowAddress < item2->fLowAddress) { + return -1; + } else if (item1->fLowAddress > item2->fLowAddress) { + return 1; + } else + return 0; + +} + +} Added: haiku/trunk/src/preferences/bluetooth/DeviceListItem.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-02-26 20:52:14 UTC (rev 29324) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-02-26 20:56:27 UTC (rev 29325) @@ -0,0 +1,28 @@ +/* + * Copyright 2009, Oliver Ruiz Dorantes, + * All rights reserved. Distributed under the terms of the MIT License. + */ +#ifndef DEVICELISTITEM_H_ +#define DEVICELISTITEM_H_ + +#include + +namespace bluetooth { + +// TODO: Implement a BluetoothDeviceListItem class, this one is stolen from somewhere ..... +class RangeItem : public BListItem +{ + public: + RangeItem(uint32 lowAddress, uint32 highAddress, const char* name); + ~RangeItem(); + virtual void DrawItem(BView *, BRect, bool = false); + static int Compare(const void *firstArg, const void *secondArg); + private: + char* fName; + uint32 fLowAddress, fHighAddress; +}; + +} + + +#endif Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-26 20:52:14 UTC (rev 29324) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-26 20:56:27 UTC (rev 29325) @@ -20,7 +20,10 @@ #include #include "InquiryPanel.h" +#include "DeviceListItem.h" +using namespace bluetooth; + // private funcionaility provided by kit extern uint8 GetInquiryTime(); @@ -34,94 +37,7 @@ static const uint32 kMsgAddToRemoteList = 'aDdL'; static const uint32 kMsgSecond = 'sCMs'; -// TODO: Implement a BluetoothDeviceListItem class, this one is stolen from somewhere ..... -class RangeItem : public BListItem -{ - public: - RangeItem(uint32 lowAddress, uint32 highAddress, const char* name); - ~RangeItem(); - virtual void DrawItem(BView *, BRect, bool = false); - static int Compare(const void *firstArg, const void *secondArg); - private: - char* fName; - uint32 fLowAddress, fHighAddress; -}; -RangeItem::RangeItem(uint32 lowAddress, uint32 highAddress, const char* name) - : BListItem(), - fLowAddress(lowAddress), - fHighAddress(highAddress) -{ - fName = strdup(name); -} - -RangeItem::~RangeItem() -{ - delete fName; -} - -/*********************************************************** - * DrawItem - ***********************************************************/ -void -RangeItem::DrawItem(BView *owner, BRect itemRect, bool complete) -{ - rgb_color kBlack = { 0,0,0,0 }; - rgb_color kHighlight = { 156,154,156,0 }; - - if (IsSelected() || complete) { - rgb_color color; - if (IsSelected()) - color = kHighlight; - else - color = owner->ViewColor(); - - owner->SetHighColor(color); - owner->SetLowColor(color); - owner->FillRect(itemRect); - owner->SetHighColor(kBlack); - - } else { - owner->SetLowColor(owner->ViewColor()); - } - - BFont font = be_plain_font; - font_height finfo; - font.GetHeight(&finfo); - - BPoint point = BPoint(itemRect.left + 17, itemRect.bottom - finfo.descent + 1); - owner->SetFont(be_fixed_font); - owner->SetHighColor(kBlack); - owner->MovePenTo(point); - -/* if (fLowAddress >= 0) { - char string[255]; - sprintf(string, "0x%04lx - 0x%04lx", fLowAddress, fHighAddress); - owner->DrawString(string); - } - point += BPoint(174, 0);*/ - owner->SetFont(be_plain_font); - owner->MovePenTo(point); - owner->DrawString(fName); -} - -int -RangeItem::Compare(const void *firstArg, const void *secondArg) -{ - const RangeItem *item1 = *static_cast(firstArg); - const RangeItem *item2 = *static_cast(secondArg); - - if (item1->fLowAddress < item2->fLowAddress) { - return -1; - } else if (item1->fLowAddress > item2->fLowAddress) { - return 1; - } else - return 0; - -} - - - class PanelDiscoveryListener : public DiscoveryListener { public: From bga at mail.berlios.de Thu Feb 26 23:38:25 2009 From: bga at mail.berlios.de (bga at BerliOS) Date: Thu, 26 Feb 2009 23:38:25 +0100 Subject: [Haiku-commits] r29326 - haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox Message-ID: <200902262238.n1QMcPkJ010292@sheep.berlios.de> Author: bga Date: 2009-02-26 23:38:24 +0100 (Thu, 26 Feb 2009) New Revision: 29326 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29326&view=rev Modified: haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp Log: This fixes retrieval of email from IMAP servers. It seems there is a difference between the behaviour of BPath in R5 and Haiku (as this used to work in R5). More specifically: BPath blah("blah"); printf("%s\n", blah.Path()); It seems that in R5 it would print "blah" (untested as I don't have R5 anymore, but this code definitelly used to work). And in Haiku it prints "/currrent/path/blah". This fixed bug #3187. Modified: haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp =================================================================== --- haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp 2009-02-26 20:56:27 UTC (rev 29325) +++ haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp 2009-02-26 22:38:24 UTC (rev 29326) @@ -142,7 +142,7 @@ else path.Append(string); } else if (loc != NULL && loc->Path() != NULL && strcmp(loc->Path(),"") != 0) // --- Don't append folder names to overridden paths - path.Append(loc->Path()); + path.Append(loc->Leaf()); create_directory(path.Path(),0777); dir.SetTo(path.Path()); From axeld at pinc-software.de Thu Feb 26 23:50:14 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 26 Feb 2009 23:50:14 +0100 CET Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A17CA1.8030201@googlemail.com> Message-ID: <49936944022-BeMail@zon> Humdinger wrote: > While we're on vmx config, is there a way to have a native resolution > (1658x1050) in vmware? Newer ones can do this, older ones too (just many releases inbetween couldn't) - it's automatically part of the resolutions VESA shows. Bye, Axel. From ingo_weinhold at gmx.de Fri Feb 27 00:19:38 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 27 Feb 2009 00:19:38 +0100 Subject: [Haiku-commits] r29326 - haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox In-Reply-To: <200902262238.n1QMcPkJ010292@sheep.berlios.de> References: <200902262238.n1QMcPkJ010292@sheep.berlios.de> Message-ID: <20090227001938.937.1@knochen-vm.localdomain> On 2009-02-26 at 23:38:25 [+0100], bga at BerliOS wrote: > Author: bga > Date: 2009-02-26 23:38:24 +0100 (Thu, 26 Feb 2009) > New Revision: 29326 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29326&view=rev > > Modified: > haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp > Log: > This fixes retrieval of email from IMAP servers. It seems there is a > difference between the behaviour of BPath in R5 and Haiku (as this used to > work in R5). More specifically: > > BPath blah("blah"); > printf("%s\n", blah.Path()); > > It seems that in R5 it would print "blah" (untested as I don't have R5 > anymore, but this code definitelly used to work). And in Haiku it prints > "/currrent/path/blah". It works just as in BeOS R5. Unsurprisingly, since the BPath section in the BeBook is pretty clear about that. It starts with "A BPath object represents an absolute pathname...". A few lines later: "It always represents an absolute path. The pathname strings that you use to initialize a BPath can be relative, and they can include references to "." and "..". The BPath "normalizes" the passed-in strings to create an absolute pathname, as described in "Initializing and Normalizing"." CU, Ingo From korli at mail.berlios.de Fri Feb 27 00:27:29 2009 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 27 Feb 2009 00:27:29 +0100 Subject: [Haiku-commits] r29327 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200902262327.n1QNRToJ014201@sheep.berlios.de> Author: korli Date: 2009-02-27 00:27:28 +0100 (Fri, 27 Feb 2009) New Revision: 29327 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29327&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp Log: * compute offset based on vendor (32 for non intel) and sample rate Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2009-02-26 22:38:24 UTC (rev 29326) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2009-02-26 23:27:28 UTC (rev 29327) @@ -504,14 +504,13 @@ const char* desc) { uint32 bufferSize, bufferPhysicalAddress, alloc; - uint32 response[2], index; + uint32 response[2]; physical_entry pe; bdl_entry_t* bufferDescriptors; corb_t verb[2]; uint8* buffer; status_t rc; - uint16 format; - + /* Clear previously allocated memory */ if (stream->buffer_area >= B_OK) { delete_area(stream->buffer_area); @@ -523,10 +522,34 @@ stream->buffer_descriptors_area = B_ERROR; } + /* Find out stream format and sample rate */ + uint16 format = (stream->num_channels - 1) & 0xf; + switch (stream->sample_format) { + case B_FMT_8BIT_S: format |= FORMAT_8BIT; stream->bps = 8; break; + case B_FMT_16BIT: format |= FORMAT_16BIT; stream->bps = 16; break; + case B_FMT_20BIT: format |= FORMAT_20BIT; stream->bps = 20; break; + case B_FMT_24BIT: format |= FORMAT_24BIT; stream->bps = 24; break; + case B_FMT_32BIT: format |= FORMAT_32BIT; stream->bps = 32; break; + + default: + dprintf("hda: Invalid sample format: 0x%lx\n", + stream->sample_format); + break; + } + + for (uint32 index = 0; index < sizeof(kRates) / sizeof(kRates[0]); index++) { + if (kRates[index].multi_rate == stream->sample_rate) { + format |= kRates[index].hw_rate; + stream->rate = kRates[index].rate; + break; + } + } + // Stream interrupts seem to arrive too early on most HDA // so we adjust buffer descriptors to take this into account - // TODO compute this value based on sample rate and depending on the hardware - uint32 offset = 1 * (stream->sample_size * stream->num_channels); + uint32 offset = (stream->sample_size * stream->num_channels) * stream->rate / 48000; + if (stream->controller->pci_info.vendor_id != INTEL_VENDORID) + offset *= 32; /* Calculate size of buffer (aligned to 128 bytes) */ bufferSize = stream->sample_size * stream->num_channels @@ -535,6 +558,8 @@ dprintf("HDA: sample size %ld, num channels %ld, buffer length %ld, offset %ld **********\n", stream->sample_size, stream->num_channels, stream->buffer_length, offset); + dprintf("IRA: %s: setup stream %ld: SR=%ld, SF=%ld F=0x%x\n", __func__, stream->id, + stream->rate, stream->bps, format); /* Calculate total size of all buffers (aligned to size of B_PAGE_SIZE) */ alloc = bufferSize * stream->num_buffers; @@ -559,7 +584,7 @@ alloc, stream->num_buffers); /* Store pointers (both virtual/physical) */ - for (index = 0; index < stream->num_buffers; index++) { + for (uint32 index = 0; index < stream->num_buffers; index++) { stream->buffers[index] = buffer + (index * bufferSize); stream->physical_buffers[index] = bufferPhysicalAddress + (index * bufferSize); @@ -601,7 +626,7 @@ } /* Setup buffer descriptor list (BDL) entries */ - for (index = 0; index < stream->num_buffers; index++, bufferDescriptors++) { + for (uint32 index = 0; index < stream->num_buffers; index++, bufferDescriptors++) { bufferDescriptors->lower = stream->physical_buffers[index] + offset; bufferDescriptors->upper = 0; fragments++; @@ -616,31 +641,6 @@ } /* Configure stream registers */ - format = (stream->num_channels - 1) & 0xf; - switch (stream->sample_format) { - case B_FMT_8BIT_S: format |= FORMAT_8BIT; stream->bps = 8; break; - case B_FMT_16BIT: format |= FORMAT_16BIT; stream->bps = 16; break; - case B_FMT_20BIT: format |= FORMAT_20BIT; stream->bps = 20; break; - case B_FMT_24BIT: format |= FORMAT_24BIT; stream->bps = 24; break; - case B_FMT_32BIT: format |= FORMAT_32BIT; stream->bps = 32; break; - - default: - dprintf("hda: Invalid sample format: 0x%lx\n", - stream->sample_format); - break; - } - - for (index = 0; index < sizeof(kRates) / sizeof(kRates[0]); index++) { - if (kRates[index].multi_rate == stream->sample_rate) { - format |= kRates[index].hw_rate; - stream->rate = kRates[index].rate; - break; - } - } - - dprintf("IRA: %s: setup stream %ld: SR=%ld, SF=%ld F=0x%x\n", __func__, stream->id, - stream->rate, stream->bps, format); - stream->Write16(HDAC_STREAM_FORMAT, format); stream->Write32(HDAC_STREAM_BUFFERS_BASE_LOWER, stream->physical_buffer_descriptors); From superstippi at gmx.de Fri Feb 27 00:31:41 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Fri, 27 Feb 2009 00:31:41 +0100 Subject: [Haiku-commits] r29326 - haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox In-Reply-To: <200902262238.n1QMcPkJ010292@sheep.berlios.de> References: <200902262238.n1QMcPkJ010292@sheep.berlios.de> Message-ID: <20090226233141.264070@gmx.net> -------- Original-Nachricht -------- > Datum: Thu, 26 Feb 2009 23:38:25 +0100 > Von: bga at BerliOS > An: haiku-commits at lists.berlios.de > Betreff: [Haiku-commits] r29326 - haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox > Author: bga > Date: 2009-02-26 23:38:24 +0100 (Thu, 26 Feb 2009) > New Revision: 29326 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29326&view=rev > > Modified: > haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox/filter.cpp > Log: > This fixes retrieval of email from IMAP servers. It seems there is a > difference between the behaviour of BPath in R5 and Haiku (as this used to work > in R5). More specifically: > > BPath blah("blah"); > printf("%s\n", blah.Path()); > > It seems that in R5 it would print "blah" (untested as I don't have R5 > anymore, but this code definitelly used to work). And in Haiku it prints > "/currrent/path/blah". But this is the documented and correct behavior. Specifically, the BeBook says that relative paths like that will trigger the "normalization engine" and will convert the path to be absolute, taking the current working directory as the base. Best regards, -Stephan From mmu_man at mail.berlios.de Fri Feb 27 01:15:24 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 27 Feb 2009 01:15:24 +0100 Subject: [Haiku-commits] r29328 - haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial Message-ID: <200902270015.n1R0FOjw026784@sheep.berlios.de> Author: mmu_man Date: 2009-02-27 01:15:20 +0100 (Fri, 27 Feb 2009) New Revision: 29328 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29328&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/UART.h haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/pci_serial.txt haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/poke_16C952.lst Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.h haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/NOTES.txt haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/SerialDevice.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/SerialDevice.h haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Tracing.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Tracing.h Log: Working version of the driver. At least it does seem to work with my onboard com port, but not the OxfordSemi PCI card I have here. Still requires tty_manager, and config_manager too, so won't work in Haiku yet. Needs cleanup. Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.cpp 2009-02-26 23:27:28 UTC (rev 29327) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.cpp 2009-02-27 00:15:20 UTC (rev 29328) @@ -14,15 +14,113 @@ #include "Driver.h" #include "SerialDevice.h" -static const char *sDeviceBaseName = "ports/serial"; +int32 api_version = B_CUR_DRIVER_API_VERSION; +static const char *sDeviceBaseName = DEVFS_BASE; SerialDevice *gSerialDevices[DEVICES_COUNT]; char *gDeviceNames[DEVICES_COUNT + 1]; -usb_module_info *gUSBModule = NULL; +config_manager_for_driver_module_info *gConfigManagerModule = NULL; +isa_module_info *gISAModule = NULL; +pci_module_info *gPCIModule = NULL; tty_module_info *gTTYModule = NULL; struct ddomain gSerialDomain; sem_id gDriverLock = -1; +// 24 MHz clock +static const uint32 sDefaultRates[] = { + 0, //B0 + 2304, //B50 + 1536, //B75 + 1047, //B110 + 857, //B134 + 768, //B150 + 512, //B200 + 384, //B300 + 192, //B600 + 0, //B1200 + 0, //B1800 + 48, //B2400 + 24, //B4800 + 12, //B9600 + 6, //B19200 + 3, //B38400 + 2, //B57600 + 1, //B115200 + 0, //B230400 + 4, //460800 !? B31250! + 0, //921600 !? +}; +// 8MHz clock on serial3 and 4 on the BeBox +#if 0 +static const uint32 sBeBoxRates[] = { + 0, //B0 + //... +}; +#endif + +static const struct serial_support_descriptor sSupportedDevices[] = { + +#ifdef HANDLE_ISA_COM + // ISA devices + { B_ISA_BUS, "Generic 16550 Serial Port", sDefaultRates, NULL, { 8, 8, 8 }, + { PCI_simple_communications, PCI_serial, PCI_serial_16550 } }, +#endif + // PCI devices + + // vendor/device matches first + +/* + { B_PCI_BUS, "OxfordSemi 16950 Serial Port", sDefaultRates, NULL, { 32, 32, 8 }, + { PCI_simple_communications, PCI_serial, PCI_serial_16950, + 0x1415, 0x9501 } }, +*/ + // generic fallback matches + /* + { B_PCI_BUS, "Generic XT Serial Port", NULL }, + { PCI_INVAL, PCI_INVAL, PCI_simple_communications, + PCI_serial, PCI_serial_xt } }, + + { B_PCI_BUS, "Generic 16450 Serial Port", NULL }, + { PCI_INVAL, PCI_INVAL, PCI_simple_communications, + PCI_serial, PCI_serial_16450 } }, + + */ + { B_PCI_BUS, "Generic 16550 Serial Port", sDefaultRates, NULL, { 8, 8, 8 }, + { PCI_simple_communications, PCI_serial, PCI_serial_16550, + PCI_INVAL, PCI_INVAL } }, + +//XXX + + { B_PCI_BUS, "Generic 16950 Serial Port", sDefaultRates, NULL, { 8, 8, 8 }, + { PCI_simple_communications, PCI_serial, PCI_serial_16950, + PCI_INVAL, PCI_INVAL } }, + +//XXX DEBUG! HACK HACK HACK +//XXX for testing probing +#if 0 + { B_PCI_BUS, "My BadIDE controller", sDefaultRates, NULL, { 8, 32, 8 }, + { 1, 1, 0x8a, + 0x1002, 0x434a } }, + { B_PCI_BUS, "My GoodIDE controller", sDefaultRates, NULL, { 8, 32, 8 }, + { 1, 1, 0x8a, + 0x1002, 0x4349 } }, + { B_PCI_BUS, "My IDE controller", sDefaultRates, NULL, { 8, 32, 8 }, + { 1, 1, 0x8a, + PCI_INVAL, PCI_INVAL } }, +#endif + + // non PCI_serial devices + + // beos zz driver supported that one + { B_PCI_BUS, "Lucent Modem", sDefaultRates, NULL, { 8, 8, 8 }, + { PCI_simple_communications, PCI_simple_communications_other, 0x00, + 0x11C1, 0x0480 } }, + + { B_PCI_BUS, NULL, NULL, NULL, {0}, {0} } +}; + + +#if 0 status_t pc_serial_device_added(pc_device device, void **cookie) { @@ -101,8 +199,325 @@ TRACE_FUNCRET("< pc_serial_device_removed() returns\n"); return B_OK; } +#endif +//#pragma mark - +status_t +pc_serial_insert_device(SerialDevice *device) +{ + status_t status = B_OK; + + //XXX fix leaks! + acquire_sem(gDriverLock); + for (int32 i = 0; i < DEVICES_COUNT; i++) { + if (gSerialDevices[i] != NULL) + continue; + + status = device->Init(); + if (status < B_OK) { + delete device; + //return status; + break; + } + + gSerialDevices[i] = device; + + release_sem(gDriverLock); + TRACE_ALWAYS("%s added\n", device->Description()); + return B_OK; + } + + release_sem(gDriverLock); + return B_ERROR; +} + + +// probe devices with config_manager +static status_t +scan_bus(bus_type bus) +{ + const char *bus_name = "Unknown"; + uint64 cookie = 0; + status_t status; + struct { + device_info di; + pci_info pi; + } big_info; + struct device_info &dinfo = big_info.di; + + switch (bus) { + case B_ISA_BUS: + bus_name = "ISA"; + break; + case B_PCI_BUS: + bus_name = "PCI"; + break; + case B_PCMCIA_BUS: + default: + return EINVAL; + } + TRACE_ALWAYS("scanning %s bus...\n", bus_name); + +//XXX: clean up this mess + + while ((gConfigManagerModule->get_next_device_info(bus, + &cookie, &big_info.di, sizeof(big_info)) == B_OK)) { + // skip disabled devices + if (dinfo.flags & B_DEVICE_INFO_ENABLED == 0) + continue; + // skip non configured devices + if (dinfo.flags & B_DEVICE_INFO_CONFIGURED == 0) + continue; + // and devices in error + if (dinfo.config_status < B_OK) + continue; + + + /* + TRACE_ALWAYS("device: 0x%08lx 0x%08lx 0x%08lx 0x%08lx\n", + dinfo.id[0], dinfo.id[1], dinfo.id[2], dinfo.id[3]); + */ + + /* + if (bus == B_PCI_BUS) { + pci_info *pcii = (pci_info *)(((char *)&dinfo) + + dinfo.bus_dependent_info_offset); + TRACE_ALWAYS("pci: %04x:%04x\n", + pcii->vendor_id, pcii->device_id); + if ((pcii->header_type & PCI_header_type_mask) == + PCI_header_type_generic) { + TRACE_ALWAYS("subsys: %04x:%04x\n", + pcii->u.h0.subsystem_vendor_id, pcii->u.h0.subsystem_id); + } + } + */ + + const struct serial_support_descriptor *supported = NULL; + for (int i = 0; sSupportedDevices[i].name; i++) { + if (sSupportedDevices[i].bus != bus) + continue; + if (sSupportedDevices[i].match.class_base != PCI_undefined && + sSupportedDevices[i].match.class_base != dinfo.devtype.base) + continue; + if (sSupportedDevices[i].match.class_sub != PCI_undefined && + sSupportedDevices[i].match.class_sub != dinfo.devtype.subtype) + continue; + if (sSupportedDevices[i].match.class_api != PCI_undefined && + sSupportedDevices[i].match.class_api != dinfo.devtype.interface) + continue; + +#if 0 + // either this way + if (bus == B_PCI_BUS) { + pci_info *pcii = (pci_info *)(((char *)&dinfo) + + dinfo.bus_dependent_info_offset); + if (sSupportedDevices[i].match.vendor_id != PCI_INVAL && + sSupportedDevices[i].match.vendor_id != pcii->vendor_id) + continue; + if (sSupportedDevices[i].match.device_id != PCI_INVAL && + sSupportedDevices[i].match.device_id != pcii->device_id) + continue; + } +#endif + // or this one: + // .id[0] = vendor_id and .id[1] = device_id + // .id[3?] = subsys_vendor_id and .id[2?] = subsys_device_id + if (bus == B_PCI_BUS && + sSupportedDevices[i].match.vendor_id != PCI_INVAL && + sSupportedDevices[i].match.vendor_id != dinfo.id[0]) + continue; + + if (bus == B_PCI_BUS && + sSupportedDevices[i].match.device_id != PCI_INVAL && + sSupportedDevices[i].match.device_id != dinfo.id[1]) + continue; + + + supported = &sSupportedDevices[i]; + break; + } + if (supported == NULL) + continue; + + struct { + struct device_configuration c; + resource_descriptor res[16]; + } config; + if (gConfigManagerModule->get_size_of_current_configuration_for( + cookie) > sizeof(config)) { + TRACE_ALWAYS("config size too big for device\n"); + continue; + } + + if (gConfigManagerModule->get_current_configuration_for(cookie, + &config.c, sizeof(config)) < B_OK) { + TRACE_ALWAYS("can't get config for device\n"); + continue; + + } + + TRACE_ALWAYS("device %Ld resources: %d irq %d dma %d io %d mem\n", + cookie, + gConfigManagerModule->count_resource_descriptors_of_type( + &config.c, B_IRQ_RESOURCE), + gConfigManagerModule->count_resource_descriptors_of_type( + &config.c, B_DMA_RESOURCE), + gConfigManagerModule->count_resource_descriptors_of_type( + &config.c, B_IO_PORT_RESOURCE), + gConfigManagerModule->count_resource_descriptors_of_type( + &config.c, B_MEMORY_RESOURCE)); + + + // we first need the IRQ + resource_descriptor irqdesc; + if (gConfigManagerModule->get_nth_resource_descriptor_of_type( + &config.c, 0, B_IRQ_RESOURCE, &irqdesc, sizeof(irqdesc)) < B_OK) { + TRACE_ALWAYS("can't find IRQ for device\n"); + continue; + } + int irq; + // XXX: what about APIC lines ? + for (irq = 0; irq < 32; irq++) { + if (irqdesc.d.m.mask & (1 << irq)) + break; + } + TRACE_ALWAYS("irq %d\n", irq); + //TRACE_ALWAYS("irq: %lx,%lx,%lx\n", irqdesc.d.m.mask, irqdesc.d.m.flags, irqdesc.d.m.cookie); + + TRACE_ALWAYS("found %s device %Ld [%x|%x|%x] " + /*"ID: '%16.16s'"*/" flags: %08lx status: %s\n", + bus_name, cookie, dinfo.devtype.base, dinfo.devtype.subtype, + dinfo.devtype.interface, /*dinfo.id,*/ dinfo.flags, + strerror(dinfo.config_status)); + + // force enable I/O ports on PCI devices +#if 0 + if (bus == B_PCI_BUS) { + pci_info *pcii = (pci_info *)(((char *)&dinfo) + + dinfo.bus_dependent_info_offset); + + uint32 cmd = gPCIModule->read_pci_config(pcii->bus, pcii->device, + pcii->function, PCI_command, 2); + TRACE_ALWAYS("PCI_command: 0x%04lx\n", cmd); + cmd |= PCI_command_io; + gPCIModule->write_pci_config(pcii->bus, pcii->device, + pcii->function, PCI_command, 2, cmd); + } +#endif + + // instanciate devices on IO ports + resource_descriptor iodesc; + SerialDevice *master = NULL; + for (int i = 0; + gConfigManagerModule->get_nth_resource_descriptor_of_type( + &config.c, i, B_IO_PORT_RESOURCE, &iodesc, sizeof(iodesc)) == B_OK; + i++) { + TRACE_ALWAYS("io at 0x%04lx len 0x%04lx\n", iodesc.d.r.minbase, + iodesc.d.r.len); + + if (iodesc.d.r.len < supported->constraints.minsize) + continue; + if (iodesc.d.r.len > supported->constraints.maxsize) + continue; + SerialDevice *device; + uint32 ioport = iodesc.d.r.minbase; +next_split: + // no more to split + if ((ioport - iodesc.d.r.minbase) >= iodesc.d.r.len) + continue; + + TRACE_ALWAYS("inserting device at io 0x%04lx as %s\n", ioport, + supported->name); + + + device = new SerialDevice(supported, ioport, irq, master); + if (pc_serial_insert_device(device) < B_OK) { + TRACE_ALWAYS("can't insert device\n"); + continue; + } + if (master == NULL) + master = device; + + ioport += supported->constraints.split; + goto next_split; + // try next part of the I/O range now + } + // we have at least one device + if (master) { + // hook up the irq +#if 0 + status = install_io_interrupt_handler(irq, pc_serial_interrupt, + master, 0); + TRACE_ALWAYS("installing irq %d handler: %s\n", irq, strerror(status)); +#endif + } + } +} + +// this version doesn't use config_manager, but can't probe the IRQ yet +status_t +scan_pci_alt() +{ + pci_info info; + int ix; + // probe PCI devices + for (ix = 0; (*gPCIModule->get_nth_pci_info)(ix, &info) == B_OK; ix++) { + // sanity check + if (info.header_type & PCI_header_type_mask != PCI_header_type_generic) + continue; + TRACE_ALWAYS("probing PCI device %2d [%x|%x|%x] %04x:%04x\n", + ix, info.class_base, info.class_sub, info.class_api, + info.vendor_id, info.device_id); + + const struct serial_support_descriptor *supported = NULL; + for (int i = 0; sSupportedDevices[i].name; i++) { + if (sSupportedDevices[i].bus != B_PCI_BUS) + continue; + if (info.class_base != sSupportedDevices[i].match.class_base) + continue; + if (info.class_sub != sSupportedDevices[i].match.class_sub) + continue; + if (info.class_api != sSupportedDevices[i].match.class_api) + continue; + if (sSupportedDevices[i].match.vendor_id != PCI_INVAL + && info.vendor_id != sSupportedDevices[i].match.vendor_id) + continue; + if (sSupportedDevices[i].match.device_id != PCI_INVAL + && info.device_id != sSupportedDevices[i].match.device_id) + continue; + supported = &sSupportedDevices[i]; + } + if (supported == NULL) + continue; + + TRACE_ALWAYS("found PCI device %2d [%x|%x|%x] %04x:%04x as %s\n", + ix, info.class_base, info.class_sub, info.class_api, + info.vendor_id, info.device_id, supported->name); + + // find I/O ports + for (int r = 0; r < 6; r++) { + TRACE_ALWAYS("range at 0x%08lx len 0x%lx flags 0x%02x\n", + info.u.h0.base_registers[r], info.u.h0.base_register_sizes[r], + info.u.h0.base_register_flags[r]); + + // not I/O + if (info.u.h0.base_register_flags[r] & PCI_address_space == 0) + continue; + // + TRACE_ALWAYS("regs at 0x%08lx len 0x%lx\n", + info.u.h0.base_registers[r], info.u.h0.base_register_sizes[r]); + //&PCI_address_io_mask + } + // XXX: interrupt_line doesn't seem to + TRACE_ALWAYS("irq line %d, pin %d\n", + info.u.h0.interrupt_line, info.u.h0.interrupt_pin); + } + + return B_OK; +} + + //#pragma mark - @@ -119,21 +534,29 @@ status_t init_driver() { + status_t status; load_settings(); create_log_file(); TRACE_FUNCALLS("> init_driver()\n"); - status_t status = get_module(B_TTY_MODULE_NAME, (module_info **)&gTTYModule); + status = get_module(B_TTY_MODULE_NAME, (module_info **)&gTTYModule); if (status < B_OK) - return status; + goto err_tty; - status = get_module(B_USB_MODULE_NAME, (module_info **)&gUSBModule); - if (status < B_OK) { - put_module(B_TTY_MODULE_NAME); - return status; - } + status = get_module(B_PCI_MODULE_NAME, (module_info **)&gPCIModule); + if (status < B_OK) + goto err_pci; + status = get_module(B_ISA_MODULE_NAME, (module_info **)&gISAModule); + if (status < B_OK) + goto err_isa; + + status = get_module(B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME, + (module_info **)&gConfigManagerModule); + if (status < B_OK) + goto err_cm; + for (int32 i = 0; i < DEVICES_COUNT; i++) gSerialDevices[i] = NULL; @@ -141,20 +564,40 @@ gDriverLock = create_sem(1, DRIVER_NAME"_devices_table_lock"); if (gDriverLock < B_OK) { - put_module(B_USB_MODULE_NAME); - put_module(B_TTY_MODULE_NAME); - return gDriverLock; + status = gDriverLock; + goto err_sem; } - static pc_notify_hooks notifyHooks = { - &pc_serial_device_added, - &pc_serial_device_removed - }; + status = ENOENT; - gUSBModule->register_driver(DRIVER_NAME, NULL, 0, NULL); - gUSBModule->install_notify(DRIVER_NAME, ¬ifyHooks); + memset(&gSerialDomain, 0, sizeof(gSerialDomain)); + ddbackground(&gSerialDomain); + + + scan_bus(B_ISA_BUS); + scan_bus(B_PCI_BUS); + + + // XXX: ISA cards + // XXX: pcmcia + + TRACE_FUNCRET("< init_driver() returns\n"); return B_OK; + +err_none: + delete_sem(gDriverLock); +err_sem: + put_module(B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME); +err_cm: + put_module(B_ISA_MODULE_NAME); +err_isa: + put_module(B_PCI_MODULE_NAME); +err_pci: + put_module(B_TTY_MODULE_NAME); +err_tty: + TRACE_FUNCRET("< init_driver() returns %s\n", strerror(status)); + return status; } @@ -164,11 +607,16 @@ { TRACE_FUNCALLS("> uninit_driver()\n"); - gUSBModule->uninstall_notify(DRIVER_NAME); + //gUSBModule->uninstall_notify(DRIVER_NAME); acquire_sem(gDriverLock); for (int32 i = 0; i < DEVICES_COUNT; i++) { if (gSerialDevices[i]) { + /* + if (gSerialDevices[i]->Master() == gSerialDevices[i]) + remove_io_interrupt_handler(gSerialDevices[i]->IRQ(), + pc_serial_interrupt, gSerialDevices[i]); + */ delete gSerialDevices[i]; gSerialDevices[i] = NULL; } @@ -178,7 +626,9 @@ free(gDeviceNames[i]); delete_sem(gDriverLock); - put_module(B_USB_MODULE_NAME); + put_module(B_CONFIG_MANAGER_FOR_DRIVER_MODULE_NAME); + put_module(B_ISA_MODULE_NAME); + put_module(B_PCI_MODULE_NAME); put_module(B_TTY_MODULE_NAME); TRACE_FUNCRET("< uninit_driver() returns\n"); @@ -202,6 +652,36 @@ } +int32 +pc_serial_interrupt(void *arg) +{ + int32 ret; + SerialDevice *master = (SerialDevice *)arg; + TRACE_FUNCALLS("> pc_serial_interrupt(%p)\n", arg); + + if (!master) + return B_UNHANDLED_INTERRUPT; + + ret = master->InterruptHandler(); + return ret; + + + for (int32 i = 0; i < DEVICES_COUNT; i++) { + if (gSerialDevices[i] && gSerialDevices[i]->Master() == master) { + ret = gSerialDevices[i]->InterruptHandler(); + // XXX: handle more than 1 ? + if (ret != B_UNHANDLED_INTERRUPT) { + TRACE_FUNCRET("< pc_serial_interrupt() returns: true\n"); + return ret; + } + } + } + + TRACE_FUNCRET("< pc_serial_interrupt() returns: unhandled\n"); + return B_UNHANDLED_INTERRUPT; +} + + /* pc_serial_open - handle open() calls */ static status_t pc_serial_open(const char *name, uint32 flags, void **cookie) Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.h 2009-02-26 23:27:28 UTC (rev 29327) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/Driver.h 2009-02-27 00:15:20 UTC (rev 29328) @@ -11,6 +11,9 @@ #include #include #include +#include +#include +#include #include #ifdef __HAIKU__ @@ -25,9 +28,71 @@ #include } + +// whether we should handle default COM ports +#define HANDLE_ISA_COM + #define DRIVER_NAME "pc_serial" // driver name for debug output #define DEVICES_COUNT 20 // max simultaneously open devices +#ifdef HANDLE_ISA_COM +#define DEVFS_BASE "ports/my_serial" +#else +// avoid clashing with BeOS zz driver +#define DEVFS_BASE "ports/pc_serial" +#endif + + +// no user serviceable part beyond this point + +// more PCI serial APIs +#ifndef PCI_serial_16650 +#define PCI_serial_16650 0x03 /* 16650-compatible serial controller */ +#define PCI_serial_16750 0x04 /* 16750-compatible serial controller */ +#define PCI_serial_16850 0x05 /* 16850-compatible serial controller */ +#define PCI_serial_16950 0x06 /* 16950-compatible serial controller */ +#endif + +class SerialDevice; + +struct port_constraints { + uint32 minsize; + uint32 maxsize; + uint32 split; // range to split I/O ports for each device +}; + +#define PCI_INVAL 0xffff +struct serial_support_descriptor { + bus_type bus; // B_*_BUS + const char *name; + const uint32 *bauds; + // not yet used + SerialDevice *(*instanciator)(struct serial_support_descriptor *desc); + // I/O port constrains (which ranges to use, how to split them) + struct port_constraints constraints; + // bus specific stuff here... + struct { + // for both ISA & PCI + uchar class_base; + uchar class_sub; + uchar class_api; // or PCI_undefined + // for PCI: if PCI_INVAL then match class + ushort vendor_id; + ushort device_id; + } match; +}; +typedef struct serial_support_descriptor serial_support_descriptor; + + +struct serial_config_descriptor { + bus_type bus; // B_*_BUS + struct serial_support_descriptor *descriptor; + union { + struct pci_info pci; + } d; +}; + + /* Some usefull helper defines ... */ #define SIZEOF(array) (sizeof(array) / sizeof(array[0])) /* size of array */ /* This one rounds the size to integral count of segs (segments) */ @@ -35,6 +100,9 @@ /* Default device buffer size */ #define DEF_BUFFER_SIZE 0x200 +// XXX: sort up the mess in termios.h on B* ! +#define BLAST B230400 + /* line coding defines ... Come from CDC USB specs? */ #define LC_STOP_BIT_1 0 #define LC_STOP_BIT_2 2 @@ -55,42 +123,18 @@ #define CLS_LINE_DTR 0x0001 #define CLS_LINE_RTS 0x0002 -/* attributes etc ...*/ -#ifndef USB_EP_ADDR_DIR_IN -#define USB_EP_ADDR_DIR_IN 0x80 -#define USB_EP_ADDR_DIR_OUT 0x00 -#endif - -#ifndef USB_EP_ATTR_CONTROL -#define USB_EP_ATTR_CONTROL 0x00 -#define USB_EP_ATTR_ISOCHRONOUS 0x01 -#define USB_EP_ATTR_BULK 0x02 -#define USB_EP_ATTR_INTERRUPT 0x03 -#endif - -/* USB class - communication devices */ -#define USB_DEV_CLASS_COMM 0x02 -#define USB_INT_CLASS_CDC 0x02 -#define USB_INT_SUBCLASS_ACM 0x02 -#define USB_INT_CLASS_CDC_DATA 0x0a -#define USB_INT_SUBCLASS_DATA 0x00 - -// communication device subtypes -#define FUNCTIONAL_SUBTYPE_UNION 0x06 - +extern config_manager_for_driver_module_info *gConfigManagerModule; extern isa_module_info *gISAModule; extern pci_module_info *gPCIModule; extern tty_module_info *gTTYModule; extern struct ddomain gSerialDomain; extern "C" { -status_t pc_serial_device_added(pc_device device, void **cookie); -status_t pc_serial_device_removed(void *cookie); - status_t init_hardware(); void uninit_driver(); bool pc_serial_service(struct tty *ptty, struct ddrover *ddr, uint flags); +int32 pc_serial_interrupt(void *arg); status_t pc_serial_open(const char *name, uint32 flags, void **cookie); status_t pc_serial_read(void *cookie, off_t position, void *buffer, size_t *numBytes); Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/NOTES.txt =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/NOTES.txt 2009-02-26 23:27:28 UTC (rev 29327) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/NOTES.txt 2009-02-27 00:15:20 UTC (rev 29328) @@ -1,4 +1,10 @@ references: http://www.beyondlogic.org/serial/serial.htm +http://jamesthornton.com/freebsd/articles/serial-uart/ +http://dugeem.net/david/work/freebsd-serial.html +http://dugeem.net/david/work/etc/sio.c +if you can understand it: +http://lxr.linux.no/linux+v2.6.28.7/drivers/serial/ + Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/SerialDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/SerialDevice.cpp 2009-02-26 23:27:28 UTC (rev 29327) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial/SerialDevice.cpp 2009-02-27 00:15:20 UTC (rev 29328) @@ -6,24 +6,23 @@ * Distributed under the terms of the MIT License. */ #include "SerialDevice.h" -#include "USB3.h" +#include "UART.h" -#include "ACM.h" -#include "FTDI.h" -#include "KLSI.h" -#include "Prolific.h" - -SerialDevice::SerialDevice(usb_device device, uint16 vendorID, - uint16 productID, const char *description) - : fDevice(device), - fVendorID(vendorID), - fProductID(productID), - fDescription(description), +SerialDevice::SerialDevice(const struct serial_support_descriptor *device, + uint32 ioBase, uint32 irq, const SerialDevice *master) + : /*fSupportDescriptor(device->descriptor), + fDevice(device), + fDescription(device->descriptor->name),*/ + fSupportDescriptor(device), + fDevice(NULL), + fDescription(device->name), + // fDeviceOpen(false), fDeviceRemoved(false), - fControlPipe(0), - fReadPipe(0), - fWritePipe(0), + fBus(device->bus), + fIOBase(ioBase), + fIRQ(irq), + fMaster(master), fBufferArea(-1), fReadBuffer(NULL), fReadBufferSize(ROUNDUP(DEF_BUFFER_SIZE, 16)), @@ -40,6 +39,7 @@ { memset(&fTTYFile, 0, sizeof(ttyfile)); memset(&fTTY, 0, sizeof(tty)); + memset(&fRover, 0, sizeof(ddrover)); } @@ -75,38 +75,79 @@ fWriteBuffer = fReadBuffer + fReadBufferSize; fInterruptBuffer = fWriteBuffer + fWriteBufferSize; + + // disable DLAB + WriteReg8(LCR, 0); + return B_OK; } void -SerialDevice::SetControlPipe(usb_pipe handle) +SerialDevice::SetModes() { - fControlPipe = handle; -} + struct termios tios; + memcpy(&tios, &fTTY.t, sizeof(struct termios)); + //TRACE_FUNCRES(trace_termios, &tios); + spin(10000); + uint32 baudIndex = tios.c_cflag & CBAUD; + if (baudIndex > BLAST) + baudIndex = BLAST; + uint8 lcr = 0; + uint16 divisor = SupportDescriptor()->bauds[baudIndex]; -void -SerialDevice::SetReadPipe(usb_pipe handle) -{ - fReadPipe = handle; -} + switch (tios.c_cflag & CSIZE) { +#if CS5 != CS7 + // in case someday... + case CS5: + lcr |= LCR_5BIT; + break; + case CS6: + lcr |= LCR_6BIT; + break; +#endif + case CS7: + lcr |= LCR_7BIT; + break; + case CS8: + default: + lcr |= LCR_8BIT; + break; + } + if (tios.c_cflag & CSTOPB) + lcr |= LCR_2STOP; + if (tios.c_cflag & PARENB) + lcr |= LCR_P_EN; + if (tios.c_cflag & PARODD == 0) + lcr |= LCR_P_EVEN; -void -SerialDevice::SetWritePipe(usb_pipe handle) -{ - fWritePipe = handle; -} + if (baudIndex == B0) { + // disable + MaskReg8(MCR, MCR_DTR); + } else { + // set FCR now, + // 16650 and later chips have another reg at 2 when DLAB=1 + uint8 fcr = FCR_ENABLE | FCR_RX_RST | FCR_TX_RST | FCR_F_8; + // enable fifo + //fcr = 0; + WriteReg8(FCR, fcr); + // unmask the divisor latch regs + WriteReg8(LCR, LCR_DLAB); + // set divisor + WriteReg8(DLLB, divisor & 0x00ff); + WriteReg8(DLHB, divisor >> 8); + //WriteReg8(2,0); -void -SerialDevice::SetModes() -{ - struct termios tios; - memcpy(&tios, &fTTY.t, sizeof(struct termios)); + } + // set control lines, and disable divisor latch reg + WriteReg8(LCR, lcr); + + +#if 0 uint16 newControl = fControlOut; - TRACE_FUNCRES(trace_termios, &tios); static uint32 baudRates[] = { 0x00000000, //B0 @@ -132,11 +173,6 @@ 0x000E1000, //921600 }; - uint32 baudCount = sizeof(baudRates) / sizeof(baudRates[0]); - uint32 baudIndex = tios.c_cflag & CBAUD; - if (baudIndex > baudCount) - baudIndex = baudCount - 1; - usb_serial_line_coding lineCoding; lineCoding.speed = baudRates[baudIndex]; lineCoding.stopbits = (tios.c_cflag & CSTOPB) ? LC_STOP_BIT_2 : LC_STOP_BIT_1; @@ -172,64 +208,103 @@ fLineCoding.parity); SetLineCoding(&fLineCoding); } +#endif } bool SerialDevice::Service(struct tty *ptty, struct ddrover *ddr, uint flags) { + uint8 msr; + status_t err; + if (&fTTY != ptty) return false; + TRACE_ALWAYS("%s(,,0x%08lx)\n", __FUNCTION__, flags); + if (flags <= TTYGETSIGNALS) { switch (flags) { case TTYENABLE: TRACE("TTYENABLE\n"); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, false); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, true); - fControlOut = CLS_LINE_DTR | CLS_LINE_RTS; - SetControlLineState(fControlOut); + + SetModes(); + err = install_io_interrupt_handler(IRQ(), pc_serial_interrupt, this, 0); + TRACE_ALWAYS("installing irq handler for %d: %s\n", IRQ(), strerror(err)); + msr = ReadReg8(MSR); + gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, msr & MSR_DCD); + gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, msr & MSR_CTS); + // + WriteReg8(MCR, MCR_DTR | MCR_RTS | MCR_IRQ_EN /*| MCR_LOOP*//*XXXXXXX*/); + // enable irqs + WriteReg8(IER, IER_RLS | IER_MS | IER_RDA); + //WriteReg8(IER, IER_RDA); break; case TTYDISABLE: TRACE("TTYDISABLE\n"); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, false); - fControlOut = 0x0; - SetControlLineState(fControlOut); + // remove the handler + remove_io_interrupt_handler(IRQ(), pc_serial_interrupt, this); + // disable IRQ + WriteReg8(IER, 0); + WriteReg8(MCR, 0); + msr = ReadReg8(MSR); + gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, msr & MSR_DCD); break; case TTYISTOP: TRACE("TTYISTOP\n"); - fInputStopped = true; - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, false); + MaskReg8(MCR, MCR_RTS); + //fInputStopped = true; + //gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, false); break; case TTYIRESUME: TRACE("TTYIRESUME\n"); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, true); - fInputStopped = false; + OrReg8(MCR, MCR_RTS); + //gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, true); + //fInputStopped = false; break; case TTYGETSIGNALS: TRACE("TTYGETSIGNALS\n"); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDCD, true); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWCTS, true); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWDSR, false); - gTTYModule->ttyhwsignal(ptty, ddr, TTYHWRI, false); + msr = ReadReg8(MSR); [... truncated: 736 lines follow ...] From bga at bug-br.org.br Fri Feb 27 01:25:13 2009 From: bga at bug-br.org.br (Bruno G. Albuquerque) Date: Thu, 26 Feb 2009 21:25:13 -0300 (BRT) Subject: [Haiku-commits] r29326 - haiku/trunk/src/add-ons/mail_daemon/system_filters/inbox In-Reply-To: <20090227001938.937.1@knochen-vm.localdomain> References: <200902262238.n1QMcPkJ010292@sheep.berlios.de> <20090227001938.937.1@knochen-vm.localdomain> Message-ID: <49488.189.26.197.16.1235694313.squirrel@www.bug-br.org.br> Em Qui, Fevereiro 26, 2009 8:19 pm, Ingo Weinhold escreveu: >> This fixes retrieval of email from IMAP servers. It seems there is a >> difference between the behaviour of BPath in R5 and Haiku (as this used >> to >> work in R5). More specifically: >> >> BPath blah("blah"); >> printf("%s\n", blah.Path()); >> >> It seems that in R5 it would print "blah" (untested as I don't have R5 >> anymore, but this code definitelly used to work). And in Haiku it prints >> "/currrent/path/blah". > > It works just as in BeOS R5. Unsurprisingly, since the BPath section in > the > BeBook is pretty clear about that. It starts with "A BPath object > represents > an absolute pathname...". A few lines later: "It always represents an > absolute path. The pathname strings that you use to initialize a BPath can > be relative, and they can include references to "." and "..". The BPath > "normalizes" the passed-in strings to create an absolute pathname, as > described in "Initializing and Normalizing"." Yep. As I said I didn't test it in R5 but this is surprising as it did work at some point. Oh well. -Bruno From dlmcpaul at mail.berlios.de Fri Feb 27 09:59:00 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Fri, 27 Feb 2009 09:59:00 +0100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder Message-ID: <200902270859.n1R8x0vr020243@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-27 09:58:59 +0100 (Fri, 27 Feb 2009) New Revision: 29329 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29329&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.h Log: Output as Stereo as AudioChannelConverter cannot handle > 2 channels Modified: haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp 2009-02-27 00:15:20 UTC (rev 29328) +++ haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp 2009-02-27 08:58:59 UTC (rev 29329) @@ -42,24 +42,31 @@ , fChannelMask(0) { fInputBuffer = malloc(INPUT_BUFFER_MAX_SIZE); + strcpy(fChannelInfo,"Unknown"); fState = a52_init(0); - fSamples = a52_samples(fState); + if (fState) { + fSamples = a52_samples(fState); + } } AC3Decoder::~AC3Decoder() { free(fInputBuffer); - a52_free(fState); + if (fState) { + a52_free(fState); + } } void AC3Decoder::GetCodecInfo(media_codec_info *info) { - strcpy(info->short_name, "AC-3"); - strcpy(info->pretty_name, "AC-3 audio decoder (liba52)"); + if (info) { + strcpy(info->short_name, "AC-3"); + sprintf(info->pretty_name,"%s AC-3 decoded by liba52",fChannelInfo); + } } @@ -67,22 +74,17 @@ AC3Decoder::Setup(media_format *ioEncodedFormat, const void *infoBuffer, size_t infoSize) { - return B_OK; -} + if (!fState) { + return B_ERROR; + } - -status_t -AC3Decoder::NegotiateOutputFormat(media_format *ioDecodedFormat) -{ if (!fHasStreamInfo) fHasStreamInfo = GetStreamInfo(); if (!fHasStreamInfo) { - TRACE("AC3Decoder::NegotiateOutputFormat: couldn't get stream info\n"); - return false; + TRACE("AC3Decoder::Setup: couldn't get stream info\n"); + return B_ERROR; } - - TRACE("AC3Decoder::NegotiateOutputFormat: fFlags 0x%x, fFrameRate %d, fBitRate %d\n", fFlags, fFrameRate, fBitRate); - + // Sample offsets of the output buffer are stored in fInterleaveOffset // When a channel is not present, it is skipped, the rest is shifted left // The block of samples order presented by liba52 is @@ -104,6 +106,11 @@ switch (fFlags & A52_CHANNEL_MASK) { case A52_CHANNEL: // XXX two independant mono channels { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"2.1 Channel"); + } else { + strcpy(fChannelInfo,"2 Channel"); + } fChannelCount += 2; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT; static int lfe_offsets[6] = { 2, 0, 1 }; @@ -112,6 +119,11 @@ break; } case A52_MONO: { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"Mono + Sub"); + } else { + strcpy(fChannelInfo,"Mono"); + } fChannelCount += 1; fChannelMask |= B_CHANNEL_LEFT; static int lfe_offsets[6] = { 1, 0 }; @@ -121,6 +133,11 @@ } case A52_STEREO: { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"Stereo + Sub"); + } else { + strcpy(fChannelInfo,"Stereo"); + } fChannelCount += 2; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT; static int lfe_offsets[6] = { 2, 0, 1 }; @@ -130,6 +147,11 @@ } case A52_3F: // 3 front channels (left, center, right) { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"3.1 front Channel"); + } else { + strcpy(fChannelInfo,"3 front Channel"); + } fChannelCount += 3; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_CENTER; static int lfe_offsets[6] = { 3, 0, 2, 1 }; @@ -139,6 +161,11 @@ } case A52_2F1R: // 2 front, 1 rear surround channel (L, R, S) { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"2.1 front 1 rear Channel"); + } else { + strcpy(fChannelInfo,"2 front 1 rear Channel"); + } fChannelCount += 3; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_BACK_CENTER; static int lfe_offsets[6] = { 2, 0, 3, 1 }; @@ -149,6 +176,11 @@ case A52_3F1R: // 3 front, 1 rear surround channel (L, C, R, S) { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"3.1 front 1 rear Channel"); + } else { + strcpy(fChannelInfo,"3 front 1 rear Channel"); + } fChannelCount += 4; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_CENTER | B_CHANNEL_BACK_CENTER; static int lfe_offsets[6] = { 3, 0, 2, 1, 4 }; @@ -158,6 +190,11 @@ } case A52_2F2R: // 2 front, 2 rear surround channels (L, R, LS, RS) { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"2.1 front 2 rear Channel"); + } else { + strcpy(fChannelInfo,"2 front 2 rear Channel"); + } fChannelCount += 4; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_REARLEFT | B_CHANNEL_REARRIGHT; static int lfe_offsets[6] = { 2, 0, 1, 3, 4}; @@ -167,6 +204,11 @@ } case A52_3F2R: // 3 front, 2 rear surround channels (L, C, R, LS, RS) { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"3.1 front 2 rear Channel"); + } else { + strcpy(fChannelInfo,"3 front 2 rear Channel"); + } fChannelCount += 5; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT | B_CHANNEL_CENTER | B_CHANNEL_REARLEFT | B_CHANNEL_REARRIGHT; static int lfe_offsets[6] = { 3, 0, 2, 1, 4, 5 }; @@ -176,6 +218,11 @@ } case A52_DOLBY: { + if (fFlags & A52_LFE) { + strcpy(fChannelInfo,"Dolby stereo + Sub"); + } else { + strcpy(fChannelInfo,"Dolby stereo"); + } fChannelCount += 2; fChannelMask |= B_CHANNEL_LEFT | B_CHANNEL_RIGHT; static int lfe_offsets[6] = { 2, 0, 1 }; @@ -189,16 +236,35 @@ return B_ERROR; } + // Currently the liba52 library will remix for us + // When AudioChannelConverter can handle more than 1 or 2 channels the below code can be removed + + fFlags = A52_STEREO & A52_CHANNEL_MASK; + fChannelCount = 2; + fChannelMask = B_CHANNEL_LEFT | B_CHANNEL_RIGHT; + static int nrm_offsets[6] = { 0, 1 }; + fInterleaveOffset = nrm_offsets; + + return B_OK; +} + + +status_t +AC3Decoder::NegotiateOutputFormat(media_format *ioDecodedFormat) +{ ioDecodedFormat->type = B_MEDIA_RAW_AUDIO; ioDecodedFormat->u.raw_audio.frame_rate = fFrameRate; ioDecodedFormat->u.raw_audio.channel_count = fChannelCount; ioDecodedFormat->u.raw_audio.format = media_raw_audio_format::B_AUDIO_FLOAT; ioDecodedFormat->u.raw_audio.byte_order = B_MEDIA_HOST_ENDIAN; - ioDecodedFormat->u.raw_audio.buffer_size = 6 * 256 * fChannelCount * sizeof(float); + + fFrameSize = (ioDecodedFormat->u.raw_audio.format & 0xf) * ioDecodedFormat->u.raw_audio.channel_count; + + ioDecodedFormat->u.raw_audio.buffer_size = 6 * 256 * fFrameSize; ioDecodedFormat->u.raw_audio.channel_mask = fChannelMask; - fFrameSize = (ioDecodedFormat->u.raw_audio.format & 0xf) * ioDecodedFormat->u.raw_audio.channel_count; - + TRACE("AC3Decoder::NegotiateOutputFormat: fFlags 0x%x, fFrameRate %d, fBitRate %d, fChannelCount %d, fFrameSize %d\n", fFlags, fFrameRate, fBitRate, fChannelCount, fFrameSize); + return B_OK; } @@ -236,14 +302,6 @@ AC3Decoder::Decode(void *buffer, int64 *frameCount, media_header *mediaHeader, media_decode_info *info) { -// bigtime_t start = system_time(); - - mediaHeader->start_time = fStartTime; - -// printf("AC3Decoder::Decode: start time %Ld\n", fStartTime); - - set_thread_priority(find_thread(0), 7); - if (!DecodeNext()) { TRACE("AC3Decoder::Decode: DecodeNext failed\n"); return B_ERROR; @@ -272,11 +330,14 @@ } } + mediaHeader->start_time = fStartTime; + mediaHeader->type = B_MEDIA_RAW_AUDIO; + mediaHeader->size_used = 6 * 256 * fFrameSize; + mediaHeader->data_offset = 0; + fStartTime += 6 * 256 * 1000000LL / fFrameRate; *frameCount = 6 * 256; -// printf("AC3Decoder::Decode: finished, %Ld usec\n", system_time() - start); - return B_OK; } @@ -356,6 +417,8 @@ continue; } + TRACE("AC3Decoder::DecodeNext: %d, %d\n",sample_rate, bit_rate); + if (!InputGetData(&input, bytes)) { TRACE("AC3Decoder::DecodeNext: can't get %d data bytes\n", bytes); return false; Modified: haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.h 2009-02-27 00:15:20 UTC (rev 29328) +++ haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.h 2009-02-27 08:58:59 UTC (rev 29329) @@ -76,6 +76,8 @@ int fChannelCount; int fChannelMask; int *fInterleaveOffset; + + char fChannelInfo[120]; }; From axeld at pinc-software.de Fri Feb 27 10:03:55 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 27 Feb 2009 10:03:55 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29329_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?plugins/ac3=5Fdecoder?= In-Reply-To: <200902270859.n1R8x0vr020243@sheep.berlios.de> Message-ID: <4815660641-BeMail@zon> dlmcpaul at BerliOS wrote: > + // Currently the liba52 library will remix for us > + // When AudioChannelConverter can handle more than 1 or 2 channels > the below code can be That definitely deserves a TODO prefix :-) Bye, Axel. From axeld at pinc-software.de Fri Feb 27 10:04:41 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 27 Feb 2009 10:04:41 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29328_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/drivers/ports/pc=5Fserial?= In-Reply-To: <200902270015.n1R0FOjw026784@sheep.berlios.de> Message-ID: <4861938554-BeMail@zon> mmu_man at BerliOS wrote: > Log: > Working version of the driver. At least it does seem to work with my > onboard com port, > but not the OxfordSemi PCI card I have here. Still requires > tty_manager, and > config_manager too, so won't work in Haiku yet. Needs cleanup. Great! Just don't dare to make them compatible :-) Bye, Axel. From dlmcpaul at mail.berlios.de Fri Feb 27 10:06:54 2009 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Fri, 27 Feb 2009 10:06:54 +0100 Subject: [Haiku-commits] r29330 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder Message-ID: <200902270906.n1R96sn4026838@sheep.berlios.de> Author: dlmcpaul Date: 2009-02-27 10:06:53 +0100 (Fri, 27 Feb 2009) New Revision: 29330 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29330&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp Log: made comment a TODO Modified: haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp 2009-02-27 08:58:59 UTC (rev 29329) +++ haiku/trunk/src/add-ons/media/plugins/ac3_decoder/ac3_decoder.cpp 2009-02-27 09:06:53 UTC (rev 29330) @@ -237,7 +237,7 @@ } // Currently the liba52 library will remix for us - // When AudioChannelConverter can handle more than 1 or 2 channels the below code can be removed + // TODO When AudioChannelConverter can handle more than 1 or 2 channels the below code can be removed fFlags = A52_STEREO & A52_CHANNEL_MASK; fChannelCount = 2; From dlmcpaul at gmail.com Fri Feb 27 10:07:33 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Fri, 27 Feb 2009 20:07:33 +1100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: <4815660641-BeMail@zon> References: <200902270859.n1R8x0vr020243@sheep.berlios.de> <4815660641-BeMail@zon> Message-ID: 2009/2/27 Axel D?rfler : > dlmcpaul at BerliOS wrote: >> + ? ? // Currently the liba52 library will remix for us >> + ? ? // When AudioChannelConverter can handle more than 1 or 2 channels >> the below code can be > > That definitely deserves a TODO prefix :-) This is your way of raising my commit count isn't it :-) -- Cheers David From marcusoverhagen at arcor.de Fri Feb 27 11:27:52 2009 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Fri, 27 Feb 2009 11:27:52 +0100 (CET) Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: <200902270859.n1R8x0vr020243@sheep.berlios.de> References: <200902270859.n1R8x0vr020243@sheep.berlios.de> Message-ID: <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> > Author: dlmcpaul > Output as Stereo as AudioChannelConverter cannot handle > 2 channels Why are you doing this? and wtf is AudioChannelConverter ? The whole media kit was already able to support multiple streams, and the mixer would downmix them as needed. Can you please revert this and find the real issue instead? regards Marcus Erwischt! Bei Arcor sehen Sie die besten Promi-Bilder riesengro? und in Top-Qualit?t. Hier finden Sie die sch?nsten Schnappsch?sse auf dem roten Teppich, lernen die Frauen des Womanizers Boris Becker kennen und schauen den Royals ins Wohnzimmer. Viel Spa? auf Ihrer virtuellen Reise durch die Welt der Stars und Sternchen: http://vip.arcor.de. From axeld at pinc-software.de Fri Feb 27 11:32:27 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 27 Feb 2009 11:32:27 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29329_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?plugins/ac3=5Fdecoder?= In-Reply-To: Message-ID: <10127396560-BeMail@zon> David McPaul wrote: > 2009/2/27 Axel D?rfler : > > dlmcpaul at BerliOS wrote: > >> + ? ? // Currently the liba52 library will remix for us > >> + ? ? // When AudioChannelConverter can handle more than 1 or 2 > > > channels > >> the below code can be > > That definitely deserves a TODO prefix :-) > This is your way of raising my commit count isn't it :-) Next on the list: improve the AudioChannelConverter ;-) Bye, Axel. From bonefish at mail.berlios.de Fri Feb 27 11:52:19 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 27 Feb 2009 11:52:19 +0100 Subject: [Haiku-commits] r29331 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200902271052.n1RAqJZt002594@sheep.berlios.de> Author: bonefish Date: 2009-02-27 11:52:19 +0100 (Fri, 27 Feb 2009) New Revision: 29331 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29331&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.h Log: Got rid of no longer needed LookupNoType(). The lookup hook doesn't doesn't have a type return parameter anymore. 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-02-27 09:06:53 UTC (rev 29330) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.cpp 2009-02-27 10:52:19 UTC (rev 29331) @@ -85,14 +85,6 @@ return B_BAD_VALUE; } -// LookupNoType -status_t -Volume::LookupNoType(void* dir, const char* entryName, ino_t* vnid) -{ - int type; - return Lookup(dir, entryName, vnid, &type); -} - // GetVNodeName status_t Volume::GetVNodeName(void* node, char* buffer, size_t bufferSize) @@ -105,7 +97,7 @@ // look up the parent directory ino_t parentID; - error = LookupNoType(node, "..", &parentID); + error = Lookup(node, "..", &parentID); if (error != B_OK) return error; 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-02-27 09:06:53 UTC (rev 29330) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Volume.h 2009-02-27 10:52:19 UTC (rev 29331) @@ -38,9 +38,6 @@ // vnodes virtual status_t Lookup(void* dir, const char* entryName, ino_t* vnid); - virtual status_t LookupNoType(void* dir, - const char* entryName, ino_t* vnid); - // not required virtual status_t GetVNodeName(void* node, char* buffer, size_t bufferSize); virtual status_t ReadVNode(ino_t vnid, bool reenter, From bonefish at mail.berlios.de Fri Feb 27 11:54:27 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 27 Feb 2009 11:54:27 +0100 Subject: [Haiku-commits] r29332 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200902271054.n1RAsR4X002825@sheep.berlios.de> Author: bonefish Date: 2009-02-27 11:54:26 +0100 (Fri, 27 Feb 2009) New Revision: 29332 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29332&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp Log: More adjustments to the new FS interface. The enabled sources compile again, but don't link yet. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp 2009-02-27 10:52:19 UTC (rev 29331) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp 2009-02-27 10:54:26 UTC (rev 29332) @@ -323,39 +323,48 @@ // Rename status_t -HaikuKernelVolume::Rename(void* oldDir, const char* oldName, void* newDir, +HaikuKernelVolume::Rename(void* _oldDir, const char* oldName, void* _newDir, const char* newName) { - if (!fFSModule->rename) + HaikuKernelNode* oldDir = (HaikuKernelNode*)_oldDir; + HaikuKernelNode* newDir = (HaikuKernelNode*)_newDir; + + if (!oldDir->ops->rename) return B_BAD_VALUE; - return fFSModule->rename(&fVolume, oldDir, oldName, newDir, newName); + return oldDir->ops->rename(&fVolume, oldDir, oldName, newDir, newName); } // Access status_t -HaikuKernelVolume::Access(void* node, int mode) +HaikuKernelVolume::Access(void* _node, int mode) { - if (!fFSModule->access) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->access) return B_OK; - return fFSModule->access(&fVolume, node, mode); + return node->ops->access(&fVolume, node, mode); } // ReadStat status_t -HaikuKernelVolume::ReadStat(void* node, struct stat* st) +HaikuKernelVolume::ReadStat(void* _node, struct stat* st) { - if (!fFSModule->read_stat) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->read_stat) return B_BAD_VALUE; - return fFSModule->read_stat(&fVolume, node, st); + return node->ops->read_stat(&fVolume, node, st); } // WriteStat status_t -HaikuKernelVolume::WriteStat(void* node, const struct stat *st, uint32 mask) +HaikuKernelVolume::WriteStat(void* _node, const struct stat *st, uint32 mask) { - if (!fFSModule->write_stat) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->write_stat) return B_BAD_VALUE; - return fFSModule->write_stat(&fVolume, node, st, mask); + return node->ops->write_stat(&fVolume, node, st, mask); } @@ -364,66 +373,78 @@ // Create status_t -HaikuKernelVolume::Create(void* dir, const char* name, int openMode, int mode, +HaikuKernelVolume::Create(void* _dir, const char* name, int openMode, int mode, void** cookie, ino_t* vnid) { - if (!fFSModule->create) + HaikuKernelNode* dir = (HaikuKernelNode*)_dir; + + if (!dir->ops->create) return B_BAD_VALUE; - return fFSModule->create(&fVolume, dir, name, openMode, mode, cookie, + return dir->ops->create(&fVolume, dir, name, openMode, mode, cookie, vnid); } // Open status_t -HaikuKernelVolume::Open(void* node, int openMode, void** cookie) +HaikuKernelVolume::Open(void* _node, int openMode, void** cookie) { - if (!fFSModule->open) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->open) return B_BAD_VALUE; - return fFSModule->open(&fVolume, node, openMode, cookie); + return node->ops->open(&fVolume, node, openMode, cookie); } // Close status_t -HaikuKernelVolume::Close(void* node, void* cookie) +HaikuKernelVolume::Close(void* _node, void* cookie) { - if (!fFSModule->close) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->close) return B_OK; - return fFSModule->close(&fVolume, node, cookie); + return node->ops->close(&fVolume, node, cookie); } // FreeCookie status_t -HaikuKernelVolume::FreeCookie(void* node, void* cookie) +HaikuKernelVolume::FreeCookie(void* _node, void* cookie) { - if (!fFSModule->free_cookie) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->free_cookie) return B_OK; - return fFSModule->free_cookie(&fVolume, node, cookie); + return node->ops->free_cookie(&fVolume, node, cookie); } // Read status_t -HaikuKernelVolume::Read(void* node, void* cookie, off_t pos, void* buffer, +HaikuKernelVolume::Read(void* _node, void* cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead) { - if (!fFSModule->read) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->read) return B_BAD_VALUE; *bytesRead = bufferSize; - return fFSModule->read(&fVolume, node, cookie, pos, buffer, bytesRead); + return node->ops->read(&fVolume, node, cookie, pos, buffer, bytesRead); } // Write status_t -HaikuKernelVolume::Write(void* node, void* cookie, off_t pos, +HaikuKernelVolume::Write(void* _node, void* cookie, off_t pos, const void* buffer, size_t bufferSize, size_t* bytesWritten) { - if (!fFSModule->write) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->write) return B_BAD_VALUE; *bytesWritten = bufferSize; - return fFSModule->write(&fVolume, node, cookie, pos, buffer, + return node->ops->write(&fVolume, node, cookie, pos, buffer, bytesWritten); } @@ -433,71 +454,85 @@ // CreateDir status_t -HaikuKernelVolume::CreateDir(void* dir, const char* name, int mode, +HaikuKernelVolume::CreateDir(void* _dir, const char* name, int mode, ino_t *newDir) { - if (!fFSModule->create_dir) + HaikuKernelNode* dir = (HaikuKernelNode*)_dir; + + if (!dir->ops->create_dir) return B_BAD_VALUE; - return fFSModule->create_dir(&fVolume, dir, name, mode, newDir); + return dir->ops->create_dir(&fVolume, dir, name, mode, newDir); } // RemoveDir status_t -HaikuKernelVolume::RemoveDir(void* dir, const char* name) +HaikuKernelVolume::RemoveDir(void* _dir, const char* name) { - if (!fFSModule->remove_dir) + HaikuKernelNode* dir = (HaikuKernelNode*)_dir; + + if (!dir->ops->remove_dir) return B_BAD_VALUE; - return fFSModule->remove_dir(&fVolume, dir, name); + return dir->ops->remove_dir(&fVolume, dir, name); } // OpenDir status_t -HaikuKernelVolume::OpenDir(void* node, void** cookie) +HaikuKernelVolume::OpenDir(void* _node, void** cookie) { - if (!fFSModule->open_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->open_dir) return B_BAD_VALUE; - return fFSModule->open_dir(&fVolume, node, cookie); + return node->ops->open_dir(&fVolume, node, cookie); } // CloseDir status_t -HaikuKernelVolume::CloseDir(void* node, void* cookie) +HaikuKernelVolume::CloseDir(void* _node, void* cookie) { - if (!fFSModule->close_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->close_dir) return B_OK; - return fFSModule->close_dir(&fVolume, node, cookie); + return node->ops->close_dir(&fVolume, node, cookie); } // FreeDirCookie status_t -HaikuKernelVolume::FreeDirCookie(void* node, void* cookie) +HaikuKernelVolume::FreeDirCookie(void* _node, void* cookie) { - if (!fFSModule->free_dir_cookie) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->free_dir_cookie) return B_OK; - return fFSModule->free_dir_cookie(&fVolume, node, cookie); + return node->ops->free_dir_cookie(&fVolume, node, cookie); } // ReadDir status_t -HaikuKernelVolume::ReadDir(void* node, void* cookie, void* buffer, +HaikuKernelVolume::ReadDir(void* _node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { - if (!fFSModule->read_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->read_dir) return B_BAD_VALUE; *countRead = count; - return fFSModule->read_dir(&fVolume, node, cookie, + return node->ops->read_dir(&fVolume, node, cookie, (struct dirent*)buffer, bufferSize, countRead); } // RewindDir status_t -HaikuKernelVolume::RewindDir(void* node, void* cookie) +HaikuKernelVolume::RewindDir(void* _node, void* cookie) { - if (!fFSModule->rewind_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->rewind_dir) return B_BAD_VALUE; - return fFSModule->rewind_dir(&fVolume, node, cookie); + return node->ops->rewind_dir(&fVolume, node, cookie); } @@ -506,52 +541,62 @@ // OpenAttrDir status_t -HaikuKernelVolume::OpenAttrDir(void* node, void** cookie) +HaikuKernelVolume::OpenAttrDir(void* _node, void** cookie) { - if (!fFSModule->open_attr_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->open_attr_dir) return B_BAD_VALUE; - return fFSModule->open_attr_dir(&fVolume, node, cookie); + return node->ops->open_attr_dir(&fVolume, node, cookie); } // CloseAttrDir status_t -HaikuKernelVolume::CloseAttrDir(void* node, void* cookie) +HaikuKernelVolume::CloseAttrDir(void* _node, void* cookie) { - if (!fFSModule->close_attr_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->close_attr_dir) return B_OK; - return fFSModule->close_attr_dir(&fVolume, node, cookie); + return node->ops->close_attr_dir(&fVolume, node, cookie); } // FreeAttrDirCookie status_t -HaikuKernelVolume::FreeAttrDirCookie(void* node, void* cookie) +HaikuKernelVolume::FreeAttrDirCookie(void* _node, void* cookie) { - if (!fFSModule->free_attr_dir_cookie) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->free_attr_dir_cookie) return B_OK; - return fFSModule->free_attr_dir_cookie(&fVolume, node, cookie); + return node->ops->free_attr_dir_cookie(&fVolume, node, cookie); } // ReadAttrDir status_t -HaikuKernelVolume::ReadAttrDir(void* node, void* cookie, void* buffer, +HaikuKernelVolume::ReadAttrDir(void* _node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { - if (!fFSModule->read_attr_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->read_attr_dir) return B_BAD_VALUE; *countRead = count; - return fFSModule->read_attr_dir(&fVolume, node, cookie, + return node->ops->read_attr_dir(&fVolume, node, cookie, (struct dirent*)buffer, bufferSize, countRead); } // RewindAttrDir status_t -HaikuKernelVolume::RewindAttrDir(void* node, void* cookie) +HaikuKernelVolume::RewindAttrDir(void* _node, void* cookie) { - if (!fFSModule->rewind_attr_dir) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->rewind_attr_dir) return B_BAD_VALUE; - return fFSModule->rewind_attr_dir(&fVolume, node, cookie); + return node->ops->rewind_attr_dir(&fVolume, node, cookie); } @@ -560,110 +605,131 @@ // CreateAttr status_t -HaikuKernelVolume::CreateAttr(void* node, const char* name, uint32 type, +HaikuKernelVolume::CreateAttr(void* _node, const char* name, uint32 type, int openMode, void** cookie) { - if (!fFSModule->create_attr) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->create_attr) return B_BAD_VALUE; - return fFSModule->create_attr(&fVolume, node, name, type, openMode, + return node->ops->create_attr(&fVolume, node, name, type, openMode, cookie); } // OpenAttr status_t -HaikuKernelVolume::OpenAttr(void* node, const char* name, int openMode, +HaikuKernelVolume::OpenAttr(void* _node, const char* name, int openMode, void** cookie) { - if (!fFSModule->open_attr) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->open_attr) return B_BAD_VALUE; - return fFSModule->open_attr(&fVolume, node, name, openMode, cookie); + return node->ops->open_attr(&fVolume, node, name, openMode, cookie); } // CloseAttr status_t -HaikuKernelVolume::CloseAttr(void* node, void* cookie) +HaikuKernelVolume::CloseAttr(void* _node, void* cookie) { - if (!fFSModule->close_attr) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->close_attr) return B_OK; - return fFSModule->close_attr(&fVolume, node, cookie); + return node->ops->close_attr(&fVolume, node, cookie); } // FreeAttrCookie status_t -HaikuKernelVolume::FreeAttrCookie(void* node, void* cookie) +HaikuKernelVolume::FreeAttrCookie(void* _node, void* cookie) { - if (!fFSModule->free_attr_cookie) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->free_attr_cookie) return B_OK; - return fFSModule->free_attr_cookie(&fVolume, node, cookie); + return node->ops->free_attr_cookie(&fVolume, node, cookie); } // ReadAttr status_t -HaikuKernelVolume::ReadAttr(void* node, void* cookie, off_t pos, +HaikuKernelVolume::ReadAttr(void* _node, void* cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead) { - if (!fFSModule->read_attr) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->read_attr) return B_BAD_VALUE; *bytesRead = bufferSize; - return fFSModule->read_attr(&fVolume, node, cookie, pos, buffer, + return node->ops->read_attr(&fVolume, node, cookie, pos, buffer, bytesRead); } // WriteAttr status_t -HaikuKernelVolume::WriteAttr(void* node, void* cookie, off_t pos, +HaikuKernelVolume::WriteAttr(void* _node, void* cookie, off_t pos, const void* buffer, size_t bufferSize, size_t* bytesWritten) { - if (!fFSModule->write_attr) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->write_attr) return B_BAD_VALUE; *bytesWritten = bufferSize; - return fFSModule->write_attr(&fVolume, node, cookie, pos, buffer, + return node->ops->write_attr(&fVolume, node, cookie, pos, buffer, bytesWritten); } // ReadAttrStat status_t -HaikuKernelVolume::ReadAttrStat(void* node, void* cookie, +HaikuKernelVolume::ReadAttrStat(void* _node, void* cookie, struct stat *st) { - if (!fFSModule->read_attr_stat) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->read_attr_stat) return B_BAD_VALUE; - return fFSModule->read_attr_stat(&fVolume, node, cookie, st); + return node->ops->read_attr_stat(&fVolume, node, cookie, st); } // WriteAttrStat status_t -HaikuKernelVolume::WriteAttrStat(void* node, void* cookie, +HaikuKernelVolume::WriteAttrStat(void* _node, void* cookie, const struct stat* st, int statMask) { - if (!fFSModule->write_attr_stat) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->write_attr_stat) return B_BAD_VALUE; - return fFSModule->write_attr_stat(&fVolume, node, cookie, st, + return node->ops->write_attr_stat(&fVolume, node, cookie, st, statMask); } // RenameAttr status_t -HaikuKernelVolume::RenameAttr(void* oldNode, const char* oldName, - void* newNode, const char* newName) +HaikuKernelVolume::RenameAttr(void* _oldNode, const char* oldName, + void* _newNode, const char* newName) { - if (!fFSModule->rename_attr) + HaikuKernelNode* oldNode = (HaikuKernelNode*)_oldNode; + HaikuKernelNode* newNode = (HaikuKernelNode*)_newNode; + + if (!oldNode->ops->rename_attr) return B_BAD_VALUE; - return fFSModule->rename_attr(&fVolume, oldNode, oldName, newNode, + return oldNode->ops->rename_attr(&fVolume, oldNode, oldName, newNode, newName); } // RemoveAttr status_t -HaikuKernelVolume::RemoveAttr(void* node, const char* name) +HaikuKernelVolume::RemoveAttr(void* _node, const char* name) { - if (!fFSModule->remove_attr) + HaikuKernelNode* node = (HaikuKernelNode*)_node; + + if (!node->ops->remove_attr) return B_BAD_VALUE; - return fFSModule->remove_attr(&fVolume, node, name); + return node->ops->remove_attr(&fVolume, node, name); } 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-02-27 10:52:19 UTC (rev 29331) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-02-27 10:54:26 UTC (rev 29332) @@ -111,7 +111,7 @@ error = fRequestThreads[i].Init(fFileSystem); if (error != B_OK) RETURN_ERROR(error); - } + } // run the threads for (int32 i = 0; i < kRequestThreadCount; i++) @@ -185,7 +185,7 @@ // init an FS info FSInfo info; status_t error = info.SetTo(fsName, infos, kRequestThreadCount + 1, - capabilities); + capabilities, fFileSystem->GetClientFSType()); // prepare the message BMessage message(UFS_REGISTER_FS); 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-02-27 10:52:19 UTC (rev 29331) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandRequestHandler.cpp 2009-02-27 10:54:26 UTC (rev 29332) @@ -254,7 +254,7 @@ reply->error = result; reply->volume = volume; reply->rootID = rootID; - reply->capabilities = volume->GetCapabilities(); + volume->GetCapabilities(reply->capabilities); // send the reply return _SendReply(allocator, false); @@ -393,7 +393,6 @@ RETURN_ERROR(error); reply->vnid = vnid; - reply->type = type; reply->error = result; // send the reply @@ -449,10 +448,13 @@ if (!volume) result = B_BAD_VALUE; - fs_vnode node; + void* node; + int type; + uint32 flags; if (result == B_OK) { RequestThreadContext context(volume); - result = volume->ReadVNode(request->vnid, request->reenter, &node); + result = volume->ReadVNode(request->vnid, request->reenter, &node, + &type, &flags); } // prepare the reply @@ -464,6 +466,8 @@ reply->error = result; reply->node = node; + reply->type = type; + reply->flags = flags; // send the reply return _SendReply(allocator, false); @@ -627,7 +631,7 @@ if (result == B_OK) { RequestThreadContext context(volume); result = volume->Select(request->node, request->fileCookie, - request->event, 0, request->sync); + request->event, request->sync); } // prepare the reply @@ -960,7 +964,7 @@ result = B_BAD_VALUE; ino_t vnid; - fs_cookie fileCookie; + void* fileCookie; if (result == B_OK) { RequestThreadContext context(volume); result = volume->Create(request->node, @@ -993,7 +997,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie fileCookie; + void* fileCookie; if (result == B_OK) { RequestThreadContext context(volume); result = volume->Open(request->node, request->openMode, &fileCookie); @@ -1079,8 +1083,8 @@ if (!volume) result = B_BAD_VALUE; - fs_vnode node = request->node; - fs_cookie fileCookie = request->fileCookie; + void* node = request->node; + void* fileCookie = request->fileCookie; off_t pos = request->pos; size_t size = request->size; @@ -1219,7 +1223,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie dirCookie = NULL; + void* dirCookie = NULL; if (result == B_OK) { RequestThreadContext context(volume); result = volume->OpenDir(request->node, &dirCookie); @@ -1305,8 +1309,8 @@ if (!volume) result = B_BAD_VALUE; - fs_vnode node = request->node; - fs_vnode dirCookie = request->dirCookie; + void* node = request->node; + void* dirCookie = request->dirCookie; size_t bufferSize = request->bufferSize; uint32 count = request->count; @@ -1392,7 +1396,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie attrDirCookie; + void* attrDirCookie; if (result == B_OK) { RequestThreadContext context(volume); result = volume->OpenAttrDir(request->node, &attrDirCookie); @@ -1479,8 +1483,8 @@ if (!volume) result = B_BAD_VALUE; - fs_vnode node = request->node; - fs_cookie attrDirCookie = request->attrDirCookie; + void* node = request->node; + void* attrDirCookie = request->attrDirCookie; size_t bufferSize = request->bufferSize; uint32 count = request->count; @@ -1556,7 +1560,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie attrCookie; + void* attrCookie; if (result == B_OK) { RequestThreadContext context(volume); result = volume->CreateAttr(request->node, @@ -1588,7 +1592,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie attrCookie; + void* attrCookie; if (result == B_OK) { RequestThreadContext context(volume); result = volume->OpenAttr(request->node, @@ -1677,7 +1681,7 @@ result = B_BAD_VALUE; void* node = request->node; - fs_cookie attrCookie = request->attrCookie; + void* attrCookie = request->attrCookie; off_t pos = request->pos; size_t size = request->size; @@ -1876,7 +1880,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie indexDirCookie; + void* indexDirCookie; if (result == B_OK) { RequestThreadContext context(volume); result = volume->OpenIndexDir(&indexDirCookie); @@ -1962,7 +1966,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie indexDirCookie = request->indexDirCookie; + void* indexDirCookie = request->indexDirCookie; size_t bufferSize = request->bufferSize; uint32 count = request->count; @@ -2126,7 +2130,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie queryCookie; + void* queryCookie; if (result == B_OK) { RequestThreadContext context(volume); result = volume->OpenQuery((const char*)request->queryString.GetData(), @@ -2213,7 +2217,7 @@ if (!volume) result = B_BAD_VALUE; - fs_cookie queryCookie = request->queryCookie; + void* queryCookie = request->queryCookie; size_t bufferSize = request->bufferSize; uint32 count = request->count; From bonefish at mail.berlios.de Fri Feb 27 12:38:26 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 27 Feb 2009 12:38:26 +0100 Subject: [Haiku-commits] r29333 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200902271138.n1RBcQh8012273@sheep.berlios.de> Author: bonefish Date: 2009-02-27 12:38:26 +0100 (Fri, 27 Feb 2009) New Revision: 29333 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29333&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_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: Got the kernel interface compiling. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_kernel_emu.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_kernel_emu.cpp 2009-02-27 10:54:26 UTC (rev 29332) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_kernel_emu.cpp 2009-02-27 11:38:26 UTC (rev 29333) @@ -11,6 +11,8 @@ #include "Debug.h" #include "haiku_fs_cache.h" +#include "HaikuKernelNode.h" +#include "HaikuKernelVolume.h" #include "kernel_emu.h" @@ -145,8 +147,8 @@ return error; // publish the new node - error = UserlandFS::KernelEmu::publish_vnode(volume, vnodeID, node, type, - flags); + error = UserlandFS::KernelEmu::publish_vnode(volume->GetID(), vnodeID, node, + type, flags); if (error != B_OK) volume->UndoPublishVNode(node); @@ -155,18 +157,18 @@ // get_vnode status_t -get_vnode(defs_volume *_volume, ino_t vnodeID, fs_vnode *privateNode) +get_vnode(fs_volume *_volume, ino_t vnodeID, fs_vnode *privateNode) { HaikuKernelVolume* volume = HaikuKernelVolume::GetVolume(_volume); // get the node void* foundNode; - status_t error = UserlandFS::KernelEmu::get_vnode(volume, vnodeID, + status_t error = UserlandFS::KernelEmu::get_vnode(volume->GetID(), vnodeID, &foundNode); if (error != B_OK) return error; - ((HaikuKernelNode*)foundNode)->GetFSNode(privateNode); + *privateNode = *(HaikuKernelNode*)foundNode; return B_OK; } @@ -221,7 +223,7 @@ fs_volume* volume_for_vnode(fs_vnode *vnode) { - return HaikuKernelNode::GetNode(vnode)->GetVolume(); + return HaikuKernelNode::GetNode(vnode)->GetVolume()->GetFSVolume(); } @@ -520,7 +522,7 @@ } // parse_expression -uint32 +uint64 parse_expression(const char *string) { return UserlandFS::KernelEmu::parse_expression(string); 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-02-27 10:54:26 UTC (rev 29332) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.cpp 2009-02-27 11:38:26 UTC (rev 29333) @@ -324,6 +324,14 @@ return error; } +// acquire_vnode +status_t +UserlandFS::KernelEmu::acquire_vnode(dev_t nsid, ino_t vnodeID) +{ + // TODO: Implement! + return B_BAD_VALUE; +} + // new_vnode status_t UserlandFS::KernelEmu::new_vnode(dev_t nsid, ino_t vnid, void* data) 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-02-27 10:54:26 UTC (rev 29332) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/kernel_emu.h 2009-02-27 11:38:26 UTC (rev 29333) @@ -22,6 +22,7 @@ status_t get_vnode(dev_t nsid, ino_t vnid, void** node); status_t put_vnode(dev_t nsid, ino_t vnid); +status_t acquire_vnode(dev_t nsid, ino_t vnodeID); 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); From dlmcpaul at gmail.com Fri Feb 27 12:43:48 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Fri, 27 Feb 2009 22:43:48 +1100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> References: <200902270859.n1R8x0vr020243@sheep.berlios.de> <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> Message-ID: 2009/2/27 Marcus Overhagen : >> Author: dlmcpaul > >> Output as Stereo as AudioChannelConverter cannot handle > 2 channels > > Why are you doing this? and wtf is AudioChannelConverter ? AudioChannelConverter x channels in to y channels out depending on what the output supports. It is part of the MediaPlayer. > The whole media kit was already able to support multiple streams, > and the mixer would downmix them as needed. Perhaps this should be discussed with the writers of the MediaPlayer. The application seems to have a number of classes that I think are in the mixer including channel conversion, samplerate conversion and format conversion. See src/apps/mediaplayer/media_node_framework/audio/ > Can you please revert this and find the real issue instead? I am happy to look further into this. Until then I like having sound come out when I play AC3 files with more than 2 channels as do others. There is a reason the TODO is there. I really really really want people to stop using VLC to play media files under haiku and the only way to do it is to have the files work when they play them using MediaPlayer, the only application we have that actually uses the MediaKit. -- Cheers David From bonefish at mail.berlios.de Fri Feb 27 13:06:45 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 27 Feb 2009 13:06:45 +0100 Subject: [Haiku-commits] r29334 - haiku/trunk/src/system/kernel/cache Message-ID: <200902271206.n1RC6jXv011462@sheep.berlios.de> Author: bonefish Date: 2009-02-27 13:06:43 +0100 (Fri, 27 Feb 2009) New Revision: 29334 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29334&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: Removed the superfluous 'extern "C"'s. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2009-02-27 11:38:26 UTC (rev 29333) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2009-02-27 12:06:43 UTC (rev 29334) @@ -1804,7 +1804,7 @@ } -extern "C" status_t +status_t block_cache_init(void) { sBlockCache = create_object_cache_etc("cached blocks", sizeof(cached_block), @@ -1842,7 +1842,7 @@ } -extern "C" size_t +size_t block_cache_used_memory() { size_t usedMemory = 0; @@ -1866,7 +1866,7 @@ // #pragma mark - public transaction API -extern "C" int32 +int32 cache_start_transaction(void* _cache) { block_cache* cache = (block_cache*)_cache; @@ -1893,7 +1893,7 @@ } -extern "C" status_t +status_t cache_sync_transaction(void* _cache, int32 id) { block_cache* cache = (block_cache*)_cache; @@ -1961,7 +1961,7 @@ } -extern "C" status_t +status_t cache_end_transaction(void* _cache, int32 id, transaction_notification_hook hook, void* data) { @@ -2026,7 +2026,7 @@ } -extern "C" status_t +status_t cache_abort_transaction(void* _cache, int32 id) { block_cache* cache = (block_cache*)_cache; @@ -2078,7 +2078,7 @@ from its sub transaction. The new transaction also gets a new transaction ID. */ -extern "C" int32 +int32 cache_detach_sub_transaction(void* _cache, int32 id, transaction_notification_hook hook, void* data) { @@ -2173,7 +2173,7 @@ } -extern "C" status_t +status_t cache_abort_sub_transaction(void* _cache, int32 id) { block_cache* cache = (block_cache*)_cache; @@ -2226,7 +2226,7 @@ } -extern "C" status_t +status_t cache_start_sub_transaction(void* _cache, int32 id) { block_cache* cache = (block_cache*)_cache; @@ -2337,7 +2337,7 @@ } -extern "C" status_t +status_t cache_next_block_in_transaction(void* _cache, int32 id, bool mainOnly, long* _cookie, off_t* _blockNumber, void** _data, void** _unchangedData) { @@ -2382,7 +2382,7 @@ } -extern "C" int32 +int32 cache_blocks_in_transaction(void* _cache, int32 id) { block_cache* cache = (block_cache*)_cache; @@ -2396,7 +2396,7 @@ } -extern "C" int32 +int32 cache_blocks_in_main_transaction(void* _cache, int32 id) { block_cache* cache = (block_cache*)_cache; @@ -2410,7 +2410,7 @@ } -extern "C" int32 +int32 cache_blocks_in_sub_transaction(void* _cache, int32 id) { block_cache* cache = (block_cache*)_cache; @@ -2427,7 +2427,7 @@ // #pragma mark - public block cache API -extern "C" void +void block_cache_delete(void* _cache, bool allowWrites) { block_cache* cache = (block_cache*)_cache; @@ -2463,7 +2463,7 @@ } -extern "C" void* +void* block_cache_create(int fd, off_t numBlocks, size_t blockSize, bool readOnly) { block_cache* cache = new(nothrow) block_cache(fd, numBlocks, blockSize, @@ -2483,7 +2483,7 @@ } -extern "C" status_t +status_t block_cache_sync(void* _cache) { block_cache* cache = (block_cache*)_cache; @@ -2515,7 +2515,7 @@ } -extern "C" status_t +status_t block_cache_sync_etc(void* _cache, off_t blockNumber, size_t numBlocks) { block_cache* cache = (block_cache*)_cache; @@ -2554,7 +2554,7 @@ } -extern "C" void +void block_cache_discard(void* _cache, off_t blockNumber, size_t numBlocks) { block_cache* cache = (block_cache*)_cache; @@ -2586,7 +2586,7 @@ } -extern "C" status_t +status_t block_cache_make_writable(void* _cache, off_t blockNumber, int32 transaction) { block_cache* cache = (block_cache*)_cache; @@ -2607,7 +2607,7 @@ } -extern "C" void* +void* block_cache_get_writable_etc(void* _cache, off_t blockNumber, off_t base, off_t length, int32 transaction) { @@ -2624,7 +2624,7 @@ } -extern "C" void* +void* block_cache_get_writable(void* _cache, off_t blockNumber, int32 transaction) { return block_cache_get_writable_etc(_cache, blockNumber, @@ -2632,7 +2632,7 @@ } -extern "C" void* +void* block_cache_get_empty(void* _cache, off_t blockNumber, int32 transaction) { block_cache* cache = (block_cache*)_cache; @@ -2648,7 +2648,7 @@ } -extern "C" const void* +const void* block_cache_get_etc(void* _cache, off_t blockNumber, off_t base, off_t length) { block_cache* cache = (block_cache*)_cache; @@ -2671,7 +2671,7 @@ } -extern "C" const void* +const void* block_cache_get(void* _cache, off_t blockNumber) { return block_cache_get_etc(_cache, blockNumber, blockNumber, 1); @@ -2685,7 +2685,7 @@ Note, you must only use this function on blocks that were acquired writable! */ -extern "C" status_t +status_t block_cache_set_dirty(void* _cache, off_t blockNumber, bool dirty, int32 transaction) { @@ -2709,7 +2709,7 @@ } -extern "C" void +void block_cache_put(void* _cache, off_t blockNumber) { block_cache* cache = (block_cache*)_cache; From superstippi at gmx.de Fri Feb 27 13:12:03 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Fri, 27 Feb 2009 13:12:03 +0100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> References: <200902270859.n1R8x0vr020243@sheep.berlios.de> <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> Message-ID: <20090227121203.31730@gmx.net> Von: Marcus Overhagen > > Author: dlmcpaul > > > Output as Stereo as AudioChannelConverter cannot handle > 2 channels > > Why are you doing this? and wtf is AudioChannelConverter ? > The whole media kit was already able to support multiple streams, > and the mixer would downmix them as needed. > > Can you please revert this and find the real issue instead? Marcus, I am happy that you are following progress and it's great you want to influence development on a subject where you have lots of experience and knowledge of the code base. But please try to work a bit on the tone, it somehow doesn't come across very friendly (to me at least). David is doing good work, I was already happy to watch videos which I couldn't watch before, because seeking wouldn't work and even without seeking, audio would stop working halfway into the clip. My experience here is that every developer on the team is very open for input. Der Ton macht die Musik. It's a matter of pro-actively influencing the working atmosphere, and in a volunteer environment, I think the fun aspect should dominate. Best regards, -Stephan From superstippi at gmx.de Fri Feb 27 13:25:25 2009 From: superstippi at gmx.de (Stephan Assmus) Date: Fri, 27 Feb 2009 13:25:25 +0100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: References: <200902270859.n1R8x0vr020243@sheep.berlios.de> <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> Message-ID: <20090227122525.213670@gmx.net> -------- Original-Nachricht -------- > Datum: Fri, 27 Feb 2009 22:43:48 +1100 > Von: David McPaul > An: SVN commits to the Haiku source repository > Betreff: Re: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder > 2009/2/27 Marcus Overhagen : > >> Author: dlmcpaul > > > >> Output as Stereo as AudioChannelConverter cannot handle > 2 channels > > > > Why are you doing this? and wtf is AudioChannelConverter ? > > AudioChannelConverter x channels in to y channels out depending on > what the output supports. > It is part of the MediaPlayer. > > > The whole media kit was already able to support multiple streams, > > and the mixer would downmix them as needed. > > Perhaps this should be discussed with the writers of the MediaPlayer. > The application seems to have a number of classes that I think are in > the mixer including channel conversion, samplerate conversion and > format conversion. The problem here is the AudioProducer node code in MediaPlayer. It originally stems from Be sample code, and Ingo and I already made it much more flexible than it used to be. I think changing it to support any number of channels should not be very hard at all. Then the channel converter can be removed from the pipeline that is constructed, but it's important that the remaining parts of the pipeline all handle any channel count. I believe this may already be the case. As for sample rate of the AudioProducer, the matter is a bit more tricky. The current frame work is based on video frames as the "time source". That imposes some restrictions on the audio sample rate and buffer sizes usable. There are some NOTES in the code about that (AudioProducer). When watching movies, these restrictions actually aren't much of a problem except when the original sample rate differs (loss in quality due to resampling), but when playing just audio, then there are actually some side effects, like the audio clips duration being clamped to a multiple of the virtual video frame duration (defaults to 25 fps). > I really really really want people to stop using VLC to play media > files under haiku and the only way to do it is to have the files work > when they play them using MediaPlayer, the only application we have > that actually uses the MediaKit. Getting closer and closer to the goal! :-D Best regards, -Stephan From bonefish at mail.berlios.de Fri Feb 27 17:11:58 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 27 Feb 2009 17:11:58 +0100 Subject: [Haiku-commits] r29335 - haiku/trunk/headers/private/kernel/util Message-ID: <200902271611.n1RGBwZZ012901@sheep.berlios.de> Author: bonefish Date: 2009-02-27 17:11:57 +0100 (Fri, 27 Feb 2009) New Revision: 29335 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29335&view=rev Modified: haiku/trunk/headers/private/kernel/util/OpenHashTable.h Log: Made usable from userland. Modified: haiku/trunk/headers/private/kernel/util/OpenHashTable.h =================================================================== --- haiku/trunk/headers/private/kernel/util/OpenHashTable.h 2009-02-27 12:06:43 UTC (rev 29334) +++ haiku/trunk/headers/private/kernel/util/OpenHashTable.h 2009-02-27 16:11:57 UTC (rev 29335) @@ -6,10 +6,14 @@ #define _KERNEL_UTIL_OPEN_HASH_TABLE_H -#include -#include +#include +#ifdef _KERNEL_MODE +# include +# include +#endif + /*! The Definition template must have four methods: `HashKey', `Hash', `Compare' and `GetLink;. It must also define several types as shown in the @@ -116,8 +120,13 @@ void InsertUnchecked(ValueType *value) { - if (CheckDuplicates && _ExhaustiveSearch(value)) + if (CheckDuplicates && _ExhaustiveSearch(value)) { +#ifdef _KERNEL_MODE panic("Hash Table: value already in table."); +#else + debugger("Hash Table: value already in table."); +#endif + } _Insert(fTable, fTableSize, value); fItemCount++; @@ -160,8 +169,13 @@ if (slot == NULL) return false; - if (CheckDuplicates && _ExhaustiveSearch(value)) + if (CheckDuplicates && _ExhaustiveSearch(value)) { +#ifdef _KERNEL_MODE panic("Hash Table: duplicate detected."); +#else + debugger("Hash Table: duplicate detected."); +#endif + } fItemCount--; return true; From marcusoverhagen at arcor.de Fri Feb 27 17:16:25 2009 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Fri, 27 Feb 2009 17:16:25 +0100 (CET) Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: References: <200902270859.n1R8x0vr020243@sheep.berlios.de> <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> Message-ID: <23356419.1235751385808.JavaMail.ngmail@webmail10.arcor-online.net> Von: David McPaul > > > >> Output as Stereo as AudioChannelConverter cannot handle > 2 channels > > > > Why are you doing this? and wtf is AudioChannelConverter ? > > AudioChannelConverter x channels in to y channels out depending on > what the output supports. It is part of the MediaPlayer. Well, at least when directly beeing connected to the mixer, this class shouldn't be needed. The mixer supports already arbitrary channel counts (though it may have bugs, it worked when tested with 2, 4, 5 and 6 channel=. > > The whole media kit was already able to support multiple streams, > > and the mixer would downmix them as needed. > > Perhaps this should be discussed with the writers of the MediaPlayer. > The application seems to have a number of classes that I think are in > the mixer including channel conversion, samplerate conversion and > format conversion. This is probably to connect media player to other outputs, too. However, when connected to the system mixer this shouldn't be needed. > I am happy to look further into this. Until then I like having sound > come out when I play AC3 files with more than 2 channels as do others. > There is a reason the TODO is there. Ok, it's just that I was very surprised that you limited AC3 support to stereo output, while I personally made sure (years ago) that it would properly play all channels when connected to the system mixer. > I really really really want people to stop using VLC to play media > files under haiku and the only way to do it is to have the files work > when they play them using MediaPlayer, the only application we have > that actually uses the MediaKit. Yes, thats certainly very good. I think it once worked even with media player. Perhaps media player needs some tuning because of the new media node framework. Im currently in china, and even when I get back to germany I wont be able to do haiku development for quite some time, as I moved to my partitially renovated house some weeks ago, and will need some more weekends to finish before I can continue with software develoment again. regards Marcus Erwischt! Bei Arcor sehen Sie die besten Promi-Bilder riesengro? und in Top-Qualit?t. Hier finden Sie die sch?nsten Schnappsch?sse auf dem roten Teppich, lernen die Frauen des Womanizers Boris Becker kennen und schauen den Royals ins Wohnzimmer. Viel Spa? auf Ihrer virtuellen Reise durch die Welt der Stars und Sternchen: http://vip.arcor.de. From bonefish at mail.berlios.de Fri Feb 27 17:18:00 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 27 Feb 2009 17:18:00 +0100 Subject: [Haiku-commits] r29336 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200902271618.n1RGI0Ht013453@sheep.berlios.de> Author: bonefish Date: 2009-02-27 17:17:58 +0100 (Fri, 27 Feb 2009) New Revision: 29336 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29336&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.h Removed: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache_priv.h Modified: 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/haiku_block_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.h Log: * Added condition variables. * Added a dummy slab implementation. * Updated the lock, hash, and block cache implementations. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-02-27 16:11:57 UTC (rev 29335) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-02-27 16:17:58 UTC (rev 29336) @@ -8,6 +8,9 @@ SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; +UsePrivateSystemHeaders ; +UsePrivateHeaders libroot ; + SEARCH_SOURCE += [ FDirName $(userlandFSTop) private ] ; SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ; @@ -40,10 +43,12 @@ # BeOSKernelVolume.cpp DispatcherFileSystem.cpp FileSystem.cpp -# haiku_block_cache.cpp + haiku_block_cache.cpp + haiku_condition_variable.cpp # haiku_file_cache.cpp haiku_hash.cpp haiku_lock.cpp + haiku_slab.cpp HaikuKernelFileSystem.cpp HaikuKernelVolume.cpp kernel_emu.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-02-27 16:11:57 UTC (rev 29335) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-02-27 16:17:58 UTC (rev 29336) @@ -23,7 +23,8 @@ #include "DispatcherDefs.h" #include "FileSystem.h" #include "FSInfo.h" -#include "haiku_block_cache_priv.h" +#include "haiku_block_cache.h" +#include "haiku_condition_variable.h" #include "haiku_fs_cache.h" #include "HaikuKernelFileSystem.h" #include "RequestThread.h" @@ -277,6 +278,11 @@ RETURN_ERROR(B_NO_MEMORY); ObjectDeleter fsDeleter(fileSystem); + // init condition variables + error = UserlandFS::HaikuKernelEmu::condition_variable_init(); + if (error != B_OK) + RETURN_ERROR(error); + // init block cache error = UserlandFS::HaikuKernelEmu::block_cache_init(); if (error != B_OK) Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.cpp 2009-02-27 16:11:57 UTC (rev 29335) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.cpp 2009-02-27 16:17:58 UTC (rev 29336) @@ -1,9 +1,9 @@ /* - * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ -#include "haiku_block_cache_priv.h" +#include "haiku_block_cache.h" #include @@ -12,90 +12,685 @@ #include #include +#include + +#include + +#include "haiku_condition_variable.h" #include "haiku_fs_cache.h" #include "haiku_hash.h" +#include "haiku_lock.h" +#include "haiku_slab.h" #include "kernel_emu.h" + // TODO: this is a naive but growing implementation to test the API: // 1) block reading/writing is not at all optimized for speed, it will // just read and write single blocks. // 2) the locking could be improved; getting a block should not need to // wait for blocks to be written -// 3) dirty blocks are only written back if asked for // TODO: the retrieval/copy of the original data could be delayed until the // new data must be written, ie. in low memory situations. + //#define TRACE_BLOCK_CACHE +#undef TRACE /* undef TRACE from */ #ifdef TRACE_BLOCK_CACHE # define TRACE(x) dprintf x #else # define TRACE(x) ; #endif -using std::nothrow; - // This macro is used for fatal situations that are acceptable in a running // system, like out of memory situations - should only panic for debugging. #define FATAL(x) panic x + using UserlandFS::KernelEmu::dprintf; using UserlandFS::KernelEmu::dump_block; using UserlandFS::KernelEmu::panic; +using UserlandFS::KernelEmu::spawn_kernel_thread; namespace UserlandFS { namespace HaikuKernelEmu { -static const int32 kMaxBlockCount = 1024; +static const bigtime_t kTransactionIdleTime = 2000000LL; + // a transaction is considered idle after 2 seconds of inactivity + +struct cache_transaction; +struct cached_block; +struct block_cache; +typedef DoublyLinkedListLink block_link; + +struct cached_block { + cached_block* next; // next in hash + cached_block* transaction_next; + block_link link; + off_t block_number; + void* current_data; + void* original_data; + void* parent_data; +#if BLOCK_CACHE_DEBUG_CHANGED + void* compare; +#endif + int32 ref_count; + int32 accessed; + bool busy : 1; + bool is_writing : 1; + bool is_dirty : 1; + bool unused : 1; + bool discard : 1; + cache_transaction* transaction; + cache_transaction* previous_transaction; + + static int Compare(void* _cacheEntry, const void* _block); + static uint32 Hash(void* _cacheEntry, const void* _block, uint32 range); +}; + +typedef DoublyLinkedList > block_list; + +struct cache_notification : DoublyLinkedListLinkImpl { + int32 transaction_id; + int32 events_pending; + int32 events; + transaction_notification_hook hook; + void* data; + bool delete_after_event; +}; + +typedef DoublyLinkedList NotificationList; + +struct block_cache : DoublyLinkedListLinkImpl { + hash_table* hash; + mutex lock; + int fd; + off_t max_blocks; + size_t block_size; + int32 next_transaction_id; + cache_transaction* last_transaction; + hash_table* transaction_hash; + + object_cache* buffer_cache; + block_list unused_blocks; + + uint32 num_dirty_blocks; + bool read_only; + + NotificationList pending_notifications; + ConditionVariable condition_variable; + + block_cache(int fd, off_t numBlocks, size_t blockSize, + bool readOnly); + ~block_cache(); + + status_t Init(); + + void Free(void* buffer); + void* Allocate(); + void RemoveBlock(cached_block* block); + void DiscardBlock(cached_block* block); + void FreeBlock(cached_block* block); + cached_block* NewBlock(off_t blockNumber); + + +private: + cached_block* _GetUnusedBlock(); +}; + +struct cache_listener; +typedef DoublyLinkedListLink listener_link; + +struct cache_listener : cache_notification { + listener_link link; +}; + +typedef DoublyLinkedList > ListenerList; + struct cache_transaction { cache_transaction(); - cache_transaction *next; + cache_transaction* next; int32 id; int32 num_blocks; + int32 main_num_blocks; int32 sub_num_blocks; - cached_block *first_block; + cached_block* first_block; block_list blocks; - transaction_notification_hook notification_hook; - void *notification_data; + ListenerList listeners; bool open; bool has_sub_transaction; + bigtime_t last_used; }; -static status_t write_cached_block(block_cache *cache, cached_block *block, +#if BLOCK_CACHE_BLOCK_TRACING +namespace BlockTracing { + +class Action : public AbstractTraceEntry { +public: + Action(block_cache* cache, cached_block* block) + : + fCache(cache), + fBlockNumber(block->block_number), + fIsDirty(block->is_dirty), + fHasOriginal(block->original_data != NULL), + fHasParent(block->parent_data != NULL), + fTransactionID(-1), + fPreviousID(-1) + { + if (block->transaction != NULL) + fTransactionID = block->transaction->id; + if (block->previous_transaction != NULL) + fPreviousID = block->previous_transaction->id; + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, %s %Ld, %c%c%c transaction %ld " + "(previous id %ld)\n", fCache, _Action(), fBlockNumber, + fIsDirty ? 'd' : '-', fHasOriginal ? 'o' : '-', + fHasParent ? 'p' : '-', fTransactionID, fPreviousID); + } + + virtual const char* _Action() const = 0; + +private: + block_cache* fCache; + uint64 fBlockNumber; + bool fIsDirty; + bool fHasOriginal; + bool fHasParent; + int32 fTransactionID; + int32 fPreviousID; +}; + +class Get : public Action { +public: + Get(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "get"; } +}; + +class Put : public Action { +public: + Put(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "put"; } +}; + +class Read : public Action { +public: + Read(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "read"; } +}; + +class Write : public Action { +public: + Write(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "write"; } +}; + +class Flush : public Action { +public: + Flush(block_cache* cache, cached_block* block, bool getUnused = false) + : Action(cache, block), + fGetUnused(getUnused) + { + Initialized(); + } + + virtual const char* _Action() const + { return fGetUnused ? "get-unused" : "flush"; } + +private: + bool fGetUnused; +}; + +class Error : public AbstractTraceEntry { +public: + Error(block_cache* cache, uint64 blockNumber, const char* message, + status_t status = B_OK) + : + fCache(cache), + fBlockNumber(blockNumber), + fMessage(message), + fStatus(status) + { + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, error %Ld, %s%s%s", + fCache, fBlockNumber, fMessage, fStatus != B_OK ? ": " : "", + fStatus != B_OK ? strerror(fStatus) : ""); + } + +private: + block_cache* fCache; + uint64 fBlockNumber; + const char* fMessage; + status_t fStatus; +}; + +} // namespace BlockTracing + +# define TB(x) new(std::nothrow) BlockTracing::x; +#else +# define TB(x) ; +#endif + +#if BLOCK_CACHE_TRANSACTION_TRACING +namespace TransactionTracing { + +class Action : public AbstractTraceEntry { + public: + Action(const char* label, block_cache* cache, + cache_transaction* transaction) + : + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fSub(transaction->has_sub_transaction), + fNumBlocks(transaction->num_blocks), + fSubNumBlocks(transaction->sub_num_blocks) + { + strlcpy(fLabel, label, sizeof(fLabel)); + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, %s transaction %p (id %ld)%s" + ", %ld/%ld blocks", fCache, fLabel, fTransaction, fID, + fSub ? " sub" : "", fNumBlocks, fSubNumBlocks); + } + + private: + char fLabel[12]; + block_cache *fCache; + cache_transaction *fTransaction; + int32 fID; + bool fSub; + int32 fNumBlocks; + int32 fSubNumBlocks; +}; + +class Detach : public AbstractTraceEntry { + public: + Detach(block_cache* cache, cache_transaction* transaction, + cache_transaction* newTransaction) + : + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fSub(transaction->has_sub_transaction), + fNewTransaction(newTransaction), + fNewID(newTransaction->id) + { + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, detach transaction %p (id %ld)" + "from transaction %p (id %ld)%s", + fCache, fNewTransaction, fNewID, fTransaction, fID, + fSub ? " sub" : ""); + } + + private: + block_cache *fCache; + cache_transaction *fTransaction; + int32 fID; + bool fSub; + cache_transaction *fNewTransaction; + int32 fNewID; +}; + +class Abort : public AbstractTraceEntry { + public: + Abort(block_cache* cache, cache_transaction* transaction) + : + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fNumBlocks(0) + { + bool isSub = transaction->has_sub_transaction; + fNumBlocks = isSub ? transaction->sub_num_blocks + : transaction->num_blocks; + fBlocks = (off_t*)alloc_tracing_buffer(fNumBlocks * sizeof(off_t)); + if (fBlocks != NULL) { + cached_block* block = transaction->first_block; + for (int32 i = 0; block != NULL && i < fNumBlocks; + block = block->transaction_next) { + fBlocks[i++] = block->block_number; + } + } else + fNumBlocks = 0; + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, abort transaction " + "%p (id %ld), blocks", fCache, fTransaction, fID); + for (int32 i = 0; i < fNumBlocks && !out.IsFull(); i++) + out.Print(" %Ld", fBlocks[i]); + } + + private: + block_cache *fCache; + cache_transaction *fTransaction; + int32 fID; + off_t *fBlocks; + int32 fNumBlocks; +}; + +} // namespace TransactionTracing + +# define T(x) new(std::nothrow) TransactionTracing::x; +#else +# define T(x) ; +#endif + + +static status_t write_cached_block(block_cache* cache, cached_block* block, bool deleteTransaction = true); +static DoublyLinkedList sCaches; +static mutex sCachesLock = MUTEX_INITIALIZER("block caches"); +static sem_id sEventSemaphore; +static mutex sNotificationsLock = MUTEX_INITIALIZER("block cache notifications"); +static thread_id sNotifierWriterThread; +static DoublyLinkedListLink sMarkCache; + // TODO: this only works if the link is the first entry of block_cache +static object_cache* sBlockCache; + + +// #pragma mark - notifications/listener + + +/*! Checks wether or not this is an event that closes a transaction. */ +static inline bool +is_closing_event(int32 event) +{ + return (event & (TRANSACTION_ABORTED | TRANSACTION_ENDED)) != 0; +} + + +static inline bool +is_written_event(int32 event) +{ + return (event & TRANSACTION_WRITTEN) != 0; +} + + +/*! From the specified \a notification, it will remove the lowest pending + event, and return that one in \a _event. + If there is no pending event anymore, it will return \c false. +*/ +static bool +get_next_pending_event(cache_notification* notification, int32* _event) +{ + for (int32 eventMask = 1; eventMask <= TRANSACTION_IDLE; eventMask <<= 1) { + int32 pending = atomic_and(¬ification->events_pending, + ~eventMask); + + bool more = (pending & ~eventMask) != 0; + + if ((pending & eventMask) != 0) { + *_event = eventMask; + return more; + } + } + + return false; +} + + +static void +flush_pending_notifications(block_cache* cache) +{ + ASSERT_LOCKED_MUTEX(&sCachesLock); + + while (true) { + MutexLocker locker(sNotificationsLock); + + cache_notification* notification = cache->pending_notifications.Head(); + if (notification == NULL) + return; + + bool deleteAfterEvent = false; + int32 event = -1; + if (!get_next_pending_event(notification, &event)) { + // remove the notification if this was the last pending event + cache->pending_notifications.Remove(notification); + deleteAfterEvent = notification->delete_after_event; + } + + if (event >= 0) { + // Notify listener, we need to copy the notification, as it might + // be removed when we unlock the list. + cache_notification copy = *notification; + locker.Unlock(); + + copy.hook(copy.transaction_id, event, copy.data); + + locker.Lock(); + } + + if (deleteAfterEvent) + delete notification; + } +} + + +/*! Flushes all pending notifications by calling the appropriate hook + functions. + Must not be called with a cache lock held. +*/ +static void +flush_pending_notifications() +{ + MutexLocker _(sCachesLock); + + DoublyLinkedList::Iterator iterator = sCaches.GetIterator(); + while (iterator.HasNext()) { + block_cache* cache = iterator.Next(); + + flush_pending_notifications(cache); + } +} + + +/*! Initializes the \a notification as specified. */ +static void +set_notification(cache_transaction* transaction, + cache_notification ¬ification, int32 events, + transaction_notification_hook hook, void* data) +{ + notification.transaction_id = transaction != NULL ? transaction->id : -1; + notification.events_pending = 0; + notification.events = events; + notification.hook = hook; + notification.data = data; + notification.delete_after_event = false; +} + + +/*! Makes sure the notification is deleted. It either deletes it directly, + when possible, or marks it for deletion if the notification is pending. +*/ +static void +delete_notification(cache_notification* notification) +{ + MutexLocker locker(sNotificationsLock); + + if (notification->events_pending != 0) + notification->delete_after_event = true; + else + delete notification; +} + + +/*! Adds the notification to the pending notifications list, or, if it's + already part of it, updates its events_pending field. + Also marks the notification to be deleted if \a deleteNotification + is \c true. + Triggers the notifier thread to run. +*/ +static void +add_notification(block_cache* cache, cache_notification* notification, + int32 event, bool deleteNotification) +{ + if (notification->hook == NULL) + return; + + int32 pending = atomic_or(¬ification->events_pending, event); + if (pending == 0) { + // not yet part of the notification list + MutexLocker locker(sNotificationsLock); + if (deleteNotification) + notification->delete_after_event = true; + cache->pending_notifications.Add(notification); + } else if (deleteNotification) { + // we might need to delete it ourselves if we're late + delete_notification(notification); + } + + release_sem_etc(sEventSemaphore, 1, B_DO_NOT_RESCHEDULE); + // We're probably still holding some locks that makes rescheduling + // not a good idea at this point. +} + + +/*! Notifies all interested listeners of this transaction about the \a event. + If \a event is a closing event (ie. TRANSACTION_ENDED, and + TRANSACTION_ABORTED), all listeners except those listening to + TRANSACTION_WRITTEN will be removed. +*/ +static void +notify_transaction_listeners(block_cache* cache, cache_transaction* transaction, + int32 event) +{ + T(Action("notify", cache, transaction)); + + bool isClosing = is_closing_event(event); + bool isWritten = is_written_event(event); + + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + + bool remove = (isClosing && !is_written_event(listener->events)) + || (isWritten && is_written_event(listener->events)); + if (remove) + iterator.Remove(); + + if ((listener->events & event) != 0) + add_notification(cache, listener, event, remove); + else if (remove) + delete_notification(listener); + } +} + + +/*! Removes and deletes all listeners that are still monitoring this + transaction. +*/ +static void +remove_transaction_listeners(block_cache* cache, cache_transaction* transaction) +{ + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + iterator.Remove(); + + delete_notification(listener); + } +} + + +static status_t +add_transaction_listener(block_cache* cache, cache_transaction* transaction, + int32 events, transaction_notification_hook hookFunction, void* data) +{ + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + + if (listener->data == data && listener->hook == hookFunction) { + // this listener already exists, just update it + listener->events |= events; + return B_OK; + } + } + + cache_listener* listener = new(std::nothrow) cache_listener; + if (listener == NULL) + return B_NO_MEMORY; + + set_notification(transaction, *listener, events, hookFunction, data); + transaction->listeners.Add(listener); + return B_OK; +} + + // #pragma mark - private transaction cache_transaction::cache_transaction() { num_blocks = 0; + main_num_blocks = 0; sub_num_blocks = 0; first_block = NULL; - notification_hook = NULL; - notification_data = NULL; open = true; + last_used = system_time(); } static int -transaction_compare(void *_transaction, const void *_id) +transaction_compare(void* _transaction, const void* _id) { - cache_transaction *transaction = (cache_transaction *)_transaction; - const int32 *id = (const int32 *)_id; + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32* id = (const int32*)_id; return transaction->id - *id; } static uint32 -transaction_hash(void *_transaction, const void *_id, uint32 range) +transaction_hash(void* _transaction, const void* _id, uint32 range) { - cache_transaction *transaction = (cache_transaction *)_transaction; - const int32 *id = (const int32 *)_id; + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32* id = (const int32*)_id; if (transaction != NULL) return transaction->id % range; @@ -105,43 +700,60 @@ static void -delete_transaction(block_cache *cache, cache_transaction *transaction) +delete_transaction(block_cache* cache, cache_transaction* transaction) { if (cache->last_transaction == transaction) cache->last_transaction = NULL; + remove_transaction_listeners(cache, transaction); delete transaction; } -static cache_transaction * -lookup_transaction(block_cache *cache, int32 id) +static cache_transaction* +lookup_transaction(block_cache* cache, int32 id) { - return (cache_transaction *)hash_lookup(cache->transaction_hash, &id); + return (cache_transaction*)hash_lookup(cache->transaction_hash, &id); } // #pragma mark - cached_block -/* static */ int -cached_block::Compare(void *_cacheEntry, const void *_block) +compare_blocks(const void* _blockA, const void* _blockB) { - cached_block *cacheEntry = (cached_block *)_cacheEntry; - const off_t *block = (const off_t *)_block; + cached_block* blockA = *(cached_block**)_blockA; + cached_block* blockB = *(cached_block**)_blockB; - return cacheEntry->block_number - *block; + off_t diff = blockA->block_number - blockB->block_number; + if (diff > 0) + return 1; + + return diff < 0 ? -1 : 0; } +/*static*/ int +cached_block::Compare(void* _cacheEntry, const void* _block) +{ + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const off_t* block = (const off_t*)_block; -/* static */ -uint32 -cached_block::Hash(void *_cacheEntry, const void *_block, uint32 range) + off_t diff = cacheEntry->block_number - *block; + if (diff > 0) + return 1; + + return diff < 0 ? -1 : 0; +} + + + +/*static*/ uint32 +cached_block::Hash(void* _cacheEntry, const void* _block, uint32 range) { - cached_block *cacheEntry = (cached_block *)_cacheEntry; - const off_t *block = (const off_t *)_block; + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const off_t* block = (const off_t*)_block; if (cacheEntry != NULL) return cacheEntry->block_number % range; @@ -154,110 +766,116 @@ block_cache::block_cache(int _fd, off_t numBlocks, size_t blockSize, - bool readOnly) + bool readOnly) : hash(NULL), fd(_fd), max_blocks(numBlocks), block_size(blockSize), - allocated_block_count(0), next_transaction_id(1), last_transaction(NULL), transaction_hash(NULL), + buffer_cache(NULL), + num_dirty_blocks(0), read_only(readOnly) { - hash = hash_init(32, 0, &cached_block::Compare, &cached_block::Hash); - if (hash == NULL) - return; - - transaction_hash = hash_init(16, 0, &transaction_compare, - &UserlandFS::HaikuKernelEmu::transaction_hash); - if (transaction_hash == NULL) - return; - - if (benaphore_init(&lock, "block cache") < B_OK) - return; } +/*! Should be called with the cache's lock held. */ block_cache::~block_cache() { - benaphore_destroy(&lock); - hash_uninit(transaction_hash); hash_uninit(hash); + + delete_object_cache(buffer_cache); + + mutex_destroy(&lock); } status_t -block_cache::InitCheck() +block_cache::Init() { - if (lock.sem < B_OK) - return lock.sem; + condition_variable.Init(this, "cache transaction sync"); + mutex_init(&lock, "block cache"); - if (hash == NULL || transaction_hash == NULL) + buffer_cache = create_object_cache_etc("block cache buffers", block_size, + 8, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL); + if (buffer_cache == NULL) return B_NO_MEMORY; + cached_block dummyBlock; + hash = hash_init(1024, offset_of_member(dummyBlock, next), + &cached_block::Compare, &cached_block::Hash); + if (hash == NULL) + return B_NO_MEMORY; + + cache_transaction dummyTransaction; + transaction_hash = hash_init(16, offset_of_member(dummyTransaction, next), + &transaction_compare, &UserlandFS::HaikuKernelEmu::transaction_hash); + if (transaction_hash == NULL) + return B_NO_MEMORY; + return B_OK; } void -block_cache::Free(void *address) +block_cache::Free(void* buffer) { - if (address == NULL) - return; - - free(address); + if (buffer != NULL) + object_cache_free(buffer_cache, buffer); } -void * +void* block_cache::Allocate() { - return malloc(block_size); + return object_cache_alloc(buffer_cache, 0); } void -block_cache::FreeBlock(cached_block *block) +block_cache::FreeBlock(cached_block* block) { Free(block->current_data); - block->current_data = NULL; if (block->original_data != NULL || block->parent_data != NULL) { - panic("block_cache::FreeBlock(): %p, %p\n", block->original_data, - block->parent_data); + panic("block_cache::FreeBlock(): %Ld, original %p, parent %p\n", + block->block_number, block->original_data, block->parent_data); } -#ifdef DEBUG_CHANGED +#if BLOCK_CACHE_DEBUG_CHANGED Free(block->compare); #endif - delete block; + object_cache_free(sBlockCache, block); } /*! Allocates a new block for \a blockNumber, ready for use */ -cached_block * +cached_block* block_cache::NewBlock(off_t blockNumber) { - cached_block *block = new(nothrow) cached_block; + cached_block* block = (cached_block*)object_cache_alloc(sBlockCache, 0); if (block == NULL) { - FATAL(("could not allocate block!\n")); - return NULL; - } + TB(Error(this, blockNumber, "allocation failed")); + dprintf("block allocation failed, unused list is %sempty.\n", + unused_blocks.IsEmpty() ? "" : "not "); - // if we hit the limit of blocks to cache? try to free one or more - if (allocated_block_count >= kMaxBlockCount) { - RemoveUnusedBlocks(LONG_MAX, - allocated_block_count - kMaxBlockCount + 1); + // allocation failed, try to reuse an unused block + block = _GetUnusedBlock(); + if (block == NULL) { + TB(Error(this, blockNumber, "get unused failed")); + FATAL(("could not allocate block!\n")); + return NULL; + } [... truncated: 3117 lines follow ...] From revol at free.fr Fri Feb 27 17:33:28 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Fri, 27 Feb 2009 17:33:28 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29329_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?plugins/ac3=5Fdecoder?= In-Reply-To: Message-ID: <5269034660-BeMail@laptop> > I really really really want people to stop using VLC to play media > files under haiku and the only way to do it is to have the files work > when they play them using MediaPlayer, the only application we have > that actually uses the MediaKit. You could have a look at nplay too :D Fran?ois. From korli at users.berlios.de Fri Feb 27 17:39:38 2009 From: korli at users.berlios.de (=?ISO-8859-1?B?Suly9G1lIER1dmFs?=) Date: Fri, 27 Feb 2009 17:39:38 +0100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: <5269034660-BeMail@laptop> References: <5269034660-BeMail@laptop> Message-ID: 2009/2/27 Fran?ois Revol > > I really really really want people to stop using VLC to play media > > files under haiku and the only way to do it is to have the files work > > when they play them using MediaPlayer, the only application we have > > that actually uses the MediaKit. > > Out of curiosity did you try with playfile ? Bye, J?r?me -------------- next part -------------- An HTML attachment was scrubbed... URL: From mmu_man at mail.berlios.de Fri Feb 27 17:50:25 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 27 Feb 2009 17:50:25 +0100 Subject: [Haiku-commits] r29337 - haiku/trunk/src/bin Message-ID: <200902271650.n1RGoPkk015815@sheep.berlios.de> Author: mmu_man Date: 2009-02-27 17:50:25 +0100 (Fri, 27 Feb 2009) New Revision: 29337 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29337&view=rev Modified: haiku/trunk/src/bin/sysinfo.c Log: added cache/TLB descriptors from Intel Application Note 485. Patch by Christian Packmann. Modified: haiku/trunk/src/bin/sysinfo.c =================================================================== --- haiku/trunk/src/bin/sysinfo.c 2009-02-27 16:17:58 UTC (rev 29336) +++ haiku/trunk/src/bin/sysinfo.c 2009-02-27 16:50:25 UTC (rev 29337) @@ -27,20 +27,28 @@ {0x02, "Instruction TLB: 4M-byte pages, fully associative, 2 entries"}, {0x03, "Data TLB: 4k-byte pages, 4-way set associative, 64 entries"}, {0x04, "Data TLB: 4M-byte pages, 4-way set associative, 8 entries"}, + {0x05, "Data TLB: 4M-byte pages, 4-way set associative, 32 entries"}, {0x06, "L1 inst cache: 8 KB, 4-way set associative, 32 bytes/line"}, {0x08, "L1 inst cache: 16 KB, 4-way set associative, 32 bytes/line"}, {0x0A, "L1 data cache: 8 KB, 2-way set associative, 32 bytes/line"}, {0x0C, "L1 data cache: 16 KB, 4-way set associative, 32 bytes/line"}, + {0x0D, "L1 data cache: 16 KB, 4-way set associative, 64-bytes/line, ECC"}, {0x10, /* IA-64 */ "L1 data cache: 16 KB, 4-way set associative, 32 bytes/line"}, {0x15, /* IA-64 */ "L1 inst cache: 16 KB, 4-way set associative, 32 bytes/line"}, {0x1A, /* IA-64 */ "L2 cache: 96 KB, 6-way set associative, 64 bytes/line"}, + {0x21, "L2 cache: 256 KB (MLC), 8-way set associative, 64-bytes/line"}, {0x22, "L3 cache: 512 KB, 4-way set associative (!), 64 bytes/line, dual-sectored"}, {0x23, "L3 cache: 1 MB, 8-way set associative, 64 bytes/line, dual-sectored"}, {0x25, "L3 cache: 2 MB, 8-way set associative, 64 bytes/line, dual-sectored"}, {0x29, "L3 cache: 4 MB, 8-way set associative, 64 bytes/line, dual-sectored"}, + {0x2c, "L1 data cache: 32 KB, 8-way set associative, 64 bytes/line"}, + {0x30, "L1 inst cache: 32 KB, 8-way set associative, 64 bytes/line"}, {0x39, "L2 cache: 128 KB, 4-way set associative, 64 bytes/line, sectored"}, + {0x3A, "L2 cache: 192 KB, 4-way set associative, 64 bytes/line, sectored"}, {0x3B, "L2 cache: 128 KB, 2-way set associative, 64 bytes/line, sectored"}, {0x3C, "L2 cache: 256 KB, 4-way set associative, 64 bytes/line, sectored"}, + {0x3D, "L2 cache: 384 KB, 6-way set associative, 64 bytes/line, sectored"}, + {0x3E, "L2 cache: 512 KB, 4-way set associative, 64 bytes/line, sectored"}, {0x40, NULL /*"No integrated L2 cache (P6 core) or L3 cache (P4 core)"*/}, // this one is separately handled {0x41, "L2 cache: 128 KB, 4-way set associative, 32 bytes/line"}, @@ -48,9 +56,22 @@ {0x43, "L2 cache: 512 KB, 4-way set associative, 32 bytes/line"}, {0x44, "L2 cache: 1024 KB, 4-way set associative, 32 bytes/line"}, {0x45, "L2 cache: 2048 KB, 4-way set associative, 32 bytes/line"}, + {0x46, "L3 cache: 4096 KB, 4-way set associative, 64 bytes/line"}, + {0x47, "L3 cache: 8192 KB, 8-way set associative, 64 bytes/line"}, + {0x48, "L2 cache: 3072 KB, 12-way set associative, 64 bytes/line, unified on-die"}, + // 0x49 requires special handling, either 4M L3 (Xeon MP, 0F06; otherwise 4M L2 + {0x4A, "L3 cache: 6144 KB, 12-way set associative, 64 bytes/line"}, + {0x4B, "L3 cache: 8192 KB, 16-way set associative, 64 bytes/line"}, + {0x4C, "L3 cache: 12288 KB, 12-way set associative, 64 bytes/line"}, + {0x4D, "L3 cache: 16384 KB, 16-way set associative, 64 bytes/line"}, + {0x4E, "L2 cache: 6144 KB, 24-way set associative, 64 bytes/line"}, {0x50, "Inst TLB: 4K/4M/2M-bytes pages, fully associative, 64 entries"}, {0x51, "Inst TLB: 4K/4M/2M-bytes pages, fully associative, 128 entries"}, {0x52, "Inst TLB: 4K/4M/2M-bytes pages, fully associative, 256 entries"}, + {0x55, "Inst TLB: 2M/4M-bytes pages, fully associative, 7 entries"}, + {0x56, "L1 Data TLB: 4M-bytes pages, 4-way set associative, 16 entries"}, + {0x57, "L1 Data TLB: 4K-bytes pages, 4-way set associative, 16 entries"}, + {0x5A, "Data TLB: 2M/4M-bytes pages, 4-way set associative, 32 entries"}, {0x5B, "Data TLB: 4K/4M-bytes pages, fully associative, 64 entries"}, {0x5C, "Data TLB: 4K/4M-bytes pages, fully associative, 128 entries"}, {0x5D, "Data TLB: 4K/4M-bytes pages, fully associative, 256 entries"}, @@ -84,6 +105,28 @@ {0x80, /* Cyrix specific */ "L1 cache: 16 KB, 4-way set associative, 16 bytes/line"}, // {0x82, "Cyrix specific: ???"}, // {0x84, "Cyrix specific: ???"}, + {0xB0, "Inst TLB: 4K-bytes pages, 4-way set associative, 128 entries"}, + {0xB1, "Inst TLB: 2M-bytes pages, 4-way set associative, 8 entries OR 4M, 4-way, 4 entries"}, + // Intel doesn't give any details how to determine which of the two options is the case + // as per Intel Application Note 485, November 2008. + {0xB2, "Inst TLB: 4K-bytes pages, 4-way set associative, 64 entries"}, + {0xB3, "Data TLB: 4K-bytes pages, 4-way set associative, 128 entries"}, + {0xB4, "Data TLB: 4K-bytes pages, 4-way set associative, 256 entries"}, + {0xCA, "Shared 2nd-level TLB: 4K, 4-way set associative, 512 entries"}, + {0xD0, "L3 cache: 512 KB, 4-way set associative, 64-bytes/line"}, + {0xD1, "L3 cache: 1024 KB, 4-way set associative, 64-bytes/line"}, + {0xD2, "L3 cache: 2048 KB, 4-way set associative, 64-bytes/line"}, + {0xD6, "L3 cache: 1024 KB, 8-way set associative, 64-bytes/line"}, + {0xD7, "L3 cache: 2048 KB, 8-way set associative, 64-bytes/line"}, + {0xD8, "L3 cache: 4096 KB, 8-way set associative, 64-bytes/line"}, + {0xDC, "L3 cache: 2048 KB, 12-way set associative, 64-bytes/line"}, + {0xDD, "L3 cache: 4096 KB, 12-way set associative, 64-bytes/line"}, + {0xDE, "L3 cache: 8192 KB, 12-way set associative, 64-bytes/line"}, + {0xE2, "L3 cache: 2048 KB, 16-way set associative, 64-bytes/line"}, + {0xE3, "L3 cache: 4096 KB, 16-way set associative, 64-bytes/line"}, + {0xE4, "L3 cache: 8192 KB, 16-way set associative, 64-bytes/line"}, + {0xF0, "64-byte Prefetching"}, + {0xF1, "128-byte Prefetching"}, {0, NULL} }; From revol at free.fr Fri Feb 27 19:21:25 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Fri, 27 Feb 2009 19:21:25 +0100 CET Subject: [Haiku-commits] r29328 - haiku/trunk/src/add-ons/kernel/drivers/ports/pc_serial In-Reply-To: <4861938554-BeMail@zon> Message-ID: <11745431402-BeMail@laptop> > mmu_man at BerliOS wrote: > > Log: > > Working version of the driver. At least it does seem to work with > > my > > onboard com port, > > but not the OxfordSemi PCI card I have here. Still requires > > tty_manager, and > > config_manager too, so won't work in Haiku yet. Needs cleanup. > > Great! > Just don't dare to make them compatible :-) > Config manager is needed for ISA probing, and it's used for PCI too for now, as I noticed at least under BeOS that the IRQ reported in the pci_info looked wrong. Though there is code that uses the old style PCI bus manager for probing but it's not yet used. It should be easy to move it later to the pnp stack. In anyway it's limited to a single function. As for tty manager, it can probably be abstracted away in a base class common to usb_serial. But I need to clean that up first. Fran?ois. From humdingerb at googlemail.com Fri Feb 27 19:29:52 2009 From: humdingerb at googlemail.com (Humdinger) Date: Fri, 27 Feb 2009 19:29:52 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49936944022-BeMail@zon> References: <49936944022-BeMail@zon> Message-ID: <49A83120.9010401@googlemail.com> Axel D?rfler wrote: > Humdinger wrote: >> While we're on vmx config, is there a way to have a native resolution >> (1658x1050) in vmware? > > Newer ones can do this, older ones too (just many releases inbetween > couldn't) - it's automatically part of the resolutions VESA shows. I'm feeling kinda stupid now. You're totally right. Last time I looked my resolution wasn't listed. Thanks! Now if only it would work natively on my nvidia 7600go notebook... Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From umccullough at gmail.com Fri Feb 27 20:35:26 2009 From: umccullough at gmail.com (Urias McCullough) Date: Fri, 27 Feb 2009 11:35:26 -0800 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A83120.9010401@googlemail.com> References: <49936944022-BeMail@zon> <49A83120.9010401@googlemail.com> Message-ID: <1e80d8750902271135n106ec68esae7e1ca89610efa@mail.gmail.com> On Fri, Feb 27, 2009 at 10:29 AM, Humdinger wrote: > Axel D?rfler wrote: >> Humdinger wrote: >>> While we're on vmx config, is there a way to have a native resolution >>> (1658x1050) in vmware? >> >> Newer ones can do this, older ones too (just many releases inbetween >> couldn't) - it's automatically part of the resolutions VESA shows. > > I'm feeling kinda stupid now. > You're totally right. Last time I looked my resolution wasn't listed. > Thanks! > Now if only it would work natively on my nvidia 7600go notebook... Is it "trivial" to add more resolutions? I know we get a bunch of people in #haiku asking about different resolutions using vesa - some strange, such as 1280x800 or whatever... - Urias From superstippi at gmx.de Fri Feb 27 21:24:26 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Fri, 27 Feb 2009 21:24:26 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <1e80d8750902271135n106ec68esae7e1ca89610efa@mail.gmail.com> References: <49936944022-BeMail@zon> <49A83120.9010401@googlemail.com> <1e80d8750902271135n106ec68esae7e1ca89610efa@mail.gmail.com> Message-ID: <49A84BFA.4080209@gmx.de> Urias McCullough schrieb: > On Fri, Feb 27, 2009 at 10:29 AM, Humdinger wrote: >> Axel D?rfler wrote: >>> Humdinger wrote: >>>> While we're on vmx config, is there a way to have a native resolution >>>> (1658x1050) in vmware? >>> Newer ones can do this, older ones too (just many releases inbetween >>> couldn't) - it's automatically part of the resolutions VESA shows. >> I'm feeling kinda stupid now. >> You're totally right. Last time I looked my resolution wasn't listed. >> Thanks! >> Now if only it would work natively on my nvidia 7600go notebook... > > Is it "trivial" to add more resolutions? I know we get a bunch of > people in #haiku asking about different resolutions using vesa - some > strange, such as 1280x800 or whatever... Don't know if it's possible at all. The list of resolutions in VESA comes from the VESA BIOS of the card, the vesa drivers reads that list. I know there used to be a tool for Linux that would patch the VESA BIOS of some intel cards to overwrite one resolution with another one, back when the intel driver still didn't know how to switch resolutions on Linux... Don't know if something like this could be done in a generic way. Best regards, -Stephan From umccullough at gmail.com Fri Feb 27 21:39:49 2009 From: umccullough at gmail.com (Urias McCullough) Date: Fri, 27 Feb 2009 12:39:49 -0800 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A84BFA.4080209@gmx.de> References: <49936944022-BeMail@zon> <49A83120.9010401@googlemail.com> <1e80d8750902271135n106ec68esae7e1ca89610efa@mail.gmail.com> <49A84BFA.4080209@gmx.de> Message-ID: <1e80d8750902271239u597ca615xc0f555dc678cd35d@mail.gmail.com> On Fri, Feb 27, 2009 at 12:24 PM, Stephan A?mus wrote: > Urias McCullough schrieb: >> On Fri, Feb 27, 2009 at 10:29 AM, Humdinger wrote: >>> Axel D?rfler wrote: >>>> Humdinger wrote: >>>>> While we're on vmx config, is there a way to have a native resolution >>>>> (1658x1050) in vmware? >>>> Newer ones can do this, older ones too (just many releases inbetween >>>> couldn't) - it's automatically part of the resolutions VESA shows. >>> I'm feeling kinda stupid now. >>> You're totally right. Last time I looked my resolution wasn't listed. >>> Thanks! >>> Now if only it would work natively on my nvidia 7600go notebook... >> >> Is it "trivial" to add more resolutions? I know we get a bunch of >> people in #haiku asking about different resolutions using vesa - some >> strange, such as 1280x800 or whatever... > > Don't know if it's possible at all. The list of resolutions in VESA > comes from the VESA BIOS of the card, the vesa drivers reads that list. > I know there used to be a tool for Linux that would patch the VESA BIOS > of some intel cards to overwrite one resolution with another one, back > when the intel driver still didn't know how to switch resolutions on > Linux... Don't know if something like this could be done in a generic way. Yes, it was my understanding that it worked that way as well, but Axel's assertion that vmware automatically provides the "native" 1658x1050 made by start wondering :) From bga at bug-br.org.br Fri Feb 27 21:49:46 2009 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Fri, 27 Feb 2009 17:49:46 -0300 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49A84BFA.4080209@gmx.de> References: <49936944022-BeMail@zon> <49A83120.9010401@googlemail.com> <1e80d8750902271135n106ec68esae7e1ca89610efa@mail.gmail.com> <49A84BFA.4080209@gmx.de> Message-ID: <49A851EA.3090603@bug-br.org.br> Stephan A?mus wrote: > Don't know if it's possible at all. The list of resolutions in VESA > comes from the VESA BIOS of the card, the vesa drivers reads that list. > I know there used to be a tool for Linux that would patch the VESA BIOS > of some intel cards to overwrite one resolution with another one, back > when the intel driver still didn't know how to switch resolutions on > Linux... Don't know if something like this could be done in a generic way. It s possible with some BIOS. Notably, ATI's AtomBIOS that come with newer Radeon cards can be patched to allow custom resolutions. -Bruno From dlmcpaul at gmail.com Fri Feb 27 22:00:15 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Sat, 28 Feb 2009 08:00:15 +1100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: <5269034660-BeMail@laptop> References: <5269034660-BeMail@laptop> Message-ID: 2009/2/28 Fran?ois Revol : >> I really really really want people to stop using VLC to play media >> files under haiku and the only way to do it is to have the files work >> when they play them using MediaPlayer, the only application we have >> that actually uses the MediaKit. > > You could have a look at nplay too :D Is this the nplay on BeBits that returns 404 not found :-) -- Cheers David From dlmcpaul at gmail.com Fri Feb 27 22:00:46 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Sat, 28 Feb 2009 08:00:46 +1100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: References: <5269034660-BeMail@laptop> Message-ID: 2009/2/28 J?r?me Duval : > 2009/2/27 Fran?ois Revol >> >> > I really really really want people to stop using VLC to play media >> > files under haiku and the only way to do it is to have the files work >> > when they play them using MediaPlayer, the only application we have >> > that actually uses the MediaKit. >> > > Out of curiosity did you try with playfile ? No I didn't but I obviously should have. -- Cheers David From stippi at mail.berlios.de Fri Feb 27 22:11:05 2009 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 27 Feb 2009 22:11:05 +0100 Subject: [Haiku-commits] r29338 - haiku/trunk/src/servers/app Message-ID: <200902272111.n1RLB5He001818@sheep.berlios.de> Author: stippi Date: 2009-02-27 22:11:05 +0100 (Fri, 27 Feb 2009) New Revision: 29338 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29338&view=rev Modified: haiku/trunk/src/servers/app/FontCache.cpp haiku/trunk/src/servers/app/FontCacheEntry.cpp haiku/trunk/src/servers/app/FontCacheEntry.h Log: Specify the maximum signature buffer size to prevent unwanted overflow. Modified: haiku/trunk/src/servers/app/FontCache.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCache.cpp 2009-02-27 16:50:25 UTC (rev 29337) +++ haiku/trunk/src/servers/app/FontCache.cpp 2009-02-27 21:11:05 UTC (rev 29338) @@ -52,8 +52,9 @@ FontCacheEntry* FontCache::FontCacheEntryFor(const ServerFont& font) { - char signature[512]; - FontCacheEntry::GenerateSignature(signature, font); + static const size_t signatureSize = 512; + char signature[signatureSize]; + FontCacheEntry::GenerateSignature(signature, signatureSize, font); AutoReadLocker readLocker(this); Modified: haiku/trunk/src/servers/app/FontCacheEntry.cpp =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.cpp 2009-02-27 16:50:25 UTC (rev 29337) +++ haiku/trunk/src/servers/app/FontCacheEntry.cpp 2009-02-27 21:11:05 UTC (rev 29338) @@ -217,7 +217,8 @@ // GenerateSignature /*static*/ void -FontCacheEntry::GenerateSignature(char* signature, const ServerFont& font) +FontCacheEntry::GenerateSignature(char* signature, size_t signatureSize, + const ServerFont& font) { glyph_rendering renderingType = _RenderTypeFor(font); @@ -226,7 +227,7 @@ bool hinting = font.Hinting(); uint8 averageWeight = gSubpixelAverageWeight; - sprintf(signature, "%ld,%u,%d,%d,%.1f,%d,%d", + snprintf(signature, signatureSize, "%ld,%u,%d,%d,%.1f,%d,%d", font.GetFamilyAndStyle(), charMap, font.Face(), int(renderingType), font.Size(), hinting, averageWeight); } Modified: haiku/trunk/src/servers/app/FontCacheEntry.h =================================================================== --- haiku/trunk/src/servers/app/FontCacheEntry.h 2009-02-27 16:50:25 UTC (rev 29337) +++ haiku/trunk/src/servers/app/FontCacheEntry.h 2009-02-27 21:11:05 UTC (rev 29338) @@ -93,6 +93,7 @@ uint16 glyphCode2, double* x, double* y); static void GenerateSignature(char* signature, + size_t signatureSize, const ServerFont& font); // private to FontCache class: From dlmcpaul at gmail.com Fri Feb 27 22:13:35 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Sat, 28 Feb 2009 08:13:35 +1100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: <20090227122525.213670@gmx.net> References: <200902270859.n1R8x0vr020243@sheep.berlios.de> <12487309.1235730472512.JavaMail.ngmail@webmail15.arcor-online.net> <20090227122525.213670@gmx.net> Message-ID: 2009/2/27 Stephan Assmus : > > -------- Original-Nachricht -------- >> Datum: Fri, 27 Feb 2009 22:43:48 +1100 >> Von: David McPaul >> An: SVN commits to the Haiku source repository >> Betreff: Re: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder > >> 2009/2/27 Marcus Overhagen : >> >> Author: dlmcpaul >> > >> >> Output as Stereo as AudioChannelConverter cannot handle > 2 channels >> > >> > Why are you doing this? and wtf is AudioChannelConverter ? >> >> AudioChannelConverter x channels in to y channels out depending on >> what the output supports. >> It is part of the MediaPlayer. >> >> > The whole media kit was already able to support multiple streams, >> > and the mixer would downmix them as needed. >> >> Perhaps this should be discussed with the writers of the MediaPlayer. >> The application seems to have a number of classes that I think are in >> the mixer including channel conversion, samplerate conversion and >> format conversion. > > The problem here is the AudioProducer node code in MediaPlayer. It originally stems from Be sample code, and Ingo and I already made it much more flexible than it used to be. I think changing it to support any number of channels should not be very hard at all. Then the channel converter can be removed from the pipeline that is constructed, but it's important that the remaining parts of the pipeline all handle any channel count. I believe this may already be the case. In both FormatProposal and FormatSuggestionRequested the AudioProducer returns it's preferred format which is 2 channel float 44100. I assume that one or both of these methods needs to change to try different formats. Can you tell me where this negotiation comes from? I would think that the first attempt to connect to the mixer would be with the format that the decoder proposed and then if no connection is possible retry with the format the AudioProducer could convert to based on the abilities of the Converters it has. -- Cheers David From axeld at pinc-software.de Fri Feb 27 22:22:38 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 27 Feb 2009 22:22:38 +0100 CET Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <1e80d8750902271239u597ca615xc0f555dc678cd35d@mail.gmail.com> Message-ID: <49139151950-BeMail@zon> Urias McCullough wrote: > > Don't know if it's possible at all. The list of resolutions in VESA > > comes from the VESA BIOS of the card, the vesa drivers reads that > > list. > > I know there used to be a tool for Linux that would patch the VESA > > BIOS > > of some intel cards to overwrite one resolution with another one, > > back > > when the intel driver still didn't know how to switch resolutions > > on > > Linux... Don't know if something like this could be done in a > > generic way. > Yes, it was my understanding that it worked that way as well, but > Axel's assertion that vmware automatically provides the "native" > 1658x1050 made by start wondering :) Not sure that it always does it, but VMware has total control over its VESA graphics card, unlike Haiku :-) Bye, Axel. From humdingerb at googlemail.com Fri Feb 27 22:52:07 2009 From: humdingerb at googlemail.com (Humdinger) Date: Fri, 27 Feb 2009 22:52:07 +0100 Subject: [Haiku-commits] r29272 - haiku/trunk/build/jam In-Reply-To: <49139151950-BeMail@zon> References: <49139151950-BeMail@zon> Message-ID: <49A86087.7050206@googlemail.com> Axel D?rfler wrote: > Not sure that it always does it, but VMware has total control over its > VESA graphics card, unlike Haiku :-) Or me with my notebook's chipset, else I'd have switched graphics cards a long time ago. :) Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=- Deutsche Haiku News @ http://www.haiku-gazette.de From axeld at mail.berlios.de Fri Feb 27 23:31:16 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 27 Feb 2009 23:31:16 +0100 Subject: [Haiku-commits] r29339 - haiku/trunk/src/system/kernel/fs Message-ID: <200902272231.n1RMVGIR016200@sheep.berlios.de> Author: axeld Date: 2009-02-27 23:31:15 +0100 (Fri, 27 Feb 2009) New Revision: 29339 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29339&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * zero_pages() did not fill in the _bytes parameter correctly - it returned how many unclear bytes remained instead of how many were cleared. This caused sparse files to show garbage instead of empty space. This fixes bug #2889. * common_file_io_vec_pages() set "size" (size_t) from file_io_vecs::length which is off_t without taking into account that important information could be lost. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-27 21:11:05 UTC (rev 29338) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-27 22:31:15 UTC (rev 29339) @@ -3308,7 +3308,9 @@ #endif // ADD_DEBUGGER_COMMANDS -//! Clears an iovec array of physical pages. +/*! Clears an iovec array of physical pages. + Returns in \a _bytes the number of bytes successfully cleared. +*/ static status_t zero_pages(const iovec* vecs, size_t vecCount, size_t* _bytes) { @@ -3321,14 +3323,13 @@ status_t status = vm_memset_physical((addr_t)vecs[index].iov_base, 0, length); if (status != B_OK) { - *_bytes = bytes; + *_bytes -= bytes; return status; } bytes -= length; } - *_bytes = bytes; return B_OK; } @@ -3359,8 +3360,9 @@ // now directly read the data from the device // the first file_io_vec can be read directly - size = fileVecs[0].length; - if (size > numBytes) + if (fileVecs[0].length < numBytes) + size = fileVecs[0].length; + else size = numBytes; if (fileVecs[0].offset >= 0) { @@ -8548,7 +8550,7 @@ case LOCK_SH: case LOCK_EX: break; - + default: return B_BAD_VALUE; } From mmu_man at mail.berlios.de Fri Feb 27 23:44:06 2009 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 27 Feb 2009 23:44:06 +0100 Subject: [Haiku-commits] r29340 - haiku/trunk/headers/private/kernel/util Message-ID: <200902272244.n1RMi6nd017165@sheep.berlios.de> Author: mmu_man Date: 2009-02-27 23:44:05 +0100 (Fri, 27 Feb 2009) New Revision: 29340 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29340&view=rev Modified: haiku/trunk/headers/private/kernel/util/OpenHashTable.h Log: Fix for gcc4 build. Thx Monni. Modified: haiku/trunk/headers/private/kernel/util/OpenHashTable.h =================================================================== --- haiku/trunk/headers/private/kernel/util/OpenHashTable.h 2009-02-27 22:31:15 UTC (rev 29339) +++ haiku/trunk/headers/private/kernel/util/OpenHashTable.h 2009-02-27 22:44:05 UTC (rev 29340) @@ -7,6 +7,7 @@ #include +#include #ifdef _KERNEL_MODE # include From axeld at mail.berlios.de Sat Feb 28 00:09:40 2009 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 28 Feb 2009 00:09:40 +0100 Subject: [Haiku-commits] r29341 - haiku/trunk/src/system/kernel/fs Message-ID: <200902272309.n1RN9eho018781@sheep.berlios.de> Author: axeld Date: 2009-02-28 00:09:39 +0100 (Sat, 28 Feb 2009) New Revision: 29341 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29341&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * Consolidated '*' style. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-27 22:44:05 UTC (rev 29340) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-27 23:09:39 UTC (rev 29341) @@ -1,6 +1,6 @@ /* * Copyright 2005-2008, Ingo Weinhold, ingo_weinhold at gmx.de. - * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2002-2009, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -262,13 +262,13 @@ struct vnode : fs_vnode, DoublyLinkedListLinkImpl { - struct vnode *next; - vm_cache *cache; + struct vnode* next; + vm_cache* cache; dev_t device; list_link unused_link; ino_t id; - struct fs_mount *mount; - struct vnode *covered_by; + struct fs_mount* mount; + struct vnode* covered_by; int32 ref_count; uint32 type : 29; // TODO: S_INDEX_DIR actually needs another bit. @@ -276,8 +276,8 @@ uint32 remove : 1; uint32 busy : 1; uint32 unpublished : 1; - struct advisory_locking *advisory_locking; - struct file_descriptor *mandatory_locked_by; + struct advisory_locking* advisory_locking; + struct file_descriptor* mandatory_locked_by; }; struct vnode_hash_key { @@ -427,13 +427,13 @@ static mutex sIOContextRootLock = MUTEX_INITIALIZER("io_context::root lock"); #define VNODE_HASH_TABLE_SIZE 1024 -static hash_table *sVnodeTable; +static hash_table* sVnodeTable; static list sUnusedVnodeList; static uint32 sUnusedVnodes = 0; -static struct vnode *sRoot; +static struct vnode* sRoot; #define MOUNTS_HASH_TABLE_SIZE 16 -static hash_table *sMountsTable; +static hash_table* sMountsTable; static dev_t sNextMountID = 1; #define MAX_TEMP_IO_VECS 8 @@ -443,64 +443,78 @@ /* function declarations */ // file descriptor operation prototypes -static status_t file_read(struct file_descriptor *, off_t pos, void *buffer, size_t *); -static status_t file_write(struct file_descriptor *, off_t pos, const void *buffer, size_t *); -static off_t file_seek(struct file_descriptor *, off_t pos, int seek_type); -static void file_free_fd(struct file_descriptor *); -static status_t file_close(struct file_descriptor *); -static status_t file_select(struct file_descriptor *, uint8 event, - struct selectsync *sync); -static status_t file_deselect(struct file_descriptor *, uint8 event, - struct selectsync *sync); -static status_t dir_read(struct io_context *, struct file_descriptor *, - struct dirent *buffer, size_t bufferSize, uint32 *_count); -static status_t dir_read(struct io_context* ioContext, struct vnode *vnode, - void *cookie, struct dirent *buffer, size_t bufferSize, uint32 *_count); -static status_t dir_rewind(struct file_descriptor *); -static void dir_free_fd(struct file_descriptor *); -static status_t dir_close(struct file_descriptor *); -static status_t attr_dir_read(struct io_context *, struct file_descriptor *, - struct dirent *buffer, size_t bufferSize, uint32 *_count); -static status_t attr_dir_rewind(struct file_descriptor *); -static void attr_dir_free_fd(struct file_descriptor *); -static status_t attr_dir_close(struct file_descriptor *); -static status_t attr_read(struct file_descriptor *, off_t pos, void *buffer, size_t *); -static status_t attr_write(struct file_descriptor *, off_t pos, const void *buffer, size_t *); -static off_t attr_seek(struct file_descriptor *, off_t pos, int seek_type); -static void attr_free_fd(struct file_descriptor *); -static status_t attr_close(struct file_descriptor *); -static status_t attr_read_stat(struct file_descriptor *, struct stat *); -static status_t attr_write_stat(struct file_descriptor *, const struct stat *, int statMask); -static status_t index_dir_read(struct io_context *, struct file_descriptor *, - struct dirent *buffer, size_t bufferSize, uint32 *_count); -static status_t index_dir_rewind(struct file_descriptor *); -static void index_dir_free_fd(struct file_descriptor *); -static status_t index_dir_close(struct file_descriptor *); -static status_t query_read(struct io_context *, struct file_descriptor *, - struct dirent *buffer, size_t bufferSize, uint32 *_count); -static status_t query_rewind(struct file_descriptor *); -static void query_free_fd(struct file_descriptor *); -static status_t query_close(struct file_descriptor *); +static status_t file_read(struct file_descriptor* descriptor, off_t pos, + void* buffer, size_t* _bytes); +static status_t file_write(struct file_descriptor* descriptor, off_t pos, + const void* buffer, size_t* _bytes); +static off_t file_seek(struct file_descriptor* descriptor, off_t pos, + int seekType); +static void file_free_fd(struct file_descriptor* descriptor); +static status_t file_close(struct file_descriptor* descriptor); +static status_t file_select(struct file_descriptor* descriptor, uint8 event, + struct selectsync* sync); +static status_t file_deselect(struct file_descriptor* descriptor, uint8 event, + struct selectsync* sync); +static status_t dir_read(struct io_context* context, + struct file_descriptor* descriptor, struct dirent* buffer, size_t bufferSize, + uint32* _count); +static status_t dir_read(struct io_context* ioContext, struct vnode* vnode, + void* cookie, struct dirent* buffer, size_t bufferSize, uint32* _count); +static status_t dir_rewind(struct file_descriptor* descriptor); +static void dir_free_fd(struct file_descriptor* descriptor); +static status_t dir_close(struct file_descriptor* descriptor); +static status_t attr_dir_read(struct io_context* context, + struct file_descriptor* descriptor, struct dirent* buffer, size_t bufferSize, + uint32* _count); +static status_t attr_dir_rewind(struct file_descriptor* descriptor); +static void attr_dir_free_fd(struct file_descriptor* descriptor); +static status_t attr_dir_close(struct file_descriptor* descriptor); +static status_t attr_read(struct file_descriptor* descriptor, off_t pos, + void* buffer, size_t* _bytes); +static status_t attr_write(struct file_descriptor* descriptor, off_t pos, + const void* buffer, size_t* _bytes); +static off_t attr_seek(struct file_descriptor* descriptor, off_t pos, + int seekType); +static void attr_free_fd(struct file_descriptor* descriptor); +static status_t attr_close(struct file_descriptor* descriptor); +static status_t attr_read_stat(struct file_descriptor* descriptor, + struct stat* statData); +static status_t attr_write_stat(struct file_descriptor* descriptor, + const struct stat* descriptor, int statMask); +static status_t index_dir_read(struct io_context* context, + struct file_descriptor* descriptor, struct dirent* buffer, size_t bufferSize, + uint32* _count); +static status_t index_dir_rewind(struct file_descriptor* descriptor); +static void index_dir_free_fd(struct file_descriptor* descriptor); +static status_t index_dir_close(struct file_descriptor* descriptor); +static status_t query_read(struct io_context* context, + struct file_descriptor* descriptor, struct dirent* buffer, size_t bufferSize, + uint32* _count); +static status_t query_rewind(struct file_descriptor* descriptor); +static void query_free_fd(struct file_descriptor* descriptor); +static status_t query_close(struct file_descriptor* descriptor); -static status_t common_ioctl(struct file_descriptor *, ulong, void *buf, size_t len); -static status_t common_read_stat(struct file_descriptor *, struct stat *); -static status_t common_write_stat(struct file_descriptor *, const struct stat *, int statMask); +static status_t common_ioctl(struct file_descriptor* descriptor, ulong op, + void* buffer, size_t length); +static status_t common_read_stat(struct file_descriptor* descriptor, + struct stat* statData); +static status_t common_write_stat(struct file_descriptor* descriptor, + const struct stat* statData, int statMask); +static status_t common_path_read_stat(int fd, char* path, bool traverseLeafLink, + struct stat* stat, bool kernel); -static status_t common_path_read_stat(int fd, char *path, bool traverseLeafLink, - struct stat *stat, bool kernel); - -static status_t vnode_path_to_vnode(struct vnode *vnode, char *path, +static status_t vnode_path_to_vnode(struct vnode* vnode, char* path, bool traverseLeafLink, int count, bool kernel, - struct vnode **_vnode, ino_t *_parentID); -static status_t dir_vnode_to_path(struct vnode *vnode, char *buffer, + struct vnode** _vnode, ino_t* _parentID); +static status_t dir_vnode_to_path(struct vnode* vnode, char* buffer, size_t bufferSize, bool kernel); -static status_t fd_and_path_to_vnode(int fd, char *path, bool traverseLeafLink, - struct vnode **_vnode, ino_t *_parentID, bool kernel); -static void inc_vnode_ref_count(struct vnode *vnode); -static status_t dec_vnode_ref_count(struct vnode *vnode, bool alwaysFree, +static status_t fd_and_path_to_vnode(int fd, char* path, bool traverseLeafLink, + struct vnode** _vnode, ino_t* _parentID, bool kernel); +static void inc_vnode_ref_count(struct vnode* vnode); +static status_t dec_vnode_ref_count(struct vnode* vnode, bool alwaysFree, bool reenter); -static inline void put_vnode(struct vnode *vnode); -static status_t fs_unmount(char *path, dev_t mountID, uint32 flags, +static inline void put_vnode(struct vnode* vnode); +static status_t fs_unmount(char* path, dev_t mountID, uint32 flags, bool kernel); @@ -622,14 +636,14 @@ // VNodePutter class VNodePutter { public: - VNodePutter(struct vnode *vnode = NULL) : fVNode(vnode) {} + VNodePutter(struct vnode* vnode = NULL) : fVNode(vnode) {} ~VNodePutter() { Put(); } - void SetTo(struct vnode *vnode) + void SetTo(struct vnode* vnode) { Put(); fVNode = vnode; @@ -643,15 +657,15 @@ } } - struct vnode *Detach() + struct vnode* Detach() { - struct vnode *vnode = fVNode; + struct vnode* vnode = fVNode; fVNode = NULL; return vnode; } private: - struct vnode *fVNode; + struct vnode* fVNode; }; @@ -801,10 +815,10 @@ static int -mount_compare(void *_m, const void *_key) +mount_compare(void* _m, const void* _key) { - struct fs_mount *mount = (fs_mount *)_m; - const dev_t *id = (dev_t *)_key; + struct fs_mount* mount = (fs_mount*)_m; + const dev_t* id = (dev_t*)_key; if (mount->id == *id) return 0; @@ -814,10 +828,10 @@ static uint32 -mount_hash(void *_m, const void *_key, uint32 range) +mount_hash(void* _m, const void* _key, uint32 range) { - struct fs_mount *mount = (fs_mount *)_m; - const dev_t *id = (dev_t *)_key; + struct fs_mount* mount = (fs_mount*)_m; + const dev_t* id = (dev_t*)_key; if (mount) return mount->id % range; @@ -829,19 +843,19 @@ /*! Finds the mounted device (the fs_mount structure) with the given ID. Note, you must hold the gMountMutex lock when you call this function. */ -static struct fs_mount * +static struct fs_mount* find_mount(dev_t id) { ASSERT_LOCKED_MUTEX(&sMountMutex); - return (fs_mount *)hash_lookup(sMountsTable, (void *)&id); + return (fs_mount*)hash_lookup(sMountsTable, (void*)&id); } static status_t -get_mount(dev_t id, struct fs_mount **_mount) +get_mount(dev_t id, struct fs_mount** _mount) { - struct fs_mount *mount; + struct fs_mount* mount; MutexLocker nodeLocker(sVnodeMutex); MutexLocker mountLocker(sMountMutex); @@ -863,7 +877,7 @@ static void -put_mount(struct fs_mount *mount) +put_mount(struct fs_mount* mount) { if (mount) put_vnode(mount->root_vnode); @@ -875,8 +889,8 @@ Returns a pointer to file system module interface, or NULL if it could not open the module. */ -static file_system_module_info * -get_file_system(const char *fsName) +static file_system_module_info* +get_file_system(const char* fsName) { char name[B_FILE_NAME_LENGTH]; if (strncmp(fsName, "file_systems/", strlen("file_systems/"))) { @@ -886,8 +900,8 @@ fsName = NULL; } - file_system_module_info *info; - if (get_module(fsName ? fsName : name, (module_info **)&info) != B_OK) + file_system_module_info* info; + if (get_module(fsName ? fsName : name, (module_info**)&info) != B_OK) return NULL; return info; @@ -900,8 +914,8 @@ done with it. Returns NULL if the required memory is not available. */ -static char * -get_file_system_name(const char *fsName) +static char* +get_file_system_name(const char* fsName) { const size_t length = strlen("file_systems/"); @@ -911,7 +925,7 @@ } fsName += length; - const char *end = strchr(fsName, '/'); + const char* end = strchr(fsName, '/'); if (end == NULL) { // this doesn't seem to be a valid name, but well... return strdup(fsName); @@ -919,7 +933,7 @@ // cut off the trailing /v1 - char *name = (char *)malloc(end + 1 - fsName); + char* name = (char*)malloc(end + 1 - fsName); if (name == NULL) return NULL; @@ -935,11 +949,11 @@ Returns NULL if the required memory is not available or if there is no name for the specified layer. */ -static char * -get_file_system_name_for_layer(const char *fsNames, int32 layer) +static char* +get_file_system_name_for_layer(const char* fsNames, int32 layer) { while (layer >= 0) { - const char *end = strchr(fsNames, ':'); + const char* end = strchr(fsNames, ':'); if (end == NULL) { if (layer == 0) return strdup(fsNames); @@ -948,7 +962,7 @@ if (layer == 0) { size_t length = end - fsNames + 1; - char *result = (char *)malloc(length); + char* result = (char*)malloc(length); strlcpy(result, fsNames, length); return result; } @@ -962,10 +976,10 @@ static int -vnode_compare(void *_vnode, const void *_key) +vnode_compare(void* _vnode, const void* _key) { - struct vnode *vnode = (struct vnode *)_vnode; - const struct vnode_hash_key *key = (vnode_hash_key *)_key; + struct vnode* vnode = (struct vnode*)_vnode; + const struct vnode_hash_key* key = (vnode_hash_key*)_key; if (vnode->device == key->device && vnode->id == key->vnode) return 0; @@ -975,10 +989,10 @@ static uint32 -vnode_hash(void *_vnode, const void *_key, uint32 range) +vnode_hash(void* _vnode, const void* _key, uint32 range) { - struct vnode *vnode = (struct vnode *)_vnode; - const struct vnode_hash_key *key = (vnode_hash_key *)_key; + struct vnode* vnode = (struct vnode*)_vnode; + const struct vnode_hash_key* key = (vnode_hash_key*)_key; #define VHASH(mountid, vnodeid) (((uint32)((vnodeid) >> 32) + (uint32)(vnodeid)) ^ (uint32)(mountid)) @@ -992,7 +1006,7 @@ static void -add_vnode_to_mount_list(struct vnode *vnode, struct fs_mount *mount) +add_vnode_to_mount_list(struct vnode* vnode, struct fs_mount* mount) { RecursiveLocker _(mount->rlock); mount->vnodes.Add(vnode); @@ -1000,7 +1014,7 @@ static void -remove_vnode_from_mount_list(struct vnode *vnode, struct fs_mount *mount) +remove_vnode_from_mount_list(struct vnode* vnode, struct fs_mount* mount) { RecursiveLocker _(mount->rlock); mount->vnodes.Remove(vnode); @@ -1008,11 +1022,11 @@ static status_t -create_new_vnode(struct vnode **_vnode, dev_t mountID, ino_t vnodeID) +create_new_vnode(struct vnode** _vnode, dev_t mountID, ino_t vnodeID) { FUNCTION(("create_new_vnode()\n")); - struct vnode *vnode = (struct vnode *)malloc(sizeof(struct vnode)); + struct vnode* vnode = (struct vnode*)malloc(sizeof(struct vnode)); if (vnode == NULL) return B_NO_MEMORY; @@ -1047,7 +1061,7 @@ Will also make sure that any cache modifications are written back. */ static void -free_vnode(struct vnode *vnode, bool reenter) +free_vnode(struct vnode* vnode, bool reenter) { ASSERT_PRINT(vnode->ref_count == 0 && vnode->busy, "vnode: %p\n", vnode); @@ -1114,7 +1128,7 @@ \return \c B_OK, if everything went fine, an error code otherwise. */ static status_t -dec_vnode_ref_count(struct vnode *vnode, bool alwaysFree, bool reenter) +dec_vnode_ref_count(struct vnode* vnode, bool alwaysFree, bool reenter) { mutex_lock(&sVnodeMutex); @@ -1169,7 +1183,7 @@ \param vnode the vnode. */ static void -inc_vnode_ref_count(struct vnode *vnode) +inc_vnode_ref_count(struct vnode* vnode) { atomic_add(&vnode->ref_count, 1); TRACE(("inc_vnode_ref_count: vnode %p, ref now %ld\n", vnode, vnode->ref_count)); @@ -1186,7 +1200,7 @@ \return The vnode structure, if it was found in the hash table, \c NULL otherwise. */ -static struct vnode * +static struct vnode* lookup_vnode(dev_t mountID, ino_t vnodeID) { struct vnode_hash_key key; @@ -1194,7 +1208,7 @@ key.device = mountID; key.vnode = vnodeID; - return (vnode *)hash_lookup(sVnodeTable, &key); + return (vnode*)hash_lookup(sVnodeTable, &key); } @@ -1231,7 +1245,7 @@ \return \c B_OK, if everything when fine, an error code otherwise. */ static status_t -get_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode, bool canWait, +get_vnode(dev_t mountID, ino_t vnodeID, struct vnode** _vnode, bool canWait, int reenter) { FUNCTION(("get_vnode: mountid %ld vnid 0x%Lx %p\n", mountID, vnodeID, _vnode)); @@ -1241,7 +1255,7 @@ int32 tries = 1000; // try for 10 secs restart: - struct vnode *vnode = lookup_vnode(mountID, vnodeID); + struct vnode* vnode = lookup_vnode(mountID, vnodeID); if (vnode && vnode->busy) { mutex_unlock(&sVnodeMutex); if (!canWait || --tries < 0) { @@ -1334,14 +1348,14 @@ \param vnode the vnode. */ static inline void -put_vnode(struct vnode *vnode) +put_vnode(struct vnode* vnode) { dec_vnode_ref_count(vnode, false, false); } static void -vnode_low_resource_handler(void */*data*/, uint32 resources, int32 level) +vnode_low_resource_handler(void* /*data*/, uint32 resources, int32 level) { TRACE(("vnode_low_resource_handler(level = %ld)\n", level)); @@ -1367,7 +1381,7 @@ for (uint32 i = 0; i < count; i++) { mutex_lock(&sVnodeMutex); - struct vnode *vnode = (struct vnode *)list_remove_head_item( + struct vnode* vnode = (struct vnode*)list_remove_head_item( &sUnusedVnodeList); if (vnode == NULL) { mutex_unlock(&sVnodeMutex); @@ -1389,7 +1403,7 @@ static inline void -put_advisory_locking(struct advisory_locking *locking) +put_advisory_locking(struct advisory_locking* locking) { release_sem(locking->lock); } @@ -1402,12 +1416,12 @@ Note, you must not have the vnode mutex locked when calling this function. */ -static struct advisory_locking * -get_advisory_locking(struct vnode *vnode) +static struct advisory_locking* +get_advisory_locking(struct vnode* vnode) { mutex_lock(&sVnodeMutex); - struct advisory_locking *locking = vnode->advisory_locking; + struct advisory_locking* locking = vnode->advisory_locking; sem_id lock = locking != NULL ? locking->lock : B_ERROR; mutex_unlock(&sVnodeMutex); @@ -1432,13 +1446,13 @@ one locked then. */ static status_t -create_advisory_locking(struct vnode *vnode) +create_advisory_locking(struct vnode* vnode) { if (vnode == NULL) return B_FILE_ERROR; ObjectDeleter lockingDeleter; - struct advisory_locking *locking = NULL; + struct advisory_locking* locking = NULL; while (get_advisory_locking(vnode) == NULL) { // no locking object set on the vnode yet, create one @@ -1475,9 +1489,9 @@ /*! Retrieves the first lock that has been set by the current team. */ static status_t -get_advisory_lock(struct vnode *vnode, struct flock *flock) +get_advisory_lock(struct vnode* vnode, struct flock* flock) { - struct advisory_locking *locking = get_advisory_locking(vnode); + struct advisory_locking* locking = get_advisory_locking(vnode); if (locking == NULL) return B_BAD_VALUE; @@ -1487,7 +1501,7 @@ LockList::Iterator iterator = locking->locks.GetIterator(); while (iterator.HasNext()) { - struct advisory_lock *lock = iterator.Next(); + struct advisory_lock* lock = iterator.Next(); if (lock->team == team) { flock->l_start = lock->start; @@ -1506,7 +1520,7 @@ with the advisory_lock \a lock. */ static bool -advisory_lock_intersects(struct advisory_lock *lock, struct flock *flock) +advisory_lock_intersects(struct advisory_lock* lock, struct flock* flock) { if (flock == NULL) return true; @@ -1520,11 +1534,11 @@ if \a flock is NULL. */ static status_t -release_advisory_lock(struct vnode *vnode, struct flock *flock) +release_advisory_lock(struct vnode* vnode, struct flock* flock) { FUNCTION(("release_advisory_lock(vnode = %p, flock = %p)\n", vnode, flock)); - struct advisory_locking *locking = get_advisory_locking(vnode); + struct advisory_locking* locking = get_advisory_locking(vnode); if (locking == NULL) return B_OK; @@ -1536,7 +1550,7 @@ LockList::Iterator iterator = locking->locks.GetIterator(); while (iterator.HasNext()) { - struct advisory_lock *lock = iterator.Next(); + struct advisory_lock* lock = iterator.Next(); bool removeLock = false; if (lock->session == session) @@ -1560,7 +1574,7 @@ lock->start = flock->l_start + flock->l_len; } else { // divide the lock into two locks - struct advisory_lock *secondLock = new advisory_lock; + struct advisory_lock* secondLock = new advisory_lock; if (secondLock == NULL) { // TODO: we should probably revert the locks we already // changed... (ie. allocate upfront) @@ -1632,7 +1646,7 @@ seems to be in line to what the BSD's are doing). */ static status_t -acquire_advisory_lock(struct vnode *vnode, pid_t session, struct flock *flock, +acquire_advisory_lock(struct vnode* vnode, pid_t session, struct flock* flock, bool wait) { FUNCTION(("acquire_advisory_lock(vnode = %p, flock = %p, wait = %s)\n", @@ -1643,7 +1657,7 @@ // TODO: do deadlock detection! - struct advisory_locking *locking; + struct advisory_locking* locking; sem_id waitForLock; while (true) { @@ -1660,7 +1674,7 @@ // test for collisions LockList::Iterator iterator = locking->locks.GetIterator(); while (iterator.HasNext()) { - struct advisory_lock *lock = iterator.Next(); + struct advisory_lock* lock = iterator.Next(); // TODO: locks from the same team might be joinable! if (lock->team != team && advisory_lock_intersects(lock, flock)) { @@ -1694,7 +1708,7 @@ // install new lock - struct advisory_lock *lock = (struct advisory_lock *)malloc( + struct advisory_lock* lock = (struct advisory_lock*)malloc( sizeof(struct advisory_lock)); if (lock == NULL) { if (waitForLock >= B_OK) @@ -1722,7 +1736,7 @@ values according to the l_whence field. */ static status_t -normalize_flock(struct file_descriptor *descriptor, struct flock *flock) +normalize_flock(struct file_descriptor* descriptor, struct flock* flock) { switch (flock->l_whence) { case SEEK_SET: @@ -1732,7 +1746,7 @@ break; case SEEK_END: { - struct vnode *vnode = descriptor->u.vnode; + struct vnode* vnode = descriptor->u.vnode; struct stat stat; status_t status; @@ -1813,16 +1827,16 @@ TODO: there is currently no means to stop a blocking read/write! */ void -disconnect_mount_or_vnode_fds(struct fs_mount *mount, - struct vnode *vnodeToDisconnect) +disconnect_mount_or_vnode_fds(struct fs_mount* mount, + struct vnode* vnodeToDisconnect) { // iterate over all teams and peek into their file descriptors int32 nextTeamID = 0; while (true) { - struct io_context *context = NULL; + struct io_context* context = NULL; bool contextLocked = false; - struct team *team = NULL; + struct team* team = NULL; team_id lastTeamID; cpu_status state = disable_interrupts(); @@ -1837,7 +1851,7 @@ } if (team) { - context = (io_context *)team->io_context; + context = (io_context*)team->io_context; // Some acrobatics to lock the context in a safe way // (cf. _kern_get_next_fd_info() for details). @@ -1875,12 +1889,12 @@ sRoot, false); for (uint32 i = 0; i < context->table_size; i++) { - if (struct file_descriptor *descriptor = context->fds[i]) { + if (struct file_descriptor* descriptor = context->fds[i]) { inc_fd_ref_count(descriptor); // if this descriptor points at this mount, we // need to disconnect it to be able to unmount - struct vnode *vnode = fd_vnode(descriptor); + struct vnode* vnode = fd_vnode(descriptor); if (vnodeToDisconnect != NULL) { if (vnode == vnodeToDisconnect) disconnect_fd(descriptor); @@ -1940,13 +1954,13 @@ \return The volume root vnode the vnode cover is covered by, if it is indeed a mount point, or \c NULL otherwise. */ -static struct vnode * -resolve_mount_point_to_volume_root(struct vnode *vnode) +static struct vnode* +resolve_mount_point_to_volume_root(struct vnode* vnode) { if (!vnode) return NULL; - struct vnode *volumeRoot = NULL; + struct vnode* volumeRoot = NULL; mutex_lock(&sVnodeCoveredByMutex); if (vnode->covered_by) { @@ -1981,16 +1995,16 @@ */ status_t resolve_mount_point_to_volume_root(dev_t mountID, ino_t nodeID, - dev_t *resolvedMountID, ino_t *resolvedNodeID) + dev_t* resolvedMountID, ino_t* resolvedNodeID) { // get the node - struct vnode *node; + struct vnode* node; status_t error = get_vnode(mountID, nodeID, &node, true, false); if (error != B_OK) return error; // resolve the node - struct vnode *resolvedNode = resolve_mount_point_to_volume_root(node); + struct vnode* resolvedNode = resolve_mount_point_to_volume_root(node); if (resolvedNode) { put_vnode(node); node = resolvedNode; @@ -2016,15 +2030,15 @@ \return The mount point vnode the vnode covers, if it is indeed a volume root and not "/", or \c NULL otherwise. */ -static struct vnode * -resolve_volume_root_to_mount_point(struct vnode *vnode) +static struct vnode* +resolve_volume_root_to_mount_point(struct vnode* vnode) { if (!vnode) return NULL; - struct vnode *mountPoint = NULL; + struct vnode* mountPoint = NULL; - struct fs_mount *mount = vnode->mount; + struct fs_mount* mount = vnode->mount; if (vnode == mount->root_vnode && mount->covers_vnode) { mountPoint = mount->covers_vnode; inc_vnode_ref_count(mountPoint); @@ -2051,12 +2065,12 @@ if the given path name is empty. */ static status_t -get_dir_path_and_leaf(char *path, char *filename) +get_dir_path_and_leaf(char* path, char* filename) { if (*path == '\0') return B_ENTRY_NOT_FOUND; - char *p = strrchr(path, '/'); + char* p = strrchr(path, '/'); // '/' are not allowed in file names! FUNCTION(("get_dir_path_and_leaf(path = %s)\n", path)); @@ -2096,15 +2110,15 @@ static status_t -entry_ref_to_vnode(dev_t mountID, ino_t directoryID, const char *name, - bool traverse, bool kernel, struct vnode **_vnode) +entry_ref_to_vnode(dev_t mountID, ino_t directoryID, const char* name, + bool traverse, bool kernel, struct vnode** _vnode) { char clonedName[B_FILE_NAME_LENGTH + 1]; if (strlcpy(clonedName, name, B_FILE_NAME_LENGTH) >= B_FILE_NAME_LENGTH) return B_NAME_TOO_LONG; // get the directory vnode and let vnode_path_to_vnode() do the rest - struct vnode *directory; + struct vnode* directory; status_t status = get_vnode(mountID, directoryID, &directory, true, false); if (status < 0) @@ -2154,9 +2168,9 @@ it is successful or not! */ static status_t -vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink, - int count, struct io_context *ioContext, struct vnode **_vnode, - ino_t *_parentID) +vnode_path_to_vnode(struct vnode* vnode, char* path, bool traverseLeafLink, + int count, struct io_context* ioContext, struct vnode** _vnode, + ino_t* _parentID) { status_t status = B_OK; ino_t lastParentID = vnode->id; @@ -2174,8 +2188,8 @@ } while (true) { - struct vnode *nextVnode; - char *nextPath; + struct vnode* nextVnode; + char* nextPath; TRACE(("vnode_path_to_vnode: top of loop. p = %p, p = '%s'\n", path, path)); @@ -2237,7 +2251,7 @@ if (S_ISLNK(nextVnode->type) && !(!traverseLeafLink && nextPath[0] == '\0')) { size_t bufferSize; - char *buffer; + char* buffer; TRACE(("traverse link\n")); @@ -2247,7 +2261,7 @@ goto resolve_link_error; } - buffer = (char *)malloc(bufferSize = B_PATH_NAME_LENGTH); + buffer = (char*)malloc(bufferSize = B_PATH_NAME_LENGTH); if (buffer == NULL) { status = B_NO_MEMORY; goto resolve_link_error; @@ -2321,7 +2335,7 @@ vnode = nextVnode; // see if we hit a mount point - struct vnode *mountPoint = resolve_mount_point_to_volume_root(vnode); + struct vnode* mountPoint = resolve_mount_point_to_volume_root(vnode); if (mountPoint) { put_vnode(vnode); vnode = mountPoint; @@ -2337,8 +2351,8 @@ static status_t -vnode_path_to_vnode(struct vnode *vnode, char *path, bool traverseLeafLink, - int count, bool kernel, struct vnode **_vnode, ino_t *_parentID) +vnode_path_to_vnode(struct vnode* vnode, char* path, bool traverseLeafLink, + int count, bool kernel, struct vnode** _vnode, ino_t* _parentID) { return vnode_path_to_vnode(vnode, path, traverseLeafLink, count, get_current_io_context(kernel), _vnode, _parentID); @@ -2346,10 +2360,10 @@ static status_t -path_to_vnode(char *path, bool traverseLink, struct vnode **_vnode, - ino_t *_parentID, bool kernel) +path_to_vnode(char* path, bool traverseLink, struct vnode** _vnode, + ino_t* _parentID, bool kernel) { - struct vnode *start = NULL; + struct vnode* start = NULL; FUNCTION(("path_to_vnode(path = \"%s\")\n", path)); @@ -2376,7 +2390,7 @@ } } else { - struct io_context *context = get_current_io_context(kernel); + struct io_context* context = get_current_io_context(kernel); mutex_lock(&context->io_mutex); start = context->cwd; @@ -2398,7 +2412,7 @@ The path buffer must be able to store at least one additional character. */ static status_t -path_to_dir_vnode(char *path, struct vnode **_vnode, char *filename, bool kernel) +path_to_dir_vnode(char* path, struct vnode** _vnode, char* filename, bool kernel) { status_t status = get_dir_path_and_leaf(path, filename); if (status != B_OK) @@ -2433,8 +2447,8 @@ \return \c B_OK, if everything went fine, another error code otherwise. */ static status_t -fd_and_path_to_dir_vnode(int fd, char *path, struct vnode **_vnode, - char *filename, bool kernel) +fd_and_path_to_dir_vnode(int fd, char* path, struct vnode** _vnode, + char* filename, bool kernel) { if (!path) return B_BAD_VALUE; @@ -2476,8 +2490,8 @@ \return \c B_OK, if everything went fine, another error code otherwise. */ static status_t -vnode_and_path_to_dir_vnode(struct vnode* vnode, char *path, - struct vnode **_vnode, char *filename, bool kernel) +vnode_and_path_to_dir_vnode(struct vnode* vnode, char* path, + struct vnode** _vnode, char* filename, bool kernel) { if (!path) return B_BAD_VALUE; @@ -2500,7 +2514,7 @@ /*! Returns a vnode's name in the d_name field of a supplied dirent buffer. */ static status_t -get_vnode_name(struct vnode *vnode, struct vnode *parent, struct dirent *buffer, +get_vnode_name(struct vnode* vnode, struct vnode* parent, struct dirent* buffer, size_t bufferSize, struct io_context* ioContext) { if (bufferSize < sizeof(struct dirent)) @@ -2528,7 +2542,7 @@ if (parent == NULL) return EOPNOTSUPP; - void *cookie; + void* cookie; status_t status = FS_CALL(parent, open_dir, &cookie); if (status >= B_OK) { @@ -2557,11 +2571,11 @@ static status_t -get_vnode_name(struct vnode *vnode, struct vnode *parent, char *name, +get_vnode_name(struct vnode* vnode, struct vnode* parent, char* name, size_t nameSize, bool kernel) { char buffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH]; - struct dirent *dirent = (struct dirent *)buffer; + struct dirent* dirent = (struct dirent*)buffer; status_t status = get_vnode_name(vnode, parent, dirent, sizeof(buffer), get_current_io_context(kernel)); @@ -2591,7 +2605,7 @@ in the calling function (it's not done here because of efficiency) */ static status_t -dir_vnode_to_path(struct vnode *vnode, char *buffer, size_t bufferSize, +dir_vnode_to_path(struct vnode* vnode, char* buffer, size_t bufferSize, bool kernel) { FUNCTION(("dir_vnode_to_path(%p, %p, %lu)\n", vnode, buffer, bufferSize)); @@ -2607,7 +2621,7 @@ if (pathBuffer.InitCheck() != B_OK) return B_NO_MEMORY; - char *path = pathBuffer.LockBuffer(); + char* path = pathBuffer.LockBuffer(); int32 insert = pathBuffer.BufferSize(); int32 maxLevel = 256; int32 length; @@ -2618,7 +2632,7 @@ inc_vnode_ref_count(vnode); // resolve a volume root to its mount point - struct vnode *mountPoint = resolve_volume_root_to_mount_point(vnode); + struct vnode* mountPoint = resolve_volume_root_to_mount_point(vnode); if (mountPoint) { put_vnode(vnode); vnode = mountPoint; @@ -2631,8 +2645,8 @@ while (true) { // the name buffer is also used for fs_read_dir() char nameBuffer[sizeof(struct dirent) + B_FILE_NAME_LENGTH]; - char *name = &((struct dirent *)nameBuffer)->d_name[0]; - struct vnode *parentVnode; + char* name = &((struct dirent*)nameBuffer)->d_name[0]; + struct vnode* parentVnode; ino_t parentID; // lookup the parent vnode @@ -2719,14 +2733,14 @@ additional character. */ static status_t -check_path(char *to) +check_path(char* to) { int32 length = 0; // check length of every path component [... truncated: 3247 lines follow ...] From revol at free.fr Sat Feb 28 00:12:15 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sat, 28 Feb 2009 00:12:15 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29329_-_haiku/trunk/src/add-ons/media/?= =?utf-8?q?plugins/ac3=5Fdecoder?= In-Reply-To: Message-ID: <29195730533-BeMail@laptop> > 2009/2/28 Fran?ois Revol : > >> I really really really want people to stop using VLC to play media > >> files under haiku and the only way to do it is to have the files > > > work > >> when they play them using MediaPlayer, the only application we > > > have > >> that actually uses the MediaKit. > > > > You could have a look at nplay too :D > > Is this the nplay on BeBits that returns 404 not found :-) Right, I should really upload it back, the original place got removed by someone else... :^) Fran?ois. From umccullough at gmail.com Sat Feb 28 00:36:39 2009 From: umccullough at gmail.com (Urias McCullough) Date: Fri, 27 Feb 2009 15:36:39 -0800 Subject: [Haiku-commits] r29341 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200902272309.n1RN9eho018781@sheep.berlios.de> References: <200902272309.n1RN9eho018781@sheep.berlios.de> Message-ID: <1e80d8750902271536u1100bcf8n23d6b7745fb2728a@mail.gmail.com> On Fri, Feb 27, 2009 at 3:09 PM, axeld at BerliOS wrote: > Author: axeld > Date: 2009-02-28 00:09:39 +0100 (Sat, 28 Feb 2009) > New Revision: 29341 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29341&view=rev > > Modified: > ? haiku/trunk/src/system/kernel/fs/vfs.cpp > Log: > * Consolidated '*' style. > > > Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp > =================================================================== > --- haiku/trunk/src/system/kernel/fs/vfs.cpp ? ?2009-02-27 22:44:05 UTC (rev 29340) > +++ haiku/trunk/src/system/kernel/fs/vfs.cpp ? ?2009-02-27 23:09:39 UTC (rev 29341) > @@ -1,6 +1,6 @@ ... > -static status_t attr_write_stat(struct file_descriptor *, const struct stat *, int statMask); > +static status_t attr_write_stat(struct file_descriptor* descriptor, > + ? ? ? const struct stat* descriptor, int statMask); This looks broken - someone in #haiku complained that there are two descriptor params. From dlmcpaul at gmail.com Sat Feb 28 09:45:18 2009 From: dlmcpaul at gmail.com (David McPaul) Date: Sat, 28 Feb 2009 19:45:18 +1100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: References: <5269034660-BeMail@laptop> Message-ID: 2009/2/28 David McPaul : > 2009/2/28 J?r?me Duval : >> 2009/2/27 Fran?ois Revol >>> >>> > I really really really want people to stop using VLC to play media >>> > files under haiku and the only way to do it is to have the files work >>> > when they play them using MediaPlayer, the only application we have >>> > that actually uses the MediaKit. >>> >> >> Out of curiosity did you try with playfile ? > > No I didn't but I obviously should have. Ok playfile handles 6 channels fine. At this point in time I am a little confused as to what the extra conversion code in MediaPlayer is needed for. -- Cheers David From superstippi at gmx.de Sat Feb 28 10:20:44 2009 From: superstippi at gmx.de (=?ISO-8859-1?Q?Stephan_A=DFmus?=) Date: Sat, 28 Feb 2009 10:20:44 +0100 Subject: [Haiku-commits] r29329 - haiku/trunk/src/add-ons/media/plugins/ac3_decoder In-Reply-To: References: <5269034660-BeMail@laptop> Message-ID: <49A901EC.10401@gmx.de> David McPaul schrieb: > 2009/2/28 David McPaul : >> 2009/2/28 J?r?me Duval : >>> 2009/2/27 Fran?ois Revol >>>>> I really really really want people to stop using VLC to play media >>>>> files under haiku and the only way to do it is to have the files work >>>>> when they play them using MediaPlayer, the only application we have >>>>> that actually uses the MediaKit. >>> Out of curiosity did you try with playfile ? >> No I didn't but I obviously should have. > > Ok playfile handles 6 channels fine. > > At this point in time I am a little confused as to what the extra > conversion code in MediaPlayer is needed for. It's just a limitation of the AudioProducer code in MediaPlayer. I could have a look at it today. Best regards, -Stephan From bonefish at mail.berlios.de Sat Feb 28 11:08:31 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 11:08:31 +0100 Subject: [Haiku-commits] r29342 - haiku/trunk/src/system/kernel/fs Message-ID: <200902281008.n1SA8VCM002813@sheep.berlios.de> Author: bonefish Date: 2009-02-28 11:08:30 +0100 (Sat, 28 Feb 2009) New Revision: 29342 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29342&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Fixed duplicate parameter name. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-27 23:09:39 UTC (rev 29341) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2009-02-28 10:08:30 UTC (rev 29342) @@ -480,7 +480,7 @@ static status_t attr_read_stat(struct file_descriptor* descriptor, struct stat* statData); static status_t attr_write_stat(struct file_descriptor* descriptor, - const struct stat* descriptor, int statMask); + const struct stat* stat, int statMask); static status_t index_dir_read(struct io_context* context, struct file_descriptor* descriptor, struct dirent* buffer, size_t bufferSize, uint32* _count); From bonefish at mail.berlios.de Sat Feb 28 11:09:36 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 11:09:36 +0100 Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200902281009.n1SA9a5k002910@sheep.berlios.de> Author: bonefish Date: 2009-02-28 11:09:36 +0100 (Sat, 28 Feb 2009) New Revision: 29343 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29343&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.cpp Log: Forgot to add the dummy slab implementation. Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.cpp 2009-02-28 10:08:30 UTC (rev 29342) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.cpp 2009-02-28 10:09:36 UTC (rev 29343) @@ -0,0 +1,97 @@ +/* + * Copyright 2001-2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "haiku_slab.h" + +#include + +#include + + +namespace UserlandFS { +namespace HaikuKernelEmu { + + +struct object_cache { + object_cache(const char *name, size_t objectSize, + size_t alignment, size_t maxByteUsage, uint32 flags, void *cookie, + object_cache_constructor constructor, + object_cache_destructor destructor, object_cache_reclaimer reclaimer) + : + objectSize(objectSize), + objectConstructor(constructor), + objectDestructor(destructor) + { + } + + size_t objectSize; + object_cache_constructor objectConstructor; + object_cache_destructor objectDestructor; +}; + + +object_cache * +create_object_cache(const char *name, size_t objectSize, + size_t alignment, void *cookie, object_cache_constructor constructor, + object_cache_destructor destructor) +{ + return new(std::nothrow) object_cache(name, objectSize, alignment, + 0, 0, cookie, constructor, destructor, NULL); +} + + +object_cache * +create_object_cache_etc(const char *name, size_t objectSize, + size_t alignment, size_t maxByteUsage, uint32 flags, void *cookie, + object_cache_constructor constructor, object_cache_destructor destructor, + object_cache_reclaimer reclaimer) +{ + return new(std::nothrow) object_cache(name, objectSize, alignment, + maxByteUsage, flags, cookie, constructor, destructor, reclaimer); +} + + +void +delete_object_cache(object_cache *cache) +{ + delete cache; +} + + +status_t +object_cache_set_minimum_reserve(object_cache *cache, size_t objectCount) +{ + return B_OK; +} + + +void * +object_cache_alloc(object_cache *cache, uint32 flags) +{ + return cache != NULL ? malloc(cache->objectSize) : NULL; +} + + +void +object_cache_free(object_cache *cache, void *object) +{ + free(object); +} + + +status_t +object_cache_reserve(object_cache *cache, size_t object_count, uint32 flags) +{ + return B_OK; +} + + +void object_cache_get_usage(object_cache *cache, size_t *_allocatedMemory) +{ + *_allocatedMemory = 0; +} + +} // namespace HaikuKernelEmu +} // namespace UserlandFS From axeld at pinc-software.de Sat Feb 28 11:25:35 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 28 Feb 2009 11:25:35 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r29343_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/file=5Fsystems/userlandfs/server?= In-Reply-To: <200902281009.n1SA9a5k002910@sheep.berlios.de> Message-ID: <980629691-BeMail@zon> bonefish at BerliOS wrote: > Log: > Forgot to add the dummy slab implementation. Don't we have something like that in the libkernelemu.so already? Or did I only added it to the tcp_shell? Bye, Axel. From axeld at pinc-software.de Sat Feb 28 11:26:28 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 28 Feb 2009 11:26:28 +0100 CET Subject: [Haiku-commits] r29341 - haiku/trunk/src/system/kernel/fs In-Reply-To: <1e80d8750902271536u1100bcf8n23d6b7745fb2728a@mail.gmail.com> Message-ID: <1033825388-BeMail@zon> Urias McCullough wrote: > > +static status_t attr_write_stat(struct file_descriptor* > > descriptor, > > + ? ? ? const struct stat* descriptor, int statMask); > This looks broken - someone in #haiku complained that there are two > descriptor params. Oh, sorry. And thanks Ingo for fixing it! Bye, Axel. From ingo_weinhold at gmx.de Sat Feb 28 11:49:14 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 28 Feb 2009 11:49:14 +0100 Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server In-Reply-To: <980629691-BeMail@zon> References: <980629691-BeMail@zon> Message-ID: <20090228114914.363.1@knochen-vm.localdomain> On 2009-02-28 at 11:25:35 [+0100], Axel D?rfler wrote: > bonefish at BerliOS wrote: > > Log: > > Forgot to add the dummy slab implementation. > > Don't we have something like that in the libkernelemu.so already? Now that you mention it, yeah, it does already contain the slab functions. So theoretically I could merge most of the UserlandFS kernel emulation stuff into it as well, provided that it doesn't need to work on BeOS. I also wonder whether in some cases we could simply compile the kernel sources directly for userland. E.g. for the block cache I basically only kicked out the low resource handling stuff, which could as well be #ifdef'ed in the kernel source or stubs provided for it in the emulation. CU, Ingo From bonefish at mail.berlios.de Sat Feb 28 12:39:49 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 12:39:49 +0100 Subject: [Haiku-commits] r29344 - in haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server: . beos haiku Message-ID: <200902281139.n1SBdnl3015354@sheep.berlios.de> Author: bonefish Date: 2009-02-28 12:39:46 +0100 (Sat, 28 Feb 2009) New Revision: 29344 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29344&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/ 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.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/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.c haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache_priv.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_interface.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/beos/beos_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_lock.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/ 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.h 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 haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_file_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.h 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_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.h Removed: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelNode.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache.c haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache_priv.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_interface.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_kernel_emu.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_lock.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_file_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_kernel_emu.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.h Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile Log: * Reorganized the sources. Haiku and BeOS kernel interface each have their own subdirectory, now. * Moved all code specific to a kernel interface into the respective library. Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelNode.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.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-02-28 10:09:36 UTC (rev 29343) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-02-28 11:39:46 UTC (rev 29344) @@ -8,9 +8,6 @@ SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; -UsePrivateSystemHeaders ; -UsePrivateHeaders libroot ; - SEARCH_SOURCE += [ FDirName $(userlandFSTop) private ] ; SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ; @@ -19,57 +16,38 @@ DEFINES += BUILDING_USERLAND_FS_SERVER=1 ; Application UserlandFSServer - : AreaSupport.cpp - Debug.cpp - DispatcherDefs.cpp - driver_settings.c - LazyInitializable.cpp - Locker.cpp - ObjectTracker.cpp - Port.cpp - Referencable.cpp - Request.cpp - RequestAllocator.cpp - RequestHandler.cpp - RequestPort.cpp - Requests.cpp - SingleReplyRequestHandler.cpp - String.cpp + : + AreaSupport.cpp + Debug.cpp + DispatcherDefs.cpp + driver_settings.c + LazyInitializable.cpp + Locker.cpp + ObjectTracker.cpp + Port.cpp + Referencable.cpp + Request.cpp + RequestAllocator.cpp + RequestHandler.cpp + RequestPort.cpp + Requests.cpp + SingleReplyRequestHandler.cpp + String.cpp -# beos_fs_cache.c + DispatcherFileSystem.cpp + FileSystem.cpp + kernel_emu.cpp + main.cpp + RequestThread.cpp + ServerDefs.cpp + UserlandFSDispatcher.cpp + UserlandFSServer.cpp + UserlandRequestHandler.cpp + Volume.cpp -# beos_lock.cpp -# BeOSKernelFileSystem.cpp -# BeOSKernelVolume.cpp - DispatcherFileSystem.cpp - FileSystem.cpp - haiku_block_cache.cpp - haiku_condition_variable.cpp -# haiku_file_cache.cpp - haiku_hash.cpp - haiku_lock.cpp - haiku_slab.cpp - HaikuKernelFileSystem.cpp - HaikuKernelVolume.cpp - kernel_emu.cpp - main.cpp - RequestThread.cpp - ServerDefs.cpp - UserlandFSDispatcher.cpp - UserlandFSServer.cpp - UserlandRequestHandler.cpp - Volume.cpp - : be + : + be ; -# the library providing the BeOS kernel interface for add-ons -SharedLibrary libuserlandfs_beos_kernel.so - : beos_kernel_emu.cpp - : UserlandFSServer -; - -# the library providing the Haiku kernel interface for add-ons -SharedLibrary libuserlandfs_haiku_kernel.so - : haiku_kernel_emu.cpp - : UserlandFSServer -; +HaikuSubInclude beos ; +HaikuSubInclude haiku ; Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelFileSystem.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/BeOSKernelVolume.h) Added: 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-02-28 10:09:36 UTC (rev 29343) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile 2009-02-28 11:39:46 UTC (rev 29344) @@ -0,0 +1,30 @@ +SubDir HAIKU_TOP src add-ons kernel file_systems userlandfs server beos ; + +local userlandFSTop = [ FDirName $(HAIKU_TOP) src add-ons kernel + file_systems userlandfs ] ; +local userlandFSIncludes = [ PrivateHeaders userlandfs ] ; + +SubDirSysHdrs [ FDirName $(userlandFSIncludes) ] ; +SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; +SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; + +SEARCH_SOURCE += [ FDirName $(userlandFSTop) private ] ; +SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ; + +DEFINES += USER=1 ; +DEFINES += DEBUG_APP="\\\"libuserlandfs_beos\\\"" ; +DEFINES += BUILDING_USERLAND_FS_SERVER=1 ; + +# the library providing the BeOS kernel interface for add-ons +SharedLibrary libuserlandfs_beos_kernel.so + : + beos_kernel_emu.cpp + + beos_fs_cache.c + beos_lock.cpp + BeOSKernelFileSystem.cpp + BeOSKernelVolume.cpp + + : + UserlandFSServer +; Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.c (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache.c) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache_priv.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache_priv.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_interface.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_interface.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_kernel_emu.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_kernel_emu.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_lock.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_lock.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_lock.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_lock.h) Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache.c Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_cache_priv.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_fs_interface.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_kernel_emu.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_lock.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos_lock.h Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelFileSystem.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelNode.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelNode.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/HaikuKernelVolume.h) Added: 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-02-28 10:09:36 UTC (rev 29343) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-02-28 11:39:46 UTC (rev 29344) @@ -0,0 +1,37 @@ +SubDir HAIKU_TOP src add-ons kernel file_systems userlandfs server haiku ; + +local userlandFSTop = [ FDirName $(HAIKU_TOP) src add-ons kernel + file_systems userlandfs ] ; +local userlandFSIncludes = [ PrivateHeaders userlandfs ] ; + +SubDirSysHdrs [ FDirName $(userlandFSIncludes) ] ; +SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; +SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; + +UsePrivateSystemHeaders ; +UsePrivateHeaders libroot ; + +SEARCH_SOURCE += [ FDirName $(userlandFSTop) private ] ; +SEARCH_SOURCE += [ FDirName $(userlandFSTop) shared ] ; + +DEFINES += USER=1 ; +DEFINES += DEBUG_APP="\\\"libuserlandfs_haiku\\\"" ; +DEFINES += BUILDING_USERLAND_FS_SERVER=1 ; + +# the library providing the Haiku kernel interface for add-ons +SharedLibrary libuserlandfs_haiku_kernel.so + : + haiku_kernel_emu.cpp + + haiku_block_cache.cpp + haiku_condition_variable.cpp +# haiku_file_cache.cpp + haiku_hash.cpp + haiku_lock.cpp + haiku_slab.cpp + HaikuKernelFileSystem.cpp + HaikuKernelVolume.cpp + + : + UserlandFSServer +; Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_file_cache.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_file_cache.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_fs_cache.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_kernel_emu.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.cpp (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.h) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.cpp (from rev 29343, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.cpp) Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.h (from rev 29341, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.h) Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_block_cache.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_condition_variable.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_file_cache.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_fs_cache.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_hash.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_kernel_emu.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_lock.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku_slab.h From bonefish at mail.berlios.de Sat Feb 28 12:47:02 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 12:47:02 +0100 Subject: [Haiku-commits] r29345 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server Message-ID: <200902281147.n1SBl2id022415@sheep.berlios.de> Author: bonefish Date: 2009-02-28 12:46:57 +0100 (Sat, 28 Feb 2009) New Revision: 29345 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29345&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp Log: Commented out the interaction with the specific kernel interfaces. This has to be implemented differently. 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-02-28 11:39:46 UTC (rev 29344) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-02-28 11:46:57 UTC (rev 29345) @@ -15,21 +15,25 @@ #include "AutoDeleter.h" #include "AutoLocker.h" -#include "beos_fs_cache.h" -#include "beos_fs_interface.h" -#include "BeOSKernelFileSystem.h" #include "Compatibility.h" #include "Debug.h" #include "DispatcherDefs.h" #include "FileSystem.h" #include "FSInfo.h" +#include "RequestThread.h" +#include "ServerDefs.h" + +#if 0 +#include "beos_fs_cache.h" +#include "beos_fs_interface.h" +#include "BeOSKernelFileSystem.h" #include "haiku_block_cache.h" #include "haiku_condition_variable.h" #include "haiku_fs_cache.h" #include "HaikuKernelFileSystem.h" -#include "RequestThread.h" -#include "ServerDefs.h" +#endif + static const int32 kRequestThreadCount = 10; static const int32 kMaxBlockCacheBlocks = 16384; @@ -57,8 +61,11 @@ } delete fNotificationRequestPort; delete fFileSystem; +// TODO:... +#if 0 if (fBlockCacheInitialized) beos_shutdown_block_cache(); +#endif if (fAddOnImage >= 0) unload_add_on(fAddOnImage); } @@ -210,6 +217,8 @@ UserlandFSServer::_CreateBeOSKernelInterface(const char* fsName, image_id image, FileSystem** _fileSystem) { +// TODO: Implement! +#if 0 // get the symbols "fs_entry" and "api_version" beos_vnode_ops* fsOps; status_t error = get_image_symbol(image, "fs_entry", B_SYMBOL_TYPE_DATA, @@ -242,6 +251,8 @@ fsDeleter.Detach(); *_fileSystem = fileSystem; return B_OK; +#endif + return B_ERROR; } // _CreateHaikuKernelInterface @@ -249,6 +260,8 @@ UserlandFSServer::_CreateHaikuKernelInterface(const char* fsName, image_id image, FileSystem** _fileSystem) { +// TODO: Implement! +#if 0 // get the modules module_info** modules; status_t error = get_image_symbol(image, "modules", B_SYMBOL_TYPE_DATA, @@ -302,4 +315,6 @@ fsDeleter.Detach(); *_fileSystem = fileSystem; return B_OK; +#endif + return B_ERROR; } From bonefish at mail.berlios.de Sat Feb 28 13:16:21 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 13:16:21 +0100 Subject: [Haiku-commits] r29346 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281216.n1SCGLWt018068@sheep.berlios.de> Author: bonefish Date: 2009-02-28 13:16:18 +0100 (Sat, 28 Feb 2009) New Revision: 29346 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29346&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile Log: Missing include directory. 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-02-28 11:46:57 UTC (rev 29345) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-02-28 12:16:18 UTC (rev 29346) @@ -7,6 +7,7 @@ SubDirSysHdrs [ FDirName $(userlandFSIncludes) ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; +SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ; UsePrivateSystemHeaders ; UsePrivateHeaders libroot ; From bonefish at mail.berlios.de Sat Feb 28 13:20:46 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 13:20:46 +0100 Subject: [Haiku-commits] r29347 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281220.n1SCKkbm023964@sheep.berlios.de> Author: bonefish Date: 2009-02-28 13:20:41 +0100 (Sat, 28 Feb 2009) New Revision: 29347 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29347&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.h 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_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.h Log: Moved the implementation of the public interfaces out of their namespaces. This makes things a bit simpler and makes quite a bit of haiku_kernel_emu.cpp superfluous. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp 2009-02-28 12:20:41 UTC (rev 29347) @@ -13,6 +13,7 @@ #include #include +#include #include @@ -21,7 +22,6 @@ #include "haiku_hash.h" #include "haiku_lock.h" #include "haiku_slab.h" -#include "kernel_emu.h" // TODO: this is a naive but growing implementation to test the API: @@ -46,15 +46,6 @@ #define FATAL(x) panic x -using UserlandFS::KernelEmu::dprintf; -using UserlandFS::KernelEmu::dump_block; -using UserlandFS::KernelEmu::panic; -using UserlandFS::KernelEmu::spawn_kernel_thread; - -namespace UserlandFS { -namespace HaikuKernelEmu { - - static const bigtime_t kTransactionIdleTime = 2000000LL; // a transaction is considered idle after 2 seconds of inactivity @@ -813,7 +804,7 @@ cache_transaction dummyTransaction; transaction_hash = hash_init(16, offset_of_member(dummyTransaction, next), - &transaction_compare, &UserlandFS::HaikuKernelEmu::transaction_hash); + &transaction_compare, &::transaction_hash); if (transaction_hash == NULL) return B_NO_MEMORY; @@ -2343,7 +2334,7 @@ block_cache* cache = (block_cache*)_cache; if (allowWrites) - UserlandFS::HaikuKernelEmu::block_cache_sync(cache); + block_cache_sync(cache); mutex_lock(&sCachesLock); sCaches.Remove(cache); @@ -2627,6 +2618,3 @@ put_cached_block(cache, blockNumber); } - -} // namespace HaikuKernelEmu -} // namespace UserlandFS Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.h 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.h 2009-02-28 12:20:41 UTC (rev 29347) @@ -9,14 +9,12 @@ #include -namespace UserlandFS { -namespace HaikuKernelEmu { +extern "C" { status_t block_cache_init(void); size_t block_cache_used_memory(); -} // namespace HaikuKernelEmu -} // namespace UserlandFS +} #endif // USERLAND_FS_HAIKU_BLOCK_CACHE_H Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.cpp 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.cpp 2009-02-28 12:20:41 UTC (rev 29347) @@ -10,6 +10,7 @@ #include #include +#include // libroot #include @@ -18,20 +19,13 @@ #include #include -#include "kernel_emu.h" #include "haiku_lock.h" -namespace UserlandFS { -namespace HaikuKernelEmu { - #define STATUS_ADDED 1 #define STATUS_WAITING 2 -using UserlandFS::KernelEmu::dprintf; -using UserlandFS::KernelEmu::panic; - static const int kConditionVariableHashSize = 512; @@ -258,6 +252,3 @@ return error; } - -} // namespace HaikuKernelEmu -} // namespace UserlandFS Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.h 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.h 2009-02-28 12:20:41 UTC (rev 29347) @@ -11,10 +11,6 @@ #include -namespace UserlandFS { -namespace HaikuKernelEmu { - - class ConditionVariable; @@ -95,7 +91,4 @@ status_t condition_variable_init(); -} // namespace HaikuKernelEmu -} // namespace UserlandFS - #endif // USERLAND_FS_HAIKU_CONDITION_VARIABLE_H Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h 2009-02-28 12:20:41 UTC (rev 29347) @@ -17,70 +17,6 @@ namespace HaikuKernelEmu { -/* transactions */ -extern int32 cache_start_transaction(void *cache); -extern status_t cache_sync_transaction(void *cache, int32 id); -extern status_t cache_end_transaction(void *cache, int32 id, - transaction_notification_hook hook, void *data); -extern status_t cache_abort_transaction(void *cache, int32 id); -extern int32 cache_detach_sub_transaction(void *cache, int32 id, - transaction_notification_hook hook, void *data); -extern status_t cache_abort_sub_transaction(void *cache, int32 id); -extern status_t cache_start_sub_transaction(void *cache, int32 id); -extern status_t cache_add_transaction_listener(void *cache, int32 id, - int32 events, transaction_notification_hook hook, - void *data); -extern status_t cache_remove_transaction_listener(void *cache, int32 id, - transaction_notification_hook hook, void *data); -extern status_t cache_next_block_in_transaction(void *cache, int32 id, - bool mainOnly, long *_cookie, off_t *_blockNumber, - void **_data, void **_unchangedData); -extern int32 cache_blocks_in_transaction(void *cache, int32 id); -extern int32 cache_blocks_in_main_transaction(void *cache, int32 id); -extern int32 cache_blocks_in_sub_transaction(void *cache, int32 id); - -/* block cache */ -extern void block_cache_delete(void *cache, bool allowWrites); -extern void *block_cache_create(int fd, off_t numBlocks, size_t blockSize, - bool readOnly); -extern status_t block_cache_sync(void *cache); -extern status_t block_cache_sync_etc(void *cache, off_t blockNumber, - size_t numBlocks); -extern void block_cache_discard(void *cache, off_t blockNumber, - size_t numBlocks); -extern status_t block_cache_make_writable(void *cache, off_t blockNumber, - int32 transaction); -extern void *block_cache_get_writable_etc(void *cache, off_t blockNumber, - off_t base, off_t length, int32 transaction); -extern void *block_cache_get_writable(void *cache, off_t blockNumber, - int32 transaction); -extern void *block_cache_get_empty(void *cache, off_t blockNumber, - int32 transaction); -extern const void *block_cache_get_etc(void *cache, off_t blockNumber, - off_t base, off_t length); -extern const void *block_cache_get(void *cache, off_t blockNumber); -extern status_t block_cache_set_dirty(void *cache, off_t blockNumber, - bool isDirty, int32 transaction); -extern void block_cache_put(void *cache, off_t blockNumber); - -/* file cache */ -extern void *file_cache_create(dev_t mountID, ino_t vnodeID, off_t size, - int fd); -extern void file_cache_delete(void *_cacheRef); -extern status_t file_cache_set_size(void *_cacheRef, off_t size); -extern status_t file_cache_sync(void *_cache); -extern status_t file_cache_invalidate_file_map(void *_cacheRef, off_t offset, - off_t size); - -extern status_t file_cache_read_pages(void *_cacheRef, off_t offset, - const iovec *vecs, size_t count, size_t *_numBytes); -extern status_t file_cache_write_pages(void *_cacheRef, off_t offset, - const iovec *vecs, size_t count, size_t *_numBytes); -extern status_t file_cache_read(void *_cacheRef, off_t offset, void *bufferBase, - size_t *_size); -extern status_t file_cache_write(void *_cacheRef, off_t offset, - const void *buffer, size_t *_size); - // interface for the emulation layer status_t file_cache_init(); status_t file_cache_register_volume(HaikuKernelVolume* volume); Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.cpp 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.cpp 2009-02-28 12:20:41 UTC (rev 29347) @@ -11,8 +11,8 @@ #include #include +#include -#include "kernel_emu.h" #undef TRACE #define TRACE_HASH 0 @@ -22,13 +22,7 @@ # define TRACE(x) ; #endif -using UserlandFS::KernelEmu::dprintf; -using UserlandFS::KernelEmu::panic; -namespace UserlandFS { -namespace HaikuKernelEmu { - - // TODO: the hashtable is not expanded when necessary (no load factor, nothing) // resizing should be optional, though, in case the hash is used at times // that forbid resizing. @@ -438,6 +432,3 @@ } } } - -} // namespace HaikuKernelEmu -} // namespace UserlandFS Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.h 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.h 2009-02-28 12:20:41 UTC (rev 29347) @@ -10,8 +10,6 @@ #include -namespace UserlandFS { -namespace HaikuKernelEmu { // The use of offsetof() on non-PODs is invalid. Since many structs use // templated members (i.e. DoublyLinkedList) which makes them non-PODs we @@ -28,6 +26,8 @@ typedef struct hash_table hash_table; +extern "C" { + struct hash_table *hash_init(uint32 table_size, int next_ptr_offset, int compare_func(void *element, const void *key), uint32 hash_func(void *element, const void *key, uint32 range)); @@ -60,7 +60,6 @@ uint32 hash_hash_string(const char *str); -} // namespace HaikuKernelEmu -} // namespace UserlandFS +} // extern "C" #endif /* USERLAND_FS_HAIKU_HASH_H */ 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-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp 2009-02-28 12:20:41 UTC (rev 29347) @@ -10,7 +10,6 @@ #include #include "Debug.h" -#include "haiku_fs_cache.h" #include "HaikuKernelNode.h" #include "HaikuKernelVolume.h" #include "kernel_emu.h" @@ -227,260 +226,6 @@ } -// #pragma mark - Transaction - - -// cache_start_transaction -int32 -cache_start_transaction(void *_cache) -{ - return UserlandFS::HaikuKernelEmu::cache_start_transaction(_cache); -} - -// cache_sync_transaction -status_t -cache_sync_transaction(void *_cache, int32 id) -{ - return UserlandFS::HaikuKernelEmu::cache_sync_transaction(_cache, id); -} - -// cache_end_transaction -status_t -cache_end_transaction(void *_cache, int32 id, - transaction_notification_hook hook, void *data) -{ - return UserlandFS::HaikuKernelEmu::cache_end_transaction(_cache, id, hook, - data); -} - -// cache_abort_transaction -status_t -cache_abort_transaction(void *_cache, int32 id) -{ - return UserlandFS::HaikuKernelEmu::cache_abort_transaction(_cache, id); -} - -// cache_detach_sub_transaction -int32 -cache_detach_sub_transaction(void *_cache, int32 id, - transaction_notification_hook hook, void *data) -{ - return UserlandFS::HaikuKernelEmu::cache_detach_sub_transaction(_cache, id, - hook, data); -} - -// cache_abort_sub_transaction -status_t -cache_abort_sub_transaction(void *_cache, int32 id) -{ - return UserlandFS::HaikuKernelEmu::cache_abort_sub_transaction(_cache, id); -} - -// cache_start_sub_transaction -status_t -cache_start_sub_transaction(void *_cache, int32 id) -{ - return UserlandFS::HaikuKernelEmu::cache_start_sub_transaction(_cache, id); -} - -// cache_next_block_in_transaction -status_t -cache_next_block_in_transaction(void *_cache, int32 id, uint32 *_cookie, - off_t *_blockNumber, void **_data, void **_unchangedData) -{ - return UserlandFS::HaikuKernelEmu::cache_next_block_in_transaction(_cache, - id, _cookie, _blockNumber, _data, _unchangedData); -} - -// cache_blocks_in_transaction -int32 -cache_blocks_in_transaction(void *_cache, int32 id) -{ - return UserlandFS::HaikuKernelEmu::cache_blocks_in_transaction(_cache, id); -} - -// cache_blocks_in_sub_transaction -int32 -cache_blocks_in_sub_transaction(void *_cache, int32 id) -{ - return UserlandFS::HaikuKernelEmu::cache_blocks_in_sub_transaction(_cache, - id); -} - - -// #pragma mark - Block Cache - - -// block_cache_delete -void -block_cache_delete(void *_cache, bool allowWrites) -{ - UserlandFS::HaikuKernelEmu::block_cache_delete(_cache, allowWrites); -} - -// block_cache_create -void * -block_cache_create(int fd, off_t numBlocks, size_t blockSize, bool readOnly) -{ - return UserlandFS::HaikuKernelEmu::block_cache_create(fd, numBlocks, - blockSize, readOnly); -} - -// block_cache_sync -status_t -block_cache_sync(void *_cache) -{ - return UserlandFS::HaikuKernelEmu::block_cache_sync(_cache); -} - -// block_cache_sync_etc -status_t -block_cache_sync_etc(void *_cache, off_t blockNumber, size_t numBlocks) -{ - return UserlandFS::HaikuKernelEmu::block_cache_sync_etc(_cache, - blockNumber, numBlocks); -} - -// block_cache_make_writable -status_t -block_cache_make_writable(void *_cache, off_t blockNumber, int32 transaction) -{ - return UserlandFS::HaikuKernelEmu::block_cache_make_writable(_cache, - blockNumber, transaction); -} - -// block_cache_get_writable_etc -void * -block_cache_get_writable_etc(void *_cache, off_t blockNumber, off_t base, - off_t length, int32 transaction) -{ - return UserlandFS::HaikuKernelEmu::block_cache_get_writable_etc(_cache, - blockNumber, base, length, transaction); -} - -// block_cache_get_writable -void * -block_cache_get_writable(void *_cache, off_t blockNumber, int32 transaction) -{ - return UserlandFS::HaikuKernelEmu::block_cache_get_writable(_cache, - blockNumber, transaction); -} - -// block_cache_get_empty -void * -block_cache_get_empty(void *_cache, off_t blockNumber, int32 transaction) -{ - return UserlandFS::HaikuKernelEmu::block_cache_get_empty(_cache, - blockNumber, transaction); -} - -// block_cache_get_etc -const void * -block_cache_get_etc(void *_cache, off_t blockNumber, off_t base, off_t length) -{ - return UserlandFS::HaikuKernelEmu::block_cache_get_etc(_cache, blockNumber, - base, length); -} - -// block_cache_get -const void * -block_cache_get(void *_cache, off_t blockNumber) -{ - return UserlandFS::HaikuKernelEmu::block_cache_get(_cache, blockNumber); -} - -// block_cache_set_dirty -status_t -block_cache_set_dirty(void *_cache, off_t blockNumber, bool isDirty, - int32 transaction) -{ - return UserlandFS::HaikuKernelEmu::block_cache_set_dirty(_cache, - blockNumber, isDirty, transaction); -} - -// block_cache_put -void -block_cache_put(void *_cache, off_t blockNumber) -{ - UserlandFS::HaikuKernelEmu::block_cache_put(_cache, blockNumber); -} - - -// #pragma mark - File Cache - -// file_cache_create -void * -file_cache_create(dev_t mountID, ino_t vnodeID, off_t size, int fd) -{ - return UserlandFS::HaikuKernelEmu::file_cache_create(mountID, vnodeID, - size, fd); -} - -// file_cache_delete -void -file_cache_delete(void *_cacheRef) -{ - UserlandFS::HaikuKernelEmu::file_cache_delete(_cacheRef); -} - -// file_cache_set_size -status_t -file_cache_set_size(void *_cacheRef, off_t size) -{ - return UserlandFS::HaikuKernelEmu::file_cache_set_size(_cacheRef, size); -} - -// file_cache_sync -status_t -file_cache_sync(void *_cache) -{ - return UserlandFS::HaikuKernelEmu::file_cache_sync(_cache); -} - -// file_cache_invalidate_file_map -status_t -file_cache_invalidate_file_map(void *_cacheRef, off_t offset, off_t size) -{ - return UserlandFS::HaikuKernelEmu::file_cache_invalidate_file_map( - _cacheRef, offset, size); -} - -// file_cache_read_pages -status_t -file_cache_read_pages(void *_cacheRef, off_t offset, const iovec *vecs, - size_t count, size_t *_numBytes) -{ - return UserlandFS::HaikuKernelEmu::file_cache_read_pages(_cacheRef, - offset, vecs, count, _numBytes); -} - -// file_cache_write_pages -status_t -file_cache_write_pages(void *_cacheRef, off_t offset, const iovec *vecs, - size_t count, size_t *_numBytes) -{ - return UserlandFS::HaikuKernelEmu::file_cache_write_pages(_cacheRef, - offset, vecs, count, _numBytes); -} - -// file_cache_read -status_t -file_cache_read(void *_cacheRef, off_t offset, void *bufferBase, size_t *_size) -{ - return UserlandFS::HaikuKernelEmu::file_cache_read(_cacheRef, offset, - bufferBase, _size); -} - -// file_cache_write -status_t -file_cache_write(void *_cacheRef, off_t offset, const void *buffer, - size_t *_size) -{ - return UserlandFS::HaikuKernelEmu::file_cache_write(_cacheRef, offset, - buffer, _size); -} - - // #pragma mark - Misc Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.cpp 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.cpp 2009-02-28 12:20:41 UTC (rev 29347) @@ -10,16 +10,9 @@ #include "haiku_lock.h" -#include +#include -#include "kernel_emu.h" -using UserlandFS::KernelEmu::panic; - -namespace UserlandFS { -namespace HaikuKernelEmu { - - sem_id _init_semaphore(int32 count, const char* name) { @@ -269,6 +262,3 @@ { return release_sem_etc(lock->sem, RW_MAX_READERS, 0); } - -} // namespace HaikuKernelEmu -} // namespace UserlandFS Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.h 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.h 2009-02-28 12:20:41 UTC (rev 29347) @@ -11,9 +11,6 @@ #include -namespace UserlandFS { -namespace HaikuKernelEmu { - typedef struct recursive_lock { sem_id sem; thread_id holder; @@ -51,6 +48,9 @@ { _init_semaphore(RW_MAX_READERS, name) } +extern "C" { + + sem_id _init_semaphore(int32 count, const char* name); // implementation private @@ -93,6 +93,9 @@ extern status_t rw_lock_write_unlock(rw_lock* lock); +} // extern "C" + + /* C++ Auto Locking */ #include "AutoLocker.h" @@ -132,10 +135,5 @@ // RecursiveLocker typedef AutoLocker RecursiveLocker; -} // namespace HaikuKernelEmu -} // namespace UserlandFS -using UserlandFS::HaikuKernelEmu::MutexLocker; -using UserlandFS::HaikuKernelEmu::RecursiveLocker; - #endif /* USERLAND_FS_HAIKU_LOCK_H */ Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.cpp 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.cpp 2009-02-28 12:20:41 UTC (rev 29347) @@ -10,10 +10,6 @@ #include -namespace UserlandFS { -namespace HaikuKernelEmu { - - struct object_cache { object_cache(const char *name, size_t objectSize, size_t alignment, size_t maxByteUsage, uint32 flags, void *cookie, @@ -92,6 +88,3 @@ { *_allocatedMemory = 0; } - -} // namespace HaikuKernelEmu -} // namespace UserlandFS Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.h 2009-02-28 12:16:18 UTC (rev 29346) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.h 2009-02-28 12:20:41 UTC (rev 29347) @@ -11,10 +11,6 @@ #include -namespace UserlandFS { -namespace HaikuKernelEmu { - - enum { /* create_object_cache_etc flags */ CACHE_NO_DEPOT = 1 << 0, @@ -35,6 +31,8 @@ typedef void (*object_cache_reclaimer)(void *cookie, int32 level); +extern "C" { + object_cache *create_object_cache(const char *name, size_t object_size, size_t alignment, void *cookie, object_cache_constructor constructor, object_cache_destructor); @@ -56,7 +54,6 @@ void object_cache_get_usage(object_cache *cache, size_t *_allocatedMemory); -} // namespace HaikuKernelEmu -} // namespace UserlandFS +} // extern "C" #endif // USERLAND_FS_HAIKU_SLAB_SLAB_H From bonefish at mail.berlios.de Sat Feb 28 14:47:10 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 14:47:10 +0100 Subject: [Haiku-commits] r29348 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281347.n1SDlAQj002090@sheep.berlios.de> Author: bonefish Date: 2009-02-28 14:47:10 +0100 (Sat, 28 Feb 2009) New Revision: 29348 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29348&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_map.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/vfs.h Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp Log: Added the kernel file map implementation. 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-02-28 12:20:41 UTC (rev 29347) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-02-28 13:47:10 UTC (rev 29348) @@ -33,6 +33,8 @@ HaikuKernelFileSystem.cpp HaikuKernelVolume.cpp + file_map.cpp + : UserlandFSServer ; Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_map.cpp (from rev 29341, haiku/trunk/src/system/kernel/cache/file_map.cpp) =================================================================== --- haiku/trunk/src/system/kernel/cache/file_map.cpp 2009-02-27 23:09:39 UTC (rev 29341) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_map.cpp 2009-02-28 13:47:10 UTC (rev 29348) @@ -0,0 +1,647 @@ +/* + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +#include +#include +#include + +#include + +#include +#include + +#include + +#include "haiku_lock.h" +#include "vfs.h" + + +//#define TRACE_FILE_MAP +#ifdef TRACE_FILE_MAP +# define TRACE(x...) dprintf_no_syslog(x) +#else +# define TRACE(x...) ; +#endif + +// TODO: use a sparse array - eventually, the unused BlockMap would be something +// to reuse for this. We could also have an upperbound of memory consumption +// for the whole map. +// TODO: it would be nice if we could free a file map in low memory situations. + + +#define CACHED_FILE_EXTENTS 2 + // must be smaller than MAX_FILE_IO_VECS + // TODO: find out how much of these are typically used + +struct file_extent { + off_t offset; + file_io_vec disk; +}; + +struct file_extent_array { + file_extent* array; + size_t max_count; +}; + +class FileMap +#if DEBUG_FILE_MAP + : public DoublyLinkedListLinkImpl +#endif +{ +public: + FileMap(struct vnode* vnode, off_t size); + ~FileMap(); + + void Invalidate(off_t offset, off_t size); + void SetSize(off_t size); + + status_t Translate(off_t offset, size_t size, + file_io_vec* vecs, size_t* _count, + size_t align); + + file_extent* ExtentAt(uint32 index); + + size_t Count() const { return fCount; } + struct vnode* Vnode() const { return fVnode; } + off_t Size() const { return fSize; } + + status_t SetMode(uint32 mode); + +private: + file_extent* _FindExtent(off_t offset, uint32* _index); + status_t _MakeSpace(size_t count); + status_t _Add(file_io_vec* vecs, size_t vecCount, + off_t& lastOffset); + status_t _Cache(off_t offset, off_t size); + void _InvalidateAfter(off_t offset); + void _Free(); + + union { + file_extent fDirect[CACHED_FILE_EXTENTS]; + file_extent_array fIndirect; + }; + mutex fLock; + size_t fCount; + struct vnode* fVnode; + off_t fSize; + bool fCacheAll; +}; + +#if DEBUG_FILE_MAP +typedef DoublyLinkedList FileMapList; + +static FileMapList sList; +static mutex sLock; +#endif + + +FileMap::FileMap(struct vnode* vnode, off_t size) + : + fCount(0), + fVnode(vnode), + fSize(size), + fCacheAll(false) +{ + mutex_init(&fLock, "file map"); + +#if DEBUG_FILE_MAP + MutexLocker _(sLock); + sList.Add(this); +#endif +} + + +FileMap::~FileMap() +{ + _Free(); + mutex_destroy(&fLock); + +#if DEBUG_FILE_MAP + MutexLocker _(sLock); + sList.Remove(this); +#endif +} + + +file_extent* +FileMap::ExtentAt(uint32 index) +{ + if (index >= fCount) + return NULL; + + if (fCount > CACHED_FILE_EXTENTS) + return &fIndirect.array[index]; + + return &fDirect[index]; +} + + +file_extent* +FileMap::_FindExtent(off_t offset, uint32 *_index) +{ + int32 left = 0; + int32 right = fCount - 1; + + while (left <= right) { + int32 index = (left + right) / 2; + file_extent* extent = ExtentAt(index); + + if (extent->offset > offset) { + // search in left part + right = index - 1; + } else if (extent->offset + extent->disk.length <= offset) { + // search in right part + left = index + 1; + } else { + // found extent + if (_index) + *_index = index; + + return extent; + } + } + + return NULL; +} + + +status_t +FileMap::_MakeSpace(size_t count) +{ + if (count <= CACHED_FILE_EXTENTS) { + // just use the reserved area in the file_cache_ref structure + if (fCount > CACHED_FILE_EXTENTS) { + // the new size is smaller than the minimal array size + file_extent *array = fIndirect.array; + memcpy(fDirect, array, sizeof(file_extent) * count); + free(array); + } + } else { + // resize array if needed + file_extent* oldArray = NULL; + size_t maxCount = CACHED_FILE_EXTENTS; + if (fCount > CACHED_FILE_EXTENTS) { + oldArray = fIndirect.array; + maxCount = fIndirect.max_count; + } + + if (count > maxCount) { + // allocate new array + while (maxCount < count) { + if (maxCount < 32768) + maxCount <<= 1; + else + maxCount += 32768; + } + + file_extent* newArray = (file_extent *)realloc(oldArray, + maxCount * sizeof(file_extent)); + if (newArray == NULL) + return B_NO_MEMORY; + + if (fCount > 0 && fCount <= CACHED_FILE_EXTENTS) + memcpy(newArray, fDirect, sizeof(file_extent) * fCount); + + fIndirect.array = newArray; + fIndirect.max_count = maxCount; + } + } + + fCount = count; + return B_OK; +} + + +status_t +FileMap::_Add(file_io_vec* vecs, size_t vecCount, off_t& lastOffset) +{ + TRACE("FileMap@%p::Add(vecCount = %ld)\n", this, vecCount); + + uint32 start = fCount; + off_t offset = 0; + + status_t status = _MakeSpace(fCount + vecCount); + if (status != B_OK) + return status; + + file_extent* lastExtent = NULL; + if (start != 0) { + lastExtent = ExtentAt(start - 1); + offset = lastExtent->offset + lastExtent->disk.length; + } + + for (uint32 i = 0; i < vecCount; i++) { + if (lastExtent != NULL) { + if (lastExtent->disk.offset + lastExtent->disk.length + == vecs[i].offset + || (lastExtent->disk.offset == -1 && vecs[i].offset == -1)) { + lastExtent->disk.length += vecs[i].length; + offset += vecs[i].length; + start--; + _MakeSpace(fCount - 1); + continue; + } + } + + file_extent* extent = ExtentAt(start + i); + extent->offset = offset; + extent->disk = vecs[i]; + + offset += extent->disk.length; + lastExtent = extent; + } + +#ifdef TRACE_FILE_MAP + for (uint32 i = 0; i < fCount; i++) { + file_extent* extent = ExtentAt(i); + TRACE("[%ld] extent offset %Ld, disk offset %Ld, length %Ld\n", + i, extent->offset, extent->disk.offset, extent->disk.length); + } +#endif + + lastOffset = offset; + return B_OK; +} + + +void +FileMap::_InvalidateAfter(off_t offset) +{ + uint32 index; + file_extent* extent = _FindExtent(offset, &index); + if (extent != NULL) { + _MakeSpace(index + 1); + + if (extent->offset + extent->disk.length > offset) { + extent->disk.length = offset - extent->offset; + if (extent->disk.length == 0) + _MakeSpace(index); + } + } +} + + +/*! Invalidates or removes the specified part of the file map. +*/ +void +FileMap::Invalidate(off_t offset, off_t size) +{ + MutexLocker _(fLock); + + // TODO: honour size, we currently always remove everything after "offset" + if (offset == 0) { + _Free(); + return; + } + + _InvalidateAfter(offset); +} + + +void +FileMap::SetSize(off_t size) +{ + MutexLocker _(fLock); + + if (size < fSize) + _InvalidateAfter(size); + + fSize = size; +} + + +void +FileMap::_Free() +{ + if (fCount > CACHED_FILE_EXTENTS) + free(fIndirect.array); + + fCount = 0; +} + + +status_t +FileMap::_Cache(off_t offset, off_t size) +{ + file_extent* lastExtent = NULL; + if (fCount > 0) + lastExtent = ExtentAt(fCount - 1); + + off_t mapEnd = 0; + if (lastExtent != NULL) + mapEnd = lastExtent->offset + lastExtent->disk.length; + + off_t end = offset + size; + + if (fCacheAll && mapEnd < end) + return B_ERROR; + + status_t status = B_OK; + file_io_vec vecs[8]; + const size_t kMaxVecs = 8; + + while (status == B_OK && mapEnd < end) { + // We don't have the requested extents yet, retrieve them + size_t vecCount = kMaxVecs; + status = vfs_get_file_map(Vnode(), mapEnd, ~0UL, vecs, &vecCount); + if (status == B_OK || status == B_BUFFER_OVERFLOW) + status = _Add(vecs, vecCount, mapEnd); + } + + return status; +} + + +status_t +FileMap::SetMode(uint32 mode) +{ + if (mode != FILE_MAP_CACHE_ALL && mode != FILE_MAP_CACHE_ON_DEMAND) + return B_BAD_VALUE; + + MutexLocker _(fLock); + + if ((mode == FILE_MAP_CACHE_ALL && fCacheAll) + || (mode == FILE_MAP_CACHE_ON_DEMAND && !fCacheAll)) + return B_OK; + + if (mode == FILE_MAP_CACHE_ALL) { + status_t status = _Cache(0, fSize); + if (status != B_OK) + return status; + + fCacheAll = true; + } else + fCacheAll = false; + + return B_OK; +} + + +status_t +FileMap::Translate(off_t offset, size_t size, file_io_vec* vecs, size_t* _count, + size_t align) +{ + MutexLocker _(fLock); + + size_t maxVecs = *_count; + size_t padLastVec = 0; + + if (offset >= Size()) { + *_count = 0; + return B_OK; + } + if (offset + size > fSize) { + if (align > 1) { + off_t alignedSize = (fSize + align - 1) & ~(off_t)(align - 1); + if (offset + size >= alignedSize) + padLastVec = alignedSize - fSize; + } + size = fSize - offset; + } + + // First, we need to make sure that we have already cached all file + // extents needed for this request. + + status_t status = _Cache(offset, size); + if (status != B_OK) + return status; + + // We now have cached the map of this file as far as we need it, now + // we need to translate it for the requested access. + + uint32 index; + file_extent* fileExtent = _FindExtent(offset, &index); + + offset -= fileExtent->offset; + if (fileExtent->disk.offset != -1) + vecs[0].offset = fileExtent->disk.offset + offset; + else + vecs[0].offset = -1; + vecs[0].length = fileExtent->disk.length - offset; + + if (vecs[0].length >= size) { + vecs[0].length = size + padLastVec; + *_count = 1; + return B_OK; + } + + // copy the rest of the vecs + + size -= vecs[0].length; + uint32 vecIndex = 1; + + while (true) { + fileExtent++; + + vecs[vecIndex++] = fileExtent->disk; + + if (size <= fileExtent->disk.length) { + vecs[vecIndex - 1].length = size + padLastVec; + break; + } + + if (vecIndex >= maxVecs) { + *_count = vecIndex; + return B_BUFFER_OVERFLOW; + } + + size -= fileExtent->disk.length; + } + + *_count = vecIndex; + return B_OK; +} + + +// #pragma mark - + + +#if DEBUG_FILE_MAP + +static int +dump_file_map(int argc, char** argv) +{ + if (argc < 2) { + print_debugger_command_usage(argv[0]); + return 0; + } + + bool printExtents = false; + if (argc > 2 && !strcmp(argv[1], "-p")) + printExtents = true; + + FileMap* map = (FileMap*)parse_expression(argv[argc - 1]); + if (map == NULL) { + kprintf("invalid file map!\n"); + return 0; + } + + kprintf("FileMap %p\n", map); + kprintf(" size %Ld\n", map->Size()); + kprintf(" count %lu\n", map->Count()); + + if (!printExtents) + return 0; + + for (uint32 i = 0; i < map->Count(); i++) { + file_extent* extent = map->ExtentAt(i); + + kprintf(" [%lu] offset %Ld, disk offset %Ld, length %Ld\n", + i, extent->offset, extent->disk.offset, extent->disk.length); + } + + return 0; +} + + +static int +dump_file_map_stats(int argc, char** argv) +{ + off_t minSize = 0; + off_t maxSize = -1; + + if (argc == 2) { + maxSize = parse_expression(argv[1]); + } else if (argc > 2) { + minSize = parse_expression(argv[1]); + maxSize = parse_expression(argv[2]); + } + + FileMapList::Iterator iterator = sList.GetIterator(); + off_t size = 0; + off_t mapSize = 0; + uint32 extents = 0; + uint32 count = 0; + uint32 emptyCount = 0; + + while (iterator.HasNext()) { + FileMap* map = iterator.Next(); + + if (minSize > map->Size() || (maxSize != -1 && maxSize < map->Size())) + continue; + + if (map->Count() != 0) { + file_extent* extent = map->ExtentAt(map->Count() - 1); + if (extent != NULL) + mapSize += extent->offset + extent->disk.length; + + extents += map->Count(); + } else + emptyCount++; + + size += map->Size(); + count++; + } + + kprintf("%ld file maps (%ld empty), %Ld file bytes in total, %Ld bytes " + "cached, %lu extents\n", count, emptyCount, size, mapSize, extents); + kprintf("average %lu extents per map for %Ld bytes.\n", + extents / (count - emptyCount), mapSize / (count - emptyCount)); + + return 0; +} + +#endif // DEBUG_FILE_MAP + + +// #pragma mark - private kernel API + + +extern "C" status_t +file_map_init(void) +{ +#if DEBUG_FILE_MAP + add_debugger_command_etc("file_map", &dump_file_map, + "Dumps the specified file map.", + "[-p] \n" + " -p - causes the file extents to be printed as well.\n" + " - pointer to the file map.\n", 0); + add_debugger_command("file_map_stats", &dump_file_map_stats, + "Dumps some file map statistics."); + + mutex_init(&sLock, "file map list"); +#endif + return B_OK; +} + + +// #pragma mark - public FS API + + +extern "C" void* +file_map_create(dev_t mountID, ino_t vnodeID, off_t size) +{ + TRACE("file_map_create(mountID = %ld, vnodeID = %Ld, size = %Ld)\n", + mountID, vnodeID, size); + + // Get the vnode for the object + // (note, this does not grab a reference to the node) + struct vnode* vnode; + if (vfs_lookup_vnode(mountID, vnodeID, &vnode) != B_OK) + return NULL; + + return new(std::nothrow) FileMap(vnode, size); +} + + +extern "C" void +file_map_delete(void* _map) +{ + FileMap* map = (FileMap*)_map; + if (map == NULL) + return; + + TRACE("file_map_delete(map = %p)\n", map); + delete map; +} + + +extern "C" void +file_map_set_size(void* _map, off_t size) +{ + FileMap* map = (FileMap*)_map; + if (map == NULL) + return; + + map->SetSize(size); +} + + +extern "C" void +file_map_invalidate(void* _map, off_t offset, off_t size) +{ + FileMap* map = (FileMap*)_map; + if (map == NULL) + return; + + map->Invalidate(offset, size); +} + + +extern "C" status_t +file_map_set_mode(void* _map, uint32 mode) +{ + FileMap* map = (FileMap*)_map; + if (map == NULL) + return B_BAD_VALUE; + + return map->SetMode(mode); +} + + +extern "C" status_t +file_map_translate(void* _map, off_t offset, size_t size, file_io_vec* vecs, + size_t* _count, size_t align) +{ + TRACE("file_map_translate(map %p, offset %Ld, size %ld)\n", + _map, offset, size); + + FileMap* map = (FileMap*)_map; + if (map == NULL) + return B_BAD_VALUE; + + return map->Translate(offset, size, vecs, _count, align); +} + 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-02-28 12:20:41 UTC (rev 29347) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp 2009-02-28 13:47:10 UTC (rev 29348) @@ -13,6 +13,7 @@ #include "HaikuKernelNode.h" #include "HaikuKernelVolume.h" #include "kernel_emu.h" +#include "vfs.h" // #pragma mark - Notifications @@ -226,6 +227,26 @@ } +// #pragma mark - VFS private + + +status_t +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; +} + + +status_t +vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode) +{ + // TODO: Implement! + return B_BAD_VALUE; +} + + // #pragma mark - Misc Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/vfs.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/vfs.h 2009-02-28 12:20:41 UTC (rev 29347) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/vfs.h 2009-02-28 13:47:10 UTC (rev 29348) @@ -0,0 +1,23 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef USERLAND_FS_HAIKU_VFS_H +#define USERLAND_FS_HAIKU_VFS_H + +#include + + +struct vnode; + +extern "C" { + + +status_t vfs_get_file_map(struct vnode *vnode, off_t offset, size_t size, + struct file_io_vec *vecs, size_t *_count); +status_t vfs_lookup_vnode(dev_t mountID, ino_t vnodeID, struct vnode **_vnode); + + +} // extern "C" + +#endif // USERLAND_FS_HAIKU_VFS_H From bonefish at mail.berlios.de Sat Feb 28 16:10:36 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 16:10:36 +0100 Subject: [Haiku-commits] r29349 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281510.n1SFAa8o013123@sheep.berlios.de> Author: bonefish Date: 2009-02-28 16:10:36 +0100 (Sat, 28 Feb 2009) New Revision: 29349 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29349&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_cache.cpp Removed: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_file_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h 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/Jamfile Log: Removed the file cache emulation and added implementation stubs for the file cache functions. We won't emulate the file cache in userland anymore, but forward the calls to the kernel. Besides that this will save quite a bit of emulation code, it will also make mmap()ing files on UserlandFS volumes possible. The drawback is that these calls will be slower. 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-02-28 13:47:10 UTC (rev 29348) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp 2009-02-28 15:10:36 UTC (rev 29349) @@ -47,19 +47,12 @@ if (!fFSModule->mount) return B_BAD_VALUE; - // make the volume known to the file cache emulation - status_t error - = UserlandFS::HaikuKernelEmu::file_cache_register_volume(this); + // mount + status_t error = fFSModule->mount(&fVolume, device, flags, parameters, + rootID); if (error != B_OK) return error; - // mount - error = fFSModule->mount(&fVolume, device, flags, parameters, rootID); - if (error != B_OK) { - UserlandFS::HaikuKernelEmu::file_cache_unregister_volume(this); - return error; - } - _InitCapabilities(); return B_OK; @@ -72,13 +65,7 @@ if (!fVolume.ops->unmount) return B_BAD_VALUE; - // unmount - status_t error = fVolume.ops->unmount(&fVolume); - - // unregister with the file cache emulation - UserlandFS::HaikuKernelEmu::file_cache_unregister_volume(this); - - return error; + return fVolume.ops->unmount(&fVolume); } // Sync 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-02-28 13:47:10 UTC (rev 29348) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-02-28 15:10:36 UTC (rev 29349) @@ -26,13 +26,13 @@ haiku_block_cache.cpp haiku_condition_variable.cpp -# haiku_file_cache.cpp haiku_hash.cpp haiku_lock.cpp haiku_slab.cpp HaikuKernelFileSystem.cpp HaikuKernelVolume.cpp + file_cache.cpp file_map.cpp : Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_cache.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_cache.cpp 2009-02-28 13:47:10 UTC (rev 29348) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_cache.cpp 2009-02-28 15:10:36 UTC (rev 29349) @@ -0,0 +1,78 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include + + +void* +file_cache_create(dev_t mountID, ino_t vnodeID, off_t size) +{ + // TODO: Implement! + return NULL; +} + + +void +file_cache_delete(void *cacheRef) +{ + // TODO: Implement! +} + + +void +file_cache_enable(void *cacheRef) +{ + // TODO: Implement! +} + + +bool +file_cache_is_enabled(void *cacheRef) +{ + // TODO: Implement! + return false; +} + + +status_t +file_cache_disable(void *cacheRef) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + +status_t +file_cache_set_size(void *cacheRef, off_t size) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + +status_t +file_cache_sync(void *cache) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + +status_t +file_cache_read(void *cacheRef, void *cookie, off_t offset, void *bufferBase, + size_t *_size) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + +status_t +file_cache_write(void *cacheRef, void *cookie, off_t offset, const void *buffer, + size_t *_size) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_file_cache.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_fs_cache.h From bonefish at mail.berlios.de Sat Feb 28 16:14:24 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 16:14:24 +0100 Subject: [Haiku-commits] r29350 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281514.n1SFEO77013356@sheep.berlios.de> Author: bonefish Date: 2009-02-28 16:14:24 +0100 (Sat, 28 Feb 2009) New Revision: 29350 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29350&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp Log: Stubbed the missing methods. The library links now at least. 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-02-28 15:10:36 UTC (rev 29349) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp 2009-02-28 15:14:24 UTC (rev 29350) @@ -9,7 +9,6 @@ #include "Debug.h" #include "kernel_emu.h" -#include "haiku_fs_cache.h" #include "HaikuKernelNode.h" @@ -36,6 +35,45 @@ { } + +// NewVNode +status_t +HaikuKernelVolume::NewVNode(ino_t vnodeID, void* privateNode, fs_vnode_ops* ops, + HaikuKernelNode** node) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + +// PublishVNode +status_t +HaikuKernelVolume::PublishVNode(ino_t vnodeID, void* privateNode, + fs_vnode_ops* ops, int type, uint32 flags, HaikuKernelNode** node) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + +// UndoNewVNode +status_t +HaikuKernelVolume::UndoNewVNode(HaikuKernelNode* node) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + +// UndoPublishVNode +status_t +HaikuKernelVolume::UndoPublishVNode(HaikuKernelNode* node) +{ + // TODO: Implement! + return B_NOT_SUPPORTED; +} + + // #pragma mark - // #pragma mark ----- FS ----- From bonefish at mail.berlios.de Sat Feb 28 16:24:55 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 16:24:55 +0100 Subject: [Haiku-commits] r29351 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281524.n1SFOt67014125@sheep.berlios.de> Author: bonefish Date: 2009-02-28 16:24:54 +0100 (Sat, 28 Feb 2009) New Revision: 29351 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29351&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/block_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/block_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/condition_variable.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/condition_variable.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/khash.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/khash.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/lock.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/slab.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/slab.h Removed: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_condition_variable.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_hash.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_lock.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_slab.h Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/file_map.cpp Log: Some file renaming (removed the haiku_ prefix). 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-02-28 15:14:24 UTC (rev 29350) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-02-28 15:24:54 UTC (rev 29351) @@ -22,19 +22,18 @@ # the library providing the Haiku kernel interface for add-ons SharedLibrary libuserlandfs_haiku_kernel.so : - haiku_kernel_emu.cpp + block_cache.cpp + condition_variable.cpp + file_cache.cpp + file_map.cpp + khash.cpp + lock.cpp + slab.cpp - haiku_block_cache.cpp - haiku_condition_variable.cpp - haiku_hash.cpp - haiku_lock.cpp - haiku_slab.cpp + haiku_kernel_emu.cpp HaikuKernelFileSystem.cpp HaikuKernelVolume.cpp - file_cache.cpp - file_map.cpp - : UserlandFSServer ; Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/block_cache.cpp (from rev 29347, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp) =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_block_cache.cpp 2009-02-28 12:20:41 UTC (rev 29347) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/block_cache.cpp 2009-02-28 15:24:54 UTC (rev 29351) @@ -0,0 +1,2620 @@ +/* + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +#include "block_cache.h" + +#include + +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include "condition_variable.h" +#include "khash.h" +#include "lock.h" +#include "slab.h" + + +// TODO: this is a naive but growing implementation to test the API: +// 1) block reading/writing is not at all optimized for speed, it will +// just read and write single blocks. +// 2) the locking could be improved; getting a block should not need to +// wait for blocks to be written +// TODO: the retrieval/copy of the original data could be delayed until the +// new data must be written, ie. in low memory situations. + + +//#define TRACE_BLOCK_CACHE +#undef TRACE /* undef TRACE from */ +#ifdef TRACE_BLOCK_CACHE +# define TRACE(x) dprintf x +#else +# define TRACE(x) ; +#endif + +// This macro is used for fatal situations that are acceptable in a running +// system, like out of memory situations - should only panic for debugging. +#define FATAL(x) panic x + + +static const bigtime_t kTransactionIdleTime = 2000000LL; + // a transaction is considered idle after 2 seconds of inactivity + + +struct cache_transaction; +struct cached_block; +struct block_cache; +typedef DoublyLinkedListLink block_link; + +struct cached_block { + cached_block* next; // next in hash + cached_block* transaction_next; + block_link link; + off_t block_number; + void* current_data; + void* original_data; + void* parent_data; +#if BLOCK_CACHE_DEBUG_CHANGED + void* compare; +#endif + int32 ref_count; + int32 accessed; + bool busy : 1; + bool is_writing : 1; + bool is_dirty : 1; + bool unused : 1; + bool discard : 1; + cache_transaction* transaction; + cache_transaction* previous_transaction; + + static int Compare(void* _cacheEntry, const void* _block); + static uint32 Hash(void* _cacheEntry, const void* _block, uint32 range); +}; + +typedef DoublyLinkedList > block_list; + +struct cache_notification : DoublyLinkedListLinkImpl { + int32 transaction_id; + int32 events_pending; + int32 events; + transaction_notification_hook hook; + void* data; + bool delete_after_event; +}; + +typedef DoublyLinkedList NotificationList; + +struct block_cache : DoublyLinkedListLinkImpl { + hash_table* hash; + mutex lock; + int fd; + off_t max_blocks; + size_t block_size; + int32 next_transaction_id; + cache_transaction* last_transaction; + hash_table* transaction_hash; + + object_cache* buffer_cache; + block_list unused_blocks; + + uint32 num_dirty_blocks; + bool read_only; + + NotificationList pending_notifications; + ConditionVariable condition_variable; + + block_cache(int fd, off_t numBlocks, size_t blockSize, + bool readOnly); + ~block_cache(); + + status_t Init(); + + void Free(void* buffer); + void* Allocate(); + void RemoveBlock(cached_block* block); + void DiscardBlock(cached_block* block); + void FreeBlock(cached_block* block); + cached_block* NewBlock(off_t blockNumber); + + +private: + cached_block* _GetUnusedBlock(); +}; + +struct cache_listener; +typedef DoublyLinkedListLink listener_link; + +struct cache_listener : cache_notification { + listener_link link; +}; + +typedef DoublyLinkedList > ListenerList; + +struct cache_transaction { + cache_transaction(); + + cache_transaction* next; + int32 id; + int32 num_blocks; + int32 main_num_blocks; + int32 sub_num_blocks; + cached_block* first_block; + block_list blocks; + ListenerList listeners; + bool open; + bool has_sub_transaction; + bigtime_t last_used; +}; + +#if BLOCK_CACHE_BLOCK_TRACING +namespace BlockTracing { + +class Action : public AbstractTraceEntry { +public: + Action(block_cache* cache, cached_block* block) + : + fCache(cache), + fBlockNumber(block->block_number), + fIsDirty(block->is_dirty), + fHasOriginal(block->original_data != NULL), + fHasParent(block->parent_data != NULL), + fTransactionID(-1), + fPreviousID(-1) + { + if (block->transaction != NULL) + fTransactionID = block->transaction->id; + if (block->previous_transaction != NULL) + fPreviousID = block->previous_transaction->id; + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, %s %Ld, %c%c%c transaction %ld " + "(previous id %ld)\n", fCache, _Action(), fBlockNumber, + fIsDirty ? 'd' : '-', fHasOriginal ? 'o' : '-', + fHasParent ? 'p' : '-', fTransactionID, fPreviousID); + } + + virtual const char* _Action() const = 0; + +private: + block_cache* fCache; + uint64 fBlockNumber; + bool fIsDirty; + bool fHasOriginal; + bool fHasParent; + int32 fTransactionID; + int32 fPreviousID; +}; + +class Get : public Action { +public: + Get(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "get"; } +}; + +class Put : public Action { +public: + Put(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "put"; } +}; + +class Read : public Action { +public: + Read(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "read"; } +}; + +class Write : public Action { +public: + Write(block_cache* cache, cached_block* block) + : Action(cache, block) + { + Initialized(); + } + + virtual const char* _Action() const { return "write"; } +}; + +class Flush : public Action { +public: + Flush(block_cache* cache, cached_block* block, bool getUnused = false) + : Action(cache, block), + fGetUnused(getUnused) + { + Initialized(); + } + + virtual const char* _Action() const + { return fGetUnused ? "get-unused" : "flush"; } + +private: + bool fGetUnused; +}; + +class Error : public AbstractTraceEntry { +public: + Error(block_cache* cache, uint64 blockNumber, const char* message, + status_t status = B_OK) + : + fCache(cache), + fBlockNumber(blockNumber), + fMessage(message), + fStatus(status) + { + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, error %Ld, %s%s%s", + fCache, fBlockNumber, fMessage, fStatus != B_OK ? ": " : "", + fStatus != B_OK ? strerror(fStatus) : ""); + } + +private: + block_cache* fCache; + uint64 fBlockNumber; + const char* fMessage; + status_t fStatus; +}; + +} // namespace BlockTracing + +# define TB(x) new(std::nothrow) BlockTracing::x; +#else +# define TB(x) ; +#endif + +#if BLOCK_CACHE_TRANSACTION_TRACING +namespace TransactionTracing { + +class Action : public AbstractTraceEntry { + public: + Action(const char* label, block_cache* cache, + cache_transaction* transaction) + : + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fSub(transaction->has_sub_transaction), + fNumBlocks(transaction->num_blocks), + fSubNumBlocks(transaction->sub_num_blocks) + { + strlcpy(fLabel, label, sizeof(fLabel)); + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, %s transaction %p (id %ld)%s" + ", %ld/%ld blocks", fCache, fLabel, fTransaction, fID, + fSub ? " sub" : "", fNumBlocks, fSubNumBlocks); + } + + private: + char fLabel[12]; + block_cache *fCache; + cache_transaction *fTransaction; + int32 fID; + bool fSub; + int32 fNumBlocks; + int32 fSubNumBlocks; +}; + +class Detach : public AbstractTraceEntry { + public: + Detach(block_cache* cache, cache_transaction* transaction, + cache_transaction* newTransaction) + : + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fSub(transaction->has_sub_transaction), + fNewTransaction(newTransaction), + fNewID(newTransaction->id) + { + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, detach transaction %p (id %ld)" + "from transaction %p (id %ld)%s", + fCache, fNewTransaction, fNewID, fTransaction, fID, + fSub ? " sub" : ""); + } + + private: + block_cache *fCache; + cache_transaction *fTransaction; + int32 fID; + bool fSub; + cache_transaction *fNewTransaction; + int32 fNewID; +}; + +class Abort : public AbstractTraceEntry { + public: + Abort(block_cache* cache, cache_transaction* transaction) + : + fCache(cache), + fTransaction(transaction), + fID(transaction->id), + fNumBlocks(0) + { + bool isSub = transaction->has_sub_transaction; + fNumBlocks = isSub ? transaction->sub_num_blocks + : transaction->num_blocks; + fBlocks = (off_t*)alloc_tracing_buffer(fNumBlocks * sizeof(off_t)); + if (fBlocks != NULL) { + cached_block* block = transaction->first_block; + for (int32 i = 0; block != NULL && i < fNumBlocks; + block = block->transaction_next) { + fBlocks[i++] = block->block_number; + } + } else + fNumBlocks = 0; + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { + out.Print("block cache %p, abort transaction " + "%p (id %ld), blocks", fCache, fTransaction, fID); + for (int32 i = 0; i < fNumBlocks && !out.IsFull(); i++) + out.Print(" %Ld", fBlocks[i]); + } + + private: + block_cache *fCache; + cache_transaction *fTransaction; + int32 fID; + off_t *fBlocks; + int32 fNumBlocks; +}; + +} // namespace TransactionTracing + +# define T(x) new(std::nothrow) TransactionTracing::x; +#else +# define T(x) ; +#endif + + +static status_t write_cached_block(block_cache* cache, cached_block* block, + bool deleteTransaction = true); + + +static DoublyLinkedList sCaches; +static mutex sCachesLock = MUTEX_INITIALIZER("block caches"); +static sem_id sEventSemaphore; +static mutex sNotificationsLock = MUTEX_INITIALIZER("block cache notifications"); +static thread_id sNotifierWriterThread; +static DoublyLinkedListLink sMarkCache; + // TODO: this only works if the link is the first entry of block_cache +static object_cache* sBlockCache; + + +// #pragma mark - notifications/listener + + +/*! Checks wether or not this is an event that closes a transaction. */ +static inline bool +is_closing_event(int32 event) +{ + return (event & (TRANSACTION_ABORTED | TRANSACTION_ENDED)) != 0; +} + + +static inline bool +is_written_event(int32 event) +{ + return (event & TRANSACTION_WRITTEN) != 0; +} + + +/*! From the specified \a notification, it will remove the lowest pending + event, and return that one in \a _event. + If there is no pending event anymore, it will return \c false. +*/ +static bool +get_next_pending_event(cache_notification* notification, int32* _event) +{ + for (int32 eventMask = 1; eventMask <= TRANSACTION_IDLE; eventMask <<= 1) { + int32 pending = atomic_and(¬ification->events_pending, + ~eventMask); + + bool more = (pending & ~eventMask) != 0; + + if ((pending & eventMask) != 0) { + *_event = eventMask; + return more; + } + } + + return false; +} + + +static void +flush_pending_notifications(block_cache* cache) +{ + ASSERT_LOCKED_MUTEX(&sCachesLock); + + while (true) { + MutexLocker locker(sNotificationsLock); + + cache_notification* notification = cache->pending_notifications.Head(); + if (notification == NULL) + return; + + bool deleteAfterEvent = false; + int32 event = -1; + if (!get_next_pending_event(notification, &event)) { + // remove the notification if this was the last pending event + cache->pending_notifications.Remove(notification); + deleteAfterEvent = notification->delete_after_event; + } + + if (event >= 0) { + // Notify listener, we need to copy the notification, as it might + // be removed when we unlock the list. + cache_notification copy = *notification; + locker.Unlock(); + + copy.hook(copy.transaction_id, event, copy.data); + + locker.Lock(); + } + + if (deleteAfterEvent) + delete notification; + } +} + + +/*! Flushes all pending notifications by calling the appropriate hook + functions. + Must not be called with a cache lock held. +*/ +static void +flush_pending_notifications() +{ + MutexLocker _(sCachesLock); + + DoublyLinkedList::Iterator iterator = sCaches.GetIterator(); + while (iterator.HasNext()) { + block_cache* cache = iterator.Next(); + + flush_pending_notifications(cache); + } +} + + +/*! Initializes the \a notification as specified. */ +static void +set_notification(cache_transaction* transaction, + cache_notification ¬ification, int32 events, + transaction_notification_hook hook, void* data) +{ + notification.transaction_id = transaction != NULL ? transaction->id : -1; + notification.events_pending = 0; + notification.events = events; + notification.hook = hook; + notification.data = data; + notification.delete_after_event = false; +} + + +/*! Makes sure the notification is deleted. It either deletes it directly, + when possible, or marks it for deletion if the notification is pending. +*/ +static void +delete_notification(cache_notification* notification) +{ + MutexLocker locker(sNotificationsLock); + + if (notification->events_pending != 0) + notification->delete_after_event = true; + else + delete notification; +} + + +/*! Adds the notification to the pending notifications list, or, if it's + already part of it, updates its events_pending field. + Also marks the notification to be deleted if \a deleteNotification + is \c true. + Triggers the notifier thread to run. +*/ +static void +add_notification(block_cache* cache, cache_notification* notification, + int32 event, bool deleteNotification) +{ + if (notification->hook == NULL) + return; + + int32 pending = atomic_or(¬ification->events_pending, event); + if (pending == 0) { + // not yet part of the notification list + MutexLocker locker(sNotificationsLock); + if (deleteNotification) + notification->delete_after_event = true; + cache->pending_notifications.Add(notification); + } else if (deleteNotification) { + // we might need to delete it ourselves if we're late + delete_notification(notification); + } + + release_sem_etc(sEventSemaphore, 1, B_DO_NOT_RESCHEDULE); + // We're probably still holding some locks that makes rescheduling + // not a good idea at this point. +} + + +/*! Notifies all interested listeners of this transaction about the \a event. + If \a event is a closing event (ie. TRANSACTION_ENDED, and + TRANSACTION_ABORTED), all listeners except those listening to + TRANSACTION_WRITTEN will be removed. +*/ +static void +notify_transaction_listeners(block_cache* cache, cache_transaction* transaction, + int32 event) +{ + T(Action("notify", cache, transaction)); + + bool isClosing = is_closing_event(event); + bool isWritten = is_written_event(event); + + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + + bool remove = (isClosing && !is_written_event(listener->events)) + || (isWritten && is_written_event(listener->events)); + if (remove) + iterator.Remove(); + + if ((listener->events & event) != 0) + add_notification(cache, listener, event, remove); + else if (remove) + delete_notification(listener); + } +} + + +/*! Removes and deletes all listeners that are still monitoring this + transaction. +*/ +static void +remove_transaction_listeners(block_cache* cache, cache_transaction* transaction) +{ + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + iterator.Remove(); + + delete_notification(listener); + } +} + + +static status_t +add_transaction_listener(block_cache* cache, cache_transaction* transaction, + int32 events, transaction_notification_hook hookFunction, void* data) +{ + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + + if (listener->data == data && listener->hook == hookFunction) { + // this listener already exists, just update it + listener->events |= events; + return B_OK; + } + } + + cache_listener* listener = new(std::nothrow) cache_listener; + if (listener == NULL) + return B_NO_MEMORY; + + set_notification(transaction, *listener, events, hookFunction, data); + transaction->listeners.Add(listener); + return B_OK; +} + + +// #pragma mark - private transaction + + +cache_transaction::cache_transaction() +{ + num_blocks = 0; + main_num_blocks = 0; + sub_num_blocks = 0; + first_block = NULL; + open = true; + last_used = system_time(); +} + + +static int +transaction_compare(void* _transaction, const void* _id) +{ + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32* id = (const int32*)_id; + + return transaction->id - *id; +} + + +static uint32 +transaction_hash(void* _transaction, const void* _id, uint32 range) +{ + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32* id = (const int32*)_id; + + if (transaction != NULL) + return transaction->id % range; + + return (uint32)*id % range; +} + + +static void +delete_transaction(block_cache* cache, cache_transaction* transaction) +{ + if (cache->last_transaction == transaction) + cache->last_transaction = NULL; + + remove_transaction_listeners(cache, transaction); + delete transaction; +} + + +static cache_transaction* +lookup_transaction(block_cache* cache, int32 id) +{ + return (cache_transaction*)hash_lookup(cache->transaction_hash, &id); +} + + +// #pragma mark - cached_block + + +int +compare_blocks(const void* _blockA, const void* _blockB) +{ + cached_block* blockA = *(cached_block**)_blockA; + cached_block* blockB = *(cached_block**)_blockB; + + off_t diff = blockA->block_number - blockB->block_number; + if (diff > 0) + return 1; + + return diff < 0 ? -1 : 0; +} + + +/*static*/ int +cached_block::Compare(void* _cacheEntry, const void* _block) +{ + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const off_t* block = (const off_t*)_block; + + off_t diff = cacheEntry->block_number - *block; + if (diff > 0) + return 1; + + return diff < 0 ? -1 : 0; +} + + + +/*static*/ uint32 +cached_block::Hash(void* _cacheEntry, const void* _block, uint32 range) +{ + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const off_t* block = (const off_t*)_block; + + if (cacheEntry != NULL) + return cacheEntry->block_number % range; + + return (uint64)*block % range; +} + + +// #pragma mark - block_cache + + +block_cache::block_cache(int _fd, off_t numBlocks, size_t blockSize, + bool readOnly) + : + hash(NULL), + fd(_fd), + max_blocks(numBlocks), + block_size(blockSize), + next_transaction_id(1), + last_transaction(NULL), + transaction_hash(NULL), + buffer_cache(NULL), + num_dirty_blocks(0), + read_only(readOnly) +{ +} + + +/*! Should be called with the cache's lock held. */ +block_cache::~block_cache() +{ + hash_uninit(transaction_hash); + hash_uninit(hash); + + delete_object_cache(buffer_cache); + + mutex_destroy(&lock); +} + + +status_t +block_cache::Init() +{ + condition_variable.Init(this, "cache transaction sync"); + mutex_init(&lock, "block cache"); + + buffer_cache = create_object_cache_etc("block cache buffers", block_size, + 8, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL); + if (buffer_cache == NULL) + return B_NO_MEMORY; + + cached_block dummyBlock; + hash = hash_init(1024, offset_of_member(dummyBlock, next), + &cached_block::Compare, &cached_block::Hash); + if (hash == NULL) + return B_NO_MEMORY; + + cache_transaction dummyTransaction; + transaction_hash = hash_init(16, offset_of_member(dummyTransaction, next), + &transaction_compare, &::transaction_hash); + if (transaction_hash == NULL) + return B_NO_MEMORY; + + return B_OK; +} + + +void +block_cache::Free(void* buffer) +{ + if (buffer != NULL) + object_cache_free(buffer_cache, buffer); +} + + +void* +block_cache::Allocate() +{ + return object_cache_alloc(buffer_cache, 0); +} + + +void +block_cache::FreeBlock(cached_block* block) +{ + Free(block->current_data); + + if (block->original_data != NULL || block->parent_data != NULL) { + panic("block_cache::FreeBlock(): %Ld, original %p, parent %p\n", + block->block_number, block->original_data, block->parent_data); + } + +#if BLOCK_CACHE_DEBUG_CHANGED + Free(block->compare); +#endif + + object_cache_free(sBlockCache, block); +} + + +/*! Allocates a new block for \a blockNumber, ready for use */ +cached_block* +block_cache::NewBlock(off_t blockNumber) +{ + cached_block* block = (cached_block*)object_cache_alloc(sBlockCache, 0); + if (block == NULL) { + TB(Error(this, blockNumber, "allocation failed")); + dprintf("block allocation failed, unused list is %sempty.\n", + unused_blocks.IsEmpty() ? "" : "not "); + + // allocation failed, try to reuse an unused block + block = _GetUnusedBlock(); + if (block == NULL) { + TB(Error(this, blockNumber, "get unused failed")); + FATAL(("could not allocate block!\n")); + return NULL; + } + } + + block->current_data = Allocate(); + if (block->current_data == NULL) { + object_cache_free(sBlockCache, block); + return NULL; + } + + block->block_number = blockNumber; + block->ref_count = 0; + block->accessed = 0; + block->transaction_next = NULL; + block->transaction = block->previous_transaction = NULL; + block->original_data = NULL; + block->parent_data = NULL; + block->is_dirty = false; + block->unused = false; + block->discard = false; +#if BLOCK_CACHE_DEBUG_CHANGED + block->compare = NULL; +#endif + + return block; +} + + +void +block_cache::RemoveBlock(cached_block* block) +{ + hash_remove(hash, block); + FreeBlock(block); +} + + +/*! Discards the block from a transaction (this method must not be called + for blocks not part of a transaction). +*/ +void +block_cache::DiscardBlock(cached_block* block) +{ + ASSERT(block->discard); + + if (block->parent_data != NULL && block->parent_data != block->current_data) + Free(block->parent_data); + + block->parent_data = NULL; + + if (block->original_data != NULL) { + Free(block->original_data); + block->original_data = NULL; + } + + RemoveBlock(block); +} + + +cached_block* +block_cache::_GetUnusedBlock() +{ + TRACE(("block_cache: get unused block\n")); + + for (block_list::Iterator iterator = unused_blocks.GetIterator(); + cached_block* block = iterator.Next();) { + TB(Flush(this, block, true)); + // this can only happen if no transactions are used + if (block->is_dirty) + write_cached_block(this, block, false); + + // remove block from lists + iterator.Remove(); + hash_remove(hash, block); + + // TODO: see if parent/compare data is handled correctly here! + if (block->parent_data != NULL + && block->parent_data != block->original_data) + Free(block->parent_data); + if (block->original_data != NULL) + Free(block->original_data); + + return block; + } + + return NULL; +} + + +// #pragma mark - private block functions + + +/*! Removes a reference from the specified \a block. If this was the last + reference, the block is moved into the unused list. + In low memory situations, it will also free some blocks from that list, + but not necessarily the \a block it just released. +*/ +static void +put_cached_block(block_cache* cache, cached_block* block) +{ +#if BLOCK_CACHE_DEBUG_CHANGED [... truncated: 2769 lines follow ...] From bonefish at mail.berlios.de Sat Feb 28 16:28:52 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 16:28:52 +0100 Subject: [Haiku-commits] r29352 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281528.n1SFSq3Q014333@sheep.berlios.de> Author: bonefish Date: 2009-02-28 16:28:51 +0100 (Sat, 28 Feb 2009) New Revision: 29352 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29352&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.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 haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp Log: Removed the parent directory from the header directories again. Instead include the respective headers explicitly. Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.h 2009-02-28 15:24:54 UTC (rev 29351) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.h 2009-02-28 15:28:51 UTC (rev 29352) @@ -3,7 +3,7 @@ #ifndef USERLAND_FS_HAIKU_KERNEL_FILE_SYSTEM_H #define USERLAND_FS_HAIKU_KERNEL_FILE_SYSTEM_H -#include "FileSystem.h" +#include "../FileSystem.h" struct file_system_module_info; 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-02-28 15:24:54 UTC (rev 29351) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.cpp 2009-02-28 15:28:51 UTC (rev 29352) @@ -8,7 +8,9 @@ #include #include "Debug.h" -#include "kernel_emu.h" + +#include "../kernel_emu.h" + #include "HaikuKernelNode.h" 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-02-28 15:24:54 UTC (rev 29351) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelVolume.h 2009-02-28 15:28:51 UTC (rev 29352) @@ -5,7 +5,7 @@ #include -#include "Volume.h" +#include "../Volume.h" namespace UserlandFS { 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-02-28 15:24:54 UTC (rev 29351) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/Jamfile 2009-02-28 15:28:51 UTC (rev 29352) @@ -7,7 +7,6 @@ SubDirSysHdrs [ FDirName $(userlandFSIncludes) ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; -SubDirHdrs [ FDirName $(SUBDIR) $(DOTDOT) ] ; UsePrivateSystemHeaders ; UsePrivateHeaders libroot ; 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-02-28 15:24:54 UTC (rev 29351) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp 2009-02-28 15:28:51 UTC (rev 29352) @@ -10,9 +10,11 @@ #include #include "Debug.h" + +#include "../kernel_emu.h" + #include "HaikuKernelNode.h" #include "HaikuKernelVolume.h" -#include "kernel_emu.h" #include "vfs.h" From bonefish at mail.berlios.de Sat Feb 28 17:00:11 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 17:00:11 +0100 Subject: [Haiku-commits] r29353 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos Message-ID: <200902281600.n1SG0BVq016496@sheep.berlios.de> Author: bonefish Date: 2009-02-28 17:00:09 +0100 (Sat, 28 Feb 2009) New Revision: 29353 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29353&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/BeOSKernelFileSystem.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 Log: Adjusted to interface changes in the server. Should be working save for the stubbed new_vnode(). 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-02-28 15:28:51 UTC (rev 29352) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp 2009-02-28 16:00:09 UTC (rev 29353) @@ -54,108 +54,130 @@ fCapabilities.ClearAll(); // FS interface type - fCapabilities.clientFSType = CLIENT_FS_BEOS_KERNEL; + fClientFSType = CLIENT_FS_BEOS_KERNEL; // FS operations fCapabilities.Set(FS_CAPABILITY_MOUNT, fFSOps->mount); - fCapabilities.Set(FS_CAPABILITY_UNMOUNT, fFSOps->unmount); - fCapabilities.Set(FS_CAPABILITY_READ_FS_INFO, fFSOps->rfsstat); - fCapabilities.Set(FS_CAPABILITY_WRITE_FS_INFO, fFSOps->wfsstat); - fCapabilities.Set(FS_CAPABILITY_SYNC, fFSOps->sync); + // Volume operations + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_UNMOUNT, fFSOps->unmount); + + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_READ_FS_INFO, fFSOps->rfsstat); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_WRITE_FS_INFO, + fFSOps->wfsstat); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_SYNC, fFSOps->sync); + + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_GET_VNODE, fFSOps->read_vnode); + + // index directory & index operations + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_OPEN_INDEX_DIR, + fFSOps->open_indexdir); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_CLOSE_INDEX_DIR, + fFSOps->close_indexdir); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_FREE_INDEX_DIR_COOKIE, + fFSOps->free_indexdircookie); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_READ_INDEX_DIR, + fFSOps->read_indexdir); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_REWIND_INDEX_DIR, + fFSOps->rewind_indexdir); + + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_CREATE_INDEX, + fFSOps->create_index); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_REMOVE_INDEX, + fFSOps->remove_index); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_READ_INDEX_STAT, + fFSOps->stat_index); + + // query operations + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_OPEN_QUERY, + fFSOps->open_query); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_CLOSE_QUERY, + fFSOps->close_query); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_FREE_QUERY_COOKIE, + fFSOps->free_querycookie); + fVolumeCapabilities.Set(FS_VOLUME_CAPABILITY_READ_QUERY, + fFSOps->read_query); + // missing: FS_VOLUME_CAPABILITY_REWIND_QUERY, + // vnode operations - fCapabilities.Set(FS_CAPABILITY_LOOKUP, fFSOps->walk); - // missing: FS_CAPABILITY_GET_VNODE_NAME, + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_LOOKUP, fFSOps->walk); + // missing: FS_VNODE_CAPABILITY_GET_VNODE_NAME, - fCapabilities.Set(FS_CAPABILITY_GET_VNODE, fFSOps->read_vnode); - fCapabilities.Set(FS_CAPABILITY_PUT_VNODE, fFSOps->write_vnode); - fCapabilities.Set(FS_CAPABILITY_REMOVE_VNODE, fFSOps->remove_vnode); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_PUT_VNODE, fFSOps->write_vnode); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_REMOVE_VNODE, + fFSOps->remove_vnode); // VM file access - // missing: FS_CAPABILITY_CAN_PAGE, - // missing: FS_CAPABILITY_READ_PAGES, - // missing: FS_CAPABILITY_WRITE_PAGES, + // missing: FS_VNODE_CAPABILITY_CAN_PAGE, + // missing: FS_VNODE_CAPABILITY_READ_PAGES, + // missing: FS_VNODE_CAPABILITY_WRITE_PAGES, // cache file access - // missing: FS_CAPABILITY_GET_FILE_MAP, + // missing: FS_VNODE_CAPABILITY_GET_FILE_MAP, // common operations - fCapabilities.Set(FS_CAPABILITY_IOCTL, fFSOps->ioctl); - fCapabilities.Set(FS_CAPABILITY_SET_FLAGS, fFSOps->setflags); - fCapabilities.Set(FS_CAPABILITY_SELECT, fFSOps->select); - fCapabilities.Set(FS_CAPABILITY_DESELECT, fFSOps->deselect); - fCapabilities.Set(FS_CAPABILITY_FSYNC, fFSOps->fsync); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_IOCTL, fFSOps->ioctl); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_SET_FLAGS, fFSOps->setflags); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_SELECT, fFSOps->select); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_DESELECT, fFSOps->deselect); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_FSYNC, fFSOps->fsync); - fCapabilities.Set(FS_CAPABILITY_READ_SYMLINK, fFSOps->readlink); - fCapabilities.Set(FS_CAPABILITY_CREATE_SYMLINK, fFSOps->symlink); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_READ_SYMLINK, fFSOps->readlink); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CREATE_SYMLINK, fFSOps->symlink); - fCapabilities.Set(FS_CAPABILITY_LINK, fFSOps->link); - fCapabilities.Set(FS_CAPABILITY_UNLINK, fFSOps->unlink); - fCapabilities.Set(FS_CAPABILITY_RENAME, fFSOps->rename); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_LINK, fFSOps->link); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_UNLINK, fFSOps->unlink); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_RENAME, fFSOps->rename); - fCapabilities.Set(FS_CAPABILITY_ACCESS, fFSOps->access); - fCapabilities.Set(FS_CAPABILITY_READ_STAT, fFSOps->rstat); - fCapabilities.Set(FS_CAPABILITY_WRITE_STAT, fFSOps->wstat); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_ACCESS, fFSOps->access); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_READ_STAT, fFSOps->rstat); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_WRITE_STAT, fFSOps->wstat); // file operations - fCapabilities.Set(FS_CAPABILITY_CREATE, fFSOps->create); - fCapabilities.Set(FS_CAPABILITY_OPEN, fFSOps->open); - fCapabilities.Set(FS_CAPABILITY_CLOSE, fFSOps->close); - fCapabilities.Set(FS_CAPABILITY_FREE_COOKIE, fFSOps->free_cookie); - fCapabilities.Set(FS_CAPABILITY_READ, fFSOps->read); - fCapabilities.Set(FS_CAPABILITY_WRITE, fFSOps->write); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CREATE, fFSOps->create); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_OPEN, fFSOps->open); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CLOSE, fFSOps->close); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_FREE_COOKIE, fFSOps->free_cookie); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_READ, fFSOps->read); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_WRITE, fFSOps->write); // directory operations - fCapabilities.Set(FS_CAPABILITY_CREATE_DIR, fFSOps->mkdir); - fCapabilities.Set(FS_CAPABILITY_REMOVE_DIR, fFSOps->rmdir); - fCapabilities.Set(FS_CAPABILITY_OPEN_DIR, fFSOps->opendir); - fCapabilities.Set(FS_CAPABILITY_CLOSE_DIR, fFSOps->closedir); - fCapabilities.Set(FS_CAPABILITY_FREE_DIR_COOKIE, fFSOps->free_dircookie); - fCapabilities.Set(FS_CAPABILITY_READ_DIR, fFSOps->readdir); - fCapabilities.Set(FS_CAPABILITY_REWIND_DIR, fFSOps->rewinddir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CREATE_DIR, fFSOps->mkdir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_REMOVE_DIR, fFSOps->rmdir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_OPEN_DIR, fFSOps->opendir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CLOSE_DIR, fFSOps->closedir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_FREE_DIR_COOKIE, + fFSOps->free_dircookie); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_READ_DIR, fFSOps->readdir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_REWIND_DIR, fFSOps->rewinddir); // attribute directory operations - fCapabilities.Set(FS_CAPABILITY_OPEN_ATTR_DIR, fFSOps->open_attrdir); - fCapabilities.Set(FS_CAPABILITY_CLOSE_ATTR_DIR, fFSOps->close_attrdir); - fCapabilities.Set(FS_CAPABILITY_FREE_ATTR_DIR_COOKIE, + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_OPEN_ATTR_DIR, + fFSOps->open_attrdir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CLOSE_ATTR_DIR, + fFSOps->close_attrdir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_FREE_ATTR_DIR_COOKIE, fFSOps->free_attrdircookie); - fCapabilities.Set(FS_CAPABILITY_READ_ATTR_DIR, fFSOps->read_attrdir); - fCapabilities.Set(FS_CAPABILITY_REWIND_ATTR_DIR, fFSOps->rewind_attrdir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_READ_ATTR_DIR, + fFSOps->read_attrdir); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_REWIND_ATTR_DIR, + fFSOps->rewind_attrdir); // attribute operations // we emulate open_attr() and free_attr_dir_cookie() if either read_attr() // or write_attr() is present bool hasAttributes = (fFSOps->read_attr || fFSOps->write_attr); - fCapabilities.Set(FS_CAPABILITY_CREATE_ATTR, hasAttributes); - fCapabilities.Set(FS_CAPABILITY_OPEN_ATTR, hasAttributes); - fCapabilities.Set(FS_CAPABILITY_CLOSE_ATTR, false); - fCapabilities.Set(FS_CAPABILITY_FREE_ATTR_COOKIE, hasAttributes); - fCapabilities.Set(FS_CAPABILITY_READ_ATTR, fFSOps->read_attr); - fCapabilities.Set(FS_CAPABILITY_WRITE_ATTR, fFSOps->write_attr); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CREATE_ATTR, hasAttributes); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_OPEN_ATTR, hasAttributes); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_CLOSE_ATTR, false); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_FREE_ATTR_COOKIE, hasAttributes); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_READ_ATTR, fFSOps->read_attr); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_WRITE_ATTR, fFSOps->write_attr); - fCapabilities.Set(FS_CAPABILITY_READ_ATTR_STAT, fFSOps->stat_attr); - // missing: FS_CAPABILITY_WRITE_ATTR_STAT - fCapabilities.Set(FS_CAPABILITY_RENAME_ATTR, fFSOps->rename_attr); - fCapabilities.Set(FS_CAPABILITY_REMOVE_ATTR, fFSOps->remove_attr); - - // index directory & index operations - fCapabilities.Set(FS_CAPABILITY_OPEN_INDEX_DIR, fFSOps->open_indexdir); - fCapabilities.Set(FS_CAPABILITY_CLOSE_INDEX_DIR, fFSOps->close_indexdir); - fCapabilities.Set(FS_CAPABILITY_FREE_INDEX_DIR_COOKIE, - fFSOps->free_indexdircookie); - fCapabilities.Set(FS_CAPABILITY_READ_INDEX_DIR, fFSOps->read_indexdir); - fCapabilities.Set(FS_CAPABILITY_REWIND_INDEX_DIR, fFSOps->rewind_indexdir); - - fCapabilities.Set(FS_CAPABILITY_CREATE_INDEX, fFSOps->create_index); - fCapabilities.Set(FS_CAPABILITY_REMOVE_INDEX, fFSOps->remove_index); - fCapabilities.Set(FS_CAPABILITY_READ_INDEX_STAT, fFSOps->stat_index); - - // query operations - fCapabilities.Set(FS_CAPABILITY_OPEN_QUERY, fFSOps->open_query); - fCapabilities.Set(FS_CAPABILITY_CLOSE_QUERY, fFSOps->close_query); - fCapabilities.Set(FS_CAPABILITY_FREE_QUERY_COOKIE, - fFSOps->free_querycookie); - fCapabilities.Set(FS_CAPABILITY_READ_QUERY, fFSOps->read_query); - // missing: FS_CAPABILITY_REWIND_QUERY, + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_READ_ATTR_STAT, + fFSOps->stat_attr); + // missing: FS_VNODE_CAPABILITY_WRITE_ATTR_STAT + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_RENAME_ATTR, fFSOps->rename_attr); + fNodeCapabilities.Set(FS_VNODE_CAPABILITY_REMOVE_ATTR, fFSOps->remove_attr); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h 2009-02-28 15:28:51 UTC (rev 29352) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h 2009-02-28 16:00:09 UTC (rev 29353) @@ -3,7 +3,7 @@ #ifndef USERLAND_FS_BEOS_KERNEL_FILE_SYSTEM_H #define USERLAND_FS_BEOS_KERNEL_FILE_SYSTEM_H -#include "FileSystem.h" +#include "../FileSystem.h" struct beos_vnode_ops; @@ -17,11 +17,20 @@ virtual status_t CreateVolume(Volume** volume, dev_t id); virtual status_t DeleteVolume(Volume* volume); + void GetVolumeCapabilities( + FSVolumeCapabilities& capabilities) const + { capabilities = fVolumeCapabilities; } + void GetNodeCapabilities( + FSVNodeCapabilities& capabilities) const + { capabilities = fNodeCapabilities; } + private: void _InitCapabilities(); private: beos_vnode_ops* fFSOps; + FSVolumeCapabilities fVolumeCapabilities; + FSVNodeCapabilities fNodeCapabilities; }; } // namespace UserlandFS 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-02-28 15:28:51 UTC (rev 29352) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-02-28 16:00:09 UTC (rev 29353) @@ -9,9 +9,10 @@ #include "beos_fs_interface.h" #include "Debug.h" -#include "kernel_emu.h" +#include "../kernel_emu.h" + using std::nothrow; static int open_mode_to_access(int openMode); @@ -114,72 +115,44 @@ // Lookup status_t -BeOSKernelVolume::Lookup(fs_vnode dir, const char* entryName, ino_t* vnid) +BeOSKernelVolume::Lookup(void* dir, const char* entryName, ino_t* vnid) { if (!fFSOps->walk) return B_BAD_VALUE; + return fFSOps->walk(fVolumeCookie, dir, entryName, NULL, vnid); +} - status_t error = fFSOps->walk(fVolumeCookie, dir, entryName, NULL, vnid); +// ReadVNode +status_t +BeOSKernelVolume::ReadVNode(ino_t vnid, bool reenter, void** node, int* type, + uint32* flags) +{ + if (!fFSOps->read_vnode) + return B_BAD_VALUE; + + // get the node + status_t error = fFSOps->read_vnode(fVolumeCookie, vnid, (char)reenter, + node); if (error != B_OK) return error; - // We need to get the node stat to return the node's type. -// TODO: This is quite expensive. get_vnode() and put_vnode() cause trips to -// the kernel. If it is implemented properly walk() has already called -// get_vnode() for our node. Introducing a mechanism that would allow us to -// temporarily track the {get,put,new}_vnode() calls of our thread would save -// those two kernel trips. - - // get the vnode - fs_vnode node; - error = UserlandFS::KernelEmu::get_vnode(GetID(), *vnid, &node); + // stat it -- we need to get the node type + struct stat st; + error = ReadStat(node, &st); if (error != B_OK) { - // walk() has called get_vnode() for the caller, so we need to put the - // node - UserlandFS::KernelEmu::put_vnode(GetID(), *vnid); + WriteVNode(node, reenter); return error; } - // get the node's stat - struct stat st; - error = ReadStat(node, &st); - if (error == B_OK) - *type = (st.st_mode & S_IFMT); + *type = (st.st_mode & S_IFMT); + *flags = 0; - // put the node for our get_vnode() - UserlandFS::KernelEmu::put_vnode(GetID(), *vnid); - - // on error put the node for walk()'s get_vnode() - if (error != B_OK) - UserlandFS::KernelEmu::put_vnode(GetID(), *vnid); - - return error; + return B_OK; } -// LookupNoType -status_t -BeOSKernelVolume::LookupNoType(fs_vnode dir, const char* entryName, - ino_t* vnid) -{ - if (!fFSOps->walk) - return B_BAD_VALUE; - return fFSOps->walk(fVolumeCookie, dir, entryName, NULL, vnid); -} - -// ReadVNode -status_t -BeOSKernelVolume::ReadVNode(ino_t vnid, bool reenter, fs_vnode* node, int* type, - uint32* flags) -{ -#error Return type and flags! - if (!fFSOps->read_vnode) - return B_BAD_VALUE; - return fFSOps->read_vnode(fVolumeCookie, vnid, (char)reenter, node); -} - // WriteVNode status_t -BeOSKernelVolume::WriteVNode(fs_vnode node, bool reenter) +BeOSKernelVolume::WriteVNode(void* node, bool reenter) { if (!fFSOps->write_vnode) return B_BAD_VALUE; @@ -188,7 +161,7 @@ // RemoveVNode status_t -BeOSKernelVolume::RemoveVNode(fs_vnode node, bool reenter) +BeOSKernelVolume::RemoveVNode(void* node, bool reenter) { if (!fFSOps->remove_vnode) return B_BAD_VALUE; @@ -201,7 +174,7 @@ // IOCtl status_t -BeOSKernelVolume::IOCtl(fs_vnode node, fs_cookie cookie, uint32 command, +BeOSKernelVolume::IOCtl(void* node, void* cookie, uint32 command, void* buffer, size_t size) { if (!fFSOps->ioctl) @@ -212,7 +185,7 @@ // SetFlags status_t -BeOSKernelVolume::SetFlags(fs_vnode node, fs_cookie cookie, int flags) +BeOSKernelVolume::SetFlags(void* node, void* cookie, int flags) { if (!fFSOps->setflags) return B_BAD_VALUE; @@ -221,7 +194,7 @@ // Select status_t -BeOSKernelVolume::Select(fs_vnode node, fs_cookie cookie, uint8 event, +BeOSKernelVolume::Select(void* node, void* cookie, uint8 event, selectsync* sync) { if (!fFSOps->select) { @@ -233,7 +206,7 @@ // Deselect status_t -BeOSKernelVolume::Deselect(fs_vnode node, fs_cookie cookie, uint8 event, +BeOSKernelVolume::Deselect(void* node, void* cookie, uint8 event, selectsync* sync) { if (!fFSOps->select || !fFSOps->deselect) @@ -243,7 +216,7 @@ // FSync status_t -BeOSKernelVolume::FSync(fs_vnode node) +BeOSKernelVolume::FSync(void* node) { if (!fFSOps->fsync) return B_BAD_VALUE; @@ -252,7 +225,7 @@ // ReadSymlink status_t -BeOSKernelVolume::ReadSymlink(fs_vnode node, char* buffer, size_t bufferSize, +BeOSKernelVolume::ReadSymlink(void* node, char* buffer, size_t bufferSize, size_t* bytesRead) { if (!fFSOps->readlink) @@ -263,7 +236,7 @@ // CreateSymlink status_t -BeOSKernelVolume::CreateSymlink(fs_vnode dir, const char* name, +BeOSKernelVolume::CreateSymlink(void* dir, const char* name, const char* target, int mode) { if (!fFSOps->symlink) @@ -274,7 +247,7 @@ // Link status_t -BeOSKernelVolume::Link(fs_vnode dir, const char* name, fs_vnode node) +BeOSKernelVolume::Link(void* dir, const char* name, void* node) { if (!fFSOps->link) return B_BAD_VALUE; @@ -283,7 +256,7 @@ // Unlink status_t -BeOSKernelVolume::Unlink(fs_vnode dir, const char* name) +BeOSKernelVolume::Unlink(void* dir, const char* name) { if (!fFSOps->unlink) return B_BAD_VALUE; @@ -292,7 +265,7 @@ // Rename status_t -BeOSKernelVolume::Rename(fs_vnode oldDir, const char* oldName, fs_vnode newDir, +BeOSKernelVolume::Rename(void* oldDir, const char* oldName, void* newDir, const char* newName) { if (!fFSOps->rename) @@ -302,7 +275,7 @@ // Access status_t -BeOSKernelVolume::Access(fs_vnode node, int mode) +BeOSKernelVolume::Access(void* node, int mode) { if (!fFSOps->access) return B_OK; @@ -311,7 +284,7 @@ // ReadStat status_t -BeOSKernelVolume::ReadStat(fs_vnode node, struct stat* st) +BeOSKernelVolume::ReadStat(void* node, struct stat* st) { if (!fFSOps->rstat) return B_BAD_VALUE; @@ -323,7 +296,7 @@ // WriteStat status_t -BeOSKernelVolume::WriteStat(fs_vnode node, const struct stat *st, uint32 mask) +BeOSKernelVolume::WriteStat(void* node, const struct stat *st, uint32 mask) { if (!fFSOps->wstat) return B_BAD_VALUE; @@ -340,8 +313,8 @@ // Create status_t -BeOSKernelVolume::Create(fs_vnode dir, const char* name, int openMode, int mode, - fs_cookie* cookie, ino_t* vnid) +BeOSKernelVolume::Create(void* dir, const char* name, int openMode, int mode, + void** cookie, ino_t* vnid) { if (!fFSOps->create) return B_BAD_VALUE; @@ -351,7 +324,7 @@ // Open status_t -BeOSKernelVolume::Open(fs_vnode node, int openMode, fs_cookie* cookie) +BeOSKernelVolume::Open(void* node, int openMode, void** cookie) { if (!fFSOps->open) return B_BAD_VALUE; @@ -360,7 +333,7 @@ // Close status_t -BeOSKernelVolume::Close(fs_vnode node, fs_cookie cookie) +BeOSKernelVolume::Close(void* node, void* cookie) { if (!fFSOps->close) return B_OK; @@ -369,7 +342,7 @@ // FreeCookie status_t -BeOSKernelVolume::FreeCookie(fs_vnode node, fs_cookie cookie) +BeOSKernelVolume::FreeCookie(void* node, void* cookie) { if (!fFSOps->free_cookie) return B_OK; @@ -378,7 +351,7 @@ // Read status_t -BeOSKernelVolume::Read(fs_vnode node, fs_cookie cookie, off_t pos, void* buffer, +BeOSKernelVolume::Read(void* node, void* cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead) { if (!fFSOps->read) @@ -389,7 +362,7 @@ // Write status_t -BeOSKernelVolume::Write(fs_vnode node, fs_cookie cookie, off_t pos, +BeOSKernelVolume::Write(void* node, void* cookie, off_t pos, const void* buffer, size_t bufferSize, size_t* bytesWritten) { if (!fFSOps->write) @@ -405,7 +378,7 @@ // CreateDir status_t -BeOSKernelVolume::CreateDir(fs_vnode dir, const char* name, int mode, +BeOSKernelVolume::CreateDir(void* dir, const char* name, int mode, ino_t *newDir) { if (!fFSOps->mkdir || !fFSOps->walk) // we need walk() too @@ -430,7 +403,7 @@ // RemoveDir status_t -BeOSKernelVolume::RemoveDir(fs_vnode dir, const char* name) +BeOSKernelVolume::RemoveDir(void* dir, const char* name) { if (!fFSOps->rmdir) return B_BAD_VALUE; @@ -439,7 +412,7 @@ // OpenDir status_t -BeOSKernelVolume::OpenDir(fs_vnode node, fs_cookie* cookie) +BeOSKernelVolume::OpenDir(void* node, void** cookie) { if (!fFSOps->opendir) return B_BAD_VALUE; @@ -448,7 +421,7 @@ // CloseDir status_t -BeOSKernelVolume::CloseDir(fs_vnode node, fs_vnode cookie) +BeOSKernelVolume::CloseDir(void* node, void* cookie) { if (!fFSOps->closedir) return B_OK; @@ -457,7 +430,7 @@ // FreeDirCookie status_t -BeOSKernelVolume::FreeDirCookie(fs_vnode node, fs_vnode cookie) +BeOSKernelVolume::FreeDirCookie(void* node, void* cookie) { if (!fFSOps->free_dircookie) return B_OK; @@ -466,7 +439,7 @@ // ReadDir status_t -BeOSKernelVolume::ReadDir(fs_vnode node, fs_vnode cookie, void* buffer, +BeOSKernelVolume::ReadDir(void* node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { if (!fFSOps->readdir) @@ -481,7 +454,7 @@ // RewindDir status_t -BeOSKernelVolume::RewindDir(fs_vnode node, fs_vnode cookie) +BeOSKernelVolume::RewindDir(void* node, void* cookie) { if (!fFSOps->rewinddir) return B_BAD_VALUE; @@ -494,7 +467,7 @@ // OpenAttrDir status_t -BeOSKernelVolume::OpenAttrDir(fs_vnode node, fs_cookie *cookie) +BeOSKernelVolume::OpenAttrDir(void* node, void** cookie) { if (!fFSOps->open_attrdir) return B_BAD_VALUE; @@ -503,7 +476,7 @@ // CloseAttrDir status_t -BeOSKernelVolume::CloseAttrDir(fs_vnode node, fs_cookie cookie) +BeOSKernelVolume::CloseAttrDir(void* node, void* cookie) { if (!fFSOps->close_attrdir) return B_OK; @@ -512,7 +485,7 @@ // FreeAttrDirCookie status_t -BeOSKernelVolume::FreeAttrDirCookie(fs_vnode node, fs_cookie cookie) +BeOSKernelVolume::FreeAttrDirCookie(void* node, void* cookie) { if (!fFSOps->free_attrdircookie) return B_OK; @@ -521,7 +494,7 @@ // ReadAttrDir status_t -BeOSKernelVolume::ReadAttrDir(fs_vnode node, fs_cookie cookie, void* buffer, +BeOSKernelVolume::ReadAttrDir(void* node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { if (!fFSOps->read_attrdir) @@ -536,7 +509,7 @@ // RewindAttrDir status_t -BeOSKernelVolume::RewindAttrDir(fs_vnode node, fs_cookie cookie) +BeOSKernelVolume::RewindAttrDir(void* node, void* cookie) { if (!fFSOps->rewind_attrdir) return B_BAD_VALUE; @@ -549,30 +522,30 @@ // CreateAttr status_t -BeOSKernelVolume::CreateAttr(fs_vnode node, const char* name, uint32 type, - int openMode, fs_cookie* cookie) +BeOSKernelVolume::CreateAttr(void* node, const char* name, uint32 type, + int openMode, void** cookie) { return _OpenAttr(node, name, type, openMode, true, cookie); } // OpenAttr status_t -BeOSKernelVolume::OpenAttr(fs_vnode node, const char* name, int openMode, - fs_cookie* cookie) +BeOSKernelVolume::OpenAttr(void* node, const char* name, int openMode, + void** cookie) { return _OpenAttr(node, name, 0, openMode, false, cookie); } // CloseAttr status_t -BeOSKernelVolume::CloseAttr(fs_vnode node, fs_cookie cookie) +BeOSKernelVolume::CloseAttr(void* node, void* cookie) { return B_OK; } // FreeAttrCookie status_t -BeOSKernelVolume::FreeAttrCookie(fs_vnode node, fs_cookie _cookie) +BeOSKernelVolume::FreeAttrCookie(void* node, void* _cookie) { AttributeCookie* cookie = (AttributeCookie*)_cookie; @@ -587,7 +560,7 @@ // ReadAttr status_t -BeOSKernelVolume::ReadAttr(fs_vnode node, fs_cookie _cookie, off_t pos, +BeOSKernelVolume::ReadAttr(void* node, void* _cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead) { AttributeCookie* cookie = (AttributeCookie*)_cookie; @@ -607,7 +580,7 @@ // WriteAttr status_t -BeOSKernelVolume::WriteAttr(fs_vnode node, fs_cookie _cookie, off_t pos, +BeOSKernelVolume::WriteAttr(void* node, void* _cookie, off_t pos, const void* buffer, size_t bufferSize, size_t* bytesWritten) { AttributeCookie* cookie = (AttributeCookie*)_cookie; @@ -627,7 +600,7 @@ // ReadAttrStat status_t -BeOSKernelVolume::ReadAttrStat(fs_vnode node, fs_cookie _cookie, +BeOSKernelVolume::ReadAttrStat(void* node, void* _cookie, struct stat *st) { AttributeCookie* cookie = (AttributeCookie*)_cookie; @@ -651,8 +624,8 @@ // RenameAttr status_t -BeOSKernelVolume::RenameAttr(fs_vnode oldNode, const char* oldName, - fs_vnode newNode, const char* newName) +BeOSKernelVolume::RenameAttr(void* oldNode, const char* oldName, + void* newNode, const char* newName) { if (!fFSOps->rename_attr) return B_BAD_VALUE; @@ -664,7 +637,7 @@ // RemoveAttr status_t -BeOSKernelVolume::RemoveAttr(fs_vnode node, const char* name) +BeOSKernelVolume::RemoveAttr(void* node, const char* name) { if (!fFSOps->remove_attr) return B_BAD_VALUE; @@ -677,7 +650,7 @@ // OpenIndexDir status_t -BeOSKernelVolume::OpenIndexDir(fs_cookie *cookie) +BeOSKernelVolume::OpenIndexDir(void** cookie) { if (!fFSOps->open_indexdir) return B_BAD_VALUE; @@ -686,7 +659,7 @@ // CloseIndexDir status_t -BeOSKernelVolume::CloseIndexDir(fs_cookie cookie) +BeOSKernelVolume::CloseIndexDir(void* cookie) { if (!fFSOps->close_indexdir) return B_OK; @@ -695,7 +668,7 @@ // FreeIndexDirCookie status_t -BeOSKernelVolume::FreeIndexDirCookie(fs_cookie cookie) +BeOSKernelVolume::FreeIndexDirCookie(void* cookie) { if (!fFSOps->free_indexdircookie) return B_OK; @@ -704,7 +677,7 @@ // ReadIndexDir status_t -BeOSKernelVolume::ReadIndexDir(fs_cookie cookie, void* buffer, +BeOSKernelVolume::ReadIndexDir(void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { if (!fFSOps->read_indexdir) @@ -719,7 +692,7 @@ // RewindIndexDir status_t -BeOSKernelVolume::RewindIndexDir(fs_cookie cookie) +BeOSKernelVolume::RewindIndexDir(void* cookie) { if (!fFSOps->rewind_indexdir) return B_BAD_VALUE; @@ -774,7 +747,7 @@ // OpenQuery status_t BeOSKernelVolume::OpenQuery(const char* queryString, uint32 flags, port_id port, - uint32 token, fs_cookie *cookie) + uint32 token, void** cookie) { if (!fFSOps->open_query) return B_BAD_VALUE; @@ -784,7 +757,7 @@ // CloseQuery status_t -BeOSKernelVolume::CloseQuery(fs_cookie cookie) +BeOSKernelVolume::CloseQuery(void* cookie) { if (!fFSOps->close_query) return B_OK; @@ -793,7 +766,7 @@ // FreeQueryCookie status_t -BeOSKernelVolume::FreeQueryCookie(fs_cookie cookie) +BeOSKernelVolume::FreeQueryCookie(void* cookie) { if (!fFSOps->free_querycookie) return B_OK; @@ -802,7 +775,7 @@ // ReadQuery status_t -BeOSKernelVolume::ReadQuery(fs_cookie cookie, void* buffer, size_t bufferSize, +BeOSKernelVolume::ReadQuery(void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead) { if (!fFSOps->read_query) @@ -821,8 +794,8 @@ // _OpenAttr status_t -BeOSKernelVolume::_OpenAttr(fs_vnode node, const char* name, uint32 type, - int openMode, bool create, fs_cookie* _cookie) +BeOSKernelVolume::_OpenAttr(void* node, const char* name, uint32 type, + int openMode, bool create, void** _cookie) { // check permissions first int accessMode = open_mode_to_access(openMode) | (create ? W_OK : 0); 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-02-28 15:28:51 UTC (rev 29352) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.h 2009-02-28 16:00:09 UTC (rev 29353) @@ -3,7 +3,7 @@ #ifndef USERLAND_FS_BEOS_KERNEL_VOLUME_H #define USERLAND_FS_BEOS_KERNEL_VOLUME_H -#include "Volume.h" +#include "../Volume.h" struct beos_vnode_ops; @@ -25,110 +25,107 @@ uint32 mask); // vnodes - virtual status_t Lookup(fs_vnode dir, const char* entryName, + virtual status_t Lookup(void* dir, const char* entryName, ino_t* vnid); - virtual status_t LookupNoType(fs_vnode dir, - const char* entryName, ino_t* vnid); - // not required virtual status_t ReadVNode(ino_t vnid, bool reenter, - fs_vnode* node, int* type, uint32* flags); - virtual status_t WriteVNode(fs_vnode node, bool reenter); - virtual status_t RemoveVNode(fs_vnode node, bool reenter); + void** node, int* type, uint32* flags); + virtual status_t WriteVNode(void* node, bool reenter); + virtual status_t RemoveVNode(void* node, bool reenter); // nodes - virtual status_t IOCtl(fs_vnode node, fs_cookie cookie, + virtual status_t IOCtl(void* node, void* cookie, uint32 command, void* buffer, size_t size); - virtual status_t SetFlags(fs_vnode node, fs_cookie cookie, + virtual status_t SetFlags(void* node, void* cookie, int flags); - virtual status_t Select(fs_vnode node, fs_cookie cookie, + virtual status_t Select(void* node, void* cookie, uint8 event, selectsync* sync); - virtual status_t Deselect(fs_vnode node, fs_cookie cookie, + virtual status_t Deselect(void* node, void* cookie, uint8 event, selectsync* sync); - virtual status_t FSync(fs_vnode node); + virtual status_t FSync(void* node); - virtual status_t ReadSymlink(fs_vnode node, char* buffer, + virtual status_t ReadSymlink(void* node, char* buffer, size_t bufferSize, size_t* bytesRead); - virtual status_t CreateSymlink(fs_vnode dir, const char* name, + virtual status_t CreateSymlink(void* dir, const char* name, const char* target, int mode); - virtual status_t Link(fs_vnode dir, const char* name, - fs_vnode node); - virtual status_t Unlink(fs_vnode dir, const char* name); - virtual status_t Rename(fs_vnode oldDir, const char* oldName, - fs_vnode newDir, const char* newName); + virtual status_t Link(void* dir, const char* name, + void* node); + virtual status_t Unlink(void* dir, const char* name); + virtual status_t Rename(void* oldDir, const char* oldName, + void* newDir, const char* newName); - virtual status_t Access(fs_vnode node, int mode); - virtual status_t ReadStat(fs_vnode node, struct stat* st); - virtual status_t WriteStat(fs_vnode node, const struct stat *st, + virtual status_t Access(void* node, int mode); + virtual status_t ReadStat(void* node, struct stat* st); + virtual status_t WriteStat(void* node, const struct stat *st, uint32 mask); // files - virtual status_t Create(fs_vnode dir, const char* name, - int openMode, int mode, fs_cookie* cookie, + virtual status_t Create(void* dir, const char* name, + int openMode, int mode, void** cookie, ino_t* vnid); - virtual status_t Open(fs_vnode node, int openMode, - fs_cookie* cookie); - virtual status_t Close(fs_vnode node, fs_cookie cookie); - virtual status_t FreeCookie(fs_vnode node, fs_cookie cookie); - virtual status_t Read(fs_vnode node, fs_cookie cookie, off_t pos, + virtual status_t Open(void* node, int openMode, + void** cookie); + virtual status_t Close(void* node, void* cookie); + virtual status_t FreeCookie(void* node, void* cookie); + virtual status_t Read(void* node, void* cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead); - virtual status_t Write(fs_vnode node, fs_cookie cookie, + virtual status_t Write(void* node, void* cookie, off_t pos, const void* buffer, size_t bufferSize, size_t* bytesWritten); // directories - virtual status_t CreateDir(fs_vnode dir, const char* name, + virtual status_t CreateDir(void* dir, const char* name, int mode, ino_t *newDir); - virtual status_t RemoveDir(fs_vnode dir, const char* name); - virtual status_t OpenDir(fs_vnode node, fs_cookie* cookie); - virtual status_t CloseDir(fs_vnode node, fs_vnode cookie); - virtual status_t FreeDirCookie(fs_vnode node, fs_vnode cookie); - virtual status_t ReadDir(fs_vnode node, fs_vnode cookie, + virtual status_t RemoveDir(void* dir, const char* name); + virtual status_t OpenDir(void* node, void** cookie); + virtual status_t CloseDir(void* node, void* cookie); + virtual status_t FreeDirCookie(void* node, void* cookie); + virtual status_t ReadDir(void* node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead); - virtual status_t RewindDir(fs_vnode node, fs_vnode cookie); + virtual status_t RewindDir(void* node, void* cookie); // attribute directories - virtual status_t OpenAttrDir(fs_vnode node, fs_cookie *cookie); - virtual status_t CloseAttrDir(fs_vnode node, fs_cookie cookie); - virtual status_t FreeAttrDirCookie(fs_vnode node, - fs_cookie cookie); - virtual status_t ReadAttrDir(fs_vnode node, fs_cookie cookie, + virtual status_t OpenAttrDir(void* node, void** cookie); + virtual status_t CloseAttrDir(void* node, void* cookie); + virtual status_t FreeAttrDirCookie(void* node, + void* cookie); + virtual status_t ReadAttrDir(void* node, void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead); - virtual status_t RewindAttrDir(fs_vnode node, fs_cookie cookie); + virtual status_t RewindAttrDir(void* node, void* cookie); // attributes - virtual status_t CreateAttr(fs_vnode node, const char *name, + virtual status_t CreateAttr(void* node, const char *name, uint32 type, int openMode, - fs_cookie *cookie); - virtual status_t OpenAttr(fs_vnode node, const char *name, - int openMode, fs_cookie *cookie); - virtual status_t CloseAttr(fs_vnode node, fs_cookie cookie); - virtual status_t FreeAttrCookie(fs_vnode node, fs_cookie cookie); - virtual status_t ReadAttr(fs_vnode node, fs_cookie cookie, + void** cookie); + virtual status_t OpenAttr(void* node, const char *name, + int openMode, void** cookie); + virtual status_t CloseAttr(void* node, void* cookie); + virtual status_t FreeAttrCookie(void* node, void* cookie); + virtual status_t ReadAttr(void* node, void* cookie, off_t pos, void* buffer, size_t bufferSize, size_t* bytesRead); - virtual status_t WriteAttr(fs_vnode node, fs_cookie cookie, + virtual status_t WriteAttr(void* node, void* cookie, off_t pos, const void* buffer, size_t bufferSize, size_t* bytesWritten); - virtual status_t ReadAttrStat(fs_vnode node, fs_cookie cookie, + virtual status_t ReadAttrStat(void* node, void* cookie, struct stat *st); - virtual status_t RenameAttr(fs_vnode oldNode, - const char* oldName, fs_vnode newNode, + virtual status_t RenameAttr(void* oldNode, + const char* oldName, void* newNode, const char* newName); - virtual status_t RemoveAttr(fs_vnode node, const char* name); + virtual status_t RemoveAttr(void* node, const char* name); // indices - virtual status_t OpenIndexDir(fs_cookie *cookie); - virtual status_t CloseIndexDir(fs_cookie cookie); - virtual status_t FreeIndexDirCookie(fs_cookie cookie); - virtual status_t ReadIndexDir(fs_cookie cookie, void* buffer, + virtual status_t OpenIndexDir(void** cookie); + virtual status_t CloseIndexDir(void* cookie); + virtual status_t FreeIndexDirCookie(void* cookie); + virtual status_t ReadIndexDir(void* cookie, void* buffer, size_t bufferSize, uint32 count, uint32* countRead); [... truncated: 64 lines follow ...] From mmlr at mail.berlios.de Sat Feb 28 17:06:57 2009 From: mmlr at mail.berlios.de (mmlr at mail.berlios.de) Date: Sat, 28 Feb 2009 17:06:57 +0100 Subject: [Haiku-commits] r29354 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200902281606.n1SG6vDT017028@sheep.berlios.de> Author: mmlr Date: 2009-02-28 17:06:53 +0100 (Sat, 28 Feb 2009) New Revision: 29354 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29354&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h Log: * Check for and discard not enabled interrupts in EHCI. * Simplify acknowledging interrupts a bit. Might help with bug #2083 in case the controller would interrupt on a port change or frame list rollover even though those aren't enabled by us. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2009-02-28 16:00:09 UTC (rev 29353) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2009-02-28 16:06:53 UTC (rev 29354) @@ -795,51 +795,49 @@ acquire_spinlock(&lock); // check if any interrupt was generated - uint32 status = ReadOpReg(EHCI_USBSTS); + uint32 status = ReadOpReg(EHCI_USBSTS) & EHCI_USBSTS_INTMASK; if ((status & fEnabledInterrupts) == 0) { + if (status != 0) { + TRACE("discarding not enabled interrupts 0x%08lx\n", status); + WriteOpReg(EHCI_USBSTS, status); + } + release_spinlock(&lock); return B_UNHANDLED_INTERRUPT; } - uint32 acknowledge = 0; bool asyncAdvance = false; bool finishTransfers = false; int32 result = B_HANDLED_INTERRUPT; if (status & EHCI_USBSTS_USBINT) { TRACE("transfer finished\n"); - acknowledge |= EHCI_USBSTS_USBINT; result = B_INVOKE_SCHEDULER; finishTransfers = true; } if (status & EHCI_USBSTS_USBERRINT) { TRACE("transfer error\n"); - acknowledge |= EHCI_USBSTS_USBERRINT; result = B_INVOKE_SCHEDULER; finishTransfers = true; } - if (status & EHCI_USBSTS_PORTCHANGE) { + if (status & EHCI_USBSTS_FLROLLOVER) + TRACE("frame list rollover\n"); + + if (status & EHCI_USBSTS_PORTCHANGE) TRACE("port change detected\n"); - acknowledge |= EHCI_USBSTS_PORTCHANGE; - } if (status & EHCI_USBSTS_INTONAA) { TRACE("interrupt on async advance\n"); - acknowledge |= EHCI_USBSTS_INTONAA; asyncAdvance = true; result = B_INVOKE_SCHEDULER; } - if (status & EHCI_USBSTS_HOSTSYSERR) { + if (status & EHCI_USBSTS_HOSTSYSERR) TRACE_ERROR("host system error!\n"); - acknowledge |= EHCI_USBSTS_HOSTSYSERR; - } - if (acknowledge) - WriteOpReg(EHCI_USBSTS, acknowledge); - + WriteOpReg(EHCI_USBSTS, status); release_spinlock(&lock); if (asyncAdvance) Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h 2009-02-28 16:00:09 UTC (rev 29353) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci_hardware.h 2009-02-28 16:06:53 UTC (rev 29354) @@ -56,6 +56,7 @@ #define EHCI_USBSTS_PORTCHANGE (1 << 2) // Port Change Detected #define EHCI_USBSTS_USBERRINT (1 << 1) // USB Error Interrupt #define EHCI_USBSTS_USBINT (1 << 0) // USB Interrupt +#define EHCI_USBSTS_INTMASK 0x3f // USB Interrupt Enable Register (EHCI Spec 2.3.3) From axeld at pinc-software.de Sat Feb 28 17:10:37 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 28 Feb 2009 17:10:37 +0100 CET Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server In-Reply-To: <20090228114914.363.1@knochen-vm.localdomain> Message-ID: <21682458687-BeMail@zon> Ingo Weinhold wrote: > On 2009-02-28 at 11:25:35 [+0100], Axel D?rfler > > wrote: > > bonefish at BerliOS wrote: > > > Log: > > > Forgot to add the dummy slab implementation. > > Don't we have something like that in the libkernelemu.so already? > Now that you mention it, yeah, it does already contain the slab > functions. > So theoretically I could merge most of the UserlandFS kernel > emulation > stuff into it as well, provided that it doesn't need to work on BeOS. I would guess so. And there is already a module implementation waiting to be used, too. > I also wonder whether in some cases we could simply compile the > kernel > sources directly for userland. E.g. for the block cache I basically > only > kicked out the low resource handling stuff, which could as well be > #ifdef'ed in the kernel source or stubs provided for it in the > emulation. Indeed. The block cache test also uses the original sources directly; I guess we have mostly platform independent stuff in the kernel anyway, it might just be hard to provide the platform depending functionality (mostly VM stuff). Bye, Axel. From bonefish at mail.berlios.de Sat Feb 28 17:16:37 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 17:16:37 +0100 Subject: [Haiku-commits] r29355 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos Message-ID: <200902281616.n1SGGbi8017651@sheep.berlios.de> Author: bonefish Date: 2009-02-28 17:16:36 +0100 (Sat, 28 Feb 2009) New Revision: 29355 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29355&view=rev Added: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/fs_cache.c haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/fs_cache_priv.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/fs_interface.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/lock.h Removed: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.c haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache_priv.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_interface.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_lock.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_lock.h 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/Jamfile haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_kernel_emu.cpp Log: Renamed files (removed "beos_" prefix). 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-02-28 16:06:53 UTC (rev 29354) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp 2009-02-28 16:16:36 UTC (rev 29355) @@ -4,8 +4,8 @@ #include -#include "beos_fs_interface.h" #include "BeOSKernelVolume.h" +#include "fs_interface.h" using std::nothrow; 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-02-28 16:06:53 UTC (rev 29354) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelVolume.cpp 2009-02-28 16:16:36 UTC (rev 29355) @@ -7,12 +7,13 @@ #include #include -#include "beos_fs_interface.h" #include "Debug.h" #include "../kernel_emu.h" +#include "fs_interface.h" + using std::nothrow; static int open_mode_to_access(int openMode); 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-02-28 16:06:53 UTC (rev 29354) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/Jamfile 2009-02-28 16:16:36 UTC (rev 29355) @@ -18,10 +18,10 @@ # the library providing the BeOS kernel interface for add-ons SharedLibrary libuserlandfs_beos_kernel.so : + fs_cache.c + lock.cpp + beos_kernel_emu.cpp - - beos_fs_cache.c - beos_lock.cpp BeOSKernelFileSystem.cpp BeOSKernelVolume.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.c Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache_priv.h Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_interface.h 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-02-28 16:06:53 UTC (rev 29354) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_kernel_emu.cpp 2009-02-28 16:16:36 UTC (rev 29355) @@ -14,8 +14,8 @@ #include "../kernel_emu.h" -#include "beos_fs_cache.h" -#include "beos_lock.h" +#include "fs_cache.h" +#include "lock.h" // #pragma mark - Paths Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_lock.cpp Deleted: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_lock.h Copied: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/fs_cache.c (from rev 29344, haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.c) =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/beos_fs_cache.c 2009-02-28 11:39:46 UTC (rev 29344) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/fs_cache.c 2009-02-28 16:16:36 UTC (rev 29355) @@ -0,0 +1,2441 @@ +/* + This file contains the global device cache for the BeOS. All + file system I/O comes through here. The cache can handle blocks + of different sizes for multiple different underlying physical + devices. + + The cache is organized as a hash table (for lookups by device + and block number) and two doubly-linked lists. The normal + list is for "normal" blocks which are either clean or dirty. + The locked list is for blocks that are locked in the cache by + BFS. The lists are LRU ordered. + + Most of the work happens in the function cache_block_io() which + is quite lengthy. The other functions of interest are get_ents() + which picks victims to be kicked out of the cache; flush_ents() + which does the work of flushing them; and set_blocks_info() which + handles cloning blocks and setting callbacks so that the BFS + journal will work properly. If you want to modify this code it + will take some study but it's not too bad. Do not think about + separating the list of clean and dirty blocks into two lists as + I did that already and it's slower. + + Originally this cache code was written while listening to the album + "Ride the Lightning" by Metallica. The current version was written + while listening to "Welcome to SkyValley" by Kyuss as well as an + ambient collection on the German label FAX. Music helps a lot when + writing code. + + THIS CODE COPYRIGHT DOMINIC GIAMPAOLO. NO WARRANTY IS EXPRESSED + OR IMPLIED. YOU MAY USE THIS CODE AND FREELY DISTRIBUTE IT FOR + NON-COMMERCIAL USE AS LONG AS THIS NOTICE REMAINS ATTACHED. + + FOR COMMERCIAL USE, CONTACT DOMINIC GIAMPAOLO (dbg at be.com). + + Dominic Giampaolo + dbg at be.com +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +#include +#include + +#include "fs_cache.h" +#include "fs_cache_priv.h" +#include "lock.h" + + + +#ifndef USER +#define printf dprintf +#endif +#ifdef USER +#define kprintf printf +#endif + + +typedef off_t fs_off_t; + +/* forward prototypes */ +static int flush_ents(cache_ent **ents, int n_ents); + +//static int do_dump(int argc, char **argv); +//static int do_find_block(int argc, char **argv); +//static int do_find_data(int argc, char **argv); +//static void cache_flusher(void *arg, int phase); + + +int chatty_io = 0; + +#define CHUNK (512 * 1024) /* a hack to work around scsi driver bugs */ + +static void +beos_panic(const char *format, ...) +{ + va_list ap; + + va_start(ap, format); + vfprintf(stderr, format, ap); + va_end(ap); + + while (TRUE) + ; +} + +size_t +beos_read_phys_blocks(int fd, fs_off_t bnum, void *data, uint num_blocks, int bsize) +{ + size_t ret = 0; + size_t sum; + + if (chatty_io) + printf("R: %8Ld : %3d\n", bnum, num_blocks); + + if (num_blocks * bsize < CHUNK) + ret = read_pos(fd, bnum * bsize, data, num_blocks * bsize); + else { + for(sum=0; (sum + CHUNK) <= (num_blocks * bsize); sum += CHUNK) { + ret = read_pos(fd, (bnum * bsize) + sum, data, CHUNK); + if (ret != CHUNK) + break; + + data = (void *)((char *)data + CHUNK); + } + + if (ret == CHUNK && ((num_blocks * bsize) - sum) > 0) { + ret = read_pos(fd, (bnum * bsize) + sum, data, + (num_blocks * bsize) - sum); + + if (ret == (num_blocks * bsize) - sum) + ret = num_blocks * bsize; + } else if (ret == CHUNK) { + ret = num_blocks * bsize; + } + } + + if (ret == num_blocks * bsize) + return 0; + else + return EBADF; +} + +size_t +beos_write_phys_blocks(int fd, fs_off_t bnum, void *data, uint num_blocks, int bsize) +{ + size_t ret = 0; + size_t sum; + + if (chatty_io) + printf("W: %8Ld : %3d\n", bnum, num_blocks); + + if (num_blocks * bsize < CHUNK) + ret = write_pos(fd, bnum * bsize, data, num_blocks * bsize); + else { + for(sum=0; (sum + CHUNK) <= (num_blocks * bsize); sum += CHUNK) { + ret = write_pos(fd, (bnum * bsize) + sum, data, CHUNK); + if (ret != CHUNK) + break; + + data = (void *)((char *)data + CHUNK); + } + + if (ret == CHUNK && ((num_blocks * bsize) - sum) > 0) { + ret = write_pos(fd, (bnum * bsize) + sum, data, + (num_blocks * bsize) - sum); + + if (ret == (num_blocks * bsize) - sum) + ret = num_blocks * bsize; + } else if (ret == CHUNK) { + ret = num_blocks * bsize; + } + } + + + if (ret == num_blocks * bsize) + return 0; + else + return EBADF; +} + +// #pragma mark - + +static int +init_hash_table(hash_table *ht) +{ + ht->max = HT_DEFAULT_MAX; + ht->mask = ht->max - 1; + ht->num_elements = 0; + + ht->table = (hash_ent **)calloc(ht->max, sizeof(hash_ent *)); + if (ht->table == NULL) + return ENOMEM; + + return 0; +} + + +static void +shutdown_hash_table(hash_table *ht) +{ + int i, hash_len; + hash_ent *he, *next; + + for(i=0; i < ht->max; i++) { + he = ht->table[i]; + + for(hash_len=0; he; hash_len++, he=next) { + next = he->next; + free(he); + } + } + + if (ht->table) + free(ht->table); + ht->table = NULL; +} + +#if 0 +static void +print_hash_stats(hash_table *ht) +{ + int i, hash_len, max = -1, sum = 0; + hash_ent *he, *next; + + for(i=0; i < ht->max; i++) { + he = ht->table[i]; + + for(hash_len=0; he; hash_len++, he=next) { + next = he->next; + } + if (hash_len) + printf("bucket %3d : %3d\n", i, hash_len); + + sum += hash_len; + if (hash_len > max) + max = hash_len; + } + + printf("max # of chains: %d, average chain length %d\n", max,sum/ht->max); +} +#endif + +#define HASH(d, b) ((((fs_off_t)d) << (sizeof(fs_off_t)*8 - 6)) | (b)) + +static hash_ent * +new_hash_ent(int dev, fs_off_t bnum, void *data) +{ + hash_ent *he; + + he = (hash_ent *)malloc(sizeof(*he)); + if (he == NULL) + return NULL; + + he->hash_val = HASH(dev, bnum); + he->dev = dev; + he->bnum = bnum; + he->data = data; + he->next = NULL; + + return he; +} + + +static int +grow_hash_table(hash_table *ht) +{ + int i, omax, newsize, newmask; + fs_off_t hash; + hash_ent **new_table, *he, *next; + + if (ht->max & ht->mask) { + printf("*** hashtable size %d or mask %d looks weird!\n", ht->max, + ht->mask); + } + + omax = ht->max; + newsize = omax * 2; /* have to grow in powers of two */ + newmask = newsize - 1; + + new_table = (hash_ent **)calloc(newsize, sizeof(hash_ent *)); + if (new_table == NULL) + return ENOMEM; + + for(i=0; i < omax; i++) { + for(he=ht->table[i]; he; he=next) { + hash = he->hash_val & newmask; + next = he->next; + + he->next = new_table[hash]; + new_table[hash] = he; + } + } + + free(ht->table); + ht->table = new_table; + ht->max = newsize; + ht->mask = newmask; + + return 0; +} + + + + +static int +hash_insert(hash_table *ht, int dev, fs_off_t bnum, void *data) +{ + fs_off_t hash; + hash_ent *he, *curr; + + hash = HASH(dev, bnum) & ht->mask; + + curr = ht->table[hash]; + for(; curr != NULL; curr=curr->next) + if (curr->dev == dev && curr->bnum == bnum) + break; + + if (curr && curr->dev == dev && curr->bnum == bnum) { + printf("entry %d:%Ld already in the hash table!\n", dev, bnum); + return EEXIST; + } + + he = new_hash_ent(dev, bnum, data); + if (he == NULL) + return ENOMEM; + + he->next = ht->table[hash]; + ht->table[hash] = he; + + ht->num_elements++; + if (ht->num_elements >= ((ht->max * 3) / 4)) { + if (grow_hash_table(ht) != 0) + return ENOMEM; + } + + return 0; +} + +static void * +hash_lookup(hash_table *ht, int dev, fs_off_t bnum) +{ + hash_ent *he; + + he = ht->table[HASH(dev, bnum) & ht->mask]; + + for(; he != NULL; he=he->next) { + if (he->dev == dev && he->bnum == bnum) + break; + } + + if (he) + return he->data; + else + return NULL; +} + + +static void * +hash_delete(hash_table *ht, int dev, fs_off_t bnum) +{ + void *data; + fs_off_t hash; + hash_ent *he, *prev = NULL; + + hash = HASH(dev, bnum) & ht->mask; + he = ht->table[hash]; + + for(; he != NULL; prev=he,he=he->next) { + if (he->dev == dev && he->bnum == bnum) + break; + } + + if (he == NULL) { + printf("*** hash_delete: tried to delete non-existent block %d:%Ld\n", + dev, bnum); + return NULL; + } + + data = he->data; + + if (ht->table[hash] == he) + ht->table[hash] = he->next; + else if (prev) + prev->next = he->next; + else + beos_panic("hash table is inconsistent\n"); + + free(he); + ht->num_elements--; + + return data; +} + +// #pragma mark - + +/* + These are the global variables for the cache. +*/ +static block_cache bc; + +#define MAX_IOVECS 64 /* # of iovecs for use by cache code */ +static beos_lock iovec_lock; +static struct iovec *iovec_pool[MAX_IOVECS]; /* each ptr is to an array of iovecs */ +static int iovec_used[MAX_IOVECS]; /* non-zero == iovec is in use */ + +#define NUM_FLUSH_BLOCKS 64 /* size of the iovec array pointed by each ptr */ + + +#define DEFAULT_READ_AHEAD_SIZE (32 * 1024) +static int read_ahead_size = DEFAULT_READ_AHEAD_SIZE; + +/* this array stores the size of each device so we can error check requests */ +#define MAX_DEVICES 256 +fs_off_t max_device_blocks[MAX_DEVICES]; + + +/* has the time of the last cache access so cache flushing doesn't interfere */ +static bigtime_t last_cache_access = 0; + + +int +beos_init_block_cache(int max_blocks, int flags) +{ + memset(&bc, 0, sizeof(bc)); + memset(iovec_pool, 0, sizeof(iovec_pool)); + memset(iovec_used, 0, sizeof(iovec_used)); + memset(&max_device_blocks, 0, sizeof(max_device_blocks)); + + if (init_hash_table(&bc.ht) != 0) + return ENOMEM; + + bc.lock.s = iovec_lock.s = -1; + + bc.max_blocks = max_blocks; + bc.flags = flags; + if (beos_new_lock(&bc.lock, "bollockcache") != 0) + goto err; + + if (beos_new_lock(&iovec_lock, "iovec_lock") != 0) + goto err; + + /* allocate two of these up front so vm won't accidently re-enter itself */ + iovec_pool[0] = (struct iovec *)malloc(sizeof(struct iovec)*NUM_FLUSH_BLOCKS); + iovec_pool[1] = (struct iovec *)malloc(sizeof(struct iovec)*NUM_FLUSH_BLOCKS); + +#ifndef USER +#ifdef DEBUG + add_debugger_command("bcache", do_dump, "dump the block cache list"); + add_debugger_command("fblock", do_find_block, "find a block in the cache"); + add_debugger_command("fdata", do_find_data, "find a data block ptr in the cache"); +#endif + register_kernel_daemon(cache_flusher, NULL, 3); +#endif + + return 0; + + err: + if (bc.lock.s >= 0) + beos_free_lock(&bc.lock); + + if (iovec_lock.s >= 0) + beos_free_lock(&iovec_lock); + + shutdown_hash_table(&bc.ht); + memset((void *)&bc, 0, sizeof(bc)); + return ENOMEM; +} + + +static struct iovec * +get_iovec_array(void) +{ + int i; + struct iovec *iov; + + LOCK(iovec_lock); + + for(i=0; i < MAX_IOVECS; i++) { + if (iovec_used[i] == 0) + break; + } + + if (i >= MAX_IOVECS) /* uh-oh */ + beos_panic("cache: ran out of iovecs (pool 0x%x, used 0x%x)!\n", + &iovec_pool[0], &iovec_used[0]); + + if (iovec_pool[i] == NULL) { + iovec_pool[i] = (struct iovec *)malloc(sizeof(struct iovec)*NUM_FLUSH_BLOCKS); + if (iovec_pool == NULL) + beos_panic("can't allocate an iovec!\n"); + } + + iov = iovec_pool[i]; + iovec_used[i] = 1; + + UNLOCK(iovec_lock); + + return iov; +} + + +static void +release_iovec_array(struct iovec *iov) +{ + int i; + + LOCK(iovec_lock); + + for(i=0; i < MAX_IOVECS; i++) { + if (iov == iovec_pool[i]) + break; + } + + if (i < MAX_IOVECS) + iovec_used[i] = 0; + else /* uh-oh */ + printf("cache: released an iovec I don't own (iov %p)\n", iov); + + + UNLOCK(iovec_lock); +} + + + + +static void +real_dump_cache_list(cache_ent_list *cel) +{ + cache_ent *ce; + + kprintf("starting from LRU end:\n"); + + for (ce = cel->lru; ce; ce = ce->next) { + kprintf("ce %p dev %2d bnum %6Ld lock %d flag %d arg %p " + "clone %p\n", ce, ce->dev, ce->block_num, ce->lock, + ce->flags, ce->arg, ce->clone); + } + kprintf("MRU end\n"); +} + +static void +dump_cache_list(void) +{ + kprintf("NORMAL BLOCKS\n"); + real_dump_cache_list(&bc.normal); + + kprintf("LOCKED BLOCKS\n"); + real_dump_cache_list(&bc.locked); + + kprintf("cur blocks %d, max blocks %d ht @ %p\n", bc.cur_blocks, + bc.max_blocks, &bc.ht); +} + +#if 0 +static void +check_bcache(char *str) +{ + int count = 0; + cache_ent *ce, *prev = NULL; + + LOCK(bc.lock); + + for(ce=bc.normal.lru; ce; prev=ce, ce=ce->next) { + count++; + } + + for(ce=bc.locked.lru; ce; prev=ce, ce=ce->next) { + count++; + } + + if (count != bc.cur_blocks) { + if (count < bc.cur_blocks - 16) + beos_panic("%s: count == %d, cur_blocks %d, prev 0x%x\n", + str, count, bc.cur_blocks, prev); + else + printf("%s: count == %d, cur_blocks %d, prev 0x%x\n", + str, count, bc.cur_blocks, prev); + } + + UNLOCK(bc.lock); +} + + +static void +dump_lists(void) +{ + cache_ent *nce; + + printf("LOCKED 0x%x (tail 0x%x, head 0x%x)\n", &bc.locked, + bc.locked.lru, bc.locked.mru); + for(nce=bc.locked.lru; nce; nce=nce->next) + printf("nce @ 0x%x dev %d bnum %ld flags %d lock %d clone 0x%x func 0x%x\n", + nce, nce->dev, nce->block_num, nce->flags, nce->lock, nce->clone, + nce->func); + + printf("NORMAL 0x%x (tail 0x%x, head 0x%x)\n", &bc.normal, + bc.normal.lru, bc.normal.mru); + for(nce=bc.normal.lru; nce; nce=nce->next) + printf("nce @ 0x%x dev %d bnum %ld flags %d lock %d clone 0x%x func 0x%x\n", + nce, nce->dev, nce->block_num, nce->flags, nce->lock, nce->clone, + nce->func); +} + + +static void +check_lists(void) +{ + cache_ent *ce, *prev, *oce; + cache_ent_list *cel; + + cel = &bc.normal; + for(ce=cel->lru,prev=NULL; ce; prev=ce, ce=ce->next) { + for(oce=bc.locked.lru; oce; oce=oce->next) { + if (oce == ce) { + dump_lists(); + beos_panic("1:ce @ 0x%x is in two lists(cel 0x%x &LOCKED)\n",ce,cel); + } + } + } + if (prev && prev != cel->mru) { + dump_lists(); + beos_panic("*** last element in list != cel mru (ce 0x%x, cel 0x%x)\n", + prev, cel); + } + + cel = &bc.locked; + for(ce=cel->lru,prev=NULL; ce; prev=ce, ce=ce->next) { + for(oce=bc.normal.lru; oce; oce=oce->next) { + if (oce == ce) { + dump_lists(); + beos_panic("3:ce @ 0x%x is in two lists(cel 0x%x & DIRTY)\n",ce,cel); + } + } + } + if (prev && prev != cel->mru) { + dump_lists(); + beos_panic("*** last element in list != cel mru (ce 0x%x, cel 0x%x)\n", + prev, cel); + } +} +#endif + + +#ifdef DEBUG +#if 0 +static int +do_dump(int argc, char **argv) +{ + dump_cache_list(); + return 1; +} + + +static int +do_find_block(int argc, char **argv) +{ + int i; + fs_off_t bnum; + cache_ent *ce; + + if (argc < 2) { + kprintf("%s: needs a block # argument\n", argv[0]); + return 1; + } + + for(i=1; i < argc; i++) { + bnum = strtoul(argv[i], NULL, 0); + + for(ce=bc.normal.lru; ce; ce=ce->next) { + if (ce->block_num == bnum) { + kprintf("found clean bnum %ld @ 0x%lx (data @ 0x%lx)\n", + bnum, ce, ce->data); + } + } + + for(ce=bc.locked.lru; ce; ce=ce->next) { + if (ce->block_num == bnum) { + kprintf("found locked bnum %ld @ 0x%lx (data @ 0x%lx)\n", + bnum, ce, ce->data); + } + } + } + + return 0; +} + +static int +do_find_data(int argc, char **argv) +{ + int i; + void *data; + cache_ent *ce; + + if (argc < 2) { + kprintf("%s: needs a block # argument\n", argv[0]); + return 1; + } + + for(i=1; i < argc; i++) { + data = (void *)strtoul(argv[i], NULL, 0); + + for(ce=bc.normal.lru; ce; ce=ce->next) { + if (ce->data == data) { + kprintf("found normal data ptr for bnum %ld @ ce 0x%lx\n", + ce->block_num, ce); + } + } + + for(ce=bc.locked.lru; ce; ce=ce->next) { + if (ce->data == data) { + kprintf("found locked data ptr for bnum %ld @ ce 0x%lx\n", + ce->block_num, ce); + } + } + } + + return 0; +} +#endif +#endif /* DEBUG */ + + + +/* + this function detaches the cache_ent from the list. +*/ +static void +delete_from_list(cache_ent_list *cel, cache_ent *ce) +{ + if (ce->next) + ce->next->prev = ce->prev; + if (ce->prev) + ce->prev->next = ce->next; + + if (cel->lru == ce) + cel->lru = ce->next; + if (cel->mru == ce) + cel->mru = ce->prev; + + ce->next = NULL; + ce->prev = NULL; +} + + + +/* + this function adds the cache_ent ce to the head of the + list (i.e. the MRU end). the cache_ent should *not* + be in any lists. +*/ +static void +add_to_head(cache_ent_list *cel, cache_ent *ce) +{ +if (ce->next != NULL || ce->prev != NULL) { + beos_panic("*** ath: ce has non-null next/prev ptr (ce 0x%x nxt 0x%x, prv 0x%x)\n", + ce, ce->next, ce->prev); +} + + ce->next = NULL; + ce->prev = cel->mru; + + if (cel->mru) + cel->mru->next = ce; + cel->mru = ce; + + if (cel->lru == NULL) + cel->lru = ce; +} + + +/* + this function adds the cache_ent ce to the tail of the + list (i.e. the MRU end). the cache_ent should *not* + be in any lists. +*/ +static void +add_to_tail(cache_ent_list *cel, cache_ent *ce) +{ +if (ce->next != NULL || ce->prev != NULL) { + beos_panic("*** att: ce has non-null next/prev ptr (ce 0x%x nxt 0x%x, prv 0x%x)\n", + ce, ce->next, ce->prev); +} + + ce->next = cel->lru; + ce->prev = NULL; + + if (cel->lru) + cel->lru->prev = ce; + cel->lru = ce; + + if (cel->mru == NULL) + cel->mru = ce; +} + + +static int +cache_ent_cmp(const void *a, const void *b) +{ + fs_off_t diff; + cache_ent *p1 = *(cache_ent **)a, *p2 = *(cache_ent **)b; + + if (p1 == NULL || p2 == NULL) + beos_panic("cache_ent pointers are null?!? (a 0x%lx, b 0x%lx\n)\n", a, b); + + if (p1->dev == p2->dev) { + diff = p1->block_num - p2->block_num; + return (int)diff; + } else { + return p1->dev - p2->dev; + } +} + +#if 0 +// ToDo: add this to the fsh (as a background thread)? +static void +cache_flusher(void *arg, int phase) +{ + int i, num_ents, err; + bigtime_t now = system_time(); + static cache_ent *ce = NULL; + static cache_ent *ents[NUM_FLUSH_BLOCKS]; + + /* + if someone else was in the cache recently then just bail out so + we don't lock them out unnecessarily + */ + if ((now - last_cache_access) < 1000000) + return; + + LOCK(bc.lock); + + ce = bc.normal.lru; + + for(num_ents=0; ce && num_ents < NUM_FLUSH_BLOCKS; ce=ce->next) { + if (ce->flags & CE_BUSY) + continue; + + if ((ce->flags & CE_DIRTY) == 0 && ce->clone == NULL) + continue; + + ents[num_ents] = ce; + ents[num_ents]->flags |= CE_BUSY; + num_ents++; + } + + /* if we've got some room left over, look for cloned locked blocks */ + if (num_ents < NUM_FLUSH_BLOCKS) { + ce = bc.locked.lru; + + for(; num_ents < NUM_FLUSH_BLOCKS;) { + for(; + ce && ((ce->flags & CE_BUSY) || ce->clone == NULL); + ce=ce->next) + /* skip ents that meet the above criteria */; + + if (ce == NULL) + break; + + ents[num_ents] = ce; + ents[num_ents]->flags |= CE_BUSY; + ce = ce->next; + num_ents++; + } + } + + UNLOCK(bc.lock); + + if (num_ents == 0) + return; + + qsort(ents, num_ents, sizeof(cache_ent **), cache_ent_cmp); + + if ((err = flush_ents(ents, num_ents)) != 0) { + printf("flush ents failed (ents @ 0x%lx, num_ents %d!\n", + (ulong)ents, num_ents); + } + + for(i=0; i < num_ents; i++) { /* clear the busy bit on each of ent */ + ents[i]->flags &= ~CE_BUSY; + } +} +#endif + + +static int +flush_cache_ent(cache_ent *ce) +{ + int ret = 0; + void *data; + + /* if true, then there's nothing to flush */ + if ((ce->flags & CE_DIRTY) == 0 && ce->clone == NULL) + return 0; + + /* same thing here */ + if (ce->clone == NULL && ce->lock != 0) + return 0; + + restart: + if (ce->clone) + data = ce->clone; + else + data = ce->data; + + if (chatty_io > 2) printf("flush: %7Ld\n", ce->block_num); + ret = beos_write_phys_blocks(ce->dev, ce->block_num, data, 1, ce->bsize); + + if (ce->func) { + ce->func(ce->logged_bnum, 1, ce->arg); + ce->func = NULL; + } + + if (ce->clone) { + free(ce->clone); + ce->clone = NULL; + + if (ce->lock == 0 && (ce->flags & CE_DIRTY)) + goto restart; /* also write the real data ptr */ + } else { + ce->flags &= ~CE_DIRTY; + } + + return ret; +} [... truncated: 1680 lines follow ...] From ingo_weinhold at gmx.de Sat Feb 28 18:19:48 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 28 Feb 2009 18:19:48 +0100 Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server In-Reply-To: <21682458687-BeMail@zon> References: <21682458687-BeMail@zon> Message-ID: <20090228181948.487.2@knochen-vm.localdomain> On 2009-02-28 at 17:10:37 [+0100], Axel D?rfler wrote: > Ingo Weinhold wrote: > > On 2009-02-28 at 11:25:35 [+0100], Axel D?rfler > > > wrote: > > > bonefish at BerliOS wrote: > > > > Log: > > > > Forgot to add the dummy slab implementation. > > > Don't we have something like that in the libkernelemu.so already? > > Now that you mention it, yeah, it does already contain the slab > > functions. > > So theoretically I could merge most of the UserlandFS kernel > > emulation > > stuff into it as well, provided that it doesn't need to work on BeOS. > > I would guess so. And there is already a module implementation waiting > to be used, too. I don't really need that ATM. At least not until encountering a FS that wants to load other modules. > > I also wonder whether in some cases we could simply compile the > > kernel > > sources directly for userland. E.g. for the block cache I basically > > only > > kicked out the low resource handling stuff, which could as well be > > #ifdef'ed in the kernel source or stubs provided for it in the > > emulation. > > Indeed. The block cache test also uses the original sources directly; I > guess we have mostly platform independent stuff in the kernel anyway, > it might just be hard to provide the platform depending functionality > (mostly VM stuff). The question is in what direction we want to develop the libkernelemu.so -- just keep it simple and provide a few kernel interfaces or emulate a complete kernel. In the latter case we'd probably want to use as much of the kernel source as possible directly an only replace low level/privileged code. CU, Ingo From revol at free.fr Sat Feb 28 18:42:31 2009 From: revol at free.fr (=?utf-8?q?Fran=C3=A7ois?= Revol) Date: Sat, 28 Feb 2009 18:42:31 +0100 CET Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server In-Reply-To: <20090228181948.487.2@knochen-vm.localdomain> Message-ID: <8039469867-BeMail@laptop> > > > Now that you mention it, yeah, it does already contain the slab > > > functions. > > > So theoretically I could merge most of the UserlandFS kernel > > > emulation > > > stuff into it as well, provided that it doesn't need to work on > > > BeOS. > > > > I would guess so. And there is already a module implementation > > waiting > > to be used, too. > > I don't really need that ATM. At least not until encountering a FS > that > wants to load other modules. I could use it in googlefs, but when building for userland it would just use regular socket calls anyway. Fran?ois. From bonefish at mail.berlios.de Sat Feb 28 19:50:41 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 19:50:41 +0100 Subject: [Haiku-commits] r29356 - in haiku/trunk: headers/private/libroot headers/private/runtime_loader src/system/libroot/os src/system/runtime_loader Message-ID: <200902281850.n1SIofef009126@sheep.berlios.de> Author: bonefish Date: 2009-02-28 19:50:40 +0100 (Sat, 28 Feb 2009) New Revision: 29356 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29356&view=rev Added: haiku/trunk/headers/private/libroot/image_private.h Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h haiku/trunk/src/system/libroot/os/image.cpp haiku/trunk/src/system/runtime_loader/elf.cpp haiku/trunk/src/system/runtime_loader/runtime_loader_private.h Log: Added private get_image_symbol_etc() that can recursively search for a symbol (similar to how dlsym() works). Added: haiku/trunk/headers/private/libroot/image_private.h =================================================================== --- haiku/trunk/headers/private/libroot/image_private.h 2009-02-28 16:16:36 UTC (rev 29355) +++ haiku/trunk/headers/private/libroot/image_private.h 2009-02-28 18:50:40 UTC (rev 29356) @@ -0,0 +1,21 @@ +/* + * Copyright 2009, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _LIBROOT_IMAGE_PRIVATE_H +#define _LIBROOT_IMAGE_PRIVATE_H + +#include + +#include + + +__BEGIN_DECLS + +status_t get_image_symbol_etc(image_id id, char const* symbolName, + int32 symbolType, bool recursive, image_id* _inImage, void** _location); + +__END_DECLS + + +#endif // _LIBROOT_IMAGE_PRIVATE_H Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h =================================================================== --- haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2009-02-28 16:16:36 UTC (rev 29355) +++ haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2009-02-28 18:50:40 UTC (rev 29356) @@ -28,7 +28,7 @@ image_id (*load_library)(char const *path, uint32 flags, void **_handle); status_t (*unload_library)(void* handle); status_t (*get_image_symbol)(image_id imageID, char const *symbolName, - int32 symbolType, void **_location); + int32 symbolType, bool recursive, image_id *_inImage, void **_location); status_t (*get_library_symbol)(void* handle, void* caller, const char* symbolName, void **_location); status_t (*get_nth_image_symbol)(image_id imageID, int32 num, char *symbolName, Modified: haiku/trunk/src/system/libroot/os/image.cpp =================================================================== --- haiku/trunk/src/system/libroot/os/image.cpp 2009-02-28 16:16:36 UTC (rev 29355) +++ haiku/trunk/src/system/libroot/os/image.cpp 2009-02-28 18:50:40 UTC (rev 29356) @@ -3,19 +3,20 @@ * Distributed under the terms of the MIT License. */ +#include +#include +#include +#include + +#include + #include #include #include #include -#include -#include -#include -#include - - thread_id load_image(int32 argCount, const char **args, const char **environ) { @@ -81,13 +82,24 @@ status_t -get_image_symbol(image_id id, char const *symbolName, int32 symbolType, void **_location) +get_image_symbol(image_id id, char const *symbolName, int32 symbolType, + void **_location) { - return __gRuntimeLoader->get_image_symbol(id, symbolName, symbolType, _location); + return __gRuntimeLoader->get_image_symbol(id, symbolName, symbolType, + false, NULL, _location); } status_t +get_image_symbol_etc(image_id id, char const *symbolName, int32 symbolType, + bool recursive, image_id *_inImage, void **_location) +{ + return __gRuntimeLoader->get_image_symbol(id, symbolName, symbolType, + recursive, _inImage, _location); +} + + +status_t get_nth_image_symbol(image_id id, int32 num, char *nameBuffer, int32 *_nameLength, int32 *_symbolType, void **_location) { Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2009-02-28 16:16:36 UTC (rev 29355) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2009-02-28 18:50:40 UTC (rev 29356) @@ -2421,7 +2421,7 @@ status_t get_symbol(image_id imageID, char const *symbolName, int32 symbolType, - void **_location) + bool recursive, image_id *_inImage, void **_location) { status_t status = B_OK; image_t *image; @@ -2436,9 +2436,17 @@ // get the image from those who have been already initialized image = find_loaded_image_by_id(imageID); - if (image != NULL) - status = find_symbol(image, symbolName, symbolType, _location); - else + if (image != NULL) { + if (recursive) { + // breadth-first search in the given image and its dependencies + status = find_symbol_breadth_first(image, symbolName, symbolType, + &image, _location); + } else + status = find_symbol(image, symbolName, symbolType, _location); + + if (status == B_OK && _inImage != NULL) + *_inImage = image->id; + } else status = B_BAD_IMAGE_ID; rld_unlock(); Modified: haiku/trunk/src/system/runtime_loader/runtime_loader_private.h =================================================================== --- haiku/trunk/src/system/runtime_loader/runtime_loader_private.h 2009-02-28 16:16:36 UTC (rev 29355) +++ haiku/trunk/src/system/runtime_loader/runtime_loader_private.h 2009-02-28 18:50:40 UTC (rev 29356) @@ -35,7 +35,7 @@ status_t get_nth_symbol(image_id imageID, int32 num, char *nameBuffer, int32 *_nameLength, int32 *_type, void **_location); status_t get_symbol(image_id imageID, char const *symbolName, int32 symbolType, - void **_location); + bool recursive, image_id *_inImage, void **_location); status_t get_library_symbol(void* handle, void* caller, const char* symbolName, void **_location); status_t get_next_image_dependency(image_id id, uint32 *cookie, From bonefish at mail.berlios.de Sat Feb 28 19:51:23 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 19:51:23 +0100 Subject: [Haiku-commits] r29357 - haiku/trunk/headers/private/userlandfs/private Message-ID: <200902281851.n1SIpNOf009179@sheep.berlios.de> Author: bonefish Date: 2009-02-28 19:51:23 +0100 (Sat, 28 Feb 2009) New Revision: 29357 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29357&view=rev Modified: haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h Log: Missed to check this in earlier. Modified: haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h =================================================================== --- haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h 2009-02-28 18:50:40 UTC (rev 29356) +++ haiku/trunk/headers/private/userlandfs/private/FSCapabilities.h 2009-02-28 18:51:23 UTC (rev 29357) @@ -222,5 +222,7 @@ } // namespace UserlandFSUtil using UserlandFSUtil::FSCapabilities; +using UserlandFSUtil::FSVolumeCapabilities; +using UserlandFSUtil::FSVNodeCapabilities; #endif // USERLAND_FS_FS_CAPABILITIES_H From bonefish at mail.berlios.de Sat Feb 28 19:52:37 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 19:52:37 +0100 Subject: [Haiku-commits] r29358 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku Message-ID: <200902281852.n1SIqb1S009277@sheep.berlios.de> Author: bonefish Date: 2009-02-28 19:52:36 +0100 (Sat, 28 Feb 2009) New Revision: 29358 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29358&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp Log: * Fixed get_vnode() signature. * Added simple get_default_partition_content_name(). 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-02-28 18:51:23 UTC (rev 29357) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/haiku_kernel_emu.cpp 2009-02-28 18:52:36 UTC (rev 29358) @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -159,7 +160,7 @@ // get_vnode status_t -get_vnode(fs_volume *_volume, ino_t vnodeID, fs_vnode *privateNode) +get_vnode(fs_volume *_volume, ino_t vnodeID, void **privateNode) { HaikuKernelVolume* volume = HaikuKernelVolume::GetVolume(_volume); @@ -170,7 +171,7 @@ if (error != B_OK) return error; - *privateNode = *(HaikuKernelNode*)foundNode; + *privateNode = ((HaikuKernelNode*)foundNode)->private_node; return B_OK; } @@ -229,6 +230,20 @@ } +// #pragma mark - Disk Device Manager + + +// get_default_partition_content_name +status_t +get_default_partition_content_name(partition_id partitionID, + const char* fileSystemName, char* buffer, size_t bufferSize) +{ + // TODO: Improve! + snprintf(buffer, bufferSize, "%s Volume", fileSystemName); + return B_OK; +} + + // #pragma mark - VFS private From bonefish at mail.berlios.de Sat Feb 28 19:56:36 2009 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 28 Feb 2009 19:56:36 +0100 Subject: [Haiku-commits] r29359 - in haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server: . beos haiku Message-ID: <200902281856.n1SIuaLv009582@sheep.berlios.de> Author: bonefish Date: 2009-02-28 19:56:35 +0100 (Sat, 28 Feb 2009) New Revision: 29359 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29359&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.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/BeOSKernelFileSystem.cpp haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.cpp Log: Moved the creation and initialization of the FileSystem subclass instance into the FS interface specific libraries, thus making the server completely independent of those. 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-02-28 18:52:36 UTC (rev 29358) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/FileSystem.h 2009-02-28 18:56:35 UTC (rev 29359) @@ -4,7 +4,8 @@ #define USERLAND_FS_FILE_SYSTEM_H #include -#include +#include +#include #include "FSCapabilities.h" @@ -35,4 +36,9 @@ using UserlandFS::FileSystem; + +// implemented by the interface implementations +extern "C" status_t userlandfs_create_file_system(const char* fsName, + image_id image, FileSystem** _fileSystem); + #endif // USERLAND_FS_FILE_SYSTEM_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-02-28 18:52:36 UTC (rev 29358) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/Jamfile 2009-02-28 18:56:35 UTC (rev 29359) @@ -5,6 +5,7 @@ local userlandFSIncludes = [ PrivateHeaders userlandfs ] ; SubDirSysHdrs [ FDirName $(userlandFSIncludes) ] ; +UsePrivateHeaders libroot ; SubDirHdrs [ FDirName $(userlandFSIncludes) private ] ; SubDirHdrs [ FDirName $(userlandFSIncludes) shared ] ; 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-02-28 18:52:36 UTC (rev 29358) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.cpp 2009-02-28 18:56:35 UTC (rev 29359) @@ -13,6 +13,8 @@ #include #include +#include + #include "AutoDeleter.h" #include "AutoLocker.h" #include "Compatibility.h" @@ -23,20 +25,9 @@ #include "RequestThread.h" #include "ServerDefs.h" -#if 0 -#include "beos_fs_cache.h" -#include "beos_fs_interface.h" -#include "BeOSKernelFileSystem.h" -#include "haiku_block_cache.h" -#include "haiku_condition_variable.h" -#include "haiku_fs_cache.h" -#include "HaikuKernelFileSystem.h" -#endif - static const int32 kRequestThreadCount = 10; -static const int32 kMaxBlockCacheBlocks = 16384; // constructor UserlandFSServer::UserlandFSServer(const char* signature) @@ -44,8 +35,7 @@ fAddOnImage(-1), fFileSystem(NULL), fNotificationRequestPort(NULL), - fRequestThreads(NULL), - fBlockCacheInitialized(false) + fRequestThreads(NULL) { } @@ -61,11 +51,6 @@ } delete fNotificationRequestPort; delete fFileSystem; -// TODO:... -#if 0 - if (fBlockCacheInitialized) - beos_shutdown_block_cache(); -#endif if (fAddOnImage >= 0) unload_add_on(fAddOnImage); } @@ -91,17 +76,21 @@ if (fAddOnImage < 0) RETURN_ERROR(fAddOnImage); + // Get the FS creation function -- the add-on links against one of our + // libraries exporting that function, so we search recursively. + union { + void* address; + status_t (*function)(const char*, image_id, FileSystem**); + } createFSFunction; + error = get_image_symbol_etc(fAddOnImage, "userlandfs_create_file_system", + B_SYMBOL_TYPE_TEXT, true, NULL, &createFSFunction.address); + if (error != B_OK) + RETURN_ERROR(error); + // create the FileSystem interface - // BeOS kernel interface - if (_CreateBeOSKernelInterface(fileSystem, fAddOnImage, &fFileSystem) - == B_OK) { - // BeOS interface - } else if (_CreateHaikuKernelInterface(fileSystem, fAddOnImage, - &fFileSystem) == B_OK) { - // Haiku interface - } else { - ERROR(("Add-on doesn't has a supported interface.\n")); - } + error = createFSFunction.function(fileSystem, fAddOnImage, &fFileSystem); + if (error != B_OK) + RETURN_ERROR(error); // create the notification request port fNotificationRequestPort = new(nothrow) RequestPort(kRequestPortSize); @@ -211,110 +200,3 @@ } return error; } - -// _CreateBeOSKernelInterface -status_t -UserlandFSServer::_CreateBeOSKernelInterface(const char* fsName, image_id image, - FileSystem** _fileSystem) -{ -// TODO: Implement! -#if 0 - // get the symbols "fs_entry" and "api_version" - beos_vnode_ops* fsOps; - status_t error = get_image_symbol(image, "fs_entry", B_SYMBOL_TYPE_DATA, - (void**)&fsOps); - if (error != B_OK) - RETURN_ERROR(error); - int32* apiVersion; - error = get_image_symbol(image, "api_version", B_SYMBOL_TYPE_DATA, - (void**)&apiVersion); - if (error != B_OK) - RETURN_ERROR(error); - - // check api version - if (*apiVersion != BEOS_FS_API_VERSION) - RETURN_ERROR(B_ERROR); - - // create the file system - BeOSKernelFileSystem* fileSystem = new(nothrow) BeOSKernelFileSystem(fsOps); - if (!fileSystem) - RETURN_ERROR(B_NO_MEMORY); - ObjectDeleter fsDeleter(fileSystem); - - // init the block cache - error = beos_init_block_cache(kMaxBlockCacheBlocks, 0); - if (error != B_OK) - RETURN_ERROR(error); - fBlockCacheInitialized = true; - - // everything went fine - fsDeleter.Detach(); - *_fileSystem = fileSystem; - return B_OK; -#endif - return B_ERROR; -} - -// _CreateHaikuKernelInterface -status_t -UserlandFSServer::_CreateHaikuKernelInterface(const char* fsName, - image_id image, FileSystem** _fileSystem) -{ -// TODO: Implement! -#if 0 - // get the modules - module_info** modules; - status_t error = get_image_symbol(image, "modules", B_SYMBOL_TYPE_DATA, - (void**)&modules); - if (error != B_OK) - RETURN_ERROR(error); - - // module name must match "file_systems//v1" - char moduleName[B_PATH_NAME_LENGTH]; - snprintf(moduleName, sizeof(moduleName), "file_systems/%s/v1", fsName); - - // find the module - file_system_module_info* module = NULL; - for (int32 i = 0; modules[i]->name; i++) { - if (strcmp(modules[i]->name, moduleName) == 0) { - module = (file_system_module_info*)modules[i]; - break; - } - } - if (!module) - RETURN_ERROR(B_ERROR); - - // create the file system - HaikuKernelFileSystem* fileSystem - = new(nothrow) HaikuKernelFileSystem(module); - if (!fileSystem) - RETURN_ERROR(B_NO_MEMORY); - ObjectDeleter fsDeleter(fileSystem); - - // init condition variables - error = UserlandFS::HaikuKernelEmu::condition_variable_init(); - if (error != B_OK) - RETURN_ERROR(error); - - // init block cache - error = UserlandFS::HaikuKernelEmu::block_cache_init(); - if (error != B_OK) - RETURN_ERROR(error); - - // init file cache - error = UserlandFS::HaikuKernelEmu::file_cache_init(); - if (error != B_OK) - RETURN_ERROR(error); - - // init the FS - error = fileSystem->Init(); - if (error != B_OK) - return error; - - // everything went fine - fsDeleter.Detach(); - *_fileSystem = fileSystem; - return B_OK; -#endif - return B_ERROR; -} 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-02-28 18:52:36 UTC (rev 29358) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/UserlandFSServer.h 2009-02-28 18:56:35 UTC (rev 29359) @@ -28,17 +28,12 @@ private: status_t _RegisterWithDispatcher(const char* fsName); - status_t _CreateBeOSKernelInterface(const char* fsName, - image_id image, FileSystem** fileSystem); - status_t _CreateHaikuKernelInterface(const char* fsName, - image_id image, FileSystem** fileSystem); private: image_id fAddOnImage; FileSystem* fFileSystem; RequestPort* fNotificationRequestPort; RequestThread* fRequestThreads; - bool fBlockCacheInitialized; }; } // namespace UserlandFS 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-02-28 18:52:36 UTC (rev 29358) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.cpp 2009-02-28 18:56:35 UTC (rev 29359) @@ -5,23 +5,46 @@ #include #include "BeOSKernelVolume.h" +#include "fs_cache.h" #include "fs_interface.h" -using std::nothrow; +static const int32 kMaxBlockCacheBlocks = 16384; + + // constructor BeOSKernelFileSystem::BeOSKernelFileSystem(beos_vnode_ops* fsOps) - : FileSystem(), - fFSOps(fsOps) + : + FileSystem(), + fFSOps(fsOps), + fBlockCacheInitialized(false) { _InitCapabilities(); } + // destructor BeOSKernelFileSystem::~BeOSKernelFileSystem() { + if (fBlockCacheInitialized) + beos_shutdown_block_cache(); } + +// Init +status_t +BeOSKernelFileSystem::Init() +{ + // init the block cache + status_t error = beos_init_block_cache(kMaxBlockCacheBlocks, 0); + if (error != B_OK) + RETURN_ERROR(error); + + fBlockCacheInitialized = true; + return B_OK; +} + + // CreateVolume status_t BeOSKernelFileSystem::CreateVolume(Volume** volume, dev_t id) @@ -31,7 +54,7 @@ return B_BAD_VALUE; // create the volume - *volume = new(nothrow) BeOSKernelVolume(this, id, fFSOps); + *volume = new(std::nothrow) BeOSKernelVolume(this, id, fFSOps); if (!*volume) return B_NO_MEMORY; return B_OK; @@ -181,3 +204,43 @@ fNodeCapabilities.Set(FS_VNODE_CAPABILITY_RENAME_ATTR, fFSOps->rename_attr); fNodeCapabilities.Set(FS_VNODE_CAPABILITY_REMOVE_ATTR, fFSOps->remove_attr); } + + +// #pragma mark - bootstrapping + + +status_t +userlandfs_create_file_system(const char* fsName, image_id image, + FileSystem** _fileSystem) +{ + // get the symbols "fs_entry" and "api_version" + beos_vnode_ops* fsOps; + status_t error = get_image_symbol(image, "fs_entry", B_SYMBOL_TYPE_DATA, + (void**)&fsOps); + if (error != B_OK) + RETURN_ERROR(error); + int32* apiVersion; + error = get_image_symbol(image, "api_version", B_SYMBOL_TYPE_DATA, + (void**)&apiVersion); + if (error != B_OK) + RETURN_ERROR(error); + + // check api version + if (*apiVersion != BEOS_FS_API_VERSION) + RETURN_ERROR(B_ERROR); + + // create the file system + BeOSKernelFileSystem* fileSystem + = new(std::nothrow) BeOSKernelFileSystem(fsOps); + if (!fileSystem) + RETURN_ERROR(B_NO_MEMORY); + + error = fileSystem->Init(); + if (error != B_OK) { + delete fileSystem; + return error; + } + + *_fileSystem = fileSystem; + return B_OK; +} Modified: haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h 2009-02-28 18:52:36 UTC (rev 29358) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/beos/BeOSKernelFileSystem.h 2009-02-28 18:56:35 UTC (rev 29359) @@ -14,6 +14,8 @@ BeOSKernelFileSystem(beos_vnode_ops* fsOps); virtual ~BeOSKernelFileSystem(); + status_t Init(); + virtual status_t CreateVolume(Volume** volume, dev_t id); virtual status_t DeleteVolume(Volume* volume); @@ -31,6 +33,7 @@ beos_vnode_ops* fFSOps; FSVolumeCapabilities fVolumeCapabilities; FSVNodeCapabilities fNodeCapabilities; + bool fBlockCacheInitialized; }; } // namespace UserlandFS 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-02-28 18:52:36 UTC (rev 29358) +++ haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server/haiku/HaikuKernelFileSystem.cpp 2009-02-28 18:56:35 UTC (rev 29359) @@ -2,13 +2,16 @@ #include "HaikuKernelFileSystem.h" +#include + #include #include +#include "block_cache.h" +#include "condition_variable.h" #include "HaikuKernelVolume.h" -using std::nothrow; // constructor HaikuKernelFileSystem::HaikuKernelFileSystem(file_system_module_info* fsModule) @@ -24,16 +27,34 @@ // call the kernel module uninitialization if (fFSModule->info.std_ops) fFSModule->info.std_ops(B_MODULE_UNINIT); + +// TODO: Call the cleanup methods (condition vars, block cache)! } // Init status_t HaikuKernelFileSystem::Init() { - // call the kernel module initialization + // init condition variables + status_t error = condition_variable_init(); + if (error != B_OK) + RETURN_ERROR(error); +// TODO: Call the cleanup methods, if something goes wrong! + + // init block cache + error = block_cache_init(); + if (error != B_OK) + RETURN_ERROR(error); + + // call the kernel module initialization (if any) if (!fFSModule->info.std_ops) return B_OK; - return fFSModule->info.std_ops(B_MODULE_INIT); + + error = fFSModule->info.std_ops(B_MODULE_INIT); + if (error != B_OK) + RETURN_ERROR(error); + + return B_OK; } // CreateVolume @@ -45,7 +66,7 @@ return B_BAD_VALUE; // create the volume - *volume = new(nothrow) HaikuKernelVolume(this, id, fFSModule); + *volume = new(std::nothrow) HaikuKernelVolume(this, id, fFSModule); if (!*volume) return B_NO_MEMORY; return B_OK; @@ -73,3 +94,49 @@ // FS operations fCapabilities.Set(FS_CAPABILITY_MOUNT, fFSModule->mount); } + + +// #pragma mark - bootstrapping + + +status_t +userlandfs_create_file_system(const char* fsName, image_id image, + FileSystem** _fileSystem) +{ + // get the modules + module_info** modules; + status_t error = get_image_symbol(image, "modules", B_SYMBOL_TYPE_DATA, + (void**)&modules); + if (error != B_OK) + RETURN_ERROR(error); + + // module name must match "file_systems//v1" + char moduleName[B_PATH_NAME_LENGTH]; + snprintf(moduleName, sizeof(moduleName), "file_systems/%s/v1", fsName); + + // find the module + file_system_module_info* module = NULL; + for (int32 i = 0; modules[i]->name; i++) { + if (strcmp(modules[i]->name, moduleName) == 0) { + module = (file_system_module_info*)modules[i]; + break; + } + } + if (!module) + RETURN_ERROR(B_ERROR); + + // create the file system + HaikuKernelFileSystem* fileSystem + = new(std::nothrow) HaikuKernelFileSystem(module); + if (!fileSystem) + RETURN_ERROR(B_NO_MEMORY); + + error = fileSystem->Init(); + if (error != B_OK) { + delete fileSystem; + return error; + } + + *_fileSystem = fileSystem; + return B_OK; +} From axeld at pinc-software.de Sat Feb 28 19:56:51 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 28 Feb 2009 19:56:51 +0100 CET Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server In-Reply-To: <8039469867-BeMail@laptop> Message-ID: <31657057185-BeMail@zon> "Fran?ois Revol" wrote: > > > I would guess so. And there is already a module implementation > > > waiting to be used, too. > > I don't really need that ATM. At least not until encountering a FS > > that wants to load other modules. > I could use it in googlefs, but when building for userland it would > just use regular socket calls anyway. Even if you didn't notice it yet, Haiku has regular socket calls in the kernel, too :-) Bye, Axel. From ingo_weinhold at gmx.de Sat Feb 28 19:58:48 2009 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 28 Feb 2009 19:58:48 +0100 Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server In-Reply-To: <8039469867-BeMail@laptop> References: <8039469867-BeMail@laptop> Message-ID: <20090228195848.550.3@knochen-vm.localdomain> On 2009-02-28 at 18:42:31 [+0100], Fran?ois Revol wrote: > > > > Now that you mention it, yeah, it does already contain the slab > > > > functions. > > > > So theoretically I could merge most of the UserlandFS kernel > > > > emulation > > > > stuff into it as well, provided that it doesn't need to work on > > > > BeOS. > > > > > > I would guess so. And there is already a module implementation > > > waiting > > > to be used, too. > > > > I don't really need that ATM. At least not until encountering a FS > > that > > wants to load other modules. > > I could use it in googlefs, but when building for userland it would > just use regular socket calls anyway. In Haiku you can use them in the kernel just as well. :-) CU, Ingo From axeld at pinc-software.de Sat Feb 28 20:29:01 2009 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 28 Feb 2009 20:29:01 +0100 CET Subject: [Haiku-commits] r29343 - haiku/trunk/src/add-ons/kernel/file_systems/userlandfs/server In-Reply-To: <20090228181948.487.2@knochen-vm.localdomain> Message-ID: <33587186354-BeMail@zon> Ingo Weinhold wrote: > > Indeed. The block cache test also uses the original sources > > directly; I > > guess we have mostly platform independent stuff in the kernel > > anyway, > > it might just be hard to provide the platform depending > > functionality > > (mostly VM stuff). > The question is in what direction we want to develop the > libkernelemu.so -- > just keep it simple and provide a few kernel interfaces or emulate a > complete kernel. In the latter case we'd probably want to use as much > of > the kernel source as possible directly an only replace low level/ > privileged > code. I'm not really sure why we should emulate a complete kernel with it. If it's for testing, then I guess porting the kernel to a userland app that will run on Haiku sounds nicer (but could also be a lot of work, depending on how many userland services one would want to run on top of that). Bye, Axel. From anevilyak at mail.berlios.de Sat Feb 28 20:59:17 2009 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 28 Feb 2009 20:59:17 +0100 Subject: [Haiku-commits] r29360 - haiku/trunk/src/kits/interface Message-ID: <200902281959.n1SJxHfi013979@sheep.berlios.de> Author: anevilyak Date: 2009-02-28 20:59:16 +0100 (Sat, 28 Feb 2009) New Revision: 29360 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29360&view=rev Modified: haiku/trunk/src/kits/interface/TextControl.cpp Log: Prevent BTextControl from eating scripting messages it doesn't handle (though it doesn't currently handle any). Updated TODO note to clarify this. Fixes ticket #3494. Modified: haiku/trunk/src/kits/interface/TextControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextControl.cpp 2009-02-28 18:56:35 UTC (rev 29359) +++ haiku/trunk/src/kits/interface/TextControl.cpp 2009-02-28 19:59:16 UTC (rev 29360) @@ -547,8 +547,12 @@ switch(msg->what) { case B_SET_PROPERTY: case B_GET_PROPERTY: - // TODO - break; + // TODO: implement these. + + // fall through and pass to BControl + // until implemented - note that we will still + // need to pass these up the chain for any scripting + // messages we don't handle ourselves regardless. default: BControl::MessageReceived(msg); break; From oruizdorantes at mail.berlios.de Sat Feb 28 21:48:28 2009 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Sat, 28 Feb 2009 21:48:28 +0100 Subject: [Haiku-commits] r29361 - haiku/trunk/src/preferences/bluetooth Message-ID: <200902282048.n1SKmSr5020353@sheep.berlios.de> Author: oruizdorantes Date: 2009-02-28 21:48:27 +0100 (Sat, 28 Feb 2009) New Revision: 29361 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=29361&view=rev Modified: haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp haiku/trunk/src/preferences/bluetooth/BluetoothMain.h haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp 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 haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h haiku/trunk/src/preferences/bluetooth/defs.h Log: - Implement a suitable BListItem(me) for bluetooth Devices - Add functionality to the Menu starting or shutting down the server(Monni) - Add the desired device after the inquiry to the RemoveDevices List (Monni & me) Modified: haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/BluetoothMain.cpp 2009-02-28 20:48:27 UTC (rev 29361) @@ -24,45 +24,48 @@ BluetoothApplication::AboutRequested() { - (new BAlert("about", "Haiku Bluetooth System, (ARCE) - -Created by Oliver Ruiz Dorantes - -With support of: - - Mika Lindqvist - - Maksym Yevmenkin - -Thanks to the individuals who helped... - -Shipping/donating hardware: - - Henry Jair Abril Florez(el Colombian) - & Stefanie Bartolich - - Dennis d'Entremont - - Luroh - - Pieter Panman - -Economically: - - Karl von Dorf, Andrea Bernardi (OSDrawer), - - Matt M, Doug F, Hubert H, - - Sebastian B, Andrew M, Jared E, - - Frederik H, Tom S, Ferry B, - - Greg G, David F, Richard S, Martin W: - -With patches: - - Fredrik Ekdahl - - Andreas F?rber - -Testing: - - Petter H. Juliussen - - Raynald Lesieur - - Adrien Destugues - - J?rg Meyer + (new BAlert("about", "Haiku Bluetooth System, (ARCE)\n\n" + "Created by Oliver Ruiz Dorantes\n\n" + "With support of:\n" + " - Mika Lindqvist\n" + " - Maksym Yevmenkin\n\n" + "Thanks to the individuals who helped...\n\n" + "Shipping/donating hardware:\n" + " - Henry Jair Abril Florez(el Colombian)\n" + " & Stefanie Bartolich\n" + " - Dennis d'Entremont\n" + " - Luroh\n" + " - Pieter Panman\n\n" + "Economically:\n" + " - Karl von Dorf, Andrea Bernardi (OSDrawer),\n" + " - Matt M, Doug F, Hubert H,\n" + " - Sebastian B, Andrew M, Jared E,\n" + " - Frederik H, Tom S, Ferry B,\n" + " - Greg G, David F, Richard S, Martin W:\n\n" + "With patches:\n" + " - Fredrik Ekdahl\n" + " - Andreas F?rber\n\n" + "Testing:\n" + " - Petter H. Juliussen\n" + " - Raynald Lesieur\n" + " - Adrien Destugues\n" + " - J?rg Meyer\n\n" + "Who gave me all the knowledge:\n" + " - the yellowTAB team", "OK"))->Go(); -Who gave me all the knowledge: - - the yellowTAB team", "OK"))->Go(); - } +void +BluetoothApplication::MessageReceived(BMessage *message) +{ + switch (message->what) { + case kMsgAddToRemoteList: + fWindow->PostMessage(message); + break; + default: + BApplication::MessageReceived(message); + } +} int main(int, char**) Modified: haiku/trunk/src/preferences/bluetooth/BluetoothMain.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/BluetoothMain.h 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/BluetoothMain.h 2009-02-28 20:48:27 UTC (rev 29361) @@ -14,6 +14,7 @@ public: BluetoothApplication(void); + virtual void MessageReceived(BMessage*); virtual void AboutRequested(); private: Modified: haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/BluetoothWindow.cpp 2009-02-28 20:48:27 UTC (rev 29361) @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include "RemoteDevicesView.h" @@ -105,6 +107,25 @@ || fAntialiasingSettings->IsDefaultable()); fRevertButton->SetEnabled(false); */ break; + case kMsgStartServices: + printf("kMsgStartServices\n"); + if (!be_roster->IsRunning("application/x-vnd.Be-bluetooth_server")) + { + printf("kMsgStopServices: %s\n", strerror(be_roster->Launch("application/x-vnd.Be-bluetooth_server"))); + } + break; + case kMsgStopServices: + printf("kMsgStopServices\n"); + if (be_roster->IsRunning("application/x-vnd.Be-bluetooth_server")) + { + printf("kMsgStopServices: %s\n", strerror(BMessenger("application/x-vnd.Be-bluetooth_server").SendMessage(B_QUIT_REQUESTED))); + } + break; + case kMsgAddToRemoteList: + { + PostMessage(message, fRemoteDevices); + } + break; case B_ABOUT_REQUESTED: be_app->PostMessage(message); break; Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.cpp 2009-02-28 20:48:27 UTC (rev 29361) @@ -2,86 +2,126 @@ * Copyright 2009, Oliver Ruiz Dorantes, * All rights reserved. Distributed under the terms of the MIT License. */ -#include "DeviceListItem.h" -#include - #include #include -namespace bluetooth { +#include +#include -RangeItem::RangeItem(uint32 lowAddress, uint32 highAddress, const char* name) - : BListItem(), - fLowAddress(lowAddress), - fHighAddress(highAddress) + +#include "DeviceListItem.h" + + +#define PIXELS_FOR_ICON 32 +#define INSETS 2 +#define TEXT_ROWS 2 + +namespace Bluetooth { + +DeviceListItem::DeviceListItem(BluetoothDevice* bDevice) + : BListItem(), + fDevice(bDevice) +{ + SetDevice(fDevice); +} + + +DeviceListItem::DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi = 0) + : BListItem(), + fDevice(NULL), + fAddress(bdaddr), + fClass(dClass), + fName("unknown"), + fRSSI(rssi) +{ + +} + + +void +DeviceListItem::SetDevice(BluetoothDevice* bDevice) { - fName = strdup(name); + fAddress = bDevice->GetBluetoothAddress(); + fClass = bDevice->GetDeviceClass(); + fName = bDevice->GetFriendlyName(); + // AKAIR rssi can only be got at inquiry time... } -RangeItem::~RangeItem() -{ - delete fName; + +DeviceListItem::~DeviceListItem() +{ + } -/*********************************************************** - * DrawItem - ***********************************************************/ -void -RangeItem::DrawItem(BView *owner, BRect itemRect, bool complete) -{ - rgb_color kBlack = { 0,0,0,0 }; - rgb_color kHighlight = { 156,154,156,0 }; + +/*********************************************************** + * DrawItem + ***********************************************************/ +void +DeviceListItem::DrawItem(BView *owner, BRect itemRect, bool complete) +{ + rgb_color kBlack = { 0,0,0,0 }; + rgb_color kHighlight = { 156,154,156,0 }; - if (IsSelected() || complete) { - rgb_color color; - if (IsSelected()) - color = kHighlight; - else - color = owner->ViewColor(); - - owner->SetHighColor(color); - owner->SetLowColor(color); - owner->FillRect(itemRect); - owner->SetHighColor(kBlack); - - } else { - owner->SetLowColor(owner->ViewColor()); - } + if (IsSelected() || complete) { + rgb_color color; + if (IsSelected()) + color = kHighlight; + else + color = owner->ViewColor(); + + owner->SetHighColor(color); + owner->SetLowColor(color); + owner->FillRect(itemRect); + owner->SetHighColor(kBlack); + + } else { + owner->SetLowColor(owner->ViewColor()); + } + + font_height finfo; + be_plain_font->GetHeight(&finfo); + + 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); - BFont font = be_plain_font; - font_height finfo; - font.GetHeight(&finfo); + owner->DrawString(bdaddrUtils::ToString(fAddress)); + + point -= BPoint(0, (finfo.ascent + finfo.descent + finfo.leading)); + + owner->SetFont(be_plain_font); + owner->MovePenTo(point); + owner->DrawString(fName.String()); - BPoint point = BPoint(itemRect.left + 17, itemRect.bottom - finfo.descent + 1); - owner->SetFont(be_fixed_font); - owner->SetHighColor(kBlack); - owner->MovePenTo(point); + // TODO: Stroke icon -/* if (fLowAddress >= 0) { - char string[255]; - sprintf(string, "0x%04lx - 0x%04lx", fLowAddress, fHighAddress); - owner->DrawString(string); - } - point += BPoint(174, 0);*/ - owner->SetFont(be_plain_font); - owner->MovePenTo(point); - owner->DrawString(fName); -} + // TODO: Draw rssi +} -int -RangeItem::Compare(const void *firstArg, const void *secondArg) + +void +DeviceListItem::Update(BView *owner, const BFont *font) { - const RangeItem *item1 = *static_cast(firstArg); - const RangeItem *item2 = *static_cast(secondArg); + BListItem::Update(owner,font); + + 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); - if (item1->fLowAddress < item2->fLowAddress) { - return -1; - } else if (item1->fLowAddress > item2->fLowAddress) { - return 1; - } else - return 0; } + +int +DeviceListItem::Compare(const void *firstArg, const void *secondArg) +{ + const DeviceListItem *item1 = *static_cast(firstArg); + const DeviceListItem *item2 = *static_cast(secondArg); + + return (int)bdaddrUtils::Compare((bdaddr_t*)&item1->fAddress, (bdaddr_t*)&item2->fAddress); +} } Modified: haiku/trunk/src/preferences/bluetooth/DeviceListItem.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/DeviceListItem.h 2009-02-28 20:48:27 UTC (rev 29361) @@ -6,20 +6,37 @@ #define DEVICELISTITEM_H_ #include +#include -namespace bluetooth { +#include +#include -// TODO: Implement a BluetoothDeviceListItem class, this one is stolen from somewhere ..... -class RangeItem : public BListItem +class BluetoothDevice; + +namespace Bluetooth { + +class DeviceListItem : public BListItem { public: - RangeItem(uint32 lowAddress, uint32 highAddress, const char* name); - ~RangeItem(); - virtual void DrawItem(BView *, BRect, bool = false); + DeviceListItem(BluetoothDevice* bDevice); + DeviceListItem(bdaddr_t bdaddr, DeviceClass dClass, int32 rssi = 0); + + ~DeviceListItem(); + + void DrawItem(BView *, BRect, bool = false); + void Update(BView *owner, const BFont *font); + static int Compare(const void *firstArg, const void *secondArg); + private: - char* fName; - uint32 fLowAddress, fHighAddress; + void SetDevice(BluetoothDevice* bDevice); + + BluetoothDevice* fDevice; + bdaddr_t fAddress; + DeviceClass fClass; + BString fName; + int32 fRSSI; + }; } Modified: haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/InquiryPanel.cpp 2009-02-28 20:48:27 UTC (rev 29361) @@ -21,8 +21,9 @@ #include "InquiryPanel.h" #include "DeviceListItem.h" +#include "defs.h" -using namespace bluetooth; +using Bluetooth::DeviceListItem; // private funcionaility provided by kit extern uint8 GetInquiryTime(); @@ -34,7 +35,6 @@ static const uint32 kMsgInquiry = 'iQbt'; static const uint32 kMsgAddListDevice = 'aDdv'; -static const uint32 kMsgAddToRemoteList = 'aDdL'; static const uint32 kMsgSecond = 'sCMs'; @@ -52,8 +52,9 @@ DeviceDiscovered(RemoteDevice* btDevice, DeviceClass cod) { BMessage* message = new BMessage(kMsgAddListDevice); - message->AddPointer("remote", btDevice); + message->AddPointer("remoteItem", new DeviceListItem(btDevice->GetBluetoothAddress(), cod)); + fInquiryPanel->PostMessage(message); } @@ -85,18 +86,17 @@ B_ALL_WORKSPACES ), fScanning(false) , fLocalDevice(lDevice) { - BRect iDontCare(0,0,0,0); +// BRect iDontCare(0,0,0,0); SetLayout(new BGroupLayout(B_HORIZONTAL)); - fScanProgress = new BStatusBar(iDontCare, "status", "Scanning progress", ""); + fScanProgress = new BStatusBar("status", "Scanning progress", ""); activeColor = fScanProgress->BarColor(); if (fLocalDevice == NULL) fLocalDevice = LocalDevice::GetLocalDevice(); - fMessage = new BTextView(iDontCare, "description", - iDontCare, B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT); + fMessage = new BTextView("description", B_WILL_DRAW); fMessage->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fMessage->SetLowColor(fMessage->ViewColor()); fMessage->MakeEditable(false); @@ -167,14 +167,27 @@ case kMsgAddListDevice: { - RemoteDevice* rDevice; + DeviceListItem* listItem; - message->FindPointer("remote", (void **)&rDevice); + message->FindPointer("remoteItem", (void **)&listItem); - fRemoteList->AddItem(new RangeItem(0,1,bdaddrUtils::ToString(rDevice->GetBluetoothAddress()))); + fRemoteList->AddItem(listItem); } break; + case kMsgAddToRemoteList: + { + message->PrintToStream(); + int32 index = fRemoteList->CurrentSelection(0); + DeviceListItem* item = (DeviceListItem*) fRemoteList->ItemAt(index); + + BMessage message(kMsgAddToRemoteList); + message.AddPointer("device", item); + + be_app->PostMessage(&message); + } + break; + case kMsgStart: fRemoteList->MakeEmpty(); fScanProgress->Reset(); @@ -205,7 +218,7 @@ scanningTime = scanningTime + 1; } - if (fRemoteList->CurrentSelection() < 0) + if (fRemoteList->CurrentSelection() < 0 || fScanning) fAddButton->SetEnabled(false); else fAddButton->SetEnabled(true); Modified: haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp =================================================================== --- haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.cpp 2009-02-28 20:48:27 UTC (rev 29361) @@ -21,36 +21,39 @@ #include "RemoteDevicesView.h" static const uint32 kMsgAddDevices = 'ddDv'; +static const uint32 kMsgRemoveDevice = 'rmDv'; +static const uint32 kMsgTrustDevice = 'trDv'; +static const uint32 kMsgBlockDevice = 'blDv'; +static const uint32 kMsgRefreshDevices = 'rfDv'; - RemoteDevicesView::RemoteDevicesView(const char *name, uint32 flags) : BView(name, flags) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - addButton = new BButton(BRect(5,5,5,5), "add", "Add" B_UTF8_ELLIPSIS, - new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT); + addButton = new BButton("add", "Add" B_UTF8_ELLIPSIS, + new BMessage(kMsgAddDevices)); - BButton* removeButton = new BButton(BRect(5,5,5,5), "remove", "Remove", - new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT); + removeButton = new BButton("remove", "Remove", + new BMessage(kMsgRemoveDevice)); - BButton* trustButton = new BButton(BRect(5,5,5,5), "trust", "As Trusted", - new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT); + trustButton = new BButton("trust", "As Trusted", + new BMessage(kMsgTrustDevice)); - BButton* blockButton = new BButton(BRect(5,5,5,5), "trust", "As Blocked", - new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT); + blockButton = new BButton("trust", "As Blocked", + new BMessage(kMsgBlockDevice)); - BButton* availButton = new BButton(BRect(5,5,5,5), "check", "Refresh" B_UTF8_ELLIPSIS, - new BMessage(kMsgAddDevices), B_FOLLOW_RIGHT); + availButton = new BButton("check", "Refresh" B_UTF8_ELLIPSIS, + new BMessage(kMsgRefreshDevices)); - // Set up list of color attributes - fAttrList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); + // Set up device list + fDeviceList = new BListView("DeviceList", B_SINGLE_SELECTION_LIST); - fScrollView = new BScrollView("ScrollView", fAttrList, 0, false, true); + fScrollView = new BScrollView("ScrollView", fDeviceList, 0, false, true); fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); SetLayout(new BGroupLayout(B_VERTICAL)); @@ -74,7 +77,7 @@ .SetInsets(5, 5, 5, 100) ); - fAttrList->SetSelectionMessage(NULL); + fDeviceList->SetSelectionMessage(NULL); } RemoteDevicesView::~RemoteDevicesView(void) @@ -85,25 +88,21 @@ void RemoteDevicesView::AttachedToWindow(void) { - fAttrList->SetTarget(this); + fDeviceList->SetTarget(this); addButton->SetTarget(this); + removeButton->SetTarget(this); + trustButton->SetTarget(this); + blockButton->SetTarget(this); + availButton->SetTarget(this); LoadSettings(); - fAttrList->Select(0); + fDeviceList->Select(0); } void RemoteDevicesView::MessageReceived(BMessage *msg) { - if (msg->WasDropped()) { - rgb_color *color; - ssize_t size; - - if (msg->FindData("RGBColor", (type_code)'RGBC', (const void**)&color, &size) == B_OK) { - - } - } - + printf("what = %ld\n", msg->what); switch(msg->what) { case kMsgAddDevices: { @@ -111,6 +110,17 @@ iPanel->Show(); } break; + case kMsgRemoveDevice: + printf("kMsgRemoveDevice: %ld\n", fDeviceList->CurrentSelection(0)); + fDeviceList->RemoveItem(fDeviceList->CurrentSelection(0)); + break; + case kMsgAddToRemoteList: + { + BListItem* device; + msg->FindPointer("device", (void**)&device); + fDeviceList->AddItem(device); + } + break; default: BView::MessageReceived(msg); break; Modified: haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/RemoteDevicesView.h 2009-02-28 20:48:27 UTC (rev 29361) @@ -40,7 +40,11 @@ void UpdateAllColors(); BButton* addButton; - BListView* fAttrList; + BButton* removeButton; + BButton* trustButton; + BButton* blockButton; + BButton* availButton; + BListView* fDeviceList; BScrollView* fScrollView; Modified: haiku/trunk/src/preferences/bluetooth/defs.h =================================================================== --- haiku/trunk/src/preferences/bluetooth/defs.h 2009-02-28 19:59:16 UTC (rev 29360) +++ haiku/trunk/src/preferences/bluetooth/defs.h 2009-02-28 20:48:27 UTC (rev 29361) @@ -26,6 +26,8 @@ const uint32 kBorderSpace = 10; const uint32 kItemSpace = 7; +static const uint32 kMsgAddToRemoteList = 'aDdL'; + extern LocalDevice* ActiveLocalDevice; #endif
      iconActivityMonitor  A tool to track system resources like CPU and memory usage.