From revol at free.fr Tue Apr 1 01:07:37 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 01 Apr 2008 01:07:37 +0200 CEST Subject: [Haiku-commits] r24669 - in haiku/trunk: headers/posix headers/private/kernel src/kits/network/dns src/system/kernel src/system/libroot/posix/unistd In-Reply-To: <47F15E1A.8070904@arcor.de> Message-ID: <9007738927-BeMail@laptop> > > It's not unsafe when using the sys: namespace for attributes, that > > BFS > > only allows writing to by root... (at least R5 did). > > It would still need shadow password files though... > > > What happens when copying these files or trying to make/restore a > backup? You'd get doubled users if root copies. User copies won't be able to add the attr oth. Fran?ois. From haiku at kaldience.com Tue Apr 1 08:14:57 2008 From: haiku at kaldience.com (Maurice Kalinowski) Date: Tue, 01 Apr 2008 08:14:57 +0200 Subject: [Haiku-commits] r24714 - in haiku/trunk/src/add-ons/media/media-add-ons: . reader In-Reply-To: <47F15C1C.7030809@arcor.de> References: <200803312123.m2VLNddO010923@sheep.berlios.de> <47F15C1C.7030809@arcor.de> Message-ID: <47F1D2E1.3070604@kaldience.com> Marcus Overhagen wrote: > mauricek at BerliOS schrieb: > > I know I still might have some old code with the same issues, > but anyhow, some comments, about what can still be improved. > > Yeah I know, lots of stuff can be removed. A whole bunch of functions just got overloaded for some debug output. While this might be helpful during development it doesn't make any sense to have them in the tree anymore (Granted that the add-on works as expected). Will do further cleanups this week, but as you saw it's already a lot of stuff going on there... Maurice From haiku at kaldience.com Tue Apr 1 08:19:21 2008 From: haiku at kaldience.com (Maurice Kalinowski) Date: Tue, 01 Apr 2008 08:19:21 +0200 Subject: [Haiku-commits] r24671 - in haiku/trunk: headers/private/media src/kits/media In-Reply-To: <47F15D66.8040103@arcor.de> References: <200803300135.m2U1ZxYd015121@sheep.berlios.de> <47F15D66.8040103@arcor.de> Message-ID: <47F1D3E9.5080208@kaldience.com> Marcus Overhagen wrote: > mauricek at BerliOS schrieb: > > >> + case FILEINTERFACE_SET_REF: >> + { >> + reply.duration = request->duration; >> + >> + rv = SetRef(ref, request->create, &reply.duration); >> + reply.duration = request->duration; >> > > are you sure? reply.duration is ignored. > Cannot say anything from work about this. It shouldn't be ignored, so at least at that point this is ok. It should be processed in the reply handling. As the svn browser is dead currently, I cannot take a look from here. Maurice From stippi at mail.berlios.de Tue Apr 1 09:42:36 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 1 Apr 2008 09:42:36 +0200 Subject: [Haiku-commits] r24715 - in haiku/trunk/src/apps/mediaplayer: . playlist Message-ID: <200804010742.m317gadm010372@sheep.berlios.de> Author: stippi Date: 2008-04-01 09:42:35 +0200 (Tue, 01 Apr 2008) New Revision: 24715 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24715&view=rev Modified: haiku/trunk/src/apps/mediaplayer/Jamfile haiku/trunk/src/apps/mediaplayer/MainWin.cpp haiku/trunk/src/apps/mediaplayer/MainWin.h haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h Log: Applied Patch by Frederik Modeen with some changes by myself: * Created Settings window similar to R5 MediaPlayer. * Prepared loading and saving of settings. * Settings menu entry is hidden for the time being, since these new settings do not actually have any effect yet. * Prepared loading and saving of Playlists. * ZETA Playlists can be dropped on the Player and should load fine. Myself: * Cleanup in MainWindow.cpp for line width limit. To Frederik: I removed the buttons again from the Playlist window, since they don't do anything yet, and the features are available from the menu as well. An icon bar would be better, IMHO. Modified: haiku/trunk/src/apps/mediaplayer/Jamfile =================================================================== --- haiku/trunk/src/apps/mediaplayer/Jamfile 2008-03-31 21:23:38 UTC (rev 24714) +++ haiku/trunk/src/apps/mediaplayer/Jamfile 2008-04-01 07:42:35 UTC (rev 24715) @@ -9,6 +9,7 @@ playlist supplier support + settings ; local sourceDir ; @@ -29,6 +30,10 @@ RemovePLItemsCommand.cpp # supplier + Settings.cpp + SettingsWindow.cpp + + # supplier AudioSupplier.cpp MediaTrackAudioSupplier.cpp MediaTrackVideoSupplier.cpp @@ -42,6 +47,8 @@ ListenerAdapter.cpp Notifier.cpp RWLocker.cpp + FileReadWrite.cpp + TPreferences.cpp # . Controller.cpp @@ -59,7 +66,7 @@ VideoView.cpp VolumeSlider.cpp - : be media tracker translation $(TARGET_LIBSTDC++) + : be media tracker translation textencoding $(TARGET_LIBSTDC++) : MediaPlayer.rdef ; Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2008-03-31 21:23:38 UTC (rev 24714) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2008-04-01 07:42:35 UTC (rev 24715) @@ -2,8 +2,8 @@ * MainWin.cpp - Media Player for the Haiku Operating System * * Copyright (C) 2006 Marcus Overhagen - * Copyright (C) 2007 Stephan A?mus - * Copyright (C) 2007 Fredrik Mod?en + * Copyright (C) 2007-2008 Stephan A?mus (GPL->MIT ok) + * Copyright (C) 2007-2008 Fredrik Mod?en * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -16,7 +16,8 @@ * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, + * USA. * */ #include "MainWin.h" @@ -42,6 +43,7 @@ #include "MainApp.h" #include "PlaylistObserver.h" #include "PlaylistWindow.h" +#include "SettingsWindow.h" #define NAME "MediaPlayer" #define MIN_WIDTH 250 @@ -70,7 +72,7 @@ M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS, M_TOGGLE_ALWAYS_ON_TOP, M_TOGGLE_KEEP_ASPECT_RATIO, - M_PREFERENCES, + M_SETTINGS, M_VOLUME_UP, M_VOLUME_DOWN, M_SKIP_NEXT, @@ -94,10 +96,12 @@ MainWin::MainWin() - : BWindow(BRect(100,100,350,300), NAME, B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */) + : BWindow(BRect(100,100,400,300), NAME, B_TITLED_WINDOW, + B_ASYNCHRONOUS_CONTROLS /* | B_WILL_ACCEPT_FIRST_CLICK */) , fFilePanel(NULL) , fInfoWin(NULL) , fPlaylistWindow(NULL) + , fSettingsWindow(NULL) , fHasFile(false) , fHasVideo(false) , fHasAudio(false) @@ -127,7 +131,8 @@ BRect rect = Bounds(); // background - fBackground = new BView(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); + fBackground = new BView(rect, "background", B_FOLLOW_ALL, + B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); fBackground->SetViewColor(0,0,0); AddChild(fBackground); @@ -141,12 +146,15 @@ fMenuBar->SetResizingMode(B_FOLLOW_NONE); // video view - rect = BRect(0, fMenuBarHeight, fBackground->Bounds().right, fMenuBarHeight + 10); - fVideoView = new VideoView(rect, "video display", B_FOLLOW_NONE, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); + rect = BRect(0, fMenuBarHeight, fBackground->Bounds().right, + fMenuBarHeight + 10); + fVideoView = new VideoView(rect, "video display", B_FOLLOW_NONE, + B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE); fBackground->AddChild(fVideoView); // controls - rect = BRect(0, fMenuBarHeight + 11, fBackground->Bounds().right, fBackground->Bounds().bottom); + rect = BRect(0, fMenuBarHeight + 11, fBackground->Bounds().right, + fBackground->Bounds().bottom); fControls = new ControllerView(rect, fController, fPlaylist); fBackground->AddChild(fControls); fControls->ResizeToPreferred(); @@ -155,7 +163,8 @@ fControls->SetResizingMode(B_FOLLOW_BOTTOM | B_FOLLOW_LEFT_RIGHT); // fControls->MoveTo(0, fBackground->Bounds().bottom - fControlsHeight + 1); -// fVideoView->ResizeTo(fBackground->Bounds().Width(), fBackground->Bounds().Height() - fMenuBarHeight - fControlsHeight); +// fVideoView->ResizeTo(fBackground->Bounds().Width(), +// fBackground->Bounds().Height() - fMenuBarHeight - fControlsHeight); fPlaylist->AddListener(fPlaylistObserver); fController->SetVideoView(fVideoView); @@ -168,9 +177,15 @@ _SetupWindow(); + // setup the settings window now, we need to have it + fSettingsWindow = new SettingsWindow(BRect(150, 150, 450, 520)); + fSettingsWindow->Hide(); + fSettingsWindow->Show(); + // setup the playlist window now, we need to have it // running for the undo/redo playlist editing - fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 400, 500), fPlaylist, fController); + fPlaylistWindow = new PlaylistWindow(BRect(150, 150, 500, 600), fPlaylist, + fController); fPlaylistWindow->Hide(); fPlaylistWindow->Show(); // this makes sure the window thread is running without @@ -200,6 +215,11 @@ fPlaylistWindow->Lock(); fPlaylistWindow->Quit(); } + + if (fSettingsWindow) { + fSettingsWindow->Lock(); + fSettingsWindow->Quit(); + } delete fPlaylist; delete fController; @@ -220,10 +240,13 @@ bool no_menu = fNoMenu || fIsFullscreen; bool no_controls = fNoControls || fIsFullscreen; - printf("FrameResized enter: new_width %.0f, new_height %.0f\n", new_width, new_height); + printf("FrameResized enter: new_width %.0f, new_height %.0f\n", + new_width, new_height); int max_video_width = int(new_width) + 1; - int max_video_height = int(new_height) + 1 - (no_menu ? 0 : fMenuBarHeight) - (no_controls ? 0 : fControlsHeight); + int max_video_height = int(new_height) + 1 + - (no_menu ? 0 : fMenuBarHeight) + - (no_controls ? 0 : fControlsHeight); ASSERT(max_video_height >= 0); @@ -374,7 +397,8 @@ fPlaylist->SetCurrentRefIndex(fPlaylist->CurrentRefIndex() + 1); break; case MSG_CONTROLLER_FILE_CHANGED: - // TODO: move all other GUI changes as a reaction to this notification + // TODO: move all other GUI changes as a reaction to this + // notification // _UpdatePlaylistMenu(); break; case MSG_CONTROLLER_VIDEO_TRACK_CHANGED: { @@ -441,7 +465,7 @@ case B_ABOUT_REQUESTED: BAlert *alert; alert = new BAlert("about", NAME"\n\n Written by Marcus Overhagen " - "and Stephan A?mus", "Thanks"); + ", Stephan A?mus and Frederik Mod?en", "Thanks"); if (fAlwaysOnTop) { _ToggleAlwaysOnTop(); alert->Go(); @@ -536,7 +560,7 @@ printf("B_RELEASE_OVERLAY_LOCK\n"); fVideoView->OverlayLockRelease(); break; - + case B_MOUSE_WHEEL_CHANGED: { printf("B_MOUSE_WHEEL_CHANGED\n"); @@ -593,16 +617,19 @@ case M_ASPECT_544_576: VideoFormatChange(544, 576, 1.41176, 1.0); break; -/* - case M_PREFERENCES: + + case M_SETTINGS: + ShowSettingsWindow(); break; - +/* default: - if (msg->what >= M_SELECT_CHANNEL && msg->what <= M_SELECT_CHANNEL_END) { + if (msg->what >= M_SELECT_CHANNEL + && msg->what <= M_SELECT_CHANNEL_END) { SelectChannel(msg->what - M_SELECT_CHANNEL); break; } - if (msg->what >= M_SELECT_INTERFACE && msg->what <= M_SELECT_INTERFACE_END) { + if (msg->what >= M_SELECT_INTERFACE + && msg->what <= M_SELECT_INTERFACE_END) { SelectInterface(msg->what - M_SELECT_INTERFACE - 1); break; } @@ -647,8 +674,6 @@ (new BAlert("error", s, "OK"))->Go(); } else { // just go to the next file and don't bother user - // TODO: this makes it impossible to skip backwards - // over a non recognized file! fPlaylist->SetCurrentRefIndex(fPlaylist->CurrentRefIndex() + 1); } fHasFile = false; @@ -664,6 +689,7 @@ _SetupWindow(); } + void MainWin::ShowFileInfo() { @@ -694,16 +720,32 @@ void -MainWin::VideoFormatChange(int width, int height, float width_scale, float height_scale) +MainWin::ShowSettingsWindow() { + if (fSettingsWindow->Lock()) { + if (fSettingsWindow->IsHidden()) + fSettingsWindow->Show(); + else + fSettingsWindow->Activate(); + fSettingsWindow->Unlock(); + } +} + + +void +MainWin::VideoFormatChange(int width, int height, float width_scale, + float height_scale) +{ // called when video format or aspect ratio changes - printf("VideoFormatChange enter: width %d, height %d, width_scale %.6f, height_scale %.6f\n", width, height, width_scale, height_scale); + printf("VideoFormatChange enter: width %d, height %d, width_scale %.6f, " + "height_scale %.6f\n", width, height, width_scale, height_scale); if (width_scale < 1.0 && height_scale >= 1.0) { width_scale = 1.0 / width_scale; height_scale = 1.0 / height_scale; - printf("inverting! new values: width_scale %.6f, height_scale %.6f\n", width_scale, height_scale); + printf("inverting! new values: width_scale %.6f, height_scale %.6f\n", + width_scale, height_scale); } fSourceWidth = width; @@ -740,7 +782,6 @@ MainWin::_SetupWindow() { printf("MainWin::_SetupWindow\n"); - // Populate the track menus _SetupTrackMenus(); // Enable both if a file was loaded @@ -752,8 +793,7 @@ fVideoMenu->SetEnabled(fHasVideo); fAudioMenu->SetEnabled(fHasAudio); - fDebugMenu->SetEnabled(fHasVideo); - +// fDebugMenu->SetEnabled(fHasVideo); if (fHasVideo) { fController->GetSize(&fSourceWidth, &fSourceHeight); fWidthScale = 1.0; @@ -764,7 +804,6 @@ fWidthScale = 1.0; fHeightScale = 1.0; } - _UpdateControlsEnabledStatus(); _ResizeWindow(100); @@ -783,7 +822,7 @@ fSettingsMenu = new BMenu("Settings"); fAudioTrackMenu = new BMenu("Track"); fVideoTrackMenu = new BMenu("Track"); - fDebugMenu = new BMenu("Debug"); +// fDebugMenu = new BMenu("Debug"); fMenuBar->AddItem(fFileMenu); fMenuBar->AddItem(fAudioMenu); @@ -791,10 +830,13 @@ fMenuBar->AddItem(fSettingsMenu); // fMenuBar->AddItem(fDebugMenu); - fFileMenu->AddItem(new BMenuItem("New Player"B_UTF8_ELLIPSIS, new BMessage(M_FILE_NEWPLAYER), 'N', B_COMMAND_KEY)); + fFileMenu->AddItem(new BMenuItem("New Player"B_UTF8_ELLIPSIS, + new BMessage(M_FILE_NEWPLAYER), 'N')); fFileMenu->AddSeparatorItem(); - fFileMenu->AddItem(new BMenuItem("Open File"B_UTF8_ELLIPSIS, new BMessage(M_FILE_OPEN), 'O', B_COMMAND_KEY)); - fFileMenu->AddItem(new BMenuItem("File Info"B_UTF8_ELLIPSIS, new BMessage(M_FILE_INFO), 'I', B_COMMAND_KEY)); + fFileMenu->AddItem(new BMenuItem("Open File"B_UTF8_ELLIPSIS, + new BMessage(M_FILE_OPEN), 'O')); + fFileMenu->AddItem(new BMenuItem("File Info"B_UTF8_ELLIPSIS, + new BMessage(M_FILE_INFO), 'I')); fFileMenu->AddItem(fPlaylistMenu); fPlaylistMenu->Superitem()->SetShortcut('P', B_COMMAND_KEY); fPlaylistMenu->Superitem()->SetMessage(new BMessage(M_FILE_PLAYLIST)); @@ -803,8 +845,8 @@ fFileMenu->AddItem(new BMenuItem("About" NAME B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); fFileMenu->AddSeparatorItem(); - fFileMenu->AddItem(new BMenuItem("Close", new BMessage(M_FILE_CLOSE), 'W', B_COMMAND_KEY)); - fFileMenu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q', B_COMMAND_KEY)); + fFileMenu->AddItem(new BMenuItem("Close", new BMessage(M_FILE_CLOSE), 'W')); + fFileMenu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q')); fPlaylistMenu->SetRadioMode(true); @@ -812,40 +854,51 @@ fVideoMenu->AddItem(fVideoTrackMenu); fVideoMenu->AddSeparatorItem(); - fVideoMenu->AddItem(new BMenuItem("50% scale", new BMessage(M_VIEW_50), '0', B_COMMAND_KEY)); - fVideoMenu->AddItem(new BMenuItem("100% scale", new BMessage(M_VIEW_100), '1', B_COMMAND_KEY)); - fVideoMenu->AddItem(new BMenuItem("200% scale", new BMessage(M_VIEW_200), '2', B_COMMAND_KEY)); - fVideoMenu->AddItem(new BMenuItem("300% scale", new BMessage(M_VIEW_300), '3', B_COMMAND_KEY)); - fVideoMenu->AddItem(new BMenuItem("400% scale", new BMessage(M_VIEW_400), '4', B_COMMAND_KEY)); + fVideoMenu->AddItem(new BMenuItem("50% scale", + new BMessage(M_VIEW_50), '0')); + fVideoMenu->AddItem(new BMenuItem("100% scale", + new BMessage(M_VIEW_100), '1')); + fVideoMenu->AddItem(new BMenuItem("200% scale", + new BMessage(M_VIEW_200), '2')); + fVideoMenu->AddItem(new BMenuItem("300% scale", + new BMessage(M_VIEW_300), '3')); + fVideoMenu->AddItem(new BMenuItem("400% scale", + new BMessage(M_VIEW_400), '4')); fVideoMenu->AddSeparatorItem(); - fVideoMenu->AddItem(new BMenuItem("Full Screen", new BMessage(M_TOGGLE_FULLSCREEN), 'F', B_COMMAND_KEY)); - fVideoMenu->AddItem(new BMenuItem("Keep Aspect Ratio", new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY)); + fVideoMenu->AddItem(new BMenuItem("Full Screen", + new BMessage(M_TOGGLE_FULLSCREEN), 'F')); + fVideoMenu->AddItem(new BMenuItem("Keep Aspect Ratio", + new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K')); - fSettingsMenu->AddItem(new BMenuItem("No Menu", new BMessage(M_TOGGLE_NO_MENU), 'M', B_COMMAND_KEY)); - fSettingsMenu->AddItem(new BMenuItem("No Border", new BMessage(M_TOGGLE_NO_BORDER), 'B', B_COMMAND_KEY)); - fSettingsMenu->AddItem(new BMenuItem("No Controls", new BMessage(M_TOGGLE_NO_CONTROLS), 'C', B_COMMAND_KEY)); - fSettingsMenu->AddItem(new BMenuItem("Always on Top", new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T', B_COMMAND_KEY)); + fSettingsMenu->AddItem(new BMenuItem("No Menu", + new BMessage(M_TOGGLE_NO_MENU), 'M')); + fSettingsMenu->AddItem(new BMenuItem("No Border", + new BMessage(M_TOGGLE_NO_BORDER), 'B')); + fSettingsMenu->AddItem(new BMenuItem("No Controls", + new BMessage(M_TOGGLE_NO_CONTROLS), 'C')); + fSettingsMenu->AddItem(new BMenuItem("Always on Top", + new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T')); // fSettingsMenu->AddSeparatorItem(); -// fSettingsMenu->AddItem(new BMenuItem("Preferences"B_UTF8_ELLIPSIS, new BMessage(M_PREFERENCES), 'P', B_COMMAND_KEY)); +// fSettingsMenu->AddItem(new BMenuItem("Settings"B_UTF8_ELLIPSIS, +// new BMessage(M_SETTINGS), 'S')); - fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1", new BMessage(M_ASPECT_100000_1))); - fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.06666:1", new BMessage(M_ASPECT_106666_1))); - fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.09091:1", new BMessage(M_ASPECT_109091_1))); - fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.41176:1", new BMessage(M_ASPECT_141176_1))); - fDebugMenu->AddItem(new BMenuItem("force 720 x 576, display aspect 4:3", new BMessage(M_ASPECT_720_576))); - fDebugMenu->AddItem(new BMenuItem("force 704 x 576, display aspect 4:3", new BMessage(M_ASPECT_704_576))); - fDebugMenu->AddItem(new BMenuItem("force 544 x 576, display aspect 4:3", new BMessage(M_ASPECT_544_576))); +// fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1", +// new BMessage(M_ASPECT_100000_1))); +// fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.06666:1", +// new BMessage(M_ASPECT_106666_1))); +// fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.09091:1", +// new BMessage(M_ASPECT_109091_1))); +// fDebugMenu->AddItem(new BMenuItem("pixel aspect ratio 1.41176:1", +// new BMessage(M_ASPECT_141176_1))); +// fDebugMenu->AddItem(new BMenuItem("force 720 x 576, display aspect 4:3", +// new BMessage(M_ASPECT_720_576))); +// fDebugMenu->AddItem(new BMenuItem("force 704 x 576, display aspect 4:3", +// new BMessage(M_ASPECT_704_576))); +// fDebugMenu->AddItem(new BMenuItem("force 544 x 576, display aspect 4:3", +// new BMessage(M_ASPECT_544_576))); fAudioTrackMenu->SetRadioMode(true); fVideoTrackMenu->SetRadioMode(true); -/* - fSettingsMenu->ItemAt(3)->SetMarked(fIsFullscreen); - fSettingsMenu->ItemAt(5)->SetMarked(fNoMenu); - fSettingsMenu->ItemAt(6)->SetMarked(fNoBorder); - fSettingsMenu->ItemAt(7)->SetMarked(fAlwaysOnTop); - fSettingsMenu->ItemAt(8)->SetMarked(fKeepAspectRatio); - fSettingsMenu->ItemAt(10)->SetEnabled(false); // XXX disable unused preference menu -*/ } @@ -861,7 +914,8 @@ c = fController->AudioTrackCount(); for (i = 0; i < c; i++) { sprintf(s, "Track %d", i + 1); - fAudioTrackMenu->AddItem(new BMenuItem(s, new BMessage(M_SELECT_AUDIO_TRACK + i))); + fAudioTrackMenu->AddItem(new BMenuItem(s, + new BMessage(M_SELECT_AUDIO_TRACK + i))); } if (!c) fAudioTrackMenu->AddItem(new BMenuItem("none", new BMessage(M_DUMMY))); @@ -869,7 +923,8 @@ c = fController->VideoTrackCount(); for (i = 0; i < c; i++) { sprintf(s, "Track %d", i + 1); - fVideoTrackMenu->AddItem(new BMenuItem(s, new BMessage(M_SELECT_VIDEO_TRACK + i))); + fVideoTrackMenu->AddItem(new BMenuItem(s, + new BMessage(M_SELECT_VIDEO_TRACK + i))); } if (!c) fVideoTrackMenu->AddItem(new BMenuItem("none", new BMessage(M_DUMMY))); @@ -882,9 +937,11 @@ int minWidth = fNoControls ? MIN_WIDTH : fControlsWidth; if (!fNoMenu) minWidth = max_c(minWidth, fMenuBarWidth); - int minHeight = (fNoMenu ? 0 : fMenuBarHeight) + (fNoControls ? 0 : fControlsHeight); + int minHeight = (fNoMenu ? 0 : fMenuBarHeight) + + (fNoControls ? 0 : fControlsHeight); - SetSizeLimits(minWidth - 1, 32000, minHeight - 1, fHasVideo ? 32000 : minHeight - 1); + SetSizeLimits(minWidth - 1, 32000, minHeight - 1, fHasVideo ? + 32000 : minHeight - 1); } @@ -916,7 +973,8 @@ void MainWin::_ResizeVideoView(int x, int y, int width, int height) { - printf("_ResizeVideoView: %d,%d, width %d, height %d\n", x, y, width, height); + printf("_ResizeVideoView: %d,%d, width %d, height %d\n", x, y, + width, height); if (fKeepAspectRatio) { // Keep aspect ratio, place video view inside @@ -953,7 +1011,8 @@ BPoint screen_where; uint32 buttons = msg->FindInt32("buttons"); - // On Zeta, only "screen_where" is relyable, "where" and "be:view_where" seem to be broken + // On Zeta, only "screen_where" is relyable, "where" and "be:view_where" + // seem to be broken if (B_OK != msg->FindPoint("screen_where", &screen_where)) { // Workaround for BeOS R5, it has no "screen_where" if (!originalHandler || msg->FindPoint("where", &screen_where) < B_OK) @@ -966,7 +1025,8 @@ // if (1 == msg->FindInt32("buttons") && msg->FindInt32("clicks") == 1) { if (1 == buttons && msg->FindInt32("clicks") % 2 == 0) { - BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, screen_where.y + 1); + BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, + screen_where.y + 1); if (r.Contains(fMouseDownMousePos)) { PostMessage(M_TOGGLE_FULLSCREEN); return; @@ -974,7 +1034,8 @@ } if (2 == buttons && msg->FindInt32("clicks") % 2 == 0) { - BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, screen_where.y + 1); + BRect r(screen_where.x - 1, screen_where.y - 1, screen_where.x + 1, + screen_where.y + 1); if (r.Contains(fMouseDownMousePos)) { PostMessage(M_TOGGLE_NO_BORDER_NO_MENU_NO_CONTROLS); return; @@ -983,14 +1044,16 @@ /* // very broken in Zeta: - fMouseDownMousePos = fVideoView->ConvertToScreen(msg->FindPoint("where")); + fMouseDownMousePos = fVideoView->ConvertToScreen( + msg->FindPoint("where")); */ fMouseDownMousePos = screen_where; fMouseDownWindowPos = Frame().LeftTop(); if (buttons == 1 && !fIsFullscreen) { // start mouse tracking - fVideoView->SetMouseEventMask(B_POINTER_EVENTS | B_NO_POINTER_HISTORY /* | B_LOCK_WINDOW_FOCUS */); + fVideoView->SetMouseEventMask(B_POINTER_EVENTS | B_NO_POINTER_HISTORY + /* | B_LOCK_WINDOW_FOCUS */); fMouseDownTracking = true; } @@ -1061,38 +1124,51 @@ printf("Show context menu\n"); BPopUpMenu *menu = new BPopUpMenu("context menu", false, false); BMenuItem *item; - menu->AddItem(item = new BMenuItem("Full Screen", new BMessage(M_TOGGLE_FULLSCREEN), 'F', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Full Screen", + new BMessage(M_TOGGLE_FULLSCREEN), 'F')); item->SetMarked(fIsFullscreen); item->SetEnabled(fHasVideo); - menu->AddItem(item = new BMenuItem("Keep Aspect Ratio", new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Keep Aspect Ratio", + new BMessage(M_TOGGLE_KEEP_ASPECT_RATIO), 'K')); item->SetMarked(fKeepAspectRatio); item->SetEnabled(fHasVideo); menu->AddSeparatorItem(); - menu->AddItem(item = new BMenuItem("No Menu", new BMessage(M_TOGGLE_NO_MENU), 'M', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("No Menu", + new BMessage(M_TOGGLE_NO_MENU), 'M')); item->SetMarked(fNoMenu); - menu->AddItem(item = new BMenuItem("No Border", new BMessage(M_TOGGLE_NO_BORDER), 'B', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("No Border", + new BMessage(M_TOGGLE_NO_BORDER), 'B')); item->SetMarked(fNoBorder); - menu->AddItem(item = new BMenuItem("Always on Top", new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T', B_COMMAND_KEY)); + menu->AddItem(item = new BMenuItem("Always on Top", + new BMessage(M_TOGGLE_ALWAYS_ON_TOP), 'T')); item->SetMarked(fAlwaysOnTop); menu->AddSeparatorItem(); menu->AddItem(new BMenuItem("About" NAME B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q', B_COMMAND_KEY)); + menu->AddItem(new BMenuItem("Quit", new BMessage(M_FILE_QUIT), 'Q')); menu->AddSeparatorItem(); - menu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1", new BMessage(M_ASPECT_100000_1))); - menu->AddItem(new BMenuItem("pixel aspect ratio 1.06666:1", new BMessage(M_ASPECT_106666_1))); - menu->AddItem(new BMenuItem("pixel aspect ratio 1.09091:1", new BMessage(M_ASPECT_109091_1))); - menu->AddItem(new BMenuItem("pixel aspect ratio 1.41176:1", new BMessage(M_ASPECT_141176_1))); - menu->AddItem(new BMenuItem("force 720 x 576, display aspect 4:3", new BMessage(M_ASPECT_720_576))); - menu->AddItem(new BMenuItem("force 704 x 576, display aspect 4:3", new BMessage(M_ASPECT_704_576))); - menu->AddItem(new BMenuItem("force 544 x 576, display aspect 4:3", new BMessage(M_ASPECT_544_576))); + menu->AddItem(new BMenuItem("pixel aspect ratio 1.00000:1", + new BMessage(M_ASPECT_100000_1))); + menu->AddItem(new BMenuItem("pixel aspect ratio 1.06666:1", + new BMessage(M_ASPECT_106666_1))); + menu->AddItem(new BMenuItem("pixel aspect ratio 1.09091:1", + new BMessage(M_ASPECT_109091_1))); + menu->AddItem(new BMenuItem("pixel aspect ratio 1.41176:1", + new BMessage(M_ASPECT_141176_1))); + menu->AddItem(new BMenuItem("force 720 x 576, display aspect 4:3", + new BMessage(M_ASPECT_720_576))); + menu->AddItem(new BMenuItem("force 704 x 576, display aspect 4:3", + new BMessage(M_ASPECT_704_576))); + menu->AddItem(new BMenuItem("force 544 x 576, display aspect 4:3", + new BMessage(M_ASPECT_544_576))); menu->SetTargetForItems(this); - BRect r(screen_point.x - 5, screen_point.y - 5, screen_point.x + 5, screen_point.y + 5); + BRect r(screen_point.x - 5, screen_point.y - 5, screen_point.x + 5, + screen_point.y + 5); menu->Go(screen_point, true, true, r, true); } @@ -1109,7 +1185,8 @@ uint32 raw_char = msg->FindInt32("raw_char"); uint32 modifiers = msg->FindInt32("modifiers"); - printf("key 0x%lx, raw_char 0x%lx, modifiers 0x%lx\n", key, raw_char, modifiers); + printf("key 0x%lx, raw_char 0x%lx, modifiers 0x%lx\n", key, raw_char, + modifiers); switch (raw_char) { case B_SPACE: @@ -1134,7 +1211,8 @@ break; case B_TAB: - if ((modifiers & (B_COMMAND_KEY | B_CONTROL_KEY | B_OPTION_KEY | B_MENU_KEY)) == 0) { + if ((modifiers & (B_COMMAND_KEY | B_CONTROL_KEY | B_OPTION_KEY + | B_MENU_KEY)) == 0) { PostMessage(M_TOGGLE_FULLSCREEN); return B_OK; } else @@ -1260,7 +1338,9 @@ // switch to fullscreen fSavedFrame = Frame(); - printf("saving current frame: %d %d %d %d\n", int(fSavedFrame.left), int(fSavedFrame.top), int(fSavedFrame.right), int(fSavedFrame.bottom)); + printf("saving current frame: %d %d %d %d\n", int(fSavedFrame.left), + int(fSavedFrame.top), int(fSavedFrame.right), + int(fSavedFrame.bottom)); BScreen screen(this); BRect rect(screen.Frame()); Modified: haiku/trunk/src/apps/mediaplayer/MainWin.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.h 2008-03-31 21:23:38 UTC (rev 24714) +++ haiku/trunk/src/apps/mediaplayer/MainWin.h 2008-04-01 07:42:35 UTC (rev 24715) @@ -32,10 +32,10 @@ #include "VideoView.h" #include "Playlist.h" - class ControllerObserver; class PlaylistObserver; class PlaylistWindow; +class SettingsWindow; class MainWin : public BWindow { public: @@ -54,6 +54,7 @@ void ShowFileInfo(); void ShowPlaylistWindow(); + void ShowSettingsWindow(); void VideoFormatChange(int width, int height, float widthScale, float heightScale); @@ -100,6 +101,7 @@ ControllerView* fControls; InfoWin* fInfoWin; PlaylistWindow* fPlaylistWindow; + SettingsWindow* fSettingsWindow; BMenu* fFileMenu; BMenu* fAudioMenu; Modified: haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp 2008-03-31 21:23:38 UTC (rev 24714) +++ haiku/trunk/src/apps/mediaplayer/playlist/Playlist.cpp 2008-04-01 07:42:35 UTC (rev 24715) @@ -3,7 +3,7 @@ * * Copyright (C) 2006 Marcus Overhagen * Copyright (C) 2007 Stephan A?mus - * Copyright (C) 2007 Fredrik Mod?en + * Copyright (C) 2008 Fredrik Mod?en (I have no problem changing my things to MIT) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -34,6 +34,8 @@ #include #include +#include "FileReadWrite.h" + using std::nothrow; // TODO: using BList for objects is bad, replace it with a template @@ -281,8 +283,7 @@ entry_ref ref; for (int i = 0; refsReceivedMessage->FindRef("refs", i, &ref) == B_OK; i++) - AppendToPlaylistRecursive(ref, playlist); - + AppendToPlaylistRecursive(ref, playlist); playlist->Sort(); if (add) @@ -300,10 +301,17 @@ { // recursively append the ref (dive into folders) BEntry entry(&ref, true); - if (entry.InitCheck() < B_OK) + if (entry.InitCheck() < B_OK) { + printf("Not OK\n"); return; - if (!entry.Exists()) + } + + if (!entry.Exists()) { + BPath path = BPath(&ref); + //printf("Don't exist - %s\n", path.Path()); return; + } + if (entry.IsDirectory()) { BDirectory dir(&entry); if (dir.InitCheck() < B_OK) @@ -313,13 +321,35 @@ while (dir.GetNextRef(&subRef) == B_OK) AppendToPlaylistRecursive(subRef, playlist); } else if (entry.IsFile()) { + //printf("Is File\n"); BString mimeString = _MIMEString(&ref); - if (_IsMediaFile(mimeString)) + if (_IsMediaFile(mimeString)) { + //printf("Adding\n"); playlist->AddRef(ref); - else if (_IsPlaylist(mimeString)) { - printf("Playlist::AppendToPlaylistRecursive() - " - "TODO: implement playlist file loading\n"); - } + } else if (_IsPlaylist(mimeString)) { + //printf("RunPlaylist thing\n"); + BFile file(&ref, B_READ_ONLY); + FileReadWrite lineReader(&file); + + BString str; + entry_ref refPath; + status_t err; + BPath path; + while (lineReader.Next(str)) { + str = str.RemoveFirst("file://"); + str = str.RemoveLast(".."); + path = BPath(str.String()); + printf("Line %s\n", path.Path()); + if (path.Path() != NULL) { + if ((err = get_ref_for_path(path.Path(), &refPath)) == B_OK) { + playlist->AddRef(refPath); + } else + printf("Error - %s: [%lx]\n", strerror(err), (int32) err); + } else + printf("Error - No File Found in playlist\n"); + } + } else + printf("MIME Type = %s\n", mimeString.String()); } } @@ -331,7 +361,6 @@ Playlist::playlist_cmp(const void *p1, const void *p2) { // compare complete path - BEntry a(*(const entry_ref **)p1, false); BEntry b(*(const entry_ref **)p2, false); @@ -342,6 +371,30 @@ } +/*static*/ void +Playlist::_AddPlayListFileToPlayList(const entry_ref& ref, Playlist* playlist) +{ + + BFile file(&ref, B_READ_ONLY); + FileReadWrite lineReader(&file); + + BString str; + while (lineReader.Next(str)) { + BPath path = BPath(str.String()); + entry_ref refPath; + status_t err; + if ((err = get_ref_for_path(path.Path(), &refPath)) == B_OK) { + AppendToPlaylistRecursive(refPath, playlist); + } else + printf("Error - %s: [%lx]\n", strerror(err), (int32) err); + } + /* + Read line for x to the end of file (while?) + make a enty_ref and call AppendToPlaylistRecursive(with new entry, playlist) + */ +} + + /*static*/ bool Playlist::_IsMediaFile(const BString& mimeString) { Modified: haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h 2008-03-31 21:23:38 UTC (rev 24714) +++ haiku/trunk/src/apps/mediaplayer/playlist/Playlist.h 2008-04-01 07:42:35 UTC (rev 24715) @@ -1,8 +1,9 @@ /* * Playlist.h - Media Player for the Haiku Operating System * - * Copyright (C) 2006 Marcus Overhagen - * Copyright (C) 2007 Stephan A?mus + * Copyright (C) 2006 Marcus Overhagen + * Copyright (C) 2007 Stephan A?mus + * Copyright (C) 2008 Fredrik Mod?en (I have no problem changing my things to MIT) * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -88,7 +89,8 @@ static bool _IsMediaFile(const BString& mimeString); static bool _IsPlaylist(const BString& mimeString); static BString _MIMEString(const entry_ref* entry); - + static void _AddPlayListFileToPlayList(const entry_ref& ref, + Playlist* playlist); void _NotifyRefAdded(const entry_ref& ref, int32 index) const; void _NotifyRefRemoved(int32 index) const; Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp 2008-03-31 21:23:38 UTC (rev 24714) +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.cpp 2008-04-01 07:42:35 UTC (rev 24715) @@ -3,22 +3,41 @@ * Distributed under the terms of the MIT License. * * Authors: - * Stephan A?mus + * Stephan A?mus + * Fredrik Mod?en */ + #include "PlaylistWindow.h" +#include + +#include +#include +#include #include #include #include #include #include #include +#include +#include +#include #include "CommandStack.h" #include "PlaylistListView.h" #include "RWLocker.h" +#define DEBUG 1 +enum { + M_PLAYLIST_OPEN = 'open', + M_PLAYLIST_SAVE = 'save', + M_PLAYLIST_EMPTY = 'emty' +}; + +#define SPACE 5 + PlaylistWindow::PlaylistWindow(BRect frame, Playlist* playlist, Controller* controller) : BWindow(frame, "Playlist", B_DOCUMENT_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, @@ -28,18 +47,19 @@ , fCommandStack(new CommandStack(fLocker)) , fCommandStackListener(this) { - frame = Bounds(); - + frame = Bounds(); + _CreateMenu(frame); - + // will adjust frame to account for menubar + frame.right -= B_V_SCROLL_BAR_WIDTH; fListView = new PlaylistListView(frame, playlist, controller, fCommandStack); - BScrollView* scrollView = new BScrollView("playlist scrollview", - fListView, B_FOLLOW_ALL, 0, false, true, B_NO_BORDER); + BScrollView* scrollView = new BScrollView("playlist scrollview", fListView, + B_FOLLOW_ALL_SIDES, 0, false, true, B_NO_BORDER); - fTopView = scrollView; + fTopView = scrollView; AddChild(fTopView); // small visual tweak @@ -109,7 +129,23 @@ } break; } - + + case M_PLAYLIST_SAVE: + if (!fSavePanel) + fSavePanel = new BFilePanel(B_SAVE_PANEL); + fSavePanel->Show(); + break; + case B_SAVE_REQUESTED: + printf("We are saving\n"); + //Use fListView and have a SaveToFile? + break; + case M_PLAYLIST_OPEN: + if (!fOpenPanel) + fOpenPanel = new BFilePanel(B_OPEN_PANEL); + fOpenPanel->Show(); + break; + case M_PLAYLIST_EMPTY: + break; default: BWindow::MessageReceived(message); break; @@ -127,15 +163,22 @@ BMenuBar* menuBar = new BMenuBar(frame, "main menu"); BMenu* fileMenu = new BMenu("Playlist"); menuBar->AddItem(fileMenu); - // TODO add some items: "Open", "Save", "Make Empty"... +// fileMenu->AddItem(new BMenuItem("Open"B_UTF8_ELLIPSIS, +// new BMessage(M_PLAYLIST_OPEN), 'O')); +// fileMenu->AddItem(new BMenuItem("Save"B_UTF8_ELLIPSIS, +// new BMessage(M_PLAYLIST_SAVE), 'S')); +// fileMenu->AddSeparatorItem(); + fileMenu->AddItem(new BMenuItem("Close", + new BMessage(B_QUIT_REQUESTED), 'W')); BMenu* editMenu = new BMenu("Edit"); - BMessage* message = new BMessage(B_UNDO); - fUndoMI = new BMenuItem("Undo", message); + fUndoMI = new BMenuItem("Undo", new BMessage(B_UNDO), 'Z'); editMenu->AddItem(fUndoMI); - message = new BMessage(B_REDO); - fRedoMI = new BMenuItem("Undo", message); + fRedoMI = new BMenuItem("Redo", new BMessage(B_REDO), 'Z', B_SHIFT_KEY); editMenu->AddItem(fRedoMI); + editMenu->AddSeparatorItem(); + editMenu->AddItem(new BMenuItem("Make Empty", + new BMessage(M_PLAYLIST_EMPTY), 'N')); menuBar->AddItem(editMenu); AddChild(menuBar); Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h 2008-03-31 21:23:38 UTC (rev 24714) +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h 2008-04-01 07:42:35 UTC (rev 24715) @@ -3,8 +3,10 @@ * Distributed under the terms of the MIT License. * * Authors: - * Stephan A?mus + * Stephan A?mus + * Fredrik Mod?en */ + #ifndef PLAYLIST_WINDOW_H #define PLAYLIST_WINDOW_H @@ -21,6 +23,7 @@ class Playlist; class PlaylistListView; class RWLocker; +class BButton; class PlaylistWindow : public BWindow { public: @@ -42,6 +45,9 @@ BView* fTopView; BMenuItem* fUndoMI; BMenuItem* fRedoMI; + + BFilePanel* fOpenPanel; + BFilePanel* fSavePanel; RWLocker* fLocker; CommandStack* fCommandStack; From stippi at mail.berlios.de Tue Apr 1 10:06:43 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 1 Apr 2008 10:06:43 +0200 Subject: [Haiku-commits] r24716 - in haiku/trunk/src/apps/mediaplayer: . settings Message-ID: <200804010806.m3186htV012593@sheep.berlios.de> Author: stippi Date: 2008-04-01 10:06:39 +0200 (Tue, 01 Apr 2008) New Revision: 24716 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24716&view=rev Added: haiku/trunk/src/apps/mediaplayer/settings/ haiku/trunk/src/apps/mediaplayer/settings/Settings.cpp haiku/trunk/src/apps/mediaplayer/settings/Settings.h haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.h Log: Argh! Forgot to svn add these files. Should have been part of last commit. Added: haiku/trunk/src/apps/mediaplayer/settings/Settings.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/settings/Settings.cpp 2008-04-01 07:42:35 UTC (rev 24715) +++ haiku/trunk/src/apps/mediaplayer/settings/Settings.cpp 2008-04-01 08:06:39 UTC (rev 24716) @@ -0,0 +1,107 @@ +/* + * Copyright 2008, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fredrik Mod?en + */ + +#include "Settings.h" + +#include + +#include +#include +#include + +#include "TPreferences.h" + +Settings::Settings(const char *filename) + : fTPreferences(TPreferences(B_USER_CONFIG_DIRECTORY, filename)) +{ +} + + +void +Settings::LoadSettings(mpSettings &settings) +{ + BPath path; + + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) + return; + + path.Append(SETTINGSFILENAME); + + BFile settingsFile(path.Path(), B_READ_ONLY); + + if (settingsFile.InitCheck() != B_OK) { + _SetDefault(settings); + return; + } + + fTPreferences.Unflatten(&settingsFile); + memset(&settings, 0, sizeof(settings)); + + fTPreferences.FindInt8("autostart", (int8 *)&settings.autostart); + fTPreferences.FindInt8("closeWhenDonePlayingMovie", + (int8 *)&settings.closeWhenDonePlayingMovie); + fTPreferences.FindInt8("closeWhenDonePlayingSound", + (int8 *)&settings.closeWhenDonePlayingSound); + fTPreferences.FindInt8("loopMovie", (int8 *)&settings.loopMovie); + fTPreferences.FindInt8("loopSound", (int8 *)&settings.loopSound); + fTPreferences.FindInt8("fullVolume", (int8 *)&settings.fullVolume); + fTPreferences.FindInt8("halfVolume", (int8 *)&settings.halfVolume); + fTPreferences.FindInt8("mute", (int8 *)&settings.mute); + + fTPreferences.Flatten(&settingsFile); +} + + +void +Settings::SaveSettings(const mpSettings &settings) +{ + BPath path; + + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path, true) != B_OK) + return; + + path.Append(SETTINGSFILENAME); + + BFile settingsFile(path.Path(), B_READ_WRITE | B_CREATE_FILE); + + fTPreferences.Unflatten(&settingsFile); + + fTPreferences.SetInt8("autostart", settings.autostart); + fTPreferences.SetInt8("closeWhenDonePlayingMovie", + settings.closeWhenDonePlayingMovie); + fTPreferences.SetInt8("closeWhenDonePlayingSound", + settings.closeWhenDonePlayingSound); + fTPreferences.SetInt8("loopMovie", settings.loopMovie); + fTPreferences.SetInt8("loopSound", settings.loopSound); + fTPreferences.SetInt8("fullVolume", settings.fullVolume); + fTPreferences.SetInt8("halfVolume", settings.halfVolume); + fTPreferences.SetInt8("mute", settings.mute); + + settingsFile.SetSize(0); + settingsFile.Seek(0, SEEK_SET); + + fTPreferences.Flatten(&settingsFile); +} + + +void +Settings::_SetDefault(mpSettings &settings) +{ + memset(&settings, 0, sizeof(settings)); + + settings.autostart = 0; + settings.closeWhenDonePlayingMovie = 0; + settings.closeWhenDonePlayingSound = 0; + settings.loopMovie = 0; + settings.loopSound = 0; + settings.fullVolume = 0; + settings.halfVolume = 0; + settings.mute = 1; +} + + Added: haiku/trunk/src/apps/mediaplayer/settings/Settings.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/settings/Settings.h 2008-04-01 07:42:35 UTC (rev 24715) +++ haiku/trunk/src/apps/mediaplayer/settings/Settings.h 2008-04-01 08:06:39 UTC (rev 24716) @@ -0,0 +1,38 @@ +/* + * Copyright 2008, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fredrik Mod?en + */ + +#ifndef __SETTINGS_H__ +#define __SETTINGS_H__ + +#include +#include + +#include "TPreferences.h" + +struct mpSettings { + int8 + autostart, closeWhenDonePlayingMovie, closeWhenDonePlayingSound, + loopMovie, loopSound, fullVolume, halfVolume, mute; +}; + +#define SETTINGSFILENAME "MediaPlayerSettings" + +class Settings { + public: + Settings(const char *filename = SETTINGSFILENAME); + + void LoadSettings(mpSettings &settings); + void SaveSettings(const mpSettings &settings); + + private: + void _SetDefault(mpSettings &settings); + + TPreferences fTPreferences; +}; + +#endif // __SETTINGS_H__ Added: haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp 2008-04-01 07:42:35 UTC (rev 24715) +++ haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.cpp 2008-04-01 08:06:39 UTC (rev 24716) @@ -0,0 +1,182 @@ +/* + * Copyright 2008, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fredrik Mod?en + */ + +#include "SettingsWindow.h" + +#include + +#include +#include +#include +#include +#include +#include +#include + +enum { + M_AUTOSTART = 0x3000, + M_CLOSE_WINDOW_MOVIE, + M_CLOSE_WINDOW_SOUNDS, + M_LOOP_MOVIE, + M_LOOP_SOUND, + M_START_FULL_VOLUME, + M_START_HALF_VOLUME, + M_START_MUTE_VOLUME, + M_SETTINGS_SAVE, + M_SETTINGS_CANCEL, +}; + +#define SPACE 10 +#define SPACEING 7 +#define BUTTONHEIGHT 20 + +SettingsWindow::SettingsWindow(BRect frame) + : BWindow(frame, "Settings", B_MODAL_WINDOW, B_NOT_CLOSABLE | B_NOT_ZOOMABLE + | B_NOT_RESIZABLE) +{ + fSettingsObj = new Settings(); + fSettingsObj->LoadSettings(fSettings); + + frame = Bounds(); + BView* view = new BView(frame,"SettingsView",B_FOLLOW_ALL_SIDES,B_WILL_DRAW); + view->SetViewColor(216, 216, 216); + + BRect btnRect(140.00, frame.bottom - (SPACE + BUTTONHEIGHT), 205.00, + frame.bottom-SPACE); + BButton* btn = new BButton(btnRect, "btnCancel", "Cancel", + new BMessage(M_SETTINGS_CANCEL)); + view->AddChild(btn); + + btnRect.OffsetBy(btnRect.Width() + SPACE, 0); + btn = new BButton(btnRect, "btnOK", "OK", new BMessage(M_SETTINGS_SAVE)); + view->AddChild(btn); + + BRect rectBox(frame.left + SPACE, frame.top + SPACE, frame.right - SPACE, + btnRect.top- SPACE); + BBox* bbox = new BBox(rectBox, "box1", B_FOLLOW_ALL_SIDES,B_WILL_DRAW | B_NAVIGABLE, + B_FANCY_BORDER); + bbox->SetLabel("MediaPlayer Settings"); + + BFont font; + font_height fh1; + font.GetHeight(&fh1); + + BString str("Play Mode:"); + BRect rect(rectBox.left, rectBox.top + SPACE, rectBox.right - (12*2), + rectBox.top + fh1.leading + fh1.ascent + 10); + bbox->AddChild(new BStringView(rect, "stringViewPlayMode", str.String())); + + rect.OffsetBy(0, rect.Height()); + bbox->AddChild(fChkboxAutostart = new BCheckBox(rect, "chkboxAutostart", + "Automatically start playing", new BMessage(M_AUTOSTART))); + + rect.OffsetBy(SPACE, rect.Height() + SPACEING); + bbox->AddChild(fChkBoxCloseWindowMovies = new BCheckBox(rect, "chkBoxCloseWindowMovies", + "Close window when done playing movies", new BMessage(M_CLOSE_WINDOW_MOVIE))); + + rect.OffsetBy(0, rect.Height() + SPACEING); + bbox->AddChild(fChkBoxCloseWindowSounds = new BCheckBox(rect, "chkBoxCloseWindowSounds", + "Close window when done playing sounds", new BMessage(M_CLOSE_WINDOW_SOUNDS))); + + rect.OffsetBy(-SPACE, rect.Height() + SPACEING); + bbox->AddChild(fChkBoxLoopMovie = new BCheckBox(rect, "chkBoxLoopMovie", "Loop movies by default", + new BMessage(M_LOOP_MOVIE))); + + rect.OffsetBy(0, rect.Height() + SPACEING); + bbox->AddChild(fChkBoxLoopSounds = new BCheckBox(rect, "chkBoxLoopSounds", "Loop sounds by default", + new BMessage(M_LOOP_SOUND))); + + rect.OffsetBy(0, rect.Height() + SPACE + SPACEING); + bbox->AddChild(new BStringView(rect, "stringViewPlayBackg", + "Play backgrounds movies at:")); + + rect.OffsetBy(SPACE, rect.Height() + SPACEING); + fRdbtnfullvolume = new BRadioButton(rect, "rdbtnfullvolume", + "Full Volume", new BMessage(M_START_FULL_VOLUME)); + bbox->AddChild(fRdbtnfullvolume); + + rect.OffsetBy(0, rect.Height() + SPACEING); + fRdbtnhalfvolume = new BRadioButton(rect, "rdbtnhalfvolume", + "Half Volume", new BMessage(M_START_HALF_VOLUME)); + bbox->AddChild(fRdbtnhalfvolume); + + rect.OffsetBy(0, rect.Height() + SPACEING); + fRdbtnmutevolume = new BRadioButton(rect, "rdbtnfullvolume", "Muted", + new BMessage(M_START_MUTE_VOLUME)); + bbox->AddChild(fRdbtnmutevolume); + + SetSettings(); + + view->AddChild(bbox); + AddChild(view); +} + + +SettingsWindow::~SettingsWindow() +{ +} + + +void +SettingsWindow::SetSettings() +{ + fChkboxAutostart->SetValue(fSettings.autostart); + fChkBoxCloseWindowMovies->SetValue(fSettings.closeWhenDonePlayingMovie); + fChkBoxCloseWindowSounds->SetValue(fSettings.closeWhenDonePlayingSound); + fChkBoxLoopMovie->SetValue(fSettings.loopMovie); + fChkBoxLoopSounds->SetValue(fSettings.loopSound); + fRdbtnfullvolume->SetValue(fSettings.fullVolume); + fRdbtnhalfvolume->SetValue(fSettings.halfVolume); + fRdbtnmutevolume->SetValue(fSettings.mute); +} + + +bool +SettingsWindow::QuitRequested() +{ + Hide(); + return false; +} + + +void +SettingsWindow::MessageReceived(BMessage* message) +{ + switch (message->what) { + case M_AUTOSTART: + case M_CLOSE_WINDOW_MOVIE: + case M_CLOSE_WINDOW_SOUNDS: + case M_LOOP_MOVIE: + case M_LOOP_SOUND: + case M_START_FULL_VOLUME: + case M_START_HALF_VOLUME: + case M_START_MUTE_VOLUME: + fSettings.autostart = fChkboxAutostart->Value(); + fSettings.closeWhenDonePlayingMovie = fChkBoxCloseWindowMovies->Value(); + fSettings.closeWhenDonePlayingSound = fChkBoxCloseWindowSounds->Value(); + fSettings.loopMovie = fChkBoxLoopMovie->Value(); + fSettings.loopSound = fChkBoxLoopSounds->Value(); + fSettings.fullVolume = fRdbtnfullvolume->Value(); + fSettings.halfVolume = fRdbtnhalfvolume->Value(); + fSettings.mute = fRdbtnmutevolume->Value(); + case B_KEY_DOWN: + int32 index; + if(message->FindInt32("key", &index) == B_NO_ERROR) + if(index == 1) + PostMessage(B_QUIT_REQUESTED); + break; + case M_SETTINGS_SAVE: + fSettingsObj->SaveSettings(fSettings); + case M_SETTINGS_CANCEL: + PostMessage(B_QUIT_REQUESTED); + break; + default: + BWindow::MessageReceived(message); + break; + } +} Added: haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.h 2008-04-01 07:42:35 UTC (rev 24715) +++ haiku/trunk/src/apps/mediaplayer/settings/SettingsWindow.h 2008-04-01 08:06:39 UTC (rev 24716) @@ -0,0 +1,39 @@ +/* + * Copyright 2008, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fredrik Mod?en + */ + +#ifndef _SETTINGS_WINDOW_H +#define _SETTINGS_WINDOW_H + +#include +#include +#include + +#include "Settings.h" + +class SettingsWindow : public BWindow { + public: + SettingsWindow(BRect frame); + virtual ~SettingsWindow(); + void SetSettings(); + virtual bool QuitRequested(); + virtual void MessageReceived(BMessage* message); + private: + Settings* fSettingsObj; + mpSettings fSettings; + + BCheckBox* fChkboxAutostart; + BCheckBox* fChkBoxCloseWindowMovies; + BCheckBox* fChkBoxCloseWindowSounds; + BCheckBox* fChkBoxLoopMovie; + BCheckBox* fChkBoxLoopSounds; + BRadioButton* fRdbtnfullvolume; + BRadioButton* fRdbtnhalfvolume; + BRadioButton* fRdbtnmutevolume; +}; + +#endif From marcusoverhagen at arcor.de Tue Apr 1 10:12:49 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Tue, 1 Apr 2008 10:12:49 +0200 (CEST) Subject: [Haiku-commits] r24671 - in haiku/trunk: headers/private/media src/kits/media In-Reply-To: <47F1D3E9.5080208@kaldience.com> References: <47F1D3E9.5080208@kaldience.com> <200803300135.m2U1ZxYd015121@sheep.berlios.de> <47F15D66.8040103@arcor.de> Message-ID: <7769235.1207037569862.JavaMail.ngmail@webmail13> Maurice Kalinowski wrote: > Marcus Overhagen wrote: > > mauricek at BerliOS schrieb: > > > > > >> + case FILEINTERFACE_SET_REF: > >> + { > >> + reply.duration = request->duration; > >> + > >> + rv = SetRef(ref, request->create, &reply.duration); > >> + reply.duration = request->duration; > >> > > > > are you sure? reply.duration is ignored. > > > Cannot say anything from work about this. > > It shouldn't be ignored, so at least at that point this is ok. It should > be processed in the reply handling. As the svn browser is dead > currently, I cannot take a look from here. What I meant to say is: The value that is stored in reply.duration by the SetRef function is overwritten by the request->duration one line later. That way, the value set by SetRef is discarded. Marcus Jetzt komfortabel bei Arcor-Digital TV einsteigen: Mehr Happy Ends, mehr Herzschmerz, mehr Fernsehen! Erleben Sie 50 digitale TV Programme und optional 60 Pay TV Sender, einen elektronischen Programmf?hrer mit Movie Star Bewertungen von TV Movie. Au?erdem, aktuelle Filmhits und prickelnde Erotik in der Arcor-Videothek. Infos unter www.arcor.de/tv From axeld at pinc-software.de Tue Apr 1 10:20:43 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Apr 2008 10:20:43 +0200 CEST Subject: [Haiku-commits] r24669 - in haiku/trunk: headers/posix headers/private/kernel src/kits/network/dns src/system/kernel src/system/libroot/posix/unistd In-Reply-To: <9007738927-BeMail@laptop> Message-ID: <700983474-BeMail@zon> "Fran?ois Revol" wrote: > > What happens when copying these files or trying to make/restore a > > backup? > You'd get doubled users if root copies. > User copies won't be able to add the attr oth. Even if we wanted to use single files, there would still be no good reason to use queries IMO. Bye, Axel. From axeld at mail.berlios.de Tue Apr 1 14:15:20 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 1 Apr 2008 14:15:20 +0200 Subject: [Haiku-commits] r24717 - in haiku/trunk: headers/private/kernel src/system/kernel src/system/libroot/posix/signal Message-ID: <200804011215.m31CFKuv024538@sheep.berlios.de> Author: axeld Date: 2008-04-01 14:15:14 +0200 (Tue, 01 Apr 2008) New Revision: 24717 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24717&view=rev Added: haiku/trunk/src/system/libroot/posix/signal/sigwait.c Modified: haiku/trunk/headers/private/kernel/ksignal.h haiku/trunk/headers/private/kernel/syscalls.h haiku/trunk/src/system/kernel/signal.cpp haiku/trunk/src/system/libroot/posix/signal/Jamfile Log: * Implemented sigwait(). * Not sure if it works as intended, as the specs are a bit vague. Modified: haiku/trunk/headers/private/kernel/ksignal.h =================================================================== --- haiku/trunk/headers/private/kernel/ksignal.h 2008-04-01 08:06:39 UTC (rev 24716) +++ haiku/trunk/headers/private/kernel/ksignal.h 2008-04-01 12:15:14 UTC (rev 24717) @@ -40,6 +40,7 @@ extern status_t _user_sigaction(int sig, const struct sigaction *newAction, struct sigaction *oldAction); extern bigtime_t _user_set_alarm(bigtime_t time, uint32 mode); +extern status_t _user_sigwait(const sigset_t *set, int *_signal); extern status_t _user_sigsuspend(const sigset_t *mask); extern status_t _user_sigpending(sigset_t *set); extern status_t _user_set_signal_stack(const stack_t *newUserStack, Modified: haiku/trunk/headers/private/kernel/syscalls.h =================================================================== --- haiku/trunk/headers/private/kernel/syscalls.h 2008-04-01 08:06:39 UTC (rev 24716) +++ haiku/trunk/headers/private/kernel/syscalls.h 2008-04-01 12:15:14 UTC (rev 24717) @@ -131,6 +131,7 @@ extern status_t _kern_sigaction(int sig, const struct sigaction *action, struct sigaction *oldAction); extern bigtime_t _kern_set_alarm(bigtime_t time, uint32 mode); +extern status_t _kern_sigwait(const sigset_t *set, int *_signal); extern status_t _kern_sigsuspend(const sigset_t *mask); extern status_t _kern_sigpending(sigset_t *set); extern status_t _kern_set_signal_stack(const stack_t *newStack, @@ -248,7 +249,7 @@ extern area_id _kern_transfer_area(area_id area, void **_address, uint32 addressSpec, team_id target); extern status_t _kern_set_area_protection(area_id area, uint32 newProtection); -extern area_id _kern_clone_area(const char *name, void **_address, uint32 addressSpec, +extern area_id _kern_clone_area(const char *name, void **_address, uint32 addressSpec, uint32 protection, area_id sourceArea); extern status_t _kern_reserve_heap_address_range(addr_t* _address, uint32 addressSpec, addr_t size); @@ -296,7 +297,7 @@ extern int32 _kern_atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst); extern int32 _kern_atomic_add(vint32 *value, int32 addValue); extern int32 _kern_atomic_and(vint32 *value, int32 andValue); -extern int32 _kern_atomic_or(vint32 *value, int32 orValue); +extern int32 _kern_atomic_or(vint32 *value, int32 orValue); extern int32 _kern_atomic_get(vint32 *value); #endif // ATOMIC_FUNCS_ARE_SYSCALLS @@ -305,7 +306,7 @@ extern int64 _kern_atomic_test_and_set64(vint64 *value, int64 newValue, int64 testAgainst); extern int64 _kern_atomic_add64(vint64 *value, int64 addValue); extern int64 _kern_atomic_and64(vint64 *value, int64 andValue); -extern int64 _kern_atomic_or64(vint64 *value, int64 orValue); +extern int64 _kern_atomic_or64(vint64 *value, int64 orValue); extern int64 _kern_atomic_get64(vint64 *value); #endif // ATOMIC64_FUNCS_ARE_SYSCALLS Modified: haiku/trunk/src/system/kernel/signal.cpp =================================================================== --- haiku/trunk/src/system/kernel/signal.cpp 2008-04-01 08:06:39 UTC (rev 24716) +++ haiku/trunk/src/system/kernel/signal.cpp 2008-04-01 12:15:14 UTC (rev 24717) @@ -7,6 +7,8 @@ /*! POSIX signals handling routines */ +#include + #include #include @@ -17,8 +19,8 @@ #include #include #include -#include #include +#include #include #include #include @@ -203,7 +205,7 @@ #endif // SIGNAL_TRACING -// #pragma mark - +// #pragma mark - /*! Updates the thread::flags field according to what signals are pending. @@ -482,7 +484,7 @@ if (flags & B_CHECK_PERMISSION) { // ToDo: introduce euid & uid fields to the team and check permission } - + if (signal == 0) return B_OK; @@ -560,7 +562,7 @@ if ((flags & SIGNAL_FLAG_TEAMS_LOCKED) == 0) state = disable_interrupts(); - + if (id > 0) { // send a signal to the specified thread @@ -574,7 +576,7 @@ // (the absolute value of the id) struct process_group *group; - + // TODO: handle -1 correctly if (id == 0 || id == -1) { // send a signal to the current team @@ -612,7 +614,7 @@ RELEASE_TEAM_LOCK(); GRAB_THREAD_LOCK(); - } + } // ToDo: maybe the scheduler should only be invoked if there is reason to do it? // (ie. deliver_signal() moved some threads in the running queue?) @@ -798,6 +800,46 @@ } +/*! Wait for the specified signals, and return the signal retrieved in + \a _signal. +*/ +int +sigwait(const sigset_t *set, int *_signal) +{ + struct thread *thread = thread_get_current_thread(); + int signalsPending = 0; + + ConditionVariable conditionVar; + conditionVar.Publish(set, "sigwait"); + + while (true) { + ConditionVariableEntry entry; + entry.Wait(set, B_CAN_INTERRUPT); + + if (has_signals_pending(thread)) { + signalsPending = atomic_get(&thread->sig_pending) & *set; + break; + } + } + + conditionVar.Unpublish(); + + update_current_thread_signals_flag(); + + if (signalsPending) { + // select the lowest pending signal to return in _signal + for (int signal = 1; signal < NSIG; signal++) { + if ((SIGNAL_TO_MASK(signal) & signalsPending) != 0) { + *_signal = signal; + return B_OK; + } + } + } + + return B_INTERRUPTED; +} + + /*! Replace the current signal block mask and wait for any event to happen. Before returning, the original signal block mask is reinstantiated. */ @@ -843,7 +885,7 @@ if (set == NULL) return B_BAD_VALUE; - *set = atomic_get(&thread->sig_pending); + *set = atomic_get(&thread->sig_pending); return B_OK; } @@ -916,6 +958,25 @@ status_t +_user_sigwait(const sigset_t *userSet, int *_userSignal) +{ + if (userSet == NULL || _userSignal == NULL) + return B_BAD_VALUE; + + sigset_t set; + if (user_memcpy(&set, userSet, sizeof(sigset_t)) < B_OK) + return B_BAD_ADDRESS; + + int signal; + status_t status = sigwait(&set, &signal); + if (status < B_OK) + return syscall_restart_handle_post(status); + + return user_memcpy(_userSignal, &signal, sizeof(int)); +} + + +status_t _user_sigsuspend(const sigset_t *userMask) { sigset_t mask; Modified: haiku/trunk/src/system/libroot/posix/signal/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/signal/Jamfile 2008-04-01 08:06:39 UTC (rev 24716) +++ haiku/trunk/src/system/libroot/posix/signal/Jamfile 2008-04-01 12:15:14 UTC (rev 24717) @@ -19,5 +19,6 @@ sigrelse.cpp sigset.c sigsuspend.c + sigwait.c strsignal.c ; Added: haiku/trunk/src/system/libroot/posix/signal/sigwait.c =================================================================== --- haiku/trunk/src/system/libroot/posix/signal/sigwait.c 2008-04-01 08:06:39 UTC (rev 24716) +++ haiku/trunk/src/system/libroot/posix/signal/sigwait.c 2008-04-01 12:15:14 UTC (rev 24717) @@ -0,0 +1,18 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include + +#include + + +int +sigwait(const sigset_t *set, int *_signal) +{ + return _kern_sigwait(set, _signal); + // does not set errno, but returns the error value directly +} + From axeld at mail.berlios.de Tue Apr 1 14:17:02 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 1 Apr 2008 14:17:02 +0200 Subject: [Haiku-commits] r24718 - haiku/trunk/src/system/libroot/posix/pthread Message-ID: <200804011217.m31CH2GN024633@sheep.berlios.de> Author: axeld Date: 2008-04-01 14:17:02 +0200 (Tue, 01 Apr 2008) New Revision: 24718 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24718&view=rev Modified: haiku/trunk/src/system/libroot/posix/pthread/pthread.c Log: pthread_detach() no longer fails, as we currently have all threads detached. We would need to have a hash that contains the thread data to be able to comply with the specs AFAICT. Modified: haiku/trunk/src/system/libroot/posix/pthread/pthread.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pthread/pthread.c 2008-04-01 12:15:14 UTC (rev 24717) +++ haiku/trunk/src/system/libroot/posix/pthread/pthread.c 2008-04-01 12:17:02 UTC (rev 24718) @@ -153,6 +153,7 @@ int pthread_detach(pthread_t thread) { - return B_NOT_ALLOWED; + // TODO: currently, all threads are detached in our implementation... + return 0; } From stippi at mail.berlios.de Tue Apr 1 15:49:39 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 1 Apr 2008 15:49:39 +0200 Subject: [Haiku-commits] r24719 - haiku/trunk/src/apps/mediaplayer/support Message-ID: <200804011349.m31Dndgq001292@sheep.berlios.de> Author: stippi Date: 2008-04-01 15:49:39 +0200 (Tue, 01 Apr 2008) New Revision: 24719 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24719&view=rev Added: haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.cpp haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.h haiku/trunk/src/apps/mediaplayer/support/TPreferences.cpp haiku/trunk/src/apps/mediaplayer/support/TPreferences.h Log: * Again, I forgot to svn add some files. Sorry. Build should be fixed. Added: haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.cpp 2008-04-01 12:17:02 UTC (rev 24718) +++ haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.cpp 2008-04-01 13:49:39 UTC (rev 24719) @@ -0,0 +1,76 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer + * Fredrik Mod?en + */ + +#include "FileReadWrite.h" + +#include +#include + +FileReadWrite::FileReadWrite(BFile *file, int32 sourceEncoding) + : fFile(file), + fSourceEncoding(sourceEncoding) +{} + + +void +FileReadWrite::SetEncoding(int32 sourceEncoding) +{ + fSourceEncoding = sourceEncoding; +} + + +uint32 +FileReadWrite::GetEncoding() +{ + return fSourceEncoding; +} + + +status_t +FileReadWrite::Write(const BString& contents)const +{ + ssize_t sz = fFile->Write(contents.String(), contents.Length()); + if (sz != contents.Length()) + return sz < 0 ? sz : B_IO_ERROR; + else + return B_OK; +} + + +bool +FileReadWrite::Next(BString& string) +{ + // Fill up the buffer with the first chunk of code + if (fPositionInBuffer == 0) + fAmtRead = fFile->Read(&fBuffer, sizeof(fBuffer)); + while (fAmtRead > 0) { + while (fPositionInBuffer < fAmtRead) { + // Return true if we hit a newline or the end of the file + if (fBuffer[fPositionInBuffer] == '\n') { + fPositionInBuffer++; + //Convert begin + int32 state = 0; + int32 bufferLen = string.Length(); + int32 destBufferLen = bufferLen; + char destination[destBufferLen]; + if (fSourceEncoding) + convert_to_utf8(fSourceEncoding, string.String(), &bufferLen, destination, &destBufferLen, &state); + string = destination; + return true; + } + string += fBuffer[fPositionInBuffer]; + fPositionInBuffer++; + } + + // Once the buffer runs out, grab some more and start again + fAmtRead = fFile->Read(&fBuffer, sizeof(fBuffer)); + fPositionInBuffer = 0; + } + return false; +} Added: haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.h 2008-04-01 12:17:02 UTC (rev 24718) +++ haiku/trunk/src/apps/mediaplayer/support/FileReadWrite.h 2008-04-01 13:49:39 UTC (rev 24719) @@ -0,0 +1,34 @@ +/* + * Copyright 2008, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer + * Fredrik Mod?en + */ + +#ifndef _FILEREADRWITE_ +#define _FILEREADRWITE_ + +#include +#include +#include + +class FileReadWrite { + public: + // -1 defult encoding + FileReadWrite(BFile *file, int32 sourceEncoding = -1); + bool Next(BString& string); + status_t Write(const BString& contents)const; + void SetEncoding(int32 sourceEncoding); + uint32 GetEncoding(); + + private: + BFile* fFile; + int32 fSourceEncoding; + char fBuffer[4096]; + off_t fPositionInBuffer; + ssize_t fAmtRead; +}; + +#endif //_FILEREADRWITE_ Added: haiku/trunk/src/apps/mediaplayer/support/TPreferences.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/TPreferences.cpp 2008-04-01 12:17:02 UTC (rev 24718) +++ haiku/trunk/src/apps/mediaplayer/support/TPreferences.cpp 2008-04-01 13:49:39 UTC (rev 24719) @@ -0,0 +1,138 @@ +//Volume II, Issue 35; September 2, 1998 (Eric Shepherd) + +#include "TPreferences.h" + +#include +#include + +TPreferences::TPreferences(directory_which directory, const char *filename) + :BMessage('pref') +{ + BFile file; + fStatus = find_directory(directory, &fPath); + + if (fStatus != B_OK) + return; + + fPath.Append(filename); + fStatus = file.SetTo(fPath.Path(), B_READ_ONLY); + + if (fStatus == B_OK) + fStatus = Unflatten(&file); +} + + +TPreferences::~TPreferences() +{ + BFile file; + if (file.SetTo(fPath.Path(), B_WRITE_ONLY | B_CREATE_FILE) == B_OK) + Flatten(&file); +} + + +status_t +TPreferences::SetBool(const char *name, bool b) +{ + if (HasBool(name)) + return ReplaceBool(name, 0, b); + return AddBool(name, b); +} + + +status_t +TPreferences::SetInt8(const char *name, int8 i) +{ + if (HasInt8(name)) + return ReplaceInt8(name, 0, i); + return AddInt8(name, i); +} + + +status_t +TPreferences::SetInt16(const char *name, int16 i) +{ + if (HasInt16(name)) + return ReplaceInt16(name, 0, i); + return AddInt16(name, i); +} + + +status_t +TPreferences::SetInt32(const char *name, int32 i) +{ + if (HasInt32(name)) + return ReplaceInt32(name, 0, i); + return AddInt32(name, i); +} + + +status_t +TPreferences::SetInt64(const char *name, int64 i) +{ + if (HasInt64(name)) + return ReplaceInt64(name, 0, i); + return AddInt64(name, i); +} + + +status_t +TPreferences::SetFloat(const char *name, float f) +{ + if (HasFloat(name)) + return ReplaceFloat(name, 0, f); + return AddFloat(name, f); +} + + +status_t +TPreferences::SetDouble(const char *name, double f) +{ + if (HasDouble(name)) + return ReplaceDouble(name, 0, f); + return AddDouble(name, f); +} + + +status_t +TPreferences::SetString(const char *name, const char *s) +{ + if (HasString(name)) + return ReplaceString(name, 0, s); + return AddString(name, s); +} + + +status_t +TPreferences::SetPoint(const char *name, BPoint p) +{ + if (HasPoint(name)) + return ReplacePoint(name, 0, p); + return AddPoint(name, p); +} + + +status_t +TPreferences::SetRect(const char *name, BRect r) +{ + if (HasRect(name)) + return ReplaceRect(name, 0, r); + return AddRect(name, r); +} + + +status_t +TPreferences::SetMessage(const char *name, const BMessage *message) +{ + if (HasMessage(name)) + return ReplaceMessage(name, 0, message); + return AddMessage(name, message); +} + + +status_t +TPreferences::SetFlat(const char *name, const BFlattenable *obj) +{ + if (HasFlat(name, obj)) + return ReplaceFlat(name, 0, (BFlattenable *) obj); + return AddFlat(name, (BFlattenable *) obj); +} Added: haiku/trunk/src/apps/mediaplayer/support/TPreferences.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/support/TPreferences.h 2008-04-01 12:17:02 UTC (rev 24718) +++ haiku/trunk/src/apps/mediaplayer/support/TPreferences.h 2008-04-01 13:49:39 UTC (rev 24719) @@ -0,0 +1,68 @@ +#ifndef __TPREFS_H__ +#define __TPREFS_H__ + +//Volume II, Issue 35; September 2, 1998 (Eric Shepherd) +/* +Usage + TPreferences prefs("PrefsSample_prefs"); // Preferences + if (prefs.InitCheck() != B_OK) { + prefs.SetInt64("last_used", real_time_clock()); + prefs.SetInt32("use_count", 0); + } + +Then we call PrintToStream() to print out the contents of the TPreferences object: + +prefs.PrintToStream(); + +Finally, we update the preferences: + + int32 count; + if (prefs.FindInt32("use_count", &count) != B_OK) { + count = 0; + } + prefs.SetInt64("last_used", real_time_clock()); + prefs.SetInt32("use_count", ++count); + +*/ +#include +#include +#include + +class TPreferences : public BMessage { + public: + TPreferences(directory_which directory, const char* filename); + virtual ~TPreferences(); + + + status_t InitCheck(void); + status_t SetBool(const char *name, bool b); + status_t SetInt8(const char *name, int8 i); + status_t SetInt16(const char *name, int16 i); + status_t SetInt32(const char *name, int32 i); + status_t SetInt64(const char *name, int64 i); + status_t SetFloat(const char *name, float f); + status_t SetDouble(const char *name, double d); + status_t SetString(const char *name, + const char *string); + status_t SetPoint(const char *name, BPoint p); + status_t SetRect(const char *name, BRect r); + status_t SetMessage(const char *name, + const BMessage *message); + status_t SetFlat(const char *name, + const BFlattenable *obj); + private: + BPath fPath; + status_t fStatus; +}; + +inline +status_t TPreferences::InitCheck(void) +{ + return fStatus; +} + +#if __POWERPC__ +#pragma export off +#endif + +#endif // __TPREFS_H__ From bga at mail.berlios.de Tue Apr 1 17:38:02 2008 From: bga at mail.berlios.de (bga at BerliOS) Date: Tue, 1 Apr 2008 17:38:02 +0200 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs Message-ID: <200804011538.m31Fc2uV012651@sheep.berlios.de> Author: bga Date: 2008-04-01 17:38:01 +0200 (Tue, 01 Apr 2008) New Revision: 24720 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24720&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: - vnode_path_to_vnode() now returns B_NOT_A_DIRECTORY instead of B_NOT_ALLOWED as expected by POSIX programs. This allowed be to compile Haiku under itself without any hacks at all, so I guess this means that now we are officially self-hosting! Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 13:49:39 UTC (rev 24719) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 15:38:01 UTC (rev 24720) @@ -1821,6 +1821,15 @@ if (status < B_OK) { put_vnode(vnode); + if (status == B_NOT_ALLOWED) { + // We are only concerned about directories here, so + // B_NOT_ALLOWED is actually B_NOT_A_DIRECTORY. This + // happens because fs_access() can be called on files + // to and this would be valid outside of the context + // of vnode_path_to_vnode(). This is also what POSIX + // programs expect as return code in this case. + return B_NOT_A_DIRECTORY; + } return status; } From ingo_weinhold at gmx.de Tue Apr 1 18:12:32 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 01 Apr 2008 18:12:32 +0200 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200804011538.m31Fc2uV012651@sheep.berlios.de> References: <200804011538.m31Fc2uV012651@sheep.berlios.de> Message-ID: <20080401181232.369.1@knochen-vm.1207065770.fake> On 2008-04-01 at 17:38:02 [+0200], bga at BerliOS wrote: > Author: bga > Date: 2008-04-01 17:38:01 +0200 (Tue, 01 Apr 2008) > New Revision: 24720 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24720&view=rev > > Modified: > haiku/trunk/src/system/kernel/fs/vfs.cpp > Log: > - vnode_path_to_vnode() now returns B_NOT_A_DIRECTORY instead of > B_NOT_ALLOWED > as expected by POSIX programs. This allowed be to compile Haiku under > itself > without any hacks at all, so I guess this means that now we are officially > self-hosting! > > > > Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp > =================================================================== > --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 13:49:39 UTC > (rev 24719) > +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 15:38:01 UTC > (rev 24720) > @@ -1821,6 +1821,15 @@ > > if (status < B_OK) { > put_vnode(vnode); > + if (status == B_NOT_ALLOWED) { > + // We are only concerned about directories here, > so > + // B_NOT_ALLOWED is actually B_NOT_A_DIRECTORY. > This > + // happens because fs_access() can be called on > files > + // to and this would be valid outside of the > context > + // of vnode_path_to_vnode(). This is also what > POSIX > + // programs expect as return code in this case. > + return B_NOT_A_DIRECTORY; > + } > return status; > } While it works around a specific problem, this change just switches which case is wrong. Now you'll get a B_NOT_A_DIRECTORY, if there is a directory for which you don't have X permission. The correct solution is obviously to check the type of the supposed directory vnode. To avoid extra stat()ing, we'll have to pass it as a parameter. CU, Ingo From axeld at pinc-software.de Tue Apr 1 18:14:08 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Apr 2008 18:14:08 +0200 CEST Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200804011538.m31Fc2uV012651@sheep.berlios.de> Message-ID: <25504625681-BeMail@zon> bga at BerliOS wrote: > Log: > - vnode_path_to_vnode() now returns B_NOT_A_DIRECTORY instead of > B_NOT_ALLOWED > as expected by POSIX programs. This allowed be to compile Haiku > under itself > without any hacks at all, so I guess this means that now we are > officially > self-hosting! That change is actually not correct, though, as the system will now return B_NOT_A_DIRECTORY when in fact it is a directory with missing privileges. Correct would be to check if "vnode" is a directory beforehand - probably in the calling function. Bye, Axel. From bga at bug-br.org.br Tue Apr 1 18:17:53 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 01 Apr 2008 13:17:53 -0300 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <20080401181232.369.1@knochen-vm.1207065770.fake> References: <200804011538.m31Fc2uV012651@sheep.berlios.de> <20080401181232.369.1@knochen-vm.1207065770.fake> Message-ID: <47F26031.4090707@bug-br.org.br> Ingo Weinhold wrote: > While it works around a specific problem, this change just switches which > case is wrong. Now you'll get a B_NOT_A_DIRECTORY, if there is a directory > for which you don't have X permission. The correct solution is obviously to > check the type of the supposed directory vnode. To avoid extra stat()ing, > we'll have to pass it as a parameter. I thought about checking inside Inode::CheckPermission() if the vnode referenced was a directory or a file and returning the correct error but I was not sure something else on the system relied on the current behaviour so I did not. But yes, I didn't foresee the problem you described but it is obviously real. giving a vnode in the vfs, is it possible to know if it is a directory or not in a way that does not cost an arm and a leg? If so, we could simply check that in vnode_path_to_vnode() and not even call fs_access() if the vnode does not refer to a directory (and return B_NOT_DIRECTORY). That would also sort it up. -Bruno From bga at bug-br.org.br Tue Apr 1 18:19:37 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 01 Apr 2008 13:19:37 -0300 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <25504625681-BeMail@zon> References: <25504625681-BeMail@zon> Message-ID: <47F26099.40701@bug-br.org.br> Axel D?rfler wrote: > That change is actually not correct, though, as the system will now > return B_NOT_A_DIRECTORY when in fact it is a directory with missing > privileges. > Correct would be to check if "vnode" is a directory beforehand - > probably in the calling function. Yes, but I did not see any obvious way to check if a vnode is a directory at the VFS level (it looks like only the fs itself knows that). is this really the case? -Bruno From korli at users.berlios.de Tue Apr 1 18:27:51 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 1 Apr 2008 18:27:51 +0200 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <25504625681-BeMail@zon> References: <200804011538.m31Fc2uV012651@sheep.berlios.de> <25504625681-BeMail@zon> Message-ID: 2008/4/1, Axel D?rfler : > That change is actually not correct, though, as the system will now > return B_NOT_A_DIRECTORY when in fact it is a directory with missing > privileges. The code style is also not correct on this change (space vs tabs). Bye, J?r?me From bga at bug-br.org.br Tue Apr 1 18:30:49 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 01 Apr 2008 13:30:49 -0300 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <47F26099.40701@bug-br.org.br> References: <25504625681-BeMail@zon> <47F26099.40701@bug-br.org.br> Message-ID: <47F26339.6090509@bug-br.org.br> Bruno Albuquerque wrote: > Axel D?rfler wrote: > >> That change is actually not correct, though, as the system will now >> return B_NOT_A_DIRECTORY when in fact it is a directory with missing >> privileges. >> Correct would be to check if "vnode" is a directory beforehand - >> probably in the calling function. > > Yes, but I did not see any obvious way to check if a vnode is a > directory at the VFS level (it looks like only the fs itself knows > that). is this really the case? I dug a bit more and the way to go seems to change fs_access() to also have a type parameter (like fs_lookup() does). Is it ok to change the interface? If so, I will go ahead and do it and also fix whatever breaks due to that. -Bruno From ingo_weinhold at gmx.de Tue Apr 1 18:39:35 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 01 Apr 2008 18:39:35 +0200 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <47F26099.40701@bug-br.org.br> References: <25504625681-BeMail@zon> <47F26099.40701@bug-br.org.br> Message-ID: <20080401183935.424.2@knochen-vm.1207065770.fake> On 2008-04-01 at 18:19:37 [+0200], Bruno Albuquerque wrote: > Axel D?rfler wrote: > > > That change is actually not correct, though, as the system will now > > return B_NOT_A_DIRECTORY when in fact it is a directory with missing > > privileges. > > Correct would be to check if "vnode" is a directory beforehand - > > probably in the calling function. > > Yes, but I did not see any obvious way to check if a vnode is a > directory at the VFS level (it looks like only the fs itself knows > that). is this really the case? The VFS can always read_stat() a vnode to find out. Moreover lookup() also returns the type, so at least from the second iteration on we already do have the type of the supposed directory node. So only passing the type of the directory node to vnode_path_to_vnode() (for the first iteration) will be necessary. That needs some checking whether/when that type is always know and get it, if not. CU, Ingo From ingo_weinhold at gmx.de Tue Apr 1 18:40:34 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 01 Apr 2008 18:40:34 +0200 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <47F26339.6090509@bug-br.org.br> References: <25504625681-BeMail@zon> <47F26099.40701@bug-br.org.br> <47F26339.6090509@bug-br.org.br> Message-ID: <20080401184034.461.3@knochen-vm.1207065770.fake> On 2008-04-01 at 18:30:49 [+0200], Bruno Albuquerque wrote: > Bruno Albuquerque wrote: > > Axel D?rfler wrote: > > > >> That change is actually not correct, though, as the system will now > >> return B_NOT_A_DIRECTORY when in fact it is a directory with missing > >> privileges. > >> Correct would be to check if "vnode" is a directory beforehand - > >> probably in the calling function. > > > > Yes, but I did not see any obvious way to check if a vnode is a > > directory at the VFS level (it looks like only the fs itself knows > > that). is this really the case? > > I dug a bit more and the way to go seems to change fs_access() to also > have a type parameter (like fs_lookup() does). Is it ok to change the > interface? If so, I will go ahead and do it and also fix whatever breaks > due to that. Please don't. That's really not necessary. CU, Ingo From bga at bug-br.org.br Tue Apr 1 18:46:26 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 01 Apr 2008 13:46:26 -0300 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <20080401184034.461.3@knochen-vm.1207065770.fake> References: <25504625681-BeMail@zon> <47F26099.40701@bug-br.org.br> <47F26339.6090509@bug-br.org.br> <20080401184034.461.3@knochen-vm.1207065770.fake> Message-ID: <47F266E2.2080301@bug-br.org.br> Ingo Weinhold wrote: >>>> That change is actually not correct, though, as the system will now >>>> return B_NOT_A_DIRECTORY when in fact it is a directory with missing >>>> privileges. >>>> Correct would be to check if "vnode" is a directory beforehand - >>>> probably in the calling function. >>> >>> Yes, but I did not see any obvious way to check if a vnode is a >>> directory at the VFS level (it looks like only the fs itself knows >>> that). is this really the case? >> >> I dug a bit more and the way to go seems to change fs_access() to also >> have a type parameter (like fs_lookup() does). Is it ok to change the >> interface? If so, I will go ahead and do it and also fix whatever breaks >> due to that. > > Please don't. That's really not necessary. Well, at least semantically, it does. The error returned by fs_access() is not enough to figure out what happened. Specially if you consider that you have a program that you provide a path to it and it know nothing about what that path is until it access it (which will go over vnode_path_to_vnode()). Of course I am open to other ideas. -Bruno From axeld at mail.berlios.de Tue Apr 1 19:39:52 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 1 Apr 2008 19:39:52 +0200 Subject: [Haiku-commits] r24721 - haiku/trunk/src/system/kernel/fs Message-ID: <200804011739.m31HdqAJ015729@sheep.berlios.de> Author: axeld Date: 2008-04-01 19:39:52 +0200 (Tue, 01 Apr 2008) New Revision: 24721 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24721&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Reverted r24720, and at least fixed the problematic return code after the first loop - the vnode passed in would still need to be checked, though. Eventually, it would be nice to move the check to the top, though, so that we don't need to search for the patch delimiter twice. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 15:38:01 UTC (rev 24720) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 17:39:52 UTC (rev 24721) @@ -1821,15 +1821,6 @@ if (status < B_OK) { put_vnode(vnode); - if (status == B_NOT_ALLOWED) { - // We are only concerned about directories here, so - // B_NOT_ALLOWED is actually B_NOT_A_DIRECTORY. This - // happens because fs_access() can be called on files - // to and this would be valid outside of the context - // of vnode_path_to_vnode(). This is also what POSIX - // programs expect as return code in this case. - return B_NOT_A_DIRECTORY; - } return status; } @@ -1841,15 +1832,16 @@ mutex_unlock(&sVnodeMutex); if (!nextVnode) { - // pretty screwed up here - the file system found the vnode, but the hash - // lookup failed, so our internal structures are messed up + // pretty screwed up here - the file system found the vnode, but the + // hash lookup failed, so our internal structures are messed up panic("vnode_path_to_vnode: could not lookup vnode (mountid 0x%lx vnid 0x%Lx)\n", vnode->device, vnodeID); put_vnode(vnode); return B_ENTRY_NOT_FOUND; } - // If the new node is a symbolic link, resolve it (if we've been told to do it) + // If the new node is a symbolic link, resolve it (if we've been told + // to do it) if (S_ISLNK(type) && !(!traverseLeafLink && nextPath[0] == '\0')) { size_t bufferSize; char *buffer; @@ -1937,6 +1929,13 @@ path = nextPath; vnode = nextVnode; + if (strchr(path, '/') && !S_ISDIR(type)) { + // We need to continue to traverse, but our next vnode is not + // a directory. + put_vnode(vnode); + return B_NOT_A_DIRECTORY; + } + // see if we hit a mount point struct vnode *mountPoint = resolve_mount_point_to_volume_root(vnode); if (mountPoint) { From axeld at mail.berlios.de Tue Apr 1 19:59:52 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 1 Apr 2008 19:59:52 +0200 Subject: [Haiku-commits] r24722 - haiku/trunk/src/system/kernel/fs Message-ID: <200804011759.m31HxqOV017664@sheep.berlios.de> Author: axeld Date: 2008-04-01 19:59:51 +0200 (Tue, 01 Apr 2008) New Revision: 24722 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24722&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Revised my previous patch as outlined in the previous one: * No longer checks for the path delimiter twice. * Now also checks if the first part of the path is a directory. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 17:39:52 UTC (rev 24721) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 17:59:51 UTC (rev 24722) @@ -1753,7 +1753,7 @@ int count, struct io_context *ioContext, struct vnode **_vnode, ino_t *_parentID, int *_type) { - status_t status = 0; + status_t status = B_OK; ino_t lastParentID = vnode->id; int type = 0; @@ -1782,7 +1782,8 @@ // walk to find the next path component ("path" will point to a single // path component), and filter out multiple slashes - for (nextPath = path + 1; *nextPath != '\0' && *nextPath != '/'; nextPath++); + for (nextPath = path + 1; *nextPath != '\0' && *nextPath != '/'; + nextPath++); if (*nextPath == '/') { *nextPath = '\0'; @@ -1806,12 +1807,25 @@ put_vnode(vnode); vnode = nextVnode; } + } else if (nextPath[0]) { + // check if vnode is really a directory + if (type == 0) { + // we need to retrieve the type first + struct stat stat; + status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, + vnode->private_node, &stat); + if (status == B_OK) + type = stat.st_mode; + } + + if (status == B_OK && !S_ISDIR(type)) + status = B_NOT_A_DIRECTORY; } // Check if we have the right to search the current directory vnode. // If a file system doesn't have the access() function, we assume that // searching a directory is always allowed - if (FS_CALL(vnode, access)) + if (status == B_OK && FS_CALL(vnode, access)) status = FS_CALL(vnode, access)(vnode->mount->cookie, vnode->private_node, X_OK); // Tell the filesystem to get the vnode of this path component (if we got the @@ -1929,13 +1943,6 @@ path = nextPath; vnode = nextVnode; - if (strchr(path, '/') && !S_ISDIR(type)) { - // We need to continue to traverse, but our next vnode is not - // a directory. - put_vnode(vnode); - return B_NOT_A_DIRECTORY; - } - // see if we hit a mount point struct vnode *mountPoint = resolve_mount_point_to_volume_root(vnode); if (mountPoint) { From axeld at pinc-software.de Tue Apr 1 20:04:11 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Apr 2008 20:04:11 +0200 CEST Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <47F266E2.2080301@bug-br.org.br> Message-ID: <32107913296-BeMail@zon> Bruno Albuquerque wrote: > Well, at least semantically, it does. The error returned by > fs_access() > is not enough to figure out what happened. Specially if you consider > that you have a program that you provide a path to it and it know > nothing about what that path is until it access it (which will go > over > vnode_path_to_vnode()). Of course I am open to other ideas. fs_access() is fine - vnode_path_to_vnode() just didn't use it correctly :-) Anyway, I've now changed that function to work correctly. Still, when telling the shell to switch to another directory that is a file, I get a "no such file or directory" error, instead of "not a directory". At least set_cwd(), and vnode_path_to_vnode() do look correct now. Bye, Axel. From leavengood at gmail.com Tue Apr 1 20:08:25 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Tue, 1 Apr 2008 14:08:25 -0400 Subject: [Haiku-commits] r24710 - in haiku/trunk: headers/posix src/system/libroot/posix/pthread In-Reply-To: <745357210-BeMail@laptop> References: <47F13740.2010607@bug-br.org.br> <745357210-BeMail@laptop> Message-ID: On Mon, Mar 31, 2008 at 4:49 PM, Fran?ois Revol wrote: > > Ah, I looked into that one once... > Given that you'll have to add gui support code anyway I don't see any > reason to not add native threading too. This is a question I have been asking myself, mostly in the context of the Haiku WebKit port: if we fully implement pthreads, in what cases would we want to code a native thread implementation in an app? Of the top of my head I would think that simple command-line programs could just stay pthreads (aka minimal porting required), whereas maybe bigger apps or GUI apps might benefit from a native port. But I'm not sure. Are there considerable advantages to going native, besides one less level of indirection and *maybe* therefore better performance? Though I'm not convinced until I see some benchmarks. Ryan From axeld at mail.berlios.de Tue Apr 1 20:17:32 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 1 Apr 2008 20:17:32 +0200 Subject: [Haiku-commits] r24723 - in haiku/trunk/src/add-ons/kernel/drivers/network: . syskonnect syskonnect/dev syskonnect/dev/mii syskonnect/dev/sk Message-ID: <200804011817.m31IHWdN019489@sheep.berlios.de> Author: axeld Date: 2008-04-01 20:17:28 +0200 (Tue, 01 Apr 2008) New Revision: 24723 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24723&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/brgphyreg.h haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/miidevs.h haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy.c haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/ukphy_subr.c haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphy.c haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/xmphyreg.h haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/glue.c haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_sk.c haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/if_skreg.h haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/xmaciireg.h haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/sk/yukonreg.h Modified: haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile Log: Applied patch by Euan Kirkhope: * Imported FreeBSD driver "sk" as syskonnect into the Haiku tree, and wrote the necessary glue code to let it run. Modified: haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile 2008-04-01 17:59:51 UTC (rev 24722) +++ haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile 2008-04-01 18:17:28 UTC (rev 24723) @@ -19,6 +19,7 @@ SubInclude HAIKU_TOP src add-ons kernel drivers network marvell_yukon ; SubInclude HAIKU_TOP src add-ons kernel drivers network nforce ; SubInclude HAIKU_TOP src add-ons kernel drivers network pcnet ; +SubInclude HAIKU_TOP src add-ons kernel drivers network syskonnect ; SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network bcm440x ; SubIncludeGPL HAIKU_TOP src add-ons kernel drivers network bcm570x ; Added: haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/Jamfile 2008-04-01 17:59:51 UTC (rev 24722) +++ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/Jamfile 2008-04-01 18:17:28 UTC (rev 24723) @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network syskonnect ; + +SubInclude HAIKU_TOP src add-ons kernel drivers network syskonnect dev ; Added: haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/Jamfile 2008-04-01 17:59:51 UTC (rev 24722) +++ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/Jamfile 2008-04-01 18:17:28 UTC (rev 24723) @@ -0,0 +1,4 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network syskonnect dev ; + +SubInclude HAIKU_TOP src add-ons kernel drivers network syskonnect dev mii ; +SubInclude HAIKU_TOP src add-ons kernel drivers network syskonnect dev sk ; Added: haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/Jamfile 2008-04-01 17:59:51 UTC (rev 24722) +++ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/Jamfile 2008-04-01 18:17:28 UTC (rev 24723) @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network syskonnect dev mii ; + +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 ] ; + +KernelStaticLibrary syskonnect_mii.a + : + xmphy.c + e1000phy.c + ukphy.c + ukphy_subr.c + ; + Added: haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/brgphyreg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/brgphyreg.h 2008-04-01 17:59:51 UTC (rev 24722) +++ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/brgphyreg.h 2008-04-01 18:17:28 UTC (rev 24723) @@ -0,0 +1,364 @@ +/*- + * Copyright (c) 2000 + * Bill Paul . 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. All advertising materials mentioning features or use of this software + * must display the following acknowledgement: + * This product includes software developed by Bill Paul. + * 4. Neither the name of the author nor the names of any co-contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY Bill Paul 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 Bill Paul OR THE VOICES IN HIS HEAD + * 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/mii/brgphyreg.h,v 1.6.2.2 2007/06/14 21:07:19 davidch Exp $ + */ + +#ifndef _DEV_MII_BRGPHYREG_H_ +#define _DEV_MII_BRGPHYREG_H_ + +/* + * Broadcom BCM5400 registers + */ + +#define BRGPHY_MII_BMCR 0x00 +#define BRGPHY_BMCR_RESET 0x8000 +#define BRGPHY_BMCR_LOOP 0x4000 +#define BRGPHY_BMCR_SPD0 0x2000 /* Speed select, lower bit */ +#define BRGPHY_BMCR_AUTOEN 0x1000 /* Autoneg enabled */ +#define BRGPHY_BMCR_PDOWN 0x0800 /* Power down */ +#define BRGPHY_BMCR_ISO 0x0400 /* Isolate */ +#define BRGPHY_BMCR_STARTNEG 0x0200 /* Restart autoneg */ +#define BRGPHY_BMCR_FDX 0x0100 /* Duplex mode */ +#define BRGPHY_BMCR_CTEST 0x0080 /* Collision test enable */ +#define BRGPHY_BMCR_SPD1 0x0040 /* Speed select, upper bit */ + +#define BRGPHY_S1000 BRGPHY_BMCR_SPD1 /* 1000mbps */ +#define BRGPHY_S100 BRGPHY_BMCR_SPD0 /* 100mpbs */ +#define BRGPHY_S10 0 /* 10mbps */ + +#define BRGPHY_MII_BMSR 0x01 +#define BRGPHY_BMSR_EXTSTS 0x0100 /* Extended status present */ +#define BRGPHY_BMSR_PRESUB 0x0040 /* Preamble surpression */ +#define BRGPHY_BMSR_ACOMP 0x0020 /* Autoneg complete */ +#define BRGPHY_BMSR_RFAULT 0x0010 /* Remote fault condition occured */ +#define BRGPHY_BMSR_ANEG 0x0008 /* Autoneg capable */ +#define BRGPHY_BMSR_LINK 0x0004 /* Link status */ +#define BRGPHY_BMSR_JABBER 0x0002 /* Jabber detected */ +#define BRGPHY_BMSR_EXT 0x0001 /* Extended capability */ + +#define BRGPHY_MII_ANAR 0x04 +#define BRGPHY_ANAR_NP 0x8000 /* Next page */ +#define BRGPHY_ANAR_RF 0x2000 /* Remote fault */ +#define BRGPHY_ANAR_ASP 0x0800 /* Asymmetric Pause */ +#define BRGPHY_ANAR_PC 0x0400 /* Pause capable */ +#define BRGPHY_ANAR_SEL 0x001F /* Selector field, 00001=Ethernet */ + +#define BRGPHY_MII_ANLPAR 0x05 +#define BRGPHY_ANLPAR_NP 0x8000 /* Next page */ +#define BRGPHY_ANLPAR_RF 0x2000 /* Remote fault */ +#define BRGPHY_ANLPAR_ASP 0x0800 /* Asymmetric Pause */ +#define BRGPHY_ANLPAR_PC 0x0400 /* Pause capable */ +#define BRGPHY_ANLPAR_SEL 0x001F /* Selector field, 00001=Ethernet */ + +#define BRGPHY_SEL_TYPE 0x0001 /* Ethernet */ + +#define BRGPHY_MII_ANER 0x06 +#define BRGPHY_ANER_PDF 0x0010 /* Parallel detection fault */ +#define BRGPHY_ANER_LPNP 0x0008 /* Link partner can next page */ +#define BRGPHY_ANER_NP 0x0004 /* Local PHY can next page */ +#define BRGPHY_ANER_RX 0x0002 /* Next page received */ +#define BRGPHY_ANER_LPAN 0x0001 /* Link partner autoneg capable */ + +#define BRGPHY_MII_NEXTP 0x07 /* Next page */ + +#define BRGPHY_MII_NEXTP_LP 0x08 /* Next page of link partner */ + +#define BRGPHY_MII_1000CTL 0x09 /* 1000baseT control */ +#define BRGPHY_1000CTL_TST 0xE000 /* Test modes */ +#define BRGPHY_1000CTL_MSE 0x1000 /* Master/Slave enable */ +#define BRGPHY_1000CTL_MSC 0x0800 /* Master/Slave configuration */ +#define BRGPHY_1000CTL_RD 0x0400 /* Repeater/DTE */ +#define BRGPHY_1000CTL_AFD 0x0200 /* Advertise full duplex */ +#define BRGPHY_1000CTL_AHD 0x0100 /* Advertise half duplex */ + +#define BRGPHY_MII_1000STS 0x0A /* 1000baseT status */ +#define BRGPHY_1000STS_MSF 0x8000 /* Master/slave fault */ +#define BRGPHY_1000STS_MSR 0x4000 /* Master/slave result */ +#define BRGPHY_1000STS_LRS 0x2000 /* Local receiver status */ +#define BRGPHY_1000STS_RRS 0x1000 /* Remote receiver status */ +#define BRGPHY_1000STS_LPFD 0x0800 /* Link partner can FD */ +#define BRGPHY_1000STS_LPHD 0x0400 /* Link partner can HD */ +#define BRGPHY_1000STS_IEC 0x00FF /* Idle error count */ + +#define BRGPHY_MII_EXTSTS 0x0F /* Extended status */ +#define BRGPHY_EXTSTS_X_FD_CAP 0x8000 /* 1000base-X FD capable */ +#define BRGPHY_EXTSTS_X_HD_CAP 0x4000 /* 1000base-X HD capable */ +#define BRGPHY_EXTSTS_T_FD_CAP 0x2000 /* 1000base-T FD capable */ +#define BRGPHY_EXTSTS_T_HD_CAP 0x1000 /* 1000base-T HD capable */ + +#define BRGPHY_MII_PHY_EXTCTL 0x10 /* PHY extended control */ +#define BRGPHY_PHY_EXTCTL_MAC_PHY 0x8000 /* 10BIT/GMI-interface */ +#define BRGPHY_PHY_EXTCTL_DIS_CROSS 0x4000 /* Disable MDI crossover */ +#define BRGPHY_PHY_EXTCTL_TX_DIS 0x2000 /* TX output disabled */ +#define BRGPHY_PHY_EXTCTL_INT_DIS 0x1000 /* Interrupts disabled */ +#define BRGPHY_PHY_EXTCTL_F_INT 0x0800 /* Force interrupt */ +#define BRGPHY_PHY_EXTCTL_BY_45 0x0400 /* Bypass 4B5B-Decoder */ +#define BRGPHY_PHY_EXTCTL_BY_SCR 0x0200 /* Bypass scrambler */ +#define BRGPHY_PHY_EXTCTL_BY_MLT3 0x0100 /* Bypass MLT3 encoder */ +#define BRGPHY_PHY_EXTCTL_BY_RXA 0x0080 /* Bypass RX alignment */ +#define BRGPHY_PHY_EXTCTL_RES_SCR 0x0040 /* Reset scrambler */ +#define BRGPHY_PHY_EXTCTL_EN_LTR 0x0020 /* Enable LED traffic mode */ +#define BRGPHY_PHY_EXTCTL_LED_ON 0x0010 /* Force LEDs on */ +#define BRGPHY_PHY_EXTCTL_LED_OFF 0x0008 /* Force LEDs off */ +#define BRGPHY_PHY_EXTCTL_EX_IPG 0x0004 /* Extended TX IPG mode */ +#define BRGPHY_PHY_EXTCTL_3_LED 0x0002 /* Three link LED mode */ +#define BRGPHY_PHY_EXTCTL_HIGH_LA 0x0001 /* GMII Fifo Elasticy (?) */ + +#define BRGPHY_MII_PHY_EXTSTS 0x11 /* PHY extended status */ +#define BRGPHY_PHY_EXTSTS_CROSS_STAT 0x2000 /* MDI crossover status */ +#define BRGPHY_PHY_EXTSTS_INT_STAT 0x1000 /* Interrupt status */ +#define BRGPHY_PHY_EXTSTS_RRS 0x0800 /* Remote receiver status */ +#define BRGPHY_PHY_EXTSTS_LRS 0x0400 /* Local receiver status */ +#define BRGPHY_PHY_EXTSTS_LOCKED 0x0200 /* Locked */ +#define BRGPHY_PHY_EXTSTS_LS 0x0100 /* Link status */ +#define BRGPHY_PHY_EXTSTS_RF 0x0080 /* Remove fault */ +#define BRGPHY_PHY_EXTSTS_CE_ER 0x0040 /* Carrier ext error */ +#define BRGPHY_PHY_EXTSTS_BAD_SSD 0x0020 /* Bad SSD */ +#define BRGPHY_PHY_EXTSTS_BAD_ESD 0x0010 /* Bad ESS */ +#define BRGPHY_PHY_EXTSTS_RX_ER 0x0008 /* RX error */ +#define BRGPHY_PHY_EXTSTS_TX_ER 0x0004 /* TX error */ +#define BRGPHY_PHY_EXTSTS_LOCK_ER 0x0002 /* Lock error */ +#define BRGPHY_PHY_EXTSTS_MLT3_ER 0x0001 /* MLT3 code error */ + +#define BRGPHY_MII_RXERRCNT 0x12 /* RX error counter */ + +#define BRGPHY_MII_FCERRCNT 0x13 /* False carrier sense counter */ +#define BGRPHY_FCERRCNT 0x00FF /* False carrier counter */ + +#define BRGPHY_MII_RXNOCNT 0x14 /* RX not OK counter */ +#define BRGPHY_RXNOCNT_LOCAL 0xFF00 /* Local RX not OK counter */ +#define BRGPHY_RXNOCNT_REMOTE 0x00FF /* Local RX not OK counter */ + +#define BRGPHY_MII_DSP_RW_PORT 0x15 /* DSP coefficient r/w port */ + +#define BRGPHY_MII_DSP_ADDR_REG 0x17 /* DSP coefficient addr register */ + +#define BRGPHY_DSP_TAP_NUMBER_MASK 0x00 +#define BRGPHY_DSP_AGC_A 0x00 +#define BRGPHY_DSP_AGC_B 0x01 +#define BRGPHY_DSP_MSE_PAIR_STATUS 0x02 +#define BRGPHY_DSP_SOFT_DECISION 0x03 +#define BRGPHY_DSP_PHASE_REG 0x04 +#define BRGPHY_DSP_SKEW 0x05 +#define BRGPHY_DSP_POWER_SAVER_UPPER_BOUND 0x06 +#define BRGPHY_DSP_POWER_SAVER_LOWER_BOUND 0x07 +#define BRGPHY_DSP_LAST_ECHO 0x08 +#define BRGPHY_DSP_FREQUENCY 0x09 +#define BRGPHY_DSP_PLL_BANDWIDTH 0x0A +#define BRGPHY_DSP_PLL_PHASE_OFFSET 0x0B + +#define BRGPHYDSP_FILTER_DCOFFSET 0x0C00 +#define BRGPHY_DSP_FILTER_FEXT3 0x0B00 +#define BRGPHY_DSP_FILTER_FEXT2 0x0A00 +#define BRGPHY_DSP_FILTER_FEXT1 0x0900 +#define BRGPHY_DSP_FILTER_FEXT0 0x0800 +#define BRGPHY_DSP_FILTER_NEXT3 0x0700 +#define BRGPHY_DSP_FILTER_NEXT2 0x0600 +#define BRGPHY_DSP_FILTER_NEXT1 0x0500 +#define BRGPHY_DSP_FILTER_NEXT0 0x0400 +#define BRGPHY_DSP_FILTER_ECHO 0x0300 +#define BRGPHY_DSP_FILTER_DFE 0x0200 +#define BRGPHY_DSP_FILTER_FFE 0x0100 + +#define BRGPHY_DSP_CONTROL_ALL_FILTERS 0x1000 + +#define BRGPHY_DSP_SEL_CH_0 0x0000 +#define BRGPHY_DSP_SEL_CH_1 0x2000 +#define BRGPHY_DSP_SEL_CH_2 0x4000 +#define BRGPHY_DSP_SEL_CH_3 0x6000 + +#define BRGPHY_MII_AUXCTL 0x18 /* AUX control */ +#define BRGPHY_AUXCTL_LOW_SQ 0x8000 /* Low squelch */ +#define BRGPHY_AUXCTL_LONG_PKT 0x4000 /* RX long packets */ +#define BRGPHY_AUXCTL_ER_CTL 0x3000 /* Edgerate control */ +#define BRGPHY_AUXCTL_TX_TST 0x0400 /* TX test, always 1 */ +#define BRGPHY_AUXCTL_DIS_PRF 0x0080 /* dis part resp filter */ +#define BRGPHY_AUXCTL_DIAG_MODE 0x0004 /* Diagnostic mode */ + +#define BRGPHY_MII_AUXSTS 0x19 /* AUX status */ +#define BRGPHY_AUXSTS_ACOMP 0x8000 /* Autoneg complete */ +#define BRGPHY_AUXSTS_AN_ACK 0x4000 /* Autoneg complete ack */ +#define BRGPHY_AUXSTS_AN_ACK_D 0x2000 /* Autoneg complete ack detect */ +#define BRGPHY_AUXSTS_AN_NPW 0x1000 /* Autoneg next page wait */ +#define BRGPHY_AUXSTS_AN_RES 0x0700 /* Autoneg HCD */ +#define BRGPHY_AUXSTS_PDF 0x0080 /* Parallel detect. fault */ +#define BRGPHY_AUXSTS_RF 0x0040 /* Remote fault */ +#define BRGPHY_AUXSTS_ANP_R 0x0020 /* Autoneg page received */ +#define BRGPHY_AUXSTS_LP_ANAB 0x0010 /* Link partner autoneg ability */ +#define BRGPHY_AUXSTS_LP_NPAB 0x0008 /* Link partner next page ability */ +#define BRGPHY_AUXSTS_LINK 0x0004 /* Link status */ +#define BRGPHY_AUXSTS_PRR 0x0002 /* Pause resolution-RX */ +#define BRGPHY_AUXSTS_PRT 0x0001 /* Pause resolution-TX */ + +#define BRGPHY_RES_1000FD 0x0700 /* 1000baseT full duplex */ +#define BRGPHY_RES_1000HD 0x0600 /* 1000baseT half duplex */ +#define BRGPHY_RES_100FD 0x0500 /* 100baseT full duplex */ +#define BRGPHY_RES_100T4 0x0400 /* 100baseT4 */ +#define BRGPHY_RES_100HD 0x0300 /* 100baseT half duplex */ +#define BRGPHY_RES_10FD 0x0200 /* 10baseT full duplex */ +#define BRGPHY_RES_10HD 0x0100 /* 10baseT half duplex */ + +#define BRGPHY_MII_ISR 0x1A /* Interrupt status */ +#define BRGPHY_ISR_PSERR 0x4000 /* Pair swap error */ +#define BRGPHY_ISR_MDXI_SC 0x2000 /* MDIX Status Change */ +#define BRGPHY_ISR_HCT 0x1000 /* Counter above 32K */ +#define BRGPHY_ISR_LCT 0x0800 /* All counter below 128 */ +#define BRGPHY_ISR_AN_PR 0x0400 /* Autoneg page received */ +#define BRGPHY_ISR_NO_HDCL 0x0200 /* No HCD Link */ +#define BRGPHY_ISR_NO_HDC 0x0100 /* No HCD */ +#define BRGPHY_ISR_USHDC 0x0080 /* Negotiated Unsupported HCD */ +#define BRGPHY_ISR_SCR_S_ERR 0x0040 /* Scrambler sync error */ +#define BRGPHY_ISR_RRS_CHG 0x0020 /* Remote RX status change */ +#define BRGPHY_ISR_LRS_CHG 0x0010 /* Local RX status change */ +#define BRGPHY_ISR_DUP_CHG 0x0008 /* Duplex mode change */ +#define BRGPHY_ISR_LSP_CHG 0x0004 /* Link speed changed */ +#define BRGPHY_ISR_LNK_CHG 0x0002 /* Link status change */ +#define BRGPHY_ISR_CRCERR 0x0001 /* CRC error */ + +#define BRGPHY_MII_IMR 0x1B /* Interrupt mask */ +#define BRGPHY_IMR_PSERR 0x4000 /* Pair swap error */ +#define BRGPHY_IMR_MDXI_SC 0x2000 /* MDIX Status Change */ +#define BRGPHY_IMR_HCT 0x1000 /* Counter above 32K */ +#define BRGPHY_IMR_LCT 0x0800 /* All counter below 128 */ +#define BRGPHY_IMR_AN_PR 0x0400 /* Autoneg page received */ +#define BRGPHY_IMR_NO_HDCL 0x0200 /* No HCD Link */ +#define BRGPHY_IMR_NO_HDC 0x0100 /* No HCD */ +#define BRGPHY_IMR_USHDC 0x0080 /* Negotiated Unsupported HCD */ +#define BRGPHY_IMR_SCR_S_ERR 0x0040 /* Scrambler sync error */ +#define BRGPHY_IMR_RRS_CHG 0x0020 /* Remote RX status change */ +#define BRGPHY_IMR_LRS_CHG 0x0010 /* Local RX status change */ +#define BRGPHY_IMR_DUP_CHG 0x0008 /* Duplex mode change */ +#define BRGPHY_IMR_LSP_CHG 0x0004 /* Link speed changed */ +#define BRGPHY_IMR_LNK_CHG 0x0002 /* Link status change */ +#define BRGPHY_IMR_CRCERR 0x0001 /* CRC error */ + +/*******************************************************/ +/* Begin: Shared SerDes PHY register definitions */ +/*******************************************************/ + +/* SerDes autoneg is different from copper */ +#define BRGPHY_SERDES_ANAR 0x04 +#define BRGPHY_SERDES_ANAR_FDX 0x0020 +#define BRGPHY_SERDES_ANAR_HDX 0x0040 +#define BRGPHY_SERDES_ANAR_NO_PAUSE (0x0 << 7) +#define BRGPHY_SERDES_ANAR_SYM_PAUSE (0x1 << 7) +#define BRGPHY_SERDES_ANAR_ASYM_PAUSE (0x2 << 7) +#define BRGPHY_SERDES_ANAR_BOTH_PAUSE (0x3 << 7) + +#define BRGPHY_SERDES_ANLPAR 0x05 +#define BRGPHY_SERDES_ANLPAR_FDX 0x0020 +#define BRGPHY_SERDES_ANLPAR_HDX 0x0040 +#define BRGPHY_SERDES_ANLPAR_NO_PAUSE (0x0 << 7) +#define BRGPHY_SERDES_ANLPAR_SYM_PAUSE (0x1 << 7) +#define BRGPHY_SERDES_ANLPAR_ASYM_PAUSE (0x2 << 7) +#define BRGPHY_SERDES_ANLPAR_BOTH_PAUSE (0x3 << 7) + +/*******************************************************/ +/* End: Shared SerDes PHY register definitions */ +/*******************************************************/ + +/*******************************************************/ +/* Begin: PHY register values for the 5706 PHY */ +/*******************************************************/ + +/* + * Shadow register 0x1C, bit 15 is write enable, + * bits 14-10 select function (0x00 to 0x1F). + */ +#define BRGPHY_MII_SHADOW_1C 0x1C +#define BRGPHY_SHADOW_1C_WRITE_EN 0x8000 +#define BRGPHY_SHADOW_1C_SELECT_MASK 0x7C00 + +/* Shadow 0x1C Mode Control Register (select value 0x1F) */ +#define BRGPHY_SHADOW_1C_MODE_CTRL (0x1F << 10) +/* When set, Regs 0-0x0F are 1000X, else 1000T */ +#define BRGPHY_SHADOW_1C_ENA_1000X 0x0001 + +#define BRGPHY_MII_TEST1 0x1E +#define BRGPHY_TEST1_TRIM_EN 0x0010 +#define BRGPHY_TEST1_CRC_EN 0x8000 + +#define BRGPHY_MII_TEST2 0x1F + +/*******************************************************/ +/* End: PHY register values for the 5706 PHY */ +/*******************************************************/ + +/*******************************************************/ +/* Begin: PHY register values for the 5708S SerDes PHY */ +/*******************************************************/ + +/* Autoneg Next Page Transmit 1 Regiser */ +#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1 0x0B +#define BRGPHY_5708S_ANEG_NXT_PG_XMIT1_25G 0x0001 + +/* Use the BLOCK_ADDR register to select the page for registers 0x10 to 0x1E */ +#define BRGPHY_5708S_BLOCK_ADDR 0x1f +#define BRGPHY_5708S_DIG_PG0 0x0000 +#define BRGPHY_5708S_DIG3_PG2 0x0002 +#define BRGPHY_5708S_TX_MISC_PG5 0x0005 + +/* 5708S SerDes "Digital" Registers (page 0) */ +#define BRGPHY_5708S_PG0_1000X_CTL1 0x10 +#define BRGPHY_5708S_PG0_1000X_CTL1_AUTODET_EN 0x0010 +#define BRGPHY_5708S_PG0_1000X_CTL1_FIBER_MODE 0x0001 + +#define BRGPHY_5708S_PG0_1000X_STAT1 0x14 +#define BRGPHY_5708S_PG0_1000X_STAT1_LINK 0x0002 +#define BRGPHY_5708S_PG0_1000X_STAT1_FDX 0x0004 +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK 0x0018 +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10 (0x0 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_100 (0x1 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_1G (0x2 << 3) +#define BRGPHY_5708S_PG0_1000X_STAT1_SPEED_25G (0x3 << 3) + + +#define BRGPHY_5708S_PG0_1000X_CTL2 0x11 +#define BRGPHY_5708S_PG0_1000X_CTL2_PAR_DET_EN 0x0001 + +/* 5708S SerDes "Digital 3" Registers (page 2) */ +#define BRGPHY_5708S_PG2_DIGCTL_3_0 0x10 +#define BRGPHY_5708S_PG2_DIGCTL_3_0_USE_IEEE 0x0001 + +/* 5708S SerDes "TX Misc" Registers (page 5) */ +#define BRGPHY_5708S_PG5_2500STATUS1 0x10 +#define BRGPHY_5708S_PG5_TXACTL1 0x15 +#define BRGPHY_5708S_PG5_TXACTL3 0x17 + +/*******************************************************/ +/* End: PHY register values for the 5708S SerDes PHY */ +/*******************************************************/ + +#define BRGPHY_INTRS \ + ~(BRGPHY_IMR_LNK_CHG|BRGPHY_IMR_LSP_CHG|BRGPHY_IMR_DUP_CHG) + +#endif /* _DEV_BRGPHY_MIIREG_H_ */ Added: haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c 2008-04-01 17:59:51 UTC (rev 24722) +++ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phy.c 2008-04-01 18:17:28 UTC (rev 24723) @@ -0,0 +1,513 @@ +/*- + * Principal Author: Parag Patel + * Copyright (c) 2001 + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * Additonal Copyright (c) 2001 by Traakan Software under same licence. + * Secondary Author: Matthew Jacob + */ + +#include +__FBSDID("$FreeBSD: src/sys/dev/mii/e1000phy.c,v 1.18 2006/12/11 11:09:48 yongari Exp $"); + +/* + * driver for the Marvell 88E1000 series external 1000/100/10-BT PHY. + */ + +/* + * Support added for the Marvell 88E1011 (Alaska) 1000/100/10baseTX and + * 1000baseSX PHY. + * Nathan Binkert + * Jung-uk Kim + */ + +#include +#include +#include +#include +#include +#include + + +#include +#include + +#include +#include +#include "miidevs.h" + +#include + +#include "miibus_if.h" + +static int e1000phy_probe(device_t); +static int e1000phy_attach(device_t); + +struct e1000phy_softc { + struct mii_softc mii_sc; + int mii_model; +}; + +static device_method_t e1000phy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, e1000phy_probe), + DEVMETHOD(device_attach, e1000phy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + { 0, 0 } +}; + +static devclass_t e1000phy_devclass; +static driver_t e1000phy_driver = { + "e1000phy", + e1000phy_methods, + sizeof(struct e1000phy_softc) +}; + +DRIVER_MODULE(e1000phy, miibus, e1000phy_driver, e1000phy_devclass, 0, 0); + +static int e1000phy_service(struct mii_softc *, struct mii_data *, int); +static void e1000phy_status(struct mii_softc *); +static void e1000phy_reset(struct mii_softc *); +static int e1000phy_mii_phy_auto(struct e1000phy_softc *); + +static const struct mii_phydesc e1000phys[] = { + MII_PHY_DESC(MARVELL, E1000), + MII_PHY_DESC(MARVELL, E1011), + MII_PHY_DESC(MARVELL, E1000_3), + MII_PHY_DESC(MARVELL, E1000S), + MII_PHY_DESC(MARVELL, E1000_5), + MII_PHY_DESC(MARVELL, E1000_6), + MII_PHY_DESC(MARVELL, E3082), + MII_PHY_DESC(MARVELL, E1112), + MII_PHY_DESC(MARVELL, E1149), + MII_PHY_DESC(MARVELL, E1111), + MII_PHY_DESC(MARVELL, E1116), + MII_PHY_DESC(MARVELL, E1118), + MII_PHY_DESC(xxMARVELL, E1000), + MII_PHY_DESC(xxMARVELL, E1011), + MII_PHY_DESC(xxMARVELL, E1000_3), + MII_PHY_DESC(xxMARVELL, E1000_5), + MII_PHY_DESC(xxMARVELL, E1111), + MII_PHY_END +}; + +static int +e1000phy_probe(device_t dev) +{ + + return (mii_phy_dev_probe(dev, e1000phys, BUS_PROBE_DEFAULT)); +} + +static int +e1000phy_attach(device_t dev) +{ + struct e1000phy_softc *esc; + struct mii_softc *sc; + struct mii_attach_args *ma; + struct mii_data *mii; + int fast_ether; + + esc = device_get_softc(dev); + sc = &esc->mii_sc; + ma = device_get_ivars(dev); + sc->mii_dev = device_get_parent(dev); + mii = device_get_softc(sc->mii_dev); + LIST_INSERT_HEAD(&mii->mii_phys, sc, mii_list); + + sc->mii_inst = mii->mii_instance; + sc->mii_phy = ma->mii_phyno; + sc->mii_service = e1000phy_service; + sc->mii_pdata = mii; + sc->mii_anegticks = MII_ANEGTICKS_GIGE; + mii->mii_instance++; + + fast_ether = 0; + esc->mii_model = MII_MODEL(ma->mii_id2); + switch (esc->mii_model) { + case MII_MODEL_MARVELL_E1011: + case MII_MODEL_MARVELL_E1112: + if (PHY_READ(sc, E1000_ESSR) & E1000_ESSR_FIBER_LINK) + sc->mii_flags |= MIIF_HAVEFIBER; + break; + case MII_MODEL_MARVELL_E3082: + /* 88E3082 10/100 Fast Ethernet PHY. */ + sc->mii_anegticks = MII_ANEGTICKS; + fast_ether = 1; + break; + } + + e1000phy_reset(sc); + + device_printf(dev, " "); + +#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), + E1000_CR_ISOLATE); + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), + E1000_CR_SPEED_10); + printf("10baseT, "); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), + E1000_CR_SPEED_10 | E1000_CR_FULL_DUPLEX); + printf("10baseT-FDX, "); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), + E1000_CR_SPEED_100); + printf("100baseTX, "); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), + E1000_CR_SPEED_100 | E1000_CR_FULL_DUPLEX); + printf("100baseTX-FDX, "); + if (fast_ether == 0) { + /* + * 1000BT-simplex not supported; driver must ignore + * this entry, but it must be present in order to + * manually set full-duplex. + */ + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, + sc->mii_inst), E1000_CR_SPEED_1000); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, + sc->mii_inst), + E1000_CR_SPEED_1000 | E1000_CR_FULL_DUPLEX); + printf("1000baseTX-FDX, "); + } + } else { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), + E1000_CR_SPEED_1000 | E1000_CR_FULL_DUPLEX); + printf("1000baseSX-FDX, "); + } + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_AUTO, 0, sc->mii_inst), 0); + printf("auto\n"); +#undef ADD + + MIIBUS_MEDIAINIT(sc->mii_dev); + return (0); +} + +static void +e1000phy_reset(struct mii_softc *sc) +{ + struct e1000phy_softc *esc; + uint16_t reg; + + esc = (struct e1000phy_softc *)sc; + reg = PHY_READ(sc, E1000_SCR); + if ((sc->mii_flags & MIIF_HAVEFIBER) != 0) { + reg &= ~E1000_SCR_AUTO_X_MODE; + PHY_WRITE(sc, E1000_SCR, reg); + if (esc->mii_model == MII_MODEL_MARVELL_E1112) { + /* Select 1000BASE-X only mode. */ + PHY_WRITE(sc, E1000_EADR, 2); + reg = PHY_READ(sc, E1000_SCR); + reg &= ~E1000_SCR_MODE_MASK; + reg |= E1000_SCR_MODE_1000BX; + PHY_WRITE(sc, E1000_SCR, reg); + PHY_WRITE(sc, E1000_EADR, 1); + } + } else { + switch (esc->mii_model) { + case MII_MODEL_MARVELL_E1111: + case MII_MODEL_MARVELL_E1112: + case MII_MODEL_MARVELL_E1116: + case MII_MODEL_MARVELL_E1118: + case MII_MODEL_MARVELL_E1149: + /* Disable energy detect mode. */ + reg &= ~E1000_SCR_EN_DETECT_MASK; + reg |= E1000_SCR_AUTO_X_MODE; + break; + case MII_MODEL_MARVELL_E3082: + reg |= (E1000_SCR_AUTO_X_MODE >> 1); + break; + default: + reg &= ~E1000_SCR_AUTO_X_MODE; + break; + } + /* Enable CRS on TX. */ + reg |= E1000_SCR_ASSERT_CRS_ON_TX; + /* Auto correction for reversed cable polarity. */ + reg &= ~E1000_SCR_POLARITY_REVERSAL; + PHY_WRITE(sc, E1000_SCR, reg); + } + + switch (MII_MODEL(esc->mii_model)) { + case MII_MODEL_MARVELL_E3082: + case MII_MODEL_MARVELL_E1112: + case MII_MODEL_MARVELL_E1116: + case MII_MODEL_MARVELL_E1118: + case MII_MODEL_MARVELL_E1149: + break; + default: + /* Force TX_CLK to 25MHz clock. */ + reg = PHY_READ(sc, E1000_ESCR); + reg |= E1000_ESCR_TX_CLK_25; + PHY_WRITE(sc, E1000_ESCR, reg); + break; + } + + /* Reset the PHY so all changes take effect. */ + reg = PHY_READ(sc, E1000_CR); + reg |= E1000_CR_RESET; + PHY_WRITE(sc, E1000_CR, reg); +} + +static int +e1000phy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + struct ifmedia_entry *ife = mii->mii_media.ifm_cur; + struct e1000phy_softc *esc = (struct e1000phy_softc *)sc; + uint16_t speed, gig; + int reg; + + switch (cmd) { + case MII_POLLSTAT: + /* + * If we're not polling our PHY instance, just return. + */ + if (IFM_INST(ife->ifm_media) != sc->mii_inst) + return (0); + break; + + case MII_MEDIACHG: + /* + * If the media indicates a different PHY instance, + * isolate ourselves. + */ + if (IFM_INST(ife->ifm_media) != sc->mii_inst) { + reg = PHY_READ(sc, E1000_CR); + PHY_WRITE(sc, E1000_CR, reg | E1000_CR_ISOLATE); + return (0); + } + + /* + * If the interface is not up, don't do anything. + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + break; + + if (IFM_SUBTYPE(ife->ifm_media) == IFM_AUTO) { + e1000phy_mii_phy_auto(esc); + break; + } + + speed = 0; + switch (IFM_SUBTYPE(ife->ifm_media)) { + case IFM_1000_T: + if (esc->mii_model == MII_MODEL_MARVELL_E3082) + return (EINVAL); + speed = E1000_CR_SPEED_1000; + break; + case IFM_1000_SX: + if (esc->mii_model == MII_MODEL_MARVELL_E3082) + return (EINVAL); + speed = E1000_CR_SPEED_1000; + break; + case IFM_100_TX: + speed = E1000_CR_SPEED_100; + break; + case IFM_10_T: + speed = E1000_CR_SPEED_10; + break; + case IFM_NONE: + reg = PHY_READ(sc, E1000_CR); + PHY_WRITE(sc, E1000_CR, + reg | E1000_CR_ISOLATE | E1000_CR_POWER_DOWN); + goto done; + default: + return (EINVAL); + } + + if (((ife->ifm_media & IFM_GMASK) & IFM_FDX) != 0) { + speed |= E1000_CR_FULL_DUPLEX; + gig = E1000_1GCR_1000T_FD; + } else + gig = E1000_1GCR_1000T; + + reg = PHY_READ(sc, E1000_CR); + reg &= ~E1000_CR_AUTO_NEG_ENABLE; + PHY_WRITE(sc, E1000_CR, reg | E1000_CR_RESET); + + /* + * When setting the link manually, one side must + * be the master and the other the slave. However + * ifmedia doesn't give us a good way to specify + * this, so we fake it by using one of the LINK + * flags. If LINK0 is set, we program the PHY to + * be a master, otherwise it's a slave. + */ + if (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_T || + (IFM_SUBTYPE(ife->ifm_media) == IFM_1000_SX)) { + if ((mii->mii_ifp->if_flags & IFF_LINK0)) + PHY_WRITE(sc, E1000_1GCR, gig | + E1000_1GCR_MS_ENABLE | E1000_1GCR_MS_VALUE); + else + PHY_WRITE(sc, E1000_1GCR, gig | + E1000_1GCR_MS_ENABLE); + } else { + if (esc->mii_model != MII_MODEL_MARVELL_E3082) + PHY_WRITE(sc, E1000_1GCR, 0); + } + PHY_WRITE(sc, E1000_AR, E1000_AR_SELECTOR_FIELD); + PHY_WRITE(sc, E1000_CR, speed | E1000_CR_RESET); +done: + break; + case MII_TICK: + /* + * If we're not currently selected, just return. + */ + if (IFM_INST(ife->ifm_media) != sc->mii_inst) + return (0); + + /* + * Is the interface even up? + */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + return (0); + + /* + * Only used for autonegotiation. + */ + if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) + break; + + /* + * check for link. + * Read the status register twice; BMSR_LINK is latch-low. + */ + reg = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); + if (reg & BMSR_LINK) { + sc->mii_ticks = 0; + break; + } + + /* Announce link loss right after it happens. */ + if (sc->mii_ticks <= sc->mii_anegticks) + return (0); + + sc->mii_ticks = 0; + e1000phy_reset(sc); + e1000phy_mii_phy_auto(esc); + break; + } + + /* Update the media status. */ + e1000phy_status(sc); + + /* Callback if something changed. */ + mii_phy_update(sc, cmd); + return (0); +} + +static void +e1000phy_status(struct mii_softc *sc) +{ + struct mii_data *mii = sc->mii_pdata; + int bmsr, bmcr, esr, gsr, ssr, isr, ar, lpar; + + mii->mii_media_status = IFM_AVALID; + mii->mii_media_active = IFM_ETHER; + + bmsr = PHY_READ(sc, E1000_SR) | PHY_READ(sc, E1000_SR); + esr = PHY_READ(sc, E1000_ESR); + bmcr = PHY_READ(sc, E1000_CR); + ssr = PHY_READ(sc, E1000_SSR); + isr = PHY_READ(sc, E1000_ISR); + ar = PHY_READ(sc, E1000_AR); + lpar = PHY_READ(sc, E1000_LPAR); + + if (bmsr & E1000_SR_LINK_STATUS) + mii->mii_media_status |= IFM_ACTIVE; + + if (bmcr & E1000_CR_LOOPBACK) + mii->mii_media_active |= IFM_LOOP; + + if ((((bmcr & E1000_CR_AUTO_NEG_ENABLE) != 0) && + ((bmsr & E1000_SR_AUTO_NEG_COMPLETE) == 0)) || + ((ssr & E1000_SSR_LINK) == 0) || + ((ssr & E1000_SSR_SPD_DPLX_RESOLVED) == 0)) { + /* Erg, still trying, I guess... */ + mii->mii_media_active |= IFM_NONE; + return; + } + + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + if (ssr & E1000_SSR_1000MBS) + mii->mii_media_active |= IFM_1000_T; + else if (ssr & E1000_SSR_100MBS) + mii->mii_media_active |= IFM_100_TX; + else + mii->mii_media_active |= IFM_10_T; + } else { + if (ssr & E1000_SSR_1000MBS) + mii->mii_media_active |= IFM_1000_SX; + } + + if (ssr & E1000_SSR_DUPLEX) + mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; + + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + /* FLAG0==rx-flow-control FLAG1==tx-flow-control */ + if ((ar & E1000_AR_PAUSE) && (lpar & E1000_LPAR_PAUSE)) { + mii->mii_media_active |= IFM_FLAG0 | IFM_FLAG1; + } else if (!(ar & E1000_AR_PAUSE) && (ar & E1000_AR_ASM_DIR) && + (lpar & E1000_LPAR_PAUSE) && (lpar & E1000_LPAR_ASM_DIR)) { + mii->mii_media_active |= IFM_FLAG1; + } else if ((ar & E1000_AR_PAUSE) && (ar & E1000_AR_ASM_DIR) && + !(lpar & E1000_LPAR_PAUSE) && (lpar & E1000_LPAR_ASM_DIR)) { + mii->mii_media_active |= IFM_FLAG0; + } + } + + /* FLAG2 : local PHY resolved to MASTER */ + if ((IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_T) || + (IFM_SUBTYPE(mii->mii_media_active) == IFM_1000_SX)) { + PHY_READ(sc, E1000_1GSR); + gsr = PHY_READ(sc, E1000_1GSR); + if ((gsr & E1000_1GSR_MS_CONFIG_RES) != 0) + mii->mii_media_active |= IFM_FLAG2; + } +} + +static int +e1000phy_mii_phy_auto(struct e1000phy_softc *esc) +{ + struct mii_softc *sc; + + sc = &esc->mii_sc; + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) + PHY_WRITE(sc, E1000_AR, E1000_AR_10T | E1000_AR_10T_FD | + E1000_AR_100TX | E1000_AR_100TX_FD | + E1000_AR_PAUSE | E1000_AR_ASM_DIR); + else + PHY_WRITE(sc, E1000_AR, E1000_FA_1000X_FD | E1000_FA_1000X | + E1000_FA_SYM_PAUSE | E1000_FA_ASYM_PAUSE); + if (esc->mii_model != MII_MODEL_MARVELL_E3082) + PHY_WRITE(sc, E1000_1GCR, + E1000_1GCR_1000T_FD | E1000_1GCR_1000T); + PHY_WRITE(sc, E1000_CR, + E1000_CR_AUTO_NEG_ENABLE | E1000_CR_RESTART_AUTO_NEG); + + return (EJUSTRETURN); +} Added: haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h 2008-04-01 17:59:51 UTC (rev 24722) +++ haiku/trunk/src/add-ons/kernel/drivers/network/syskonnect/dev/mii/e1000phyreg.h 2008-04-01 18:17:28 UTC (rev 24723) @@ -0,0 +1,324 @@ +/* $FreeBSD: src/sys/dev/mii/e1000phyreg.h,v 1.4 2006/12/11 10:43:32 yongari Exp $ */ +/*- + * Principal Author: Parag Patel + * Copyright (c) 2001 + * 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 unmodified, 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR 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 AUTHOR 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. + * + * Additonal Copyright (c) 2001 by Traakan Software under same licence. + * Secondary Author: Matthew Jacob + */ + +/*- + * Derived by information released by Intel under the following license: + * + * Copyright (c) 1999 - 2001, 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 Intel Corporation nor the names of its contributors + * may be used to endorse or promote products derived from this software [... truncated: 7424 lines follow ...] From bga at bug-br.org.br Tue Apr 1 20:17:33 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 01 Apr 2008 15:17:33 -0300 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <32107913296-BeMail@zon> References: <32107913296-BeMail@zon> Message-ID: <47F27C3D.5040805@bug-br.org.br> Axel D?rfler wrote: > fs_access() is fine - vnode_path_to_vnode() just didn't use it > correctly :-) Well, you are calling fs_stat() on a file that may or may not be accessible to the user. Although you do check for errors when calling fs_stat(), this does not look pretty. I still think that, semantically, fs_access() should be able to differentiate between an error because of lack of permission and an error because you tried to access a file as if it was a directory. If it did that, you would even save one extra stat call. > Anyway, I've now changed that function to work correctly. > > Still, when telling the shell to switch to another directory that is a > file, I get a "no such file or directory" error, instead of "not a > directory". At least set_cwd(), and vnode_path_to_vnode() do look > correct now. Maybe only an strerror() difference in the message returned? Under linux the error for trying to cd to a directory that does not exist is, indeed, "Not a directory". bga at librarian:~$ cd this_is_a_file bash: cd: this_is_a_file: Not a directory -Bruno From axeld at mail.berlios.de Tue Apr 1 20:21:48 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 1 Apr 2008 20:21:48 +0200 Subject: [Haiku-commits] r24724 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200804011821.m31ILmH6019826@sheep.berlios.de> Author: axeld Date: 2008-04-01 20:21:47 +0200 (Tue, 01 Apr 2008) New Revision: 24724 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24724&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp Log: * Minor cleanup. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2008-04-01 18:17:28 UTC (rev 24723) +++ haiku/trunk/src/system/kernel/arch/x86/arch_debug.cpp 2008-04-01 18:21:47 UTC (rev 24724) @@ -547,13 +547,11 @@ else ebp = thread->arch_info.current_stack.esp[2]; - bool onKernelStack = true; - for (;;) { - onKernelStack = onKernelStack - && is_kernel_stack_address(thread, ebp); + if (!is_kernel_stack_address(thread, ebp)) + break; - if (onKernelStack && is_iframe(thread, ebp)) { + if (is_iframe(thread, ebp)) { struct iframe *frame = (struct iframe *)ebp; if (is_calling(thread, frame->eip, symbol, start, end)) From revol at free.fr Tue Apr 1 20:30:26 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 01 Apr 2008 20:30:26 +0200 CEST Subject: [Haiku-commits] =?windows-1252?q?r24710_-_in_haiku/trunk=3A_heade?= =?windows-1252?q?rs/posix_src/system/libroot/posix/pthread?= In-Reply-To: Message-ID: <339193903-BeMail@laptop> > On Mon, Mar 31, 2008 at 4:49 PM, Fran?ois Revol > wrote: > > > > Ah, I looked into that one once... > > Given that you'll have to add gui support code anyway I don't see > > any > > reason to not add native threading too. > > This is a question I have been asking myself, mostly in the context > of > the Haiku WebKit port: if we fully implement pthreads, in what cases > would we want to code a native thread implementation in an app? Of > the > top of my head I would think that simple command-line programs could > just stay pthreads (aka minimal porting required), whereas maybe > bigger apps or GUI apps might benefit from a native port. But I'm not > sure. Are there considerable advantages to going native, besides one > less level of indirection and *maybe* therefore better performance? > Though I'm not convinced until I see some benchmarks. > Well I suppose it all depends how much the gui code and threading code are mixed. Of course if it's all about adding a control window to something that uses pthread everywhere there is not much point to it. Fran?ois. From laplace at mail.berlios.de Tue Apr 1 20:45:34 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Tue, 1 Apr 2008 20:45:34 +0200 Subject: [Haiku-commits] r24725 - haiku/trunk/src/apps/bootman Message-ID: <200804011845.m31IjYJo021568@sheep.berlios.de> Author: laplace Date: 2008-04-01 20:45:30 +0200 (Tue, 01 Apr 2008) New Revision: 24725 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24725&view=rev Added: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp haiku/trunk/src/apps/bootman/LegacyBootDrive.h Modified: haiku/trunk/src/apps/bootman/BootManagerController.cpp haiku/trunk/src/apps/bootman/Jamfile Log: Read partition table using BDiskDevice from first disk. Modified: haiku/trunk/src/apps/bootman/BootManagerController.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerController.cpp 2008-04-01 18:21:47 UTC (rev 24724) +++ haiku/trunk/src/apps/bootman/BootManagerController.cpp 2008-04-01 18:45:30 UTC (rev 24725) @@ -13,10 +13,11 @@ #include "DefaultPartitionPage.h" #include "DescriptionPage.h" #include "FileSelectionPage.h" +#include "LegacyBootDrive.h" -// TODO remove -#define USE_TEST_BOOT_DRIVE 1 +#define USE_TEST_BOOT_DRIVE 0 + #if USE_TEST_BOOT_DRIVE #include "TestBootDrive.h" #endif @@ -35,8 +36,7 @@ #if USE_TEST_BOOT_DRIVE fBootDrive = new TestBootDrive(); #else - // TODO implement - fBootDrive = NULL; + fBootDrive = new LegacyBootDrive(); #endif // set defaults Modified: haiku/trunk/src/apps/bootman/Jamfile =================================================================== --- haiku/trunk/src/apps/bootman/Jamfile 2008-04-01 18:21:47 UTC (rev 24724) +++ haiku/trunk/src/apps/bootman/Jamfile 2008-04-01 18:45:30 UTC (rev 24725) @@ -1,6 +1,7 @@ SubDir HAIKU_TOP src apps bootman ; -SetSubDirSupportedPlatformsBeOSCompatible ; +UsePrivateHeaders shared ; +UsePrivateHeaders storage ; Application bootman : BootManager.cpp @@ -10,6 +11,7 @@ DescriptionPage.cpp EntryPage.cpp FileSelectionPage.cpp + LegacyBootDrive.cpp PartitionsPage.cpp TestBootDrive.cpp UninstallPage.cpp Added: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-01 18:21:47 UTC (rev 24724) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-01 18:45:30 UTC (rev 24725) @@ -0,0 +1,155 @@ +/* + * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "LegacyBootDrive.h" + + +#include +#include +#include +#include +#include +#include + +#include + + +class PartitionRecorder : public BDiskDeviceVisitor +{ +public: + PartitionRecorder(BMessage* settings); + + virtual bool Visit(BDiskDevice* device); + virtual bool Visit(BPartition* partition, int32 level); + +private: + bool _Record(BPartition* partition); + + BMessage* fSettings; + int32 fIndex; +}; + + +PartitionRecorder::PartitionRecorder(BMessage* settings) + : fSettings(settings) +{ +} + + +bool +PartitionRecorder::Visit(BDiskDevice* device) +{ + return false; +} + + +bool +PartitionRecorder::Visit(BPartition* partition, int32 level) +{ + return _Record(partition); +} + + +bool +PartitionRecorder::_Record(BPartition* partition) +{ + BPath partitionPath; + partition->GetPath(&partitionPath); + + BString buffer; + const char* name = partition->ContentName(); + if (name == NULL) { + fIndex ++; + buffer << "Unnamed " << fIndex; + name = buffer.String(); + } + + const char* type = partition->Type(); + if (type == NULL) + type = "Unknown"; + + BMessage message; + message.AddBool("show", true); + message.AddString("name", name); + message.AddString("type", type); + message.AddString("path", partitionPath.Path()); + message.AddInt64("size", partition->ContentSize()); + fSettings->AddMessage("partition", &message); + + return false; +} + + +LegacyBootDrive::LegacyBootDrive() +{ +} + + +LegacyBootDrive::~LegacyBootDrive() +{ +} + + +bool +LegacyBootDrive::IsBootMenuInstalled() +{ + return false; +} + + +status_t +LegacyBootDrive::ReadPartitions(BMessage *message) +{ + BDiskDeviceRoster diskDeviceRoster; + BDiskDevice device; + // first disk only + if (diskDeviceRoster.GetNextDevice(&device) == B_OK) { + BPath path; + if (device.GetPath(&path) != B_OK) + return B_ERROR; + + message->AddString("disk", path.Path()); + + + PartitionRecorder recorder(message); + device.VisitEachDescendant(&recorder); + } + return B_OK; +} + + +status_t +LegacyBootDrive::WriteBootMenu(BMessage *message) +{ + // TODO + printf("WriteBootMenu:\n"); + message->PrintToStream(); + + BMessage partition; + int32 index = 0; + for (; message->FindMessage("partition", index, &partition) == B_OK; index ++) { + printf("Partition %d:\n", (int)index); + partition.PrintToStream(); + } + + return B_OK; +} + + +status_t +LegacyBootDrive::SaveMasterBootRecord(BFile *file) +{ + // TODO implement + return B_OK; +} + + +status_t +LegacyBootDrive::RestoreMasterBootRecord(BFile *file) +{ + // TODO implement + return B_OK; +} Added: haiku/trunk/src/apps/bootman/LegacyBootDrive.h =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.h 2008-04-01 18:21:47 UTC (rev 24724) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.h 2008-04-01 18:45:30 UTC (rev 24725) @@ -0,0 +1,23 @@ +/* + * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef LEGACY_BOOT_DRIVE_H +#define LEGACY_BOOT_DRIVE_H + +#include "BootDrive.h" + +class LegacyBootDrive : public BootDrive +{ +public: + LegacyBootDrive(); + virtual ~LegacyBootDrive(); + + virtual bool IsBootMenuInstalled(); + virtual status_t ReadPartitions(BMessage *message); + virtual status_t WriteBootMenu(BMessage *message); + virtual status_t SaveMasterBootRecord(BFile *file); + virtual status_t RestoreMasterBootRecord(BFile *file); +}; + +#endif // LEGACY_BOOT_DRIVE_H From laplace at mail.berlios.de Tue Apr 1 20:52:52 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Tue, 1 Apr 2008 20:52:52 +0200 Subject: [Haiku-commits] r24726 - haiku/trunk/src/apps/bootman Message-ID: <200804011852.m31IqqvS022089@sheep.berlios.de> Author: laplace Date: 2008-04-01 20:52:51 +0200 (Tue, 01 Apr 2008) New Revision: 24726 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24726&view=rev Modified: haiku/trunk/src/apps/bootman/BootDrive.h haiku/trunk/src/apps/bootman/BootManager.cpp haiku/trunk/src/apps/bootman/BootManagerController.cpp haiku/trunk/src/apps/bootman/BootManagerController.h haiku/trunk/src/apps/bootman/BootManagerWindow.cpp haiku/trunk/src/apps/bootman/BootManagerWindow.h haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp haiku/trunk/src/apps/bootman/DefaultPartitionPage.h haiku/trunk/src/apps/bootman/DescriptionPage.cpp haiku/trunk/src/apps/bootman/DescriptionPage.h haiku/trunk/src/apps/bootman/EntryPage.cpp haiku/trunk/src/apps/bootman/EntryPage.h haiku/trunk/src/apps/bootman/FileSelectionPage.cpp haiku/trunk/src/apps/bootman/FileSelectionPage.h haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp haiku/trunk/src/apps/bootman/LegacyBootDrive.h haiku/trunk/src/apps/bootman/PartitionsPage.h haiku/trunk/src/apps/bootman/TestBootDrive.cpp haiku/trunk/src/apps/bootman/TestBootDrive.h haiku/trunk/src/apps/bootman/UninstallPage.cpp haiku/trunk/src/apps/bootman/UninstallPage.h haiku/trunk/src/apps/bootman/WizardController.cpp haiku/trunk/src/apps/bootman/WizardController.h haiku/trunk/src/apps/bootman/WizardPageView.cpp haiku/trunk/src/apps/bootman/WizardPageView.h haiku/trunk/src/apps/bootman/WizardView.cpp haiku/trunk/src/apps/bootman/WizardView.h Log: Added Haiku, Inc. to copyrigth text. Modified: haiku/trunk/src/apps/bootman/BootDrive.h =================================================================== --- haiku/trunk/src/apps/bootman/BootDrive.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/BootDrive.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef BOOT_DRIVE_H #define BOOT_DRIVE_H Modified: haiku/trunk/src/apps/bootman/BootManager.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManager.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/BootManager.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,10 +1,12 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. - * Copyright 2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. - */ + * + * Authors: + * Michael Pfeiffer + * Axel D?rfler + */ - #include "BootManagerWindow.h" #include Modified: haiku/trunk/src/apps/bootman/BootManagerController.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerController.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/BootManagerController.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/BootManagerController.h =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerController.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/BootManagerController.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef BOOT_MANAGER_CONTROLLER_H #define BOOT_MANAGER_CONTROLLER_H Modified: haiku/trunk/src/apps/bootman/BootManagerWindow.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerWindow.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/BootManagerWindow.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/BootManagerWindow.h =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerWindow.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/BootManagerWindow.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef BOOT_MANAGER_WINDOW_H #define BOOT_MANAGER_WINDOW_H Modified: haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/DefaultPartitionPage.h =================================================================== --- haiku/trunk/src/apps/bootman/DefaultPartitionPage.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/DefaultPartitionPage.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef DEFAULT_PARTITON_PAGE_H #define DEFAULT_PARTITON_PAGE_H Modified: haiku/trunk/src/apps/bootman/DescriptionPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/DescriptionPage.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/DescriptionPage.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/DescriptionPage.h =================================================================== --- haiku/trunk/src/apps/bootman/DescriptionPage.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/DescriptionPage.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef DESCRIPTION_PAGE_H #define DESCRIPTION_PAGE_H Modified: haiku/trunk/src/apps/bootman/EntryPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/EntryPage.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/EntryPage.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/EntryPage.h =================================================================== --- haiku/trunk/src/apps/bootman/EntryPage.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/EntryPage.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef ENTRY_PAGE_H #define ENTRY_PAGE_H Modified: haiku/trunk/src/apps/bootman/FileSelectionPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/FileSelectionPage.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/FileSelectionPage.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/FileSelectionPage.h =================================================================== --- haiku/trunk/src/apps/bootman/FileSelectionPage.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/FileSelectionPage.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef FILE_SELECTION_PAGE_H #define FILE_SELECTION_PAGE_H Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.h =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef LEGACY_BOOT_DRIVE_H #define LEGACY_BOOT_DRIVE_H Modified: haiku/trunk/src/apps/bootman/PartitionsPage.h =================================================================== --- haiku/trunk/src/apps/bootman/PartitionsPage.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/PartitionsPage.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef PARTITONS_PAGE_H #define PARTITONS_PAGE_H Modified: haiku/trunk/src/apps/bootman/TestBootDrive.cpp =================================================================== --- haiku/trunk/src/apps/bootman/TestBootDrive.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/TestBootDrive.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/TestBootDrive.h =================================================================== --- haiku/trunk/src/apps/bootman/TestBootDrive.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/TestBootDrive.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef TEST_BOOT_DRIVE_H #define TEST_BOOT_DRIVE_H Modified: haiku/trunk/src/apps/bootman/UninstallPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/UninstallPage.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/UninstallPage.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/UninstallPage.h =================================================================== --- haiku/trunk/src/apps/bootman/UninstallPage.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/UninstallPage.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef UNINSTALL_PAGE_H #define UNINSTALL_PAGE_H Modified: haiku/trunk/src/apps/bootman/WizardController.cpp =================================================================== --- haiku/trunk/src/apps/bootman/WizardController.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/WizardController.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/WizardController.h =================================================================== --- haiku/trunk/src/apps/bootman/WizardController.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/WizardController.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef WIZARD_CONTROLLER_H #define WIZARD_CONTROLLER_H Modified: haiku/trunk/src/apps/bootman/WizardPageView.cpp =================================================================== --- haiku/trunk/src/apps/bootman/WizardPageView.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/WizardPageView.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/WizardPageView.h =================================================================== --- haiku/trunk/src/apps/bootman/WizardPageView.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/WizardPageView.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef WIZARD_PAGE_VIEW_H #define WIZARD_PAGE_VIEW_H Modified: haiku/trunk/src/apps/bootman/WizardView.cpp =================================================================== --- haiku/trunk/src/apps/bootman/WizardView.cpp 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/WizardView.cpp 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ Modified: haiku/trunk/src/apps/bootman/WizardView.h =================================================================== --- haiku/trunk/src/apps/bootman/WizardView.h 2008-04-01 18:45:30 UTC (rev 24725) +++ haiku/trunk/src/apps/bootman/WizardView.h 2008-04-01 18:52:51 UTC (rev 24726) @@ -1,6 +1,9 @@ /* - * Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. + * Copyright 2008, Haiku, Inc. All rights reserved. * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Pfeiffer */ #ifndef WIZARD_VIEW_H #define WIZARD_VIEW_H From axeld at pinc-software.de Tue Apr 1 21:11:31 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Apr 2008 21:11:31 +0200 CEST Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <47F27C3D.5040805@bug-br.org.br> Message-ID: <36147160989-BeMail@zon> Bruno Albuquerque wrote: > Axel D?rfler wrote: > > fs_access() is fine - vnode_path_to_vnode() just didn't use it > > correctly :-) > Well, you are calling fs_stat() on a file that may or may not be > accessible to the user. Although you do check for errors when calling Besides dir_open_entry_ref(), this is a perfectly fine thing to do; the vnode always has to come from somewhere. > fs_stat(), this does not look pretty. I still think that, > semantically, > fs_access() should be able to differentiate between an error because > of > lack of permission and an error because you tried to access a file as > if > it was a directory. If it did that, you would even save one extra > stat call. fs_access() is the equivalent of the POSIX access() function. It's the callers responsibility to call it in an environment that makes sense for the task it wants to perform. > > Still, when telling the shell to switch to another directory that > > is a > > file, I get a "no such file or directory" error, instead of "not a > > directory". At least set_cwd(), and vnode_path_to_vnode() do look > > correct now. > Maybe only an strerror() difference in the message returned? Under > linux > the error for trying to cd to a directory that does not exist is, > indeed, "Not a directory". Nope, that would be B_ENTRY_NOT_FOUND. I didn't check it yet, maybe I should file a bug report. Bye, Axel. From bga at bug-br.org.br Tue Apr 1 22:17:57 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 01 Apr 2008 17:17:57 -0300 Subject: [Haiku-commits] r24720 - haiku/trunk/src/system/kernel/fs In-Reply-To: <36147160989-BeMail@zon> References: <36147160989-BeMail@zon> Message-ID: <47F29875.7040006@bug-br.org.br> Axel D?rfler wrote: >> Maybe only an strerror() difference in the message returned? Under >> linux >> the error for trying to cd to a directory that does not exist is, >> indeed, "Not a directory". > > Nope, that would be B_ENTRY_NOT_FOUND. I didn't check it yet, maybe I > should file a bug report. Anyway, I was wrong. If you do "cd file" the error is "Not a directory". If you do "cd non_existing_file_or_dir" the error is "No such file or directory". -Bruno From mmlr at mail.berlios.de Tue Apr 1 22:37:58 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 1 Apr 2008 22:37:58 +0200 Subject: [Haiku-commits] r24727 - in haiku/trunk/src/add-ons/kernel: bus_managers/usb busses/usb Message-ID: <200804012037.m31KbwTJ031203@sheep.berlios.de> Author: mmlr Date: 2008-04-01 22:37:57 +0200 (Tue, 01 Apr 2008) New Revision: 24727 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24727&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h haiku/trunk/src/add-ons/kernel/busses/usb/ehci_rh.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ohci_rh.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci_rh.cpp Log: Cutting down on unnecessary per-controller delays when starting up the USB stack. The root hubs do not really need a powerup delay and as they are not used until all initialization is done, this gives plenty of time to stabilize the power. Therefore remove the powerup delay for root hubs and reduce the stabilization time to zero. Also remove the define for the first explore delay as it is not used. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp 2008-04-01 18:52:51 UTC (rev 24726) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp 2008-04-01 20:37:57 UTC (rev 24727) @@ -204,7 +204,7 @@ if (deviceDescriptor.device_class == 0x09) { TRACE(("USB BusManager: creating new hub\n")); Hub *hub = new(std::nothrow) Hub(parent, port, deviceDescriptor, - deviceAddress, speed); + deviceAddress, speed, false); if (!hub) { TRACE_ERROR(("USB BusManager: no memory to allocate hub\n")); FreeAddress(deviceAddress); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp 2008-04-01 18:52:51 UTC (rev 24726) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp 2008-04-01 20:37:57 UTC (rev 24727) @@ -12,7 +12,7 @@ Hub::Hub(Object *parent, int8 hubPort, usb_device_descriptor &desc, - int8 deviceAddress, usb_speed speed) + int8 deviceAddress, usb_speed speed, bool isRootHub) : Device(parent, hubPort, desc, deviceAddress, speed), fInterruptPipe(NULL) { @@ -71,7 +71,8 @@ InterruptCallback, this); // Wait some time before powering up the ports - snooze(USB_DELAY_HUB_POWER_UP); + if (!isRootHub) + snooze(USB_DELAY_HUB_POWER_UP); // Enable port power on all ports for (int32 i = 0; i < fHubDescriptor.num_ports; i++) { 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 2008-04-01 18:52:51 UTC (rev 24726) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2008-04-01 20:37:57 UTC (rev 24727) @@ -483,7 +483,7 @@ Hub(Object *parent, int8 hubPort, usb_device_descriptor &desc, int8 deviceAddress, - usb_speed speed); + usb_speed speed, bool isRootHub); virtual ~Hub(); virtual status_t Changed(change_item **changeList, Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h 2008-04-01 18:52:51 UTC (rev 24726) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usbspec_p.h 2008-04-01 20:37:57 UTC (rev 24727) @@ -26,7 +26,6 @@ #define USB_DELAY_SET_ADDRESS_RETRY 200000 #define USB_DELAY_SET_ADDRESS 10000 #define USB_DELAY_SET_CONFIGURATION 50000 -#define USB_DELAY_FIRST_EXPLORE 5000000 #define USB_DELAY_HUB_EXPLORE 1000000 // For bandwidth calculation Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci_rh.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci_rh.cpp 2008-04-01 18:52:51 UTC (rev 24726) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci_rh.cpp 2008-04-01 20:37:57 UTC (rev 24727) @@ -76,7 +76,7 @@ USB_DESCRIPTOR_HUB, // Descriptor type 0x0f, // Number of ports 0x0000, // Hub characteristics - 50, // Power on to power good (in 2ms units) + 0, // Power on to power good (in 2ms units) 0, // Maximum current (in mA) 0x00, // All ports are removable 0xff // Depricated power control mask @@ -123,7 +123,7 @@ EHCIRootHub::EHCIRootHub(Object *rootObject, int8 deviceAddress) : Hub(rootObject, rootObject->GetStack()->IndexOfBusManager(rootObject->GetBusManager()), - sEHCIRootHubDevice, deviceAddress, USB_SPEED_HIGHSPEED) + sEHCIRootHubDevice, deviceAddress, USB_SPEED_HIGHSPEED, true) { } Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci_rh.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci_rh.cpp 2008-04-01 18:52:51 UTC (rev 24726) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci_rh.cpp 2008-04-01 20:37:57 UTC (rev 24727) @@ -76,7 +76,7 @@ USB_DESCRIPTOR_HUB, // Type 0, // Number of ports 0x0000, // Hub characteristics - 50, // Power on to power good + 0, // Power on to power good 0, // Current 0x00, // Both ports are removable 0xff // Depricated power control mask @@ -122,7 +122,7 @@ OHCIRootHub::OHCIRootHub(Object *rootObject, int8 deviceAddress) : Hub(rootObject, rootObject->GetStack()->IndexOfBusManager(rootObject->GetBusManager()), - sOHCIRootHubDevice, deviceAddress, USB_SPEED_FULLSPEED) + sOHCIRootHubDevice, deviceAddress, USB_SPEED_FULLSPEED, true) { } Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci_rh.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci_rh.cpp 2008-04-01 18:52:51 UTC (rev 24726) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci_rh.cpp 2008-04-01 20:37:57 UTC (rev 24727) @@ -79,7 +79,7 @@ USB_DESCRIPTOR_HUB, // Descriptor type 2, // Number of ports 0x0000, // Hub characteristics - 50, // Power on to power good (in 2ms units) + 0, // Power on to power good (in 2ms units) 0, // Maximum current (in mA) 0x00, // Both ports are removable 0xff // Depricated power control mask @@ -127,7 +127,7 @@ UHCIRootHub::UHCIRootHub(Object *rootObject, int8 deviceAddress) : Hub(rootObject, rootObject->GetStack()->IndexOfBusManager(rootObject->GetBusManager()), - sUHCIRootHubDevice, deviceAddress, USB_SPEED_FULLSPEED) + sUHCIRootHubDevice, deviceAddress, USB_SPEED_FULLSPEED, true) { } From mmlr at mail.berlios.de Tue Apr 1 22:40:45 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 1 Apr 2008 22:40:45 +0200 Subject: [Haiku-commits] r24728 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200804012040.m31Kejm5031449@sheep.berlios.de> Author: mmlr Date: 2008-04-01 22:40:45 +0200 (Tue, 01 Apr 2008) New Revision: 24728 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24728&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h Log: When initializing a UHCI controller, ensure that the interrupts are disabled before routing them from the BIOS. Also clear pending SMIs when disabling legacy support. Might help with some legacy support issues and probably introduces others instead... Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-01 20:37:57 UTC (rev 24727) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-01 20:40:45 UTC (rev 24728) @@ -332,13 +332,14 @@ sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device, fPCIInfo->function, PCI_command, 2, command); + // disable interrupts + WriteReg16(UHCI_USBINTR, 0); + // make sure we gain control of the UHCI controller instead of the BIOS sPCIModule->write_pci_config(fPCIInfo->bus, fPCIInfo->device, - fPCIInfo->function, PCI_LEGSUP, 2, PCI_LEGSUP_USBPIRQDEN); + fPCIInfo->function, PCI_LEGSUP, 2, PCI_LEGSUP_USBPIRQDEN + | PCI_LEGSUP_CLEAR_SMI); - // disable interrupts - WriteReg16(UHCI_USBINTR, 0); - // do a global and host reset GlobalReset(); if (ControllerReset() < B_OK) { Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h 2008-04-01 20:37:57 UTC (rev 24727) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci_hardware.h 2008-04-01 20:40:45 UTC (rev 24728) @@ -19,8 +19,9 @@ // ** -- Only writable with words! // PCI register -#define PCI_LEGSUP 0xC0 -#define PCI_LEGSUP_USBPIRQDEN 0x2000 +#define PCI_LEGSUP 0xC0 +#define PCI_LEGSUP_USBPIRQDEN 0x2000 +#define PCI_LEGSUP_CLEAR_SMI 0x8f00 // Registers #define UHCI_USBCMD 0x00 // USB Command - word - R/W From mmlr at mail.berlios.de Tue Apr 1 22:43:46 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 1 Apr 2008 22:43:46 +0200 Subject: [Haiku-commits] r24729 - haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk Message-ID: <200804012043.m31KhkrD031701@sheep.berlios.de> Author: mmlr Date: 2008-04-01 22:43:45 +0200 (Tue, 01 Apr 2008) New Revision: 24729 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24729&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp Log: * Retry some times when the device reports it is not ready * Use the CBW_SIGNATURE define instead of the numeric value Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-01 20:40:45 UTC (rev 24728) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-01 20:43:45 UTC (rev 24729) @@ -157,7 +157,7 @@ uint32 *dataLength, bool directionIn) { command_block_wrapper command; - command.signature = 0x43425355; + command.signature = CBW_SIGNATURE; command.tag = device->current_tag++; command.data_transfer_length = (dataLength != NULL ? *dataLength : 0); command.flags = (directionIn ? CBW_DATA_INPUT : CBW_DATA_OUTPUT); @@ -500,7 +500,12 @@ } result = usb_disk_inquiry(device); - usb_disk_test_unit_ready(device); + for (uint32 tries = 0; tries < 3; tries++) { + if (usb_disk_test_unit_ready(device) == B_OK) + break; + snooze(10000); + } + if (result != B_OK || usb_disk_update_capacity(device) != B_OK) { TRACE_ALWAYS("failed to read device data\n"); delete_sem(device->notify); From mmlr at mail.berlios.de Tue Apr 1 22:48:15 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 1 Apr 2008 22:48:15 +0200 Subject: [Haiku-commits] r24730 - in haiku/trunk/src/add-ons/kernel: busses/agp_gart drivers/graphics/intel_extreme Message-ID: <200804012048.m31KmFh1032099@sheep.berlios.de> Author: mmlr Date: 2008-04-01 22:48:14 +0200 (Tue, 01 Apr 2008) New Revision: 24730 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24730&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp Log: Adding device ids for the i965GM chipset present in my laptop to the intel_extreme driver and agp_gart. These worked for me for quite some time now. Modified: haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp 2008-04-01 20:43:45 UTC (rev 24729) +++ haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp 2008-04-01 20:48:14 UTC (rev 24730) @@ -58,6 +58,7 @@ // {0x2772, INTEL_TYPE_945, "i945G"}, // {0x27a2, INTEL_TYPE_945, "i945GM"}, // {0x29a2, INTEL_TYPE_965, "i965G"}, + {0x2a00, 0x2a02, INTEL_TYPE_965, "i965GM"}, {0x29b0, 0x29b2, INTEL_TYPE_G33, "G33"}, {0x29c0, 0x29c2, INTEL_TYPE_G33, "Q35"}, {0x29d0, 0x29d2, INTEL_TYPE_G33, "Q33"}, Modified: haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2008-04-01 20:43:45 UTC (rev 24729) +++ haiku/trunk/src/add-ons/kernel/drivers/graphics/intel_extreme/driver.cpp 2008-04-01 20:48:14 UTC (rev 24730) @@ -49,6 +49,7 @@ {0x2772, INTEL_TYPE_945, "i945G"}, {0x27a2, INTEL_TYPE_945, "i945GM"}, {0x29a2, INTEL_TYPE_965, "i965G"}, + {0x2a02, INTEL_TYPE_965, "i965GM"}, {0x29b2, INTEL_TYPE_G33, "G33G"}, {0x29c2, INTEL_TYPE_G33, "Q35G"}, {0x29d2, INTEL_TYPE_G33, "Q33G"}, From anevilyak at gmail.com Tue Apr 1 23:39:31 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 1 Apr 2008 16:39:31 -0500 Subject: [Haiku-commits] r24722 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200804011759.m31HxqOV017664@sheep.berlios.de> References: <200804011759.m31HxqOV017664@sheep.berlios.de> Message-ID: Hi Axel, On Tue, Apr 1, 2008 at 12:59 PM, axeld at BerliOS wrote: > Author: axeld > Date: 2008-04-01 19:59:51 +0200 (Tue, 01 Apr 2008) > New Revision: 24722 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24722&view=rev > > Modified: > haiku/trunk/src/system/kernel/fs/vfs.cpp > Log: > Revised my previous patch as outlined in the previous one: > * No longer checks for the path delimiter twice. > * Now also checks if the first part of the path is a directory. This patch seems to have broken something else, if I try to do operations to a path that involves a symlink, I now get Not A Directory errors as well. For instance, ls -la /etc/subversion fails with not a directory, but ls -la /boot/beos/etc/subversion succeeds. Are you perchance checking the S_ISDIR flag before resolving the link? Regards, Rene From oruizdorantes at mail.berlios.de Tue Apr 1 23:48:06 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Tue, 1 Apr 2008 23:48:06 +0200 Subject: [Haiku-commits] r24731 - haiku/trunk/src/kits/bluetooth Message-ID: <200804012148.m31Lm6X3005965@sheep.berlios.de> Author: oruizdorantes Date: 2008-04-01 23:48:05 +0200 (Tue, 01 Apr 2008) New Revision: 24731 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24731&view=rev Modified: haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp Log: Complete asking the server all the events needed to perform a complete(basic) discovery process Modified: haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp 2008-04-01 20:48:14 UTC (rev 24730) +++ haiku/trunk/src/kits/bluetooth/DiscoveryAgent.cpp 2008-04-01 21:48:05 UTC (rev 24731) @@ -55,7 +55,6 @@ return B_TIMED_OUT; void* startInquiryCommand = NULL; - int8 bt_status = BT_ERROR; // keep the listener whats the current listener for our inquiry state fLastUsedListener = listener; @@ -71,10 +70,19 @@ request.AddInt32("hci_id", fLocalDevice->GetID()); startInquiryCommand = buildInquiry(accessCode, secs, BT_MAX_RESPONSES, &size); + + // For stating the inquiry request.AddData("raw command", B_ANY_TYPE, startInquiryCommand, size); request.AddInt16("eventExpected", HCI_EVENT_CMD_STATUS); request.AddInt16("opcodeExpected", PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY)); + // For getting each discovered message + request.AddInt16("eventExpected", HCI_EVENT_INQUIRY_RESULT); + + // For finishing each discovered message + request.AddInt16("eventExpected", HCI_EVENT_INQUIRY_COMPLETE); + + if (btsm->SendMessage(&request, listener) == B_OK) { return B_OK; From axeld at pinc-software.de Tue Apr 1 23:48:56 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Apr 2008 23:48:56 +0200 CEST Subject: [Haiku-commits] r24722 - haiku/trunk/src/system/kernel/fs In-Reply-To: Message-ID: <45592454530-BeMail@zon> Hi Rene, "Rene Gollent" wrote: > On Tue, Apr 1, 2008 at 12:59 PM, axeld at BerliOS < > axeld at mail.berlios.de> wrote: > > Log: > > Revised my previous patch as outlined in the previous one: > > * No longer checks for the path delimiter twice. > > * Now also checks if the first part of the path is a directory. > This patch seems to have broken something else, if I try to do > operations to a path that involves a symlink, I now get Not A > Directory errors as well. For instance, ls -la /etc/subversion fails > with not a directory, but ls -la /boot/beos/etc/subversion succeeds. > Are you perchance checking the S_ISDIR flag before resolving the > link? Thanks for the note, I'll look into it tomorrow. Bye, Axel. From oruizdorantes at mail.berlios.de Tue Apr 1 23:51:31 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Tue, 1 Apr 2008 23:51:31 +0200 Subject: [Haiku-commits] r24732 - haiku/trunk/src/servers/bluetooth Message-ID: <200804012151.m31LpVXS006300@sheep.berlios.de> Author: oruizdorantes Date: 2008-04-01 23:51:31 +0200 (Tue, 01 Apr 2008) New Revision: 24732 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24732&view=rev Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceHandler.cpp Log: Fix correct handling of more than one event wanted in a single request Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceHandler.cpp =================================================================== --- haiku/trunk/src/servers/bluetooth/LocalDeviceHandler.cpp 2008-04-01 21:48:05 UTC (rev 24731) +++ haiku/trunk/src/servers/bluetooth/LocalDeviceHandler.cpp 2008-04-01 21:51:31 UTC (rev 24732) @@ -99,14 +99,14 @@ if ( (msg->FindInt16("opcodeExpected", eventIndex, &opcodeFound) == B_OK) && ((uint16)opcodeFound != opcode) ) { - // FIX: this should remove only the entry - fEventsWanted.RemoveMessage(msg); + // this should remove only the entry + (void)msg->RemoveData("eventExpected", eventIndex); + (void)msg->RemoveData("opcodeExpected", eventIndex); goto bail; } } else { - // Event matches so far - // FIX: this should remove only the entry - fEventsWanted.RemoveMessage(msg); + // Event matches so far + (void)msg->RemoveData("eventExpected", eventIndex); goto bail; } From axeld at pinc-software.de Tue Apr 1 23:54:33 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Tue, 01 Apr 2008 23:54:33 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24710_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/posix_src/system/libroot/posix/pthread?= In-Reply-To: Message-ID: <45929265406-BeMail@zon> "Ryan Leavengood" wrote: > On Mon, Mar 31, 2008 at 4:49 PM, Fran?ois Revol > wrote: > > Ah, I looked into that one once... > > Given that you'll have to add gui support code anyway I don't see > > any > > reason to not add native threading too. > This is a question I have been asking myself, mostly in the context > of > the Haiku WebKit port: if we fully implement pthreads, in what cases > would we want to code a native thread implementation in an app? Of > the > top of my head I would think that simple command-line programs could > just stay pthreads (aka minimal porting required), whereas maybe > bigger apps or GUI apps might benefit from a native port. But I'm not > sure. Are there considerable advantages to going native, besides one > less level of indirection and *maybe* therefore better performance? > Though I'm not convinced until I see some benchmarks. Since pthreads are mapped 1:1 to Haiku threads, there is no performance overhead. Thread creation is slightly more expensive with pthreads as it requires a separate user data structure to be managed, but that's the only disadvantage I can think of - and thread creation is rarely a performance bottleneck in any sane app. If there is a working pthreads implementation, I don't see any need to port a pthread-based app to a supposedly native solution; it's a different API to the same thing. Bye, Axel. From oruizdorantes at mail.berlios.de Tue Apr 1 23:59:23 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Tue, 1 Apr 2008 23:59:23 +0200 Subject: [Haiku-commits] r24733 - haiku/trunk/src/servers/bluetooth Message-ID: <200804012159.m31LxNPF006973@sheep.berlios.de> Author: oruizdorantes Date: 2008-04-01 23:59:23 +0200 (Tue, 01 Apr 2008) New Revision: 24733 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24733&view=rev Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h Log: - Implement the server understand the Inquiry complete, and the Inquiry result. - With this, we should be able to discover other devices, but not tested yet. No application to use this part of the kit Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp =================================================================== --- haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp 2008-04-01 21:51:31 UTC (rev 24732) +++ haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.cpp 2008-04-01 21:59:23 UTC (rev 24733) @@ -111,9 +111,11 @@ // we are waiting for a reply switch (event->ecode) { case HCI_EVENT_INQUIRY_COMPLETE: + InquiryComplete((uint8*)(event+1), request); break; case HCI_EVENT_INQUIRY_RESULT: + InquiryResult((struct inquiry_info*)(event+1), request); break; case HCI_EVENT_CONN_COMPLETE: @@ -229,6 +231,8 @@ Output::Instance()->Post("\n", BLACKBOARD_LD_OFFSET + GetID()); // Handle command complete information + // FIX ME! the expected code might me in another + // index as is relative to the event not the request request->FindInt16("opcodeExpected", 0 /*REVIEW!*/, &opcodeExpected); @@ -259,8 +263,9 @@ request->SendReply(&reply); Output::Instance()->Post("Negative reply for getAdress\n", BLACKBOARD_KIT); } - - ClearWantedEvent(request, PACK_OPCODE(OGF_INFORMATIONAL_PARAM, OCF_READ_BD_ADDR)); + + // This request is not genna be used anymore + ClearWantedEvent(request); } break; @@ -283,8 +288,9 @@ printf("Sending reply ... %ld\n",request->SendReply(&reply)); reply.PrintToStream(); - - ClearWantedEvent(request, PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_READ_LOCAL_NAME)); + + // This request is not genna be used anymore + ClearWantedEvent(request); } break; @@ -306,8 +312,9 @@ printf("Sending reply ... %ld\n",request->SendReply(&reply)); reply.PrintToStream(); - - ClearWantedEvent(request, PACK_OPCODE(OGF_CONTROL_BASEBAND, OCF_WRITE_SCAN_ENABLE)); + + // This request is not genna be used anymore + ClearWantedEvent(request); } break; @@ -355,7 +362,7 @@ printf("Sending reply ... %ld\n",request->SendReply(&reply)); reply.PrintToStream(); - ClearWantedEvent(request, PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY)); + ClearWantedEvent(request, HCI_EVENT_CMD_STATUS, PACK_OPCODE(OGF_LINK_CONTROL, OCF_INQUIRY)); } break; @@ -366,6 +373,32 @@ } + +void +LocalDeviceImpl::InquiryResult(struct inquiry_info* event, BMessage* request) +{ + + BMessage reply(BT_MSG_INQUIRY_DEVICE); + + reply.AddData("info", B_ANY_TYPE, &event, sizeof(struct inquiry_info)); + + printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); + + +} + + +void +LocalDeviceImpl::InquiryComplete(uint8* status, BMessage* request) +{ + BMessage reply(BT_MSG_INQUIRY_COMPLETED); + + reply.AddInt8("status", *status); + printf("%s: Sending reply ... %ld\n",__FUNCTION__, request->SendReply(&reply)); + +} + + #if 0 #pragma mark - Request Methods - #endif Modified: haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h =================================================================== --- haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h 2008-04-01 21:51:31 UTC (rev 24732) +++ haiku/trunk/src/servers/bluetooth/LocalDeviceImpl.h 2008-04-01 21:59:23 UTC (rev 24733) @@ -40,6 +40,10 @@ void CommandComplete(struct hci_ev_cmd_complete* event, BMessage* request); void CommandStatus(struct hci_ev_cmd_status* event, BMessage* request); + // Inquiry + void InquiryResult(struct inquiry_info* event, BMessage* request); + void InquiryComplete(uint8* status, BMessage* request); + }; #endif From mmu_man at mail.berlios.de Wed Apr 2 01:09:24 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 2 Apr 2008 01:09:24 +0200 Subject: [Haiku-commits] r24734 - haiku/trunk/src/apps/mediaplayer/playlist Message-ID: <200804012309.m31N9O3Z030709@sheep.berlios.de> Author: mmu_man Date: 2008-04-02 01:09:21 +0200 (Wed, 02 Apr 2008) New Revision: 24734 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24734&view=rev Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h Log: Was missing BFilePanel class declaration. Modified: haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h 2008-04-01 21:59:23 UTC (rev 24733) +++ haiku/trunk/src/apps/mediaplayer/playlist/PlaylistWindow.h 2008-04-01 23:09:21 UTC (rev 24734) @@ -24,6 +24,7 @@ class PlaylistListView; class RWLocker; class BButton; +class BFilePanel; class PlaylistWindow : public BWindow { public: From bga at bug-br.org.br Wed Apr 2 02:38:31 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 01 Apr 2008 21:38:31 -0300 Subject: [Haiku-commits] r24722 - haiku/trunk/src/system/kernel/fs In-Reply-To: References: <200804011759.m31HxqOV017664@sheep.berlios.de> Message-ID: <47F2D587.3020803@bug-br.org.br> Rene Gollent escreveu: > This patch seems to have broken something else, if I try to do > operations to a path that involves a symlink, I now get Not A > Directory errors as well. For instance, ls -la /etc/subversion fails > with not a directory, but ls -la /boot/beos/etc/subversion succeeds. > Are you perchance checking the S_ISDIR flag before resolving the link? This also seem to have broken populating images as all symlinks seems to be ignored when unzipping files to it (like the development related packages, for example). -Bruno From bonefish at mail.berlios.de Wed Apr 2 02:51:53 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 2 Apr 2008 02:51:53 +0200 Subject: [Haiku-commits] r24735 - haiku/trunk/src/system/kernel/fs Message-ID: <200804020051.m320pr7C016734@sheep.berlios.de> Author: bonefish Date: 2008-04-02 02:51:43 +0200 (Wed, 02 Apr 2008) New Revision: 24735 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24735&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * Fixed resolution of symlinks path components, broken since r24721/r24722. After resolving a symlink we weren't updating the local type variable to the type of the link target, so that the directory check in the next iteration would always fail. * Added TODO. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-01 23:09:21 UTC (rev 24734) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-02 00:51:43 UTC (rev 24735) @@ -1756,6 +1756,10 @@ status_t status = B_OK; ino_t lastParentID = vnode->id; int type = 0; + // TODO: Actually the caller could provide the type of the start node, + // if known, which it is in most cases (context root, mount root, cwd). + // We'd save a now always required read_stat(). + // Doing that via _type wouldn't even require an interface change. FUNCTION(("vnode_path_to_vnode(vnode = %p, path = %s)\n", vnode, path)); @@ -1923,9 +1927,10 @@ if (absoluteSymlink && *path == '\0') { // symlink was just "/" nextVnode = vnode; + type = S_IFDIR; } else { status = vnode_path_to_vnode(vnode, path, traverseLeafLink, - count + 1, ioContext, &nextVnode, &lastParentID, _type); + count + 1, ioContext, &nextVnode, &lastParentID, &type); } free(buffer); From anevilyak at gmail.com Wed Apr 2 02:52:16 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 1 Apr 2008 19:52:16 -0500 Subject: [Haiku-commits] r24722 - haiku/trunk/src/system/kernel/fs In-Reply-To: <47F2D587.3020803@bug-br.org.br> References: <200804011759.m31HxqOV017664@sheep.berlios.de> <47F2D587.3020803@bug-br.org.br> Message-ID: > This also seem to have broken populating images as all symlinks seems to > be ignored when unzipping files to it (like the development related > packages, for example). on my sys gcc and friends were there, but the system wouldn't find them in the path, only doing /boot/develop/tools/gcc-2.95.3-haiku/bin/gcc would work. I don't see how it'd affect populating the image anyways since I didn't think fs_shell used our VFS code? Regards, Rene From anevilyak at gmail.com Wed Apr 2 02:58:41 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 1 Apr 2008 19:58:41 -0500 Subject: [Haiku-commits] r24735 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200804020051.m320pr7C016734@sheep.berlios.de> References: <200804020051.m320pr7C016734@sheep.berlios.de> Message-ID: > if (absoluteSymlink && *path == '\0') { > // symlink was just "/" > nextVnode = vnode; > + type = S_IFDIR; > } else { > status = vnode_path_to_vnode(vnode, path, traverseLeafLink, I'm curious, is it definitely only going to be a dir when it hits this case? or could it also be a file? Regards, Rene From ingo_weinhold at gmx.de Wed Apr 2 03:11:37 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 02 Apr 2008 03:11:37 +0200 Subject: [Haiku-commits] r24735 - haiku/trunk/src/system/kernel/fs In-Reply-To: References: <200804020051.m320pr7C016734@sheep.berlios.de> Message-ID: <20080402031137.607.1@knochen-vm.1207091810.fake> On 2008-04-02 at 02:58:41 [+0200], Rene Gollent wrote: > > if (absoluteSymlink && *path == '\0') { > > // symlink was just "/" > > nextVnode = vnode; > > + type = S_IFDIR; > > } else { > > status = vnode_path_to_vnode(vnode, path, > > traverseLeafLink, > > > I'm curious, is it definitely only going to be a dir when it hits this > case? or could it also be a file? We've just resolved a symlink to "/". I'd say it's pretty safe to assume that this is a directory. :-) CU, Ingo From anevilyak at gmail.com Wed Apr 2 03:12:18 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 1 Apr 2008 20:12:18 -0500 Subject: [Haiku-commits] r24735 - haiku/trunk/src/system/kernel/fs In-Reply-To: <20080402031137.607.1@knochen-vm.1207091810.fake> References: <200804020051.m320pr7C016734@sheep.berlios.de> <20080402031137.607.1@knochen-vm.1207091810.fake> Message-ID: > > We've just resolved a symlink to "/". I'd say it's pretty safe to assume that > this is a directory. :-) > > CU, Ingo Ah, I only had a quick glance at the diff + commit message and wondered. Regards, Rene From bonefish at mail.berlios.de Wed Apr 2 03:55:38 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 2 Apr 2008 03:55:38 +0200 Subject: [Haiku-commits] r24736 - haiku/trunk/src/system/kernel/fs Message-ID: <200804020155.m321tctp021608@sheep.berlios.de> Author: bonefish Date: 2008-04-02 03:55:37 +0200 (Wed, 02 Apr 2008) New Revision: 24736 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24736&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Also check whether the supplied vnode is a directory, if there's only one path component. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-02 00:51:43 UTC (rev 24735) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-02 01:55:37 UTC (rev 24736) @@ -1811,21 +1811,21 @@ put_vnode(vnode); vnode = nextVnode; } - } else if (nextPath[0]) { - // check if vnode is really a directory - if (type == 0) { - // we need to retrieve the type first - struct stat stat; - status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, - vnode->private_node, &stat); - if (status == B_OK) - type = stat.st_mode; - } + } - if (status == B_OK && !S_ISDIR(type)) - status = B_NOT_A_DIRECTORY; + // check if vnode is really a directory + if (type == 0) { + // we need to retrieve the type first + struct stat stat; + status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, + vnode->private_node, &stat); + if (status == B_OK) + type = stat.st_mode; } + if (status == B_OK && !S_ISDIR(type)) + status = B_NOT_A_DIRECTORY; + // Check if we have the right to search the current directory vnode. // If a file system doesn't have the access() function, we assume that // searching a directory is always allowed From axeld at mail.berlios.de Wed Apr 2 11:37:23 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 11:37:23 +0200 Subject: [Haiku-commits] r24737 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/system/kernel/cache Message-ID: <200804020937.m329bN64010482@sheep.berlios.de> Author: axeld Date: 2008-04-02 11:37:22 +0200 (Wed, 02 Apr 2008) New Revision: 24737 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24737&view=rev Modified: haiku/trunk/headers/os/drivers/fs_cache.h haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h haiku/trunk/src/system/kernel/cache/block_cache.cpp haiku/trunk/src/system/kernel/cache/block_cache_private.h Log: * Added a TRANSACTION_IDLE notification that is sent when the transaction hasn't been used for more than 2 seconds. * Replaced the block_cache::lock benaphore with a recursive lock, so that you can call cache functions from within the notification listeners. Modified: haiku/trunk/headers/os/drivers/fs_cache.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_cache.h 2008-04-02 01:55:37 UTC (rev 24736) +++ haiku/trunk/headers/os/drivers/fs_cache.h 2008-04-02 09:37:22 UTC (rev 24737) @@ -14,7 +14,8 @@ enum { TRANSACTION_WRITTEN, TRANSACTION_ABORTED, - TRANSACTION_ENDED + TRANSACTION_ENDED, + TRANSACTION_IDLE }; typedef void (*transaction_notification_hook)(int32 id, int32 event, @@ -22,7 +23,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif /* transactions */ extern int32 cache_start_transaction(void *_cache); @@ -88,6 +89,6 @@ #ifdef __cplusplus } -#endif +#endif #endif /* _FS_CACHE_H */ Modified: haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-04-02 01:55:37 UTC (rev 24736) +++ haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-04-02 09:37:22 UTC (rev 24737) @@ -790,6 +790,7 @@ #define TRANSACTION_WRITTEN FSSH_TRANSACTION_WRITTEN #define TRANSACTION_ABORTED FSSH_TRANSACTION_ABORTED #define TRANSACTION_ENDED FSSH_TRANSACTION_ENDED +#define TRANSACTION_IDLE FSSH_TRANSACTION_IDLE #define transaction_notification_hook fssh_transaction_notification_hook Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-04-02 01:55:37 UTC (rev 24736) +++ haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-04-02 09:37:22 UTC (rev 24737) @@ -14,7 +14,8 @@ enum { FSSH_TRANSACTION_WRITTEN, FSSH_TRANSACTION_ABORTED, - FSSH_TRANSACTION_ENDED + FSSH_TRANSACTION_ENDED, + FSSH_TRANSACTION_IDLE }; typedef void (*fssh_transaction_notification_hook)(int32_t id, int32_t event, @@ -22,7 +23,7 @@ #ifdef __cplusplus extern "C" { -#endif +#endif /* transactions */ extern int32_t fssh_cache_start_transaction(void *_cache); @@ -110,6 +111,6 @@ #ifdef __cplusplus } -#endif +#endif #endif /* _FSSH_FS_CACHE_H */ Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-02 01:55:37 UTC (rev 24736) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-02 09:37:22 UTC (rev 24737) @@ -49,6 +49,9 @@ #define FATAL(x) panic x +static const bigtime_t kTransactionIdleTime = 2000000LL; + // a transaction is considered idle after 2 seconds of inactivity + struct cache_hook : DoublyLinkedListLinkImpl { transaction_notification_hook hook; void *data; @@ -71,6 +74,7 @@ HookList listeners; bool open; bool has_sub_transaction; + bigtime_t last_used; }; #ifdef BLOCK_CACHE_TRANSACTION_TRACING @@ -212,6 +216,7 @@ notification_hook = NULL; notification_data = NULL; open = true; + last_used = system_time(); } @@ -239,10 +244,11 @@ /*! Notifies all listeners of this transaction, and removes them - afterwards. + afterwards if requested via \a removeListener. */ static void -notify_transaction_listeners(cache_transaction *transaction, int32 event) +notify_transaction_listeners(cache_transaction *transaction, int32 event, + bool removeListener) { HookList::Iterator iterator = transaction->listeners.GetIterator(); while (iterator.HasNext()) { @@ -250,8 +256,10 @@ hook->hook(transaction->id, event, hook->data); - iterator.Remove(); - delete hook; + if (removeListener) { + iterator.Remove(); + delete hook; + } } } @@ -353,7 +361,7 @@ if (transaction_hash == NULL) return; - if (benaphore_init(&lock, "block cache") < B_OK) + if (recursive_lock_init(&lock, "block cache") < B_OK) return; register_low_memory_handler(&block_cache::LowMemoryHandler, this, 0); @@ -368,7 +376,7 @@ unregister_low_memory_handler(&block_cache::LowMemoryHandler, this); - benaphore_destroy(&lock); + recursive_lock_destroy(&lock); hash_uninit(transaction_hash); hash_uninit(hash); @@ -525,7 +533,7 @@ block_cache::LowMemoryHandler(void *data, int32 level) { block_cache *cache = (block_cache *)data; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); if (!locker.IsLocked()) { // If our block_cache were deleted, it could be that we had @@ -767,6 +775,8 @@ transaction->first_block = block; transaction->num_blocks++; } + if (transaction != NULL) + transaction->last_used = system_time(); bool wasUnchanged = block->original_data == NULL || block->previous_transaction != NULL; @@ -854,6 +864,7 @@ previous->notification_hook(previous->id, TRANSACTION_WRITTEN, previous->notification_data); } + notify_transaction_listeners(previous, TRANSACTION_WRITTEN, false); if (deleteTransaction) { hash_remove(cache->transaction_hash, previous); @@ -1054,6 +1065,8 @@ kprintf(" sub num block: %ld\n", transaction->sub_num_blocks); kprintf(" has sub: %d\n", transaction->has_sub_transaction); kprintf(" state: %s\n", transaction->open ? "open" : "closed"); + kprintf(" idle: %ld secs\n", + (system_time() - transaction->last_used) / 1000000); if (!showBlocks) return 0; @@ -1126,7 +1139,7 @@ block_cache *cache = NULL; while ((cache = get_next_block_cache(cache)) != NULL) { - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); const uint32 kMaxCount = 64; cached_block *blocks[kMaxCount]; uint32 count = 0; @@ -1154,8 +1167,15 @@ while ((transaction = (cache_transaction *)hash_next( cache->transaction_hash, &iterator)) != NULL && count < kMaxCount) { - if (transaction->open) + if (transaction->open) { + if (system_time() > transaction->last_used + + kTransactionIdleTime) { + // transaction is open but idle + notify_transaction_listeners(transaction, + TRANSACTION_IDLE, false); + } continue; + } // sort blocks to speed up writing them back // TODO: ideally, this should be handled by the I/O scheduler @@ -1223,7 +1243,7 @@ cache_start_transaction(void *_cache) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); if (cache->last_transaction && cache->last_transaction->open) { panic("last transaction (%ld) still open!\n", @@ -1250,7 +1270,7 @@ cache_sync_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); status_t status = B_ENTRY_NOT_FOUND; TRACE(("cache_sync_transaction(id %ld)\n", id)); @@ -1313,7 +1333,7 @@ transaction_notification_hook hook, void *data) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); TRACE(("cache_end_transaction(id = %ld)\n", id)); @@ -1328,7 +1348,7 @@ transaction->notification_hook = hook; transaction->notification_data = data; - notify_transaction_listeners(transaction, TRANSACTION_ENDED); + notify_transaction_listeners(transaction, TRANSACTION_ENDED, true); // iterate through all blocks and free the unchanged original contents @@ -1369,7 +1389,7 @@ cache_abort_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); TRACE(("cache_abort_transaction(id = %ld)\n", id)); @@ -1380,7 +1400,7 @@ } T(Abort(cache, transaction)); - notify_transaction_listeners(transaction, TRANSACTION_ABORTED); + notify_transaction_listeners(transaction, TRANSACTION_ABORTED, true); // iterate through all blocks and restore their original contents @@ -1420,7 +1440,7 @@ transaction_notification_hook hook, void *data) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); TRACE(("cache_detach_sub_transaction(id = %ld)\n", id)); @@ -1443,7 +1463,7 @@ transaction->notification_hook = hook; transaction->notification_data = data; - notify_transaction_listeners(transaction, TRANSACTION_ENDED); + notify_transaction_listeners(transaction, TRANSACTION_ENDED, true); // iterate through all blocks and free the unchanged original contents @@ -1505,7 +1525,7 @@ cache_abort_sub_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); TRACE(("cache_abort_sub_transaction(id = %ld)\n", id)); @@ -1518,7 +1538,7 @@ return B_BAD_VALUE; T(Abort(cache, transaction)); - notify_transaction_listeners(transaction, TRANSACTION_ABORTED); + notify_transaction_listeners(transaction, TRANSACTION_ABORTED, true); // revert all changes back to the version of the parent @@ -1556,7 +1576,7 @@ cache_start_sub_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); TRACE(("cache_start_sub_transaction(id = %ld)\n", id)); @@ -1566,7 +1586,7 @@ return B_BAD_VALUE; } - notify_transaction_listeners(transaction, TRANSACTION_ENDED); + notify_transaction_listeners(transaction, TRANSACTION_ENDED, true); // move all changed blocks up to the parent @@ -1611,7 +1631,7 @@ if (hook == NULL) return B_NO_MEMORY; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) { @@ -1633,7 +1653,7 @@ { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) @@ -1660,7 +1680,7 @@ cached_block *block = (cached_block *)*_cookie; block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL || !transaction->open) @@ -1696,7 +1716,7 @@ cache_blocks_in_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) @@ -1710,7 +1730,7 @@ cache_blocks_in_main_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) @@ -1724,7 +1744,7 @@ cache_blocks_in_sub_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) @@ -1745,7 +1765,7 @@ if (allowWrites) block_cache_sync(cache); - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); // free all blocks @@ -1794,7 +1814,7 @@ // we will sync all dirty blocks to disk that have a completed // transaction or no transaction only - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); hash_iterator iterator; hash_open(cache->hash, &iterator); @@ -1827,7 +1847,7 @@ return B_BAD_VALUE; } - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); for (; numBlocks > 0; numBlocks--, blockNumber++) { cached_block *block = (cached_block *)hash_lookup(cache->hash, @@ -1853,7 +1873,7 @@ block_cache_make_writable(void *_cache, off_t blockNumber, int32 transaction) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); if (cache->read_only) panic("tried to make block writable on a read-only cache!"); @@ -1875,7 +1895,7 @@ off_t length, int32 transaction) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); TRACE(("block_cache_get_writable_etc(block = %Ld, transaction = %ld)\n", blockNumber, transaction)); @@ -1899,7 +1919,7 @@ block_cache_get_empty(void *_cache, off_t blockNumber, int32 transaction) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); TRACE(("block_cache_get_empty(block = %Ld, transaction = %ld)\n", blockNumber, transaction)); @@ -1915,7 +1935,7 @@ block_cache_get_etc(void *_cache, off_t blockNumber, off_t base, off_t length) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); bool allocated; cached_block *block = get_cached_block(cache, blockNumber, &allocated); @@ -1952,7 +1972,7 @@ int32 transaction) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); cached_block *block = (cached_block *)hash_lookup(cache->hash, &blockNumber); @@ -1975,7 +1995,7 @@ block_cache_put(void *_cache, off_t blockNumber) { block_cache *cache = (block_cache *)_cache; - BenaphoreLocker locker(&cache->lock); + RecursiveLocker locker(&cache->lock); put_cached_block(cache, blockNumber); } Modified: haiku/trunk/src/system/kernel/cache/block_cache_private.h =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache_private.h 2008-04-02 01:55:37 UTC (rev 24736) +++ haiku/trunk/src/system/kernel/cache/block_cache_private.h 2008-04-02 09:37:22 UTC (rev 24737) @@ -52,20 +52,20 @@ &cached_block::link> > block_list; struct block_cache : DoublyLinkedListLinkImpl { - hash_table *hash; - benaphore lock; - int fd; - off_t max_blocks; - size_t block_size; - int32 next_transaction_id; + hash_table *hash; + recursive_lock lock; + int fd; + off_t max_blocks; + size_t block_size; + int32 next_transaction_id; cache_transaction *last_transaction; - hash_table *transaction_hash; + hash_table *transaction_hash; - object_cache *buffer_cache; - block_list unused_blocks; + object_cache *buffer_cache; + block_list unused_blocks; - uint32 num_dirty_blocks; - bool read_only; + uint32 num_dirty_blocks; + bool read_only; block_cache(int fd, off_t numBlocks, size_t blockSize, bool readOnly); ~block_cache(); From axeld at mail.berlios.de Wed Apr 2 11:46:35 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 11:46:35 +0200 Subject: [Haiku-commits] r24738 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804020946.m329kZDm011500@sheep.berlios.de> Author: axeld Date: 2008-04-02 11:46:34 +0200 (Wed, 02 Apr 2008) New Revision: 24738 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24738&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h Log: Resolved a TODO in Journal::Lock() that Urias reminded me about: * BFS now uses a transaction listener that flushes the current transaction in case it is idle; before, transactions would always be kept open when they weren't large, so that the block writer could not write back the blocks (they were busy from its POV). * This solves the described problem of the screen resolution not being written back even after minutes of inactivity. * Renamed _TransactionNotify() to _TransactionWritten() to differentiate it a bit more from the new _TransactionListener(). Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-02 09:37:22 UTC (rev 24737) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-02 09:46:34 UTC (rev 24738) @@ -531,8 +531,8 @@ the log start pointer as needed. Note, the transactions may not be completed in the order they were written. */ -void -Journal::_TransactionNotify(int32 transactionID, int32 event, void *_logEntry) +/*static*/ void +Journal::_TransactionWritten(int32 transactionID, int32 event, void *_logEntry) { LogEntry *logEntry = (LogEntry *)_logEntry; @@ -577,13 +577,27 @@ status_t status = journal->fVolume->WriteSuperBlock(); if (status != B_OK) { - FATAL(("_BlockNotify: could not write back super block: %s\n", + FATAL(("_TransactionWritten: could not write back super block: %s\n", strerror(status))); } } } +/*! Listens to TRANSACTION_IDLE events, and flushes the log when that happens */ +/*static*/ void +Journal::_TransactionListener(int32 transactionID, int32 event, void *_journal) +{ + if (event != TRANSACTION_IDLE) + return; + + // The current transaction seems to be idle - flush it + + Journal *journal = (Journal *)_journal; + journal->_FlushLog(); +} + + /*! Writes the blocks that are part of current transaction into the log, and ends the current transaction. If the current transaction is too large to fit into the log, it will @@ -763,11 +777,11 @@ if (detached) { fTransactionID = cache_detach_sub_transaction(fVolume->BlockCache(), - fTransactionID, _TransactionNotify, logEntry); + fTransactionID, _TransactionWritten, logEntry); fUnwrittenTransactions = 1; } else { cache_end_transaction(fVolume->BlockCache(), fTransactionID, - _TransactionNotify, logEntry); + _TransactionWritten, logEntry); fUnwrittenTransactions = 0; } @@ -775,8 +789,11 @@ } +/*! Flushes the current log entry to disk. If \a flushBlocks is \c true it will + also write back all dirty blocks for this volume. +*/ status_t -Journal::FlushLogAndBlocks() +Journal::_FlushLog(bool flushBlocks) { status_t status = fLock.Lock(); if (status != B_OK) @@ -796,26 +813,31 @@ FATAL(("writing current log entry failed: %s\n", strerror(status))); } - status = fVolume->FlushDevice(); + if (flushBlocks) + status = fVolume->FlushDevice(); fLock.Unlock(); return status; } +/*! Flushes the current log entry to disk, and also writes back all dirty + blocks for this volume (completing all open transactions). +*/ status_t +Journal::FlushLogAndBlocks() +{ + return _FlushLog(true); +} + + +status_t Journal::Lock(Transaction *owner) { status_t status = fLock.Lock(); if (status != B_OK) return status; -/* ToDo: - // if the last transaction is older than 2 secs, start a new one - if (fTransactionsInEntry != 0 && system_time() - fTimestamp > 2000000L) - WriteLogEntry(); -*/ - if (fLock.OwnerCount() > 1) { // we'll just use the current transaction again return B_OK; @@ -842,6 +864,9 @@ return fTransactionID; } + cache_add_transaction_listener(fVolume->BlockCache(), fTransactionID, + _TransactionListener, this); + return B_OK; } @@ -867,7 +892,7 @@ { int32 count = cache_blocks_in_transaction(fVolume->BlockCache(), fTransactionID); - if (count < 0) + if (count <= 0) return 0; // take the number of array blocks in this transaction into account Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-04-02 09:37:22 UTC (rev 24737) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-04-02 09:46:34 UTC (rev 24738) @@ -52,13 +52,17 @@ private: bool _HasSubTransaction() { return fHasSubtransaction; } + status_t _FlushLog(bool flushBlocks = false); uint32 _TransactionSize() const; status_t _WriteTransactionToLog(); status_t _CheckRunArray(const run_array *array); status_t _ReplayRunArray(int32 *start); status_t _TransactionDone(bool success); - static void _TransactionNotify(int32 transactionID, int32 event, + + static void _TransactionWritten(int32 transactionID, int32 event, void *_logEntry); + static void _TransactionListener(int32 transactionID, int32 event, + void *_journal); Volume *fVolume; RecursiveLock fLock; From korli at users.berlios.de Wed Apr 2 12:06:58 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 2 Apr 2008 12:06:58 +0200 Subject: [Haiku-commits] r24737 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/system/kernel/cache In-Reply-To: <200804020937.m329bN64010482@sheep.berlios.de> References: <200804020937.m329bN64010482@sheep.berlios.de> Message-ID: Hi Axel, 2008/4/2, axeld at BerliOS : > * Added a TRANSACTION_IDLE notification that is sent when the transaction > hasn't been used for more than 2 seconds. If you had asked, I would have proposed TRANSACTION_STALLED instead :) Bye, J?r?me From axeld at pinc-software.de Wed Apr 2 12:25:44 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 02 Apr 2008 12:25:44 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24737_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/os/drivers_headers/private/fs=5Fshell__src/system/kerne?= =?iso-8859-15?q?l/cache?= In-Reply-To: Message-ID: <9353507401-BeMail@zon> "J?r?me Duval" wrote: > 2008/4/2, axeld at BerliOS : > > * Added a TRANSACTION_IDLE notification that is sent when the > > transaction > > hasn't been used for more than 2 seconds. > If you had asked, I would have proposed TRANSACTION_STALLED instead > :) Why stalled? That transaction is still valid and could be reused any time; it just hadn't been used for some time and left open. If BFS needed a transaction it would just reuse that idle transaction. Bye, Axel. From axeld at mail.berlios.de Wed Apr 2 12:44:10 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 12:44:10 +0200 Subject: [Haiku-commits] r24739 - haiku/trunk/src/system/kernel/cache Message-ID: <200804021044.m32AiAan006548@sheep.berlios.de> Author: axeld Date: 2008-04-02 12:44:08 +0200 (Wed, 02 Apr 2008) New Revision: 24739 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24739&view=rev Removed: haiku/trunk/src/system/kernel/cache/block_cache_private.h Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * block_cache_private.h is no longer needed, moved its contents into block_cache.cpp. * Fixed warning. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-02 09:46:34 UTC (rev 24738) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-02 10:44:08 UTC (rev 24739) @@ -4,7 +4,7 @@ */ -#include "block_cache_private.h" +#include #include #include @@ -15,9 +15,9 @@ #include #include -#include #include #include +#include #include #include #include @@ -42,7 +42,7 @@ #endif #define DEBUG_BLOCK_CACHE -//#define DEBUG_CHANGED +#define DEBUG_CHANGED // This macro is used for fatal situations that are acceptable in a running // system, like out of memory situations - should only panic for debugging. @@ -52,6 +52,74 @@ 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; +#ifdef DEBUG_CHANGED + void *compare; +#endif + int32 ref_count; + int32 accessed; + bool busy : 1; + bool is_writing : 1; + bool is_dirty : 1; + bool unused : 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 block_cache : DoublyLinkedListLinkImpl { + hash_table *hash; + recursive_lock 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; + + block_cache(int fd, off_t numBlocks, size_t blockSize, bool readOnly); + ~block_cache(); + + status_t InitCheck(); + + void RemoveUnusedBlocks(int32 maxAccessed = LONG_MAX, + int32 count = LONG_MAX); + void FreeBlock(cached_block *block); + cached_block *NewBlock(off_t blockNumber); + void Free(void *buffer); + void *Allocate(); + + static void LowMemoryHandler(void *data, int32 level); + +private: + cached_block *_GetUnusedBlock(); +}; + struct cache_hook : DoublyLinkedListLinkImpl { transaction_notification_hook hook; void *data; @@ -1065,7 +1133,7 @@ kprintf(" sub num block: %ld\n", transaction->sub_num_blocks); kprintf(" has sub: %d\n", transaction->has_sub_transaction); kprintf(" state: %s\n", transaction->open ? "open" : "closed"); - kprintf(" idle: %ld secs\n", + kprintf(" idle: %Ld secs\n", (system_time() - transaction->last_used) / 1000000); if (!showBlocks) Deleted: haiku/trunk/src/system/kernel/cache/block_cache_private.h From stippi at mail.berlios.de Wed Apr 2 13:04:12 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 2 Apr 2008 13:04:12 +0200 Subject: [Haiku-commits] r24740 - haiku/trunk/src/servers/app Message-ID: <200804021104.m32B4Cnm030564@sheep.berlios.de> Author: stippi Date: 2008-04-02 13:04:03 +0200 (Wed, 02 Apr 2008) New Revision: 24740 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24740&view=rev Modified: haiku/trunk/src/servers/app/DrawState.cpp Log: The scale of a state does not influence the origin. Only previous states and their origin and scale influences the current state's origin, since they can be regarded as within the parent state's coordinate system. Modified: haiku/trunk/src/servers/app/DrawState.cpp =================================================================== --- haiku/trunk/src/servers/app/DrawState.cpp 2008-04-02 10:44:08 UTC (rev 24739) +++ haiku/trunk/src/servers/app/DrawState.cpp 2008-04-02 11:04:03 UTC (rev 24740) @@ -289,8 +289,7 @@ fCombinedOrigin.y = fPreviousState->fCombinedOrigin.y + fOrigin.y * fPreviousState->fCombinedScale; } else { - fCombinedOrigin.x = fOrigin.x * fCombinedScale; - fCombinedOrigin.y = fOrigin.y * fCombinedScale; + fCombinedOrigin = fOrigin; } } @@ -309,6 +308,8 @@ fCombinedScale = fScale; // update font size + // NOTE: This is what makes the call potentially expensive, + // hence the introductory check fFont.SetSize(fUnscaledFontSize * fCombinedScale); } } From ingo_weinhold at gmx.de Wed Apr 2 13:10:32 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 02 Apr 2008 13:10:32 +0200 Subject: [Haiku-commits] r24669 - in haiku/trunk: headers/posix headers/private/kernel src/kits/network/dns src/system/kernel src/system/libroot/posix/unistd In-Reply-To: <700983474-BeMail@zon> References: <700983474-BeMail@zon> Message-ID: <20080402131032.515.1@knochen-vm.1207134578.fake> On 2008-04-01 at 10:20:43 [+0200], Axel D?rfler wrote: > "Fran?ois Revol" wrote: > > > What happens when copying these files or trying to make/restore a > > > backup? > > You'd get doubled users if root copies. > > User copies won't be able to add the attr oth. > > Even if we wanted to use single files, there would still be no good > reason to use queries IMO. Well, the get{pw,gr}{nam,{uid,gid}}() functions benefit from being able to directly query for the matching name/ID. Nevertheless I'd at least restrict the considered query results to a single directory. Anyway, I've almost finished the /etc/{passwd,group} backend and will soon check it in. CU, Ingo From stippi at mail.berlios.de Wed Apr 2 13:12:41 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 2 Apr 2008 13:12:41 +0200 Subject: [Haiku-commits] r24741 - in haiku/trunk/src/servers/app: . drawing Message-ID: <200804021112.m32BCfCL003027@sheep.berlios.de> Author: stippi Date: 2008-04-02 13:12:39 +0200 (Wed, 02 Apr 2008) New Revision: 24741 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24741&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp haiku/trunk/src/servers/app/Desktop.h haiku/trunk/src/servers/app/ServerApp.cpp haiku/trunk/src/servers/app/ServerCursor.h haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp haiku/trunk/src/servers/app/drawing/HWInterface.cpp haiku/trunk/src/servers/app/drawing/HWInterface.h Log: HWInterface::Cursor() and therefor Desktop::Cursor() accessed the current cursor without locking, and did not add a reference while using the cursor. I have tried to solve both problems by introducing a simple ServerCursorReference class, which makes sure that the reference count is properly maintained. There are only two places where this code was even used, from within ServerApp and when taking screenshots. Axel, you mentioned in #837 that the code is unsafe, is this what you meant? This hopefully fixes #837, but it is very hard to reproduce in the first place, I will close the ticket, but it should just be reopened if ever encountered again. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-04-02 11:04:03 UTC (rev 24740) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-04-02 11:12:39 UTC (rev 24741) @@ -714,15 +714,15 @@ if (newCursor == NULL) newCursor = fCursorManager.GetCursor(B_CURSOR_DEFAULT); - ServerCursor* oldCursor = Cursor(); - if (newCursor == oldCursor) + ServerCursorReference oldCursor = Cursor(); + if (newCursor == oldCursor.Cursor()) return; HWInterface()->SetCursor(newCursor); } -ServerCursor* +ServerCursorReference Desktop::Cursor() const { return HWInterface()->Cursor(); Modified: haiku/trunk/src/servers/app/Desktop.h =================================================================== --- haiku/trunk/src/servers/app/Desktop.h 2008-04-02 11:04:03 UTC (rev 24740) +++ haiku/trunk/src/servers/app/Desktop.h 2008-04-02 11:12:39 UTC (rev 24741) @@ -12,12 +12,13 @@ #include "CursorManager.h" +#include "DesktopSettings.h" #include "EventDispatcher.h" +#include "MessageLooper.h" #include "Screen.h" #include "ScreenManager.h" +#include "ServerCursor.h" #include "VirtualScreen.h" -#include "DesktopSettings.h" -#include "MessageLooper.h" #include "WindowList.h" #include "Workspace.h" #include "WorkspacePrivate.h" @@ -78,7 +79,7 @@ CursorManager& GetCursorManager() { return fCursorManager; } void SetCursor(ServerCursor* cursor); - ServerCursor* Cursor() const; + ServerCursorReference Cursor() const; void SetLastMouseState(const BPoint& position, int32 buttons); // for use by the mouse filter only Modified: haiku/trunk/src/servers/app/ServerApp.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerApp.cpp 2008-04-02 11:04:03 UTC (rev 24740) +++ haiku/trunk/src/servers/app/ServerApp.cpp 2008-04-02 11:12:39 UTC (rev 24741) @@ -291,8 +291,6 @@ if (fIsActive == value) return; - // TODO: send some message to the client?!? - fIsActive = value; if (fIsActive) { Modified: haiku/trunk/src/servers/app/ServerCursor.h =================================================================== --- haiku/trunk/src/servers/app/ServerCursor.h 2008-04-02 11:04:03 UTC (rev 24740) +++ haiku/trunk/src/servers/app/ServerCursor.h 2008-04-02 11:12:39 UTC (rev 24741) @@ -33,7 +33,7 @@ ServerCursor(const ServerCursor* cursor); virtual ~ServerCursor(); - + //! Returns the cursor's hot spot void SetHotSpot(BPoint pt); BPoint GetHotSpot() const @@ -70,4 +70,54 @@ vint32 fPendingViewCursor; }; + +class ServerCursorReference { +public: + ServerCursorReference() + : fCursor(NULL) + { + } + ServerCursorReference(ServerCursor* cursor) + : fCursor(cursor) + { + if (fCursor) + fCursor->Acquire(); + } + ServerCursorReference(const ServerCursorReference& other) + : fCursor(other.fCursor) + { + if (fCursor) + fCursor->Acquire(); + } + virtual ~ServerCursorReference() + { + if (fCursor) + fCursor->Release(); + } + + ServerCursorReference& operator=(const ServerCursorReference& other) + { + SetCursor(other.fCursor); + return *this; + } + + void SetCursor(ServerCursor* cursor) + { + if (fCursor == cursor) + return; + if (fCursor) + fCursor->Release(); + fCursor = cursor; + if (fCursor) + fCursor->Acquire(); + } + ServerCursor* Cursor() const + { + return fCursor; + } +private: + ServerCursor* fCursor; +}; + + #endif // SERVER_CURSOR_H Modified: haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2008-04-02 11:04:03 UTC (rev 24740) +++ haiku/trunk/src/servers/app/drawing/DrawingEngine.cpp 2008-04-02 11:12:39 UTC (rev 24741) @@ -62,7 +62,7 @@ , fHidden(interface->HideFloatingOverlays(area)) { } - + AutoFloatingOverlaysHider(HWInterface* interface) : fInterface(interface) , fHidden(fInterface->HideFloatingOverlays()) @@ -83,7 +83,7 @@ private: HWInterface* fInterface; bool fHidden; - + }; @@ -127,7 +127,7 @@ bool DrawingEngine::LockExclusiveAccess() -{ +{ return fGraphicsCard->LockExclusiveAccess(); } @@ -453,7 +453,7 @@ // compare vertically if (yOffset > 0) { if (is_above(a, b)) { - cmp -= 1; + cmp -= 1; } else if (is_above(b, a)) { cmp += 1; } @@ -541,7 +541,7 @@ BRegion region(r); region.IntersectWith(fPainter->ClippingRegion()); fGraphicsCard->InvertRegion(region); - } else { + } else { fPainter->InvertRect(r); _CopyToFront(r); @@ -586,7 +586,7 @@ BPoint center(r.left + xRadius, r.top + yRadius); - if (filled) + if (filled) fPainter->FillArc(center, xRadius, yRadius, angle, span); else fPainter->StrokeArc(center, xRadius, yRadius, angle, span); @@ -730,7 +730,7 @@ || overlaysHider.WasHidden()); } else { fPainter->FillRect(r, color); - + _CopyToFront(r); } } @@ -1069,7 +1069,7 @@ //bigtime_t now = system_time(); // TODO: BoundingBox is quite slow!! Optimizing it will be beneficial. // Cursiously, the DrawString after it is actually faster!?! -// TODO: make the availability of the hardware cursor part of the +// TODO: make the availability of the hardware cursor part of the // HW acceleration flags and skip all calculations for HideFloatingOverlays // in case we don't have one. // TODO: Watch out about penLocation and use Painter::PenLocation() when @@ -1151,11 +1151,14 @@ status_t result = bitmap->ImportBits(buffer->Bits(), buffer->BitsLength(), buffer->BytesPerRow(), buffer->ColorSpace(), - bounds.LeftTop(), BPoint(0, 0), + bounds.LeftTop(), BPoint(0, 0), bounds.IntegerWidth() + 1, bounds.IntegerHeight() + 1); if (drawCursor) { - ServerCursor *cursor = fGraphicsCard->Cursor(); + ServerCursorReference cursorRef = fGraphicsCard->Cursor(); + ServerCursor* cursor = cursorRef.Cursor(); + if (!cursor) + return result; int32 cursorWidth = cursor->Width(); int32 cursorHeight = cursor->Height(); @@ -1164,7 +1167,7 @@ BBitmap cursorArea(BRect(0, 0, cursorWidth - 1, cursorHeight - 1), B_BITMAP_NO_SERVER_LINK, B_RGBA32); - + cursorArea.ImportBits(bitmap->Bits(), bitmap->BitsLength(), bitmap->BytesPerRow(), bitmap->ColorSpace(), cursorPosition, BPoint(0, 0), @@ -1185,7 +1188,7 @@ bitmap->ImportBits(cursorArea.Bits(), cursorArea.BitsLength(), cursorArea.BytesPerRow(), cursorArea.ColorSpace(), - BPoint(0, 0), cursorPosition, + BPoint(0, 0), cursorPosition, cursorWidth, cursorHeight); } Modified: haiku/trunk/src/servers/app/drawing/HWInterface.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/HWInterface.cpp 2008-04-02 11:04:03 UTC (rev 24740) +++ haiku/trunk/src/servers/app/drawing/HWInterface.cpp 2008-04-02 11:12:39 UTC (rev 24741) @@ -12,7 +12,6 @@ #include "drawing_support.h" #include "RenderingBuffer.h" -#include "ServerCursor.h" #include "SystemPalette.h" #include "UpdateQueue.h" @@ -148,6 +147,17 @@ fFloatingOverlaysLock.Unlock(); } +// Cursor +ServerCursorReference +HWInterface::Cursor() const +{ + if (!fFloatingOverlaysLock.Lock()) + return ServerCursorReference(NULL); + ServerCursorReference reference(fCursor); + fFloatingOverlaysLock.Unlock(); + return reference; +} + // SetCursorVisible void HWInterface::SetCursorVisible(bool visible) @@ -529,7 +539,7 @@ uint8* c = crs; uint8* d = dst; uint8* b = bup; - + for (int32 x = area.left; x <= area.right; x++) { *(uint32*)b = *(uint32*)s; // assumes backbuffer alpha = 255 @@ -601,7 +611,7 @@ case B_RGB32: case B_RGBA32: { int32 bytes = (right - x + 1) * 4; - + if (bytes > 0) { // offset to left top pixel in dest buffer dst += y * dstBPR + x * 4; @@ -657,7 +667,7 @@ } break; } - case B_RGB15: + case B_RGB15: case B_RGBA15: { // offset to left top pixel in dest buffer dst += y * dstBPR + x * 2; @@ -702,7 +712,7 @@ break; } - case B_GRAY8: + case B_GRAY8: if (frontBuffer->Width() > dstBPR) { // VGA 16 color grayscale planar mode if (fVGADevice > 0) { Modified: haiku/trunk/src/servers/app/drawing/HWInterface.h =================================================================== --- haiku/trunk/src/servers/app/drawing/HWInterface.h 2008-04-02 11:04:03 UTC (rev 24740) +++ haiku/trunk/src/servers/app/drawing/HWInterface.h 2008-04-02 11:12:39 UTC (rev 24741) @@ -9,7 +9,9 @@ #define HW_INTERFACE_H +#include "IntRect.h" #include "MultiLocker.h" +#include "ServerCursor.h" #include @@ -20,13 +22,10 @@ #include #include -#include "IntRect.h" - class Overlay; class RenderingBuffer; class ServerBitmap; -class ServerCursor; class UpdateQueue; class BString; @@ -108,7 +107,7 @@ virtual void Sync() {} // cursor handling (these do their own Read/Write locking) - ServerCursor* Cursor() const { return fCursor; } + ServerCursorReference Cursor() const; virtual void SetCursor(ServerCursor* cursor); virtual void SetCursorVisible(bool visible); bool IsCursorVisible(); From revol at free.fr Wed Apr 2 14:00:20 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Wed, 02 Apr 2008 14:00:20 +0200 CEST Subject: [Haiku-commits] r24669 - in haiku/trunk: headers/posix headers/private/kernel src/kits/network/dns src/system/kernel src/system/libroot/posix/unistd In-Reply-To: <20080402131032.515.1@knochen-vm.1207134578.fake> Message-ID: <1211759561-BeMail@laptop> > > On 2008-04-01 at 10:20:43 [+0200], Axel D?rfler > > wrote: > > "Fran?ois Revol" wrote: > > > > What happens when copying these files or trying to make/restore > > > > a > > > > backup? > > > You'd get doubled users if root copies. > > > User copies won't be able to add the attr oth. > > > > Even if we wanted to use single files, there would still be no good > > reason to use queries IMO. > > Well, the get{pw,gr}{nam,{uid,gid}}() functions benefit from being > able to > directly query for the matching name/ID. Nevertheless I'd at least > restrict > the considered query results to a single directory. Anyway, I've > almost Yes probably, unless we want to move the attributes to the home directory itself. > finished the /etc/{passwd,group} backend and will soon check it in. The query version is in pwd_query.c anyway, so one can always substitute it for comparison. How about using pwd_file.c for that one ? For PAM one will need to hook those calls anyway. Fran?ois. From korli at users.berlios.de Wed Apr 2 14:06:06 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 2 Apr 2008 14:06:06 +0200 Subject: [Haiku-commits] r24737 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/system/kernel/cache In-Reply-To: <9353507401-BeMail@zon> References: <9353507401-BeMail@zon> Message-ID: 2008/4/2, Axel D?rfler : > "J?r?me Duval" wrote: > > 2008/4/2, axeld at BerliOS : > > > * Added a TRANSACTION_IDLE notification that is sent when the > > > transaction > > > hasn't been used for more than 2 seconds. > > If you had asked, I would have proposed TRANSACTION_STALLED instead > > :) > > > Why stalled? That transaction is still valid and could be reused any > time; it just hadn't been used for some time and left open. If BFS > needed a transaction it would just reuse that idle transaction. > I was under the impression the transaction was in use, but without activity, which is the meaning of stalled. If the transaction isn't used, idle is obviously a better choice. Bye, J?r?me From axeld at mail.berlios.de Wed Apr 2 14:19:29 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 14:19:29 +0200 Subject: [Haiku-commits] r24742 - haiku/trunk/src/system/kernel/vm Message-ID: <200804021219.m32CJT5k018206@sheep.berlios.de> Author: axeld Date: 2008-04-02 14:19:28 +0200 (Wed, 02 Apr 2008) New Revision: 24742 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24742&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp Log: * Fixed several occasions of bugs with respect to the handling of overcommitting stores: - has_precommitted was incorrectly set to true in the constructor - when a precommitted page was committed, vm_store::committed_size was still changed. - unreserving memory did not update vm_store::committed_size. - when precommitted pages were committed, their page count instead of their size was reserved. * All this lead to bug #1970 which should be fixed now. * Cleanup of vm_cache.cpp, no functional change. Modified: haiku/trunk/src/system/kernel/vm/vm_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-04-02 11:12:39 UTC (rev 24741) +++ haiku/trunk/src/system/kernel/vm/vm_cache.cpp 2008-04-02 12:19:28 UTC (rev 24742) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -34,7 +34,7 @@ #endif -static hash_table *sPageCacheTable; +static hash_table* sPageCacheTable; static spinlock sPageCacheTableLock; #if DEBUG_CACHE_LIST @@ -45,15 +45,15 @@ struct page_lookup_key { uint32 offset; - vm_cache *cache; + vm_cache* cache; }; static int -page_compare_func(void *_p, const void *_key) +page_compare_func(void* _p, const void* _key) { - vm_page *page = (vm_page *)_p; - const struct page_lookup_key *key = (page_lookup_key *)_key; + vm_page* page = (vm_page*)_p; + const struct page_lookup_key* key = (page_lookup_key*)_key; TRACE(("page_compare_func: page %p, key %p\n", page, key)); @@ -65,10 +65,10 @@ static uint32 -page_hash_func(void *_p, const void *_key, uint32 range) +page_hash_func(void* _p, const void* _key, uint32 range) { - vm_page *page = (vm_page *)_p; - const struct page_lookup_key *key = (page_lookup_key *)_key; + vm_page* page = (vm_page*)_p; + const struct page_lookup_key* key = (page_lookup_key*)_key; #define HASH(offset, ref) ((offset) + ((uint32)(ref) >> 6) * 997) // sizeof(vm_cache) >= 64, hence (uint32)(ref) >> 6 is still unique @@ -101,7 +101,7 @@ static void -delete_cache(vm_cache *cache) +delete_cache(vm_cache* cache) { if (cache->areas != NULL) panic("cache %p to be deleted still has areas", cache); @@ -127,9 +127,9 @@ cache->store->ops->destroy(cache->store); // free all of the pages in the cache - vm_page *page = cache->page_list; + vm_page* page = cache->page_list; while (page) { - vm_page *oldPage = page; + vm_page* oldPage = page; int state; page = page->cache_next; @@ -168,7 +168,7 @@ status_t -vm_cache_init(kernel_args *args) +vm_cache_init(kernel_args* args) { // TODO: The table should grow/shrink dynamically. sPageCacheTable = hash_init(vm_page_num_pages() / 2, @@ -180,17 +180,17 @@ } -vm_cache * -vm_cache_create(vm_store *store) +vm_cache* +vm_cache_create(vm_store* store) { - vm_cache *cache; + vm_cache* cache; if (store == NULL) { panic("vm_cache created with NULL store!"); return NULL; } - cache = (vm_cache *)malloc(sizeof(vm_cache)); + cache = (vm_cache*)malloc(sizeof(vm_cache)); if (cache == NULL) return NULL; @@ -238,7 +238,7 @@ void -vm_cache_acquire_ref(vm_cache *cache) +vm_cache_acquire_ref(vm_cache* cache) { TRACE(("vm_cache_acquire_ref: cache %p, ref will be %ld\n", cache, cache->ref_count + 1)); @@ -251,7 +251,7 @@ void -vm_cache_release_ref(vm_cache *cache) +vm_cache_release_ref(vm_cache* cache) { TRACE(("vm_cache_release_ref: cacheRef %p, ref will be %ld\n", cache, cache->ref_count - 1)); @@ -268,8 +268,8 @@ void* return_address; }; int32 min = 0; - vm_area *a; - vm_cache *c; + vm_area* a; + vm_cache* c; bool locked = false; if (cacheRef->lock.holder != find_thread(NULL)) { mutex_lock(&cacheRef->lock); @@ -281,7 +281,7 @@ min++; dprintf("! %ld release cache_ref %p, ref_count is now %ld (min %ld, called from %p)\n", find_thread(NULL), cacheRef, cacheRef->ref_count, - min, ((struct stack_frame *)x86_read_ebp())->return_address); + min, ((struct stack_frame*)x86_read_ebp())->return_address); if (cacheRef->ref_count < min) panic("cache_ref %p has too little ref_count!!!!", cacheRef); if (locked) @@ -314,8 +314,8 @@ } -vm_page * -vm_cache_lookup_page(vm_cache *cache, off_t offset) +vm_page* +vm_cache_lookup_page(vm_cache* cache, off_t offset) { ASSERT_LOCKED_MUTEX(&cache->lock); @@ -326,7 +326,7 @@ cpu_status state = disable_interrupts(); acquire_spinlock(&sPageCacheTableLock); - vm_page *page = (vm_page *)hash_lookup(sPageCacheTable, &key); + vm_page* page = (vm_page*)hash_lookup(sPageCacheTable, &key); release_spinlock(&sPageCacheTableLock); restore_interrupts(state); @@ -339,7 +339,7 @@ void -vm_cache_insert_page(vm_cache *cache, vm_page *page, off_t offset) +vm_cache_insert_page(vm_cache* cache, vm_page* page, off_t offset) { TRACE(("vm_cache_insert_page: cache %p, page %p, offset %Ld\n", cache, page, offset)); @@ -370,7 +370,7 @@ struct page_lookup_key key; key.offset = (uint32)(offset >> PAGE_SHIFT); key.cache = cache; - vm_page* otherPage = (vm_page *)hash_lookup(sPageCacheTable, &key); + vm_page* otherPage = (vm_page*)hash_lookup(sPageCacheTable, &key); if (otherPage != NULL) { panic("vm_cache_insert_page(): there's already page %p with cache " "offset %lu in cache %p; inserting page %p", otherPage, @@ -382,13 +382,12 @@ } -/*! - Removes the vm_page from this cache. Of course, the page must +/*! Removes the vm_page from this cache. Of course, the page must really be in this cache or evil things will happen. The cache lock must be held. */ void -vm_cache_remove_page(vm_cache *cache, vm_page *page) +vm_cache_remove_page(vm_cache* cache, vm_page* page) { TRACE(("vm_cache_remove_page: cache %p, page %p\n", cache, page)); ASSERT_LOCKED_MUTEX(&cache->lock); @@ -422,7 +421,7 @@ status_t -vm_cache_write_modified(vm_cache *cache, bool fsReenter) +vm_cache_write_modified(vm_cache* cache, bool fsReenter) { TRACE(("vm_cache_write_modified(cache = %p)\n", cache)); @@ -437,22 +436,22 @@ } -/*! - Commits the memory to the store if the \a commitment is larger than +/*! Commits the memory to the store if the \a commitment is larger than what's committed already. Assumes you have the \a ref's lock held. */ status_t -vm_cache_set_minimal_commitment_locked(vm_cache *cache, off_t commitment) +vm_cache_set_minimal_commitment_locked(vm_cache* cache, off_t commitment) { TRACE(("vm_cache_set_minimal_commitment_locked(cache %p, commitment %Ld)\n", cache, commitment)); ASSERT_LOCKED_MUTEX(&cache->lock); - vm_store *store = cache->store; + vm_store* store = cache->store; status_t status = B_OK; - // If we don't have enough committed space to cover through to the new end of region... + // If we don't have enough committed space to cover through to the new end + // of the area... if (store->committed_size < commitment) { // ToDo: should we check if the cache's virtual size is large // enough for a commitment of that size? @@ -465,8 +464,7 @@ } -/*! - This function updates the size field of the vm_cache structure. +/*! This function updates the size field of the vm_cache structure. If needed, it will free up all pages that don't belong to the cache anymore. The cache lock must be held when you call it. Since removed pages don't belong to the cache any longer, they are not @@ -476,7 +474,7 @@ has to wait for busy pages. */ status_t -vm_cache_resize(vm_cache *cache, off_t newSize) +vm_cache_resize(vm_cache* cache, off_t newSize) { TRACE(("vm_cache_resize(cache %p, newSize %Ld) old size %Ld\n", cache, newSize, cache->virtual_size)); @@ -493,7 +491,8 @@ if (newPageCount < oldPageCount) { // we need to remove all pages in the cache outside of the new virtual // size - vm_page *page = cache->page_list, *next; + vm_page* page = cache->page_list; + vm_page* next; while (page != NULL) { next = page->cache_next; @@ -534,13 +533,12 @@ } -/*! - Removes the \a consumer from the \a cache. +/*! Removes the \a consumer from the \a cache. It will also release the reference to the cacheRef owned by the consumer. Assumes you have the consumer's cache lock held. */ void -vm_cache_remove_consumer(vm_cache *cache, vm_cache *consumer) +vm_cache_remove_consumer(vm_cache* cache, vm_cache* consumer) { TRACE(("remove consumer vm cache %p from cache %p\n", consumer, cache)); ASSERT_LOCKED_MUTEX(&consumer->lock); @@ -562,7 +560,7 @@ // The cache is not really needed anymore - it can be merged with its only // consumer left. - consumer = (vm_cache *)list_get_first_item(&cache->consumers); + consumer = (vm_cache*)list_get_first_item(&cache->consumers); bool merge = acquire_unreferenced_cache_ref(consumer); @@ -598,16 +596,15 @@ } if (merge) { - vm_page *page, *nextPage; - vm_cache *newSource; + consumer = (vm_cache*)list_remove_head_item(&cache->consumers); - consumer = (vm_cache *)list_remove_head_item(&cache->consumers); - TRACE(("merge vm cache %p (ref == %ld) with vm cache %p\n", cache, cache->ref_count, consumer)); - for (page = cache->page_list; page != NULL; page = nextPage) { - vm_page *consumerPage; + vm_page* nextPage; + for (vm_page* page = cache->page_list; page != NULL; + page = nextPage) { + vm_page* consumerPage; nextPage = page->cache_next; consumerPage = vm_cache_lookup_page(consumer, @@ -644,7 +641,7 @@ } } - newSource = cache->source; + vm_cache* newSource = cache->source; // The remaining consumer has gotten a new source mutex_lock(&newSource->lock); @@ -667,7 +664,7 @@ mutex_unlock(&consumer->lock); vm_cache_release_ref(consumer); } - + if (cache->busy) busyCondition.Unpublish(); } @@ -677,14 +674,13 @@ } -/*! - Marks the \a cache as source of the \a consumer cache, +/*! Marks the \a cache as source of the \a consumer cache, and adds the \a consumer to its list. This also grabs a reference to the source cache. Assumes you have the cache and the consumer's lock held. */ void -vm_cache_add_consumer_locked(vm_cache *cache, vm_cache *consumer) +vm_cache_add_consumer_locked(vm_cache* cache, vm_cache* consumer) { TRACE(("add consumer vm cache %p to cache %p\n", consumer, cache)); ASSERT_LOCKED_MUTEX(&cache->lock); @@ -700,12 +696,11 @@ } -/*! - Adds the \a area to the \a cache. +/*! Adds the \a area to the \a cache. Assumes you have the locked the cache. */ status_t -vm_cache_insert_area_locked(vm_cache *cache, vm_area *area) +vm_cache_insert_area_locked(vm_cache* cache, vm_area* area) { TRACE(("vm_cache_insert_area_locked(cache %p, area %p)\n", cache, area)); ASSERT_LOCKED_MUTEX(&cache->lock); @@ -724,7 +719,7 @@ status_t -vm_cache_remove_area(vm_cache *cache, vm_area *area) +vm_cache_remove_area(vm_cache* cache, vm_area* area) { TRACE(("vm_cache_remove_area(cache %p, area %p)\n", cache, area)); Modified: haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp 2008-04-02 11:12:39 UTC (rev 24741) +++ haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp 2008-04-02 12:19:28 UTC (rev 24742) @@ -1,5 +1,5 @@ -/* - * Copyright 2002-2007, Axel D?rfler, axeld at pinc-software.de. +/* + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. @@ -25,7 +25,7 @@ // The stack functionality looks like a good candidate to put into its own // store. I have not done this because once we have a swap file backing up -// the memory, it would probably not be a good idea to separate this +// the memory, it would probably not be a good idea to separate this // anymore. typedef struct anonymous_store { @@ -50,6 +50,9 @@ { anonymous_store *store = (anonymous_store *)_store; + size -= store->vm.cache->virtual_base; + // anonymous stores don't need to span over their whole source + // if we can overcommit, we don't commit here, but in anonymous_fault() if (store->can_overcommit) { if (store->has_precommitted) @@ -57,26 +60,23 @@ // pre-commit some pages to make a later failure less probable store->has_precommitted = true; - if (size > store->vm.cache->virtual_base + store->precommitted_pages) - size = store->vm.cache->virtual_base + store->precommitted_pages; + uint32 precommitted = store->precommitted_pages * B_PAGE_SIZE; + if (size > precommitted) + size = precommitted; } - size -= store->vm.cache->virtual_base; - // anonymous stores don't need to span over their whole source - // Check to see how much we could commit - we need real memory if (size > store->vm.committed_size) { // try to commit if (vm_try_reserve_memory(size - store->vm.committed_size) != B_OK) return B_NO_MEMORY; - - store->vm.committed_size = size; } else { // we can release some vm_unreserve_memory(store->vm.committed_size - size); } + store->vm.committed_size = size; return B_OK; } @@ -136,10 +136,10 @@ // try to commit additional memory if (vm_try_reserve_memory(B_PAGE_SIZE) != B_OK) return B_NO_MEMORY; + + store->vm.committed_size += B_PAGE_SIZE; } else store->precommitted_pages--; - - store->vm.committed_size += B_PAGE_SIZE; } // This will cause vm_soft_fault() to handle the fault @@ -177,7 +177,7 @@ store->vm.cache = NULL; store->vm.committed_size = 0; store->can_overcommit = canOvercommit; - store->has_precommitted = numPrecommittedPages != 0; + store->has_precommitted = false; store->precommitted_pages = min_c(numPrecommittedPages, 255); store->guarded_size = numGuardPages * B_PAGE_SIZE; From anevilyak at gmail.com Wed Apr 2 14:24:54 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 2 Apr 2008 07:24:54 -0500 Subject: [Haiku-commits] r24742 - haiku/trunk/src/system/kernel/vm In-Reply-To: <200804021219.m32CJT5k018206@sheep.berlios.de> References: <200804021219.m32CJT5k018206@sheep.berlios.de> Message-ID: Hi Axel, On Wed, Apr 2, 2008 at 7:19 AM, axeld at BerliOS wrote: > Author: axeld > Date: 2008-04-02 14:19:28 +0200 (Wed, 02 Apr 2008) > New Revision: 24742 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24742&view=rev > > Modified: > haiku/trunk/src/system/kernel/vm/vm_cache.cpp > haiku/trunk/src/system/kernel/vm/vm_store_anonymous_noswap.cpp > Log: > * Fixed several occasions of bugs with respect to the handling of > overcommitting stores: > - has_precommitted was incorrectly set to true in the constructor > - when a precommitted page was committed, vm_store::committed_size > was still changed. > - unreserving memory did not update vm_store::committed_size. > - when precommitted pages were committed, their page count instead of their > size was reserved. > * All this lead to bug #1970 which should be fixed now. > * Cleanup of vm_cache.cpp, no functional change. > > Nice work! I'll switch back to the sAvailableMemory-based system info tonight and assuming everything looks correct, will update that in the tree. Thanks! Regards, Rene From axeld at mail.berlios.de Wed Apr 2 14:27:26 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 14:27:26 +0200 Subject: [Haiku-commits] r24743 - haiku/trunk/src/system/kernel Message-ID: <200804021227.m32CRQWH018758@sheep.berlios.de> Author: axeld Date: 2008-04-02 14:27:25 +0200 (Wed, 02 Apr 2008) New Revision: 24743 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24743&view=rev Modified: haiku/trunk/src/system/kernel/main.c Log: * Removed old /bin/init startup code - it hasn't been needed for ages anymore. * Some cleanup. Modified: haiku/trunk/src/system/kernel/main.c =================================================================== --- haiku/trunk/src/system/kernel/main.c 2008-04-02 12:19:28 UTC (rev 24742) +++ haiku/trunk/src/system/kernel/main.c 2008-04-02 12:27:25 UTC (rev 24743) @@ -6,7 +6,7 @@ * Distributed under the terms of the NewOS License. */ -/*! This is main - initializes processors and starts init */ +/*! This is main - initializes the kernel and launches the Bootscript */ #include @@ -45,7 +45,7 @@ #include -//#define TRACE_BOOT 1 +//#define TRACE_BOOT #ifdef TRACE_BOOT # define TRACE(x...) dprintf("INIT: " x) #else @@ -70,7 +70,8 @@ // This is something we cannot handle right now - release kernels // should always be able to handle the kernel_args of earlier // released kernels. - debug_early_boot_message("Version mismatch between boot loader and kernel!\n"); + debug_early_boot_message("Version mismatch between boot loader and " + "kernel!\n"); return -1; } @@ -177,7 +178,8 @@ TRACE("exiting kernel startup\n"); kernel_startup = false; - smp_cpu_rendezvous(&sCpuRendezvous2, 0); // release the AP cpus to go enter the scheduler + smp_cpu_rendezvous(&sCpuRendezvous2, 0); + // release the AP cpus to go enter the scheduler TRACE("enabling interrupts and starting scheduler on cpu 0\n"); enable_interrupts(); @@ -190,11 +192,11 @@ resume_thread(thread); } else { // lets make sure we're in sync with the main cpu - // the boot processor has probably been sending us - // tlb sync messages all along the way, but we've + // the boot processor has probably been sending us + // tlb sync messages all along the way, but we've // been ignoring them arch_cpu_global_TLB_invalidate(); - + // this is run for each non boot processor after they've been set loose cpu_init_percpu(&sKernelArgs, currentCPU); smp_per_cpu_init(&sKernelArgs, currentCPU); @@ -219,9 +221,9 @@ main2(void *unused) { (void)(unused); - + TRACE("start of main2: initializing devices\n"); - + boot_splash_init(); TRACE("Init modules\n"); @@ -259,9 +261,6 @@ TRACE("Add preloaded old-style drivers\n"); devfs_add_preloaded_drivers(&sKernelArgs); - // ToDo: device manager starts here, bus_init()/dev_init() won't be necessary anymore, - // but instead, the hardware and drivers are rescanned then. - int_init_post_device_manager(&sKernelArgs); TRACE("Mount boot file system\n"); @@ -275,7 +274,7 @@ TRACE("vm_init_post_modules\n"); boot_splash_set_stage(BOOT_SPLASH_STAGE_6_INIT_VM_MODULES); vm_init_post_modules(&sKernelArgs); - + TRACE("debug_init_post_modules\n"); debug_init_post_modules(&sKernelArgs); @@ -285,24 +284,11 @@ boot_splash_set_stage(BOOT_SPLASH_STAGE_7_RUN_BOOT_SCRIPT); // start the init process { - const char *shellArgs[] = {"/bin/sh", "/boot/beos/system/boot/Bootscript", NULL}; - const char *initArgs[] = {"/bin/init", NULL}; - const char **args; - int32 argc; + const char *args[] = {"/bin/sh", "/boot/beos/system/boot/Bootscript", + NULL}; + int32 argc = 2; thread_id thread; - struct stat st; - if (stat(shellArgs[1], &st) == 0) { - // start Bootscript - args = shellArgs; - argc = 2; - } else { - // ToDo: this is only necessary as long as we have the bootdir mechanism - // start init - args = initArgs; - argc = 1; - } - thread = load_image(argc, args, NULL); if (thread >= B_OK) { resume_thread(thread); From bonefish at mail.berlios.de Wed Apr 2 14:29:59 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 2 Apr 2008 14:29:59 +0200 Subject: [Haiku-commits] r24744 - haiku/trunk/src/tools/fs_shell Message-ID: <200804021229.m32CTxXM019213@sheep.berlios.de> Author: bonefish Date: 2008-04-02 14:29:59 +0200 (Wed, 02 Apr 2008) New Revision: 24744 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24744&view=rev Modified: haiku/trunk/src/tools/fs_shell/fssh.cpp Log: Use a reasonable umask when creating directories. Modified: haiku/trunk/src/tools/fs_shell/fssh.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/fssh.cpp 2008-04-02 12:27:25 UTC (rev 24743) +++ haiku/trunk/src/tools/fs_shell/fssh.cpp 2008-04-02 12:29:59 UTC (rev 24744) @@ -48,7 +48,9 @@ static int sArgc; static const char* const* sArgv; +static mode_t sUmask = 0022; + static fssh_status_t init_kernel() { @@ -687,7 +689,8 @@ } // make the directory - error = _kern_create_dir(-1, path, FSSH_S_IRWXU); + error = _kern_create_dir(-1, + path, (FSSH_S_IRWXU | FSSH_S_IRWXG | FSSH_S_IRWXO) & ~sUmask); if (error != FSSH_B_OK) { fprintf(stderr, "Error: Failed to make directory \"%s\": %s\n", path, fssh_strerror(error)); From axeld at mail.berlios.de Wed Apr 2 14:30:08 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 14:30:08 +0200 Subject: [Haiku-commits] r24745 - in haiku/trunk: headers/private/kernel src/system/kernel/vm Message-ID: <200804021230.m32CU8UV019301@sheep.berlios.de> Author: axeld Date: 2008-04-02 14:30:06 +0200 (Wed, 02 Apr 2008) New Revision: 24745 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24745&view=rev Modified: haiku/trunk/headers/private/kernel/vm.h haiku/trunk/src/system/kernel/vm/vm.cpp haiku/trunk/src/system/kernel/vm/vm_page.cpp Log: * Renamed vm_get_available_memory() to vm_available_memory() to fit better into our usual naming scheme. * Minor cleanup. Modified: haiku/trunk/headers/private/kernel/vm.h =================================================================== --- haiku/trunk/headers/private/kernel/vm.h 2008-04-02 12:29:59 UTC (rev 24744) +++ haiku/trunk/headers/private/kernel/vm.h 2008-04-02 12:30:06 UTC (rev 24745) @@ -98,28 +98,28 @@ void forbid_page_faults(void); // private kernel only extension (should be moved somewhere else): -area_id create_area_etc(struct team *team, const char *name, void **address, +area_id create_area_etc(struct team *team, const char *name, void **address, uint32 addressSpec, uint32 size, uint32 lock, uint32 protection); status_t delete_area_etc(struct team *team, area_id area); status_t vm_unreserve_address_range(team_id team, void *address, addr_t size); -status_t vm_reserve_address_range(team_id team, void **_address, +status_t vm_reserve_address_range(team_id team, void **_address, uint32 addressSpec, addr_t size, uint32 flags); -area_id vm_create_anonymous_area(team_id team, const char *name, void **address, +area_id vm_create_anonymous_area(team_id team, const char *name, void **address, uint32 addressSpec, addr_t size, uint32 wiring, uint32 protection); -area_id vm_map_physical_memory(team_id team, const char *name, void **address, +area_id vm_map_physical_memory(team_id team, const char *name, void **address, uint32 addressSpec, addr_t size, uint32 protection, addr_t phys_addr); -area_id vm_map_file(team_id aid, const char *name, void **address, - uint32 addressSpec, addr_t size, uint32 protection, uint32 mapping, +area_id vm_map_file(team_id aid, const char *name, void **address, + uint32 addressSpec, addr_t size, uint32 protection, uint32 mapping, const char *path, off_t offset); struct vm_cache *vm_area_get_locked_cache(struct vm_area *area); void vm_area_put_locked_cache(struct vm_cache *cache); -area_id vm_create_null_area(team_id team, const char *name, void **address, +area_id vm_create_null_area(team_id team, const char *name, void **address, uint32 addressSpec, addr_t size); -area_id vm_copy_area(team_id team, const char *name, void **_address, +area_id vm_copy_area(team_id team, const char *name, void **_address, uint32 addressSpec, uint32 protection, area_id sourceID); -area_id vm_clone_area(team_id team, const char *name, void **address, - uint32 addressSpec, uint32 protection, uint32 mapping, +area_id vm_clone_area(team_id team, const char *name, void **address, + uint32 addressSpec, uint32 protection, uint32 mapping, area_id sourceArea); status_t vm_delete_area(team_id teamID, area_id areaID); status_t vm_create_vnode_cache(struct vnode *vnode, struct vm_cache **_cache); @@ -138,7 +138,7 @@ status_t vm_get_physical_page(addr_t paddr, addr_t *vaddr, uint32 flags); status_t vm_put_physical_page(addr_t vaddr); -off_t vm_get_available_memory(void); +off_t vm_available_memory(void); // user syscalls area_id _user_create_area(const char *name, void **address, uint32 addressSpec, @@ -151,10 +151,10 @@ status_t _user_get_area_info(area_id area, area_info *info); status_t _user_get_next_area_info(team_id team, int32 *cookie, area_info *info); status_t _user_resize_area(area_id area, size_t newSize); -area_id _user_transfer_area(area_id area, void **_address, uint32 addressSpec, +area_id _user_transfer_area(area_id area, void **_address, uint32 addressSpec, team_id target); status_t _user_set_area_protection(area_id area, uint32 newProtection); -area_id _user_clone_area(const char *name, void **_address, uint32 addressSpec, +area_id _user_clone_area(const char *name, void **_address, uint32 addressSpec, uint32 protection, area_id sourceArea); status_t _user_reserve_heap_address_range(addr_t* userAddress, uint32 addressSpec, addr_t size); Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2008-04-02 12:29:59 UTC (rev 24744) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2008-04-02 12:30:06 UTC (rev 24745) @@ -4394,7 +4394,7 @@ off_t -vm_get_available_memory(void) +vm_available_memory(void) { return sAvailableMemory; } Modified: haiku/trunk/src/system/kernel/vm/vm_page.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-04-02 12:29:59 UTC (rev 24744) +++ haiku/trunk/src/system/kernel/vm/vm_page.cpp 2008-04-02 12:30:06 UTC (rev 24745) @@ -1693,7 +1693,7 @@ vm_page_allocate_pages(int pageState, vm_page **pages, uint32 numPages) { uint32 i; - + for (i = 0; i < numPages; i++) { pages[i] = vm_page_allocate_page(pageState, false); if (pages[i] == NULL) { @@ -1874,7 +1874,7 @@ size_t vm_page_num_available_pages(void) { - return vm_get_available_memory() / B_PAGE_SIZE; + return vm_available_memory() / B_PAGE_SIZE; } From anevilyak at gmail.com Wed Apr 2 14:33:48 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 2 Apr 2008 07:33:48 -0500 Subject: [Haiku-commits] r24742 - haiku/trunk/src/system/kernel/vm In-Reply-To: References: <200804021219.m32CJT5k018206@sheep.berlios.de> Message-ID: One more thing I forgot: does the VM currently track page faults? I noticed a TODO in system_info.cpp mentioning adding page fault reporting. Regards, Rene From axeld at pinc-software.de Wed Apr 2 14:35:21 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 02 Apr 2008 14:35:21 +0200 CEST Subject: [Haiku-commits] r24742 - haiku/trunk/src/system/kernel/vm In-Reply-To: Message-ID: <17130579543-BeMail@zon> "Rene Gollent" wrote: > Nice work! I'll switch back to the sAvailableMemory-based system info > tonight and assuming everything looks correct, will update that in > the > tree. Thanks! I forgot you changed that, too! I'll update it now, I have it already open in my editor :-) Bye, Axel. From axeld at mail.berlios.de Wed Apr 2 14:47:14 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 14:47:14 +0200 Subject: [Haiku-commits] r24746 - in haiku/trunk/src: bin system/kernel Message-ID: <200804021247.m32ClE68021092@sheep.berlios.de> Author: axeld Date: 2008-04-02 14:47:08 +0200 (Wed, 02 Apr 2008) New Revision: 24746 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24746&view=rev Modified: haiku/trunk/src/bin/sysinfo.c haiku/trunk/src/system/kernel/system_info.cpp Log: * Reenabled used page reporting based on vm_available_memory(). * Prettyfied memory info in the sysinfo app. * Minor cleanup. Modified: haiku/trunk/src/bin/sysinfo.c =================================================================== --- haiku/trunk/src/bin/sysinfo.c 2008-04-02 12:30:06 UTC (rev 24745) +++ haiku/trunk/src/bin/sysinfo.c 2008-04-02 12:47:08 UTC (rev 24746) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2005, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. * Copyright (c) 2002, Carlos Hasan, for Haiku. * * Distributed under the terms of the MIT license. @@ -307,7 +307,7 @@ "PAT", "PSE36", "PSN", "CFLUSH", NULL, "DS", "ACPI", "MMX", "FXSTR", "SSE", "SSE2", "SS", - "HTT", "TM", NULL, "PBE", + "HTT", "TM", NULL, "PBE", }; int32 found = 0; int32 i; @@ -517,11 +517,12 @@ static void dump_mem(system_info *info) { - printf("%10lu bytes free (used/cached/max %10lu / %10lu / %10lu)\n", + printf("%10lu bytes free (used/max %10lu / %10lu)\n", B_PAGE_SIZE * (uint32)(info->max_pages - info->used_pages), B_PAGE_SIZE * (uint32)info->used_pages, - B_PAGE_SIZE * (uint32)info->cached_pages, B_PAGE_SIZE * (uint32)info->max_pages); + printf(" (cached %10lu)\n", + B_PAGE_SIZE * (uint32)info->cached_pages); } Modified: haiku/trunk/src/system/kernel/system_info.cpp =================================================================== --- haiku/trunk/src/system/kernel/system_info.cpp 2008-04-02 12:30:06 UTC (rev 24745) +++ haiku/trunk/src/system/kernel/system_info.cpp 2008-04-02 12:47:08 UTC (rev 24746) @@ -77,15 +77,12 @@ for (int32 i = 0; i < info->cpu_count; i++) info->cpu_infos[i].active_time = cpu_get_active_time(i); - // ToDo: Add page_faults + // TODO: Add page_faults info->max_pages = vm_page_num_pages(); - info->used_pages = info->max_pages - vm_page_num_free_pages(); - -/* TODO: return to using these once sAvailableMemory yields correct values. - info->used_pages = vm_page_num_pages() - vm_page_num_available_pages(); - info->cached_pages = vm_page_num_pages() - vm_page_num_free_pages() + info->used_pages = info->max_pages - vm_page_num_available_pages(); + info->cached_pages = info->max_pages - vm_page_num_free_pages() - info->used_pages; -*/ + info->used_threads = thread_used_threads(); info->max_threads = thread_max_threads(); info->used_teams = team_used_teams(); @@ -105,7 +102,7 @@ } -status_t +status_t system_info_init(struct kernel_args *args) { add_debugger_command("info", &dump_info, "System info"); From axeld at pinc-software.de Wed Apr 2 14:51:44 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 02 Apr 2008 14:51:44 +0200 CEST Subject: [Haiku-commits] r24741 - in haiku/trunk/src/servers/app: . drawing In-Reply-To: <200804021112.m32BCfCL003027@sheep.berlios.de> Message-ID: <18113538590-BeMail@zon> stippi at BerliOS wrote: > Log: > HWInterface::Cursor() and therefor Desktop::Cursor() accessed the > current cursor without locking, and did not add a reference while > using the cursor. I have tried to solve both problems by introducing > a simple ServerCursorReference class, which makes sure that the > reference count is properly maintained. There are only two places > where this code was even used, from within ServerApp and when taking > screenshots. Axel, you mentioned in #837 that the code is unsafe, is > this what you meant? This hopefully fixes #837, but it is very hard > to reproduce in the first place, I will close the ticket, but it > should > just be reopened if ever encountered again. I was rather referring to the TODO comment in CursorManager::RemoveCursor(), but your change might actually have a larger influence on that. Whatever happened to the test app you wanted to write for that? :-) Bye, Axel. From axeld at pinc-software.de Wed Apr 2 14:54:46 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 02 Apr 2008 14:54:46 +0200 CEST Subject: [Haiku-commits] r24742 - haiku/trunk/src/system/kernel/vm In-Reply-To: Message-ID: <18295648082-BeMail@zon> "Rene Gollent" wrote: > One more thing I forgot: does the VM currently track page faults? I > noticed a TODO in system_info.cpp mentioning adding page fault > reporting. It currently doesn't do this. I'm just unsure if we should really add this to system_info, or better introduce a VM statistic structure (and syscall to retrieve it) that has much more detailed information. Bye, Axel. From zooey at hirschkaefer.de Wed Apr 2 14:35:36 2008 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Wed, 02 Apr 2008 14:35:36 +0200 Subject: [Haiku-commits] r24741 - in haiku/trunk/src/servers/app: . drawing In-Reply-To: <200804021112.m32BCfCL003027@sheep.berlios.de> References: <200804021112.m32BCfCL003027@sheep.berlios.de> Message-ID: <47F37D98.3050302@hirschkaefer.de> Hi Stippi, stippi at BerliOS schrieb: > + void SetCursor(ServerCursor* cursor) > + { > + if (fCursor == cursor) > + return; > + if (fCursor) > + fCursor->Release(); Is it ever possible that a ServerCursorReference is shared between two or more threads? If so, I think there's a tiny race condition precisely at this point, as fCursor is released now (i.e. it may be dead already) and some other thread may invoke Cursor() and thus access fCursor. > + fCursor = cursor; > + if (fCursor) > + fCursor->Acquire(); > + } I'd suggest to use a temp, like this: void SetCursor(ServerCursor* cursor) { if (fCursor == cursor) return; if (cursor) cursor->Acquire(); ServerCursor* oldCursor = fCursor; fCursor = cursor; if (oldCursor) oldCursor->Release(); } or maybe even this (making use of c++-swap, dunno if that works for pointers, though): void SetCursor(ServerCursor* cursor) { if (fCursor == cursor) return; if (cursor) cursor->Acquire(); swap(fCursor, cursor); if (cursor) cursor->Release(); } What do you think? cheers, Oliver From anevilyak at gmail.com Wed Apr 2 14:59:21 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 2 Apr 2008 07:59:21 -0500 Subject: [Haiku-commits] r24742 - haiku/trunk/src/system/kernel/vm In-Reply-To: <18295648082-BeMail@zon> References: <18295648082-BeMail@zon> Message-ID: > It currently doesn't do this. > I'm just unsure if we should really add this to system_info, or better > introduce a VM statistic structure (and syscall to retrieve it) that > has much more detailed information. > +1 to that idea from me :) Especially if you want to be able to report a lot of different VM stats. Regards, Rene From axeld at mail.berlios.de Wed Apr 2 15:04:09 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 15:04:09 +0200 Subject: [Haiku-commits] r24747 - haiku/trunk/src/servers/app Message-ID: <200804021304.m32D49RO026961@sheep.berlios.de> Author: axeld Date: 2008-04-02 15:04:08 +0200 (Wed, 02 Apr 2008) New Revision: 24747 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24747&view=rev Modified: haiku/trunk/src/servers/app/FontManager.cpp Log: * AttachUser() now creates the user directory if it's not there yet. Added a TODO comment that find_directory() won't return the correct directory in a multi-user environment. This fixes bug #2003. * Some cleanup. Modified: haiku/trunk/src/servers/app/FontManager.cpp =================================================================== --- haiku/trunk/src/servers/app/FontManager.cpp 2008-04-02 12:47:08 UTC (rev 24746) +++ haiku/trunk/src/servers/app/FontManager.cpp 2008-04-02 13:04:08 UTC (rev 24747) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -7,7 +7,7 @@ * Axel D?rfler, axeld at pinc-software.de */ -/** Manages font families and styles */ +/*! Manages font families and styles */ #include "FontFamily.h" @@ -369,8 +369,7 @@ } -/*! - \brief Removes the style from the font directory. +/*! \brief Removes the style from the font directory. It doesn't necessary delete the font style, if it's still in use, though. @@ -429,8 +428,7 @@ } -/*! - \brief Sets the fonts that will be used when you create an empty +/*! \brief Sets the fonts that will be used when you create an empty ServerFont without specifying a style, as well as the default Desktop fonts if there are no settings available. */ @@ -444,21 +442,24 @@ if (style == NULL) return B_ERROR; - fDefaultPlainFont = new (std::nothrow) ServerFont(*style, DEFAULT_PLAIN_FONT_SIZE); + fDefaultPlainFont = new (std::nothrow) ServerFont(*style, + DEFAULT_PLAIN_FONT_SIZE); if (fDefaultPlainFont == NULL) return B_NO_MEMORY; style = _GetDefaultStyle(DEFAULT_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE, FALLBACK_BOLD_FONT_FAMILY, DEFAULT_BOLD_FONT_STYLE, B_BOLD_FACE); - fDefaultBoldFont = new (std::nothrow) ServerFont(*style, DEFAULT_BOLD_FONT_SIZE); + fDefaultBoldFont = new (std::nothrow) ServerFont(*style, + DEFAULT_BOLD_FONT_SIZE); if (fDefaultBoldFont == NULL) return B_NO_MEMORY; style = _GetDefaultStyle(DEFAULT_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE, FALLBACK_FIXED_FONT_FAMILY, DEFAULT_FIXED_FONT_STYLE, B_REGULAR_FACE); - fDefaultFixedFont = new (std::nothrow) ServerFont(*style, DEFAULT_FIXED_FONT_SIZE); + fDefaultFixedFont = new (std::nothrow) ServerFont(*style, + DEFAULT_FIXED_FONT_SIZE); if (fDefaultFixedFont == NULL) return B_NO_MEMORY; @@ -510,8 +511,7 @@ } -/*! - \brief Adds the FontFamily/FontStyle that is represented by this path. +/*! \brief Adds the FontFamily/FontStyle that is represented by this path. */ status_t FontManager::_AddFont(font_directory& directory, BEntry& entry) @@ -645,7 +645,8 @@ if (status != B_OK) { // we cannot watch this directory - while this is unfortunate, // it's not a critical error - printf("could not watch directory %ld:%Ld\n", nodeRef.device, nodeRef.node); + printf("could not watch directory %ld:%Ld\n", nodeRef.device, + nodeRef.node); // TODO: should go into syslog() } else { BPath path(&entry); @@ -662,8 +663,7 @@ } -/*! - \brief Creates all unknown font_directories of the specified path - but +/*! \brief Creates all unknown font_directories of the specified path - but only if one of its parent directories is already known. This method is used to create the font_directories for font_mappings. @@ -715,8 +715,7 @@ } -/*! - \brief Scan a folder for all valid fonts +/*! \brief Scan a folder for all valid fonts \param directoryPath Path of the folder to scan. */ status_t @@ -766,8 +765,7 @@ } -/*! - \brief Finds and returns the first valid charmap in a font +/*! \brief Finds and returns the first valid charmap in a font \param face Font handle obtained from FT_Load_Face() \return An FT_CharMap or NULL if unsuccessful @@ -825,8 +823,7 @@ } -/*! - \brief Counts the number of font families available +/*! \brief Counts the number of font families available \return The number of unique font families currently available */ int32 @@ -838,8 +835,7 @@ } -/*! - \brief Counts the number of styles available in a font family +/*! \brief Counts the number of styles available in a font family \param family Name of the font family to scan \return The number of font styles currently available for the font family */ @@ -875,8 +871,7 @@ } -/*! - \brief Locates a FontFamily object by name +/*! \brief Locates a FontFamily object by name \param name The family to find \return Pointer to the specified family or NULL if not found. */ @@ -930,8 +925,8 @@ } -/*! - \brief Retrieves the FontStyle object that comes closest to the one specified +/*! \brief Retrieves the FontStyle object that comes closest to the one + specified. \param family The font's family or NULL in which case \a familyID is used \param style The font's style or NULL in which case \a styleID is used @@ -978,8 +973,7 @@ } -/*! - \brief Retrieves the FontStyle object +/*! \brief Retrieves the FontStyle object \param family ID for the font's family \param style ID of the font's style \return The FontStyle having those attributes or NULL if not available @@ -992,8 +986,7 @@ } -/*! - \brief If you don't find your preferred font style, but are anxious +/*! \brief If you don't find your preferred font style, but are anxious to have one fitting your needs, you may want to use this method. */ FontStyle* @@ -1012,8 +1005,7 @@ } -/*! - \brief This call is used by the FontStyle class - and the FontStyle class +/*! \brief This call is used by the FontStyle class - and the FontStyle class only - to remove itself from the font manager. At this point, the style is already no longer available to the user. */ @@ -1061,8 +1053,9 @@ BAutolock locker(this); #if !TEST_MODE + // TODO: actually, find_directory() cannot know which user ID we want here BPath path; - if (find_directory(B_USER_FONTS_DIRECTORY, &path) != B_OK) + if (find_directory(B_USER_FONTS_DIRECTORY, &path, true) != B_OK) return; _AddPath(path.Path()); From bonefish at mail.berlios.de Wed Apr 2 15:39:44 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 2 Apr 2008 15:39:44 +0200 Subject: [Haiku-commits] r24748 - haiku/trunk/headers/private/libroot Message-ID: <200804021339.m32DdiGr030146@sheep.berlios.de> Author: bonefish Date: 2008-04-02 15:39:43 +0200 (Wed, 02 Apr 2008) New Revision: 24748 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24748&view=rev Added: haiku/trunk/headers/private/libroot/libroot_lock.h Log: Copied the benaphore implementation from the kernel for use in libroot. Would be nice to actually share those. Added: haiku/trunk/headers/private/libroot/libroot_lock.h =================================================================== --- haiku/trunk/headers/private/libroot/libroot_lock.h 2008-04-02 13:04:08 UTC (rev 24747) +++ haiku/trunk/headers/private/libroot/libroot_lock.h 2008-04-02 13:39:43 UTC (rev 24748) @@ -0,0 +1,82 @@ +/* + * Copyright 2002-2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + * + * Copyright 2001-2002, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ +#ifndef _LIBROOT_LOCK_H +#define _LIBROOT_LOCK_H + +#include + + +// TODO: Copied from the kernel private lock.h/lock.c. We should somehow make +// that code reusable. + + +namespace BPrivate { + + +typedef struct benaphore { + sem_id sem; + int32 count; +} benaphore; + + +static inline status_t +benaphore_init(benaphore *ben, const char *name) +{ + if (ben == NULL || name == NULL) + return B_BAD_VALUE; + + ben->count = 1; + ben->sem = create_sem(0, name); + if (ben->sem >= B_OK) + return B_OK; + + return ben->sem; +} + + +static inline status_t +benaphore_lock_etc(benaphore *ben, uint32 flags, bigtime_t timeout) +{ + if (atomic_add(&ben->count, -1) <= 0) + return acquire_sem_etc(ben->sem, 1, flags, timeout); + + return B_OK; +} + + +static inline status_t +benaphore_lock(benaphore *ben) +{ + if (atomic_add(&ben->count, -1) <= 0) + return acquire_sem(ben->sem); + + return B_OK; +} + + +static inline status_t +benaphore_unlock(benaphore *ben) +{ + if (atomic_add(&ben->count, 1) < 0) + return release_sem(ben->sem); + + return B_OK; +} + + +} // namespace BPrivate + + +using BPrivate::benaphore; +using BPrivate::benaphore_init; +using BPrivate::benaphore_lock_etc; +using BPrivate::benaphore_lock; +using BPrivate::benaphore_unlock; + + +#endif // _LIBROOT_LOCK_H From axeld at mail.berlios.de Wed Apr 2 15:51:35 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 15:51:35 +0200 Subject: [Haiku-commits] r24749 - haiku/trunk/src/system/kernel/cache Message-ID: <200804021351.m32DpZ9G031130@sheep.berlios.de> Author: axeld Date: 2008-04-02 15:51:34 +0200 (Wed, 02 Apr 2008) New Revision: 24749 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24749&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * A notification can cause a transaction to be deleted - in this case, the block_writer() as well as notify_transaction_listeners() must update their data or quit. This fixes newly introduced bug #2008. * Minor cleanup. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-02 13:39:43 UTC (rev 24748) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-02 13:51:34 UTC (rev 24749) @@ -95,6 +95,7 @@ int32 next_transaction_id; cache_transaction *last_transaction; hash_table *transaction_hash; + int32 transaction_changed; object_cache *buffer_cache; block_list unused_blocks; @@ -311,19 +312,44 @@ } +static void +delete_transaction(block_cache *cache, cache_transaction *transaction) +{ + if (cache->last_transaction == transaction) + cache->last_transaction = NULL; + + delete transaction; + cache->transaction_changed++; +} + + +static cache_transaction * +lookup_transaction(block_cache *cache, int32 id) +{ + return (cache_transaction *)hash_lookup(cache->transaction_hash, &id); +} + + /*! Notifies all listeners of this transaction, and removes them afterwards if requested via \a removeListener. */ static void -notify_transaction_listeners(cache_transaction *transaction, int32 event, - bool removeListener) +notify_transaction_listeners(block_cache *cache, cache_transaction *transaction, + int32 event, bool removeListener) { + int32 id = transaction->id; + HookList::Iterator iterator = transaction->listeners.GetIterator(); while (iterator.HasNext()) { cache_hook *hook = iterator.Next(); hook->hook(transaction->id, event, hook->data); + if (lookup_transaction(cache, id) != transaction) { + // transaction has been removed by the hook! + return; + } + if (removeListener) { iterator.Remove(); delete hook; @@ -332,23 +358,6 @@ } -static void -delete_transaction(block_cache *cache, cache_transaction *transaction) -{ - if (cache->last_transaction == transaction) - cache->last_transaction = NULL; - - 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 @@ -407,6 +416,7 @@ next_transaction_id(1), last_transaction(NULL), transaction_hash(NULL), + transaction_changed(0), num_dirty_blocks(0), read_only(readOnly) { @@ -932,7 +942,8 @@ previous->notification_hook(previous->id, TRANSACTION_WRITTEN, previous->notification_data); } - notify_transaction_listeners(previous, TRANSACTION_WRITTEN, false); + notify_transaction_listeners(cache, previous, TRANSACTION_WRITTEN, + false); if (deleteTransaction) { hash_remove(cache->transaction_hash, previous); @@ -1238,9 +1249,17 @@ if (transaction->open) { if (system_time() > transaction->last_used + kTransactionIdleTime) { - // transaction is open but idle - notify_transaction_listeners(transaction, + int32 change = cache->transaction_changed; + + // Transaction is open but idle + notify_transaction_listeners(cache, transaction, TRANSACTION_IDLE, false); + + if (change != cache->transaction_changed) { + // Transactions were removed by the above + // notification + hash_rewind(cache->transaction_hash, &iterator); + } } continue; } @@ -1416,7 +1435,7 @@ transaction->notification_hook = hook; transaction->notification_data = data; - notify_transaction_listeners(transaction, TRANSACTION_ENDED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); // iterate through all blocks and free the unchanged original contents @@ -1468,7 +1487,7 @@ } T(Abort(cache, transaction)); - notify_transaction_listeners(transaction, TRANSACTION_ABORTED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ABORTED, true); // iterate through all blocks and restore their original contents @@ -1531,7 +1550,7 @@ transaction->notification_hook = hook; transaction->notification_data = data; - notify_transaction_listeners(transaction, TRANSACTION_ENDED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); // iterate through all blocks and free the unchanged original contents @@ -1606,7 +1625,7 @@ return B_BAD_VALUE; T(Abort(cache, transaction)); - notify_transaction_listeners(transaction, TRANSACTION_ABORTED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ABORTED, true); // revert all changes back to the version of the parent @@ -1654,7 +1673,7 @@ return B_BAD_VALUE; } - notify_transaction_listeners(transaction, TRANSACTION_ENDED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); // move all changed blocks up to the parent @@ -1686,8 +1705,8 @@ /*! Adds a transaction listener that gets notified when the transaction - is ended or aborted. - The listener gets automatically removed in this case. + is ended, aborted, written, or idle. + The listener gets automatically removed when the transaction ends. */ status_t cache_add_transaction_listener(void *_cache, int32 id, From bonefish at mail.berlios.de Wed Apr 2 16:02:54 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 2 Apr 2008 16:02:54 +0200 Subject: [Haiku-commits] r24750 - in haiku/trunk: build/jam headers/posix headers/private/libroot src/bin/coreutils/lib src/kits/network/dns src/system/libroot/posix src/system/libroot/posix/unistd Message-ID: <200804021402.m32E2s1w001170@sheep.berlios.de> Author: bonefish Date: 2008-04-02 16:02:52 +0200 (Wed, 02 Apr 2008) New Revision: 24750 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24750&view=rev Added: haiku/trunk/src/system/libroot/posix/grp.cpp haiku/trunk/src/system/libroot/posix/pwd.cpp haiku/trunk/src/system/libroot/posix/user_group_common.cpp haiku/trunk/src/system/libroot/posix/user_group_common.h Removed: haiku/trunk/src/system/libroot/posix/grp.c haiku/trunk/src/system/libroot/posix/pwd.c Modified: haiku/trunk/build/jam/BuildSetup haiku/trunk/build/jam/HaikuImage haiku/trunk/build/jam/ImageRules haiku/trunk/build/jam/UserBuildConfig.ReadMe haiku/trunk/headers/posix/grp.h haiku/trunk/headers/posix/pwd.h haiku/trunk/headers/posix/unistd.h haiku/trunk/headers/private/libroot/libroot_private.h haiku/trunk/src/bin/coreutils/lib/config.h haiku/trunk/src/kits/network/dns/config.h haiku/trunk/src/system/libroot/posix/Jamfile haiku/trunk/src/system/libroot/posix/unistd/conf.c haiku/trunk/src/system/libroot/posix/unistd/fork.c haiku/trunk/src/system/libroot/posix/unistd/usergroup.cpp Log: * Replaced the dummy implementations of the and functions by ones reading /etc/{group,passwd}. * Added quasi-standard getpwent_r() and getgrent_r(). * Added _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX sysconf() constants. * Moved initgroups() and getgrouplist() definition to grp.cpp. They use the same backend as the functions. * Set the permissions of files created by the build system to what they should be on the image (executables: 755, others: 644). Otherwise only root could do anything under Haiku. * Added build system variables HAIKU_ROOT_USER_NAME and HAIKU_ROOT_USER_REAL_NAME to customize name and real name of Haiku's root user. * Added build system rules AddUserToHaikuImage and AddGroupToHaikuImage for adding additional users and groups (by default only root user and group and a "users" group are created). * Adjusted BIND port and coreutils config.h files according to what features have become available. * Fixed HAIKU_DOCUMENTATION_OBJECT_DIR definition. Untested, but it used a wrong variable name before. Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/build/jam/BuildSetup 2008-04-02 14:02:52 UTC (rev 24750) @@ -871,10 +871,16 @@ KEEPOBJS = true ; +# Set permissions to how they should be on the image. +EXEMODE = 755 ; +FILEMODE = 644 ; +SHELLMODE = 755 ; + + # output directories # TODO: Review this. HAIKU_DOCUMENTATION_DIR ?= [ FDirName $(HAIKU_OUTPUT_DIR) documentation ] ; -HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_DIR) +HAIKU_DOCUMENTATION_OBJECT_DIR ?= [ FDirName $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) documentation ] ; # TODO: Rethink test stuff. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/build/jam/HaikuImage 2008-04-02 14:02:52 UTC (rev 24750) @@ -419,7 +419,7 @@ AddDirectoryToHaikuImage beos etc synth ; AddDirectoryToHaikuImage beos system add-ons input_server methods ; -#optional +# optional AddFilesToHaikuImage optional beos system add-ons input_server methods : canna ; # printers @@ -481,6 +481,16 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) OptionalPackages ] ; +#pragma mark - User/Group Setup + + +# add the root user and the root and users groups +AddUserToHaikuImage $(HAIKU_ROOT_USER_NAME:E=baron) : 0 : 0 : /boot/home + : /bin/bash : $(HAIKU_ROOT_USER_REAL_NAME:E="Root User") ; +AddGroupToHaikuImage root : 0 : ; +AddGroupToHaikuImage users : 100 : ; + + #pragma mark - Build The Image Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/build/jam/ImageRules 2008-04-02 14:02:52 UTC (rev 24750) @@ -676,7 +676,54 @@ UnzipArchiveToHaikuImage $(dirTokens) : $(zipFile) ; } +rule AddEntryToHaikuImageUserGroupFile file : entry +{ + local allEntries = [ on $(file) return $(HAIKU_IMAGE_USER_GROUP_ENTRIES) ] ; + if $(allEntries) { + allEntries = $(allEntries)|$(entry) ; + } else { + allEntries = $(entry) ; + + Always $(file) ; + MakeLocate $(file) : $(HAIKU_COMMON_PLATFORM_OBJECT_DIR) ; + BuildHaikuImageUserGroupFile $(file) ; + AddFilesToHaikuImage beos etc : $(file) ; + } + + HAIKU_IMAGE_USER_GROUP_ENTRIES on $(file) = $(allEntries) ; +} + +actions BuildHaikuImageUserGroupFile +{ + echo "$(HAIKU_IMAGE_USER_GROUP_ENTRIES)" | tr '|' '\n' > $(1) +} + +rule AddUserToHaikuImage user : uid : gid : home : shell : realName +{ + if ! $(user) || ! $(uid) || ! $(gid) || ! $(home) { + Exit "Invalid haiku user specification passed to AddUserToHaikuImage." ; + } + + local entry + = $(user):x:$(uid):$(gid):$(realName:E=$(user)):$(home):$(shell:E="") ; + + AddEntryToHaikuImageUserGroupFile passwd : $(entry) ; +} + +rule AddGroupToHaikuImage group : gid : members +{ + if ! $(group) || ! $(gid) { + Exit "Invalid haiku group specification passed to" + "AddGroupToHaikuImage." ; + } + + local entry = $(group):x:$(gid):$(members:J=,:E) ; + + AddEntryToHaikuImageUserGroupFile group : $(entry) ; +} + + rule CreateHaikuImageMakeDirectoriesScript script { CreateContainerMakeDirectoriesScript $(HAIKU_IMAGE_CONTAINER_NAME) Modified: haiku/trunk/build/jam/UserBuildConfig.ReadMe =================================================================== --- haiku/trunk/build/jam/UserBuildConfig.ReadMe 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/build/jam/UserBuildConfig.ReadMe 2008-04-02 14:02:52 UTC (rev 24750) @@ -131,7 +131,23 @@ HAIKU_IMAGE_EARLY_USER_SCRIPTS = $(HAIKU_TOP)/../early-image-script.sh ; HAIKU_IMAGE_LATE_USER_SCRIPTS = $(HAIKU_TOP)/../late-image-script.sh ; +# Set name and real name of the root user. Defaults to "baron" and "Root User". +HAIKU_ROOT_USER_NAME = bond ; +HAIKU_ROOT_USER_REAL_NAME = "James Bond" ; +# Add user "walter" with user ID 1000 and group ID 100 (note, that a group with +# that ID should exist -- 100 already exists and is the "users" group), home +# directory "/boot/home", shell "/bin/bash", and real name "Just Walter" to the +# image. +AddUserToHaikuImage walter : 1000 : 100 : /boot/home : /bin/bash + : "Just Walter" ; + +# Add group "party" with group ID 101 and members "baron" and "walter" to the +# image. +AddGroupToHaikuImage party : 101 : baron walter ; + + + # Creating Sourceable Shell Scripts # If you use shell scripts (e.g. for testing) that need to access targets or Modified: haiku/trunk/headers/posix/grp.h =================================================================== --- haiku/trunk/headers/posix/grp.h 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/headers/posix/grp.h 2008-04-02 14:02:52 UTC (rev 24750) @@ -29,6 +29,8 @@ size_t bufferSize, struct group **_result); extern struct group *getgrent(void); +extern int getgrent_r(struct group* group, char* buffer, size_t bufferSize, + struct group** _result); extern void setgrent(void); extern void endgrent(void); Modified: haiku/trunk/headers/posix/pwd.h =================================================================== --- haiku/trunk/headers/posix/pwd.h 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/headers/posix/pwd.h 2008-04-02 14:02:52 UTC (rev 24750) @@ -22,10 +22,12 @@ /* traverse the user password database */ extern struct passwd *getpwent(void); +extern int getpwent_r(struct passwd* pwbuf, char* buf, size_t buflen, + struct passwd** pwbufp); extern void setpwent(void); extern void endpwent(void); -/*search the user password database */ +/* search the user password database */ extern struct passwd *getpwnam(const char *name); extern int getpwnam_r(const char *name, struct passwd *passwd, char *buffer, size_t bufferSize, struct passwd **result); Modified: haiku/trunk/headers/posix/unistd.h =================================================================== --- haiku/trunk/headers/posix/unistd.h 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/headers/posix/unistd.h 2008-04-02 14:02:52 UTC (rev 24750) @@ -57,6 +57,8 @@ #define _SC_STREAM_MAX 22 #define _SC_TZNAME_MAX 23 #define _SC_VERSION 24 +#define _SC_GETGR_R_SIZE_MAX 25 +#define _SC_GETPW_R_SIZE_MAX 26 /* lseek() constants */ #ifndef SEEK_SET Modified: haiku/trunk/headers/private/libroot/libroot_private.h =================================================================== --- haiku/trunk/headers/private/libroot/libroot_private.h 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/headers/private/libroot/libroot_private.h 2008-04-02 14:02:52 UTC (rev 24750) @@ -10,6 +10,30 @@ #include +#define MAX_PASSWD_NAME_LEN (32) +#define MAX_PASSWD_PASSWORD_LEN (32) +#define MAX_PASSWD_REAL_NAME_LEN (128) +#define MAX_PASSWD_HOME_DIR_LEN (B_PATH_NAME_LENGTH) +#define MAX_PASSWD_SHELL_LEN (B_PATH_NAME_LENGTH) + +#define MAX_PASSWD_BUFFER_SIZE ( \ + MAX_PASSWD_NAME_LEN \ + + MAX_PASSWD_PASSWORD_LEN \ + + MAX_PASSWD_REAL_NAME_LEN \ + + MAX_PASSWD_HOME_DIR_LEN \ + + MAX_PASSWD_SHELL_LEN) + +#define MAX_GROUP_NAME_LEN (32) +#define MAX_GROUP_PASSWORD_LEN (32) +#define MAX_GROUP_MEMBER_COUNT (32) + +#define MAX_GROUP_BUFFER_SIZE ( \ + MAX_GROUP_NAME_LEN \ + + MAX_GROUP_PASSWORD_LEN \ + + ((MAX_GROUP_MEMBER_COUNT + 1) * sizeof(char*))) + // MAX_GROUP_NAME_LEN and MAX_GROUP_PASSWORD_LEN are char* aligned + + struct user_space_program_args; struct real_time_data; @@ -33,7 +57,9 @@ void __arch_init_time(struct real_time_data *data, bool setDefaults); bigtime_t __arch_get_system_time_offset(struct real_time_data *data); void __init_pwd_backend(void); +void __reinit_pwd_backend_after_fork(void); + #ifdef __cplusplus } #endif Modified: haiku/trunk/src/bin/coreutils/lib/config.h =================================================================== --- haiku/trunk/src/bin/coreutils/lib/config.h 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/bin/coreutils/lib/config.h 2008-04-02 14:02:52 UTC (rev 24750) @@ -228,10 +228,10 @@ /* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ /* Define to 1 if your system has a working `chown' function. */ -/* #undef HAVE_CHOWN */ +#define HAVE_CHOWN 1 /* Define to 1 if you have the `chroot' function. */ -/* #undef HAVE_CHROOT */ +#define HAVE_CHROOT 1 /* Define to 1 if you have the `chsize' function. */ /* #undef HAVE_CHSIZE */ @@ -671,7 +671,7 @@ /* #undef HAVE_INET_NTOP */ /* Define to 1 if you have the `initgroups' function. */ -/* #undef HAVE_INITGROUPS */ +#define HAVE_INITGROUPS 1 /* Define to 1 if the compiler supports one of the keywords 'inline', '__inline__', '__inline' and effectively inlines functions marked as such. @@ -928,7 +928,7 @@ #define HAVE_SETENV 1 /* Define to 1 if you have the `setgroups' function. */ -/* #undef HAVE_SETGROUPS */ +#define HAVE_SETGROUPS 1 /* Define to 1 if you have the `sethostname' function. */ #define HAVE_SETHOSTNAME 1 Modified: haiku/trunk/src/kits/network/dns/config.h =================================================================== --- haiku/trunk/src/kits/network/dns/config.h 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/kits/network/dns/config.h 2008-04-02 14:02:52 UTC (rev 24750) @@ -16,7 +16,7 @@ /* define if prototype for getgrnam_r() is required */ #define NEED_GETGRNAM_R 1 #define NEED_GETGRGID_R 1 -#define NEED_GETGRENT_R 1 +/*#define NEED_GETGRENT_R 1*/ #define NEED_SETGRENT_R 1 #define NEED_ENDGRENT_R 1 @@ -29,7 +29,7 @@ #define NEED_SETPWENT_R 1 #define NEED_SETPASSENT_R 1 #define NEED_SETPWENT_R 1 -#define NEED_GETPWENT_R 1 +/*#define NEED_GETPWENT_R 1*/ #define NEED_ENDPWENT_R 1 #define NEED_SETPASSENT 1 Modified: haiku/trunk/src/system/libroot/posix/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/Jamfile 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/system/libroot/posix/Jamfile 2008-04-02 14:02:52 UTC (rev 24750) @@ -1,12 +1,12 @@ SubDir HAIKU_TOP src system libroot posix ; -UsePrivateHeaders [ FDirName syslog_daemon ] ; +UsePrivateHeaders shared [ FDirName syslog_daemon ] ; UseHeaders $(TARGET_PRIVATE_KERNEL_HEADERS) : true ; -if $(HAIKU_ENABLE_MULTIUSER) = 1 { +if $(HAIKU_MULTIUSER_QUERY) = 1 { PWD_BACKEND = pwd_query.c ; } else { - PWD_BACKEND = pwd.c grp.c ; + PWD_BACKEND = pwd.cpp grp.cpp user_group_common.cpp ; } MergeObject posix_main.o : assert.c Deleted: haiku/trunk/src/system/libroot/posix/grp.c Added: haiku/trunk/src/system/libroot/posix/grp.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/grp.cpp 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/system/libroot/posix/grp.cpp 2008-04-02 14:02:52 UTC (rev 24750) @@ -0,0 +1,260 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include + +#include +#include + +#include + +#include + +#include + +#include "user_group_common.h" + + +using BPrivate::GroupDB; +using BPrivate::GroupDBReader; +using BPrivate::GroupEntryHandler; +using BPrivate::UserGroupLocker; + +static GroupDB* sGroupDB = NULL; + +static struct group sGroupBuffer; +static char sGroupStringBuffer[MAX_GROUP_BUFFER_SIZE]; + + +namespace { + +class GroupEntryFindHandler : public GroupEntryHandler { +public: + GroupEntryFindHandler(const char* name, uid_t gid, + group* entry, char* buffer, size_t bufferSize) + : + fName(name), + fGID(gid), + fEntry(entry), + fBuffer(buffer), + fBufferSize(bufferSize) + { + } + + virtual status_t HandleEntry(const char* name, const char* password, + gid_t gid, const char* const* members, int memberCount) + { + if (fName != NULL ? strcmp(fName, name) != 0 : fGID != gid) + return 0; + + // found + status_t error = BPrivate::copy_group_to_buffer(name, password, gid, + members, memberCount, fEntry, fBuffer, fBufferSize); + + return error == B_OK ? 1 : error; + } + +private: + const char* fName; + gid_t fGID; + group* fEntry; + char* fBuffer; + size_t fBufferSize; +}; + + +class UserGroupEntryHandler : public BPrivate::GroupEntryHandler { +public: + UserGroupEntryHandler(const char* user, gid_t* groupList, int maxGroupCount, + int* groupCount) + : + fUser(user), + fGroupList(groupList), + fMaxGroupCount(maxGroupCount), + fGroupCount(groupCount) + { + } + + virtual status_t HandleEntry(const char* name, const char* password, + gid_t gid, const char* const* members, int memberCount) + { + for (int i = 0; i < memberCount; i++) { + const char* member = members[i]; + if (*member != '\0' && strcmp(member, fUser) == 0) { + if (*fGroupCount < fMaxGroupCount) + fGroupList[*fGroupCount] = gid; + ++*fGroupCount; + } + } + + return 0; + } + +private: + const char* fUser; + gid_t* fGroupList; + int fMaxGroupCount; + int* fGroupCount; +}; + +} // empty namespace + + +static GroupDB* +init_group_db() +{ + if (sGroupDB != NULL) + return sGroupDB; + + sGroupDB = new(nothrow) GroupDB; + if (sGroupDB == NULL) + return NULL; + + if (sGroupDB->Init() != B_OK) { + delete sGroupDB; + sGroupDB = NULL; + } + + return sGroupDB; +} + + +// #pragma mark - + + +struct group* +getgrent(void) +{ + struct group* result = NULL; + int status = getgrent_r(&sGroupBuffer, sGroupStringBuffer, + sizeof(sGroupStringBuffer), &result); + if (status != 0) + errno = status; + return result; +} + + +int +getgrent_r(struct group* group, char* buffer, size_t bufferSize, + struct group** _result) +{ + UserGroupLocker _; + + int status = B_NO_MEMORY; + + *_result = NULL; + + if (GroupDB* db = init_group_db()) { + status = db->GetNextEntry(group, buffer, bufferSize); + if (status == 0) + *_result = group; + + } + + return status; +} + + +void +setgrent(void) +{ + UserGroupLocker _; + + if (GroupDB* db = init_group_db()) + db->RewindEntries(); +} + + +void +endgrent(void) +{ + UserGroupLocker locker; + + GroupDB* db = sGroupDB; + sGroupDB = NULL; + + locker.Unlock(); + + delete db; +} + + +struct group * +getgrnam(const char *name) +{ + struct group* result = NULL; + int status = getgrnam_r(name, &sGroupBuffer, sGroupStringBuffer, + sizeof(sGroupStringBuffer), &result); + if (status != 0) + errno = status; + return result; +} + + +int +getgrnam_r(const char *name, struct group *group, char *buffer, + size_t bufferSize, struct group **_result) +{ + GroupEntryFindHandler handler(name, 0, group, buffer, bufferSize); + status_t status = GroupDBReader(&handler).Read(BPrivate::kGroupFile); + + *_result = (status == 1 ? group : NULL); + return (status == 1 ? 0 : (status == 0 ? ENOENT : status)); +} + + +struct group * +getgrgid(gid_t gid) +{ + struct group* result = NULL; + int status = getgrgid_r(gid, &sGroupBuffer, sGroupStringBuffer, + sizeof(sGroupStringBuffer), &result); + if (status != 0) + errno = status; + return result; +} + + +int +getgrgid_r(gid_t gid, struct group *group, char *buffer, + size_t bufferSize, struct group **_result) +{ + GroupEntryFindHandler handler(NULL, gid, group, buffer, bufferSize); + status_t status = GroupDBReader(&handler).Read(BPrivate::kGroupFile); + + *_result = (status == 1 ? group : NULL); + return (status == 1 ? 0 : (status == 0 ? ENOENT : status)); +} + + +int +getgrouplist(const char* user, gid_t baseGroup, gid_t* groupList, + int* groupCount) +{ + int maxGroupCount = *groupCount; + *groupCount = 0; + + UserGroupEntryHandler handler(user, groupList, maxGroupCount, groupCount); + BPrivate::GroupDBReader(&handler).Read(BPrivate::kGroupFile); + + // put in the base group + if (*groupCount < maxGroupCount) + groupList[*groupCount] = baseGroup; + ++*groupCount; + + return *groupCount <= maxGroupCount ? *groupCount : -1; +} + + +int +initgroups(const char* user, gid_t baseGroup) +{ + gid_t groups[NGROUPS_MAX + 1]; + int groupCount = NGROUPS_MAX + 1; + if (getgrouplist(user, baseGroup, groups, &groupCount) < 0) + return -1; + + return setgroups(groupCount, groups); +} Deleted: haiku/trunk/src/system/libroot/posix/pwd.c Added: haiku/trunk/src/system/libroot/posix/pwd.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd.cpp 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/system/libroot/posix/pwd.cpp 2008-04-02 14:02:52 UTC (rev 24750) @@ -0,0 +1,194 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + +#include + +#include +#include + +#include + +#include + +#include + +#include "user_group_common.h" + + +using BPrivate::PasswdDB; +using BPrivate::PasswdDBReader; +using BPrivate::PasswdEntryHandler; +using BPrivate::UserGroupLocker; + +static PasswdDB* sPasswdDB = NULL; + +static struct passwd sPasswdBuffer; +static char sPasswdStringBuffer[MAX_PASSWD_BUFFER_SIZE]; + + +namespace { + +class PasswdEntryFindHandler : public PasswdEntryHandler { +public: + PasswdEntryFindHandler(const char* name, uid_t uid, + passwd* entry, char* buffer, size_t bufferSize) + : + fName(name), + fUID(uid), + fEntry(entry), + fBuffer(buffer), + fBufferSize(bufferSize) + { + } + + virtual status_t HandleEntry(const char* name, const char* password, + uid_t uid, gid_t gid, const char* home, const char* shell, + const char* realName) + { + if (fName != NULL ? strcmp(fName, name) != 0 : fUID != uid) + return 0; + + // found + status_t error = BPrivate::copy_passwd_to_buffer(name, password, uid, + gid, home, shell, realName, fEntry, fBuffer, fBufferSize); + return error == B_OK ? 1 : error; + } + +private: + const char* fName; + uid_t fUID; + passwd* fEntry; + char* fBuffer; + size_t fBufferSize; +}; + +} // empty namespace + + +static PasswdDB* +init_passwd_db() +{ + if (sPasswdDB != NULL) + return sPasswdDB; + + sPasswdDB = new(nothrow) PasswdDB; + if (sPasswdDB == NULL) + return NULL; + + if (sPasswdDB->Init() != B_OK) { + delete sPasswdDB; + sPasswdDB = NULL; + } + + return sPasswdDB; +} + + +// #pragma mark - + + +struct passwd* +getpwent(void) +{ + struct passwd* result = NULL; + int status = getpwent_r(&sPasswdBuffer, sPasswdStringBuffer, + sizeof(sPasswdStringBuffer), &result); + if (status != 0) + errno = status; + return result; +} + + +int +getpwent_r(struct passwd* passwd, char* buffer, size_t bufferSize, + struct passwd** _result) +{ + UserGroupLocker _; + + int status = B_NO_MEMORY; + + *_result = NULL; + + if (PasswdDB* db = init_passwd_db()) { + status = db->GetNextEntry(passwd, buffer, bufferSize); + if (status == 0) + *_result = passwd; + + } + + return status; +} + + +void +setpwent(void) +{ + UserGroupLocker _; + + if (PasswdDB* db = init_passwd_db()) + db->RewindEntries(); +} + + +void +endpwent(void) +{ + UserGroupLocker locker; + + PasswdDB* db = sPasswdDB; + sPasswdDB = NULL; + + locker.Unlock(); + + delete db; +} + + +struct passwd * +getpwnam(const char *name) +{ + struct passwd* result = NULL; + int status = getpwnam_r(name, &sPasswdBuffer, sPasswdStringBuffer, + sizeof(sPasswdStringBuffer), &result); + if (status != 0) + errno = status; + return result; +} + + +int +getpwnam_r(const char *name, struct passwd *passwd, char *buffer, + size_t bufferSize, struct passwd **_result) +{ + PasswdEntryFindHandler handler(name, 0, passwd, buffer, bufferSize); + status_t status = PasswdDBReader(&handler).Read(BPrivate::kPasswdFile); + + *_result = (status == 1 ? passwd : NULL); + return (status == 1 ? 0 : (status == 0 ? ENOENT : status)); +} + + +struct passwd * +getpwuid(uid_t uid) +{ + struct passwd* result = NULL; + int status = getpwuid_r(uid, &sPasswdBuffer, sPasswdStringBuffer, + sizeof(sPasswdStringBuffer), &result); + if (status != 0) + errno = status; + return result; +} + + +int +getpwuid_r(uid_t uid, struct passwd *passwd, char *buffer, + size_t bufferSize, struct passwd **_result) +{ + PasswdEntryFindHandler handler(NULL, uid, passwd, buffer, bufferSize); + status_t status = PasswdDBReader(&handler).Read(BPrivate::kPasswdFile); + + *_result = (status == 1 ? passwd : NULL); + return (status == 1 ? 0 : (status == 0 ? ENOENT : status)); +} Modified: haiku/trunk/src/system/libroot/posix/unistd/conf.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/conf.c 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/system/libroot/posix/unistd/conf.c 2008-04-02 14:02:52 UTC (rev 24750) @@ -14,7 +14,9 @@ #include +#include + int getdtablesize(void) { @@ -52,6 +54,10 @@ return TZNAME_MAX; case _SC_VERSION: return _POSIX_VERSION; + case _SC_GETGR_R_SIZE_MAX: + return MAX_GROUP_BUFFER_SIZE; + case _SC_GETPW_R_SIZE_MAX: + return MAX_PASSWD_BUFFER_SIZE; } return -1; Modified: haiku/trunk/src/system/libroot/posix/unistd/fork.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/fork.c 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/system/libroot/posix/unistd/fork.c 2008-04-02 14:02:52 UTC (rev 24750) @@ -10,6 +10,7 @@ #include #include +#include #include #include @@ -156,6 +157,7 @@ __main_thread_id = find_thread(NULL); __init_fork(); __gRuntimeLoader->reinit_after_fork(); + __reinit_pwd_backend_after_fork(); call_fork_hooks(sChildHooks); } else { Modified: haiku/trunk/src/system/libroot/posix/unistd/usergroup.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/usergroup.cpp 2008-04-02 13:51:34 UTC (rev 24749) +++ haiku/trunk/src/system/libroot/posix/unistd/usergroup.cpp 2008-04-02 14:02:52 UTC (rev 24750) @@ -31,131 +31,6 @@ } -class FileLineReader { -public: - FileLineReader(int fd) - : fFD(fd), - fSize(0), - fOffset(0) - { - } - - char* NextLine() - { - char* eol; - if (fOffset >= fSize - || (eol = strchr(fBuffer + fOffset, '\n')) == NULL) { - _ReadBuffer(); - if (fOffset >= fSize) - return NULL; - - eol = strchr(fBuffer + fOffset, '\n'); - if (eol == NULL) - eol = fBuffer + fSize; - } - - char* result = fBuffer + fOffset; - *eol = '\0'; - fOffset = eol + 1 - fBuffer; - return result; - } - - char* NextNonEmptyLine() - { - while (char* line = NextLine()) { - while (*line != '\0' && isspace(*line)) - line++; - - if (*line != '\0' && *line != '#') - return line; - } - - return NULL; - } - -private: - void _ReadBuffer() - { - // catch special cases: full buffer or already done with the file - if (fSize == LINE_MAX || fFD < 0) - return; - - // move buffered bytes to the beginning of the buffer - int leftBytes = 0; - if (fOffset < fSize) { - leftBytes = fSize - fOffset; - memmove(fBuffer, fBuffer + fOffset, leftBytes); - } - - fOffset = 0; - fSize = leftBytes; - - // read - ssize_t bytesRead = read(fFD, fBuffer + leftBytes, - LINE_MAX - leftBytes); - if (bytesRead > 0) - fSize += bytesRead; - else - fFD = -1; - - // null-terminate - fBuffer[fSize] = '\0'; - } - -private: - int fFD; - char fBuffer[LINE_MAX + 1]; - int fSize; - int fOffset; -}; - - -class Tokenizer { -public: - Tokenizer(char* string) - : fString(string) - { - } - - char* NextToken(char separator) - { - if (fString == NULL) - return NULL; - - char* token = fString; - fString = strchr(fString, separator); - if (fString != NULL) { - *fString = '\0'; - fString++; - } - - return token; - } - - char* NextTrimmedToken(char separator) - { - char* token = NextToken(separator); - if (token == NULL) - return NULL; - - // skip spaces at the beginning - while (*token != '\0' && isspace(*token)) - token++; - - // cut off spaces at the end - char* end = token + strlen(token); - while (end != token && isspace(end[-1])) - end--; - *end = '\0'; - - return token; - } - -private: - char* fString; -}; - - // #pragma mark - @@ -230,51 +105,6 @@ int -getgrouplist(const char* user, gid_t baseGroup, gid_t* groupList, - int* groupCount) -{ - int maxGroupCount = *groupCount; - *groupCount = 0; - - // read group file - int fd = open("/etc/group", O_RDONLY); - FileLineReader reader(fd); - - while (char* line = reader.NextNonEmptyLine()) { - Tokenizer lineTokenizer(line); - lineTokenizer.NextTrimmedToken(':'); // group name - lineTokenizer.NextTrimmedToken(':'); // group password - char* groupID = lineTokenizer.NextTrimmedToken(':'); - - if (groupID == NULL || !isdigit(*groupID)) - continue; - - gid_t gid = atol(groupID); - if (gid == baseGroup) - continue; - - while (char* groupUser = lineTokenizer.NextTrimmedToken(',')) { - if (*groupUser != '\0' && strcmp(groupUser, user) == 0) { - if (*groupCount < maxGroupCount) - groupList[*groupCount] = gid; [... truncated: 1016 lines follow ...] From ingo_weinhold at gmx.de Wed Apr 2 16:13:16 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 02 Apr 2008 16:13:16 +0200 Subject: [Haiku-commits] r24669 - in haiku/trunk: headers/posix headers/private/kernel src/kits/network/dns src/system/kernel src/system/libroot/posix/unistd In-Reply-To: <1211759561-BeMail@laptop> References: <1211759561-BeMail@laptop> Message-ID: <20080402161316.501.1@knochen-vm.1207141764.fake> On 2008-04-02 at 14:00:20 [+0200], Fran?ois Revol wrote: > > > > On 2008-04-01 at 10:20:43 [+0200], Axel D?rfler > > > wrote: > > > "Fran?ois Revol" wrote: > > > > > What happens when copying these files or trying to make/restore > > > > > a > > > > > backup? > > > > You'd get doubled users if root copies. > > > > User copies won't be able to add the attr oth. > > > > > > Even if we wanted to use single files, there would still be no good > > > reason to use queries IMO. > > > > Well, the get{pw,gr}{nam,{uid,gid}}() functions benefit from being > > able to > > directly query for the matching name/ID. Nevertheless I'd at least > > restrict > > the considered query results to a single directory. Anyway, I've > > almost > > Yes probably, unless we want to move the attributes to the home > directory itself. That won't work for users that don't have a real home directory or share one. > > finished the /etc/{passwd,group} backend and will soon check it in. > > The query version is in pwd_query.c anyway, so one can always > substitute it for comparison. > How about using pwd_file.c for that one ? > For PAM one will need to hook those calls anyway. Well, if/when we do that, we will probably want to solve that differently anyway. Namely by moving the stuff to a daemon and have the libroot functions get the infos there. CU, Ingo PS: To build again the query backend would need to implement getgrouplist() and initgroups() now (the latter is generic anyway and could be moved to a separate file). From bonefish at mail.berlios.de Wed Apr 2 17:09:51 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 2 Apr 2008 17:09:51 +0200 Subject: [Haiku-commits] r24751 - haiku/trunk/src/system/libroot/os Message-ID: <200804021509.m32F9pRx007484@sheep.berlios.de> Author: bonefish Date: 2008-04-02 17:09:50 +0200 (Wed, 02 Apr 2008) New Revision: 24751 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24751&view=rev Modified: haiku/trunk/src/system/libroot/os/find_directory.c Log: Use the thread-safe getpwuid_r() instead of getpwuid(). Modified: haiku/trunk/src/system/libroot/os/find_directory.c =================================================================== --- haiku/trunk/src/system/libroot/os/find_directory.c 2008-04-02 14:02:52 UTC (rev 24750) +++ haiku/trunk/src/system/libroot/os/find_directory.c 2008-04-02 15:09:50 UTC (rev 24751) @@ -22,6 +22,7 @@ #include #include +#include /* use pwents to find home */ #define USE_PWENTS @@ -187,7 +188,7 @@ free(buffer); return err; } - + switch (which) { /* Per volume directories */ case B_DESKTOP_DIRECTORY: @@ -279,6 +280,10 @@ err = B_OK; if (template) { if (!strncmp(template, "$h", 2)) { + struct passwd pwBuffer; + char pwStringBuffer[MAX_PASSWD_BUFFER_SIZE]; + struct passwd *pw; + if (bootDevice > -1 && device != bootDevice) { int l = pathLength - strlen(buffer); if (l > 5) @@ -286,11 +291,10 @@ } else { #ifndef _KERNEL_MODE #ifdef USE_PWENTS - struct passwd *pw; - // WARNING getpwuid() might not be threadsafe... - pw = getpwuid(getuid()); - if (pw) + if (getpwuid_r(geteuid(), &pwBuffer, pwStringBuffer, + sizeof(pwStringBuffer), &pw) == 0) { home = pw->pw_dir; + } #endif // USE_PWENTS if (!home) { /* use env var */ From ingo_weinhold at gmx.de Wed Apr 2 17:14:52 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 02 Apr 2008 17:14:52 +0200 Subject: [Haiku-commits] r24747 - haiku/trunk/src/servers/app In-Reply-To: <200804021304.m32D49RO026961@sheep.berlios.de> References: <200804021304.m32D49RO026961@sheep.berlios.de> Message-ID: <20080402171452.378.1@knochen-vm.1207149079.fake> On 2008-04-02 at 15:04:09 [+0200], axeld at BerliOS wrote: > #if !TEST_MODE > + // TODO: actually, find_directory() cannot know which user ID we want > here > BPath path; > - if (find_directory(B_USER_FONTS_DIRECTORY, &path) != B_OK) > + if (find_directory(B_USER_FONTS_DIRECTORY, &path, true) != B_OK) > return; How about 1) seteuid(...); find_directory(); seteuid(0); 2) add a find_directory_etc() with uid_t parameter ? CU, Ingo From revol at free.fr Wed Apr 2 17:27:19 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Wed, 02 Apr 2008 17:27:19 +0200 CEST Subject: [Haiku-commits] r24747 - haiku/trunk/src/servers/app In-Reply-To: <20080402171452.378.1@knochen-vm.1207149079.fake> Message-ID: <13630855413-BeMail@laptop> > > On 2008-04-02 at 15:04:09 [+0200], axeld at BerliOS < > axeld at mail.berlios.de> > wrote: > > #if !TEST_MODE > > + // TODO: actually, find_directory() cannot know which user ID > > we want > > here > > BPath path; > > - if (find_directory(B_USER_FONTS_DIRECTORY, &path) != B_OK) > > + if (find_directory(B_USER_FONTS_DIRECTORY, &path, true) != > > B_OK) > > return; > > How about > > 1) seteuid(...); find_directory(); seteuid(0); That's not threadsafe, other threads might be doing priviledged ops at the same time... windows uses impersonation, where a specific thread can have a different user than the rest of the process, but that looks a bit overkill... > 2) add a find_directory_etc() with uid_t parameter Could work, but it'll only work when reading files. Fran?ois. From ingo_weinhold at gmx.de Wed Apr 2 17:38:17 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 02 Apr 2008 17:38:17 +0200 Subject: [Haiku-commits] r24747 - haiku/trunk/src/servers/app In-Reply-To: <13630855413-BeMail@laptop> References: <13630855413-BeMail@laptop> Message-ID: <20080402173817.493.2@knochen-vm.1207149079.fake> On 2008-04-02 at 17:27:19 [+0200], Fran?ois Revol wrote: > > > > On 2008-04-02 at 15:04:09 [+0200], axeld at BerliOS < > > axeld at mail.berlios.de> > > wrote: > > > #if !TEST_MODE > > > + // TODO: actually, find_directory() cannot know which user ID > > > we want > > > here > > > BPath path; > > > - if (find_directory(B_USER_FONTS_DIRECTORY, &path) != B_OK) > > > + if (find_directory(B_USER_FONTS_DIRECTORY, &path, true) != > > > B_OK) > > > return; > > > > How about > > > > 1) seteuid(...); find_directory(); seteuid(0); > > That's not threadsafe, other threads might be doing priviledged ops at > the same time... Oops, good point. :-) > > 2) add a find_directory_etc() with uid_t parameter > > Could work, but it'll only work when reading files. The find_directory_etc() version would just use the supplied uid instead of geteuid() (respectively use it when >= 0) for passing to getpwuid_r(). What does that have to do with reading files? CU, Ingo From revol at free.fr Wed Apr 2 18:17:30 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Wed, 02 Apr 2008 18:17:30 +0200 CEST Subject: [Haiku-commits] r24747 - haiku/trunk/src/servers/app In-Reply-To: <20080402173817.493.2@knochen-vm.1207149079.fake> Message-ID: <16641814986-BeMail@laptop> > > > 2) add a find_directory_etc() with uid_t parameter > > > > Could work, but it'll only work when reading files. > > The find_directory_etc() version would just use the supplied uid > instead of > geteuid() (respectively use it when >= 0) for passing to > getpwuid_r(). What > does that have to do with reading files? > It's ok when you want to read user's files, but if you want to write them you'll have to chown() then to him after doing so if you have to create them. Fran?ois. From axeld at mail.berlios.de Wed Apr 2 17:54:23 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 17:54:23 +0200 Subject: [Haiku-commits] r24752 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804021554.m32FsNpP012539@sheep.berlios.de> Author: axeld Date: 2008-04-02 17:54:22 +0200 (Wed, 02 Apr 2008) New Revision: 24752 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24752&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h Log: * Quick fix for a possible deadlock I introduced with the block_cache idle notification. We should rework the cache notifications to work asynchronously. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-02 15:09:50 UTC (rev 24751) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-02 15:54:22 UTC (rev 24752) @@ -594,7 +594,7 @@ // The current transaction seems to be idle - flush it Journal *journal = (Journal *)_journal; - journal->_FlushLog(); + journal->_FlushLog(false, false); } @@ -793,9 +793,9 @@ also write back all dirty blocks for this volume. */ status_t -Journal::_FlushLog(bool flushBlocks) +Journal::_FlushLog(bool canWait, bool flushBlocks) { - status_t status = fLock.Lock(); + status_t status = canWait ? fLock.Lock() : fLock.LockWithTimeout(0); if (status != B_OK) return status; @@ -827,7 +827,7 @@ status_t Journal::FlushLogAndBlocks() { - return _FlushLog(true); + return _FlushLog(true, true); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-04-02 15:09:50 UTC (rev 24751) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-04-02 15:54:22 UTC (rev 24752) @@ -52,7 +52,7 @@ private: bool _HasSubTransaction() { return fHasSubtransaction; } - status_t _FlushLog(bool flushBlocks = false); + status_t _FlushLog(bool canWait, bool flushBlocks); uint32 _TransactionSize() const; status_t _WriteTransactionToLog(); status_t _CheckRunArray(const run_array *array); From axeld at mail.berlios.de Wed Apr 2 18:09:48 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 2 Apr 2008 18:09:48 +0200 Subject: [Haiku-commits] r24753 - haiku/trunk/src/data/beos_mime/application Message-ID: <200804021609.m32G9mw7014167@sheep.berlios.de> Author: axeld Date: 2008-04-02 18:09:48 +0200 (Wed, 02 Apr 2008) New Revision: 24753 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24753&view=rev Added: haiku/trunk/src/data/beos_mime/application/x-scode-upkg Log: * Added MIME type for packages for our PackageInstaller based on the patch by Philippe Saint-Pierre that is part of ticket #2006. * Added sniffer rule. * For now, added package icon without any flags. Added: haiku/trunk/src/data/beos_mime/application/x-scode-upkg =================================================================== --- haiku/trunk/src/data/beos_mime/application/x-scode-upkg 2008-04-02 15:54:22 UTC (rev 24752) +++ haiku/trunk/src/data/beos_mime/application/x-scode-upkg 2008-04-02 16:09:48 UTC (rev 24753) @@ -0,0 +1,48 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "application/x-scode-UPkg"; + +resource(2, "META:SNIFF_RULE") "0.40 (\"AlB\\032\")"; + +resource(3, "META:S:DESC") #'MSDC' "Software Package"; +resource(4, "META:L:DESC") #'MLDC' "Binary package for the PackageInstaller"; + +resource(5, "META:PREF_APP") #'MSIG' "application/x-vnd.Haiku-PackageInstaller"; + +resource(6, "META:EXTENS") message(234) { + "extensions" = "pkg", + "type" = "application/x-scode-UPkg" +}; + +resource(7, "META:ICON") #'VICN' array { + $"6E6369660903010000020006023CC7EE389BC0BA16573E39B04977C842ADC700" + $"FFF8EAFFF5DEAC020006023C96323A4D3FBAFC013D5A974B57A549844D00983F" + $"04FFE6C276020006023A492400000000000040000047000000000000FFEFCEFF" + $"FFD16E02000602BB8A46BA62453C0CE4BD0B7C487ECB4B908500EEBF5AFFFFEB" + $"C0020006023A75293B1661BC4A333BA5424832E349A3B900696363FFFFDCDC03" + $"A7FF0003FF00000401880D0608B2AB445B49C62DC7C1C521C92AC755C631C7C0" + $"C48DCAECC15AC9BCC2F4CC1CBFC15F3C5B3A593F060AEEEA0E233C22C04022BF" + $"2422C1B0B40BC32FB647C4A6B4FBC3F6B7DDC57DB99EC604B99FC07FBEC1BB44" + $"BBA1B9FEBD24BA9CBA49B972B905B954B623BB6AB766BA27B4CABCC30606BA0B" + $"3EBADEC283B702BF85B5ECC0FAB673BE35B5723926BB83B670BC45B5AEBA98B7" + $"5BB992B861060AEAEE0EBF8DBB84C6133BC618C3B8C8A9C0DCC7A7C22FC96EBF" + $"D859BECD5ABBEA5ABD575ABAC9C969B9F9C5DCB83AC7CDB8EFC472B7B6C33AB7" + $"78C181B8E5C269B80BC064B9F2060CEEEEEEC5933DC221BCF0C3E6BDB342BC42" + $"BF27BBDDBCE0BDF9BDFFBCC2BB9DBF57BA6BC0CBBA45C34ABA45C1FABA45C4EC" + $"BA85C6B6BD7AC876BBD3C796BF59C97344C9CFC3C8C74AC297C8DDC4E2C5D7C5" + $"A3C467C5CEC17CC5D2C2F8C5CABFFF0606BA0B444ABA6BC0CBBA45C34ABA45C1" + $"FABA45C4ECBA85C6B6BD7AC876BBD3C796BF59C97344C9CF06076E3BC5933DC3" + $"DFC121C4ECBFD6C2CFC26D444AC9CFC3C8C74AC297C8DDC4E2C5D7C5A3C467C5" + $"CEC17CC5D2C2F8C5CABFFF0607EE3AC5933DC221BCF0C3E6BDB342BC42BF27BB" + $"DDBCE0BDF9BDFFBCC2BB9DBF57BA6BC0CB444AC3DFC121C2CFC26DC4ECBFD606" + $"06EE0A233C22C04022BF2422C1B0B40BC32FB647C4A6B4FBC3F6B7DDC57DB99E" + $"C604B99FC07F0606EA0E233CB99FC07FBEC1BB44BBA1B9FEBD24BA9CBA49B972" + $"B905B954B623BB6AB766BA27B4CABCC30607BA3BBF8DBB84C6133BC85BBB9FC7" + $"75BCA4C91DBAC3C969B9F9C5DCB83AC7CDB8EFC472B7B6C33AB778C181B8E5C2" + $"69B80BC064B9F20607BA3BC6133BC618C3B8C8A9C0DCC7A7C22FC96EBFD859BE" + $"CD5ABBEA5ABD575ABAC9C969B9F9C85BBB9FC91DBAC3C775BCA40408FEBB453F" + $"3B2F3F31372D32352B3439364E314A2E52344F355335C519353F3438BC43BE4E" + $"BB3DBAEBBD3A2FBDDB070A080100000A0004010203041001178400040A010407" + $"09020A000A0202060B000A040105000A00010C1815FF01178200040A03010800" +}; From ingo_weinhold at gmx.de Wed Apr 2 18:59:47 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 02 Apr 2008 18:59:47 +0200 Subject: [Haiku-commits] r24747 - haiku/trunk/src/servers/app In-Reply-To: <16641814986-BeMail@laptop> References: <16641814986-BeMail@laptop> Message-ID: <20080402185947.577.3@knochen-vm.1207149079.fake> On 2008-04-02 at 18:17:30 [+0200], Fran?ois Revol wrote: > > > > 2) add a find_directory_etc() with uid_t parameter > > > > > > Could work, but it'll only work when reading files. > > > > The find_directory_etc() version would just use the supplied uid > > instead of > > geteuid() (respectively use it when >= 0) for passing to > > getpwuid_r(). What > > does that have to do with reading files? > > > > It's ok when you want to read user's files, but if you want to write > them you'll have to chown() then to him after doing so if you have to > create them. "files" == "directories find_directory() might create"? At any rate servers meddling with users' directories (actually writing stuff) need some privileges anyway, so chown() shouldn't really be a problem. CU, Ingo From superstippi at gmx.de Wed Apr 2 20:14:24 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 02 Apr 2008 20:14:24 +0200 Subject: [Haiku-commits] r24741 - in haiku/trunk/src/servers/app: . drawing In-Reply-To: <47F37D98.3050302@hirschkaefer.de> References: <200804021112.m32BCfCL003027@sheep.berlios.de> <47F37D98.3050302@hirschkaefer.de> Message-ID: <20080402201424.799.1@stippis2.1207159447.fake> Oliver Tappe wrote: > Hi Stippi, > > stippi at BerliOS schrieb: > > + void SetCursor(ServerCursor* cursor) > > + { > > + if (fCursor == cursor) > > + return; > > + if (fCursor) > > + fCursor->Release(); > > Is it ever possible that a ServerCursorReference is shared between two or > more threads? > If so, I think there's a tiny race condition precisely at this point, as > fCursor is released now (i.e. it may be dead already) and some other > thread may invoke Cursor() and thus access fCursor. > > > + fCursor = cursor; > > + if (fCursor) > > + fCursor->Acquire(); > > + } > > I'd suggest to use a temp, like this: > > void SetCursor(ServerCursor* cursor) > { > if (fCursor == cursor) > return; > if (cursor) > cursor->Acquire(); > ServerCursor* oldCursor = fCursor; > fCursor = cursor; > if (oldCursor) > oldCursor->Release(); > } > > or maybe even this (making use of c++-swap, dunno if that works for > pointers, though): > > void SetCursor(ServerCursor* cursor) > { > if (fCursor == cursor) > return; > if (cursor) > cursor->Acquire(); > swap(fCursor, cursor); > if (cursor) > cursor->Release(); > } > > What do you think? Thanks, Oliver. It was not possible in the current code path that one ServerCursorReference would be shared between multiple threads, it was only meant to help with reference bookkeeping while the cursor is passed from function call to function call. But I will incorporate this change anyways, who knows how the code will be used in the future. Best regards, -Stephan From korli at mail.berlios.de Wed Apr 2 20:33:03 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 2 Apr 2008 20:33:03 +0200 Subject: [Haiku-commits] r24754 - in haiku/vendor/acpica/current: common compiler debugger disassembler events hardware include include/platform interpreter/dispatcher interpreter/executer interpreter/parser namespace resources tables utilities Message-ID: <200804021833.m32IX30O023429@sheep.berlios.de> Author: korli Date: 2008-04-02 20:32:56 +0200 (Wed, 02 Apr 2008) New Revision: 24754 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24754&view=rev Added: haiku/vendor/acpica/current/compiler/aslstartup.c Modified: haiku/vendor/acpica/current/common/16bit.h haiku/vendor/acpica/current/common/a16find.c haiku/vendor/acpica/current/common/a16utils.obj haiku/vendor/acpica/current/common/adfile.c haiku/vendor/acpica/current/common/adisasm.c haiku/vendor/acpica/current/common/adwalk.c haiku/vendor/acpica/current/common/dmrestag.c haiku/vendor/acpica/current/common/dmtable.c haiku/vendor/acpica/current/common/dmtbdump.c haiku/vendor/acpica/current/common/dmtbinfo.c haiku/vendor/acpica/current/common/getopt.c haiku/vendor/acpica/current/compiler/Makefile haiku/vendor/acpica/current/compiler/aslanalyze.c haiku/vendor/acpica/current/compiler/aslcodegen.c haiku/vendor/acpica/current/compiler/aslcompile.c haiku/vendor/acpica/current/compiler/aslcompiler.h haiku/vendor/acpica/current/compiler/aslcompiler.l haiku/vendor/acpica/current/compiler/aslcompiler.y haiku/vendor/acpica/current/compiler/asldefine.h haiku/vendor/acpica/current/compiler/aslerror.c haiku/vendor/acpica/current/compiler/aslfiles.c haiku/vendor/acpica/current/compiler/aslfold.c haiku/vendor/acpica/current/compiler/aslglobal.h haiku/vendor/acpica/current/compiler/asllength.c haiku/vendor/acpica/current/compiler/asllisting.c haiku/vendor/acpica/current/compiler/aslload.c haiku/vendor/acpica/current/compiler/asllookup.c haiku/vendor/acpica/current/compiler/aslmain.c haiku/vendor/acpica/current/compiler/aslmap.c haiku/vendor/acpica/current/compiler/aslopcodes.c haiku/vendor/acpica/current/compiler/asloperands.c haiku/vendor/acpica/current/compiler/aslopt.c haiku/vendor/acpica/current/compiler/aslresource.c haiku/vendor/acpica/current/compiler/aslrestype1.c haiku/vendor/acpica/current/compiler/aslrestype2.c haiku/vendor/acpica/current/compiler/aslstubs.c haiku/vendor/acpica/current/compiler/asltransform.c haiku/vendor/acpica/current/compiler/asltree.c haiku/vendor/acpica/current/compiler/asltypes.h haiku/vendor/acpica/current/compiler/aslutils.c haiku/vendor/acpica/current/debugger/dbcmds.c haiku/vendor/acpica/current/debugger/dbdisply.c haiku/vendor/acpica/current/debugger/dbexec.c haiku/vendor/acpica/current/debugger/dbfileio.c haiku/vendor/acpica/current/debugger/dbhistry.c haiku/vendor/acpica/current/debugger/dbinput.c haiku/vendor/acpica/current/debugger/dbstats.c haiku/vendor/acpica/current/debugger/dbutils.c haiku/vendor/acpica/current/debugger/dbxface.c haiku/vendor/acpica/current/disassembler/dmbuffer.c haiku/vendor/acpica/current/disassembler/dmnames.c haiku/vendor/acpica/current/disassembler/dmobject.c haiku/vendor/acpica/current/disassembler/dmopcode.c haiku/vendor/acpica/current/disassembler/dmresrc.c haiku/vendor/acpica/current/disassembler/dmresrcl.c haiku/vendor/acpica/current/disassembler/dmresrcs.c haiku/vendor/acpica/current/disassembler/dmutils.c haiku/vendor/acpica/current/disassembler/dmwalk.c haiku/vendor/acpica/current/events/evevent.c haiku/vendor/acpica/current/events/evgpe.c haiku/vendor/acpica/current/events/evgpeblk.c haiku/vendor/acpica/current/events/evmisc.c haiku/vendor/acpica/current/events/evregion.c haiku/vendor/acpica/current/events/evrgnini.c haiku/vendor/acpica/current/events/evsci.c haiku/vendor/acpica/current/events/evxface.c haiku/vendor/acpica/current/events/evxfevnt.c haiku/vendor/acpica/current/events/evxfregn.c haiku/vendor/acpica/current/hardware/hwacpi.c haiku/vendor/acpica/current/hardware/hwgpe.c haiku/vendor/acpica/current/hardware/hwregs.c haiku/vendor/acpica/current/hardware/hwsleep.c haiku/vendor/acpica/current/hardware/hwtimer.c haiku/vendor/acpica/current/include/acapps.h haiku/vendor/acpica/current/include/acconfig.h haiku/vendor/acpica/current/include/acdebug.h haiku/vendor/acpica/current/include/acdisasm.h haiku/vendor/acpica/current/include/acdispat.h haiku/vendor/acpica/current/include/acevents.h haiku/vendor/acpica/current/include/acexcep.h haiku/vendor/acpica/current/include/acglobal.h haiku/vendor/acpica/current/include/achware.h haiku/vendor/acpica/current/include/acinterp.h haiku/vendor/acpica/current/include/aclocal.h haiku/vendor/acpica/current/include/acmacros.h haiku/vendor/acpica/current/include/acnames.h haiku/vendor/acpica/current/include/acnamesp.h haiku/vendor/acpica/current/include/acobject.h haiku/vendor/acpica/current/include/acopcode.h haiku/vendor/acpica/current/include/acoutput.h haiku/vendor/acpica/current/include/acparser.h haiku/vendor/acpica/current/include/acpi.h haiku/vendor/acpica/current/include/acpiosxf.h haiku/vendor/acpica/current/include/acpixf.h haiku/vendor/acpica/current/include/acresrc.h haiku/vendor/acpica/current/include/acstruct.h haiku/vendor/acpica/current/include/actables.h haiku/vendor/acpica/current/include/actbl.h haiku/vendor/acpica/current/include/actbl1.h haiku/vendor/acpica/current/include/actbl2.h haiku/vendor/acpica/current/include/actypes.h haiku/vendor/acpica/current/include/acutils.h haiku/vendor/acpica/current/include/amlcode.h haiku/vendor/acpica/current/include/amlresrc.h haiku/vendor/acpica/current/include/platform/acdos16.h haiku/vendor/acpica/current/include/platform/acefi.h haiku/vendor/acpica/current/include/platform/acenv.h haiku/vendor/acpica/current/include/platform/acfreebsd.h haiku/vendor/acpica/current/include/platform/acgcc.h haiku/vendor/acpica/current/include/platform/acintel.h haiku/vendor/acpica/current/include/platform/aclinux.h haiku/vendor/acpica/current/include/platform/acmsvc.h haiku/vendor/acpica/current/include/platform/acnetbsd.h haiku/vendor/acpica/current/include/platform/acwin.h haiku/vendor/acpica/current/include/platform/acwin64.h haiku/vendor/acpica/current/interpreter/dispatcher/dsfield.c haiku/vendor/acpica/current/interpreter/dispatcher/dsinit.c haiku/vendor/acpica/current/interpreter/dispatcher/dsmethod.c haiku/vendor/acpica/current/interpreter/dispatcher/dsmthdat.c haiku/vendor/acpica/current/interpreter/dispatcher/dsobject.c haiku/vendor/acpica/current/interpreter/dispatcher/dsopcode.c haiku/vendor/acpica/current/interpreter/dispatcher/dsutils.c haiku/vendor/acpica/current/interpreter/dispatcher/dswexec.c haiku/vendor/acpica/current/interpreter/dispatcher/dswload.c haiku/vendor/acpica/current/interpreter/dispatcher/dswscope.c haiku/vendor/acpica/current/interpreter/dispatcher/dswstate.c haiku/vendor/acpica/current/interpreter/executer/exconfig.c haiku/vendor/acpica/current/interpreter/executer/exconvrt.c haiku/vendor/acpica/current/interpreter/executer/excreate.c haiku/vendor/acpica/current/interpreter/executer/exdump.c haiku/vendor/acpica/current/interpreter/executer/exfield.c haiku/vendor/acpica/current/interpreter/executer/exfldio.c haiku/vendor/acpica/current/interpreter/executer/exmisc.c haiku/vendor/acpica/current/interpreter/executer/exmutex.c haiku/vendor/acpica/current/interpreter/executer/exnames.c haiku/vendor/acpica/current/interpreter/executer/exoparg1.c haiku/vendor/acpica/current/interpreter/executer/exoparg2.c haiku/vendor/acpica/current/interpreter/executer/exoparg3.c haiku/vendor/acpica/current/interpreter/executer/exoparg6.c haiku/vendor/acpica/current/interpreter/executer/exprep.c haiku/vendor/acpica/current/interpreter/executer/exregion.c haiku/vendor/acpica/current/interpreter/executer/exresnte.c haiku/vendor/acpica/current/interpreter/executer/exresolv.c haiku/vendor/acpica/current/interpreter/executer/exresop.c haiku/vendor/acpica/current/interpreter/executer/exstore.c haiku/vendor/acpica/current/interpreter/executer/exstoren.c haiku/vendor/acpica/current/interpreter/executer/exstorob.c haiku/vendor/acpica/current/interpreter/executer/exsystem.c haiku/vendor/acpica/current/interpreter/executer/exutils.c haiku/vendor/acpica/current/interpreter/parser/psargs.c haiku/vendor/acpica/current/interpreter/parser/psloop.c haiku/vendor/acpica/current/interpreter/parser/psopcode.c haiku/vendor/acpica/current/interpreter/parser/psparse.c haiku/vendor/acpica/current/interpreter/parser/psscope.c haiku/vendor/acpica/current/interpreter/parser/pstree.c haiku/vendor/acpica/current/interpreter/parser/psutils.c haiku/vendor/acpica/current/interpreter/parser/pswalk.c haiku/vendor/acpica/current/interpreter/parser/psxface.c haiku/vendor/acpica/current/namespace/nsaccess.c haiku/vendor/acpica/current/namespace/nsalloc.c haiku/vendor/acpica/current/namespace/nsdump.c haiku/vendor/acpica/current/namespace/nsdumpdv.c haiku/vendor/acpica/current/namespace/nseval.c haiku/vendor/acpica/current/namespace/nsinit.c haiku/vendor/acpica/current/namespace/nsload.c haiku/vendor/acpica/current/namespace/nsnames.c haiku/vendor/acpica/current/namespace/nsobject.c haiku/vendor/acpica/current/namespace/nsparse.c haiku/vendor/acpica/current/namespace/nssearch.c haiku/vendor/acpica/current/namespace/nsutils.c haiku/vendor/acpica/current/namespace/nswalk.c haiku/vendor/acpica/current/namespace/nsxfeval.c haiku/vendor/acpica/current/namespace/nsxfname.c haiku/vendor/acpica/current/namespace/nsxfobj.c haiku/vendor/acpica/current/resources/rsaddr.c haiku/vendor/acpica/current/resources/rscalc.c haiku/vendor/acpica/current/resources/rscreate.c haiku/vendor/acpica/current/resources/rsdump.c haiku/vendor/acpica/current/resources/rsinfo.c haiku/vendor/acpica/current/resources/rsio.c haiku/vendor/acpica/current/resources/rsirq.c haiku/vendor/acpica/current/resources/rslist.c haiku/vendor/acpica/current/resources/rsmemory.c haiku/vendor/acpica/current/resources/rsmisc.c haiku/vendor/acpica/current/resources/rsutils.c haiku/vendor/acpica/current/resources/rsxface.c haiku/vendor/acpica/current/tables/tbfadt.c haiku/vendor/acpica/current/tables/tbfind.c haiku/vendor/acpica/current/tables/tbinstal.c haiku/vendor/acpica/current/tables/tbutils.c haiku/vendor/acpica/current/tables/tbxface.c haiku/vendor/acpica/current/tables/tbxfroot.c haiku/vendor/acpica/current/utilities/utalloc.c haiku/vendor/acpica/current/utilities/utcache.c haiku/vendor/acpica/current/utilities/utclib.c haiku/vendor/acpica/current/utilities/utcopy.c haiku/vendor/acpica/current/utilities/utdebug.c haiku/vendor/acpica/current/utilities/utdelete.c haiku/vendor/acpica/current/utilities/uteval.c haiku/vendor/acpica/current/utilities/utglobal.c haiku/vendor/acpica/current/utilities/utinit.c haiku/vendor/acpica/current/utilities/utmath.c haiku/vendor/acpica/current/utilities/utmisc.c haiku/vendor/acpica/current/utilities/utmutex.c haiku/vendor/acpica/current/utilities/utobject.c haiku/vendor/acpica/current/utilities/utresrc.c haiku/vendor/acpica/current/utilities/utstate.c haiku/vendor/acpica/current/utilities/uttrack.c haiku/vendor/acpica/current/utilities/utxface.c Log: updated acpica with version 20080321 Modified: haiku/vendor/acpica/current/common/16bit.h =================================================================== --- haiku/vendor/acpica/current/common/16bit.h 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/16bit.h 2008-04-02 18:32:56 UTC (rev 24754) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/vendor/acpica/current/common/a16find.c =================================================================== --- haiku/vendor/acpica/current/common/a16find.c 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/a16find.c 2008-04-02 18:32:56 UTC (rev 24754) @@ -2,7 +2,7 @@ * * Module Name: a16find - 16-bit (real mode) routines to find ACPI * tables in memory - * $Revision: 1.41 $ + * $Revision: 1.43 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/vendor/acpica/current/common/a16utils.obj =================================================================== (Binary files differ) Modified: haiku/vendor/acpica/current/common/adfile.c =================================================================== --- haiku/vendor/acpica/current/common/adfile.c 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/adfile.c 2008-04-02 18:32:56 UTC (rev 24754) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adfile - Application-level disassembler file support routines - * $Revision: 1.2 $ + * $Revision: 1.4 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/vendor/acpica/current/common/adisasm.c =================================================================== --- haiku/vendor/acpica/current/common/adisasm.c 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/adisasm.c 2008-04-02 18:32:56 UTC (rev 24754) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adisasm - Application-level disassembler routines - * $Revision: 1.103 $ + * $Revision: 1.112 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -372,7 +372,7 @@ ACPI_STATUS Status; char *DisasmFilename = NULL; FILE *File = NULL; - ACPI_TABLE_HEADER *Table; + ACPI_TABLE_HEADER *Table = NULL; ACPI_TABLE_HEADER *ExternalTable; @@ -470,7 +470,7 @@ { /* Always parse the tables, only option is what to display */ - Status = AdParseTable (Table); + Status = AdParseTable (Table, TRUE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not parse ACPI tables, %s\n", @@ -547,7 +547,9 @@ Status = AcpiNsRootInitialize (); AdAddExternalsToNamespace (); - Status = AdParseTable (Table); + /* Parse table. No need to reload it, however (FALSE) */ + + Status = AdParseTable (Table, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not parse ACPI tables, %s\n", @@ -573,6 +575,17 @@ } Cleanup: + + if (Table && !AcpiUtIsAmlTable (Table)) + { + ACPI_FREE (Table); + } + + if (DisasmFilename) + { + ACPI_FREE (DisasmFilename); + } + if (OutToFile && File) { @@ -585,7 +598,8 @@ } AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - return Status; + AcpiGbl_ParseOpRoot = NULL; + return (Status); } @@ -640,19 +654,36 @@ ACPI_TABLE_HEADER *Table) { char *NewFilename; + UINT8 Checksum; + /* + * Print file header and dump original table header + */ AdDisassemblerHeader (Filename); AcpiOsPrintf (" *\n * Original Table Header:\n"); AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); AcpiOsPrintf (" * Revision 0x%2.2X\n", Table->Revision); + + /* Print and validate the table checksum */ + + AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); + + Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); + if (Checksum) + { + AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", + (UINT8) (Table->Checksum - Checksum)); + } + AcpiOsPrintf ("\n"); + AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); - AcpiOsPrintf (" * Creator ID \"%.4s\"\n", Table->AslCompilerId); - AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); + AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); + AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); AcpiOsPrintf (" */\n"); /* Create AML output filename based on input filename */ @@ -674,6 +705,8 @@ "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); + + ACPI_FREE (NewFilename); } @@ -904,6 +937,7 @@ case AML_CREATE_BYTE_FIELD_OP: case AML_CREATE_BIT_FIELD_OP: case AML_CREATE_FIELD_OP: + case AML_BANK_FIELD_OP: /* Nothing to do in these cases */ @@ -1046,7 +1080,8 @@ ACPI_STATUS AdParseTable ( - ACPI_TABLE_HEADER *Table) + ACPI_TABLE_HEADER *Table, + BOOLEAN LoadTable) { ACPI_STATUS Status = AE_OK; ACPI_WALK_STATE *WalkState; @@ -1102,16 +1137,19 @@ /* Pass 2 */ - Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table, - Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); - if (ACPI_FAILURE (Status)) + if (LoadTable) { - return Status; + Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table, + Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); + if (ACPI_FAILURE (Status)) + { + return Status; + } } fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0, NULL); if (ACPI_FAILURE (Status)) { return (Status); Modified: haiku/vendor/acpica/current/common/adwalk.c =================================================================== --- haiku/vendor/acpica/current/common/adwalk.c 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/adwalk.c 2008-04-02 18:32:56 UTC (rev 24754) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adwalk - Application-level disassembler parse tree walk routines - * $Revision: 1.5 $ + * $Revision: 1.7 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/vendor/acpica/current/common/dmrestag.c =================================================================== --- haiku/vendor/acpica/current/common/dmrestag.c 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/dmrestag.c 2008-04-02 18:32:56 UTC (rev 24754) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmrestag - Add tags to resource descriptors (Application-level) - * $Revision: 1.10 $ + * $Revision: 1.12 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/vendor/acpica/current/common/dmtable.c =================================================================== --- haiku/vendor/acpica/current/common/dmtable.c 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/dmtable.c 2008-04-02 18:32:56 UTC (rev 24754) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmtable - Support for ACPI tables that contain no AML code - * $Revision: 1.11 $ + * $Revision: 1.16 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -137,6 +137,16 @@ /* These tables map a subtable type to a description string */ +static const char *AcpiDmAsfSubnames[] = +{ + "ASF Information", + "ASF Alerts", + "ASF Remote Control", + "ASF RMCP Boot Options", + "ASF Address", + "Unknown SubTable Type" /* Reserved */ +}; + static const char *AcpiDmDmarSubnames[] = { "Hardware Unit Definition", @@ -144,6 +154,31 @@ "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmHestSubnames[] = +{ + "XPF Machine Check Exception", + "XPF Corrected Machine Check", + "NOT USED???", + "XPF Non-Maskable Interrupt", + "IPF Corrected Machine Check", + "IPF Corrected Platform Error", + "PCI Express Root Port AER", + "PCI Express AER (AER Endpoint)", + "PCI Express/PCI-X Bridge AERn", + "Generic Hardware Error Source", + "Unknown SubTable Type" /* Reserved */ +}; + +static const char *AcpiDmHestNotifySubnames[] = +{ + "Polled", + "External Interrupt", + "Local Interrupt", + "SCI", + "NMI", + "Unknown Notify Type" /* Reserved */ +}; + static const char *AcpiDmMadtSubnames[] = { "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ @@ -180,16 +215,21 @@ { {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"}, + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"}, {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"}, {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"}, {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"}, + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"}, + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"}, {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"}, + {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"}, {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"}, {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"}, + {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"}, {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"}, @@ -284,6 +324,7 @@ AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMTABLE_DATA *TableData; UINT32 Length; @@ -314,7 +355,11 @@ * All other tables must use the common ACPI table header, dump it now */ Length = Table->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + if (ACPI_FAILURE (Status)) + { + return; + } AcpiOsPrintf ("\n"); /* Match signature and dispatch appropriately */ @@ -419,7 +464,7 @@ * TableOffset - Starting offset within the table for this * sub-descriptor (0 if main table) * Table - The ACPI table - * SubtableLength - Lenghth of this sub-descriptor + * SubtableLength - Length of this sub-descriptor * Info - Info table for this ACPI table * * RETURN: None @@ -428,7 +473,7 @@ * ******************************************************************************/ -void +ACPI_STATUS AcpiDmDumpTable ( UINT32 TableLength, UINT32 TableOffset, @@ -442,12 +487,13 @@ UINT8 Temp8; UINT16 Temp16; ACPI_DMTABLE_DATA *TableData; + BOOLEAN LastOutputBlankLine = FALSE; if (!Info) { AcpiOsPrintf ("Display not implemented\n"); - return; + return (AE_NOT_IMPLEMENTED); } /* Walk entire Info table; Null name terminates */ @@ -466,7 +512,8 @@ if ((CurrentOffset >= TableLength) || (SubtableLength && (Info->Offset >= SubtableLength))) { - return; + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); } /* Generate the byte length for this field */ @@ -478,10 +525,13 @@ case ACPI_DMT_SPACEID: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: + case ACPI_DMT_ASF: + case ACPI_DMT_HESTNTYP: ByteLength = 1; break; case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: + case ACPI_DMT_HEST: ByteLength = 2; break; case ACPI_DMT_UINT24: @@ -506,14 +556,32 @@ ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; break; case ACPI_DMT_GAS: - AcpiOsPrintf ("\n"); + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } ByteLength = sizeof (ACPI_GENERIC_ADDRESS); break; + case ACPI_DMT_HESTNTFY: + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } + ByteLength = sizeof (ACPI_HEST_NOTIFY); + break; default: ByteLength = 0; break; } + if (CurrentOffset + ByteLength > TableLength) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); + } + /* Start a new line and decode the opcode */ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); @@ -571,9 +639,11 @@ case ACPI_DMT_UINT56: - AcpiOsPrintf ("%6.6X%8.8X\n", - ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF, - ACPI_LODWORD (ACPI_GET64 (Target))); + for (Temp8 = 0; Temp8 < 7; Temp8++) + { + AcpiOsPrintf ("%2.2X", Target[Temp8]); + } + AcpiOsPrintf ("\n"); break; case ACPI_DMT_UINT64: @@ -649,8 +719,23 @@ AcpiOsPrintf ("\n"); AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, CurrentOffset, Target, 0, AcpiDmTableInfoGas); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; break; + case ACPI_DMT_ASF: + + /* ASF subtable types */ + + Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ + if (Temp16 > ACPI_ASF_TYPE_RESERVED) + { + Temp16 = ACPI_ASF_TYPE_RESERVED; + } + + AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); + break; + case ACPI_DMT_DMAR: /* DMAR subtable types */ @@ -664,6 +749,42 @@ AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]); break; + case ACPI_DMT_HEST: + + /* HEST subtable types */ + + Temp16 = *Target; + if (Temp16 > ACPI_HEST_TYPE_RESERVED) + { + Temp16 = ACPI_HEST_TYPE_RESERVED; + } + + AcpiOsPrintf ("%4.4X (%s)\n", *Target, AcpiDmHestSubnames[Temp16]); + break; + + case ACPI_DMT_HESTNTFY: + + AcpiOsPrintf ("\n"); + AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, + CurrentOffset, Target, 0, AcpiDmTableInfoHestNotify); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + break; + + case ACPI_DMT_HESTNTYP: + + /* HEST Notify types */ + + Temp8 = *Target; + if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) + { + Temp8 = ACPI_HEST_NOTIFY_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); + break; + + case ACPI_DMT_MADT: /* MADT subtable types */ @@ -691,14 +812,16 @@ break; case ACPI_DMT_EXIT: - return; + return (AE_OK); default: ACPI_ERROR ((AE_INFO, "**** Invalid table opcode [%X] ****\n", Info->Opcode)); - return; + return (AE_SUPPORT); } } + + return (AE_OK); } Modified: haiku/vendor/acpica/current/common/dmtbdump.c =================================================================== --- haiku/vendor/acpica/current/common/dmtbdump.c 2008-04-02 16:09:48 UTC (rev 24753) +++ haiku/vendor/acpica/current/common/dmtbdump.c 2008-04-02 18:32:56 UTC (rev 24754) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code - * $Revision: 1.14 $ + * $Revision: 1.18 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -289,6 +289,7 @@ AcpiDmDumpAsf ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_HEADER); ACPI_ASF_INFO *SubTable; ACPI_DMTABLE_INFO *InfoTable; @@ -307,7 +308,12 @@ { /* Common sub-table header */ - AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, AcpiDmTableInfoAsfHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ { @@ -349,9 +355,13 @@ return; } - AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } - /* Dump variable-length extra data */ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ @@ -362,7 +372,12 @@ for (i = 0; i < DataCount; i++) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable); + Status = AcpiDmDumpTable (Table->Length, DataOffset, + DataTable, DataLength, DataInfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength); DataOffset += DataLength; @@ -381,6 +396,11 @@ AcpiOsPrintf ("%2.2X ", *DataTable); DataTable++; DataOffset++; + if (DataOffset > Table->Length) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return; + } } AcpiOsPrintf ("\n"); @@ -391,6 +411,12 @@ /* Point to next sub-table */ + if (!SubTable->Header.Length) + { + AcpiOsPrintf ("Invalid zero subtable header length\n"); + return; + } + Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length); } @@ -414,6 +440,7 @@ AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_CPEP_POLLING *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CPEP); @@ -421,7 +448,11 @@ /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -429,7 +460,12 @@ while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoCpep0); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table */ @@ -456,6 +492,7 @@ AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMAR_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DMAR); @@ -468,7 +505,11 @@ /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -478,7 +519,12 @@ /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoDmarHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Type) { @@ -495,7 +541,12 @@ return; } - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } /* * Currently, a common flag indicates whether there are any @@ -509,8 +560,12 @@ while (ScopeOffset < SubTable->Length) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, - ScopeTable->Length, AcpiDmTableInfoDmarScope); + Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, + ScopeTable->Length, AcpiDmTableInfoDmarScope); + if (ACPI_FAILURE (Status)) + { + return; + } /* Dump the PCI Path entries for this device scope */ @@ -548,6 +603,180 @@ /******************************************************************************* * + * FUNCTION: AcpiDmDumpEinj + * + * PARAMETERS: Table - A EINJ table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a EINJ. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpEinj ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_EINJ); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpErst + * + * PARAMETERS: Table - A ERST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a ERST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpErst ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_ERST); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpHest + * + * PARAMETERS: Table - A HEST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a HEST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpHest ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_HEST_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_HEST); + ACPI_DMTABLE_INFO *InfoTable; + UINT32 SubTableLength; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* TBD: add new subtable types as examples become available */ + + switch (SubTable->Type) + { + case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE: + InfoTable = AcpiDmTableInfoHest9; + SubTableLength = sizeof (ACPI_HEST_GENERIC); + break; + + default: + AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type); + return; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += SubTableLength; + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpMadt * * PARAMETERS: Table - A MADT table @@ -563,6 +792,7 @@ AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_SUBTABLE_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_MADT); @@ -571,7 +801,11 @@ /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -581,7 +815,12 @@ /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoMadtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } [... truncated: 15886 lines follow ...] From korli at mail.berlios.de Wed Apr 2 20:34:33 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 2 Apr 2008 20:34:33 +0200 Subject: [Haiku-commits] r24755 - haiku/vendor/acpica Message-ID: <200804021834.m32IYXwH023701@sheep.berlios.de> Author: korli Date: 2008-04-02 20:34:33 +0200 (Wed, 02 Apr 2008) New Revision: 24755 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24755&view=rev Added: haiku/vendor/acpica/20080321/ Log: tagging acpica-20080321 Copied: haiku/vendor/acpica/20080321 (from rev 24754, haiku/vendor/acpica/current) From julun at mail.berlios.de Wed Apr 2 21:18:00 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Wed, 2 Apr 2008 21:18:00 +0200 Subject: [Haiku-commits] r24756 - haiku/trunk/src/system/libroot/posix Message-ID: <200804021918.m32JI0oM027530@sheep.berlios.de> Author: julun Date: 2008-04-02 21:17:59 +0200 (Wed, 02 Apr 2008) New Revision: 24756 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24756&view=rev Modified: haiku/trunk/src/system/libroot/posix/grp.cpp haiku/trunk/src/system/libroot/posix/pwd.cpp haiku/trunk/src/system/libroot/posix/user_group_common.cpp Log: * gcc4 build fix Modified: haiku/trunk/src/system/libroot/posix/grp.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/grp.cpp 2008-04-02 18:34:33 UTC (rev 24755) +++ haiku/trunk/src/system/libroot/posix/grp.cpp 2008-04-02 19:17:59 UTC (rev 24756) @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -108,7 +109,7 @@ if (sGroupDB != NULL) return sGroupDB; - sGroupDB = new(nothrow) GroupDB; + sGroupDB = new(std::nothrow) GroupDB; if (sGroupDB == NULL) return NULL; Modified: haiku/trunk/src/system/libroot/posix/pwd.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/pwd.cpp 2008-04-02 18:34:33 UTC (rev 24755) +++ haiku/trunk/src/system/libroot/posix/pwd.cpp 2008-04-02 19:17:59 UTC (rev 24756) @@ -6,6 +6,7 @@ #include #include +#include #include #include @@ -73,7 +74,7 @@ if (sPasswdDB != NULL) return sPasswdDB; - sPasswdDB = new(nothrow) PasswdDB; + sPasswdDB = new(std::nothrow) PasswdDB; if (sPasswdDB == NULL) return NULL; Modified: haiku/trunk/src/system/libroot/posix/user_group_common.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/user_group_common.cpp 2008-04-02 18:34:33 UTC (rev 24755) +++ haiku/trunk/src/system/libroot/posix/user_group_common.cpp 2008-04-02 19:17:59 UTC (rev 24756) @@ -520,7 +520,7 @@ PasswdDB::HandleEntry(const char* name, const char* password, uid_t uid, gid_t gid, const char* home, const char* shell, const char* realName) { - PasswdDBEntry* entry = new(nothrow) PasswdDBEntry(); + PasswdDBEntry* entry = new(std::nothrow) PasswdDBEntry(); if (entry == NULL || !entry->Init(name, password, uid, gid, home, shell, realName)) { delete entry; @@ -692,7 +692,7 @@ GroupDB::HandleEntry(const char* name, const char* password, gid_t gid, const char* const* members, int memberCount) { - GroupDBEntry* entry = new(nothrow) GroupDBEntry(); + GroupDBEntry* entry = new(std::nothrow) GroupDBEntry(); if (entry == NULL || !entry->Init(name, password, gid, members, memberCount)) { delete entry; From bonefish at mail.berlios.de Wed Apr 2 22:29:43 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Wed, 2 Apr 2008 22:29:43 +0200 Subject: [Haiku-commits] r24757 - in haiku/trunk: . build/jam Message-ID: <200804022029.m32KThf5001736@sheep.berlios.de> Author: bonefish Date: 2008-04-02 22:29:43 +0200 (Wed, 02 Apr 2008) New Revision: 24757 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24757&view=rev Modified: haiku/trunk/Jamrules haiku/trunk/build/jam/BuildSetup haiku/trunk/build/jam/HaikuImage haiku/trunk/build/jam/MiscRules haiku/trunk/build/jam/UserBuildConfig.ReadMe Log: Added a new fancy build system feature called "build profiles". Especially people building various kinds of images with different settings may want to have a look at the respective section in the UserBuildConfig.ReadMe. Modified: haiku/trunk/Jamrules =================================================================== --- haiku/trunk/Jamrules 2008-04-02 19:17:59 UTC (rev 24756) +++ haiku/trunk/Jamrules 2008-04-02 20:29:43 UTC (rev 24757) @@ -45,4 +45,15 @@ } } +# If a build profile was specified on the command line, now is the time to +# check whether it is unknown or one of the default profiles. +if $(HAIKU_BUILD_PROFILE) && ! $(HAIKU_BUILD_PROFILE_DEFINED) { + # define the obvious default profiles + if $(HAIKU_BUILD_PROFILE) in image vmware-image install { + DefineBuildProfile $(HAIKU_BUILD_PROFILE) : $(HAIKU_BUILD_PROFILE) ; + } else { + Exit "Build profile" $(HAIKU_BUILD_PROFILE) "not defined." ; + } +} + PrepareConfigVariables ; Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2008-04-02 19:17:59 UTC (rev 24756) +++ haiku/trunk/build/jam/BuildSetup 2008-04-02 20:29:43 UTC (rev 24757) @@ -43,37 +43,63 @@ HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ; +# Haiku image/install defaults +HAIKU_DEFAULT_IMAGE_NAME = haiku.image ; +HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ; +HAIKU_DEFAULT_VMWARE_IMAGE_NAME = haiku.vmdk ; +HAIKU_DEFAULT_INSTALL_DIR = /Haiku ; +HAIKU_DEFAULT_IMAGE_SIZE ?= 100 ; # 100 MB + + # analyze an optionally replace jam's target parameters HAIKU_ORIGINAL_JAM_TARGETS = $(JAM_TARGETS) ; +HAIKU_BUILD_PROFILE = ; if $(JAM_TARGETS) { - # 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". - if $(JAM_TARGETS) = all { - if ! $(INVOCATION_SUBDIR) || $(INVOCATION_SUBDIR) = src { - JAM_TARGETS = haiku-image ; + 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 ; + } } - # The "run" target allows for running arbitrary command lines containing - # build system targets, which are built and replaced accordingly. - } else if $(JAM_TARGETS[1]) = run && $(JAM_TARGETS[2]) { - local run = [ RunCommandLine $(JAM_TARGETS[2-]) ] ; - JAM_TARGETS = $(run) ; + # 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!" ; + } + } - # "update-image", "update-vmware-image", and "update-install" targets allow - # for updating only specific targets in the image/installation dir. - } else if $(JAM_TARGETS[1]) = update-image - || $(JAM_TARGETS[1]) = update-vmware-image - || $(JAM_TARGETS[1]) = update-install { - SetUpdateHaikuImageOnly 1 ; - HAIKU_INCLUDE_IN_IMAGE on $(JAM_TARGETS[2-]) = 1 ; + # 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 = ; + } - 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 ; + 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/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-02 19:17:59 UTC (rev 24756) +++ haiku/trunk/build/jam/HaikuImage 2008-04-02 20:29:43 UTC (rev 24757) @@ -495,14 +495,14 @@ # Set image name and directory defaults and locate the image. -HAIKU_IMAGE_NAME ?= haiku.image ; -HAIKU_IMAGE_DIR ?= $(HAIKU_OUTPUT_DIR) ; -HAIKU_IMAGE ?= $(HAIKU_IMAGE_NAME) ; -HAIKU_IMAGE_SIZE ?= 100 ; # 100 MB +HAIKU_IMAGE_NAME ?= $(HAIKU_DEFAULT_IMAGE_NAME) ; +HAIKU_IMAGE_DIR ?= $(HAIKU_DEFAULT_IMAGE_DIR) ; +HAIKU_IMAGE = $(HAIKU_IMAGE_NAME) ; +HAIKU_IMAGE_SIZE ?= $(HAIKU_DEFAULT_IMAGE_SIZE) ; # 100 MB MakeLocate $(HAIKU_IMAGE) : $(HAIKU_IMAGE_DIR) ; # Set the default installation directory. -HAIKU_INSTALL_DIR ?= /Haiku ; +HAIKU_INSTALL_DIR ?= $(HAIKU_DEFAULT_INSTALL_DIR) ; # the pseudo target all image contents is attached to NotFile $(HAIKU_IMAGE_CONTAINER_NAME) ; @@ -590,8 +590,8 @@ # build the VMware image -HAIKU_VMWARE_IMAGE_NAME ?= haiku.vmdk ; -HAIKU_VMWARE_IMAGE ?= $(HAIKU_VMWARE_IMAGE_NAME) ; +HAIKU_VMWARE_IMAGE_NAME ?= $(HAIKU_DEFAULT_VMWARE_IMAGE_NAME) ; +HAIKU_VMWARE_IMAGE = $(HAIKU_VMWARE_IMAGE_NAME) ; MakeLocate $(HAIKU_VMWARE_IMAGE) : $(HAIKU_IMAGE_DIR) ; _BuildHaikuImage $(HAIKU_VMWARE_IMAGE) : true : true ; Modified: haiku/trunk/build/jam/MiscRules =================================================================== --- haiku/trunk/build/jam/MiscRules 2008-04-02 19:17:59 UTC (rev 24756) +++ haiku/trunk/build/jam/MiscRules 2008-04-02 20:29:43 UTC (rev 24757) @@ -227,3 +227,121 @@ $(COMMAND_LINE) } + +#pragma mark - DefineBuildProfile + + +rule DefineBuildProfile name : type : path { + # DefineBuildProfile : [ : ] + # + # Makes a build profile known. Build profiles can be used to define + # different sets of settings for Haiku images/installations. For each + # profile the default actions "build", "update", and "mount" (the latter + # only for disks or image types) will be available (i.e. can be specified + # as second parameter on the jam command line). They will build an image + # or installation, update only given targets, respectively just mount the + # image or disk using the bfs_shell. + # + # - The name of the build profile. + # - The type of the build profile. Must be one of "image" (plain + # disk image), "vmware-image" (VMware disk image), "disk" + # (actual partition or hard disk device), "install" (installation + # in a directory), or "custom" (user-defined). + # - The path associated with the profile. Depending on the profile + # type, this is the path to the disk image/VMware image, hard + # disk/partition device, or the installation directory. If the + # parameter is omitted, the value of the HAIKU[_VMWARE]_IMAGE_NAME, + # HAIKU_IMAGE_DIR, respectively HAIKU_INSTALL_DIR or their default + # values will be used instead. + + if ! $(HAIKU_BUILD_PROFILE) || $(HAIKU_BUILD_PROFILE) != $(name) { + return ; + } + + HAIKU_BUILD_PROFILE_DEFINED = 1 ; + + # split path into directory path and name + local targetDir = $(path:D) ; + local targetName = $(path:BS) ; + + # Jam's path splitting produces an empty string, if a component doesn't + # exist. That's a little unhandy for checks. + if $(targetDir) = "" { + targetDir = ; + } + if $(targetName) = "" { + targetName = ; + } + + targetDir ?= $(HAIKU_IMAGE_DIR) ; + targetDir ?= $(HAIKU_DEFAULT_IMAGE_DIR) ; + + # "disk" is "image" with HAIKU_DONT_CLEAR_IMAGE + if $(type) = "disk" { + type = "image" ; + HAIKU_DONT_CLEAR_IMAGE = 1 ; + } + + local buildTarget ; + local startOffset ; + + switch $(type) { + case "image" : { + targetName ?= $(HAIKU_IMAGE_NAME) ; + targetName ?= $(HAIKU_DEFAULT_IMAGE_NAME) ; + HAIKU_IMAGE_DIR = $(targetDir) ; + HAIKU_IMAGE_NAME = $(targetName) ; + buildTarget = haiku-image ; + } + + case "vmware-image" : { + targetName ?= $(HAIKU_VMWARE_IMAGE_NAME) ; + targetName ?= $(HAIKU_DEFAULT_VMWARE_IMAGE_NAME) ; + HAIKU_IMAGE_DIR = $(targetDir) ; + HAIKU_VMWARE_IMAGE_NAME = $(targetName) ; + buildTarget = haiku-vmware-image ; + startOffset = --start-offset 65536 ; + } + + case "install" : { + path ?= $(HAIKU_INSTALL_DIR) ; + path ?= $(HAIKU_DEFAULT_INSTALL_DIR) ; + HAIKU_INSTALL_DIR = $(path) ; + buildTarget = install-haiku ; + } + + case "custom" : { + # user-defined -- don't do anything + return 1 ; + } + + case * : { + Exit "Unsupported build profile type: " $(type) ; + } + } + + switch $(HAIKU_BUILD_PROFILE_ACTION) { + case "build" : { + JAM_TARGETS = $(buildTarget) ; + } + + case "update" : { + JAM_TARGETS = $(buildTarget) ; + SetUpdateHaikuImageOnly 1 ; + HAIKU_INCLUDE_IN_IMAGE on $(HAIKU_BUILD_PROFILE_PARAMETERS) = 1 ; + } + + case "mount" : { + if $(type) = "install" { + Exit "Build action \"mount\" not supported for profile type" + "\"install\"." ; + } + + local commandLine = :bfs_shell $(startOffset) + \"$(targetName:D=$(targetDir))\" ; + JAM_TARGETS = [ RunCommandLine $(commandLine) ] ; + } + } + + return 1 ; +} Modified: haiku/trunk/build/jam/UserBuildConfig.ReadMe =================================================================== --- haiku/trunk/build/jam/UserBuildConfig.ReadMe 2008-04-02 19:17:59 UTC (rev 24756) +++ haiku/trunk/build/jam/UserBuildConfig.ReadMe 2008-04-02 20:29:43 UTC (rev 24757) @@ -147,7 +147,79 @@ AddGroupToHaikuImage party : 101 : baron walter ; +# Build Profiles +# A build profile is a named set of settings for building a Haiku image or +# installation. The following lines define five different build profiles: +# disk - Installation on device /dev/sda57. All optional packages will be +# included. Profile type "disk" implies "HAIKU_DONT_CLEAR_IMAGE = 1". +# qemu - A plain 200 MB disk image (type "image") named "haiku-qemu.image". +# Since only the image name is given, the default location will be +# chosen for the image, unless HAIKU_IMAGE_DIR has been set +# beforehand. +# vmware - A 400 MB VMware image (type "vmware-image"). It will not be zeroed, +# if not necessary. The optional packages Development and Pe will be +# installed. No image name or path is given, so the defaults +# ("haiku.vmdk" in the generated directory) will be used, unless the +# respective variables are set. +# crash - Similar to the vmware profile, but created at a specific location +# and 1 GB size. Furthermore a "crash-tests" directory will be copied +# to the image. +# install - Installation in directory "/Haiku2" (type "install"). + +DefineBuildProfile disk : disk : "/dev/sda57" ; +DefineBuildProfile qemu : image : "haiku-qemu.image" ; +DefineBuildProfile vmware : vmware-image ; +DefineBuildProfile crash : vmware-image + : "/home/foobar/vmware/Virtual Machines/CrashOMatic/CrashOMatic.vmdk" ; +DefineBuildProfile install : install : /Haiku2 ; + +switch $(HAIKU_BUILD_PROFILE) { + case "disk" : { + HAIKU_ADD_ALL_OPTIONAL_PACKAGES = 1 ; + } + + case "qemu" : { + HAIKU_IMAGE_SIZE = 200 ; + } + + case "vmware" : { + HAIKU_IMAGE_SIZE = 400 ; + HAIKU_DONT_CLEAR_IMAGE = 1 ; + AddOptionalHaikuImagePackages Development Pe ; + } + + case "crash" : { + HAIKU_IMAGE_SIZE = 1024 ; + HAIKU_DONT_CLEAR_IMAGE = 1 ; + AddOptionalHaikuImagePackages Development Pe ; + CopyDirectoryToHaikuImage home Desktop : $(HAIKU_TOP)/../crash-tests ; + } +} + +# By specifying the build profile name as first (non-option) parameter on the +# jam command line prefixed by an "@" character, the profile will be selected. +# The second parameter specifies the action to be performed, further optional +# parameters may follow. Jam command line examples: +# +# jam -q @disk build +# -> Equivalent to running "jam -q haiku-image" with the settings for the +# "disk" profile. "build" is the default action, so it could even be +# omitted. +# jam -q @vmware update kernel +# -> Equivalent to running "jam -q update-vmware-image kernel" with the +# settings for the "vmware" profile. +# jam -q @crash mount +# -> Enters the bfs_shell mounting the image specified by the "crash" profile. +# +# Note, that the build system will automatically define the build profiles +# "image", "vmware-image", and "install", unless they are already defined in +# the UserBuildConfig. They correspond to the respective build profile types +# and use the values of the variables HAIKU[_VMWARE]_IMAGE_NAME, +# HAIKU_IMAGE_DIR, HAIKU_INSTALL_DIR, respectively their default values. +# "jam -q @image" will therefore be equivalent to "jam -q haiku-image". + + # Creating Sourceable Shell Scripts # If you use shell scripts (e.g. for testing) that need to access targets or From ingo_weinhold at gmx.de Wed Apr 2 22:24:20 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 02 Apr 2008 22:24:20 +0200 Subject: [Haiku-commits] r24756 - haiku/trunk/src/system/libroot/posix In-Reply-To: <200804021918.m32JI0oM027530@sheep.berlios.de> References: <200804021918.m32JI0oM027530@sheep.berlios.de> Message-ID: <20080402222420.855.4@knochen-vm.1207149079.fake> On 2008-04-02 at 21:18:00 [+0200], julun at BerliOS wrote: > Author: julun > Date: 2008-04-02 21:17:59 +0200 (Wed, 02 Apr 2008) > New Revision: 24756 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24756&view=rev > > Modified: > haiku/trunk/src/system/libroot/posix/grp.cpp > haiku/trunk/src/system/libroot/posix/pwd.cpp > haiku/trunk/src/system/libroot/posix/user_group_common.cpp > Log: > * gcc4 build fix Thank! I always tend to forget those. CU, Ingo From korli at mail.berlios.de Wed Apr 2 22:58:55 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 2 Apr 2008 22:58:55 +0200 Subject: [Haiku-commits] r24758 - in haiku/trunk: headers/libs/png src/libs/png Message-ID: <200804022058.m32KwtUN003855@sheep.berlios.de> Author: korli Date: 2008-04-02 22:58:54 +0200 (Wed, 02 Apr 2008) New Revision: 24758 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24758&view=rev Modified: haiku/trunk/headers/libs/png/png.h haiku/trunk/headers/libs/png/pngconf.h haiku/trunk/src/libs/png/png.c haiku/trunk/src/libs/png/pngerror.c haiku/trunk/src/libs/png/pngmem.c haiku/trunk/src/libs/png/pngpread.c haiku/trunk/src/libs/png/pngread.c haiku/trunk/src/libs/png/pngrtran.c haiku/trunk/src/libs/png/pngrutil.c haiku/trunk/src/libs/png/pngset.c haiku/trunk/src/libs/png/pngwrite.c haiku/trunk/src/libs/png/pngwutil.c Log: updated libpng to 1.2.26 Modified: haiku/trunk/headers/libs/png/png.h =================================================================== --- haiku/trunk/headers/libs/png/png.h 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/headers/libs/png/png.h 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,15 +1,15 @@ /* png.h - header file for PNG reference library * - * libpng version 1.2.22 - October 13, 2007 - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * libpng version 1.2.26 - April 2, 2008 + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * * Authors and maintainers: * libpng versions 0.71, May 1995, through 0.88, January 1996: Guy Schalnat * libpng versions 0.89c, June 1996, through 0.96, May 1997: Andreas Dilger - * libpng versions 0.97, January 1998, through 1.2.22 - October 13, 2007: Glenn + * libpng versions 0.97, January 1998, through 1.2.26 - April 2, 2008: Glenn * See also "Contributing Authors", below. * * Note about libpng version numbers: @@ -169,6 +169,18 @@ * 1.2.22rc1 13 10222 12.so.0.22[.0] * 1.0.30 10 10030 10.so.0.30[.0] * 1.2.22 13 10222 12.so.0.22[.0] + * 1.2.23beta01-05 13 10223 12.so.0.23[.0] + * 1.2.23rc01 13 10223 12.so.0.23[.0] + * 1.2.23 13 10223 12.so.0.23[.0] + * 1.2.24beta01-02 13 10224 12.so.0.24[.0] + * 1.2.24rc01 13 10224 12.so.0.24[.0] + * 1.2.24 13 10224 12.so.0.24[.0] + * 1.2.25beta01-06 13 10225 12.so.0.25[.0] + * 1.2.25rc01-02 13 10225 12.so.0.25[.0] + * 1.0.31 10 10031 10.so.0.31[.0] + * 1.2.25 13 10225 12.so.0.25[.0] + * 1.2.26beta01-06 13 10226 12.so.0.26[.0] + * 1.2.26rc01 13 10226 12.so.0.26[.0] * * Henceforth the source version will match the shared-library major * and minor numbers; the shared-library major version number will be @@ -198,8 +210,8 @@ * If you modify libpng you may insert additional notices immediately following * this sentence. * - * libpng versions 1.2.6, August 15, 2004, through 1.2.22, October 13, 2007, are - * Copyright (c) 2004, 2006-2007 Glenn Randers-Pehrson, and are + * libpng versions 1.2.6, August 15, 2004, through 1.2.26, April 2, 2008, are + * Copyright (c) 2004, 2006-2008 Glenn Randers-Pehrson, and are * distributed according to the same disclaimer and license as libpng-1.2.5 * with the following individual added to the list of Contributing Authors: * @@ -310,13 +322,13 @@ * Y2K compliance in libpng: * ========================= * - * October 13, 2007 + * April 2, 2008 * * Since the PNG Development group is an ad-hoc body, we can't make * an official declaration. * * This is your unofficial assurance that libpng from version 0.71 and - * upward through 1.2.22 are Y2K compliant. It is my belief that earlier + * upward through 1.2.26 are Y2K compliant. It is my belief that earlier * versions were also Y2K compliant. * * Libpng only has three year fields. One is a 2-byte unsigned integer @@ -372,9 +384,9 @@ */ /* Version information for png.h - this should match the version in png.c */ -#define PNG_LIBPNG_VER_STRING "1.2.22" +#define PNG_LIBPNG_VER_STRING "1.2.26" #define PNG_HEADER_VERSION_STRING \ - " libpng version 1.2.22 - October 13, 2007\n" + " libpng version 1.2.26 - April 2, 2008\n" #define PNG_LIBPNG_VER_SONUM 0 #define PNG_LIBPNG_VER_DLLNUM 13 @@ -382,7 +394,7 @@ /* These should match the first 3 components of PNG_LIBPNG_VER_STRING: */ #define PNG_LIBPNG_VER_MAJOR 1 #define PNG_LIBPNG_VER_MINOR 2 -#define PNG_LIBPNG_VER_RELEASE 22 +#define PNG_LIBPNG_VER_RELEASE 26 /* This should match the numeric part of the final component of * PNG_LIBPNG_VER_STRING, omitting any leading zero: */ @@ -410,7 +422,7 @@ * Versions 0.7 through 1.0.0 were in the range 0 to 100 here (only * version 1.0.0 was mis-numbered 100 instead of 10000). From * version 1.0.1 it's xxyyzz, where x=major, y=minor, z=release */ -#define PNG_LIBPNG_VER 10222 /* 1.2.22 */ +#define PNG_LIBPNG_VER 10226 /* 1.2.26 */ #ifndef PNG_VERSION_INFO_ONLY /* include the compression library's header */ @@ -651,9 +663,10 @@ * up private chunks for output even though the library doesn't actually * know about their semantics. */ +#define PNG_CHUNK_NAME_LENGTH 5 typedef struct png_unknown_chunk_t { - png_byte name[5]; + png_byte name[PNG_CHUNK_NAME_LENGTH]; png_byte *data; png_size_t size; @@ -1180,10 +1193,12 @@ png_uint_32 row_number; /* current row in interlace pass */ png_bytep prev_row; /* buffer to save previous (unfiltered) row */ png_bytep row_buf; /* buffer to save current (unfiltered) row */ +#ifndef PNG_NO_WRITE_FILTERING png_bytep sub_row; /* buffer to save "sub" row when filtering */ png_bytep up_row; /* buffer to save "up" row when filtering */ png_bytep avg_row; /* buffer to save "avg" row when filtering */ png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */ +#endif png_row_info row_info; /* used for transformation routines */ png_uint_32 idat_size; /* current IDAT size for read */ @@ -1415,13 +1430,16 @@ /* storage for unknown chunk that the library doesn't recognize. */ png_unknown_chunk unknown_chunk; #endif + +/* New members added in libpng-1.2.26 */ + png_uint_32 old_big_row_buf_size, old_prev_row_size; }; /* This triggers a compiler error in png.c, if png.c and png.h * do not agree upon the version number. */ -typedef png_structp version_1_2_22; +typedef png_structp version_1_2_26; typedef png_struct FAR * FAR * png_structpp; Modified: haiku/trunk/headers/libs/png/pngconf.h =================================================================== --- haiku/trunk/headers/libs/png/pngconf.h 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/headers/libs/png/pngconf.h 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngconf.h - machine configurable file for libpng * - * libpng version 1.2.22 - October 13, 2007 + * libpng version 1.2.26 - April 2, 2008 * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -323,7 +323,7 @@ /* If you encounter a compiler error here, see the explanation * near the end of INSTALL. */ - __png.h__ already includes setjmp.h; + __pngconf.h__ already includes setjmp.h; __dont__ include it again.; # endif # endif /* __linux__ */ @@ -333,7 +333,9 @@ # ifdef __linux__ # ifdef PNG_SAVE_BSD_SOURCE -# define _BSD_SOURCE +# ifndef _BSD_SOURCE +# define _BSD_SOURCE +# endif # undef PNG_SAVE_BSD_SOURCE # endif # endif /* __linux__ */ @@ -1430,8 +1432,6 @@ # define CVT_PTR(ptr) (png_far_to_near(png_ptr,ptr,CHECK)) # define CVT_PTR_NOCHECK(ptr) (png_far_to_near(png_ptr,ptr,NOCHECK)) # define png_snprintf _fsnprintf /* Added to v 1.2.19 */ -# define png_strcpy _fstrcpy -# define png_strncpy _fstrncpy /* Added to v 1.2.6 */ # define png_strlen _fstrlen # define png_memcmp _fmemcmp /* SJT: added */ # define png_memcpy _fmemcpy @@ -1460,8 +1460,6 @@ # define png_snprintf6(s1,n,fmt,x1,x2,x3,x4,x5,x6) \ sprintf(s1,fmt,x1,x2,x3,x4,x5,x6) # endif -# define png_strcpy strcpy -# define png_strncpy strncpy /* Added to v 1.2.6 */ # define png_strlen strlen # define png_memcmp memcmp /* SJT: added */ # define png_memcpy memcpy Modified: haiku/trunk/src/libs/png/png.c =================================================================== --- haiku/trunk/src/libs/png/png.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/png.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -13,7 +13,7 @@ #include "png.h" /* Generate a compiler error if there is an old png.h in the search path. */ -typedef version_1_2_22 Your_png_h_is_not_version_1_2_22; +typedef version_1_2_26 Your_png_h_is_not_version_1_2_26; /* Version information for C files. This had better match the version * string defined in png.h. */ @@ -693,8 +693,8 @@ png_get_copyright(png_structp png_ptr) { png_ptr = png_ptr; /* silence compiler warning about unused png_ptr */ - return ((png_charp) "\n libpng version 1.2.22 - October 13, 2007\n\ - Copyright (c) 1998-2007 Glenn Randers-Pehrson\n\ + return ((png_charp) "\n libpng version 1.2.26 - April 2, 2008\n\ + Copyright (c) 1998-2008 Glenn Randers-Pehrson\n\ Copyright (c) 1996-1997 Andreas Dilger\n\ Copyright (c) 1995-1996 Guy Eric Schalnat, Group 42, Inc.\n"); } Modified: haiku/trunk/src/libs/png/pngerror.c =================================================================== --- haiku/trunk/src/libs/png/pngerror.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngerror.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -136,6 +136,8 @@ 'A', 'B', 'C', 'D', 'E', 'F' }; +#define PNG_MAX_ERROR_TEXT 64 + #if !defined(PNG_NO_WARNINGS) || !defined(PNG_NO_ERROR_TEXT) static void /* PRIVATE */ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp @@ -165,8 +167,8 @@ { buffer[iout++] = ':'; buffer[iout++] = ' '; - png_strncpy(buffer+iout, error_message, 63); - buffer[iout+63] = '\0'; + png_memcpy(buffer+iout, error_message, PNG_MAX_ERROR_TEXT); + buffer[iout+PNG_MAX_ERROR_TEXT-1] = '\0'; } } @@ -174,7 +176,7 @@ void PNGAPI png_chunk_error(png_structp png_ptr, png_const_charp error_message) { - char msg[18+64]; + char msg[18+PNG_MAX_ERROR_TEXT]; if (png_ptr == NULL) png_error(png_ptr, error_message); else @@ -190,7 +192,7 @@ void PNGAPI png_chunk_warning(png_structp png_ptr, png_const_charp warning_message) { - char msg[18+64]; + char msg[18+PNG_MAX_ERROR_TEXT]; if (png_ptr == NULL) png_warning(png_ptr, warning_message); else Modified: haiku/trunk/src/libs/png/pngmem.c =================================================================== --- haiku/trunk/src/libs/png/pngmem.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngmem.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngmem.c - stub functions for memory allocation * - * Last changed in libpng 1.2.13 November 13, 2006 + * Last changed in libpng 1.2.26 [April 2, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2006 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -456,7 +456,7 @@ if (size > (png_uint_32)65536L) { #ifndef PNG_USER_MEM_SUPPORTED - if(png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) + if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0) png_error(png_ptr, "Cannot Allocate > 64K"); else #endif Modified: haiku/trunk/src/libs/png/pngpread.c =================================================================== --- haiku/trunk/src/libs/png/pngpread.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngpread.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngpread.c - read a png file in push mode * - * Last changed in libpng 1.2.22 [October 13, 2007] + * Last changed in libpng 1.2.26 [April 2, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -28,7 +28,7 @@ png_process_data(png_structp png_ptr, png_infop info_ptr, png_bytep buffer, png_size_t buffer_size) { - if(png_ptr == NULL) return; + if(png_ptr == NULL || info_ptr == NULL) return; png_push_restore_buffer(png_ptr, buffer, buffer_size); while (png_ptr->buffer_size) @@ -224,6 +224,8 @@ { if (png_ptr->push_length + 4 > png_ptr->buffer_size) { + if (png_ptr->push_length != 13) + png_error(png_ptr, "Invalid IHDR length"); png_push_save_buffer(png_ptr); return; } @@ -1018,33 +1020,38 @@ png_ptr->rowbytes + 1); do { - png_ptr->pass++; - if ((png_ptr->pass == 1 && png_ptr->width < 5) || - (png_ptr->pass == 3 && png_ptr->width < 3) || - (png_ptr->pass == 5 && png_ptr->width < 2)) - png_ptr->pass++; + int pass; + pass = png_ptr->pass; + pass++; + if ((pass == 1 && png_ptr->width < 5) || + (pass == 3 && png_ptr->width < 3) || + (pass == 5 && png_ptr->width < 2)) + pass++; - if (png_ptr->pass > 7) - png_ptr->pass--; - if (png_ptr->pass >= 7) - break; + if (pass > 7) + pass--; + png_ptr->pass = (png_byte) pass; + if (pass < 7) + { + png_ptr->iwidth = (png_ptr->width + + png_pass_inc[pass] - 1 - + png_pass_start[pass]) / + png_pass_inc[pass]; - png_ptr->iwidth = (png_ptr->width + - png_pass_inc[png_ptr->pass] - 1 - - png_pass_start[png_ptr->pass]) / - png_pass_inc[png_ptr->pass]; + png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, + png_ptr->iwidth) + 1; - png_ptr->irowbytes = PNG_ROWBYTES(png_ptr->pixel_depth, - png_ptr->iwidth) + 1; + if (png_ptr->transformations & PNG_INTERLACE) + break; - if (png_ptr->transformations & PNG_INTERLACE) - break; + png_ptr->num_rows = (png_ptr->height + + png_pass_yinc[pass] - 1 - + png_pass_ystart[pass]) / + png_pass_yinc[pass]; + } + else + break; - png_ptr->num_rows = (png_ptr->height + - png_pass_yinc[png_ptr->pass] - 1 - - png_pass_ystart[png_ptr->pass]) / - png_pass_yinc[png_ptr->pass]; - } while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0); } } @@ -1490,9 +1497,11 @@ length = (png_uint_32)65535L; } #endif - png_strncpy((png_charp)png_ptr->unknown_chunk.name, - (png_charp)png_ptr->chunk_name, 4); - png_ptr->unknown_chunk.name[4] = '\0'; + png_memcpy((png_charp)png_ptr->unknown_chunk.name, + (png_charp)png_ptr->chunk_name, + png_sizeof(png_ptr->unknown_chunk.name)); + png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1]='\0'; + png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); png_ptr->unknown_chunk.size = (png_size_t)length; png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); @@ -1515,9 +1524,9 @@ &png_ptr->unknown_chunk, 1); } } -#else - png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); + else #endif + png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); png_free(png_ptr, png_ptr->unknown_chunk.data); png_ptr->unknown_chunk.data = NULL; } Modified: haiku/trunk/src/libs/png/pngread.c =================================================================== --- haiku/trunk/src/libs/png/pngread.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngread.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngread.c - read a PNG file * - * Last changed in libpng 1.2.20 September 7, 2007 + * Last changed in libpng 1.2.25 [February 18, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -89,12 +89,18 @@ png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); - i=0; - do + if(user_png_ver) { - if(user_png_ver[i] != png_libpng_ver[i]) + i=0; + do + { + if(user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + } + else png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; - } while (png_libpng_ver[i++]); + if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) { @@ -318,7 +324,7 @@ void PNGAPI png_read_info(png_structp png_ptr, png_infop info_ptr) { - if(png_ptr == NULL) return; + if(png_ptr == NULL || info_ptr == NULL) return; png_debug(1, "in png_read_info\n"); /* If we haven't checked all of the PNG signature bytes, do so now. */ if (png_ptr->sig_bytes < 8) @@ -1099,25 +1105,29 @@ png_structp png_ptr = NULL; png_infop info_ptr = NULL, end_info_ptr = NULL; #ifdef PNG_USER_MEM_SUPPORTED - png_free_ptr free_fn; - png_voidp mem_ptr; + png_free_ptr free_fn = NULL; + png_voidp mem_ptr = NULL; #endif png_debug(1, "in png_destroy_read_struct\n"); if (png_ptr_ptr != NULL) + { png_ptr = *png_ptr_ptr; + } + if (png_ptr == NULL) + return; +#ifdef PNG_USER_MEM_SUPPORTED + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; +#endif + if (info_ptr_ptr != NULL) info_ptr = *info_ptr_ptr; if (end_info_ptr_ptr != NULL) end_info_ptr = *end_info_ptr_ptr; -#ifdef PNG_USER_MEM_SUPPORTED - free_fn = png_ptr->free_fn; - mem_ptr = png_ptr->mem_ptr; -#endif - png_read_destroy(png_ptr, info_ptr, end_info_ptr); if (info_ptr != NULL) @@ -1149,16 +1159,13 @@ *end_info_ptr_ptr = NULL; } - if (png_ptr != NULL) - { #ifdef PNG_USER_MEM_SUPPORTED - png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, - (png_voidp)mem_ptr); + png_destroy_struct_2((png_voidp)png_ptr, (png_free_ptr)free_fn, + (png_voidp)mem_ptr); #else - png_destroy_struct((png_voidp)png_ptr); + png_destroy_struct((png_voidp)png_ptr); #endif - *png_ptr_ptr = NULL; - } + *png_ptr_ptr = NULL; } /* free all memory used by the read (old method) */ Modified: haiku/trunk/src/libs/png/pngrtran.c =================================================================== --- haiku/trunk/src/libs/png/pngrtran.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngrtran.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngrtran.c - transforms the data in a row for PNG readers * - * Last changed in libpng 1.2.22 [October 13, 2007] + * Last changed in libpng 1.2.25 [February 18, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -964,6 +964,14 @@ palette[i].blue = png_ptr->gamma_table[palette[i].blue]; } } + /* Prevent the transformations being done again, and make sure + * that the now spurious alpha channel is stripped - the code + * has just reduced background composition and gamma correction + * to a simply alpha channel strip. + */ + png_ptr->transformations &= ~PNG_BACKGROUND; + png_ptr->transformations &= ~PNG_GAMMA; + png_ptr->transformations |= PNG_STRIP_ALPHA; } /* if (png_ptr->background_gamma_type!=PNG_BACKGROUND_GAMMA_UNKNOWN) */ else @@ -1038,6 +1046,9 @@ palette[i].green = png_ptr->gamma_table[palette[i].green]; palette[i].blue = png_ptr->gamma_table[palette[i].blue]; } + + /* Done the gamma correction. */ + png_ptr->transformations &= ~PNG_GAMMA; } } #if defined(PNG_READ_BACKGROUND_SUPPORTED) @@ -1075,6 +1086,10 @@ png_ptr->trans[i], back.blue); } } + + /* Handled alpha, still need to strip the channel. */ + png_ptr->transformations &= ~PNG_BACKGROUND; + png_ptr->transformations |= PNG_STRIP_ALPHA; } #endif /* PNG_READ_BACKGROUND_SUPPORTED */ Modified: haiku/trunk/src/libs/png/pngrutil.c =================================================================== --- haiku/trunk/src/libs/png/pngrutil.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngrutil.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngrutil.c - utilities to read a PNG file * - * Last changed in libpng 1.2.22 [October 13, 2007] + * Last changed in libpng 1.2.26 [April 2, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -230,7 +230,7 @@ text_size = (png_size_t)(chunklength - (text - chunkdata) - 1); text_size = png_sizeof(msg) > text_size ? text_size : png_sizeof(msg); - png_memcpy(text + prefix_size, msg, text_size + 1); + png_memcpy(text + prefix_size, msg, text_size); break; } if (!png_ptr->zstream.avail_out || ret == Z_STREAM_END) @@ -1393,7 +1393,7 @@ if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE) { png_ptr->background.index = buf[0]; - if(info_ptr->num_palette) + if (info_ptr && info_ptr->num_palette) { if(buf[0] > info_ptr->num_palette) { @@ -1792,7 +1792,7 @@ #else #ifdef PNG_FIXED_POINT_SUPPORTED sheight = (png_charp)png_malloc_warn(png_ptr, png_strlen(ep) + 1); - if (swidth == NULL) + if (sheight == NULL) { png_warning(png_ptr, "Out of memory while processing sCAL chunk height"); return; @@ -2223,9 +2223,10 @@ length = (png_uint_32)65535L; } #endif - png_strncpy((png_charp)png_ptr->unknown_chunk.name, - (png_charp)png_ptr->chunk_name, 4); - png_ptr->unknown_chunk.name[4] = '\0'; + png_memcpy((png_charp)png_ptr->unknown_chunk.name, + (png_charp)png_ptr->chunk_name, + png_sizeof(png_ptr->unknown_chunk.name)); + png_ptr->unknown_chunk.name[png_sizeof(png_ptr->unknown_chunk.name)-1] = '\0'; png_ptr->unknown_chunk.data = (png_bytep)png_malloc(png_ptr, length); png_ptr->unknown_chunk.size = (png_size_t)length; png_crc_read(png_ptr, (png_bytep)png_ptr->unknown_chunk.data, length); @@ -2248,9 +2249,9 @@ &png_ptr->unknown_chunk, 1); } } -#else - png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); + else #endif + png_set_unknown_chunks(png_ptr, info_ptr, &png_ptr->unknown_chunk, 1); png_free(png_ptr, png_ptr->unknown_chunk.data); png_ptr->unknown_chunk.data = NULL; } @@ -2850,6 +2851,7 @@ png_read_finish_row(png_structp png_ptr) { #ifdef PNG_USE_LOCAL_ARRAYS +#ifdef PNG_READ_INTERLACING_SUPPORTED /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* start of interlace block */ @@ -2863,6 +2865,7 @@ /* offset to next interlace block in the y direction */ PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; +#endif /* PNG_READ_INTERLACING_SUPPORTED */ #endif png_debug(1, "in png_read_finish_row\n"); @@ -2870,6 +2873,7 @@ if (png_ptr->row_number < png_ptr->num_rows) return; +#ifdef PNG_READ_INTERLACING_SUPPORTED if (png_ptr->interlaced) { png_ptr->row_number = 0; @@ -2904,6 +2908,7 @@ if (png_ptr->pass < 7) return; } +#endif /* PNG_READ_INTERLACING_SUPPORTED */ if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED)) { @@ -2978,6 +2983,7 @@ png_read_start_row(png_structp png_ptr) { #ifdef PNG_USE_LOCAL_ARRAYS +#ifdef PNG_READ_INTERLACING_SUPPORTED /* arrays to facilitate easy interlacing - use pass (0 - 6) as index */ /* start of interlace block */ @@ -2992,6 +2998,7 @@ /* offset to next interlace block in the y direction */ PNG_CONST int png_pass_yinc[7] = {8, 8, 8, 4, 4, 2, 2}; #endif +#endif int max_pixel_depth; png_uint_32 row_bytes; @@ -2999,6 +3006,7 @@ png_debug(1, "in png_read_start_row\n"); png_ptr->zstream.avail_in = 0; png_init_read_transformations(png_ptr); +#ifdef PNG_READ_INTERLACING_SUPPORTED if (png_ptr->interlaced) { if (!(png_ptr->transformations & PNG_INTERLACE)) @@ -3019,6 +3027,7 @@ png_error(png_ptr, "Rowbytes overflow in png_read_start_row"); } else +#endif /* PNG_READ_INTERLACING_SUPPORTED */ { png_ptr->num_rows = png_ptr->height; png_ptr->iwidth = png_ptr->width; @@ -3137,18 +3146,32 @@ if (row_bytes > (png_uint_32)65536L) png_error(png_ptr, "This image requires a row greater than 64KB"); #endif - png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64); - png_ptr->row_buf = png_ptr->big_row_buf+32; + if(row_bytes + 64 > png_ptr->old_big_row_buf_size) + { + if (png_ptr->big_row_buf) + png_free(png_ptr,png_ptr->big_row_buf); + png_ptr->big_row_buf = (png_bytep)png_malloc(png_ptr, row_bytes+64); + png_ptr->row_buf = png_ptr->big_row_buf+32; + png_ptr->old_big_row_buf_size = row_bytes+64; + } + #ifdef PNG_MAX_MALLOC_64K if ((png_uint_32)png_ptr->rowbytes + 1 > (png_uint_32)65536L) png_error(png_ptr, "This image requires a row greater than 64KB"); #endif if ((png_uint_32)png_ptr->rowbytes > (png_uint_32)(PNG_SIZE_MAX - 1)) png_error(png_ptr, "Row has too many bytes to allocate in memory."); - png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( - png_ptr->rowbytes + 1)); + if(png_ptr->rowbytes+1 > png_ptr->old_prev_row_size) + { + if (png_ptr->prev_row) + png_free(png_ptr,png_ptr->prev_row); + png_ptr->prev_row = (png_bytep)png_malloc(png_ptr, (png_uint_32)( + png_ptr->rowbytes + 1)); + png_ptr->old_prev_row_size = png_ptr->rowbytes+1; + } + png_memset_check(png_ptr, png_ptr->prev_row, 0, png_ptr->rowbytes + 1); png_debug1(3, "width = %lu,\n", png_ptr->width); Modified: haiku/trunk/src/libs/png/pngset.c =================================================================== --- haiku/trunk/src/libs/png/pngset.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngset.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngset.c - storage of image information into info struct * - * Last changed in libpng 1.2.22 [October 13, 2007] + * Last changed in libpng 1.2.25 [February 18, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) * @@ -41,7 +41,13 @@ png_debug1(1, "in %s storage function\n", "cHRM"); if (png_ptr == NULL || info_ptr == NULL) return; - + if (!(white_x || white_y || red_x || red_y || green_x || green_y || + blue_x || blue_y)) + { + png_warning(png_ptr, + "Ignoring attempt to set all-zero chromaticity values"); + return; + } if (white_x < 0.0 || white_y < 0.0 || red_x < 0.0 || red_y < 0.0 || green_x < 0.0 || green_y < 0.0 || @@ -93,6 +99,13 @@ if (png_ptr == NULL || info_ptr == NULL) return; + if (!(white_x || white_y || red_x || red_y || green_x || green_y || + blue_x || blue_y)) + { + png_warning(png_ptr, + "Ignoring attempt to set all-zero chromaticity values"); + return; + } if (white_x < 0 || white_y < 0 || red_x < 0 || red_y < 0 || green_x < 0 || green_y < 0 || @@ -102,25 +115,14 @@ "Ignoring attempt to set negative chromaticity value"); return; } -#ifdef PNG_FLOATING_POINT_SUPPORTED - if (white_x > (double) PNG_UINT_31_MAX || - white_y > (double) PNG_UINT_31_MAX || - red_x > (double) PNG_UINT_31_MAX || - red_y > (double) PNG_UINT_31_MAX || - green_x > (double) PNG_UINT_31_MAX || - green_y > (double) PNG_UINT_31_MAX || - blue_x > (double) PNG_UINT_31_MAX || - blue_y > (double) PNG_UINT_31_MAX) -#else - if (white_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - white_y > (png_fixed_point) PNG_UINT_31_MAX/100000L || - red_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - red_y > (png_fixed_point) PNG_UINT_31_MAX/100000L || - green_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - green_y > (png_fixed_point) PNG_UINT_31_MAX/100000L || - blue_x > (png_fixed_point) PNG_UINT_31_MAX/100000L || - blue_y > (png_fixed_point) PNG_UINT_31_MAX/100000L) -#endif + if (white_x > (png_fixed_point) PNG_UINT_31_MAX || + white_y > (png_fixed_point) PNG_UINT_31_MAX || + red_x > (png_fixed_point) PNG_UINT_31_MAX || + red_y > (png_fixed_point) PNG_UINT_31_MAX || + green_x > (png_fixed_point) PNG_UINT_31_MAX || + green_y > (png_fixed_point) PNG_UINT_31_MAX || + blue_x > (png_fixed_point) PNG_UINT_31_MAX || + blue_y > (png_fixed_point) PNG_UINT_31_MAX ) { png_warning(png_ptr, "Ignoring attempt to set chromaticity value exceeding 21474.83"); @@ -486,6 +488,7 @@ { png_warning(png_ptr, "Memory allocation failed while processing sCAL."); + return; } png_memcpy(info_ptr->scal_s_width, swidth, (png_size_t)length); @@ -497,9 +500,9 @@ png_free (png_ptr, info_ptr->scal_s_width); png_warning(png_ptr, "Memory allocation failed while processing sCAL."); + return; } png_memcpy(info_ptr->scal_s_height, sheight, (png_size_t)length); - info_ptr->valid |= PNG_INFO_sCAL; #ifdef PNG_FREE_ME_SUPPORTED info_ptr->free_me |= PNG_FREE_SCAL; @@ -679,19 +682,20 @@ { png_charp new_iccp_name; png_charp new_iccp_profile; + png_uint_32 length; png_debug1(1, "in %s storage function\n", "iCCP"); if (png_ptr == NULL || info_ptr == NULL || name == NULL || profile == NULL) return; - new_iccp_name = (png_charp)png_malloc_warn(png_ptr, png_strlen(name)+1); + length = png_strlen(name)+1; + new_iccp_name = (png_charp)png_malloc_warn(png_ptr, length); if (new_iccp_name == NULL) { png_warning(png_ptr, "Insufficient memory to process iCCP chunk."); return; } - png_strncpy(new_iccp_name, name, png_strlen(name)); - new_iccp_name[png_strlen(name)] = '\0'; + png_memcpy(new_iccp_name, name, length); new_iccp_profile = (png_charp)png_malloc_warn(png_ptr, proflen); if (new_iccp_profile == NULL) { @@ -972,29 +976,29 @@ { png_sPLT_tp to = np + info_ptr->splt_palettes_num + i; png_sPLT_tp from = entries + i; + png_uint_32 length; - to->name = (png_charp)png_malloc_warn(png_ptr, - png_strlen(from->name) + 1); + length = png_strlen(from->name) + 1; + to->name = (png_charp)png_malloc_warn(png_ptr, length); if (to->name == NULL) { png_warning(png_ptr, "Out of memory while processing sPLT chunk"); + continue; } - /* TODO: use png_malloc_warn */ - png_strncpy(to->name, from->name, png_strlen(from->name)); - to->name[png_strlen(from->name)] = '\0'; + png_memcpy(to->name, from->name, length); to->entries = (png_sPLT_entryp)png_malloc_warn(png_ptr, from->nentries * png_sizeof(png_sPLT_entry)); - /* TODO: use png_malloc_warn */ - png_memcpy(to->entries, from->entries, - from->nentries * png_sizeof(png_sPLT_entry)); if (to->entries == NULL) { png_warning(png_ptr, "Out of memory while processing sPLT chunk"); png_free(png_ptr,to->name); to->name = NULL; + continue; } + png_memcpy(to->entries, from->entries, + from->nentries * png_sizeof(png_sPLT_entry)); to->nentries = from->nentries; to->depth = from->depth; } @@ -1039,8 +1043,11 @@ png_unknown_chunkp to = np + info_ptr->unknown_chunks_num + i; png_unknown_chunkp from = unknowns + i; - png_strncpy((png_charp)to->name, (png_charp)from->name, 4); - to->name[4] = '\0'; + png_memcpy((png_charp)to->name, + (png_charp)from->name, + png_sizeof(from->name)); + to->name[png_sizeof(to->name)-1] = '\0'; + to->data = (png_bytep)png_malloc_warn(png_ptr, from->size); if (to->data == NULL) { Modified: haiku/trunk/src/libs/png/pngwrite.c =================================================================== --- haiku/trunk/src/libs/png/pngwrite.c 2008-04-02 20:29:43 UTC (rev 24757) +++ haiku/trunk/src/libs/png/pngwrite.c 2008-04-02 20:58:54 UTC (rev 24758) @@ -1,9 +1,9 @@ /* pngwrite.c - general routines to write a PNG file * - * Last changed in libpng 1.2.15 January 5, 2007 + * Last changed in libpng 1.2.25 [February 18, 2008] * For conditions of distribution and use, see copyright notice in png.h - * Copyright (c) 1998-2007 Glenn Randers-Pehrson + * Copyright (c) 1998-2008 Glenn Randers-Pehrson * (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger) * (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.) */ @@ -482,12 +482,15 @@ #endif /* PNG_USER_MEM_SUPPORTED */ png_set_error_fn(png_ptr, error_ptr, error_fn, warn_fn); - i=0; - do + if(user_png_ver) { - if(user_png_ver[i] != png_libpng_ver[i]) - png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; - } while (png_libpng_ver[i++]); + i=0; + do + { + if(user_png_ver[i] != png_libpng_ver[i]) + png_ptr->flags |= PNG_FLAG_LIBRARY_MISMATCH; + } while (png_libpng_ver[i++]); + } if (png_ptr->flags & PNG_FLAG_LIBRARY_MISMATCH) { @@ -1000,21 +1003,32 @@ #endif } +#ifdef PNG_USER_MEM_SUPPORTED + if (png_ptr != NULL) + { + free_fn = png_ptr->free_fn; + mem_ptr = png_ptr->mem_ptr; + } +#endif + if (info_ptr_ptr != NULL) info_ptr = *info_ptr_ptr; if (info_ptr != NULL) { - png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); + if (png_ptr != NULL) + { + png_free_data(png_ptr, info_ptr, PNG_FREE_ALL, -1); #if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) - if (png_ptr->num_chunk_list) - { - png_free(png_ptr, png_ptr->chunk_list); - png_ptr->chunk_list=NULL; - png_ptr->num_chunk_list=0; + if (png_ptr->num_chunk_list) + { + png_free(png_ptr, png_ptr->chunk_list); + png_ptr->chunk_list=NULL; + png_ptr->num_chunk_list=0; + } +#endif } -#endif #ifdef PNG_USER_MEM_SUPPORTED png_destroy_struct_2((png_voidp)info_ptr, (png_free_ptr)free_fn, @@ -1060,11 +1074,13 @@ /* free our memory. png_free checks NULL for us. */ [... truncated: 63 lines follow ...] From mmlr at mail.berlios.de Thu Apr 3 01:07:23 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 3 Apr 2008 01:07:23 +0200 Subject: [Haiku-commits] r24759 - haiku/trunk/src/system/kernel/fs Message-ID: <200804022307.m32N7Nf8027220@sheep.berlios.de> Author: mmlr Date: 2008-04-03 01:07:22 +0200 (Thu, 03 Apr 2008) New Revision: 24759 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24759&view=rev Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp Log: Change publish_node() of the devfs to not insert the node into the directory. Instead return the directory vnode, so the calling function can insert it after all vnode initialization is done. Otherwise entry created notifications are sent upon inserting the node into the directory for vnodes that are not yet fully initialized (i.e. they have no type or the device hooks are not yet set). That would cause for example ioctls to fail when someone would react to a notification of a newly created device. Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-04-02 20:58:54 UTC (rev 24758) +++ haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-04-02 23:07:22 UTC (rev 24759) @@ -1176,7 +1176,8 @@ static status_t -publish_node(struct devfs *fs, const char *path, struct devfs_vnode **_node) +publish_node(struct devfs *fs, const char *path, struct devfs_vnode **_node, + struct devfs_vnode **_dir) { ASSERT_LOCKED_MUTEX(&fs->lock); @@ -1240,17 +1241,21 @@ vnode->stream.type = S_IFDIR | 0755; vnode->stream.u.dir.dir_head = NULL; list_init(&vnode->stream.u.dir.cookies); + + hash_insert(sDeviceFileSystem->vnode_hash, vnode); + devfs_insert_in_dir(dir, vnode); } else { // this is the last component + // Note: We do not yet insert the node into the directory, as it + // is not yet fully initialized. Instead we return the directory + // vnode so that the calling function can insert it after all + // initialization is done. This ensures that no create notification + // is sent out for a vnode that is not yet fully valid. *_node = vnode; + *_dir = dir; + break; } - hash_insert(sDeviceFileSystem->vnode_hash, vnode); - devfs_insert_in_dir(dir, vnode); - - if (atLeaf) - break; - last = i; dir = vnode; } @@ -1290,11 +1295,12 @@ isDisk = true; struct devfs_vnode *node; + struct devfs_vnode *dirNode; status_t status; RecursiveLocker locker(&fs->lock); - status = publish_node(fs, path, &node); + status = publish_node(fs, path, &node, &dirNode); if (status != B_OK) return status; @@ -1323,6 +1329,9 @@ return B_NO_MEMORY; } + // the node is now fully valid and we may insert it into the dir + hash_insert(sDeviceFileSystem->vnode_hash, node); + devfs_insert_in_dir(dirNode, node); return B_OK; } @@ -2871,6 +2880,7 @@ devfs_publish_file_device(const char *path, const char *filePath) { struct devfs_vnode *node; + struct devfs_vnode *dirNode; status_t status; filePath = strdup(filePath); @@ -2879,7 +2889,7 @@ RecursiveLocker locker(&sDeviceFileSystem->lock); - status = publish_node(sDeviceFileSystem, path, &node); + status = publish_node(sDeviceFileSystem, path, &node, &dirNode); if (status != B_OK) return status; @@ -2888,6 +2898,9 @@ node->stream.u.symlink.path = filePath; node->stream.u.symlink.length = strlen(filePath); + // the node is now fully valid and we may insert it into the dir + hash_insert(sDeviceFileSystem->vnode_hash, node); + devfs_insert_in_dir(dirNode, node); return B_OK; } From mmlr at mail.berlios.de Thu Apr 3 01:20:38 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 3 Apr 2008 01:20:38 +0200 Subject: [Haiku-commits] r24760 - haiku/trunk/src/system/kernel/fs Message-ID: <200804022320.m32NKcru004510@sheep.berlios.de> Author: mmlr Date: 2008-04-03 01:20:37 +0200 (Thu, 03 Apr 2008) New Revision: 24760 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24760&view=rev Modified: haiku/trunk/src/system/kernel/fs/node_monitor.cpp Log: Change the NodeMonitorService lock from a mutex to a recursive_lock. This allows event listeners to add new listeners inside a node monitoring event (i.e. if one wants to add a listener for the entry that has just been created and triggered the current notification). Modified: haiku/trunk/src/system/kernel/fs/node_monitor.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/node_monitor.cpp 2008-04-02 23:07:22 UTC (rev 24759) +++ haiku/trunk/src/system/kernel/fs/node_monitor.cpp 2008-04-02 23:20:37 UTC (rev 24760) @@ -176,7 +176,7 @@ typedef OpenHashTable MonitorHash; MonitorHash fMonitors; - mutex fMutex; + recursive_lock fRecursiveLock; }; static NodeMonitorService sNodeMonitorService; @@ -226,19 +226,20 @@ NodeMonitorService::NodeMonitorService() { - mutex_init(&fMutex, "node monitor"); + recursive_lock_init(&fRecursiveLock, "node monitor"); } NodeMonitorService::~NodeMonitorService() { + recursive_lock_destroy(&fRecursiveLock); } status_t NodeMonitorService::InitCheck() { - return fMutex.sem >= B_OK ? B_OK : fMutex.sem; + return fRecursiveLock.sem >= B_OK ? B_OK : fRecursiveLock.sem; } @@ -384,7 +385,7 @@ TRACE(("%s(dev = %ld, node = %Ld, flags = %ld, listener = %p\n", __PRETTY_FUNCTION__, device, node, flags, ¬ificationListener)); - MutexLocker _(fMutex); + RecursiveLocker _(fRecursiveLock); node_monitor *monitor; status_t status = _GetMonitor(context, device, node, true, &monitor); @@ -405,7 +406,7 @@ TRACE(("%s(dev = %ld, node = %Ld, flags = %ld, listener = %p\n", __PRETTY_FUNCTION__, device, node, flags, ¬ificationListener)); - MutexLocker _(fMutex); + RecursiveLocker _(fRecursiveLock); node_monitor *monitor; status_t status = _GetMonitor(context, device, node, false, &monitor); @@ -530,7 +531,7 @@ if (!name) return B_BAD_VALUE; - MutexLocker locker(fMutex); + RecursiveLocker locker(fRecursiveLock); // get the lists of all interested listeners interested_monitor_listener_list interestedListeners[3]; @@ -575,7 +576,7 @@ dev_t nodeDevice = device; resolve_mount_point_to_volume_root(device, node, &nodeDevice, &node); - MutexLocker locker(fMutex); + RecursiveLocker locker(fRecursiveLock); // get the lists of all interested listeners interested_monitor_listener_list interestedListeners[3]; @@ -617,7 +618,7 @@ NodeMonitorService::NotifyStatChanged(dev_t device, ino_t node, uint32 statFields) { - MutexLocker locker(fMutex); + RecursiveLocker locker(fRecursiveLock); // get the lists of all interested listeners interested_monitor_listener_list interestedListeners[3]; @@ -662,7 +663,7 @@ if (!attribute) return B_BAD_VALUE; - MutexLocker locker(fMutex); + RecursiveLocker locker(fRecursiveLock); // get the lists of all interested listeners interested_monitor_listener_list interestedListeners[3]; @@ -694,7 +695,7 @@ { TRACE(("unmounted device: %ld\n", device)); - MutexLocker locker(fMutex); + RecursiveLocker locker(fRecursiveLock); // get the lists of all interested listeners interested_monitor_listener_list interestedListeners[3]; @@ -724,7 +725,7 @@ TRACE(("mounted device: %ld, parent %ld:%Ld\n", device, parentDevice, parentDirectory)); - MutexLocker locker(fMutex); + RecursiveLocker locker(fRecursiveLock); // get the lists of all interested listeners interested_monitor_listener_list interestedListeners[3]; @@ -752,7 +753,7 @@ inline status_t NodeMonitorService::RemoveListeners(io_context *context) { - MutexLocker locker(fMutex); + RecursiveLocker locker(fRecursiveLock); while (!list_is_empty(&context->node_monitors)) { // the _RemoveListener() method will also free the node_monitor @@ -826,7 +827,7 @@ TRACE(("%s(dev = %ld, node = %Ld, listener = %p\n", __PRETTY_FUNCTION__, device, node, ¬ificationListener)); - MutexLocker _(fMutex); + RecursiveLocker _(fRecursiveLock); // get the monitor for this device/node pair node_monitor *monitor = _MonitorFor(device, node); @@ -854,7 +855,7 @@ monitor_listener *listener = NULL; int32 count = 0; - MutexLocker _(fMutex); + RecursiveLocker _(fRecursiveLock); while ((listener = (monitor_listener*)list_get_next_item( &context->node_monitors, listener)) != NULL) { @@ -883,7 +884,7 @@ TRACE(("%s(dev = %ld, node = %Ld, flags = %ld, listener = %p\n", __PRETTY_FUNCTION__, device, node, flags, &userListener)); - MutexLocker _(fMutex); + RecursiveLocker _(fRecursiveLock); node_monitor *monitor; status_t status = _GetMonitor(context, device, node, true, &monitor); From bonefish at mail.berlios.de Thu Apr 3 04:24:48 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 3 Apr 2008 04:24:48 +0200 Subject: [Haiku-commits] r24761 - haiku/trunk/src/system/kernel/cache Message-ID: <200804030224.m332OmZI020695@sheep.berlios.de> Author: bonefish Date: 2008-04-03 04:24:46 +0200 (Thu, 03 Apr 2008) New Revision: 24761 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24761&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: cache_end_transaction() doesn't remove the transaction, so that the check in notify_transaction_listeners() didn't hold, although the cache_hooks were deleted anyway. I've introduced a listener_change counter to detect changes to the listener list while iterating, since any change makes the iteration unsafe. Should fix bug #2008 for real. Nevertheless I thing the transaction listener concept needs revision. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-02 23:20:37 UTC (rev 24760) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-03 02:24:46 UTC (rev 24761) @@ -141,6 +141,7 @@ transaction_notification_hook notification_hook; void *notification_data; HookList listeners; + uint16 listener_change; bool open; bool has_sub_transaction; bigtime_t last_used; @@ -343,16 +344,27 @@ while (iterator.HasNext()) { cache_hook *hook = iterator.Next(); + uint16 listenerChange = transaction->listener_change; + hook->hook(transaction->id, event, hook->data); if (lookup_transaction(cache, id) != transaction) { // transaction has been removed by the hook! return; + } else if (listenerChange != transaction->listener_change) { + // Someone has meddled with the listener list, i.e. continuing the + // iteration is no longer safe. Rewind. + iterator.Rewind(); + continue; + // TODO: Maybe even break out completely, but then we might miss + // listeners. + // TODO: The whole listener concept needs to be revised! } if (removeListener) { iterator.Remove(); delete hook; + transaction->listener_change++; } } } @@ -1730,6 +1742,7 @@ hook->data = data; transaction->listeners.Add(hook); + transaction->listener_change++; return B_OK; } @@ -1752,6 +1765,7 @@ if (hook->data == data && hook->hook == hookFunction) { iterator.Remove(); delete hook; + transaction->listener_change++; return B_OK; } } From anevilyak at gmail.com Thu Apr 3 06:39:51 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 2 Apr 2008 23:39:51 -0500 Subject: [Haiku-commits] r24761 - haiku/trunk/src/system/kernel/cache In-Reply-To: <200804030224.m332OmZI020695@sheep.berlios.de> References: <200804030224.m332OmZI020695@sheep.berlios.de> Message-ID: Hi, On Wed, Apr 2, 2008 at 9:24 PM, bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-04-03 04:24:46 +0200 (Thu, 03 Apr 2008) > New Revision: 24761 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24761&view=rev > > Modified: > haiku/trunk/src/system/kernel/cache/block_cache.cpp > Log: > cache_end_transaction() doesn't remove the transaction, so that the > check in notify_transaction_listeners() didn't hold, although the > cache_hooks were deleted anyway. I've introduced a listener_change > counter to detect changes to the listener list while iterating, since > any change makes the iteration unsafe. Should fix bug #2008 for real. > Nevertheless I thing the transaction listener concept needs revision. > > With this change I now eventually get a panic from the block allocator in the doubly linked list code, re assertion failed: fFirst != NULL && fLast != NULL && fLast == fFirst) iirc. Regards, Rene From axeld at pinc-software.de Thu Apr 3 09:37:13 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 03 Apr 2008 09:37:13 +0200 CEST Subject: [Haiku-commits] r24759 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200804022307.m32N7Nf8027220@sheep.berlios.de> Message-ID: <883263501-BeMail@zon> mmlr at BerliOS wrote: > Log: > Change publish_node() of the devfs to not insert the node into the > directory. > Instead return the directory vnode, so the calling function can > insert it after > all vnode initialization is done. Otherwise entry created > notifications are > sent upon inserting the node into the directory for vnodes that are > not yet > fully initialized (i.e. they have no type or the device hooks are not > yet set). > That would cause for example ioctls to fail when someone would react > to a > notification of a newly created device. Nice catch! I'll just rename publish_node() to add_node(), then (as it doesn't publish it anymore). Bye, Axel. From axeld at pinc-software.de Thu Apr 3 09:38:02 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 03 Apr 2008 09:38:02 +0200 CEST Subject: [Haiku-commits] r24761 - haiku/trunk/src/system/kernel/cache In-Reply-To: <200804030224.m332OmZI020695@sheep.berlios.de> Message-ID: <932794126-BeMail@zon> bonefish at BerliOS wrote: > Log: > cache_end_transaction() doesn't remove the transaction, so that the > check in notify_transaction_listeners() didn't hold, although the > cache_hooks were deleted anyway. I've introduced a listener_change > counter to detect changes to the listener list while iterating, since > any change makes the iteration unsafe. Should fix bug #2008 for real. Nice catch - I didn't look into it yet, because I'm currently busy with... > Nevertheless I thing the transaction listener concept needs revision. ... this one :-) Bye, Axel. From axeld at mail.berlios.de Thu Apr 3 10:24:52 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Apr 2008 10:24:52 +0200 Subject: [Haiku-commits] r24762 - haiku/trunk/src/system/kernel/fs Message-ID: <200804030824.m338Oq4u003305@sheep.berlios.de> Author: axeld Date: 2008-04-03 10:24:50 +0200 (Thu, 03 Apr 2008) New Revision: 24762 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24762&view=rev Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp Log: * Renamed publish_node() to new_node(). * Introduced a new publish_node() which then actually publishs the node, similar to the VFS's new_vnode(), and publish_vnode() semantics. Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-04-03 02:24:46 UTC (rev 24761) +++ haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-04-03 08:24:50 UTC (rev 24762) @@ -1176,7 +1176,7 @@ static status_t -publish_node(struct devfs *fs, const char *path, struct devfs_vnode **_node, +new_node(struct devfs *fs, const char *path, struct devfs_vnode **_node, struct devfs_vnode **_dir) { ASSERT_LOCKED_MUTEX(&fs->lock); @@ -1242,7 +1242,7 @@ vnode->stream.u.dir.dir_head = NULL; list_init(&vnode->stream.u.dir.cookies); - hash_insert(sDeviceFileSystem->vnode_hash, vnode); + hash_insert(fs->vnode_hash, vnode); devfs_insert_in_dir(dir, vnode); } else { // this is the last component @@ -1265,6 +1265,14 @@ } +static void +publish_node(devfs *fs, devfs_vnode *dirNode, struct devfs_vnode *node) +{ + hash_insert(fs->vnode_hash, node); + devfs_insert_in_dir(dirNode, node); +} + + static status_t publish_device(struct devfs *fs, const char *path, device_node_info *deviceNode, pnp_devfs_driver_info *info, driver_entry *driver, device_hooks *ops, @@ -1300,7 +1308,7 @@ RecursiveLocker locker(&fs->lock); - status = publish_node(fs, path, &node, &dirNode); + status = new_node(fs, path, &node, &dirNode); if (status != B_OK) return status; @@ -1330,8 +1338,7 @@ } // the node is now fully valid and we may insert it into the dir - hash_insert(sDeviceFileSystem->vnode_hash, node); - devfs_insert_in_dir(dirNode, node); + publish_node(fs, dirNode, node); return B_OK; } @@ -1803,7 +1810,7 @@ // TODO: we might want to check if the current node does still exist // (it should fail in the driver's open(), though, if it doesn't) if (driver != NULL - && (driver->devices_used == 0) + && driver->devices_used == 0 && (driver->image < 0 || driver->binary_updated)) { status = reload_driver(driver); if (status < B_OK) @@ -2889,7 +2896,7 @@ RecursiveLocker locker(&sDeviceFileSystem->lock); - status = publish_node(sDeviceFileSystem, path, &node, &dirNode); + status = new_node(sDeviceFileSystem, path, &node, &dirNode); if (status != B_OK) return status; @@ -2899,8 +2906,7 @@ node->stream.u.symlink.length = strlen(filePath); // the node is now fully valid and we may insert it into the dir - hash_insert(sDeviceFileSystem->vnode_hash, node); - devfs_insert_in_dir(dirNode, node); + publish_node(sDeviceFileSystem, dirNode, node); return B_OK; } From stippi at mail.berlios.de Thu Apr 3 10:50:57 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 3 Apr 2008 10:50:57 +0200 Subject: [Haiku-commits] r24763 - in haiku/trunk: headers/posix src/bin/diffutils src/bin/gdb/libiberty src/system/libroot/posix/unistd Message-ID: <200804030850.m338ovEl005947@sheep.berlios.de> Author: stippi Date: 2008-04-03 10:50:56 +0200 (Thu, 03 Apr 2008) New Revision: 24763 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24763&view=rev Added: haiku/trunk/src/system/libroot/posix/unistd/getpagesize.c Modified: haiku/trunk/headers/posix/unistd.h haiku/trunk/src/bin/diffutils/config.h haiku/trunk/src/bin/gdb/libiberty/Jamfile haiku/trunk/src/system/libroot/posix/unistd/Jamfile Log: Applied patch by James Woodcock: * Implemented POSIX getpagesize() function in libroot. Modified: haiku/trunk/headers/posix/unistd.h =================================================================== --- haiku/trunk/headers/posix/unistd.h 2008-04-03 08:24:50 UTC (rev 24762) +++ haiku/trunk/headers/posix/unistd.h 2008-04-03 08:50:56 UTC (rev 24763) @@ -115,6 +115,7 @@ extern int mknod(const char *name, mode_t mode, dev_t dev); +extern int getpagesize(void); extern int getdtablesize(void); extern long sysconf(int name); extern long fpathconf(int fd, int name); Modified: haiku/trunk/src/bin/diffutils/config.h =================================================================== --- haiku/trunk/src/bin/diffutils/config.h 2008-04-03 08:24:50 UTC (rev 24762) +++ haiku/trunk/src/bin/diffutils/config.h 2008-04-03 08:50:56 UTC (rev 24763) @@ -36,8 +36,6 @@ # define DIR_TO_FD(Dir_p) -1 #endif -#define getpagesize() 4096 - /* Define if there is a member named d_ino in the struct describing directory headers. */ #define D_INO_IN_DIRENT 1 @@ -422,7 +420,7 @@ /* #undef HAVE_GETMNTINFO */ /* Define to 1 if you have the `getpagesize' function. */ -/* #undef HAVE_GETPAGESIZE */ +#define HAVE_GETPAGESIZE 1 /* Define to 1 if you have the `getpass' function. */ /* #undef HAVE_GETPASS */ Modified: haiku/trunk/src/bin/gdb/libiberty/Jamfile =================================================================== --- haiku/trunk/src/bin/gdb/libiberty/Jamfile 2008-04-03 08:24:50 UTC (rev 24762) +++ haiku/trunk/src/bin/gdb/libiberty/Jamfile 2008-04-03 08:50:56 UTC (rev 24763) @@ -58,7 +58,6 @@ # me, but some of those should be provided by Haiku. basename.c clock.c - getpagesize.c index.c insque.c mempcpy.c Modified: haiku/trunk/src/system/libroot/posix/unistd/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/Jamfile 2008-04-03 08:24:50 UTC (rev 24762) +++ haiku/trunk/src/system/libroot/posix/unistd/Jamfile 2008-04-03 08:50:56 UTC (rev 24763) @@ -16,6 +16,7 @@ fcntl.c fork.c getlogin.c + getpagesize.c hostname.cpp ioctl.c link.c Added: haiku/trunk/src/system/libroot/posix/unistd/getpagesize.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/getpagesize.c 2008-04-03 08:24:50 UTC (rev 24762) +++ haiku/trunk/src/system/libroot/posix/unistd/getpagesize.c 2008-04-03 08:50:56 UTC (rev 24763) @@ -0,0 +1,13 @@ +/* +** Copyright 2008, James Woodcock. All rights reserved. +** Distributed under the terms of the MIT License. +*/ + +#include +#include + +int +getpagesize(void) +{ + return B_PAGE_SIZE; +} From stippi at mail.berlios.de Thu Apr 3 11:04:08 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 3 Apr 2008 11:04:08 +0200 Subject: [Haiku-commits] r24764 - haiku/trunk/src/kits/tracker Message-ID: <200804030904.m33948Sl007255@sheep.berlios.de> Author: stippi Date: 2008-04-03 11:04:07 +0200 (Thu, 03 Apr 2008) New Revision: 24764 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24764&view=rev Modified: haiku/trunk/src/kits/tracker/CountView.cpp haiku/trunk/src/kits/tracker/CountView.h Log: Applied patch by Christof Lutteroth: * The count/info view in Tracker truncates the text in a better way when it does not fit, and also used the space of the barber pool when it isn't displayed. Modified: haiku/trunk/src/kits/tracker/CountView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/CountView.cpp 2008-04-03 08:50:56 UTC (rev 24763) +++ haiku/trunk/src/kits/tracker/CountView.cpp 2008-04-03 09:04:07 UTC (rev 24764) @@ -73,9 +73,12 @@ if (fStartSpinningAfter && system_time() < fStartSpinningAfter) return; + // When the barber pole just starts spinning we need to invalidate + // the whole rectangle of text and barber pole. + // After this the text needs no updating since only the pole changes. if (fStartSpinningAfter) { fStartSpinningAfter = 0; - Invalidate(BarberPoleOuterRect()); + Invalidate(TextAndBarberPoleRect()); } else Invalidate(BarberPoleInnerRect()); } @@ -133,11 +136,23 @@ { BRect result = Bounds(); result.InsetBy(4, 2); - result.right -= 10; + // if the barber pole is not present, use its space for text + if(fShowingBarberPole) + result.right -= 10; + return result; } +BRect +BCountView::TextAndBarberPoleRect() const +{ + BRect result = Bounds(); + result.InsetBy(4, 2); + + return result; +} + void BCountView::CheckCount() { @@ -154,7 +169,6 @@ BCountView::Draw(BRect) { BRect bounds(Bounds()); - BRect barberPoleRect; BString itemString; if (!IsTypingAhead()) { if (fLastCount == 0) @@ -166,14 +180,10 @@ } else itemString << TypeAhead(); - BString string(itemString); BRect textRect(TextInvalRect()); - if (fShowingBarberPole && !fStartSpinningAfter) { - barberPoleRect = BarberPoleOuterRect(); - TruncateString(&string, B_TRUNCATE_END, textRect.Width()); - } + TruncateString(&string, B_TRUNCATE_END, textRect.Width()); if (IsTypingAhead()) // use a muted gray for the typeahead @@ -202,6 +212,8 @@ EndLineArray(); return; } + + BRect barberPoleRect(BarberPoleOuterRect()); AddLine(barberPoleRect.LeftTop(), barberPoleRect.RightTop(), shadow); AddLine(barberPoleRect.LeftTop(), barberPoleRect.LeftBottom(), shadow); Modified: haiku/trunk/src/kits/tracker/CountView.h =================================================================== --- haiku/trunk/src/kits/tracker/CountView.h 2008-04-03 08:50:56 UTC (rev 24763) +++ haiku/trunk/src/kits/tracker/CountView.h 2008-04-03 09:04:07 UTC (rev 24764) @@ -66,6 +66,7 @@ BRect BarberPoleInnerRect() const; BRect BarberPoleOuterRect() const; BRect TextInvalRect() const; + BRect TextAndBarberPoleRect() const; void TrySpinningBarberPole(); int32 fLastCount; From stippi at mail.berlios.de Thu Apr 3 12:19:01 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 3 Apr 2008 12:19:01 +0200 Subject: [Haiku-commits] r24766 - haiku/trunk/src/tools Message-ID: <200804031019.m33AJ1oR015170@sheep.berlios.de> Author: stippi Date: 2008-04-03 12:19:00 +0200 (Thu, 03 Apr 2008) New Revision: 24766 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24766&view=rev Modified: haiku/trunk/src/tools/generate_boot_screen.cpp Log: * Changed the generate_boot_screen build tool to take placement parameters for the logo and the icons separately. * Image data output uses full line width. Modified: haiku/trunk/src/tools/generate_boot_screen.cpp =================================================================== --- haiku/trunk/src/tools/generate_boot_screen.cpp 2008-04-03 09:53:24 UTC (rev 24765) +++ haiku/trunk/src/tools/generate_boot_screen.cpp 2008-04-03 10:19:00 UTC (rev 24766) @@ -133,7 +133,7 @@ if (x == width * 3 - 1 && y == height - 1) { fprintf(sOutput, "0x%02x\n};\n\n", row[x]); break; - } else if ((offset % 8) == 0) + } else if ((offset % 12) == 0) fprintf(sOutput, "0x%02x,\n\t", row[x]); else fprintf(sOutput, "0x%02x, ", row[x]); @@ -164,24 +164,54 @@ int main(int argc, char* argv[]) { - if (argc < 4) { + if (argc < 8) { printf("Usage:\n"); - printf("\t%s \n", + printf("\t%s " + " \n", argv[0]); return 0; } - const char* headerFileName = argv[3]; + int logoPlacementX = atoi(argv[2]); + int logoPlacementY = atoi(argv[3]); + int iconPlacementX = atoi(argv[5]); + int iconPlacementY = atoi(argv[6]); + if (logoPlacementX < 0 || logoPlacementX > 100) { + printf("Bad X placement for logo: %d%%\n", logoPlacementX); + return 1; + } + if (logoPlacementY < 0 || logoPlacementY > 100) { + printf("Bad Y placement for logo: %d%%\n\n", logoPlacementY); + return 1; + } + if (iconPlacementX < 0 || iconPlacementX > 100) { + printf("Bad X placement for icons: %d%%\n", iconPlacementX); + return 1; + } + if (iconPlacementY < 0 || iconPlacementY > 100) { + printf("Bad Y placement for icons: %d%%\n", iconPlacementY); + return 1; + } + const char* headerFileName = argv[7]; sOutput = fopen(headerFileName, "wb"); if (!sOutput) error("Could not open file \"%s\" for writing", headerFileName); - fputs("// This file was generated by the generate_boot_screen build tool." - "\n\n", sOutput); + fputs("// This file was generated by the generate_boot_screen Haiku build " + "tool.\n\n", sOutput); + fprintf(sOutput, "static const int32 kLogoPlacementX = %d;\n", + logoPlacementX); + fprintf(sOutput, "static const int32 kLogoPlacementY = %d;\n", + logoPlacementY); + fprintf(sOutput, "static const int32 kIconPlacementX = %d;\n", + iconPlacementX); + fprintf(sOutput, "static const int32 kIconPlacementY = %d;\n\n", + iconPlacementY); + parseImage(argv[1], "kSplashLogo"); - parseImage(argv[2], "kSplashIcons"); + parseImage(argv[4], "kSplashIcons"); fclose(sOutput); return 0; From stippi at mail.berlios.de Thu Apr 3 12:23:03 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 3 Apr 2008 12:23:03 +0200 Subject: [Haiku-commits] r24767 - haiku/trunk/src/tools Message-ID: <200804031023.m33AN3bP015675@sheep.berlios.de> Author: stippi Date: 2008-04-03 12:23:03 +0200 (Thu, 03 Apr 2008) New Revision: 24767 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24767&view=rev Modified: haiku/trunk/src/tools/generate_boot_screen.cpp Log: * Renamed placement constants to fit into the existing scheme. Modified: haiku/trunk/src/tools/generate_boot_screen.cpp =================================================================== --- haiku/trunk/src/tools/generate_boot_screen.cpp 2008-04-03 10:19:00 UTC (rev 24766) +++ haiku/trunk/src/tools/generate_boot_screen.cpp 2008-04-03 10:23:03 UTC (rev 24767) @@ -201,13 +201,13 @@ fputs("// This file was generated by the generate_boot_screen Haiku build " "tool.\n\n", sOutput); - fprintf(sOutput, "static const int32 kLogoPlacementX = %d;\n", + fprintf(sOutput, "static const int32 kSplashLogoPlacementX = %d;\n", logoPlacementX); - fprintf(sOutput, "static const int32 kLogoPlacementY = %d;\n", + fprintf(sOutput, "static const int32 kSplashLogoPlacementY = %d;\n", logoPlacementY); - fprintf(sOutput, "static const int32 kIconPlacementX = %d;\n", + fprintf(sOutput, "static const int32 kSplashIconsPlacementX = %d;\n", iconPlacementX); - fprintf(sOutput, "static const int32 kIconPlacementY = %d;\n\n", + fprintf(sOutput, "static const int32 kSplashIconsPlacementY = %d;\n\n", iconPlacementY); parseImage(argv[1], "kSplashLogo"); From stippi at mail.berlios.de Thu Apr 3 11:53:25 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 3 Apr 2008 11:53:25 +0200 Subject: [Haiku-commits] r24765 - haiku/trunk/src/preferences/media Message-ID: <200804030953.m339rPAl012113@sheep.berlios.de> Author: stippi Date: 2008-04-03 11:53:24 +0200 (Thu, 03 Apr 2008) New Revision: 24765 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24765&view=rev Modified: haiku/trunk/src/preferences/media/Media.cpp haiku/trunk/src/preferences/media/MediaViews.cpp haiku/trunk/src/preferences/media/MediaWindow.cpp Log: Applied patch by Clemens Zeidler: * The Media preflet itself is now font sensitive by using the new layout management. Modified: haiku/trunk/src/preferences/media/Media.cpp =================================================================== --- haiku/trunk/src/preferences/media/Media.cpp 2008-04-03 09:04:07 UTC (rev 24764) +++ haiku/trunk/src/preferences/media/Media.cpp 2008-04-03 09:53:24 UTC (rev 24765) @@ -19,7 +19,7 @@ Media::Media() : BApplication("application/x-vnd.Haiku-Media") { - BRect rect(32,64,637,442); + BRect rect(32,64,637,462); BPath path; if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK) { @@ -51,7 +51,6 @@ } fWindow = new MediaWindow(rect); - fWindow->SetSizeLimits(605.0, 10000.0, 378.0, 10000.0); be_roster->StartWatching(BMessenger(this)); } Modified: haiku/trunk/src/preferences/media/MediaViews.cpp =================================================================== --- haiku/trunk/src/preferences/media/MediaViews.cpp 2008-04-03 09:04:07 UTC (rev 24764) +++ haiku/trunk/src/preferences/media/MediaViews.cpp 2008-04-03 09:53:24 UTC (rev 24765) @@ -26,6 +26,9 @@ #include #include #include +#include +#include + #include "MediaViews.h" BarView::BarView(BRect frame) @@ -55,9 +58,10 @@ SettingsView::SettingsView (BRect frame, bool isVideo) : BView (frame, "SettingsView", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW ), - fIsVideo(isVideo) + fIsVideo(isVideo) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + BRect rect(frame); rect.left += 10; rect.top += 12; @@ -65,33 +69,46 @@ rect.bottom = rect.top + 104; BBox *defaultsBox = new BBox(rect, "defaults"); defaultsBox->SetLabel(fIsVideo ? "Default Nodes" : "Defaults"); - AddChild(defaultsBox); + // create the default box + BGroupLayout* defaultBoxLayout = new BGroupLayout(B_VERTICAL, 5); + float inset = defaultsBox->Frame().left - defaultsBox->InnerFrame().left; + defaultBoxLayout->SetInsets(inset, defaultsBox->TopBorderOffset() * 2, inset, inset); + defaultsBox->SetLayout(defaultBoxLayout); + defaultBoxLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5)); + + BGroupView* inputField = new BGroupView(B_HORIZONTAL); + BGroupView* outputField = new BGroupView(B_HORIZONTAL); + defaultsBox->GetLayout()->AddView(inputField); + defaultsBox->GetLayout()->AddView(outputField); + BRect defaultRect(20, 22, 250, 40); float divider = StringWidth(fIsVideo ? "Video Output:" : "Audio Output:") + 5; fMenu1 = new BPopUpMenu(""); fMenu1->SetLabelFromMarked(true); - BMenuField *menuField1 = new BMenuField(defaultRect, "menuField1", + BMenuField *menuField1 = new BMenuField(defaultRect, "menuField1", fIsVideo ? "Video Input:" : "Audio Input:", fMenu1); - defaultsBox->AddChild(menuField1); menuField1->SetDivider(divider); defaultRect.OffsetBy(0, 26); fMenu2 = new BPopUpMenu(""); fMenu2->SetLabelFromMarked(true); - BMenuField *menuField2 = new BMenuField(defaultRect, "menuField2", + BMenuField *menuField2 = new BMenuField(defaultRect, "menuField2", fIsVideo ? "Video Output:" : "Audio Output:", fMenu2); - defaultsBox->AddChild(menuField2); menuField2->SetDivider(divider); + inputField->GroupLayout()->AddView(menuField1); + outputField->GroupLayout()->AddView(menuField2); + + BMenuField *menuField3 = NULL; if (!fIsVideo) { defaultRect.OffsetBy(186, 0); defaultRect.right -= 30; fMenu3 = new BPopUpMenu(""); fMenu3->SetLabelFromMarked(true); - BMenuField *menuField3 = new BMenuField(defaultRect, "menuField3", + menuField3 = new BMenuField(defaultRect, "menuField3", "Channel:", fMenu3); - defaultsBox->AddChild(menuField3); + outputField->GroupLayout()->AddView(menuField3); menuField3->SetDivider(StringWidth("Channel:")+5); defaultRect.right += 30; defaultRect.OffsetBy(-186, 0); @@ -100,24 +117,23 @@ defaultRect.OffsetBy(0, 32); defaultRect.right += 100; rgb_color red_color = {222, 32, 33}; - fRestartView = new BStringView(defaultRect, "restartStringView", "Restart the Media Server to apply changes.", + fRestartView = new BStringView(defaultRect, "restartStringView", "Restart the Media Server to apply changes.", B_FOLLOW_ALL, B_WILL_DRAW); fRestartView->SetHighColor(red_color); defaultsBox->AddChild(fRestartView); fRestartView->Hide(); + // create the realtime box rect.top = rect.bottom + 10; rect.bottom = rect.top + 162; BBox *realtimeBox = new BBox(rect, "realtime"); realtimeBox->SetLabel("Real-Time"); - AddChild(realtimeBox); BMessage *message = new BMessage(ML_ENABLE_REAL_TIME); message->AddBool("isVideo", fIsVideo); - BRect rect2(22,20, 190, 40); - fRealtimeCheckBox = new BCheckBox(rect2, "realtimeCheckBox", + BRect rect2(22,20, frame.Width() - 22, 40); + fRealtimeCheckBox = new BCheckBox(rect2, "realtimeCheckBox", fIsVideo ? "Enable Real-Time Video" : "Enable Real-Time Audio", message); - realtimeBox->AddChild(fRealtimeCheckBox); uint32 flags; BMediaRoster::Roster()->GetRealtimeFlags(&flags); @@ -126,7 +142,6 @@ rect2.top += 26; rect2.bottom = rect.Height() - 5; - rect2.right = rect.right - 15; BRect textRect(3, 3, rect2.Width() - 3, rect2.Height() - 3); BTextView *textView = new BTextView(rect2, "stringView", textRect, B_FOLLOW_ALL, B_WILL_DRAW); textView->Insert(fIsVideo ? "Enabling Real-Time Video allows the BeOS to perform video operations as fast and smoothly as possible. It achieves optimum performance by using more RAM." @@ -136,14 +151,23 @@ textView->MakeEditable(false); textView->MakeSelectable(false); textView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - realtimeBox->AddChild(textView); + BGroupLayout* realtimeBoxLayout = new BGroupLayout(B_VERTICAL, 5); + inset = realtimeBox->Frame().left - realtimeBox->InnerFrame().left; + realtimeBoxLayout->SetInsets(inset, defaultsBox->TopBorderOffset() * 2, inset, inset); + realtimeBox->SetLayout(realtimeBoxLayout); + + realtimeBoxLayout->AddItem(BSpaceLayoutItem::CreateVerticalStrut(5)); + realtimeBoxLayout->AddView(fRealtimeCheckBox); + realtimeBoxLayout->AddView(textView); + + // create the bottom line: volumen in deskbar checkbox and restart button + BGroupView* bottomView = new BGroupView(B_HORIZONTAL); rect.top = rect.bottom + 11; rect.bottom = rect.top + 20; rect.left = rect.right - StringWidth("Restart Media Services") - 20; BButton *restartButton = new BButton(rect, "restartButton", "Restart Media Services", new BMessage(ML_RESTART_MEDIA_SERVER)); - AddChild(restartButton); if (!fIsVideo) { rect.right = rect.left - 10; @@ -151,14 +175,24 @@ rect.left = frame.left + 33; if (StringWidth("Show Volume Control on Deskbar") > rect.Width() - 30) rect.left -= 10; - fVolumeCheckBox = new BCheckBox(rect, "volumeCheckBox", "Show Volume Control on Deskbar", new BMessage(ML_SHOW_VOLUME_CONTROL)); - AddChild(fVolumeCheckBox); - + bottomView->GroupLayout()->AddView(fVolumeCheckBox); if (BDeskbar().HasItem("MediaReplicant")) fVolumeCheckBox->SetValue(B_CONTROL_ON); } + else{ + bottomView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); + } + bottomView->GroupLayout()->AddView(restartButton); + + // compose all stuff + BGroupLayout* rootlayout = new BGroupLayout(B_VERTICAL, 5); + SetLayout(rootlayout); + + rootlayout->AddView(defaultsBox); + rootlayout->AddView(realtimeBox); + rootlayout->AddView(bottomView); } void Modified: haiku/trunk/src/preferences/media/MediaWindow.cpp =================================================================== --- haiku/trunk/src/preferences/media/MediaWindow.cpp 2008-04-03 09:04:07 UTC (rev 24764) +++ haiku/trunk/src/preferences/media/MediaWindow.cpp 2008-04-03 09:53:24 UTC (rev 24765) @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include "MediaWindow.h" // Images @@ -148,16 +150,19 @@ // Bitmaps BRect iconRect(0, 0, 15, 15); BBitmap *icon = new BBitmap(iconRect, B_CMAP8); - icon->SetBits(kDevicesBits, kDevicesWidth*kDevicesHeight, 0, kDevicesColorSpace); + icon->SetBits(kDevicesBits, kDevicesWidth*kDevicesHeight, 0, + kDevicesColorSpace); fIcons.AddItem(icon); icon = new BBitmap(iconRect, B_CMAP8); - icon->SetBits(kMixerBits, kMixerWidth*kMixerHeight, 0, kMixerColorSpace); + icon->SetBits(kMixerBits, kMixerWidth*kMixerHeight, 0, + kMixerColorSpace); fIcons.AddItem(icon); icon = new BBitmap(iconRect, B_CMAP8); icon->SetBits(kMicBits, kMicWidth*kMicHeight, 0, kMicColorSpace); fIcons.AddItem(icon); icon = new BBitmap(iconRect, B_CMAP8); - icon->SetBits(kSpeakerBits, kSpeakerWidth*kSpeakerHeight, 0, kSpeakerColorSpace); + icon->SetBits(kSpeakerBits, kSpeakerWidth*kSpeakerHeight, 0, + kSpeakerColorSpace); fIcons.AddItem(icon); icon = new BBitmap(iconRect, B_CMAP8); icon->SetBits(kCamBits, kCamWidth*kCamHeight, 0, kCamColorSpace); @@ -166,47 +171,80 @@ icon->SetBits(kTVBits, kTVWidth*kTVHeight, 0, kTVColorSpace); fIcons.AddItem(icon); + const float scrollWidth = 9 * be_plain_font->Size() + 30; + const float contentWidth = 34 * be_plain_font->Size(); + float totalWidthFont = scrollWidth + contentWidth + 14 * 3; + const float totalWidth = (605.0 > totalWidthFont) ? + 605.0 : totalWidthFont; BRect bounds = Bounds(); // the whole view - // Create the OutlineView - BRect menuRect(bounds.left+14, bounds.top+14, bounds.left+146, bounds.bottom-14); - BRect titleRect(menuRect.right+14, menuRect.top, bounds.right-10, menuRect.top+16); - BRect availableRect(menuRect.right+15, titleRect.bottom+12, bounds.right-14, bounds.bottom-4); - BRect barRect(titleRect.left, titleRect.bottom+10, titleRect.right-2, titleRect.bottom+11); + font_height titleHeightStruct; + be_bold_font->GetHeight(&titleHeightStruct); + float titleHeight = titleHeightStruct.ascent + titleHeightStruct.descent + + titleHeightStruct.leading + 1; - fListView = new BListView(menuRect, "media_list_view", B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES); + BRect menuRect(bounds.left + 14, bounds.top + 14, scrollWidth, + bounds.bottom - 14); + BRect titleRect(menuRect.right + 14, menuRect.top, + totalWidth - 10, menuRect.top + titleHeight); + BRect availableRect(menuRect.right + 15, titleRect.bottom + 12, + totalWidth - 14, bounds.bottom - 16); + BRect barRect(titleRect.left, titleRect.bottom + 10, + titleRect.right - 2, titleRect.bottom + 11); + + fListView = new BListView(menuRect, "media_list_view", + B_SINGLE_SELECTION_LIST, B_FOLLOW_ALL_SIDES); fListView->SetSelectionMessage(new BMessage(ML_SELECTED_NODE)); // Add ScrollView to Media Menu - BScrollView *scrollView = new BScrollView("listscroller", fListView, B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM, 0, false, false, B_FANCY_BORDER); - + BScrollView *scrollView = new BScrollView("listscroller", + fListView, B_FOLLOW_LEFT|B_FOLLOW_TOP_BOTTOM, 0, false, false, + B_FANCY_BORDER); + scrollView->SetExplicitMinSize(BSize(scrollWidth, B_SIZE_UNSET)); + scrollView->SetExplicitMaxSize(BSize(scrollWidth, B_SIZE_UNSET)); + // Create the Views - fBox = new BBox(bounds, "background", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER); + fBox = new BBox(bounds, "background", B_FOLLOW_ALL_SIDES, + B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER); + SetLayout(new BGroupLayout(B_HORIZONTAL)); + GetLayout()->AddView(fBox); - // Add Child(ren) - AddChild(fBox); - fBox->AddChild(scrollView); - // StringViews rgb_color titleFontColor = { 0,0,0,0 }; - fTitleView = new BStringView(titleRect, "AudioSettings", "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); + fTitleView = new BStringView(titleRect, "AudioSettings", + "Audio Settings", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); fTitleView->SetFont(be_bold_font); - fTitleView->SetFontSize(12.0); fTitleView->SetHighColor(titleFontColor); - fBox->AddChild(fTitleView); + fContentView = new BBox(availableRect, "contentView", + B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER); - fContentView = new BBox(availableRect, "contentView", B_FOLLOW_ALL_SIDES, B_WILL_DRAW | B_FRAME_EVENTS, B_NO_BORDER); - fBox->AddChild(fContentView); - - BRect settingsRect(0, 0, 442, 335); + BRect settingsRect(0, 0, availableRect.Width(), availableRect.Height()); fAudioView = new SettingsView(settingsRect, false); fVideoView = new SettingsView(settingsRect, true); fBar = new BarView(barRect); - fBox->AddChild(fBar); + BGroupView* titleGroupView = new BGroupView(B_HORIZONTAL); + titleGroupView->GroupLayout()->AddView(fTitleView); + titleGroupView->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); + + // Layout all views + BGroupView* rightView = new BGroupView(B_VERTICAL, 5); + rightView->GroupLayout()->SetInsets(14, 0, 0, 0); + rightView->GroupLayout()->AddView(titleGroupView); + rightView->GroupLayout()->AddView(fBar, 0); + rightView->GroupLayout()->AddView(fContentView); + BGroupLayout* rootLayout = new BGroupLayout(B_HORIZONTAL); + rootLayout->SetInsets(14, 14, 14, 14); + fBox->SetLayout(rootLayout); + + rootLayout->AddView(scrollView); + + rootLayout->AddView(rightView); + + // Start the window fInitCheck = InitMedia(true); if (fInitCheck != B_OK) { PostMessage(B_QUIT_REQUESTED); @@ -214,9 +252,17 @@ if (IsHidden()) Show(); } + + // Set window limits + ResizeTo(totalWidth + 14, bounds.Height()); + SetZoomLimits(totalWidth + 14, bounds.Height()); + SetSizeLimits(totalWidth + 14, 100000, bounds.Height(), 100000); } -// ---------------------------------------------------------------------------------------------------------- // + +// #pragma mark - + + status_t MediaWindow::InitMedia(bool first) { From axeld at mail.berlios.de Thu Apr 3 13:21:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Apr 2008 13:21:01 +0200 Subject: [Haiku-commits] r24768 - haiku/trunk/src/system/kernel/cache Message-ID: <200804031121.m33BL1OV012661@sheep.berlios.de> Author: axeld Date: 2008-04-03 13:21:00 +0200 (Thu, 03 Apr 2008) New Revision: 24768 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24768&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * Decoupled notifications from the block cache functions; they are now called without having the cache's lock held. * The only downside to this approach is that ending a transaction now needs additional memory, and might therefore fail - that could be fixed by allocating that memory upfront with the start of the new transaction, though. * Therefore, I reverted the cache lock to a benaphore, as the recursive lock is no longer needed. * The block writer thread is now a block writer and notifier thread: it will wait for up to 2 seconds on the sEventSemaphore, and if nothing comes in, it will continue with its previously sole job. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-03 10:23:03 UTC (rev 24767) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-03 11:21:00 UTC (rev 24768) @@ -86,9 +86,20 @@ DoublyLinkedListMemberGetLink > 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; - recursive_lock lock; + benaphore lock; int fd; off_t max_blocks; size_t block_size; @@ -103,6 +114,9 @@ uint32 num_dirty_blocks; bool read_only; + NotificationList pending_notifications; + bool deleting; + block_cache(int fd, off_t numBlocks, size_t blockSize, bool readOnly); ~block_cache(); @@ -121,12 +135,16 @@ cached_block *_GetUnusedBlock(); }; -struct cache_hook : DoublyLinkedListLinkImpl { - transaction_notification_hook hook; - void *data; +struct cache_listener; +typedef DoublyLinkedListLink listener_link; + +struct cache_listener : cache_notification { + listener_link link; }; -typedef DoublyLinkedList HookList; +typedef DoublyLinkedList > ListenerList; struct cache_transaction { cache_transaction(); @@ -138,10 +156,7 @@ int32 sub_num_blocks; cached_block *first_block; block_list blocks; - transaction_notification_hook notification_hook; - void *notification_data; - HookList listeners; - uint16 listener_change; + ListenerList listeners; bool open; bool has_sub_transaction; bigtime_t last_used; @@ -269,6 +284,8 @@ static DoublyLinkedList sCaches; static mutex sCachesLock; +static sem_id sEventSemaphore; +static mutex sNotificationsLock; static DoublyLinkedListLink sMarkCache; // TODO: this only works if the link is the first entry of block_cache static object_cache *sBlockCache; @@ -283,8 +300,6 @@ main_num_blocks = 0; sub_num_blocks = 0; first_block = NULL; - notification_hook = NULL; - notification_data = NULL; open = true; last_used = system_time(); } @@ -313,63 +328,165 @@ } -static void -delete_transaction(block_cache *cache, cache_transaction *transaction) +static bool +get_next_pending_event(cache_notification *notification, int32 *_event) { - if (cache->last_transaction == transaction) - cache->last_transaction = NULL; + for (int32 eventMask = 1; eventMask <= TRANSACTION_IDLE; eventMask <<= 1) { + int32 pending = atomic_and(¬ification->events_pending, + ~eventMask); - delete transaction; - cache->transaction_changed++; + bool more = (pending & ~eventMask) != 0; + + if ((pending & eventMask) != 0) { + *_event = eventMask; + return more; + } + } + + return false; } -static cache_transaction * -lookup_transaction(block_cache *cache, int32 id) +static void +set_notification(cache_transaction *transaction, + cache_notification ¬ification, int32 events, + transaction_notification_hook hook, void *data) { - return (cache_transaction *)hash_lookup(cache->transaction_hash, &id); + notification.transaction_id = transaction->id; + notification.events_pending = 0; + notification.events = events; + notification.hook = hook; + notification.data = data; + notification.delete_after_event = false; } -/*! Notifies all listeners of this transaction, and removes them - afterwards if requested via \a removeListener. +/*! 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 + MutexLocker locker(sNotificationsLock); + if (notification->events_pending != 0) + notification->delete_after_event = true; + else + delete 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 requested via \a removeListeners, the listeners will be removed + afterwards. +*/ +static void notify_transaction_listeners(block_cache *cache, cache_transaction *transaction, - int32 event, bool removeListener) + int32 event, bool removeListeners) { - int32 id = transaction->id; + T(Action("notify", cache, transaction)); - HookList::Iterator iterator = transaction->listeners.GetIterator(); + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); while (iterator.HasNext()) { - cache_hook *hook = iterator.Next(); + cache_listener *listener = iterator.Next(); - uint16 listenerChange = transaction->listener_change; + if (removeListeners) + iterator.Remove(); - hook->hook(transaction->id, event, hook->data); + if ((listener->events & event) != 0) + add_notification(cache, listener, event, removeListeners); + else if (removeListeners) + delete listener; + } +} - if (lookup_transaction(cache, id) != transaction) { - // transaction has been removed by the hook! - return; - } else if (listenerChange != transaction->listener_change) { - // Someone has meddled with the listener list, i.e. continuing the - // iteration is no longer safe. Rewind. - iterator.Rewind(); - continue; - // TODO: Maybe even break out completely, but then we might miss - // listeners. - // TODO: The whole listener concept needs to be revised! + +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(); + + if (listener->events_pending != 0) { + // This listener is already in the notification list - just + // mark it to be deleted. + MutexLocker _(sNotificationsLock); + if (listener->events_pending != 0) { + listener->delete_after_event = true; + continue; + } } - if (removeListener) { - iterator.Remove(); - delete hook; - transaction->listener_change++; + delete 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; } +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 @@ -430,7 +547,8 @@ transaction_hash(NULL), transaction_changed(0), num_dirty_blocks(0), - read_only(readOnly) + read_only(readOnly), + deleting(false) { mutex_lock(&sCachesLock); sCaches.Add(this); @@ -451,7 +569,7 @@ if (transaction_hash == NULL) return; - if (recursive_lock_init(&lock, "block cache") < B_OK) + if (benaphore_init(&lock, "block cache") < B_OK) return; register_low_memory_handler(&block_cache::LowMemoryHandler, this, 0); @@ -460,14 +578,16 @@ block_cache::~block_cache() { + deleting = true; + + unregister_low_memory_handler(&block_cache::LowMemoryHandler, this); + + benaphore_destroy(&lock); + mutex_lock(&sCachesLock); sCaches.Remove(this); mutex_unlock(&sCachesLock); - unregister_low_memory_handler(&block_cache::LowMemoryHandler, this); - - recursive_lock_destroy(&lock); - hash_uninit(transaction_hash); hash_uninit(hash); @@ -623,7 +743,7 @@ block_cache::LowMemoryHandler(void *data, int32 level) { block_cache *cache = (block_cache *)data; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); if (!locker.IsLocked()) { // If our block_cache were deleted, it could be that we had @@ -950,12 +1070,8 @@ if (--previous->num_blocks == 0) { TRACE(("cache transaction %ld finished!\n", previous->id)); - if (previous->notification_hook != NULL) { - previous->notification_hook(previous->id, TRANSACTION_WRITTEN, - previous->notification_data); - } notify_transaction_listeners(cache, previous, TRANSACTION_WRITTEN, - false); + true); if (deleteTransaction) { hash_remove(cache->transaction_hash, previous); @@ -1071,6 +1187,20 @@ kprintf(" block_size: %lu\n", cache->block_size); kprintf(" next_transaction_id: %ld\n", cache->next_transaction_id); + if (!cache->pending_notifications.IsEmpty()) { + kprintf(" pending notifications:\n"); + + NotificationList::Iterator iterator + = cache->pending_notifications.GetIterator(); + while (iterator.HasNext()) { + cache_notification *notification = iterator.Next(); + + kprintf(" %p %5lx %p - %p\n", notification, + notification->events_pending, notification->hook, + notification->data); + } + } + if (showTransactions) { kprintf(" transactions:\n"); kprintf("address id state blocks main sub\n"); @@ -1159,6 +1289,16 @@ kprintf(" idle: %Ld secs\n", (system_time() - transaction->last_used) / 1000000); + kprintf(" listeners:\n"); + + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener *listener = iterator.Next(); + + kprintf(" %p %5lx %p - %p\n", listener, listener->events_pending, + listener->hook, listener->data); + } + if (!showBlocks) return 0; @@ -1174,9 +1314,9 @@ kprintf("--\n"); - block_list::Iterator iterator = transaction->blocks.GetIterator(); - while (iterator.HasNext()) { - block = iterator.Next(); + block_list::Iterator blockIterator = transaction->blocks.GetIterator(); + while (blockIterator.HasNext()) { + block = blockIterator.Next(); dump_block(block); } @@ -1203,16 +1343,40 @@ static block_cache * -get_next_block_cache(block_cache *last) +get_next_locked_block_cache(block_cache *last) { MutexLocker _(sCachesLock); + block_cache *cache; if (last != NULL) { + benaphore_unlock(&last->lock); + cache = sCaches.GetNext((block_cache *)&sMarkCache); sCaches.Remove((block_cache *)&sMarkCache); } else cache = sCaches.Head(); + while (cache != NULL) { + while (cache != NULL && cache->deleting) { + cache = sCaches.GetNext(cache); + } + if (cache == NULL) + break; + + status_t status = benaphore_lock(&cache->lock); + if (status != B_OK) { + // can only happen if the cache is being deleted right now + continue; + } + + if (cache->deleting) { + benaphore_unlock(&cache->lock); + continue; + } + + break; + } + if (cache != NULL) sCaches.Insert(sCaches.GetNext(cache), (block_cache *)&sMarkCache); @@ -1220,17 +1384,78 @@ } +static void +flush_pending_notifications(block_cache *cache) +{ + 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; + } +} + + +static void +flush_pending_notifications() +{ + MutexLocker _(sCachesLock); + + DoublyLinkedList::Iterator iterator = sCaches.GetIterator(); + while (iterator.HasNext()) { + block_cache *cache = iterator.Next(); + + flush_pending_notifications(cache); + } +} + + static status_t -block_writer(void *) +block_notifier_and_writer(void *) { + const bigtime_t kTimeout = 2000000LL; + bigtime_t timeout = kTimeout; + while (true) { + bigtime_t start = system_time(); + + status_t status = acquire_sem_etc(sEventSemaphore, 1, + B_RELATIVE_TIMEOUT, timeout); + if (status == B_OK) { + flush_pending_notifications(); + timeout -= system_time() - start; + continue; + } + // write 64 blocks of each block_cache every two seconds // TODO: change this once we have an I/O scheduler - snooze(2000000LL); + timeout = kTimeout; block_cache *cache = NULL; - while ((cache = get_next_block_cache(cache)) != NULL) { - RecursiveLocker locker(&cache->lock); + while ((cache = get_next_locked_block_cache(cache)) != NULL) { const uint32 kMaxCount = 64; cached_block *blocks[kMaxCount]; uint32 count = 0; @@ -1261,17 +1486,9 @@ if (transaction->open) { if (system_time() > transaction->last_used + kTransactionIdleTime) { - int32 change = cache->transaction_changed; - // Transaction is open but idle notify_transaction_listeners(cache, transaction, TRANSACTION_IDLE, false); - - if (change != cache->transaction_changed) { - // Transactions were removed by the above - // notification - hash_rewind(cache->transaction_hash, &iterator); - } } continue; } @@ -1306,14 +1523,20 @@ sBlockCache = create_object_cache_etc("cached blocks", sizeof(cached_block), 8, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL); if (sBlockCache == NULL) - return B_ERROR; + return B_NO_MEMORY; mutex_init(&sCachesLock, "block caches"); + mutex_init(&sNotificationsLock, "block cache notifications"); + new (&sCaches) DoublyLinkedList; // manually call constructor - thread_id thread = spawn_kernel_thread(&block_writer, "block writer", - B_LOW_PRIORITY, NULL); + sEventSemaphore = create_sem(0, "block cache event"); + if (sEventSemaphore < B_OK) + return sEventSemaphore; + + thread_id thread = spawn_kernel_thread(&block_notifier_and_writer, + "block writer/notifier", B_LOW_PRIORITY, NULL); if (thread >= B_OK) send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE); @@ -1342,7 +1565,7 @@ cache_start_transaction(void *_cache) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); if (cache->last_transaction && cache->last_transaction->open) { panic("last transaction (%ld) still open!\n", @@ -1369,7 +1592,7 @@ cache_sync_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); status_t status = B_ENTRY_NOT_FOUND; TRACE(("cache_sync_transaction(id %ld)\n", id)); @@ -1432,7 +1655,7 @@ transaction_notification_hook hook, void *data) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); TRACE(("cache_end_transaction(id = %ld)\n", id)); @@ -1442,13 +1665,13 @@ return B_BAD_VALUE; } + if (add_transaction_listener(cache, transaction, TRANSACTION_WRITTEN, hook, + data) != B_OK) { + return B_NO_MEMORY; + } + T(Action("end", cache, transaction)); - transaction->notification_hook = hook; - transaction->notification_data = data; - - notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); - // iterate through all blocks and free the unchanged original contents cached_block *block = transaction->first_block, *next; @@ -1479,6 +1702,7 @@ } transaction->open = false; + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); return B_OK; } @@ -1488,7 +1712,7 @@ cache_abort_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); TRACE(("cache_abort_transaction(id = %ld)\n", id)); @@ -1539,7 +1763,7 @@ transaction_notification_hook hook, void *data) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); TRACE(("cache_detach_sub_transaction(id = %ld)\n", id)); @@ -1556,14 +1780,15 @@ if (transaction == NULL) return B_NO_MEMORY; + if (add_transaction_listener(cache, transaction, TRANSACTION_WRITTEN, hook, + data) != B_OK) { + delete newTransaction; + return B_NO_MEMORY; + } + newTransaction->id = atomic_add(&cache->next_transaction_id, 1); T(Detach(cache, transaction, newTransaction)); - transaction->notification_hook = hook; - transaction->notification_data = data; - - notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); - // iterate through all blocks and free the unchanged original contents cached_block *block = transaction->first_block, *next, *last = NULL; @@ -1612,6 +1837,7 @@ transaction->has_sub_transaction = false; transaction->num_blocks = transaction->main_num_blocks; transaction->sub_num_blocks = 0; + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); hash_insert_grow(cache->transaction_hash, newTransaction); cache->last_transaction = newTransaction; @@ -1624,7 +1850,7 @@ cache_abort_sub_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); TRACE(("cache_abort_sub_transaction(id = %ld)\n", id)); @@ -1675,7 +1901,7 @@ cache_start_sub_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); TRACE(("cache_start_sub_transaction(id = %ld)\n", id)); @@ -1717,33 +1943,22 @@ /*! Adds a transaction listener that gets notified when the transaction - is ended, aborted, written, or idle. + is ended, aborted, written, or idle as specified by \a events. The listener gets automatically removed when the transaction ends. */ status_t -cache_add_transaction_listener(void *_cache, int32 id, - transaction_notification_hook hookFunction, void *data) +cache_add_transaction_listener(void *_cache, int32 id, int32 events, + transaction_notification_hook hook, void *data) { block_cache *cache = (block_cache *)_cache; - cache_hook *hook = new(std::nothrow) cache_hook; - if (hook == NULL) - return B_NO_MEMORY; + BenaphoreLocker locker(&cache->lock); - RecursiveLocker locker(&cache->lock); - cache_transaction *transaction = lookup_transaction(cache, id); - if (transaction == NULL) { - delete hook; + if (transaction == NULL) return B_BAD_VALUE; - } - hook->hook = hookFunction; - hook->data = data; - - transaction->listeners.Add(hook); - transaction->listener_change++; - return B_OK; + return add_transaction_listener(cache, transaction, events, hook, data); } @@ -1753,19 +1968,24 @@ { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) return B_BAD_VALUE; - HookList::Iterator iterator = transaction->listeners.GetIterator(); + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); while (iterator.HasNext()) { - cache_hook *hook = iterator.Next(); - if (hook->data == data && hook->hook == hookFunction) { + cache_listener *listener = iterator.Next(); + if (listener->data == data && listener->hook == hookFunction) { iterator.Remove(); - delete hook; - transaction->listener_change++; + + if (listener->events_pending != 0) { + MutexLocker _(sNotificationsLock); + if (listener->events_pending != 0) + cache->pending_notifications.Remove(listener); + } + delete listener; return B_OK; } } @@ -1781,7 +2001,7 @@ cached_block *block = (cached_block *)*_cookie; block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL || !transaction->open) @@ -1817,7 +2037,7 @@ cache_blocks_in_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) @@ -1831,7 +2051,7 @@ cache_blocks_in_main_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) @@ -1845,7 +2065,7 @@ cache_blocks_in_sub_transaction(void *_cache, int32 id) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); cache_transaction *transaction = lookup_transaction(cache, id); if (transaction == NULL) @@ -1866,7 +2086,7 @@ if (allowWrites) block_cache_sync(cache); - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); // free all blocks @@ -1915,7 +2135,7 @@ // we will sync all dirty blocks to disk that have a completed // transaction or no transaction only - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); hash_iterator iterator; hash_open(cache->hash, &iterator); @@ -1948,7 +2168,7 @@ return B_BAD_VALUE; } - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); for (; numBlocks > 0; numBlocks--, blockNumber++) { cached_block *block = (cached_block *)hash_lookup(cache->hash, @@ -1974,7 +2194,7 @@ block_cache_make_writable(void *_cache, off_t blockNumber, int32 transaction) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); if (cache->read_only) panic("tried to make block writable on a read-only cache!"); @@ -1996,7 +2216,7 @@ off_t length, int32 transaction) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); TRACE(("block_cache_get_writable_etc(block = %Ld, transaction = %ld)\n", blockNumber, transaction)); @@ -2020,7 +2240,7 @@ block_cache_get_empty(void *_cache, off_t blockNumber, int32 transaction) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); TRACE(("block_cache_get_empty(block = %Ld, transaction = %ld)\n", blockNumber, transaction)); @@ -2036,7 +2256,7 @@ block_cache_get_etc(void *_cache, off_t blockNumber, off_t base, off_t length) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); bool allocated; cached_block *block = get_cached_block(cache, blockNumber, &allocated); @@ -2073,7 +2293,7 @@ int32 transaction) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); cached_block *block = (cached_block *)hash_lookup(cache->hash, &blockNumber); @@ -2096,7 +2316,7 @@ block_cache_put(void *_cache, off_t blockNumber) { block_cache *cache = (block_cache *)_cache; - RecursiveLocker locker(&cache->lock); + BenaphoreLocker locker(&cache->lock); put_cached_block(cache, blockNumber); } From axeld at mail.berlios.de Thu Apr 3 13:22:14 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Apr 2008 13:22:14 +0200 Subject: [Haiku-commits] r24769 - haiku/trunk/src/system/kernel/cache Message-ID: <200804031122.m33BMElw013681@sheep.berlios.de> Author: axeld Date: 2008-04-03 13:22:14 +0200 (Thu, 03 Apr 2008) New Revision: 24769 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24769&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * Removed the "transaction_changed" leftover member. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-03 11:21:00 UTC (rev 24768) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-03 11:22:14 UTC (rev 24769) @@ -106,7 +106,6 @@ int32 next_transaction_id; cache_transaction *last_transaction; hash_table *transaction_hash; - int32 transaction_changed; object_cache *buffer_cache; block_list unused_blocks; @@ -545,7 +544,6 @@ next_transaction_id(1), last_transaction(NULL), transaction_hash(NULL), - transaction_changed(0), num_dirty_blocks(0), read_only(readOnly), deleting(false) From axeld at pinc-software.de Thu Apr 3 14:08:37 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 03 Apr 2008 14:08:37 +0200 CEST Subject: [Haiku-commits] r24761 - haiku/trunk/src/system/kernel/cache In-Reply-To: Message-ID: <17167940254-BeMail@zon> "Rene Gollent" wrote: > With this change I now eventually get a panic from the block > allocator > in the doubly linked list code, re assertion failed: fFirst != NULL & > & > fLast != NULL && fLast == fFirst) iirc. Please open a bug report if that still happens with anything after r24768. Bye, Axel. From kaoutsis at sch.gr Thu Apr 3 14:11:06 2008 From: kaoutsis at sch.gr (kaoutsis) Date: Thu, 03 Apr 2008 15:11:06 +0300 Subject: [Haiku-commits] r24768 - haiku/trunk/src/system/kernel/cache In-Reply-To: <200804031121.m33BL1OV012661@sheep.berlios.de> References: <200804031121.m33BL1OV012661@sheep.berlios.de> Message-ID: <47F4C95A.3010801@sch.gr> axeld at BerliOS wrote: > Author: axeld > Date: 2008-04-03 13:21:00 +0200 (Thu, 03 Apr 2008) > New Revision: 24768 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24768&view=rev > > Modified: > haiku/trunk/src/system/kernel/cache/block_cache.cpp > Log: > * Decoupled notifications from the block cache functions; they are now > called without having the cache's lock held. > * The only downside to this approach is that ending a transaction now needs > additional memory, and might therefore fail - that could be fixed by > allocating that memory upfront with the start of the new transaction, > though. > * Therefore, I reverted the cache lock to a benaphore, as the recursive > lock is no longer needed. > * The block writer thread is now a block writer and notifier thread: it will > wait for up to 2 seconds on the sEventSemaphore, and if nothing comes in, > it will continue with its previously sole job. > > > Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp > =================================================================== > --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-03 10:23:03 UTC (rev 24767) > +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-03 11:21:00 UTC (rev 24768) > [...] > > @@ -1717,33 +1943,22 @@ > > > /*! Adds a transaction listener that gets notified when the transaction > - is ended, aborted, written, or idle. > + is ended, aborted, written, or idle as specified by \a events. > The listener gets automatically removed when the transaction ends. > */ > status_t > -cache_add_transaction_listener(void *_cache, int32 id, > - transaction_notification_hook hookFunction, void *data) > +cache_add_transaction_listener(void *_cache, int32 id, int32 events, > + transaction_notification_hook hook, void *data) > { > block_cache *cache = (block_cache *)_cache; > > - cache_hook *hook = new(std::nothrow) cache_hook; > - if (hook == NULL) > - return B_NO_MEMORY; > + BenaphoreLocker locker(&cache->lock); > > - RecursiveLocker locker(&cache->lock); > - > cache_transaction *transaction = lookup_transaction(cache, id); > - if (transaction == NULL) { > - delete hook; > + if (transaction == NULL) > return B_BAD_VALUE; > - } > > - hook->hook = hookFunction; > - hook->data = data; > - > - transaction->listeners.Add(hook); > - transaction->listener_change++; > - return B_OK; > + return add_transaction_listener(cache, transaction, events, hook, data); > } > > > i get this: Link generated/objects/haiku/x86/release/add-ons/kernel/file_systems/bfs/bfs generated/objects/haiku/x86/release/add-ons/kernel/file_systems/bfs/Inode.o: In function `InodeAllocator::Keep(void)': Inode.cpp:(.text+0x535): undefined reference to `cache_add_transaction_listener' generated/objects/haiku/x86/release/add-ons/kernel/file_systems/bfs/Journal.o: In function `Journal::Lock(Transaction *)': Journal.cpp:(.text+0x1cbe): undefined reference to `cache_add_transaction_listener' collect2: ld returned 1 exit status may be another change to Inode.cpp and Journal.cpp is needed? the function cache_add_transaction_listener() in these files has now a different parameter list ? Good bye, Vasilis From axeld at mail.berlios.de Thu Apr 3 14:19:44 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Apr 2008 14:19:44 +0200 Subject: [Haiku-commits] r24770 - haiku/trunk/src/kits/tracker Message-ID: <200804031219.m33CJiar017131@sheep.berlios.de> Author: axeld Date: 2008-04-03 14:19:44 +0200 (Thu, 03 Apr 2008) New Revision: 24770 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24770&view=rev Modified: haiku/trunk/src/kits/tracker/CountView.cpp Log: Cleanup. Modified: haiku/trunk/src/kits/tracker/CountView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/CountView.cpp 2008-04-03 11:22:14 UTC (rev 24769) +++ haiku/trunk/src/kits/tracker/CountView.cpp 2008-04-03 12:19:44 UTC (rev 24770) @@ -34,36 +34,42 @@ // defines the status area drawn in the bottom left corner of a Tracker window +#include "CountView.h" + #include #include "AutoLock.h" #include "Bitmaps.h" -#include "CountView.h" #include "ContainerWindow.h" #include "DirMenu.h" #include "PoseView.h" + +const bigtime_t kBarberPoleDelay = 500000; + + BCountView::BCountView(BRect bounds, BPoseView* view) - : BView(bounds, "CountVw", B_FOLLOW_LEFT + B_FOLLOW_BOTTOM, + : BView(bounds, "CountVw", B_FOLLOW_LEFT + B_FOLLOW_BOTTOM, B_PULSE_NEEDED | B_WILL_DRAW), - fLastCount(-1), - fPoseView(view), - fShowingBarberPole(false), - fBarberPoleMap(NULL), - fLastBarberPoleOffset(5), - fStartSpinningAfter(0), - fTypeAheadString("") - + fLastCount(-1), + fPoseView(view), + fShowingBarberPole(false), + fBarberPoleMap(NULL), + fLastBarberPoleOffset(5), + fStartSpinningAfter(0), + fTypeAheadString("") { - GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, kResBarberPoleBitmap, - &fBarberPoleMap); + GetTrackerResources()->GetBitmapResource(B_MESSAGE_TYPE, + kResBarberPoleBitmap, &fBarberPoleMap); } + BCountView::~BCountView() { delete fBarberPoleMap; } + void BCountView::TrySpinningBarberPole() { @@ -83,25 +89,26 @@ Invalidate(BarberPoleInnerRect()); } -void + +void BCountView::Pulse() { TrySpinningBarberPole(); } -void + +void BCountView::EndBarberPole() { if (!fShowingBarberPole) return; - + fShowingBarberPole = false; Invalidate(); } -const bigtime_t kBarberPoleDelay = 500000; -void +void BCountView::StartBarberPole() { AutoLock lock(Window()); @@ -113,7 +120,8 @@ // wait a bit before showing the barber pole } -BRect + +BRect BCountView::BarberPoleInnerRect() const { BRect result = Bounds(); @@ -123,7 +131,8 @@ return result; } -BRect + +BRect BCountView::BarberPoleOuterRect() const { BRect result(BarberPoleInnerRect()); @@ -131,6 +140,7 @@ return result; } + BRect BCountView::TextInvalRect() const { @@ -138,12 +148,13 @@ result.InsetBy(4, 2); // if the barber pole is not present, use its space for text - if(fShowingBarberPole) + if (fShowingBarberPole) result.right -= 10; return result; } + BRect BCountView::TextAndBarberPoleRect() const { @@ -153,6 +164,7 @@ return result; } + void BCountView::CheckCount() { @@ -165,6 +177,7 @@ TrySpinningBarberPole(); } + void BCountView::Draw(BRect) { @@ -179,17 +192,18 @@ itemString << fLastCount << " items"; } else itemString << TypeAhead(); - + BString string(itemString); BRect textRect(TextInvalRect()); TruncateString(&string, B_TRUNCATE_END, textRect.Width()); - if (IsTypingAhead()) + if (IsTypingAhead()) { // use a muted gray for the typeahead SetHighColor(tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT)); - else + } else SetHighColor(0, 0, 0); + MovePenTo(textRect.LeftBottom()); DrawString(string.String()); @@ -212,7 +226,7 @@ EndLineArray(); return; } - + BRect barberPoleRect(BarberPoleOuterRect()); AddLine(barberPoleRect.LeftTop(), barberPoleRect.RightTop(), shadow); @@ -237,6 +251,7 @@ DrawBitmap(fBarberPoleMap, destRect); } + void BCountView::MouseDown(BPoint) { @@ -266,6 +281,7 @@ } } + void BCountView::AttachedToWindow() { @@ -278,20 +294,23 @@ CheckCount(); } -void + +void BCountView::SetTypeAhead(const char *string) { fTypeAheadString = string; Invalidate(); } + const char * BCountView::TypeAhead() const { return fTypeAheadString.String(); } -bool + +bool BCountView::IsTypingAhead() const { return fTypeAheadString.Length() != 0; From anevilyak at gmail.com Thu Apr 3 14:27:36 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 3 Apr 2008 07:27:36 -0500 Subject: [Haiku-commits] r24761 - haiku/trunk/src/system/kernel/cache In-Reply-To: <17167940254-BeMail@zon> References: <17167940254-BeMail@zon> Message-ID: On Thu, Apr 3, 2008 at 7:08 AM, Axel D?rfler wrote: > "Rene Gollent" wrote: > > With this change I now eventually get a panic from the block > > allocator > > in the doubly linked list code, re assertion failed: fFirst != NULL & > > & > > fLast != NULL && fLast == fFirst) iirc. > > Please open a bug report if that still happens with anything after > r24768. > Will do, it'll be some hours before I can test this though. Regards, Rene From axeld at mail.berlios.de Thu Apr 3 14:39:06 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Apr 2008 14:39:06 +0200 Subject: [Haiku-commits] r24771 - in haiku/trunk/src: add-ons/tracker/zipomatic apps/packageinstaller Message-ID: <200804031239.m33Cd6OA020098@sheep.berlios.de> Author: axeld Date: 2008-04-03 14:39:06 +0200 (Thu, 03 Apr 2008) New Revision: 24771 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24771&view=rev Modified: haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.rdef haiku/trunk/src/apps/packageinstaller/PackageInstaller.rdef Log: * I'm not sure if that puts more or less pressure on stippi, but the PackageInstaller, ZipOMatic, and the Expander now all have the same icon (instead of none, resp. a BeOS bitmap icon). Modified: haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.rdef =================================================================== --- haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.rdef 2008-04-03 12:19:44 UTC (rev 24770) +++ haiku/trunk/src/add-ons/tracker/zipomatic/ZipOMatic.rdef 2008-04-03 12:39:06 UTC (rev 24771) @@ -1,16 +1,12 @@ -/* - * ZipOMatic.rdef - */ - resource app_signature "application/x-vnd.haiku.zip-o-matic"; resource app_flags B_SINGLE_LAUNCH; resource app_version { - major = 1, + major = 1, middle = 0, minor = 0, - + /* 0 = development 1 = alpha 2 = beta 3 = gamma 4 = golden master 5 = final */ variety = 0, @@ -18,13 +14,38 @@ internal = 1, short_info = "ZipOMatic", - long_info = "ZipOMatic, Copyright 2003-2006 Haiku Inc." + long_info = "ZipOMatic, Copyright 2003-2008 Haiku Inc." }; resource file_types message { "types" = "application/octet-stream" }; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E6369660E0500040065035D2B0C0385501C0200060238B0AD39B313BC39613B" + $"3C1049FADA48DA6900663200FF834F1C02000602BAC477B68B1E383D42BC6FBF" + $"4A77B34B835900A3784BFF76401C020006023A5A93364779BA1E153E2FD44ABA" + $"0945BA0400E5B07BFFFFCE9E03945F2C02000602B9A55E3826F4BA0888BB71D4" + $"49A1AB4BD47500BE8852FFDCA977020006023A32CCB3AE813614FC3C7C854AB1" + $"F4444C1900FCCC9DFFEEB78103FFDCBA020006023CBAB636B0FDB853093E5B6E" + $"484D0548998100FFE3C7FFF3B476020006023A6157385DA4B8EDF53AF2894AF1" + $"C14968F500FFD5ACFFB0784202000602B56B53389A1FBC6007B91EFD4A160A4B" + $"0820007C4E28FFA175450F0A07405E485E4C605D4BC93CC3195C46544508052A" + $"472A51405C524A52440A0C384E22432A3B223B382E3E2E4526562C52375E3A4C" + $"4C40460A043E2E423E524552360A053E2E423E5245C3ACC2453E410A052A3B3E" + $"2E3E41BC85C2182ABF590A043E41BC85C2184046C162C13E0A0440465234524A" + $"405C0A0340464A4640500A06B7BDC1592E4E4057405C2A512AC1570A04404640" + $"572E4EB7BDC1590A044526562C52373E2E0A042243384E40462A3B0A04223B38" + $"2E3E2E2A3B0A04404652375E3A4C4C0F0A010100000A0001011001178402040A" + $"050107000A020108000A080109000A0D010A000A0001021001178402040A0401" + $"05000A060103000A070104000A030106000A09010B000A0B010C000A0A010D00" + $"0A0C010E00" +}; + +#else // HAIKU_TARGET_PLATFORM_HAIKU + resource large_icon array { $"FFFFFFFFFFFF00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" $"FFFFFFFFFF00FAFAFAFA0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" @@ -79,3 +100,4 @@ $"FFFFFFFFFFFFFFFF0000FFFFFFFFFFFF" }; +endif // HAIKU_TARGET_PLATFORM_HAIKU Modified: haiku/trunk/src/apps/packageinstaller/PackageInstaller.rdef =================================================================== --- haiku/trunk/src/apps/packageinstaller/PackageInstaller.rdef 2008-04-03 12:19:44 UTC (rev 24770) +++ haiku/trunk/src/apps/packageinstaller/PackageInstaller.rdef 2008-04-03 12:39:06 UTC (rev 24771) @@ -1,4 +1,3 @@ - resource app_signature "application/x-vnd.Haiku-PackageInstaller"; resource file_types message { @@ -15,8 +14,32 @@ internal = 0, short_info = "Package Installer", - long_info = "Package Installer ?2007 Haiku, Inc." + long_info = "Package Installer ?2007-2008 Haiku, Inc." }; resource app_flags B_SINGLE_LAUNCH; +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E6369660E0500040065035D2B0C0385501C0200060238B0AD39B313BC39613B" + $"3C1049FADA48DA6900663200FF834F1C02000602BAC477B68B1E383D42BC6FBF" + $"4A77B34B835900A3784BFF76401C020006023A5A93364779BA1E153E2FD44ABA" + $"0945BA0400E5B07BFFFFCE9E03945F2C02000602B9A55E3826F4BA0888BB71D4" + $"49A1AB4BD47500BE8852FFDCA977020006023A32CCB3AE813614FC3C7C854AB1" + $"F4444C1900FCCC9DFFEEB78103FFDCBA020006023CBAB636B0FDB853093E5B6E" + $"484D0548998100FFE3C7FFF3B476020006023A6157385DA4B8EDF53AF2894AF1" + $"C14968F500FFD5ACFFB0784202000602B56B53389A1FBC6007B91EFD4A160A4B" + $"0820007C4E28FFA175450F0A07405E485E4C605D4BC93CC3195C46544508052A" + $"472A51405C524A52440A0C384E22432A3B223B382E3E2E4526562C52375E3A4C" + $"4C40460A043E2E423E524552360A053E2E423E5245C3ACC2453E410A052A3B3E" + $"2E3E41BC85C2182ABF590A043E41BC85C2184046C162C13E0A0440465234524A" + $"405C0A0340464A4640500A06B7BDC1592E4E4057405C2A512AC1570A04404640" + $"572E4EB7BDC1590A044526562C52373E2E0A042243384E40462A3B0A04223B38" + $"2E3E2E2A3B0A04404652375E3A4C4C0F0A010100000A0001011001178402040A" + $"050107000A020108000A080109000A0D010A000A0001021001178402040A0401" + $"05000A060103000A070104000A030106000A09010B000A0B010C000A0A010D00" + $"0A0C010E00" +}; + +#endif From axeld at mail.berlios.de Thu Apr 3 16:14:28 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Apr 2008 16:14:28 +0200 Subject: [Haiku-commits] r24772 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/add-ons/kernel/file_systems/bfs src/tools/fs_shell Message-ID: <200804031414.m33EESld030647@sheep.berlios.de> Author: axeld Date: 2008-04-03 16:14:27 +0200 (Thu, 03 Apr 2008) New Revision: 24772 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24772&view=rev Modified: haiku/trunk/headers/os/drivers/fs_cache.h haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp haiku/trunk/src/tools/fs_shell/block_cache.cpp Log: Looks like some bloke forgot to commit *some* files that should have been part of r24768 (block cache notification mechanism rewrite). Thanks for the note, Vasilis! Modified: haiku/trunk/headers/os/drivers/fs_cache.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_cache.h 2008-04-03 12:39:06 UTC (rev 24771) +++ haiku/trunk/headers/os/drivers/fs_cache.h 2008-04-03 14:14:27 UTC (rev 24772) @@ -11,11 +11,12 @@ #include +/* transaction events */ enum { - TRANSACTION_WRITTEN, - TRANSACTION_ABORTED, - TRANSACTION_ENDED, - TRANSACTION_IDLE + TRANSACTION_WRITTEN = 0x01, + TRANSACTION_ABORTED = 0x02, + TRANSACTION_ENDED = 0x04, + TRANSACTION_IDLE = 0x08 }; typedef void (*transaction_notification_hook)(int32 id, int32 event, @@ -36,7 +37,8 @@ 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, - transaction_notification_hook hook, void *data); + 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, Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-04-03 12:39:06 UTC (rev 24771) +++ haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-04-03 14:14:27 UTC (rev 24772) @@ -12,10 +12,10 @@ enum { - FSSH_TRANSACTION_WRITTEN, - FSSH_TRANSACTION_ABORTED, - FSSH_TRANSACTION_ENDED, - FSSH_TRANSACTION_IDLE + FSSH_TRANSACTION_WRITTEN = 0x01, + FSSH_TRANSACTION_ABORTED = 0x02, + FSSH_TRANSACTION_ENDED = 0x04, + FSSH_TRANSACTION_IDLE = 0x08 }; typedef void (*fssh_transaction_notification_hook)(int32_t id, int32_t event, @@ -40,7 +40,8 @@ extern fssh_status_t fssh_cache_start_sub_transaction(void *_cache, int32_t id); extern fssh_status_t fssh_cache_add_transaction_listener(void *_cache, - int32_t id, fssh_transaction_notification_hook hook, + int32_t id, int32_t events, + fssh_transaction_notification_hook hook, void *data); extern fssh_status_t fssh_cache_remove_transaction_listener(void *_cache, int32_t id, fssh_transaction_notification_hook hook, Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-04-03 12:39:06 UTC (rev 24771) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-04-03 14:14:27 UTC (rev 24772) @@ -252,7 +252,7 @@ if (status == B_OK) { cache_add_transaction_listener(volume->BlockCache(), fTransaction->ID(), - &_TransactionListener, fInode); + TRANSACTION_ABORTED, &_TransactionListener, fInode); } fTransaction = NULL; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-03 12:39:06 UTC (rev 24771) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-03 14:14:27 UTC (rev 24772) @@ -536,9 +536,6 @@ { LogEntry *logEntry = (LogEntry *)_logEntry; - if (event != TRANSACTION_WRITTEN) - return; - PRINT(("Log entry %p has been finished, transaction ID = %ld\n", logEntry, transactionID)); @@ -588,9 +585,6 @@ /*static*/ void Journal::_TransactionListener(int32 transactionID, int32 event, void *_journal) { - if (event != TRANSACTION_IDLE) - return; - // The current transaction seems to be idle - flush it Journal *journal = (Journal *)_journal; @@ -865,7 +859,7 @@ } cache_add_transaction_listener(fVolume->BlockCache(), fTransactionID, - _TransactionListener, this); + TRANSACTION_IDLE, _TransactionListener, this); return B_OK; } Modified: haiku/trunk/src/tools/fs_shell/block_cache.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-04-03 12:39:06 UTC (rev 24771) +++ haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-04-03 14:14:27 UTC (rev 24772) @@ -50,7 +50,7 @@ void *data; }; -typedef DoublyLinkedList HookList; +typedef DoublyLinkedList HookList; struct cache_transaction { cache_transaction(); @@ -377,7 +377,7 @@ fssh_panic("put_cached_block: invalid block number %lld (max %lld)", blockNumber, cache->max_blocks - 1); } - + cached_block *block = (cached_block *)hash_lookup(cache->hash, &blockNumber); if (block != NULL) put_cached_block(cache, block); @@ -974,9 +974,11 @@ The listener gets automatically removed in this case. */ fssh_status_t -fssh_cache_add_transaction_listener(void *_cache, int32_t id, +fssh_cache_add_transaction_listener(void *_cache, int32_t id, int32_t events, fssh_transaction_notification_hook hookFunction, void *data) { +// TODO: this is currently not used in a critical context in BFS +#if 0 block_cache *cache = (block_cache *)_cache; cache_hook *hook = new(std::nothrow) cache_hook; @@ -995,6 +997,7 @@ hook->data = data; transaction->listeners.Add(hook); +#endif return FSSH_B_OK; } @@ -1061,7 +1064,7 @@ *_unchangedData = block->original_data; *_cookie = (fssh_addr_t)block; - return FSSH_B_OK; + return FSSH_B_OK; } @@ -1130,7 +1133,7 @@ cache->FreeBlock(block); } - // free all transactions (they will all be aborted) + // free all transactions (they will all be aborted) cookie = 0; cache_transaction *transaction; From axeld at pinc-software.de Thu Apr 3 16:14:52 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 03 Apr 2008 16:14:52 +0200 CEST Subject: [Haiku-commits] r24768 - haiku/trunk/src/system/kernel/cache In-Reply-To: <47F4C95A.3010801@sch.gr> Message-ID: <24742884780-BeMail@zon> kaoutsis wrote: > may be another change to Inode.cpp and Journal.cpp is needed? > the function cache_add_transaction_listener() in these files has now > a different parameter list ? Ooops, I did it again ;-) Sorry, it's fixed in r24772. Bye, Axel. From anevilyak at gmail.com Thu Apr 3 16:18:26 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 3 Apr 2008 09:18:26 -0500 Subject: [Haiku-commits] r24768 - haiku/trunk/src/system/kernel/cache In-Reply-To: <24742884780-BeMail@zon> References: <47F4C95A.3010801@sch.gr> <24742884780-BeMail@zon> Message-ID: On Thu, Apr 3, 2008 at 9:14 AM, Axel D?rfler wrote: > Ooops, I did it again ;-) > Sorry, it's fixed in r24772. > Great, now I'm going to have Britney Spears in my head all day :P Rene From stippi at mail.berlios.de Thu Apr 3 16:25:27 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 3 Apr 2008 16:25:27 +0200 Subject: [Haiku-commits] r24773 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel Message-ID: <200804031425.m33EPRQd031805@sheep.berlios.de> Author: stippi Date: 2008-04-03 16:24:10 +0200 (Thu, 03 Apr 2008) New Revision: 24773 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24773&view=rev Modified: haiku/trunk/data/artwork/boot_splash/splash_logo haiku/trunk/data/artwork/boot_splash/splash_logo.png haiku/trunk/headers/private/kernel/boot/images.h haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp haiku/trunk/src/system/kernel/boot_splash.cpp Log: * Revised boot splash artwork, the logo is back in the lower right corner, the icons are centered. * The boot loader and kernel now use the placement info that generate_boot_screen now generates. * Made the code that draws the images handle the case where any of the images is larger than the frame buffer. * All drawing functions need to know the image width (analogous for bytes per row). Modified: haiku/trunk/data/artwork/boot_splash/splash_logo =================================================================== (Binary files differ) Modified: haiku/trunk/data/artwork/boot_splash/splash_logo.png =================================================================== (Binary files differ) Modified: haiku/trunk/headers/private/kernel/boot/images.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/images.h 2008-04-03 14:14:27 UTC (rev 24772) +++ haiku/trunk/headers/private/kernel/boot/images.h 2008-04-03 14:24:10 UTC (rev 24773) @@ -1,21349 +1,11630 @@ -// This file was generated by the generate_boot_screen build tool. +// This file was generated by the generate_boot_screen Haiku build tool. -static const uint16 kSplashLogoWidth = 397; -static const uint16 kSplashLogoHeight = 90; +static const int32 kSplashLogoPlacementX = 80; +static const int32 kSplashLogoPlacementY = 90; +static const int32 kSplashIconsPlacementX = 50; +static const int32 kSplashIconsPlacementY = 50; + +static const uint16 kSplashLogoWidth = 294; +static const uint16 kSplashLogoHeight = 86; static const uint8 kSplashLogoImage[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x05, 0x05, 0x05, 0x05, 0x05, - 0x05, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x05, 0x05, 0x05, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x05, 0x05, - 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x05, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x00, 0x00, 0x00, 0x00, [... truncated: 32268 lines follow ...] From axeld at mail.berlios.de Thu Apr 3 16:36:40 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 3 Apr 2008 16:36:40 +0200 Subject: [Haiku-commits] r24774 - haiku/trunk/build/jam Message-ID: <200804031436.m33EaeKb000534@sheep.berlios.de> Author: axeld Date: 2008-04-03 16:36:39 +0200 (Thu, 03 Apr 2008) New Revision: 24774 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24774&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Added syskonnect driver to the build to close ticket #1945 again that diver reopened so fast. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-03 14:24:10 UTC (rev 24773) +++ haiku/trunk/build/jam/HaikuImage 2008-04-03 14:36:39 UTC (rev 24774) @@ -127,7 +127,7 @@ BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com etherpci $(X86_ONLY)ipro1000 $(X86_ONLY)rtl8139 rtl8169 sis900 $(X86_ONLY)via_rhine wb840 net_stack $(X86_ONLY)ipro100 $(X86_ONLY)nforce #vlance - $(X86_ONLY)marvell_yukon + $(X86_ONLY)marvell_yukon $(X86_ONLY)syskonnect $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x ; #BEOS_ADD_ONS_DRIVERS_ACPI = $(X86_ONLY)acpi_button ; From mmu_man at mail.berlios.de Thu Apr 3 16:59:04 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 3 Apr 2008 16:59:04 +0200 Subject: [Haiku-commits] r24775 - haiku/trunk/build/jam Message-ID: <200804031459.m33Ex497004390@sheep.berlios.de> Author: mmu_man Date: 2008-04-03 16:59:04 +0200 (Thu, 03 Apr 2008) New Revision: 24775 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24775&view=rev Modified: haiku/trunk/build/jam/UserBuildConfig.ReadMe Log: Just make sure someone copying it as UserBuildConfig will understand what is wrong and where instead of reporting build breakage induced by their misbehaviour. Modified: haiku/trunk/build/jam/UserBuildConfig.ReadMe =================================================================== --- haiku/trunk/build/jam/UserBuildConfig.ReadMe 2008-04-03 14:36:39 UTC (rev 24774) +++ haiku/trunk/build/jam/UserBuildConfig.ReadMe 2008-04-03 14:59:04 UTC (rev 24775) @@ -7,7 +7,11 @@ # to UserBuildConfig -- you don't want all the things to happen, that are # specified here. Rather create an empty UserBuildConfig and copy the lines # you really want, or start out with UserBuildConfig.sample. +# Of course, noone reads ReadMe files, so they will just get an error here +# when copying it and jamming: +Exit You must NOT copy UserBuildConfig.ReadMe directly but use parts of it! ; + # Adding timezone and keymap settings AddSymlinkToHaikuImage home config settings : /boot/beos/etc/timezones/Europe/Paris : timezone ; From axeld at pinc-software.de Thu Apr 3 17:26:23 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 03 Apr 2008 17:26:23 +0200 CEST Subject: [Haiku-commits] r24768 - haiku/trunk/src/system/kernel/cache In-Reply-To: Message-ID: <29033048405-BeMail@zon> "Rene Gollent" wrote: > On Thu, Apr 3, 2008 at 9:14 AM, Axel D?rfler > wrote: > > Ooops, I did it again ;-) > > Sorry, it's fixed in r24772. > Great, now I'm going to have Britney Spears in my head all day :P I may have heard it somewhere, but I don't even know that song, only its name, sorry again ;-) Bye, Axel. From anevilyak at gmail.com Thu Apr 3 17:44:40 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 3 Apr 2008 10:44:40 -0500 Subject: [Haiku-commits] r24768 - haiku/trunk/src/system/kernel/cache In-Reply-To: <29033048405-BeMail@zon> References: <29033048405-BeMail@zon> Message-ID: On Thu, Apr 3, 2008 at 10:26 AM, Axel D?rfler wrote: > I may have heard it somewhere, but I don't even know that song, only > its name, sorry again ;-) Ah, I thought you quoted its name intentionally :) Rene From stippi at mail.berlios.de Thu Apr 3 19:21:35 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 3 Apr 2008 19:21:35 +0200 Subject: [Haiku-commits] r24776 - haiku/trunk/src/apps/launchbox Message-ID: <200804031721.m33HLZ4a019499@sheep.berlios.de> Author: stippi Date: 2008-04-03 19:21:34 +0200 (Thu, 03 Apr 2008) New Revision: 24776 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24776&view=rev Modified: haiku/trunk/src/apps/launchbox/MainWindow.cpp Log: Don't display error when BRoster::Launch() returns B_ALREADY_RUNNING... Modified: haiku/trunk/src/apps/launchbox/MainWindow.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/MainWindow.cpp 2008-04-03 14:59:04 UTC (rev 24775) +++ haiku/trunk/src/apps/launchbox/MainWindow.cpp 2008-04-03 17:21:34 UTC (rev 24776) @@ -139,7 +139,7 @@ "running?"; } else { status_t ret = be_roster->Launch(button->Ref()); - if (ret < B_OK) { + if (ret < B_OK && ret != B_ALREADY_RUNNING) { errorMessage = "Failed to launch '"; BPath path(button->Ref()); if (path.InitCheck() >= B_OK) @@ -154,7 +154,7 @@ } if (!launchedByRef && button->AppSignature()) { status_t ret = be_roster->Launch(button->AppSignature()); - if (ret != B_OK) { + if (ret != B_OK && ret != B_ALREADY_RUNNING) { errorMessage = "Failed to launch application with " "signature '"; errorMessage << button->AppSignature() << "'.\n\nError: "; From umccullough at gmail.com Thu Apr 3 20:10:28 2008 From: umccullough at gmail.com (Urias McCullough) Date: Thu, 3 Apr 2008 11:10:28 -0700 Subject: [Haiku-commits] r24775 - haiku/trunk/build/jam In-Reply-To: <200804031459.m33Ex497004390@sheep.berlios.de> References: <200804031459.m33Ex497004390@sheep.berlios.de> Message-ID: <1e80d8750804031110v6a0e08b9t793690a1a71d04d0@mail.gmail.com> On 03/04/2008, mmu_man at BerliOS wrote: > # to UserBuildConfig -- you don't want all the things to happen, that are > # specified here. Rather create an empty UserBuildConfig and copy the lines > # you really want, or start out with UserBuildConfig.sample. > +# Of course, noone reads ReadMe files, so they will just get an error here > +# when copying it and jamming: > +Exit You must NOT copy UserBuildConfig.ReadMe directly but use parts of it! ; Ah - nice and simple :) From mmlr at mail.berlios.de Thu Apr 3 20:14:12 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 3 Apr 2008 20:14:12 +0200 Subject: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs Message-ID: <200804031814.m33IEC8D012359@sheep.berlios.de> Author: mmlr Date: 2008-04-03 20:14:11 +0200 (Thu, 03 Apr 2008) New Revision: 24777 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24777&view=rev Modified: haiku/trunk/headers/private/kernel/disk_device_manager/KDiskDeviceManager.h haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp haiku/trunk/src/system/kernel/fs/vfs_boot.cpp Log: Implement node monitoring in the kernel disk device manager. * Added {Create|Delete}Device() analogous to {Create|Delete}FileDevice * Added a small DeviceWatcher class that reacts to entry creation/removal * Implemented a way to start/stop node monitoring * Start watching for devices after the boot volume has been mounted and the the second initial scan was run The disk device manager now creates and scans a device when a "raw" node is published and deletes the device on removal. This makes hot-plugging of disk devices (for example memory sticks using usb_disk) work. Their partitions will be scanned and published so they can be mounted. Somehow the removal of the partitions does not yet work however, any insights are welcome. Modified: haiku/trunk/headers/private/kernel/disk_device_manager/KDiskDeviceManager.h =================================================================== --- haiku/trunk/headers/private/kernel/disk_device_manager/KDiskDeviceManager.h 2008-04-03 17:21:34 UTC (rev 24776) +++ haiku/trunk/headers/private/kernel/disk_device_manager/KDiskDeviceManager.h 2008-04-03 18:14:11 UTC (rev 24777) @@ -65,6 +65,9 @@ status_t ScanPartition(KPartition* partition); + partition_id CreateDevice(const char *path, bool *newlyCreated = NULL); + status_t DeleteDevice(const char *path); + partition_id CreateFileDevice(const char* filePath, bool* newlyCreated = NULL); status_t DeleteFileDevice(const char *filePath); @@ -90,13 +93,9 @@ KDiskSystem *LoadDiskSystem(disk_system_id id); KDiskSystem *LoadNextDiskSystem(int32 *cookie); - // Watching - - // TODO: Watching service for the kernel. The userland watching is handled - // by the registrar. - status_t InitialDeviceScan(); status_t RescanDiskSystems(); + status_t StartMonitoring(); private: static status_t _CheckMediaStatusDaemon(void* self); @@ -117,10 +116,13 @@ status_t _ScanPartition(KPartition *partition); // used by the other _ScanPartition() version only + status_t _AddRemoveMonitoring(const char *path, bool add); + struct DeviceMap; struct DiskSystemMap; struct PartitionMap; struct PartitionSet; + class DeviceWatcher; BLocker fLock; DeviceMap *fDevices; @@ -129,6 +131,7 @@ PartitionSet *fObsoletePartitions; thread_id fMediaChecker; volatile bool fTerminating; + DeviceWatcher *fDeviceWatcher; static KDiskDeviceManager *sDefaultManager; }; Modified: haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp =================================================================== --- haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp 2008-04-03 17:21:34 UTC (rev 24776) +++ haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp 2008-04-03 18:14:11 UTC (rev 24777) @@ -23,6 +23,11 @@ #include #include +#include +#include +#include +#include + #include #include #include @@ -87,6 +92,73 @@ }; +// DeviceWatcher +class KDiskDeviceManager::DeviceWatcher : public NotificationListener { + public: + DeviceWatcher(KDiskDeviceManager *manager) + : fManager(manager) + { + } + + virtual ~DeviceWatcher() + { + } + + virtual void EventOccured(NotificationService &service, + const KMessage *event) + { + int32 opCode = event->GetInt32("opcode", -1); + switch (opCode) { + case B_ENTRY_CREATED: + case B_ENTRY_REMOVED: + { + const char *name = event->GetString("name", ""); + dev_t device = event->GetInt32("device", -1); + ino_t directory = event->GetInt64("directory", -1); + ino_t node = event->GetInt64("node", -1); + + // TODO: it would be nice if we could stat based on the + // node here instead of having to resolve the path + KPath path(B_PATH_NAME_LENGTH + 1); + if (path.InitCheck() != B_OK + || vfs_entry_ref_to_path(device, directory, name, + path.LockBuffer(), path.BufferSize()) != B_OK) + break; + path.UnlockBuffer(); + + struct stat st; + if (lstat(path.Path(), &st) != 0) + break; + + if (S_ISDIR(st.st_mode)) { + if (opCode == B_ENTRY_CREATED) + add_node_listener(device, node, B_WATCH_DIRECTORY, + *this); + else + remove_node_listener(device, node, *this); + } else { + if (strcmp(name, "raw") == 0) { + // a new raw device was added/removed + if (opCode == B_ENTRY_CREATED) + fManager->CreateDevice(path.Path()); + else + fManager->DeleteDevice(path.Path()); + } + } + + break; + } + + default: + break; + } + } + + private: + KDiskDeviceManager *fManager; +}; + + static bool is_active_job_status(uint32 status) { @@ -105,7 +177,8 @@ fDiskSystems(new(nothrow) DiskSystemMap), fObsoletePartitions(new(nothrow) PartitionSet), fMediaChecker(-1), - fTerminating(false) + fTerminating(false), + fDeviceWatcher(new(nothrow) DeviceWatcher(this)) { if (InitCheck() != B_OK) return; @@ -129,6 +202,9 @@ status_t result; wait_for_thread(fMediaChecker, &result); + // stop all node monitoring + _AddRemoveMonitoring("/dev/disk", false); + // remove all devices for (int32 cookie = 0; KDiskDevice *device = NextDevice(&cookie);) { PartitionRegistrar _(device); @@ -488,6 +564,78 @@ } +partition_id +KDiskDeviceManager::CreateDevice(const char *path, bool *newlyCreated) +{ + if (!path) + return B_BAD_VALUE; + + status_t error = B_ERROR; + if (ManagerLocker locker = this) { + KDiskDevice *device = FindDevice(path); + if (device != NULL) { + // we already know this device + if (newlyCreated) + *newlyCreated = false; + + return device->ID(); + } + + // create a KDiskDevice for it + device = new(nothrow) KDiskDevice; + if (!device) + return B_NO_MEMORY; + + // initialize and add the device + error = device->SetTo(path); + + // Note: Here we are allowed to lock a device although already having + // the manager locked, since it is not yet added to the manager. + DeviceWriteLocker deviceLocker(device); + if (error == B_OK && !deviceLocker.IsLocked()) + error = B_ERROR; + if (error == B_OK && !_AddDevice(device)) + error = B_NO_MEMORY; + + // cleanup on error + if (error != B_OK) { + delete device; + return error; + } + + if (error == B_OK) { + // scan for partitions + _ScanPartition(device, false); + device->UnmarkBusy(true); + + if (newlyCreated) + *newlyCreated = true; + + return device->ID(); + } + } + + return error; +} + + +status_t +KDiskDeviceManager::DeleteDevice(const char *path) +{ + KDiskDevice *device = FindDevice(path); + if (device == NULL) + return B_ENTRY_NOT_FOUND; + + PartitionRegistrar _(device, true); + if (DeviceWriteLocker locker = device) { + if (_RemoveDevice(device)) + return B_OK; + } + + return B_ERROR; +} + + // CreateFileDevice partition_id KDiskDeviceManager::CreateFileDevice(const char *filePath, bool* newlyCreated) @@ -758,6 +906,18 @@ return error; } + +status_t +KDiskDeviceManager::StartMonitoring() +{ + // do another scan, this will populate the devfs directories + InitialDeviceScan(); + // start monitoring all dirs under /dev/disk + status_t result = _AddRemoveMonitoring("/dev/disk", true); + return result; +} + + // _RescanDiskSystems status_t KDiskDeviceManager::_RescanDiskSystems(bool fileSystems) @@ -1127,6 +1287,50 @@ status_t +KDiskDeviceManager::_AddRemoveMonitoring(const char *path, bool add) +{ + struct stat st; + if (lstat(path, &st) < 0) + return errno; + + status_t error = B_ENTRY_NOT_FOUND; + if (S_ISDIR(st.st_mode)) { + if (add) { + error = add_node_listener(st.st_dev, st.st_ino, B_WATCH_DIRECTORY, + *fDeviceWatcher); + } else { + error = remove_node_listener(st.st_dev, st.st_ino, + *fDeviceWatcher); + } + if (error != B_OK) + return error; + + DIR *dir = opendir(path); + if (!dir) + return errno; + + while (dirent *entry = readdir(dir)) { + // skip "." and ".." + if (!strcmp(entry->d_name, ".") || !strcmp(entry->d_name, "..")) + continue; + + KPath entryPath; + if (entryPath.SetPath(path) != B_OK + || entryPath.Append(entry->d_name) != B_OK) { + continue; + } + + if (_AddRemoveMonitoring(entryPath.Path(), add) == B_OK) + error = B_OK; + } + closedir(dir); + } + + return error; +} + + +status_t KDiskDeviceManager::_CheckMediaStatus() { while (!fTerminating) { Modified: haiku/trunk/src/system/kernel/fs/vfs_boot.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs_boot.cpp 2008-04-03 17:21:34 UTC (rev 24776) +++ haiku/trunk/src/system/kernel/fs/vfs_boot.cpp 2008-04-03 18:14:11 UTC (rev 24777) @@ -516,8 +516,6 @@ // search for other disk systems KDiskDeviceManager *manager = KDiskDeviceManager::Default(); manager->RescanDiskSystems(); - manager->InitialDeviceScan(); - // TODO: later, the DDM should notice when there are new - // partitions/devices available + manager->StartMonitoring(); } From korli at mail.berlios.de Thu Apr 3 20:14:53 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 3 Apr 2008 20:14:53 +0200 Subject: [Haiku-commits] r24778 - haiku/trunk/src/kits/media Message-ID: <200804031814.m33IEr5Z012422@sheep.berlios.de> Author: korli Date: 2008-04-03 20:14:52 +0200 (Thu, 03 Apr 2008) New Revision: 24778 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24778&view=rev Modified: haiku/trunk/src/kits/media/Controllable.cpp Log: fix typo Modified: haiku/trunk/src/kits/media/Controllable.cpp =================================================================== --- haiku/trunk/src/kits/media/Controllable.cpp 2008-04-03 18:14:11 UTC (rev 24777) +++ haiku/trunk/src/kits/media/Controllable.cpp 2008-04-03 18:14:52 UTC (rev 24778) @@ -302,7 +302,7 @@ ERROR("BControllable::StartControlPanel Error launching application\n"); return B_BAD_VALUE; } - printf("BControllable::StartContolPanel done wiht id: %d\n" , id); + printf("BControllable::StartControlPanel done with id: %ld\n", id); free(arg); if (out_messenger) From korli at mail.berlios.de Thu Apr 3 20:25:27 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 3 Apr 2008 20:25:27 +0200 Subject: [Haiku-commits] r24779 - haiku/trunk/src/apps/cortex/addons/common Message-ID: <200804031825.m33IPRpg013385@sheep.berlios.de> Author: korli Date: 2008-04-03 20:25:27 +0200 (Thu, 03 Apr 2008) New Revision: 24779 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24779&view=rev Modified: haiku/trunk/src/apps/cortex/addons/common/RawBuffer.cpp Log: fix warning Modified: haiku/trunk/src/apps/cortex/addons/common/RawBuffer.cpp =================================================================== --- haiku/trunk/src/apps/cortex/addons/common/RawBuffer.cpp 2008-04-03 18:14:52 UTC (rev 24778) +++ haiku/trunk/src/apps/cortex/addons/common/RawBuffer.cpp 2008-04-03 18:25:27 UTC (rev 24779) @@ -285,7 +285,7 @@ if(m_pPool) rtm_free(m_pData); else - delete [] m_pData; + delete [] (int8 *)m_pData; m_pData = 0; } From mmlr at mail.berlios.de Thu Apr 3 20:54:10 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 3 Apr 2008 20:54:10 +0200 Subject: [Haiku-commits] r24780 - haiku/trunk/build/jam Message-ID: <200804031854.m33IsAde015742@sheep.berlios.de> Author: mmlr Date: 2008-04-03 20:54:10 +0200 (Thu, 03 Apr 2008) New Revision: 24780 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24780&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Add the usb_disk driver to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-03 18:25:27 UTC (rev 24779) +++ haiku/trunk/build/jam/HaikuImage 2008-04-03 18:54:10 UTC (rev 24780) @@ -171,6 +171,7 @@ AddDriversToHaikuImage midi : $(BEOS_ADD_ONS_DRIVERS_MIDI) ; AddDriversToHaikuImage bus : fw_raw usb_raw ; AddDriversToHaikuImage disk scsi : scsi_cd scsi_dsk ; +AddDriversToHaikuImage disk usb : usb_disk ; AddDriversToHaikuImage disk virtual : nbd ; AddDriversToHaikuImage dvb : cx23882 ; AddDriversToHaikuImage graphics : $(BEOS_ADD_ONS_DRIVERS_GRAPHICS) ; From bonefish at mail.berlios.de Thu Apr 3 21:52:43 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 3 Apr 2008 21:52:43 +0200 Subject: [Haiku-commits] r24781 - haiku/trunk/build/jam Message-ID: <200804031952.m33JqhVC020283@sheep.berlios.de> Author: bonefish Date: 2008-04-03 21:52:43 +0200 (Thu, 03 Apr 2008) New Revision: 24781 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24781&view=rev Modified: haiku/trunk/build/jam/ImageRules Log: Replaced "echo -n >" by "touch" as it's more portable. Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-04-03 18:54:10 UTC (rev 24780) +++ haiku/trunk/build/jam/ImageRules 2008-04-03 19:52:43 UTC (rev 24781) @@ -38,7 +38,7 @@ actions InitScript1 { $(RM) $(1) - echo -n > $(1) + touch $(1) } rule AddVariableToScript script : variable : value From revol at free.fr Thu Apr 3 22:05:32 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 03 Apr 2008 22:05:32 +0200 CEST Subject: [Haiku-commits] r24781 - haiku/trunk/build/jam In-Reply-To: <200804031952.m33JqhVC020283@sheep.berlios.de> Message-ID: <2313831434-BeMail@laptop> > Author: bonefish > Date: 2008-04-03 21:52:43 +0200 (Thu, 03 Apr 2008) > New Revision: 24781 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24781&view=rev > > Modified: > haiku/trunk/build/jam/ImageRules > Log: > Replaced "echo -n >" by "touch" as it's more portable. Ah thanks, I had that pending here but forgot to commit. Fran?ois. From bga at mail.berlios.de Thu Apr 3 22:09:37 2008 From: bga at mail.berlios.de (bga at BerliOS) Date: Thu, 3 Apr 2008 22:09:37 +0200 Subject: [Haiku-commits] r24782 - in haiku/trunk/src/build/libbe/storage: . mime Message-ID: <200804032009.m33K9bj2021520@sheep.berlios.de> Author: bga Date: 2008-04-03 22:09:36 +0200 (Thu, 03 Apr 2008) New Revision: 24782 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24782&view=rev Modified: haiku/trunk/src/build/libbe/storage/Mime.cpp haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp Log: While tracking a mimeset bug when building under Haiku, I found these. Not sure if these changes are correct byt they seem to make sense. Ingo? - Haiku uses the same code that BeOS/Dano/Zeta uses for mime related stuff during the build process. Added checking for HAIKU_HOST_PLATFORM_HAIKU where relevant. Modified: haiku/trunk/src/build/libbe/storage/Mime.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/Mime.cpp 2008-04-03 19:52:43 UTC (rev 24781) +++ haiku/trunk/src/build/libbe/storage/Mime.cpp 2008-04-03 20:09:36 UTC (rev 24782) @@ -15,7 +15,7 @@ #include #include #include -#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) +#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) && !defined(HAIKU_HOST_PLATFORM_HAIKU) # include #endif #include @@ -84,4 +84,3 @@ // We don't have a MIME DB... return B_OK; } - Modified: haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp 2008-04-03 19:52:43 UTC (rev 24781) +++ haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp 2008-04-03 20:09:36 UTC (rev 24782) @@ -31,7 +31,7 @@ namespace BPrivate { namespace Storage { -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) +#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) // device_is_root_device bool device_is_root_device(dev_t device) Modified: haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp 2008-04-03 19:52:43 UTC (rev 24781) +++ haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp 2008-04-03 20:09:36 UTC (rev 24782) @@ -24,7 +24,7 @@ #include #include -#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) +#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) && !defined(HAIKU_HOST_PLATFORM_HAIKU) # include #else # define B_VECTOR_ICON_TYPE 'VICN' @@ -56,7 +56,7 @@ err = appFileInfoWrite.SetIconForType(type, &icon, iconSize); else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND) { err = appFileInfoWrite.SetIconForType(type, NULL, iconSize); -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) +#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) // gives an error if the attribute didn't exist yet... err = B_OK; #endif @@ -110,7 +110,7 @@ } -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) +#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) // BMimeType::GuessMimeType() doesn't seem to work under BeOS status_t guess_mime_type(const void *_buffer, int32 length, BMimeType *type) @@ -220,7 +220,7 @@ BMimeType type; if (!err && (updateType || updateAppInfo)) { err = BMimeType::GuessMimeType(entry, &type); -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) +#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) if (err) err = guess_mime_type(entry, &type); #endif @@ -261,7 +261,7 @@ else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND || err == B_BAD_VALUE) { // BeOS returns B_BAD_VALUE on shared libraries err = appFileInfoWrite.SetSignature(NULL); -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) +#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) err = B_OK; #endif } @@ -288,7 +288,7 @@ err = appFileInfoWrite.SetSupportedTypes(&supportedTypes); hasSupportedTypes = true; } else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND || err == B_BAD_VALUE) { -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) +#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) file.RemoveAttr(kSupportedTypesAttr); err = B_OK; #else @@ -333,7 +333,7 @@ if (err == B_OK) err = appFileInfoWrite.SetVersionInfo(&versionInfo, kind); else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND || err == B_BAD_VALUE) { -#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) +#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) && !defined(HAIKU_HOST_PLATFORM_HAIKU) // BeOS crashes when calling SetVersionInfo() with a NULL pointer err = appFileInfoWrite.SetVersionInfo(NULL, kind); #else @@ -376,4 +376,3 @@ } // namespace Mime } // namespace Storage } // namespace BPrivate - From bga at bug-br.org.br Thu Apr 3 22:16:59 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Thu, 03 Apr 2008 17:16:59 -0300 Subject: [Haiku-commits] r24782 - in haiku/trunk/src/build/libbe/storage: . mime In-Reply-To: <200804032009.m33K9bj2021520@sheep.berlios.de> References: <200804032009.m33K9bj2021520@sheep.berlios.de> Message-ID: <47F53B3B.8030804@bug-br.org.br> bga at BerliOS wrote: > - Haiku uses the same code that BeOS/Dano/Zeta uses for mime related stuff > during the build process. Added checking for HAIKU_HOST_PLATFORM_HAIKU where > relevant. Anyway, how about setting a define that is an alias to all of those? Like HAIKU_HOST_PLATFORM_BEOS_COMPATIBLE or something? -Bruno From korli at mail.berlios.de Thu Apr 3 22:49:39 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 3 Apr 2008 22:49:39 +0200 Subject: [Haiku-commits] r24783 - in haiku/trunk/src/add-ons/kernel/bus_managers/acpi: common compiler debugger disassembler events hardware include include/platform interpreter/dispatcher interpreter/executer interpreter/parser namespace resources tables utilities Message-ID: <200804032049.m33Kndh3025257@sheep.berlios.de> Author: korli Date: 2008-04-03 22:49:28 +0200 (Thu, 03 Apr 2008) New Revision: 24783 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24783&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslstartup.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/16bit.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/a16find.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/a16utils.obj haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adfile.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtbinfo.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/getopt.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/Makefile haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslanalyze.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslcodegen.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompile.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslcompiler.l haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asldefine.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslerror.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslfiles.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslfold.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslglobal.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asllength.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asllisting.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslload.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asllookup.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslmain.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslmap.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslopcodes.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asloperands.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslopt.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslresource.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype1.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslrestype2.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslstubs.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asltransform.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asltree.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/asltypes.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/compiler/aslutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbcmds.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbdisply.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbexec.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbfileio.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbhistry.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbinput.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbstats.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/debugger/dbxface.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmbuffer.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmnames.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmobject.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmopcode.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcl.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmresrcs.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/disassembler/dmwalk.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evevent.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evgpe.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evgpeblk.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evmisc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evregion.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evrgnini.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evsci.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evxface.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evxfevnt.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/events/evxfregn.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/hardware/hwacpi.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/hardware/hwgpe.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/hardware/hwregs.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/hardware/hwsleep.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/hardware/hwtimer.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acapps.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acconfig.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acdebug.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acdisasm.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acdispat.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acevents.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acexcep.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acglobal.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/achware.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acinterp.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/aclocal.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acmacros.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acnames.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acnamesp.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acobject.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acopcode.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acoutput.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acparser.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acpi.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acpiosxf.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acpixf.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acresrc.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acstruct.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/actables.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/actbl.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/actbl1.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/actbl2.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/actypes.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/acutils.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/amlcode.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/amlresrc.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acdos16.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acefi.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acenv.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acfreebsd.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acgcc.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acintel.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/aclinux.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acmsvc.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acnetbsd.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/include/platform/acwin64.h haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsfield.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsinit.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmethod.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsmthdat.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsobject.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsopcode.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dsutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswexec.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswload.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswscope.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/dispatcher/dswstate.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconfig.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exconvrt.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/excreate.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exdump.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfield.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exfldio.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmisc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exmutex.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exnames.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg1.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg2.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg3.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exoparg6.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exprep.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exregion.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresnte.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresolv.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exresop.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstore.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstoren.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exstorob.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exsystem.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/executer/exutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psargs.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psloop.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psopcode.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psparse.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psscope.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pstree.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/pswalk.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/interpreter/parser/psxface.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsaccess.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsalloc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsdump.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsdumpdv.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nseval.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsinit.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsload.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsnames.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsobject.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsparse.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nssearch.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nswalk.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfeval.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfname.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/namespace/nsxfobj.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsaddr.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rscalc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rscreate.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsdump.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsinfo.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsio.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsirq.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rslist.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsmemory.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsmisc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/resources/rsxface.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/tables/tbfadt.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/tables/tbfind.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/tables/tbinstal.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/tables/tbutils.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/tables/tbxface.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/tables/tbxfroot.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utalloc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utcache.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utclib.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utcopy.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utdebug.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utdelete.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/uteval.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utglobal.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utinit.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utmath.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utmisc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utmutex.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utobject.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utresrc.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utstate.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/uttrack.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/utilities/utxface.c Log: merging acpica-20080321 in trunk Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/16bit.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/16bit.h 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/16bit.h 2008-04-03 20:49:28 UTC (rev 24783) @@ -8,7 +8,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/a16find.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/a16find.c 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/a16find.c 2008-04-03 20:49:28 UTC (rev 24783) @@ -2,7 +2,7 @@ * * Module Name: a16find - 16-bit (real mode) routines to find ACPI * tables in memory - * $Revision: 1.41 $ + * $Revision: 1.43 $ * *****************************************************************************/ @@ -10,7 +10,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/a16utils.obj =================================================================== (Binary files differ) Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adfile.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adfile.c 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adfile.c 2008-04-03 20:49:28 UTC (rev 24783) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adfile - Application-level disassembler file support routines - * $Revision: 1.2 $ + * $Revision: 1.4 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adisasm.c 2008-04-03 20:49:28 UTC (rev 24783) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adisasm - Application-level disassembler routines - * $Revision: 1.103 $ + * $Revision: 1.112 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -372,7 +372,7 @@ ACPI_STATUS Status; char *DisasmFilename = NULL; FILE *File = NULL; - ACPI_TABLE_HEADER *Table; + ACPI_TABLE_HEADER *Table = NULL; ACPI_TABLE_HEADER *ExternalTable; @@ -470,7 +470,7 @@ { /* Always parse the tables, only option is what to display */ - Status = AdParseTable (Table); + Status = AdParseTable (Table, TRUE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not parse ACPI tables, %s\n", @@ -547,7 +547,9 @@ Status = AcpiNsRootInitialize (); AdAddExternalsToNamespace (); - Status = AdParseTable (Table); + /* Parse table. No need to reload it, however (FALSE) */ + + Status = AdParseTable (Table, FALSE); if (ACPI_FAILURE (Status)) { AcpiOsPrintf ("Could not parse ACPI tables, %s\n", @@ -573,6 +575,17 @@ } Cleanup: + + if (Table && !AcpiUtIsAmlTable (Table)) + { + ACPI_FREE (Table); + } + + if (DisasmFilename) + { + ACPI_FREE (DisasmFilename); + } + if (OutToFile && File) { @@ -585,7 +598,8 @@ } AcpiPsDeleteParseTree (AcpiGbl_ParseOpRoot); - return Status; + AcpiGbl_ParseOpRoot = NULL; + return (Status); } @@ -640,19 +654,36 @@ ACPI_TABLE_HEADER *Table) { char *NewFilename; + UINT8 Checksum; + /* + * Print file header and dump original table header + */ AdDisassemblerHeader (Filename); AcpiOsPrintf (" *\n * Original Table Header:\n"); AcpiOsPrintf (" * Signature \"%4.4s\"\n", Table->Signature); AcpiOsPrintf (" * Length 0x%8.8X (%u)\n", Table->Length, Table->Length); AcpiOsPrintf (" * Revision 0x%2.2X\n", Table->Revision); + + /* Print and validate the table checksum */ + + AcpiOsPrintf (" * Checksum 0x%2.2X", Table->Checksum); + + Checksum = AcpiTbChecksum (ACPI_CAST_PTR (UINT8, Table), Table->Length); + if (Checksum) + { + AcpiOsPrintf (" **** Incorrect checksum, should be 0x%2.2X", + (UINT8) (Table->Checksum - Checksum)); + } + AcpiOsPrintf ("\n"); + AcpiOsPrintf (" * OEM ID \"%.6s\"\n", Table->OemId); AcpiOsPrintf (" * OEM Table ID \"%.8s\"\n", Table->OemTableId); AcpiOsPrintf (" * OEM Revision 0x%8.8X (%u)\n", Table->OemRevision, Table->OemRevision); - AcpiOsPrintf (" * Creator ID \"%.4s\"\n", Table->AslCompilerId); - AcpiOsPrintf (" * Creator Revision 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); + AcpiOsPrintf (" * Compiler ID \"%.4s\"\n", Table->AslCompilerId); + AcpiOsPrintf (" * Compiler Version 0x%8.8X (%u)\n", Table->AslCompilerRevision, Table->AslCompilerRevision); AcpiOsPrintf (" */\n"); /* Create AML output filename based on input filename */ @@ -674,6 +705,8 @@ "DefinitionBlock (\"%s\", \"%4.4s\", %hd, \"%.6s\", \"%.8s\", 0x%8.8X)\n", NewFilename, Table->Signature, Table->Revision, Table->OemId, Table->OemTableId, Table->OemRevision); + + ACPI_FREE (NewFilename); } @@ -904,6 +937,7 @@ case AML_CREATE_BYTE_FIELD_OP: case AML_CREATE_BIT_FIELD_OP: case AML_CREATE_FIELD_OP: + case AML_BANK_FIELD_OP: /* Nothing to do in these cases */ @@ -1046,7 +1080,8 @@ ACPI_STATUS AdParseTable ( - ACPI_TABLE_HEADER *Table) + ACPI_TABLE_HEADER *Table, + BOOLEAN LoadTable) { ACPI_STATUS Status = AE_OK; ACPI_WALK_STATE *WalkState; @@ -1102,16 +1137,19 @@ /* Pass 2 */ - Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table, - Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); - if (ACPI_FAILURE (Status)) + if (LoadTable) { - return Status; + Status = AcpiTbStoreTable ((ACPI_NATIVE_UINT) Table, Table, + Table->Length, ACPI_TABLE_ORIGIN_ALLOCATED, &TableIndex); + if (ACPI_FAILURE (Status)) + { + return Status; + } } fprintf (stderr, "Pass 2 parse of [%4.4s]\n", (char *) Table->Signature); - Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0); + Status = AcpiNsOneCompleteParse (ACPI_IMODE_LOAD_PASS2, 0, NULL); if (ACPI_FAILURE (Status)) { return (Status); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/adwalk.c 2008-04-03 20:49:28 UTC (rev 24783) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: adwalk - Application-level disassembler parse tree walk routines - * $Revision: 1.5 $ + * $Revision: 1.7 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmrestag.c 2008-04-03 20:49:28 UTC (rev 24783) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmrestag - Add tags to resource descriptors (Application-level) - * $Revision: 1.10 $ + * $Revision: 1.12 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtable.c 2008-04-03 20:49:28 UTC (rev 24783) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmtable - Support for ACPI tables that contain no AML code - * $Revision: 1.11 $ + * $Revision: 1.16 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -137,6 +137,16 @@ /* These tables map a subtable type to a description string */ +static const char *AcpiDmAsfSubnames[] = +{ + "ASF Information", + "ASF Alerts", + "ASF Remote Control", + "ASF RMCP Boot Options", + "ASF Address", + "Unknown SubTable Type" /* Reserved */ +}; + static const char *AcpiDmDmarSubnames[] = { "Hardware Unit Definition", @@ -144,6 +154,31 @@ "Unknown SubTable Type" /* Reserved */ }; +static const char *AcpiDmHestSubnames[] = +{ + "XPF Machine Check Exception", + "XPF Corrected Machine Check", + "NOT USED???", + "XPF Non-Maskable Interrupt", + "IPF Corrected Machine Check", + "IPF Corrected Platform Error", + "PCI Express Root Port AER", + "PCI Express AER (AER Endpoint)", + "PCI Express/PCI-X Bridge AERn", + "Generic Hardware Error Source", + "Unknown SubTable Type" /* Reserved */ +}; + +static const char *AcpiDmHestNotifySubnames[] = +{ + "Polled", + "External Interrupt", + "Local Interrupt", + "SCI", + "NMI", + "Unknown Notify Type" /* Reserved */ +}; + static const char *AcpiDmMadtSubnames[] = { "Processor Local APIC", /* ACPI_MADT_TYPE_LOCAL_APIC */ @@ -180,16 +215,21 @@ { {ACPI_SIG_ASF, NULL, AcpiDmDumpAsf, "Alert Standard Format table"}, {ACPI_SIG_BOOT, AcpiDmTableInfoBoot, NULL, "Simple Boot Flag Table"}, + {ACPI_SIG_BERT, AcpiDmTableInfoBert, NULL, "Boot Error Record Table"}, {ACPI_SIG_CPEP, NULL, AcpiDmDumpCpep, "Corrected Platform Error Polling table"}, {ACPI_SIG_DBGP, AcpiDmTableInfoDbgp, NULL, "Debug Port table"}, {ACPI_SIG_DMAR, NULL, AcpiDmDumpDmar, "DMA Remapping table"}, {ACPI_SIG_ECDT, AcpiDmTableInfoEcdt, NULL, "Embedded Controller Boot Resources Table"}, + {ACPI_SIG_EINJ, NULL, AcpiDmDumpEinj, "Error Injection table"}, + {ACPI_SIG_ERST, NULL, AcpiDmDumpErst, "Error Record Serialization Table"}, {ACPI_SIG_FADT, NULL, AcpiDmDumpFadt, "Fixed ACPI Description Table"}, + {ACPI_SIG_HEST, NULL, AcpiDmDumpHest, "Hardware Error Source Table"}, {ACPI_SIG_HPET, AcpiDmTableInfoHpet, NULL, "High Precision Event Timer table"}, {ACPI_SIG_MADT, NULL, AcpiDmDumpMadt, "Multiple APIC Description Table"}, {ACPI_SIG_MCFG, NULL, AcpiDmDumpMcfg, "Memory Mapped Configuration table"}, {ACPI_SIG_RSDT, NULL, AcpiDmDumpRsdt, "Root System Description Table"}, {ACPI_SIG_SBST, AcpiDmTableInfoSbst, NULL, "Smart Battery Specification Table"}, + {ACPI_SIG_SLIC, AcpiDmTableInfoSlic, NULL, "Software Licensing Description Table"}, {ACPI_SIG_SLIT, NULL, AcpiDmDumpSlit, "System Locality Information Table"}, {ACPI_SIG_SPCR, AcpiDmTableInfoSpcr, NULL, "Serial Port Console Redirection table"}, {ACPI_SIG_SPMI, AcpiDmTableInfoSpmi, NULL, "Server Platform Management Interface table"}, @@ -284,6 +324,7 @@ AcpiDmDumpDataTable ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMTABLE_DATA *TableData; UINT32 Length; @@ -314,7 +355,11 @@ * All other tables must use the common ACPI table header, dump it now */ Length = Table->Length; - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHeader); + if (ACPI_FAILURE (Status)) + { + return; + } AcpiOsPrintf ("\n"); /* Match signature and dispatch appropriately */ @@ -419,7 +464,7 @@ * TableOffset - Starting offset within the table for this * sub-descriptor (0 if main table) * Table - The ACPI table - * SubtableLength - Lenghth of this sub-descriptor + * SubtableLength - Length of this sub-descriptor * Info - Info table for this ACPI table * * RETURN: None @@ -428,7 +473,7 @@ * ******************************************************************************/ -void +ACPI_STATUS AcpiDmDumpTable ( UINT32 TableLength, UINT32 TableOffset, @@ -442,12 +487,13 @@ UINT8 Temp8; UINT16 Temp16; ACPI_DMTABLE_DATA *TableData; + BOOLEAN LastOutputBlankLine = FALSE; if (!Info) { AcpiOsPrintf ("Display not implemented\n"); - return; + return (AE_NOT_IMPLEMENTED); } /* Walk entire Info table; Null name terminates */ @@ -466,7 +512,8 @@ if ((CurrentOffset >= TableLength) || (SubtableLength && (Info->Offset >= SubtableLength))) { - return; + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); } /* Generate the byte length for this field */ @@ -478,10 +525,13 @@ case ACPI_DMT_SPACEID: case ACPI_DMT_MADT: case ACPI_DMT_SRAT: + case ACPI_DMT_ASF: + case ACPI_DMT_HESTNTYP: ByteLength = 1; break; case ACPI_DMT_UINT16: case ACPI_DMT_DMAR: + case ACPI_DMT_HEST: ByteLength = 2; break; case ACPI_DMT_UINT24: @@ -506,14 +556,32 @@ ByteLength = ACPI_STRLEN (ACPI_CAST_PTR (char, Target)) + 1; break; case ACPI_DMT_GAS: - AcpiOsPrintf ("\n"); + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } ByteLength = sizeof (ACPI_GENERIC_ADDRESS); break; + case ACPI_DMT_HESTNTFY: + if (!LastOutputBlankLine) + { + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + } + ByteLength = sizeof (ACPI_HEST_NOTIFY); + break; default: ByteLength = 0; break; } + if (CurrentOffset + ByteLength > TableLength) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return (AE_BAD_DATA); + } + /* Start a new line and decode the opcode */ AcpiDmLineHeader (CurrentOffset, ByteLength, Info->Name); @@ -571,9 +639,11 @@ case ACPI_DMT_UINT56: - AcpiOsPrintf ("%6.6X%8.8X\n", - ACPI_HIDWORD (ACPI_GET64 (Target)) & 0x00FFFFFF, - ACPI_LODWORD (ACPI_GET64 (Target))); + for (Temp8 = 0; Temp8 < 7; Temp8++) + { + AcpiOsPrintf ("%2.2X", Target[Temp8]); + } + AcpiOsPrintf ("\n"); break; case ACPI_DMT_UINT64: @@ -649,8 +719,23 @@ AcpiOsPrintf ("\n"); AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, CurrentOffset, Target, 0, AcpiDmTableInfoGas); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; break; + case ACPI_DMT_ASF: + + /* ASF subtable types */ + + Temp16 = (UINT16) ((*Target) & 0x7F); /* Top bit can be zero or one */ + if (Temp16 > ACPI_ASF_TYPE_RESERVED) + { + Temp16 = ACPI_ASF_TYPE_RESERVED; + } + + AcpiOsPrintf ("%2.2X <%s>\n", *Target, AcpiDmAsfSubnames[Temp16]); + break; + case ACPI_DMT_DMAR: /* DMAR subtable types */ @@ -664,6 +749,42 @@ AcpiOsPrintf ("%4.4X <%s>\n", *Target, AcpiDmDmarSubnames[Temp16]); break; + case ACPI_DMT_HEST: + + /* HEST subtable types */ + + Temp16 = *Target; + if (Temp16 > ACPI_HEST_TYPE_RESERVED) + { + Temp16 = ACPI_HEST_TYPE_RESERVED; + } + + AcpiOsPrintf ("%4.4X (%s)\n", *Target, AcpiDmHestSubnames[Temp16]); + break; + + case ACPI_DMT_HESTNTFY: + + AcpiOsPrintf ("\n"); + AcpiDmDumpTable (ACPI_CAST_PTR (ACPI_TABLE_HEADER, Table)->Length, + CurrentOffset, Target, 0, AcpiDmTableInfoHestNotify); + AcpiOsPrintf ("\n"); + LastOutputBlankLine = TRUE; + break; + + case ACPI_DMT_HESTNTYP: + + /* HEST Notify types */ + + Temp8 = *Target; + if (Temp8 > ACPI_HEST_NOTIFY_RESERVED) + { + Temp8 = ACPI_HEST_NOTIFY_RESERVED; + } + + AcpiOsPrintf ("%2.2X (%s)\n", *Target, AcpiDmHestNotifySubnames[Temp8]); + break; + + case ACPI_DMT_MADT: /* MADT subtable types */ @@ -691,14 +812,16 @@ break; case ACPI_DMT_EXIT: - return; + return (AE_OK); default: ACPI_ERROR ((AE_INFO, "**** Invalid table opcode [%X] ****\n", Info->Opcode)); - return; + return (AE_SUPPORT); } } + + return (AE_OK); } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c 2008-04-03 20:09:36 UTC (rev 24782) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/common/dmtbdump.c 2008-04-03 20:49:28 UTC (rev 24783) @@ -1,7 +1,7 @@ /****************************************************************************** * * Module Name: dmtbdump - Dump ACPI data tables that contain no AML code - * $Revision: 1.14 $ + * $Revision: 1.18 $ * *****************************************************************************/ @@ -9,7 +9,7 @@ * * 1. Copyright Notice * - * Some or all of this work - Copyright (c) 1999 - 2006, Intel Corp. + * Some or all of this work - Copyright (c) 1999 - 2008, Intel Corp. * All rights reserved. * * 2. License @@ -289,6 +289,7 @@ AcpiDmDumpAsf ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; UINT32 Offset = sizeof (ACPI_TABLE_HEADER); ACPI_ASF_INFO *SubTable; ACPI_DMTABLE_INFO *InfoTable; @@ -307,7 +308,12 @@ { /* Common sub-table header */ - AcpiDmDumpTable (Table->Length, Offset, SubTable, 0, AcpiDmTableInfoAsfHdr); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, AcpiDmTableInfoAsfHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ { @@ -349,9 +355,13 @@ return; } - AcpiDmDumpTable (Table->Length, Offset, SubTable, SubTable->Header.Length, InfoTable); + Status = AcpiDmDumpTable (Table->Length, Offset, SubTable, + SubTable->Header.Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } - /* Dump variable-length extra data */ switch (SubTable->Header.Type & 0x7F) /* Mask off top bit */ @@ -362,7 +372,12 @@ for (i = 0; i < DataCount; i++) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Table->Length, DataOffset, DataTable, DataLength, DataInfoTable); + Status = AcpiDmDumpTable (Table->Length, DataOffset, + DataTable, DataLength, DataInfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } DataTable = ACPI_ADD_PTR (UINT8, DataTable, DataLength); DataOffset += DataLength; @@ -381,6 +396,11 @@ AcpiOsPrintf ("%2.2X ", *DataTable); DataTable++; DataOffset++; + if (DataOffset > Table->Length) + { + AcpiOsPrintf ("**** ACPI table terminates in the middle of a data structure!\n"); + return; + } } AcpiOsPrintf ("\n"); @@ -391,6 +411,12 @@ /* Point to next sub-table */ + if (!SubTable->Header.Length) + { + AcpiOsPrintf ("Invalid zero subtable header length\n"); + return; + } + Offset += SubTable->Header.Length; SubTable = ACPI_ADD_PTR (ACPI_ASF_INFO, SubTable, SubTable->Header.Length); } @@ -414,6 +440,7 @@ AcpiDmDumpCpep ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_CPEP_POLLING *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_CPEP); @@ -421,7 +448,11 @@ /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoCpep); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -429,7 +460,12 @@ while (Offset < Table->Length) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, AcpiDmTableInfoCpep0); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoCpep0); + if (ACPI_FAILURE (Status)) + { + return; + } /* Point to next sub-table */ @@ -456,6 +492,7 @@ AcpiDmDumpDmar ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_DMAR_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_DMAR); @@ -468,7 +505,11 @@ /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoDmar); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -478,7 +519,12 @@ /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoDmarHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoDmarHdr); + if (ACPI_FAILURE (Status)) + { + return; + } switch (SubTable->Type) { @@ -495,7 +541,12 @@ return; } - AcpiDmDumpTable (Length, Offset, SubTable, SubTable->Length, InfoTable); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } /* * Currently, a common flag indicates whether there are any @@ -509,8 +560,12 @@ while (ScopeOffset < SubTable->Length) { AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, - ScopeTable->Length, AcpiDmTableInfoDmarScope); + Status = AcpiDmDumpTable (Length, Offset + ScopeOffset, ScopeTable, + ScopeTable->Length, AcpiDmTableInfoDmarScope); + if (ACPI_FAILURE (Status)) + { + return; + } /* Dump the PCI Path entries for this device scope */ @@ -548,6 +603,180 @@ /******************************************************************************* * + * FUNCTION: AcpiDmDumpEinj + * + * PARAMETERS: Table - A EINJ table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a EINJ. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpEinj ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_EINJ); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoEinj); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpErst + * + * PARAMETERS: Table - A ERST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a ERST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpErst ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_WHEA_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_ERST); + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoErst); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, Table, Offset); + while (Offset < Table->Length) + { + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, AcpiDmTableInfoEinj0); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += sizeof (ACPI_WHEA_HEADER); + SubTable = ACPI_ADD_PTR (ACPI_WHEA_HEADER, SubTable, + sizeof (ACPI_WHEA_HEADER)); + } +} + + +/******************************************************************************* + * + * FUNCTION: AcpiDmDumpHest + * + * PARAMETERS: Table - A HEST table + * + * RETURN: None + * + * DESCRIPTION: Format the contents of a HEST. This table type consists + * of an open-ended number of subtables. + * + ******************************************************************************/ + +void +AcpiDmDumpHest ( + ACPI_TABLE_HEADER *Table) +{ + ACPI_STATUS Status; + ACPI_HEST_HEADER *SubTable; + UINT32 Length = Table->Length; + UINT32 Offset = sizeof (ACPI_TABLE_HEST); + ACPI_DMTABLE_INFO *InfoTable; + UINT32 SubTableLength; + + + /* Main table */ + + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoHest); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Sub-tables */ + + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, Table, Offset); + while (Offset < Table->Length) + { + /* TBD: add new subtable types as examples become available */ + + switch (SubTable->Type) + { + case ACPI_HEST_TYPE_GENERIC_HARDWARE_ERROR_SOURCE: + InfoTable = AcpiDmTableInfoHest9; + SubTableLength = sizeof (ACPI_HEST_GENERIC); + break; + + default: + AcpiOsPrintf ("\n**** Unknown HEST sub-table type %X\n", SubTable->Type); + return; + } + + AcpiOsPrintf ("\n"); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + 0, InfoTable); + if (ACPI_FAILURE (Status)) + { + return; + } + + /* Point to next sub-table (each subtable is of fixed length) */ + + Offset += SubTableLength; + SubTable = ACPI_ADD_PTR (ACPI_HEST_HEADER, SubTable, SubTableLength); + } +} + + +/******************************************************************************* + * * FUNCTION: AcpiDmDumpMadt * * PARAMETERS: Table - A MADT table @@ -563,6 +792,7 @@ AcpiDmDumpMadt ( ACPI_TABLE_HEADER *Table) { + ACPI_STATUS Status; ACPI_SUBTABLE_HEADER *SubTable; UINT32 Length = Table->Length; UINT32 Offset = sizeof (ACPI_TABLE_MADT); @@ -571,7 +801,11 @@ /* Main table */ - AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + Status = AcpiDmDumpTable (Length, 0, Table, 0, AcpiDmTableInfoMadt); + if (ACPI_FAILURE (Status)) + { + return; + } /* Sub-tables */ @@ -581,7 +815,12 @@ /* Common sub-table header */ AcpiOsPrintf ("\n"); - AcpiDmDumpTable (Length, Offset, SubTable, 0, AcpiDmTableInfoMadtHdr); + Status = AcpiDmDumpTable (Length, Offset, SubTable, + SubTable->Length, AcpiDmTableInfoMadtHdr); + if (ACPI_FAILURE (Status)) + { + return; + } [... truncated: 15326 lines follow ...] From bonefish at mail.berlios.de Thu Apr 3 23:18:18 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 3 Apr 2008 23:18:18 +0200 Subject: [Haiku-commits] r24784 - in haiku/trunk: build/jam build/scripts src/tools src/tools/vmdkimage Message-ID: <200804032118.m33LIIoq029057@sheep.berlios.de> Author: bonefish Date: 2008-04-03 23:18:18 +0200 (Thu, 03 Apr 2008) New Revision: 24784 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24784&view=rev Added: haiku/trunk/src/tools/vmdkimage/ haiku/trunk/src/tools/vmdkimage/Jamfile haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp haiku/trunk/src/tools/vmdkimage/vmdkimage.h Removed: haiku/trunk/src/tools/vmdkheader/ Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/build/scripts/build_haiku_image haiku/trunk/src/tools/Jamfile Log: * Renamed vmdkheader to vmdkimage and changed it to create a full image by default (new option "-H" will create the header only). Option "-c" will clear the image. * Adjusted build_haiku_image accordingly. vmdkimage is way faster and more portable than the former vmdkheader+dd combo. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-03 20:49:28 UTC (rev 24783) +++ haiku/trunk/build/jam/HaikuImage 2008-04-03 21:18:18 UTC (rev 24784) @@ -531,7 +531,7 @@ AddTargetVariableToScript $(script) : rc ; AddTargetVariableToScript $(script) : resattr ; AddTargetVariableToScript $(script) : unzip ; -AddTargetVariableToScript $(script) : vmdkheader ; +AddTargetVariableToScript $(script) : vmdkimage ; if $(HOST_RM_ATTRS_TARGET) { AddTargetVariableToScript $(script) : $(HOST_RM_ATTRS_TARGET) : rmAttrs ; } else { Modified: haiku/trunk/build/scripts/build_haiku_image =================================================================== --- haiku/trunk/build/scripts/build_haiku_image 2008-04-03 20:49:28 UTC (rev 24783) +++ haiku/trunk/build/scripts/build_haiku_image 2008-04-03 21:18:18 UTC (rev 24784) @@ -21,7 +21,7 @@ # rc # rmAttrs # unzip -# vmdkheader +# vmdkimage # if [ $# -gt 0 ]; then . $1 @@ -93,17 +93,19 @@ if [ ! $updateOnly ]; then echo "Creating image ..." - ddFlags= + ddFlags= if [ $isVMwareImage ]; then - rm -f "$imagePath" - $vmdkheader -h 64k -i${imageSize}M "$imagePath" || exit 1 - ddFlags="conv=notrunc oflag=append" - dontClearImage= + vmdkImageFlags= + if [ ! "$dontClearImage" ]; then + vmdkImageFlags="-c" + fi + $vmdkimage -h 64k -i${imageSize}M $vmdkImageFlags "$imagePath" \ + || exit 1 + elif [ ! -e "$imagePath" -o ! "$dontClearImage" ]; then + dd if=/dev/zero of="$imagePath" bs=1048576 count=$imageSize \ + || exit 1 fi - if [ ! -e "$imagePath" -o ! "$dontClearImage" ]; then - dd if=/dev/zero of="$imagePath" bs=1048576 count=$imageSize $ddFlags - fi $bfsShell --initialize $imageOffsetFlags "$imagePath" Haiku \ "block_size 2048" || exit 1 $makebootable $imageOffsetFlags "$imagePath" Modified: haiku/trunk/src/tools/Jamfile =================================================================== --- haiku/trunk/src/tools/Jamfile 2008-04-03 20:49:28 UTC (rev 24783) +++ haiku/trunk/src/tools/Jamfile 2008-04-03 21:18:18 UTC (rev 24784) @@ -104,6 +104,6 @@ SubInclude HAIKU_TOP src tools rman ; SubInclude HAIKU_TOP src tools translation ; SubInclude HAIKU_TOP src tools unzip ; -SubInclude HAIKU_TOP src tools vmdkheader ; +SubInclude HAIKU_TOP src tools vmdkimage ; SubInclude HAIKU_TOP src tools unflatten ; Copied: haiku/trunk/src/tools/vmdkimage/Jamfile (from rev 24775, haiku/trunk/src/tools/vmdkheader/Jamfile) =================================================================== --- haiku/trunk/src/tools/vmdkheader/Jamfile 2008-04-03 14:59:04 UTC (rev 24775) +++ haiku/trunk/src/tools/vmdkimage/Jamfile 2008-04-03 21:18:18 UTC (rev 24784) @@ -0,0 +1,8 @@ +SubDir HAIKU_TOP src tools vmdkimage ; + +UsePrivateHeaders kernel ; + +BuildPlatformMain vmdkimage + : vmdkimage.cpp + : $(HOST_LIBSUPC++) +; Copied: haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp (from rev 24775, haiku/trunk/src/tools/vmdkheader/vmdkheader.cpp) =================================================================== --- haiku/trunk/src/tools/vmdkheader/vmdkheader.cpp 2008-04-03 14:59:04 UTC (rev 24775) +++ haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp 2008-04-03 21:18:18 UTC (rev 24784) @@ -0,0 +1,240 @@ +/* + * Copyright 2007, Marcus Overhagen. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "vmdkimage.h" + + +static void +print_usage() +{ + printf("\n"); + printf("vmdkimage\n"); + printf("\n"); + printf("usage: vmdkimage -i -h [-c] [-H] [-f] " + "\n"); + printf(" -i, --imagesize size of raw partition image file\n"); + printf(" -h, --headersize size of the vmdk header to write\n"); + printf(" -f, --file the raw partition image file\n"); + printf(" -c, --clear-image set the image content to zero\n"); + printf(" -H, --header-only write only the header\n"); + exit(EXIT_FAILURE); +} + + +int +main(int argc, char *argv[]) +{ + uint64 headersize = 0; + uint64 imagesize = 0; + const char *file = NULL; + bool headerOnly = false; + bool clearImage = false; + + if (sizeof(SparseExtentHeader) != 512) { + fprintf(stderr, "compilation error: struct size is %u byte\n", + (unsigned)sizeof(SparseExtentHeader)); + exit(EXIT_FAILURE); + } + + while (1) { + int c; + static struct option long_options[] = + { + {"headersize", required_argument, 0, 'h'}, + {"imagesize", required_argument, 0, 'i'}, + {"file", required_argument, 0, 'f'}, + {"clear-image", no_argument, 0, 'c'}, + {"header-only", no_argument, 0, 'H'}, + {0, 0, 0, 0} + }; + + opterr = 0; /* don't print errors */ + c = getopt_long(argc, argv, "h:i:c:H:f:", long_options, NULL); + if (c == -1) + break; + + switch (c) { + case 'h': + headersize = strtoull(optarg, NULL, 10); + if (strchr(optarg, 'G') || strchr(optarg, 'g')) + headersize *= 1024 * 1024 * 1024; + else if (strchr(optarg, 'M') || strchr(optarg, 'm')) + headersize *= 1024 * 1024; + else if (strchr(optarg, 'K') || strchr(optarg, 'k')) + headersize *= 1024; + break; + + case 'i': + imagesize = strtoull(optarg, NULL, 10); + if (strchr(optarg, 'G') || strchr(optarg, 'g')) + imagesize *= 1024 * 1024 * 1024; + else if (strchr(optarg, 'M') || strchr(optarg, 'm')) + imagesize *= 1024 * 1024; + else if (strchr(optarg, 'K') || strchr(optarg, 'k')) + imagesize *= 1024; + break; + + case 'f': + file = optarg; + break; + + case 'c': + clearImage = true; + break; + + case 'H': + headerOnly = true; + break; + + default: + print_usage(); + } + } + + if (file == NULL && optind == argc - 1) + file = argv[optind]; + + if (!headersize || !imagesize || !file) + print_usage(); + + char desc[512]; + SparseExtentHeader header; + + if (headersize < sizeof(desc) + sizeof(header)) { + fprintf(stderr, "Error: header size must be at least %u byte\n", + (unsigned)(sizeof(desc) + sizeof(header))); + exit(EXIT_FAILURE); + } + + if (headersize % 512) { + fprintf(stderr, "Error: header size must be a multiple of 512 bytes\n"); + exit(EXIT_FAILURE); + } + + if (imagesize % 512) { + fprintf(stderr, "Error: image size must be a multiple of 512 bytes\n"); + exit(EXIT_FAILURE); + } + + // arbitrary 1 GB limitation + if (headersize > 0x40000000u) { + fprintf(stderr, "Error: header size too large\n"); + exit(EXIT_FAILURE); + } + + // arbitrary 2 GB limitation + if (imagesize > 0x80000000u) { + fprintf(stderr, "Error: image size too large\n"); + exit(EXIT_FAILURE); + } + + const char *name = strrchr(file, '/'); + name = name ? (name + 1) : file; + +// printf("headersize %llu\n", headersize); +// printf("imagesize %llu\n", imagesize); +// printf("file %s\n", file); + + uint64 sectors; + uint64 heads; + uint64 cylinders; + + // TODO: fixme! + sectors = 63; + heads = 16; + cylinders = imagesize / (sectors * heads * 512); + while (cylinders > 1024) { + cylinders /= 2; + heads *= 2; + } + off_t actualImageSize = (off_t)cylinders * sectors * heads * 512; + + memset(desc, 0, sizeof(desc)); + memset(&header, 0, sizeof(header)); + + header.magicNumber = SPARSE_MAGICNUMBER; + header.version = 1; + header.flags = 1; + header.capacity = 0; + header.grainSize = 16; + header.descriptorOffset = 1; + header.descriptorSize = sizeof(desc) / 512; + header.numGTEsPerGT = 512; + header.rgdOffset = 0; + header.gdOffset = 0; + header.overHead = headersize / 512; + header.uncleanShutdown = 0; + header.singleEndLineChar = '\n'; + header.nonEndLineChar = ' '; + header.doubleEndLineChar1 = '\r'; + header.doubleEndLineChar2 = '\n'; + + strcat(desc, + "# Disk Descriptor File\n" + "version=1\n" + "CID=fffffffe\n" + "parentCID=ffffffff\n" + "createType=\"monolithicFlat\"\n"); + sprintf(desc + strlen(desc), + "# Extent Description\n" + "RW %llu FLAT \"%s\" %llu\n", + imagesize / 512, name, headersize / 512); + sprintf(desc + strlen(desc), + "# Disk Data Base\n" + "ddb.toolsVersion = \"0\"\n" + "ddb.virtualHWVersion = \"3\"\n" + "ddb.geometry.sectors = \"%llu\"\n" + "ddb.adapterType = \"ide\"\n" + "ddb.geometry.heads = \"%llu\"\n" + "ddb.geometry.cylinders = \"%llu\"\n", + sectors, heads, cylinders); + + int fd = open(file, O_RDWR | O_CREAT, 0666); + if (fd < 0) { + fprintf(stderr, "Error: couldn't open file %s (%s)\n", file, + strerror(errno)); + exit(EXIT_FAILURE); + } + if (sizeof(header) != write(fd, &header, sizeof(header))) + goto write_err; + + if (sizeof(desc) != write(fd, desc, sizeof(desc))) + goto write_err; + + headersize--; + if (headersize != (uint64)lseek(fd, headersize, SEEK_SET)) + goto write_err; + + if (1 != write(fd, "", 1)) + goto write_err; + + if (!headerOnly) { + if (clearImage && ftruncate(fd, headersize) != 0 + || ftruncate(fd, actualImageSize) != 0) { + fprintf(stderr, "Error: resizing file %s failed (%s)\n", file, + strerror(errno)); + exit(EXIT_FAILURE); + } + } + + close(fd); + return 0; + +write_err: + fprintf(stderr, "Error: writing file %s failed (%s)\n", file, + strerror(errno)); + close(fd); + exit(EXIT_FAILURE); +} Copied: haiku/trunk/src/tools/vmdkimage/vmdkimage.h (from rev 24775, haiku/trunk/src/tools/vmdkheader/vmdkheader.h) =================================================================== --- haiku/trunk/src/tools/vmdkheader/vmdkheader.h 2008-04-03 14:59:04 UTC (rev 24775) +++ haiku/trunk/src/tools/vmdkimage/vmdkimage.h 2008-04-03 21:18:18 UTC (rev 24784) @@ -0,0 +1,39 @@ +/* + * Copyright 2007, Marcus Overhagen. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _VMDKIMAGE_H +#define _VMDKIMAGE_H + +typedef unsigned char uint8; +typedef unsigned int uint32; +typedef unsigned long long uint64; + + +typedef uint64 SectorType; +typedef uint8 Bool; + +struct SparseExtentHeader +{ + uint32 magicNumber; + uint32 version; + uint32 flags; + SectorType capacity; + SectorType grainSize; + SectorType descriptorOffset; + SectorType descriptorSize; + uint32 numGTEsPerGT; + SectorType rgdOffset; + SectorType gdOffset; + SectorType overHead; + Bool uncleanShutdown; + char singleEndLineChar; + char nonEndLineChar; + char doubleEndLineChar1; + char doubleEndLineChar2; + uint8 pad[435]; +} __attribute__((__packed__)) ; + +#define SPARSE_MAGICNUMBER 0x564d444b /* 'V' 'M' 'D' 'K' */ + +#endif From ingo_weinhold at gmx.de Thu Apr 3 23:44:08 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 03 Apr 2008 23:44:08 +0200 Subject: [Haiku-commits] r24782 - in haiku/trunk/src/build/libbe/storage: . mime In-Reply-To: <47F53B3B.8030804@bug-br.org.br> References: <200804032009.m33K9bj2021520@sheep.berlios.de> <47F53B3B.8030804@bug-br.org.br> Message-ID: <20080403234408.987.6@knochen-vm.1207248335.fake> On 2008-04-03 at 22:16:59 [+0200], Bruno Albuquerque wrote: > bga at BerliOS wrote: > > > - Haiku uses the same code that BeOS/Dano/Zeta uses for mime related stuff > > during the build process. Added checking for HAIKU_HOST_PLATFORM_HAIKU > > where > > relevant. > > Anyway, how about setting a define that is an alias to all of those? > Like HAIKU_HOST_PLATFORM_BEOS_COMPATIBLE or something? I guess one could just use __BEOS__. Not sure why it is so complicated in this file. CU, Ingo From alex at zappotek.com Fri Apr 4 00:25:57 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Fri, 04 Apr 2008 00:25:57 +0200 Subject: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs In-Reply-To: <200804031814.m33IEC8D012359@sheep.berlios.de> References: <200804031814.m33IEC8D012359@sheep.berlios.de> Message-ID: <47F55975.1080104@zappotek.com> mmlr at BerliOS wrote : > Author: mmlr > Date: 2008-04-03 20:14:11 +0200 (Thu, 03 Apr 2008) > New Revision: 24777 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24777&view=rev > > Modified: > haiku/trunk/headers/private/kernel/disk_device_manager/KDiskDeviceManager.h > haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp > haiku/trunk/src/system/kernel/fs/vfs_boot.cpp > Log: > Implement node monitoring in the kernel disk device manager. > > * Added {Create|Delete}Device() analogous to {Create|Delete}FileDevice > * Added a small DeviceWatcher class that reacts to entry creation/removal > * Implemented a way to start/stop node monitoring > * Start watching for devices after the boot volume has been mounted and the > the second initial scan was run > > The disk device manager now creates and scans a device when a "raw" node is > published and deletes the device on removal. This makes hot-plugging of disk > devices (for example memory sticks using usb_disk) work. Their partitions will > be scanned and published so they can be mounted. Somehow the removal of the > partitions does not yet work however, any insights are welcome. > > Really nice work on usb_disk! Quickly tested with a memory stick under vmware and it seems to work pretty well already :-) (didn't test hot-unplugging). Regards, Alex From bonefish at mail.berlios.de Fri Apr 4 01:54:56 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 4 Apr 2008 01:54:56 +0200 Subject: [Haiku-commits] r24785 - haiku/trunk/src/tools/vmdkimage Message-ID: <200804032354.m33Nsuoe001966@sheep.berlios.de> Author: bonefish Date: 2008-04-04 01:54:55 +0200 (Fri, 04 Apr 2008) New Revision: 24785 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24785&view=rev Modified: haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp Log: Fixed incorrect getopt() specification: -c and -H don't have arguments. Modified: haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp =================================================================== --- haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp 2008-04-03 21:18:18 UTC (rev 24784) +++ haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp 2008-04-03 23:54:55 UTC (rev 24785) @@ -61,7 +61,7 @@ }; opterr = 0; /* don't print errors */ - c = getopt_long(argc, argv, "h:i:c:H:f:", long_options, NULL); + c = getopt_long(argc, argv, "h:i:cHf:", long_options, NULL); if (c == -1) break; From bga at mail.berlios.de Fri Apr 4 02:15:42 2008 From: bga at mail.berlios.de (bga at BerliOS) Date: Fri, 4 Apr 2008 02:15:42 +0200 Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin Message-ID: <200804040015.m340Fgn0005613@sheep.berlios.de> Author: bga Date: 2008-04-04 02:15:41 +0200 (Fri, 04 Apr 2008) New Revision: 24786 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24786&view=rev Removed: haiku/trunk/src/bin/bison/ haiku/trunk/src/bin/flex/ Modified: haiku/trunk/src/bin/Jamfile Log: Removed bison and flex as both are now part of the development package. Modified: haiku/trunk/src/bin/Jamfile =================================================================== --- haiku/trunk/src/bin/Jamfile 2008-04-03 23:54:55 UTC (rev 24785) +++ haiku/trunk/src/bin/Jamfile 2008-04-04 00:15:41 UTC (rev 24786) @@ -159,7 +159,6 @@ SubInclude HAIKU_TOP src bin bash ; SubInclude HAIKU_TOP src bin bc ; SubInclude HAIKU_TOP src bin bemail_utils ; -SubInclude HAIKU_TOP src bin bison ; SubInclude HAIKU_TOP src bin chkbfs ; SubInclude HAIKU_TOP src bin compress ; SubInclude HAIKU_TOP src bin coreutils ; @@ -167,7 +166,6 @@ SubInclude HAIKU_TOP src bin desklink ; SubInclude HAIKU_TOP src bin diffutils ; SubInclude HAIKU_TOP src bin findutils ; -SubInclude HAIKU_TOP src bin flex ; SubInclude HAIKU_TOP src bin fwcontrol ; SubInclude HAIKU_TOP src bin gawk ; SubInclude HAIKU_TOP src bin gdb ; From bga at mail.berlios.de Fri Apr 4 02:34:14 2008 From: bga at mail.berlios.de (bga at BerliOS) Date: Fri, 4 Apr 2008 02:34:14 +0200 Subject: [Haiku-commits] r24787 - haiku/trunk/src/data/etc/keymaps Message-ID: <200804040034.m340YEUG009238@sheep.berlios.de> Author: bga Date: 2008-04-04 02:34:11 +0200 (Fri, 04 Apr 2008) New Revision: 24787 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24787&view=rev Added: haiku/trunk/src/data/etc/keymaps/Brazilian(ABNT2).keymap Log: - Added Brazilian(ABNT2) keymap originally included in the International Keymap Pack by ITO, Takayuki and licensed as public domain. Added: haiku/trunk/src/data/etc/keymaps/Brazilian(ABNT2).keymap =================================================================== --- haiku/trunk/src/data/etc/keymaps/Brazilian(ABNT2).keymap 2008-04-04 00:15:41 UTC (rev 24786) +++ haiku/trunk/src/data/etc/keymaps/Brazilian(ABNT2).keymap 2008-04-04 00:34:11 UTC (rev 24787) @@ -0,0 +1,256 @@ +#keymap +# +# Brazilian Portuguese (ABNT2) keymap +# +# Raw key numbering for 101 keyboard... +# [sys] [brk] +# 0x7e 0x7f +# [esc] [ f1] [ f2] [ f3] [ f4] [ f5] [ f6] [ f7] [ f8] [ f9] [f10] [f11] [f12] [prn] [scr] [pau] +# 0x01 0x02 0x03 0x04 0x05 0x06 0x07 0x08 0x09 0x0a 0x0b 0x0c 0x0d 0x0e 0x0f 0x10 K E Y P A D K E Y S +# +# [ ` ] [ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ] [ 7 ] [ 8 ] [ 9 ] [ 0 ] [ - ] [ = ] [bck] [ins] [hme] [pup] [num] [ / ] [ * ] [ - ] +# 0x11 0x12 0x13 0x14 0x15 0x16 0x17 0x18 0x19 0x1a 0x1b 0x1c 0x1d 0x1e 0x1f 0x20 0x21 0x22 0x23 0x24 0x25 +# +# [tab] [ q ] [ w ] [ e ] [ r ] [ t ] [ y ] [ u ] [ i ] [ o ] [ p ] [ [ ] [ ] ] [ \ ] [del] [end] [pdn] [ 7 ] [ 8 ] [ 9 ] [ + ] +# 0x26 0x27 0x28 0x29 0x2a 0x2b 0x2c 0x2d 0x2e 0x2f 0x30 0x31 0x32 0x33 0x34 0x35 0x36 0x37 0x38 0x39 0x3a +# +# [cap] [ a ] [ s ] [ d ] [ f ] [ g ] [ h ] [ j ] [ k ] [ l ] [ ; ] [ ' ] [ enter ] [ 4 ] [ 5 ] [ 6 ] +# 0x3b 0x3c 0x3d 0x3e 0x3f 0x40 0x41 0x42 0x43 0x44 0x45 0x46 0x47 0x48 0x49 0x4a +# +# [shift] [ z ] [ x ] [ c ] [ v ] [ b ] [ n ] [ m ] [ , ] [ . ] [ / ] [shift] [ up] [ 1 ] [ 2 ] [ 3 ] [ent] +# 0x4b 0x4c 0x4d 0x4e 0x4f 0x50 0x51 0x52 0x53 0x54 0x55 0x56 0x57 0x58 0x59 0x5a 0x5b +# +# [ctr] [cmd] [ space ] [cmd] [ctr] [lft] [dwn] [rgt] [ 0 ] [ . ] +# 0x5c 0x5d 0x5e 0x5f 0x60 0x61 0x62 0x63 0x64 0x65 +# +# NOTE: On a Microsoft Natural Keyboard: +# left option = 0x66 +# right option = 0x67 +# menu key = 0x68 +# NOTE: On an Apple Extended Keyboard: +# left option = 0x66 +# right option = 0x67 +# keypad '=' = 0x6a +# power key = 0x6b +Version = 3 +CapsLock = 0x3b +ScrollLock = 0x0f +NumLock = 0x22 +LShift = 0x4b +RShift = 0x56 +LCommand = 0x5d +RCommand = 0x60 +LControl = 0x5c +RControl = 0x00 +LOption = 0x66 +ROption = 0x5f +Menu = 0x68 +# +# Lock settings +# To set NumLock, do the following: +# LockSettings = NumLock +# +# To set everything, do the following: +# LockSettings = CapsLock NumLock ScrollLock +# +LockSettings = +# Legend: +# n = Normal +# s = Shift +# c = Control +# C = CapsLock +# o = Option +# Key n s c o os C Cs Co Cos +Key 0x00 = '' '' '' '' '' '' '' '' '' +Key 0x01 = 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b 0x1b +Key 0x02 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x03 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x04 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x05 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x06 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x07 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x08 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x09 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0a = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0b = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0c = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0d = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0e = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x0f = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x10 = 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 0x10 +Key 0x11 = '\'' '"' '' ' ' '' '\'' '"' ' ' '' +Key 0x12 = '1' '!' '' 0xc2b9 '' '1' '!' 0xc2b9 '' +Key 0x13 = '2' '@' 0x00 0xc2b2 '' '2' '@' 0xc2b2 '' +Key 0x14 = '3' '#' '' 0xc2b3 '' '3' '#' 0xc2b3 '' +Key 0x15 = '4' '$' '' 0xc2a3 '' '4' '$' 0xc2a3 '' +Key 0x16 = '5' '%' '' 0xc2a2 '' '5' '%' 0xc2a2 '' +# dead key +Key 0x17 = '6' 0xc2a8 '' 0xc2ac '' '6' 0xc2a8 0xc2ac '' +Key 0x18 = '7' '&' '' ' ' '' '7' '&' ' ' '' +Key 0x19 = '8' '*' '' ' ' '' '8' '*' ' ' '' +Key 0x1a = '9' '(' '' ' ' '' '9' '(' ' ' '' +Key 0x1b = '0' ')' '' ' ' '' '0' ')' ' ' '' +Key 0x1c = '-' '_' 0x1f ' ' '' '-' '_' ' ' '' +Key 0x1d = '=' '+' '' 0xc2a7 '' '=' '+' 0xc2a7 '' +Key 0x1e = 0x08 0x08 0x7f 0x08 0x08 0x08 0x08 0x08 0x08 +Key 0x1f = 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 0x05 +Key 0x20 = 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 0x01 +Key 0x21 = 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b 0x0b +Key 0x22 = '' '' '' '' '' '' '' '' '' +Key 0x23 = '/' '/' '/' '/' '/' '/' '/' '/' '/' +Key 0x24 = '*' '*' '*' '*' '*' '*' '*' '*' '*' +Key 0x25 = '-' '-' '-' '-' '-' '-' '-' '-' '-' +Key 0x26 = 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 0x09 +Key 0x27 = 'q' 'Q' 0x11 '/' '' 'Q' 'q' '/' '' +Key 0x28 = 'w' 'W' 0x17 '?' '' 'W' 'w' '?' '' +Key 0x29 = 'e' 'E' 0x05 0xc2b0 '' 'E' 'e' 0xc2b0 '' +Key 0x2a = 'r' 'R' 0x12 ' ' '' 'R' 'r' ' ' '' +Key 0x2b = 't' 'T' 0x14 ' ' '' 'T' 't' ' ' '' +Key 0x2c = 'y' 'Y' 0x19 ' ' '' 'Y' 'y' ' ' '' +Key 0x2d = 'u' 'U' 0x15 ' ' '' 'U' 'u' ' ' '' +Key 0x2e = 'i' 'I' 0x09 ' ' '' 'I' 'i' ' ' '' +Key 0x2f = 'o' 'O' 0x0f ' ' '' 'O' 'o' ' ' '' +# dead keys +Key 0x30 = 'p' 'P' 0x10 ' ' '' 'P' 'p' ' ' '' +Key 0x31 = 0xc2b4 '`' '' ' ' '' 0xc2b4 '`' ' ' '' +Key 0x32 = '[' '{' 0x1b 0xc2aa '' '[' '{' 0xc2aa '' +Key 0x33 = ']' '}' 0x1c 0xc2ba '' ']' '}' 0xc2ba '' +Key 0x34 = 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f 0x7f +Key 0x35 = 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 0x04 +Key 0x36 = 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c 0x0c +Key 0x37 = 0x01 '7' 0x01 0x01 '7' 0x01 '7' 0x01 '7' +Key 0x38 = 0x1e '8' 0x1e 0x1e '8' 0x1e '8' 0x1e '8' +Key 0x39 = 0x0b '9' 0x0b 0x0b '9' 0x0b '9' 0x0b '9' +Key 0x3a = '+' '+' '+' '+' '+' '+' '+' '+' '+' +Key 0x3b = '' '' '' '' '' '' '' '' '' +Key 0x3c = 'a' 'A' 0x01 ' ' '' 'A' 'a' ' ' '' +Key 0x3d = 's' 'S' 0x13 ' ' '' 'S' 's' ' ' '' +Key 0x3e = 'd' 'D' 0x04 ' ' '' 'D' 'd' ' ' '' +Key 0x3f = 'f' 'F' 0x06 ' ' '' 'F' 'f' ' ' '' +Key 0x40 = 'g' 'G' 0x07 ' ' '' 'G' 'g' ' ' '' +Key 0x41 = 'h' 'H' 0x08 ' ' '' 'H' 'h' ' ' '' +Key 0x42 = 'j' 'J' 0x0a ' ' '' 'J' 'j' ' ' '' +Key 0x43 = 'k' 'K' 0x0b ' ' '' 'K' 'k' ' ' '' +Key 0x44 = 'l' 'L' 0x0c ' ' '' 'L' 'l' ' ' '' +Key 0x45 = 0xc3a7 0xc387 0x1d ' ' '' 0xc387 0xc3a7 ' ' '' +# dead keys +Key 0x46 = '~' '^' 0x1e ' ' '' '~' '^' ' ' '' +Key 0x47 = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a +Key 0x48 = 0x1c '4' 0x1c 0x1c '4' 0x1c '4' 0x1c '4' +Key 0x49 = '' '5' '' '' '5' '' '5' '' '5' +Key 0x4a = 0x1d '6' 0x1d 0x1d '6' 0x1d '6' 0x1d '6' +Key 0x4b = '' '' '' '' '' '' '' '' '' +Key 0x4c = 'z' 'Z' 0x1a ' ' '' 'Z' 'z' ' ' '' +Key 0x4d = 'x' 'X' 0x18 ' ' '' 'X' 'x' ' ' '' +Key 0x4e = 'c' 'C' 0x03 ' ' '' 'C' 'c' ' ' '' +Key 0x4f = 'v' 'V' 0x16 ' ' '' 'V' 'v' ' ' '' +Key 0x50 = 'b' 'B' 0x02 ' ' '' 'B' 'b' ' ' '' +Key 0x51 = 'n' 'N' 0x0e ' ' '' 'N' 'n' ' ' '' +Key 0x52 = 'm' 'M' 0x0d ' ' '' 'M' 'm' ' ' '' +Key 0x53 = ',' '<' '' ' ' '' ',' '<' ' ' '' +Key 0x54 = '.' '>' '' ' ' '' '.' '>' ' ' '' +Key 0x55 = ';' ':' '' ' ' '' ';' ':' ' ' '' +Key 0x56 = '' '' '' '' '' '' '' '' '' +Key 0x57 = 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e 0x1e +Key 0x58 = 0x04 '1' 0x04 0x04 '1' 0x04 '1' 0x04 '1' +Key 0x59 = 0x1f '2' 0x1f 0x1f '2' 0x1f '2' 0x1f '2' +Key 0x5a = 0x0c '3' 0x0c 0x0c '3' 0x0c '3' 0x0c '3' +Key 0x5b = 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a 0x0a +Key 0x5c = '' '' '' '' '' '' '' '' '' +Key 0x5d = '' '' '' '' '' '' '' '' '' +Key 0x5e = ' ' ' ' 0x00 ' ' ' ' ' ' ' ' ' ' ' ' +Key 0x5f = '' '' '' '' '' '' '' '' '' +Key 0x60 = '' '' '' '' '' '' '' '' '' +Key 0x61 = 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c 0x1c +Key 0x62 = 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f 0x1f +Key 0x63 = 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d 0x1d +Key 0x64 = 0x05 '0' 0x05 0x05 '0' 0x05 '0' 0x05 '0' +Key 0x65 = 0x7f ',' 0x7f 0x7f ',' 0x7f ',' 0x7f ',' +Key 0x66 = '' '' '' '' '' '' '' '' '' +Key 0x67 = '' '' '' '' '' '' '' '' '' +Key 0x68 = '' '' '' '' '' '' '' '' '' +Key 0x69 = '\\' '|' 0x1c ' ' '' '\\' '|' ' ' '' +Key 0x6a = '' '' '' '' '' '' '' '' '' +# the 103rd key (on the left of the right Shift key, same as Japanese underscore key) +Key 0x6b = '/' '?' '' 0xc2b0 '' '/' '?' 0xc2b0 '' +Key 0x6c = '' '' '' '' '' '' '' '' '' +Key 0x6d = '' '' '' '' '' '' '' '' '' +Key 0x6e = '' '' '' '' '' '' '' '' '' +Key 0x6f = '' '' '' '' '' '' '' '' '' +# keypad period (preliminary; patch required) +Key 0x70 = '.' '.' '.' '.' '.' '.' '.' '.' '.' +Key 0x71 = '' '' '' '' '' '' '' '' '' +Key 0x72 = '' '' '' '' '' '' '' '' '' +Key 0x73 = '' '' '' '' '' '' '' '' '' +Key 0x74 = '' '' '' '' '' '' '' '' '' +Key 0x75 = '' '' '' '' '' '' '' '' '' +Key 0x76 = '' '' '' '' '' '' '' '' '' +Key 0x77 = '' '' '' '' '' '' '' '' '' +Key 0x78 = '' '' '' '' '' '' '' '' '' +Key 0x79 = '' '' '' '' '' '' '' '' '' +Key 0x7a = '' '' '' '' '' '' '' '' '' +Key 0x7b = '' '' '' '' '' '' '' '' '' +Key 0x7c = '' '' '' '' '' '' '' '' '' +Key 0x7d = '' '' '' '' '' '' '' '' '' +Key 0x7e = '' '' '' '' '' '' '' '' '' +Key 0x7f = '' '' '' '' '' '' '' '' '' +Acute ' ' = 0xc2b4 # U+00B4 ACUTE ACCENT +Acute 'A' = 0xc381 +Acute 'E' = 0xc389 +Acute 'I' = 0xc38d +Acute 'O' = 0xc393 +Acute 'U' = 0xc39a +Acute 'Y' = 0xc39d +Acute 'a' = 0xc3a1 +Acute 'e' = 0xc3a9 +Acute 'i' = 0xc3ad +Acute 'o' = 0xc3b3 +Acute 'u' = 0xc3ba +Acute 'y' = 0xc3bd +AcuteTab = Normal Shift Option Option-Shift CapsLock CapsLock-Shift CapsLock-Option CapsLock-Option-Shift +Grave ' ' = '`' # U+0060 GRAVE ACCENT +Grave 'A' = 0xc380 +Grave 'E' = 0xc388 +Grave 'I' = 0xc38c +Grave 'O' = 0xc392 +Grave 'U' = 0xc399 +Grave 'a' = 0xc3a0 +Grave 'e' = 0xc3a8 +Grave 'i' = 0xc3ac +Grave 'o' = 0xc3b2 +Grave 'u' = 0xc3b9 +GraveTab = Normal Shift Option Option-Shift CapsLock CapsLock-Shift CapsLock-Option CapsLock-Option-Shift +Circumflex ' ' = '^' # U+005E CIRCUMFLEX ACCENT +Circumflex 'A' = 0xc382 +Circumflex 'E' = 0xc38a +Circumflex 'I' = 0xc38e +Circumflex 'O' = 0xc394 +Circumflex 'U' = 0xc39b +Circumflex 'a' = 0xc3a2 +Circumflex 'e' = 0xc3aa +Circumflex 'i' = 0xc3ae +Circumflex 'o' = 0xc3b4 +Circumflex 'u' = 0xc3bb +CircumflexTab = Normal Shift Option Option-Shift CapsLock CapsLock-Shift CapsLock-Option CapsLock-Option-Shift +Diaeresis ' ' = 0xc2a8 # U+00A8 DIAERESIS +Diaeresis 'A' = 0xc384 +Diaeresis 'E' = 0xc38b +Diaeresis 'I' = 0xc38f +Diaeresis 'O' = 0xc396 +Diaeresis 'U' = 0xc39c +Diaeresis 'Y' = 0xc5b8 +Diaeresis 'a' = 0xc3a4 +Diaeresis 'e' = 0xc3ab +Diaeresis 'i' = 0xc3af +Diaeresis 'o' = 0xc3b6 +Diaeresis 'u' = 0xc3bc +Diaeresis 'y' = 0xc3bf +DiaeresisTab = Normal Shift Option Option-Shift CapsLock CapsLock-Shift CapsLock-Option CapsLock-Option-Shift +Tilde ' ' = '~' # U+007E TILDE +Tilde 'A' = 0xc383 +Tilde 'O' = 0xc395 +Tilde 'N' = 0xc391 +Tilde 'a' = 0xc3a3 +Tilde 'o' = 0xc3b5 +Tilde 'n' = 0xc3b1 +TildeTab = Normal Shift Option Option-Shift CapsLock CapsLock-Shift CapsLock-Option CapsLock-Option-Shift From anevilyak at mail.berlios.de Fri Apr 4 02:40:43 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Fri, 4 Apr 2008 02:40:43 +0200 Subject: [Haiku-commits] r24788 - haiku/trunk/src/apps/aboutsystem Message-ID: <200804040040.m340ehHr009977@sheep.berlios.de> Author: anevilyak Date: 2008-04-04 02:40:42 +0200 (Fri, 04 Apr 2008) New Revision: 24788 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24788&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: * AboutSystem now shows cache usage together with total/available mem. * Small cleanups. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-04 00:34:11 UTC (rev 24787) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-04 00:40:42 UTC (rev 24788) @@ -1,9 +1,10 @@ /* - * Copyright (c) 2005-2007, Haiku, Inc. + * Copyright (c) 2005-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * - * Author: + * Authors: * DarkWyrm + * Ren? Gollent */ @@ -43,7 +44,8 @@ static const char *UptimeToString(char string[], size_t size); -static const char *MemUsageToString(char string[], size_t size); +static const char *MemUsageToString(char string[], size_t size, system_info *info); +static const char *CacheUsageToString(char string[], size_t size, system_info *info); static const rgb_color kDarkGrey = { 100, 100, 100, 255 }; static const rgb_color kHaikuGreen = { 42, 131, 36, 255 }; @@ -81,6 +83,7 @@ private: BStringView *fMemView; + BStringView *fCacheView; BStringView *fUptimeView; BView *fInfoView; BTextView *fCreditsView; @@ -235,7 +238,6 @@ fInfoView->AddChild(stringView); stringView->ResizeToPreferred(); - BString cpuType; cpuType << get_cpu_vendor_string(systemInfo.cpu_type) << " " << get_cpu_model_string(&systemInfo); @@ -272,10 +274,15 @@ fMemView = new BStringView(r, "ramtext", ""); fInfoView->AddChild(fMemView); - //fMemView->ResizeToPreferred(); - - fMemView->SetText(MemUsageToString(string, sizeof(string))); + fMemView->SetText(MemUsageToString(string, sizeof(string), &systemInfo)); + r.OffsetBy(0, textHeight); + r.bottom = r.top + textHeight; + + fCacheView = new BStringView(r, "cachetext", ""); + fInfoView->AddChild(fCacheView); + fCacheView->SetText(CacheUsageToString(string, sizeof(string), &systemInfo)); + // Kernel build time/date r.OffsetBy(0, textHeight * 1.5); r.bottom = r.top + labelHeight; @@ -658,9 +665,11 @@ AboutView::Pulse(void) { char string[255]; - + system_info info; + get_system_info(&info); fUptimeView->SetText(UptimeToString(string, sizeof(string))); - fMemView->SetText(MemUsageToString(string, sizeof(string))); + fMemView->SetText(MemUsageToString(string, sizeof(string), &info)); + fCacheView->SetText(CacheUsageToString(string, sizeof(string), &info)); if (fScrollRunner == NULL && (system_time() > fLastActionTime + 10000000)) { BMessage message(SCROLL_CREDITS_VIEW); @@ -823,22 +832,24 @@ static const char * -MemUsageToString(char string[], size_t size) +MemUsageToString(char string[], size_t size, system_info *info) { - system_info systemInfo; - - if (get_system_info(&systemInfo) < B_OK) - return "Unknown"; - snprintf(string, size, "%d MB total, %d MB used (%d%%)", - int(systemInfo.max_pages / 256.0f + 0.5f), - int(systemInfo.used_pages / 256.0f + 0.5f), - int(100 * systemInfo.used_pages / systemInfo.max_pages)); + int(info->max_pages / 256.0f + 0.5f), + int(info->used_pages / 256.0f + 0.5f), + int(100 * info->used_pages / info->max_pages)); return string; } +static const char * +CacheUsageToString(char string[], size_t size, system_info *info) +{ + snprintf(string, size, "Cache size: %d MB", int(info->cached_pages / 256.0f + 0.5f)); + return string; +} + static const char * UptimeToString(char string[], size_t size) { From bga at bug-br.org.br Fri Apr 4 02:55:29 2008 From: bga at bug-br.org.br (Bruno G. Albuquerque) Date: Thu, 3 Apr 2008 21:55:29 -0300 (BRT) Subject: [Haiku-commits] r24785 - haiku/trunk/src/tools/vmdkimage In-Reply-To: <200804032354.m33Nsuoe001966@sheep.berlios.de> References: <200804032354.m33Nsuoe001966@sheep.berlios.de> Message-ID: <41041.189.26.198.73.1207270529.squirrel@www.bug-br.org.br> Hi Ingo. Although this was most certainly not *THIS* change, your recent changes seem to have broken the VMWare image under VMWare player. When I try to start the virtual machine VMPLayer says it can not find the vmdk file. Then I browse from inside VMWare Player to the file, select it and it still says it can not find the file. I would gues sthat for some reason it is not recognizing the vmdk generated. Note that it worked alright before these changes. -Bruno Em Qui, Abril 3, 2008 8:54 pm, bonefish at BerliOS escreveu: > Author: bonefish > Date: 2008-04-04 01:54:55 +0200 (Fri, 04 Apr 2008) > New Revision: 24785 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24785&view=rev > > Modified: > haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp > Log: > Fixed incorrect getopt() specification: -c and -H don't have arguments. > > > Modified: haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp > =================================================================== > --- haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp 2008-04-03 21:18:18 UTC > (rev 24784) > +++ haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp 2008-04-03 23:54:55 UTC > (rev 24785) > @@ -61,7 +61,7 @@ > }; > > opterr = 0; /* don't print errors */ > - c = getopt_long(argc, argv, "h:i:c:H:f:", long_options, NULL); > + c = getopt_long(argc, argv, "h:i:cHf:", long_options, NULL); > if (c == -1) > break; > > > _______________________________________________ > Haiku-commits mailing list > Haiku-commits at lists.berlios.de > https://lists.berlios.de/mailman/listinfo/haiku-commits > From ingo_weinhold at gmx.de Fri Apr 4 03:17:52 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 04 Apr 2008 03:17:52 +0200 Subject: [Haiku-commits] r24785 - haiku/trunk/src/tools/vmdkimage In-Reply-To: <41041.189.26.198.73.1207270529.squirrel@www.bug-br.org.br> References: <200804032354.m33Nsuoe001966@sheep.berlios.de> <41041.189.26.198.73.1207270529.squirrel@www.bug-br.org.br> Message-ID: <20080404031752.1451.11@knochen-vm.1207248335.fake> On 2008-04-04 at 02:55:29 [+0200], Bruno G. Albuquerque wrote: > Hi Ingo. Although this was most certainly not *THIS* change, your recent > changes seem to have broken the VMWare image under VMWare player. When I > try to start the virtual machine VMPLayer says it can not find the vmdk > file. Then I browse from inside VMWare Player to the file, select it and > it still says it can not find the file. I would gues sthat for some reason > it is not recognizing the vmdk generated. Darn, looks like I tested the wrong VM. Looking into it... CU, Ingo From bonefish at mail.berlios.de Fri Apr 4 03:24:27 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 4 Apr 2008 03:24:27 +0200 Subject: [Haiku-commits] r24789 - haiku/trunk/src/tools/vmdkimage Message-ID: <200804040124.m341ORBN012461@sheep.berlios.de> Author: bonefish Date: 2008-04-04 03:24:26 +0200 (Fri, 04 Apr 2008) New Revision: 24789 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24789&view=rev Modified: haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp Log: * Used the original size for vmdk Extent Description, not the sector-aligned one. * Truncated the image a little too short. Modified: haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp =================================================================== --- haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp 2008-04-04 00:40:42 UTC (rev 24788) +++ haiku/trunk/src/tools/vmdkimage/vmdkimage.cpp 2008-04-04 01:24:26 UTC (rev 24789) @@ -190,7 +190,7 @@ sprintf(desc + strlen(desc), "# Extent Description\n" "RW %llu FLAT \"%s\" %llu\n", - imagesize / 512, name, headersize / 512); + actualImageSize / 512, name, headersize / 512); sprintf(desc + strlen(desc), "# Disk Data Base\n" "ddb.toolsVersion = \"0\"\n" @@ -222,7 +222,7 @@ if (!headerOnly) { if (clearImage && ftruncate(fd, headersize) != 0 - || ftruncate(fd, actualImageSize) != 0) { + || ftruncate(fd, actualImageSize + headersize) != 0) { fprintf(stderr, "Error: resizing file %s failed (%s)\n", file, strerror(errno)); exit(EXIT_FAILURE); From superstippi at gmx.de Fri Apr 4 08:38:23 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Fri, 04 Apr 2008 08:38:23 +0200 Subject: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs In-Reply-To: <47F55975.1080104@zappotek.com> References: <200804031814.m33IEC8D012359@sheep.berlios.de> <47F55975.1080104@zappotek.com> Message-ID: <20080404063823.190980@gmx.net> -------- Original-Nachricht -------- > Datum: Fri, 04 Apr 2008 00:25:57 +0200 > Von: Alexandre Deckner > An: SVN commits to the Haiku source repository > Betreff: Re: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs > mmlr at BerliOS wrote : > > Author: mmlr > > Date: 2008-04-03 20:14:11 +0200 (Thu, 03 Apr 2008) > > New Revision: 24777 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24777&view=rev > > > > Modified: > > > haiku/trunk/headers/private/kernel/disk_device_manager/KDiskDeviceManager.h > > > haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp > > haiku/trunk/src/system/kernel/fs/vfs_boot.cpp > > Log: > > Implement node monitoring in the kernel disk device manager. > > > > * Added {Create|Delete}Device() analogous to {Create|Delete}FileDevice > > * Added a small DeviceWatcher class that reacts to entry > creation/removal > > * Implemented a way to start/stop node monitoring > > * Start watching for devices after the boot volume has been mounted and > the > > the second initial scan was run > > > > The disk device manager now creates and scans a device when a "raw" node > is > > published and deletes the device on removal. This makes hot-plugging of > disk > > devices (for example memory sticks using usb_disk) work. Their > partitions will > > be scanned and published so they can be mounted. Somehow the removal of > the > > partitions does not yet work however, any insights are welcome. > > > > > > Really nice work on usb_disk! Quickly tested with a memory stick under > vmware and it seems to work pretty well already :-) (didn't test > hot-unplugging). Yes, I was pretty impressed, my stick worked out of the box (hot plugging and mounted during boot)! Thanks for this awesome work, Michael! When you added it to the image, I noticed you didn't add it to the boot drivers, was this intentional? Is there any problem with that? I took your original commit message to mean Haiku could be booted off USB devices when the driver is linked in the boot folder. Best regards, -Stephan From philippe.houdoin at free.fr Fri Apr 4 10:36:24 2008 From: philippe.houdoin at free.fr (philippe.houdoin at free.fr) Date: Fri, 4 Apr 2008 10:36:24 +0200 Subject: [Haiku-commits] r24780 - haiku/trunk/build/jam Message-ID: <644bda5106bccc6a671881f57e024878@free.fr> > Log: > Add the usb_disk driver to the image. Nice addition! > AddDriversToHaikuImage disk scsi : scsi_cd scsi_dsk ; > +AddDriversToHaikuImage disk usb : usb_disk ; BTW, can't we rename scsi_dsk into scsi_d*i*sk for both consistency and clarity? Philippe. From mmlr at mlotz.ch Fri Apr 4 10:56:19 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 4 Apr 2008 10:56:19 +0200 Subject: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs In-Reply-To: <20080404063823.190980@gmx.net> References: <200804031814.m33IEC8D012359@sheep.berlios.de> <47F55975.1080104@zappotek.com> <20080404063823.190980@gmx.net> Message-ID: <20080404084623.M71447@mlotz.ch> On Fri, 04 Apr 2008 08:38:23 +0200, Stephan Assmus wrote > Yes, I was pretty impressed, my stick worked out of the box (hot > plugging and mounted during boot)! Thanks for this awesome work, Michael! As long as you don't hot-unplug it ;-) > When you added it to the image, I noticed you didn't add it to the > boot drivers, was this intentional? Is there any problem with that? > I took your original commit message to mean Haiku could be booted > off USB devices when the driver is linked in the boot folder. It actually was intentional as I am not yet sure what is really needed for USB boot to work. It does work when linking the stack (usb bus_manager + uhci/ehci) and the usb_disk driver into the boot modules. But this is technically not correct, as usb_disk is a driver and not actually a module (it does not export a module_info). There is a corresponding error message that the module could not be added. So I have yet to test out if only linking the stack will work. But yes, USB boot works since the first commit when setup this way. I actually have a USB stick which I booted some machines at work with to test out. Regards Michael From mmlr at mlotz.ch Fri Apr 4 11:01:46 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 4 Apr 2008 11:01:46 +0200 Subject: [Haiku-commits] r24780 - haiku/trunk/build/jam In-Reply-To: <644bda5106bccc6a671881f57e024878@free.fr> References: <644bda5106bccc6a671881f57e024878@free.fr> Message-ID: <20080404085821.M40295@mlotz.ch> On Fri, 4 Apr 2008 10:36:24 +0200, philippe.houdoin wrote > > AddDriversToHaikuImage disk scsi : scsi_cd scsi_dsk ; > > +AddDriversToHaikuImage disk usb : usb_disk ; > > BTW, can't we rename scsi_dsk into scsi_d*i*sk for both consistency > and clarity? Yeah, I also wondered why it was called scsi_dsk a few times. As far as I remember the original SCSI disk driver under BeOS was also called scsi_dsk, so probably the name was just reused. But that of course does not mean that we shouldn't change it for Haiku. So +1 for renaming from me. Regards Michael From axeld at pinc-software.de Fri Apr 4 11:07:45 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 04 Apr 2008 11:07:45 +0200 CEST Subject: [Haiku-commits] r24780 - haiku/trunk/build/jam In-Reply-To: <644bda5106bccc6a671881f57e024878@free.fr> Message-ID: <3410194149-BeMail@zon> wrote: > > +AddDriversToHaikuImage disk usb : usb_disk ; > BTW, can't we rename scsi_dsk into scsi_d*i*sk for both consistency > and clarity? Sure we can, it's on my TODO list since we got it - just very low priority ;-) Bye, Axel. From axeld at pinc-software.de Fri Apr 4 11:11:45 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 04 Apr 2008 11:11:45 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24777_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/private/kernel/disk=5Fdevice=5Fmanager_src/system/kerne?= =?iso-8859-15?q?l/disk=5Fdevice=5Fmanager__src/system/kernel/fs?= In-Reply-To: <20080404084623.M71447@mlotz.ch> Message-ID: <3650102653-BeMail@zon> "Michael Lotz" wrote: > It actually was intentional as I am not yet sure what is really > needed for USB > boot to work. It does work when linking the stack (usb bus_manager + > uhci/ehci) and the usb_disk driver into the boot modules. But this is > technically not correct, as usb_disk is a driver and not actually a > module (it > does not export a module_info). There is a corresponding error > message that > the module could not be added. So I have yet to test out if only > linking the That's just because the boot modules will be tried first, only afterwards it will be checked if this is a standard driver. In any case, this boot method is only a temporary solution, anyway. > stack will work. But yes, USB boot works since the first commit when > setup > this way. I actually have a USB stick which I booted some machines at > work > with to test out. Very cool! BTW how do you want us to proceed with this thing? Originally, my plan was to finish the new driver architecture, and then port the USB stuff to it. What are we going to do with usb_scsi+scsi bus_manager vs. usb_disk? Bye, Axel. From mmlr at mlotz.ch Fri Apr 4 12:02:51 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 4 Apr 2008 12:02:51 +0200 Subject: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs In-Reply-To: <3650102653-BeMail@zon> References: <20080404084623.M71447@mlotz.ch> <3650102653-BeMail@zon> Message-ID: <20080404100110.M31125@mlotz.ch> Now I see that this message also got to the list, so I will repost my answer here... On Fri, 04 Apr 2008 11:11:45 +0200 CEST, Axel D?rfler wrote > That's just because the boot modules will be tried first, only > afterwards it will be checked if this is a standard driver. In any > case, this boot method is only a temporary solution, anyway. Ah, another one of those temporary solutions ;-) >> stack will work. But yes, USB boot works since the first commit when >> setup >> this way. I actually have a USB stick which I booted some machines at >> work >> with to test out. > > Very cool! Yeah, it's quite neat, but in fact the performance of most USB sticks sucks for the usage pattern a booting Haiku has (they are usually meant for larger bulk transfers). Also loading of applications from such devices is slow (especially Firefox for example that involves many small reads and writes). Installing to a BFS on such a device usually takes ages too because of the many small files written and the generally poor write performance of most flash media. In the process of optimizing CD boot we will probably automatically speed up this kind of device too though. > BTW how do you want us to proceed with this thing? Originally, my > plan was to finish the new driver architecture, and then port the > USB stuff to it. What are we going to do with usb_scsi+scsi > bus_manager vs. usb_disk? Well, the new driver architecture again... In fact, the problem with usb_scsi is not really the USB side of things. The problem there is the changed SCSI interface. I am not sure that moving the USB stack will really bring any benefit there. Then there is the general question of usb_scsi vs. usb_disk. With the current USB stack, writing USB drivers is pretty straight forward and simple. And the way things work really fits the hotplugging architecture of USB. So doing a driver like usb_disk which dynamically reacts and publishes raw nodes makes a lot of sense and works nicely. The usb_scsi module simply has to do more work here as it needs to bridge between the USB and SCSI architecture. Currently usb_scsi will just reserve fake entries in the SCSI bus and then "fill" them when something is plugged in. This approach has the problem of being very inflexible. If devices provide more LUNs than reserved for example or you simply plug in more devices than you reserved, these resources won't be accessible. Of course when we do a full port we would also fix this by dynamic publishing of devices. It's really a question of work. Getting USB mass storage to work with a driver like usb_disk is just way easier to do and requires less work than porting over usb_scsi. I tried a few times to actually get usb_scsi ported, so did others, but it seems just a lot of work and one really easily gets stuck. On the other hand I hacked up usb_disk and now disk monitoring and rescanning so that hotplugging works in just a few days of work and it works perfectly well. So in the end, after the new driver architecture is finalized and we see real benefit in it we should revisit this and attempt to cleanly port over usb_scsi. But for now I don't see the need to invest any more time into that when we can get the same functionality with less effort. Regards Michael From mmlr at mlotz.ch Fri Apr 4 12:21:00 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 4 Apr 2008 12:21:00 +0200 Subject: [Haiku-commits] r24773 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel Message-ID: <20080404100655.M43510@mlotz.ch> > Author: stippi > Date: 2008-04-03 16:24:10 +0200 (Thu, 03 Apr 2008) > New Revision: 24773 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24773&view=rev > Log: > * Revised boot splash artwork, the logo is back in the lower right corner, > the icons are centered. Well, so nobody else answered to that so far. But I really have to. This is a highly subjective matter of course, so all this is IMHO. To make it short, I really don't like this change. At first, there was only the logo at the lower right corner - that looked ok. Then there was the logo centered on top of that neat white line and the animated icons - this really looked great, very modern and I immediately fell in love with it. If the whole block of logo+line+icons was vertically centered it would have been perfect IMHO. Now we have both, the logo in the lower right corner and the animated icons. But they do not really "connect" anymore (for lack of a better word). It looks to me like both items were just thrown into the bootscreen. Then there is another problem that I noticed on my laptop. I have a native resolution of 1280x800 so it is a widescreen display. The bootscreen will be 1024x768 though and is centered with two black bars on each side. Now the placement of the logo is even more wired as it is actually not in the lower right corner anymore but just "somewhere" in the lower part of the screen. The vertically and horizontally centered approach obviously didn't have this problem. So afterall I guess I just wanted to note that I liked the previous version far better and maybe bring that up for discussion. I for one would find it nice if we could have the previous version back. Regards Michael From axeld at mail.berlios.de Fri Apr 4 13:06:34 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Apr 2008 13:06:34 +0200 Subject: [Haiku-commits] r24790 - in haiku/trunk/src/build/libbe/storage: . mime Message-ID: <200804041106.m34B6YOL012340@sheep.berlios.de> Author: axeld Date: 2008-04-04 13:06:33 +0200 (Fri, 04 Apr 2008) New Revision: 24790 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24790&view=rev Modified: haiku/trunk/src/build/libbe/storage/Mime.cpp haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp Log: * More or less reverted r24782; most ifdef's are NOT needed when running Haiku code, they work around buggy BeOS code not present on Haiku. * If this code turns out to be problematic under Haiku (Bruno, did your changes make any difference at all?), then please fix the problems in the Storage Kit, don't enable work-arounds for BeOS. * Simplified the macro check as suggested by Ingo. Modified: haiku/trunk/src/build/libbe/storage/Mime.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/Mime.cpp 2008-04-04 01:24:26 UTC (rev 24789) +++ haiku/trunk/src/build/libbe/storage/Mime.cpp 2008-04-04 11:06:33 UTC (rev 24790) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2006, Haiku Inc. + * Copyright 2002-2008, Haiku Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -12,19 +12,9 @@ Mime type C functions implementation. */ -#include -#include -#include -#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) && !defined(HAIKU_HOST_PLATFORM_HAIKU) -# include -#endif #include #include -#include -#include -#include - using namespace BPrivate; // update_mime_info @@ -79,7 +69,7 @@ */ status_t create_app_meta_mime(const char *path, int recursive, int synchronous, - int force) + int force) { // We don't have a MIME DB... return B_OK; Modified: haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp 2008-04-04 01:24:26 UTC (rev 24789) +++ haiku/trunk/src/build/libbe/storage/mime/MimeUpdateThread.cpp 2008-04-04 11:06:33 UTC (rev 24790) @@ -31,7 +31,7 @@ namespace BPrivate { namespace Storage { -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) +#ifdef __BEOS__ // device_is_root_device bool device_is_root_device(dev_t device) @@ -52,7 +52,7 @@ If \a replyee is non-NULL and construction succeeds, the MimeThreadObject assumes resposibility for its deletion. - + Also, if \c non-NULL, \a replyee is expected to be a \c B_REG_MIME_UPDATE_MIME_INFO or a \c B_REG_MIME_CREATE_APP_META_MIME message with a \c true \c "synchronous" field detached from the registrar's mime manager looper (though this is not verified). @@ -67,7 +67,7 @@ , fForce(force) , fReplyee(replyee) , fStatus(root ? B_OK : B_BAD_VALUE) -{ +{ } // destructor @@ -131,7 +131,7 @@ // DeviceSupportsAttributes /*! \brief Returns true if the given device supports attributes, false if not (or if an error occurs while determining). - + Device numbers and their corresponding support info are cached in a std::list to save unnecessarily \c statvfs()ing devices that have already been statvfs()ed (which might otherwise happen quite often @@ -157,11 +157,11 @@ { status_t err = ref ? B_OK : B_BAD_VALUE; bool entryIsDir = false; - + // Look to see if we're being terminated // if (!err && fShouldExit) // err = B_CANCELED; - + // Before we update, make sure this entry lives on a device that supports // attributes. If not, we skip it and any of its children for // updates (we don't signal an error, however). @@ -169,18 +169,18 @@ //BPath path(ref); //printf("Updating '%s' (%s)... \n", path.Path(), // (DeviceSupportsAttributes(ref->device) ? "yes" : "no")); - + if (!err && (device_is_root_device(ref->device) - || DeviceSupportsAttributes(ref->device))) { + || DeviceSupportsAttributes(ref->device))) { // Update this entry if (!err) err = DoMimeUpdate(ref, &entryIsDir); // If we're recursing and this is a directory, update // each of the directory's children as well - if (!err && fRecursive && entryIsDir) { - BDirectory dir; + if (!err && fRecursive && entryIsDir) { + BDirectory dir; err = dir.SetTo(ref); if (!err) { entry_ref childRef; @@ -193,13 +193,13 @@ err = B_OK; break; } else { - err = UpdateEntry(&childRef); - } - } - } + err = UpdateEntry(&childRef); + } + } + } } } - return err; + return err; } } // namespace Mime Modified: haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp 2008-04-04 01:24:26 UTC (rev 24789) +++ haiku/trunk/src/build/libbe/storage/mime/UpdateMimeInfoThread.cpp 2008-04-04 11:06:33 UTC (rev 24790) @@ -24,7 +24,7 @@ #include #include -#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) && !defined(HAIKU_HOST_PLATFORM_HAIKU) +#if !defined(__BEOS__) || defined(__HAIKU__) # include #else # define B_VECTOR_ICON_TYPE 'VICN' @@ -56,7 +56,7 @@ err = appFileInfoWrite.SetIconForType(type, &icon, iconSize); else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND) { err = appFileInfoWrite.SetIconForType(type, NULL, iconSize); -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) +#if defined(__BEOS__) && !defined(__HAIKU__) // gives an error if the attribute didn't exist yet... err = B_OK; #endif @@ -110,7 +110,7 @@ } -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) +#if defined(__BEOS__) || !defined(__HAIKU__) // BMimeType::GuessMimeType() doesn't seem to work under BeOS status_t guess_mime_type(const void *_buffer, int32 length, BMimeType *type) @@ -220,7 +220,8 @@ BMimeType type; if (!err && (updateType || updateAppInfo)) { err = BMimeType::GuessMimeType(entry, &type); -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) +#if defined(__BEOS__) && !defined(__HAIKU__) + // GuessMimeType() doesn't seem to work correctly under BeOS if (err) err = guess_mime_type(entry, &type); #endif @@ -261,7 +262,7 @@ else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND || err == B_BAD_VALUE) { // BeOS returns B_BAD_VALUE on shared libraries err = appFileInfoWrite.SetSignature(NULL); -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) +#if defined(__BEOS__) && !defined(__HAIKU__) err = B_OK; #endif } @@ -288,7 +289,7 @@ err = appFileInfoWrite.SetSupportedTypes(&supportedTypes); hasSupportedTypes = true; } else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND || err == B_BAD_VALUE) { -#if defined(HAIKU_HOST_PLATFORM_DANO) || defined(HAIKU_HOST_PLATFORM_BEOS) || defined(HAIKU_HOST_PLATFORM_BONE) || defined(HAIKU_HOST_PLATFORM_HAIKU) +#if defined(__BEOS__) && !defined(__HAIKU__) file.RemoveAttr(kSupportedTypesAttr); err = B_OK; #else @@ -333,7 +334,7 @@ if (err == B_OK) err = appFileInfoWrite.SetVersionInfo(&versionInfo, kind); else if (err == B_ENTRY_NOT_FOUND || err == B_NAME_NOT_FOUND || err == B_BAD_VALUE) { -#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) && !defined(HAIKU_HOST_PLATFORM_HAIKU) +#if !defined(HAIKU_HOST_PLATFORM_DANO) && !defined(HAIKU_HOST_PLATFORM_BEOS) && !defined(HAIKU_HOST_PLATFORM_BONE) // BeOS crashes when calling SetVersionInfo() with a NULL pointer err = appFileInfoWrite.SetVersionInfo(NULL, kind); #else @@ -360,7 +361,7 @@ supportedType, smallIcon, B_MINI_ICON); if (err != B_OK) return err; - + // large icon err = update_icon(appFileInfoRead, appFileInfoWrite, supportedType, largeIcon, B_LARGE_ICON); From stefano.ceccherini at gmail.com Fri Apr 4 13:13:50 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Fri, 4 Apr 2008 13:13:50 +0200 Subject: [Haiku-commits] r24773 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080404100655.M43510@mlotz.ch> References: <20080404100655.M43510@mlotz.ch> Message-ID: <894b9700804040413k219c229duf7310b6b65810555@mail.gmail.com> 2008/4/4, Michael Lotz : > To make it short, I really don't like this change. At first, there was only > the logo at the lower right corner - that looked ok. Then there was the logo > centered on top of that neat white line and the animated icons - this really > looked great, very modern and I immediately fell in love with it. If the whole > block of logo+line+icons was vertically centered it would have been perfect IMHO. > Now we have both, the logo in the lower right corner and the animated icons. > But they do not really "connect" anymore (for lack of a better word). It looks > to me like both items were just thrown into the bootscreen. I agree. From haiku at kaldience.com Fri Apr 4 13:14:56 2008 From: haiku at kaldience.com (Maurice Kalinowski) Date: Fri, 04 Apr 2008 13:14:56 +0200 Subject: [Haiku-commits] r24773 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080404100655.M43510@mlotz.ch> References: <20080404100655.M43510@mlotz.ch> Message-ID: <47F60DB0.7000200@kaldience.com> Michael Lotz wrote: > So afterall I guess I just wanted to note that I liked the previous version > far better and maybe bring that up for discussion. I for one would find it > nice if we could have the previous version back. > > Though I hate such short reply mails... +1 Cheers, Maurice From bga at bug-br.org.br Fri Apr 4 14:29:21 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Fri, 04 Apr 2008 09:29:21 -0300 Subject: [Haiku-commits] r24790 - in haiku/trunk/src/build/libbe/storage: . mime In-Reply-To: <200804041106.m34B6YOL012340@sheep.berlios.de> References: <200804041106.m34B6YOL012340@sheep.berlios.de> Message-ID: <47F61F21.4030008@bug-br.org.br> axeld at BerliOS wrote: > * More or less reverted r24782; most ifdef's are NOT needed when running > Haiku code, they work around buggy BeOS code not present on Haiku. Well, as this is only executed when building Haiku, I thought more on the lines of BeOS x Linux. > * If this code turns out to be problematic under Haiku (Bruno, did your changes > make any difference at all?), then please fix the problems in the Storage > Kit, don't enable work-arounds for BeOS. Could not test it through yet, but I guess it did not make any change. -Bruno From axeld at pinc-software.de Fri Apr 4 15:33:13 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 04 Apr 2008 15:33:13 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24790_-_in_haiku/trunk/src/build?= =?iso-8859-15?q?/libbe/storage=3A_=2E_mime?= In-Reply-To: <47F61F21.4030008@bug-br.org.br> Message-ID: <19338934778-BeMail@zon> Bruno Albuquerque wrote: > axeld at BerliOS wrote: > > * More or less reverted r24782; most ifdef's are NOT needed when > > running > > Haiku code, they work around buggy BeOS code not present on > > Haiku. > Well, as this is only executed when building Haiku, I thought more on > the lines of BeOS x Linux. Okay, though Linux and Haiku often use the same (Haiku) code in that case, while BeOS uses the stuff from libbe.so for which most of those work-arounds were. > > * If this code turns out to be problematic under Haiku (Bruno, did > > your changes > > make any difference at all?), then please fix the problems in the > > Storage > > Kit, don't enable work-arounds for BeOS. > Could not test it through yet, but I guess it did not make any > change. Great, thanks for the update! Bye, Axel. From axeld at mail.berlios.de Fri Apr 4 15:54:19 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Apr 2008 15:54:19 +0200 Subject: [Haiku-commits] r24791 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804041354.m34DsJJn028735@sheep.berlios.de> Author: axeld Date: 2008-04-04 15:54:18 +0200 (Fri, 04 Apr 2008) New Revision: 24791 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24791&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp Log: * Journal::_TransactionWritten() updated Volume::LogStart() before it actually wrote the super block, so there was a race condition with what _WriteTransactionToLog() assumed was already written there (if it managed to write the log entry before the super block was written by _TransactionWritten(), and a reboot happened just then, the log start could point to an invalid log entry). Not very likely, but it could happen. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-04 11:06:33 UTC (rev 24790) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-04 13:54:18 UTC (rev 24791) @@ -567,8 +567,6 @@ // update the super block, and change the disk's state, if necessary if (update) { - journal->fVolume->LogStart() = superBlock.log_start; - if (superBlock.log_start == superBlock.log_end) superBlock.flags = SUPER_BLOCK_DISK_CLEAN; @@ -577,6 +575,8 @@ FATAL(("_TransactionWritten: could not write back super block: %s\n", strerror(status))); } + + journal->fVolume->LogStart() = superBlock.log_start; } } From axeld at mail.berlios.de Fri Apr 4 16:02:31 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Apr 2008 16:02:31 +0200 Subject: [Haiku-commits] r24792 - haiku/trunk/src/system/kernel/cache Message-ID: <200804041402.m34E2Vjq029726@sheep.berlios.de> Author: axeld Date: 2008-04-04 16:02:30 +0200 (Fri, 04 Apr 2008) New Revision: 24792 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24792&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * If BFS's Journal::_WriteTransactionToLog() noticed there wasn't enough free space left for the new log entry, it did call cache_sync_transaction(), and then just assumed the space would be ready. But since the transaction could have been written before that call by the block writer, and since the _TransactionWritten() hook is now called asynchronously, cache_sync_transaction() actually has to flush all pending TRANSACTION_WRITTEN notifications before returning to the caller. * To implement this, block_cache now publishs a condition variable, and wait_for_notifications() adds a fake notification that signals that one. Since the notifications are handled in FIFO order, this guarantees that the previous TRANSACTION_WRITTEN hook is done. * notify_transaction_listeners() could accidently delete notifications that still had pending signals. Now, it will defer the deletion to the notification thread instead in that case. This should fix bug #2008. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-04 13:54:18 UTC (rev 24791) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-04 14:02:30 UTC (rev 24792) @@ -15,6 +15,7 @@ #include #include +#include #include #include #include @@ -114,6 +115,7 @@ bool read_only; NotificationList pending_notifications; + ConditionVariable condition_variable; bool deleting; block_cache(int fd, off_t numBlocks, size_t blockSize, bool readOnly); @@ -351,7 +353,7 @@ cache_notification ¬ification, int32 events, transaction_notification_hook hook, void *data) { - notification.transaction_id = transaction->id; + notification.transaction_id = transaction != NULL ? transaction->id : -1; notification.events_pending = 0; notification.events = events; notification.hook = hook; @@ -414,8 +416,14 @@ if ((listener->events & event) != 0) add_notification(cache, listener, event, removeListeners); - else if (removeListeners) - delete listener; + else if (removeListeners) { + // we might need to defer the deletion if its currently in use + MutexLocker locker(sNotificationsLock); + if (listener->events_pending != 0) + listener->delete_after_event = true; + else + delete listener; + } } } @@ -552,6 +560,8 @@ sCaches.Add(this); mutex_unlock(&sCachesLock); + condition_variable.Publish(this, "cache transaction sync"); + buffer_cache = create_object_cache_etc("block cache buffers", blockSize, 8, 0, CACHE_LARGE_SLAB, NULL, NULL, NULL, NULL); if (buffer_cache == NULL) @@ -574,6 +584,7 @@ } +//! Should be called with the cache's lock held. block_cache::~block_cache() { deleting = true; @@ -582,6 +593,8 @@ benaphore_destroy(&lock); + condition_variable.Unpublish(); + mutex_lock(&sCachesLock); sCaches.Remove(this); mutex_unlock(&sCachesLock); @@ -1340,6 +1353,30 @@ #endif // DEBUG_BLOCK_CACHE +static void +notify_sync(int32 transactionID, int32 event, void *_cache) +{ + block_cache *cache = (block_cache *)_cache; + + cache->condition_variable.NotifyOne(); +} + + +static void +wait_for_notifications(block_cache *cache) +{ + // add sync notification + cache_notification notification; + set_notification(NULL, notification, TRANSACTION_WRITTEN, notify_sync, + cache); + add_notification(cache, ¬ification, TRANSACTION_WRITTEN, false); + + // wait for condition + ConditionVariableEntry entry; + entry.Wait(cache); +} + + static block_cache * get_next_locked_block_cache(block_cache *last) { @@ -1417,6 +1454,10 @@ } +/*! Flushes all pending notifications by calling the appropriate hook + functions. + Must not be called with a cache lock held. +*/ static void flush_pending_notifications() { @@ -1644,6 +1685,11 @@ } hash_close(cache->transaction_hash, &iterator, false); + locker.Unlock(); + + wait_for_notifications(cache); + // make sure that all pending TRANSACTION_WRITTEN notifications + // are handled after we return return B_OK; } From zharik at gmx.li Fri Apr 4 16:09:54 2008 From: zharik at gmx.li (Siarzhuk Zharski) Date: Fri, 04 Apr 2008 16:09:54 +0200 Subject: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs In-Reply-To: <3650102653-BeMail@zon> References: <3650102653-BeMail@zon> Message-ID: <47F636B2.3000309@gmx.li> Hi, Axel, 04.04.2008 11:11 you wrote: > BTW how do you want us to proceed with this thing? Originally, my plan > was to finish the new driver architecture, and then port the USB stuff > to it. What are we going to do with usb_scsi+scsi bus_manager vs. > usb_disk? Some comments from my side, if you don't mind, ok? ;-D 04.04.2008 12:02 Michael Lotz wrote: >> BTW how do you want us to proceed with this thing? Originally, my >> plan was to finish the new driver architecture, and then port the >> USB stuff to it. What are we going to do with usb_scsi+scsi >> bus_manager vs. usb_disk? >> > Well, the new driver architecture again... In fact, the problem with usb_scsi > is not really the USB side of things. The problem there is the changed SCSI > interface. I am not sure that moving the USB stack will really bring any > benefit there. > In case we will get a more "traditional" SCSI CAM support - all that driver-related glue should gone, I hope. :-) > Then there is the general question of usb_scsi vs. usb_disk. With the current > USB stack, writing USB drivers is pretty straight forward and simple. And the > way things work really fits the hotplugging architecture of USB. So doing a > driver like usb_disk which dynamically reacts and publishes raw nodes makes a > lot of sense and works nicely. The usb_scsi module simply has to do more work > here as it needs to bridge between the USB and SCSI architecture. Currently > usb_scsi will just reserve fake entries in the SCSI bus and then "fill" them > when something is plugged in. This approach has the problem of being very > inflexible. If devices provide more LUNs than reserved for example or you > simply plug in more devices than you reserved, these resources won't be > accessible. Of course when we do a full port we would also fix this by dynamic > publishing of devices. > If we left all those "reservation" tricks out of this discussion scope, usb_scsi behave like a filter - just transfer SCSI commands to usb-based hardware. Ideally this should be no difference is it works with USB connected HDD, CD, floppy or tape mass storages. SCSI sub-system determine the type of connected hardware self and decide which dev entries should be published - hard disk, cd, tape etc. In case we go "usb_disk way" - we have to implement also usb_cd driver, usb_floppy driver and usb_tape driver for every command set. > It's really a question of work. Getting USB mass storage to work with a driver > like usb_disk is just way easier to do and requires less work than porting > over usb_scsi. There are lot of transport protocols (Bulk,CB, CBI) and command sets (SCSI, UFI, ATAPI, RBC, QIC157). :-( There are really many "vendor-protocol" usb mass storages that require some small quirks to be used as standard. > I tried a few times to actually get usb_scsi ported, so did > others, but it seems just a lot of work and one really easily gets stuck. On > the other hand I hacked up usb_disk and now disk monitoring and rescanning so > that hotplugging works in just a few days of work and it works perfectly well. > > So in the end, after the new driver architecture is finalized and we see real > benefit in it we should revisit this and attempt to cleanly port over > usb_scsi. But for now I don't see the need to invest any more time into that > when we can get the same functionality with less effort. > If you remember, before usb_scsi module was developed there was "usb disk" driver from one of Japan developers. It supported CBI-transfers only and was a disk driver not a SCSI CAM module. The life is like verses - not repeated but rhymed. :-) Anyway, Michael, it is just comments. :-) Thank you for your effort! --- Kind Regards, S.Zharski. From axeld at pinc-software.de Fri Apr 4 16:30:33 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 04 Apr 2008 16:30:33 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24777_-_in_haiku/trunk=3A_header?= =?iso-8859-15?q?s/private/kernel/disk=5Fdevice=5Fmanager_src/system/kerne?= =?iso-8859-15?q?l/disk=5Fdevice=5Fmanager__src/system/kernel/fs?= In-Reply-To: <20080404100110.M31125@mlotz.ch> Message-ID: <22778991355-BeMail@zon> "Michael Lotz" wrote: > On Fri, 04 Apr 2008 11:11:45 +0200 CEST, Axel D?rfler wrote > > That's just because the boot modules will be tried first, only > > afterwards it will be checked if this is a standard driver. In any > > case, this boot method is only a temporary solution, anyway. > Ah, another one of those temporary solutions ;-) Indeed, we have plenty of those :-) When I hacked on the new device driver architecture the last time, this just seemed like the easiest solution for now. Ideally, the boot loader would notice it had been loaded from a USB stick/drive and then automatically load the required modules/drivers. Not sure if this is at all possible, though. [...] > In the process of optimizing CD boot we will probably automatically > speed up > this kind of device too though. Probably, depends on how we go about that; what I was thinking at would have to be done specifically for the boot disk, and wouldn't work that well in a standard environment. > > BTW how do you want us to proceed with this thing? Originally, my > > plan was to finish the new driver architecture, and then port the > > USB stuff to it. What are we going to do with usb_scsi+scsi > > bus_manager vs. usb_disk? [...] > It's really a question of work. Getting USB mass storage to work with > a driver > like usb_disk is just way easier to do and requires less work than > porting > over usb_scsi. I tried a few times to actually get usb_scsi ported, > so did > others, but it seems just a lot of work and one really easily gets > stuck. On > the other hand I hacked up usb_disk and now disk monitoring and > rescanning so > that hotplugging works in just a few days of work and it works > perfectly well. > > So in the end, after the new driver architecture is finalized and we > see real > benefit in it we should revisit this and attempt to cleanly port over > usb_scsi. That was what I meant, a forward looking statement :-) > But for now I don't see the need to invest any more time into that > when we can get the same functionality with less effort. Sure, I can perfectly understand this. It's just one more sign that I finally should work on that driver architecture again :-) I'll see what I can do about that this weekend. Bye, Axel. From mmlr at mlotz.ch Fri Apr 4 16:32:31 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 4 Apr 2008 16:32:31 +0200 Subject: [Haiku-commits] r24777 - in haiku/trunk: headers/private/kernel/disk_device_manager src/system/kernel/disk_device_manager src/system/kernel/fs In-Reply-To: <47F636B2.3000309@gmx.li> References: <3650102653-BeMail@zon> <47F636B2.3000309@gmx.li> Message-ID: <20080404141351.M57993@mlotz.ch> On Fri, 04 Apr 2008 16:09:54 +0200, Siarzhuk Zharski wrote > If we left all those "reservation" tricks out of this discussion > scope, usb_scsi behave like a filter - just transfer SCSI commands > to usb-based hardware. Ideally this should be no difference is it > works with USB connected HDD, CD, floppy or tape mass storages. SCSI > sub-system determine the type of connected hardware self and decide > which dev entries should be published - hard disk, cd, tape etc. In > case we go "usb_disk way" - we have to implement also usb_cd driver, > usb_floppy driver and usb_tape driver for every command set. Absolutely. And I fully agree that we will need such a bridge at one point. The example of cdrecord by Stephan was a really good one. For this to work over an eventual usb_cd driver you would almost certainly have to add backend code to cdrecord which in case of a "simple" SCSI-USB bridge is completely unnecessary. > There are lot of transport protocols (Bulk,CB, CBI) and command sets > (SCSI, UFI, ATAPI, RBC, QIC157). :-( There are really many > "vendor-protocol" usb mass storages that require some small quirks > to be used as standard. In fact those are becoming less and less. Microsoft helps here, as they discourage anything other than bulk-only and transparent SCSI. In fact I've read that the RBC protocol is not even supported under Windows. Anyway from the protocol standpoint of view it again makes no real sense to support other protocols besides SCSI in usb_scsi. Because then you again do translation. As soon as you have to do that you could in fact just as well implement it as a driver. > If you remember, before usb_scsi module was developed there was "usb > disk" driver from one of Japan developers. It supported CBI- > transfers only and was a disk driver not a SCSI CAM module. The life > is like verses - not repeated but rhymed. :-) Yes, I took a look at that and it is basically the same thing. As I already started out and quickly got to a point where everything worked nicely I didn't really feel intrigued to reuse any code. It actually did support bulk-only, but it never worked because of a bug in the BeOS USB stack - kinda ironic. > Anyway, Michael, it is just comments. :-) Thank you for your effort! They are appreciated - And I really hope that you do not feel offended by my efforts. As I said, usb_scsi is fine and we should port it over cleanly at some point. It's just that for the current needs a simpler approach that gets most of the current target devices working seemed a better choice. Regards Michael From ingo_weinhold at gmx.de Fri Apr 4 16:41:33 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 04 Apr 2008 16:41:33 +0200 Subject: [Haiku-commits] r24773 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <47F60DB0.7000200@kaldience.com> References: <20080404100655.M43510@mlotz.ch> <47F60DB0.7000200@kaldience.com> Message-ID: <20080404164133.466.1@knochen-vm.1207319339.fake> On 2008-04-04 at 13:14:56 [+0200], Maurice Kalinowski wrote: > Michael Lotz wrote: > > So afterall I guess I just wanted to note that I liked the previous > > version > > far better and maybe bring that up for discussion. I for one would find it > > nice if we could have the previous version back. > > > > > Though I hate such short reply mails... > > +1 +1 CU, Ingo From axeld at mail.berlios.de Fri Apr 4 17:11:38 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Apr 2008 17:11:38 +0200 Subject: [Haiku-commits] r24793 - haiku/trunk/src/system/kernel/cache Message-ID: <200804041511.m34FBcDO004969@sheep.berlios.de> Author: axeld Date: 2008-04-04 17:11:37 +0200 (Fri, 04 Apr 2008) New Revision: 24793 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24793&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * This should fix a deadlock as reported by bga. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-04 14:02:30 UTC (rev 24792) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-04 15:11:37 UTC (rev 24793) @@ -1369,11 +1369,14 @@ cache_notification notification; set_notification(NULL, notification, TRANSACTION_WRITTEN, notify_sync, cache); + + ConditionVariableEntry entry; + entry.Add(cache); + add_notification(cache, ¬ification, TRANSACTION_WRITTEN, false); - // wait for condition - ConditionVariableEntry entry; - entry.Wait(cache); + // wait for notification hook to be called + entry.Wait(); } From anevilyak at mail.berlios.de Fri Apr 4 17:12:12 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Fri, 4 Apr 2008 17:12:12 +0200 Subject: [Haiku-commits] r24794 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200804041512.m34FCCeW005079@sheep.berlios.de> Author: anevilyak Date: 2008-04-04 17:12:11 +0200 (Fri, 04 Apr 2008) New Revision: 24794 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24794&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp Log: On my system's BIOS / monitor there seems to be a race condition between grabbing the EDID info and setting the video mode. The result of this is a garbage display every other boot. By introducing a small wait before doing the mode set, it works every time. Will see if I can reduce the spin timer though with some more tests. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp 2008-04-04 15:11:37 UTC (rev 24793) +++ haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp 2008-04-04 15:12:11 UTC (rev 24794) @@ -27,7 +27,7 @@ #include -//#define TRACE_VIDEO +#define TRACE_VIDEO #ifdef TRACE_VIDEO # define TRACE(x) dprintf x #else @@ -809,7 +809,11 @@ if (sVesaCompatible && sMode != NULL) { if (!sModeChosen) get_mode_from_settings(); - + + // On some BIOS / chipset / monitor combinations, there seems to be a timing issue between + // getting the EDID data and setting the video mode. As such we wait here briefly to give + // everything enough time to settle. + spin(1000); if (vesa_set_mode(sMode->mode) != B_OK) goto fallback; From koki at digintrans.com Fri Apr 4 17:31:56 2008 From: koki at digintrans.com (Jorge G. Mare (a.k.a. Koki)) Date: Fri, 04 Apr 2008 08:31:56 -0700 Subject: [Haiku-commits] r24794 - haiku/trunk/src/system/boot/platform/bios_ia32 In-Reply-To: <200804041512.m34FCCeW005079@sheep.berlios.de> References: <200804041512.m34FCCeW005079@sheep.berlios.de> Message-ID: <47F649EC.4090309@digintrans.com> anevilyak at BerliOS wrote: > Author: anevilyak > Date: 2008-04-04 17:12:11 +0200 (Fri, 04 Apr 2008) > New Revision: 24794 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24794&view=rev > > Modified: > haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp > Log: > On my system's BIOS / monitor there seems to be a race condition between grabbing the EDID info > and setting the video mode. The result of this is a garbage display every other boot. Something like this (see attached screenshot)? http://dev.haiku-os.org/ticket/1959 Cheers, Koki From anevilyak at gmail.com Fri Apr 4 18:31:20 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 4 Apr 2008 11:31:20 -0500 Subject: [Haiku-commits] r24794 - haiku/trunk/src/system/boot/platform/bios_ia32 In-Reply-To: <47F649EC.4090309@digintrans.com> References: <200804041512.m34FCCeW005079@sheep.berlios.de> <47F649EC.4090309@digintrans.com> Message-ID: > > Something like this (see attached screenshot)? > > http://dev.haiku-os.org/ticket/1959 > No, that issue is MTRR-related. This is purely with respect to the video mode during the boot splash, nothing to do with the actual mode used by the app_server, since that's set up by the accelerant, at which point MTRRs come into play. The boot splash mode is VESA-based. Regards, Rene From revol at free.fr Fri Apr 4 18:48:37 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 04 Apr 2008 18:48:37 +0200 CEST Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin In-Reply-To: <200804040015.m340Fgn0005613@sheep.berlios.de> Message-ID: <1492605970-BeMail@laptop> > Author: bga > Date: 2008-04-04 02:15:41 +0200 (Fri, 04 Apr 2008) > New Revision: 24786 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24786&view=rev > > Removed: > haiku/trunk/src/bin/bison/ > haiku/trunk/src/bin/flex/ > Modified: > haiku/trunk/src/bin/Jamfile > Log: > Removed bison and flex as both are now part of the development > package. While it's nice to have a downloadable dev package, and those might not be needed for a base distro, it's still useful to have the sources around IMO. First, because building a distribution is much easier if everything is cross-buildable. It might be harder to get right than running configure scripts and make, but I already went the other way once with Zeta, writing a makefile engine to run configure and make install apps from the source tree to get the full distro, but it's not reliable. Also, some platforms (m68k, but later arm and even ppc) might not even have enough resources to be able to natively build parts of those. Using qemu-ppc to build them is not really a solution. Fran?ois. From bga at bug-br.org.br Fri Apr 4 19:08:35 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Fri, 04 Apr 2008 14:08:35 -0300 Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin In-Reply-To: <1492605970-BeMail@laptop> References: <1492605970-BeMail@laptop> Message-ID: <47F66093.1080402@bug-br.org.br> Fran?ois Revol wrote: > While it's nice to have a downloadable dev package, and those might not > be needed for a base distro, it's still useful to have the sources > around IMO. As I understand it, the idea is to actually get patches submitted to the respective projects. There is no sense in keeping the sources in our source tree unless we also want to keep the sources for everything else (Vision, Firefox, etc). Just my opinion, anyway. -Bruno From axeld at pinc-software.de Fri Apr 4 19:21:16 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 04 Apr 2008 19:21:16 +0200 CEST Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin In-Reply-To: <47F66093.1080402@bug-br.org.br> Message-ID: <33021025880-BeMail@zon> Bruno Albuquerque wrote: > Fran?ois Revol wrote: > > While it's nice to have a downloadable dev package, and those might > > not > > be needed for a base distro, it's still useful to have the sources > > around IMO. > As I understand it, the idea is to actually get patches submitted to > the > respective projects. There is no sense in keeping the sources in our > source tree unless we also want to keep the sources for everything > else > (Vision, Firefox, etc). +1 It probably makes little sense to try to compile Haiku on an Atari Falcon anyway :-) Bye, Axel. From anevilyak at gmail.com Fri Apr 4 19:23:29 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 4 Apr 2008 12:23:29 -0500 Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin In-Reply-To: <33021025880-BeMail@zon> References: <47F66093.1080402@bug-br.org.br> <33021025880-BeMail@zon> Message-ID: > +1 > It probably makes little sense to try to compile Haiku on an Atari > Falcon anyway :-) > > Bye, > Axel. > It'd be impressive if you succeeded though :) Rene From revol at free.fr Fri Apr 4 20:04:27 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 04 Apr 2008 20:04:27 +0200 CEST Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin In-Reply-To: <47F66093.1080402@bug-br.org.br> Message-ID: <210428728-BeMail@laptop> > Fran?ois Revol wrote: > > > While it's nice to have a downloadable dev package, and those might > > not > > be needed for a base distro, it's still useful to have the sources > > around IMO. > > As I understand it, the idea is to actually get patches submitted to > the > respective projects. There is no sense in keeping the sources in our > source tree unless we also want to keep the sources for everything > else > (Vision, Firefox, etc). I didn't mean to include everything in svn, building from the tree doesn't mean the sources are inside the tree (see branches/mmu_man/ distro). Of course patches must be submitted, I always do that ASAP to avoid having to maintain forks, but for smaller stuff like flex and bison having them around can be handy. Fran?ois. From revol at free.fr Fri Apr 4 20:05:22 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 04 Apr 2008 20:05:22 +0200 CEST Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin In-Reply-To: <33021025880-BeMail@zon> Message-ID: <265833933-BeMail@laptop> > Bruno Albuquerque wrote: > > Fran?ois Revol wrote: > > > While it's nice to have a downloadable dev package, and those > > > might > > > not > > > be needed for a base distro, it's still useful to have the > > > sources > > > around IMO. > > As I understand it, the idea is to actually get patches submitted > > to > > the > > respective projects. There is no sense in keeping the sources in > > our > > source tree unless we also want to keep the sources for everything > > else > > (Vision, Firefox, etc). > > +1 > It probably makes little sense to try to compile Haiku on an Atari > Falcon anyway :-) > Which is exactly why things must remain cross-buildable from the tree :p But that doesn't mean the sources must stay in, of course. Fran?ois. From revol at free.fr Fri Apr 4 20:06:18 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 04 Apr 2008 20:06:18 +0200 CEST Subject: [Haiku-commits] r24786 - haiku/trunk/src/bin In-Reply-To: Message-ID: <321322717-BeMail@laptop> > > +1 > > It probably makes little sense to try to compile Haiku on an Atari > > Falcon anyway :-) > > > > Bye, > > Axel. > > > > It'd be impressive if you succeeded though :) Aranym supports up to 256MB of RAM though :p (Hades clones probably do as well) Fran?ois. From axeld at mail.berlios.de Fri Apr 4 20:59:17 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Apr 2008 20:59:17 +0200 Subject: [Haiku-commits] r24795 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804041859.m34IxH8s015197@sheep.berlios.de> Author: axeld Date: 2008-04-04 20:59:17 +0200 (Fri, 04 Apr 2008) New Revision: 24795 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24795&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp Log: * As briefly discussed in ticket #2024, I've changed BFS to allow to mount volumes with a broken log. It will only allow the volume read-only then, though (unlike Be's BFS), as your disk could be corrupt. * Added InitCheck() method to the RecursiveLock class, and now only check this one in Journal::InitCheck() instead of also replaying the log there; this is now done directly in Volume::Mount(). Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-04 15:12:11 UTC (rev 24794) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-04 18:59:17 UTC (rev 24795) @@ -355,16 +355,7 @@ status_t Journal::InitCheck() { - // TODO: this logic won't work whenever the size of the pending transaction - // equals the size of the log (happens with the original BFS only) - if (fVolume->LogStart() != fVolume->LogEnd()) { - if (fVolume->SuperBlock().flags != SUPER_BLOCK_DISK_DIRTY) - FATAL(("log_start and log_end differ, but disk is marked clean - trying to replay log...\n")); - - return ReplayLog(); - } - - return B_OK; + return fLock.InitCheck(); } @@ -493,8 +484,16 @@ status_t Journal::ReplayLog() { + // TODO: this logic won't work whenever the size of the pending transaction + // equals the size of the log (happens with the original BFS only) + if (fVolume->LogStart() == fVolume->LogEnd()) + return B_OK; + INFORM(("Replay log, disk was not correctly unmounted...\n")); + if (fVolume->SuperBlock().flags != SUPER_BLOCK_DISK_DIRTY) + INFORM(("log_start and log_end differ, but disk is marked clean - trying to replay log...\n")); + int32 start = fVolume->LogStart(); int32 lastStart = -1; while (true) { Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h 2008-04-04 15:12:11 UTC (rev 24794) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Lock.h 2008-04-04 18:59:17 UTC (rev 24795) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2001-2008, Axel D?rfler, axeld at pinc-software.de. * This file may be used under the terms of the MIT License. */ #ifndef LOCK_H @@ -48,7 +48,7 @@ { if (fSemaphore < B_OK) return fSemaphore; - + return B_OK; } @@ -62,7 +62,7 @@ return B_OK; #endif } - + status_t Unlock() { #ifdef USE_BENAPHORE @@ -109,7 +109,7 @@ }; -//**** Recursive Lock +// #pragma mark - Recursive Lock class RecursiveLock { public: @@ -125,6 +125,14 @@ { } + status_t InitCheck() const + { + if (fSemaphore < B_OK) + return fSemaphore; + + return B_OK; + } + status_t LockWithTimeout(bigtime_t timeout) { thread_id thread = find_thread(NULL); @@ -277,7 +285,7 @@ { if (fSemaphore < B_OK) return fSemaphore; - + return B_OK; } @@ -363,7 +371,7 @@ { if (fSemaphore < B_OK) return fSemaphore; - + return B_OK; } @@ -543,7 +551,7 @@ break; if (current == thisThread) break; - + snooze(time); } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2008-04-04 15:12:11 UTC (rev 24794) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2008-04-04 18:59:17 UTC (rev 24795) @@ -363,13 +363,23 @@ if (fJournal == NULL) return B_NO_MEMORY; - // replaying the log is the first thing we will do on this disk status_t status = fJournal->InitCheck(); if (status < B_OK) { FATAL(("could not initialize journal: %s!\n", strerror(status))); return status; } + // replaying the log is the first thing we will do on this disk + status = fJournal->ReplayLog(); + if (status < B_OK) { + FATAL(("Replaying log failed, data may be corrupted, volume read-only.\n")); + fFlags |= VOLUME_READ_ONLY; + // TODO: if this is the boot volume, Bootscript will assume this + // is a CD... + // TODO: it would be nice to have a user visible alert instead + // of letting him just find this in the syslog. + } + status = fBlockAllocator.Initialize(); if (status < B_OK) { FATAL(("could not initialize block bitmap allocator!\n")); From stippi at mail.berlios.de Fri Apr 4 21:14:05 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 4 Apr 2008 21:14:05 +0200 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel Message-ID: <200804041914.m34JE5FC016492@sheep.berlios.de> Author: stippi Date: 2008-04-04 21:13:00 +0200 (Fri, 04 Apr 2008) New Revision: 24796 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24796&view=rev Modified: haiku/trunk/data/artwork/boot_splash/splash_icons haiku/trunk/data/artwork/boot_splash/splash_icons.png haiku/trunk/data/artwork/boot_splash/splash_logo haiku/trunk/data/artwork/boot_splash/splash_logo.png haiku/trunk/headers/private/kernel/boot/images.h haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp haiku/trunk/src/system/kernel/boot_splash.cpp Log: Refined again the boot splash artwork. Everything is now centered as a whole. The dividing line is back although with a little more spacing. Also the icon spacing is a little increased and I added a subtle outline as well as a little brighter background for the active icon look. The placement logic is now not independant of each other anymore, otherwise I couldn't center both images as a unit. But only the vertical placement is affected. Comments as always on the commit mailing list... :-) Modified: haiku/trunk/data/artwork/boot_splash/splash_icons =================================================================== (Binary files differ) Modified: haiku/trunk/data/artwork/boot_splash/splash_icons.png =================================================================== (Binary files differ) Modified: haiku/trunk/data/artwork/boot_splash/splash_logo =================================================================== (Binary files differ) Modified: haiku/trunk/data/artwork/boot_splash/splash_logo.png =================================================================== (Binary files differ) Modified: haiku/trunk/headers/private/kernel/boot/images.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/images.h 2008-04-04 18:59:17 UTC (rev 24795) +++ haiku/trunk/headers/private/kernel/boot/images.h 2008-04-04 19:13:00 UTC (rev 24796) @@ -1,12 +1,12 @@ // This file was generated by the generate_boot_screen Haiku build tool. -static const int32 kSplashLogoPlacementX = 80; -static const int32 kSplashLogoPlacementY = 90; +static const int32 kSplashLogoPlacementX = 50; +static const int32 kSplashLogoPlacementY = 50; static const int32 kSplashIconsPlacementX = 50; static const int32 kSplashIconsPlacementY = 50; -static const uint16 kSplashLogoWidth = 294; -static const uint16 kSplashLogoHeight = 86; +static const uint16 kSplashLogoWidth = 372; +static const uint16 kSplashLogoHeight = 96; static const uint8 kSplashLogoImage[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -132,8 +132,6 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -200,15 +198,66 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -233,9 +282,28 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -243,7 +311,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -253,9 +321,9 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -267,29 +335,29 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -297,7 +365,7 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -306,31 +374,50 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -338,40 +425,41 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -379,18 +467,37 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, + 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -398,47 +505,47 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, @@ -452,227 +559,305 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, + 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, + 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, + 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, + 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, + 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, + 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, + 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, + 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, + 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, @@ -693,290 +878,368 @@ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, + 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, + 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, + 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, + 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, + 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, + 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, + 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x10, 0x10, 0x10, + 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x10, 0x10, 0x10, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, + 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, + 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, + 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, + 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, + 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, + 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, + 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, + 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, + 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, + 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, [... truncated: 22342 lines follow ...] From axeld at mail.berlios.de Fri Apr 4 21:32:39 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 4 Apr 2008 21:32:39 +0200 Subject: [Haiku-commits] r24797 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804041932.m34JWdBi019203@sheep.berlios.de> Author: axeld Date: 2008-04-04 21:32:39 +0200 (Fri, 04 Apr 2008) New Revision: 24797 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24797&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp Log: * Resolved a TODO: determine the log size depending on the size of the volume. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2008-04-04 19:13:00 UTC (rev 24796) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2008-04-04 19:32:39 UTC (rev 24797) @@ -654,12 +654,18 @@ fBlockShift = fSuperBlock.BlockShift(); fAllocationGroupShift = fSuperBlock.AllocationGroupShift(); + // determine log size depending on the size of the volume + off_t logSize = 2048; + if (numBlocks <= 20480) + logSize = 512; + if (deviceSize > 1LL * 1024 * 1024 * 1024) + logSize = 4096; + // since the allocator has not been initialized yet, we // cannot use BlockAllocator::BitmapSize() here fSuperBlock.log_blocks = ToBlockRun(AllocationGroups() * fSuperBlock.BlocksPerAllocationGroup() + 1); - fSuperBlock.log_blocks.length = HOST_ENDIAN_TO_BFS_INT16(2048); - // ToDo: set the log size depending on the disk size + fSuperBlock.log_blocks.length = HOST_ENDIAN_TO_BFS_INT16(logSize); fSuperBlock.log_start = fSuperBlock.log_end = HOST_ENDIAN_TO_BFS_INT64( ToBlock(Log())); From korli at mail.berlios.de Fri Apr 4 21:45:12 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 4 Apr 2008 21:45:12 +0200 Subject: [Haiku-commits] r24798 - haiku/trunk/src/servers/app Message-ID: <200804041945.m34JjCU8020359@sheep.berlios.de> Author: korli Date: 2008-04-04 21:45:11 +0200 (Fri, 04 Apr 2008) New Revision: 24798 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24798&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: * GRAY8 is 8 bits * typo Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2008-04-04 19:32:39 UTC (rev 24797) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2008-04-04 19:45:11 UTC (rev 24798) @@ -3083,10 +3083,11 @@ fDirectWindowData->buffer_info->bits_per_pixel = 16; break; case B_CMAP8: + case B_GRAY8: fDirectWindowData->buffer_info->bits_per_pixel = 8; break; default: - fprintf(stderr, "unkown colorspace in HandleDirectConnection()!\n"); + fprintf(stderr, "unknown colorspace in HandleDirectConnection()!\n"); fDirectWindowData->buffer_info->bits_per_pixel = 0; break; } From axeld at pinc-software.de Fri Apr 4 21:51:44 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 04 Apr 2008 21:51:44 +0200 CEST Subject: [Haiku-commits] r24788 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <200804040040.m340ehHr009977@sheep.berlios.de> Message-ID: <42049299526-BeMail@zon> anevilyak at BerliOS wrote: > Log: > * AboutSystem now shows cache usage together with total/available > mem. > * Small cleanups. [...] > } > > +static const char * > +CacheUsageToString(char string[], size_t size, system_info *info) > +{ [...] > +} > + > static const char * [...] Besides the fact that there should be two blank lines between the functions, do you really think that this information is important enough to show it to the average user? Bye, Axel. From anevilyak at gmail.com Fri Apr 4 21:56:29 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 4 Apr 2008 14:56:29 -0500 Subject: [Haiku-commits] r24788 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <42049299526-BeMail@zon> References: <200804040040.m340ehHr009977@sheep.berlios.de> <42049299526-BeMail@zon> Message-ID: > Besides the fact that there should be two blank lines between the > functions, do you really think that this information is important > enough to show it to the average user? Well, a number of people asked for it :) I can remove it again if people would prefer that. Regards, Rene From mmlr at mlotz.ch Fri Apr 4 22:02:35 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 04 Apr 2008 22:02:35 +0200 Subject: [Haiku-commits] =?windows-1252?q?r24796_-_in_haiku/trunk=3A_data/?= =?windows-1252?q?artwork/boot=5Fsplash_headers/private/kernel/boot_src/sy?= =?windows-1252?q?stem/boot/platform/bios=5Fia32_src/system/kernel?= In-Reply-To: <200804041914.m34JE5FC016492@sheep.berlios.de> Message-ID: <1634746897-BeMail@primary> > Author: stippi > Date: 2008-04-04 21:13:00 +0200 (Fri, 04 Apr 2008) > New Revision: 24796 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24796&view=rev > Log: > Comments as always on the commit mailing list... :-) Very nice! Clean, modern and centered ;-). I like it very much, thanks for looking into it so quickly. Regards Michael From korli at users.berlios.de Fri Apr 4 22:26:57 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 4 Apr 2008 22:26:57 +0200 Subject: [Haiku-commits] r24648 - haiku/trunk/src/system/boot/platform/bios_ia32 In-Reply-To: <5361168252-BeMail@zon> References: <5361168252-BeMail@zon> Message-ID: 2008/3/31, Axel D?rfler : > That's strange, at least; I can understand why the older revision > failed (I accidently removed the fallback), but the newer should have > worked fine. It seems to happen because the default width is now 1024 (instead of 800). > What happens if you select different modes directly in the boot menu? I > guess some of them don't work, either? Do you have an LCD or CRT? Is it > able to show you the frequency your graphics board delivers (if so, you > could press F12 to go into KDL and have some time to see it)? Can you > retrieve serial debug output? At least it might be helpful to see the > different resolutions your card provides with TRACE_VIDEO defined, as > well as EDID information (shouldn't be any, though). > Selecting some of them work but not well : selecting 1280*1024 gives me a 800*600. I can switch to 1280*1020 in the Screen preflet and the display is ok. On reboot the display is still out of frequency range (though a different one from the fresh install). It's a LCD. It seems there is no EDID. I can provide a serial log. VESA version = 3.0 oem string: NVIDIA 100: 640 x 400 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 101: 640 x 480 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 102: 800 x 600 x 4 (a = 799, mem = 3, phy = 0, p = 4, b = 1) 103: 800 x 600 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 104: 1024 x 768 x 4 (a = 799, mem = 3, phy = 0, p = 4, b = 1) 105: 1024 x 768 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 106: 1280 x 1024 x 4 (a = 799, mem = 3, phy = 0, p = 4, b = 1) 107: 1280 x 1024 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 10e: 320 x 200 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 10f: 320 x 200 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 111: 640 x 480 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 112: 640 x 480 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 114: 800 x 600 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 115: 800 x 600 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 117: 1024 x 768 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 118: 1024 x 768 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 11a: 1280 x 1024 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 11b: 1280 x 1024 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 130: 320 x 200 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 131: 320 x 400 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 132: 320 x 400 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 133: 320 x 400 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 134: 320 x 240 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 135: 320 x 240 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 136: 320 x 240 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 13d: 640 x 400 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 13e: 640 x 400 x 32 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 145: 1600 x 1200 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 146: 1600 x 1200 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 147: 1400 x 1050 x 8 (a = 927, mem = 4, phy = d0000000, p = 1, b = 1) 148: 1400 x 1050 x 16 (a = 927, mem = 6, phy = d0000000, p = 1, b = 1) 152: 2048 x 1536 x 32 (a = 987, mem = 6, phy = d0000000, p = 1, b = 1) VESA compatible graphics! mmu_allocate: requested vaddr: 0x00000000, next free vaddr: 0x80109000, size: 16384 EDID1: 4f EDID2: ebx 0 Bye, J?r?me From superstippi at gmx.de Fri Apr 4 22:36:44 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Fri, 04 Apr 2008 22:36:44 +0200 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <1634746897-BeMail@primary> References: <1634746897-BeMail@primary> Message-ID: <20080404223644.19220.3@stippis2.1207326576.fake> Michael Lotz wrote: > > Author: stippi > > Date: 2008-04-04 21:13:00 +0200 (Fri, 04 Apr 2008) New Revision: 24796 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24796&view=rev Log: > > Comments as always on the commit mailing list... :-) > > Very nice! Clean, modern and centered ;-). I like it very much, thanks > for looking into it so quickly. I tested in QEMU and there it worked on the system that I used for coding. When I upgraded on my other box, Haiku wouldn't boot anymore and I tracked it down to my patch. I am clueless, I have read my patch multiple times. And now you tell me you could look at it... I will find it eventually, but just a warning to others, you could be stuck like me. So maybe wait a bit before upgrading until I fixed my problem. Best regards, -Stephan From mmlr at mlotz.ch Fri Apr 4 22:47:31 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Fri, 04 Apr 2008 22:47:31 +0200 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080404223644.19220.3@stippis2.1207326576.fake> Message-ID: <223118010-BeMail@primary> Hi Stephan > I tested in QEMU and there it worked on the system that I used for > coding. > When I upgraded on my other box, Haiku wouldn't boot anymore and I > tracked > it down to my patch. I am clueless, I have read my patch multiple > times. > And now you tell me you could look at it... I will find it > eventually, but > just a warning to others, you could be stuck like me. So maybe wait a > bit > before upgrading until I fixed my problem. In fact I only tested it in QEMU when I sent that mail. I now rebooted to check if it would hang, but it booted straight through. So everything works as expected over here. Regards Michael From superstippi at gmx.de Fri Apr 4 22:53:37 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Fri, 04 Apr 2008 22:53:37 +0200 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <223118010-BeMail@primary> References: <223118010-BeMail@primary> Message-ID: <20080404225337.20829.4@stippis2.1207326576.fake> Michael Lotz wrote: > Hi Stephan > > > I tested in QEMU and there it worked on the system that I used for > > coding. > > When I upgraded on my other box, Haiku wouldn't boot anymore and I > > tracked > > it down to my patch. I am clueless, I have read my patch multiple > > times. > > And now you tell me you could look at it... I will find it eventually, > > but > > just a warning to others, you could be stuck like me. So maybe wait a > > bit > > before upgrading until I fixed my problem. > > In fact I only tested it in QEMU when I sent that mail. I now rebooted to > check if it would hang, but it booted straight through. So everything > works as expected over here. The more I am debugging the problem, the more clueless I am. The problem is in this function: http://svn.berlios.de/viewcvs/haiku/haiku/trunk/src/system/kernel/boot_splash.cpp?rev=24796&view=diff&r1=24796&r2=24795&p1=haiku/trunk/src/system/kernel/boot_splash.cpp&p2=/haiku/trunk/src/system/kernel/boot_splash.cpp ... at least when I add a "return" at the beginning, I can boot again. But really, I am totally puzzled. Especially since the same code works in video.cpp in the boot loader. Best regards, -Stephan From michael.pfeiffer at utanet.at Fri Apr 4 23:28:25 2008 From: michael.pfeiffer at utanet.at (Michael Pfeiffer) Date: Fri, 4 Apr 2008 23:28:25 +0200 Subject: [Haiku-commits] r24788 - haiku/trunk/src/apps/aboutsystem In-Reply-To: References: <200804040040.m340ehHr009977@sheep.berlios.de> <42049299526-BeMail@zon> Message-ID: Am 04.04.2008 um 21:56 schrieb Rene Gollent: >> Besides the fact that there should be two blank lines between the >> functions, do you really think that this information is important >> enough to show it to the average user? > > Well, a number of people asked for it :) I can remove it again if > people would prefer that. Well if you ask, I am for removing it. IMO this kind of information belongs to an Activity Monitor like application. - Michael From ingo_weinhold at gmx.de Fri Apr 4 23:33:31 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 04 Apr 2008 23:33:31 +0200 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080404225337.20829.4@stippis2.1207326576.fake> References: <223118010-BeMail@primary> <20080404225337.20829.4@stippis2.1207326576.fake> Message-ID: <20080404233331.1894.2@knochen-vm.1207319339.fake> On 2008-04-04 at 22:53:37 [+0200], Stephan Assmus wrote: > > Michael Lotz wrote: > > Hi Stephan > > > > > I tested in QEMU and there it worked on the system that I used for > > > coding. > > > When I upgraded on my other box, Haiku wouldn't boot anymore and I > > > tracked > > > it down to my patch. I am clueless, I have read my patch multiple > > > times. > > > And now you tell me you could look at it... I will find it eventually, > > > but > > > just a warning to others, you could be stuck like me. So maybe wait a > > > bit > > > before upgrading until I fixed my problem. I can reproduce the problem can be reproduced under VMware, too. > The more I am debugging the problem, the more clueless I am. The problem is > in this function: > > http://svn.berlios.de/viewcvs/haiku/haiku/trunk/src/system/kernel/boot_splash.cpp?rev=24796&view=diff&r1=24796&r2=24795&p1=haiku/trunk/src/system/kernel/boot_splash.cpp&p2=/haiku/trunk/src/system/kernel/boot_splash.cpp > > ... at least when I add a "return" at the beginning, I can boot again. But > really, I am totally puzzled. Especially since the same code works in > video.cpp in the boot loader. I haven't looked into this, but assuming that blit_cropped() writes to memory and now gets different parameters, I'd suppose that it now writes to a location where it shouldn't write. BTW, the serial debug output is: PANIC: insert page 0x919d3000 into cache 0x90a2c1e0: page cache is set to 0x90a2c0c0 PANIC: page fault in debugger without fault handler! Touching address 0x00000014 from eip 0x8008882b. [repeats a few times] The second PANIC is the kernel_debugger_loop(). It's too early and the debugger is not initialized yet. It repeats several times -- probably till the stack is full and causes a double fault. CU, Ingo From bga at bug-br.org.br Fri Apr 4 23:33:36 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Fri, 04 Apr 2008 18:33:36 -0300 Subject: [Haiku-commits] r24788 - haiku/trunk/src/apps/aboutsystem In-Reply-To: References: <200804040040.m340ehHr009977@sheep.berlios.de> <42049299526-BeMail@zon> Message-ID: <47F69EB0.6080102@bug-br.org.br> Michael Pfeiffer wrote: > Well if you ask, I am for removing it. > > IMO this kind of information belongs to an Activity Monitor like > application. I am for keeping it for 2 reasons: 1 - We do not have an "Activity Monitor like application" unless you count Process Controller (but even if this is implemented there, it uses mostly bars to show this kind of information which is not really as helpful. 2 - Right now, Haiku *IS* developer only. That information helps a lot specially considering the types of bugs I am tracking now. Really, I am all for removing it at some point in time but, right now, it does not hurt at all and it is useful. -Bruno From bga at bug-br.org.br Fri Apr 4 23:35:48 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Fri, 04 Apr 2008 18:35:48 -0300 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080404233331.1894.2@knochen-vm.1207319339.fake> References: <223118010-BeMail@primary> <20080404225337.20829.4@stippis2.1207326576.fake> <20080404233331.1894.2@knochen-vm.1207319339.fake> Message-ID: <47F69F34.90002@bug-br.org.br> Ingo Weinhold wrote: > I can reproduce the problem can be reproduced under VMware, too. FYI, I ran it under VMWare and had no problems. But then, again, I only tried once. Not sure if it matters or not but my VM has 2 Gb of memory allocated to it. -Bruno From anevilyak at gmail.com Fri Apr 4 23:53:58 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 4 Apr 2008 16:53:58 -0500 Subject: [Haiku-commits] r24788 - haiku/trunk/src/apps/aboutsystem In-Reply-To: <47F69EB0.6080102@bug-br.org.br> References: <200804040040.m340ehHr009977@sheep.berlios.de> <42049299526-BeMail@zon> <47F69EB0.6080102@bug-br.org.br> Message-ID: > Really, I am all for removing it at some point in time but, right now, > it does not hurt at all and it is useful. In all fairness though, this info is accessible from sysinfo on Terminal also though...I can look at modifying what value ProcessController is using for "System Resources & Caches" at the moment, since I truthfully have absolutely no idea what that value represents right now. The one upshot of AboutSystem and/or ProcessController representing this info vs the terminal app is that they automatically refresh it, which makes it useful for watching behavior on the fly. I suppose we could also modify our version of top to display it. Thoughts everyone? Rene From anevilyak at gmail.com Sat Apr 5 00:10:14 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 4 Apr 2008 17:10:14 -0500 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <47F69F34.90002@bug-br.org.br> References: <223118010-BeMail@primary> <20080404225337.20829.4@stippis2.1207326576.fake> <20080404233331.1894.2@knochen-vm.1207319339.fake> <47F69F34.90002@bug-br.org.br> Message-ID: For what it's worth, it works fine on my real hardware also. Regards, Rene From mmlr at mail.berlios.de Sat Apr 5 00:51:34 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 5 Apr 2008 00:51:34 +0200 Subject: [Haiku-commits] r24799 - haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk Message-ID: <200804042251.m34MpYC4009960@sheep.berlios.de> Author: mmlr Date: 2008-04-05 00:51:29 +0200 (Sat, 05 Apr 2008) New Revision: 24799 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24799&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h Log: * Add support for devices with multiple LUNs * A device now has one or more LUNs which are used for LUN specific functions * Adapted these LUN specific functions to the new design and also change the (un-)publishing accordingly * Handle "no media" cases more correctly * Output some interesting device infos also with tracing disabled * Add some more helpful debug output here and there Devices that provide multiple logical units (like those n in 1 card readers) should now be usable with usb_disk too. Also we don't fail when a device is attached which currently does not contain a media. Instead handle media changes correctly so inserting a media works as expected. Note that hot-unplugging and media removal still does not quite work right at the devfs or disk device manager level and easily crashes the system. Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-04 19:45:11 UTC (rev 24798) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-04 22:51:29 UTC (rev 24799) @@ -18,7 +18,7 @@ #define DRIVER_NAME "usb_disk" #define DEVICE_NAME_BASE "disk/usb/" -#define DEVICE_NAME DEVICE_NAME_BASE"%ld/%ld/raw" +#define DEVICE_NAME DEVICE_NAME_BASE"%ld/%d/raw" //#define TRACE_USB_DISK @@ -35,6 +35,7 @@ static usb_module_info *gUSBModule = NULL; static disk_device *gDeviceList = NULL; static uint32 gDeviceCount = 0; +static uint32 gLunCount = 0; static benaphore gDeviceListLock; static char **gDeviceNames = NULL; @@ -54,19 +55,38 @@ void *data, size_t dataLength); status_t usb_disk_receive_csw(disk_device *device, command_status_wrapper *status); -status_t usb_disk_operation(disk_device *device, uint8 operation, +status_t usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, uint32 logicalBlockAddress, uint16 transferLength, void *data, uint32 *dataLength, bool directionIn); -status_t usb_disk_request_sense(disk_device *device); -status_t usb_disk_test_unit_ready(disk_device *device); -status_t usb_disk_inquiry(disk_device *device); -status_t usb_disk_update_capacity(disk_device *device); -status_t usb_disk_synchronize(disk_device *device, bool force); +status_t usb_disk_request_sense(device_lun *lun); +status_t usb_disk_test_unit_ready(device_lun *lun); +status_t usb_disk_inquiry(device_lun *lun); +status_t usb_disk_reset_capacity(device_lun *lun); +status_t usb_disk_update_capacity(device_lun *lun); +status_t usb_disk_synchronize(device_lun *lun, bool force); // +//#pragma mark - Device Allocation Helper Functions +// + + +void +usb_disk_free_device_and_luns(disk_device *device) +{ + benaphore_lock(&device->lock); + benaphore_destroy(&device->lock); + delete_sem(device->notify); + for (uint8 i = 0; i < device->lun_count; i++) + free(device->luns[i]); + free(device->luns); + free(device); +} + + +// //#pragma mark - Bulk-only Mass Storage Functions // @@ -92,8 +112,8 @@ 1, &result, &actualLength) != B_OK || actualLength != 1) return 0; - if (result > 15) { - // invalid count, only up to 15 LUNs are possible + if (result > MAX_LOGICAL_UNIT_NUMBER) { + // invalid max lun return 0; } @@ -152,16 +172,17 @@ status_t -usb_disk_operation(disk_device *device, uint8 operation, uint8 opLength, +usb_disk_operation(device_lun *lun, uint8 operation, uint8 opLength, uint32 logicalBlockAddress, uint16 transferLength, void *data, uint32 *dataLength, bool directionIn) { + disk_device *device = lun->device; command_block_wrapper command; command.signature = CBW_SIGNATURE; command.tag = device->current_tag++; command.data_transfer_length = (dataLength != NULL ? *dataLength : 0); command.flags = (directionIn ? CBW_DATA_INPUT : CBW_DATA_OUTPUT); - command.lun = device->lun; + command.lun = lun->logical_unit_number; command.command_block_length = opLength; memset(command.command_block, 0, sizeof(command.command_block)); @@ -169,7 +190,7 @@ case 6: { scsi_command_6 *commandBlock = (scsi_command_6 *)command.command_block; commandBlock->operation = operation; - commandBlock->lun = device->lun << 5; + commandBlock->lun = lun->logical_unit_number << 5; commandBlock->allocation_length = (uint8)transferLength; break; } @@ -177,7 +198,7 @@ case 10: { scsi_command_10 *commandBlock = (scsi_command_10 *)command.command_block; commandBlock->operation = operation; - commandBlock->lun_flags = device->lun << 5; + commandBlock->lun_flags = lun->logical_unit_number << 5; commandBlock->logical_block_address = htonl(logicalBlockAddress); commandBlock->transfer_length = htons(transferLength); break; @@ -252,16 +273,18 @@ result = B_OK; } else { // the operation is complete but has failed at the SCSI level - TRACE_ALWAYS("operation failed at the SCSI level\n"); - usb_disk_request_sense(device); - result = B_ERROR; + TRACE_ALWAYS("operation 0x%02x failed at the SCSI level\n", + operation); + result = usb_disk_request_sense(lun); + if (result == B_OK) + result = B_ERROR; } break; } case CSW_STATUS_PHASE_ERROR: { // a protocol or device error occured - TRACE_ALWAYS("phase error in operation\n"); + TRACE_ALWAYS("phase error in operation 0x%02x\n", operation); usb_disk_reset_recovery(device); if (dataLength != NULL) *dataLength = 0; @@ -279,18 +302,18 @@ status_t -usb_disk_request_sense(disk_device *device) +usb_disk_request_sense(device_lun *lun) { uint32 dataLength = sizeof(scsi_request_sense_6_parameter); scsi_request_sense_6_parameter parameter; - status_t result = usb_disk_operation(device, SCSI_REQUEST_SENSE_6, 6, 0, + status_t result = usb_disk_operation(lun, SCSI_REQUEST_SENSE_6, 6, 0, dataLength, ¶meter, &dataLength, true); if (result != B_OK) { TRACE_ALWAYS("getting request sense data failed\n"); return result; } - if (parameter.sense_key >= 2) { + if (parameter.sense_key > SCSI_SENSE_KEY_NOT_READY) { TRACE_ALWAYS("request_sense: key: 0x%02x; asc: 0x%02x; ascq: 0x%02x;\n", parameter.sense_key, parameter.additional_sense_code, parameter.additional_sense_code_qualifier); @@ -302,13 +325,17 @@ return B_OK; case SCSI_SENSE_KEY_NOT_READY: - TRACE_ALWAYS("request_sense: device not ready\n"); - return B_DEV_NOT_READY; + TRACE("request_sense: device not ready (asc 0x%02x ascq 0x%02x)\n", + parameter.additional_sense_code, + parameter.additional_sense_code_qualifier); + lun->media_present = false; + usb_disk_reset_capacity(lun); + return B_DEV_NO_MEDIA; + case SCSI_SENSE_KEY_HARDWARE_ERROR: case SCSI_SENSE_KEY_MEDIUM_ERROR: - case SCSI_SENSE_KEY_HARDWARE_ERROR: - TRACE_ALWAYS("request_sense: no media or hardware error\n"); - return B_DEV_NO_MEDIA; + TRACE_ALWAYS("request_sense: media or hardware error\n"); + return B_DEV_UNREADABLE; case SCSI_SENSE_KEY_ILLEGAL_REQUEST: TRACE_ALWAYS("request_sense: illegal request\n"); @@ -316,6 +343,8 @@ case SCSI_SENSE_KEY_UNIT_ATTENTION: TRACE_ALWAYS("request_sense: media changed\n"); + lun->media_changed = true; + lun->media_present = true; return B_DEV_MEDIA_CHANGED; case SCSI_SENSE_KEY_DATA_PROTECT: @@ -332,71 +361,85 @@ status_t -usb_disk_test_unit_ready(disk_device *device) +usb_disk_test_unit_ready(device_lun *lun) { - status_t result = usb_disk_operation(device, SCSI_TEST_UNIT_READY_6, 6, 0, - 0, NULL, NULL, true); - if (result == B_OK) - return B_OK; - - return usb_disk_request_sense(device); + return usb_disk_operation(lun, SCSI_TEST_UNIT_READY_6, 6, 0, 0, NULL, NULL, + true); } status_t -usb_disk_inquiry(disk_device *device) +usb_disk_inquiry(device_lun *lun) { uint32 dataLength = sizeof(scsi_inquiry_6_parameter); scsi_inquiry_6_parameter parameter; - status_t result = usb_disk_operation(device, SCSI_INQUIRY_6, 6, 0, - dataLength, ¶meter, &dataLength, true); + status_t result = B_ERROR; + for (uint32 tries = 0; tries < 3; tries++) { + result = usb_disk_operation(lun, SCSI_INQUIRY_6, 6, 0, dataLength, + ¶meter, &dataLength, true); + if (result == B_OK) + break; + } if (result != B_OK) { TRACE_ALWAYS("getting inquiry data failed\n"); - device->removable = true; + lun->device_type = B_DISK; + lun->removable = true; return result; } - TRACE("peripherial_device_type. 0x%02x\n", parameter.peripherial_device_type); - TRACE("peripherial_qualifier... 0x%02x\n", parameter.peripherial_qualifier); - TRACE("removable_medium........ %s\n", parameter.removable_medium ? "yes" : "no"); - TRACE("version................. 0x%02x\n", parameter.version); - TRACE("response_data_format.... 0x%02x\n", parameter.response_data_format); - TRACE("vendor_identification... \"%.8s\"\n", parameter.vendor_identification); - TRACE("product_identification.. \"%.16s\"\n", parameter.product_identification); - TRACE("product_revision_level.. \"%.4s\"\n", parameter.product_revision_level); - device->device_type = parameter.peripherial_device_type; /* 1:1 mapping */ - device->removable = (parameter.removable_medium == 1); + TRACE("peripherial_device_type 0x%02x\n", parameter.peripherial_device_type); + TRACE("peripherial_qualifier 0x%02x\n", parameter.peripherial_qualifier); + TRACE("removable_medium %s\n", parameter.removable_medium ? "yes" : "no"); + TRACE("version 0x%02x\n", parameter.version); + TRACE("response_data_format 0x%02x\n", parameter.response_data_format); + TRACE_ALWAYS("vendor_identification \"%.8s\"\n", parameter.vendor_identification); + TRACE_ALWAYS("product_identification \"%.16s\"\n", parameter.product_identification); + TRACE_ALWAYS("product_revision_level \"%.4s\"\n", parameter.product_revision_level); + lun->device_type = parameter.peripherial_device_type; /* 1:1 mapping */ + lun->removable = (parameter.removable_medium == 1); return B_OK; } status_t -usb_disk_update_capacity(disk_device *device) +usb_disk_reset_capacity(device_lun *lun) { + lun->block_size = 512; + lun->block_count = 0; + return B_OK; +} + + +status_t +usb_disk_update_capacity(device_lun *lun) +{ uint32 dataLength = sizeof(scsi_read_capacity_10_parameter); scsi_read_capacity_10_parameter parameter; - status_t result = usb_disk_operation(device, SCSI_READ_CAPACITY_10, 10, 0, - 0, ¶meter, &dataLength, true); + status_t result = usb_disk_operation(lun, SCSI_READ_CAPACITY_10, 10, 0, 0, + ¶meter, &dataLength, true); if (result != B_OK) { TRACE_ALWAYS("failed to update capacity\n"); - device->block_size = 1; - device->block_count = 0; + lun->media_present = false; + lun->media_changed = false; + usb_disk_reset_capacity(lun); return result; } - device->block_size = ntohl(parameter.logical_block_length); - device->block_count = ntohl(parameter.last_logical_block_address) + 1; + lun->media_present = true; + lun->media_changed = false; + lun->block_size = ntohl(parameter.logical_block_length); + lun->block_count = ntohl(parameter.last_logical_block_address) + 1; return B_OK; } status_t -usb_disk_synchronize(disk_device *device, bool force) +usb_disk_synchronize(device_lun *lun, bool force) { - if (device->should_sync || force) { - status_t result = usb_disk_operation(device, SCSI_SYNCHRONIZE_CACHE_10, + if (lun->should_sync || force) { + status_t result = usb_disk_operation(lun, SCSI_SYNCHRONIZE_CACHE_10, 10, 0, 0, NULL, NULL, false); - device->should_sync = false; + lun->should_sync = false; return result; } @@ -415,7 +458,6 @@ { //TRACE("callback()\n"); disk_device *device = (disk_device *)cookie; - device->status = status; device->actual_length = actualLength; release_sem(device->notify); @@ -432,8 +474,7 @@ device->open_count = 0; device->interface = 0xff; device->current_tag = 0; - device->should_sync = false; - device->lun = 0; + device->luns = NULL; // scan through the interfaces to find our bulk-only data interface const usb_configuration_info *configuration = gUSBModule->get_configuration(newDevice); @@ -483,6 +524,7 @@ if (device->interface == 0xff) { TRACE_ALWAYS("no valid bulk-only interface found\n"); + free(device); return B_ERROR; } @@ -496,33 +538,58 @@ if (device->notify < B_OK) { benaphore_destroy(&device->lock); free(device); - return B_NO_MORE_SEMS; + return device->notify; } - result = usb_disk_inquiry(device); - for (uint32 tries = 0; tries < 3; tries++) { - if (usb_disk_test_unit_ready(device) == B_OK) + device->lun_count = usb_disk_get_max_lun(device) + 1; + device->luns = (device_lun **)malloc(device->lun_count + * sizeof(device_lun *)); + for (uint8 i = 0; i < device->lun_count; i++) + device->luns[i] = NULL; + + TRACE_ALWAYS("device reports a lun count of %d\n", device->lun_count); + for (uint8 i = 0; i < device->lun_count; i++) { + // create the individual luns present on this device + device_lun *lun = (device_lun *)malloc(sizeof(device_lun)); + if (lun == NULL) { + result = B_NO_MEMORY; break; - snooze(10000); + } + + device->luns[i] = lun; + lun->device = device; + lun->logical_unit_number = i; + lun->should_sync = false; + lun->media_present = true; + lun->media_changed = true; + usb_disk_reset_capacity(lun); + + // initialize this lun + result = usb_disk_inquiry(lun); + for (uint32 tries = 0; tries < 3; tries++) { + status_t ready = usb_disk_test_unit_ready(lun); + if (ready == B_OK || ready == B_DEV_NO_MEDIA) + break; + snooze(10000); + } + + if (result != B_OK) + break; } - if (result != B_OK || usb_disk_update_capacity(device) != B_OK) { - TRACE_ALWAYS("failed to read device data\n"); - delete_sem(device->notify); - benaphore_destroy(&device->lock); - free(device); - return B_ERROR; + if (result != B_OK) { + TRACE_ALWAYS("failed to initialize logical units\n"); + usb_disk_free_device_and_luns(device); + return result; } benaphore_lock(&gDeviceListLock); device->link = (void *)gDeviceList; gDeviceList = device; uint32 deviceNumber = gDeviceCount++; - - // ToDo: find out about LUNs and publish those too - //uint8 maxLun = usb_disk_get_max_lun(device); - //TRACE("device has max lun %d\n", maxLun); - sprintf(device->name, DEVICE_NAME, deviceNumber, 0L); + gLunCount += device->lun_count; + for (uint8 i = 0; i < device->lun_count; i++) + sprintf(device->luns[i]->name, DEVICE_NAME, deviceNumber, i); benaphore_unlock(&gDeviceListLock); TRACE("new device: 0x%08lx\n", (uint32)device); @@ -551,18 +618,14 @@ element = (disk_device *)element->link; } } + gLunCount -= device->lun_count; gDeviceCount--; benaphore_unlock(&gDeviceListLock); device->device = 0; device->removed = true; - if (device->open_count == 0) { - benaphore_lock(&device->lock); - benaphore_destroy(&device->lock); - delete_sem(device->notify); - free(device); - } - + if (device->open_count == 0) + usb_disk_free_device_and_luns(device); return B_OK; } @@ -573,15 +636,15 @@ static bool -usb_disk_needs_partial_buffer(disk_device *device, off_t position, - size_t length, uint32 &blockPosition, uint16 &blockCount) +usb_disk_needs_partial_buffer(device_lun *lun, off_t position, size_t length, + uint32 &blockPosition, uint16 &blockCount) { - blockPosition = (uint32)(position / device->block_size); - if ((off_t)blockPosition * device->block_size != position) + blockPosition = (uint32)(position / lun->block_size); + if ((off_t)blockPosition * lun->block_size != position) return true; - blockCount = (uint16)(length / device->block_size); - if ((size_t)blockCount * device->block_size != length) + blockCount = (uint16)(length / lun->block_size); + if ((size_t)blockCount * lun->block_size != length) return true; return false; @@ -589,43 +652,43 @@ static status_t -usb_disk_block_read(disk_device *device, uint32 blockPosition, - uint16 blockCount, void *buffer, size_t *length) +usb_disk_block_read(device_lun *lun, uint32 blockPosition, uint16 blockCount, + void *buffer, size_t *length) { - status_t result = usb_disk_operation(device, SCSI_READ_10, 10, - blockPosition, blockCount, buffer, length, true); + status_t result = usb_disk_operation(lun, SCSI_READ_10, 10, blockPosition, + blockCount, buffer, length, true); return result; } static status_t -usb_disk_block_write(disk_device *device, uint32 blockPosition, - uint16 blockCount, void *buffer, size_t *length) +usb_disk_block_write(device_lun *lun, uint32 blockPosition, uint16 blockCount, + void *buffer, size_t *length) { - status_t result = usb_disk_operation(device, SCSI_WRITE_10, 10, - blockPosition, blockCount, buffer, length, false); + status_t result = usb_disk_operation(lun, SCSI_WRITE_10, 10, blockPosition, + blockCount, buffer, length, false); if (result == B_OK) - device->should_sync = true; + lun->should_sync = true; return result; } static status_t -usb_disk_prepare_partial_buffer(disk_device *device, off_t position, - size_t length, void *&partialBuffer, void *&blockBuffer, - uint32 &blockPosition, uint16 &blockCount) +usb_disk_prepare_partial_buffer(device_lun *lun, off_t position, size_t length, + void *&partialBuffer, void *&blockBuffer, uint32 &blockPosition, + uint16 &blockCount) { - blockPosition = (uint32)(position / device->block_size); - blockCount = (uint16)((uint32)((position + length + device->block_size - 1) - / device->block_size) - blockPosition); - size_t blockLength = blockCount * device->block_size; + blockPosition = (uint32)(position / lun->block_size); + blockCount = (uint16)((uint32)((position + length + lun->block_size - 1) + / lun->block_size) - blockPosition); + size_t blockLength = blockCount * lun->block_size; blockBuffer = malloc(blockLength); if (blockBuffer == NULL) { TRACE_ALWAYS("no memory to allocate partial buffer\n"); return B_NO_MEMORY; } - status_t result = usb_disk_block_read(device, blockPosition, blockCount, + status_t result = usb_disk_block_read(lun, blockPosition, blockCount, blockBuffer, &blockLength); if (result != B_OK) { TRACE_ALWAYS("block read failed when filling partial buffer\n"); @@ -633,7 +696,7 @@ return result; } - off_t offset = position - (blockPosition * device->block_size); + off_t offset = position - (blockPosition * lun->block_size); partialBuffer = (uint8 *)blockBuffer + offset; return B_OK; } @@ -667,11 +730,18 @@ benaphore_lock(&gDeviceListLock); disk_device *device = gDeviceList; while (device) { - if (!device->removed && strncmp(rawName, device->name, 32) == 0) { - device->open_count++; - *cookie = device; - benaphore_unlock(&gDeviceListLock); - return B_OK; + for (uint8 i = 0; i < device->lun_count; i++) { + device_lun *lun = device->luns[i]; + if (strncmp(rawName, lun->name, 32) == 0) { + // found the matching device/lun + if (device->removed) + return B_ERROR; + + device->open_count++; + *cookie = lun; + benaphore_unlock(&gDeviceListLock); + return B_OK; + } } device = (disk_device *)device->link; @@ -686,8 +756,8 @@ usb_disk_close(void *cookie) { TRACE("close()\n"); - disk_device *device = (disk_device *)cookie; - usb_disk_synchronize(device, false); + device_lun *lun = (device_lun *)cookie; + usb_disk_synchronize(lun, false); return B_OK; } @@ -698,13 +768,13 @@ TRACE("free()\n"); benaphore_lock(&gDeviceListLock); - disk_device *device = (disk_device *)cookie; + device_lun *lun = (device_lun *)cookie; + disk_device *device = lun->device; device->open_count--; if (device->removed && device->open_count == 0) { - benaphore_lock(&device->lock); - benaphore_destroy(&device->lock); - delete_sem(device->notify); - free(device); + // we can simply free the device here as it has been removed from the + // device list in the device removed notification hook + usb_disk_free_device_and_luns(device); } benaphore_unlock(&gDeviceListLock); @@ -715,7 +785,8 @@ static status_t usb_disk_ioctl(void *cookie, uint32 op, void *buffer, size_t length) { - disk_device *device = (disk_device *)cookie; + device_lun *lun = (device_lun *)cookie; + disk_device *device = lun->device; if (device->removed) return B_DEV_NOT_READY; @@ -724,21 +795,27 @@ switch (op) { case B_GET_MEDIA_STATUS: { - *(status_t *)buffer = usb_disk_test_unit_ready(device); + *(status_t *)buffer = usb_disk_test_unit_ready(lun); TRACE("B_GET_MEDIA_STATUS: 0x%08lx\n", *(status_t *)buffer); result = B_OK; break; } case B_GET_GEOMETRY: { + if (lun->media_changed) { + result = usb_disk_update_capacity(lun); + if (result != B_OK) + break; + } + device_geometry *geometry = (device_geometry *)buffer; - geometry->bytes_per_sector = device->block_size; - geometry->cylinder_count = device->block_count; + geometry->bytes_per_sector = lun->block_size; + geometry->cylinder_count = lun->block_count; geometry->sectors_per_track = geometry->head_count = 1; - geometry->device_type = device->device_type; - geometry->removable = device->removable; - geometry->read_only = (device->device_type == B_CD); - geometry->write_once = (device->device_type == B_WORM); + geometry->device_type = lun->device_type; + geometry->removable = lun->removable; + geometry->read_only = (lun->device_type == B_CD); + geometry->write_once = (lun->device_type == B_WORM); TRACE("B_GET_GEOMETRY: %ld sectors at %ld bytes per sector\n", geometry->cylinder_count, geometry->bytes_per_sector); result = B_OK; @@ -746,7 +823,8 @@ } case B_FLUSH_DRIVE_CACHE: - usb_disk_synchronize(device, true); + TRACE("B_FLUSH_DRIVE_CACHE\n"); + usb_disk_synchronize(lun, true); break; default: @@ -763,7 +841,8 @@ usb_disk_read(void *cookie, off_t position, void *buffer, size_t *length) { TRACE("read(%lld, %ld)\n", position, *length); - disk_device *device = (disk_device *)cookie; + device_lun *lun = (device_lun *)cookie; + disk_device *device = lun->device; if (device->removed) { *length = 0; return B_DEV_NOT_READY; @@ -776,20 +855,20 @@ status_t result = B_ERROR; uint32 blockPosition = 0; uint16 blockCount = 0; - bool needsPartial = usb_disk_needs_partial_buffer(device, position, - *length, blockPosition, blockCount); + bool needsPartial = usb_disk_needs_partial_buffer(lun, position, *length, + blockPosition, blockCount); if (needsPartial) { void *partialBuffer = NULL; void *blockBuffer = NULL; - result = usb_disk_prepare_partial_buffer(device, position, *length, + result = usb_disk_prepare_partial_buffer(lun, position, *length, partialBuffer, blockBuffer, blockPosition, blockCount); if (result == B_OK) { memcpy(buffer, partialBuffer, *length); free(blockBuffer); } } else { - result = usb_disk_block_read(device, blockPosition, blockCount, - buffer, length); + result = usb_disk_block_read(lun, blockPosition, blockCount, buffer, + length); } benaphore_unlock(&device->lock); @@ -809,7 +888,8 @@ size_t *length) { TRACE("write(%lld, %ld)\n", position, *length); - disk_device *device = (disk_device *)cookie; + device_lun *lun = (device_lun *)cookie; + disk_device *device = lun->device; if (device->removed) { *length = 0; return B_DEV_NOT_READY; @@ -822,22 +902,22 @@ status_t result = B_ERROR; uint32 blockPosition = 0; uint16 blockCount = 0; - bool needsPartial = usb_disk_needs_partial_buffer(device, position, + bool needsPartial = usb_disk_needs_partial_buffer(lun, position, *length, blockPosition, blockCount); if (needsPartial) { void *partialBuffer = NULL; void *blockBuffer = NULL; - result = usb_disk_prepare_partial_buffer(device, position, *length, + result = usb_disk_prepare_partial_buffer(lun, position, *length, partialBuffer, blockBuffer, blockPosition, blockCount); if (result == B_OK) { memcpy(partialBuffer, buffer, *length); - size_t blockLength = blockCount * device->block_size; - result = usb_disk_block_write(device, blockPosition, blockCount, + size_t blockLength = blockCount * lun->block_size; + result = usb_disk_block_write(lun, blockPosition, blockCount, blockBuffer, &blockLength); free(blockBuffer); } } else { - result = usb_disk_block_write(device, blockPosition, blockCount, + result = usb_disk_block_write(lun, blockPosition, blockCount, (void *)buffer, length); } @@ -881,6 +961,7 @@ gDeviceList = NULL; gDeviceCount = 0; + gLunCount = 0; status_t result = benaphore_init(&gDeviceListLock, "usb_disk device list lock"); if (result < B_OK) { TRACE("failed to create device list lock\n"); @@ -931,7 +1012,7 @@ gDeviceNames = NULL; } - gDeviceNames = (char **)malloc(sizeof(char *) * (gDeviceCount + 1)); + gDeviceNames = (char **)malloc(sizeof(char *) * (gLunCount + 1)); if (gDeviceNames == NULL) return NULL; @@ -939,7 +1020,9 @@ benaphore_lock(&gDeviceListLock); disk_device *device = gDeviceList; while (device) { - gDeviceNames[index++] = strdup(device->name); + for (uint8 i = 0; i < device->lun_count; i++) + gDeviceNames[index++] = strdup(device->luns[i]->name); + device = (disk_device *)device->link; } Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h 2008-04-04 19:45:11 UTC (rev 24798) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h 2008-04-04 22:51:29 UTC (rev 24799) @@ -14,6 +14,7 @@ #define REQUEST_MASS_STORAGE_RESET 0xff #define REQUEST_GET_MAX_LUN 0xfe +#define MAX_LOGICAL_UNIT_NUMBER 15 #define CBW_SIGNATURE 0x43425355 #define CBW_DATA_OUTPUT 0x00 @@ -24,12 +25,14 @@ #define CSW_STATUS_COMMAND_FAILED 0x01 #define CSW_STATUS_PHASE_ERROR 0x02 +typedef struct device_lun_s device_lun; + +// holds common information about an attached device (pointed to by luns) typedef struct disk_device_s { usb_device device; bool removed; uint32 open_count; benaphore lock; - char name[32]; void * link; // device state @@ -37,22 +40,35 @@ usb_pipe bulk_out; uint8 interface; uint32 current_tag; + + // used to store callback information + sem_id notify; + status_t status; + size_t actual_length; + + // logical units of this device + uint8 lun_count; + device_lun **luns; +} disk_device; + + +// represents a logical unit on the pointed to device - this gets published +struct device_lun_s { + disk_device *device; + char name[32]; + uint8 logical_unit_number; bool should_sync; - uint8 lun; // device information through read capacity/inquiry + bool media_present; + bool media_changed; uint32 block_count; uint32 block_size; uint8 device_type; bool removable; +}; - // used to store callback information - sem_id notify; - status_t status; - size_t actual_length; -} disk_device; - typedef struct command_block_wrapper_s { uint32 signature; uint32 tag; From anevilyak at mail.berlios.de Sat Apr 5 01:39:31 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 5 Apr 2008 01:39:31 +0200 Subject: [Haiku-commits] r24800 - haiku/trunk/src/apps/aboutsystem Message-ID: <200804042339.m34NdVV0004958@sheep.berlios.de> Author: anevilyak Date: 2008-04-05 01:39:30 +0200 (Sat, 05 Apr 2008) New Revision: 24800 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24800&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Remove cache mem indicator from this app. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-04 22:51:29 UTC (rev 24799) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-04 23:39:30 UTC (rev 24800) @@ -83,7 +83,6 @@ private: BStringView *fMemView; - BStringView *fCacheView; BStringView *fUptimeView; BView *fInfoView; BTextView *fCreditsView; @@ -276,13 +275,6 @@ fInfoView->AddChild(fMemView); fMemView->SetText(MemUsageToString(string, sizeof(string), &systemInfo)); - r.OffsetBy(0, textHeight); - r.bottom = r.top + textHeight; - - fCacheView = new BStringView(r, "cachetext", ""); - fInfoView->AddChild(fCacheView); - fCacheView->SetText(CacheUsageToString(string, sizeof(string), &systemInfo)); - // Kernel build time/date r.OffsetBy(0, textHeight * 1.5); r.bottom = r.top + labelHeight; @@ -669,7 +661,6 @@ get_system_info(&info); fUptimeView->SetText(UptimeToString(string, sizeof(string))); fMemView->SetText(MemUsageToString(string, sizeof(string), &info)); - fCacheView->SetText(CacheUsageToString(string, sizeof(string), &info)); if (fScrollRunner == NULL && (system_time() > fLastActionTime + 10000000)) { BMessage message(SCROLL_CREDITS_VIEW); From anevilyak at mail.berlios.de Sat Apr 5 01:40:11 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 5 Apr 2008 01:40:11 +0200 Subject: [Haiku-commits] r24801 - haiku/trunk/src/apps/processcontroller Message-ID: <200804042340.m34NeBjt005318@sheep.berlios.de> Author: anevilyak Date: 2008-04-05 01:40:09 +0200 (Sat, 05 Apr 2008) New Revision: 24801 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24801&view=rev Modified: haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp Log: Modify ProcessController's System Resources and Caches item: it now shows cache and total committed mem respectively. Modified: haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp 2008-04-04 23:39:30 UTC (rev 24800) +++ haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp 2008-04-04 23:40:09 UTC (rev 24801) @@ -30,12 +30,12 @@ KernelMemoryBarMenuItem::KernelMemoryBarMenuItem(system_info& systemInfo) : BMenuItem("System Resources & Caches...", NULL) { - fTotalWriteMemory = -1; fLastSum = -1; fGrenze1 = -1; fGrenze2 = -1; - fPhsysicalMemory = float(int(systemInfo.max_pages * B_PAGE_SIZE / 1024)); - fCommitedMemory = float(int(systemInfo.used_pages * B_PAGE_SIZE / 1024)); + fPhysicalMemory = float(int(systemInfo.max_pages * B_PAGE_SIZE / 1024)); + fCommittedMemory = float(int(systemInfo.used_pages * B_PAGE_SIZE / 1024)); + fCachedMemory = float(int(systemInfo.cached_pages * B_PAGE_SIZE / 1024)); } @@ -49,14 +49,11 @@ void -KernelMemoryBarMenuItem::UpdateSituation(float commitedMemory, - float totalWriteMemory) +KernelMemoryBarMenuItem::UpdateSituation(float committedMemory, + float cachedMemory) { - if (commitedMemory < totalWriteMemory) - totalWriteMemory = commitedMemory; - - fCommitedMemory = commitedMemory; - fTotalWriteMemory = totalWriteMemory; + fCommittedMemory = committedMemory; + fCachedMemory = cachedMemory; DrawBar(false); } @@ -71,8 +68,6 @@ // draw the bar itself BRect cadre (frame.right - kMargin - kBarWidth, frame.top + 5, frame.right - kMargin, frame.top + 13); - if (fTotalWriteMemory < 0) - return; if (fLastSum < 0) force = true; @@ -86,8 +81,8 @@ cadre.InsetBy(1, 1); BRect r = cadre; - float grenze1 = cadre.left + (cadre.right - cadre.left) * fTotalWriteMemory / fPhsysicalMemory; - float grenze2 = cadre.left + (cadre.right - cadre.left) * fCommitedMemory / fPhsysicalMemory; + float grenze1 = cadre.left + (cadre.right - cadre.left) * fCachedMemory / fPhysicalMemory; + float grenze2 = cadre.left + (cadre.right - cadre.left) * fCommittedMemory / fPhysicalMemory; if (grenze1 > cadre.right) grenze1 = cadre.right; if (grenze2 > cadre.right) @@ -135,7 +130,7 @@ fGrenze2 = grenze2; // draw the value - double sum = fTotalWriteMemory * FLT_MAX + fCommitedMemory; + double sum = fCachedMemory * FLT_MAX + fCommittedMemory; if (force || sum != fLastSum) { if (selected) { menu->SetLowColor(gMenuBackColorSelected); @@ -150,11 +145,11 @@ menu->SetHighColor(kBlack); char infos[128]; - sprintf(infos, "%.1f MB", fTotalWriteMemory / 1024.f); + sprintf(infos, "%.1f MB", fCachedMemory / 1024.f); BPoint loc(cadre.left - kMargin - gMemoryTextWidth / 2 - menu->StringWidth(infos), cadre.bottom + 1); menu->DrawString(infos, loc); - sprintf(infos, "%.1f MB", fCommitedMemory / 1024.f); + sprintf(infos, "%.1f MB", fCommittedMemory / 1024.f); loc.x = cadre.left - kMargin - menu->StringWidth(infos); menu->DrawString(infos, loc); fLastSum = sum; Modified: haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h =================================================================== --- haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h 2008-04-04 23:39:30 UTC (rev 24800) +++ haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.h 2008-04-04 23:40:09 UTC (rev 24801) @@ -30,12 +30,12 @@ virtual void GetContentSize(float* _width, float* _height); void DrawBar(bool force); - void UpdateSituation(float commitedMemory, float totalWriteMemory); + void UpdateSituation(float committedMemory, float fCachedMemory); private: - float fTotalWriteMemory; - float fPhsysicalMemory; - float fCommitedMemory; + float fCachedMemory; + float fPhysicalMemory; + float fCommittedMemory; double fLastSum; float fGrenze1; float fGrenze2; Modified: haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp 2008-04-04 23:39:30 UTC (rev 24800) +++ haiku/trunk/src/apps/processcontroller/MemoryBarMenu.cpp 2008-04-04 23:40:09 UTC (rev 24801) @@ -86,7 +86,8 @@ { system_info sinfo; get_system_info(&sinfo); - int commitedMemory = int(sinfo.used_pages * B_PAGE_SIZE / 1024); + int committedMemory = int(sinfo.used_pages * B_PAGE_SIZE / 1024); + int cachedMemory = int(sinfo.cached_pages * B_PAGE_SIZE / 1024); Window()->BeginViewTransaction(); // create the list of items to remove, for their team is gone. Update the old teams. @@ -96,7 +97,7 @@ MemoryBarMenuItem* item; int total = 0; for (k = 1; (item = (MemoryBarMenuItem*)ItemAt(k)) != NULL; k++) { - int m = item->UpdateSituation(commitedMemory); + int m = item->UpdateSituation(committedMemory); if (m < 0) { if (lastRecycle == fRecycleCount) { fRecycleCount += EXTRA; @@ -157,7 +158,7 @@ infos.team_info.team, infos.team_icon, true, NULL)); } - int m = item->UpdateSituation(commitedMemory); + int m = item->UpdateSituation(committedMemory); if (m >= 0) { total += m; item = NULL; @@ -181,7 +182,7 @@ fLastTotalTime = system_time(); KernelMemoryBarMenuItem *kernelItem; if ((kernelItem = (KernelMemoryBarMenuItem*)ItemAt(0)) != NULL) - kernelItem->UpdateSituation(commitedMemory, total); + kernelItem->UpdateSituation(committedMemory, cachedMemory); Window()->EndViewTransaction(); Window()->Flush(); From anevilyak at mail.berlios.de Sat Apr 5 01:41:02 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 5 Apr 2008 01:41:02 +0200 Subject: [Haiku-commits] r24802 - haiku/trunk/src/apps/aboutsystem Message-ID: <200804042341.m34Nf2vE005753@sheep.berlios.de> Author: anevilyak Date: 2008-04-05 01:41:01 +0200 (Sat, 05 Apr 2008) New Revision: 24802 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24802&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Forgot about this static function. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-04 23:40:09 UTC (rev 24801) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-04 23:41:01 UTC (rev 24802) @@ -833,14 +833,7 @@ return string; } -static const char * -CacheUsageToString(char string[], size_t size, system_info *info) -{ - snprintf(string, size, "Cache size: %d MB", int(info->cached_pages / 256.0f + 0.5f)); - return string; -} - static const char * UptimeToString(char string[], size_t size) { From mmlr at mail.berlios.de Sat Apr 5 01:46:15 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 5 Apr 2008 01:46:15 +0200 Subject: [Haiku-commits] r24803 - haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk Message-ID: <200804042346.m34NkFux006452@sheep.berlios.de> Author: mmlr Date: 2008-04-05 01:46:14 +0200 (Sat, 05 Apr 2008) New Revision: 24803 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24803&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h Log: Implement a downcounter for the synchronize cache command. There are devices that do not support it (probably because they do not have a cache at all like in flash media) and this should at least avoid spamming the syslog when this is the case. It will try 5 times and then disable syncing for that device. Untested as of yet though. Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-04 23:41:01 UTC (rev 24802) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-04 23:46:14 UTC (rev 24803) @@ -436,10 +436,21 @@ status_t usb_disk_synchronize(device_lun *lun, bool force) { + if (lun->device->sync_support == 0) { + // this device repeatedly reported an illegal request when syncing + // it obviously does really not support this command... + return B_UNSUPPORTED; + } + if (lun->should_sync || force) { status_t result = usb_disk_operation(lun, SCSI_SYNCHRONIZE_CACHE_10, 10, 0, 0, NULL, NULL, false); lun->should_sync = false; + + if (result == B_OK) + lun->device->sync_support = SYNC_SUPPORT_RELOAD; + else if (result == B_DEV_INVALID_IOCTL) + lun->device->sync_support--; return result; } @@ -474,6 +485,7 @@ device->open_count = 0; device->interface = 0xff; device->current_tag = 0; + device->sync_support = SYNC_SUPPORT_RELOAD; device->luns = NULL; // scan through the interfaces to find our bulk-only data interface Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h 2008-04-04 23:41:01 UTC (rev 24802) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.h 2008-04-04 23:46:14 UTC (rev 24803) @@ -25,6 +25,8 @@ #define CSW_STATUS_COMMAND_FAILED 0x01 #define CSW_STATUS_PHASE_ERROR 0x02 +#define SYNC_SUPPORT_RELOAD 5 + typedef struct device_lun_s device_lun; // holds common information about an attached device (pointed to by luns) @@ -40,6 +42,7 @@ usb_pipe bulk_out; uint8 interface; uint32 current_tag; + uint8 sync_support; // used to store callback information sem_id notify; From mmlr at mail.berlios.de Sat Apr 5 02:38:41 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 5 Apr 2008 02:38:41 +0200 Subject: [Haiku-commits] r24804 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200804050038.m350cfVv010394@sheep.berlios.de> Author: mmlr Date: 2008-04-05 02:38:38 +0200 (Sat, 05 Apr 2008) New Revision: 24804 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24804&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/Device.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h Log: * Another tiny cut in stack load time: do not delay after setting the current configuration of a root hub * Cut down on number of retries to set the initial device address Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp 2008-04-04 23:46:14 UTC (rev 24803) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/BusManager.cpp 2008-04-05 00:38:38 UTC (rev 24804) @@ -135,7 +135,7 @@ } status_t result = B_ERROR; - for (int32 i = 0; i < 15; i++) { + for (int32 i = 0; i < 3; i++) { // Set the address of the device USB 1.1 spec p202 result = defaultPipe->SendRequest( USB_REQTYPE_STANDARD | USB_REQTYPE_DEVICE_OUT, // type @@ -223,7 +223,7 @@ TRACE(("USB BusManager: creating new device\n")); Device *device = new(std::nothrow) Device(parent, port, deviceDescriptor, - deviceAddress, speed); + deviceAddress, speed, false); if (!device) { TRACE_ERROR(("USB BusManager: no memory to allocate device\n")); FreeAddress(deviceAddress); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Device.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Device.cpp 2008-04-04 23:46:14 UTC (rev 24803) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Device.cpp 2008-04-05 00:38:38 UTC (rev 24804) @@ -11,11 +11,12 @@ Device::Device(Object *parent, int8 hubPort, usb_device_descriptor &desc, - int8 deviceAddress, usb_speed speed) + int8 deviceAddress, usb_speed speed, bool isRootHub) : Object(parent), fDeviceDescriptor(desc), fInitOK(false), fAvailable(true), + fIsRootHub(isRootHub), fConfigurations(NULL), fCurrentConfiguration(NULL), fSpeed(speed), @@ -372,7 +373,8 @@ InitEndpoints(); // Wait some for the configuration being finished - snooze(USB_DELAY_SET_CONFIGURATION); + if (!fIsRootHub) + snooze(USB_DELAY_SET_CONFIGURATION); return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp 2008-04-04 23:46:14 UTC (rev 24803) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Hub.cpp 2008-04-05 00:38:38 UTC (rev 24804) @@ -13,7 +13,7 @@ Hub::Hub(Object *parent, int8 hubPort, usb_device_descriptor &desc, int8 deviceAddress, usb_speed speed, bool isRootHub) - : Device(parent, hubPort, desc, deviceAddress, speed), + : Device(parent, hubPort, desc, deviceAddress, speed, isRootHub), fInterruptPipe(NULL) { TRACE(("USB Hub %d: creating hub\n", DeviceAddress())); 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 2008-04-04 23:46:14 UTC (rev 24803) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2008-04-05 00:38:38 UTC (rev 24804) @@ -414,7 +414,7 @@ Device(Object *parent, int8 hubPort, usb_device_descriptor &desc, int8 deviceAddress, - usb_speed speed); + usb_speed speed, bool isRootHub); virtual ~Device(); status_t InitCheck(); @@ -469,6 +469,7 @@ private: bool fAvailable; + bool fIsRootHub; usb_configuration_info *fConfigurations; usb_configuration_info *fCurrentConfiguration; usb_speed fSpeed; From ingo_weinhold at gmx.de Sat Apr 5 06:20:32 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 05 Apr 2008 06:20:32 +0200 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080404233331.1894.2@knochen-vm.1207319339.fake> References: <223118010-BeMail@primary> <20080404225337.20829.4@stippis2.1207326576.fake> <20080404233331.1894.2@knochen-vm.1207319339.fake> Message-ID: <20080405062032.2168.3@knochen-vm.1207319339.fake> On 2008-04-04 at 23:33:31 [+0200], Ingo Weinhold wrote: > On 2008-04-04 at 22:53:37 [+0200], Stephan Assmus > wrote: > > > > Michael Lotz wrote: > > > > > > > I tested in QEMU and there it worked on the system that I used for > > > > coding. > > > > When I upgraded on my other box, Haiku wouldn't boot anymore and I > > > > tracked > > > > it down to my patch. I am clueless, I have read my patch multiple > > > > times. > > > > And now you tell me you could look at it... I will find it eventually, > > > > but > > > > just a warning to others, you could be stuck like me. So maybe wait a > > > > bit > > > > before upgrading until I fixed my problem. > > I can reproduce the problem can be reproduced under VMware, too. I don't think this problem is related to r24796. I'm still running r24794 on my other machine and encounter the same problem now. It worked the whole day, and started to happen only after my latest changes (which only add VFS stuff and shouldn't have any effect that early in the boot process). CU, Ingo From axeld at mail.berlios.de Sat Apr 5 12:16:49 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 5 Apr 2008 12:16:49 +0200 Subject: [Haiku-commits] r24805 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200804051016.m35AGnaQ003439@sheep.berlios.de> Author: axeld Date: 2008-04-05 12:16:49 +0200 (Sat, 05 Apr 2008) New Revision: 24805 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24805&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp Log: * Enlarged maximum kernel size to 2 MB - this is the code the boot loader's MMU code reserves for the kernel, and we hit that limit recently with the addition of the boot splash code. * This fixes the boot crash as triggered by Stippi's recent changes to the splash image. * Cleanup (doxygen comments, line length). Modified: haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp 2008-04-05 00:38:38 UTC (rev 24804) +++ haiku/trunk/src/system/boot/platform/bios_ia32/mmu.cpp 2008-04-05 10:16:49 UTC (rev 24805) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2007, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. * Based on code written by Travis Geiselbrecht for NewOS. * * Distributed under the terms of the MIT License. @@ -22,26 +22,28 @@ #include -/** The (physical) memory layout of the boot loader is currently as follows: - * 0x0500 - 0x10000 protected mode stack - * 0x0500 - 0x09000 real mode stack - * 0x10000 - ? code (up to ~500 kB) - * 0x90000 1st temporary page table (identity maps 0-4 MB) - * 0x91000 2nd (4-8 MB) - * 0x92000 - 0x92000 further page tables - * 0x9e000 - 0xa0000 SMP trampoline code - * [0xa0000 - 0x100000 BIOS/ROM/reserved area] - * 0x100000 page directory - * ... boot loader heap (32 kB) - * ... free physical memory - * - * The first 8 MB are identity mapped (0x0 - 0x0800000); paging is turned - * on. The kernel is mapped at 0x80000000, all other stuff mapped by the - * loader (kernel args, modules, driver settings, ...) comes after - * 0x81000000 which means that there is currently only 1 MB reserved for - * the kernel itself (see kMaxKernelSize). - */ +/*! The (physical) memory layout of the boot loader is currently as follows: + 0x0500 - 0x10000 protected mode stack + 0x0500 - 0x09000 real mode stack + 0x10000 - ? code (up to ~500 kB) + 0x90000 1st temporary page table (identity maps 0-4 MB) + 0x91000 2nd (4-8 MB) + 0x92000 - 0x92000 further page tables + 0x9e000 - 0xa0000 SMP trampoline code + [0xa0000 - 0x100000 BIOS/ROM/reserved area] + 0x100000 page directory + ... boot loader heap (32 kB) + ... free physical memory + The first 8 MB are identity mapped (0x0 - 0x0800000); paging is turned + on. The kernel is mapped at 0x80000000, all other stuff mapped by the + loader (kernel args, modules, driver settings, ...) comes after + 0x80020000 which means that there is currently only 2 MB reserved for + the kernel itself (see kMaxKernelSize). + + The layout in PXE mode differs a bit from this, see definitions below. +*/ + //#define TRACE_MMU #ifdef TRACE_MMU # define TRACE(x) dprintf x @@ -61,14 +63,15 @@ uint32 type; }; -#ifdef _PXE_ENV static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W -static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel +static const size_t kMaxKernelSize = 0x200000; // 2 MB for the kernel // working page directory and page table static uint32 *sPageDirectory = 0; +#ifdef _PXE_ENV + static addr_t sNextPhysicalAddress = 0x112000; static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize; static addr_t sMaxVirtualAddress = KERNEL_BASE + 0x400000; @@ -79,12 +82,6 @@ #else -static const uint32 kDefaultPageTableFlags = 0x07; // present, user, R/W -static const size_t kMaxKernelSize = 0x100000; // 1 MB for the kernel - -// working page directory and page table -static uint32 *sPageDirectory = 0; - static addr_t sNextPhysicalAddress = 0x100000; static addr_t sNextVirtualAddress = KERNEL_BASE + kMaxKernelSize; static addr_t sMaxVirtualAddress = KERNEL_BASE + 0x400000; @@ -133,9 +130,9 @@ static uint32 * get_next_page_table() { - TRACE(("get_next_page_table, sNextPageTableAddress %p, kPageTableRegionEnd %p\n", - sNextPageTableAddress, kPageTableRegionEnd)); - + TRACE(("get_next_page_table, sNextPageTableAddress %p, kPageTableRegionEnd " + "%p\n", sNextPageTableAddress, kPageTableRegionEnd)); + addr_t address = sNextPageTableAddress; if (address >= kPageTableRegionEnd) return (uint32 *)get_next_physical_page(); @@ -145,8 +142,7 @@ } -/** Adds a new page table for the specified base address */ - +/*! Adds a new page table for the specified base address */ static void add_page_table(addr_t base) { @@ -154,16 +150,20 @@ // Get new page table and clear it out uint32 *pageTable = get_next_page_table(); - if (pageTable > (uint32 *)(8 * 1024 * 1024)) - panic("tried to add page table beyond the indentity mapped 8 MB region\n"); + if (pageTable > (uint32 *)(8 * 1024 * 1024)) { + panic("tried to add page table beyond the indentity mapped 8 MB " + "region\n"); + } - gKernelArgs.arch_args.pgtables[gKernelArgs.arch_args.num_pgtables++] = (uint32)pageTable; + gKernelArgs.arch_args.pgtables[gKernelArgs.arch_args.num_pgtables++] + = (uint32)pageTable; for (int32 i = 0; i < 1024; i++) pageTable[i] = 0; // put the new page table into the page directory - sPageDirectory[base/(4*1024*1024)] = (uint32)pageTable | kDefaultPageTableFlags; + sPageDirectory[base / (4 * 1024 * 1024)] + = (uint32)pageTable | kDefaultPageTableFlags; } @@ -172,8 +172,10 @@ { TRACE(("unmap_page(virtualAddress = %p)\n", (void *)virtualAddress)); - if (virtualAddress < KERNEL_BASE) - panic("unmap_page: asked to unmap invalid page %p!\n", (void *)virtualAddress); + if (virtualAddress < KERNEL_BASE) { + panic("unmap_page: asked to unmap invalid page %p!\n", + (void *)virtualAddress); + } // unmap the page from the correct page table uint32 *pageTable = (uint32 *)(sPageDirectory[virtualAddress @@ -184,19 +186,20 @@ } -/** Creates an entry to map the specified virtualAddress to the given - * physicalAddress. - * If the mapping goes beyond the current page table, it will allocate - * a new one. If it cannot map the requested page, it panics. - */ - +/*! Creates an entry to map the specified virtualAddress to the given + physicalAddress. + If the mapping goes beyond the current page table, it will allocate + a new one. If it cannot map the requested page, it panics. +*/ static void map_page(addr_t virtualAddress, addr_t physicalAddress, uint32 flags) { TRACE(("map_page: vaddr 0x%lx, paddr 0x%lx\n", virtualAddress, physicalAddress)); - if (virtualAddress < KERNEL_BASE) - panic("map_page: asked to map invalid page %p!\n", (void *)virtualAddress); + if (virtualAddress < KERNEL_BASE) { + panic("map_page: asked to map invalid page %p!\n", + (void *)virtualAddress); + } if (virtualAddress >= sMaxVirtualAddress) { // we need to add a new page table @@ -204,8 +207,10 @@ add_page_table(sMaxVirtualAddress); sMaxVirtualAddress += B_PAGE_SIZE * 1024; - if (virtualAddress >= sMaxVirtualAddress) - panic("map_page: asked to map a page to %p\n", (void *)virtualAddress); + if (virtualAddress >= sMaxVirtualAddress) { + panic("map_page: asked to map a page to %p\n", + (void *)virtualAddress); + } } physicalAddress &= ~(B_PAGE_SIZE - 1); @@ -214,10 +219,10 @@ uint32 *pageTable = (uint32 *)(sPageDirectory[virtualAddress / (B_PAGE_SIZE * 1024)] & 0xfffff000); uint32 tableEntry = (virtualAddress % (B_PAGE_SIZE * 1024)) / B_PAGE_SIZE; - - TRACE(("map_page: inserting pageTable %p, tableEntry %ld, physicalAddress %p\n", - pageTable, tableEntry, physicalAddress)); + TRACE(("map_page: inserting pageTable %p, tableEntry %ld, physicalAddress " + "%p\n", pageTable, tableEntry, physicalAddress)); + pageTable[tableEntry] = physicalAddress | flags; asm volatile("invlpg (%0)" : : "r" (virtualAddress)); @@ -251,7 +256,7 @@ get_memory_map(extended_memory **_extendedMemory) { extended_memory *block = (extended_memory *)kExtraSegmentScratch; - bios_regs regs = { 0, 0, sizeof(extended_memory), 0, 0, (uint32)block, 0, 0}; + bios_regs regs = {0, 0, sizeof(extended_memory), 0, 0, (uint32)block, 0, 0}; uint32 count = 0; TRACE(("get_memory_map()\n")); @@ -273,7 +278,7 @@ #ifdef TRACE_MMU dprintf("extended memory info (from 0xe820):\n"); for (uint32 i = 0; i < count; i++) { - dprintf(" base 0x%Lx, len 0x%Lx, type %lu\n", + dprintf(" base 0x%Lx, len 0x%Lx, type %lu\n", block[i].base_addr, block[i].length, block[i].type); } #endif @@ -351,8 +356,8 @@ extern "C" void * mmu_allocate(void *virtualAddress, size_t size) { - TRACE(("mmu_allocate: requested vaddr: %p, next free vaddr: 0x%lx, size: %ld\n", - virtualAddress, sNextVirtualAddress, size)); + TRACE(("mmu_allocate: requested vaddr: %p, next free vaddr: 0x%lx, size: " + "%ld\n", virtualAddress, sNextVirtualAddress, size)); size = (size + B_PAGE_SIZE - 1) / B_PAGE_SIZE; // get number of pages to map @@ -360,13 +365,14 @@ if (virtualAddress != NULL) { // This special path is almost only useful for loading the // kernel into memory; it will only allow you to map the - // 1 MB following the kernel base address. + // 'kMaxKernelSize' bytes following the kernel base address. // Also, it won't check for already mapped addresses, so // you better know why you are here :) addr_t address = (addr_t)virtualAddress; // is the address within the valid range? - if (address < KERNEL_BASE || address + size >= KERNEL_BASE + kMaxKernelSize) + if (address < KERNEL_BASE + || address + size >= KERNEL_BASE + kMaxKernelSize) return NULL; for (uint32 i = 0; i < size; i++) { @@ -380,18 +386,18 @@ void *address = (void *)sNextVirtualAddress; for (uint32 i = 0; i < size; i++) { - map_page(get_next_virtual_page(), get_next_physical_page(), kDefaultPageFlags); + map_page(get_next_virtual_page(), get_next_physical_page(), + kDefaultPageFlags); } return address; } -/** This will unmap the allocated chunk of memory from the virtual - * address space. It might not actually free memory (as its implementation - * is very simple), but it might. - */ - +/*! This will unmap the allocated chunk of memory from the virtual + address space. It might not actually free memory (as its implementation + is very simple), but it might. +*/ extern "C" void mmu_free(void *virtualAddress, size_t size) { @@ -421,11 +427,10 @@ } -/** Sets up the final and kernel accessible GDT and IDT tables. - * BIOS calls won't work any longer after this function has - * been called. - */ - +/*! Sets up the final and kernel accessible GDT and IDT tables. + BIOS calls won't work any longer after this function has + been called. +*/ extern "C" void mmu_init_for_kernel(void) { @@ -488,7 +493,7 @@ // seg 0x10 - kernel 4GB data set_segment_descriptor(&virtualGDT[2], 0, 0xffffffff, DT_DATA_WRITEABLE, DPL_KERNEL); - + // seg 0x1b - ring 3 user 4GB code set_segment_descriptor(&virtualGDT[3], 0, 0xffffffff, DT_CODE_READABLE, DPL_USER); @@ -511,17 +516,23 @@ } // save the memory we've physically allocated - gKernelArgs.physical_allocated_range[0].size = sNextPhysicalAddress - gKernelArgs.physical_allocated_range[0].start; + gKernelArgs.physical_allocated_range[0].size + = sNextPhysicalAddress - gKernelArgs.physical_allocated_range[0].start; - // save the memory we've virtually allocated (for the kernel and other stuff) + // Save the memory we've virtually allocated (for the kernel and other + // stuff) gKernelArgs.virtual_allocated_range[0].start = KERNEL_BASE; - gKernelArgs.virtual_allocated_range[0].size = sNextVirtualAddress - KERNEL_BASE; + gKernelArgs.virtual_allocated_range[0].size + = sNextVirtualAddress - KERNEL_BASE; gKernelArgs.num_virtual_allocated_ranges = 1; // sort the address ranges - sort_addr_range(gKernelArgs.physical_memory_range, gKernelArgs.num_physical_memory_ranges); - sort_addr_range(gKernelArgs.physical_allocated_range, gKernelArgs.num_physical_allocated_ranges); - sort_addr_range(gKernelArgs.virtual_allocated_range, gKernelArgs.num_virtual_allocated_ranges); + sort_addr_range(gKernelArgs.physical_memory_range, + gKernelArgs.num_physical_memory_ranges); + sort_addr_range(gKernelArgs.physical_allocated_range, + gKernelArgs.num_physical_allocated_ranges); + sort_addr_range(gKernelArgs.virtual_allocated_range, + gKernelArgs.num_virtual_allocated_ranges); #ifdef TRACE_MMU { @@ -566,10 +577,12 @@ // also map it on the next vpage gKernelArgs.arch_args.vir_pgdir = get_next_virtual_page(); - map_page(gKernelArgs.arch_args.vir_pgdir, (uint32)sPageDirectory, kDefaultPageFlags); + map_page(gKernelArgs.arch_args.vir_pgdir, (uint32)sPageDirectory, + kDefaultPageFlags); // map in a kernel stack - gKernelArgs.cpu_kstack[0].start = (addr_t)mmu_allocate(NULL, KERNEL_STACK_SIZE); + gKernelArgs.cpu_kstack[0].start = (addr_t)mmu_allocate(NULL, + KERNEL_STACK_SIZE); gKernelArgs.cpu_kstack[0].size = KERNEL_STACK_SIZE; TRACE(("kernel stack at 0x%lx to 0x%lx\n", gKernelArgs.cpu_kstack[0].start, @@ -587,17 +600,25 @@ if (extMemoryBlock[i].type == 1) { // round everything up to page boundaries, exclusive of pages // it partially occupies - extMemoryBlock[i].length -= (extMemoryBlock[i].base_addr % B_PAGE_SIZE) - ? (B_PAGE_SIZE - (extMemoryBlock[i].base_addr % B_PAGE_SIZE)) : 0; - extMemoryBlock[i].base_addr = ROUNDUP(extMemoryBlock[i].base_addr, B_PAGE_SIZE); - extMemoryBlock[i].length = ROUNDOWN(extMemoryBlock[i].length, B_PAGE_SIZE); + if ((extMemoryBlock[i].base_addr % B_PAGE_SIZE) != 0) { + extMemoryBlock[i].length -= B_PAGE_SIZE + - extMemoryBlock[i].base_addr % B_PAGE_SIZE; + } + extMemoryBlock[i].base_addr + = ROUNDUP(extMemoryBlock[i].base_addr, B_PAGE_SIZE); + extMemoryBlock[i].length + = ROUNDOWN(extMemoryBlock[i].length, B_PAGE_SIZE); // we ignore all memory beyond 4 GB if (extMemoryBlock[i].base_addr > 0xffffffffULL) continue; - if (extMemoryBlock[i].base_addr + extMemoryBlock[i].length > 0xffffffffULL) - extMemoryBlock[i].length = 0x100000000ULL - extMemoryBlock[i].base_addr; + if (extMemoryBlock[i].base_addr + extMemoryBlock[i].length + > 0xffffffffULL) { + extMemoryBlock[i].length + = 0x100000000ULL - extMemoryBlock[i].base_addr; + } + if (gKernelArgs.num_physical_memory_ranges > 0) { // we might want to extend a previous hole addr_t previousEnd = gKernelArgs.physical_memory_range[ @@ -606,14 +627,16 @@ gKernelArgs.num_physical_memory_ranges - 1].size; addr_t holeSize = extMemoryBlock[i].base_addr - previousEnd; - // if the hole is smaller than 1 MB, we try to mark the memory - // as allocated and extend the previous memory range + // If the hole is smaller than 1 MB, we try to mark the + // memory as allocated and extend the previous memory range if (previousEnd <= extMemoryBlock[i].base_addr && holeSize < 0x100000 && insert_physical_allocated_range(previousEnd, - extMemoryBlock[i].base_addr - previousEnd) == B_OK) { + extMemoryBlock[i].base_addr - previousEnd) + == B_OK) { gKernelArgs.physical_memory_range[ - gKernelArgs.num_physical_memory_ranges - 1].size += holeSize; + gKernelArgs.num_physical_memory_ranges - 1].size + += holeSize; } } @@ -622,19 +645,22 @@ } } } else { - // ToDo: for now! + // TODO: for now! dprintf("No extended memory block - using 32 MB (fix me!)\n"); uint32 memSize = 32 * 1024 * 1024; - // we dont have an extended map, assume memory is contiguously mapped at 0x0 + // We dont have an extended map, assume memory is contiguously mapped + // at 0x0 gKernelArgs.physical_memory_range[0].start = 0; gKernelArgs.physical_memory_range[0].size = memSize; gKernelArgs.num_physical_memory_ranges = 1; // mark the bios area allocated - gKernelArgs.physical_allocated_range[gKernelArgs.num_physical_allocated_ranges].start = 0x9f000; // 640k - 1 page - gKernelArgs.physical_allocated_range[gKernelArgs.num_physical_allocated_ranges].size = 0x61000; - gKernelArgs.num_physical_allocated_ranges++; + uint32 biosRange = gKernelArgs.num_physical_allocated_ranges++; + + gKernelArgs.physical_allocated_range[biosRange].start = 0x9f000; + // 640k - 1 page + gKernelArgs.physical_allocated_range[biosRange].size = 0x61000; } gKernelArgs.arch_args.page_hole = 0xffc00000; From axeld at mail.berlios.de Sat Apr 5 12:23:11 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 5 Apr 2008 12:23:11 +0200 Subject: [Haiku-commits] r24806 - haiku/trunk/src/system/kernel/cache Message-ID: <200804051023.m35ANB2C004148@sheep.berlios.de> Author: axeld Date: 2008-04-05 12:23:11 +0200 (Sat, 05 Apr 2008) New Revision: 24806 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24806&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: The wait_for_notifications() function now detects if it has been run from within the notifier/writer thread, and will then flush the notifications directly. This should fix #2008 again. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-05 10:16:49 UTC (rev 24805) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-05 10:23:11 UTC (rev 24806) @@ -287,6 +287,7 @@ static mutex sCachesLock; static sem_id sEventSemaphore; static mutex sNotificationsLock; +static thread_id sWriterNotifyThread; static DoublyLinkedListLink sMarkCache; // TODO: this only works if the link is the first entry of block_cache static object_cache *sBlockCache; @@ -1353,33 +1354,6 @@ #endif // DEBUG_BLOCK_CACHE -static void -notify_sync(int32 transactionID, int32 event, void *_cache) -{ - block_cache *cache = (block_cache *)_cache; - - cache->condition_variable.NotifyOne(); -} - - -static void -wait_for_notifications(block_cache *cache) -{ - // add sync notification - cache_notification notification; - set_notification(NULL, notification, TRANSACTION_WRITTEN, notify_sync, - cache); - - ConditionVariableEntry entry; - entry.Add(cache); - - add_notification(cache, ¬ification, TRANSACTION_WRITTEN, false); - - // wait for notification hook to be called - entry.Wait(); -} - - static block_cache * get_next_locked_block_cache(block_cache *last) { @@ -1559,6 +1533,40 @@ } +static void +notify_sync(int32 transactionID, int32 event, void *_cache) +{ + block_cache *cache = (block_cache *)_cache; + + cache->condition_variable.NotifyOne(); +} + + +static void +wait_for_notifications(block_cache *cache) +{ + if (find_thread(NULL) == sWriterNotifyThread) { + // We're the notifier thread, don't wait, but flush all pending + // notifications directly. + flush_pending_notifications(cache); + return; + } + + // add sync notification + cache_notification notification; + set_notification(NULL, notification, TRANSACTION_WRITTEN, notify_sync, + cache); + + ConditionVariableEntry entry; + entry.Add(cache); + + add_notification(cache, ¬ification, TRANSACTION_WRITTEN, false); + + // wait for notification hook to be called + entry.Wait(); +} + + extern "C" status_t block_cache_init(void) { @@ -1577,10 +1585,10 @@ if (sEventSemaphore < B_OK) return sEventSemaphore; - thread_id thread = spawn_kernel_thread(&block_notifier_and_writer, + sWriterNotifyThread = spawn_kernel_thread(&block_notifier_and_writer, "block writer/notifier", B_LOW_PRIORITY, NULL); - if (thread >= B_OK) - send_signal_etc(thread, SIGCONT, B_DO_NOT_RESCHEDULE); + if (sWriterNotifyThread >= B_OK) + send_signal_etc(sWriterNotifyThread, SIGCONT, B_DO_NOT_RESCHEDULE); #ifdef DEBUG_BLOCK_CACHE add_debugger_command_etc("block_caches", &dump_caches, From axeld at pinc-software.de Sat Apr 5 12:32:38 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sat, 05 Apr 2008 12:32:38 +0200 CEST Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080404225337.20829.4@stippis2.1207326576.fake> Message-ID: <8345803620-BeMail@zon> Stephan Assmus wrote: > The more I am debugging the problem, the more clueless I am. The > problem is > in this function: I hope you didn't spend too much time on that one. I didn't notice your problems before, but it's fixed now (in r24805) :-) Bye, Axel. From superstippi at gmx.de Sat Apr 5 13:52:08 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 05 Apr 2008 13:52:08 +0200 Subject: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel In-Reply-To: <20080405062032.2168.3@knochen-vm.1207319339.fake> References: <223118010-BeMail@primary> <20080404225337.20829.4@stippis2.1207326576.fake> <20080404233331.1894.2@knochen-vm.1207319339.fake> <20080405062032.2168.3@knochen-vm.1207319339.fake> Message-ID: <20080405115208.98480@gmx.net> -------- Original-Nachricht -------- > Datum: Sat, 05 Apr 2008 06:20:32 +0200 > Von: Ingo Weinhold > An: SVN commits to the Haiku source repository > Betreff: Re: [Haiku-commits] r24796 - in haiku/trunk: data/artwork/boot_splash headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel > > On 2008-04-04 at 23:33:31 [+0200], Ingo Weinhold > wrote: > > On 2008-04-04 at 22:53:37 [+0200], Stephan Assmus > > wrote: > > > > > > Michael Lotz wrote: > > > > > > > > > I tested in QEMU and there it worked on the system that I used for > > > > > coding. > > > > > When I upgraded on my other box, Haiku wouldn't boot anymore and I > > > > > tracked > > > > > it down to my patch. I am clueless, I have read my patch multiple > > > > > times. > > > > > And now you tell me you could look at it... I will find it > eventually, > > > > > but > > > > > just a warning to others, you could be stuck like me. So maybe > wait a > > > > > bit > > > > > before upgrading until I fixed my problem. > > > > I can reproduce the problem can be reproduced under VMware, too. > > I don't think this problem is related to r24796. I'm still running r24794 > on > my other machine and encounter the same problem now. It worked the whole > day, and started to happen only after my latest changes (which only add > VFS stuff and shouldn't have any effect that early in the boot process). In this case, I am glad I just went to bed yesterday. I had two theories, one was that the calculations resulted into some odd offsets into the frame buffer, but I threw that away quickly, since it makes no sense, and the other theory was that the image was somehow too big suddenly. But I threw that possibility away too, since it would work for me when I commented out just *drawing* the image. Since Axel's fix I assume that it was just very close at the memory limit (of the stack?) and it wouldn't have worked if I let it run one function call deeper. Well, I am just glad I didn't spent any more time on it then I did. And thanks Axel! Best regards, -Stephan From laplace at mail.berlios.de Sat Apr 5 13:55:14 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 5 Apr 2008 13:55:14 +0200 Subject: [Haiku-commits] r24807 - haiku/trunk/headers/os/interface Message-ID: <200804051155.m35BtEkd001243@sheep.berlios.de> Author: laplace Date: 2008-04-05 13:55:14 +0200 (Sat, 05 Apr 2008) New Revision: 24807 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24807&view=rev Modified: haiku/trunk/headers/os/interface/PrintJob.h Log: Restored the copyright notice before r24684, as pointed out by Marcus Overhagen on the Haiku-commits mailing list, r24684 is a copyright violation. Also reverted some meaningful comments. Modified: haiku/trunk/headers/os/interface/PrintJob.h =================================================================== --- haiku/trunk/headers/os/interface/PrintJob.h 2008-04-05 10:23:11 UTC (rev 24806) +++ haiku/trunk/headers/os/interface/PrintJob.h 2008-04-05 11:55:14 UTC (rev 24807) @@ -1,7 +1,13 @@ -/* - * Copyright 2008, Haiku Inc. - * Distributed under the terms of the MIT License. - */ +/******************************************************************************* +/ +/ File: PrintJob.h +/ +/ Description: BPrintJob runs a printing session. +/ +/ Copyright 1996-98, Be Incorporated, All Rights Reserved +/ +*******************************************************************************/ + #ifndef _PRINTSESSION_H #define _PRINTSESSION_H @@ -14,6 +20,8 @@ class BFile; class BView; +/*----------------------------------------------------------------*/ +/*----- BPrintJob related structures -----------------------------*/ struct print_file_header { int32 version; @@ -27,10 +35,12 @@ struct _page_header_; +/*----------------------------------------------------------------*/ +/*----- BPrintJob class ------------------------------------------*/ class BPrintJob { public: - + // These values are returned by PrinterType() enum { B_BW_PRINTER = 0, B_COLOR_PRINTER From stippi at mail.berlios.de Sat Apr 5 14:07:11 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 5 Apr 2008 14:07:11 +0200 Subject: [Haiku-commits] r24808 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200804051207.m35C7BD3002083@sheep.berlios.de> Author: stippi Date: 2008-04-05 14:07:10 +0200 (Sat, 05 Apr 2008) New Revision: 24808 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24808&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp Log: Rene left tracing turned on in his last commit to this file. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp 2008-04-05 11:55:14 UTC (rev 24807) +++ haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp 2008-04-05 12:07:10 UTC (rev 24808) @@ -27,7 +27,7 @@ #include -#define TRACE_VIDEO +//#define TRACE_VIDEO #ifdef TRACE_VIDEO # define TRACE(x) dprintf x #else @@ -809,8 +809,8 @@ if (sVesaCompatible && sMode != NULL) { if (!sModeChosen) get_mode_from_settings(); - - // On some BIOS / chipset / monitor combinations, there seems to be a timing issue between + + // On some BIOS / chipset / monitor combinations, there seems to be a timing issue between // getting the EDID data and setting the video mode. As such we wait here briefly to give // everything enough time to settle. spin(1000); @@ -882,7 +882,7 @@ int x = (gKernelArgs.frame_buffer.width - width) * placementX / 100; int y = (gKernelArgs.frame_buffer.height - height) * placementY / 100; - + height = min_c(kSplashLogoHeight, gKernelArgs.frame_buffer.height); blit_image(kSplashLogoImage, NULL, width, height, kSplashLogoWidth, NULL, x, y); From axeld at mail.berlios.de Sat Apr 5 14:24:11 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 5 Apr 2008 14:24:11 +0200 Subject: [Haiku-commits] r24809 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804051224.m35COB0L002950@sheep.berlios.de> Author: axeld Date: 2008-04-05 14:24:11 +0200 (Sat, 05 Apr 2008) New Revision: 24809 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24809&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp Log: * Added checks to (hopefully) all write/create functions to bail out early if the volume is read-only. This should help with #2028. * Removed unused bfs_[de]select() functions. * Removed most paranoia checks - now that we control both sides of code, this would just hide eventual problems in the VFS code. * Cleanup. 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 2008-04-05 12:07:10 UTC (rev 24808) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2008-04-05 12:24:11 UTC (rev 24809) @@ -130,10 +130,10 @@ static status_t -bfs_unmount(void *ns) +bfs_unmount(void *_fs) { FUNCTION(); - Volume* volume = (Volume *)ns; + Volume* volume = (Volume *)_fs; status_t status = volume->Unmount(); delete volume; @@ -142,26 +142,20 @@ } -/** Fill in bfs_info struct for device. - */ - static status_t -bfs_read_fs_stat(void *_ns, struct fs_info *info) +bfs_read_fs_stat(void *_fs, struct fs_info *info) { FUNCTION(); - if (_ns == NULL || info == NULL) - return B_BAD_VALUE; - Volume *volume = (Volume *)_ns; - + Volume *volume = (Volume *)_fs; RecursiveLocker locker(volume->Lock()); // File system flags. - info->flags = B_FS_IS_PERSISTENT | B_FS_HAS_ATTR | B_FS_HAS_MIME | B_FS_HAS_QUERY | - (volume->IsReadOnly() ? B_FS_IS_READONLY : 0); + info->flags = B_FS_IS_PERSISTENT | B_FS_HAS_ATTR | B_FS_HAS_MIME + | B_FS_HAS_QUERY | (volume->IsReadOnly() ? B_FS_IS_READONLY : 0); info->io_size = BFS_IO_SIZE; - // whatever is appropriate here? Just use the same value as BFS (and iso9660) for now + // whatever is appropriate here? info->block_size = volume->BlockSize(); info->total_blocks = volume->NumBlocks(); @@ -178,19 +172,23 @@ static status_t -bfs_write_fs_stat(void *_ns, const struct fs_info *info, uint32 mask) +bfs_write_fs_stat(void *_fs, const struct fs_info *info, uint32 mask) { FUNCTION_START(("mask = %ld\n", mask)); - Volume *volume = (Volume *)_ns; - disk_super_block &superBlock = volume->SuperBlock(); + Volume *volume = (Volume *)_fs; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; RecursiveLocker locker(volume->Lock()); status_t status = B_BAD_VALUE; if (mask & FS_WRITE_FSINFO_NAME) { - strncpy(superBlock.name, info->volume_name, sizeof(superBlock.name) - 1); + disk_super_block &superBlock = volume->SuperBlock(); + + strncpy(superBlock.name, info->volume_name, + sizeof(superBlock.name) - 1); superBlock.name[sizeof(superBlock.name) - 1] = '\0'; status = volume->WriteSuperBlock(); @@ -200,14 +198,11 @@ static status_t -bfs_sync(void *_ns) +bfs_sync(void *_fs) { FUNCTION(); - if (_ns == NULL) - return B_BAD_VALUE; - Volume *volume = (Volume *)_ns; - + Volume *volume = (Volume *)_fs; return volume->Sync(); } @@ -218,10 +213,10 @@ /*! Reads in the node from disk and creates an inode object from it. */ static status_t -bfs_get_vnode(void *_ns, ino_t id, void **_node, bool reenter) +bfs_get_vnode(void *_fs, ino_t id, void **_node, bool reenter) { //FUNCTION_START(("ino_t = %Ld\n", id)); - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; // first inode may be after the log area, we don't go through // the hassle and try to load an earlier block from disk @@ -284,14 +279,11 @@ static status_t -bfs_remove_vnode(void *_ns, void *_node, bool reenter) +bfs_remove_vnode(void *_fs, void *_node, bool reenter) { FUNCTION(); - if (_ns == NULL || _node == NULL) - return B_BAD_VALUE; - - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *inode = (Inode *)_node; // The "chkbfs" functionality uses this flag to prevent the space used @@ -325,7 +317,7 @@ static bool bfs_can_page(fs_volume _fs, fs_vnode _v, fs_cookie _cookie) { - // ToDo: we're obviously not even asked... + // TODO: we're obviously not even asked... return false; } @@ -383,6 +375,9 @@ Volume *volume = (Volume *)_fs; Inode *inode = (Inode *)_node; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; + if (inode->FileCache() == NULL) RETURN_ERROR(B_BAD_VALUE); @@ -452,8 +447,8 @@ if (offset > inode->Size()) { // make sure the extent ends with the last official file // block (without taking any preallocations into account) - vecs[index].length = (inode->Size() - fileOffset + volume->BlockSize() - 1) - & ~(volume->BlockSize() - 1); + vecs[index].length = (inode->Size() - fileOffset + + volume->BlockSize() - 1) & ~(volume->BlockSize() - 1); } *_count = index + 1; return B_OK; @@ -478,13 +473,12 @@ static status_t -bfs_lookup(void *_ns, void *_directory, const char *file, ino_t *_vnodeID, int *_type) +bfs_lookup(void *_fs, void *_directory, const char *file, ino_t *_vnodeID, + int *_type) { //FUNCTION_START(("file = %s\n", file)); - if (_ns == NULL || _directory == NULL || file == NULL || _vnodeID == NULL) - return B_BAD_VALUE; - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *directory = (Inode *)_directory; // check access permissions @@ -496,7 +490,8 @@ if (directory->GetTree(&tree) != B_OK) RETURN_ERROR(B_BAD_VALUE); - if ((status = tree->Find((uint8 *)file, (uint16)strlen(file), _vnodeID)) < B_OK) { + status = tree->Find((uint8 *)file, (uint16)strlen(file), _vnodeID); + if (status < B_OK) { //PRINT(("bfs_walk() could not find %Ld:\"%s\": %s\n", directory->BlockNumber(), file, strerror(status))); return status; } @@ -506,7 +501,8 @@ // interfere with new_vnode() here Inode *inode; - if ((status = get_vnode(volume->ID(), *_vnodeID, (void **)&inode)) != B_OK) { + status = get_vnode(volume->ID(), *_vnodeID, (void **)&inode); + if (status != B_OK) { REPORT_ERROR(status); return B_ENTRY_NOT_FOUND; } @@ -591,12 +587,14 @@ #ifdef DEBUG case 56742: { - // allocate all free blocks and zero them out (a test for the BlockAllocator)! + // allocate all free blocks and zero them out + // (a test for the BlockAllocator)! BlockAllocator &allocator = volume->Allocator(); Transaction transaction(volume, 0); CachedBlock cached(volume); block_run run; - while (allocator.AllocateBlocks(transaction, 8, 0, 64, 1, run) == B_OK) { + while (allocator.AllocateBlocks(transaction, 8, 0, 64, 1, run) + == B_OK) { PRINT(("write block_run(%ld, %d, %d)\n", run.allocation_group, run.start, run.length)); for (int32 i = 0;i < run.length;i++) { @@ -626,13 +624,12 @@ } -/** Sets the open-mode flags for the open file cookie - only - * supports O_APPEND currently, but that should be sufficient - * for a file system. - */ - +/*! Sets the open-mode flags for the open file cookie - only + supports O_APPEND currently, but that should be sufficient + for a file system. +*/ static status_t -bfs_set_flags(void *_ns, void *_node, void *_cookie, int flags) +bfs_set_flags(void *_fs, void *_node, void *_cookie, int flags) { FUNCTION_START(("node = %p, flags = %d", _node, flags)); @@ -643,32 +640,11 @@ } -#if 0 static status_t -bfs_select(void *ns, void *node, void *cookie, uint8 event, uint32 ref, selectsync *sync) +bfs_fsync(void *_fs, void *_node) { - FUNCTION_START(("event = %d, ref = %lu, sync = %p\n", event, ref, sync)); - notify_select_event(sync, ref); - - return B_OK; -} - - -static status_t -bfs_deselect(void *ns, void *node, void *cookie, uint8 event, selectsync *sync) -{ FUNCTION(); - return B_OK; -} -#endif -static status_t -bfs_fsync(void *_ns, void *_node) -{ - FUNCTION(); - if (_node == NULL) - return B_BAD_VALUE; - Inode *inode = (Inode *)_node; ReadLocked locked(inode->Lock()); @@ -680,11 +656,8 @@ } -/** Fills in the stat struct for a node - */ - static status_t -bfs_read_stat(void *_ns, void *_node, struct stat *stat) +bfs_read_stat(void *_fs, void *_node, struct stat *stat) { FUNCTION(); @@ -696,16 +669,16 @@ static status_t -bfs_write_stat(void *_ns, void *_node, const struct stat *stat, uint32 mask) +bfs_write_stat(void *_fs, void *_node, const struct stat *stat, uint32 mask) { FUNCTION(); - if (_ns == NULL || _node == NULL || stat == NULL) - RETURN_ERROR(B_BAD_VALUE); - - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *inode = (Inode *)_node; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; + // TODO: we should definitely check a bit more if the new stats are // valid - or even better, the VFS should check this before calling us @@ -788,18 +761,17 @@ status_t -bfs_create(void *_ns, void *_directory, const char *name, int openMode, +bfs_create(void *_fs, void *_directory, const char *name, int openMode, int mode, void **_cookie, ino_t *_vnodeID) { FUNCTION_START(("name = \"%s\", perms = %d, openMode = %d\n", name, mode, openMode)); - if (_ns == NULL || _directory == NULL || _cookie == NULL - || name == NULL || *name == '\0') - RETURN_ERROR(B_BAD_VALUE); - - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *directory = (Inode *)_directory; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; + if (!directory->IsDirectory()) RETURN_ERROR(B_BAD_TYPE); @@ -826,8 +798,10 @@ // register the cookie *_cookie = cookie; - if (created) - notify_entry_created(volume->ID(), directory->ID(), name, *_vnodeID); + if (created) { + notify_entry_created(volume->ID(), directory->ID(), name, + *_vnodeID); + } } else free(cookie); @@ -836,18 +810,17 @@ static status_t -bfs_create_symlink(void *_ns, void *_directory, const char *name, +bfs_create_symlink(void *_fs, void *_directory, const char *name, const char *path, int mode) { FUNCTION_START(("name = \"%s\", path = \"%s\"\n", name, path)); - if (_ns == NULL || _directory == NULL || path == NULL - || name == NULL || *name == '\0') - RETURN_ERROR(B_BAD_VALUE); - - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *directory = (Inode *)_directory; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; + if (!directory->IsDirectory()) RETURN_ERROR(B_BAD_TYPE); @@ -899,7 +872,7 @@ status_t -bfs_link(void *ns, void *dir, const char *name, void *node) +bfs_link(void *_fs, void *dir, const char *name, void *node) { FUNCTION_START(("name = \"%s\"\n", name)); @@ -910,16 +883,14 @@ status_t -bfs_unlink(void *_ns, void *_directory, const char *name) +bfs_unlink(void *_fs, void *_directory, const char *name) { FUNCTION_START(("name = \"%s\"\n", name)); - if (_ns == NULL || _directory == NULL || name == NULL || *name == '\0') - return B_BAD_VALUE; if (!strcmp(name, "..") || !strcmp(name, ".")) return B_NOT_ALLOWED; - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *directory = (Inode *)_directory; status_t status = directory->CheckPermissions(W_OK); @@ -939,20 +910,18 @@ status_t -bfs_rename(void *_ns, void *_oldDir, const char *oldName, void *_newDir, const char *newName) +bfs_rename(void *_fs, void *_oldDir, const char *oldName, void *_newDir, + const char *newName) { FUNCTION_START(("oldDir = %p, oldName = \"%s\", newDir = %p, newName = \"%s\"\n", _oldDir, oldName, _newDir, newName)); // there might be some more tests needed?! - if (_ns == NULL || _oldDir == NULL || _newDir == NULL - || oldName == NULL || *oldName == '\0' - || newName == NULL || *newName == '\0' - || !strcmp(oldName, ".") || !strcmp(oldName, "..") + if (!strcmp(oldName, ".") || !strcmp(oldName, "..") || !strcmp(newName, ".") || !strcmp(newName, "..") || strchr(newName, '/') != NULL) RETURN_ERROR(B_BAD_VALUE); - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *oldDirectory = (Inode *)_oldDir; Inode *newDirectory = (Inode *)_newDir; @@ -969,7 +938,8 @@ RecursiveLocker locker(volume->Lock()); - // get the directory's tree, and a pointer to the inode which should be changed + // Get the directory's tree, and a pointer to the inode which should be + // changed BPlusTree *tree; status = oldDirectory->GetTree(&tree); if (status < B_OK) @@ -1023,12 +993,14 @@ RETURN_ERROR(status); } - status = newTree->Insert(transaction, (const uint8 *)newName, strlen(newName), id); + status = newTree->Insert(transaction, (const uint8 *)newName, + strlen(newName), id); if (status == B_NAME_IN_USE) { // If there is already a file with that name, we have to remove // it, as long it's not a directory with files in it off_t clobber; - if (newTree->Find((const uint8 *)newName, strlen(newName), &clobber) < B_OK) + if (newTree->Find((const uint8 *)newName, strlen(newName), &clobber) + < B_OK) return B_NAME_IN_USE; if (clobber == id) return B_BAD_VALUE; @@ -1038,13 +1010,16 @@ if (vnode.Get(&other) < B_OK) return B_NAME_IN_USE; - status = newDirectory->Remove(transaction, newName, NULL, other->IsDirectory()); + status = newDirectory->Remove(transaction, newName, NULL, + other->IsDirectory()); if (status < B_OK) return status; - notify_entry_removed(volume->ID(), newDirectory->ID(), newName, clobber); + notify_entry_removed(volume->ID(), newDirectory->ID(), newName, + clobber); - status = newTree->Insert(transaction, (const uint8 *)newName, strlen(newName), id); + status = newTree->Insert(transaction, (const uint8 *)newName, + strlen(newName), id); } if (status < B_OK) return status; @@ -1065,7 +1040,8 @@ } if (status == B_OK) { - status = tree->Remove(transaction, (const uint8 *)oldName, strlen(oldName), id); + status = tree->Remove(transaction, (const uint8 *)oldName, + strlen(oldName), id); if (status == B_OK) { inode->Parent() = newDirectory->BlockRun(); @@ -1074,8 +1050,10 @@ BPlusTree *movedTree = NULL; if (oldDirectory != newDirectory && inode->IsDirectory() - && (status = inode->GetTree(&movedTree)) == B_OK) - status = movedTree->Replace(transaction, (const uint8 *)"..", 2, newDirectory->ID()); + && (status = inode->GetTree(&movedTree)) == B_OK) { + status = movedTree->Replace(transaction, (const uint8 *)"..", + 2, newDirectory->ID()); + } if (status == B_OK) status = inode->WriteBack(transaction); @@ -1094,9 +1072,12 @@ // for us) // Anyway, if we overwrote a file in the target directory // this is lost now (only in-memory, not on-disk)... - bailStatus = tree->Insert(transaction, (const uint8 *)oldName, strlen(oldName), id); - if (movedTree != NULL) - movedTree->Replace(transaction, (const uint8 *)"..", 2, oldDirectory->ID()); + bailStatus = tree->Insert(transaction, (const uint8 *)oldName, + strlen(oldName), id); + if (movedTree != NULL) { + movedTree->Replace(transaction, (const uint8 *)"..", 2, + oldDirectory->ID()); + } } } @@ -1111,8 +1092,10 @@ } } - if (bailStatus == B_OK) - bailStatus = newTree->Remove(transaction, (const uint8 *)newName, strlen(newName), id); + if (bailStatus == B_OK) { + bailStatus = newTree->Remove(transaction, (const uint8 *)newName, + strlen(newName), id); + } if (bailStatus < B_OK) volume->Panic(); @@ -1133,7 +1116,7 @@ // any data from it. if (inode->IsDirectory() && openMode & O_RWMASK) { openMode = openMode & ~O_RWMASK; - // ToDo: for compatibility reasons, we don't return an error here... + // TODO: for compatibility reasons, we don't return an error here... // e.g. "copyattr" tries to do that //return B_IS_A_DIRECTORY; } @@ -1143,7 +1126,7 @@ if (status < B_OK) RETURN_ERROR(status); - // we could actually use the cookie to keep track of: + // We could actually use the cookie to keep track of: // - the last block_run // - the location in the data_stream (indirect, double indirect, // position in block_run array) @@ -1185,7 +1168,7 @@ static status_t -bfs_read(void *_ns, void *_node, void *_cookie, off_t pos, void *buffer, +bfs_read(void *_fs, void *_node, void *_cookie, off_t pos, void *buffer, size_t *_length) { //FUNCTION(); @@ -1201,13 +1184,16 @@ static status_t -bfs_write(void *_ns, void *_node, void *_cookie, off_t pos, const void *buffer, +bfs_write(void *_fs, void *_node, void *_cookie, off_t pos, const void *buffer, size_t *_length) { //FUNCTION(); - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *inode = (Inode *)_node; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; + if (!inode->HasUserAccessableStream()) { *_length = 0; RETURN_ERROR(B_BAD_VALUE); @@ -1233,9 +1219,10 @@ ReadLocked locker(inode->Lock()); // periodically notify if the file size has changed - // ToDo: should we better test for a change in the last_modified time only? + // TODO: should we better test for a change in the last_modified time only? if (!inode->IsDeleted() && cookie->last_size != inode->Size() - && system_time() > cookie->last_notification + INODE_NOTIFICATION_INTERVAL) { + && system_time() > cookie->last_notification + + INODE_NOTIFICATION_INTERVAL) { notify_stat_changed(volume->ID(), inode->ID(), B_STAT_MODIFICATION_TIME | B_STAT_SIZE | B_STAT_INTERIM_UPDATE); cookie->last_size = inode->Size(); @@ -1247,37 +1234,27 @@ } -/** Do whatever is necessary to close a file, EXCEPT for freeing - * the cookie! - */ - static status_t -bfs_close(void *_ns, void *_node, void *_cookie) +bfs_close(void *_fs, void *_node, void *_cookie) { FUNCTION(); - if (_ns == NULL || _node == NULL || _cookie == NULL) - return B_BAD_VALUE; - return B_OK; } static status_t -bfs_free_cookie(void *_ns, void *_node, void *_cookie) +bfs_free_cookie(void *_fs, void *_node, void *_cookie) { FUNCTION(); - if (_ns == NULL || _node == NULL || _cookie == NULL) - return B_BAD_VALUE; - file_cookie *cookie = (file_cookie *)_cookie; - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *inode = (Inode *)_node; Transaction transaction; - bool needsTrimming; + bool needsTrimming = false; - { + if (!volume->IsReadOnly()) { ReadLocked locker(inode->Lock()); needsTrimming = inode->NeedsTrimming(); @@ -1291,10 +1268,11 @@ } } - WriteLocked locker(inode->Lock()); status_t status = transaction.IsStarted() ? B_OK : B_ERROR; if (status == B_OK) { + WriteLocked locker(inode->Lock()); + // trim the preallocated blocks and update the size, // and last_modified indices if needed bool changedSize = false, changedTime = false; @@ -1342,18 +1320,14 @@ } -/** Checks access permissions, return B_NOT_ALLOWED if the action - * is not allowed. - */ - +/*! Checks access permissions, return B_NOT_ALLOWED if the action + is not allowed. +*/ static status_t -bfs_access(void *_ns, void *_node, int accessMode) +bfs_access(void *_fs, void *_node, int accessMode) { //FUNCTION(); - if (_ns == NULL || _node == NULL) - return B_BAD_VALUE; - Inode *inode = (Inode *)_node; status_t status = inode->CheckPermissions(accessMode); if (status < B_OK) @@ -1364,7 +1338,7 @@ static status_t -bfs_read_link(void *_ns, void *_node, char *buffer, size_t *_bufferSize) +bfs_read_link(void *_fs, void *_node, char *buffer, size_t *_bufferSize) { FUNCTION(); @@ -1399,18 +1373,17 @@ static status_t -bfs_create_dir(void *_ns, void *_directory, const char *name, int mode, +bfs_create_dir(void *_fs, void *_directory, const char *name, int mode, ino_t *_newVnodeID) { FUNCTION_START(("name = \"%s\", perms = %d\n", name, mode)); - if (_ns == NULL || _directory == NULL - || name == NULL || *name == '\0') - RETURN_ERROR(B_BAD_VALUE); - - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *directory = (Inode *)_directory; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; + if (!directory->IsDirectory()) RETURN_ERROR(B_BAD_TYPE); @@ -1438,14 +1411,11 @@ static status_t -bfs_remove_dir(void *_ns, void *_directory, const char *name) +bfs_remove_dir(void *_fs, void *_directory, const char *name) { FUNCTION_START(("name = \"%s\"\n", name)); - if (_ns == NULL || _directory == NULL || name == NULL || *name == '\0') - return B_BAD_VALUE; - - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; Inode *directory = (Inode *)_directory; Transaction transaction(volume, directory->BlockNumber()); @@ -1462,20 +1432,15 @@ } -/** Opens a directory ready to be traversed. - * bfs_open_dir() is also used by bfs_open_index_dir(). - */ - +/*! Opens a directory ready to be traversed. + bfs_open_dir() is also used by bfs_open_index_dir(). +*/ static status_t -bfs_open_dir(void *_ns, void *_node, void **_cookie) +bfs_open_dir(void *_fs, void *_node, void **_cookie) { FUNCTION(); - if (_ns == NULL || _node == NULL || _cookie == NULL) - RETURN_ERROR(B_BAD_VALUE); - Inode *inode = (Inode *)_node; - status_t status = inode->CheckPermissions(R_OK); if (status < B_OK) RETURN_ERROR(status); @@ -1499,7 +1464,7 @@ static status_t -bfs_read_dir(void *_ns, void *_node, void *_cookie, struct dirent *dirent, +bfs_read_dir(void *_fs, void *_node, void *_cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) { FUNCTION(); @@ -1510,14 +1475,15 @@ uint16 length; ino_t id; - status_t status = iterator->GetNextEntry(dirent->d_name, &length, bufferSize, &id); + status_t status = iterator->GetNextEntry(dirent->d_name, &length, + bufferSize, &id); if (status == B_ENTRY_NOT_FOUND) { *_num = 0; return B_OK; } else if (status != B_OK) RETURN_ERROR(status); - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; dirent->d_dev = volume->ID(); dirent->d_ino = id; @@ -1529,11 +1495,9 @@ } -/** Sets the TreeIterator back to the beginning of the directory - */ - +/*! Sets the TreeIterator back to the beginning of the directory. */ static status_t -bfs_rewind_dir(void * /*ns*/, void * /*node*/, void *_cookie) +bfs_rewind_dir(void * /*_fs*/, void * /*node*/, void *_cookie) { FUNCTION(); TreeIterator *iterator = (TreeIterator *)_cookie; @@ -1546,16 +1510,15 @@ static status_t -bfs_close_dir(void * /*ns*/, void * /*node*/, void * /*_cookie*/) +bfs_close_dir(void * /*fs*/, void * /*node*/, void * /*_cookie*/) { FUNCTION(); - // Do whatever you need to to close a directory, but DON'T free the cookie! return B_OK; } static status_t -bfs_free_dir_cookie(void *ns, void *node, void *_cookie) +bfs_free_dir_cookie(void *fs, void *node, void *_cookie) { TreeIterator *iterator = (TreeIterator *)_cookie; @@ -1572,7 +1535,7 @@ static status_t -bfs_open_attr_dir(void *_ns, void *_node, void **_cookie) +bfs_open_attr_dir(void *_fs, void *_node, void **_cookie) { Inode *inode = (Inode *)_node; @@ -1588,7 +1551,7 @@ static status_t -bfs_close_attr_dir(void *ns, void *node, void *cookie) +bfs_close_attr_dir(void *_fs, void *node, void *cookie) { FUNCTION(); return B_OK; @@ -1596,7 +1559,7 @@ static status_t -bfs_free_attr_dir_cookie(void *ns, void *node, void *_cookie) +bfs_free_attr_dir_cookie(void *_fs, void *node, void *_cookie) { FUNCTION(); AttributeIterator *iterator = (AttributeIterator *)_cookie; @@ -1610,7 +1573,7 @@ static status_t -bfs_rewind_attr_dir(void *_ns, void *_node, void *_cookie) +bfs_rewind_attr_dir(void *_fs, void *_node, void *_cookie) { FUNCTION(); @@ -1623,18 +1586,16 @@ static status_t -bfs_read_attr_dir(void *_ns, void *node, void *_cookie, struct dirent *dirent, +bfs_read_attr_dir(void *_fs, void *node, void *_cookie, struct dirent *dirent, size_t bufferSize, uint32 *_num) { FUNCTION(); AttributeIterator *iterator = (AttributeIterator *)_cookie; - if (iterator == NULL) - RETURN_ERROR(B_BAD_VALUE); - uint32 type; size_t length; - status_t status = iterator->GetNext(dirent->d_name, &length, &type, &dirent->d_ino); + status_t status = iterator->GetNext(dirent->d_name, &length, &type, + &dirent->d_ino); if (status == B_ENTRY_NOT_FOUND) { *_num = 0; return B_OK; @@ -1642,7 +1603,7 @@ RETURN_ERROR(status); } - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; dirent->d_dev = volume->ID(); dirent->d_reclen = sizeof(struct dirent) + length; @@ -1658,6 +1619,10 @@ { FUNCTION(); + Volume *volume = (Volume *)_fs; + if (volume->IsReadOnly()) + return B_READ_ONLY_DEVICE; + Inode *inode = (Inode *)_node; Attribute attribute(inode); @@ -1721,12 +1686,14 @@ Transaction transaction(volume, inode->BlockNumber()); Attribute attribute(inode, cookie); - status_t status = attribute.Write(transaction, cookie, pos, (const uint8 *)buffer, _length); + status_t status = attribute.Write(transaction, cookie, pos, + (const uint8 *)buffer, _length); if (status == B_OK) { transaction.Done(); - notify_attribute_changed(volume->ID(), inode->ID(), cookie->name, B_ATTR_CHANGED); - // ToDo: B_ATTR_CREATED is not yet taken into account + notify_attribute_changed(volume->ID(), inode->ID(), cookie->name, + B_ATTR_CHANGED); + // TODO: B_ATTR_CREATED is not yet taken into account // (we don't know what Attribute::Write() does exactly) } @@ -1735,7 +1702,8 @@ static status_t -bfs_read_attr_stat(fs_volume _fs, fs_vnode _file, fs_cookie _cookie, struct stat *stat) +bfs_read_attr_stat(fs_volume _fs, fs_vnode _file, fs_cookie _cookie, + struct stat *stat) { FUNCTION(); @@ -1762,12 +1730,11 @@ { FUNCTION_START(("name = \"%s\", to = \"%s\"\n", fromName, toName)); - // ToDo: implement bfs_rename_attr()! - // I'll skip the implementation here, and will do it for Haiku - at least - // there will be an API to move one attribute to another file, making that - // function much more complicated - oh joy ;-) + // TODO: implement bfs_rename_attr()! + // There will probably be an API to move one attribute to another file, + // making that function much more complicated - oh joy ;-) - RETURN_ERROR(B_ENTRY_NOT_FOUND); + return EOPNOTSUPP; } @@ -1776,9 +1743,6 @@ { FUNCTION_START(("name = \"%s\"\n", name)); - if (name == NULL) - return B_BAD_VALUE; - Volume *volume = (Volume *)_fs; Inode *inode = (Inode *)_node; @@ -1792,7 +1756,8 @@ if (status == B_OK) { transaction.Done(); - notify_attribute_changed(volume->ID(), inode->ID(), name, B_ATTR_REMOVED); + notify_attribute_changed(volume->ID(), inode->ID(), name, + B_ATTR_REMOVED); } return status; @@ -1804,13 +1769,11 @@ static status_t -bfs_open_index_dir(void *_ns, void **_cookie) +bfs_open_index_dir(void *_fs, void **_cookie) { FUNCTION(); - if (_ns == NULL || _cookie == NULL) - RETURN_ERROR(B_BAD_VALUE); - Volume *volume = (Volume *)_ns; + Volume *volume = (Volume *)_fs; if (volume->IndicesNode() == NULL) RETURN_ERROR(B_ENTRY_NOT_FOUND); @@ -1820,7 +1783,7 @@ // traversal functions. // In fact we're storing it in the Volume object for that reason. - RETURN_ERROR(bfs_open_dir(_ns, volume->IndicesNode(), _cookie)); + RETURN_ERROR(bfs_open_dir(_fs, volume->IndicesNode(), _cookie)); } @@ -1828,8 +1791,6 @@ bfs_close_index_dir(fs_volume _fs, fs_cookie _cookie) { FUNCTION(); - if (_fs == NULL || _cookie == NULL) - RETURN_ERROR(B_BAD_VALUE); Volume *volume = (Volume *)_fs; RETURN_ERROR(bfs_close_dir(_fs, volume->IndicesNode(), _cookie)); @@ -1840,8 +1801,6 @@ bfs_free_index_dir_cookie(fs_volume _fs, fs_cookie _cookie) { FUNCTION(); - if (_fs == NULL || _cookie == NULL) - RETURN_ERROR(B_BAD_VALUE); Volume *volume = (Volume *)_fs; RETURN_ERROR(bfs_free_dir_cookie(_fs, volume->IndicesNode(), _cookie)); @@ -1852,8 +1811,6 @@ bfs_rewind_index_dir(fs_volume _fs, fs_cookie _cookie) { FUNCTION(); - if (_fs == NULL || _cookie == NULL) - RETURN_ERROR(B_BAD_VALUE); Volume *volume = (Volume *)_fs; RETURN_ERROR(bfs_rewind_dir(_fs, volume->IndicesNode(), _cookie)); @@ -1865,11 +1822,10 @@ size_t bufferSize, uint32 *_num) { FUNCTION(); - if (_fs == NULL || _cookie == NULL) - RETURN_ERROR(B_BAD_VALUE); Volume *volume = (Volume *)_fs; - RETURN_ERROR(bfs_read_dir(_fs, volume->IndicesNode(), _cookie, dirent, bufferSize, _num)); + RETURN_ERROR(bfs_read_dir(_fs, volume->IndicesNode(), _cookie, dirent, + bufferSize, _num)); } @@ -1877,8 +1833,6 @@ bfs_create_index(fs_volume _fs, const char *name, uint32 type, uint32 flags) { FUNCTION_START(("name = \"%s\", type = %ld, flags = %ld\n", name, type, flags)); - if (_fs == NULL || name == NULL || *name == '\0') - return B_BAD_VALUE; Volume *volume = (Volume *)_fs; [... truncated: 75 lines follow ...] From ingo_weinhold at gmx.de Sat Apr 5 15:09:35 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 05 Apr 2008 15:09:35 +0200 Subject: [Haiku-commits] r24809 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <200804051224.m35COB0L002950@sheep.berlios.de> References: <200804051224.m35COB0L002950@sheep.berlios.de> Message-ID: <20080405150935.420.1@knochen-vm.1207400156.fake> On 2008-04-05 at 14:24:11 [+0200], axeld at BerliOS wrote: > Author: axeld > Date: 2008-04-05 14:24:11 +0200 (Sat, 05 Apr 2008) > New Revision: 24809 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24809&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp > Log: > * Added checks to (hopefully) all write/create functions to bail out early > if the volume is read-only. This should help with #2028. > * Removed unused bfs_[de]select() functions. > * Removed most paranoia checks - now that we control both sides of code, > this would just hide eventual problems in the VFS code. > * Cleanup. Ouch, this one hurts. I probably should have said clearer that I'm changing the FS interface. Particularly the cleanup part will result in a few hundred conflicts, I'm afraid. :-/ CU, Ingo From axeld at pinc-software.de Sat Apr 5 15:30:35 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sat, 05 Apr 2008 15:30:35 +0200 CEST Subject: [Haiku-commits] r24809 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <20080405150935.420.1@knochen-vm.1207400156.fake> Message-ID: <19022155302-BeMail@zon> Ingo Weinhold wrote: > > Modified: > > haiku/trunk/src/add-ons/kernel/file_systems/bfs/ > > kernel_interface.cpp > > Log: > > * Added checks to (hopefully) all write/create functions to bail > > out early > > if the volume is read-only. This should help with #2028. > > * Removed unused bfs_[de]select() functions. > > * Removed most paranoia checks - now that we control both sides of > > code, > > this would just hide eventual problems in the VFS code. > > * Cleanup. > Ouch, this one hurts. I probably should have said clearer that I'm > changing > the FS interface. Particularly the cleanup part will result in a few > hundred > conflicts, I'm afraid. :-/ Sorry, I thought you would actually only change the VFS side of things, and left the FS interface itself unchanged. Eventually it might be simpler to try to apply that patch to your version of the file - only the lines with IsReadOnly() in it are really important :-) Bye, Axel. From anevilyak at gmail.com Sat Apr 5 16:51:19 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 5 Apr 2008 09:51:19 -0500 Subject: [Haiku-commits] r24808 - haiku/trunk/src/system/boot/platform/bios_ia32 In-Reply-To: <200804051207.m35C7BD3002083@sheep.berlios.de> References: <200804051207.m35C7BD3002083@sheep.berlios.de> Message-ID: On Sat, Apr 5, 2008 at 7:07 AM, stippi at BerliOS wrote: > Author: stippi > Date: 2008-04-05 14:07:10 +0200 (Sat, 05 Apr 2008) > New Revision: 24808 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24808&view=rev > > Modified: > haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp > Log: > Rene left tracing turned on in his last commit to this file. > Oops, sorry about that :) Thanks for fixing that. Rene From mmlr at mail.berlios.de Sat Apr 5 17:14:31 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 5 Apr 2008 17:14:31 +0200 Subject: [Haiku-commits] r24810 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200804051514.m35FEVJI017805@sheep.berlios.de> Author: mmlr Date: 2008-04-05 17:14:30 +0200 (Sat, 05 Apr 2008) New Revision: 24810 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24810&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp Log: Use a more reasonable timeout of 1 second for synchronous USB requests. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp 2008-04-05 12:24:11 UTC (rev 24809) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Pipe.cpp 2008-04-05 15:14:30 UTC (rev 24810) @@ -322,9 +322,9 @@ } // the sem will be released in the callback after the result data was - // filled into the provided struct. use a 5 seconds timeout to avoid + // filled into the provided struct. use a 1 second timeout to avoid // hanging applications. - if (acquire_sem_etc(transferResult->notify_sem, 1, B_RELATIVE_TIMEOUT, 5000000) < B_OK) { + if (acquire_sem_etc(transferResult->notify_sem, 1, B_RELATIVE_TIMEOUT, 1000000) < B_OK) { TRACE_ERROR(("USB ControlPipe: timeout waiting for queued request to complete\n")); delete_sem(transferResult->notify_sem); From mmlr at mail.berlios.de Sat Apr 5 18:42:45 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 5 Apr 2008 18:42:45 +0200 Subject: [Haiku-commits] r24811 - haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk Message-ID: <200804051642.m35GgjN7013603@sheep.berlios.de> Author: mmlr Date: 2008-04-05 18:42:34 +0200 (Sat, 05 Apr 2008) New Revision: 24811 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24811&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp Log: * Updating device->removed must be protected by the device lock * Also updating device->open_count must be protected by the device list lock This fixes the (unlikely) case where a device was removed from usb_disk standpoint while it still had an open read/write/ioctl operation. Modified: haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-05 15:14:30 UTC (rev 24810) +++ haiku/trunk/src/add-ons/kernel/drivers/disk/usb/usb_disk/usb_disk.cpp 2008-04-05 16:42:34 UTC (rev 24811) @@ -632,12 +632,14 @@ } gLunCount -= device->lun_count; gDeviceCount--; - benaphore_unlock(&gDeviceListLock); - device->device = 0; + benaphore_lock(&device->lock); device->removed = true; + benaphore_unlock(&device->lock); if (device->open_count == 0) usb_disk_free_device_and_luns(device); + + benaphore_unlock(&gDeviceListLock); return B_OK; } @@ -799,12 +801,13 @@ { device_lun *lun = (device_lun *)cookie; disk_device *device = lun->device; - if (device->removed) + benaphore_lock(&device->lock); + if (device->removed) { + benaphore_unlock(&device->lock); return B_DEV_NOT_READY; + } - benaphore_lock(&device->lock); status_t result = B_DEV_INVALID_IOCTL; - switch (op) { case B_GET_MEDIA_STATUS: { *(status_t *)buffer = usb_disk_test_unit_ready(lun); @@ -852,18 +855,19 @@ static status_t usb_disk_read(void *cookie, off_t position, void *buffer, size_t *length) { + if (buffer == NULL || length == NULL) + return B_BAD_VALUE; + TRACE("read(%lld, %ld)\n", position, *length); device_lun *lun = (device_lun *)cookie; disk_device *device = lun->device; + benaphore_lock(&device->lock); if (device->removed) { *length = 0; + benaphore_unlock(&device->lock); return B_DEV_NOT_READY; } - if (buffer == NULL || length == NULL) - return B_BAD_VALUE; - - benaphore_lock(&device->lock); status_t result = B_ERROR; uint32 blockPosition = 0; uint16 blockCount = 0; @@ -899,18 +903,19 @@ usb_disk_write(void *cookie, off_t position, const void *buffer, size_t *length) { + if (buffer == NULL || length == NULL) + return B_BAD_VALUE; + TRACE("write(%lld, %ld)\n", position, *length); device_lun *lun = (device_lun *)cookie; disk_device *device = lun->device; + benaphore_lock(&device->lock); if (device->removed) { *length = 0; + benaphore_unlock(&device->lock); return B_DEV_NOT_READY; } - if (buffer == NULL || length == NULL) - return B_BAD_VALUE; - - benaphore_lock(&device->lock); status_t result = B_ERROR; uint32 blockPosition = 0; uint16 blockCount = 0; From stippi at mail.berlios.de Sat Apr 5 23:16:19 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 5 Apr 2008 23:16:19 +0200 Subject: [Haiku-commits] r24812 - in haiku/trunk: headers/private/kernel headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/system/kernel src/tools Message-ID: <200804052116.m35LGJtJ002817@sheep.berlios.de> Author: stippi Date: 2008-04-05 23:15:43 +0200 (Sat, 05 Apr 2008) New Revision: 24812 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24812&view=rev Modified: haiku/trunk/headers/private/kernel/boot/images.h haiku/trunk/headers/private/kernel/boot/kernel_args.h haiku/trunk/headers/private/kernel/boot_splash.h haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp haiku/trunk/src/system/kernel/boot_splash.cpp haiku/trunk/src/system/kernel/main.c haiku/trunk/src/tools/generate_boot_screen.cpp Log: Patch by Philippe Saint-Pierre: * Implemented RLE compression for the boot splash images, resulting in smaller kernel and boot loader. * Only the boot loader contains the RLE compressed images, the decompressed buffer for the icons is passed to the kernel via kernel args. Modified: haiku/trunk/headers/private/kernel/boot/images.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/images.h 2008-04-05 16:42:34 UTC (rev 24811) +++ haiku/trunk/headers/private/kernel/boot/images.h 2008-04-05 21:15:43 UTC (rev 24812) @@ -5,15101 +5,5464 @@ static const int32 kSplashIconsPlacementX = 50; static const int32 kSplashIconsPlacementY = 50; +struct RLE_element +{ + uint16 count; + uint8 colorComponent; +}; + static const uint16 kSplashLogoWidth = 372; static const uint16 kSplashLogoHeight = 96; -static const uint8 kSplashLogoImage[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, - 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x03, 0x03, 0x03, - 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0b, 0x0b, 0x0b, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x10, 0x10, 0x10, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, - 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x06, 0x06, 0x06, 0x03, 0x03, 0x03, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0x04, 0x04, 0x03, 0x03, 0x03, 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, - 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, - 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, 0x0d, - 0x0d, 0x0d, 0x0d, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, 0x0c, - 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, - 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, 0x08, 0x08, 0x08, 0x03, 0x03, 0x03, - 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, - 0x06, 0x06, 0x06, 0x0b, 0x0b, 0x0b, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, - 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x10, 0x10, 0x10, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, 0x0f, - 0x0f, 0x0f, 0x0f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0b, 0x0b, 0x0b, 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, - 0x09, 0x09, 0x09, 0x0a, 0x0a, 0x0a, 0x07, 0x07, 0x07, 0x06, 0x06, 0x06, - 0x08, 0x08, 0x08, 0x04, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x04, - 0x08, 0x08, 0x08, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, 0x0a, 0x0a, 0x0a, - 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0b, 0x0b, 0x0b, 0x0d, 0x0d, 0x0d, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, - 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0e, 0x0d, 0x0d, 0x0d, 0x0c, 0x0c, 0x0c, - 0x0c, 0x0c, 0x0c, 0x0d, 0x0d, 0x0d, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, - 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x0a, 0x06, 0x06, 0x06, 0x07, 0x07, 0x07, - 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, 0x07, - 0x06, 0x06, 0x06, 0x0a, 0x0a, 0x0a, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, [... truncated: 19835 lines follow ...] From mmlr at mail.berlios.de Sun Apr 6 00:01:06 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 00:01:06 +0200 Subject: [Haiku-commits] r24813 - in haiku/trunk: headers/private/kernel src/system/kernel/fs Message-ID: <200804052201.m35M16t6006156@sheep.berlios.de> Author: mmlr Date: 2008-04-06 00:01:05 +0200 (Sun, 06 Apr 2008) New Revision: 24813 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24813&view=rev Modified: haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Introduce vfs_stat_entry_ref() that allows to stat a vnode based on a dev_t and ino_t instead of a path. Supposed to work with node monitoring messages. Took the name from vfs_entry_ref_to_path() that takes the same arguments, but suggestions for a better name are welcome. Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2008-04-05 21:15:43 UTC (rev 24812) +++ haiku/trunk/headers/private/kernel/vfs.h 2008-04-05 22:01:05 UTC (rev 24813) @@ -107,6 +107,7 @@ status_t vfs_get_fs_node_from_path(dev_t mountID, const char *path, bool kernel, void **_node); status_t vfs_stat_vnode(struct vnode *vnode, struct stat *stat); +status_t vfs_stat_entry_ref(dev_t device, ino_t inode, struct stat *stat); status_t vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize); status_t vfs_entry_ref_to_path(dev_t device, ino_t inode, const char *leaf, char *path, size_t pathLength); Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-05 21:15:43 UTC (rev 24812) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-05 22:01:05 UTC (rev 24813) @@ -3803,6 +3803,21 @@ status_t +vfs_stat_entry_ref(dev_t device, ino_t inode, struct stat *stat) +{ + struct vnode *vnode; + status_t status = get_vnode(device, inode, &vnode, true, false); + if (status < B_OK) + return status; + + status = FS_CALL(vnode, read_stat)(vnode->mount->cookie, + vnode->private_node, stat); + put_vnode(vnode); + return status; +} + + +status_t vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize) { return get_vnode_name(vnode, NULL, name, nameSize, true); From bonefish at mail.berlios.de Sun Apr 6 00:04:30 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 00:04:30 +0200 Subject: [Haiku-commits] r24814 - haiku/trunk/build/jam Message-ID: <200804052204.m35M4U37006394@sheep.berlios.de> Author: bonefish Date: 2008-04-06 00:04:28 +0200 (Sun, 06 Apr 2008) New Revision: 24814 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24814&view=rev Modified: haiku/trunk/build/jam/MainBuildRules Log: Pass "--no-undefined" to the linker when building a shared library for Haiku. Support for undefined symbols is nice in principle, but not really needed for building Haiku itself, and can get little annoying, if one really just forgot to link in a symbol or has a typo in a function name in C code. Modified: haiku/trunk/build/jam/MainBuildRules =================================================================== --- haiku/trunk/build/jam/MainBuildRules 2008-04-05 22:01:05 UTC (rev 24813) +++ haiku/trunk/build/jam/MainBuildRules 2008-04-05 22:04:28 UTC (rev 24814) @@ -397,7 +397,7 @@ MainFromObjects $(_lib) : $(2) ; LINKFLAGS on $(_lib) = [ on $(_lib) return $(LINKFLAGS) ] - -nostart -Xlinker -soname=\"$(_lib:G=)\" ; + -nostart -Xlinker --no-undefined -Xlinker -soname=\"$(_lib:G=)\" ; LinkAgainst $(_lib) : $(3) ; AddSharedObjectGlueCode $(_lib) : false ; From mmlr at mail.berlios.de Sun Apr 6 00:08:48 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 00:08:48 +0200 Subject: [Haiku-commits] r24815 - haiku/trunk/src/system/kernel/disk_device_manager Message-ID: <200804052208.m35M8mJm006618@sheep.berlios.de> Author: mmlr Date: 2008-04-06 00:08:47 +0200 (Sun, 06 Apr 2008) New Revision: 24815 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24815&view=rev Modified: haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp Log: * Replace the path based lstat in the device watcher with the new device/node based one. The path based version could not have worked for entry removed notifications at all as the node is removed from the directory at this point already * Forgot to delete the device watcher instance after removing all monitors * The PartitionRegistrar in DeleteDevice() was set to already locked which is not the case * Someone probably forgot to add a PartitionRegistrar to the media checker - it did register the device on each run but never actually unregistered it, which obviously messed up the reference counting a bit Modified: haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp =================================================================== --- haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp 2008-04-05 22:04:28 UTC (rev 24814) +++ haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp 2008-04-05 22:08:47 UTC (rev 24815) @@ -117,17 +117,8 @@ ino_t directory = event->GetInt64("directory", -1); ino_t node = event->GetInt64("node", -1); - // TODO: it would be nice if we could stat based on the - // node here instead of having to resolve the path - KPath path(B_PATH_NAME_LENGTH + 1); - if (path.InitCheck() != B_OK - || vfs_entry_ref_to_path(device, directory, name, - path.LockBuffer(), path.BufferSize()) != B_OK) - break; - path.UnlockBuffer(); - struct stat st; - if (lstat(path.Path(), &st) != 0) + if (vfs_stat_entry_ref(device, node, &st) != 0) break; if (S_ISDIR(st.st_mode)) { @@ -139,6 +130,15 @@ } else { if (strcmp(name, "raw") == 0) { // a new raw device was added/removed + KPath path(B_PATH_NAME_LENGTH + 1); + if (path.InitCheck() != B_OK + || vfs_entry_ref_to_path(device, directory, + name, path.LockBuffer(), + path.BufferSize()) != B_OK) { + break; + } + path.UnlockBuffer(); + if (opCode == B_ENTRY_CREATED) fManager->CreateDevice(path.Path()); else @@ -204,6 +204,7 @@ // stop all node monitoring _AddRemoveMonitoring("/dev/disk", false); + delete fDeviceWatcher; // remove all devices for (int32 cookie = 0; KDiskDevice *device = NextDevice(&cookie);) { @@ -626,7 +627,7 @@ if (device == NULL) return B_ENTRY_NOT_FOUND; - PartitionRegistrar _(device, true); + PartitionRegistrar _(device, false); if (DeviceWriteLocker locker = device) { if (_RemoveDevice(device)) return B_OK; @@ -1336,6 +1337,7 @@ while (!fTerminating) { int32 cookie = 0; while (KDiskDevice* device = RegisterNextDevice(&cookie)) { + PartitionRegistrar _(device, true); DeviceWriteLocker locker(device); if (device->IsBusy(true)) From bonefish at mail.berlios.de Sun Apr 6 01:05:20 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 01:05:20 +0200 Subject: [Haiku-commits] r24816 - in haiku/trunk: build/jam headers/os/drivers headers/private/fs_shell headers/private/kernel src/add-ons/kernel/file_systems/bfs src/system/kernel/fs src/system/libroot/posix/sys src/tools/fs_shell Message-ID: <200804052305.m35N5KpM020495@sheep.berlios.de> Author: bonefish Date: 2008-04-06 01:05:16 +0200 (Sun, 06 Apr 2008) New Revision: 24816 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24816&view=rev Added: haiku/trunk/src/system/kernel/fs/fifo.h Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/headers/os/drivers/fs_interface.h haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h haiku/trunk/headers/private/kernel/syscalls.h haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp 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/Volume.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/bfs.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp haiku/trunk/src/system/kernel/fs/devfs.cpp haiku/trunk/src/system/kernel/fs/pipefs.cpp haiku/trunk/src/system/kernel/fs/rootfs.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/libroot/posix/sys/mkfifo.c haiku/trunk/src/tools/fs_shell/vfs.cpp Log: * Reorganized the FS interface a little: - Moved most file_system_module_info hooks into separate structures. Those that operate on mounted volumes to fs_volume_ops, those operating on a vnode to fs_vnode_ops. - Got rid of the fs_volume, fs_cookie, fs_vnode typedefs. We use void* again. - Instead of a void* volume and node cookie hooks are passed a fs_volume and fs_vnode structure pointer, which contain the cookie and an ops pointer (fs_volume a few more things). - The VFS {new,publish,get,...}_vnode() functions take a fs_volume* instead of the volume ID. So does vfs_get_fs_node_from_path(). - Added type and flags arguments to publish_vnode() and the get_vnode() hook and removed the type argument from lookup() hook. Added vnode::type using formerly unused bits to store the node type. Simplified a few things in the VFS due to the now always available node type. - Added fs_volume_ops::{create,delete}_sub_vnode() and fs_vnode_ops::get_super_vnode() hooks. They are used to support file system layers, e.g. allowing to extend an FS not supporting BeOS attribute with attribute support. Needs some more work in the VFS. - Added fs_vnode_ops::create_special_node() hook for creating special nodes (e.g. FIFOs). * Adjusted the built-in file systems and BFS according to the interface changes. Removed all other FSs from the image for the time being. We'll see whether further API changes are necessary before porting them. * Adjusted the bfs_shell accordingly. * Implemented create_special_node() in rootfs to support special nodes. * Added support for FIFOs: - Added syscall _kern_create_fifo() (used by mkfifo()), which creates a special node (type S_IFIFO) in the respective file system. - When a special node is published the VFS creates a respective sub node. Currently only FIFOs are supported. - Added a little support for FIFO subnodes by using functionality from the pipefs. - Added mkfifo to the image. It can create FIFOs in the rootfs, but the FIFOs aren't really usable ATM, since they still work like pipes, i.e. readers and writers need to have them open at the same time. * Some smaller changes in the VFS: - Made the *_CALL macros nicer to use (vargs). - Refactored FS entry lookup into new function lookup_dir_entry(). - create_vnode() no longer just calls the FS create() hook. First it looks up the entry and uses open_vnode(), if it already exists. This is necessary for two reasons: 1) The FS might not support create() while still allowing to open() entries. 2) When the FS has other layers on to of it (or the respective node) it might not be responsible for opening the node. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/build/jam/HaikuImage 2008-04-05 23:05:16 UTC (rev 24816) @@ -35,7 +35,7 @@ ideinfo idestatus ifconfig install installsound iroster isvolume join keymap kill less lessecho lesskey link listarea listattr listdev listimage listport listres listsem ln locate logger login logname ls lsindex m4 make - makebootable md5sum merge mimeset mkdos mkdir mkindex modifiers mount + makebootable md5sum merge mimeset mkdos mkdir mkfifo mkindex modifiers mount mount_nfs mountvolume mv nc netstat nl nohup od open paste patch pathchk pc ping play playfile playsound playwav pr prio printenv printf ps ptx pwd query quit readlink release renice rescan rlog rm rmattr rmindex rmdir roster route @@ -134,7 +134,8 @@ BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi config_manager agp_gart usb firewire ; -BEOS_ADD_ONS_FILE_SYSTEMS = bfs cdda fat googlefs iso9660 nfs $(GPL_ONLY)ntfs ; +BEOS_ADD_ONS_FILE_SYSTEMS = bfs ; +#cdda fat googlefs iso9660 nfs $(GPL_ONLY)ntfs ; # modules Modified: haiku/trunk/headers/os/drivers/fs_interface.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_interface.h 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/headers/os/drivers/fs_interface.h 2008-04-05 23:05:16 UTC (rev 24816) @@ -21,11 +21,6 @@ struct fs_info; struct select_sync; -/* the file system's private data structures */ -typedef void *fs_volume; -typedef void *fs_cookie; -typedef void *fs_vnode; - /* additional flags passed to write_stat() (see NodeMonitor.h for the others) */ // NOTE: Changing the constants here or in NodeMonitor.h will break // src/kits/storage/LibBeAdapter.cpp:_kern_write_stat(). @@ -42,162 +37,217 @@ #define B_CURRENT_FS_API_VERSION "/v1" +// 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 + + #ifdef __cplusplus extern "C" { #endif -typedef struct file_system_module_info { - struct module_info info; - const char* pretty_name; - uint32 flags; // DDM flags +typedef struct fs_volume fs_volume; +typedef struct fs_volume_ops fs_volume_ops; +typedef struct fs_vnode fs_vnode; +typedef struct fs_vnode_ops fs_vnode_ops; - /* scanning (the device is write locked) */ - float (*identify_partition)(int fd, partition_data *partition, - void **cookie); - status_t (*scan_partition)(int fd, partition_data *partition, - void *cookie); - void (*free_identify_partition_cookie)(partition_data *partition, - void *cookie); - void (*free_partition_content_cookie)(partition_data *partition); - /* general operations */ - status_t (*mount)(dev_t id, const char *device, uint32 flags, - const char *args, fs_volume *_fs, ino_t *_rootVnodeID); - status_t (*unmount)(fs_volume fs); +struct fs_volume { + dev_t id; + int32 layer; + void* private_volume; + fs_volume_ops* ops; + fs_volume* sub_volume; + fs_volume* super_volume; +}; - status_t (*read_fs_info)(fs_volume fs, struct fs_info *info); - status_t (*write_fs_info)(fs_volume fs, const struct fs_info *info, +struct fs_vnode { + void* private_node; + fs_vnode_ops* ops; +}; + +struct fs_volume_ops { + status_t (*unmount)(fs_volume *volume); + + status_t (*read_fs_info)(fs_volume *volume, struct fs_info *info); + status_t (*write_fs_info)(fs_volume *volume, const struct fs_info *info, uint32 mask); - status_t (*sync)(fs_volume fs); + status_t (*sync)(fs_volume *volume); + status_t (*get_vnode)(fs_volume *volume, ino_t id, fs_vnode *vnode, + int *_type, uint32 *_flags, bool reenter); + + /* index directory & index operations */ + status_t (*open_index_dir)(fs_volume *volume, void **cookie); + status_t (*close_index_dir)(fs_volume *volume, void *cookie); + status_t (*free_index_dir_cookie)(fs_volume *volume, void *cookie); + status_t (*read_index_dir)(fs_volume *volume, void *cookie, + struct dirent *buffer, size_t bufferSize, uint32 *_num); + status_t (*rewind_index_dir)(fs_volume *volume, void *cookie); + + status_t (*create_index)(fs_volume *volume, const char *name, uint32 type, + uint32 flags); + status_t (*remove_index)(fs_volume *volume, const char *name); + status_t (*read_index_stat)(fs_volume *volume, const char *name, + struct stat *stat); + + /* query operations */ + status_t (*open_query)(fs_volume *volume, const char *query, uint32 flags, + port_id port, uint32 token, void **_cookie); + status_t (*close_query)(fs_volume *volume, void *cookie); + status_t (*free_query_cookie)(fs_volume *volume, void *cookie); + status_t (*read_query)(fs_volume *volume, void *cookie, + struct dirent *buffer, size_t bufferSize, uint32 *_num); + status_t (*rewind_query)(fs_volume *volume, void *cookie); + + /* support for FS layers */ + 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); +}; + +struct fs_vnode_ops { /* vnode operations */ - status_t (*lookup)(fs_volume fs, fs_vnode dir, const char *name, - ino_t *_id, int *_type); - status_t (*get_vnode_name)(fs_volume fs, fs_vnode vnode, char *buffer, + status_t (*lookup)(fs_volume *volume, fs_vnode *dir, const char *name, + ino_t *_id); + status_t (*get_vnode_name)(fs_volume *volume, fs_vnode *vnode, char *buffer, size_t bufferSize); - status_t (*get_vnode)(fs_volume fs, ino_t id, fs_vnode *_vnode, - bool reenter); - status_t (*put_vnode)(fs_volume fs, fs_vnode vnode, bool reenter); - status_t (*remove_vnode)(fs_volume fs, fs_vnode vnode, bool reenter); + status_t (*put_vnode)(fs_volume *volume, fs_vnode *vnode, bool reenter); + status_t (*remove_vnode)(fs_volume *volume, fs_vnode *vnode, bool reenter); /* VM file access */ - bool (*can_page)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + bool (*can_page)(fs_volume *volume, fs_vnode *vnode, void *cookie); + status_t (*read_pages)(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter); - status_t (*write_pages)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, - bool reenter); + status_t (*write_pages)(fs_volume *volume, fs_vnode *vnode, + void *cookie, off_t pos, const iovec *vecs, size_t count, + size_t *_numBytes, bool reenter); /* cache file access */ - status_t (*get_file_map)(fs_volume fs, fs_vnode vnode, off_t offset, + status_t (*get_file_map)(fs_volume *volume, fs_vnode *vnode, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count); /* common operations */ - status_t (*ioctl)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, ulong op, - void *buffer, size_t length); - status_t (*set_flags)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + status_t (*ioctl)(fs_volume *volume, fs_vnode *vnode, void *cookie, + ulong op, void *buffer, size_t length); + status_t (*set_flags)(fs_volume *volume, fs_vnode *vnode, void *cookie, int flags); - status_t (*select)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + status_t (*select)(fs_volume *volume, fs_vnode *vnode, void *cookie, uint8 event, uint32 ref, selectsync *sync); - status_t (*deselect)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + status_t (*deselect)(fs_volume *volume, fs_vnode *vnode, void *cookie, uint8 event, selectsync *sync); - status_t (*fsync)(fs_volume fs, fs_vnode vnode); + status_t (*fsync)(fs_volume *volume, fs_vnode *vnode); - status_t (*read_symlink)(fs_volume fs, fs_vnode link, char *buffer, + status_t (*read_symlink)(fs_volume *volume, fs_vnode *link, char *buffer, size_t *_bufferSize); - status_t (*create_symlink)(fs_volume fs, fs_vnode dir, const char *name, - const char *path, int mode); + status_t (*create_symlink)(fs_volume *volume, fs_vnode *dir, + const char *name, const char *path, int mode); - status_t (*link)(fs_volume fs, fs_vnode dir, const char *name, - fs_vnode vnode); - status_t (*unlink)(fs_volume fs, fs_vnode dir, const char *name); - status_t (*rename)(fs_volume fs, fs_vnode fromDir, const char *fromName, - fs_vnode toDir, const char *toName); + status_t (*link)(fs_volume *volume, fs_vnode *dir, const char *name, + fs_vnode *vnode); + status_t (*unlink)(fs_volume *volume, fs_vnode *dir, const char *name); + status_t (*rename)(fs_volume *volume, fs_vnode *fromDir, + const char *fromName, fs_vnode *toDir, const char *toName); - status_t (*access)(fs_volume fs, fs_vnode vnode, int mode); - status_t (*read_stat)(fs_volume fs, fs_vnode vnode, struct stat *stat); - status_t (*write_stat)(fs_volume fs, fs_vnode vnode, + status_t (*access)(fs_volume *volume, fs_vnode *vnode, int mode); + status_t (*read_stat)(fs_volume *volume, fs_vnode *vnode, + struct stat *stat); + status_t (*write_stat)(fs_volume *volume, fs_vnode *vnode, const struct stat *stat, uint32 statMask); /* file operations */ - status_t (*create)(fs_volume fs, fs_vnode dir, const char *name, - int openMode, int perms, fs_cookie *_cookie, + status_t (*create)(fs_volume *volume, fs_vnode *dir, const char *name, + int openMode, int perms, void **_cookie, ino_t *_newVnodeID); - status_t (*open)(fs_volume fs, fs_vnode vnode, int openMode, - fs_cookie *_cookie); - status_t (*close)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*free_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, - void *buffer, size_t *length); - status_t (*write)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, off_t pos, - const void *buffer, size_t *length); + status_t (*open)(fs_volume *volume, fs_vnode *vnode, int openMode, + void **_cookie); + status_t (*close)(fs_volume *volume, fs_vnode *vnode, void *cookie); + status_t (*free_cookie)(fs_volume *volume, fs_vnode *vnode, + void *cookie); + status_t (*read)(fs_volume *volume, fs_vnode *vnode, void *cookie, + off_t pos, void *buffer, size_t *length); + status_t (*write)(fs_volume *volume, fs_vnode *vnode, void *cookie, + off_t pos, const void *buffer, size_t *length); /* directory operations */ - status_t (*create_dir)(fs_volume fs, fs_vnode parent, const char *name, - int perms, ino_t *_newVnodeID); - status_t (*remove_dir)(fs_volume fs, fs_vnode parent, const char *name); - status_t (*open_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie); - status_t (*close_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*free_dir_cookie)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*read_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + status_t (*create_dir)(fs_volume *volume, fs_vnode *parent, + const char *name, int perms, ino_t *_newVnodeID); + status_t (*remove_dir)(fs_volume *volume, fs_vnode *parent, + const char *name); + status_t (*open_dir)(fs_volume *volume, fs_vnode *vnode, + void **_cookie); + status_t (*close_dir)(fs_volume *volume, fs_vnode *vnode, void *cookie); + status_t (*free_dir_cookie)(fs_volume *volume, fs_vnode *vnode, + void *cookie); + status_t (*read_dir)(fs_volume *volume, fs_vnode *vnode, void *cookie, struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); + status_t (*rewind_dir)(fs_volume *volume, fs_vnode *vnode, + void *cookie); /* attribute directory operations */ - status_t (*open_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie *_cookie); - status_t (*close_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*free_attr_dir_cookie)(fs_volume fs, fs_vnode vnode, - fs_cookie cookie); - status_t (*read_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_attr_dir)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); + status_t (*open_attr_dir)(fs_volume *volume, fs_vnode *vnode, + void **_cookie); + status_t (*close_attr_dir)(fs_volume *volume, fs_vnode *vnode, + void *cookie); + status_t (*free_attr_dir_cookie)(fs_volume *volume, fs_vnode *vnode, + void *cookie); + status_t (*read_attr_dir)(fs_volume *volume, fs_vnode *vnode, + void *cookie, struct dirent *buffer, size_t bufferSize, + uint32 *_num); + status_t (*rewind_attr_dir)(fs_volume *volume, fs_vnode *vnode, + void *cookie); /* attribute operations */ - status_t (*create_attr)(fs_volume fs, fs_vnode vnode, const char *name, - uint32 type, int openMode, fs_cookie *_cookie); - status_t (*open_attr)(fs_volume fs, fs_vnode vnode, const char *name, - int openMode, fs_cookie *_cookie); - status_t (*close_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie); - status_t (*free_attr_cookie)(fs_volume fs, fs_vnode vnode, - fs_cookie cookie); - status_t (*read_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + status_t (*create_attr)(fs_volume *volume, fs_vnode *vnode, + const char *name, uint32 type, int openMode, + void **_cookie); + status_t (*open_attr)(fs_volume *volume, fs_vnode *vnode, const char *name, + int openMode, void **_cookie); + status_t (*close_attr)(fs_volume *volume, fs_vnode *vnode, + void *cookie); + status_t (*free_attr_cookie)(fs_volume *volume, fs_vnode *vnode, + void *cookie); + status_t (*read_attr)(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, void *buffer, size_t *length); - status_t (*write_attr)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, + status_t (*write_attr)(fs_volume *volume, fs_vnode *vnode, void *cookie, off_t pos, const void *buffer, size_t *length); - status_t (*read_attr_stat)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - struct stat *stat); - status_t (*write_attr_stat)(fs_volume fs, fs_vnode vnode, fs_cookie cookie, - const struct stat *stat, int statMask); - status_t (*rename_attr)(fs_volume fs, fs_vnode fromVnode, - const char *fromName, fs_vnode toVnode, const char *toName); - status_t (*remove_attr)(fs_volume fs, fs_vnode vnode, const char *name); + status_t (*read_attr_stat)(fs_volume *volume, fs_vnode *vnode, + void *cookie, struct stat *stat); + status_t (*write_attr_stat)(fs_volume *volume, fs_vnode *vnode, + void *cookie, const struct stat *stat, int statMask); + status_t (*rename_attr)(fs_volume *volume, fs_vnode *fromVnode, + const char *fromName, fs_vnode *toVnode, const char *toName); + status_t (*remove_attr)(fs_volume *volume, fs_vnode *vnode, + const char *name); - /* index directory & index operations */ - status_t (*open_index_dir)(fs_volume fs, fs_cookie *cookie); - status_t (*close_index_dir)(fs_volume fs, fs_cookie cookie); - status_t (*free_index_dir_cookie)(fs_volume fs, fs_cookie cookie); - status_t (*read_index_dir)(fs_volume fs, fs_cookie cookie, - struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_index_dir)(fs_volume fs, fs_cookie cookie); + /* support for node and FS layers */ + status_t (*create_special_node)(fs_volume *volume, fs_vnode *dir, + const char *name, fs_vnode *subVnode, mode_t mode, uint32 flags, + fs_vnode *_superVnode, ino_t *_nodeID); + status_t (*get_super_vnode)(fs_volume *volume, fs_vnode *vnode, + fs_volume *superVolume, fs_vnode *superVnode); +}; - status_t (*create_index)(fs_volume fs, const char *name, uint32 type, - uint32 flags); - status_t (*remove_index)(fs_volume fs, const char *name); - status_t (*read_index_stat)(fs_volume fs, const char *name, - struct stat *stat); +typedef struct file_system_module_info { + struct module_info info; + const char* pretty_name; + uint32 flags; // DDM flags - /* query operations */ - status_t (*open_query)(fs_volume fs, const char *query, uint32 flags, - port_id port, uint32 token, fs_cookie *_cookie); - status_t (*close_query)(fs_volume fs, fs_cookie cookie); - status_t (*free_query_cookie)(fs_volume fs, fs_cookie cookie); - status_t (*read_query)(fs_volume fs, fs_cookie cookie, - struct dirent *buffer, size_t bufferSize, uint32 *_num); - status_t (*rewind_query)(fs_volume fs, fs_cookie cookie); + /* scanning (the device is write locked) */ + float (*identify_partition)(int fd, partition_data *partition, + void **cookie); + status_t (*scan_partition)(int fd, partition_data *partition, + void *cookie); + void (*free_identify_partition_cookie)(partition_data *partition, + void *cookie); + void (*free_partition_content_cookie)(partition_data *partition); + /* general operations */ + status_t (*mount)(fs_volume *volume, const char *device, uint32 flags, + const char *args, ino_t *_rootVnodeID); + /* capability querying (the device is read locked) */ uint32 (*get_supported_operations)(partition_data* partition, uint32 mask); @@ -233,17 +283,19 @@ /* file system add-ons only prototypes */ -extern status_t new_vnode(dev_t mountID, ino_t vnodeID, - fs_vnode privateNode); -extern status_t publish_vnode(dev_t mountID, ino_t vnodeID, - fs_vnode privateNode); -extern status_t get_vnode(dev_t mountID, ino_t vnodeID, - fs_vnode *_privateNode); -extern status_t put_vnode(dev_t mountID, ino_t vnodeID); -extern status_t remove_vnode(dev_t mountID, ino_t vnodeID); -extern status_t unremove_vnode(dev_t mountID, ino_t vnodeID); -extern status_t get_vnode_removed(dev_t mountID, ino_t vnodeID, - bool* removed); +extern status_t new_vnode(fs_volume *volume, ino_t vnodeID, void *privateNode, + fs_vnode_ops *ops); +extern status_t publish_vnode(fs_volume *volume, ino_t vnodeID, + void *privateNode, fs_vnode_ops *ops, int type, + uint32 flags); +extern status_t get_vnode(fs_volume *volume, ino_t vnodeID, + void **_privateNode); +extern status_t put_vnode(fs_volume *volume, ino_t vnodeID); +extern status_t remove_vnode(fs_volume *volume, ino_t vnodeID); +extern status_t unremove_vnode(fs_volume *volume, ino_t vnodeID); +extern status_t get_vnode_removed(fs_volume *volume, ino_t vnodeID, + bool *removed); + extern status_t read_pages(int fd, off_t pos, const struct iovec *vecs, size_t count, size_t *_numBytes, bool fsReenter); extern status_t write_pages(int fd, off_t pos, const struct iovec *vecs, @@ -257,10 +309,6 @@ const struct iovec *vecs, size_t vecCount, uint32 *_vecIndex, size_t *_vecOffset, size_t *_bytes); -// Deprecated! Will disappear soon! -extern status_t notify_listener(int op, dev_t device, ino_t parentNode, - ino_t toParentNode, ino_t node, const char *name); - extern status_t notify_entry_created(dev_t device, ino_t directory, const char *name, ino_t node); extern status_t notify_entry_removed(dev_t device, ino_t directory, Modified: haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-04-05 23:05:16 UTC (rev 24816) @@ -870,11 +870,6 @@ #define mount_id fssh_mount_id #define vnode_id fssh_vnode_id -/* the file system's private data structures */ -#define fs_volume fssh_fs_volume -#define fs_cookie fssh_fs_cookie -#define fs_vnode fssh_fs_vnode - /* additional flags passed to write_stat() */ #define B_STAT_SIZE_INSECURE FSSH_B_STAT_SIZE_INSECURE @@ -885,6 +880,14 @@ #define B_CURRENT_FS_API_VERSION FSSH_B_CURRENT_FS_API_VERSION +// flags for publish_vnode() and fs_volume_ops::get_vnode() +#define B_VNODE_PUBLISH_REMOVED FSSH_B_VNODE_PUBLISH_REMOVED +#define B_VNODE_DONT_CREATE_SPECIAL_SUB_NODE FSSH_B_VNODE_DONT_CREATE_SPECIAL_SUB_NODE + +#define fs_volume fssh_fs_volume +#define fs_volume_ops fssh_fs_volume_ops +#define fs_vnode fssh_fs_vnode +#define fs_vnode_ops fssh_fs_vnode_ops #define file_system_module_info fssh_file_system_module_info Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/headers/private/fs_shell/fssh_fs_interface.h 2008-04-05 23:05:16 UTC (rev 24816) @@ -24,9 +24,7 @@ typedef fssh_ino_t fssh_vnode_id; /* the file system's private data structures */ -typedef void *fssh_fs_volume; typedef void *fssh_fs_cookie; -typedef void *fssh_fs_vnode; /* additional flags passed to write_stat() */ #define FSSH_B_STAT_SIZE_INSECURE 0x2000 @@ -41,197 +39,250 @@ #define FSSH_B_CURRENT_FS_API_VERSION "/v1" +// flags for publish_vnode() and fs_volume_ops::get_vnode() +#define FSSH_B_VNODE_PUBLISH_REMOVED 0x01 +#define FSSH_B_VNODE_DONT_CREATE_SPECIAL_SUB_NODE 0x02 + + #ifdef __cplusplus extern "C" { #endif -typedef struct fssh_file_system_module_info { - struct fssh_module_info info; - const char* pretty_name; - uint32_t flags; // DDM flags +typedef struct fssh_fs_volume fssh_fs_volume; +typedef struct fssh_fs_volume_ops fssh_fs_volume_ops; +typedef struct fssh_fs_vnode fssh_fs_vnode; +typedef struct fssh_fs_vnode_ops fssh_fs_vnode_ops; - /* scanning (the device is write locked) */ - float (*identify_partition)(int fd, fssh_partition_data *partition, - void **cookie); - fssh_status_t (*scan_partition)(int fd, fssh_partition_data *partition, - void *cookie); - void (*free_identify_partition_cookie)(fssh_partition_data *partition, - void *cookie); - void (*free_partition_content_cookie)(fssh_partition_data *partition); - /* general operations */ - fssh_status_t (*mount)(fssh_mount_id id, const char *device, uint32_t flags, - const char *args, fssh_fs_volume *_fs, - fssh_vnode_id *_rootVnodeID); - fssh_status_t (*unmount)(fssh_fs_volume fs); +struct fssh_fs_volume { + fssh_dev_t id; + int32_t layer; + void* private_volume; + fssh_fs_volume_ops* ops; + fssh_fs_volume* sub_volume; + fssh_fs_volume* super_volume; +}; - fssh_status_t (*read_fs_info)(fssh_fs_volume fs, struct fssh_fs_info *info); - fssh_status_t (*write_fs_info)(fssh_fs_volume fs, +struct fssh_fs_vnode { + void* private_node; + fssh_fs_vnode_ops* ops; +}; + +struct fssh_fs_volume_ops { + fssh_status_t (*unmount)(fssh_fs_volume *volume); + + fssh_status_t (*read_fs_info)(fssh_fs_volume *volume, + struct fssh_fs_info *info); + fssh_status_t (*write_fs_info)(fssh_fs_volume *volume, const struct fssh_fs_info *info, uint32_t mask); - fssh_status_t (*sync)(fssh_fs_volume fs); + fssh_status_t (*sync)(fssh_fs_volume *volume); + fssh_status_t (*get_vnode)(fssh_fs_volume *volume, fssh_vnode_id id, + fssh_fs_vnode *_vnode, int *_type, uint32_t *_flags, + bool reenter); + + /* index directory & index operations */ + fssh_status_t (*open_index_dir)(fssh_fs_volume *volume, + fssh_fs_cookie *cookie); + fssh_status_t (*close_index_dir)(fssh_fs_volume *volume, + fssh_fs_cookie cookie); + fssh_status_t (*free_index_dir_cookie)(fssh_fs_volume *volume, + fssh_fs_cookie cookie); + fssh_status_t (*read_index_dir)(fssh_fs_volume *volume, + fssh_fs_cookie cookie, struct fssh_dirent *buffer, + fssh_size_t bufferSize, uint32_t *_num); + fssh_status_t (*rewind_index_dir)(fssh_fs_volume *volume, + fssh_fs_cookie cookie); + + fssh_status_t (*create_index)(fssh_fs_volume *volume, const char *name, + uint32_t type, uint32_t flags); + fssh_status_t (*remove_index)(fssh_fs_volume *volume, const char *name); + fssh_status_t (*read_index_stat)(fssh_fs_volume *volume, const char *name, + struct fssh_stat *stat); + + /* query operations */ + fssh_status_t (*open_query)(fssh_fs_volume *volume, const char *query, + uint32_t flags, fssh_port_id port, uint32_t token, + fssh_fs_cookie *_cookie); + fssh_status_t (*close_query)(fssh_fs_volume *volume, fssh_fs_cookie cookie); + fssh_status_t (*free_query_cookie)(fssh_fs_volume *volume, + fssh_fs_cookie cookie); + fssh_status_t (*read_query)(fssh_fs_volume *volume, fssh_fs_cookie cookie, + struct fssh_dirent *buffer, fssh_size_t bufferSize, + uint32_t *_num); + fssh_status_t (*rewind_query)(fssh_fs_volume *volume, + fssh_fs_cookie cookie); + + /* support for FS layers */ + fssh_status_t (*create_sub_vnode)(fssh_fs_volume *volume, fssh_ino_t id, + fssh_fs_vnode *vnode); + fssh_status_t (*delete_sub_vnode)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode); +}; + +struct fssh_fs_vnode_ops { /* vnode operations */ - fssh_status_t (*lookup)(fssh_fs_volume fs, fssh_fs_vnode dir, - const char *name, fssh_vnode_id *_id, int *_type); - fssh_status_t (*get_vnode_name)(fssh_fs_volume fs, fssh_fs_vnode vnode, - char *buffer, fssh_size_t bufferSize); + fssh_status_t (*lookup)(fssh_fs_volume *volume, fssh_fs_vnode *dir, + const char *name, fssh_vnode_id *_id); + fssh_status_t (*get_vnode_name)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, char *buffer, fssh_size_t bufferSize); - fssh_status_t (*get_vnode)(fssh_fs_volume fs, fssh_vnode_id id, - fssh_fs_vnode *_vnode, bool reenter); - fssh_status_t (*put_vnode)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*put_vnode)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, bool reenter); - fssh_status_t (*remove_vnode)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*remove_vnode)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, bool reenter); /* VM file access */ - bool (*can_page)(fssh_fs_volume fs, fssh_fs_vnode vnode, + bool (*can_page)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie); - fssh_status_t (*read_pages)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*read_pages)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, fssh_off_t pos, const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes, bool reenter); - fssh_status_t (*write_pages)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*write_pages)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, fssh_off_t pos, const fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes, bool reenter); /* cache file access */ - fssh_status_t (*get_file_map)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*get_file_map)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_off_t offset, fssh_size_t size, struct fssh_file_io_vec *vecs, fssh_size_t *_count); /* common operations */ - fssh_status_t (*ioctl)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*ioctl)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, fssh_ulong op, void *buffer, fssh_size_t length); - fssh_status_t (*set_flags)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*set_flags)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, int flags); - fssh_status_t (*select)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*select)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, uint8_t event, uint32_t ref, fssh_selectsync *sync); - fssh_status_t (*deselect)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*deselect)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, uint8_t event, fssh_selectsync *sync); - fssh_status_t (*fsync)(fssh_fs_volume fs, fssh_fs_vnode vnode); + fssh_status_t (*fsync)(fssh_fs_volume *volume, fssh_fs_vnode *vnode); - fssh_status_t (*read_symlink)(fssh_fs_volume fs, fssh_fs_vnode link, + fssh_status_t (*read_symlink)(fssh_fs_volume *volume, fssh_fs_vnode *link, char *buffer, fssh_size_t *_bufferSize); - fssh_status_t (*create_symlink)(fssh_fs_volume fs, fssh_fs_vnode dir, + fssh_status_t (*create_symlink)(fssh_fs_volume *volume, fssh_fs_vnode *dir, const char *name, const char *path, int mode); - fssh_status_t (*link)(fssh_fs_volume fs, fssh_fs_vnode dir, - const char *name, fssh_fs_vnode vnode); - fssh_status_t (*unlink)(fssh_fs_volume fs, fssh_fs_vnode dir, + fssh_status_t (*link)(fssh_fs_volume *volume, fssh_fs_vnode *dir, + const char *name, fssh_fs_vnode *vnode); + fssh_status_t (*unlink)(fssh_fs_volume *volume, fssh_fs_vnode *dir, const char *name); - fssh_status_t (*rename)(fssh_fs_volume fs, fssh_fs_vnode fromDir, - const char *fromName, fssh_fs_vnode toDir, const char *toName); + fssh_status_t (*rename)(fssh_fs_volume *volume, fssh_fs_vnode *fromDir, + const char *fromName, fssh_fs_vnode *toDir, const char *toName); - fssh_status_t (*access)(fssh_fs_volume fs, fssh_fs_vnode vnode, int mode); - fssh_status_t (*read_stat)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*access)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, + int mode); + fssh_status_t (*read_stat)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, struct fssh_stat *stat); - fssh_status_t (*write_stat)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*write_stat)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, const struct fssh_stat *stat, uint32_t statMask); /* file operations */ - fssh_status_t (*create)(fssh_fs_volume fs, fssh_fs_vnode dir, + fssh_status_t (*create)(fssh_fs_volume *volume, fssh_fs_vnode *dir, const char *name, int openMode, int perms, fssh_fs_cookie *_cookie, fssh_vnode_id *_newVnodeID); - fssh_status_t (*open)(fssh_fs_volume fs, fssh_fs_vnode vnode, int openMode, - fssh_fs_cookie *_cookie); - fssh_status_t (*close)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*open)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, + int openMode, fssh_fs_cookie *_cookie); + fssh_status_t (*close)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie); - fssh_status_t (*free_cookie)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*free_cookie)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie); - fssh_status_t (*read)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*read)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, fssh_off_t pos, void *buffer, fssh_size_t *length); - fssh_status_t (*write)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*write)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, fssh_off_t pos, const void *buffer, fssh_size_t *length); /* directory operations */ - fssh_status_t (*create_dir)(fssh_fs_volume fs, fssh_fs_vnode parent, + fssh_status_t (*create_dir)(fssh_fs_volume *volume, fssh_fs_vnode *parent, const char *name, int perms, fssh_vnode_id *_newVnodeID); - fssh_status_t (*remove_dir)(fssh_fs_volume fs, fssh_fs_vnode parent, + fssh_status_t (*remove_dir)(fssh_fs_volume *volume, fssh_fs_vnode *parent, const char *name); - fssh_status_t (*open_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*open_dir)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie *_cookie); - fssh_status_t (*close_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*close_dir)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie); - fssh_status_t (*free_dir_cookie)(fssh_fs_volume fs, fssh_fs_vnode vnode, - fssh_fs_cookie cookie); - fssh_status_t (*read_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*free_dir_cookie)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_cookie cookie); + fssh_status_t (*read_dir)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, struct fssh_dirent *buffer, fssh_size_t bufferSize, uint32_t *_num); - fssh_status_t (*rewind_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*rewind_dir)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie); /* attribute directory operations */ - fssh_status_t (*open_attr_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*open_attr_dir)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie *_cookie); - fssh_status_t (*close_attr_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, - fssh_fs_cookie cookie); - fssh_status_t (*free_attr_dir_cookie)(fssh_fs_volume fs, - fssh_fs_vnode vnode, fssh_fs_cookie cookie); - fssh_status_t (*read_attr_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*close_attr_dir)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_cookie cookie); + fssh_status_t (*free_attr_dir_cookie)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_cookie cookie); + fssh_status_t (*read_attr_dir)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, struct fssh_dirent *buffer, fssh_size_t bufferSize, uint32_t *_num); - fssh_status_t (*rewind_attr_dir)(fssh_fs_volume fs, fssh_fs_vnode vnode, - fssh_fs_cookie cookie); + fssh_status_t (*rewind_attr_dir)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_cookie cookie); /* attribute operations */ - fssh_status_t (*create_attr)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*create_attr)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, const char *name, uint32_t type, int openMode, fssh_fs_cookie *_cookie); - fssh_status_t (*open_attr)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*open_attr)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, const char *name, int openMode, fssh_fs_cookie *_cookie); - fssh_status_t (*close_attr)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*close_attr)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie); - fssh_status_t (*free_attr_cookie)(fssh_fs_volume fs, fssh_fs_vnode vnode, - fssh_fs_cookie cookie); - fssh_status_t (*read_attr)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*free_attr_cookie)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_cookie cookie); + fssh_status_t (*read_attr)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, fssh_off_t pos, void *buffer, fssh_size_t *length); - fssh_status_t (*write_attr)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*write_attr)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, fssh_fs_cookie cookie, fssh_off_t pos, const void *buffer, fssh_size_t *length); - fssh_status_t (*read_attr_stat)(fssh_fs_volume fs, fssh_fs_vnode vnode, - fssh_fs_cookie cookie, struct fssh_stat *stat); - fssh_status_t (*write_attr_stat)(fssh_fs_volume fs, fssh_fs_vnode vnode, - fssh_fs_cookie cookie, const struct fssh_stat *stat, - int statMask); - fssh_status_t (*rename_attr)(fssh_fs_volume fs, fssh_fs_vnode fromVnode, - const char *fromName, fssh_fs_vnode toVnode, - const char *toName); - fssh_status_t (*remove_attr)(fssh_fs_volume fs, fssh_fs_vnode vnode, + fssh_status_t (*read_attr_stat)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_cookie cookie, + struct fssh_stat *stat); + fssh_status_t (*write_attr_stat)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_cookie cookie, + const struct fssh_stat *stat, int statMask); + fssh_status_t (*rename_attr)(fssh_fs_volume *volume, + fssh_fs_vnode *fromVnode, const char *fromName, + fssh_fs_vnode *toVnode, const char *toName); + fssh_status_t (*remove_attr)(fssh_fs_volume *volume, fssh_fs_vnode *vnode, const char *name); - /* index directory & index operations */ - fssh_status_t (*open_index_dir)(fssh_fs_volume fs, fssh_fs_cookie *cookie); - fssh_status_t (*close_index_dir)(fssh_fs_volume fs, fssh_fs_cookie cookie); - fssh_status_t (*free_index_dir_cookie)(fssh_fs_volume fs, - fssh_fs_cookie cookie); - fssh_status_t (*read_index_dir)(fssh_fs_volume fs, fssh_fs_cookie cookie, - struct fssh_dirent *buffer, fssh_size_t bufferSize, - uint32_t *_num); - fssh_status_t (*rewind_index_dir)(fssh_fs_volume fs, fssh_fs_cookie cookie); + /* support for vnode and FS layers */ + fssh_status_t (*create_special_node)(fssh_fs_volume *volume, + fssh_fs_vnode *dir, const char *name, fssh_fs_vnode *subVnode, + fssh_mode_t mode, uint32_t flags, fssh_fs_vnode *_superVnode, + fssh_ino_t *_nodeID); + fssh_status_t (*get_super_vnode)(fssh_fs_volume *volume, + fssh_fs_vnode *vnode, fssh_fs_volume *superVolume, + fssh_fs_vnode *superVnode); +}; - fssh_status_t (*create_index)(fssh_fs_volume fs, const char *name, - uint32_t type, uint32_t flags); - fssh_status_t (*remove_index)(fssh_fs_volume fs, const char *name); - fssh_status_t (*read_index_stat)(fssh_fs_volume fs, const char *name, - struct fssh_stat *stat); +typedef struct fssh_file_system_module_info { + struct fssh_module_info info; + const char* pretty_name; + uint32_t flags; // DDM flags - /* query operations */ - fssh_status_t (*open_query)(fssh_fs_volume fs, const char *query, - uint32_t flags, fssh_port_id port, uint32_t token, - fssh_fs_cookie *_cookie); - fssh_status_t (*close_query)(fssh_fs_volume fs, fssh_fs_cookie cookie); - fssh_status_t (*free_query_cookie)(fssh_fs_volume fs, - fssh_fs_cookie cookie); - fssh_status_t (*read_query)(fssh_fs_volume fs, fssh_fs_cookie cookie, - struct fssh_dirent *buffer, fssh_size_t bufferSize, - uint32_t *_num); - fssh_status_t (*rewind_query)(fssh_fs_volume fs, fssh_fs_cookie cookie); + /* scanning (the device is write locked) */ + float (*identify_partition)(int fd, fssh_partition_data *partition, + void **cookie); + fssh_status_t (*scan_partition)(int fd, fssh_partition_data *partition, + void *cookie); + void (*free_identify_partition_cookie)(fssh_partition_data *partition, + void *cookie); + void (*free_partition_content_cookie)(fssh_partition_data *partition); + /* general operations */ + fssh_status_t (*mount)(fssh_fs_volume *volume, const char *device, + uint32_t flags, const char *args, fssh_vnode_id *_rootVnodeID); + /* capability querying (the device is read locked) */ uint32_t (*get_supported_operations)(fssh_partition_data* partition, uint32_t mask); @@ -269,20 +320,23 @@ /* file system add-ons only prototypes */ -extern fssh_status_t fssh_new_vnode(fssh_mount_id mountID, - fssh_vnode_id vnodeID, fssh_fs_vnode privateNode); -extern fssh_status_t fssh_publish_vnode(fssh_mount_id mountID, - fssh_vnode_id vnodeID, fssh_fs_vnode privateNode); -extern fssh_status_t fssh_get_vnode(fssh_mount_id mountID, - fssh_vnode_id vnodeID, fssh_fs_vnode *_privateNode); -extern fssh_status_t fssh_put_vnode(fssh_mount_id mountID, +extern fssh_status_t fssh_new_vnode(fssh_fs_volume *volume, + fssh_vnode_id vnodeID, void *privateNode, + fssh_fs_vnode_ops *ops); +extern fssh_status_t fssh_publish_vnode(fssh_fs_volume *volume, + 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); +extern fssh_status_t fssh_put_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID); -extern fssh_status_t fssh_remove_vnode(fssh_mount_id mountID, +extern fssh_status_t fssh_remove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID); -extern fssh_status_t fssh_unremove_vnode(fssh_mount_id mountID, +extern fssh_status_t fssh_unremove_vnode(fssh_fs_volume *volume, fssh_vnode_id vnodeID); -extern fssh_status_t fssh_get_vnode_removed(fssh_mount_id mountID, +extern fssh_status_t fssh_get_vnode_removed(fssh_fs_volume *volume, fssh_vnode_id vnodeID, bool* removed); + extern fssh_status_t fssh_read_pages(int fd, fssh_off_t pos, const struct fssh_iovec *vecs, fssh_size_t count, fssh_size_t *_numBytes, bool fsReenter); Modified: haiku/trunk/headers/private/kernel/syscalls.h =================================================================== --- haiku/trunk/headers/private/kernel/syscalls.h 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/headers/private/kernel/syscalls.h 2008-04-05 23:05:16 UTC (rev 24816) @@ -178,6 +178,7 @@ extern status_t _kern_unlink(int fd, const char *path); extern status_t _kern_rename(int oldDir, const char *oldpath, int newDir, const char *newpath); +extern status_t _kern_create_fifo(const char *path, mode_t perms); extern status_t _kern_access(const char *path, int mode); extern ssize_t _kern_select(int numfds, struct fd_set *readSet, struct fd_set *writeSet, struct fd_set *errorSet, Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/headers/private/kernel/vfs.h 2008-04-05 23:05:16 UTC (rev 24816) @@ -104,7 +104,7 @@ bool allocate); 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_get_fs_node_from_path(dev_t mountID, const char *path, +status_t vfs_get_fs_node_from_path(fs_volume *volume, const char *path, bool kernel, void **_node); status_t vfs_stat_vnode(struct vnode *vnode, struct stat *stat); status_t vfs_stat_entry_ref(dev_t device, ino_t inode, struct stat *stat); @@ -171,6 +171,7 @@ status_t _user_unlink(int fd, const char *path); status_t _user_rename(int oldFD, const char *oldpath, int newFD, const char *newpath); +status_t _user_create_fifo(const char *path, mode_t perms); status_t _user_access(const char *path, int mode); ssize_t _user_select(int numfds, fd_set *readSet, fd_set *writeSet, fd_set *errorSet, bigtime_t timeout, const sigset_t *sigMask); Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-04-05 23:05:16 UTC (rev 24816) @@ -954,7 +954,7 @@ cookie->iterator = NULL; // the current directory inode is still locked in memory - put_vnode(fVolume->ID(), fVolume->ToVnode(cookie->current)); + put_vnode(fVolume->FSVolume(), fVolume->ToVnode(cookie->current)); } // if CheckNextNode() could completely work through, we can @@ -1089,7 +1089,7 @@ cookie->iterator = NULL; // unlock the directory's inode from memory - put_vnode(fVolume->ID(), fVolume->ToVnode(cookie->current)); + put_vnode(fVolume->FSVolume(), fVolume->ToVnode(cookie->current)); continue; } else if (status == B_OK) { Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Index.cpp 2008-04-05 23:05:16 UTC (rev 24816) @@ -34,7 +34,7 @@ return; if (fVolume->ID() >= 0) - put_vnode(fVolume->ID(), fNode->ID()); + put_vnode(fVolume->FSVolume(), fNode->ID()); } @@ -45,7 +45,7 @@ return; if (fVolume->ID() >= 0) - put_vnode(fVolume->ID(), fNode->ID()); + put_vnode(fVolume->FSVolume(), fNode->ID()); fNode = NULL; fName = NULL; } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-04-05 22:08:47 UTC (rev 24815) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Inode.cpp 2008-04-05 23:05:16 UTC (rev 24816) @@ -169,7 +169,7 @@ fInode->Node().flags &= ~HOST_ENDIAN_TO_BFS_INT32(INODE_IN_USE); // this unblocks any pending bfs_read_vnode() calls fInode->Free(*fTransaction); - remove_vnode(volume->ID(), fInode->ID()); + remove_vnode(volume->FSVolume(), fInode->ID()); } else volume->Free(*fTransaction, fRun); } @@ -199,7 +199,8 @@ RETURN_ERROR(B_NO_MEMORY); if (volume->ID() >= 0) { - status = new_vnode(volume->ID(), fInode->ID(), fInode); + status = new_vnode(volume->FSVolume(), fInode->ID(), fInode, + &gBFSVnodeOps); if (status < B_OK) { delete fInode; fInode = NULL; @@ -247,8 +248,10 @@ return status; } - if (!fInode->IsSymLink() && volume->ID() >= 0) - status = publish_vnode(volume->ID(), fInode->ID(), fInode); + if (!fInode->IsSymLink() && volume->ID() >= 0) { + status = publish_vnode(volume->FSVolume(), fInode->ID(), fInode, + &gBFSVnodeOps, fInode->Mode(), 0); + } if (status == B_OK) { cache_add_transaction_listener(volume->BlockCache(), fTransaction->ID(), @@ -933,14 +936,14 @@ if (attributes->IsEmpty()) { // remove attribute directory (don't fail if that can't be done) - if (remove_vnode(fVolume->ID(), attributes->ID()) == B_OK) { + if (remove_vnode(fVolume->FSVolume(), attributes->ID()) == B_OK) { // update the inode, so that no one will ever doubt it's deleted :-) attributes->Node().flags |= HOST_ENDIAN_TO_BFS_INT32(INODE_DELETED); if (attributes->WriteBack(transaction) == B_OK) { Attributes().SetTo(0, 0, 0); WriteBack(transaction); } else - unremove_vnode(fVolume->ID(), attributes->ID()); + unremove_vnode(fVolume->FSVolume(), attributes->ID()); } } @@ -1188,7 +1191,7 @@ if (attribute == NULL) return; - put_vnode(fVolume->ID(), attribute->ID()); + put_vnode(fVolume->FSVolume(), attribute->ID()); } @@ -2240,12 +2243,12 @@ } [... truncated: 7462 lines follow ...] From ingo_weinhold at gmx.de Sun Apr 6 01:06:10 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 06 Apr 2008 01:06:10 +0200 Subject: [Haiku-commits] r24813 - in haiku/trunk: headers/private/kernel src/system/kernel/fs In-Reply-To: <200804052201.m35M16t6006156@sheep.berlios.de> References: <200804052201.m35M16t6006156@sheep.berlios.de> Message-ID: <20080406010610.447.1@knochen-vm.1207431385.fake> On 2008-04-06 at 00:01:06 [+0200], mmlr at BerliOS wrote: > Author: mmlr > Date: 2008-04-06 00:01:05 +0200 (Sun, 06 Apr 2008) > New Revision: 24813 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24813&view=rev > > Modified: > haiku/trunk/headers/private/kernel/vfs.h > haiku/trunk/src/system/kernel/fs/vfs.cpp > Log: > Introduce vfs_stat_entry_ref() that allows to stat a vnode based on a dev_t > and ino_t instead of a path. "entry_ref" doesn't sound quite fitting in this case, though. CU, Ingo From bonefish at mail.berlios.de Sun Apr 6 02:26:16 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 02:26:16 +0200 Subject: [Haiku-commits] r24817 - haiku/trunk/src/system/kernel/fs Message-ID: <200804060026.m360QG0t009074@sheep.berlios.de> Author: bonefish Date: 2008-04-06 02:26:15 +0200 (Sun, 06 Apr 2008) New Revision: 24817 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24817&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: We get a reference to the node from create_special_node(), so we have to release it. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-05 23:05:16 UTC (rev 24816) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-06 00:26:15 UTC (rev 24817) @@ -8175,8 +8175,14 @@ // create the entry -- the FIFO sub node is set up automatically fs_vnode superVnode; ino_t nodeID; - return FS_CALL(dir, create_special_node, filename, NULL, + status = FS_CALL(dir, create_special_node, filename, NULL, S_IFIFO | (perms & S_IUMSK), 0, &superVnode, &nodeID); + + // create_special_node() acquired a reference for us that we don't need. + if (status == B_OK) + put_vnode(dir->mount->volume, nodeID); + + return status; } From bonefish at mail.berlios.de Sun Apr 6 02:27:37 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 02:27:37 +0200 Subject: [Haiku-commits] r24818 - haiku/trunk/src/system/kernel/fs Message-ID: <200804060027.m360RboY009388@sheep.berlios.de> Author: bonefish Date: 2008-04-06 02:27:36 +0200 (Sun, 06 Apr 2008) New Revision: 24818 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24818&view=rev Modified: haiku/trunk/src/system/kernel/fs/rootfs.cpp Log: The rootfs was calling remove_vnode() on nodes for which it might not have had a reference. Modified: haiku/trunk/src/system/kernel/fs/rootfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/rootfs.cpp 2008-04-06 00:26:15 UTC (rev 24817) +++ haiku/trunk/src/system/kernel/fs/rootfs.cpp 2008-04-06 00:27:36 UTC (rev 24818) @@ -278,20 +278,27 @@ /** You must hold the FS lock when calling this function */ static status_t -remove_node(struct rootfs *fs, struct rootfs_vnode *directory, struct rootfs_vnode *vnode) +remove_node(struct rootfs *fs, struct rootfs_vnode *directory, + struct rootfs_vnode *vnode) { // schedule this vnode to be removed when it's ref goes to zero -// TODO: This can fail, if the caller doesn't have a reference to the node -// in question. And some code paths don't guarantee that (rootfs_remove_dir() -// for example). - status_t status = remove_vnode(fs->volume, vnode->id); - if (status < B_OK) - return status; - rootfs_remove_from_dir(fs, directory, vnode); - notify_entry_removed(fs->id, directory->id, vnode->name, vnode->id); + void* dummy; + bool gotNode = (get_vnode(fs->volume, vnode->id, &dummy) == B_OK); - return B_OK; + status_t status = B_OK; + if (gotNode) + status = remove_vnode(fs->volume, vnode->id); + + if (status == B_OK) { + rootfs_remove_from_dir(fs, directory, vnode); + notify_entry_removed(fs->id, directory->id, vnode->name, vnode->id); + } + + if (gotNode) + put_vnode(fs->volume, vnode->id); + + return status; } From bonefish at mail.berlios.de Sun Apr 6 03:40:02 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 03:40:02 +0200 Subject: [Haiku-commits] r24819 - haiku/trunk/src/system/kernel/fs Message-ID: <200804060140.m361e2YA014417@sheep.berlios.de> Author: bonefish Date: 2008-04-06 03:40:01 +0200 (Sun, 06 Apr 2008) New Revision: 24819 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24819&view=rev Modified: haiku/trunk/src/system/kernel/fs/pipefs.cpp Log: * A pipe can now be inactive and active. After creation it remains inactive until at least one reader and one writer have opened it. As long as it is inactive, reads from and writes to it just block. When active, they behave as before (if there's no counterpart writes fail: SIGPIPE + EPIPE, reads return 0). When both reader and writer count drop to zero, the pipe becomes inactive again. * Allocate the ring buffer lazily when the pipe becomes active and delete it when it becomes inactive. This makes the pipe implementation FIFO compatible. IOW, FIFOs work as expected as far as I've tested them. Modified: haiku/trunk/src/system/kernel/fs/pipefs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/pipefs.cpp 2008-04-06 00:27:36 UTC (rev 24818) +++ haiku/trunk/src/system/kernel/fs/pipefs.cpp 2008-04-06 01:40:01 UTC (rev 24819) @@ -58,6 +58,9 @@ RingBuffer(); ~RingBuffer(); + status_t CreateBuffer(); + void DeleteBuffer(); + size_t Write(const void *buffer, size_t length); size_t Read(void *buffer, size_t length); ssize_t UserWrite(const void *buffer, ssize_t length); @@ -170,6 +173,7 @@ ino_t ID() const { return fID; } const char *Name() const { return fName; } + bool IsActive() const { return fActive; } int32 Type() const { return fType; } void SetMode(mode_t mode) { fType = (fType & ~S_IUMSK) | (mode & S_IUMSK); } @@ -246,6 +250,7 @@ int32 fReaderCount; int32 fWriterCount; + bool fActive; select_sync_pool *fReadSelectSyncPool; select_sync_pool *fWriteSelectSyncPool; @@ -280,20 +285,44 @@ RingBuffer::RingBuffer() + : fBuffer(NULL) { - fBuffer = create_ring_buffer(PIPEFS_MAX_BUFFER_SIZE); } RingBuffer::~RingBuffer() { - delete_ring_buffer(fBuffer); + DeleteBuffer(); } +status_t +RingBuffer::CreateBuffer() +{ + if (fBuffer != NULL) + return B_OK; + + fBuffer = create_ring_buffer(PIPEFS_MAX_BUFFER_SIZE); + return (fBuffer != NULL ? B_OK : B_NO_MEMORY); +} + + +void +RingBuffer::DeleteBuffer() +{ + if (fBuffer != NULL) { + delete_ring_buffer(fBuffer); + fBuffer = NULL; + } +} + + inline size_t RingBuffer::Write(const void *buffer, size_t length) { + if (fBuffer == NULL) + return B_NO_MEMORY; + return ring_buffer_write(fBuffer, (const uint8 *)buffer, length); } @@ -301,6 +330,9 @@ inline size_t RingBuffer::Read(void *buffer, size_t length) { + if (fBuffer == NULL) + return B_NO_MEMORY; + return ring_buffer_read(fBuffer, (uint8 *)buffer, length); } @@ -308,6 +340,9 @@ inline ssize_t RingBuffer::UserWrite(const void *buffer, ssize_t length) { + if (fBuffer == NULL) + return B_NO_MEMORY; + return ring_buffer_user_write(fBuffer, (const uint8 *)buffer, length); } @@ -315,6 +350,9 @@ inline ssize_t RingBuffer::UserRead(void *buffer, ssize_t length) { + if (fBuffer == NULL) + return B_NO_MEMORY; + return ring_buffer_user_read(fBuffer, (uint8 *)buffer, length); } @@ -322,14 +360,14 @@ inline size_t RingBuffer::Readable() const { - return ring_buffer_readable(fBuffer); + return (fBuffer != NULL ? ring_buffer_readable(fBuffer) : 0); } inline size_t RingBuffer::Writable() const { - return ring_buffer_writable(fBuffer); + return (fBuffer != NULL ? ring_buffer_writable(fBuffer) : 0); } @@ -600,6 +638,7 @@ fWriteRequests(), fReaderCount(0), fWriterCount(0), + fActive(false), fReadSelectSyncPool(NULL), fWriteSelectSyncPool(NULL) { @@ -667,7 +706,8 @@ while (dataSize > 0) { // Wait until enough space in the buffer is available. - while (fBuffer.Writable() < minToWrite && fReaderCount > 0) { + while (!fActive + || fBuffer.Writable() < minToWrite && fReaderCount > 0) { if (nonBlocking) return B_WOULD_BLOCK; @@ -688,7 +728,7 @@ } // write only as long as there are readers left - if (fReaderCount == 0) { + if (fReaderCount == 0 && fActive) { if (written == 0) send_signal(find_thread(NULL), SIGPIPE); return EPIPE; @@ -696,11 +736,11 @@ // write as much as we can - size_t toWrite = fBuffer.Writable(); + size_t toWrite = (fActive ? fBuffer.Writable() : 0); if (toWrite > dataSize) toWrite = dataSize; - if (fBuffer.UserWrite(data, toWrite) < B_OK) + if (toWrite > 0 && fBuffer.UserWrite(data, toWrite) < B_OK) return B_BAD_ADDRESS; data += toWrite; @@ -737,7 +777,7 @@ if (nonBlocking) return B_WOULD_BLOCK; - if (fWriterCount == 0) + if (fActive && fWriterCount == 0) return B_OK; error = WaitForReadRequest(request); @@ -881,18 +921,29 @@ } - void Inode::Open(int openMode) { if (!S_ISFIFO(fType)) return; + BenaphoreLocker locker(RequestLock()); + if ((openMode & O_ACCMODE) == O_WRONLY) - atomic_add(&fWriterCount, 1); + fWriterCount++; if ((openMode & O_ACCMODE) == O_RDONLY || (openMode & O_ACCMODE) == O_RDWR) - atomic_add(&fReaderCount, 1); + fReaderCount++; + + if (fReaderCount > 0 && fWriterCount > 0) { + fBuffer.CreateBuffer(); + fActive = true; + + // notify all waiting writers that they can start + if (fWriteSelectSyncPool) + notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_WRITE); + fWriteCondition.NotifyAll(); + } } @@ -906,15 +957,18 @@ BenaphoreLocker locker(RequestLock()); - if ((openMode & O_ACCMODE) == O_WRONLY - && atomic_add(&fWriterCount, -1) == 1) { + if ((openMode & O_ACCMODE) == O_WRONLY && --fWriterCount == 0) NotifyEndClosed(true); - } if ((openMode & O_ACCMODE) == O_RDONLY || (openMode & O_ACCMODE) == O_RDWR) { - if (atomic_add(&fReaderCount, -1) == 1) + if (--fReaderCount == 0) NotifyEndClosed(false); } + + if (fReaderCount == 0 && fWriterCount == 0) { + fActive = false; + fBuffer.DeleteBuffer(); + } } @@ -1351,8 +1405,7 @@ BenaphoreLocker locker(inode->RequestLock()); - if (inode->WriterCount() == 0) { - + if (inode->IsActive() && inode->WriterCount() == 0) { // as long there is no writer, and the pipe is empty, // we always just return 0 to indicate end of file if (inode->BytesAvailable() == 0) { From revol at free.fr Sun Apr 6 04:23:17 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sun, 06 Apr 2008 04:23:17 +0200 CEST Subject: [Haiku-commits] =?windows-1252?q?r24813_-_in_haiku/trunk=3A_heade?= =?windows-1252?q?rs/private/kernel_src/system/kernel/fs?= In-Reply-To: <200804052201.m35M16t6006156@sheep.berlios.de> Message-ID: <196105444-BeMail@laptop> > Author: mmlr > Date: 2008-04-06 00:01:05 +0200 (Sun, 06 Apr 2008) > New Revision: 24813 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24813&view=rev > > Modified: > haiku/trunk/headers/private/kernel/vfs.h > haiku/trunk/src/system/kernel/fs/vfs.cpp > Log: > Introduce vfs_stat_entry_ref() that allows to stat a vnode based on a > dev_t > and ino_t instead of a path. Supposed to work with node monitoring > messages. > Took the name from vfs_entry_ref_to_path() that takes the same > arguments, but > suggestions for a better name are welcome. that would be a vfs_stat_node_ref then, entry_ref is {dev, dir_inode, name} while {dev, ino} is a node_ref. Fran?ois. From bonefish at mail.berlios.de Sun Apr 6 04:42:19 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 04:42:19 +0200 Subject: [Haiku-commits] r24821 - haiku/trunk/src/system/kernel/fs Message-ID: <200804060242.m362gJ4e018816@sheep.berlios.de> Author: bonefish Date: 2008-04-06 04:42:18 +0200 (Sun, 06 Apr 2008) New Revision: 24821 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24821&view=rev Modified: haiku/trunk/src/system/kernel/fs/pipefs.cpp Log: Commented out some debug output. The sources will be reworked soon. Modified: haiku/trunk/src/system/kernel/fs/pipefs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/pipefs.cpp 2008-04-06 02:35:07 UTC (rev 24820) +++ haiku/trunk/src/system/kernel/fs/pipefs.cpp 2008-04-06 02:42:18 UTC (rev 24821) @@ -1921,8 +1921,8 @@ { FIFOInode* fifo = (FIFOInode*)vnode->private_node; fs_vnode* superVnode = fifo->SuperVnode(); -dprintf("[%ld] fifo_put_vnode(%p (%p), %p (%p), %d)\n", find_thread(NULL), -volume, volume->private_volume, vnode, fifo, reenter); +//dprintf("[%ld] fifo_put_vnode(%p (%p), %p (%p), %d)\n", find_thread(NULL), +//volume, volume->private_volume, vnode, fifo, reenter); status_t error = B_OK; if (superVnode->ops->put_vnode != NULL) @@ -1939,8 +1939,8 @@ { FIFOInode* fifo = (FIFOInode*)vnode->private_node; fs_vnode* superVnode = fifo->SuperVnode(); -dprintf("[%ld] fifo_remove_vnode(%p (%p), %p (%p), %d)\n", find_thread(NULL), -volume, volume->private_volume, vnode, fifo, reenter); +//dprintf("[%ld] fifo_remove_vnode(%p (%p), %p (%p), %d)\n", find_thread(NULL), +//volume, volume->private_volume, vnode, fifo, reenter); status_t error = B_OK; if (superVnode->ops->remove_vnode != NULL) @@ -1957,8 +1957,8 @@ { FIFOInode* fifo = (FIFOInode*)vnode->private_node; fs_vnode* superVnode = fifo->SuperVnode(); -dprintf("[%ld] fifo_read_stat(%p (%p), %p (%p), %p)\n", find_thread(NULL), -volume, volume->private_volume, vnode, fifo, st); +//dprintf("[%ld] fifo_read_stat(%p (%p), %p (%p), %p)\n", find_thread(NULL), +//volume, volume->private_volume, vnode, fifo, st); if (superVnode->ops->read_stat == NULL) return B_BAD_VALUE; @@ -1998,8 +1998,8 @@ FIFOInode* fifo = (FIFOInode*)vnode->private_node; fs_vnode* superVnode = fifo->SuperVnode(); -dprintf("[%ld] fifo_write_stat(%p (%p), %p (%p), %p, 0x%lx)\n", -find_thread(NULL), volume, volume->private_volume, vnode, fifo, st, statMask); +//dprintf("[%ld] fifo_write_stat(%p (%p), %p (%p), %p, 0x%lx)\n", +//find_thread(NULL), volume, volume->private_volume, vnode, fifo, st, statMask); if (superVnode->ops->write_stat == NULL) return B_BAD_VALUE; @@ -2019,8 +2019,8 @@ { file_cookie *cookie = (file_cookie *)_cookie; FIFOInode* fifo = (FIFOInode*)vnode->private_node; -dprintf("[%ld] fifo_open(%p (%p), %p (%p), 0x%x, %p)\n", -find_thread(NULL), volume, volume->private_volume, vnode, fifo, openMode, _cookie); +//dprintf("[%ld] fifo_open(%p (%p), %p (%p), 0x%x, %p)\n", +//find_thread(NULL), volume, volume->private_volume, vnode, fifo, openMode, _cookie); return pipefs_open(volume, vnode, openMode, _cookie); } @@ -2031,8 +2031,8 @@ { file_cookie *cookie = (file_cookie *)_cookie; FIFOInode* fifo = (FIFOInode*)vnode->private_node; -dprintf("[%ld] fifo_close(%p (%p), %p (%p), %p)\n", -find_thread(NULL), volume, volume->private_volume, vnode, fifo, _cookie); +//dprintf("[%ld] fifo_close(%p (%p), %p (%p), %p)\n", +//find_thread(NULL), volume, volume->private_volume, vnode, fifo, _cookie); fifo->Close(cookie->open_mode); @@ -2046,9 +2046,9 @@ { FIFOInode* fifo = (FIFOInode*)vnode->private_node; fs_vnode* superVnode = fifo->SuperVnode(); -dprintf("[%ld] fifo_get_super_vnode(%p (%p), %p (%p), %p, %p)\n", -find_thread(NULL), volume, volume->private_volume, vnode, fifo, superVolume, -_superVnode); +//dprintf("[%ld] fifo_get_super_vnode(%p (%p), %p (%p), %p, %p)\n", +//find_thread(NULL), volume, volume->private_volume, vnode, fifo, superVolume, +//_superVnode); if (superVnode->ops->get_super_vnode != NULL) { return superVnode->ops->get_super_vnode(volume, superVnode, superVolume, From bonefish at mail.berlios.de Sun Apr 6 04:44:38 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 04:44:38 +0200 Subject: [Haiku-commits] r24822 - haiku/trunk/src/system/kernel/fs Message-ID: <200804060244.m362ic7M019073@sheep.berlios.de> Author: bonefish Date: 2008-04-06 04:44:37 +0200 (Sun, 06 Apr 2008) New Revision: 24822 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24822&view=rev Modified: haiku/trunk/src/system/kernel/fs/rootfs.cpp Log: create_special_node() supports creating a special node without entry, now. Modified: haiku/trunk/src/system/kernel/fs/rootfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/rootfs.cpp 2008-04-06 02:42:18 UTC (rev 24821) +++ haiku/trunk/src/system/kernel/fs/rootfs.cpp 2008-04-06 02:44:37 UTC (rev 24822) @@ -141,10 +141,12 @@ memset(vnode, 0, sizeof(struct rootfs_vnode)); - vnode->name = strdup(name); - if (vnode->name == NULL) { - free(vnode); - return NULL; + if (name != NULL) { + vnode->name = strdup(name); + if (vnode->name == NULL) { + free(vnode); + return NULL; + } } vnode->id = fs->next_vnode_id++; @@ -1067,16 +1069,21 @@ MutexLocker _(fs->lock); -// TODO: Support (NULL, NULL) (dir, name)! - vnode = rootfs_find_in_dir(dir, name); - if (vnode != NULL) - return B_FILE_EXISTS; + if (name != NULL) { + vnode = rootfs_find_in_dir(dir, name); + if (vnode != NULL) + return B_FILE_EXISTS; + } vnode = rootfs_create_vnode(fs, dir, name, mode); if (vnode == NULL) return B_NO_MEMORY; - rootfs_insert_in_dir(fs, dir, vnode); + if (name != NULL) + rootfs_insert_in_dir(fs, dir, vnode); + else + flags |= B_VNODE_PUBLISH_REMOVED; + hash_insert(fs->vnode_list_hash, vnode); _superVnode->private_node = vnode; @@ -1089,12 +1096,14 @@ status_t status = publish_vnode(fs->volume, vnode->id, subVnode->private_node, subVnode->ops, mode, flags); if (status != B_OK) { - rootfs_remove_from_dir(fs, dir, vnode); + if (name != NULL) + rootfs_remove_from_dir(fs, dir, vnode); rootfs_delete_vnode(fs, vnode, false); return status; } - notify_entry_created(fs->id, dir->id, name, vnode->id); + if (name != NULL) + notify_entry_created(fs->id, dir->id, name, vnode->id); return B_OK; } From bonefish at mail.berlios.de Sun Apr 6 04:49:14 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 04:49:14 +0200 Subject: [Haiku-commits] r24823 - in haiku/trunk: headers/private/kernel src/system/kernel/fs src/system/libroot/posix/unistd Message-ID: <200804060249.m362nELT019280@sheep.berlios.de> Author: bonefish Date: 2008-04-06 04:49:12 +0200 (Sun, 06 Apr 2008) New Revision: 24823 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24823&view=rev Modified: haiku/trunk/headers/private/kernel/syscalls.h haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/fs/vfs_boot.cpp haiku/trunk/src/system/libroot/posix/unistd/pipe.c Log: * Added _kern_create_pipe() syscall, creating a pipe as an entryless FIFO. Reimplemented pipe() to use it. * pipefs is no longer mounted. Will remove the superfluous code soon. Modified: haiku/trunk/headers/private/kernel/syscalls.h =================================================================== --- haiku/trunk/headers/private/kernel/syscalls.h 2008-04-06 02:44:37 UTC (rev 24822) +++ haiku/trunk/headers/private/kernel/syscalls.h 2008-04-06 02:49:12 UTC (rev 24823) @@ -179,6 +179,7 @@ extern status_t _kern_rename(int oldDir, const char *oldpath, int newDir, const char *newpath); extern status_t _kern_create_fifo(const char *path, mode_t perms); +extern status_t _kern_create_pipe(int *fds); extern status_t _kern_access(const char *path, int mode); extern ssize_t _kern_select(int numfds, struct fd_set *readSet, struct fd_set *writeSet, struct fd_set *errorSet, Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2008-04-06 02:44:37 UTC (rev 24822) +++ haiku/trunk/headers/private/kernel/vfs.h 2008-04-06 02:49:12 UTC (rev 24823) @@ -172,6 +172,7 @@ status_t _user_rename(int oldFD, const char *oldpath, int newFD, const char *newpath); status_t _user_create_fifo(const char *path, mode_t perms); +status_t _user_create_pipe(int *fds); status_t _user_access(const char *path, int mode); ssize_t _user_select(int numfds, fd_set *readSet, fd_set *writeSet, fd_set *errorSet, bigtime_t timeout, const sigset_t *sigMask); Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-06 02:44:37 UTC (rev 24822) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-06 02:49:12 UTC (rev 24823) @@ -8187,6 +8187,60 @@ status_t +_user_create_pipe(int *userFDs) +{ + // rootfs should support creating FIFOs, but let's be sure + if (!HAS_FS_CALL(sRoot, create_special_node)) + return B_UNSUPPORTED; + + // create the node -- the FIFO sub node is set up automatically + fs_vnode superVnode; + ino_t nodeID; + status_t status = FS_CALL(sRoot, create_special_node, NULL, NULL, + S_IFIFO | S_IRUSR | S_IWUSR, 0, &superVnode, &nodeID); + if (status != B_OK) + return status; + + // We've got one reference to the node and need another one. + struct vnode* vnode; + status = get_vnode(sRoot->mount->id, nodeID, &vnode, true, false); + if (status != B_OK) { + // that should not happen + dprintf("_user_create_pipe(): Failed to lookup vnode (%ld, %lld)\n", + sRoot->mount->id, sRoot->id); + return status; + } + + // Everything looks good so far. Open two FDs for reading respectively + // writing. + int fds[2]; + fds[0] = open_vnode(vnode, O_RDONLY, false); + fds[1] = open_vnode(vnode, O_WRONLY, false); + + FDCloser closer0(fds[0], false); + FDCloser closer1(fds[1], false); + + status = (fds[0] >= 0 ? (fds[1] >= 0 ? B_OK : fds[1]) : fds[0]); + + // copy FDs to userland + if (status == B_OK) { + if (!IS_USER_ADDRESS(userFDs) + || user_memcpy(userFDs, fds, sizeof(fds)) != B_OK) { + status = B_BAD_ADDRESS; + } + } + + // keep FDs, if everything went fine + if (status == B_OK) { + closer0.Detach(); + closer1.Detach(); + } + + return status; +} + + +status_t _user_access(const char *userPath, int mode) { KPath pathBuffer(B_PATH_NAME_LENGTH + 1); Modified: haiku/trunk/src/system/kernel/fs/vfs_boot.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs_boot.cpp 2008-04-06 02:44:37 UTC (rev 24822) +++ haiku/trunk/src/system/kernel/fs/vfs_boot.cpp 2008-04-06 02:49:12 UTC (rev 24823) @@ -453,12 +453,6 @@ if (status < B_OK) panic("error mounting devfs\n"); - // bootstrap the pipefs - _kern_create_dir(-1, "/pipe", 0755); - status = _kern_mount("/pipe", NULL, "pipefs", 0, NULL, 0); - if (status < B_OK) - panic("error mounting pipefs\n"); - // create directory for the boot volume _kern_create_dir(-1, "/boot", 0755); Modified: haiku/trunk/src/system/libroot/posix/unistd/pipe.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/pipe.c 2008-04-06 02:44:37 UTC (rev 24822) +++ haiku/trunk/src/system/libroot/posix/unistd/pipe.c 2008-04-06 02:49:12 UTC (rev 24823) @@ -1,35 +1,21 @@ /* - * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. All rights reserved. * Distributed under the terms of the MIT License. */ - -#include - +#include #include -#include -#include +#include + int pipe(int streams[2]) { - bigtime_t timestamp = system_time(); - char pipeName[64]; - - while (system_time() <= timestamp) // ensure we get an unused timestamp - ; - - sprintf(pipeName, "/pipe/%03lx-%Ld", find_thread(NULL), system_time()); - - streams[0] = open(pipeName, O_CREAT | O_RDONLY, 0777); - if (streams[0] < 0) + status_t error = _kern_create_pipe(streams); + if (error != B_OK) { + errno = error; return -1; - - streams[1] = open(pipeName, O_WRONLY); - if (streams[1] < 0) { - close(streams[0]); - return -1; } return 0; From bonefish at mail.berlios.de Sun Apr 6 04:35:09 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 04:35:09 +0200 Subject: [Haiku-commits] r24820 - haiku/trunk/src/system/kernel/vm Message-ID: <200804060235.m362Z9FP018488@sheep.berlios.de> Author: bonefish Date: 2008-04-06 04:35:07 +0200 (Sun, 06 Apr 2008) New Revision: 24820 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24820&view=rev Modified: haiku/trunk/src/system/kernel/vm/vm.cpp Log: Added TODO regarding potential deadlock. Modified: haiku/trunk/src/system/kernel/vm/vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/vm/vm.cpp 2008-04-06 01:40:01 UTC (rev 24819) +++ haiku/trunk/src/system/kernel/vm/vm.cpp 2008-04-06 02:35:07 UTC (rev 24820) @@ -3700,6 +3700,10 @@ vm_area *area; acquire_sem_etc(addressSpace->sem, READ_COUNT, 0, 0); +// TODO: The user_memcpy() below can cause a deadlock, if it causes a page +// fault and someone is already waiting for a write lock on the same address +// space. This thread will then try to acquire the semaphore again and will +// be queued after the writer. area = vm_area_lookup(addressSpace, faultAddress); dprintf("vm_page_fault: sending team \"%s\" 0x%lx SIGSEGV, ip %#lx (\"%s\" +%#lx)\n", From bonefish at mail.berlios.de Sun Apr 6 05:13:12 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 05:13:12 +0200 Subject: [Haiku-commits] r24824 - haiku/trunk/src/tools/fs_shell Message-ID: <200804060313.m363DCui020422@sheep.berlios.de> Author: bonefish Date: 2008-04-06 05:13:11 +0200 (Sun, 06 Apr 2008) New Revision: 24824 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24824&view=rev Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp Log: Might help gcc 2.95.3 to resolve its perceived overloading of the function. Modified: haiku/trunk/src/tools/fs_shell/vfs.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/vfs.cpp 2008-04-06 02:49:12 UTC (rev 24823) +++ haiku/trunk/src/tools/fs_shell/vfs.cpp 2008-04-06 03:13:11 UTC (rev 24824) @@ -2399,7 +2399,7 @@ } // Use get_vnode() to resolve the cookie for the right layer. - status = fssh_get_vnode(volume, vnode->id, _node); + status = ::fssh_get_vnode(volume, vnode->id, _node); put_vnode(vnode); return FSSH_B_OK; From mmlr at mlotz.ch Sun Apr 6 10:57:35 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 06 Apr 2008 10:57:35 +0200 Subject: [Haiku-commits] r24813 - in haiku/trunk: headers/private/kernel src/system/kernel/fs In-Reply-To: <20080406010610.447.1@knochen-vm.1207431385.fake> Message-ID: <918065775-BeMail@primary> Hi Ingo > > Introduce vfs_stat_entry_ref() that allows to stat a vnode based on > > a dev_t > > and ino_t instead of a path. > > "entry_ref" doesn't sound quite fitting in this case, though. Yep exactly. That's why I wrote "name suggestions welcome" ;-). I would have gone with just overloading vfs_stat_vnode() but the c-linkage didn't quite agree with that. Will rename this to vfs_stat_node_ref() as Francois suggested. Should the same be applied to vfs_entry_ref_to_path()? It has the same argument, that's why I came to entry_ref in the first place. Regards Michael From mmlr at mail.berlios.de Sun Apr 6 11:18:28 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 11:18:28 +0200 Subject: [Haiku-commits] r24825 - in haiku/trunk: headers/private/kernel src/system/kernel/disk_device_manager src/system/kernel/fs Message-ID: <200804060918.m369ISw1030180@sheep.berlios.de> Author: mmlr Date: 2008-04-06 11:18:27 +0200 (Sun, 06 Apr 2008) New Revision: 24825 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24825&view=rev Modified: haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Rename vfs_stat_entry_ref() to vfs_stat_node_ref() as that's what a dev_t and ino_t combination really is. Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2008-04-06 03:13:11 UTC (rev 24824) +++ haiku/trunk/headers/private/kernel/vfs.h 2008-04-06 09:18:27 UTC (rev 24825) @@ -107,7 +107,7 @@ status_t vfs_get_fs_node_from_path(fs_volume *volume, const char *path, bool kernel, void **_node); status_t vfs_stat_vnode(struct vnode *vnode, struct stat *stat); -status_t vfs_stat_entry_ref(dev_t device, ino_t inode, struct stat *stat); +status_t vfs_stat_node_ref(dev_t device, ino_t inode, struct stat *stat); status_t vfs_get_vnode_name(struct vnode *vnode, char *name, size_t nameSize); status_t vfs_entry_ref_to_path(dev_t device, ino_t inode, const char *leaf, char *path, size_t pathLength); Modified: haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp =================================================================== --- haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp 2008-04-06 03:13:11 UTC (rev 24824) +++ haiku/trunk/src/system/kernel/disk_device_manager/KDiskDeviceManager.cpp 2008-04-06 09:18:27 UTC (rev 24825) @@ -118,7 +118,7 @@ ino_t node = event->GetInt64("node", -1); struct stat st; - if (vfs_stat_entry_ref(device, node, &st) != 0) + if (vfs_stat_node_ref(device, node, &st) != 0) break; if (S_ISDIR(st.st_mode)) { Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-06 03:13:11 UTC (rev 24824) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-06 09:18:27 UTC (rev 24825) @@ -3897,7 +3897,7 @@ status_t -vfs_stat_entry_ref(dev_t device, ino_t inode, struct stat *stat) +vfs_stat_node_ref(dev_t device, ino_t inode, struct stat *stat) { struct vnode *vnode; status_t status = get_vnode(device, inode, &vnode, true, false); From axeld at mail.berlios.de Sun Apr 6 11:37:14 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 6 Apr 2008 11:37:14 +0200 Subject: [Haiku-commits] r24826 - haiku/trunk/src/add-ons/kernel/busses/agp_gart Message-ID: <200804060937.m369bEil031526@sheep.berlios.de> Author: axeld Date: 2008-04-06 11:37:14 +0200 (Sun, 06 Apr 2008) New Revision: 24826 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24826&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp Log: * Enabled a few more chipsets that I found PCI IDs for. Only the i845G one has actually been tested (see ticket #1969). Modified: haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp 2008-04-06 09:18:27 UTC (rev 24825) +++ haiku/trunk/src/add-ons/kernel/busses/agp_gart/intel_gart.cpp 2008-04-06 09:37:14 UTC (rev 24826) @@ -45,20 +45,25 @@ uint32 type; const char *name; } kSupportedDevices[] = { -// {0x3577, INTEL_TYPE_83x, "i830GM"}, -// {0x2562, INTEL_TYPE_83x, "i845G"}, - + {0x3575, 0x3577, INTEL_TYPE_83x, "i830GM"}, + {0x2560, 0x2562, INTEL_TYPE_83x, "i845G"}, + {0x3580, 0x3582, INTEL_TYPE_85x, "i855G"}, {0x2570, 0x2572, INTEL_TYPE_85x, "i865G"}, -// {0x3582, INTEL_TYPE_85x, "i855G"}, // {0x2792, INTEL_TYPE_91x, "i910"}, // {0x258a, INTEL_TYPE_91x, "i915"}, -// {0x2582, INTEL_TYPE_91x, "i915G"}, -// {0x2592, INTEL_TYPE_91x, "i915GM"}, -// {0x2772, INTEL_TYPE_945, "i945G"}, -// {0x27a2, INTEL_TYPE_945, "i945GM"}, -// {0x29a2, INTEL_TYPE_965, "i965G"}, + {0x2580, 0x2582, INTEL_TYPE_91x, "i915G"}, + {0x2590, 0x2592, INTEL_TYPE_91x, "i915GM"}, + {0x2770, 0x2772, INTEL_TYPE_945, "i945G"}, + {0x27a0, 0x27a2, INTEL_TYPE_945, "i945GM"}, + + {0x2970, 0x2972, INTEL_TYPE_965, "i946GZ"}, + {0x2980, 0x2982, INTEL_TYPE_965, "i965G"}, + {0x2990, 0x2992, INTEL_TYPE_965, "i965Q"}, + {0x29a0, 0x29a2, INTEL_TYPE_965, "i965G"}, {0x2a00, 0x2a02, INTEL_TYPE_965, "i965GM"}, + {0x2a10, 0x2a12, INTEL_TYPE_965, "i965GME"}, + {0x29b0, 0x29b2, INTEL_TYPE_G33, "G33"}, {0x29c0, 0x29c2, INTEL_TYPE_G33, "Q35"}, {0x29d0, 0x29d2, INTEL_TYPE_G33, "Q33"}, From axeld at pinc-software.de Sun Apr 6 13:51:34 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Sun, 06 Apr 2008 13:51:34 +0200 CEST Subject: [Haiku-commits] r24813 - in haiku/trunk: headers/private/kernel src/system/kernel/fs In-Reply-To: <918065775-BeMail@primary> Message-ID: <12793524656-BeMail@zon> "Michael Lotz" wrote: > > "entry_ref" doesn't sound quite fitting in this case, though. > Yep exactly. That's why I wrote "name suggestions welcome" ;-). I > would > have gone with just overloading vfs_stat_vnode() but the c-linkage > didn't quite agree with that. Will rename this to vfs_stat_node_ref() > as Francois suggested. Should the same be applied to > vfs_entry_ref_to_path()? It has the same argument, that's why I came > to > entry_ref in the first place. Actually, it does not - it also contains the leaf name: (device, dir, leafName) is an entry_ref, (device, node) is a node_ref. Note, that in vfs_entry_ref_to_path() the ino_t argument refers to the directory, not the file itself. Bye, Axel. From mmlr at mail.berlios.de Sun Apr 6 14:07:46 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 14:07:46 +0200 Subject: [Haiku-commits] r24827 - haiku/trunk/src/system/kernel/fs Message-ID: <200804061207.m36C7kIP008818@sheep.berlios.de> Author: mmlr Date: 2008-04-06 14:07:45 +0200 (Sun, 06 Apr 2008) New Revision: 24827 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24827&view=rev Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp Log: When a partition was unpublished from devfs the devfs_delete_vnode() would also free the device info which it must not do, as this info is in fact just a pointer to the device info of the raw node. Removing a raw device that had partitions published therefore always lead into KDL when closing the raw device after unpublising the partition, as the close_hook pointer which sits in the device info now was 0xdeadbeef. This should make for example unplugging USB devices work as expected. Modified: haiku/trunk/src/system/kernel/fs/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-04-06 09:37:14 UTC (rev 24826) +++ haiku/trunk/src/system/kernel/fs/devfs.cpp 2008-04-06 12:07:45 UTC (rev 24827) @@ -824,16 +824,19 @@ hash_remove(fs->vnode_hash, vnode); if (S_ISCHR(vnode->stream.type)) { - // for partitions, we have to release the raw device + // for partitions, we have to release the raw device but must + // not free the device info as it was inherited from the raw + // device and is still in use there if (vnode->stream.u.dev.partition) { put_vnode(fs->volume, vnode->stream.u.dev.partition->raw_device->id); - } else + } else { delete vnode->stream.u.dev.scheduler; - // remove API conversion from old to new drivers - if (vnode->stream.u.dev.node == NULL) - free(vnode->stream.u.dev.info); + // remove API conversion from old to new drivers + if (vnode->stream.u.dev.node == NULL) + free(vnode->stream.u.dev.info); + } } free(vnode->name); From mmlr at mail.berlios.de Sun Apr 6 16:14:43 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 16:14:43 +0200 Subject: [Haiku-commits] r24828 - in haiku/trunk/src/add-ons/kernel: bus_managers/usb busses/usb Message-ID: <200804061414.m36EEhnH020121@sheep.berlios.de> Author: mmlr Date: 2008-04-06 16:14:42 +0200 (Sun, 06 Apr 2008) New Revision: 24828 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24828&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp Log: Change just host_controller_info to usb_host_controller_info for the sake of clearity as suggested by Philippe Houdoin once and brought to my attention by Slavatore. As this definition is completely private to the USB stack it would not have caused any conflicts though. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp 2008-04-06 12:07:45 UTC (rev 24827) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp 2008-04-06 14:14:42 UTC (rev 24828) @@ -61,7 +61,7 @@ bufferSize = sizeof(moduleName); TRACE(("USB Stack: found module %s\n", moduleName)); - host_controller_info *module = NULL; + usb_host_controller_info *module = NULL; if (get_module(moduleName, (module_info **)&module) != B_OK) continue; 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 2008-04-06 12:07:45 UTC (rev 24827) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2008-04-06 14:14:42 UTC (rev 24828) @@ -35,7 +35,7 @@ class PhysicalMemoryAllocator; -struct host_controller_info { +struct usb_host_controller_info { module_info info; status_t (*control)(uint32 op, void *data, size_t length); status_t (*add_to)(Stack *stack); Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-06 12:07:45 UTC (rev 24827) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-06 14:14:42 UTC (rev 24828) @@ -32,7 +32,7 @@ } -host_controller_info ehci_module = { +usb_host_controller_info ehci_module = { { "busses/usb/ehci", 0, Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-04-06 12:07:45 UTC (rev 24827) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-04-06 14:14:42 UTC (rev 24828) @@ -33,7 +33,7 @@ } -host_controller_info ohci_module = { +usb_host_controller_info ohci_module = { { "busses/usb/ohci", 0, Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-06 12:07:45 UTC (rev 24827) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-06 14:14:42 UTC (rev 24828) @@ -36,7 +36,7 @@ } -host_controller_info uhci_module = { +usb_host_controller_info uhci_module = { { "busses/usb/uhci", 0, From stippi at mail.berlios.de Sun Apr 6 16:36:14 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 16:36:14 +0200 Subject: [Haiku-commits] r24829 - haiku/trunk/src/tests/servers/app/workspace_activated Message-ID: <200804061436.m36EaErj022610@sheep.berlios.de> Author: stippi Date: 2008-04-06 16:36:14 +0200 (Sun, 06 Apr 2008) New Revision: 24829 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24829&view=rev Modified: haiku/trunk/src/tests/servers/app/workspace_activated/WorkspaceActivated.cpp Log: * Fixed missing include. Modified: haiku/trunk/src/tests/servers/app/workspace_activated/WorkspaceActivated.cpp =================================================================== --- haiku/trunk/src/tests/servers/app/workspace_activated/WorkspaceActivated.cpp 2008-04-06 14:14:42 UTC (rev 24828) +++ haiku/trunk/src/tests/servers/app/workspace_activated/WorkspaceActivated.cpp 2008-04-06 14:36:14 UTC (rev 24829) @@ -8,6 +8,7 @@ #include +#include #include #include From stippi at mail.berlios.de Sun Apr 6 16:39:22 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 16:39:22 +0200 Subject: [Haiku-commits] r24830 - haiku/trunk/src/tests/servers/registrar Message-ID: <200804061439.m36EdMSX022799@sheep.berlios.de> Author: stippi Date: 2008-04-06 16:39:22 +0200 (Sun, 06 Apr 2008) New Revision: 24830 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24830&view=rev Modified: haiku/trunk/src/tests/servers/registrar/Jamfile Log: Fixed the build of the registrar for the app_server test environment. Modified: haiku/trunk/src/tests/servers/registrar/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/registrar/Jamfile 2008-04-06 14:36:14 UTC (rev 24829) +++ haiku/trunk/src/tests/servers/registrar/Jamfile 2008-04-06 14:39:22 UTC (rev 24830) @@ -87,6 +87,8 @@ RecentApps.cpp RecentEntries.cpp Registrar.cpp + RegistrarThread.cpp + RegistrarThreadManager.cpp RosterAppInfo.cpp RosterSettingsCharStream.cpp ShutdownProcess.cpp From mmu_man at mail.berlios.de Sun Apr 6 16:52:44 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 6 Apr 2008 16:52:44 +0200 Subject: [Haiku-commits] r24831 - haiku/trunk/src/apps/mediaplayer Message-ID: <200804061452.m36EqiNL025431@sheep.berlios.de> Author: mmu_man Date: 2008-04-06 16:52:43 +0200 (Sun, 06 Apr 2008) New Revision: 24831 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24831&view=rev Modified: haiku/trunk/src/apps/mediaplayer/Jamfile haiku/trunk/src/apps/mediaplayer/MainApp.cpp haiku/trunk/src/apps/mediaplayer/MainApp.h haiku/trunk/src/apps/mediaplayer/MainWin.cpp Log: Add recent files to the Open File menu. Add dropped files to the roster's list of recent files. Modified: haiku/trunk/src/apps/mediaplayer/Jamfile =================================================================== --- haiku/trunk/src/apps/mediaplayer/Jamfile 2008-04-06 14:39:22 UTC (rev 24830) +++ haiku/trunk/src/apps/mediaplayer/Jamfile 2008-04-06 14:52:43 UTC (rev 24831) @@ -4,6 +4,9 @@ AddSubDirSupportedPlatforms libbe_test ; +# for BRecentItems +UsePublicHeaders [ FDirName be_apps Tracker ] ; + # source directories local sourceDirs = playlist Modified: haiku/trunk/src/apps/mediaplayer/MainApp.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2008-04-06 14:39:22 UTC (rev 24830) +++ haiku/trunk/src/apps/mediaplayer/MainApp.cpp 2008-04-06 14:52:43 UTC (rev 24831) @@ -32,13 +32,14 @@ MainApp *gMainApp; +const char* kAppSig = "application/x-vnd.Haiku-MediaPlayer"; static const char* kMediaServerSig = "application/x-vnd.Be.media-server"; static const char* kMediaServerAddOnSig = "application/x-vnd.Be.addon-host"; MainApp::MainApp() - : BApplication("application/x-vnd.Haiku-MediaPlayer"), + : BApplication(kAppSig), fPlayerCount(0), fFirstWindow(NewWindow()), Modified: haiku/trunk/src/apps/mediaplayer/MainApp.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainApp.h 2008-04-06 14:39:22 UTC (rev 24830) +++ haiku/trunk/src/apps/mediaplayer/MainApp.h 2008-04-06 14:52:43 UTC (rev 24831) @@ -56,5 +56,6 @@ }; extern MainApp* gMainApp; +extern const char* kAppSig; #endif Modified: haiku/trunk/src/apps/mediaplayer/MainWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2008-04-06 14:39:22 UTC (rev 24830) +++ haiku/trunk/src/apps/mediaplayer/MainWin.cpp 2008-04-06 14:52:43 UTC (rev 24831) @@ -35,6 +35,8 @@ #include #include #include +#include +#include #include #include #include @@ -347,8 +349,14 @@ break; case B_SIMPLE_DATA: printf("MainWin::MessageReceived: B_SIMPLE_DATA\n"); - if (msg->HasRef("refs")) + if (msg->HasRef("refs")) { + // add to recent documents as it's not done with drag-n-drop + entry_ref ref; + for (int32 i = 0; msg->FindRef("refs", i, &ref) == B_OK; i++) { + be_roster->AddToRecentDocuments(&ref, kAppSig); + } _RefsReceived(msg); + } break; case M_MEDIA_SERVER_STARTED: @@ -833,8 +841,17 @@ fFileMenu->AddItem(new BMenuItem("New Player"B_UTF8_ELLIPSIS, new BMessage(M_FILE_NEWPLAYER), 'N')); fFileMenu->AddSeparatorItem(); - fFileMenu->AddItem(new BMenuItem("Open File"B_UTF8_ELLIPSIS, - new BMessage(M_FILE_OPEN), 'O')); + +// fFileMenu->AddItem(new BMenuItem("Open File"B_UTF8_ELLIPSIS, +// new BMessage(M_FILE_OPEN), 'O')); + // Add recent files + BRecentFilesList recentFiles(10, false, NULL, kAppSig); + BMenuItem *item = new BMenuItem(recentFiles.NewFileListMenu( + "Open File"B_UTF8_ELLIPSIS, new BMessage(B_REFS_RECEIVED), + NULL, this, 10, false, NULL, 0, kAppSig), new BMessage(M_FILE_OPEN)); + item->SetShortcut('O', 0); + fFileMenu->AddItem(item); + fFileMenu->AddItem(new BMenuItem("File Info"B_UTF8_ELLIPSIS, new BMessage(M_FILE_INFO), 'I')); fFileMenu->AddItem(fPlaylistMenu); From stippi at mail.berlios.de Sun Apr 6 17:11:31 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 17:11:31 +0200 Subject: [Haiku-commits] r24832 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200804061511.m36FBV6H028023@sheep.berlios.de> Author: stippi Date: 2008-04-06 17:11:31 +0200 (Sun, 06 Apr 2008) New Revision: 24832 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24832&view=rev Modified: haiku/trunk/headers/os/interface/ScrollBar.h haiku/trunk/src/kits/interface/ScrollBar.cpp Log: * Removed trailing spaces in ScrollBar.h * It's not a good idea to archive fProportion as int32, seeing it's a float on [0..1]. * Implemented archive constructor for BScrollBar. Untested. Modified: haiku/trunk/headers/os/interface/ScrollBar.h =================================================================== --- haiku/trunk/headers/os/interface/ScrollBar.h 2008-04-06 14:52:43 UTC (rev 24831) +++ haiku/trunk/headers/os/interface/ScrollBar.h 2008-04-06 15:11:31 UTC (rev 24832) @@ -112,7 +112,7 @@ float fLargeStep; float fValue; float fProportion; - BView* fTarget; + BView* fTarget; orientation fOrientation; char* fTargetName; Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 14:52:43 UTC (rev 24831) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 15:11:31 UTC (rev 24832) @@ -199,6 +199,24 @@ BScrollBar::BScrollBar(BMessage *data) : BView(data) { + if (data->FindFloat("_range", 0, &fMin) < B_OK) + fMin = 0.0; + if (data->FindFloat("_range", 1, &fMax) < B_OK) + fMax = 0.0; + if (data->FindFloat("_steps", 0, &fSmallStep) < B_OK) + fSmallStep = 1.0; + if (data->FindFloat("_steps", 1, &fLargeStep) < B_OK) + fSmallStep = 10.0; + if (data->FindFloat("_val", &fValue) < B_OK) + fValue = 0.0; + int32 orientation; + if (data->FindInt32("_orient", &orientation) < B_OK) + fOrientation = B_VERTICAL; + else + fOrientation = (enum orientation)orientation; + + if (data->FindFloat("_prop", &fProportion) < B_OK) + fProportion = 0.0; } @@ -248,7 +266,7 @@ err = data->AddInt32("_orient", (int32)fOrientation); if (err != B_OK) return err; - err = data->AddInt32("_prop", (int32)fProportion); + err = data->AddFloat("_prop", fProportion); return err; } From bonefish at mail.berlios.de Sun Apr 6 17:45:07 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 17:45:07 +0200 Subject: [Haiku-commits] r24833 - haiku/trunk/src/system/kernel Message-ID: <200804061545.m36Fj7WM032673@sheep.berlios.de> Author: bonefish Date: 2008-04-06 17:45:07 +0200 (Sun, 06 Apr 2008) New Revision: 24833 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24833&view=rev Modified: haiku/trunk/src/system/kernel/module.cpp Log: Removed pipefs from the built-in modules. Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2008-04-06 15:11:31 UTC (rev 24832) +++ haiku/trunk/src/system/kernel/module.cpp 2008-04-06 15:45:07 UTC (rev 24833) @@ -51,7 +51,6 @@ // file systems extern module_info gRootFileSystem; extern module_info gDeviceFileSystem; -extern module_info gPipeFileSystem; static module_info *sBuiltInModules[] = { &gDeviceManagerModule, @@ -61,7 +60,6 @@ &gRootFileSystem, &gDeviceFileSystem, - &gPipeFileSystem, NULL }; From bonefish at mail.berlios.de Sun Apr 6 17:50:29 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 6 Apr 2008 17:50:29 +0200 Subject: [Haiku-commits] r24834 - haiku/trunk/src/system/kernel/fs Message-ID: <200804061550.m36FoTJC001119@sheep.berlios.de> Author: bonefish Date: 2008-04-06 17:50:28 +0200 (Sun, 06 Apr 2008) New Revision: 24834 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24834&view=rev Added: haiku/trunk/src/system/kernel/fs/fifo.cpp Removed: haiku/trunk/src/system/kernel/fs/pipefs.cpp Modified: haiku/trunk/src/system/kernel/fs/Jamfile Log: * Renamed pipefs.cpp to fifo.cpp. * Removed the pipefs functionality. We only need to support FIFO nodes. * Renamed the remaining pipefs_*() functions to fifo_*(). Modified: haiku/trunk/src/system/kernel/fs/Jamfile =================================================================== --- haiku/trunk/src/system/kernel/fs/Jamfile 2008-04-06 15:45:07 UTC (rev 24833) +++ haiku/trunk/src/system/kernel/fs/Jamfile 2008-04-06 15:50:28 UTC (rev 24834) @@ -7,15 +7,15 @@ KernelMergeObject kernel_fs.o : devfs.cpp + fd.cpp + fifo.cpp + IOScheduler.cpp + KPath.cpp + node_monitor.cpp rootfs.cpp - pipefs.cpp - fd.cpp vfs.cpp vfs_boot.cpp vfs_net_boot.cpp - node_monitor.cpp - IOScheduler.cpp - KPath.cpp : $(TARGET_KERNEL_PIC_CCFLAGS) -Wno-unused ; Copied: haiku/trunk/src/system/kernel/fs/fifo.cpp (from rev 24831, haiku/trunk/src/system/kernel/fs/pipefs.cpp) =================================================================== --- haiku/trunk/src/system/kernel/fs/pipefs.cpp 2008-04-06 14:52:43 UTC (rev 24831) +++ haiku/trunk/src/system/kernel/fs/fifo.cpp 2008-04-06 15:50:28 UTC (rev 24834) @@ -0,0 +1,1078 @@ +/* + * Copyright 2007-2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Copyright 2003-2007, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fifo.h" + + +//#define TRACE_FIFO +#ifdef TRACE_FIFO +# define TRACE(x) dprintf x +#else +# define TRACE(x) +#endif + + +#define PIPEFS_HASH_SIZE 16 +#define PIPEFS_MAX_BUFFER_SIZE 32768 + + +// TODO: PIPE_BUF is supposed to be defined somewhere else. +#define PIPE_BUF _POSIX_PIPE_BUF + + +namespace fifo { + +class Inode; + +class RingBuffer { + public: + RingBuffer(); + ~RingBuffer(); + + status_t CreateBuffer(); + void DeleteBuffer(); + + size_t Write(const void *buffer, size_t length); + size_t Read(void *buffer, size_t length); + ssize_t UserWrite(const void *buffer, ssize_t length); + ssize_t UserRead(void *buffer, ssize_t length); + + size_t Readable() const; + size_t Writable() const; + + private: + struct ring_buffer *fBuffer; +}; + + +class ReadRequest : public DoublyLinkedListLinkImpl { + public: + void SetUnnotified() { fNotified = false; } + + void Notify() + { + if (!fNotified) { + fWaitCondition.NotifyOne(); + fNotified = true; + } + } + + ConditionVariable<>& WaitCondition() { return fWaitCondition; } + + private: + ConditionVariable<> fWaitCondition; + bool fNotified; +}; + + +class WriteRequest : public DoublyLinkedListLinkImpl { + public: + WriteRequest(size_t minimalWriteCount) + : + fMinimalWriteCount(minimalWriteCount) + { + } + + size_t MinimalWriteCount() const + { + return fMinimalWriteCount; + } + + private: + size_t fMinimalWriteCount; +}; + + +typedef DoublyLinkedList ReadRequestList; +typedef DoublyLinkedList WriteRequestList; + + +class Inode { + public: + Inode(); + ~Inode(); + + status_t InitCheck(); + + bool IsActive() const { return fActive; } + time_t CreationTime() const { return fCreationTime; } + void SetCreationTime(time_t creationTime) + { fCreationTime = creationTime; } + time_t ModificationTime() const { return fModificationTime; } + void SetModificationTime(time_t modificationTime) + { fModificationTime = modificationTime; } + + benaphore *RequestLock() { return &fRequestLock; } + + status_t WriteDataToBuffer(const void *data, size_t *_length, + bool nonBlocking); + status_t ReadDataFromBuffer(void *data, size_t *_length, + bool nonBlocking, ReadRequest &request); + size_t BytesAvailable() const { return fBuffer.Readable(); } + size_t BytesWritable() const { return fBuffer.Writable(); } + + void AddReadRequest(ReadRequest &request); + void RemoveReadRequest(ReadRequest &request); + status_t WaitForReadRequest(ReadRequest &request); + + void NotifyBytesRead(size_t bytes); + void NotifyReadDone(); + void NotifyBytesWritten(size_t bytes); + void NotifyEndClosed(bool writer); + + void Open(int openMode); + void Close(int openMode); + int32 ReaderCount() const { return fReaderCount; } + int32 WriterCount() const { return fWriterCount; } + + status_t Select(uint8 event, uint32 ref, selectsync *sync, + int openMode); + status_t Deselect(uint8 event, selectsync *sync, int openMode); + + private: + time_t fCreationTime; + time_t fModificationTime; + + RingBuffer fBuffer; + + ReadRequestList fReadRequests; + WriteRequestList fWriteRequests; + + benaphore fRequestLock; + + ConditionVariable<> fWriteCondition; + + int32 fReaderCount; + int32 fWriterCount; + bool fActive; + + select_sync_pool *fReadSelectSyncPool; + select_sync_pool *fWriteSelectSyncPool; +}; + + +class FIFOInode : public Inode { +public: + FIFOInode(fs_vnode* vnode) + : + Inode(), + fSuperVnode(*vnode) + { + } + + fs_vnode* SuperVnode() { return &fSuperVnode; } + +private: + fs_vnode fSuperVnode; +}; + + +struct file_cookie { + int open_mode; +}; + + +//--------------------- + + +RingBuffer::RingBuffer() + : fBuffer(NULL) +{ +} + + +RingBuffer::~RingBuffer() +{ + DeleteBuffer(); +} + + +status_t +RingBuffer::CreateBuffer() +{ + if (fBuffer != NULL) + return B_OK; + + fBuffer = create_ring_buffer(PIPEFS_MAX_BUFFER_SIZE); + return (fBuffer != NULL ? B_OK : B_NO_MEMORY); +} + + +void +RingBuffer::DeleteBuffer() +{ + if (fBuffer != NULL) { + delete_ring_buffer(fBuffer); + fBuffer = NULL; + } +} + + +inline size_t +RingBuffer::Write(const void *buffer, size_t length) +{ + if (fBuffer == NULL) + return B_NO_MEMORY; + + return ring_buffer_write(fBuffer, (const uint8 *)buffer, length); +} + + +inline size_t +RingBuffer::Read(void *buffer, size_t length) +{ + if (fBuffer == NULL) + return B_NO_MEMORY; + + return ring_buffer_read(fBuffer, (uint8 *)buffer, length); +} + + +inline ssize_t +RingBuffer::UserWrite(const void *buffer, ssize_t length) +{ + if (fBuffer == NULL) + return B_NO_MEMORY; + + return ring_buffer_user_write(fBuffer, (const uint8 *)buffer, length); +} + + +inline ssize_t +RingBuffer::UserRead(void *buffer, ssize_t length) +{ + if (fBuffer == NULL) + return B_NO_MEMORY; + + return ring_buffer_user_read(fBuffer, (uint8 *)buffer, length); +} + + +inline size_t +RingBuffer::Readable() const +{ + return (fBuffer != NULL ? ring_buffer_readable(fBuffer) : 0); +} + + +inline size_t +RingBuffer::Writable() const +{ + return (fBuffer != NULL ? ring_buffer_writable(fBuffer) : 0); +} + + +// #pragma mark - + + +Inode::Inode() + : + fReadRequests(), + fWriteRequests(), + fReaderCount(0), + fWriterCount(0), + fActive(false), + fReadSelectSyncPool(NULL), + fWriteSelectSyncPool(NULL) +{ + fWriteCondition.Publish(this, "pipe"); + benaphore_init(&fRequestLock, "pipe request"); + + fCreationTime = fModificationTime = time(NULL); +} + + +Inode::~Inode() +{ + fWriteCondition.Unpublish(); + benaphore_destroy(&fRequestLock); +} + + +status_t +Inode::InitCheck() +{ + if (fRequestLock.sem < B_OK) + return B_ERROR; + + return B_OK; +} + + +/*! + Writes the specified data bytes to the inode's ring buffer. The + request lock must be held when calling this method. + Notifies readers if necessary, so that blocking readers will get started. + Returns B_OK for success, B_BAD_ADDRESS if copying from the buffer failed, + and various semaphore errors (like B_WOULD_BLOCK in non-blocking mode). If + the returned length is > 0, the returned error code can be ignored. +*/ +status_t +Inode::WriteDataToBuffer(const void *_data, size_t *_length, bool nonBlocking) +{ + const uint8* data = (const uint8*)_data; + size_t dataSize = *_length; + size_t& written = *_length; + written = 0; + + TRACE(("Inode::WriteDataToBuffer(data = %p, bytes = %lu)\n", + data, dataSize)); + + // According to the standard, request up to PIPE_BUF bytes shall not be + // interleaved with other writer's data. + size_t minToWrite = 1; + if (dataSize <= PIPE_BUF) + minToWrite = dataSize; + + while (dataSize > 0) { + // Wait until enough space in the buffer is available. + while (!fActive + || fBuffer.Writable() < minToWrite && fReaderCount > 0) { + if (nonBlocking) + return B_WOULD_BLOCK; + + ConditionVariableEntry<> entry; + entry.Add(this); + + WriteRequest request(minToWrite); + fWriteRequests.Add(&request); + + benaphore_unlock(&fRequestLock); + status_t status = entry.Wait(B_CAN_INTERRUPT); + benaphore_lock(&fRequestLock); + + fWriteRequests.Remove(&request); + + if (status != B_OK) + return status; + } + + // write only as long as there are readers left + if (fReaderCount == 0 && fActive) { + if (written == 0) + send_signal(find_thread(NULL), SIGPIPE); + return EPIPE; + } + + // write as much as we can + + size_t toWrite = (fActive ? fBuffer.Writable() : 0); + if (toWrite > dataSize) + toWrite = dataSize; + + if (toWrite > 0 && fBuffer.UserWrite(data, toWrite) < B_OK) + return B_BAD_ADDRESS; + + data += toWrite; + dataSize -= toWrite; + written += toWrite; + + NotifyBytesWritten(toWrite); + } + + return B_OK; +} + + +status_t +Inode::ReadDataFromBuffer(void *data, size_t *_length, bool nonBlocking, + ReadRequest &request) +{ + size_t dataSize = *_length; + *_length = 0; + + // wait until our request is first in queue + status_t error; + if (fReadRequests.Head() != &request) { + if (nonBlocking) + return B_WOULD_BLOCK; + + error = WaitForReadRequest(request); + if (error != B_OK) + return error; + } + + // wait until data are available + while (fBuffer.Readable() == 0) { + if (nonBlocking) + return B_WOULD_BLOCK; + + if (fActive && fWriterCount == 0) + return B_OK; + + error = WaitForReadRequest(request); + if (error != B_OK) + return error; + } + + // read as much as we can + size_t toRead = fBuffer.Readable(); + if (toRead > dataSize) + toRead = dataSize; + + if (fBuffer.UserRead(data, toRead) < B_OK) + return B_BAD_ADDRESS; + + NotifyBytesRead(toRead); + + *_length = toRead; + + return B_OK; +} + + +void +Inode::AddReadRequest(ReadRequest &request) +{ + fReadRequests.Add(&request); +} + + +void +Inode::RemoveReadRequest(ReadRequest &request) +{ + fReadRequests.Remove(&request); +} + + +status_t +Inode::WaitForReadRequest(ReadRequest &request) +{ + request.SetUnnotified(); + + // publish the condition variable + ConditionVariable<>& conditionVariable = request.WaitCondition(); + conditionVariable.Publish(&request, "pipe request"); + + // add the entry to wait on + ConditionVariableEntry<> entry; + entry.Add(&request); + + // wait + benaphore_unlock(&fRequestLock); + status_t status = entry.Wait(B_CAN_INTERRUPT); + benaphore_lock(&fRequestLock); + + // unpublish the condition variable + conditionVariable.Unpublish(); + + return status; +} + + +void +Inode::NotifyBytesRead(size_t bytes) +{ + // notify writer, if something can be written now + size_t writable = fBuffer.Writable(); + if (bytes > 0) { + // notify select()ors only, if nothing was writable before + if (writable == bytes) { + if (fWriteSelectSyncPool) + notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_WRITE); + } + + // If any of the waiting writers has a minimal write count that has + // now become satisfied, we notify all of them (condition variables + // don't support doing that selectively). + WriteRequest *request; + WriteRequestList::Iterator iterator = fWriteRequests.GetIterator(); + while ((request = iterator.Next()) != NULL) { + size_t minWriteCount = request->MinimalWriteCount(); + if (minWriteCount > 0 && minWriteCount <= writable + && minWriteCount > writable - bytes) { + fWriteCondition.NotifyAll(); + break; + } + } + } +} + + +void +Inode::NotifyReadDone() +{ + // notify next reader, if there's still something to be read + if (fBuffer.Readable() > 0) { + if (ReadRequest* request = fReadRequests.First()) + request->Notify(); + } +} + + +void +Inode::NotifyBytesWritten(size_t bytes) +{ + // notify reader, if something can be read now + if (bytes > 0 && fBuffer.Readable() == bytes) { + if (fReadSelectSyncPool) + notify_select_event_pool(fReadSelectSyncPool, B_SELECT_READ); + + if (ReadRequest* request = fReadRequests.First()) + request->Notify(); + } +} + + +void +Inode::NotifyEndClosed(bool writer) +{ + if (writer) { + // Our last writer has been closed; if the pipe + // contains no data, unlock all waiting readers + if (fBuffer.Readable() == 0) { + ReadRequest *request; + ReadRequestList::Iterator iterator = fReadRequests.GetIterator(); + while ((request = iterator.Next()) != NULL) + request->Notify(); + + if (fReadSelectSyncPool) + notify_select_event_pool(fReadSelectSyncPool, B_SELECT_READ); + } + } else { + // Last reader is gone. Wake up all writers. + fWriteCondition.NotifyAll(); + + if (fWriteSelectSyncPool) { + notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_WRITE); + notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_ERROR); + } + } +} + + +void +Inode::Open(int openMode) +{ + BenaphoreLocker locker(RequestLock()); + + if ((openMode & O_ACCMODE) == O_WRONLY) + fWriterCount++; + + if ((openMode & O_ACCMODE) == O_RDONLY || (openMode & O_ACCMODE) == O_RDWR) + fReaderCount++; + + if (fReaderCount > 0 && fWriterCount > 0) { + fBuffer.CreateBuffer(); + fActive = true; + + // notify all waiting writers that they can start + if (fWriteSelectSyncPool) + notify_select_event_pool(fWriteSelectSyncPool, B_SELECT_WRITE); + fWriteCondition.NotifyAll(); + } +} + + +void +Inode::Close(int openMode) +{ + TRACE(("Inode::Close(openMode = %d)\n", openMode)); + + BenaphoreLocker locker(RequestLock()); + + if ((openMode & O_ACCMODE) == O_WRONLY && --fWriterCount == 0) + NotifyEndClosed(true); + + if ((openMode & O_ACCMODE) == O_RDONLY || (openMode & O_ACCMODE) == O_RDWR) { + if (--fReaderCount == 0) + NotifyEndClosed(false); + } + + if (fReaderCount == 0 && fWriterCount == 0) { + fActive = false; + fBuffer.DeleteBuffer(); + } +} + + +status_t +Inode::Select(uint8 event, uint32 ref, selectsync *sync, int openMode) +{ + bool writer = true; + select_sync_pool** pool; + if ((openMode & O_RWMASK) == O_RDONLY) { + pool = &fReadSelectSyncPool; + writer = false; + } else if ((openMode & O_RWMASK) == O_WRONLY) { + pool = &fWriteSelectSyncPool; + } else + return B_NOT_ALLOWED; + + if (add_select_sync_pool_entry(pool, sync, event) != B_OK) + return B_ERROR; + + // 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) { + return notify_select_event(sync, event); + } + } else { + if (event == B_SELECT_READ + && (fBuffer.Readable() > 0 || fWriterCount == 0)) { + return notify_select_event(sync, event); + } + } + + return B_OK; +} + + +status_t +Inode::Deselect(uint8 event, selectsync *sync, int openMode) +{ + select_sync_pool** pool; + if ((openMode & O_RWMASK) == O_RDONLY) { + pool = &fReadSelectSyncPool; + } else if ((openMode & O_RWMASK) == O_WRONLY) { + pool = &fWriteSelectSyncPool; + } else + return B_NOT_ALLOWED; + + remove_select_sync_pool_entry(pool, sync, event); + return B_OK; +} + + +// #pragma mark - + + +static status_t +fifo_put_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter) +{ + FIFOInode* fifo = (FIFOInode*)vnode->private_node; + fs_vnode* superVnode = fifo->SuperVnode(); + + status_t error = B_OK; + if (superVnode->ops->put_vnode != NULL) + error = superVnode->ops->put_vnode(volume, superVnode, reenter); + + delete fifo; + + return error; +} + + +static status_t +fifo_remove_vnode(fs_volume *volume, fs_vnode *vnode, bool reenter) +{ + FIFOInode* fifo = (FIFOInode*)vnode->private_node; + fs_vnode* superVnode = fifo->SuperVnode(); + + status_t error = B_OK; + if (superVnode->ops->remove_vnode != NULL) + error = superVnode->ops->remove_vnode(volume, superVnode, reenter); + + delete fifo; + + return error; +} + + +static status_t +fifo_open(fs_volume *_volume, fs_vnode *_node, int openMode, + void **_cookie) +{ + Inode *inode = (Inode *)_node->private_node; + + TRACE(("fifo_open(): node = %p, openMode = %d\n", inode, openMode)); + + file_cookie *cookie = (file_cookie *)malloc(sizeof(file_cookie)); + if (cookie == NULL) + return B_NO_MEMORY; + + TRACE((" open cookie = %p\n", cookie)); + cookie->open_mode = openMode; + inode->Open(openMode); + + *_cookie = (void *)cookie; + + return B_OK; +} + + +static status_t +fifo_close(fs_volume *volume, fs_vnode *vnode, void *_cookie) +{ + file_cookie *cookie = (file_cookie *)_cookie; + FIFOInode* fifo = (FIFOInode*)vnode->private_node; + + fifo->Close(cookie->open_mode); + + return B_OK; +} + + +static status_t +fifo_free_cookie(fs_volume *_volume, fs_vnode *_node, void *_cookie) +{ + file_cookie *cookie = (file_cookie *)_cookie; + + TRACE(("fifo_freecookie: entry vnode %p, cookie %p\n", _node, _cookie)); + + free(cookie); + + return B_OK; +} + + +static status_t +fifo_fsync(fs_volume *_volume, fs_vnode *_v) +{ + return B_OK; +} + + +static status_t +fifo_read(fs_volume *_volume, fs_vnode *_node, void *_cookie, + off_t /*pos*/, void *buffer, size_t *_length) +{ + file_cookie *cookie = (file_cookie *)_cookie; + Inode *inode = (Inode *)_node->private_node; + + TRACE(("fifo_read(vnode = %p, cookie = %p, length = %lu, mode = %d)\n", + inode, cookie, *_length, cookie->open_mode)); + + if ((cookie->open_mode & O_RWMASK) != O_RDONLY) + return B_NOT_ALLOWED; + + BenaphoreLocker locker(inode->RequestLock()); + + if (inode->IsActive() && inode->WriterCount() == 0) { + // as long there is no writer, and the pipe is empty, + // we always just return 0 to indicate end of file + if (inode->BytesAvailable() == 0) { + *_length = 0; + return B_OK; + } + } + + // issue read request + + ReadRequest request; + inode->AddReadRequest(request); + + size_t length = *_length; + status_t status = inode->ReadDataFromBuffer(buffer, &length, + (cookie->open_mode & O_NONBLOCK) != 0, request); + + inode->RemoveReadRequest(request); + inode->NotifyReadDone(); + + if (length > 0) + status = B_OK; + + *_length = length; + return status; +} + + +static status_t +fifo_write(fs_volume *_volume, fs_vnode *_node, void *_cookie, + off_t /*pos*/, const void *buffer, size_t *_length) +{ + file_cookie *cookie = (file_cookie *)_cookie; + Inode *inode = (Inode *)_node->private_node; + + TRACE(("fifo_write(vnode = %p, cookie = %p, length = %lu)\n", + _node, cookie, *_length)); + + if ((cookie->open_mode & O_RWMASK) != O_WRONLY) + return B_NOT_ALLOWED; + + BenaphoreLocker locker(inode->RequestLock()); + + size_t length = *_length; + if (length == 0) + return B_OK; + + // copy data into ring buffer + status_t status = inode->WriteDataToBuffer(buffer, &length, + (cookie->open_mode & O_NONBLOCK) != 0); + + if (length > 0) + status = B_OK; + + *_length = length; + return status; +} + + +static status_t +fifo_read_stat(fs_volume *volume, fs_vnode *vnode, struct ::stat *st) +{ + FIFOInode* fifo = (FIFOInode*)vnode->private_node; + fs_vnode* superVnode = fifo->SuperVnode(); + + if (superVnode->ops->read_stat == NULL) + return B_BAD_VALUE; + + status_t error = superVnode->ops->read_stat(volume, superVnode, st); + if (error != B_OK) + return error; + + + BenaphoreLocker locker(fifo->RequestLock()); + + st->st_size = fifo->BytesAvailable(); + + st->st_blksize = 4096; + +// TODO: Just pass the changes to our modification time on to the super node. + st->st_atime = time(NULL); + st->st_mtime = st->st_ctime = fifo->ModificationTime(); +// st->st_crtime = inode->CreationTime(); + + return B_OK; +} + + +static status_t +fifo_write_stat(fs_volume *volume, fs_vnode *vnode, const struct ::stat *st, + uint32 statMask) +{ + // we cannot change the size of anything + if (statMask & B_STAT_SIZE) + return B_BAD_VALUE; + + FIFOInode* fifo = (FIFOInode*)vnode->private_node; + fs_vnode* superVnode = fifo->SuperVnode(); + + if (superVnode->ops->write_stat == NULL) + return B_BAD_VALUE; + + status_t error = superVnode->ops->write_stat(volume, superVnode, st, + statMask); + if (error != B_OK) + return error; + + return B_OK; +} + + +static status_t +fifo_ioctl(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, ulong op, + void *buffer, size_t length) +{ + TRACE(("fifo_ioctl: vnode %p, cookie %p, op %ld, buf %p, len %ld\n", + _vnode, _cookie, op, buffer, length)); + + return EINVAL; +} + + +static status_t +fifo_set_flags(fs_volume *_volume, fs_vnode *_vnode, void *_cookie, + int flags) +{ + file_cookie *cookie = (file_cookie *)_cookie; + + TRACE(("fifo_set_flags(vnode = %p, flags = %x)\n", _vnode, flags)); + cookie->open_mode = (cookie->open_mode & ~(O_APPEND | O_NONBLOCK)) | flags; + return B_OK; +} + + +static status_t +fifo_select(fs_volume *_volume, fs_vnode *_node, void *_cookie, + uint8 event, uint32 ref, selectsync *sync) +{ + file_cookie *cookie = (file_cookie *)_cookie; + + TRACE(("fifo_select(vnode = %p)\n", _node)); + Inode *inode = (Inode *)_node->private_node; + if (!inode) + return B_ERROR; + + BenaphoreLocker locker(inode->RequestLock()); + return inode->Select(event, ref, sync, cookie->open_mode); +} + + +static status_t +fifo_deselect(fs_volume *_volume, fs_vnode *_node, void *_cookie, + uint8 event, selectsync *sync) +{ + file_cookie *cookie = (file_cookie *)_cookie; + + TRACE(("fifo_deselect(vnode = %p)\n", _node)); + Inode *inode = (Inode *)_node->private_node; + if (!inode) + return B_ERROR; + + BenaphoreLocker locker(inode->RequestLock()); + return inode->Deselect(event, sync, cookie->open_mode); +} + + +static bool +fifo_can_page(fs_volume *_volume, fs_vnode *_v, void *cookie) +{ + return false; +} + + +static status_t +fifo_read_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, off_t pos, + const iovec *vecs, size_t count, size_t *_numBytes, bool reenter) +{ + return B_NOT_ALLOWED; +} + + +static status_t +fifo_write_pages(fs_volume *_volume, fs_vnode *_v, void *cookie, + off_t pos, const iovec *vecs, size_t count, size_t *_numBytes, bool reenter) +{ + return B_NOT_ALLOWED; +} + + +static status_t +fifo_get_super_vnode(fs_volume *volume, fs_vnode *vnode, fs_volume *superVolume, + fs_vnode *_superVnode) +{ + FIFOInode* fifo = (FIFOInode*)vnode->private_node; + fs_vnode* superVnode = fifo->SuperVnode(); + + if (superVnode->ops->get_super_vnode != NULL) { + return superVnode->ops->get_super_vnode(volume, superVnode, superVolume, + _superVnode); [... truncated: 112 lines follow ...] From mmlr at mail.berlios.de Sun Apr 6 17:57:27 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 17:57:27 +0200 Subject: [Haiku-commits] r24835 - haiku/trunk/src/add-ons/kernel/drivers/bus/usb Message-ID: <200804061557.m36FvR4o001855@sheep.berlios.de> Author: mmlr Date: 2008-04-06 17:57:26 +0200 (Sun, 06 Apr 2008) New Revision: 24835 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24835&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h Log: Implement a binary compatible way of setting an alternate interface through usb_raw. Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-06 15:50:28 UTC (rev 24834) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-06 15:57:26 UTC (rev 24835) @@ -258,7 +258,7 @@ } const usb_interface_info *interfaceInfo = - configurationInfo->interface[command->endpoint.interface_index].active; + configurationInfo->interface[command->interface.interface_index].active; if (!interfaceInfo) { command->interface.status = RAW_STATUS_ABORTED; return B_OK; @@ -270,6 +270,26 @@ return B_OK; } + case RAW_COMMAND_GET_ALT_INTERFACE_COUNT: { + const usb_configuration_info *configurationInfo = + gUSBModule->get_nth_configuration(device->device, + command->alternate.config_index); + if (!configurationInfo) { + command->alternate.status = RAW_STATUS_INVALID_CONFIGURATION; + return B_OK; + } + + if (command->alternate.interface_index >= configurationInfo->interface_count) { + command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + return B_OK; + } + + *command->alternate.alternate_count + = configurationInfo->interface[command->alternate.interface_index].alt_count; + command->alternate.status = RAW_STATUS_SUCCESS; + return B_OK; + } + case RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, @@ -446,6 +466,37 @@ return B_OK; } + case RAW_COMMAND_SET_ALT_INTERFACE: { + const usb_configuration_info *configurationInfo = + gUSBModule->get_nth_configuration(device->device, + command->alternate.config_index); + if (!configurationInfo) { + command->alternate.status = RAW_STATUS_INVALID_CONFIGURATION; + return B_OK; + } + + if (command->alternate.interface_index >= configurationInfo->interface_count) { + command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + return B_OK; + } + + const usb_interface_list *interfaceList = + &configurationInfo->interface[command->alternate.interface_index]; + if (command->alternate.alternate_index >= interfaceList->alt_count) { + command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + return B_OK; + } + + if (gUSBModule->set_alt_interface(device->device, + &interfaceList->alt[command->alternate.alternate_index]) < B_OK) { + command->alternate.status = RAW_STATUS_FAILED; + return B_OK; + } + + command->alternate.status = RAW_STATUS_SUCCESS; + return B_OK; + } + case RAW_COMMAND_CONTROL_TRANSFER: { benaphore_lock(&device->lock); if (gUSBModule->queue_request(device->device, Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-06 15:50:28 UTC (rev 24834) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-06 15:57:26 UTC (rev 24835) @@ -23,12 +23,14 @@ RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR, RAW_COMMAND_GET_STRING_DESCRIPTOR, RAW_COMMAND_GET_GENERIC_DESCRIPTOR, + RAW_COMMAND_GET_ALT_INTERFACE_COUNT, RAW_COMMAND_SET_CONFIGURATION = 0x3000, RAW_COMMAND_SET_FEATURE, RAW_COMMAND_CLEAR_FEATURE, RAW_COMMAND_GET_STATUS, RAW_COMMAND_GET_DESCRIPTOR, + RAW_COMMAND_SET_ALT_INTERFACE, RAW_COMMAND_CONTROL_TRANSFER = 0x4000, RAW_COMMAND_INTERRUPT_TRANSFER, @@ -80,6 +82,14 @@ struct { status_t status; + uint32 *alternate_count; + uint32 config_index; + uint32 interface_index; + uint32 alternate_index; + } alternate; + + struct { + status_t status; usb_endpoint_descriptor *descriptor; uint32 config_index; uint32 interface_index; From stippi at mail.berlios.de Sun Apr 6 18:22:11 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 18:22:11 +0200 Subject: [Haiku-commits] r24836 - haiku/trunk/src/kits/interface Message-ID: <200804061622.m36GMBak005201@sheep.berlios.de> Author: stippi Date: 2008-04-06 18:22:10 +0200 (Sun, 06 Apr 2008) New Revision: 24836 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24836&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp Log: * Added optional tracing to ScrollBar.cpp. * Fixed line breaks to not exceed 80 char limit. * Removed any trailing spaces. Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 15:57:26 UTC (rev 24835) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 16:22:10 UTC (rev 24836) @@ -21,8 +21,14 @@ #include #include -//#define TEST_MODE +//#define TRACE_SCROLLBAR +#ifdef TRACE_SCROLLBAR +# define TRACE(x...) printf(x) +#else +# define TRACE(x...) +#endif + typedef enum { ARROW_LEFT = 0, ARROW_RIGHT, @@ -38,7 +44,7 @@ // Quick constants for determining which arrow is down and are defined with respect // to double arrow mode. ARROW1 and ARROW4 refer to the outer pair of arrows and -// ARROW2 and ARROW3 refer to the inner ones. ARROW1 points left/up and ARROW4 +// ARROW2 and ARROW3 refer to the inner ones. ARROW1 points left/up and ARROW4 // points right/down. #define ARROW1 0 #define ARROW2 1 @@ -64,7 +70,7 @@ fStopValue(0.0), fUpArrowsEnabled(true), fDownArrowsEnabled(true), - fButtonDown(NOARROW) + fButtonDown(NOARROW) { #ifdef TEST_MODE fScrollBarInfo.proportional = true; @@ -75,7 +81,7 @@ get_scroll_bar_info(&fScrollBarInfo); #endif } - + ~Private() { if (fRepeaterThread >= 0) { @@ -84,18 +90,18 @@ wait_for_thread(fRepeaterThread, &dummy); } } - - void DrawScrollBarButton(BScrollBar *owner, arrow_direction direction, + + void DrawScrollBarButton(BScrollBar *owner, arrow_direction direction, BRect frame, bool down = false); - + static int32 button_repeater_thread(void* data); int32 ButtonRepeaterThread(); BScrollBar* fScrollBar; bool fEnabled; - - // TODO: This should be a static, initialized by + + // TODO: This should be a static, initialized by // _init_interface_kit() at application startup-time, // like BMenu::sMenuInfo scroll_bar_info fScrollBarInfo; @@ -159,7 +165,7 @@ fRepeaterThread = -1; fScrollBar->UnlockLooper(); } - + return 0; } @@ -279,39 +285,41 @@ /* From the BeBook (on ValueChanged()): - -Responds to a notification that the value of the scroll bar has changed to -newValue. For a horizontal scroll bar, this function interprets newValue -as the coordinate value that should be at the left side of the target -view's bounds rectangle. For a vertical scroll bar, it interprets -newValue as the coordinate value that should be at the top of the rectangle. -It calls ScrollTo() to scroll the target's contents into position, unless -they have already been scrolled. -ValueChanged() is called as the result both of user actions -(B_VALUE_CHANGED messages received from the Application Server) and of -programmatic ones. Programmatically, scrolling can be initiated by the -target view (calling ScrollTo()) or by the BScrollBar -(calling SetValue() or SetRange()). +Responds to a notification that the value of the scroll bar has changed to +newValue. For a horizontal scroll bar, this function interprets newValue +as the coordinate value that should be at the left side of the target +view's bounds rectangle. For a vertical scroll bar, it interprets +newValue as the coordinate value that should be at the top of the rectangle. +It calls ScrollTo() to scroll the target's contents into position, unless +they have already been scrolled. -In all these cases, the target view and the scroll bars need to be kept -in synch. This is done by a chain of function calls: ValueChanged() calls -ScrollTo(), which in turn calls SetValue(), which then calls -ValueChanged() again. It's up to ValueChanged() to get off this -merry-go-round, which it does by checking the target view's bounds -rectangle. If newValue already matches the left or top side of the -bounds rectangle, if forgoes calling ScrollTo(). +ValueChanged() is called as the result both of user actions +(B_VALUE_CHANGED messages received from the Application Server) and of +programmatic ones. Programmatically, scrolling can be initiated by the +target view (calling ScrollTo()) or by the BScrollBar +(calling SetValue() or SetRange()). -ValueChanged() does nothing if a target BView hasn't been set?or -if the target has been set by name, but the name doesn't correspond to -an actual BView within the scroll bar's window. +In all these cases, the target view and the scroll bars need to be kept +in synch. This is done by a chain of function calls: ValueChanged() calls +ScrollTo(), which in turn calls SetValue(), which then calls +ValueChanged() again. It's up to ValueChanged() to get off this +merry-go-round, which it does by checking the target view's bounds +rectangle. If newValue already matches the left or top side of the +bounds rectangle, if forgoes calling ScrollTo(). +ValueChanged() does nothing if a target BView hasn't been set?or +if the target has been set by name, but the name doesn't correspond to +an actual BView within the scroll bar's window. + */ // SetValue void BScrollBar::SetValue(float value) { + TRACE("BScrollBar(%s)::SetValue(%.1f)\n", Name(), value); + if (value > fMax) value = fMax; else if (value < fMin) @@ -341,6 +349,8 @@ void BScrollBar::ValueChanged(float newValue) { + TRACE("BScrollBar(%s)::ValueChanged(%.1f)\n", Name(), newValue); + if (fTarget) { // cache target bounds BRect targetBounds = fTarget->Bounds(); @@ -354,6 +364,8 @@ } } + TRACE(" -> %.1f\n", newValue); + SetValue(newValue); } @@ -361,6 +373,8 @@ void BScrollBar::SetProportion(float value) { + TRACE("BScrollBar(%s)::SetProportion(%.1f)\n", Name(), value); + if (value < 0.0) value = 0.0; if (value > 1.0) @@ -374,7 +388,7 @@ bool newEnabled = fPrivateData->fEnabled && fMin < fMax && fProportion < 1.0 && fProportion >= 0.0; - + _UpdateThumbFrame(); if (oldEnabled != newEnabled) @@ -393,6 +407,8 @@ void BScrollBar::SetRange(float min, float max) { + TRACE("BScrollBar(%s)::SetRange(min=%.1f, max=%.1f)\n", Name(), min, max); + if (min > max || isnanf(min) || isnanf(max) || isinff(min) || isinff(max)) { min = 0; max = 0; @@ -431,7 +447,7 @@ { // Under R5, steps can be set only after being attached to a window, probably because // the data is kept server-side. We'll just remove that limitation... :P - + // The BeBook also says that we need to specify an integer value even though the step // values are floats. For the moment, we'll just make sure that they are integers fSmallStep = roundf(smallStep); @@ -456,10 +472,10 @@ { fTarget = target; free(fTargetName); - + if (fTarget) { fTargetName = strdup(target->Name()); - + if (fOrientation == B_VERTICAL) fTarget->fVerScroller = this; else @@ -474,10 +490,10 @@ { if (!targetName) return; - + if (!Window()) debugger("Method requires window and doesn't have one"); - + BView *target = Window()->FindView(targetName); if (target) SetTarget(target); @@ -682,7 +698,7 @@ dark2 = tint_color(normal, B_LIGHTEN_1_TINT); dark4 = tint_color(normal, B_DARKEN_3_TINT); } - + SetDrawingMode(B_OP_OVER); BRect thumbBG = bounds; @@ -690,7 +706,8 @@ // Draw arrows if (fOrientation == B_HORIZONTAL) { - BRect buttonFrame(bounds.left, bounds.top, bounds.left + bounds.Height(), bounds.bottom); + BRect buttonFrame(bounds.left, bounds.top, + bounds.left + bounds.Height(), bounds.bottom); _DrawArrowButton(ARROW_LEFT, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW1); @@ -703,7 +720,7 @@ buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2) + 1), bounds.top); _DrawArrowButton(ARROW_LEFT, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW3); - + thumbBG.left += bounds.Height() * 2 + 2; thumbBG.right -= bounds.Height() * 2 + 2; } else { @@ -715,20 +732,22 @@ _DrawArrowButton(ARROW_RIGHT, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW4); } else { - BRect buttonFrame(bounds.left, bounds.top, bounds.right, bounds.top + bounds.Width()); + BRect buttonFrame(bounds.left, bounds.top, bounds.right, + bounds.top + bounds.Width()); _DrawArrowButton(ARROW_UP, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW1); - + if (doubleArrows) { buttonFrame.OffsetBy(0.0, bounds.Width() + 1); _DrawArrowButton(ARROW_DOWN, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW2); - buttonFrame.OffsetTo(bounds.left, bounds.bottom - ((bounds.Width() * 2) + 1)); + buttonFrame.OffsetTo(bounds.left, bounds.bottom + - ((bounds.Width() * 2) + 1)); _DrawArrowButton(ARROW_UP, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW3); - + thumbBG.top += bounds.Width() * 2 + 2; thumbBG.bottom -= bounds.Width() * 2 + 2; } else { @@ -773,7 +792,7 @@ AddLine(BPoint(rect.left - 1, thumbBG.bottom), BPoint(thumbBG.left + 2, thumbBG.bottom), normal); } - + if (rect.right < thumbBG.right - 1) { AddLine(BPoint(rect.right + 2, thumbBG.top + 1), BPoint(rect.right + 2, thumbBG.bottom), dark2); @@ -814,7 +833,7 @@ AddLine(BPoint(thumbBG.right, rect.top - 1), BPoint(thumbBG.right, thumbBG.top + 2), normal); } - + if (rect.bottom < thumbBG.bottom - 1) { AddLine(BPoint(thumbBG.left + 1, rect.bottom + 2), BPoint(thumbBG.right, rect.bottom + 2), dark2); @@ -841,7 +860,7 @@ BRect leftOfThumb(thumbBG.left + 1, thumbBG.top, rect.left - 1, thumbBG.bottom); if (leftOfThumb.IsValid()) FillRect(leftOfThumb); - + BRect rightOfThumb(rect.right + 3, thumbBG.top, thumbBG.right, thumbBG.bottom); if (rightOfThumb.IsValid()) FillRect(rightOfThumb); @@ -849,29 +868,35 @@ // dark lines before and after thumb if (rect.left > thumbBG.left) { SetHighColor(dark); - StrokeLine(BPoint(rect.left - 1, rect.top), BPoint(rect.left - 1, rect.bottom)); + StrokeLine(BPoint(rect.left - 1, rect.top), + BPoint(rect.left - 1, rect.bottom)); } if (rect.right < thumbBG.right) { SetHighColor(dark4); - StrokeLine(BPoint(rect.right + 1, rect.top), BPoint(rect.right + 1, rect.bottom)); + StrokeLine(BPoint(rect.right + 1, rect.top), + BPoint(rect.right + 1, rect.bottom)); } } else { - BRect topOfThumb(thumbBG.left, thumbBG.top + 1, thumbBG.right, rect.top - 1); + BRect topOfThumb(thumbBG.left, thumbBG.top + 1, + thumbBG.right, rect.top - 1); if (topOfThumb.IsValid()) FillRect(topOfThumb); - - BRect bottomOfThumb(thumbBG.left, rect.bottom + 3, thumbBG.right, thumbBG.bottom); + + BRect bottomOfThumb(thumbBG.left, rect.bottom + 3, + thumbBG.right, thumbBG.bottom); if (bottomOfThumb.IsValid()) FillRect(bottomOfThumb); // dark lines before and after thumb if (rect.top > thumbBG.top) { SetHighColor(dark); - StrokeLine(BPoint(rect.left, rect.top - 1), BPoint(rect.right, rect.top - 1)); + StrokeLine(BPoint(rect.left, rect.top - 1), + BPoint(rect.right, rect.top - 1)); } if (rect.bottom < thumbBG.bottom) { SetHighColor(dark4); - StrokeLine(BPoint(rect.left, rect.bottom + 1), BPoint(rect.right, rect.bottom + 1)); + StrokeLine(BPoint(rect.left, rect.bottom + 1), + BPoint(rect.right, rect.bottom + 1)); } } @@ -892,7 +917,7 @@ SetHighColor(tint_color(normal, (B_NO_TINT + B_DARKEN_1_TINT) / 2)); else*/ SetHighColor(normal); - + FillRect(rect); // TODO: Add the other thumb styles - dots and lines @@ -1286,10 +1311,13 @@ void BScrollBar::_UpdateTargetValue(BPoint where) { - if (fOrientation == B_VERTICAL) - fPrivateData->fStopValue = _ValueFor(BPoint(where.x, where.y - fPrivateData->fThumbFrame.Height() / 2.0)); - else - fPrivateData->fStopValue = _ValueFor(BPoint(where.x - fPrivateData->fThumbFrame.Width() / 2.0, where.y)); + if (fOrientation == B_VERTICAL) { + fPrivateData->fStopValue = _ValueFor(BPoint(where.x, where.y + - fPrivateData->fThumbFrame.Height() / 2.0)); + } else { + fPrivateData->fStopValue = _ValueFor(BPoint(where.x + - fPrivateData->fThumbFrame.Width() / 2.0, where.y)); + } } // _UpdateArrowButtons @@ -1322,9 +1350,9 @@ if (bar->fPrivateData->fScrollBarInfo.double_arrows != info->double_arrows) { bar->fPrivateData->fScrollBarInfo.double_arrows = info->double_arrows; - + int8 multiplier = (info->double_arrows) ? 1 : -1; - + if (bar->fOrientation == B_VERTICAL) bar->fPrivateData->fThumbFrame.OffsetBy(0, multiplier * B_H_SCROLL_BAR_HEIGHT); else @@ -1334,15 +1362,16 @@ bar->fPrivateData->fScrollBarInfo.proportional = info->proportional; // TODO: Figure out how proportional relates to the size of the thumb - + // TODO: Add redraw code to reflect the changes if (info->knob >= 0 && info->knob <= 2) bar->fPrivateData->fScrollBarInfo.knob = info->knob; else return B_BAD_VALUE; - - if (info->min_knob_size >= SCROLL_BAR_MINIMUM_KNOB_SIZE && info->min_knob_size <= SCROLL_BAR_MAXIMUM_KNOB_SIZE) + + if (info->min_knob_size >= SCROLL_BAR_MINIMUM_KNOB_SIZE + && info->min_knob_size <= SCROLL_BAR_MAXIMUM_KNOB_SIZE) bar->fPrivateData->fScrollBarInfo.min_knob_size = info->min_knob_size; else return B_BAD_VALUE; @@ -1428,14 +1457,14 @@ rgb_color c = ui_color(B_PANEL_BACKGROUND_COLOR); rgb_color light, dark, darker, normal, arrow; - if (down && fPrivateData->fDoRepeat) { + if (down && fPrivateData->fDoRepeat) { light = tint_color(c, (B_DARKEN_1_TINT + B_DARKEN_2_TINT) / 2.0); dark = darker = c; normal = tint_color(c, B_DARKEN_1_TINT); arrow = tint_color(c, B_DARKEN_MAX_TINT); - + } else { - // Add a usability perk - disable buttons if they would not do anything - + // Add a usability perk - disable buttons if they would not do anything - // like a left arrow if the value==fMin // NOTE: disabled because of too much visual noise/distraction /* if ((direction == ARROW_LEFT || direction == ARROW_UP) && (fValue == fMin) ) @@ -1457,10 +1486,10 @@ arrow = tint_color(c, B_DARKEN_1_TINT); } } - + BPoint tri1, tri2, tri3; r.InsetBy(4, 4); - + switch (direction) { case ARROW_LEFT: tri1.Set(r.right, r.top); @@ -1494,7 +1523,7 @@ r.InsetBy(-3, -3); SetHighColor(normal); FillRect(r); - + BShape arrowShape; arrowShape.MoveTo(tri1); arrowShape.LineTo(tri2); From mmlr at mail.berlios.de Sun Apr 6 18:22:59 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 18:22:59 +0200 Subject: [Haiku-commits] r24837 - in haiku/trunk: headers/libs/usb src/libs/usb Message-ID: <200804061622.m36GMxsi005279@sheep.berlios.de> Author: mmlr Date: 2008-04-06 18:22:59 +0200 (Sun, 06 Apr 2008) New Revision: 24837 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24837&view=rev Modified: haiku/trunk/headers/libs/usb/USBKit.h haiku/trunk/src/libs/usb/USBEndpoint.cpp haiku/trunk/src/libs/usb/USBInterface.cpp Log: * Implemented setting an alternate interface through the USBKit library based on a patch by Salvatore Benedetto, adapted to the usb_raw interface by me * Added two convenience functions IsStalled() and ClearStall() to USBEndpoint Both changes are actually untested, so if you have a use for them and encounter problems please shout. Modified: haiku/trunk/headers/libs/usb/USBKit.h =================================================================== --- haiku/trunk/headers/libs/usb/USBKit.h 2008-04-06 16:22:10 UTC (rev 24836) +++ haiku/trunk/headers/libs/usb/USBKit.h 2008-04-06 16:22:59 UTC (rev 24837) @@ -1,9 +1,6 @@ /* - * Copyright 2007, Haiku Inc. All rights reserved. + * Copyright 2007-2008, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Michael Lotz */ #ifndef _USBKIT_H @@ -240,12 +237,25 @@ uint32 CountEndpoints() const; const BUSBEndpoint *EndpointAt(uint32 index) const; + // Using CountAlternates() you can retrieve the number of alternate + // interfaces at this interface index. Note that this interface itself + // counts as an alternate so an alternate count of one really means + // that you are currently using the sole interface present. + // With SetAlternate() you can switch this BUSBInterface object to the + // alternate at the specified index. Note that all endpoints retrieved + // through EndpointAt() will become invalid and be deleted as soon as + // you set an alternate. + uint32 CountAlternates() const; + status_t SetAlternate(uint32 alternateIndex); + private: friend class BUSBConfiguration; BUSBInterface(BUSBConfiguration *config, uint32 index, int rawFD); ~BUSBInterface(); + void _UpdateDescriptorAndEndpoints(); + BUSBConfiguration *fConfiguration; uint32 fIndex; int fRawFD; @@ -305,6 +315,11 @@ usb_iso_packet_descriptor *packetDescriptors, uint32 packetCount) const; + // These are convenience methods for getting and clearing the halt + // state of an endpoint. They use the control pipe of the device to + // send the corresponding requests. + bool IsStalled() const; + status_t ClearStall() const; private: friend class BUSBInterface; BUSBEndpoint(BUSBInterface *interface, Modified: haiku/trunk/src/libs/usb/USBEndpoint.cpp =================================================================== --- haiku/trunk/src/libs/usb/USBEndpoint.cpp 2008-04-06 16:22:10 UTC (rev 24836) +++ haiku/trunk/src/libs/usb/USBEndpoint.cpp 2008-04-06 16:22:59 UTC (rev 24837) @@ -213,3 +213,23 @@ return command.isochronous.length; } + + +bool +BUSBEndpoint::IsStalled() const +{ + uint16 status = 0; + Device()->ControlTransfer(USB_REQTYPE_ENDPOINT_IN, + USB_REQUEST_GET_STATUS, USB_FEATURE_ENDPOINT_HALT, + fDescriptor.endpoint_address & 0x0f, sizeof(status), &status); + return status != 0; +} + + +status_t +BUSBEndpoint::ClearStall() const +{ + return Device()->ControlTransfer(USB_REQTYPE_ENDPOINT_OUT, + USB_REQUEST_CLEAR_FEATURE, USB_FEATURE_ENDPOINT_HALT, + fDescriptor.endpoint_address & 0x0f, 0, NULL); +} Modified: haiku/trunk/src/libs/usb/USBInterface.cpp =================================================================== --- haiku/trunk/src/libs/usb/USBInterface.cpp 2008-04-06 16:22:10 UTC (rev 24836) +++ haiku/trunk/src/libs/usb/USBInterface.cpp 2008-04-06 16:22:59 UTC (rev 24837) @@ -1,9 +1,10 @@ /* - * Copyright 2007, Haiku Inc. All rights reserved. + * Copyright 2007-2008, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: * Michael Lotz + * Salvatore Benedetto */ #include @@ -19,18 +20,7 @@ fEndpoints(NULL), fInterfaceString(NULL) { - raw_command command; - command.interface.descriptor = &fDescriptor; - command.interface.config_index = fConfiguration->Index(); - command.interface.interface_index = fIndex; - if (ioctl(fRawFD, RAW_COMMAND_GET_INTERFACE_DESCRIPTOR, &command, sizeof(command)) - || command.interface.status != RAW_STATUS_SUCCESS) { - memset(&fDescriptor, 0, sizeof(fDescriptor)); - } - - fEndpoints = new BUSBEndpoint *[fDescriptor.num_endpoints]; - for (int32 i = 0; i < fDescriptor.num_endpoints; i++) - fEndpoints[i] = new BUSBEndpoint(this, i, fRawFD); + _UpdateDescriptorAndEndpoints(); } @@ -148,3 +138,62 @@ return fEndpoints[index]; } + + +uint32 +BUSBInterface::CountAlternates() const +{ + uint32 alternateCount; + raw_command command; + command.alternate.alternate_count = &alternateCount; + command.alternate.config_index = fConfiguration->Index(); + command.alternate.interface_index = fIndex; + if (ioctl(fRawFD, RAW_COMMAND_GET_ALT_INTERFACE_COUNT, &command, sizeof(command)) + || command.alternate.status != RAW_STATUS_SUCCESS) { + return 1; + } + + return alternateCount; +} + + +status_t +BUSBInterface::SetAlternate(uint32 alternateIndex) +{ + raw_command command; + command.alternate.config_index = fConfiguration->Index(); + command.alternate.interface_index = fIndex; + command.alternate.alternate_index = alternateIndex; + if (ioctl(fRawFD, RAW_COMMAND_SET_ALT_INTERFACE, &command, sizeof(command)) + || command.alternate.status != RAW_STATUS_SUCCESS) { + return B_ERROR; + } + + _UpdateDescriptorAndEndpoints(); + return B_OK; +} + + +void +BUSBInterface::_UpdateDescriptorAndEndpoints() +{ + raw_command command; + command.interface.descriptor = &fDescriptor; + command.interface.config_index = fConfiguration->Index(); + command.interface.interface_index = fIndex; + if (ioctl(fRawFD, RAW_COMMAND_GET_INTERFACE_DESCRIPTOR, &command, sizeof(command)) + || command.interface.status != RAW_STATUS_SUCCESS) { + memset(&fDescriptor, 0, sizeof(fDescriptor)); + } + + if (fEndpoints) { + // Delete old endpoints + for (int32 i = 0; i < fDescriptor.num_endpoints; i++) + delete fEndpoints[i]; + delete fEndpoints; + } + + fEndpoints = new BUSBEndpoint *[fDescriptor.num_endpoints]; + for (int32 i = 0; i < fDescriptor.num_endpoints; i++) + fEndpoints[i] = new BUSBEndpoint(this, i, fRawFD); +} From stippi at mail.berlios.de Sun Apr 6 18:47:43 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 18:47:43 +0200 Subject: [Haiku-commits] r24838 - haiku/trunk/src/kits/interface Message-ID: <200804061647.m36GlhQW002955@sheep.berlios.de> Author: stippi Date: 2008-04-06 18:47:43 +0200 (Sun, 06 Apr 2008) New Revision: 24838 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24838&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp Log: According to my tests on R5, a BScrollBar with a proportion of 0.0, the value that it has when you never set it, uses the large step to figure out the proportion it should display. This fixes Pe's scroll bars to display the "correct" proportion. Of course the proportion is only correct if the large step indeed equals the page size. Fixes #1758. Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 16:22:59 UTC (rev 24837) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 16:47:43 UTC (rev 24838) @@ -21,7 +21,7 @@ #include #include -//#define TRACE_SCROLLBAR +#define TRACE_SCROLLBAR #ifdef TRACE_SCROLLBAR # define TRACE(x...) printf(x) #else @@ -445,15 +445,33 @@ void BScrollBar::SetSteps(float smallStep, float largeStep) { - // Under R5, steps can be set only after being attached to a window, probably because - // the data is kept server-side. We'll just remove that limitation... :P + TRACE("BScrollBar(%s)::SetSteps(small=%.1f, large=%.1f)\n", Name(), + smallStep, largeStep); - // The BeBook also says that we need to specify an integer value even though the step - // values are floats. For the moment, we'll just make sure that they are integers - fSmallStep = roundf(smallStep); - fLargeStep = roundf(largeStep); + // Under R5, steps can be set only after being attached to a window, + // probably because the data is kept server-side. We'll just remove + // that limitation... :P - // TODO: test use of fractional values and make them work properly if they don't + // The BeBook also says that we need to specify an integer value even + // though the step values are floats. For the moment, we'll just make + // sure that they are integers + smallStep = roundf(smallStep); + largeStep = roundf(largeStep); + if (fSmallStep == smallStep && fLargeStep == largeStep) + return; + + fSmallStep = smallStep; + fLargeStep = largeStep; + + if (fProportion == 0.0) { + // special case, proportion is based on fLargeStep if it was never + // set, so it means we need to invalidate here + _UpdateThumbFrame(); + Invalidate(); + } + + // TODO: test use of fractional values and make them work properly if + // they don't } // GetSteps @@ -1123,8 +1141,17 @@ float thumbSize = minSize; float proportion = fProportion; - if (fMin == fMax || proportion > 1.0 || proportion < 0.0) + if (fMin >= fMax || proportion > 1.0 || proportion < 0.0) proportion = 1.0; + if (proportion == 0.0) { + // Special case a proportion of 0.0, use the large step value + // in that case (NOTE: fMin == fMax already handled above) + // This calculation is based on the assumption that "large step" + // scrolls by one "page size". + proportion = fLargeStep / (2 * (fMax - fMin)); + if (proportion > 1.0) + proportion = 1.0; + } if (fPrivateData->fScrollBarInfo.proportional) thumbSize += (maxSize - minSize) * proportion; thumbSize = floorf(thumbSize + 0.5); From stippi at mail.berlios.de Sun Apr 6 18:56:31 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 18:56:31 +0200 Subject: [Haiku-commits] r24839 - haiku/trunk/src/kits/interface Message-ID: <200804061656.m36GuVWY014321@sheep.berlios.de> Author: stippi Date: 2008-04-06 18:56:30 +0200 (Sun, 06 Apr 2008) New Revision: 24839 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24839&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp Log: More style cleanup. Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 16:47:43 UTC (rev 24838) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 16:56:30 UTC (rev 24839) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2007, Haiku, Inc. + * Copyright (c) 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -42,10 +42,10 @@ #define SBC_SETPROPORTIONAL 2 #define SBC_SETSTYLE 3 -// Quick constants for determining which arrow is down and are defined with respect -// to double arrow mode. ARROW1 and ARROW4 refer to the outer pair of arrows and -// ARROW2 and ARROW3 refer to the inner ones. ARROW1 points left/up and ARROW4 -// points right/down. +// Quick constants for determining which arrow is down and are defined with +// respect to double arrow mode. ARROW1 and ARROW4 refer to the outer pair of +// arrows and ARROW2 and ARROW3 refer to the inner ones. ARROW1 points left/up +// and ARROW4 points right/down. #define ARROW1 0 #define ARROW2 1 #define ARROW3 2 @@ -53,8 +53,9 @@ #define THUMB 4 #define NOARROW -1 -// Because the R5 version kept a lot of data on server-side, we need to kludge our way -// into binary compatibility + +// Because the R5 version kept a lot of data on server-side, we need to kludge +// our way into binary compatibility class BScrollBar::Private { public: Private(BScrollBar* scrollBar) @@ -122,6 +123,7 @@ int8 fButtonDown; }; + // This thread is spawned when a button is initially pushed and repeatedly scrolls // the scrollbar by a little bit after a short delay int32 @@ -131,6 +133,7 @@ return privateData->ButtonRepeaterThread(); } + int32 BScrollBar::Private::ButtonRepeaterThread() { @@ -238,7 +241,7 @@ free(fTargetName); } -// Instantiate + BArchivable* BScrollBar::Instantiate(BMessage *data) { @@ -247,7 +250,7 @@ return NULL; } -// Archive + status_t BScrollBar::Archive(BMessage *data, bool deep) const { @@ -277,7 +280,7 @@ return err; } -// AttachedToWindow + void BScrollBar::AttachedToWindow() { @@ -314,7 +317,7 @@ */ -// SetValue + void BScrollBar::SetValue(float value) { @@ -338,14 +341,14 @@ ValueChanged(fValue); } -// Value + float BScrollBar::Value() const { return fValue; } -// ValueChanged + void BScrollBar::ValueChanged(float newValue) { @@ -369,7 +372,7 @@ SetValue(newValue); } -// SetProportion + void BScrollBar::SetProportion(float value) { @@ -396,14 +399,14 @@ } } -// Proportion + float BScrollBar::Proportion() const { return fProportion; } -// SetRange + void BScrollBar::SetRange(float min, float max) { @@ -431,7 +434,7 @@ } } -// GetRange + void BScrollBar::GetRange(float *min, float *max) const { @@ -441,7 +444,7 @@ *max = fMax; } -// SetSteps + void BScrollBar::SetSteps(float smallStep, float largeStep) { @@ -474,7 +477,7 @@ // they don't } -// GetSteps + void BScrollBar::GetSteps(float* smallStep, float* largeStep) const { @@ -484,7 +487,7 @@ *largeStep = fLargeStep; } -// SetTarget + void BScrollBar::SetTarget(BView *target) { @@ -502,9 +505,9 @@ fTargetName = NULL; } -// SetTarget + void -BScrollBar::SetTarget(const char *targetName) +BScrollBar::SetTarget(const char* targetName) { if (!targetName) return; @@ -512,39 +515,39 @@ if (!Window()) debugger("Method requires window and doesn't have one"); - BView *target = Window()->FindView(targetName); + BView* target = Window()->FindView(targetName); if (target) SetTarget(target); } -// Target -BView * + +BView* BScrollBar::Target() const { return fTarget; } -// Orientation + orientation BScrollBar::Orientation() const { return fOrientation; } -// MessageReceived + void -BScrollBar::MessageReceived(BMessage *msg) +BScrollBar::MessageReceived(BMessage* message) { - switch(msg->what) { + switch(message->what) { case B_VALUE_CHANGED: { int32 value; - if (msg->FindInt32("value", &value) == B_OK) + if (message->FindInt32("value", &value) == B_OK) ValueChanged(value); break; } default: - BView::MessageReceived(msg); + BView::MessageReceived(message); break; } } @@ -633,7 +636,7 @@ } } -// MouseUp + void BScrollBar::MouseUp(BPoint pt) { @@ -647,11 +650,12 @@ fPrivateData->fDoRepeat = false; } -// MouseMoved + void BScrollBar::MouseMoved(BPoint where, uint32 transit, const BMessage* message) { - if (!fPrivateData->fEnabled || fMin >= fMax || fProportion >= 1.0 || fProportion < 0.0) + if (!fPrivateData->fEnabled || fMin >= fMax || fProportion >= 1.0 + || fProportion < 0.0) return; if (fPrivateData->fButtonDown != NOARROW) { @@ -659,7 +663,8 @@ SetValue(_ValueFor(where + fPrivateData->fClickOffset)); } else { // suspend the repeating if the mouse is not over the button - bool repeat = _ButtonRectFor(fPrivateData->fButtonDown).Contains(where); + bool repeat = _ButtonRectFor(fPrivateData->fButtonDown).Contains( + where); if (fPrivateData->fDoRepeat != repeat) { fPrivateData->fDoRepeat = repeat; Invalidate(_ButtonRectFor(fPrivateData->fButtonDown)); @@ -670,21 +675,24 @@ if (fPrivateData->fDoRepeat) { _UpdateTargetValue(where); // we might have to turn arround - if ((fValue < fPrivateData->fStopValue && fPrivateData->fThumbInc < 0) || - (fValue > fPrivateData->fStopValue && fPrivateData->fThumbInc > 0)) + if ((fValue < fPrivateData->fStopValue + && fPrivateData->fThumbInc < 0) + || (fValue > fPrivateData->fStopValue + && fPrivateData->fThumbInc > 0)) { fPrivateData->fThumbInc = -fPrivateData->fThumbInc; + } } } } -// DetachedFromWindow + void BScrollBar::DetachedFromWindow() { BView::DetachedFromWindow(); } -// Draw + void BScrollBar::Draw(BRect updateRect) { @@ -692,7 +700,8 @@ rgb_color normal = ui_color(B_PANEL_BACKGROUND_COLOR); - // stroke a dark frame arround the entire scrollbar (independent of enabled state) + // stroke a dark frame arround the entire scrollbar + // (independent of enabled state) SetHighColor(tint_color(normal, B_DARKEN_2_TINT)); StrokeRect(bounds); bounds.InsetBy(1.0, 1.0); @@ -735,7 +744,8 @@ _DrawArrowButton(ARROW_RIGHT, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW2); - buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2) + 1), bounds.top); + buttonFrame.OffsetTo(bounds.right - ((bounds.Height() * 2) + 1), + bounds.top); _DrawArrowButton(ARROW_LEFT, doubleArrows, buttonFrame, updateRect, enabled, fPrivateData->fButtonDown == ARROW3); @@ -875,11 +885,13 @@ // fill and additional dark lines thumbBG.InsetBy(1.0, 1.0); if (fOrientation == B_HORIZONTAL) { - BRect leftOfThumb(thumbBG.left + 1, thumbBG.top, rect.left - 1, thumbBG.bottom); + BRect leftOfThumb(thumbBG.left + 1, thumbBG.top, rect.left - 1, + thumbBG.bottom); if (leftOfThumb.IsValid()) FillRect(leftOfThumb); - BRect rightOfThumb(rect.right + 3, thumbBG.top, thumbBG.right, thumbBG.bottom); + BRect rightOfThumb(rect.right + 3, thumbBG.top, thumbBG.right, + thumbBG.bottom); if (rightOfThumb.IsValid()) FillRect(rightOfThumb); @@ -987,36 +999,36 @@ } } -// FrameMoved + void BScrollBar::FrameMoved(BPoint newPosition) { BView::FrameMoved(newPosition); } -// FrameResized + void -BScrollBar::FrameResized(float new_width, float new_height) +BScrollBar::FrameResized(float newWidth, float newHeight) { _UpdateThumbFrame(); } -// ResolveSpecifier + BHandler* -BScrollBar::ResolveSpecifier(BMessage *msg, int32 index, - BMessage *specifier, int32 form, const char *property) +BScrollBar::ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 form, const char *property) { - return BView::ResolveSpecifier(msg, index, specifier, form, property); + return BView::ResolveSpecifier(message, index, specifier, form, property); } -// ResizeToPreferred + void BScrollBar::ResizeToPreferred() { BView::ResizeToPreferred(); } -// GetPreferredSize + void BScrollBar::GetPreferredSize(float* _width, float* _height) { @@ -1033,41 +1045,42 @@ } } -// MakeFocus + void BScrollBar::MakeFocus(bool state) { BView::MakeFocus(state); } -// AllAttached + void BScrollBar::AllAttached() { BView::AllAttached(); } -// AllDetached + void BScrollBar::AllDetached() { BView::AllDetached(); } -// GetSupportedSuites + status_t BScrollBar::GetSupportedSuites(BMessage *message) { return BView::GetSupportedSuites(message); } -// Perform + status_t -BScrollBar::Perform(perform_code d, void *arg) +BScrollBar::Perform(perform_code d, void* arg) { return BView::Perform(d, arg); } + #if DISABLES_ON_WINDOW_DEACTIVATION void BScrollBar::WindowActivated(bool active) @@ -1077,19 +1090,21 @@ } #endif // DISABLES_ON_WINDOW_DEACTIVATION + void BScrollBar::_ReservedScrollBar1() {} void BScrollBar::_ReservedScrollBar2() {} void BScrollBar::_ReservedScrollBar3() {} void BScrollBar::_ReservedScrollBar4() {} -// operator= -BScrollBar & -BScrollBar::operator=(const BScrollBar &) + + +BScrollBar& +BScrollBar::operator=(const BScrollBar&) { return *this; } -// _DoubleArrows + bool BScrollBar::_DoubleArrows() const { @@ -1107,7 +1122,7 @@ } } -// _UpdateThumbFrame + void BScrollBar::_UpdateThumbFrame() { @@ -1158,7 +1173,8 @@ thumbSize--; // the thumb can be scrolled within the remaining area "maxSize - thumbSize" - float offset = floorf(((fValue - fMin) / (fMax - fMin + 1.0)) * (maxSize - thumbSize)); + float offset = floorf(((fValue - fMin) / (fMax - fMin + 1.0)) + * (maxSize - thumbSize)); if (_DoubleArrows()) { offset += buttonSize * 2; @@ -1169,15 +1185,18 @@ offset++; if (fOrientation == B_VERTICAL) { - fPrivateData->fThumbFrame.bottom = fPrivateData->fThumbFrame.top + thumbSize; + fPrivateData->fThumbFrame.bottom = fPrivateData->fThumbFrame.top + + thumbSize; fPrivateData->fThumbFrame.OffsetBy(0.0, offset); } else { - fPrivateData->fThumbFrame.right = fPrivateData->fThumbFrame.left + thumbSize; + fPrivateData->fThumbFrame.right = fPrivateData->fThumbFrame.left + + thumbSize; fPrivateData->fThumbFrame.OffsetBy(offset, 0.0); } if (Window()) { - BRect invalid = oldFrame.IsValid() ? oldFrame | fPrivateData->fThumbFrame + BRect invalid = oldFrame.IsValid() ? + oldFrame | fPrivateData->fThumbFrame : fPrivateData->fThumbFrame; // account for those two dark lines if (fOrientation == B_HORIZONTAL) @@ -1188,7 +1207,7 @@ } } -// _ValueFor + float BScrollBar::_ValueFor(BPoint where) const { @@ -1234,7 +1253,7 @@ return ceilf(value - 0.5); } -// _ButtonFor + int32 BScrollBar::_ButtonFor(BPoint where) const { @@ -1284,7 +1303,7 @@ return NOARROW; } -// _ButtonRectFor + BRect BScrollBar::_ButtonRectFor(int32 button) const { @@ -1334,7 +1353,7 @@ return rect; } -// _UpdateTargetValue + void BScrollBar::_UpdateTargetValue(BPoint where) { @@ -1347,7 +1366,7 @@ } } -// _UpdateArrowButtons + void BScrollBar::_UpdateArrowButtons() { @@ -1368,22 +1387,26 @@ } } -// control_scrollbar + status_t control_scrollbar(scroll_bar_info *info, BScrollBar *bar) { if (!bar || !info) return B_BAD_VALUE; - if (bar->fPrivateData->fScrollBarInfo.double_arrows != info->double_arrows) { + if (bar->fPrivateData->fScrollBarInfo.double_arrows + != info->double_arrows) { bar->fPrivateData->fScrollBarInfo.double_arrows = info->double_arrows; int8 multiplier = (info->double_arrows) ? 1 : -1; - if (bar->fOrientation == B_VERTICAL) - bar->fPrivateData->fThumbFrame.OffsetBy(0, multiplier * B_H_SCROLL_BAR_HEIGHT); - else - bar->fPrivateData->fThumbFrame.OffsetBy(multiplier * B_V_SCROLL_BAR_WIDTH, 0); + if (bar->fOrientation == B_VERTICAL) { + bar->fPrivateData->fThumbFrame.OffsetBy(0, multiplier + * B_H_SCROLL_BAR_HEIGHT); + } else { + bar->fPrivateData->fThumbFrame.OffsetBy(multiplier + * B_V_SCROLL_BAR_WIDTH, 0); + } } bar->fPrivateData->fScrollBarInfo.proportional = info->proportional; @@ -1406,7 +1429,7 @@ return B_OK; } -// _DrawDisabledBackground + void BScrollBar::_DrawDisabledBackground(BRect area, const rgb_color& light, @@ -1473,7 +1496,7 @@ } } -// _DrawArrowButton + void BScrollBar::_DrawArrowButton(int32 direction, bool doubleArrows, BRect r, const BRect& updateRect, bool enabled, bool down) @@ -1491,13 +1514,16 @@ arrow = tint_color(c, B_DARKEN_MAX_TINT); } else { - // Add a usability perk - disable buttons if they would not do anything - - // like a left arrow if the value==fMin + // Add a usability perk - disable buttons if they would not do anything + // - like a left arrow if the value == fMin // NOTE: disabled because of too much visual noise/distraction -/* if ((direction == ARROW_LEFT || direction == ARROW_UP) && (fValue == fMin) ) +/* if ((direction == ARROW_LEFT || direction == ARROW_UP) + && (fValue == fMin)) { use_enabled_colors = false; - else if ((direction == ARROW_RIGHT || direction == ARROW_DOWN) && (fValue == fMax) ) - use_enabled_colors = false;*/ + } else if ((direction == ARROW_RIGHT || direction == ARROW_DOWN) + && (fValue == fMax)) { + use_enabled_colors = false; + }*/ if (enabled) { light = tint_color(c, B_LIGHTEN_MAX_TINT); From stippi at mail.berlios.de Sun Apr 6 19:53:43 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 19:53:43 +0200 Subject: [Haiku-commits] r24840 - haiku/trunk/src/kits/interface Message-ID: <200804061753.m36Hrh3R003941@sheep.berlios.de> Author: stippi Date: 2008-04-06 19:53:43 +0200 (Sun, 06 Apr 2008) New Revision: 24840 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24840&view=rev Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp Log: More cleanup, disabled accidentally left on tracing. Modified: haiku/trunk/src/kits/interface/ScrollBar.cpp =================================================================== --- haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 16:56:30 UTC (rev 24839) +++ haiku/trunk/src/kits/interface/ScrollBar.cpp 2008-04-06 17:53:43 UTC (rev 24840) @@ -21,7 +21,7 @@ #include #include -#define TRACE_SCROLLBAR +//#define TRACE_SCROLLBAR #ifdef TRACE_SCROLLBAR # define TRACE(x...) printf(x) #else @@ -321,8 +321,6 @@ void BScrollBar::SetValue(float value) { - TRACE("BScrollBar(%s)::SetValue(%.1f)\n", Name(), value); - if (value > fMax) value = fMax; else if (value < fMin) @@ -333,6 +331,8 @@ if (value == fValue) return; + TRACE("BScrollBar(%s)::SetValue(%.1f)\n", Name(), value); + fValue = value; _UpdateThumbFrame(); @@ -376,27 +376,28 @@ void BScrollBar::SetProportion(float value) { - TRACE("BScrollBar(%s)::SetProportion(%.1f)\n", Name(), value); - if (value < 0.0) value = 0.0; if (value > 1.0) value = 1.0; - if (value != fProportion) { - bool oldEnabled = fPrivateData->fEnabled && fMin < fMax - && fProportion < 1.0 && fProportion >= 0.0; + if (value == fProportion) + return; + TRACE("BScrollBar(%s)::SetProportion(%.1f)\n", Name(), value); - fProportion = value; + bool oldEnabled = fPrivateData->fEnabled && fMin < fMax + && fProportion < 1.0 && fProportion >= 0.0; - bool newEnabled = fPrivateData->fEnabled && fMin < fMax - && fProportion < 1.0 && fProportion >= 0.0; + fProportion = value; - _UpdateThumbFrame(); + bool newEnabled = fPrivateData->fEnabled && fMin < fMax + && fProportion < 1.0 && fProportion >= 0.0; - if (oldEnabled != newEnabled) - Invalidate(); - } + _UpdateThumbFrame(); + + if (oldEnabled != newEnabled) + Invalidate(); + } @@ -410,8 +411,6 @@ void BScrollBar::SetRange(float min, float max) { - TRACE("BScrollBar(%s)::SetRange(min=%.1f, max=%.1f)\n", Name(), min, max); - if (min > max || isnanf(min) || isnanf(max) || isinff(min) || isinff(max)) { min = 0; max = 0; @@ -422,6 +421,7 @@ if (fMin == min && fMax == max) return; + TRACE("BScrollBar(%s)::SetRange(min=%.1f, max=%.1f)\n", Name(), min, max); fMin = min; fMax = max; @@ -448,9 +448,6 @@ void BScrollBar::SetSteps(float smallStep, float largeStep) { - TRACE("BScrollBar(%s)::SetSteps(small=%.1f, large=%.1f)\n", Name(), - smallStep, largeStep); - // Under R5, steps can be set only after being attached to a window, // probably because the data is kept server-side. We'll just remove // that limitation... :P @@ -462,6 +459,8 @@ largeStep = roundf(largeStep); if (fSmallStep == smallStep && fLargeStep == largeStep) return; + TRACE("BScrollBar(%s)::SetSteps(small=%.1f, large=%.1f)\n", Name(), + smallStep, largeStep); fSmallStep = smallStep; fLargeStep = largeStep; From rossi at webpositive.org Sun Apr 6 19:55:25 2008 From: rossi at webpositive.org (Marcus Jacob) Date: Sun, 06 Apr 2008 19:55:25 +0200 Subject: [Haiku-commits] r24542 - in haiku/trunk: . build/scripts References: <12187111738-BeMail@primary> Message-ID: <00044a380e48a86c_mailit@relay.webpositive.org> HI Michael, I downloaded and installed your package following the directions in this mail. However I didn't manage to build at all. Guess I'm way too dumb or whatever ... Host system is dano. Sources are at r24837. Any hints? Thanks, Rossi here comes the log: Welcome to the BeOS shell. As of next week, passwords will be entered in Morse code. rossi at haven home> cd develop/haiku/haiku/ rossi at haven haiku> ./configure --cross-tools-prefix /boot/apps/haiku/cross- tools/bin/i586-pc-haiku- --target=haiku rossi at haven haiku> jam -q haiku.image ...patience... ...patience... [deleted a lot of patience ... guess I'm just plain impatient ;-)] ...patience... ...found 66167 target(s)... ...updating 8741 target(s)... InitScript1 generated/haiku.image-init-vars MkDir1 generated/objects MkDir1 generated/objects/dano MkDir1 generated/objects/dano/x86 MkDir1 generated/objects/dano/x86/release MkDir1 generated/objects/dano/x86/release/tools MkDir1 generated/objects/dano/x86/release/tools/bfs_shell C++ generated/objects/dano/x86/release/tools/bfs_shell/bfs_disk_system.o C++ generated/objects/dano/x86/release/tools/bfs_shell/BlockAllocator.o C++ generated/objects/dano/x86/release/tools/bfs_shell/BPlusTree.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Attribute.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Debug.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Index.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Inode.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Journal.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Query.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Utility.o C++ generated/objects/dano/x86/release/tools/bfs_shell/Volume.o C++ generated/objects/dano/x86/release/tools/bfs_shell/kernel_interface.o MkDir1 generated/objects/dano/x86/release/tools/fs_shell C++ generated/objects/dano/x86/release/tools/fs_shell/atomic.o C++ generated/objects/dano/x86/release/tools/fs_shell/block_cache.o C++ generated/objects/dano/x86/release/tools/fs_shell/command_cp.o C++ generated/objects/dano/x86/release/tools/fs_shell/disk_device_manager.o C++ generated/objects/dano/x86/release/tools/fs_shell/driver_settings.o C++ generated/objects/dano/x86/release/tools/fs_shell/errno.o C++ generated/objects/dano/x86/release/tools/fs_shell/fcntl.o C++ generated/objects/dano/x86/release/tools/fs_shell/fd.o C++ generated/objects/dano/x86/release/tools/fs_shell/file_cache.o C++ generated/objects/dano/x86/release/tools/fs_shell/file_map.o C++ generated/objects/dano/x86/release/tools/fs_shell/kernel_export.o C++ generated/objects/dano/x86/release/tools/fs_shell/KPath.o C++ generated/objects/dano/x86/release/tools/fs_shell/hash.o C++ generated/objects/dano/x86/release/tools/fs_shell/list.o C++ generated/objects/dano/x86/release/tools/fs_shell/lock.o C++ generated/objects/dano/x86/release/tools/fs_shell/module.o C++ generated/objects/dano/x86/release/tools/fs_shell/node_monitor.o C++ generated/objects/dano/x86/release/tools/fs_shell/partition_support.o C++ generated/objects/dano/x86/release/tools/fs_shell/path_util.o C++ generated/objects/dano/x86/release/tools/fs_shell/rootfs.o C++ generated/objects/dano/x86/release/tools/fs_shell/sem.o C++ generated/objects/dano/x86/release/tools/fs_shell/stat.o C++ generated/objects/dano/x86/release/tools/fs_shell/stat_util.o C++ generated/objects/dano/x86/release/tools/fs_shell/stdio.o C++ generated/objects/dano/x86/release/tools/fs_shell/string.o C++ generated/objects/dano/x86/release/tools/fs_shell/thread.o C++ generated/objects/dano/x86/release/tools/fs_shell/time.o C++ generated/objects/dano/x86/release/tools/fs_shell/uio.o C++ generated/objects/dano/x86/release/tools/fs_shell/unistd.o C++ generated/objects/dano/x86/release/tools/fs_shell/vfs.o C++ generated/objects/dano/x86/release/tools/fs_shell/ external_commands_beos.o C++ generated/objects/dano/x86/release/tools/fs_shell/fssh.o Archive generated/objects/dano/x86/release/tools/fs_shell/fs_shell.a Ranlib generated/objects/dano/x86/release/tools/fs_shell/fs_shell.a MkDir1 generated/objects/dano/x86/release/build MkDir1 generated/objects/dano/x86/release/build/libhaikucompat As generated/objects/dano/x86/release/build/libhaikucompat/atomic.o Cc generated/objects/dano/x86/release/build/libhaikucompat/strcasestr.o /boot/home/develop/haiku/haiku/src/system/libroot/posix/string/ strcasestr.c:47: warning: no previous prototype for `strcasestr' Cc generated/objects/dano/x86/release/build/libhaikucompat/strlcat.o /boot/home/develop/haiku/haiku/src/system/libroot/posix/string/strlcat.c: In function `strlcat': /boot/home/develop/haiku/haiku/src/system/libroot/posix/string/strlcat.c:21: warning: implicit declaration of function `strnlen' Cc generated/objects/dano/x86/release/build/libhaikucompat/strlcpy.o Cc generated/objects/dano/x86/release/build/libhaikucompat/strnlen.o /boot/home/develop/haiku/haiku/src/system/libroot/posix/string/strnlen.c:12: warning: no previous prototype for `strnlen' C++ generated/objects/dano/x86/release/build/libhaikucompat/AppFileInfo.o In file included from /boot/develop/headers/posix/be_setup.h:30, from /boot/home/develop/haiku/haiku/headers/build/ HaikuBuildCompatibility.h:13, from /boot/home/develop/haiku/haiku/src/build/libbe/storage/ AppFileInfo.cpp:1: /boot/develop/headers/be/BeBuild.h:107: warning: `_IMPEXP_BE' redefined /boot/home/develop/haiku/haiku/*Initialization*:1: warning: this is the location of the previous definition C++ generated/objects/dano/x86/release/build/libhaikucompat/Bitmap.o In file included from /boot/develop/headers/posix/be_setup.h:30, from /boot/home/develop/haiku/haiku/headers/build/ HaikuBuildCompatibility.h:13, from /boot/home/develop/haiku/haiku/src/build/libbe/ interface/Bitmap.cpp:1: /boot/develop/headers/be/BeBuild.h:107: warning: `_IMPEXP_BE' redefined /boot/home/develop/haiku/haiku/*Initialization*:1: warning: this is the location of the previous definition C++ generated/objects/dano/x86/release/build/libhaikucompat/GraphicsDefs.o In file included from /boot/develop/headers/posix/be_setup.h:30, from /boot/home/develop/haiku/haiku/headers/build/ HaikuBuildCompatibility.h:13, from /boot/home/develop/haiku/haiku/src/build/libbe/ interface/GraphicsDefs.cpp:1: /boot/develop/headers/be/BeBuild.h:107: warning: `_IMPEXP_BE' redefined /boot/home/develop/haiku/haiku/*Initialization*:1: warning: this is the location of the previous definition Archive generated/objects/dano/x86/release/build/libhaikucompat/ libhaikucompat_build.a Ranlib generated/objects/dano/x86/release/build/libhaikucompat/ libhaikucompat_build.a Link generated/objects/dano/x86/release/tools/bfs_shell/bfs_shell Chmod1 generated/objects/dano/x86/release/tools/bfs_shell/bfs_shell C++ generated/objects/dano/x86/release/tools/fs_shell/fs_shell_command.o C++ generated/objects/dano/x86/release/tools/fs_shell/fs_shell_command_beos.o Link generated/objects/dano/x86/release/tools/fs_shell/fs_shell_command Chmod1 generated/objects/dano/x86/release/tools/fs_shell/fs_shell_command C++ generated/objects/dano/x86/release/tools/copyattr.o In file included from /boot/develop/headers/be/support/SupportDefs.h:22, from /boot/develop/headers/be/storage/Directory.h:22, from /boot/home/develop/haiku/haiku/src/bin/copyattr.cpp:12: /boot/develop/headers/be/support/Errors.h:41: conflicting types for `enum {anonymous} B_NO_MEMORY' /boot/develop/headers/posix/be_errors.h:36: previous declaration as `enum {anonymous} B_NO_MEMORY' /boot/develop/headers/be/support/Errors.h:42: conflicting types for `enum {anonymous} B_IO_ERROR' /boot/develop/headers/posix/be_errors.h:37: previous declaration as `enum {anonymous} B_IO_ERROR' /boot/develop/headers/be/support/Errors.h:43: conflicting types for `enum {anonymous} B_PERMISSION_DENIED' /boot/develop/headers/posix/be_errors.h:38: previous declaration as `enum {anonymous} B_PERMISSION_DENIED' /boot/develop/headers/be/support/Errors.h:44: conflicting types for `enum {anonymous} B_BAD_INDEX' /boot/develop/headers/posix/be_errors.h:39: previous declaration as `enum {anonymous} B_BAD_INDEX' /boot/develop/headers/be/support/Errors.h:45: conflicting types for `enum {anonymous} B_BAD_TYPE' /boot/develop/headers/posix/be_errors.h:40: previous declaration as `enum {anonymous} B_BAD_TYPE' /boot/develop/headers/be/support/Errors.h:46: conflicting types for `enum {anonymous} B_BAD_VALUE' /boot/develop/headers/posix/be_errors.h:41: previous declaration as `enum {anonymous} B_BAD_VALUE' /boot/develop/headers/be/support/Errors.h:47: conflicting types for `enum {anonymous} B_MISMATCHED_VALUES' /boot/develop/headers/posix/be_errors.h:42: previous declaration as `enum {anonymous} B_MISMATCHED_VALUES' /boot/develop/headers/be/support/Errors.h:48: conflicting types for `enum {anonymous} B_NAME_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:43: previous declaration as `enum {anonymous} B_NAME_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:49: conflicting types for `enum {anonymous} B_NAME_IN_USE' /boot/develop/headers/posix/be_errors.h:44: previous declaration as `enum {anonymous} B_NAME_IN_USE' /boot/develop/headers/be/support/Errors.h:50: conflicting types for `enum {anonymous} B_TIMED_OUT' /boot/develop/headers/posix/be_errors.h:45: previous declaration as `enum {anonymous} B_TIMED_OUT' /boot/develop/headers/be/support/Errors.h:51: conflicting types for `enum {anonymous} B_INTERRUPTED' /boot/develop/headers/posix/be_errors.h:46: previous declaration as `enum {anonymous} B_INTERRUPTED' /boot/develop/headers/be/support/Errors.h:52: conflicting types for `enum {anonymous} B_WOULD_BLOCK' /boot/develop/headers/posix/be_errors.h:47: previous declaration as `enum {anonymous} B_WOULD_BLOCK' /boot/develop/headers/be/support/Errors.h:53: conflicting types for `enum {anonymous} B_CANCELED' /boot/develop/headers/posix/be_errors.h:48: previous declaration as `enum {anonymous} B_CANCELED' /boot/develop/headers/be/support/Errors.h:54: conflicting types for `enum {anonymous} B_NO_INIT' /boot/develop/headers/posix/be_errors.h:49: previous declaration as `enum {anonymous} B_NO_INIT' /boot/develop/headers/be/support/Errors.h:55: conflicting types for `enum {anonymous} B_BUSY' /boot/develop/headers/posix/be_errors.h:50: previous declaration as `enum {anonymous} B_BUSY' /boot/develop/headers/be/support/Errors.h:56: conflicting types for `enum {anonymous} B_NOT_ALLOWED' /boot/develop/headers/posix/be_errors.h:51: previous declaration as `enum {anonymous} B_NOT_ALLOWED' /boot/develop/headers/be/support/Errors.h:58: conflicting types for `enum {anonymous} B_ERROR' /boot/develop/headers/posix/be_errors.h:56: previous declaration as `enum {anonymous} B_ERROR' /boot/develop/headers/be/support/Errors.h:59: conflicting types for `enum {anonymous} B_OK' /boot/develop/headers/posix/be_errors.h:57: previous declaration as `enum {anonymous} B_OK' /boot/develop/headers/be/support/Errors.h:61: conflicting types for `enum {anonymous} B_NO_ERROR' /boot/develop/headers/posix/be_errors.h:59: previous declaration as `enum {anonymous} B_NO_ERROR' /boot/develop/headers/be/support/Errors.h:66: conflicting types for `enum {anonymous} B_BAD_SEM_ID' /boot/develop/headers/posix/be_errors.h:64: previous declaration as `enum {anonymous} B_BAD_SEM_ID' /boot/develop/headers/be/support/Errors.h:67: conflicting types for `enum {anonymous} B_NO_MORE_SEMS' /boot/develop/headers/posix/be_errors.h:65: previous declaration as `enum {anonymous} B_NO_MORE_SEMS' /boot/develop/headers/be/support/Errors.h:69: conflicting types for `enum {anonymous} B_BAD_THREAD_ID' /boot/develop/headers/posix/be_errors.h:67: previous declaration as `enum {anonymous} B_BAD_THREAD_ID' /boot/develop/headers/be/support/Errors.h:70: conflicting types for `enum {anonymous} B_NO_MORE_THREADS' /boot/develop/headers/posix/be_errors.h:68: previous declaration as `enum {anonymous} B_NO_MORE_THREADS' /boot/develop/headers/be/support/Errors.h:71: conflicting types for `enum {anonymous} B_BAD_THREAD_STATE' /boot/develop/headers/posix/be_errors.h:69: previous declaration as `enum {anonymous} B_BAD_THREAD_STATE' /boot/develop/headers/be/support/Errors.h:72: conflicting types for `enum {anonymous} B_BAD_TEAM_ID' /boot/develop/headers/posix/be_errors.h:70: previous declaration as `enum {anonymous} B_BAD_TEAM_ID' /boot/develop/headers/be/support/Errors.h:73: conflicting types for `enum {anonymous} B_NO_MORE_TEAMS' /boot/develop/headers/posix/be_errors.h:71: previous declaration as `enum {anonymous} B_NO_MORE_TEAMS' /boot/develop/headers/be/support/Errors.h:75: conflicting types for `enum {anonymous} B_BAD_PORT_ID' /boot/develop/headers/posix/be_errors.h:73: previous declaration as `enum {anonymous} B_BAD_PORT_ID' /boot/develop/headers/be/support/Errors.h:76: conflicting types for `enum {anonymous} B_NO_MORE_PORTS' /boot/develop/headers/posix/be_errors.h:74: previous declaration as `enum {anonymous} B_NO_MORE_PORTS' /boot/develop/headers/be/support/Errors.h:78: conflicting types for `enum {anonymous} B_BAD_IMAGE_ID' /boot/develop/headers/posix/be_errors.h:76: previous declaration as `enum {anonymous} B_BAD_IMAGE_ID' /boot/develop/headers/be/support/Errors.h:79: conflicting types for `enum {anonymous} B_BAD_ADDRESS' /boot/develop/headers/posix/be_errors.h:77: previous declaration as `enum {anonymous} B_BAD_ADDRESS' /boot/develop/headers/be/support/Errors.h:80: conflicting types for `enum {anonymous} B_NOT_AN_EXECUTABLE' /boot/develop/headers/posix/be_errors.h:78: previous declaration as `enum {anonymous} B_NOT_AN_EXECUTABLE' /boot/develop/headers/be/support/Errors.h:81: conflicting types for `enum {anonymous} B_MISSING_LIBRARY' /boot/develop/headers/posix/be_errors.h:79: previous declaration as `enum {anonymous} B_MISSING_LIBRARY' /boot/develop/headers/be/support/Errors.h:82: conflicting types for `enum {anonymous} B_MISSING_SYMBOL' /boot/develop/headers/posix/be_errors.h:80: previous declaration as `enum {anonymous} B_MISSING_SYMBOL' /boot/develop/headers/be/support/Errors.h:85: conflicting types for `enum {anonymous} B_DEBUGGER_ALREADY_INSTALLED' /boot/develop/headers/posix/be_errors.h:83: previous declaration as `enum {anonymous} B_DEBUGGER_ALREADY_INSTALLED' /boot/develop/headers/be/support/Errors.h:92: conflicting types for `enum {anonymous} B_BAD_REPLY' /boot/develop/headers/posix/be_errors.h:90: previous declaration as `enum {anonymous} B_BAD_REPLY' /boot/develop/headers/be/support/Errors.h:93: conflicting types for `enum {anonymous} B_DUPLICATE_REPLY' /boot/develop/headers/posix/be_errors.h:91: previous declaration as `enum {anonymous} B_DUPLICATE_REPLY' /boot/develop/headers/be/support/Errors.h:94: conflicting types for `enum {anonymous} B_MESSAGE_TO_SELF' /boot/develop/headers/posix/be_errors.h:92: previous declaration as `enum {anonymous} B_MESSAGE_TO_SELF' /boot/develop/headers/be/support/Errors.h:95: conflicting types for `enum {anonymous} B_BAD_HANDLER' /boot/develop/headers/posix/be_errors.h:93: previous declaration as `enum {anonymous} B_BAD_HANDLER' /boot/develop/headers/be/support/Errors.h:96: conflicting types for `enum {anonymous} B_ALREADY_RUNNING' /boot/develop/headers/posix/be_errors.h:94: previous declaration as `enum {anonymous} B_ALREADY_RUNNING' /boot/develop/headers/be/support/Errors.h:97: conflicting types for `enum {anonymous} B_LAUNCH_FAILED' /boot/develop/headers/posix/be_errors.h:95: previous declaration as `enum {anonymous} B_LAUNCH_FAILED' /boot/develop/headers/be/support/Errors.h:98: conflicting types for `enum {anonymous} B_AMBIGUOUS_APP_LAUNCH' /boot/develop/headers/posix/be_errors.h:96: previous declaration as `enum {anonymous} B_AMBIGUOUS_APP_LAUNCH' /boot/develop/headers/be/support/Errors.h:99: conflicting types for `enum {anonymous} B_UNKNOWN_MIME_TYPE' /boot/develop/headers/posix/be_errors.h:97: previous declaration as `enum {anonymous} B_UNKNOWN_MIME_TYPE' /boot/develop/headers/be/support/Errors.h:100: conflicting types for `enum {anonymous} B_BAD_SCRIPT_SYNTAX' /boot/develop/headers/posix/be_errors.h:98: previous declaration as `enum {anonymous} B_BAD_SCRIPT_SYNTAX' /boot/develop/headers/be/support/Errors.h:101: conflicting types for `enum {anonymous} B_LAUNCH_FAILED_NO_RESOLVE_LINK' /boot/develop/headers/posix/be_errors.h:99: previous declaration as `enum {anonymous} B_LAUNCH_FAILED_NO_RESOLVE_LINK' /boot/develop/headers/be/support/Errors.h:102: conflicting types for `enum {anonymous} B_LAUNCH_FAILED_EXECUTABLE' /boot/develop/headers/posix/be_errors.h:100: previous declaration as `enum {anonymous} B_LAUNCH_FAILED_EXECUTABLE' /boot/develop/headers/be/support/Errors.h:103: conflicting types for `enum {anonymous} B_LAUNCH_FAILED_APP_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:101: previous declaration as `enum {anonymous} B_LAUNCH_FAILED_APP_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:104: conflicting types for `enum {anonymous} B_LAUNCH_FAILED_APP_IN_TRASH' /boot/develop/headers/posix/be_errors.h:102: previous declaration as `enum {anonymous} B_LAUNCH_FAILED_APP_IN_TRASH' /boot/develop/headers/be/support/Errors.h:105: conflicting types for `enum {anonymous} B_LAUNCH_FAILED_NO_PREFERRED_APP' /boot/develop/headers/posix/be_errors.h:103: previous declaration as `enum {anonymous} B_LAUNCH_FAILED_NO_PREFERRED_APP' /boot/develop/headers/be/support/Errors.h:106: conflicting types for `enum {anonymous} B_LAUNCH_FAILED_FILES_APP_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:104: previous declaration as `enum {anonymous} B_LAUNCH_FAILED_FILES_APP_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:108: conflicting types for `enum {anonymous} B_BAD_MIME_SNIFFER_RULE' /boot/develop/headers/posix/be_errors.h:105: previous declaration as `enum {anonymous} B_BAD_MIME_SNIFFER_RULE' /boot/develop/headers/be/support/Errors.h:114: conflicting types for `enum {anonymous} B_FILE_ERROR' /boot/develop/headers/posix/be_errors.h:113: previous declaration as `enum {anonymous} B_FILE_ERROR' /boot/develop/headers/be/support/Errors.h:115: conflicting types for `enum {anonymous} B_FILE_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:114: previous declaration as `enum {anonymous} B_FILE_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:116: conflicting types for `enum {anonymous} B_FILE_EXISTS' /boot/develop/headers/posix/be_errors.h:115: previous declaration as `enum {anonymous} B_FILE_EXISTS' /boot/develop/headers/be/support/Errors.h:117: conflicting types for `enum {anonymous} B_ENTRY_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:116: previous declaration as `enum {anonymous} B_ENTRY_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:118: conflicting types for `enum {anonymous} B_NAME_TOO_LONG' /boot/develop/headers/posix/be_errors.h:117: previous declaration as `enum {anonymous} B_NAME_TOO_LONG' /boot/develop/headers/be/support/Errors.h:119: conflicting types for `enum {anonymous} B_NOT_A_DIRECTORY' /boot/develop/headers/posix/be_errors.h:118: previous declaration as `enum {anonymous} B_NOT_A_DIRECTORY' /boot/develop/headers/be/support/Errors.h:120: conflicting types for `enum {anonymous} B_DIRECTORY_NOT_EMPTY' /boot/develop/headers/posix/be_errors.h:119: previous declaration as `enum {anonymous} B_DIRECTORY_NOT_EMPTY' /boot/develop/headers/be/support/Errors.h:121: conflicting types for `enum {anonymous} B_DEVICE_FULL' /boot/develop/headers/posix/be_errors.h:120: previous declaration as `enum {anonymous} B_DEVICE_FULL' /boot/develop/headers/be/support/Errors.h:122: conflicting types for `enum {anonymous} B_READ_ONLY_DEVICE' /boot/develop/headers/posix/be_errors.h:121: previous declaration as `enum {anonymous} B_READ_ONLY_DEVICE' /boot/develop/headers/be/support/Errors.h:123: conflicting types for `enum {anonymous} B_IS_A_DIRECTORY' /boot/develop/headers/posix/be_errors.h:122: previous declaration as `enum {anonymous} B_IS_A_DIRECTORY' /boot/develop/headers/be/support/Errors.h:124: conflicting types for `enum {anonymous} B_NO_MORE_FDS' /boot/develop/headers/posix/be_errors.h:123: previous declaration as `enum {anonymous} B_NO_MORE_FDS' /boot/develop/headers/be/support/Errors.h:125: conflicting types for `enum {anonymous} B_CROSS_DEVICE_LINK' /boot/develop/headers/posix/be_errors.h:124: previous declaration as `enum {anonymous} B_CROSS_DEVICE_LINK' /boot/develop/headers/be/support/Errors.h:126: conflicting types for `enum {anonymous} B_LINK_LIMIT' /boot/develop/headers/posix/be_errors.h:125: previous declaration as `enum {anonymous} B_LINK_LIMIT' /boot/develop/headers/be/support/Errors.h:127: conflicting types for `enum {anonymous} B_BUSTED_PIPE' /boot/develop/headers/posix/be_errors.h:126: previous declaration as `enum {anonymous} B_BUSTED_PIPE' /boot/develop/headers/be/support/Errors.h:128: conflicting types for `enum {anonymous} B_UNSUPPORTED' /boot/develop/headers/posix/be_errors.h:127: previous declaration as `enum {anonymous} B_UNSUPPORTED' /boot/develop/headers/be/support/Errors.h:130: conflicting types for `enum {anonymous} B_PARTITION_TOO_SMALL' /boot/develop/headers/posix/be_errors.h:129: previous declaration as `enum {anonymous} B_PARTITION_TOO_SMALL' /boot/develop/headers/be/support/Errors.h:209: conflicting types for `enum {anonymous} B_STREAM_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:208: previous declaration as `enum {anonymous} B_STREAM_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:210: conflicting types for `enum {anonymous} B_SERVER_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:209: previous declaration as `enum {anonymous} B_SERVER_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:211: conflicting types for `enum {anonymous} B_RESOURCE_NOT_FOUND' /boot/develop/headers/posix/be_errors.h:210: previous declaration as `enum {anonymous} B_RESOURCE_NOT_FOUND' /boot/develop/headers/be/support/Errors.h:212: conflicting types for `enum {anonymous} B_RESOURCE_UNAVAILABLE' /boot/develop/headers/posix/be_errors.h:211: previous declaration as `enum {anonymous} B_RESOURCE_UNAVAILABLE' /boot/develop/headers/be/support/Errors.h:213: conflicting types for `enum {anonymous} B_BAD_SUBSCRIBER' /boot/develop/headers/posix/be_errors.h:212: previous declaration as `enum {anonymous} B_BAD_SUBSCRIBER' /boot/develop/headers/be/support/Errors.h:214: conflicting types for `enum {anonymous} B_SUBSCRIBER_NOT_ENTERED' /boot/develop/headers/posix/be_errors.h:213: previous declaration as `enum {anonymous} B_SUBSCRIBER_NOT_ENTERED' /boot/develop/headers/be/support/Errors.h:215: conflicting types for `enum {anonymous} B_BUFFER_NOT_AVAILABLE' /boot/develop/headers/posix/be_errors.h:214: previous declaration as `enum {anonymous} B_BUFFER_NOT_AVAILABLE' /boot/develop/headers/be/support/Errors.h:217: conflicting types for `enum {anonymous} B_LAST_BUFFER_ERROR' /boot/develop/headers/posix/be_errors.h:216: previous declaration as `enum {anonymous} B_LAST_BUFFER_ERROR' /boot/develop/headers/be/support/Errors.h:223: conflicting types for `enum {anonymous} B_MAIL_NO_DAEMON' /boot/develop/headers/posix/be_errors.h:222: previous declaration as `enum {anonymous} B_MAIL_NO_DAEMON' /boot/develop/headers/be/support/Errors.h:224: conflicting types for `enum {anonymous} B_MAIL_UNKNOWN_USER' /boot/develop/headers/posix/be_errors.h:223: previous declaration as `enum {anonymous} B_MAIL_UNKNOWN_USER' /boot/develop/headers/be/support/Errors.h:225: conflicting types for `enum {anonymous} B_MAIL_WRONG_PASSWORD' /boot/develop/headers/posix/be_errors.h:224: previous declaration as `enum {anonymous} B_MAIL_WRONG_PASSWORD' /boot/develop/headers/be/support/Errors.h:226: conflicting types for `enum {anonymous} B_MAIL_UNKNOWN_HOST' /boot/develop/headers/posix/be_errors.h:225: previous declaration as `enum {anonymous} B_MAIL_UNKNOWN_HOST' /boot/develop/headers/be/support/Errors.h:227: conflicting types for `enum {anonymous} B_MAIL_ACCESS_ERROR' /boot/develop/headers/posix/be_errors.h:226: previous declaration as `enum {anonymous} B_MAIL_ACCESS_ERROR' /boot/develop/headers/be/support/Errors.h:228: conflicting types for `enum {anonymous} B_MAIL_UNKNOWN_FIELD' /boot/develop/headers/posix/be_errors.h:227: previous declaration as `enum {anonymous} B_MAIL_UNKNOWN_FIELD' /boot/develop/headers/be/support/Errors.h:229: conflicting types for `enum {anonymous} B_MAIL_NO_RECIPIENT' /boot/develop/headers/posix/be_errors.h:228: previous declaration as `enum {anonymous} B_MAIL_NO_RECIPIENT' /boot/develop/headers/be/support/Errors.h:231: conflicting types for `enum {anonymous} B_MAIL_INVALID_MAIL' /boot/develop/headers/posix/be_errors.h:230: previous declaration as `enum {anonymous} B_MAIL_INVALID_MAIL' /boot/develop/headers/be/support/Errors.h:238: conflicting types for `enum {anonymous} B_NO_PRINT_SERVER' /boot/develop/headers/posix/be_errors.h:236: previous declaration as `enum {anonymous} B_NO_PRINT_SERVER' /boot/develop/headers/be/support/Errors.h:244: conflicting types for `enum {anonymous} B_DEV_INVALID_IOCTL' /boot/develop/headers/posix/be_errors.h:257: previous declaration as `enum {anonymous} B_DEV_INVALID_IOCTL' /boot/develop/headers/be/support/Errors.h:245: conflicting types for `enum {anonymous} B_DEV_NO_MEMORY' /boot/develop/headers/posix/be_errors.h:258: previous declaration as `enum {anonymous} B_DEV_NO_MEMORY' /boot/develop/headers/be/support/Errors.h:246: conflicting types for `enum {anonymous} B_DEV_BAD_DRIVE_NUM' /boot/develop/headers/posix/be_errors.h:259: previous declaration as `enum {anonymous} B_DEV_BAD_DRIVE_NUM' /boot/develop/headers/be/support/Errors.h:247: conflicting types for `enum {anonymous} B_DEV_NO_MEDIA' /boot/develop/headers/posix/be_errors.h:260: previous declaration as `enum {anonymous} B_DEV_NO_MEDIA' /boot/develop/headers/be/support/Errors.h:248: conflicting types for `enum {anonymous} B_DEV_UNREADABLE' /boot/develop/headers/posix/be_errors.h:261: previous declaration as `enum {anonymous} B_DEV_UNREADABLE' /boot/develop/headers/be/support/Errors.h:249: conflicting types for `enum {anonymous} B_DEV_FORMAT_ERROR' /boot/develop/headers/posix/be_errors.h:262: previous declaration as `enum {anonymous} B_DEV_FORMAT_ERROR' /boot/develop/headers/be/support/Errors.h:250: conflicting types for `enum {anonymous} B_DEV_TIMEOUT' /boot/develop/headers/posix/be_errors.h:263: previous declaration as `enum {anonymous} B_DEV_TIMEOUT' /boot/develop/headers/be/support/Errors.h:251: conflicting types for `enum {anonymous} B_DEV_RECALIBRATE_ERROR' /boot/develop/headers/posix/be_errors.h:264: previous declaration as `enum {anonymous} B_DEV_RECALIBRATE_ERROR' /boot/develop/headers/be/support/Errors.h:252: conflicting types for `enum {anonymous} B_DEV_SEEK_ERROR' /boot/develop/headers/posix/be_errors.h:265: previous declaration as `enum {anonymous} B_DEV_SEEK_ERROR' /boot/develop/headers/be/support/Errors.h:253: conflicting types for `enum {anonymous} B_DEV_ID_ERROR' /boot/develop/headers/posix/be_errors.h:266: previous declaration as `enum {anonymous} B_DEV_ID_ERROR' /boot/develop/headers/be/support/Errors.h:254: conflicting types for `enum {anonymous} B_DEV_READ_ERROR' /boot/develop/headers/posix/be_errors.h:267: previous declaration as `enum {anonymous} B_DEV_READ_ERROR' /boot/develop/headers/be/support/Errors.h:255: conflicting types for `enum {anonymous} B_DEV_WRITE_ERROR' /boot/develop/headers/posix/be_errors.h:268: previous declaration as `enum {anonymous} B_DEV_WRITE_ERROR' /boot/develop/headers/be/support/Errors.h:256: conflicting types for `enum {anonymous} B_DEV_NOT_READY' /boot/develop/headers/posix/be_errors.h:269: previous declaration as `enum {anonymous} B_DEV_NOT_READY' /boot/develop/headers/be/support/Errors.h:257: conflicting types for `enum {anonymous} B_DEV_MEDIA_CHANGED' /boot/develop/headers/posix/be_errors.h:270: previous declaration as `enum {anonymous} B_DEV_MEDIA_CHANGED' /boot/develop/headers/be/support/Errors.h:258: conflicting types for `enum {anonymous} B_DEV_MEDIA_CHANGE_REQUESTED' /boot/develop/headers/posix/be_errors.h:271: previous declaration as `enum {anonymous} B_DEV_MEDIA_CHANGE_REQUESTED' /boot/develop/headers/be/support/Errors.h:259: conflicting types for `enum {anonymous} B_DEV_RESOURCE_CONFLICT' /boot/develop/headers/posix/be_errors.h:272: previous declaration as `enum {anonymous} B_DEV_RESOURCE_CONFLICT' /boot/develop/headers/be/support/Errors.h:260: conflicting types for `enum {anonymous} B_DEV_CONFIGURATION_ERROR' /boot/develop/headers/posix/be_errors.h:273: previous declaration as `enum {anonymous} B_DEV_CONFIGURATION_ERROR' /boot/develop/headers/be/support/Errors.h:261: conflicting types for `enum {anonymous} B_DEV_DISABLED_BY_USER' /boot/develop/headers/posix/be_errors.h:274: previous declaration as `enum {anonymous} B_DEV_DISABLED_BY_USER' /boot/develop/headers/be/support/Errors.h:263: conflicting types for `enum {anonymous} B_DEV_DOOR_OPEN' /boot/develop/headers/posix/be_errors.h:275: previous declaration as `enum {anonymous} B_DEV_DOOR_OPEN' gcc -c "src/bin/copyattr.cpp" -O2 -Wall -Wno-trigraphs -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -Wno- multichar -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 -DARCH_x86 - D_NO_INLINE_ASM -DCOMPILE_FOR_R5 -DHAIKU_HOST_PLATFORM_DANO -Ibuild/ user_config_headers -Ibuild/config_headers -Isrc/tools -Igenerated/objects/ common/tools -Igenerated/objects/dano/x86/common/tools -Igenerated/objects/ haiku/x86/common/tools -Isrc/bin -I- -Iheaders/build/private/app -Iheaders/ build/private/storage -Iheaders/private/shared -Iheaders/build/host/dano - Iheaders/build/host/beos_common -o "generated/objects/dano/x86/release/tools/ copyattr.o" ; ...failed C++ generated/objects/dano/x86/release/tools/copyattr.o ... ...skipped copyattr for lack of copyattr.o... ...skipped haiku.image-init-vars for lack of copyattr... ...skipped haiku.image for lack of haiku.image-init-vars... ...failed updating 1 target(s)... ...skipped 3 target(s)... ...updated 68 target(s)... rossi at haven haiku> >Hi Ingo > >> Perl is a problem indeed. I believe there's no built package >> available of a >> version that would work. 5.10.0 may or may not build and work well on >> BeOS. >> The late 5.8.* versions should do under R5 net server. I had some bug >> reports, that under BONE there was trouble with the flock_server >> support >> enabled. > >Indeed I used the 5.8.0 version of perl to get autoconf going. Anyway I >have now built a package of the cross tools that works on BONE, haven't >and cannot test on plain R5 though. I built it using "configure --build >-cross-tools" from "/boot/apps/haiku" and zipped up the cross-tools >folder. The zip is availalbe from http://haiku.mlotz.ch/ >haiku_cross_compiler_bone_2.95.3-haiku-080323.zip >and should be extracted to "/boot". I successfully configured another >machine with "configure --cross-tools-prefix /boot/apps/haiku/cross- >tools/bin/i586-pc-haiku-" and built a working haiku.image with that. >So it would be nice if someone could try that under plain R5 and maybe >we could upload that package to haiku-files and put a link with >instructions onto the developer page. > >Regards >Michael >_______________________________________________ >Haiku-commits mailing list >Haiku-commits at lists.berlios.de >https://lists.berlios.de/mailman/listinfo/haiku-commits > From stippi at mail.berlios.de Sun Apr 6 19:59:23 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 19:59:23 +0200 Subject: [Haiku-commits] r24841 - haiku/trunk/src/kits/interface Message-ID: <200804061759.m36HxNd5004164@sheep.berlios.de> Author: stippi Date: 2008-04-06 19:59:22 +0200 (Sun, 06 Apr 2008) New Revision: 24841 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24841&view=rev Modified: haiku/trunk/src/kits/interface/View.cpp Log: Oh boy. I think I fixed the issue by understanding it with the right side of my brain, while the left side is still puzzled. So it's hard to put it into words. Basically, there was an unwanted feedback loop when applications first scrolled vertically and then horizontally (or vice versa). Because of the feedback effects between BView and controlling BScrollBar, and because BView controlls both scrollbars at once, it is important not to set the scrolling offset of an unaffected ScrollBar, since we might actually be comming from the SetValue() function of the other scrollbar. Fixes #1913 and possibly more, going to check up on the other scrolling related bugs. Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-04-06 17:53:43 UTC (rev 24840) +++ haiku/trunk/src/kits/interface/View.cpp 2008-04-06 17:59:22 UTC (rev 24841) @@ -1569,9 +1569,9 @@ fBounds.OffsetBy(deltaX, deltaY); // then set the new values of the scrollbars - if (fHorScroller) + if (fHorScroller && deltaX != 0.0) fHorScroller->SetValue(fBounds.left); - if (fVerScroller) + if (fVerScroller && deltaY != 0.0) fVerScroller->SetValue(fBounds.top); } From mmlr at mlotz.ch Sun Apr 6 20:39:35 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 06 Apr 2008 20:39:35 +0200 Subject: [Haiku-commits] r24542 - in haiku/trunk: . build/scripts In-Reply-To: <00044a380e48a86c_mailit@relay.webpositive.org> Message-ID: <1606958805-BeMail@primary> Hi Marcus > /boot/develop/headers/be/support/Errors.h:263: conflicting types for > `enum > {anonymous} B_DEV_DOOR_OPEN' > /boot/develop/headers/posix/be_errors.h:275: previous declaration as > `enum > {anonymous} B_DEV_DOOR_OPEN' > > gcc -c "src/bin/copyattr.cpp" -O2 -Wall -Wno-trigraphs -Wno-ctor-dtor > -privacy > -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -Wno > - > multichar -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 - > DARCH_x86 - > D_NO_INLINE_ASM -DCOMPILE_FOR_R5 -DHAIKU_HOST_PLATFORM_DANO -Ibuild/ > user_config_headers -Ibuild/config_headers -Isrc/tools -Igenerated/ > objects/ > common/tools -Igenerated/objects/dano/x86/common/tools -Igenerated/ > objects/ > haiku/x86/common/tools -Isrc/bin -I- -Iheaders/build/private/app - > Iheaders/ > build/private/storage -Iheaders/private/shared -Iheaders/build/host/ > dano - > Iheaders/build/host/beos_common -o "generated/objects/dano/x86/ > release/tools/ > copyattr.o" ; > > ...failed C++ generated/objects/dano/x86/release/tools/copyattr.o ... > ...skipped copyattr for lack of copyattr.o... > ...skipped haiku.image-init-vars for lack of > copyattr... > ...skipped haiku.image for lack of haiku.image-init- > vars... > ...failed updating 1 target(s)... > ...skipped 3 target(s)... > ...updated 68 target(s)... > rossi at haven haiku> In fact you are not even using the cross compiler yet, as you are still at the very beginning where you build the (host-platform compiled) build tools. It seems that two headers get included "/boot/develop/ headers/be/support/Errors.h" and "/boot/develop/headers/posix/ be_errors.h" which both define the same error codes. When taking a look at a Dano image I have around here it seems that "Errors.h" should simply include "be_errors.h" and nothing else. Possibly you replaced some headers in your development environment? Regards Michael From rossi at webpositive.org Sun Apr 6 21:01:52 2008 From: rossi at webpositive.org (Marcus Jacob) Date: Sun, 06 Apr 2008 21:01:52 +0200 Subject: [Haiku-commits] r24542 - in haiku/trunk: . build/scripts References: <1606958805-BeMail@primary> Message-ID: <00044a38fbfa27c3_mailit@relay.webpositive.org> Hi Michael, understood. The weird thing is, that I didn't change any headers or alike. It all used to work before the change to the build system ;-( just checked all the path in the shell environment and they look all like they should ... I'm clueless ... anyhow I'll go shop around for a clean headers dir, just to be on the safe side ... @Stephan: btw, same error with the correct target ... Thanks, Marcus >Hi Marcus > >> /boot/develop/headers/be/support/Errors.h:263: conflicting types for >> `enum >> {anonymous} B_DEV_DOOR_OPEN' >> /boot/develop/headers/posix/be_errors.h:275: previous declaration as >> `enum >> {anonymous} B_DEV_DOOR_OPEN' >> >> gcc -c "src/bin/copyattr.cpp" -O2 -Wall -Wno-trigraphs -Wno-ctor-dtor >> -privacy >> -Woverloaded-virtual -Wpointer-arith -Wcast-align -Wsign-compare -Wno >> - >> multichar -D_ZETA_USING_DEPRECATED_API_=1 -D_ZETA_TS_FIND_DIR_=1 - >> DARCH_x86 - >> D_NO_INLINE_ASM -DCOMPILE_FOR_R5 -DHAIKU_HOST_PLATFORM_DANO -Ibuild/ >> user_config_headers -Ibuild/config_headers -Isrc/tools -Igenerated/ >> objects/ >> common/tools -Igenerated/objects/dano/x86/common/tools -Igenerated/ >> objects/ >> haiku/x86/common/tools -Isrc/bin -I- -Iheaders/build/private/app - >> Iheaders/ >> build/private/storage -Iheaders/private/shared -Iheaders/build/host/ >> dano - >> Iheaders/build/host/beos_common -o "generated/objects/dano/x86/ >> release/tools/ >> copyattr.o" ; >> >> ...failed C++ generated/objects/dano/x86/release/tools/copyattr.o ... >> ...skipped copyattr for lack of copyattr.o... >> ...skipped haiku.image-init-vars for lack of >> copyattr... >> ...skipped haiku.image for lack of haiku.image-init- >> vars... >> ...failed updating 1 target(s)... >> ...skipped 3 target(s)... >> ...updated 68 target(s)... >> rossi at haven haiku> > >In fact you are not even using the cross compiler yet, as you are still >at the very beginning where you build the (host-platform compiled) >build tools. It seems that two headers get included "/boot/develop/ >headers/be/support/Errors.h" and "/boot/develop/headers/posix/ >be_errors.h" which both define the same error codes. When taking a look >at a Dano image I have around here it seems that "Errors.h" should >simply include "be_errors.h" and nothing else. Possibly you replaced >some headers in your development environment? > >Regards >Michael >_______________________________________________ >Haiku-commits mailing list >Haiku-commits at lists.berlios.de >https://lists.berlios.de/mailman/listinfo/haiku-commits > From mmlr at mail.berlios.de Sun Apr 6 21:59:24 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 21:59:24 +0200 Subject: [Haiku-commits] r24842 - in haiku/trunk: headers/libs/usb src/add-ons/kernel/drivers/bus/usb src/libs/usb Message-ID: <200804061959.m36JxOvS014401@sheep.berlios.de> Author: mmlr Date: 2008-04-06 21:59:24 +0200 (Sun, 06 Apr 2008) New Revision: 24842 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24842&view=rev Modified: haiku/trunk/headers/libs/usb/USBKit.h haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h haiku/trunk/src/libs/usb/USBInterface.cpp Log: * Add a AlternateAt() method to the BUSBInterface class that can retrieve the usb_interface_descriptor of an alternate interface without having to switch to it. * Add some reserve bytes to all classes and add some reserved virtual slots where the objects are publically constructable. * Remove the source compatibilty defines that were briding the old USB* with the new BUSB* class names. * Implement the usb_raw side of getting an alternate interface descriptor. Modified: haiku/trunk/headers/libs/usb/USBKit.h =================================================================== --- haiku/trunk/headers/libs/usb/USBKit.h 2008-04-06 17:59:22 UTC (rev 24841) +++ haiku/trunk/headers/libs/usb/USBKit.h 2008-04-06 19:59:24 UTC (rev 24842) @@ -11,14 +11,6 @@ #include -// Keep compatibility with original USBKit classes -#define USBRoster BUSBRoster -#define USBDevice BUSBDevice -#define USBConfiguration BUSBConfiguration -#define USBInterface BUSBInterface -#define USBEndpoint BUSBEndpoint - - class BUSBRoster; class BUSBDevice; class BUSBConfiguration; @@ -54,7 +46,14 @@ void Stop(); private: +virtual void _ReservedUSBRoster1(); +virtual void _ReservedUSBRoster2(); +virtual void _ReservedUSBRoster3(); +virtual void _ReservedUSBRoster4(); +virtual void _ReservedUSBRoster5(); + void *fLooper; + uint32 fReserved[10]; }; @@ -138,6 +137,12 @@ void *data) const; private: +virtual void _ReservedUSBDevice1(); +virtual void _ReservedUSBDevice2(); +virtual void _ReservedUSBDevice3(); +virtual void _ReservedUSBDevice4(); +virtual void _ReservedUSBDevice5(); + char *fPath; int fRawFD; @@ -148,6 +153,8 @@ mutable char *fManufacturerString; mutable char *fProductString; mutable char *fSerialNumberString; + + uint32 fReserved[10]; }; @@ -195,6 +202,8 @@ BUSBInterface **fInterfaces; mutable char *fConfigurationString; + + uint32 fReserved[10]; }; @@ -238,14 +247,26 @@ const BUSBEndpoint *EndpointAt(uint32 index) const; // Using CountAlternates() you can retrieve the number of alternate - // interfaces at this interface index. Note that this interface itself + // interfaces for this interface. Note that this interface itself // counts as an alternate so an alternate count of one really means // that you are currently using the sole interface present. + // AlternateAt() returns the interface descriptor of the alternate + // interface with the specified index. Using that you can peek at the + // information contained in the descriptor without having to switch + // to this alternate interface. Note that the alternate index set in + // the interface descriptor returned is not necessarily the same index + // you used to get the descriptor. Always use the zero based index you + // used to get the information with and not the values of the returned + // descriptor as the stack will handle that translation internally. + // The interface descriptor returned was allocated by new and is yours. + // You need to delete it when you're done with it. // With SetAlternate() you can switch this BUSBInterface object to the - // alternate at the specified index. Note that all endpoints retrieved - // through EndpointAt() will become invalid and be deleted as soon as - // you set an alternate. + // alternate interface at the specified index. Note that all endpoints + // retrieved through EndpointAt() will become invalid and will be + // deleted as soon as you set an alternate interface (even if the + // resulting interface is the same you were using before). uint32 CountAlternates() const; + usb_interface_descriptor *AlternateAt(uint32 alternateIndex); status_t SetAlternate(uint32 alternateIndex); private: @@ -264,6 +285,8 @@ BUSBEndpoint **fEndpoints; mutable char *fInterfaceString; + + uint32 fReserved[10]; }; @@ -331,6 +354,8 @@ int fRawFD; usb_endpoint_descriptor fDescriptor; + + uint32 fReserved[10]; }; #endif Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-06 17:59:22 UTC (rev 24841) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-06 19:59:24 UTC (rev 24842) @@ -290,6 +290,34 @@ return B_OK; } + case RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR: { + const usb_configuration_info *configurationInfo = + gUSBModule->get_nth_configuration(device->device, + command->alternate.config_index); + if (!configurationInfo) { + command->alternate.status = RAW_STATUS_INVALID_CONFIGURATION; + return B_OK; + } + + if (command->alternate.interface_index >= configurationInfo->interface_count) { + command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + return B_OK; + } + + const usb_interface_list *interfaceList = + &configurationInfo->interface[command->alternate.interface_index]; + if (command->alternate.alternate_index >= interfaceList->alt_count) { + command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + return B_OK; + } + + memcpy(command->alternate.descriptor, + &interfaceList->alt[command->alternate.alternate_index], + sizeof(usb_interface_descriptor)); + command->alternate.status = RAW_STATUS_SUCCESS; + return B_OK; + } + case RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-06 17:59:22 UTC (rev 24841) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-06 19:59:24 UTC (rev 24842) @@ -24,6 +24,7 @@ RAW_COMMAND_GET_STRING_DESCRIPTOR, RAW_COMMAND_GET_GENERIC_DESCRIPTOR, RAW_COMMAND_GET_ALT_INTERFACE_COUNT, + RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR, RAW_COMMAND_SET_CONFIGURATION = 0x3000, RAW_COMMAND_SET_FEATURE, @@ -83,6 +84,7 @@ struct { status_t status; uint32 *alternate_count; + usb_interface_descriptor *descriptor; uint32 config_index; uint32 interface_index; uint32 alternate_index; Modified: haiku/trunk/src/libs/usb/USBInterface.cpp =================================================================== --- haiku/trunk/src/libs/usb/USBInterface.cpp 2008-04-06 17:59:22 UTC (rev 24841) +++ haiku/trunk/src/libs/usb/USBInterface.cpp 2008-04-06 19:59:24 UTC (rev 24842) @@ -157,6 +157,28 @@ } +usb_interface_descriptor * +BUSBInterface::AlternateAt(uint32 alternateIndex) +{ + usb_interface_descriptor *descriptor = new usb_interface_descriptor; + if (descriptor == NULL) + return NULL; + + raw_command command; + command.alternate.descriptor = descriptor; + command.alternate.config_index = fConfiguration->Index(); + command.alternate.interface_index = fIndex; + command.alternate.alternate_index = alternateIndex; + if (ioctl(fRawFD, RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR, &command, + sizeof(command)) || command.alternate.status != RAW_STATUS_SUCCESS) { + delete descriptor; + return NULL; + } + + return descriptor; +} + + status_t BUSBInterface::SetAlternate(uint32 alternateIndex) { From stippi at mail.berlios.de Sun Apr 6 22:01:03 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 22:01:03 +0200 Subject: [Haiku-commits] r24843 - haiku/trunk/src/apps/aboutsystem Message-ID: <200804062001.m36K13p4014732@sheep.berlios.de> Author: stippi Date: 2008-04-06 22:00:58 +0200 (Sun, 06 Apr 2008) New Revision: 24843 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24843&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Addded various people who have contributed lately. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-06 19:59:24 UTC (rev 24842) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-06 20:00:58 UTC (rev 24843) @@ -427,6 +427,7 @@ "Elad Lahav\n" "Anthony Lee\n" "Santiago Lema\n" + "Raynald Lesieur\n" "Oscar Lesta\n" "Jerome Leveque\n" "Christof Lutteroth\n" @@ -436,7 +437,9 @@ "Christopher ML Zumwalt May\n" "Andrew McCall\n" "Michele (zuMi)\n" + "Marius Middelthon\n" "Misza\n" + "Fredrik Mod?en\n" "MrSiggler\n" "Alan Murta\n" "Frans Van Nispen\n" @@ -451,6 +454,7 @@ "Samuel Rodriguez Perez\n" "Thomas Roell\n" "Rafael Romo\n" + "Philippe Saint-Pierre\n" "Reznikov Sergei\n" "Zousar Shaker\n" "Alexander G. M. Smith\n" @@ -464,6 +468,7 @@ "Nathan Whitehorn\n" "Michael Wilber\n" "Ulrich Wimboeck\n" + "James Woodcock\n" // getpagesize() patch "Artur Wyszynski\n" "Gabe Yoder\n" "Gerald Zajac\n" From stippi at mail.berlios.de Sun Apr 6 22:11:04 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 6 Apr 2008 22:11:04 +0200 Subject: [Haiku-commits] r24844 - in haiku/trunk: headers/private/kernel/boot src/system/boot/platform/bios_ia32 src/tools Message-ID: <200804062011.m36KB4bU015477@sheep.berlios.de> Author: stippi Date: 2008-04-06 22:10:50 +0200 (Sun, 06 Apr 2008) New Revision: 24844 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24844&view=rev Modified: haiku/trunk/headers/private/kernel/boot/images.h haiku/trunk/src/system/boot/platform/bios_ia32/video.cpp haiku/trunk/src/tools/generate_boot_screen.cpp Log: Patch by Philippe Saint-Pierre: * Revised the RLE algorithm used for compressing the boot splash artwork to handle uncompressed runs. * Compress the RGB channels separately for improved efficiency. Modified: haiku/trunk/headers/private/kernel/boot/images.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/images.h 2008-04-06 20:00:58 UTC (rev 24843) +++ haiku/trunk/headers/private/kernel/boot/images.h 2008-04-06 20:10:50 UTC (rev 24844) @@ -5,5464 +5,8801 @@ static const int32 kSplashIconsPlacementX = 50; static const int32 kSplashIconsPlacementY = 50; -struct RLE_element -{ - uint16 count; - uint8 colorComponent; -}; - static const uint16 kSplashLogoWidth = 372; static const uint16 kSplashLogoHeight = 96; #ifndef __BOOTSPLASH_KERNEL__ -static const RLE_element kSplashLogoCompressedImage[] = { - {2892, 0x00}, {27, 0x04}, {15, 0x00}, {60, 0x04}, {531, 0x00}, {27, 0x04}, - {66, 0x00}, {27, 0x04}, {114, 0x00}, {30, 0x04}, {111, 0x00}, {36, 0x04}, - {57, 0x00}, {18, 0x04}, {24, 0x03}, {18, 0x04}, {12, 0x03}, {33, 0x08}, - {9, 0x03}, {12, 0x04}, {42, 0x00}, {36, 0x04}, {60, 0x00}, {33, 0x04}, - {342, 0x00}, {9, 0x04}, {24, 0x03}, {12, 0x04}, {45, 0x00}, {15, 0x04}, - {21, 0x03}, {12, 0x04}, {96, 0x00}, {9, 0x04}, {3, 0x03}, {21, 0x08}, - {6, 0x03}, {9, 0x04}, {93, 0x00}, {12, 0x04}, {3, 0x03}, {24, 0x08}, - {3, 0x03}, {9, 0x04}, {42, 0x00}, {9, 0x04}, {6, 0x03}, {9, 0x08}, - {72, 0x06}, {12, 0x07}, {15, 0x06}, {9, 0x03}, {12, 0x04}, {21, 0x00}, - {15, 0x04}, {6, 0x03}, {18, 0x08}, {6, 0x03}, {15, 0x04}, {39, 0x00}, - {12, 0x04}, {6, 0x03}, {18, 0x08}, {6, 0x03}, {9, 0x04}, {327, 0x00}, - {6, 0x04}, {6, 0x03}, {3, 0x08}, {21, 0x06}, {6, 0x08}, {6, 0x03}, - {12, 0x04}, {27, 0x00}, {12, 0x04}, {6, 0x03}, {6, 0x08}, {21, 0x06}, - {3, 0x08}, {6, 0x03}, {9, 0x04}, {84, 0x00}, {6, 0x04}, {3, 0x03}, - {3, 0x08}, {36, 0x06}, {3, 0x08}, {3, 0x03}, {6, 0x04}, {84, 0x00}, - {6, 0x04}, {3, 0x03}, {6, 0x08}, {30, 0x06}, {3, 0x08}, {6, 0x03}, - {12, 0x04}, {21, 0x00}, {9, 0x04}, {6, 0x03}, {3, 0x08}, {12, 0x06}, - {57, 0x07}, {6, 0x0b}, {30, 0x0a}, {9, 0x07}, {9, 0x06}, {3, 0x08}, - {6, 0x03}, {24, 0x04}, {9, 0x03}, {6, 0x08}, {30, 0x06}, {6, 0x08}, - {6, 0x03}, {12, 0x04}, {21, 0x00}, {12, 0x04}, {3, 0x03}, {6, 0x08}, - {30, 0x06}, {6, 0x08}, {3, 0x03}, {6, 0x04}, {315, 0x00}, {6, 0x04}, - {3, 0x03}, {3, 0x08}, {9, 0x06}, {24, 0x07}, {9, 0x06}, {6, 0x08}, - {6, 0x03}, {30, 0x04}, {6, 0x03}, {3, 0x08}, {12, 0x06}, {21, 0x07}, - {9, 0x06}, {3, 0x08}, {3, 0x03}, {6, 0x04}, {75, 0x00}, {6, 0x04}, - {6, 0x08}, {6, 0x06}, {6, 0x07}, {3, 0x0b}, {18, 0x0a}, {3, 0x0b}, - {6, 0x07}, {6, 0x06}, {6, 0x08}, {6, 0x04}, {72, 0x00}, {6, 0x04}, - {3, 0x03}, {3, 0x08}, {9, 0x06}, {3, 0x07}, {9, 0x0b}, {6, 0x0a}, - {3, 0x0b}, {9, 0x07}, {9, 0x06}, {3, 0x08}, {6, 0x03}, {27, 0x04}, - {3, 0x03}, {6, 0x08}, {6, 0x06}, {6, 0x07}, {3, 0x0b}, {15, 0x0a}, - {15, 0x09}, {24, 0x0a}, {42, 0x09}, {9, 0x0a}, {9, 0x07}, {6, 0x06}, - {3, 0x08}, {24, 0x03}, {3, 0x08}, {12, 0x06}, {12, 0x07}, {9, 0x0b}, - {12, 0x07}, {9, 0x06}, {3, 0x08}, {6, 0x03}, {27, 0x04}, {6, 0x03}, - {3, 0x08}, {9, 0x06}, {15, 0x07}, {3, 0x0b}, {12, 0x07}, {6, 0x06}, - {6, 0x08}, {6, 0x04}, {309, 0x00}, {6, 0x04}, {3, 0x03}, {3, 0x08}, - {3, 0x06}, {6, 0x07}, {3, 0x0b}, {24, 0x0a}, {3, 0x0b}, {6, 0x07}, - {9, 0x06}, {9, 0x03}, {15, 0x04}, {9, 0x03}, {9, 0x06}, {9, 0x07}, - {27, 0x0a}, {6, 0x07}, {6, 0x06}, {3, 0x08}, {3, 0x03}, {3, 0x04}, - {66, 0x00}, {6, 0x04}, {3, 0x03}, {3, 0x08}, {3, 0x06}, {6, 0x07}, - {6, 0x0a}, {9, 0x09}, {3, 0x0c}, {6, 0x0d}, {12, 0x09}, {6, 0x0a}, - {3, 0x07}, {6, 0x06}, {3, 0x08}, {3, 0x03}, {3, 0x04}, {66, 0x00}, - {6, 0x04}, {3, 0x08}, {6, 0x06}, {6, 0x07}, {9, 0x0a}, {15, 0x09}, - {9, 0x0a}, {3, 0x0b}, {6, 0x07}, {6, 0x06}, {3, 0x08}, {12, 0x03}, - {3, 0x04}, {12, 0x03}, {9, 0x06}, {3, 0x07}, {3, 0x0b}, {6, 0x0a}, - {9, 0x09}, {54, 0x0d}, {30, 0x0c}, {9, 0x0d}, {6, 0x09}, {6, 0x0a}, - {3, 0x06}, {6, 0x07}, {12, 0x06}, {6, 0x08}, {12, 0x06}, {9, 0x07}, - {9, 0x0a}, {18, 0x09}, {9, 0x0a}, {3, 0x0b}, {6, 0x07}, {6, 0x06}, - {3, 0x08}, {9, 0x03}, {9, 0x04}, {9, 0x03}, {3, 0x08}, {6, 0x06}, - {6, 0x07}, {12, 0x0a}, {12, 0x09}, {9, 0x0a}, {3, 0x0b}, {3, 0x07}, - {6, 0x06}, {3, 0x08}, {3, 0x03}, {6, 0x04}, {300, 0x00}, {6, 0x04}, - {3, 0x08}, {6, 0x06}, {3, 0x07}, {9, 0x0a}, {27, 0x09}, {6, 0x0a}, - {9, 0x07}, {9, 0x06}, {3, 0x08}, {15, 0x03}, {9, 0x06}, {6, 0x07}, - {6, 0x0a}, {30, 0x09}, {6, 0x0a}, {3, 0x07}, {6, 0x06}, {3, 0x08}, - {3, 0x03}, {3, 0x04}, {60, 0x00}, {6, 0x04}, {3, 0x08}, {6, 0x06}, - {3, 0x0b}, {6, 0x0a}, {3, 0x09}, {6, 0x0d}, {24, 0x0c}, {6, 0x0d}, - {3, 0x09}, {6, 0x0a}, {3, 0x0b}, {6, 0x06}, {3, 0x08}, {3, 0x04}, - {60, 0x00}, {6, 0x04}, {3, 0x08}, {3, 0x06}, {6, 0x07}, {6, 0x0a}, - {6, 0x09}, {24, 0x0d}, {6, 0x09}, {6, 0x0a}, {6, 0x07}, {12, 0x06}, - {9, 0x08}, {9, 0x06}, {6, 0x07}, {6, 0x0a}, {6, 0x09}, {6, 0x0d}, - {9, 0x0c}, {9, 0x0b}, {51, 0x0d}, {15, 0x0e}, {9, 0x0d}, {3, 0x0b}, - {6, 0x0c}, {3, 0x0d}, {9, 0x09}, {3, 0x0a}, {9, 0x07}, {15, 0x06}, - {9, 0x07}, {9, 0x0a}, {9, 0x09}, {21, 0x0d}, {3, 0x0c}, {6, 0x09}, - {6, 0x0a}, {6, 0x07}, {9, 0x06}, {3, 0x08}, {9, 0x03}, {3, 0x08}, - {9, 0x06}, {6, 0x07}, {6, 0x0a}, {9, 0x09}, {18, 0x0d}, {9, 0x09}, - {6, 0x0a}, {3, 0x07}, {6, 0x06}, {3, 0x03}, {6, 0x04}, {294, 0x00}, - {3, 0x04}, {6, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x0b}, {3, 0x0a}, - {6, 0x09}, {6, 0x0d}, {18, 0x0c}, {6, 0x0d}, {9, 0x09}, {6, 0x0a}, - {6, 0x07}, {21, 0x06}, {9, 0x07}, {6, 0x0a}, {6, 0x09}, {6, 0x0d}, - {18, 0x0c}, {6, 0x0d}, {6, 0x09}, {3, 0x0a}, {3, 0x0b}, {3, 0x07}, - {3, 0x06}, {3, 0x08}, {3, 0x03}, {3, 0x04}, {54, 0x00}, {6, 0x04}, - {3, 0x08}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {6, 0x09}, {3, 0x0d}, - {3, 0x0c}, {3, 0x0b}, {3, 0x0d}, {21, 0x0e}, {6, 0x0d}, {6, 0x0c}, - {3, 0x0d}, {3, 0x09}, {6, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x03}, - {3, 0x04}, {54, 0x00}, {6, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x07}, - {6, 0x0a}, {3, 0x09}, {6, 0x0d}, {6, 0x0c}, {12, 0x0d}, {3, 0x0b}, - {9, 0x0c}, {3, 0x0d}, {6, 0x09}, {6, 0x0a}, {9, 0x07}, {15, 0x06}, - {6, 0x07}, {3, 0x06}, {3, 0x0a}, {6, 0x09}, {3, 0x0d}, {6, 0x0c}, - {6, 0x0d}, {9, 0x0e}, {15, 0x0d}, {3, 0x10}, {18, 0x0d}, {21, 0x10}, - {6, 0x0f}, {15, 0x10}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0b}, - {6, 0x0c}, {3, 0x0d}, {6, 0x09}, {6, 0x0a}, {3, 0x06}, {15, 0x07}, - {3, 0x06}, {6, 0x0a}, {9, 0x09}, {3, 0x0d}, {9, 0x0c}, {12, 0x0b}, - {9, 0x0c}, {6, 0x0d}, {6, 0x09}, {6, 0x0a}, {9, 0x07}, {15, 0x06}, - {9, 0x07}, {6, 0x0a}, {6, 0x09}, {6, 0x0d}, {6, 0x0c}, {12, 0x0b}, - {9, 0x0c}, {3, 0x0d}, {6, 0x09}, {3, 0x0a}, {3, 0x07}, {6, 0x06}, - {3, 0x03}, {3, 0x04}, {291, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x08}, - {3, 0x06}, {3, 0x07}, {6, 0x0a}, {3, 0x09}, {3, 0x0d}, {6, 0x0c}, - {3, 0x0b}, {21, 0x0d}, {9, 0x0c}, {3, 0x0d}, {6, 0x09}, {3, 0x0a}, - {3, 0x06}, {24, 0x07}, {3, 0x0a}, {9, 0x09}, {3, 0x0d}, {6, 0x0c}, - {3, 0x0b}, {18, 0x0d}, {3, 0x0b}, {6, 0x0c}, {3, 0x0d}, {6, 0x09}, - {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x08}, {3, 0x03}, {3, 0x04}, - {48, 0x00}, {6, 0x04}, {3, 0x08}, {3, 0x06}, {3, 0x0b}, {3, 0x0a}, - {3, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, {6, 0x0e}, {3, 0x10}, - {21, 0x0f}, {6, 0x10}, {6, 0x0e}, {3, 0x0b}, {3, 0x0c}, {3, 0x0d}, - {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x08}, {3, 0x04}, - {51, 0x00}, {3, 0x04}, {3, 0x08}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, - {6, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0b}, {3, 0x0d}, {24, 0x0e}, - {3, 0x0d}, {6, 0x0c}, {3, 0x0d}, {6, 0x09}, {6, 0x0a}, {3, 0x06}, - {15, 0x07}, {3, 0x06}, {3, 0x0a}, {6, 0x09}, {3, 0x0d}, {6, 0x0c}, - {3, 0x0d}, {6, 0x0e}, {6, 0x10}, {21, 0x0f}, {3, 0x12}, {18, 0x0f}, - {21, 0x12}, {6, 0x11}, {9, 0x12}, {12, 0x0f}, {3, 0x0d}, {6, 0x0e}, - {3, 0x0b}, {6, 0x0c}, {3, 0x0d}, {9, 0x09}, {15, 0x0a}, {9, 0x09}, - {6, 0x0d}, {3, 0x0c}, {3, 0x0b}, {3, 0x0d}, {24, 0x0e}, {3, 0x0d}, - {3, 0x0b}, {6, 0x0c}, {3, 0x0d}, {6, 0x09}, {6, 0x0a}, {3, 0x0b}, - {15, 0x07}, {3, 0x06}, {6, 0x0a}, {6, 0x09}, {3, 0x0d}, {6, 0x0c}, - {6, 0x0d}, {21, 0x0e}, {3, 0x0d}, {6, 0x0c}, {3, 0x0d}, {3, 0x09}, - {3, 0x0a}, {3, 0x0b}, {6, 0x06}, {3, 0x03}, {3, 0x04}, {285, 0x00}, - {6, 0x04}, {3, 0x08}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {6, 0x09}, - {3, 0x0d}, {3, 0x0c}, {3, 0x0b}, {6, 0x0e}, {18, 0x0d}, {6, 0x0e}, - {3, 0x0d}, {3, 0x0b}, {3, 0x0c}, {3, 0x0d}, {9, 0x09}, {6, 0x0a}, - {9, 0x06}, {9, 0x0a}, {6, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0b}, - {3, 0x0d}, {6, 0x0e}, {18, 0x0d}, {6, 0x0e}, {3, 0x0d}, {3, 0x0b}, - {3, 0x0c}, {3, 0x0d}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, - {3, 0x08}, {6, 0x04}, {42, 0x00}, {6, 0x04}, {3, 0x08}, {3, 0x06}, - {3, 0x0b}, {3, 0x0a}, {3, 0x09}, {3, 0x0d}, {3, 0x0b}, {3, 0x0e}, - {3, 0x0d}, {6, 0x0f}, {3, 0x12}, {6, 0x11}, {9, 0x10}, {9, 0x11}, - {3, 0x12}, {3, 0x0f}, {3, 0x10}, {3, 0x0e}, {3, 0x0d}, {3, 0x0f}, - {3, 0x0d}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x08}, - {3, 0x04}, {45, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x07}, - {3, 0x0a}, {3, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0b}, {3, 0x0d}, - {3, 0x0e}, {3, 0x0d}, {3, 0x10}, {15, 0x0f}, {6, 0x10}, {3, 0x0d}, - {3, 0x0e}, {3, 0x0d}, {3, 0x0b}, {3, 0x0c}, {3, 0x0d}, {9, 0x09}, - {15, 0x0a}, {9, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, {3, 0x0e}, - {3, 0x0d}, {3, 0x10}, {6, 0x0f}, {3, 0x12}, {6, 0x11}, {9, 0x10}, - {18, 0x12}, {6, 0x10}, {15, 0x12}, {15, 0x13}, {6, 0x12}, {6, 0x10}, - {6, 0x11}, {9, 0x0f}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0b}, - {3, 0x0c}, {6, 0x0d}, {24, 0x09}, {6, 0x0c}, {3, 0x0b}, {3, 0x0d}, - {3, 0x0e}, {6, 0x0d}, {18, 0x0f}, {6, 0x10}, {6, 0x0e}, {3, 0x0d}, - {6, 0x0c}, {3, 0x0d}, {6, 0x09}, {18, 0x0a}, {9, 0x09}, {3, 0x0d}, - {3, 0x0c}, {3, 0x0b}, {3, 0x0d}, {6, 0x0e}, {3, 0x0d}, {3, 0x10}, - {12, 0x0f}, {6, 0x10}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0c}, - {3, 0x0d}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x08}, - {3, 0x03}, {3, 0x04}, {282, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x06}, - {3, 0x07}, {3, 0x0a}, {6, 0x09}, {3, 0x0c}, {3, 0x0b}, {6, 0x0e}, - {3, 0x10}, {24, 0x0f}, {3, 0x10}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, - {3, 0x0b}, {3, 0x0c}, {3, 0x0d}, {27, 0x09}, {3, 0x0d}, {6, 0x0c}, - {3, 0x0d}, {6, 0x0e}, {3, 0x10}, {24, 0x0f}, {3, 0x10}, {3, 0x0d}, - {3, 0x0e}, {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, {3, 0x09}, {3, 0x0a}, - {3, 0x07}, {3, 0x06}, {3, 0x08}, {3, 0x04}, {42, 0x00}, {3, 0x04}, - {3, 0x08}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, - {3, 0x0d}, {3, 0x0e}, {3, 0x10}, {3, 0x0f}, {3, 0x11}, {3, 0x10}, - {3, 0x12}, {3, 0x13}, {6, 0x12}, {3, 0x14}, {3, 0x85}, {6, 0x12}, - {3, 0x13}, {3, 0x12}, {3, 0x10}, {3, 0x11}, {3, 0x0f}, {3, 0x10}, - {3, 0x0e}, {3, 0x0d}, {3, 0x0c}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, - {3, 0x06}, {3, 0x08}, {3, 0x04}, {39, 0x00}, {3, 0x04}, {3, 0x03}, - {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x09}, {3, 0x0d}, {3, 0x0c}, - {3, 0x0d}, {3, 0x0e}, {3, 0x10}, {6, 0x0f}, {3, 0x12}, {15, 0x11}, - {3, 0x12}, {6, 0x0f}, {3, 0x10}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, - {6, 0x0c}, {3, 0x0d}, {21, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0b}, - {6, 0x0e}, {3, 0x10}, {3, 0x0f}, {3, 0x12}, {3, 0x11}, {3, 0x10}, - {6, 0x13}, {9, 0x12}, {60, 0x13}, {3, 0x14}, {6, 0x12}, {3, 0x13}, - {3, 0x12}, {3, 0x10}, {3, 0x11}, {6, 0x0f}, {6, 0x0d}, {3, 0x0e}, - {3, 0x0b}, {6, 0x0c}, {3, 0x0d}, {12, 0x09}, {3, 0x0d}, {6, 0x0c}, - {3, 0x0b}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x10}, {6, 0x0f}, - {3, 0x12}, {12, 0x11}, {3, 0x12}, {9, 0x0f}, {3, 0x10}, {3, 0x0d}, - {3, 0x0e}, {3, 0x0d}, {6, 0x0c}, {3, 0x0d}, {21, 0x09}, {3, 0x0d}, - {6, 0x0c}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x10}, {6, 0x0f}, - {6, 0x12}, {9, 0x11}, {3, 0x12}, {6, 0x0f}, {3, 0x10}, {6, 0x0e}, - {3, 0x0c}, {3, 0x0d}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, - {3, 0x08}, {3, 0x04}, {279, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x08}, - {3, 0x06}, {3, 0x0b}, {3, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, - {3, 0x0e}, {3, 0x0d}, {6, 0x0f}, {3, 0x12}, {18, 0x11}, {3, 0x12}, - {9, 0x0f}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0b}, {3, 0x0c}, - {6, 0x0d}, {12, 0x09}, {3, 0x0d}, {6, 0x0c}, {3, 0x0b}, {6, 0x0e}, - {3, 0x0d}, {6, 0x0f}, {3, 0x12}, {18, 0x11}, {3, 0x12}, {6, 0x0f}, - {3, 0x10}, {3, 0x0e}, {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, {3, 0x09}, - {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x03}, {3, 0x04}, {36, 0x00}, - {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x0b}, {3, 0x0a}, {3, 0x0d}, - {3, 0x0c}, {3, 0x0d}, {3, 0x10}, {3, 0x0f}, {3, 0x12}, {3, 0x10}, - {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x14}, {3, 0x16}, {3, 0x15}, - {3, 0x4e}, {3, 0xf7}, {3, 0x57}, {3, 0x14}, {6, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x11}, {3, 0x12}, {3, 0x0f}, {3, 0x0e}, {3, 0x0d}, - {3, 0x0c}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x03}, - {3, 0x04}, {33, 0x00}, {6, 0x04}, {3, 0x08}, {3, 0x06}, {3, 0x0b}, - {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, {3, 0x0e}, {3, 0x10}, - {3, 0x0f}, {3, 0x12}, {3, 0x11}, {3, 0x10}, {3, 0x12}, {9, 0x13}, - {3, 0x12}, {6, 0x10}, {3, 0x11}, {6, 0x0f}, {3, 0x10}, {6, 0x0e}, - {3, 0x0b}, {6, 0x0c}, {15, 0x0d}, {6, 0x0c}, {3, 0x0d}, {3, 0x0e}, - {3, 0x10}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, - {6, 0x13}, {3, 0x14}, {3, 0x16}, {63, 0x15}, {3, 0x16}, {3, 0x14}, - {6, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {3, 0x11}, {3, 0x12}, - {6, 0x0f}, {3, 0x0d}, {3, 0x0e}, {3, 0x0b}, {21, 0x0c}, {6, 0x0b}, - {3, 0x0e}, {3, 0x0d}, {3, 0x10}, {6, 0x0f}, {6, 0x11}, {6, 0x10}, - {3, 0x13}, {6, 0x12}, {6, 0x10}, {6, 0x11}, {6, 0x0f}, {3, 0x10}, - {3, 0x0e}, {3, 0x0d}, {3, 0x0b}, {3, 0x0c}, {6, 0x0d}, {9, 0x09}, - {3, 0x0d}, {6, 0x0c}, {3, 0x0b}, {6, 0x0e}, {3, 0x10}, {6, 0x0f}, - {6, 0x11}, {6, 0x10}, {6, 0x12}, {6, 0x10}, {6, 0x11}, {6, 0x0f}, - {3, 0x10}, {3, 0x0e}, {3, 0x0b}, {3, 0x0d}, {3, 0x09}, {3, 0x0a}, - {3, 0x07}, {3, 0x06}, {3, 0x03}, {3, 0x04}, {276, 0x00}, {3, 0x04}, - {3, 0x03}, {3, 0x06}, {3, 0x0b}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, - {3, 0x0d}, {3, 0x0e}, {3, 0x10}, {3, 0x0f}, {3, 0x12}, {3, 0x11}, - {3, 0x10}, {3, 0x12}, {15, 0x13}, {3, 0x10}, {6, 0x11}, {6, 0x0f}, - {3, 0x10}, {3, 0x0d}, {3, 0x0e}, {3, 0x0b}, {12, 0x0c}, {3, 0x0d}, - {6, 0x0c}, {3, 0x0b}, {3, 0x0d}, {3, 0x0e}, {3, 0x10}, {6, 0x0f}, - {3, 0x12}, {3, 0x11}, {3, 0x10}, {3, 0x12}, {15, 0x13}, {3, 0x10}, - {6, 0x11}, {6, 0x0f}, {3, 0x0e}, {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, - {3, 0x09}, {3, 0x0b}, {3, 0x06}, {3, 0x08}, {3, 0x04}, {33, 0x00}, - {6, 0x04}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, - {3, 0x0d}, {3, 0x10}, {3, 0x0f}, {3, 0x11}, {6, 0x12}, {3, 0x13}, - {3, 0x16}, {3, 0x15}, {3, 0x16}, {6, 0x17}, {3, 0xb8}, {3, 0xff}, - {3, 0xbc}, {3, 0x17}, {3, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x13}, - {6, 0x12}, {3, 0x11}, {3, 0x0f}, {3, 0x10}, {3, 0x0d}, {6, 0x0c}, - {3, 0x0a}, {3, 0x06}, {3, 0x08}, {6, 0x04}, {30, 0x00}, {3, 0x04}, - {3, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, - {3, 0x0d}, {3, 0x0e}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, - {6, 0x12}, {3, 0x14}, {3, 0x13}, {3, 0x14}, {6, 0x12}, {3, 0x13}, - {3, 0x12}, {3, 0x10}, {3, 0x11}, {6, 0x0f}, {3, 0x0d}, {3, 0x0e}, - {3, 0x0d}, {3, 0x0b}, {15, 0x0c}, {3, 0x0b}, {3, 0x0e}, {3, 0x0d}, - {3, 0x10}, {3, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {9, 0x17}, {51, 0x16}, - {9, 0x17}, {6, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x14}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {3, 0x10}, {9, 0x0f}, {3, 0x0d}, {3, 0x0e}, - {3, 0x0d}, {3, 0x0b}, {6, 0x0c}, {6, 0x0b}, {3, 0x0d}, {6, 0x0e}, - {3, 0x0d}, {6, 0x0f}, {3, 0x11}, {6, 0x10}, {3, 0x13}, {9, 0x12}, - {3, 0x14}, {9, 0x12}, {3, 0x13}, {3, 0x10}, {6, 0x11}, {6, 0x0f}, - {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0b}, {15, 0x0c}, {3, 0x0b}, - {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {6, 0x0f}, {6, 0x11}, {3, 0x10}, - {6, 0x13}, {15, 0x12}, {3, 0x13}, {3, 0x10}, {3, 0x11}, {3, 0x12}, - {3, 0x0f}, {3, 0x10}, {3, 0x0e}, {3, 0x0c}, {3, 0x0d}, {3, 0x09}, - {3, 0x0a}, {3, 0x06}, {3, 0x08}, {3, 0x04}, {273, 0x00}, {3, 0x04}, - {3, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x09}, {6, 0x0d}, - {3, 0x0e}, {3, 0x10}, {3, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, - {3, 0x12}, {21, 0xff}, {3, 0x13}, {6, 0x10}, {3, 0x12}, {6, 0x0f}, - {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {9, 0x0b}, {3, 0x0c}, {6, 0x0b}, - {3, 0x0e}, {6, 0x0d}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, - {3, 0x12}, {3, 0xfd}, {18, 0xff}, {3, 0x13}, {3, 0x10}, {3, 0x11}, - {6, 0x0f}, {3, 0x0e}, {3, 0x0d}, {3, 0x0c}, {3, 0x09}, {3, 0x0a}, - {3, 0x07}, {3, 0x06}, {3, 0x03}, {3, 0x04}, {30, 0x00}, {3, 0x04}, - {3, 0x08}, {3, 0x06}, {3, 0x0b}, {3, 0x09}, {3, 0x0c}, {3, 0x0d}, - {3, 0x10}, {3, 0x0f}, {3, 0x11}, {3, 0x13}, {9, 0x14}, {3, 0x17}, - {3, 0x16}, {6, 0x17}, {3, 0x32}, {3, 0xf3}, {3, 0xff}, {3, 0xf5}, - {3, 0x3b}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {3, 0x15}, {6, 0x14}, - {3, 0x13}, {3, 0x11}, {3, 0x0f}, {9, 0x0d}, {3, 0x09}, {3, 0x0b}, - {3, 0x06}, {3, 0x08}, {3, 0x04}, {30, 0x00}, {3, 0x04}, {3, 0x08}, - {3, 0x06}, {3, 0x0a}, {3, 0x09}, {6, 0x0d}, {3, 0x0e}, {6, 0x0f}, - {3, 0x11}, {6, 0x12}, {3, 0x11}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, - {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {3, 0x11}, {6, 0x0f}, - {3, 0x10}, {3, 0x0d}, {6, 0x0e}, {3, 0x0d}, {3, 0x0b}, {3, 0x0d}, - {6, 0x0e}, {3, 0x0d}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x12}, - {3, 0x13}, {3, 0x14}, {3, 0x15}, {3, 0xfc}, {15, 0xff}, {3, 0xfa}, - {36, 0x18}, {21, 0x17}, {6, 0x16}, {3, 0xa7}, {3, 0xfe}, {18, 0xff}, - {3, 0xf4}, {3, 0x70}, {3, 0x10}, {3, 0x0d}, {6, 0x0e}, {3, 0x0d}, - {6, 0x0b}, {6, 0x0e}, {3, 0x0d}, {3, 0x10}, {6, 0x0f}, {3, 0x11}, - {3, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {18, 0xff}, {3, 0xfe}, - {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {3, 0x11}, {6, 0x0f}, - {3, 0x0d}, {6, 0x0e}, {12, 0x0b}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, - {3, 0x10}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {3, 0x12}, {3, 0x13}, - {3, 0x10}, {3, 0x11}, {3, 0x0f}, {6, 0x0d}, {3, 0x0c}, {3, 0x0d}, - {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x03}, {3, 0x04}, {270, 0x00}, - {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x0b}, {3, 0x09}, {3, 0x0d}, - {3, 0x0c}, {3, 0x0e}, {3, 0x10}, {3, 0x0f}, {3, 0x11}, {3, 0x10}, - {3, 0x13}, {3, 0x12}, {3, 0x13}, {21, 0xff}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x10}, {3, 0x11}, {6, 0x0f}, {6, 0x0d}, {9, 0x0e}, - {3, 0x0d}, {6, 0x0e}, {3, 0x0d}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, - {3, 0x13}, {6, 0x12}, {3, 0x13}, {3, 0xfd}, {18, 0xff}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {3, 0x11}, {6, 0x0f}, {3, 0x0e}, {3, 0x0b}, - {3, 0x0d}, {3, 0x09}, {3, 0x0b}, {3, 0x06}, {3, 0x08}, {3, 0x04}, - {27, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x0b}, {3, 0x0a}, - {9, 0x0d}, {3, 0x0f}, {3, 0x11}, {6, 0x13}, {3, 0x15}, {6, 0x16}, - {3, 0x17}, {6, 0x18}, {3, 0x1a}, {3, 0xa4}, {9, 0xff}, {3, 0xaa}, - {6, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x14}, {3, 0x15}, {6, 0x13}, - {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {6, 0x0d}, {3, 0x0a}, {3, 0x07}, - {3, 0x06}, {3, 0x03}, {3, 0x04}, {24, 0x00}, {3, 0x04}, {3, 0x03}, - {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, - {3, 0x10}, {3, 0x0f}, {3, 0x11}, {3, 0x13}, {3, 0x12}, {3, 0x13}, - {3, 0x14}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x15}, {3, 0x14}, - {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x11}, {3, 0x12}, {6, 0x0f}, - {6, 0x0d}, {9, 0x0e}, {6, 0x0d}, {6, 0x0f}, {3, 0x11}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x14}, {3, 0x17}, {3, 0xfc}, - {15, 0xff}, {3, 0xfa}, {27, 0x19}, {12, 0x1a}, {18, 0x18}, {3, 0x17}, - {3, 0xa4}, {3, 0xfe}, {18, 0xff}, {3, 0xf4}, {3, 0x70}, {6, 0x0f}, - {6, 0x0d}, {12, 0x0e}, {6, 0x0d}, {6, 0x0f}, {6, 0x11}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {3, 0x14}, {3, 0x13}, {18, 0xff}, {3, 0xfe}, - {3, 0x16}, {3, 0x14}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x11}, - {3, 0x12}, {3, 0x0f}, {3, 0x10}, {3, 0x0d}, {15, 0x0e}, {3, 0x0d}, - {6, 0x0f}, {3, 0x12}, {3, 0x10}, {3, 0x13}, {3, 0x12}, {6, 0x13}, - {3, 0x14}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {6, 0x14}, {3, 0x13}, - {3, 0x10}, {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {6, 0x0d}, {3, 0x09}, - {3, 0x0a}, {3, 0x06}, {3, 0x08}, {3, 0x04}, {270, 0x00}, {3, 0x04}, - {3, 0x08}, {3, 0x07}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, {3, 0x0d}, - {3, 0x10}, {3, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x12}, {3, 0x13}, - {3, 0x14}, {3, 0x15}, {21, 0xff}, {3, 0x14}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x10}, {3, 0x11}, {9, 0x0f}, {18, 0x0d}, {6, 0x0f}, - {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x14}, - {3, 0x15}, {3, 0xfd}, {18, 0xff}, {3, 0x14}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x10}, {3, 0x0e}, {3, 0x0c}, - {3, 0x0d}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x03}, {3, 0x04}, - {21, 0x00}, {6, 0x04}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x0d}, - {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, {6, 0x13}, {3, 0x15}, - {6, 0x17}, {6, 0x18}, {9, 0x1a}, {3, 0xe9}, {9, 0xff}, {3, 0xec}, - {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x19}, {6, 0x17}, {3, 0x15}, - {6, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {6, 0x0c}, {3, 0x0a}, - {3, 0x07}, {3, 0x08}, {3, 0x03}, {3, 0x04}, {18, 0x00}, {6, 0x04}, - {3, 0x08}, {3, 0x06}, {3, 0x0a}, {3, 0x09}, {6, 0x0d}, {3, 0x10}, - {3, 0x0f}, {3, 0x11}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x15}, - {3, 0x14}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x14}, {3, 0x15}, - {3, 0x14}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {3, 0x11}, - {9, 0x0f}, {6, 0x0d}, {3, 0x10}, {9, 0x0f}, {3, 0x11}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x17}, {3, 0x16}, {3, 0x17}, - {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {6, 0x1a}, {12, 0x1b}, {24, 0x1a}, - {3, 0x18}, {6, 0x19}, {6, 0x1a}, {3, 0xa0}, {3, 0xfd}, {18, 0xff}, - {3, 0xf4}, {3, 0x73}, {3, 0x10}, {3, 0x11}, {6, 0x0f}, {3, 0x10}, - {3, 0x0d}, {3, 0x0e}, {9, 0x0d}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, - {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x14}, {3, 0x15}, {3, 0x14}, - {18, 0xff}, {3, 0xfe}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {6, 0x11}, {6, 0x0f}, {12, 0x0d}, {3, 0x10}, - {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x13}, - {3, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, - {3, 0x15}, {3, 0x14}, {6, 0x13}, {3, 0x10}, {3, 0x12}, {3, 0x0f}, - {3, 0x0e}, {3, 0x0c}, {3, 0x0d}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, - {6, 0x04}, {264, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x07}, - {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x12}, - {3, 0x10}, {3, 0x12}, {3, 0x13}, {3, 0x14}, {3, 0x15}, {3, 0x14}, - {21, 0xff}, {3, 0x14}, {3, 0x13}, {3, 0x14}, {6, 0x13}, {3, 0x10}, - {3, 0x11}, {15, 0x0f}, {3, 0x10}, {9, 0x0f}, {3, 0x11}, {3, 0x10}, - {3, 0x13}, {3, 0x12}, {3, 0x14}, {3, 0x13}, {6, 0x14}, {3, 0xfd}, - {18, 0xff}, {3, 0x14}, {3, 0x15}, {3, 0x13}, {6, 0x12}, {3, 0x11}, - {3, 0x0f}, {3, 0x0e}, {3, 0x0b}, {3, 0x0d}, {3, 0x09}, {3, 0x0b}, - {3, 0x06}, {3, 0x08}, {6, 0x04}, {15, 0x00}, {6, 0x04}, {3, 0x08}, - {3, 0x06}, {3, 0x0b}, {3, 0x09}, {3, 0x0c}, {3, 0x0d}, {3, 0x0f}, - {3, 0x11}, {6, 0x13}, {3, 0x15}, {6, 0x17}, {3, 0x18}, {9, 0x1a}, - {3, 0x1b}, {3, 0x8d}, {15, 0xff}, {3, 0x95}, {9, 0x1a}, {3, 0x18}, - {6, 0x17}, {3, 0x15}, {3, 0x13}, {6, 0x12}, {3, 0x10}, {3, 0x0d}, - {3, 0x0c}, {3, 0x09}, {3, 0x0a}, {3, 0x06}, {3, 0x08}, {6, 0x04}, - {15, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, - {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {9, 0x12}, {3, 0x14}, - {3, 0x15}, {3, 0x14}, {3, 0x16}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, - {3, 0x16}, {3, 0x17}, {3, 0x14}, {3, 0x15}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x10}, {3, 0x11}, {21, 0x0f}, {3, 0x11}, {3, 0x13}, - {3, 0x12}, {3, 0x14}, {3, 0x15}, {3, 0x17}, {3, 0x15}, {3, 0x17}, - {3, 0x18}, {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {24, 0x1c}, {9, 0x1d}, - {15, 0x1b}, {6, 0x1a}, {3, 0x9c}, {3, 0xfd}, {18, 0xff}, {3, 0xf5}, - {3, 0x73}, {3, 0x12}, {3, 0x10}, {3, 0x11}, {9, 0x0f}, {9, 0x0d}, - {3, 0x0c}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, - {6, 0x13}, {3, 0x14}, {3, 0x17}, {3, 0x16}, {18, 0xff}, {3, 0xfe}, - {3, 0x16}, {3, 0x17}, {3, 0x14}, {6, 0x13}, {3, 0x12}, {3, 0x13}, - {3, 0x10}, {3, 0x11}, {21, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x14}, {3, 0x17}, {3, 0x16}, - {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {3, 0x17}, {6, 0x14}, {6, 0x13}, - {3, 0x11}, {3, 0x0f}, {9, 0x0d}, {3, 0x09}, {3, 0x0b}, {3, 0x06}, - {3, 0x03}, {3, 0x04}, {264, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x06}, - {3, 0x0a}, {3, 0x09}, {3, 0x0c}, {3, 0x0d}, {3, 0x10}, {3, 0x0f}, - {3, 0x11}, {6, 0x13}, {6, 0x14}, {3, 0x17}, {3, 0x16}, {21, 0xff}, - {3, 0x17}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0x13}, {3, 0x12}, - {3, 0x10}, {6, 0x11}, {18, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, - {6, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0x17}, {3, 0x16}, {3, 0xfd}, - {18, 0xff}, {3, 0x17}, {3, 0x14}, {3, 0x15}, {3, 0x13}, {3, 0x12}, - {3, 0x10}, {3, 0x12}, {3, 0x10}, {3, 0x0e}, {3, 0x0c}, {3, 0x09}, - {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x03}, {3, 0x04}, {15, 0x00}, - {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {6, 0x0d}, - {3, 0x10}, {6, 0x12}, {3, 0x14}, {3, 0x15}, {6, 0x17}, {3, 0x18}, - {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1d}, {3, 0x1c}, {3, 0xdc}, - {15, 0xff}, {3, 0xe0}, {3, 0x1d}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, - {3, 0x18}, {6, 0x17}, {3, 0x15}, {3, 0x14}, {3, 0x10}, {3, 0x12}, - {9, 0x0d}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x03}, {6, 0x04}, - {9, 0x00}, {6, 0x04}, {3, 0x08}, {3, 0x06}, {3, 0x0b}, {3, 0x09}, - {6, 0x0d}, {3, 0x10}, {3, 0x0f}, {3, 0x10}, {6, 0x13}, {3, 0x15}, - {6, 0x16}, {3, 0x17}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x17}, - {3, 0x16}, {3, 0x17}, {3, 0x14}, {3, 0x15}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x10}, {3, 0x11}, {3, 0x0e}, {9, 0x0f}, {3, 0x11}, - {3, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x17}, - {3, 0x15}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0xfc}, {15, 0xff}, - {3, 0xfa}, {3, 0x1c}, {15, 0x1e}, {6, 0x1c}, {12, 0x1d}, {3, 0x1b}, - {3, 0x1c}, {6, 0x1d}, {3, 0x1b}, {3, 0x98}, {3, 0xfc}, {18, 0xff}, - {3, 0xf5}, {3, 0x73}, {3, 0x14}, {3, 0x12}, {3, 0x13}, {3, 0x10}, - {3, 0x0e}, {9, 0x0f}, {3, 0x10}, {9, 0x0f}, {3, 0x12}, {6, 0x10}, - {3, 0x12}, {6, 0x13}, {3, 0x14}, {3, 0x17}, {3, 0x15}, {3, 0x17}, - {18, 0xff}, {3, 0xfe}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {3, 0x14}, - {3, 0x15}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {3, 0x11}, - {15, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x13}, - {3, 0x15}, {3, 0x14}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {3, 0x16}, {3, 0x17}, {6, 0x14}, {6, 0x12}, - {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {6, 0x0c}, {3, 0x0a}, {3, 0x07}, - {3, 0x08}, {3, 0x04}, {264, 0x00}, {3, 0x04}, {3, 0x08}, {3, 0x07}, - {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, - {6, 0x12}, {6, 0x14}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {21, 0xff}, - {3, 0x15}, {3, 0x17}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0x11}, - {3, 0x13}, {6, 0x10}, {3, 0x11}, {9, 0x0f}, {6, 0x11}, {3, 0x10}, - {3, 0x13}, {3, 0x12}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0x17}, - {3, 0x15}, {3, 0x17}, {3, 0xfd}, {18, 0xff}, {3, 0x17}, {3, 0x16}, - {3, 0x14}, {3, 0x16}, {6, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x0d}, - {3, 0x0b}, {3, 0x0d}, {3, 0x09}, {3, 0x0b}, {3, 0x06}, {3, 0x03}, - {6, 0x04}, {6, 0x00}, {6, 0x04}, {3, 0x03}, {3, 0x08}, {3, 0x06}, - {3, 0x0a}, {3, 0x09}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x10}, - {3, 0x12}, {3, 0x16}, {6, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, - {3, 0x1b}, {3, 0x1c}, {3, 0x1d}, {3, 0x73}, {21, 0xff}, {3, 0x7b}, - {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {6, 0x17}, - {3, 0x14}, {3, 0x12}, {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {3, 0x0c}, - {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x08}, {3, 0x03}, {15, 0x04}, - {3, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, - {3, 0x0e}, {3, 0x0f}, {3, 0x11}, {6, 0x13}, {6, 0x14}, {3, 0x16}, - {3, 0x17}, {3, 0x16}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x18}, - {3, 0x17}, {3, 0x15}, {3, 0x17}, {6, 0x14}, {3, 0x13}, {3, 0x12}, - {3, 0x13}, {3, 0x10}, {12, 0x11}, {6, 0x10}, {3, 0x12}, {6, 0x13}, - {3, 0x15}, {3, 0x16}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, - {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {24, 0x1e}, {6, 0x1f}, {6, 0x1d}, - {3, 0x1e}, {6, 0x1d}, {3, 0x1b}, {3, 0x94}, {3, 0xfc}, {18, 0xff}, - {3, 0xf5}, {3, 0x75}, {3, 0x15}, {3, 0x14}, {3, 0x12}, {3, 0x13}, - {3, 0x10}, {3, 0x11}, {21, 0x0f}, {3, 0x11}, {3, 0x10}, {6, 0x13}, - {6, 0x14}, {3, 0x17}, {3, 0x15}, {3, 0x17}, {3, 0x18}, {18, 0xff}, - {3, 0xfe}, {3, 0x18}, {3, 0x17}, {3, 0x15}, {3, 0x17}, {3, 0x14}, - {6, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {15, 0x11}, {3, 0x10}, - {3, 0x13}, {3, 0x12}, {6, 0x13}, {3, 0x14}, {3, 0x17}, {3, 0x15}, - {3, 0x17}, {3, 0x18}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {3, 0x17}, - {3, 0x16}, {3, 0x17}, {3, 0x15}, {6, 0x13}, {3, 0x10}, {3, 0x0f}, - {9, 0x0d}, {3, 0x0a}, {3, 0x07}, {3, 0x08}, {3, 0x04}, {264, 0x00}, - {3, 0x04}, {3, 0x06}, {3, 0x07}, {3, 0x09}, {9, 0x0d}, {3, 0x0f}, - {3, 0x10}, {6, 0x13}, {3, 0x15}, {3, 0x17}, {3, 0x16}, {3, 0x17}, - {3, 0x18}, {21, 0xff}, {3, 0x17}, {3, 0x15}, {3, 0x16}, {3, 0x14}, - {3, 0x15}, {3, 0x14}, {3, 0x12}, {3, 0x13}, {6, 0x10}, {9, 0x11}, - {6, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x14}, {3, 0x15}, {3, 0x14}, - {9, 0x17}, {3, 0x18}, {3, 0xfd}, {18, 0xff}, {9, 0x17}, {6, 0x14}, - {3, 0x12}, {3, 0x10}, {3, 0x12}, {3, 0x10}, {3, 0x0d}, {3, 0x0c}, - {3, 0x09}, {3, 0x0a}, {3, 0x06}, {3, 0x08}, {3, 0x03}, {15, 0x04}, - {3, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x09}, {6, 0x0d}, {3, 0x10}, - {3, 0x12}, {6, 0x13}, {3, 0x14}, {3, 0x17}, {3, 0x18}, {3, 0x19}, - {3, 0x1a}, {6, 0x1b}, {3, 0x1e}, {3, 0x1d}, {3, 0xcd}, {21, 0xff}, - {3, 0xd1}, {3, 0x1c}, {6, 0x1b}, {3, 0x1a}, {3, 0x19}, {6, 0x18}, - {3, 0x14}, {6, 0x13}, {3, 0x12}, {3, 0x10}, {6, 0x0d}, {3, 0x09}, - {3, 0x0b}, {3, 0x06}, {3, 0x08}, {3, 0x03}, {9, 0x04}, {3, 0x03}, - {3, 0x08}, {3, 0x06}, {3, 0x07}, {3, 0x09}, {9, 0x0d}, {3, 0x0f}, - {3, 0x11}, {3, 0x12}, {6, 0x14}, {3, 0x16}, {3, 0x17}, {6, 0x18}, - {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {6, 0x18}, {3, 0x17}, {3, 0x15}, - {3, 0x17}, {6, 0x14}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {12, 0x10}, - {3, 0x13}, {3, 0x12}, {3, 0x13}, {6, 0x14}, {3, 0x16}, {3, 0x17}, - {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0xfc}, {15, 0xff}, - {3, 0xfa}, {6, 0x20}, {9, 0x1f}, {6, 0x20}, {12, 0x1f}, {3, 0x1e}, - {3, 0x1f}, {6, 0x1d}, {3, 0x90}, {3, 0xfb}, {18, 0xff}, {3, 0xf5}, - {3, 0x75}, {3, 0x17}, {6, 0x14}, {3, 0x12}, {3, 0x13}, {3, 0x10}, - {3, 0x11}, {18, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x13}, {3, 0x12}, - {3, 0x14}, {3, 0x15}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {6, 0x18}, - {18, 0xff}, {3, 0xfe}, {6, 0x18}, {3, 0x17}, {3, 0x15}, {3, 0x17}, - {6, 0x14}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {15, 0x10}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {6, 0x14}, {3, 0x17}, {3, 0x15}, {3, 0x17}, - {6, 0x18}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {3, 0x18}, {3, 0x17}, - {3, 0x16}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {6, 0x12}, {3, 0x10}, - {3, 0x0d}, {3, 0x0c}, {3, 0x09}, {3, 0x0b}, {3, 0x06}, {3, 0x03}, - {261, 0x00}, {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x0b}, {3, 0x09}, - {3, 0x0c}, {3, 0x0d}, {3, 0x10}, {6, 0x12}, {9, 0x14}, {3, 0x16}, - {3, 0x17}, {6, 0x18}, {21, 0xff}, {3, 0x18}, {3, 0x17}, {3, 0x15}, - {3, 0x17}, {3, 0x14}, {6, 0x13}, {3, 0x12}, {3, 0x13}, {15, 0x10}, - {3, 0x13}, {3, 0x12}, {6, 0x13}, {3, 0x14}, {3, 0x17}, {3, 0x15}, - {3, 0x17}, {6, 0x18}, {3, 0xfd}, {18, 0xff}, {3, 0x18}, {3, 0x17}, - {3, 0x15}, {3, 0x17}, {3, 0x15}, {6, 0x13}, {3, 0x11}, {3, 0x0f}, - {3, 0x0e}, {3, 0x0c}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, - {3, 0x08}, {3, 0x03}, {9, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x07}, - {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x10}, - {3, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x17}, {6, 0x1a}, {3, 0x1b}, - {3, 0x1d}, {3, 0x1e}, {3, 0x1f}, {3, 0x57}, {3, 0xfb}, {21, 0xff}, - {3, 0xfc}, {3, 0x60}, {3, 0x1e}, {6, 0x1b}, {6, 0x1a}, {3, 0x19}, - {3, 0x17}, {3, 0x15}, {3, 0x14}, {3, 0x10}, {3, 0x0f}, {3, 0x0e}, - {3, 0x0c}, {3, 0x0d}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x08}, - {12, 0x03}, {3, 0x06}, {3, 0x07}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, - {3, 0x0d}, {3, 0x10}, {6, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x17}, - {3, 0x15}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0xfe}, {15, 0xff}, - {3, 0xfc}, {3, 0x19}, {6, 0x18}, {3, 0x17}, {3, 0x16}, {6, 0x15}, - {3, 0x14}, {3, 0x11}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {6, 0x13}, - {3, 0x12}, {3, 0x11}, {6, 0x14}, {6, 0x17}, {3, 0x18}, {3, 0x19}, - {3, 0x1a}, {6, 0x1b}, {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {3, 0x21}, - {6, 0x20}, {3, 0x22}, {6, 0x20}, {9, 0x21}, {3, 0x1f}, {3, 0x20}, - {6, 0x1f}, {3, 0x1e}, {3, 0x8c}, {3, 0xfa}, {18, 0xff}, {3, 0xf5}, - {3, 0x76}, {6, 0x17}, {6, 0x14}, {3, 0x12}, {3, 0x13}, {3, 0x10}, - {3, 0x11}, {18, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x12}, {3, 0x13}, - {3, 0x15}, {3, 0x14}, {3, 0x16}, {3, 0x17}, {6, 0x18}, {3, 0x19}, - {18, 0xff}, {3, 0xfe}, {3, 0x19}, {6, 0x18}, {3, 0x17}, {3, 0x16}, - {3, 0x17}, {3, 0x15}, {3, 0x14}, {3, 0x13}, {3, 0x12}, {3, 0x13}, - {9, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x13}, {3, 0x14}, {3, 0x15}, - {3, 0x17}, {3, 0x16}, {3, 0x17}, {6, 0x18}, {3, 0x19}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {6, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x14}, - {6, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {6, 0x0c}, {3, 0x0a}, - {3, 0x06}, {3, 0x03}, {3, 0x04}, {258, 0x00}, {3, 0x04}, {3, 0x03}, - {3, 0x06}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, - {3, 0x11}, {6, 0x13}, {3, 0x15}, {6, 0x17}, {3, 0x16}, {3, 0x18}, - {3, 0x1a}, {21, 0xff}, {6, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x17}, - {6, 0x14}, {3, 0x13}, {3, 0x12}, {15, 0x13}, {3, 0x12}, {3, 0x13}, - {6, 0x14}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {6, 0x18}, {3, 0x19}, - {3, 0xfd}, {18, 0xff}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x16}, - {6, 0x14}, {3, 0x12}, {3, 0x10}, {3, 0x0f}, {9, 0x0d}, {3, 0x09}, - {3, 0x07}, {3, 0x06}, {3, 0x08}, {12, 0x03}, {6, 0x06}, {3, 0x0b}, - {3, 0x09}, {3, 0x0c}, {3, 0x0d}, {3, 0x10}, {3, 0x11}, {3, 0x13}, - {3, 0x14}, {6, 0x17}, {3, 0x18}, {3, 0x1a}, {3, 0x1b}, {3, 0x1c}, - {3, 0x1e}, {6, 0x1f}, {3, 0xbc}, {27, 0xff}, {3, 0xc2}, {3, 0x1f}, - {3, 0x1e}, {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, - {3, 0x16}, {3, 0x14}, {3, 0x13}, {3, 0x11}, {3, 0x10}, {3, 0x0d}, - {3, 0x0c}, {3, 0x09}, {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x08}, - {6, 0x03}, {6, 0x06}, {3, 0x07}, {3, 0x0a}, {6, 0x0c}, {3, 0x0e}, - {3, 0x0f}, {3, 0x11}, {6, 0x13}, {3, 0x14}, {3, 0x16}, {3, 0x17}, - {3, 0x18}, {3, 0x1a}, {3, 0x18}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, - {3, 0x1a}, {3, 0x19}, {6, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x14}, - {3, 0x13}, {3, 0x14}, {6, 0x12}, {6, 0x13}, {3, 0x12}, {3, 0x11}, - {3, 0x14}, {9, 0x15}, {3, 0x16}, {6, 0x1a}, {3, 0x1b}, {6, 0x1c}, - {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {3, 0x23}, {15, 0x22}, {3, 0x21}, - {6, 0x22}, {3, 0x20}, {3, 0x21}, {3, 0x20}, {3, 0x1f}, {3, 0x87}, - {3, 0xfa}, {18, 0xff}, {3, 0xf6}, {3, 0x77}, {3, 0x18}, {6, 0x17}, - {6, 0x14}, {3, 0x12}, {3, 0x13}, {3, 0x10}, {3, 0x0e}, {15, 0x0f}, - {3, 0x0e}, {3, 0x10}, {3, 0x13}, {3, 0x12}, {3, 0x14}, {3, 0x15}, - {6, 0x17}, {3, 0x16}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {18, 0xff}, - {3, 0xfe}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x16}, {3, 0x17}, - {3, 0x16}, {3, 0x14}, {3, 0x15}, {3, 0x13}, {3, 0x14}, {3, 0x12}, - {9, 0x13}, {3, 0x12}, {3, 0x11}, {3, 0x14}, {3, 0x15}, {3, 0x14}, - {3, 0x16}, {3, 0x17}, {6, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {3, 0x19}, {6, 0x18}, {6, 0x17}, {3, 0x16}, - {3, 0x14}, {3, 0x10}, {3, 0x0f}, {9, 0x0d}, {3, 0x0a}, {3, 0x06}, - {3, 0x08}, {3, 0x04}, {258, 0x00}, {3, 0x04}, {3, 0x08}, {3, 0x06}, - {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, - {3, 0x12}, {6, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, {3, 0x1a}, - {3, 0x19}, {21, 0xff}, {3, 0x1a}, {3, 0x18}, {3, 0x16}, {3, 0x17}, - {3, 0x16}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0x11}, {6, 0x12}, - {3, 0x13}, {6, 0x12}, {3, 0x13}, {3, 0x14}, {3, 0x15}, {3, 0x14}, - {3, 0x16}, {3, 0x17}, {3, 0x16}, {3, 0x18}, {3, 0x19}, {3, 0x18}, - {3, 0xfd}, {18, 0xff}, {3, 0x19}, {6, 0x18}, {6, 0x17}, {3, 0x15}, - {3, 0x13}, {6, 0x12}, {3, 0x10}, {3, 0x0d}, {3, 0x0c}, {3, 0x09}, - {3, 0x0a}, {3, 0x07}, {3, 0x06}, {3, 0x08}, {6, 0x03}, {6, 0x06}, - {3, 0x07}, {3, 0x0a}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, - {3, 0x12}, {3, 0x14}, {3, 0x15}, {6, 0x18}, {3, 0x19}, {3, 0x1b}, - {3, 0x1c}, {3, 0x1d}, {6, 0x1f}, {3, 0x3b}, {3, 0xf5}, {27, 0xff}, - {3, 0xf7}, {3, 0x44}, {3, 0x1f}, {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, - {3, 0x19}, {3, 0x18}, {3, 0x16}, {3, 0x15}, {3, 0x13}, {3, 0x12}, - {3, 0x0f}, {3, 0x0d}, {3, 0x0b}, {3, 0x0d}, {3, 0x0a}, {3, 0x07}, - {15, 0x06}, {3, 0x07}, {3, 0x0b}, {3, 0x09}, {3, 0x0d}, {3, 0x0b}, - {3, 0x0d}, {3, 0x0f}, {3, 0x10}, {3, 0x12}, {6, 0x16}, {3, 0x15}, - {3, 0x18}, {3, 0x1a}, {3, 0x19}, {3, 0x1a}, {3, 0xfe}, {15, 0xff}, - {3, 0xfc}, {3, 0x1a}, {3, 0x18}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, - {3, 0x16}, {3, 0x17}, {6, 0x14}, {3, 0x13}, {3, 0x11}, {6, 0x12}, - {3, 0x11}, {6, 0x13}, {3, 0x14}, {3, 0x16}, {3, 0x17}, {6, 0x18}, - {3, 0x1b}, {3, 0x1c}, {6, 0x1d}, {3, 0xfc}, {15, 0xff}, {3, 0xfa}, - {3, 0x23}, {3, 0x22}, {6, 0x23}, {6, 0x22}, {6, 0x23}, {3, 0x22}, - {3, 0x23}, {3, 0x22}, {3, 0x20}, {3, 0x84}, {3, 0xf9}, {18, 0xff}, - {3, 0xf6}, {3, 0x77}, {3, 0x1a}, {3, 0x18}, {6, 0x17}, {3, 0x15}, - {3, 0x14}, {3, 0x12}, {3, 0x10}, {3, 0x11}, {18, 0x0f}, {3, 0x11}, - {3, 0x10}, {6, 0x13}, {6, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, - {9, 0x1a}, {18, 0xff}, {3, 0xfe}, {9, 0x1a}, {3, 0x18}, {3, 0x17}, - {3, 0x15}, {3, 0x17}, {6, 0x14}, {3, 0x13}, {12, 0x12}, {3, 0x13}, - {3, 0x14}, {3, 0x13}, {3, 0x14}, {9, 0x17}, {3, 0x18}, {9, 0x1a}, - {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {3, 0x18}, {3, 0x1a}, {3, 0x18}, - {6, 0x17}, {3, 0x15}, {6, 0x13}, {3, 0x12}, {3, 0x10}, {6, 0x0d}, - {3, 0x0a}, {3, 0x07}, {3, 0x08}, {3, 0x04}, {258, 0x00}, {3, 0x04}, - {3, 0x08}, {3, 0x07}, {3, 0x0a}, {6, 0x0d}, {3, 0x10}, {6, 0x12}, - {3, 0x14}, {3, 0x15}, {6, 0x17}, {6, 0x18}, {3, 0x19}, {3, 0x1a}, - {21, 0xff}, {3, 0x19}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x15}, - {3, 0x17}, {6, 0x14}, {3, 0x13}, {3, 0x11}, {9, 0x12}, {3, 0x11}, - {3, 0x13}, {6, 0x14}, {9, 0x17}, {3, 0x18}, {3, 0x1a}, {3, 0x18}, - {3, 0x1a}, {3, 0xfd}, {18, 0xff}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, - {3, 0x17}, {3, 0x16}, {3, 0x15}, {6, 0x13}, {3, 0x11}, {3, 0x0f}, - {3, 0x0e}, {3, 0x0c}, {3, 0x0d}, {3, 0x0a}, {3, 0x07}, {15, 0x06}, - {3, 0x07}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, {3, 0x0d}, {3, 0x10}, - {3, 0x11}, {3, 0x13}, {3, 0x14}, {6, 0x17}, {6, 0x1a}, {9, 0x1d}, - {3, 0x1f}, {3, 0x20}, {3, 0xa9}, {33, 0xff}, {3, 0xb0}, {3, 0x1f}, - {6, 0x1d}, {3, 0x1b}, {6, 0x1a}, {6, 0x17}, {3, 0x14}, {3, 0x13}, - {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {3, 0x0c}, {3, 0x09}, {3, 0x0a}, - {6, 0x07}, {6, 0x06}, {6, 0x07}, {3, 0x0a}, {3, 0x09}, {6, 0x0d}, - {3, 0x10}, {6, 0x12}, {3, 0x14}, {3, 0x15}, {6, 0x17}, {3, 0x18}, - {3, 0x19}, {6, 0x1a}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x1b}, - {3, 0x1a}, {3, 0x19}, {6, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x14}, - {3, 0x15}, {3, 0x14}, {12, 0x13}, {3, 0x14}, {3, 0x15}, {6, 0x17}, - {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {6, 0x1d}, {3, 0x1f}, - {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {3, 0x25}, {12, 0x24}, {3, 0x25}, - {3, 0x23}, {3, 0x24}, {3, 0x22}, {3, 0x23}, {3, 0x22}, {3, 0x80}, - {3, 0xf8}, {18, 0xff}, {3, 0xf6}, {3, 0x77}, {6, 0x1a}, {3, 0x18}, - {6, 0x17}, {3, 0x15}, {3, 0x13}, {3, 0x12}, {3, 0x10}, {3, 0x11}, - {18, 0x0f}, {3, 0x11}, {3, 0x10}, {6, 0x13}, {3, 0x15}, {3, 0x17}, - {3, 0x15}, {3, 0x16}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, - {18, 0xff}, {3, 0xfe}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {6, 0x18}, - {3, 0x17}, {3, 0x16}, {6, 0x14}, {3, 0x13}, {6, 0x12}, {3, 0x10}, - {6, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x17}, {3, 0x16}, {3, 0x17}, - {3, 0x18}, {3, 0x1a}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x17}, - {3, 0x16}, {6, 0x14}, {3, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x0e}, - {3, 0x0d}, {3, 0x09}, {3, 0x07}, {3, 0x06}, {3, 0x04}, {258, 0x00}, - {3, 0x04}, {3, 0x08}, {3, 0x07}, {3, 0x0a}, {6, 0x0d}, {3, 0x10}, - {3, 0x12}, {6, 0x13}, {3, 0x15}, {3, 0x16}, {3, 0x17}, {3, 0x18}, - {3, 0x19}, {6, 0x1a}, {21, 0xff}, {3, 0x1a}, {3, 0x19}, {6, 0x18}, - {3, 0x17}, {3, 0x16}, {3, 0x14}, {3, 0x15}, {3, 0x14}, {6, 0x13}, - {3, 0x11}, {6, 0x13}, {3, 0x14}, {6, 0x15}, {3, 0x16}, {3, 0x17}, - {6, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0xfd}, {18, 0xff}, - {3, 0x1a}, {6, 0x18}, {6, 0x16}, {6, 0x14}, {3, 0x12}, {3, 0x11}, - {3, 0x0f}, {3, 0x0e}, {3, 0x0c}, {3, 0x0d}, {3, 0x09}, {3, 0x0a}, - {3, 0x07}, {9, 0x06}, {3, 0x07}, {3, 0x0b}, {3, 0x09}, {3, 0x0d}, - {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x12}, {3, 0x14}, {3, 0x15}, - {6, 0x18}, {3, 0x19}, {3, 0x1b}, {3, 0x1c}, {6, 0x1e}, {3, 0x1f}, - {3, 0x21}, {3, 0xec}, {33, 0xff}, {3, 0xf0}, {3, 0x29}, {3, 0x1e}, - {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, {3, 0x19}, {6, 0x18}, {3, 0x15}, - {3, 0x13}, {6, 0x12}, {9, 0x0d}, {3, 0x09}, {3, 0x0a}, {15, 0x07}, - {3, 0x0a}, {3, 0x09}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, - {6, 0x13}, {3, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, {3, 0x19}, - {3, 0x1a}, {3, 0x1b}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x1b}, - {6, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x17}, - {3, 0x14}, {3, 0x13}, {12, 0x14}, {3, 0x15}, {3, 0x14}, {3, 0x16}, - {3, 0x17}, {6, 0x18}, {3, 0x1b}, {3, 0x1c}, {6, 0x1e}, {3, 0x20}, - {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {3, 0x25}, {3, 0x24}, {6, 0x26}, - {3, 0x24}, {6, 0x25}, {3, 0x24}, {3, 0x25}, {3, 0x24}, {3, 0x7c}, - {3, 0xf7}, {18, 0xff}, {3, 0xf6}, {3, 0x79}, {3, 0x1b}, {6, 0x1a}, - {3, 0x16}, {3, 0x17}, {3, 0x14}, {9, 0x13}, {3, 0x10}, {3, 0x11}, - {18, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x12}, {3, 0x13}, {3, 0x15}, - {6, 0x17}, {3, 0x18}, {6, 0x1a}, {6, 0x1b}, {18, 0xff}, {3, 0xfe}, - {6, 0x1b}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x17}, {3, 0x14}, - {3, 0x16}, {3, 0x13}, {3, 0x14}, {3, 0x13}, {9, 0x12}, {3, 0x13}, - {3, 0x12}, {3, 0x13}, {3, 0x16}, {3, 0x17}, {3, 0x16}, {3, 0x18}, - {3, 0x19}, {3, 0x1a}, {6, 0x1b}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, - {9, 0x1a}, {3, 0x18}, {6, 0x17}, {3, 0x16}, {3, 0x12}, {3, 0x11}, - {3, 0x0f}, {3, 0x0e}, {3, 0x0c}, {3, 0x09}, {3, 0x0b}, {3, 0x06}, - {3, 0x04}, {258, 0x00}, {3, 0x04}, {3, 0x08}, {3, 0x07}, {3, 0x09}, - {6, 0x0d}, {3, 0x0f}, {3, 0x11}, {3, 0x13}, {6, 0x14}, {3, 0x16}, - {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {21, 0xff}, - {3, 0x1a}, {3, 0x18}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x16}, - {3, 0x17}, {3, 0x14}, {3, 0x13}, {3, 0x14}, {9, 0x13}, {3, 0x14}, - {3, 0x15}, {3, 0x14}, {3, 0x17}, {3, 0x15}, {3, 0x17}, {3, 0x18}, - {3, 0x19}, {6, 0x1a}, {3, 0x1b}, {3, 0xfd}, {18, 0xff}, {3, 0x1b}, - {6, 0x1a}, {3, 0x18}, {6, 0x17}, {3, 0x15}, {3, 0x14}, {3, 0x10}, - {3, 0x0f}, {9, 0x0d}, {3, 0x09}, {3, 0x0a}, {15, 0x07}, {3, 0x0a}, - {3, 0x09}, {3, 0x0c}, {3, 0x0d}, {3, 0x0f}, {3, 0x11}, {3, 0x13}, - {3, 0x14}, {6, 0x17}, {6, 0x1a}, {6, 0x1d}, {6, 0x1f}, {3, 0x20}, - {3, 0x94}, {18, 0xff}, {3, 0xe0}, {18, 0xff}, {3, 0x9c}, {6, 0x1f}, - {6, 0x1d}, {6, 0x1a}, {6, 0x17}, {3, 0x16}, {3, 0x13}, {3, 0x11}, - {3, 0x0f}, {3, 0x0e}, {3, 0x0c}, {3, 0x0d}, {3, 0x09}, {3, 0x0a}, - {6, 0x07}, {3, 0x06}, {3, 0x0a}, {3, 0x09}, {3, 0x0d}, {3, 0x0c}, - {3, 0x0e}, {3, 0x0f}, {3, 0x11}, {3, 0x13}, {6, 0x14}, {3, 0x17}, - {3, 0x18}, {6, 0x1a}, {6, 0x1b}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, - {3, 0x1d}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x16}, - {3, 0x17}, {3, 0x16}, {3, 0x14}, {3, 0x15}, {3, 0x13}, {6, 0x14}, - {3, 0x13}, {3, 0x14}, {6, 0x17}, {3, 0x18}, {6, 0x1a}, {3, 0x1b}, - {3, 0x1d}, {6, 0x1f}, {3, 0x20}, {3, 0xfc}, {15, 0xff}, {3, 0xfa}, - {3, 0x25}, {12, 0x26}, {3, 0x25}, {3, 0x26}, {3, 0x24}, {3, 0x26}, - {3, 0x78}, {3, 0xf6}, {18, 0xff}, {3, 0xf6}, {3, 0x7a}, {3, 0x1c}, - {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x16}, {6, 0x14}, - {6, 0x12}, {3, 0x11}, {6, 0x0f}, {6, 0x10}, {9, 0x0f}, {3, 0x11}, - {3, 0x10}, {3, 0x12}, {6, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, - {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1d}, {18, 0xff}, {3, 0xfe}, - {3, 0x1d}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x19}, {3, 0x17}, - {3, 0x16}, {3, 0x15}, {3, 0x13}, {3, 0x14}, {3, 0x13}, {1, 0x2d}, - {1, 0x46}, {2, 0x50}, {1, 0x80}, {1, 0x91}, {3, 0x13}, {3, 0x12}, - {6, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x17}, {3, 0x1a}, {3, 0x18}, - {3, 0x1a}, {3, 0x1b}, {3, 0x1d}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, - {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {6, 0x17}, {3, 0x15}, - {3, 0x14}, {3, 0x10}, {3, 0x0f}, {3, 0x0e}, {6, 0x0c}, {3, 0x0b}, - {3, 0x06}, {3, 0x04}, {258, 0x00}, {3, 0x04}, {3, 0x06}, {3, 0x0b}, - {3, 0x09}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, {3, 0x13}, - {3, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, {9, 0x1a}, {3, 0x1b}, - {21, 0xff}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x16}, - {3, 0x17}, {3, 0x16}, {3, 0x14}, {3, 0x15}, {15, 0x14}, {3, 0x15}, - {3, 0x14}, {3, 0x16}, {3, 0x17}, {6, 0x18}, {3, 0x19}, {3, 0x1a}, - {6, 0x1b}, {3, 0xfd}, {15, 0xff}, {3, 0xfe}, {3, 0x1a}, {3, 0x19}, - {6, 0x18}, {6, 0x17}, {3, 0x15}, {3, 0x13}, {6, 0x12}, {3, 0x10}, - {3, 0x0d}, {3, 0x0c}, {3, 0x09}, {6, 0x0a}, {6, 0x07}, {3, 0x0b}, - {3, 0x0a}, {3, 0x09}, {6, 0x0d}, {3, 0x0e}, {3, 0x0f}, {3, 0x10}, - {3, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x18}, {3, 0x19}, {3, 0x1b}, - {3, 0x1c}, {6, 0x1e}, {3, 0x20}, {3, 0x21}, {3, 0xdf}, {15, 0xff}, - {3, 0xf6}, {3, 0x4e}, {3, 0xf2}, {15, 0xff}, {3, 0xe4}, {6, 0x1f}, - {6, 0x1d}, {3, 0x1b}, {3, 0x19}, {3, 0x18}, {3, 0x16}, {3, 0x15}, - {3, 0x13}, {3, 0x12}, {3, 0x0f}, {3, 0x10}, {3, 0x0d}, {3, 0x0c}, - {6, 0x09}, {12, 0x0a}, {3, 0x09}, {3, 0x0d}, {3, 0x0b}, {3, 0x0e}, - {3, 0x0f}, {3, 0x10}, {3, 0x12}, {3, 0x14}, {6, 0x17}, {3, 0x18}, - {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1c}, {3, 0xfe}, {15, 0xff}, - {3, 0xfc}, {3, 0x1c}, {3, 0x1b}, {9, 0x1a}, {3, 0x18}, {3, 0x17}, - {3, 0x16}, {3, 0x15}, {3, 0x14}, {3, 0x15}, {3, 0x13}, {6, 0x15}, - {3, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, - {3, 0x1c}, {6, 0x1e}, {3, 0x1f}, {3, 0x20}, {3, 0xfc}, {15, 0xff}, - {3, 0xfa}, {6, 0x27}, {3, 0x26}, {9, 0x27}, {6, 0x26}, {3, 0x74}, - {3, 0xf5}, {18, 0xff}, {3, 0xf6}, {3, 0x7a}, {6, 0x1c}, {3, 0x1b}, - {6, 0x18}, {6, 0x17}, {3, 0x15}, {6, 0x13}, {3, 0x10}, {3, 0x0e}, - {6, 0x0f}, {9, 0x0d}, {6, 0x0f}, {3, 0x11}, {3, 0x10}, {3, 0x12}, - {6, 0x14}, {3, 0x16}, {3, 0x17}, {6, 0x18}, {3, 0x1a}, {3, 0x1b}, - {3, 0x1c}, {18, 0xff}, {3, 0xfe}, {3, 0x1c}, {6, 0x1b}, {3, 0x1a}, - {3, 0x19}, {3, 0x17}, {3, 0x16}, {3, 0x15}, {3, 0x16}, {3, 0x13}, - {1, 0x39}, {1, 0x5d}, {1, 0x6b}, {1, 0x82}, {1, 0xd6}, {1, 0xf7}, - {1, 0x69}, {1, 0xac}, {1, 0xc5}, {3, 0x13}, {3, 0x14}, {3, 0x13}, - {3, 0x16}, {3, 0x15}, {3, 0x16}, {3, 0x17}, {3, 0x18}, {6, 0x1a}, - {3, 0x1b}, {3, 0x1c}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {3, 0x1b}, - {6, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x15}, {3, 0x13}, - {6, 0x12}, {3, 0x10}, {3, 0x0f}, {3, 0x0c}, {3, 0x0a}, {3, 0x06}, - {3, 0x03}, {3, 0x04}, {255, 0x00}, {3, 0x03}, {3, 0x06}, {3, 0x0b}, - {3, 0x09}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, {3, 0x12}, - {3, 0x16}, {6, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {6, 0x1b}, - {21, 0xff}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x1a}, {3, 0x18}, - {3, 0x17}, {3, 0x16}, {3, 0x15}, {3, 0x14}, {3, 0x13}, {9, 0x14}, - {3, 0x15}, {3, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x17}, {3, 0x18}, - {12, 0x1a}, {3, 0x1b}, {3, 0xfb}, {3, 0xfc}, {6, 0xfb}, {3, 0xfa}, - {6, 0xf9}, {3, 0x1a}, {9, 0x19}, {3, 0x16}, {3, 0x15}, {3, 0x13}, - {6, 0x12}, {3, 0x10}, {3, 0x0f}, {3, 0x0e}, {3, 0x0c}, {3, 0x0d}, - {3, 0x09}, {12, 0x0a}, {3, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, - {3, 0x10}, {3, 0x11}, {3, 0x13}, {3, 0x14}, {3, 0x16}, {3, 0x17}, - {6, 0x1a}, {6, 0x1d}, {6, 0x1f}, {3, 0x20}, {3, 0x7b}, {18, 0xff}, - {3, 0xc0}, {3, 0x25}, {3, 0xb7}, {18, 0xff}, {3, 0x85}, {6, 0x1f}, - {6, 0x1d}, {6, 0x1a}, {6, 0x17}, {3, 0x14}, {3, 0x13}, {3, 0x11}, - {3, 0x0f}, {3, 0x0e}, {3, 0x0c}, {3, 0x0d}, {6, 0x09}, {3, 0x0a}, - {9, 0x09}, {3, 0x0c}, {6, 0x0d}, {3, 0x0f}, {3, 0x10}, {3, 0x14}, - {3, 0x15}, {6, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, - {3, 0x1c}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x1c}, {3, 0x1d}, - {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x17}, {3, 0x15}, - {3, 0x17}, {6, 0x14}, {6, 0x15}, {3, 0x14}, {3, 0x17}, {3, 0x16}, - {3, 0x17}, {3, 0x18}, {3, 0x1a}, {3, 0x1b}, {6, 0x1d}, {3, 0x1f}, - {3, 0x20}, {3, 0x22}, {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {3, 0x28}, - {12, 0x27}, {3, 0x28}, {3, 0x26}, {3, 0x70}, {3, 0xf3}, {18, 0xff}, - {3, 0xf6}, {3, 0x7a}, {3, 0x1f}, {6, 0x1c}, {3, 0x1b}, {3, 0x19}, - {3, 0x18}, {6, 0x17}, {3, 0x16}, {3, 0x12}, {3, 0x13}, {3, 0x11}, - {6, 0x0f}, {3, 0x0d}, {3, 0x0e}, {6, 0x0d}, {6, 0x0f}, {3, 0x11}, - {6, 0x12}, {6, 0x14}, {3, 0x17}, {3, 0x18}, {6, 0x1a}, {3, 0x1b}, - {3, 0x1d}, {3, 0x1b}, {18, 0xff}, {3, 0xfe}, {3, 0x1b}, {3, 0x1d}, - {3, 0x1b}, {3, 0x19}, {3, 0x18}, {3, 0x17}, {3, 0x15}, {6, 0x16}, - {3, 0x13}, {1, 0x26}, {1, 0x3b}, {1, 0x44}, {1, 0x81}, {1, 0xd8}, - {1, 0xfb}, {1, 0x71}, {1, 0xb9}, {1, 0xd6}, {3, 0x14}, {3, 0x13}, - {3, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x15}, {3, 0x17}, {3, 0x18}, - {3, 0x1a}, {3, 0x1b}, {3, 0x1d}, {3, 0x1b}, {3, 0xfa}, {15, 0xff}, - {3, 0xfb}, {3, 0x1d}, {3, 0x1b}, {6, 0x1a}, {3, 0x18}, {3, 0x16}, - {3, 0x14}, {6, 0x13}, {3, 0x12}, {3, 0x10}, {6, 0x0d}, {3, 0x0a}, - {3, 0x06}, {3, 0x03}, {3, 0x04}, {255, 0x00}, {3, 0x03}, {3, 0x06}, - {3, 0x0b}, {3, 0x09}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x10}, - {3, 0x14}, {3, 0x15}, {6, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, - {3, 0x1b}, {3, 0x1d}, {21, 0xff}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, - {3, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x15}, {3, 0x17}, {3, 0x14}, - {6, 0x15}, {6, 0x13}, {3, 0x15}, {3, 0x14}, {9, 0x17}, {3, 0x18}, - {6, 0x19}, {3, 0x1a}, {3, 0x1c}, {3, 0x1b}, {6, 0xf6}, {3, 0xf4}, - {3, 0xf2}, {3, 0xf1}, {3, 0xf0}, {3, 0xef}, {3, 0x1b}, {3, 0x19}, - {6, 0x18}, {3, 0x16}, {3, 0x14}, {3, 0x13}, {6, 0x12}, {3, 0x10}, - {3, 0x0e}, {3, 0x0d}, {3, 0x0a}, {3, 0x0d}, {6, 0x09}, {6, 0x0a}, - {6, 0x09}, {3, 0x0c}, {6, 0x0d}, {3, 0x0f}, {3, 0x10}, {3, 0x14}, - {3, 0x15}, {3, 0x16}, {3, 0x18}, {3, 0x19}, {3, 0x1b}, {3, 0x1c}, - {6, 0x1e}, {3, 0x20}, {3, 0x21}, {3, 0xd0}, {15, 0xff}, {3, 0xfc}, - {3, 0x61}, {3, 0x24}, {3, 0x54}, {3, 0xfa}, {15, 0xff}, {3, 0xd6}, - {3, 0x20}, {6, 0x1e}, {3, 0x1c}, {3, 0x1b}, {3, 0x19}, {3, 0x18}, - {3, 0x16}, {3, 0x15}, {3, 0x13}, {3, 0x10}, {3, 0x0f}, {3, 0x10}, - {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, {12, 0x09}, {3, 0x0d}, {3, 0x0c}, - {3, 0x0d}, {3, 0x10}, {6, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x16}, - {3, 0x17}, {3, 0x18}, {3, 0x1a}, {3, 0x1b}, {3, 0x1d}, {3, 0x1b}, - {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, - {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x16}, {3, 0x17}, {3, 0x16}, - {3, 0x15}, {12, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, {6, 0x1a}, - {3, 0x1b}, {3, 0x1d}, {3, 0x1e}, {6, 0x20}, {3, 0x22}, {3, 0xfc}, - {15, 0xff}, {3, 0xfa}, {9, 0x28}, {3, 0x29}, {6, 0x28}, {3, 0x6c}, - {3, 0xf3}, {18, 0xff}, {3, 0xf6}, {3, 0x7c}, {6, 0x1f}, {3, 0x1c}, - {3, 0x1d}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x16}, {6, 0x14}, - {3, 0x12}, {3, 0x10}, {3, 0x12}, {3, 0x0f}, {3, 0x0d}, {12, 0x0e}, - {3, 0x0d}, {3, 0x0f}, {3, 0x11}, {6, 0x12}, {3, 0x14}, {3, 0x15}, - {3, 0x17}, {3, 0x18}, {6, 0x1a}, {3, 0x1b}, {3, 0x1c}, {3, 0x1d}, - {18, 0xff}, {3, 0xfe}, {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, {3, 0x19}, - {9, 0x17}, {3, 0x16}, {3, 0x15}, {3, 0x14}, {3, 0x13}, {1, 0x70}, - {1, 0xbc}, {1, 0xdc}, {1, 0x78}, {1, 0xc9}, {1, 0xec}, {3, 0x14}, - {3, 0x13}, {3, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x17}, {3, 0x19}, - {3, 0x17}, {3, 0x19}, {3, 0x1b}, {3, 0x1c}, {3, 0x1d}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, - {3, 0x18}, {3, 0x17}, {3, 0x16}, {6, 0x13}, {3, 0x12}, {3, 0x10}, - {6, 0x0d}, {3, 0x0a}, {3, 0x06}, {3, 0x03}, {3, 0x04}, {255, 0x00}, - {3, 0x03}, {3, 0x06}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, {3, 0x0e}, - {3, 0x0f}, {3, 0x12}, {3, 0x14}, {3, 0x15}, {3, 0x16}, {3, 0x17}, - {6, 0x18}, {3, 0x1a}, {3, 0x1b}, {3, 0x1c}, {21, 0xff}, {6, 0x1b}, - {3, 0x1a}, {3, 0x19}, {3, 0x18}, {9, 0x17}, {6, 0x14}, {9, 0x15}, - {3, 0x14}, {6, 0x15}, {3, 0x16}, {9, 0x17}, {3, 0x19}, {3, 0x1a}, - {3, 0x1b}, {3, 0x19}, {3, 0xed}, {3, 0xea}, {3, 0xe6}, {1, 0xe3}, - {1, 0xe4}, {1, 0xe3}, {1, 0xd8}, {1, 0xe2}, {1, 0xdb}, {1, 0xce}, - {1, 0xe0}, {1, 0xd4}, {1, 0xcf}, {1, 0xe0}, {1, 0xd5}, {1, 0x18}, - {1, 0x5f}, {1, 0x3d}, {1, 0x18}, {1, 0x5c}, {1, 0x3a}, {1, 0x17}, - {1, 0x54}, {1, 0x36}, {1, 0x16}, {1, 0x29}, {1, 0x1e}, {3, 0x15}, - {6, 0x14}, {3, 0x12}, {6, 0x10}, {3, 0x0e}, {9, 0x0c}, {3, 0x0d}, - {12, 0x09}, {3, 0x0d}, {3, 0x0c}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, - {3, 0x13}, {6, 0x14}, {3, 0x17}, {3, 0x18}, {3, 0x1a}, {3, 0x1b}, - {6, 0x1d}, {6, 0x1f}, {3, 0x5e}, {3, 0xfc}, {15, 0xff}, {3, 0xd3}, - {6, 0x26}, {3, 0x24}, {3, 0xcb}, {15, 0xff}, {3, 0xfd}, {3, 0x6a}, - {3, 0x1f}, {6, 0x1d}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, - {3, 0x16}, {3, 0x14}, {3, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x0e}, - {3, 0x0d}, {3, 0x0c}, {3, 0x0d}, {9, 0x09}, {3, 0x0c}, {3, 0x0b}, - {3, 0x0e}, {3, 0x10}, {3, 0x11}, {6, 0x13}, {3, 0x15}, {3, 0x16}, - {3, 0x19}, {6, 0x1a}, {3, 0x1b}, {3, 0x1c}, {3, 0x1d}, {3, 0xfe}, - {15, 0xff}, {3, 0xfc}, {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, - {9, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {9, 0x14}, {3, 0x15}, - {3, 0x16}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1c}, - {6, 0x1e}, {3, 0x1f}, {3, 0x22}, {3, 0x23}, {3, 0xfc}, {15, 0xff}, - {3, 0xfa}, {3, 0x28}, {9, 0x29}, {3, 0x28}, {3, 0x69}, {3, 0xf1}, - {18, 0xff}, {3, 0xf7}, {3, 0x7c}, {3, 0x21}, {6, 0x1f}, {6, 0x1d}, - {6, 0x1a}, {3, 0x17}, {3, 0x16}, {3, 0x15}, {6, 0x13}, {3, 0x11}, - {6, 0x0f}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {6, 0x0e}, {3, 0x0d}, - {3, 0x0f}, {3, 0x11}, {6, 0x12}, {3, 0x14}, {6, 0x17}, {3, 0x18}, - {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1c}, {3, 0x1d}, {18, 0xff}, - {3, 0xfe}, {3, 0x1d}, {6, 0x1b}, {9, 0x19}, {3, 0x17}, {3, 0x16}, - {3, 0x15}, {3, 0x16}, {3, 0x13}, {1, 0x54}, {1, 0x8e}, {1, 0xa9}, - {1, 0x7f}, {1, 0xd7}, {1, 0xff}, {1, 0x33}, {1, 0x52}, {1, 0x61}, - {3, 0x13}, {3, 0x16}, {3, 0x14}, {3, 0x16}, {3, 0x17}, {3, 0x18}, - {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1c}, {3, 0x1d}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, - {3, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x14}, {3, 0x13}, {3, 0x11}, - {3, 0x10}, {6, 0x0d}, {3, 0x0a}, {3, 0x06}, {3, 0x03}, {3, 0x04}, - {255, 0x00}, {3, 0x03}, {3, 0x06}, {3, 0x0a}, {3, 0x09}, {3, 0x0c}, - {3, 0x0d}, {3, 0x0f}, {3, 0x12}, {3, 0x13}, {3, 0x15}, {3, 0x16}, - {3, 0x17}, {3, 0x18}, {3, 0x1a}, {6, 0x1b}, {3, 0x1c}, {21, 0xff}, - {3, 0x1d}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {3, 0x18}, {3, 0x16}, - {3, 0x17}, {3, 0x16}, {3, 0x15}, {3, 0x14}, {6, 0x15}, {3, 0x14}, - {3, 0x13}, {3, 0x16}, {3, 0x15}, {3, 0x16}, {3, 0x17}, {3, 0x19}, - {6, 0x18}, {3, 0x19}, {1, 0x1a}, {1, 0x2e}, {1, 0x22}, {1, 0x1a}, - {1, 0x9d}, {1, 0x61}, {1, 0x89}, {1, 0xde}, {1, 0xab}, {1, 0x68}, - {1, 0xdd}, {1, 0x9c}, {1, 0x4a}, {1, 0xdc}, {1, 0x90}, {1, 0x26}, - {1, 0xdc}, {1, 0x87}, {1, 0x1d}, {1, 0xdd}, {1, 0x87}, {1, 0x1d}, - {1, 0xdd}, {1, 0x87}, {1, 0x1d}, {1, 0xdd}, {1, 0x87}, {1, 0x1d}, - {1, 0xdc}, {1, 0x86}, {1, 0x1d}, {1, 0xdc}, {1, 0x86}, {1, 0x1d}, - {1, 0xdc}, {1, 0x86}, {1, 0x1b}, {1, 0xda}, {1, 0x84}, {1, 0x1b}, - {1, 0xce}, {1, 0x7d}, {1, 0x1a}, {1, 0xbf}, {1, 0x74}, {1, 0x18}, - {1, 0xa7}, {1, 0x66}, {1, 0x16}, {1, 0x83}, {1, 0x50}, {1, 0x11}, - {1, 0x3f}, {1, 0x28}, {6, 0x0e}, {9, 0x0c}, {6, 0x0d}, {3, 0x09}, - {6, 0x0d}, {3, 0x0c}, {3, 0x0d}, {3, 0x10}, {3, 0x0f}, {3, 0x10}, - {3, 0x14}, {3, 0x15}, {6, 0x17}, {6, 0x1a}, {6, 0x1d}, {6, 0x1f}, - {3, 0x21}, {3, 0xc0}, {18, 0xff}, {3, 0x82}, {9, 0x26}, {3, 0x72}, - {18, 0xff}, {3, 0xc7}, {3, 0x1f}, {3, 0x1e}, {3, 0x1d}, {3, 0x1c}, - {6, 0x1a}, {3, 0x19}, {3, 0x16}, {3, 0x15}, {3, 0x12}, {3, 0x10}, - {3, 0x12}, {3, 0x10}, {3, 0x0e}, {3, 0x0b}, {3, 0x0c}, {9, 0x0d}, - {3, 0x0c}, {3, 0x0d}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, {6, 0x13}, - {3, 0x14}, {3, 0x16}, {3, 0x18}, {6, 0x1a}, {3, 0x1b}, {3, 0x1c}, - {3, 0x1d}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x1d}, {9, 0x1b}, - {6, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {3, 0x15}, - {6, 0x14}, {3, 0x17}, {3, 0x16}, {3, 0x17}, {6, 0x18}, {6, 0x1b}, - {3, 0x1d}, {3, 0x1f}, {6, 0x21}, {3, 0x22}, {3, 0xfc}, {15, 0xff}, - {3, 0xfa}, {3, 0x29}, {3, 0x2a}, {3, 0x29}, {3, 0x2a}, {3, 0x66}, - {3, 0xf0}, {18, 0xff}, {3, 0xf7}, {3, 0x7d}, {3, 0x23}, {3, 0x21}, - {6, 0x1f}, {6, 0x1d}, {3, 0x1a}, {3, 0x18}, {6, 0x17}, {3, 0x15}, - {3, 0x12}, {3, 0x10}, {3, 0x12}, {3, 0x0f}, {3, 0x0d}, {3, 0x0e}, - {9, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0f}, {3, 0x12}, {3, 0x10}, - {3, 0x12}, {3, 0x13}, {6, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, - {6, 0x1b}, {3, 0x1d}, {18, 0xff}, {3, 0xfe}, {3, 0x1d}, {3, 0x1b}, - {3, 0x1c}, {3, 0x1a}, {6, 0x19}, {3, 0x17}, {3, 0x16}, {3, 0x15}, - {3, 0x16}, {3, 0x13}, {1, 0x2c}, {1, 0x48}, {1, 0x56}, {1, 0x7a}, - {1, 0xd2}, {1, 0xfc}, {1, 0x52}, {1, 0x8d}, {1, 0xa8}, {3, 0x16}, - {3, 0x15}, {6, 0x16}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, - {9, 0x1d}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, {9, 0x1b}, {3, 0x19}, - {3, 0x18}, {6, 0x17}, {3, 0x14}, {3, 0x13}, {3, 0x11}, {3, 0x10}, - {6, 0x0d}, {3, 0x0a}, {3, 0x07}, {3, 0x03}, {3, 0x04}, {252, 0x00}, - {3, 0x04}, {3, 0x03}, {3, 0x06}, {3, 0x0a}, {6, 0x0c}, {3, 0x0d}, - {3, 0x0f}, {3, 0x12}, {3, 0x13}, {3, 0x15}, {6, 0x16}, {6, 0x1a}, - {3, 0x1b}, {3, 0x1d}, {3, 0x1b}, {21, 0xff}, {3, 0x1c}, {3, 0x1b}, - {3, 0x1a}, {9, 0x18}, {3, 0x17}, {3, 0x16}, {3, 0x15}, {9, 0x14}, - {6, 0x13}, {3, 0x16}, {6, 0x15}, {3, 0x16}, {1, 0x17}, {1, 0x32}, - {1, 0x23}, {1, 0x19}, {1, 0x85}, {1, 0x53}, {1, 0x18}, {1, 0x44}, - {1, 0x2d}, {4, 0x1a}, {1, 0xaa}, {1, 0x68}, {1, 0x1e}, {1, 0xdc}, - {1, 0x85}, {1, 0x1e}, {1, 0xdb}, {1, 0x85}, {1, 0x1e}, {1, 0xda}, - {1, 0x84}, {1, 0x1e}, {1, 0xda}, {1, 0x84}, {1, 0x1e}, {1, 0xda}, - {1, 0x83}, {1, 0x1e}, {1, 0xd9}, {1, 0x83}, {1, 0x1e}, {1, 0xd9}, - {1, 0x83}, {1, 0x1f}, {1, 0xd8}, {1, 0x82}, {1, 0x1f}, {1, 0xd8}, - {1, 0x82}, {1, 0x1f}, {1, 0xd8}, {1, 0x82}, {1, 0x1f}, {1, 0xd8}, - {1, 0x82}, {1, 0x1f}, {1, 0xd8}, {1, 0x82}, {1, 0x1f}, {1, 0xd8}, - {1, 0x82}, {1, 0x1f}, {1, 0xd8}, {1, 0x82}, {1, 0x1e}, {1, 0xd9}, - {1, 0x83}, {1, 0x1c}, {1, 0xd6}, {1, 0x81}, {1, 0x17}, {1, 0x9b}, - {1, 0x5d}, {6, 0x0e}, {3, 0x0f}, {3, 0x0d}, {3, 0x0b}, {3, 0x0c}, - {9, 0x0d}, {3, 0x0c}, {3, 0x0d}, {3, 0x0e}, {3, 0x0f}, {3, 0x11}, - {6, 0x13}, {3, 0x14}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1b}, - {3, 0x1c}, {6, 0x1e}, {3, 0x20}, {3, 0x41}, {3, 0xf7}, {15, 0xff}, - {3, 0xe4}, {12, 0x26}, {3, 0x24}, {3, 0xdc}, {15, 0xff}, {3, 0xf9}, - {3, 0x4f}, {3, 0x1e}, {3, 0x1d}, {6, 0x1b}, {6, 0x18}, {3, 0x17}, - {3, 0x14}, {6, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x0e}, {3, 0x0d}, - {15, 0x0c}, {6, 0x0d}, {3, 0x0f}, {3, 0x11}, {3, 0x13}, {6, 0x14}, - {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1c}, - {3, 0x1d}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {3, 0x1c}, {6, 0x1d}, - {3, 0x1b}, {6, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x15}, {3, 0x16}, - {3, 0x17}, {3, 0x15}, {3, 0x17}, {3, 0x16}, {3, 0x15}, {3, 0x16}, - {3, 0x18}, {3, 0x1a}, {3, 0x1b}, {6, 0x1d}, {3, 0x1f}, {3, 0x21}, - {3, 0x22}, {3, 0x24}, {3, 0xfc}, {15, 0xff}, {3, 0xfa}, {3, 0x29}, - {3, 0x2a}, {3, 0x2b}, {3, 0x62}, {3, 0xee}, {18, 0xff}, {3, 0xf7}, - {3, 0x7e}, {3, 0x23}, {3, 0x22}, {3, 0x21}, {6, 0x1f}, {3, 0x1d}, - {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, {6, 0x14}, {3, 0x12}, - {3, 0x10}, {3, 0x0f}, {3, 0x10}, {3, 0x0e}, {3, 0x0d}, {9, 0x0b}, - {6, 0x0d}, {3, 0x0f}, {3, 0x12}, {3, 0x10}, {3, 0x12}, {3, 0x15}, - {6, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {6, 0x1d}, {3, 0x1c}, - {18, 0xff}, {3, 0xfe}, {3, 0x1c}, {3, 0x1d}, {3, 0x1b}, {3, 0x1a}, - {3, 0x19}, {3, 0x18}, {3, 0x17}, {6, 0x16}, {3, 0x15}, {3, 0x14}, - {3, 0x13}, {1, 0x6a}, {1, 0xb9}, {1, 0xe1}, {1, 0x64}, {1, 0xaf}, - {1, 0xd5}, {3, 0x16}, {3, 0x15}, {3, 0x16}, {6, 0x17}, {3, 0x18}, - {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1d}, {3, 0x1c}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {6, 0x1d}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, - {6, 0x17}, {3, 0x16}, {3, 0x13}, {3, 0x11}, {3, 0x0f}, {6, 0x0d}, - {3, 0x0a}, {3, 0x07}, {3, 0x08}, {3, 0x04}, {252, 0x00}, {3, 0x04}, - {3, 0x03}, {3, 0x06}, {3, 0x0a}, {3, 0x0c}, {3, 0x0b}, {3, 0x0d}, - {3, 0x0f}, {3, 0x12}, {3, 0x13}, {3, 0x14}, {3, 0x16}, {3, 0x18}, - {6, 0x1a}, {3, 0x1b}, {3, 0x1d}, {3, 0x1b}, {21, 0xff}, {3, 0x1c}, - {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, - {6, 0x16}, {15, 0x13}, {3, 0x15}, {3, 0x13}, {1, 0x16}, {1, 0x71}, - {1, 0x46}, {1, 0x1a}, {1, 0xb3}, {1, 0x6d}, {1, 0x1c}, {1, 0xd6}, - {1, 0x81}, {1, 0x1e}, {1, 0xdb}, {1, 0x85}, {1, 0x16}, {1, 0x23}, - {1, 0x1b}, {1, 0x18}, {1, 0x48}, {1, 0x2e}, {1, 0x1d}, {1, 0xd5}, - {1, 0x7f}, {1, 0x1f}, {1, 0xd8}, {1, 0x81}, {1, 0x1f}, {1, 0xd6}, - {1, 0x80}, {1, 0x1f}, {1, 0xd6}, {1, 0x80}, {1, 0x20}, {1, 0xd5}, - {1, 0x7f}, {1, 0x20}, {1, 0xd5}, {1, 0x7e}, {1, 0x20}, {1, 0xd5}, - {1, 0x7e}, {1, 0x20}, {1, 0xd4}, {1, 0x7d}, {1, 0x20}, {1, 0xd4}, - {1, 0x7d}, {1, 0x20}, {1, 0xd4}, {1, 0x7d}, {1, 0x20}, {1, 0xd4}, - {1, 0x7d}, {1, 0x20}, {1, 0xd4}, {1, 0x7d}, {1, 0x20}, {1, 0xd4}, - {1, 0x7d}, {1, 0x20}, {1, 0xd5}, {1, 0x7e}, {1, 0x20}, {1, 0xd5}, - {1, 0x7e}, {1, 0x1e}, {1, 0xcc}, {1, 0x79}, {1, 0x14}, {1, 0x69}, - {1, 0x3f}, {3, 0x10}, {6, 0x11}, {3, 0x0e}, {6, 0x0d}, {12, 0x0c}, - {3, 0x0d}, {3, 0x0e}, {3, 0x10}, {3, 0x12}, {3, 0x10}, {3, 0x12}, - {3, 0x16}, {6, 0x17}, {6, 0x1a}, {9, 0x1d}, {6, 0x1f}, {3, 0xad}, - {18, 0xff}, {3, 0x9e}, {3, 0x24}, {9, 0x26}, {3, 0x25}, {3, 0x91}, - {18, 0xff}, {3, 0xb5}, {3, 0x1f}, {6, 0x1d}, {3, 0x1b}, {6, 0x1a}, - {6, 0x17}, {3, 0x15}, {3, 0x14}, {6, 0x12}, {3, 0x10}, {3, 0x0e}, - {3, 0x0d}, {9, 0x0c}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0f}, - {3, 0x11}, {3, 0x12}, {6, 0x14}, {3, 0x17}, {3, 0x18}, {3, 0x19}, - {3, 0x1a}, {6, 0x1b}, {3, 0x1c}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, - {3, 0x1e}, {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, - {3, 0x18}, {6, 0x17}, {3, 0x16}, {3, 0x17}, {3, 0x15}, {3, 0x17}, - {3, 0x16}, {3, 0x17}, {3, 0x18}, {6, 0x1a}, {3, 0x1b}, {3, 0x1d}, - {3, 0x1e}, {3, 0x20}, {6, 0x22}, {3, 0x23}, {3, 0xfc}, {15, 0xff}, - {3, 0xfa}, {6, 0x2a}, {3, 0x5d}, {3, 0xed}, {18, 0xff}, {3, 0xf7}, - {3, 0x7f}, {6, 0x24}, {3, 0x22}, {3, 0x21}, {6, 0x1f}, {3, 0x1d}, - {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {3, 0x17}, {3, 0x14}, {6, 0x13}, - {3, 0x11}, {3, 0x0f}, {3, 0x0d}, {3, 0x0e}, {3, 0x0b}, {6, 0x0c}, - {3, 0x0b}, {3, 0x0d}, {3, 0x0e}, {6, 0x0f}, {3, 0x10}, {3, 0x12}, - {3, 0x15}, {6, 0x17}, {6, 0x18}, {3, 0x1b}, {6, 0x1d}, {3, 0x1e}, - {18, 0xff}, {3, 0xfe}, {3, 0x1c}, {3, 0x1d}, {3, 0x1b}, {3, 0x1a}, - {3, 0x19}, {3, 0x18}, {6, 0x17}, {3, 0x16}, {3, 0x15}, {6, 0x16}, - {1, 0x50}, {1, 0x8e}, {1, 0xaf}, {1, 0x72}, {1, 0xc9}, {1, 0xf7}, - {1, 0x21}, {1, 0x33}, {1, 0x3c}, {3, 0x15}, {3, 0x16}, {9, 0x17}, - {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1d}, {3, 0x1e}, {3, 0xfa}, - {15, 0xff}, {3, 0xfb}, {6, 0x1d}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, - {6, 0x17}, {3, 0x16}, {3, 0x12}, {3, 0x11}, {3, 0x0f}, {6, 0x0d}, - {3, 0x0a}, {3, 0x07}, {3, 0x08}, {3, 0x04}, {252, 0x00}, {3, 0x04}, - {3, 0x03}, {3, 0x06}, {3, 0x0a}, {9, 0x0d}, {3, 0x12}, {6, 0x13}, - {3, 0x14}, {6, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, {3, 0x1c}, - {3, 0x1d}, {21, 0xff}, {3, 0x1c}, {3, 0x1b}, {9, 0x1a}, {3, 0x18}, - {3, 0x17}, {3, 0x15}, {3, 0x16}, {3, 0x14}, {3, 0x13}, {6, 0x12}, - {1, 0x13}, {1, 0x36}, {1, 0x23}, {1, 0x18}, {1, 0x91}, {1, 0x58}, - {1, 0x1c}, {1, 0xc6}, {1, 0x78}, {1, 0x1e}, {1, 0xd9}, {1, 0x83}, - {1, 0x1f}, {1, 0xd8}, {1, 0x81}, {1, 0x1f}, {1, 0xd7}, {1, 0x80}, - {1, 0x1e}, {1, 0xd0}, {1, 0x7b}, {3, 0x14}, {1, 0x18}, {1, 0x7d}, - {1, 0x4b}, {1, 0x20}, {1, 0xd3}, {1, 0x7c}, {1, 0x20}, {1, 0xd3}, - {1, 0x7c}, {1, 0x21}, {1, 0xd2}, {1, 0x7b}, {1, 0x21}, {1, 0xd1}, - {1, 0x7a}, {1, 0x21}, {1, 0xd0}, {1, 0x79}, {1, 0x21}, {1, 0xd0}, - {1, 0x79}, {1, 0x21}, {1, 0xd0}, {1, 0x79}, {1, 0x21}, {1, 0xd0}, - {1, 0x79}, {1, 0x21}, {1, 0xd0}, {1, 0x79}, {1, 0x21}, {1, 0xd0}, - {1, 0x79}, {1, 0x21}, {1, 0xd0}, {1, 0x79}, {1, 0x21}, {1, 0xd0}, - {1, 0x79}, {1, 0x21}, {1, 0xd0}, {1, 0x79}, {1, 0x21}, {1, 0xd1}, - {1, 0x7a}, {1, 0x1f}, {1, 0xcb}, {1, 0x76}, {1, 0x13}, {1, 0x5f}, - {1, 0x38}, {6, 0x10}, {3, 0x11}, {3, 0x10}, {3, 0x0e}, {3, 0x0c}, - {3, 0x0e}, {3, 0x0d}, {3, 0x0c}, {3, 0x0b}, {3, 0x0d}, {3, 0x0e}, - {3, 0x0d}, {3, 0x0f}, {3, 0x11}, {6, 0x13}, {3, 0x14}, {3, 0x16}, - {3, 0x18}, {3, 0x19}, {3, 0x1b}, {3, 0x1c}, {3, 0x1d}, {6, 0x1f}, - {3, 0x24}, {3, 0xee}, {15, 0xff}, {3, 0xf1}, {3, 0x30}, {12, 0x24}, - {3, 0x25}, {3, 0x26}, {3, 0xeb}, {15, 0xff}, {3, 0xf2}, {3, 0x33}, - {3, 0x1f}, {6, 0x1c}, {3, 0x1b}, {3, 0x19}, {6, 0x18}, {3, 0x14}, - {6, 0x13}, {3, 0x11}, {3, 0x0f}, {3, 0x0d}, {3, 0x0e}, {3, 0x0d}, - {6, 0x0b}, {3, 0x0d}, {3, 0x0e}, {3, 0x10}, {3, 0x0f}, {3, 0x10}, - {3, 0x12}, {6, 0x14}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, - {3, 0x1d}, {3, 0x1b}, {3, 0x1c}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, - {3, 0x1e}, {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, {3, 0x19}, - {3, 0x18}, {3, 0x16}, {3, 0x17}, {6, 0x16}, {6, 0x17}, {3, 0x16}, - {3, 0x17}, {3, 0x18}, {6, 0x1a}, {3, 0x1d}, {3, 0x1c}, {3, 0x1e}, - {3, 0x1f}, {3, 0x22}, {3, 0x23}, {3, 0x24}, {3, 0xfc}, {15, 0xff}, - {3, 0xfa}, {3, 0x2b}, {3, 0x59}, {3, 0xeb}, {18, 0xff}, {3, 0xf7}, - {3, 0x80}, {6, 0x25}, {3, 0x24}, {3, 0x22}, {3, 0x20}, {6, 0x1f}, - {3, 0x1d}, {3, 0x1b}, {3, 0x19}, {3, 0x18}, {3, 0x16}, {3, 0x15}, - {3, 0x13}, {3, 0x12}, {6, 0x0f}, {3, 0x0e}, {3, 0x0b}, {12, 0x0c}, - {3, 0x0b}, {3, 0x0e}, {3, 0x10}, {3, 0x0f}, {3, 0x10}, {3, 0x12}, - {3, 0x15}, {6, 0x17}, {3, 0x18}, {3, 0x1a}, {3, 0x1b}, {6, 0x1d}, - {3, 0x1e}, {18, 0xff}, {3, 0xfe}, {3, 0x1e}, {3, 0x1d}, {3, 0x1b}, - {3, 0x1a}, {3, 0x19}, {9, 0x17}, {3, 0x16}, {3, 0x15}, {6, 0x16}, - {1, 0x2d}, {1, 0x4d}, {1, 0x5f}, {1, 0x6f}, {1, 0xca}, {1, 0xfc}, - {1, 0x4d}, {1, 0x88}, {1, 0xa7}, {3, 0x14}, {3, 0x16}, {3, 0x17}, - {6, 0x19}, {9, 0x1a}, {6, 0x1d}, {3, 0xfa}, {15, 0xff}, {3, 0xfb}, - {3, 0x1d}, {3, 0x1c}, {3, 0x1b}, {3, 0x1a}, {3, 0x18}, {6, 0x17}, - {3, 0x15}, {3, 0x12}, {3, 0x11}, {3, 0x0f}, {6, 0x0d}, {3, 0x0a}, - {3, 0x07}, {3, 0x08}, {3, 0x04}, {252, 0x00}, {3, 0x04}, {3, 0x03}, - {3, 0x06}, {3, 0x0a}, {6, 0x0d}, {3, 0x10}, {3, 0x12}, {6, 0x13}, - {3, 0x14}, {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1b}, - {3, 0x1c}, {3, 0x1d}, {21, 0xff}, {3, 0x1c}, {3, 0x1b}, {6, 0x1a}, - {3, 0x19}, {3, 0x17}, {3, 0x16}, {3, 0x14}, {3, 0x15}, {3, 0x13}, - {3, 0x12}, {1, 0x13}, {1, 0x54}, {1, 0x33}, {1, 0x18}, {1, 0xa7}, - {1, 0x65}, {1, 0x1d}, {1, 0xd1}, {1, 0x7c}, {1, 0x1f}, {1, 0xd6}, - {1, 0x80}, {1, 0x20}, {1, 0xd5}, {1, 0x7e}, {1, 0x20}, {1, 0xd4}, - {1, 0x7d}, {1, 0x20}, {1, 0xd3}, {1, 0x7c}, {1, 0x21}, {1, 0xd2}, - {1, 0x7b}, {1, 0x21}, {1, 0xd0}, {1, 0x79}, {1, 0x12}, {1, 0x3e}, - {1, 0x25}, {1, 0x1b}, {1, 0x9b}, {1, 0x5a}, {1, 0x22}, {1, 0xce}, - {1, 0x77}, {1, 0x22}, {1, 0xce}, {1, 0x76}, {1, 0x22}, {1, 0xcd}, - {1, 0x75}, {1, 0x22}, {1, 0xcc}, {1, 0x75}, {1, 0x22}, {1, 0xcc}, - {1, 0x75}, {1, 0x22}, {1, 0xcc}, {1, 0x75}, {1, 0x22}, {1, 0xcc}, - {1, 0x74}, {1, 0x22}, {1, 0xcc}, {1, 0x74}, {1, 0x22}, {1, 0xcc}, - {1, 0x74}, {1, 0x22}, {1, 0xcc}, {1, 0x75}, {1, 0x22}, {1, 0xcc}, - {1, 0x75}, {1, 0x22}, {1, 0xcc}, {1, 0x75}, {1, 0x22}, {1, 0xcd}, - {1, 0x75}, {1, 0x22}, {1, 0xce}, {1, 0x76}, {1, 0x16}, {1, 0x7e}, - {1, 0x49}, {3, 0x0f}, {6, 0x10}, {3, 0x11}, {3, 0x10}, {3, 0x0e}, - {3, 0x0f}, {3, 0x0e}, {9, 0x0d}, {3, 0x0e}, {3, 0x0d}, {3, 0x0f}, - {9, 0x12}, {3, 0x16}, {6, 0x17}, {3, 0x18}, {3, 0x1a}, {3, 0x1b}, - {3, 0x1d}, {6, 0x1e}, {3, 0x1f}, {3, 0x99}, {18, 0xff}, {3, 0xb4}, - {3, 0x26}, {15, 0x25}, {3, 0x24}, {3, 0xaa}, {18, 0xff}, {3, 0xa3}, - {6, 0x1e}, {6, 0x1b}, {3, 0x1a}, {3, 0x18}, {6, 0x17}, {3, 0x16}, - {3, 0x14}, {6, 0x12}, {3, 0x0f}, {3, 0x0d}, {6, 0x0e}, {3, 0x0d}, - {3, 0x0e}, {3, 0x0d}, {3, 0x0f}, {3, 0x12}, {3, 0x10}, {3, 0x12}, - {3, 0x14}, {6, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {6, 0x1d}, - {3, 0x1c}, {3, 0xfe}, {15, 0xff}, {3, 0xfc}, {6, 0x1d}, {3, 0x1c}, - {3, 0x1b}, {3, 0x1a}, {3, 0x19}, {6, 0x18}, {3, 0x17}, {15, 0x16}, - {3, 0x17}, {3, 0x18}, {3, 0x19}, {3, 0x1a}, {3, 0x1d}, {3, 0x1c}, - {3, 0x1e}, {3, 0x20}, {6, 0x22}, {3, 0x24}, {3, 0xfc}, {15, 0xff}, [... truncated: 13614 lines follow ...] From superstippi at gmx.de Sun Apr 6 22:14:46 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 06 Apr 2008 22:14:46 +0200 Subject: [Haiku-commits] r24842 - in haiku/trunk: headers/libs/usb src/add-ons/kernel/drivers/bus/usb src/libs/usb In-Reply-To: <200804061959.m36JxOvS014401@sheep.berlios.de> References: <200804061959.m36JxOvS014401@sheep.berlios.de> Message-ID: <20080406221446.34467.9@stippis2.1207481761.fake> Hi Michael, mmlr at BerliOS wrote: > + usb_interface_descriptor *descriptor = new usb_interface_descriptor; > + if (descriptor == NULL) > + return NULL; This only works as intended if you #include ... usb_interface_descriptor *descriptor = new(std::nothrow) usb_interface_descriptor; if (descriptor == NULL) return NULL; Best regards, -Stephan From mmlr at mail.berlios.de Sun Apr 6 22:19:38 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 6 Apr 2008 22:19:38 +0200 Subject: [Haiku-commits] r24845 - haiku/trunk/src/libs/usb Message-ID: <200804062019.m36KJcHG015941@sheep.berlios.de> Author: mmlr Date: 2008-04-06 22:19:38 +0200 (Sun, 06 Apr 2008) New Revision: 24845 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24845&view=rev Modified: haiku/trunk/src/libs/usb/USBInterface.cpp Log: Forgot to use nothrow for the allocation of the interface descriptor. Thanks for pointing that out Stephan! Modified: haiku/trunk/src/libs/usb/USBInterface.cpp =================================================================== --- haiku/trunk/src/libs/usb/USBInterface.cpp 2008-04-06 20:10:50 UTC (rev 24844) +++ haiku/trunk/src/libs/usb/USBInterface.cpp 2008-04-06 20:19:38 UTC (rev 24845) @@ -9,8 +9,10 @@ #include #include + +#include +#include #include -#include BUSBInterface::BUSBInterface(BUSBConfiguration *config, uint32 index, int rawFD) @@ -160,7 +162,8 @@ usb_interface_descriptor * BUSBInterface::AlternateAt(uint32 alternateIndex) { - usb_interface_descriptor *descriptor = new usb_interface_descriptor; + usb_interface_descriptor *descriptor + = new(std::nothrow) usb_interface_descriptor; if (descriptor == NULL) return NULL; From superstippi at gmx.de Sun Apr 6 22:25:28 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 06 Apr 2008 22:25:28 +0200 Subject: [Haiku-commits] r24845 - haiku/trunk/src/libs/usb In-Reply-To: <200804062019.m36KJcHG015941@sheep.berlios.de> References: <200804062019.m36KJcHG015941@sheep.berlios.de> Message-ID: <20080406222528.34594.11@stippis2.1207481761.fake> mmlr at BerliOS wrote: > Author: mmlr > Date: 2008-04-06 22:19:38 +0200 (Sun, 06 Apr 2008) New Revision: 24845 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24845&view=rev > > Modified: > haiku/trunk/src/libs/usb/USBInterface.cpp > Log: > Forgot to use nothrow for the allocation of the interface descriptor. > Thanks for pointing that out Stephan! You are most welcome! I am delighted when I can help my personal heros, even if it is only minor issues such as these. :-) Best regards, -Stephan From axeld at mail.berlios.de Sun Apr 6 23:30:51 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 6 Apr 2008 23:30:51 +0200 Subject: [Haiku-commits] r24846 - in haiku/trunk/src/apps: . activitymonitor Message-ID: <200804062130.m36LUprm023476@sheep.berlios.de> Author: axeld Date: 2008-04-06 23:30:50 +0200 (Sun, 06 Apr 2008) New Revision: 24846 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24846&view=rev Added: haiku/trunk/src/apps/activitymonitor/ haiku/trunk/src/apps/activitymonitor/ActivityMonitor.cpp haiku/trunk/src/apps/activitymonitor/ActivityMonitor.h haiku/trunk/src/apps/activitymonitor/ActivityMonitor.rdef haiku/trunk/src/apps/activitymonitor/ActivityView.cpp haiku/trunk/src/apps/activitymonitor/ActivityView.h haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp haiku/trunk/src/apps/activitymonitor/ActivityWindow.h haiku/trunk/src/apps/activitymonitor/CircularBuffer.h haiku/trunk/src/apps/activitymonitor/DataSource.cpp haiku/trunk/src/apps/activitymonitor/DataSource.h haiku/trunk/src/apps/activitymonitor/Jamfile haiku/trunk/src/apps/activitymonitor/SystemInfo.cpp haiku/trunk/src/apps/activitymonitor/SystemInfo.h Modified: haiku/trunk/src/apps/Jamfile Log: * The beginnings of an activity monitor application. Very bare and feature-less right now, but it's already working (and shows that we better compute our system_info::cached_pages field directly). * I am not sure if we want to keep this app here, merge it with ProcessController, or have it as a separate (3rdparty) app. Opinions welcome. Modified: haiku/trunk/src/apps/Jamfile =================================================================== --- haiku/trunk/src/apps/Jamfile 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/Jamfile 2008-04-06 21:30:50 UTC (rev 24846) @@ -2,6 +2,7 @@ SubInclude HAIKU_TOP src apps 3dmov ; SubInclude HAIKU_TOP src apps aboutsystem ; +SubInclude HAIKU_TOP src apps activitymonitor ; SubInclude HAIKU_TOP src apps bsnow ; SubInclude HAIKU_TOP src apps bootman ; SubInclude HAIKU_TOP src apps cdplayer ; Added: haiku/trunk/src/apps/activitymonitor/ActivityMonitor.cpp =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityMonitor.cpp 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/activitymonitor/ActivityMonitor.cpp 2008-04-06 21:30:50 UTC (rev 24846) @@ -0,0 +1,91 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "ActivityMonitor.h" + +#include + +#include +#include +#include + +#include "ActivityWindow.h" + + +const char* kSignature = "application/x-vnd.Haiku-ActivityMonitor"; + + +ActivityMonitor::ActivityMonitor() + : BApplication(kSignature) +{ +} + + +ActivityMonitor::~ActivityMonitor() +{ +} + + +void +ActivityMonitor::ReadyToRun() +{ + fWindow = new ActivityWindow(); + fWindow->Show(); +} + + +void +ActivityMonitor::RefsReceived(BMessage* message) +{ + fWindow->PostMessage(message); +} + + +void +ActivityMonitor::MessageReceived(BMessage* message) +{ + BApplication::MessageReceived(message); +} + + +void +ActivityMonitor::AboutRequested() +{ + ShowAbout(); +} + + +/*static*/ void +ActivityMonitor::ShowAbout() +{ + BAlert *alert = new BAlert("about", "ActivityMonitor\n" + "\twritten by Axel D?rfler\n" + "\tCopyright 2008, Haiku Inc.\n", "Ok"); + BTextView *view = alert->TextView(); + BFont font; + + view->SetStylable(true); + + view->GetFont(&font); + font.SetSize(18); + font.SetFace(B_BOLD_FACE); + view->SetFontAndColor(0, 15, &font); + + alert->Go(); +} + + +// #pragma mark - + + +int +main(int /*argc*/, char** /*argv*/) +{ + ActivityMonitor app; + app.Run(); + + return 0; +} Added: haiku/trunk/src/apps/activitymonitor/ActivityMonitor.h =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityMonitor.h 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/activitymonitor/ActivityMonitor.h 2008-04-06 21:30:50 UTC (rev 24846) @@ -0,0 +1,35 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef ACTIVITY_MONITOR_H +#define ACTIVITY_MONITOR_H + + +#include + +class BMessage; +class ActivityWindow; + + +class ActivityMonitor : public BApplication { +public: + ActivityMonitor(); + virtual ~ActivityMonitor(); + + virtual void ReadyToRun(); + + virtual void RefsReceived(BMessage* message); + virtual void MessageReceived(BMessage* message); + + virtual void AboutRequested(); + + static void ShowAbout(); + +private: + ActivityWindow* fWindow; +}; + +extern const char* kSignature; + +#endif // ACTIVITY_MONITOR_H Added: haiku/trunk/src/apps/activitymonitor/ActivityMonitor.rdef =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityMonitor.rdef 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/activitymonitor/ActivityMonitor.rdef 2008-04-06 21:30:50 UTC (rev 24846) @@ -0,0 +1,46 @@ + +resource(1, "BEOS:APP_SIG") #'MIMS' "application/x-vnd.Haiku-ActivityMonitor"; + +resource app_version { + major = 1, + middle = 0, + minor = 0, + + variety = B_APPV_BETA, + internal = 3, + + short_info = "ActivityMonitor", + long_info = "ActivityMonitor ?2008 Haiku, Inc." +}; + +resource app_flags B_MULTIPLE_LAUNCH; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + +resource vector_icon { + $"6E6369660E03010000020002023980000000000000004000004BE00008908100" + $"010000FFFF01000000020016023CC7EE389BC0BA16573E39B04977C842ADC700" + $"FFFFD3020006023C529D3753A2B8966F3D9D084B6044496AAF00474747FFA5A0" + $"A002001602BC4E76BC411B3C90DABCA00D47587D4ABA850090FFD40200160238" + $"313C3B5CF0BFCD963C7AAC4C13943FCAF901ECFFC3054B04017E020006033E2F" + $"99387F17BA42DB3FF5B94A0E32482C90001D1E2C3D454658FF01010102000602" + $"3879063B8224BE2CC83B10DB4A1F6F49B894FF9A9A9A00242222020006033C69" + $"A60000000000003E186148800049800058F3F3F300D4CECEFFD9D9D902000603" + $"3C1F1A33E78CB7ACC03FFE4F48BB3EBD7B6C0078D905818CFF05FF7ADD050200" + $"1602349C2E37B5FABA1F6036FC624A3E004B320001D3FF910200160235777837" + $"0A67B7E8CE363A844A1D684B45D800F3FF2E0D0A04486050605C51544E04033E" + $"5349594856475C49604B5C4E604B0A06262A264C485E5252523030240A04262A" + $"4838523030240A044838485E525252300A04262A264C485E48380A04453A4553" + $"2844282E0A04B6F9C0F42845282EB701B8EC0A044550455328452AC0F30A0445" + $"3A45502A43B701B8EC0408AEBAB6BCBCC32FBD4F2E3930BDA8B9ACC0A5BA9EBC" + $"03BB1EBFD937BF0DBD4FC072BCC3C019BDDBC0CB46460204BF23C726BF91C70D" + $"BEB5C73FBE9FC87EBE7AC7D9BEC5C922BFAAC97BBF3CC994C018C962C02DC823" + $"C053C8C8C008C77F0204BFCEC6FBC042C6E0BF5BC715BF48C85ABF1FC7B3BF71" + $"C902C063C95ABFF0C974C0D7C93FC0EAC7FAC113C8A2C0C1C7530E0A07010000" + $"0A0101011001178300040A0001021001178400040A020103000A080109000A0B" + $"010A1001178120040A030104000A04020506000A090107000A0A0108000A0D01" + $"0C0815FF0A0C010B0815FF0A0D010C0A3FEAF70000000000003FEAF7C573B4C2" + $"770615FF0A0C010B0A3FEAF70000000000003FEAF7C573B4C2770615FF" +}; + +#endif // HAIKU_TARGET_PLATFORM_HAIKU Added: haiku/trunk/src/apps/activitymonitor/ActivityView.cpp =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityView.cpp 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/activitymonitor/ActivityView.cpp 2008-04-06 21:30:50 UTC (rev 24846) @@ -0,0 +1,500 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "ActivityView.h" + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#include "ActivityMonitor.h" +#include "DataSource.h" +#include "SystemInfo.h" + + +struct data_item { + bigtime_t time; + int64 value; +}; + +const bigtime_t kInitialRefreshInterval = 500000LL; + +const uint32 kMsgRefresh = 'refr'; +const uint32 kMsgToggleDataSource = 'tgds'; + +extern const char* kSignature; + + +DataHistory::DataHistory(bigtime_t memorize, bigtime_t interval) + : + fBuffer(10000), + fMinimumValue(0), + fMaximumValue(0), + fRefreshInterval(interval), + fLastIndex(-1) +{ +} + + +DataHistory::~DataHistory() +{ +} + + +void +DataHistory::AddValue(bigtime_t time, int64 value) +{ + if (fBuffer.IsEmpty() || fMaximumValue < value) + fMaximumValue = value; + if (fBuffer.IsEmpty() || fMinimumValue > value) + fMinimumValue = value; + + data_item item = {time, value}; + fBuffer.AddItem(item); +} + + +int64 +DataHistory::ValueAt(bigtime_t time) +{ + // TODO: if the refresh rate changes, this computation won't work anymore! + int32 index = (time - Start()) / fRefreshInterval; + data_item* item = fBuffer.ItemAt(index); + if (item != NULL) + return item->value; + + return 0; +} + + +int64 +DataHistory::MaximumValue() const +{ + return fMaximumValue; +} + + +int64 +DataHistory::MinimumValue() const +{ + return fMinimumValue; +} + + +bigtime_t +DataHistory::Start() const +{ + if (fBuffer.CountItems() == 0) + return 0; + + return fBuffer.ItemAt(0)->time; +} + + +bigtime_t +DataHistory::End() const +{ + if (fBuffer.CountItems() == 0) + return 0; + + return fBuffer.ItemAt(fBuffer.CountItems() - 1)->time; +} + + +void +DataHistory::SetRefreshInterval(bigtime_t interval) +{ + // TODO: adjust buffer size +} + + +// #pragma mark - + + +ActivityView::ActivityView(BRect frame, const char* name, + const BMessage& settings, uint32 resizingMode) + : BView(frame, name, resizingMode, + B_WILL_DRAW | B_SUBPIXEL_PRECISE | B_FULL_UPDATE_ON_RESIZE + | B_FRAME_EVENTS) +{ + _Init(&settings); + + BRect rect(Bounds()); + rect.top = rect.bottom - 7; + rect.left = rect.right - 7; + BDragger* dragger = new BDragger(rect, this, + B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); + AddChild(dragger); +} + + +ActivityView::ActivityView(BMessage* archive) + : BView(archive) +{ + _Init(archive); +} + + +ActivityView::~ActivityView() +{ +} + + +void +ActivityView::_Init(const BMessage* settings) +{ + fBackgroundColor = (rgb_color){255, 255, 240}; + SetLowColor(fBackgroundColor); + + fRefreshInterval = kInitialRefreshInterval; + fDrawInterval = kInitialRefreshInterval * 2; + fLastRefresh = 0; + fDrawResolution = 1; + + AddDataSource(new UsedMemoryDataSource()); + AddDataSource(new CachedMemoryDataSource()); + AddDataSource(new ThreadsDataSource()); + AddDataSource(new CpuUsageDataSource()); +} + + +status_t +ActivityView::Archive(BMessage* into, bool deep) const +{ + status_t status; + + status = BView::Archive(into, deep); + if (status < B_OK) + return status; + + status = into->AddString("add_on", kSignature); + if (status < B_OK) + return status; + + status = SaveState(*into); + if (status < B_OK) + return status; + + return B_OK; +} + + +BArchivable* +ActivityView::Instantiate(BMessage* archive) +{ + if (!validate_instantiation(archive, "ActivityView")) + return NULL; + + return new ActivityView(archive); +} + + +status_t +ActivityView::SaveState(BMessage& state) const +{ + return B_ERROR; +} + + +DataSource* +ActivityView::FindDataSource(const char* name) +{ + for (int32 i = fSources.CountItems(); i-- > 0;) { + DataSource* source = fSources.ItemAt(i); + if (!strcmp(source->Label(), name)) + return source; + } + + return NULL; +} + + +status_t +ActivityView::AddDataSource(DataSource* source) +{ + DataHistory* values = new(std::nothrow) DataHistory(10 * 60000000LL, + fRefreshInterval); + if (values == NULL) + return B_NO_MEMORY; + if (!fValues.AddItem(values)) { + delete values; + return B_NO_MEMORY; + } + + if (!fSources.AddItem(source)) { + fValues.RemoveItem(values); + delete values; + return B_NO_MEMORY; + } + + return B_OK; +} + + +status_t +ActivityView::RemoveDataSource(DataSource* source) +{ + int32 index = fSources.IndexOf(source); + if (index < 0) + return B_ENTRY_NOT_FOUND; + + fSources.RemoveItemAt(index); + delete source; + DataHistory* values = fValues.RemoveItemAt(index); + delete values; + + return B_OK; +} + + +void +ActivityView::RemoveAllDataSources() +{ + fSources.MakeEmpty(); + fValues.MakeEmpty(); +} + + +void +ActivityView::AttachedToWindow() +{ + BMessage refresh(kMsgRefresh); + fRunner = new BMessageRunner(this, &refresh, fRefreshInterval); +} + + +void +ActivityView::DetachedFromWindow() +{ + delete fRunner; +} + + +void +ActivityView::FrameResized(float /*width*/, float /*height*/) +{ +} + + +void +ActivityView::MouseDown(BPoint where) +{ +#if 0 + int32 buttons = B_PRIMARY_MOUSE_BUTTON; + int32 clicks = 1; + if (Looper() != NULL && Looper()->CurrentMessage() != NULL) { + Looper()->CurrentMessage()->FindInt32("buttons", &buttons); + Looper()->CurrentMessage()->FindInt32("clicks", &clicks); + } +#endif + + BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); + menu->SetFont(be_plain_font); + BMenuItem* item; + + for (int32 i = 0; i < DataSource::CountSources(); i++) { + const DataSource* source = DataSource::SourceAt(i); + + BMessage* message = new BMessage(kMsgToggleDataSource); + message->AddInt32("index", i); + + item = new BMenuItem(source->Label(), message); + if (FindDataSource(source->Label())) + item->SetMarked(true); + + menu->AddItem(item); + } + + menu->SetTargetForItems(this); + + ConvertToScreen(&where); + menu->Go(where, true, false, true); + +} + + +void +ActivityView::MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage) +{ +} + + +void +ActivityView::MessageReceived(BMessage* message) +{ + switch (message->what) { + case B_ABOUT_REQUESTED: + ActivityMonitor::ShowAbout(); + break; + + case kMsgRefresh: + _Refresh(); + break; + + case kMsgToggleDataSource: + { + int32 index; + if (message->FindInt32("index", &index) != B_OK) + break; + + const DataSource* baseSource = DataSource::SourceAt(index); + if (baseSource == NULL) + break; + + DataSource* source = FindDataSource(baseSource->Label()); + if (source == NULL) + AddDataSource(baseSource->Copy()); + else + RemoveDataSource(source); + + Invalidate(); + break; + } + + case B_MOUSE_WHEEL_CHANGED: + { + float deltaY = 0.0f; + if (message->FindFloat("be:wheel_delta_y", &deltaY) != B_OK + || deltaY == 0.0f) + break; + + if (deltaY > 0) + fDrawResolution *= 2; + else + fDrawResolution /= 2; + + if (fDrawResolution < 1) + fDrawResolution = 1; + if (fDrawResolution > 128) + fDrawResolution = 128; + + Invalidate(); + break; + } + + default: + BView::MessageReceived(message); + break; + } +} + + +float +ActivityView::_PositionForValue(DataSource* source, DataHistory* values, + int64 value) +{ + int64 min = source->Minimum(); + int64 max = source->Maximum(); + if (source->AdaptiveScale()) { + int64 adaptiveMax = int64(values->MaximumValue() * 1.2); + if (adaptiveMax < max) + max = adaptiveMax; + } + + if (value > max) + value = max; + if (value < min) + value = min; + + float height = Bounds().Height(); + return height - (value - min) * height / (max - min); +} + + +void +ActivityView::Draw(BRect /*updateRect*/) +{ + uint32 step = 2; + uint32 resolution = fDrawResolution; + if (fDrawResolution > 1) { + step = 1; + resolution--; + } + + uint32 width = Bounds().IntegerWidth() - 10; + uint32 steps = width / step; + bigtime_t timeStep = fRefreshInterval * resolution; + bigtime_t now = system_time(); + + SetPenSize(2); + + for (uint32 i = fSources.CountItems(); i-- > 0;) { + DataSource* source = fSources.ItemAt(i); + DataHistory* values = fValues.ItemAt(i); + bigtime_t time = now - steps * timeStep; + // for now steps pixels per second + + BeginLineArray(steps); + SetHighColor(source->Color()); + + float lastY = FLT_MIN; + uint32 lastX = 0; + + for (uint32 x = 0; x < width; x += step, time += timeStep) { + // TODO: compute starting point instead! + if (values->Start() > time || values->End() < time) + continue; + + int64 value = values->ValueAt(time); + if (timeStep > fRefreshInterval) { + // TODO: always start with the same index, so that it always + // uses the same values for computation (currently it jumps) + uint32 count = 1; + for (bigtime_t offset = fRefreshInterval; offset < timeStep; + offset += fRefreshInterval) { + // TODO: handle int64 overflow correctly! + value += values->ValueAt(time + offset); + count++; + } + value /= count; + } + + float y = _PositionForValue(source, values, value); + if (lastY != FLT_MIN) + AddLine(BPoint(lastX, lastY), BPoint(x, y), source->Color()); + + lastX = x; + lastY = y; + } + + EndLineArray(); + } + + // TODO: add marks when an app started or quit +} + + +void +ActivityView::_Refresh() +{ + SystemInfo info; + + // TODO: run refresh in another thread to decouple it from the UI! + + for (uint32 i = fSources.CountItems(); i-- > 0;) { + DataSource* source = fSources.ItemAt(i); + DataHistory* values = fValues.ItemAt(i); + + int64 value = source->NextValue(info); + values->AddValue(info.Time(), value); + } + + bigtime_t now = info.Time(); + if (fLastRefresh + fDrawInterval <= now) { + Invalidate(); + fLastRefresh = now; + } +} + Added: haiku/trunk/src/apps/activitymonitor/ActivityView.h =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityView.h 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/activitymonitor/ActivityView.h 2008-04-06 21:30:50 UTC (rev 24846) @@ -0,0 +1,89 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef ACTIVITY_VIEW_H +#define ACTIVITY_VIEW_H + + +#include +#include + +#include "CircularBuffer.h" + +class BMessageRunner; +class DataSource; +struct data_item; + + +class DataHistory { +public: + DataHistory(bigtime_t memorize, bigtime_t interval); + ~DataHistory(); + + void AddValue(bigtime_t time, int64 value); + + int64 ValueAt(bigtime_t time); + int64 MaximumValue() const; + int64 MinimumValue() const; + bigtime_t Start() const; + bigtime_t End() const; + + void SetRefreshInterval(bigtime_t interval); + +private: + CircularBuffer fBuffer; + int64 fMinimumValue; + int64 fMaximumValue; + bigtime_t fRefreshInterval; + int32 fLastIndex; +}; + + +class ActivityView : public BView { +public: + ActivityView(BRect frame, const char* name, + const BMessage& settings, uint32 resizingMode); + ActivityView(BMessage* archive); + virtual ~ActivityView(); + + virtual status_t Archive(BMessage* into, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + + status_t SaveState(BMessage& state) const; + + DataSource* FindDataSource(const char* name); + status_t AddDataSource(DataSource* source); + status_t RemoveDataSource(DataSource* source); + void RemoveAllDataSources(); + +protected: + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); + + virtual void FrameResized(float width, float height); + virtual void MouseDown(BPoint where); + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage); + + virtual void MessageReceived(BMessage* message); + + virtual void Draw(BRect updateRect); + +private: + void _Init(const BMessage* settings); + void _Refresh(); + float _PositionForValue(DataSource* source, + DataHistory* values, int64 value); + + rgb_color fBackgroundColor; + BObjectList fSources; + BObjectList fValues; + BMessageRunner* fRunner; + bigtime_t fRefreshInterval; + bigtime_t fLastRefresh; + bigtime_t fDrawInterval; + int32 fDrawResolution; +}; + +#endif // ACTIVITY_VIEW_H Added: haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp 2008-04-06 21:30:50 UTC (rev 24846) @@ -0,0 +1,156 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ + + +#include "ActivityWindow.h" + +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "ActivityMonitor.h" +#include "ActivityView.h" + + +ActivityWindow::ActivityWindow() + : BWindow(BRect(100, 100, 500, 250), "ActivityMonitor", B_TITLED_WINDOW, + B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE) +{ + BMessage settings; + _LoadSettings(settings); + + BRect frame; + if (settings.FindRect("window frame", &frame) == B_OK) { + MoveTo(frame.LeftTop()); + ResizeTo(frame.Width(), frame.Height()); + frame.OffsetTo(B_ORIGIN); + } else + frame = Bounds(); + + // create GUI + + BMenuBar* menuBar = new BMenuBar(Bounds(), "menu"); + AddChild(menuBar); + + frame.top = menuBar->Frame().bottom; + + BView* top = new BView(frame, NULL, B_FOLLOW_ALL, B_WILL_DRAW); + top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); + AddChild(top); + + fActivityView = new ActivityView(top->Bounds().InsetByCopy(10, 10), + "ActivityMonitor", settings, B_FOLLOW_ALL); + top->AddChild(fActivityView); + + // add menu + + // "File" menu + BMenu* menu = new BMenu("File"); + BMenuItem* item; + + menu->AddItem(item = new BMenuItem("About ActivityMonitor" B_UTF8_ELLIPSIS, + new BMessage(B_ABOUT_REQUESTED))); + menu->AddSeparatorItem(); + + menu->AddItem(new BMenuItem("Quit", new BMessage(B_QUIT_REQUESTED), 'Q')); + menu->SetTargetForItems(this); + item->SetTarget(be_app); + menuBar->AddItem(menu); +} + + +ActivityWindow::~ActivityWindow() +{ +} + + +status_t +ActivityWindow::_OpenSettings(BFile& file, uint32 mode) +{ + BPath path; + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) + return B_ERROR; + + path.Append("ActivityMonitor settings"); + + return file.SetTo(path.Path(), mode); +} + + +status_t +ActivityWindow::_LoadSettings(BMessage& settings) +{ + BFile file; + status_t status = _OpenSettings(file, B_READ_ONLY); + if (status < B_OK) + return status; + + return settings.Unflatten(&file); +} + + +status_t +ActivityWindow::_SaveSettings() +{ + BFile file; + status_t status = _OpenSettings(file, B_WRITE_ONLY | B_CREATE_FILE + | B_ERASE_FILE); + if (status < B_OK) + return status; + + BMessage settings('actm'); + status = settings.AddRect("window frame", Frame()); + if (status == B_OK) + status = settings.Flatten(&file); + + return status; +} + + +void +ActivityWindow::_MessageDropped(BMessage* message) +{ + entry_ref ref; + if (message->FindRef("refs", &ref) != B_OK) { + // TODO: If app, then launch it, and add ActivityView for this one? + } +} + + +void +ActivityWindow::MessageReceived(BMessage* message) +{ + if (message->WasDropped()) { + _MessageDropped(message); + return; + } + + switch (message->what) { + case B_REFS_RECEIVED: + case B_SIMPLE_DATA: + _MessageDropped(message); + break; + + default: + BWindow::MessageReceived(message); + break; + } +} + + +bool +ActivityWindow::QuitRequested() +{ + _SaveSettings(); + be_app->PostMessage(B_QUIT_REQUESTED); + return true; +} Added: haiku/trunk/src/apps/activitymonitor/ActivityWindow.h =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityWindow.h 2008-04-06 20:19:38 UTC (rev 24845) +++ haiku/trunk/src/apps/activitymonitor/ActivityWindow.h 2008-04-06 21:30:50 UTC (rev 24846) @@ -0,0 +1,33 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef ACTIVITY_WINDOW_H +#define ACTIVITY_WINDOW_H + + +#include + +class BFile; +class ActivityView; + + +class ActivityWindow : public BWindow { +public: + ActivityWindow(); + virtual ~ActivityWindow(); + + virtual void MessageReceived(BMessage* message); + virtual bool QuitRequested(); + +private: + status_t _OpenSettings(BFile& file, uint32 mode); + status_t _LoadSettings(BMessage& settings); + status_t _SaveSettings(); + + void _MessageDropped(BMessage *message); + [... truncated: 748 lines follow ...] From mmlr at mail.berlios.de Mon Apr 7 00:00:20 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Mon, 7 Apr 2008 00:00:20 +0200 Subject: [Haiku-commits] r24847 - haiku/trunk/src/libs/usb Message-ID: <200804062200.m36M0KPg026109@sheep.berlios.de> Author: mmlr Date: 2008-04-07 00:00:19 +0200 (Mon, 07 Apr 2008) New Revision: 24847 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24847&view=rev Modified: haiku/trunk/src/libs/usb/USBDevice.cpp haiku/trunk/src/libs/usb/USBRoster.cpp Log: Fix broken build due to forgotten definition of the reserved virtual functions. Modified: haiku/trunk/src/libs/usb/USBDevice.cpp =================================================================== --- haiku/trunk/src/libs/usb/USBDevice.cpp 2008-04-06 21:30:50 UTC (rev 24846) +++ haiku/trunk/src/libs/usb/USBDevice.cpp 2008-04-06 22:00:19 UTC (rev 24847) @@ -369,3 +369,11 @@ return command.control.length; } + + +// definition of reserved virtual functions +void BUSBDevice::_ReservedUSBDevice1() {}; +void BUSBDevice::_ReservedUSBDevice2() {}; +void BUSBDevice::_ReservedUSBDevice3() {}; +void BUSBDevice::_ReservedUSBDevice4() {}; +void BUSBDevice::_ReservedUSBDevice5() {}; Modified: haiku/trunk/src/libs/usb/USBRoster.cpp =================================================================== --- haiku/trunk/src/libs/usb/USBRoster.cpp 2008-04-06 21:30:50 UTC (rev 24846) +++ haiku/trunk/src/libs/usb/USBRoster.cpp 2008-04-06 22:00:19 UTC (rev 24847) @@ -267,3 +267,11 @@ ((RosterLooper *)fLooper)->Stop(); fLooper = NULL; } + + +// definition of reserved virtual functions +void BUSBRoster::_ReservedUSBRoster1() {}; +void BUSBRoster::_ReservedUSBRoster2() {}; +void BUSBRoster::_ReservedUSBRoster3() {}; +void BUSBRoster::_ReservedUSBRoster4() {}; +void BUSBRoster::_ReservedUSBRoster5() {}; From ingo_weinhold at gmx.de Mon Apr 7 00:04:01 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 07 Apr 2008 00:04:01 +0200 Subject: [Haiku-commits] r24841 - haiku/trunk/src/kits/interface In-Reply-To: <200804061759.m36HxNd5004164@sheep.berlios.de> References: <200804061759.m36HxNd5004164@sheep.berlios.de> Message-ID: <20080407000401.764.4@knochen-vm.1207516076.fake> On 2008-04-06 at 19:59:23 [+0200], stippi at BerliOS wrote: > Author: stippi > Date: 2008-04-06 19:59:22 +0200 (Sun, 06 Apr 2008) > New Revision: 24841 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24841&view=rev > > Modified: > haiku/trunk/src/kits/interface/View.cpp > Log: > Oh boy. I think I fixed the issue by understanding it with the right side of > my brain, while the left side is still puzzled. So it's hard to put it into > words. Basically, there was an unwanted feedback loop when applications > first > scrolled vertically and then horizontally (or vice versa). Because of the > feedback effects between BView and controlling BScrollBar, and because BView > controlls both scrollbars at once, it is important not to set the scrolling > offset of an unaffected ScrollBar, since we might actually be comming from > the > SetValue() function of the other scrollbar. Fixes #1913 and possibly more, > going to check up on the other scrolling related bugs. > > > Modified: haiku/trunk/src/kits/interface/View.cpp > =================================================================== > --- haiku/trunk/src/kits/interface/View.cpp 2008-04-06 17:53:43 UTC (rev > 24840) > +++ haiku/trunk/src/kits/interface/View.cpp 2008-04-06 17:59:22 UTC (rev > 24841) > @@ -1569,9 +1569,9 @@ > fBounds.OffsetBy(deltaX, deltaY); > > // then set the new values of the scrollbars > - if (fHorScroller) > + if (fHorScroller && deltaX != 0.0) > fHorScroller->SetValue(fBounds.left); > - if (fVerScroller) > + if (fVerScroller && deltaY != 0.0) > fVerScroller->SetValue(fBounds.top); > } Thanks a lot! That really makes Pe much more enjoyable to use under Haiku (the only left annoyance is the broken "Find Function" popup window). As you already wrote, the change doesn't look very convincing, though. Why should setting the scrollbar to a value that it already has (or should have) cause a problem (unless it causes infinite recursion, of course)? I have the suspicion that this is rather covering a different problem. CU, Ingo From anevilyak at gmail.com Mon Apr 7 01:13:11 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 6 Apr 2008 18:13:11 -0500 Subject: [Haiku-commits] r24846 - in haiku/trunk/src/apps: . activitymonitor In-Reply-To: <200804062130.m36LUprm023476@sheep.berlios.de> References: <200804062130.m36LUprm023476@sheep.berlios.de> Message-ID: Hi Axel, On Sun, Apr 6, 2008 at 4:30 PM, axeld at BerliOS wrote: > * The beginnings of an activity monitor application. Very bare and feature-less > right now, but it's already working (and shows that we better compute our > system_info::cached_pages field directly). Can you clarify what you mean by this? Is the value returned by cached_pages not correct, or am I misunderstanding what you mean here? Regards, Rene From bonefish at mail.berlios.de Mon Apr 7 01:28:51 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 7 Apr 2008 01:28:51 +0200 Subject: [Haiku-commits] r24848 - haiku/trunk/build/jam Message-ID: <200804062328.m36NSp7M003474@sheep.berlios.de> Author: bonefish Date: 2008-04-07 01:28:50 +0200 (Mon, 07 Apr 2008) New Revision: 24848 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24848&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Rebuilt libtool package, since the old one seemed to be missing files. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-04-06 22:00:19 UTC (rev 24847) +++ haiku/trunk/build/jam/OptionalPackages 2008-04-06 23:28:50 UTC (rev 24848) @@ -102,8 +102,8 @@ : $(baseURL)/jam-haiku-gcc2-2008-03-27.zip : home config bin ; - InstallOptionalHaikuImagePackage libtool-1.5.26-gcc2-2008-03-24 - : $(baseURL)/libtool-1.5.26-gcc2-2008-03-24.zip + InstallOptionalHaikuImagePackage libtool-1.5.26-gcc2-2008-04-07 + : $(baseURL)/libtool-1.5.26-gcc2-2008-04-07.zip : home ; InstallOptionalHaikuImagePackage texinfo-4.11-gcc2-2008-03-24 From bonefish at mail.berlios.de Mon Apr 7 01:40:13 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 7 Apr 2008 01:40:13 +0200 Subject: [Haiku-commits] r24849 - haiku/trunk/src/bin Message-ID: <200804062340.m36NeD16023702@sheep.berlios.de> Author: bonefish Date: 2008-04-07 01:40:12 +0200 (Mon, 07 Apr 2008) New Revision: 24849 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24849&view=rev Added: haiku/trunk/src/bin/diff_zip.cpp Modified: haiku/trunk/src/bin/Jamfile Log: Added small tool diff_zip that I used for building the latest optional packages. Modified: haiku/trunk/src/bin/Jamfile =================================================================== --- haiku/trunk/src/bin/Jamfile 2008-04-06 23:28:50 UTC (rev 24848) +++ haiku/trunk/src/bin/Jamfile 2008-04-06 23:40:12 UTC (rev 24849) @@ -23,6 +23,7 @@ clear.c clockconfig.c # csplit.c + diff_zip.cpp driveinfo.c # echo.c eject.c Added: haiku/trunk/src/bin/diff_zip.cpp =================================================================== --- haiku/trunk/src/bin/diff_zip.cpp 2008-04-06 23:28:50 UTC (rev 24848) +++ haiku/trunk/src/bin/diff_zip.cpp 2008-04-06 23:40:12 UTC (rev 24849) @@ -0,0 +1,374 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. All rights reserved. + * + * Distributed under the terms of the MIT License. + */ + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + + +using std::string; +using std::map; + + +class Directory; +class Node; + +static Node* create_node(Directory* parent, const string& name, + const struct stat& st); + + +enum diff_status { + DIFF_UNCHANGED, + DIFF_REMOVED, + DIFF_CHANGED, + DIFF_ERROR +}; + + +class EntryWriter { +public: + EntryWriter(int fd) + : fFD(fd) + { + } + + void Write(const char* entry) + { + write(fFD, entry, strlen(entry)); + write(fFD, "\n", 1); + } + +private: + int fFD; +}; + + +class Node { +public: + Node(Directory* parent, const string& name, const struct stat& st) + : fParent(parent), + fName(name), + fStat(st) + { + } + + virtual ~Node() + { + } + + Directory* Parent() const { return fParent; } + const string& Name() const { return fName; } + const struct stat& Stat() const { return fStat; } + + string Path() const; + + bool DoStat(struct stat& st) const + { + string path(Path()); + if (lstat(path.c_str(), &st) != 0) + return false; + return true; + } + + virtual bool Scan() + { + return true; + } + + virtual diff_status CollectDiffEntries(EntryWriter* out) const + { + string path(Path()); + struct stat st; + + diff_status status = DiffEntry(path, st); + if (status == DIFF_CHANGED) + out->Write(path.c_str()); + + return status; + } + + virtual void Dump(int level) const + { + printf("%*s%s\n", level, "", fName.c_str()); + } + +protected: + diff_status DiffEntry(const string& path, struct stat& st) const + { + if (lstat(path.c_str(), &st) == 0) { + if (st.st_mode != fStat.st_mode + || st.st_mtime != fStat.st_mtime + || st.st_size != fStat.st_size) { + return DIFF_CHANGED; + } + return DIFF_UNCHANGED; + } else if (errno == ENOENT) { + // that's OK, the entry was removed + return DIFF_REMOVED; + } else { + // some error + fprintf(stderr, "Error: Failed to stat \"%s\": %s\n", + path.c_str(), strerror(errno)); + return DIFF_ERROR; + } + } + +private: + Directory* fParent; + string fName; + struct stat fStat; +}; + + +class Directory : public Node { +public: + Directory(Directory* parent, const string& name, const struct stat& st) + : Node(parent, name, st), + fEntries() + { + } + + void AddEntry(const char* name, Node* node) + { + fEntries[name] = node; + } + + virtual bool Scan() + { + string path(Path()); + DIR* dir = opendir(path.c_str()); + if (dir == NULL) { + fprintf(stderr, "Error: Failed to open directory \"%s\": %s\n", + path.c_str(), strerror(errno)); + return false; + } + + errno = 0; + while (dirent* entry = readdir(dir)) { + if (strcmp(entry->d_name, ".") == 0 + || strcmp(entry->d_name, "..") == 0) { + continue; + } + + string entryPath = path + '/' + entry->d_name; + struct stat st; + if (lstat(entryPath.c_str(), &st) != 0) { + fprintf(stderr, "Error: Failed to stat entry \"%s\": %s\n", + entryPath.c_str(), strerror(errno)); + closedir(dir); + return false; + } + + Node* node = create_node(this, entry->d_name, st); + fEntries[entry->d_name] = node; + + errno = 0; + } + + if (errno != 0) { + fprintf(stderr, "Error: Failed to read directory \"%s\": %s\n", + path.c_str(), strerror(errno)); + closedir(dir); + return false; + } + + closedir(dir); + + // recursively scan the entries + for (EntryMap::iterator it = fEntries.begin(); it != fEntries.end(); + ++it) { + Node* node = it->second; + if (!node->Scan()) + return false; + } + + return true; + } + + virtual diff_status CollectDiffEntries(EntryWriter* out) const + { + string path(Path()); + struct stat st; + + diff_status status = DiffEntry(path, st); + if (status == DIFF_REMOVED || status == DIFF_ERROR) + return status; + + // we print it only if it is no longer a directory + if (!S_ISDIR(st.st_mode)) { + out->Write(path.c_str()); + return DIFF_CHANGED; + } + + // iterate through the "new" entries + DIR* dir = opendir(path.c_str()); + if (dir == NULL) { + fprintf(stderr, "Error: Failed to open directory \"%s\": %s\n", + path.c_str(), strerror(errno)); + return DIFF_ERROR; + } + + errno = 0; + while (dirent* entry = readdir(dir)) { + if (strcmp(entry->d_name, ".") == 0 + || strcmp(entry->d_name, "..") == 0) { + continue; + } + + EntryMap::const_iterator it = fEntries.find(entry->d_name); + if (it == fEntries.end()) { + // new entry + string entryPath = path + "/" + entry->d_name; + out->Write(entryPath.c_str()); + } else { + // old entry -- recurse + diff_status entryStatus = it->second->CollectDiffEntries(out); + if (entryStatus == DIFF_ERROR) { + closedir(dir); + return status; + } + if (entryStatus != DIFF_UNCHANGED) + status = DIFF_CHANGED; + } + + errno = 0; + } + + if (errno != 0) { + fprintf(stderr, "Error: Failed to read directory \"%s\": %s\n", + path.c_str(), strerror(errno)); + closedir(dir); + return DIFF_ERROR; + } + + closedir(dir); + return status; + } + + virtual void Dump(int level) const + { + Node::Dump(level); + + for (EntryMap::const_iterator it = fEntries.begin(); + it != fEntries.end(); ++it) { + it->second->Dump(level + 1); + } + } + + +private: + typedef map EntryMap; + + EntryMap fEntries; +}; + + +string +Node::Path() const +{ + if (fParent == NULL) + return fName; + + return fParent->Path() + '/' + fName; +} + + +static Node* +create_node(Directory* parent, const string& name, const struct stat& st) +{ + if (S_ISDIR(st.st_mode)) + return new Directory(parent, name, st); + return new Node(parent, name, st); +} + + +int +main(int argc, const char* const* argv) +{ + // the paths are listed after a "--" argument + int argi = 1; + for (; argi < argc; argi++) { + if (strcmp(argv[argi], "--") == 0) + break; + } + + if (argi + 1 >= argc) { + fprintf(stderr, "Usage: %s ... -- \n", argv[0]); + exit(1); + } + + int zipArgCount = argi; + const char* const* paths = argv + argi + 1; + int pathCount = argc - argi - 1; + + // snapshot the hierarchy + Node** rootNodes = new Node*[pathCount]; + + for (int i = 0; i < pathCount; i++) { + const char* path = paths[i]; + struct stat st; + if (lstat(path, &st) != 0) { + fprintf(stderr, "Error: Failed to stat \"%s\": %s\n", path, + strerror(errno)); + exit(1); + } + + rootNodes[i] = create_node(NULL, path, st); + if (!rootNodes[i]->Scan()) + exit(1); + } + + // create a temp file + char tmpFileName[64]; + sprintf(tmpFileName, "/tmp/diff_zip_%d_XXXXXX", (int)getpid()); + int tmpFileFD = mkstemp(tmpFileName); + if (tmpFileFD < 0) { + fprintf(stderr, "Error: Failed create temp file: %s\n", + strerror(errno)); + exit(1); + } + unlink(tmpFileName); + + // wait + { + printf("Waiting for changes. Press RETURN to continue..."); + fflush(stdout); + char buffer[32]; + fgets(buffer, sizeof(buffer), stdin); + } + + EntryWriter tmpFile(tmpFileFD); + + for (int i = 0; i < pathCount; i++) { + if (rootNodes[i]->CollectDiffEntries(&tmpFile) == DIFF_ERROR) + exit(1); + } + + // dup the temp file FD to our stdin and exec() + dup2(tmpFileFD, 0); + close(tmpFileFD); + lseek(0, 0, SEEK_SET); + + char** zipArgs = new char*[zipArgCount + 2]; + zipArgs[0] = strdup("zip"); + zipArgs[1] = strdup("-@"); + for (int i = 1; i < zipArgCount; i++) + zipArgs[i + 1] = strdup(argv[i]); + zipArgs[zipArgCount + 1] = NULL; + + execvp("zip", zipArgs); + + fprintf(stderr, "Error: Failed exec*() zip: %s\n", strerror(errno)); + + return 1; +} From mmu_man at mail.berlios.de Mon Apr 7 03:08:19 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 7 Apr 2008 03:08:19 +0200 Subject: [Haiku-commits] r24850 - in haiku/trunk: headers/posix src/system/libroot/posix/unistd Message-ID: <200804070108.m3718J70032040@sheep.berlios.de> Author: mmu_man Date: 2008-04-07 03:08:18 +0200 (Mon, 07 Apr 2008) New Revision: 24850 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24850&view=rev Modified: haiku/trunk/headers/posix/unistd.h haiku/trunk/src/system/libroot/posix/unistd/conf.c Log: Add _SC_PAGE_SIZE sysconf(). Modified: haiku/trunk/headers/posix/unistd.h =================================================================== --- haiku/trunk/headers/posix/unistd.h 2008-04-06 23:40:12 UTC (rev 24849) +++ haiku/trunk/headers/posix/unistd.h 2008-04-07 01:08:18 UTC (rev 24850) @@ -59,6 +59,8 @@ #define _SC_VERSION 24 #define _SC_GETGR_R_SIZE_MAX 25 #define _SC_GETPW_R_SIZE_MAX 26 +#define _SC_PAGE_SIZE 27 +#define _SC_PAGESIZE _SC_PAGE_SIZE /* lseek() constants */ #ifndef SEEK_SET Modified: haiku/trunk/src/system/libroot/posix/unistd/conf.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/conf.c 2008-04-06 23:40:12 UTC (rev 24849) +++ haiku/trunk/src/system/libroot/posix/unistd/conf.c 2008-04-07 01:08:18 UTC (rev 24850) @@ -58,6 +58,8 @@ return MAX_GROUP_BUFFER_SIZE; case _SC_GETPW_R_SIZE_MAX: return MAX_PASSWD_BUFFER_SIZE; + case _SC_PAGE_SIZE: + return B_PAGE_SIZE; } return -1; From axeld at pinc-software.de Mon Apr 7 09:07:36 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 07 Apr 2008 09:07:36 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24846_-_in_haiku/trunk/src/apps?= =?iso-8859-15?q?=3A_=2E_activitymonitor?= In-Reply-To: Message-ID: <879953197-BeMail@zon> Hi Rene, "Rene Gollent" wrote: > On Sun, Apr 6, 2008 at 4:30 PM, axeld at BerliOS < > axeld at mail.berlios.de> wrote: > > * The beginnings of an activity monitor application. Very bare and > > feature-less > > right now, but it's already working (and shows that we better > > compute our > > system_info::cached_pages field directly). > Can you clarify what you mean by this? Is the value returned by > cached_pages not correct, or am I misunderstanding what you mean > here? What I meant is that we need to track allocations that are in fact cached data to have an accurate picture of it. The number of free pages even include the inactive pages - but those are in fact cached pages, too (they could just be reused at any time). Now, when you're using more memory, you see that the number of cached memory is reduced - which is because the computation is not correct, not because it's actually reduced in the system. Bye, Axel. From axeld at pinc-software.de Mon Apr 7 09:08:08 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 07 Apr 2008 09:08:08 +0200 CEST Subject: [Haiku-commits] r24849 - haiku/trunk/src/bin In-Reply-To: <200804062340.m36NeD16023702@sheep.berlios.de> Message-ID: <911479915-BeMail@zon> bonefish at BerliOS wrote: > Log: > Added small tool diff_zip that I used for building the latest > optional > packages. Care to elaborate what one can do with it? :-) Bye, Axel. From stippi at mail.berlios.de Mon Apr 7 11:19:57 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 7 Apr 2008 11:19:57 +0200 Subject: [Haiku-commits] r24851 - in haiku/trunk/src/apps: codycam mail packageinstaller processcontroller terminal Message-ID: <200804070919.m379JvtH025232@sheep.berlios.de> Author: stippi Date: 2008-04-07 11:19:56 +0200 (Mon, 07 Apr 2008) New Revision: 24851 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24851&view=rev Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp haiku/trunk/src/apps/codycam/VideoConsumer.cpp haiku/trunk/src/apps/mail/MailWindow.cpp haiku/trunk/src/apps/packageinstaller/PackageView.cpp haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp haiku/trunk/src/apps/processcontroller/ProcessController.cpp haiku/trunk/src/apps/terminal/TermWindow.cpp Log: Applied patch by Duane R. Bailey: * Replaced occurances of "..." by B_UTF8_ELLIPSIS in the apps folder. Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -746,7 +746,7 @@ aFrame.bottom -= kYBuffer; fFtpSetupBox = new BBox(aFrame, "Ftp Setup", B_FOLLOW_ALL, B_WILL_DRAW); - fUploadClientMenu = new BPopUpMenu("Send to..."); + fUploadClientMenu = new BPopUpMenu("Send to" B_UTF8_ELLIPSIS); for (int i = 0; kUploadClient[i]; i++) { BMessage *m = new BMessage(msg_upl_client); m->AddInt32("client", i); @@ -821,7 +821,7 @@ aFrame = fStatusBox->Bounds(); aFrame.InsetBy(kXBuffer, kYBuffer); - fStatusLine = new BStringView(aFrame, "Status Line", "Waiting ..."); + fStatusLine = new BStringView(aFrame, "Status Line", "Waiting" B_UTF8_ELLIPSIS); fStatusBox->AddChild(fStatusLine); } Modified: haiku/trunk/src/apps/codycam/VideoConsumer.cpp =================================================================== --- haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/codycam/VideoConsumer.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -647,7 +647,7 @@ { BFile* output; - UpdateFtpStatus("Capturing Image ..."); + UpdateFtpStatus("Capturing Image" B_UTF8_ELLIPSIS); /* save a local copy of the image in the requested format */ output = new BFile(); @@ -695,14 +695,14 @@ ftp->SetPassive(fPassiveFtp); // ftp the local file to our web site - UpdateFtpStatus("Logging in ..."); + UpdateFtpStatus("Logging in" B_UTF8_ELLIPSIS); if (ftp->Connect((string)fServerText, (string)fLoginText, (string)fPasswordText)) { // connect to server - UpdateFtpStatus("Connected ..."); + UpdateFtpStatus("Connected" B_UTF8_ELLIPSIS); if (ftp->ChangeDir((string)fDirectoryText)) { // cd to the desired directory - UpdateFtpStatus("Transmitting ..."); + UpdateFtpStatus("Transmitting" B_UTF8_ELLIPSIS); if (ftp->PutFile((string)filename, (string)"temp")) { // send the file to the server @@ -710,7 +710,7 @@ ftp->Chmod((string)"temp", (string)"644"); // make it world readable - UpdateFtpStatus("Renaming ..."); + UpdateFtpStatus("Renaming" B_UTF8_ELLIPSIS); if (ftp->MoveFile((string)"temp", (string)filename)) { // change to the desired name Modified: haiku/trunk/src/apps/mail/MailWindow.cpp =================================================================== --- haiku/trunk/src/apps/mail/MailWindow.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/mail/MailWindow.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -2956,7 +2956,7 @@ delete item; } - fQueryMenu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE("Edit Queries...","???..."), + fQueryMenu->AddItem(new BMenuItem(MDR_DIALECT_CHOICE("Edit Queries" B_UTF8_ELLIPSIS,"???" B_UTF8_ELLIPSIS), new BMessage(M_EDIT_QUERIES), 'E', B_SHIFT_KEY)); bool queryItemsAdded = false; Modified: haiku/trunk/src/apps/packageinstaller/PackageView.cpp =================================================================== --- haiku/trunk/src/apps/packageinstaller/PackageView.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/packageinstaller/PackageView.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -586,7 +586,7 @@ } fDestination->AddSeparatorItem(); - item = new BMenuItem("Other...", new BMessage(P_MSG_OPEN_PANEL)); + item = new BMenuItem("Other" B_UTF8_ELLIPSIS, new BMessage(P_MSG_OPEN_PANEL)); item->SetTarget(this); fDestination->AddItem(item); Modified: haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/processcontroller/KernelMemoryBarMenuItem.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -28,7 +28,7 @@ KernelMemoryBarMenuItem::KernelMemoryBarMenuItem(system_info& systemInfo) - : BMenuItem("System Resources & Caches...", NULL) + : BMenuItem("System Resources & Caches" B_UTF8_ELLIPSIS, NULL) { fLastSum = -1; fGrenze1 = -1; Modified: haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/processcontroller/NoiseBarMenuItem.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -25,7 +25,7 @@ NoiseBarMenuItem::NoiseBarMenuItem() - : BMenuItem("Gone Teams...", NULL) + : BMenuItem("Gone Teams" B_UTF8_ELLIPSIS, NULL) { fBusyWaiting = -1; fLost = -1; Modified: haiku/trunk/src/apps/processcontroller/ProcessController.cpp =================================================================== --- haiku/trunk/src/apps/processcontroller/ProcessController.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/processcontroller/ProcessController.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -260,7 +260,7 @@ if (alert->Go()) kill_team(team); } else { - alert = new BAlert("", "This team is already gone...", "Ok!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert = new BAlert("", "This team is already gone" B_UTF8_ELLIPSIS, "Ok!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->Go(); } } @@ -296,7 +296,7 @@ } #endif } else { - alert = new BAlert("", "This thread is already gone...", "Ok!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); + alert = new BAlert("", "This thread is already gone" B_UTF8_ELLIPSIS, "Ok!", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT); alert->Go(); } } Modified: haiku/trunk/src/apps/terminal/TermWindow.cpp =================================================================== --- haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/apps/terminal/TermWindow.cpp 2008-04-07 09:19:56 UTC (rev 24851) @@ -142,7 +142,7 @@ fFilemenu->AddItem(new BMenuItem("New Tab", new BMessage(kNewTab), 'T')); fFilemenu->AddSeparatorItem(); - fFilemenu->AddItem(new BMenuItem("Page Setup...", new BMessage(MENU_PAGE_SETUP))); + fFilemenu->AddItem(new BMenuItem("Page Setup" B_UTF8_ELLIPSIS, new BMessage(MENU_PAGE_SETUP))); fFilemenu->AddItem(new BMenuItem("Print", new BMessage(MENU_PRINT),'P')); fFilemenu->AddSeparatorItem(); fFilemenu->AddItem(new BMenuItem("About Terminal" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); From axeld at mail.berlios.de Mon Apr 7 12:32:14 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 7 Apr 2008 12:32:14 +0200 Subject: [Haiku-commits] r24852 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804071032.m37AWEeb002042@sheep.berlios.de> Author: axeld Date: 2008-04-07 12:32:03 +0200 (Mon, 07 Apr 2008) New Revision: 24852 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24852&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp Log: * Made super block log handling endian-safe. * Made all debugging functions endian-safe. * Added tracing for log entries. * Added new KDL command "bfs_journal" to dump all pending log entries. * When BFS_DEBUGGER_COMMANDS is defined, the LogEntry class will also track the transaction ID it belonged to. * The "bfs" KDL command now sets some useful debugger variables. * The "bfs_allocator" KDL command now accepts the group index as 3rd argument. * Renamed Journal::_TransactionListener() to _TransactionIdle(), as that's all it is for. * Removed TODO comment in Volume::WriteSuperBlock(), as it's actually not true. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-04-07 09:19:56 UTC (rev 24851) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-04-07 10:32:03 UTC (rev 24852) @@ -1412,14 +1412,16 @@ #ifdef BFS_DEBUGGER_COMMANDS - void -BlockAllocator::Dump() +BlockAllocator::Dump(int32 index) { kprintf("allocation groups: %ld\n", fNumGroups); kprintf("blocks per group: %ld\n", fBlocksPerGroup); for (int32 i = 0; i < fNumGroups; i++) { + if (index != -1 && i != index) + continue; + AllocationGroup& group = fGroups[i]; kprintf("[%3ld] num bits: %lu\n", i, group.NumBits()); @@ -1436,18 +1438,23 @@ int dump_block_allocator(int argc, char **argv) { + int32 group = -1; + if (argc == 3) { + group = parse_expression(argv[2]); + argc--; + } + if (argc != 2 || !strcmp(argv[1], "--help")) { - kprintf("usage: %s \n", argv[0]); + kprintf("usage: %s [group]\n", argv[0]); return 0; } Volume *volume = (Volume *)parse_expression(argv[1]); BlockAllocator &allocator = volume->Allocator(); - allocator.Dump(); + allocator.Dump(group); return 0; } - #endif // BFS_DEBUGGER_COMMANDS Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h 2008-04-07 09:19:56 UTC (rev 24851) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.h 2008-04-07 10:32:03 UTC (rev 24852) @@ -46,7 +46,7 @@ size_t BitmapSize() const; #ifdef BFS_DEBUGGER_COMMANDS - void Dump(); + void Dump(int32 index); #endif private: Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-04-07 09:19:56 UTC (rev 24851) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-04-07 10:32:03 UTC (rev 24852) @@ -10,6 +10,7 @@ #include "BlockAllocator.h" #include "BPlusTree.h" #include "Inode.h" +#include "Journal.h" #define Print __out @@ -36,7 +37,8 @@ void dump_block_run(const char *prefix, const block_run &run) { - Print("%s(%d, %d, %d)\n", prefix, (int)run.allocation_group, run.start, run.length); + Print("%s(%d, %d, %d)\n", prefix, (int)run.allocation_group, run.start, + run.length); } @@ -45,22 +47,33 @@ { Print("disk_super_block:\n"); Print(" name = %s\n", superBlock->name); - Print(" magic1 = %#08x (%s) %s\n", (int)superBlock->magic1, get_tupel(superBlock->magic1), (superBlock->magic1 == SUPER_BLOCK_MAGIC1 ? "valid" : "INVALID")); - Print(" fs_byte_order = %#08x (%s)\n", (int)superBlock->fs_byte_order, get_tupel(superBlock->fs_byte_order)); - Print(" block_size = %u\n", (unsigned)superBlock->block_size); - Print(" block_shift = %u\n", (unsigned)superBlock->block_shift); - Print(" num_blocks = %Lu\n", superBlock->num_blocks); - Print(" used_blocks = %Lu\n", superBlock->used_blocks); - Print(" inode_size = %u\n", (unsigned)superBlock->inode_size); - Print(" magic2 = %#08x (%s) %s\n", (int)superBlock->magic2, get_tupel(superBlock->magic2), (superBlock->magic2 == (int)SUPER_BLOCK_MAGIC2 ? "valid" : "INVALID")); - Print(" blocks_per_ag = %u\n", (unsigned)superBlock->blocks_per_ag); - Print(" ag_shift = %u (%ld bytes)\n", (unsigned)superBlock->ag_shift, 1L << superBlock->ag_shift); - Print(" num_ags = %u\n", (unsigned)superBlock->num_ags); - Print(" flags = %#08x (%s)\n", (int)superBlock->flags, get_tupel(superBlock->flags)); + Print(" magic1 = %#08x (%s) %s\n", (int)superBlock->Magic1(), + get_tupel(superBlock->magic1), + (superBlock->magic1 == SUPER_BLOCK_MAGIC1 ? "valid" : "INVALID")); + Print(" fs_byte_order = %#08x (%s)\n", (int)superBlock->fs_byte_order, + get_tupel(superBlock->fs_byte_order)); + Print(" block_size = %u\n", (unsigned)superBlock->BlockSize()); + Print(" block_shift = %u\n", (unsigned)superBlock->BlockShift()); + Print(" num_blocks = %Lu\n", superBlock->NumBlocks()); + Print(" used_blocks = %Lu\n", superBlock->UsedBlocks()); + Print(" inode_size = %u\n", (unsigned)superBlock->InodeSize()); + Print(" magic2 = %#08x (%s) %s\n", (int)superBlock->Magic2(), + get_tupel(superBlock->magic2), + (superBlock->magic2 == (int)SUPER_BLOCK_MAGIC2 ? "valid" : "INVALID")); + Print(" blocks_per_ag = %u\n", + (unsigned)superBlock->BlocksPerAllocationGroup()); + Print(" ag_shift = %u (%ld bytes)\n", + (unsigned)superBlock->AllocationGroupShift(), + 1L << superBlock->AllocationGroupShift()); + Print(" num_ags = %u\n", (unsigned)superBlock->AllocationGroups()); + Print(" flags = %#08x (%s)\n", (int)superBlock->Flags(), + get_tupel(superBlock->Flags())); dump_block_run(" log_blocks = ", superBlock->log_blocks); - Print(" log_start = %Lu\n", superBlock->log_start); - Print(" log_end = %Lu\n", superBlock->log_end); - Print(" magic3 = %#08x (%s) %s\n", (int)superBlock->magic3, get_tupel(superBlock->magic3), (superBlock->magic3 == SUPER_BLOCK_MAGIC3 ? "valid" : "INVALID")); + Print(" log_start = %Lu\n", superBlock->LogStart()); + Print(" log_end = %Lu\n", superBlock->LogEnd()); + Print(" magic3 = %#08x (%s) %s\n", (int)superBlock->Magic3(), + get_tupel(superBlock->magic3), + (superBlock->magic3 == SUPER_BLOCK_MAGIC3 ? "valid" : "INVALID")); dump_block_run(" root_dir = ", superBlock->root_dir); dump_block_run(" indices = ", superBlock->indices); } @@ -72,22 +85,25 @@ Print("data_stream:\n"); for (int i = 0; i < NUM_DIRECT_BLOCKS; i++) { if (!stream->direct[i].IsZero()) { - Print(" direct[%02d] = ",i); - dump_block_run("",stream->direct[i]); + Print(" direct[%02d] = ", i); + dump_block_run("", stream->direct[i]); } } - Print(" max_direct_range = %Lu\n", stream->max_direct_range); + Print(" max_direct_range = %Lu\n", stream->MaxDirectRange()); if (!stream->indirect.IsZero()) dump_block_run(" indirect = ", stream->indirect); - Print(" max_indirect_range = %Lu\n", stream->max_indirect_range); + Print(" max_indirect_range = %Lu\n", stream->MaxIndirectRange()); - if (!stream->double_indirect.IsZero()) - dump_block_run(" double_indirect = ", stream->double_indirect); + if (!stream->double_indirect.IsZero()) { + dump_block_run(" double_indirect = ", + stream->double_indirect); + } - Print(" max_double_indirect_range = %Lu\n", stream->max_double_indirect_range); - Print(" size = %Lu\n", stream->size); + Print(" max_double_indirect_range = %Lu\n", + stream->MaxDoubleIndirectRange()); + Print(" size = %Lu\n", stream->Size()); } @@ -95,25 +111,26 @@ dump_inode(const bfs_inode *inode) { Print("inode:\n"); - Print(" magic1 = %08x (%s) %s\n", (int)inode->magic1, - get_tupel(inode->magic1), (inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID")); + Print(" magic1 = %08x (%s) %s\n", (int)inode->Magic1(), + get_tupel(inode->magic1), + (inode->magic1 == INODE_MAGIC1 ? "valid" : "INVALID")); dump_block_run( " inode_num = ", inode->inode_num); - Print(" uid = %u\n", (unsigned)inode->uid); - Print(" gid = %u\n", (unsigned)inode->gid); - Print(" mode = %08x\n", (int)inode->mode); - Print(" flags = %08x\n", (int)inode->flags); - Print(" create_time = %Ld (%Ld)\n", inode->create_time, - inode->create_time >> INODE_TIME_SHIFT); - Print(" last_modified_time = %Ld (%Ld)\n", inode->last_modified_time, - inode->last_modified_time >> INODE_TIME_SHIFT); + Print(" uid = %u\n", (unsigned)inode->UserID()); + Print(" gid = %u\n", (unsigned)inode->GroupID()); + Print(" mode = %08x\n", (int)inode->Mode()); + Print(" flags = %08x\n", (int)inode->Flags()); + Print(" create_time = %Ld (%Ld)\n", inode->CreateTime(), + inode->CreateTime() >> INODE_TIME_SHIFT); + Print(" last_modified_time = %Ld (%Ld)\n", inode->LastModifiedTime(), + inode->LastModifiedTime() >> INODE_TIME_SHIFT); dump_block_run( " parent = ", inode->parent); dump_block_run( " attributes = ", inode->attributes); - Print(" type = %u\n", (unsigned)inode->type); - Print(" inode_size = %u\n", (unsigned)inode->inode_size); + Print(" type = %u\n", (unsigned)inode->Type()); + Print(" inode_size = %u\n", (unsigned)inode->InodeSize()); Print(" etc = %#08x\n", (int)inode->etc); Print(" short_symlink = %s\n", - S_ISLNK(inode->mode) && (inode->flags & INODE_LONG_SYMLINK) == 0 ? - inode->short_symlink : "-"); + S_ISLNK(inode->Mode()) && (inode->Flags() & INODE_LONG_SYMLINK) == 0 + ? inode->short_symlink : "-"); dump_data_stream(&(inode->data)); Print(" --\n pad[0] = %08x\n", (int)inode->pad[0]); Print(" pad[1] = %08x\n", (int)inode->pad[1]); @@ -126,14 +143,16 @@ dump_bplustree_header(const bplustree_header *header) { Print("bplustree_header:\n"); - Print(" magic = %#08x (%s) %s\n", (int)header->magic, - get_tupel(header->magic), (header->magic == BPLUSTREE_MAGIC ? "valid" : "INVALID")); - Print(" node_size = %u\n", (unsigned)header->node_size); - Print(" max_number_of_levels = %u\n", (unsigned)header->max_number_of_levels); - Print(" data_type = %u\n", (unsigned)header->data_type); - Print(" root_node_pointer = %Ld\n", header->root_node_pointer); - Print(" free_node_pointer = %Ld\n", header->free_node_pointer); - Print(" maximum_size = %Lu\n", header->maximum_size); + Print(" magic = %#08x (%s) %s\n", (int)header->Magic(), + get_tupel(header->magic), + (header->magic == BPLUSTREE_MAGIC ? "valid" : "INVALID")); + Print(" node_size = %u\n", (unsigned)header->NodeSize()); + Print(" max_number_of_levels = %u\n", + (unsigned)header->MaxNumberOfLevels()); + Print(" data_type = %u\n", (unsigned)header->DataType()); + Print(" root_node_pointer = %Ld\n", header->RootNode()); + Print(" free_node_pointer = %Ld\n", header->FreeNode()); + Print(" maximum_size = %Lu\n", header->MaximumSize()); } @@ -279,11 +298,16 @@ Volume *volume = (Volume *)parse_expression(argv[1]); - kprintf("root node: %p\n", volume->RootNode()); + kprintf("block cache: %p\n", volume->BlockCache()); + kprintf("root node: %p\n", volume->RootNode()); kprintf("indices node: %p\n", volume->IndicesNode()); dump_super_block(&volume->SuperBlock()); + set_debug_variable("_cache", (addr_t)volume->BlockCache()); + set_debug_variable("_root", (addr_t)volume->RootNode()); + set_debug_variable("_indices", (addr_t)volume->IndicesNode()); + return 0; } @@ -332,6 +356,7 @@ { remove_debugger_command("bfs_inode", dump_inode); remove_debugger_command("bfs_allocator", dump_block_allocator); + remove_debugger_command("bfs_journal", dump_journal); remove_debugger_command("bfs_btree_header", dump_bplustree_header); remove_debugger_command("bfs_btree_node", dump_bplustree_node); remove_debugger_command("bfs", dump_volume); @@ -344,6 +369,8 @@ add_debugger_command("bfs_inode", dump_inode, "dump an Inode object"); add_debugger_command("bfs_allocator", dump_block_allocator, "dump a BFS block allocator"); + add_debugger_command("bfs_journal", dump_journal, + "dump the journal log entries"); add_debugger_command("bfs_btree_header", dump_bplustree_header, "dump a BFS B+tree header"); add_debugger_command("bfs_btree_node", dump_bplustree_node, Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-07 09:19:56 UTC (rev 24851) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-07 10:32:03 UTC (rev 24852) @@ -65,15 +65,75 @@ uint32 Start() const { return fStart; } uint32 Length() const { return fLength; } +#ifdef BFS_DEBUGGER_COMMANDS + void SetTransactionID(int32 id) { fTransactionID = id; } + int32 TransactionID() const { return fTransactionID; } +#endif + Journal *GetJournal() { return fJournal; } private: Journal *fJournal; uint32 fStart; uint32 fLength; +#ifdef BFS_DEBUGGER_COMMANDS + int32 fTransactionID; +#endif }; +#if defined(BFS_TRACING) && !defined(BFS_SHELL) && !defined(_BOOT_MODE) +namespace BFSJournalTracing { + +class LogEntry : public AbstractTraceEntry { + public: + LogEntry(::LogEntry* entry, off_t logPosition, bool started) + : + fEntry(entry), +#ifdef BFS_DEBUGGER_COMMANDS + fTransactionID(entry->TransactionID()), +#endif + fStart(entry->Start()), + fLength(entry->Length()), + fLogPosition(logPosition), + fStarted(started) + { + Initialized(); + } + + virtual void AddDump(TraceOutput& out) + { +#ifdef BFS_DEBUGGER_COMMANDS + out.Print("bfs:j:%s entry %p id %ld, start %lu, length %lu, log %s " + "%lu\n", fStarted ? "Started" : "Written", fEntry, + fTransactionID, fStart, fLength, + fStarted ? "end" : "start", fLogPosition); +#else + out.Print("bfs:j:%s entry %p start %lu, length %lu, log %s %lu\n", + fStarted ? "Started" : "Written", fEntry, fStart, fLength, + fStarted ? "end" : "start", fLogPosition); +#endif + } + + private: + ::LogEntry* fEntry; +#ifdef BFS_DEBUGGER_COMMANDS + int32 fTransactionID; +#endif + uint32 fStart; + uint32 fLength; + uint32 fLogPosition; + bool fStarted; +}; + +} // namespace BFSJournalTracing + +# define T(x) new(std::nothrow) BFSJournalTracing::x; +#else +# define T(x) ; +#endif + + // #pragma mark - @@ -516,8 +576,9 @@ } PRINT(("replaying worked fine!\n")); - fVolume->SuperBlock().log_start = fVolume->LogEnd(); - fVolume->LogStart() = fVolume->LogEnd(); + fVolume->SuperBlock().log_start = HOST_ENDIAN_TO_BFS_INT64( + fVolume->LogEnd()); + fVolume->LogStart() = HOST_ENDIAN_TO_BFS_INT64(fVolume->LogEnd()); fVolume->SuperBlock().flags = SUPER_BLOCK_DISK_CLEAN; return fVolume->WriteSuperBlock(); @@ -543,20 +604,24 @@ bool update = false; // Set log_start pointer if possible... - // TODO: this is not endian safe! journal->fEntriesLock.Lock(); if (logEntry == journal->fEntries.First()) { LogEntry *next = journal->fEntries.GetNext(logEntry); - if (next != NULL) - superBlock.log_start = next->Start() % journal->fLogSize; - else - superBlock.log_start = journal->fVolume->LogEnd(); + if (next != NULL) { + superBlock.log_start = HOST_ENDIAN_TO_BFS_INT64(next->Start() + % journal->fLogSize); + } else { + superBlock.log_start = HOST_ENDIAN_TO_BFS_INT64( + journal->fVolume->LogEnd()); + } update = true; } + T(LogEntry(logEntry, superBlock.LogStart(), false)); + journal->fUsed -= logEntry->Length(); journal->fEntries.Remove(logEntry); journal->fEntriesLock.Unlock(); @@ -575,14 +640,14 @@ strerror(status))); } - journal->fVolume->LogStart() = superBlock.log_start; + journal->fVolume->LogStart() = superBlock.LogStart(); } } /*! Listens to TRANSACTION_IDLE events, and flushes the log when that happens */ /*static*/ void -Journal::_TransactionListener(int32 transactionID, int32 event, void *_journal) +Journal::_TransactionIdle(int32 transactionID, int32 event, void *_journal) { // The current transaction seems to be idle - flush it @@ -747,14 +812,20 @@ return B_NO_MEMORY; } +#ifdef BFS_DEBUGGER_COMMANDS + logEntry->SetTransactionID(fTransactionID); +#endif + // Update the log end pointer in the super block fVolume->SuperBlock().flags = SUPER_BLOCK_DISK_DIRTY; - fVolume->SuperBlock().log_end = logPosition; - fVolume->LogEnd() = logPosition; + fVolume->SuperBlock().log_end = HOST_ENDIAN_TO_BFS_INT64(logPosition); status = fVolume->WriteSuperBlock(); + fVolume->LogEnd() = logPosition; + T(LogEntry(logEntry, fVolume->LogEnd(), true)); + // We need to flush the drives own cache here to ensure // disk consistency. // If that call fails, we can't do anything about it anyway @@ -858,7 +929,7 @@ } cache_add_transaction_listener(fVolume->BlockCache(), fTransactionID, - TRANSACTION_IDLE, _TransactionListener, this); + TRANSACTION_IDLE, _TransactionIdle, this); return B_OK; } @@ -924,6 +995,48 @@ } +// #pragma mark - debugger commands + + +#ifdef BFS_DEBUGGER_COMMANDS + +void +Journal::Dump() +{ + kprintf("log start: %ld\n", fVolume->LogStart()); + kprintf("log end: %ld\n", fVolume->LogEnd()); + kprintf("entries:\n"); + kprintf(" address id start length\n"); + + LogEntryList::Iterator iterator = fEntries.GetIterator(); + + while (iterator.HasNext()) { + LogEntry *entry = iterator.Next(); + + kprintf(" %p %6ld %6lu %6lu\n", entry, entry->TransactionID(), + entry->Start(), entry->Length()); + } +} + + +int +dump_journal(int argc, char **argv) +{ + if (argc != 2 || !strcmp(argv[1], "--help")) { + kprintf("usage: %s \n", argv[0]); + return 0; + } + + Volume *volume = (Volume *)parse_expression(argv[1]); + Journal *journal = volume->GetJournal(0); + + journal->Dump(); + return 0; +} + +#endif // BFS_DEBUGGER_COMMANDS + + // #pragma mark - Transaction Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-04-07 09:19:56 UTC (rev 24851) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-04-07 10:32:03 UTC (rev 24852) @@ -50,6 +50,10 @@ inline uint32 FreeLogBlocks() const; +#ifdef BFS_DEBUGGER_COMMANDS + void Dump(); +#endif + private: bool _HasSubTransaction() { return fHasSubtransaction; } status_t _FlushLog(bool canWait, bool flushBlocks); @@ -61,7 +65,7 @@ static void _TransactionWritten(int32 transactionID, int32 event, void *_logEntry); - static void _TransactionListener(int32 transactionID, int32 event, + static void _TransactionIdle(int32 transactionID, int32 event, void *_journal); Volume *fVolume; @@ -176,4 +180,8 @@ Journal *fJournal; }; +#ifdef BFS_DEBUGGER_COMMANDS +int dump_journal(int argc, char **argv); +#endif + #endif /* JOURNAL_H */ Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2008-04-07 09:19:56 UTC (rev 24851) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Volume.cpp 2008-04-07 10:32:03 UTC (rev 24852) @@ -509,7 +509,6 @@ status_t Volume::WriteSuperBlock() { - // TODO: this assumes a block size of 512 bytes of the underlying device if (write_pos(fDevice, 512, &fSuperBlock, sizeof(disk_super_block)) != sizeof(disk_super_block)) return B_IO_ERROR; From axeld at mail.berlios.de Mon Apr 7 12:39:03 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 7 Apr 2008 12:39:03 +0200 Subject: [Haiku-commits] r24853 - haiku/trunk/src/system/kernel/cache Message-ID: <200804071039.m37Ad37F013104@sheep.berlios.de> Author: axeld Date: 2008-04-07 12:39:01 +0200 (Mon, 07 Apr 2008) New Revision: 24853 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24853&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * notify_transaction_listeners() would always remove all listeners when it was asked to. Unfortunately, it also removed the TRANSACTION_WRITTEN listeners (that were added before notifying other listeners), so that BFS could never free up space in the log. Now, it will only remove the listeners it may remove. This fixes bug #2024. * Rearranged functions a bit, moved notification/listener related private functions together. * Added tracing entry for written transactions as well. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-07 10:32:03 UTC (rev 24852) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-07 10:39:01 UTC (rev 24853) @@ -293,43 +293,23 @@ static object_cache *sBlockCache; -// #pragma mark - private transaction +// #pragma mark - notifications/listener -cache_transaction::cache_transaction() +static inline bool +is_closing_event(int32 event) { - num_blocks = 0; - main_num_blocks = 0; - sub_num_blocks = 0; - first_block = NULL; - open = true; - last_used = system_time(); + return (event & (TRANSACTION_ABORTED | TRANSACTION_ENDED)) != 0; } -static int -transaction_compare(void *_transaction, const void *_id) +static inline bool +is_written_event(int32 event) { - cache_transaction *transaction = (cache_transaction *)_transaction; - const int32 *id = (const int32 *)_id; - - return transaction->id - *id; + return (event & TRANSACTION_WRITTEN) != 0; } -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 bool get_next_pending_event(cache_notification *notification, int32 *_event) { @@ -399,25 +379,31 @@ /*! Notifies all interested listeners of this transaction about the \a event. - If requested via \a removeListeners, the listeners will be removed - afterwards. + 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, bool removeListeners) + 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(); - if (removeListeners) + 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, removeListeners); - else if (removeListeners) { + add_notification(cache, listener, event, remove); + else if (remove) { // we might need to defer the deletion if its currently in use MutexLocker locker(sNotificationsLock); if (listener->events_pending != 0) @@ -430,6 +416,59 @@ static void +flush_pending_notifications(block_cache *cache) +{ + 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); + } +} + + +static void remove_transaction_listeners(block_cache *cache, cache_transaction *transaction) { ListenerList::Iterator iterator = transaction->listeners.GetIterator(); @@ -477,6 +516,43 @@ } +// #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) { @@ -1081,9 +1157,9 @@ // Has the previous transation been finished with that write? if (--previous->num_blocks == 0) { TRACE(("cache transaction %ld finished!\n", previous->id)); + T(Action("written", cache, previous)); - notify_transaction_listeners(cache, previous, TRANSACTION_WRITTEN, - true); + notify_transaction_listeners(cache, previous, TRANSACTION_WRITTEN); if (deleteTransaction) { hash_remove(cache->transaction_hash, previous); @@ -1396,59 +1472,6 @@ } -static void -flush_pending_notifications(block_cache *cache) -{ - 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); - } -} - - static status_t block_notifier_and_writer(void *) { @@ -1504,7 +1527,7 @@ + kTransactionIdleTime) { // Transaction is open but idle notify_transaction_listeners(cache, transaction, - TRANSACTION_IDLE, false); + TRANSACTION_IDLE); } continue; } @@ -1720,6 +1743,8 @@ return B_BAD_VALUE; } + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED); + if (add_transaction_listener(cache, transaction, TRANSACTION_WRITTEN, hook, data) != B_OK) { return B_NO_MEMORY; @@ -1757,8 +1782,6 @@ } transaction->open = false; - notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); - return B_OK; } @@ -1778,7 +1801,7 @@ } T(Abort(cache, transaction)); - notify_transaction_listeners(cache, transaction, TRANSACTION_ABORTED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ABORTED); // iterate through all blocks and restore their original contents @@ -1835,15 +1858,17 @@ if (transaction == NULL) return B_NO_MEMORY; + newTransaction->id = atomic_add(&cache->next_transaction_id, 1); + T(Detach(cache, transaction, newTransaction)); + + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED); + if (add_transaction_listener(cache, transaction, TRANSACTION_WRITTEN, hook, data) != B_OK) { delete newTransaction; return B_NO_MEMORY; } - newTransaction->id = atomic_add(&cache->next_transaction_id, 1); - T(Detach(cache, transaction, newTransaction)); - // iterate through all blocks and free the unchanged original contents cached_block *block = transaction->first_block, *next, *last = NULL; @@ -1892,7 +1917,6 @@ transaction->has_sub_transaction = false; transaction->num_blocks = transaction->main_num_blocks; transaction->sub_num_blocks = 0; - notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); hash_insert_grow(cache->transaction_hash, newTransaction); cache->last_transaction = newTransaction; @@ -1918,7 +1942,7 @@ return B_BAD_VALUE; T(Abort(cache, transaction)); - notify_transaction_listeners(cache, transaction, TRANSACTION_ABORTED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ABORTED); // revert all changes back to the version of the parent @@ -1966,7 +1990,7 @@ return B_BAD_VALUE; } - notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED, true); + notify_transaction_listeners(cache, transaction, TRANSACTION_ENDED); // move all changed blocks up to the parent From stippi at mail.berlios.de Mon Apr 7 12:45:52 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 7 Apr 2008 12:45:52 +0200 Subject: [Haiku-commits] r24854 - haiku/trunk/src/preferences/network Message-ID: <200804071045.m37Ajqlw026221@sheep.berlios.de> Author: stippi Date: 2008-04-07 12:45:50 +0200 (Mon, 07 Apr 2008) New Revision: 24854 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24854&view=rev Modified: haiku/trunk/src/preferences/network/EthernetSettingsView.cpp haiku/trunk/src/preferences/network/EthernetSettingsView.h haiku/trunk/src/preferences/network/NetworkWindow.cpp Log: * Use the new layout features to build the UI, prevents problems with BMenuField being cut off. Simplifies the code a lot. * Move message constants declaration into View, since they are private. * Cleanup of EthernetSettingsView.h. Modified: haiku/trunk/src/preferences/network/EthernetSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2008-04-07 10:39:01 UTC (rev 24853) +++ haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2008-04-07 10:45:50 UTC (rev 24854) @@ -18,9 +18,13 @@ #include #include #include +#include +#include +#include +#include +#include #include #include -#include #include #include #include @@ -56,6 +60,15 @@ #include "AutoDeleter.h" +static const uint32 kMsgApply = 'aply'; +static const uint32 kMsgRevert = 'rvrt'; +static const uint32 kMsgClose = 'clse'; +static const uint32 kMsgField = 'fild'; +static const uint32 kMsgInfo = 'info'; +static const uint32 kMsgMode = 'mode'; +static const uint32 kMsgChange = 'chng'; + + static void SetupTextControl(BTextControl *control) { @@ -69,8 +82,8 @@ bool EthernetSettingsView::_PrepareRequest(struct ifreq& request, const char* name) { - //This function is used for talking direct to the stack. - //It?s used by _ShowConfiguration. + // This function is used for talking direct to the stack. + // It's used by _ShowConfiguration. if (strlen(name) > IF_NAMESIZE) return false; @@ -145,127 +158,103 @@ } -EthernetSettingsView::EthernetSettingsView(BRect frame) - : BView(frame, "EthernetSettingsView", B_FOLLOW_ALL, B_WILL_DRAW) +EthernetSettingsView::EthernetSettingsView() + : BView("EthernetSettingsView", 0, NULL) , fInterfaces() , fSettings() , fCurrentSettings(NULL) { - float inset = ceilf(be_plain_font->Size() * 0.8); - frame.OffsetTo(inset, inset); - frame.right = StringWidth("IP Address XXX.XXX.XXX.XXX") + 50; - frame.bottom = frame.top + 15; // just a starting point - BPoint spacing(0, inset); - SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - + fSocket = socket(AF_INET, SOCK_DGRAM, 0); _GatherInterfaces(); - - BPopUpMenu* devmenu = new BPopUpMenu("devices"); + + // build the GUI + BGroupLayout* rootLayout = new BGroupLayout(B_VERTICAL); + SetLayout(rootLayout); + + BGridView* controlsGroup = new BGridView(); + BGridLayout* layout = controlsGroup->GridLayout(); + + // insets + float inset = ceilf(be_plain_font->Size() * 0.7); + rootLayout->SetInsets(inset, inset, inset, inset); + rootLayout->SetSpacing(inset); + layout->SetSpacing(inset, inset); + + BPopUpMenu* deviceMenu = new BPopUpMenu("devices"); for (int32 i = 0; i < fInterfaces.CountItems(); i++) { BString& name = *fInterfaces.ItemAt(i); BString label = name; BMessage* info = new BMessage(kMsgInfo); info->AddString("interface", name.String()); BMenuItem* item = new BMenuItem(label.String(), info); - devmenu->AddItem(item); + deviceMenu->AddItem(item); } - BPopUpMenu* modemenu = new BPopUpMenu("modes"); - modemenu->AddItem(new BMenuItem("Static", new BMessage(kMsgMode))); - modemenu->AddItem(new BMenuItem("DHCP", new BMessage(kMsgMode))); - //BMenuItem* offitem = new BMenuItem("Disconnected", NULL); - //modemenu->AddItem(offitem); + BPopUpMenu* modeMenu = new BPopUpMenu("modes"); + modeMenu->AddItem(new BMenuItem("Static", new BMessage(kMsgMode))); + modeMenu->AddItem(new BMenuItem("DHCP", new BMessage(kMsgMode))); + //modeMenu->AddSeparatorItem(); + //BMenuItem* offItem = new BMenuItem("Disabled", NULL); + //modeMenu->AddItem(offItem); - fDeviceMenuField = new BMenuField(frame, "networkcards", "Adapter:", devmenu); - AddChild(fDeviceMenuField); - fDeviceMenuField->ResizeToPreferred(); + fDeviceMenuField = new BMenuField("Adapter:", deviceMenu); + layout->AddItem(fDeviceMenuField->CreateLabelLayoutItem(), 0, 0); + layout->AddItem(fDeviceMenuField->CreateMenuBarLayoutItem(), 1, 0); - fTypeMenuField = new BMenuField(frame, "type", "Mode:", modemenu); - fTypeMenuField->MoveTo(fDeviceMenuField->Frame().LeftBottom() + spacing); - AddChild(fTypeMenuField); - fTypeMenuField->ResizeToPreferred(); + fTypeMenuField = new BMenuField("Mode:", modeMenu); + layout->AddItem(fTypeMenuField->CreateLabelLayoutItem(), 0, 1); + layout->AddItem(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 1); - fIPTextControl = new BTextControl(frame, "ip", "IP Address:", "", NULL); - fIPTextControl->MoveTo(fTypeMenuField->Frame().LeftBottom() + spacing); - fIPTextControl->ResizeToPreferred(); + fIPTextControl = new BTextControl("IP Address:", "", NULL); SetupTextControl(fIPTextControl); - AddChild(fIPTextControl); - fNetMaskTextControl = new BTextControl(frame, "mask", "Netmask:", "", NULL); - fNetMaskTextControl->MoveTo( - fIPTextControl->Frame().LeftBottom() + spacing); + BLayoutItem* layoutItem = fIPTextControl->CreateTextViewLayoutItem(); + layoutItem->SetExplicitMinSize(BSize( + fIPTextControl->StringWidth("XXX.XXX.XXX.XXX") + inset, + B_SIZE_UNSET)); + + layout->AddItem(fIPTextControl->CreateLabelLayoutItem(), 0, 2); + layout->AddItem(layoutItem, 1, 2); + + fNetMaskTextControl = new BTextControl("Netmask:", "", NULL); SetupTextControl(fNetMaskTextControl); - AddChild(fNetMaskTextControl); - fNetMaskTextControl->ResizeToPreferred(); + layout->AddItem(fNetMaskTextControl->CreateLabelLayoutItem(), 0, 3); + layout->AddItem(fNetMaskTextControl->CreateTextViewLayoutItem(), 1, 3); - fGatewayTextControl = new BTextControl(frame, "gateway", "Gateway:", "", - NULL); - fGatewayTextControl->MoveTo( - fNetMaskTextControl->Frame().LeftBottom() + spacing); + fGatewayTextControl = new BTextControl("Gateway:", "", NULL); SetupTextControl(fGatewayTextControl); - AddChild(fGatewayTextControl); - fGatewayTextControl->ResizeToPreferred(); - - fPrimaryDNSTextControl = new BTextControl(frame, "dns1", "DNS #1:", "", - NULL); - fPrimaryDNSTextControl->MoveTo( - fGatewayTextControl->Frame().LeftBottom() + spacing); + layout->AddItem(fGatewayTextControl->CreateLabelLayoutItem(), 0, 4); + layout->AddItem(fGatewayTextControl->CreateTextViewLayoutItem(), 1, 4); + + // TODO: Replace the DNS text controls by a BListView with add/remove + // functionality and so on... + fPrimaryDNSTextControl = new BTextControl("DNS #1:", "", NULL); SetupTextControl(fPrimaryDNSTextControl); - AddChild(fPrimaryDNSTextControl); - fPrimaryDNSTextControl->ResizeToPreferred(); + layout->AddItem(fPrimaryDNSTextControl->CreateLabelLayoutItem(), 0, 5); + layout->AddItem(fPrimaryDNSTextControl->CreateTextViewLayoutItem(), 1, 5); - fSecondaryDNSTextControl = new BTextControl(frame, "dns2", "DNS #2:", "", - NULL); - fSecondaryDNSTextControl->MoveTo( - fPrimaryDNSTextControl->Frame().LeftBottom() + spacing); + fSecondaryDNSTextControl = new BTextControl("DNS #2:", "", NULL); SetupTextControl(fSecondaryDNSTextControl); - AddChild(fSecondaryDNSTextControl); - fSecondaryDNSTextControl->ResizeToPreferred(); + layout->AddItem(fSecondaryDNSTextControl->CreateLabelLayoutItem(), 0, 6); + layout->AddItem(fSecondaryDNSTextControl->CreateTextViewLayoutItem(), 1, 6); - fRevertButton = new BButton(frame, "revert", "Revert", - new BMessage(kMsgRevert)); - fRevertButton->ResizeToPreferred(); - fRevertButton->MoveTo( - fSecondaryDNSTextControl->Frame().LeftBottom() + spacing); + // button group (TODO: move to window, but take care of + // enabling/disabling) + BGroupView* buttonGroup = new BGroupView(B_HORIZONTAL); + + fRevertButton = new BButton("Revert", new BMessage(kMsgRevert)); fRevertButton->SetEnabled(false); - AddChild(fRevertButton); + buttonGroup->GroupLayout()->AddView(fRevertButton); - fApplyButton = new BButton(frame, "apply", "Apply", new BMessage(kMsgApply)); - fApplyButton->ResizeToPreferred(); - fApplyButton->MoveTo( - fSecondaryDNSTextControl->Frame().RightBottom() + spacing - + BPoint(-fApplyButton->Frame().Width(), 0)); - AddChild(fApplyButton); + buttonGroup->GroupLayout()->AddItem(BSpaceLayoutItem::CreateGlue()); - ResizeTo(frame.Width() + 2 * inset, fApplyButton->Frame().bottom + inset); + fApplyButton = new BButton("Apply", new BMessage(kMsgApply)); + buttonGroup->GroupLayout()->AddView(fApplyButton); - // take care of label alignment - float maxLabelWidth - = fDeviceMenuField->StringWidth(fDeviceMenuField->Label()); - maxLabelWidth = max_c(maxLabelWidth, - fTypeMenuField->StringWidth(fTypeMenuField->Label())); - maxLabelWidth = max_c(maxLabelWidth, - fIPTextControl->StringWidth(fIPTextControl->Label())); - maxLabelWidth = max_c(maxLabelWidth, - fNetMaskTextControl->StringWidth(fNetMaskTextControl->Label())); - maxLabelWidth = max_c(maxLabelWidth, - fGatewayTextControl->StringWidth(fGatewayTextControl->Label())); - maxLabelWidth = max_c(maxLabelWidth, - fPrimaryDNSTextControl->StringWidth(fPrimaryDNSTextControl->Label())); - maxLabelWidth = max_c(maxLabelWidth, - fSecondaryDNSTextControl->StringWidth( - fSecondaryDNSTextControl->Label())); - - fDeviceMenuField->SetDivider(maxLabelWidth + 8); - fTypeMenuField->SetDivider(maxLabelWidth + 8); - - fIPTextControl->SetDivider(maxLabelWidth + 8); - fNetMaskTextControl->SetDivider(maxLabelWidth + 8); - fGatewayTextControl->SetDivider(maxLabelWidth + 8); - fPrimaryDNSTextControl->SetDivider(maxLabelWidth + 8); - fSecondaryDNSTextControl->SetDivider(maxLabelWidth + 8); + rootLayout->AddView(controlsGroup); + rootLayout->AddView(buttonGroup); } EthernetSettingsView::~EthernetSettingsView() Modified: haiku/trunk/src/preferences/network/EthernetSettingsView.h =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettingsView.h 2008-04-07 10:39:01 UTC (rev 24853) +++ haiku/trunk/src/preferences/network/EthernetSettingsView.h 2008-04-07 10:45:50 UTC (rev 24854) @@ -22,52 +22,56 @@ class BTextControl; -static const uint32 kMsgApply = 'aply'; -static const uint32 kMsgRevert = 'rvrt'; -static const uint32 kMsgClose = 'clse'; -static const uint32 kMsgField = 'fild'; -static const uint32 kMsgInfo = 'info'; -static const uint32 kMsgMode = 'mode'; -static const uint32 kMsgChange = 'chng'; - - class EthernetSettingsView : public BView { - public: - EthernetSettingsView(BRect frame); - virtual ~EthernetSettingsView(); +public: + EthernetSettingsView(); + virtual ~EthernetSettingsView(); - virtual void MessageReceived(BMessage* message); - virtual void AttachedToWindow(); - virtual void DetachedFromWindow(); + virtual void MessageReceived(BMessage* message); + virtual void AttachedToWindow(); + virtual void DetachedFromWindow(); - void SaveProfile(BString profileName); - void LoadProfile(BString profileName); - private: + void SaveProfile(BString profileName); + void LoadProfile(BString profileName); + +private: + void _GatherInterfaces(); + bool _PrepareRequest(struct ifreq& request, + const char* name); + void _ShowConfiguration(Settings* settings); + void _EnableTextControls(bool enable); + void _SaveConfiguration(); + void _SaveDNSConfiguration(); + void _SaveAdaptersConfiguration(); + void _ApplyControlsToConfiguration(); + status_t _GetPath(const char* name, BPath& path); +private: - BButton* fApplyButton; - BButton* fRevertButton; - BMenuField* fDeviceMenuField; - BMenuField* fTypeMenuField; - BTextControl* fIPTextControl; - BTextControl* fNetMaskTextControl; - BTextControl* fGatewayTextControl; - BTextControl* fPrimaryDNSTextControl; - BTextControl* fSecondaryDNSTextControl; - BObjectList fInterfaces; - BObjectList fSettings; - Settings* fCurrentSettings; + BButton* fApplyButton; + BButton* fRevertButton; + // TODO: buttons should be moved to window instead - int32 fStatus; - int fSocket; - void _GatherInterfaces(); - bool _PrepareRequest(struct ifreq& request, const char* name); - void _ShowConfiguration(Settings* settings); - void _EnableTextControls(bool enable); - void _SaveConfiguration(); - void _SaveDNSConfiguration(); - void _SaveAdaptersConfiguration(); - void _ApplyControlsToConfiguration(); - status_t _GetPath(const char* name, BPath& path); + BMenuField* fDeviceMenuField; + BMenuField* fTypeMenuField; + BTextControl* fIPTextControl; + BTextControl* fNetMaskTextControl; + BTextControl* fGatewayTextControl; + + BTextControl* fPrimaryDNSTextControl; + BTextControl* fSecondaryDNSTextControl; + // TODO: DNS settings do not belong here, do they? + BObjectList fInterfaces; + // TODO: the view should not know about the interfaces, + // it should only display the given interface, move + // one level up. + BObjectList fSettings; + // TODO: the view should not know about a list + // of settings, instead it should be configured + // to a specific setting from the code one level up + Settings* fCurrentSettings; + + int32 fStatus; + int fSocket; }; #endif /* ETHERNET_SETTINGS_VIEW_H */ Modified: haiku/trunk/src/preferences/network/NetworkWindow.cpp =================================================================== --- haiku/trunk/src/preferences/network/NetworkWindow.cpp 2008-04-07 10:39:01 UTC (rev 24853) +++ haiku/trunk/src/preferences/network/NetworkWindow.cpp 2008-04-07 10:45:50 UTC (rev 24854) @@ -10,6 +10,7 @@ */ #include +#include #include "NetworkWindow.h" #include "EthernetSettingsView.h" @@ -17,13 +18,12 @@ NetworkWindow::NetworkWindow() : BWindow(BRect(50, 50, 269, 302), "Network", B_TITLED_WINDOW, - B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE) + B_NOT_RESIZABLE | B_ASYNCHRONOUS_CONTROLS | B_NOT_ZOOMABLE + | B_AUTO_UPDATE_SIZE_LIMITS) { - - fEthView = new EthernetSettingsView(Bounds()); - ResizeTo(fEthView->Frame().Width(), fEthView->Frame().Height()); - - AddChild(fEthView); + SetLayout(new BGroupLayout(B_HORIZONTAL)); + fEthView = new EthernetSettingsView(); + GetLayout()->AddView(fEthView); } @@ -31,11 +31,8 @@ NetworkWindow::MessageReceived(BMessage* message) { switch (message->what) { - case kMsgInfo: - fEthView->MessageReceived(message); - break; - default: - BWindow::MessageReceived(message); + default: + BWindow::MessageReceived(message); } } From axeld at mail.berlios.de Mon Apr 7 12:57:04 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 7 Apr 2008 12:57:04 +0200 Subject: [Haiku-commits] r24855 - in haiku/trunk: headers/posix src/system/libroot/posix/pthread Message-ID: <200804071057.m37Av4cl008154@sheep.berlios.de> Author: axeld Date: 2008-04-07 12:57:01 +0200 (Mon, 07 Apr 2008) New Revision: 24855 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24855&view=rev Modified: haiku/trunk/headers/posix/pthread.h haiku/trunk/src/system/libroot/posix/pthread/pthread.c Log: * Added pthread_setconcurrency(), and pthread_getconcurrency() functions. * Since we use a 1:1 mapping, they don't do anything besides remembering the level set, though. Modified: haiku/trunk/headers/posix/pthread.h =================================================================== --- haiku/trunk/headers/posix/pthread.h 2008-04-07 10:45:50 UTC (rev 24854) +++ haiku/trunk/headers/posix/pthread.h 2008-04-07 10:57:01 UTC (rev 24855) @@ -163,6 +163,8 @@ extern int pthread_join(pthread_t thread, void **_value); extern pthread_t pthread_self(void); extern int pthread_kill(pthread_t thread, int sig); +extern int pthread_getconcurrency(void); +extern int pthread_setconcurrency(int newLevel); extern int pthread_cancel(pthread_t thread); extern int pthread_setcancelstate(int state, int *_oldState); Modified: haiku/trunk/src/system/libroot/posix/pthread/pthread.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pthread/pthread.c 2008-04-07 10:45:50 UTC (rev 24854) +++ haiku/trunk/src/system/libroot/posix/pthread/pthread.c 2008-04-07 10:57:01 UTC (rev 24855) @@ -19,6 +19,7 @@ static int32 sPthreadSlot = -1; +static int sConcurrencyLevel; struct pthread_thread * @@ -157,3 +158,20 @@ return 0; } + +int +pthread_getconcurrency(void) +{ + return sConcurrencyLevel; +} + + +int +pthread_setconcurrency(int newLevel) +{ + if (newLevel < 0) + return EINVAL; + + sConcurrencyLevel = newLevel; + return 0; +} From axeld at mail.berlios.de Mon Apr 7 14:15:15 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 7 Apr 2008 14:15:15 +0200 Subject: [Haiku-commits] r24856 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804071215.m37CFFma031328@sheep.berlios.de> Author: axeld Date: 2008-04-07 14:15:15 +0200 (Mon, 07 Apr 2008) New Revision: 24856 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24856&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp Log: * BFS now panics if cache_sync_transaction() didn't free the space needed, instead of writing over the old log entries. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-07 10:57:01 UTC (rev 24855) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-04-07 12:15:15 UTC (rev 24856) @@ -727,8 +727,13 @@ // If necessary, flush the log, so that we have enough space for this // transaction - if (runArrays.LogEntryLength() > FreeLogBlocks()) + if (runArrays.LogEntryLength() > FreeLogBlocks()) { cache_sync_transaction(fVolume->BlockCache(), fTransactionID); + if (runArrays.LogEntryLength() > FreeLogBlocks()) { + panic("no space in log after sync (%ld for %ld blocks)!", + (long)FreeLogBlocks(), (long)runArrays.LogEntryLength()); + } + } // Write log entries to disk From axeld at pinc-software.de Mon Apr 7 16:26:41 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 07 Apr 2008 16:26:41 +0200 CEST Subject: [Haiku-commits] r24854 - haiku/trunk/src/preferences/network In-Reply-To: <200804071045.m37Ajqlw026221@sheep.berlios.de> Message-ID: <23896992697-BeMail@zon> stippi at BerliOS wrote: > + // insets > + float inset = ceilf(be_plain_font->Size() * 0.7); > + rootLayout->SetInsets(inset, inset, inset, inset); > + rootLayout->SetSpacing(inset); > + layout->SetSpacing(inset, inset); Would it be possible to have this either as default inset, or if that is not desirable (ie. if you would usually prefer 0), have a function that computes this? Probably as part of BView then? Bye, Axel. From anevilyak at gmail.com Mon Apr 7 16:33:00 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 7 Apr 2008 09:33:00 -0500 Subject: [Haiku-commits] r24846 - in haiku/trunk/src/apps: . activitymonitor In-Reply-To: <879953197-BeMail@zon> References: <879953197-BeMail@zon> Message-ID: Hi Axel, On Mon, Apr 7, 2008 at 2:07 AM, Axel D?rfler wrote: > What I meant is that we need to track allocations that are in fact > cached data to have an accurate picture of it. The number of free pages > even include the inactive pages - but those are in fact cached pages, > too (they could just be reused at any time). > Now, when you're using more memory, you see that the number of cached > memory is reduced - which is because the computation is not correct, > not because it's actually reduced in the system. So by implication what you're thinking is modifying the VM to track the number of cached pages directly if I understand right? Regards, Rene From superstippi at gmx.de Mon Apr 7 16:54:26 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 07 Apr 2008 16:54:26 +0200 Subject: [Haiku-commits] r24854 - haiku/trunk/src/preferences/network In-Reply-To: <23896992697-BeMail@zon> References: <23896992697-BeMail@zon> Message-ID: <20080407165426.22709.4@stippis2.1207552761.fake> Axel D?rfler wrote: > stippi at BerliOS wrote: > > + // insets > > + float inset = ceilf(be_plain_font->Size() * 0.7); > > + rootLayout->SetInsets(inset, inset, inset, inset); > > + rootLayout->SetSpacing(inset); > > + layout->SetSpacing(inset, inset); > > Would it be possible to have this either as default inset, or if that is > not desirable (ie. if you would usually prefer 0), have a function that > computes this? Probably as part of BView then? Good idea. Best regards, -Stephan From axeld at pinc-software.de Mon Apr 7 16:56:46 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 07 Apr 2008 16:56:46 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24846_-_in_haiku/trunk/src/apps?= =?iso-8859-15?q?=3A_=2E_activitymonitor?= In-Reply-To: Message-ID: <25701587954-BeMail@zon> Hi Rene, "Rene Gollent" wrote: > On Mon, Apr 7, 2008 at 2:07 AM, Axel D?rfler > wrote: > > What I meant is that we need to track allocations that are in fact > > cached data to have an accurate picture of it. The number of free > > pages > > even include the inactive pages - but those are in fact cached > > pages, > > too (they could just be reused at any time). > > Now, when you're using more memory, you see that the number of > > cached > > memory is reduced - which is because the computation is not > > correct, > > not because it's actually reduced in the system. > So by implication what you're thinking is modifying the VM to track > the number of cached pages directly if I understand right? Exactly. Although there are also some cases that makes it a bit hard to do right, as for example the block cache uses slabs (which are using committed memory), but is in fact mostly a cache (debatable for dirty blocks that are part of a transaction). Not high priority, but definitely something we want to get right eventually :-) Bye, Axel. From axeld at pinc-software.de Mon Apr 7 18:00:53 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 07 Apr 2008 18:00:53 +0200 CEST Subject: [Haiku-commits] r24499 - haiku/trunk/src/bin/coreutils/src In-Reply-To: <20080324154918.659.4@knochen-vm.1206366884.fake> Message-ID: <29548440565-BeMail@zon> Ingo Weinhold wrote: > On 2008-03-24 at 10:28:55 [+0100], Axel D?rfler > > wrote: > > Ingo Weinhold wrote: > > > > We'll see. I've fixed at least this problem now, but not in a > > > > way > > > > we > > > > could submit to the coreutils maintainers. > > > Pity, it would nice to get those fixes into the official version > > > (my > > > previous patch has been accepted, BTW). Any chance to revise your > > > change that it becomes acceptable? > > If you'd give me an eMail address I can bother, I see what I can do > > about that :-) > Great! would be the address to send patches > to. > Best check whether the patch applies against the head version -- get > it via > git clone git://git.sv.gnu.org/coreutils > -- and re-create the patch (git diff). It took a while, but it's finally in: http://git.savannah.gnu.org/gitweb/?p=coreutils.git;a=commitdiff;h=9982e26c12ffae9bbe96eb3ea260d680ab2584a2 9982e26c12ffae9bbe96eb3ea260d680ab2584a2 :-) Bye, Axel. From ingo_weinhold at gmx.de Mon Apr 7 19:20:46 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 07 Apr 2008 19:20:46 +0200 Subject: [Haiku-commits] r24849 - haiku/trunk/src/bin In-Reply-To: <911479915-BeMail@zon> References: <911479915-BeMail@zon> Message-ID: <20080407192046.441.2@knochen-vm.1207585941.fake> On 2008-04-07 at 09:08:08 [+0200], Axel D?rfler wrote: > bonefish at BerliOS wrote: > > Log: > > Added small tool diff_zip that I used for building the latest > > optional > > packages. > > Care to elaborate what one can do with it? :-) It zips files that have been added or changed between a given start and end point in time. For building a zip for some package those points would be before and after running "make install". For more details there are the sources. :-) CU, Ingo From ingo_weinhold at gmx.de Mon Apr 7 19:28:03 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 07 Apr 2008 19:28:03 +0200 Subject: [Haiku-commits] r24854 - haiku/trunk/src/preferences/network In-Reply-To: <23896992697-BeMail@zon> References: <23896992697-BeMail@zon> Message-ID: <20080407192803.474.3@knochen-vm.1207585941.fake> On 2008-04-07 at 16:26:41 [+0200], Axel D?rfler wrote: > stippi at BerliOS wrote: > > + // insets > > + float inset = ceilf(be_plain_font->Size() * 0.7); > > + rootLayout->SetInsets(inset, inset, inset, inset); > > + rootLayout->SetSpacing(inset); > > + layout->SetSpacing(inset, inset); > > Would it be possible to have this either as default inset, or if that > is not desirable (ie. if you would usually prefer 0), have a function > that computes this? Probably as part of BView then? I think for most views (probably all but the top view) one doesn't want insets, since the parent view will have spacing anyway. A function to compute (and cache) the above value is probably a good idea. Using it for the default spacing might make sense, too. CU, Ingo From axeld at pinc-software.de Mon Apr 7 19:45:16 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 07 Apr 2008 19:45:16 +0200 CEST Subject: [Haiku-commits] r24849 - haiku/trunk/src/bin In-Reply-To: <20080407192046.441.2@knochen-vm.1207585941.fake> Message-ID: <35811267144-BeMail@zon> Ingo Weinhold wrote: > On 2008-04-07 at 09:08:08 [+0200], Axel D?rfler > > wrote: > > bonefish at BerliOS wrote: > > > Log: > > > Added small tool diff_zip that I used for building the latest > > > optional > > > packages. > > Care to elaborate what one can do with it? :-) > It zips files that have been added or changed between a given start > and end > point in time. For building a zip for some package those points would > be > before and after running "make install". For more details there are > the > sources. :-) I guess you don't have to call it twice, but it is required to run all the time? (so if you need more than a day to work on something, you can't turn off your system?) :-) Bye, Axel. From laplace at mail.berlios.de Mon Apr 7 21:04:08 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Mon, 7 Apr 2008 21:04:08 +0200 Subject: [Haiku-commits] r24857 - haiku/trunk/src/preferences/print Message-ID: <200804071904.m37J48rc007369@sheep.berlios.de> Author: laplace Date: 2008-04-07 21:04:07 +0200 (Mon, 07 Apr 2008) New Revision: 24857 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24857&view=rev Modified: haiku/trunk/src/preferences/print/PrintersWindow.cpp Log: Applied patch for ticket #2042 by Philippe Saint-Pierre: List box was overlapping the label of the list box. Modified: haiku/trunk/src/preferences/print/PrintersWindow.cpp =================================================================== --- haiku/trunk/src/preferences/print/PrintersWindow.cpp 2008-04-07 12:15:15 UTC (rev 24856) +++ haiku/trunk/src/preferences/print/PrintersWindow.cpp 2008-04-07 19:04:07 UTC (rev 24857) @@ -194,15 +194,15 @@ // Resize all buttons to maximum width and align them to the right float xPos = printersBox->Bounds().Width()-boxInset-maxWidth; - addButton->MoveTo(xPos, boxInset +5); + addButton->MoveTo(xPos, boxInset +8); addButton->ResizeTo(maxWidth, addButton->Bounds().Height()); - fRemove->MoveTo(xPos, boxInset + addButton->Bounds().Height() + boxInset +5); + fRemove->MoveTo(xPos, boxInset + addButton->Bounds().Height() + boxInset +8); fRemove->ResizeTo(maxWidth, fRemove->Bounds().Height()); fMakeDefault->MoveTo(xPos, boxInset + addButton->Bounds().Height() + boxInset + fRemove->Bounds().Height() + - boxInset +5); + boxInset +8); fMakeDefault->ResizeTo(maxWidth, fMakeDefault->Bounds().Height()); // Disable all selection-based buttons @@ -210,8 +210,8 @@ fMakeDefault->SetEnabled(false); // Create listview with scroller - BRect listBounds(boxInset, boxInset+5, fMakeDefault->Frame().left - boxInset - B_V_SCROLL_BAR_WIDTH, - printersBox->Bounds().Height()-boxInset); + BRect listBounds(boxInset, boxInset+8, fMakeDefault->Frame().left - boxInset - B_V_SCROLL_BAR_WIDTH, + printersBox->Bounds().Height()-boxInset-3); fPrinterListView = new PrinterListView(listBounds); BScrollView* pscroller = new BScrollView("printer_scroller", fPrinterListView, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, false, true, B_FANCY_BORDER); @@ -243,10 +243,10 @@ // Resize all buttons to maximum width and align them to the right xPos = fJobsBox->Bounds().Width()-boxInset-maxWidth; - cancelButton->MoveTo(xPos, boxInset +5); + cancelButton->MoveTo(xPos, boxInset +8); cancelButton->ResizeTo(maxWidth, cancelButton->Bounds().Height()); - restartButton->MoveTo(xPos, boxInset + cancelButton->Bounds().Height() + boxInset +5); + restartButton->MoveTo(xPos, boxInset + cancelButton->Bounds().Height() + boxInset +8); restartButton->ResizeTo(maxWidth, restartButton->Bounds().Height()); // Disable all selection-based buttons @@ -254,8 +254,8 @@ restartButton->SetEnabled(false); // Create listview with scroller - listBounds = BRect(boxInset, boxInset+5, cancelButton->Frame().left - boxInset - B_V_SCROLL_BAR_WIDTH, - fJobsBox->Bounds().Height()-boxInset); + listBounds = BRect(boxInset, boxInset+8, cancelButton->Frame().left - boxInset - B_V_SCROLL_BAR_WIDTH, + fJobsBox->Bounds().Height()-boxInset-3); fJobListView = new JobListView(listBounds); BScrollView* jscroller = new BScrollView("jobs_scroller", fJobListView, B_FOLLOW_ALL, B_WILL_DRAW | B_FRAME_EVENTS, false, true, B_FANCY_BORDER); From mmlr at mail.berlios.de Mon Apr 7 21:24:17 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Mon, 7 Apr 2008 21:24:17 +0200 Subject: [Haiku-commits] r24858 - in haiku/trunk: headers/libs headers/os/device src/add-ons/kernel/drivers/bus/usb src/add-ons/media/media-add-ons/usb_webcam src/bin src/kits/device src/libs Message-ID: <200804071924.m37JOHGC009251@sheep.berlios.de> Author: mmlr Date: 2008-04-07 21:24:16 +0200 (Mon, 07 Apr 2008) New Revision: 24858 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24858&view=rev Added: haiku/trunk/headers/os/device/USBKit.h haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw_private.h haiku/trunk/src/kits/device/USBConfiguration.cpp haiku/trunk/src/kits/device/USBDevice.cpp haiku/trunk/src/kits/device/USBEndpoint.cpp haiku/trunk/src/kits/device/USBInterface.cpp haiku/trunk/src/kits/device/USBRoster.cpp Removed: haiku/trunk/headers/libs/usb/ haiku/trunk/src/libs/usb/ Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile haiku/trunk/src/bin/Jamfile haiku/trunk/src/kits/device/Jamfile haiku/trunk/src/libs/Jamfile Log: Integrate the USBKit into libdevice and make it public. I left the USBKit.h name, as it in fact is like a kit in the kit. It combines the different BUSB* classes as compared to SerialPort.h where there really is a 1:1 relationship between the header and the (one) class. If someone has a better fitting name please shout. Separated the usb_raw.h into usb_raw.h which defines the protocol and usb_raw_private.h which holds the internal device structure for usb_raw. This reduces the header dependencies. Hopefully cought all occurencies of USBKit.a usage (in usb_dev_info and the usb_webcam media add-on) but might have missed something that is not in the image. Copied: haiku/trunk/headers/os/device/USBKit.h (from rev 24850, haiku/trunk/headers/libs/usb/USBKit.h) Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-07 19:04:07 UTC (rev 24857) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-07 19:24:16 UTC (rev 24858) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. All rights reserved. + * Copyright 2006-2008, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -12,6 +12,7 @@ #include #include #include "usb_raw.h" +#include "usb_raw_private.h" #include "BeOSCompatibility.h" Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-07 19:04:07 UTC (rev 24857) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-07 19:24:16 UTC (rev 24858) @@ -1,5 +1,5 @@ /* - * Copyright 2006, Haiku Inc. All rights reserved. + * Copyright 2006-2008, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -9,11 +9,8 @@ #ifndef _USB_RAW_H_ #define _USB_RAW_H_ - -#include #include - typedef enum { RAW_COMMAND_GET_VERSION = 0x1000, @@ -152,18 +149,4 @@ } isochronous; } raw_command; - -typedef struct { - usb_device device; - benaphore lock; - uint32 reference_count; - - char name[32]; - void *link; - - sem_id notify; - status_t status; - size_t actual_length; -} raw_device; - #endif // _USB_RAW_H_ Copied: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw_private.h (from rev 24850, haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h) =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-07 01:08:18 UTC (rev 24850) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw_private.h 2008-04-07 19:24:16 UTC (rev 24858) @@ -0,0 +1,28 @@ +/* + * Copyright 2008, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Michael Lotz + */ + +#ifndef _USB_RAW_PRIVATE_H_ +#define _USB_RAW_PRIVATE_H_ + +#include +#include + +typedef struct { + usb_device device; + benaphore lock; + uint32 reference_count; + + char name[32]; + void *link; + + sem_id notify; + status_t status; + size_t actual_length; +} raw_device; + +#endif // _USB_RAW_PRIVATE_H_ 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 2008-04-07 19:04:07 UTC (rev 24857) +++ haiku/trunk/src/add-ons/media/media-add-ons/usb_webcam/Jamfile 2008-04-07 19:24:16 UTC (rev 24858) @@ -2,12 +2,9 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -# for USBKit.h -UseLibraryHeaders usb ; - -# Zeta has a libusb.so, we have a USBKit.a +# Zeta has a libusb.so, we have it in libdevice.so if $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { - usbKitLibraryName = USBKit.a ; + usbKitLibraryName = libdevice.so ; } else { usbKitLibraryName = usb ; } Modified: haiku/trunk/src/bin/Jamfile =================================================================== --- haiku/trunk/src/bin/Jamfile 2008-04-07 19:04:07 UTC (rev 24857) +++ haiku/trunk/src/bin/Jamfile 2008-04-07 19:24:16 UTC (rev 24858) @@ -143,10 +143,10 @@ mail.cpp : be libmail.so : $(haiku-utils_rsrc) ; -# standard commands that need libbe.so, and the USB Kit +# standard commands that need libbe.so, libdevice.so StdBinCommands usb_dev_info.cpp - : be USBKit.a : $(haiku-utils_rsrc) ; + : be libdevice.so : $(haiku-utils_rsrc) ; # standard commands that need libbe.so, libtracker.so StdBinCommands Modified: haiku/trunk/src/kits/device/Jamfile =================================================================== --- haiku/trunk/src/kits/device/Jamfile 2008-04-07 19:04:07 UTC (rev 24857) +++ haiku/trunk/src/kits/device/Jamfile 2008-04-07 19:24:16 UTC (rev 24858) @@ -1,10 +1,18 @@ SubDir HAIKU_TOP src kits device ; +# for usb_raw.h that defines the ioctl protocol used by the USB classes +UseHeaders [ FDirName $(HAIKU_TOP) src add-ons kernel drivers bus usb ] : true ; + SharedLibrary libdevice.so : A2D.cpp D2A.cpp DigitalPort.cpp Joystick.cpp SerialPort.cpp + USBConfiguration.cpp + USBDevice.cpp + USBEndpoint.cpp + USBInterface.cpp + USBRoster.cpp : be ; Copied: haiku/trunk/src/kits/device/USBConfiguration.cpp (from rev 24850, haiku/trunk/src/libs/usb/USBConfiguration.cpp) Copied: haiku/trunk/src/kits/device/USBDevice.cpp (from rev 24850, haiku/trunk/src/libs/usb/USBDevice.cpp) Copied: haiku/trunk/src/kits/device/USBEndpoint.cpp (from rev 24850, haiku/trunk/src/libs/usb/USBEndpoint.cpp) Copied: haiku/trunk/src/kits/device/USBInterface.cpp (from rev 24850, haiku/trunk/src/libs/usb/USBInterface.cpp) Copied: haiku/trunk/src/kits/device/USBRoster.cpp (from rev 24850, haiku/trunk/src/libs/usb/USBRoster.cpp) Modified: haiku/trunk/src/libs/Jamfile =================================================================== --- haiku/trunk/src/libs/Jamfile 2008-04-07 19:04:07 UTC (rev 24857) +++ haiku/trunk/src/libs/Jamfile 2008-04-07 19:24:16 UTC (rev 24858) @@ -18,6 +18,5 @@ SubInclude HAIKU_TOP src libs png ; SubInclude HAIKU_TOP src libs stdc++ ; SubInclude HAIKU_TOP src libs termcap ; -SubInclude HAIKU_TOP src libs usb ; SubInclude HAIKU_TOP src libs util ; SubInclude HAIKU_TOP src libs zlib ; From bonefish at mail.berlios.de Mon Apr 7 21:40:52 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 7 Apr 2008 21:40:52 +0200 Subject: [Haiku-commits] r24859 - haiku/trunk/src/bin Message-ID: <200804071940.m37JeqNA010986@sheep.berlios.de> Author: bonefish Date: 2008-04-07 21:40:52 +0200 (Mon, 07 Apr 2008) New Revision: 24859 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24859&view=rev Modified: haiku/trunk/src/bin/copyattr.cpp Log: * Explicitly support source paths with a leaf name "." or "..". In this case the contents of the directory shall be copied into the target directory, not the source directory itself. This is actually a feature the build system uses for installing in a directory, but I've only ever tested it under Linux and there a bug in libbe_build made it work automatically. Fixes #2036. * Removed copy and paste left-over for the "-x" and "-X" options. Modified: haiku/trunk/src/bin/copyattr.cpp =================================================================== --- haiku/trunk/src/bin/copyattr.cpp 2008-04-07 19:24:16 UTC (rev 24858) +++ haiku/trunk/src/bin/copyattr.cpp 2008-04-07 19:40:52 UTC (rev 24859) @@ -559,7 +559,32 @@ // iterate through the source files for (int i = 0; i < sourceCount; i++) { const char *sourcePath = sourcePaths[i]; + // If the destination is a directory, we usually want to copy the + // sources into it. The user might have specified a source path ending + // in "/." or "/.." however, in which case we copy the contents of the + // given directory. + bool copySourceContentsOnly = false; if (destIsDir) { + // skip trailing '/'s + int sourceLen = strlen(sourcePath); + while (sourceLen > 1 && sourcePath[sourceLen - 1] == '/') + sourceLen--; + + // find the start of the leaf name + int leafStart = sourceLen; + while (leafStart > 0 && sourcePath[leafStart - 1] != '/') + leafStart--; + + // If the path is the root directory or the leaf is "." or "..", + // we copy the contents only. + int leafLen = sourceLen - leafStart; + if (leafLen == 0 || leafLen <= 2 + && strncmp(sourcePath + leafStart, "..", leafLen) == 0) { + copySourceContentsOnly = true; + } + } + + if (destIsDir && !copySourceContentsOnly) { // construct a usable destination entry path // normalize source path BPath normalizedSourcePath; @@ -640,10 +665,10 @@ || strcmp(arg, "--verbose") == 0) { parameters.verbose = true; - } else if (strcmp(arg, "-x") == 0 || strcmp(arg, "--type") == 0) { + } else if (strcmp(arg, "-x") == 0) { parameters.entry_filter.AddExcludeFilter(next_arg(argi), true); - } else if (strcmp(arg, "-X") == 0 || strcmp(arg, "--type") == 0) { + } else if (strcmp(arg, "-X") == 0) { parameters.entry_filter.AddExcludeFilter(next_arg(argi), false); } else if (strcmp(arg, "-") == 0 || strcmp(arg, "--") == 0) { From bonefish at mail.berlios.de Mon Apr 7 21:41:50 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 7 Apr 2008 21:41:50 +0200 Subject: [Haiku-commits] r24860 - in haiku/trunk/src: build/libbe/storage kits/storage Message-ID: <200804071941.m37Jfon7011130@sheep.berlios.de> Author: bonefish Date: 2008-04-07 21:41:49 +0200 (Mon, 07 Apr 2008) New Revision: 24860 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24860&view=rev Modified: haiku/trunk/src/build/libbe/storage/Entry.cpp haiku/trunk/src/kits/storage/Entry.cpp Log: If the entry leaf name is "." or ".." we need to resolve it. Modified: haiku/trunk/src/build/libbe/storage/Entry.cpp =================================================================== --- haiku/trunk/src/build/libbe/storage/Entry.cpp 2008-04-07 19:40:52 UTC (rev 24859) +++ haiku/trunk/src/build/libbe/storage/Entry.cpp 2008-04-07 19:41:49 UTC (rev 24860) @@ -899,6 +899,16 @@ return dirFD; fdCloser.SetTo(dirFD); } + } else if (strcmp(leafName, ".") == 0 + || strcmp(leafName, "..") == 0) { + // We have to resolve this to get the entry name. Just open + // the dir and let the next iteration deal with it. + dirFD = _kern_open_dir(-1, path); + if (dirFD < 0) + return dirFD; + fdCloser.SetTo(dirFD); + path = NULL; + continue; } else { int parentFD = _kern_open_dir(dirFD, dirPath); if (parentFD < 0) Modified: haiku/trunk/src/kits/storage/Entry.cpp =================================================================== --- haiku/trunk/src/kits/storage/Entry.cpp 2008-04-07 19:40:52 UTC (rev 24859) +++ haiku/trunk/src/kits/storage/Entry.cpp 2008-04-07 19:41:49 UTC (rev 24860) @@ -901,6 +901,16 @@ return dirFD; fdCloser.SetTo(dirFD); } + } else if (strcmp(leafName, ".") == 0 + || strcmp(leafName, "..") == 0) { + // We have to resolve this to get the entry name. Just open + // the dir and let the next iteration deal with it. + dirFD = _kern_open_dir(-1, path); + if (dirFD < 0) + return dirFD; + fdCloser.SetTo(dirFD); + path = NULL; + continue; } else { int parentFD = _kern_open_dir(dirFD, dirPath); if (parentFD < 0) From ingo_weinhold at gmx.de Mon Apr 7 22:00:53 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 07 Apr 2008 22:00:53 +0200 Subject: [Haiku-commits] r24849 - haiku/trunk/src/bin In-Reply-To: <35811267144-BeMail@zon> References: <35811267144-BeMail@zon> Message-ID: <20080407220053.643.3@knochen-vm.1207591953.fake> On 2008-04-07 at 19:45:16 [+0200], Axel D?rfler wrote: > Ingo Weinhold wrote: > > On 2008-04-07 at 09:08:08 [+0200], Axel D?rfler > > > wrote: > > > bonefish at BerliOS wrote: > > > > Log: > > > > Added small tool diff_zip that I used for building the latest > > > > optional > > > > packages. > > > Care to elaborate what one can do with it? :-) > > It zips files that have been added or changed between a given start > > and end > > point in time. For building a zip for some package those points would > > be > > before and after running "make install". For more details there are > > the > > sources. :-) > > I guess you don't have to call it twice, but it is required to run all > the time? Yep. > (so if you need more than a day to work on something, you > can't turn off your system?) :-) I don't know what applications you have in mind. I was merely using it for "make install", which usually is done in less than a day. ;-) CU, Ingo From mmlr at mail.berlios.de Tue Apr 8 09:53:44 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Tue, 8 Apr 2008 09:53:44 +0200 Subject: [Haiku-commits] r24861 - in haiku/trunk/src: add-ons/kernel/drivers/bus/usb kits/device Message-ID: <200804080753.m387riVn008775@sheep.berlios.de> Author: mmlr Date: 2008-04-08 09:53:43 +0200 (Tue, 08 Apr 2008) New Revision: 24861 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24861&view=rev Removed: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw_private.h Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h haiku/trunk/src/kits/device/USBConfiguration.cpp haiku/trunk/src/kits/device/USBDevice.cpp haiku/trunk/src/kits/device/USBEndpoint.cpp haiku/trunk/src/kits/device/USBInterface.cpp haiku/trunk/src/kits/device/USBRoster.cpp Log: * Prepare usb_raw.h for eventually being made public. Prefixed enums values with B_USB_* and the command union is now usb_raw_command. * Changed usb_raw and the BUSB* classes accordingly. * Moved the raw_device struct into usb_raw.cpp as suggested by Francois as it was the only thing usb_raw_private.h defined. * Removed usb_raw_private.h again because of the above. Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-07 19:41:49 UTC (rev 24860) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-08 07:53:43 UTC (rev 24861) @@ -8,14 +8,13 @@ #include #include +#include #include #include #include #include "usb_raw.h" -#include "usb_raw_private.h" #include "BeOSCompatibility.h" - //#define TRACE_USB_RAW #ifdef TRACE_USB_RAW #define TRACE(x) dprintf x @@ -23,11 +22,22 @@ #define TRACE(x) /* nothing */ #endif - #define DRIVER_NAME "usb_raw" #define DEVICE_NAME "bus/usb/raw" -#define DRIVER_VERSION 0x0015 +typedef struct { + usb_device device; + benaphore lock; + uint32 reference_count; + + char name[32]; + void *link; + + sem_id notify; + status_t status; + size_t actual_length; +} raw_device; + int32 api_version = B_CUR_DRIVER_API_VERSION; static usb_module_info *gUSBModule = NULL; static raw_device *gDeviceList = NULL; @@ -175,22 +185,22 @@ switch (status) { case B_OK: - device->status = RAW_STATUS_SUCCESS; + device->status = B_USB_RAW_STATUS_SUCCESS; break; case B_TIMED_OUT: - device->status = RAW_STATUS_TIMEOUT; + device->status = B_USB_RAW_STATUS_TIMEOUT; break; case B_CANCELED: - device->status = RAW_STATUS_ABORTED; + device->status = B_USB_RAW_STATUS_ABORTED; break; case B_DEV_CRC_ERROR: - device->status = RAW_STATUS_CRC_ERROR; + device->status = B_USB_RAW_STATUS_CRC_ERROR; break; case B_DEV_STALLED: - device->status = RAW_STATUS_STALLED; + device->status = B_USB_RAW_STATUS_STALLED; break; default: - device->status = RAW_STATUS_FAILED; + device->status = B_USB_RAW_STATUS_FAILED; break; } @@ -204,199 +214,199 @@ { TRACE((DRIVER_NAME": ioctl\n")); raw_device *device = (raw_device *)cookie; - raw_command *command = (raw_command *)buffer; + usb_raw_command *command = (usb_raw_command *)buffer; if (device->device == 0) return B_DEV_NOT_READY; switch (op) { - case RAW_COMMAND_GET_VERSION: { - command->version.status = DRIVER_VERSION; + case B_USB_RAW_COMMAND_GET_VERSION: { + command->version.status = B_USB_RAW_PROTOCOL_VERSION; return B_OK; } - case RAW_COMMAND_GET_DEVICE_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_DEVICE_DESCRIPTOR: { const usb_device_descriptor *deviceDescriptor = gUSBModule->get_device_descriptor(device->device); if (!deviceDescriptor) { - command->device.status = RAW_STATUS_ABORTED; + command->device.status = B_USB_RAW_STATUS_ABORTED; return B_OK; } memcpy(command->device.descriptor, deviceDescriptor, sizeof(usb_device_descriptor)); - command->device.status = RAW_STATUS_SUCCESS; + command->device.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->config.config_index); if (!configurationInfo) { - command->config.status = RAW_STATUS_INVALID_CONFIGURATION; + command->config.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } memcpy(command->config.descriptor, configurationInfo->descr, sizeof(usb_configuration_descriptor)); - command->config.status = RAW_STATUS_SUCCESS; + command->config.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_GET_INTERFACE_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->interface.config_index); if (!configurationInfo) { - command->interface.status = RAW_STATUS_INVALID_CONFIGURATION; + command->interface.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (command->interface.interface_index >= configurationInfo->interface_count) { - command->interface.status = RAW_STATUS_INVALID_INTERFACE; + command->interface.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } const usb_interface_info *interfaceInfo = configurationInfo->interface[command->interface.interface_index].active; if (!interfaceInfo) { - command->interface.status = RAW_STATUS_ABORTED; + command->interface.status = B_USB_RAW_STATUS_ABORTED; return B_OK; } memcpy(command->interface.descriptor, interfaceInfo->descr, sizeof(usb_interface_descriptor)); - command->interface.status = RAW_STATUS_SUCCESS; + command->interface.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_GET_ALT_INTERFACE_COUNT: { + case B_USB_RAW_COMMAND_GET_ALT_INTERFACE_COUNT: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->alternate.config_index); if (!configurationInfo) { - command->alternate.status = RAW_STATUS_INVALID_CONFIGURATION; + command->alternate.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (command->alternate.interface_index >= configurationInfo->interface_count) { - command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } *command->alternate.alternate_count = configurationInfo->interface[command->alternate.interface_index].alt_count; - command->alternate.status = RAW_STATUS_SUCCESS; + command->alternate.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->alternate.config_index); if (!configurationInfo) { - command->alternate.status = RAW_STATUS_INVALID_CONFIGURATION; + command->alternate.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (command->alternate.interface_index >= configurationInfo->interface_count) { - command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } const usb_interface_list *interfaceList = &configurationInfo->interface[command->alternate.interface_index]; if (command->alternate.alternate_index >= interfaceList->alt_count) { - command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } memcpy(command->alternate.descriptor, &interfaceList->alt[command->alternate.alternate_index], sizeof(usb_interface_descriptor)); - command->alternate.status = RAW_STATUS_SUCCESS; + command->alternate.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->endpoint.config_index); if (!configurationInfo) { - command->endpoint.status = RAW_STATUS_INVALID_CONFIGURATION; + command->endpoint.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (command->endpoint.interface_index >= configurationInfo->interface_count) { - command->endpoint.status = RAW_STATUS_INVALID_INTERFACE; + command->endpoint.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } const usb_interface_info *interfaceInfo = configurationInfo->interface[command->endpoint.interface_index].active; if (!interfaceInfo) { - command->endpoint.status = RAW_STATUS_ABORTED; + command->endpoint.status = B_USB_RAW_STATUS_ABORTED; return B_OK; } if (command->endpoint.endpoint_index >= interfaceInfo->endpoint_count) { - command->endpoint.status = RAW_STATUS_INVALID_ENDPOINT; + command->endpoint.status = B_USB_RAW_STATUS_INVALID_ENDPOINT; return B_OK; } memcpy(command->endpoint.descriptor, interfaceInfo->endpoint[command->endpoint.endpoint_index].descr, sizeof(usb_endpoint_descriptor)); - command->endpoint.status = RAW_STATUS_SUCCESS; + command->endpoint.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_GET_GENERIC_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->generic.config_index); if (!configurationInfo) { - command->generic.status = RAW_STATUS_INVALID_CONFIGURATION; + command->generic.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (command->generic.interface_index >= configurationInfo->interface_count) { - command->generic.status = RAW_STATUS_INVALID_INTERFACE; + command->generic.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } const usb_interface_info *interfaceInfo = configurationInfo->interface[command->generic.interface_index].active; if (!interfaceInfo) { - command->generic.status = RAW_STATUS_ABORTED; + command->generic.status = B_USB_RAW_STATUS_ABORTED; return B_OK; } if (command->generic.generic_index >= interfaceInfo->generic_count) { - // ToDo: add RAW_STATUS_INVALID_GENERIC - command->generic.status = RAW_STATUS_INVALID_ENDPOINT; + // ToDo: add B_USB_RAW_STATUS_INVALID_GENERIC + command->generic.status = B_USB_RAW_STATUS_INVALID_ENDPOINT; return B_OK; } usb_descriptor *descriptor = interfaceInfo->generic[command->generic.generic_index]; if (!descriptor) { - command->generic.status = RAW_STATUS_ABORTED; + command->generic.status = B_USB_RAW_STATUS_ABORTED; return B_OK; } if (descriptor->generic.length > command->generic.length) { - command->generic.status = RAW_STATUS_NO_MEMORY; + command->generic.status = B_USB_RAW_STATUS_NO_MEMORY; return B_OK; } memcpy(command->generic.descriptor, descriptor, descriptor->generic.length); - command->generic.status = RAW_STATUS_SUCCESS; + command->generic.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_GET_STRING_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_STRING_DESCRIPTOR: { size_t actualLength = 0; uint8 firstTwoBytes[2]; @@ -405,7 +415,7 @@ firstTwoBytes, 2, &actualLength) < B_OK || actualLength != 2 || firstTwoBytes[1] != USB_DESCRIPTOR_STRING) { - command->string.status = RAW_STATUS_ABORTED; + command->string.status = B_USB_RAW_STATUS_ABORTED; command->string.length = 0; return B_OK; } @@ -413,7 +423,7 @@ uint8 stringLength = MIN(firstTwoBytes[0], command->string.length); char *string = (char *)malloc(stringLength); if (!string) { - command->string.status = RAW_STATUS_ABORTED; + command->string.status = B_USB_RAW_STATUS_ABORTED; command->string.length = 0; return B_NO_MEMORY; } @@ -422,20 +432,20 @@ USB_DESCRIPTOR_STRING, command->string.string_index, 0, string, stringLength, &actualLength) < B_OK || actualLength != stringLength) { - command->string.status = RAW_STATUS_ABORTED; + command->string.status = B_USB_RAW_STATUS_ABORTED; command->string.length = 0; free(string); return B_OK; } memcpy(command->string.descriptor, string, stringLength); - command->string.status = RAW_STATUS_SUCCESS; + command->string.status = B_USB_RAW_STATUS_SUCCESS; command->string.length = stringLength; free(string); return B_OK; } - case RAW_COMMAND_GET_DESCRIPTOR: { + case B_USB_RAW_COMMAND_GET_DESCRIPTOR: { size_t actualLength = 0; uint8 firstTwoBytes[2]; @@ -445,7 +455,7 @@ &actualLength) < B_OK || actualLength != 2 || firstTwoBytes[1] != command->descriptor.type) { - command->descriptor.status = RAW_STATUS_ABORTED; + command->descriptor.status = B_USB_RAW_STATUS_ABORTED; command->descriptor.length = 0; return B_OK; } @@ -453,7 +463,7 @@ uint8 length = MIN(firstTwoBytes[0], command->descriptor.length); uint8 *buffer = (uint8 *)malloc(length); if (!buffer) { - command->descriptor.status = RAW_STATUS_ABORTED; + command->descriptor.status = B_USB_RAW_STATUS_ABORTED; command->descriptor.length = 0; return B_NO_MEMORY; } @@ -463,77 +473,77 @@ command->descriptor.language_id, buffer, length, &actualLength) < B_OK || actualLength != length) { - command->descriptor.status = RAW_STATUS_ABORTED; + command->descriptor.status = B_USB_RAW_STATUS_ABORTED; command->descriptor.length = 0; free(buffer); return B_OK; } memcpy(command->descriptor.data, buffer, length); - command->descriptor.status = RAW_STATUS_SUCCESS; + command->descriptor.status = B_USB_RAW_STATUS_SUCCESS; command->descriptor.length = length; free(buffer); return B_OK; } - case RAW_COMMAND_SET_CONFIGURATION: { + case B_USB_RAW_COMMAND_SET_CONFIGURATION: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->config.config_index); if (!configurationInfo) { - command->config.status = RAW_STATUS_INVALID_CONFIGURATION; + command->config.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (gUSBModule->set_configuration(device->device, configurationInfo) < B_OK) { - command->config.status = RAW_STATUS_FAILED; + command->config.status = B_USB_RAW_STATUS_FAILED; return B_OK; } - command->config.status = RAW_STATUS_SUCCESS; + command->config.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_SET_ALT_INTERFACE: { + case B_USB_RAW_COMMAND_SET_ALT_INTERFACE: { const usb_configuration_info *configurationInfo = gUSBModule->get_nth_configuration(device->device, command->alternate.config_index); if (!configurationInfo) { - command->alternate.status = RAW_STATUS_INVALID_CONFIGURATION; + command->alternate.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (command->alternate.interface_index >= configurationInfo->interface_count) { - command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } const usb_interface_list *interfaceList = &configurationInfo->interface[command->alternate.interface_index]; if (command->alternate.alternate_index >= interfaceList->alt_count) { - command->alternate.status = RAW_STATUS_INVALID_INTERFACE; + command->alternate.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } if (gUSBModule->set_alt_interface(device->device, &interfaceList->alt[command->alternate.alternate_index]) < B_OK) { - command->alternate.status = RAW_STATUS_FAILED; + command->alternate.status = B_USB_RAW_STATUS_FAILED; return B_OK; } - command->alternate.status = RAW_STATUS_SUCCESS; + command->alternate.status = B_USB_RAW_STATUS_SUCCESS; return B_OK; } - case RAW_COMMAND_CONTROL_TRANSFER: { + case B_USB_RAW_COMMAND_CONTROL_TRANSFER: { benaphore_lock(&device->lock); if (gUSBModule->queue_request(device->device, command->control.request_type, command->control.request, command->control.value, command->control.index, command->control.length, command->control.data, usb_raw_callback, device) < B_OK) { - command->control.status = RAW_STATUS_FAILED; + command->control.status = B_USB_RAW_STATUS_FAILED; command->control.length = 0; benaphore_unlock(&device->lock); return B_OK; @@ -546,48 +556,48 @@ return B_OK; } - case RAW_COMMAND_INTERRUPT_TRANSFER: - case RAW_COMMAND_BULK_TRANSFER: - case RAW_COMMAND_ISOCHRONOUS_TRANSFER: { + case B_USB_RAW_COMMAND_INTERRUPT_TRANSFER: + case B_USB_RAW_COMMAND_BULK_TRANSFER: + case B_USB_RAW_COMMAND_ISOCHRONOUS_TRANSFER: { const usb_configuration_info *configurationInfo = gUSBModule->get_configuration(device->device); if (!configurationInfo) { - command->transfer.status = RAW_STATUS_INVALID_CONFIGURATION; + command->transfer.status = B_USB_RAW_STATUS_INVALID_CONFIGURATION; return B_OK; } if (command->transfer.interface >= configurationInfo->interface_count) { - command->transfer.status = RAW_STATUS_INVALID_INTERFACE; + command->transfer.status = B_USB_RAW_STATUS_INVALID_INTERFACE; return B_OK; } const usb_interface_info *interfaceInfo = configurationInfo->interface[command->transfer.interface].active; if (!interfaceInfo) { - command->transfer.status = RAW_STATUS_ABORTED; + command->transfer.status = B_USB_RAW_STATUS_ABORTED; return B_OK; } if (command->transfer.endpoint >= interfaceInfo->endpoint_count) { - command->transfer.status = RAW_STATUS_INVALID_ENDPOINT; + command->transfer.status = B_USB_RAW_STATUS_INVALID_ENDPOINT; return B_OK; } const usb_endpoint_info *endpointInfo = &interfaceInfo->endpoint[command->transfer.endpoint]; if (!endpointInfo->handle) { - command->transfer.status = RAW_STATUS_INVALID_ENDPOINT; + command->transfer.status = B_USB_RAW_STATUS_INVALID_ENDPOINT; return B_OK; } benaphore_lock(&device->lock); status_t status; - if (op == RAW_COMMAND_INTERRUPT_TRANSFER) { + if (op == B_USB_RAW_COMMAND_INTERRUPT_TRANSFER) { status = gUSBModule->queue_interrupt(endpointInfo->handle, command->transfer.data, command->transfer.length, usb_raw_callback, device); - } else if (op == RAW_COMMAND_BULK_TRANSFER) { + } else if (op == B_USB_RAW_COMMAND_BULK_TRANSFER) { status = gUSBModule->queue_bulk(endpointInfo->handle, command->transfer.data, command->transfer.length, usb_raw_callback, device); @@ -600,7 +610,7 @@ } if (status < B_OK) { - command->transfer.status = RAW_STATUS_FAILED; + command->transfer.status = B_USB_RAW_STATUS_FAILED; command->transfer.length = 0; benaphore_unlock(&device->lock); return B_OK; Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-07 19:41:49 UTC (rev 24860) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.h 2008-04-08 07:53:43 UTC (rev 24861) @@ -1,9 +1,6 @@ /* * Copyright 2006-2008, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. - * - * Authors: - * Michael Lotz */ #ifndef _USB_RAW_H_ @@ -11,48 +8,50 @@ #include +#define B_USB_RAW_PROTOCOL_VERSION 0x0015 + typedef enum { - RAW_COMMAND_GET_VERSION = 0x1000, + B_USB_RAW_COMMAND_GET_VERSION = 0x1000, - RAW_COMMAND_GET_DEVICE_DESCRIPTOR = 0x2000, - RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, - RAW_COMMAND_GET_INTERFACE_DESCRIPTOR, - RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR, - RAW_COMMAND_GET_STRING_DESCRIPTOR, - RAW_COMMAND_GET_GENERIC_DESCRIPTOR, - RAW_COMMAND_GET_ALT_INTERFACE_COUNT, - RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR, + B_USB_RAW_COMMAND_GET_DEVICE_DESCRIPTOR = 0x2000, + B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, + B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR, + B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR, + B_USB_RAW_COMMAND_GET_STRING_DESCRIPTOR, + B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR, + B_USB_RAW_COMMAND_GET_ALT_INTERFACE_COUNT, + B_USB_RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR, - RAW_COMMAND_SET_CONFIGURATION = 0x3000, - RAW_COMMAND_SET_FEATURE, - RAW_COMMAND_CLEAR_FEATURE, - RAW_COMMAND_GET_STATUS, - RAW_COMMAND_GET_DESCRIPTOR, - RAW_COMMAND_SET_ALT_INTERFACE, + B_USB_RAW_COMMAND_SET_CONFIGURATION = 0x3000, + B_USB_RAW_COMMAND_SET_FEATURE, + B_USB_RAW_COMMAND_CLEAR_FEATURE, + B_USB_RAW_COMMAND_GET_STATUS, + B_USB_RAW_COMMAND_GET_DESCRIPTOR, + B_USB_RAW_COMMAND_SET_ALT_INTERFACE, - RAW_COMMAND_CONTROL_TRANSFER = 0x4000, - RAW_COMMAND_INTERRUPT_TRANSFER, - RAW_COMMAND_BULK_TRANSFER, - RAW_COMMAND_ISOCHRONOUS_TRANSFER -} raw_command_id; + B_USB_RAW_COMMAND_CONTROL_TRANSFER = 0x4000, + B_USB_RAW_COMMAND_INTERRUPT_TRANSFER, + B_USB_RAW_COMMAND_BULK_TRANSFER, + B_USB_RAW_COMMAND_ISOCHRONOUS_TRANSFER +} usb_raw_command_id; typedef enum { - RAW_STATUS_SUCCESS = 0, + B_USB_RAW_STATUS_SUCCESS = 0, - RAW_STATUS_FAILED, - RAW_STATUS_ABORTED, - RAW_STATUS_STALLED, - RAW_STATUS_CRC_ERROR, - RAW_STATUS_TIMEOUT, + B_USB_RAW_STATUS_FAILED, + B_USB_RAW_STATUS_ABORTED, + B_USB_RAW_STATUS_STALLED, + B_USB_RAW_STATUS_CRC_ERROR, + B_USB_RAW_STATUS_TIMEOUT, - RAW_STATUS_INVALID_CONFIGURATION, - RAW_STATUS_INVALID_INTERFACE, - RAW_STATUS_INVALID_ENDPOINT, - RAW_STATUS_INVALID_STRING, + B_USB_RAW_STATUS_INVALID_CONFIGURATION, + B_USB_RAW_STATUS_INVALID_INTERFACE, + B_USB_RAW_STATUS_INVALID_ENDPOINT, + B_USB_RAW_STATUS_INVALID_STRING, - RAW_STATUS_NO_MEMORY -} raw_command_status; + B_USB_RAW_STATUS_NO_MEMORY +} usb_raw_command_status; typedef union { @@ -147,6 +146,6 @@ usb_iso_packet_descriptor *packet_descriptors; uint32 packet_count; } isochronous; -} raw_command; +} usb_raw_command; #endif // _USB_RAW_H_ Deleted: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw_private.h Modified: haiku/trunk/src/kits/device/USBConfiguration.cpp =================================================================== --- haiku/trunk/src/kits/device/USBConfiguration.cpp 2008-04-07 19:41:49 UTC (rev 24860) +++ haiku/trunk/src/kits/device/USBConfiguration.cpp 2008-04-08 07:53:43 UTC (rev 24861) @@ -19,13 +19,12 @@ fInterfaces(NULL), fConfigurationString(NULL) { - raw_command command; + usb_raw_command command; command.config.descriptor = &fDescriptor; command.config.config_index = fIndex; - if (ioctl(fRawFD, RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, &command, sizeof(command)) - || command.config.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_CONFIGURATION_DESCRIPTOR, &command, + sizeof(command)) || command.config.status != B_USB_RAW_STATUS_SUCCESS) memset(&fDescriptor, 0, sizeof(fDescriptor)); - } fInterfaces = new BUSBInterface *[fDescriptor.number_interfaces]; for (uint32 i = 0; i < fDescriptor.number_interfaces; i++) Modified: haiku/trunk/src/kits/device/USBDevice.cpp =================================================================== --- haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-07 19:41:49 UTC (rev 24860) +++ haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-08 07:53:43 UTC (rev 24861) @@ -55,16 +55,16 @@ return B_ERROR; } - raw_command command; - if (ioctl(fRawFD, RAW_COMMAND_GET_VERSION, &command, sizeof(command)) - || command.version.status != 0x0015) { + usb_raw_command command; + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_VERSION, &command, sizeof(command)) + || command.version.status != B_USB_RAW_PROTOCOL_VERSION) { Unset(); return B_ERROR; } command.device.descriptor = &fDescriptor; - if (ioctl(fRawFD, RAW_COMMAND_GET_DEVICE_DESCRIPTOR, &command, sizeof(command)) - || command.device.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_DEVICE_DESCRIPTOR, &command, + sizeof(command)) || command.device.status != B_USB_RAW_STATUS_SUCCESS) { Unset(); return B_ERROR; } @@ -244,15 +244,14 @@ if (!descriptor) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.string.descriptor = descriptor; command.string.string_index = index; command.string.length = length; - if (ioctl(fRawFD, RAW_COMMAND_GET_STRING_DESCRIPTOR, &command, sizeof(command)) - || command.string.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_STRING_DESCRIPTOR, &command, + sizeof(command)) || command.string.status != B_USB_RAW_STATUS_SUCCESS) return 0; - } return command.string.length; } @@ -288,17 +287,16 @@ if (length > 0 && data == NULL) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.descriptor.type = type; command.descriptor.index = index; command.descriptor.language_id = languageID; command.descriptor.data = data; command.descriptor.length = length; - if (ioctl(fRawFD, RAW_COMMAND_GET_DESCRIPTOR, &command, sizeof(command)) - || command.descriptor.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_DESCRIPTOR, &command, + sizeof(command)) || command.descriptor.status != B_USB_RAW_STATUS_SUCCESS) return 0; - } return command.descriptor.length; } @@ -334,13 +332,12 @@ if (!configuration || configuration->Index() >= fDescriptor.num_configurations) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.config.config_index = configuration->Index(); - if (ioctl(fRawFD, RAW_COMMAND_SET_CONFIGURATION, &command, sizeof(command)) - || command.config.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_SET_CONFIGURATION, &command, + sizeof(command)) || command.config.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } fActiveConfiguration = configuration->Index(); return B_OK; @@ -354,7 +351,7 @@ if (length > 0 && data == NULL) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.control.request_type = requestType; command.control.request = request; command.control.value = value; @@ -362,10 +359,9 @@ command.control.length = length; command.control.data = data; - if (ioctl(fRawFD, RAW_COMMAND_CONTROL_TRANSFER, &command, sizeof(command)) - || command.control.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_CONTROL_TRANSFER, &command, + sizeof(command)) || command.control.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } return command.control.length; } Modified: haiku/trunk/src/kits/device/USBEndpoint.cpp =================================================================== --- haiku/trunk/src/kits/device/USBEndpoint.cpp 2008-04-07 19:41:49 UTC (rev 24860) +++ haiku/trunk/src/kits/device/USBEndpoint.cpp 2008-04-08 07:53:43 UTC (rev 24861) @@ -17,15 +17,14 @@ fIndex(index), fRawFD(rawFD) { - raw_command command; + usb_raw_command command; command.endpoint.descriptor = &fDescriptor; command.endpoint.config_index = fInterface->Configuration()->Index(); command.endpoint.interface_index = fInterface->Index(); command.endpoint.endpoint_index = fIndex; - if (ioctl(fRawFD, RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR, &command, sizeof(command)) - || command.config.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_ENDPOINT_DESCRIPTOR, &command, + sizeof(command)) || command.config.status != B_USB_RAW_STATUS_SUCCESS) memset(&fDescriptor, 0, sizeof(fDescriptor)); - } } @@ -132,7 +131,7 @@ if (length > 0 && data == NULL) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.control.request_type = requestType; command.control.request = request; command.control.value = value; @@ -140,10 +139,9 @@ command.control.length = length; command.control.data = data; - if (ioctl(fRawFD, RAW_COMMAND_CONTROL_TRANSFER, &command, sizeof(command)) - || command.control.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_CONTROL_TRANSFER, &command, + sizeof(command)) || command.control.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } return command.control.length; } @@ -155,16 +153,15 @@ if (length > 0 && data == NULL) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.transfer.interface = fInterface->Index(); command.transfer.endpoint = fIndex; command.transfer.data = data; command.transfer.length = length; - if (ioctl(fRawFD, RAW_COMMAND_INTERRUPT_TRANSFER, &command, sizeof(command)) - || command.transfer.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_INTERRUPT_TRANSFER, &command, + sizeof(command)) || command.transfer.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } return command.transfer.length; } @@ -176,16 +173,15 @@ if (length > 0 && data == NULL) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.transfer.interface = fInterface->Index(); command.transfer.endpoint = fIndex; command.transfer.data = data; command.transfer.length = length; - if (ioctl(fRawFD, RAW_COMMAND_BULK_TRANSFER, &command, sizeof(command)) - || command.transfer.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_BULK_TRANSFER, &command, + sizeof(command)) || command.transfer.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } return command.transfer.length; } @@ -198,7 +194,7 @@ if (length > 0 && data == NULL) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.isochronous.interface = fInterface->Index(); command.isochronous.endpoint = fIndex; command.isochronous.data = data; @@ -206,10 +202,9 @@ command.isochronous.packet_descriptors = packetDescriptors; command.isochronous.packet_count = packetCount; - if (ioctl(fRawFD, RAW_COMMAND_ISOCHRONOUS_TRANSFER, &command, sizeof(command)) - || command.isochronous.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_ISOCHRONOUS_TRANSFER, &command, + sizeof(command)) || command.isochronous.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } return command.isochronous.length; } Modified: haiku/trunk/src/kits/device/USBInterface.cpp =================================================================== --- haiku/trunk/src/kits/device/USBInterface.cpp 2008-04-07 19:41:49 UTC (rev 24860) +++ haiku/trunk/src/kits/device/USBInterface.cpp 2008-04-08 07:53:43 UTC (rev 24861) @@ -110,16 +110,15 @@ if (length > 0 && descriptor == NULL) return B_BAD_VALUE; - raw_command command; + usb_raw_command command; command.generic.descriptor = descriptor; command.generic.config_index = fConfiguration->Index(); command.generic.interface_index = fIndex; command.generic.length = length; command.generic.generic_index = index; - if (ioctl(fRawFD, RAW_COMMAND_GET_GENERIC_DESCRIPTOR, &command, sizeof(command)) - || command.generic.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_GENERIC_DESCRIPTOR, &command, + sizeof(command)) || command.generic.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } return B_OK; } @@ -146,14 +145,13 @@ BUSBInterface::CountAlternates() const { uint32 alternateCount; - raw_command command; + usb_raw_command command; command.alternate.alternate_count = &alternateCount; command.alternate.config_index = fConfiguration->Index(); command.alternate.interface_index = fIndex; - if (ioctl(fRawFD, RAW_COMMAND_GET_ALT_INTERFACE_COUNT, &command, sizeof(command)) - || command.alternate.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_ALT_INTERFACE_COUNT, &command, + sizeof(command)) || command.alternate.status != B_USB_RAW_STATUS_SUCCESS) return 1; - } return alternateCount; } @@ -167,13 +165,13 @@ if (descriptor == NULL) return NULL; - raw_command command; + usb_raw_command command; command.alternate.descriptor = descriptor; command.alternate.config_index = fConfiguration->Index(); command.alternate.interface_index = fIndex; command.alternate.alternate_index = alternateIndex; - if (ioctl(fRawFD, RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR, &command, - sizeof(command)) || command.alternate.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_ALT_INTERFACE_DESCRIPTOR, &command, + sizeof(command)) || command.alternate.status != B_USB_RAW_STATUS_SUCCESS) { delete descriptor; return NULL; } @@ -185,14 +183,13 @@ status_t BUSBInterface::SetAlternate(uint32 alternateIndex) { - raw_command command; + usb_raw_command command; command.alternate.config_index = fConfiguration->Index(); command.alternate.interface_index = fIndex; command.alternate.alternate_index = alternateIndex; - if (ioctl(fRawFD, RAW_COMMAND_SET_ALT_INTERFACE, &command, sizeof(command)) - || command.alternate.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_SET_ALT_INTERFACE, &command, + sizeof(command)) || command.alternate.status != B_USB_RAW_STATUS_SUCCESS) return B_ERROR; - } _UpdateDescriptorAndEndpoints(); return B_OK; @@ -202,14 +199,13 @@ void BUSBInterface::_UpdateDescriptorAndEndpoints() { - raw_command command; + usb_raw_command command; command.interface.descriptor = &fDescriptor; command.interface.config_index = fConfiguration->Index(); command.interface.interface_index = fIndex; - if (ioctl(fRawFD, RAW_COMMAND_GET_INTERFACE_DESCRIPTOR, &command, sizeof(command)) - || command.interface.status != RAW_STATUS_SUCCESS) { + if (ioctl(fRawFD, B_USB_RAW_COMMAND_GET_INTERFACE_DESCRIPTOR, &command, + sizeof(command)) || command.interface.status != B_USB_RAW_STATUS_SUCCESS) memset(&fDescriptor, 0, sizeof(fDescriptor)); - } if (fEndpoints) { // Delete old endpoints Modified: haiku/trunk/src/kits/device/USBRoster.cpp =================================================================== --- haiku/trunk/src/kits/device/USBRoster.cpp 2008-04-07 19:41:49 UTC (rev 24860) +++ haiku/trunk/src/kits/device/USBRoster.cpp 2008-04-08 07:53:43 UTC (rev 24861) @@ -7,7 +7,6 @@ */ #include -#include #include #include #include From stippi at mail.berlios.de Tue Apr 8 10:12:39 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 8 Apr 2008 10:12:39 +0200 Subject: [Haiku-commits] r24862 - haiku/trunk/src/servers/app Message-ID: <200804080812.m388Cdpn010560@sheep.berlios.de> Author: stippi Date: 2008-04-08 10:12:38 +0200 (Tue, 08 Apr 2008) New Revision: 24862 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24862&view=rev Modified: haiku/trunk/src/servers/app/ServerCursor.h Log: Implemented Oliver's suggested improvement to ServerCursorReference when switching cursors. There was a race condition in case the objects was used by multiple threads, in which Cursor() could return an already destroyed object. Note: This doesn't fix a real bug or anything, the change is purely forward looking in case ServerCursorReference is ever used like that. Modified: haiku/trunk/src/servers/app/ServerCursor.h =================================================================== --- haiku/trunk/src/servers/app/ServerCursor.h 2008-04-08 07:53:43 UTC (rev 24861) +++ haiku/trunk/src/servers/app/ServerCursor.h 2008-04-08 08:12:38 UTC (rev 24862) @@ -105,11 +105,12 @@ { if (fCursor == cursor) return; - if (fCursor) - fCursor->Release(); + if (cursor) + cursor->Acquire(); + ServerCursor* oldCursor = fCursor; fCursor = cursor; - if (fCursor) - fCursor->Acquire(); + if (oldCursor) + oldCursor->Release(); } ServerCursor* Cursor() const { From jackburton at mail.berlios.de Tue Apr 8 10:37:07 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Tue, 8 Apr 2008 10:37:07 +0200 Subject: [Haiku-commits] r24863 - haiku/trunk/src/kits/interface Message-ID: <200804080837.m388b7dv013296@sheep.berlios.de> Author: jackburton Date: 2008-04-08 10:37:05 +0200 (Tue, 08 Apr 2008) New Revision: 24863 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24863&view=rev Modified: haiku/trunk/src/kits/interface/PopUpMenu.cpp Log: Removed the snooze() call before tracking the popup menu. This should avoid the problem noticed by Andrea Anzani (can you check, please ?) where the tracker menu would close when moving the mouse too fast. Modified: haiku/trunk/src/kits/interface/PopUpMenu.cpp =================================================================== --- haiku/trunk/src/kits/interface/PopUpMenu.cpp 2008-04-08 08:12:38 UTC (rev 24862) +++ haiku/trunk/src/kits/interface/PopUpMenu.cpp 2008-04-08 08:37:05 UTC (rev 24863) @@ -361,9 +361,6 @@ // Show the menu's window Show(); - - // Wait some time then track the menu - snooze(50000); BMenuItem *result = Track(startOpened, _specialRect); if (result != NULL && autoInvoke) result->Invoke(); From axeld at mail.berlios.de Tue Apr 8 11:17:10 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 8 Apr 2008 11:17:10 +0200 Subject: [Haiku-commits] r24864 - haiku/trunk/headers/posix/sys Message-ID: <200804080917.m389HAll015796@sheep.berlios.de> Author: axeld Date: 2008-04-08 11:17:07 +0200 (Tue, 08 Apr 2008) New Revision: 24864 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24864&view=rev Added: haiku/trunk/headers/posix/sys/poll.h Log: Added sys/poll.h header by popular request (see ticket #2037). Added: haiku/trunk/headers/posix/sys/poll.h =================================================================== --- haiku/trunk/headers/posix/sys/poll.h 2008-04-08 08:37:05 UTC (rev 24863) +++ haiku/trunk/headers/posix/sys/poll.h 2008-04-08 09:17:07 UTC (rev 24864) @@ -0,0 +1,13 @@ +/* + * Copyright 2008, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef _SYS_POLL_H +#define _SYS_POLL_H + + +#include + // for compatibility with legacy applications + + +#endif /* _SYS_POLL_H */ From mmu_man at mail.berlios.de Tue Apr 8 17:18:19 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 8 Apr 2008 17:18:19 +0200 Subject: [Haiku-commits] r24865 - haiku/trunk/build/jam Message-ID: <200804081518.m38FIJU2015421@sheep.berlios.de> Author: mmu_man Date: 2008-04-08 17:18:19 +0200 (Tue, 08 Apr 2008) New Revision: 24865 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24865&view=rev Modified: haiku/trunk/build/jam/DocumentationRules Log: Replace spaces with tabs. Modified: haiku/trunk/build/jam/DocumentationRules =================================================================== --- haiku/trunk/build/jam/DocumentationRules 2008-04-08 09:17:07 UTC (rev 24864) +++ haiku/trunk/build/jam/DocumentationRules 2008-04-08 15:18:19 UTC (rev 24865) @@ -8,28 +8,28 @@ MakeLocate $(binary) : [ FDirName $(HAIKU_DOCUMENTATION_OBJECT_DIR) Shell_Tools ] ; - Depends $(binary) : $(source) rman ; + Depends $(binary) : $(source) rman ; LocalDepends doc_files : $(binary) ; - Man2Doc1 $(binary) : rman $(source) ; - LocalClean clean : $(binary) ; + Man2Doc1 $(binary) : rman $(source) ; + LocalClean clean : $(binary) ; } actions Man2Doc1 { - $(2[1]) -f XML "$(2[2])" > "$(1)" ; + $(2[1]) -f XML "$(2[2])" > "$(1)" ; } rule Man2Docs { - # Man2Docs ; - local source ; - for source in [ FGristFiles $(1) ] - { - local target = $(source:S=.xml) ; + # Man2Docs ; + local source ; + for source in [ FGristFiles $(1) ] + { + local target = $(source:S=.xml) ; - Man2Doc $(target) : $(source) ; - } + Man2Doc $(target) : $(source) ; + } } rule Doc2HTML From oruizdorantes at mail.berlios.de Tue Apr 8 22:02:29 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Tue, 8 Apr 2008 22:02:29 +0200 Subject: [Haiku-commits] r24866 - haiku/trunk/src/kits/bluetooth Message-ID: <200804082002.m38K2TWX005192@sheep.berlios.de> Author: oruizdorantes Date: 2008-04-08 22:02:29 +0200 (Tue, 08 Apr 2008) New Revision: 24866 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24866&view=rev Modified: haiku/trunk/src/kits/bluetooth/Jamfile Log: ObjectList is required Courtesy of candidate SoC student Adrien Destugues Modified: haiku/trunk/src/kits/bluetooth/Jamfile =================================================================== --- haiku/trunk/src/kits/bluetooth/Jamfile 2008-04-08 15:18:19 UTC (rev 24865) +++ haiku/trunk/src/kits/bluetooth/Jamfile 2008-04-08 20:02:29 UTC (rev 24866) @@ -6,7 +6,7 @@ UseHeaders [ FDirName $(HAIKU_TOP) headers os ] : true ; } -UsePrivateHeaders bluetooth ; +UsePrivateHeaders bluetooth shared ; SharedLibrary libbluetooth.so : LocalDevice.cpp From oruizdorantes at mail.berlios.de Tue Apr 8 22:39:04 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Tue, 8 Apr 2008 22:39:04 +0200 Subject: [Haiku-commits] r24867 - haiku/trunk/src/kits/bluetooth Message-ID: <200804082039.m38Kd4dM008896@sheep.berlios.de> Author: oruizdorantes Date: 2008-04-08 22:39:04 +0200 (Tue, 08 Apr 2008) New Revision: 24867 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24867&view=rev Modified: haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp Log: Added copyright Modified: haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp =================================================================== --- haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp 2008-04-08 20:02:29 UTC (rev 24866) +++ haiku/trunk/src/kits/bluetooth/RemoteDevice.cpp 2008-04-08 20:39:04 UTC (rev 24867) @@ -1,3 +1,11 @@ +/* + * Copyright 2008 Oliver Ruiz Dorantes, oliver.ruiz.dorantes_at_gmail.com + * + * All rights reserved. Distributed under the terms of the MIT License. + * + */ + + #include #include #include From bonefish at mail.berlios.de Tue Apr 8 23:14:21 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 8 Apr 2008 23:14:21 +0200 Subject: [Haiku-commits] r24868 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804082114.m38LELaW012950@sheep.berlios.de> Author: bonefish Date: 2008-04-08 23:14:21 +0200 (Tue, 08 Apr 2008) New Revision: 24868 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24868&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp Log: I broke the index dir access when changing the FS interface. 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 2008-04-08 20:39:04 UTC (rev 24867) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/kernel_interface.cpp 2008-04-08 21:14:21 UTC (rev 24868) @@ -1791,7 +1791,7 @@ fs_vnode indicesNode; indicesNode.private_node = volume->IndicesNode(); - if (indicesNode.private_node != NULL) + if (indicesNode.private_node == NULL) return B_ENTRY_NOT_FOUND; RETURN_ERROR(bfs_open_dir(_volume, &indicesNode, _cookie)); @@ -1807,7 +1807,7 @@ fs_vnode indicesNode; indicesNode.private_node = volume->IndicesNode(); - if (indicesNode.private_node != NULL) + if (indicesNode.private_node == NULL) return B_ENTRY_NOT_FOUND; RETURN_ERROR(bfs_close_dir(_volume, &indicesNode, _cookie)); @@ -1823,7 +1823,7 @@ fs_vnode indicesNode; indicesNode.private_node = volume->IndicesNode(); - if (indicesNode.private_node != NULL) + if (indicesNode.private_node == NULL) return B_ENTRY_NOT_FOUND; RETURN_ERROR(bfs_free_dir_cookie(_volume, &indicesNode, _cookie)); @@ -1839,7 +1839,7 @@ fs_vnode indicesNode; indicesNode.private_node = volume->IndicesNode(); - if (indicesNode.private_node != NULL) + if (indicesNode.private_node == NULL) return B_ENTRY_NOT_FOUND; RETURN_ERROR(bfs_rewind_dir(_volume, &indicesNode, _cookie)); @@ -1856,7 +1856,7 @@ fs_vnode indicesNode; indicesNode.private_node = volume->IndicesNode(); - if (indicesNode.private_node != NULL) + if (indicesNode.private_node == NULL) return B_ENTRY_NOT_FOUND; RETURN_ERROR(bfs_read_dir(_volume, &indicesNode, _cookie, dirent, From axeld at mail.berlios.de Wed Apr 9 12:07:35 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Apr 2008 12:07:35 +0200 Subject: [Haiku-commits] r24869 - in haiku/trunk: headers/os/interface headers/private/interface src/kits/app src/kits/game src/kits/interface Message-ID: <200804091007.m39A7ZVF000529@sheep.berlios.de> Author: axeld Date: 2008-04-09 12:07:35 +0200 (Wed, 09 Apr 2008) New Revision: 24869 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24869&view=rev Added: haiku/trunk/headers/private/interface/InterfacePrivate.h Removed: haiku/trunk/headers/private/interface/interface_misc.h Modified: haiku/trunk/headers/os/interface/InterfaceDefs.h haiku/trunk/src/kits/app/Application.cpp haiku/trunk/src/kits/game/WindowScreen.cpp haiku/trunk/src/kits/interface/InterfaceDefs.cpp Log: * Cleaned up InterfaceDefs.h, added TODO about getting rid of declaring _init_interface_kit_() in there. * Moved private get_mode_parameter() into the BPrivate namespace. * Renamed interface_misc.h to InterfacePrivate.h. * Minor other cleanup. Modified: haiku/trunk/headers/os/interface/InterfaceDefs.h =================================================================== --- haiku/trunk/headers/os/interface/InterfaceDefs.h 2008-04-08 21:14:21 UTC (rev 24868) +++ haiku/trunk/headers/os/interface/InterfaceDefs.h 2008-04-09 10:07:35 UTC (rev 24869) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2006, Haiku, Inc. + * Copyright (c) 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT license. * * Authors: @@ -34,7 +34,7 @@ #endif -// key definitions +// Key definitions struct key_info { uint32 modifiers; @@ -119,54 +119,72 @@ uint32 tilde_tables; }; +enum { + B_CONTROL_TABLE = 0x00000001, + B_OPTION_CAPS_SHIFT_TABLE = 0x00000002, + B_OPTION_CAPS_TABLE = 0x00000004, + B_OPTION_SHIFT_TABLE = 0x00000008, + B_OPTION_TABLE = 0x00000010, + B_CAPS_SHIFT_TABLE = 0x00000020, + B_CAPS_TABLE = 0x00000040, + B_SHIFT_TABLE = 0x00000080, + B_NORMAL_TABLE = 0x00000100 +}; + +// modifiers +enum { + B_SHIFT_KEY = 0x00000001, + B_COMMAND_KEY = 0x00000002, + B_CONTROL_KEY = 0x00000004, + B_CAPS_LOCK = 0x00000008, + B_SCROLL_LOCK = 0x00000010, + B_NUM_LOCK = 0x00000020, + B_OPTION_KEY = 0x00000040, + B_MENU_KEY = 0x00000080, + B_LEFT_SHIFT_KEY = 0x00000100, + B_RIGHT_SHIFT_KEY = 0x00000200, + B_LEFT_COMMAND_KEY = 0x00000400, + B_RIGHT_COMMAND_KEY = 0x00000800, + B_LEFT_CONTROL_KEY = 0x00001000, + B_RIGHT_CONTROL_KEY = 0x00002000, + B_LEFT_OPTION_KEY = 0x00004000, + B_RIGHT_OPTION_KEY = 0x00008000 +}; + + +// Mouse definitions + struct mouse_map { uint32 button[B_MAX_MOUSE_BUTTONS]; }; +enum mode_mouse { + B_NORMAL_MOUSE = 0, + B_FOCUS_FOLLOWS_MOUSE = 1, + B_WARP_MOUSE = 3, + B_INSTANT_WARP_MOUSE = 7 +}; -/*----------------------------------------------------------------*/ +// View orientation/alignment/style + enum border_style { B_PLAIN_BORDER, B_FANCY_BORDER, B_NO_BORDER }; -/*----------------------------------------------------------------*/ - enum orientation { B_HORIZONTAL, B_VERTICAL }; -/*----------------------------------------------------------------*/ - enum button_width { B_WIDTH_AS_USUAL, B_WIDTH_FROM_WIDEST, B_WIDTH_FROM_LABEL }; -/*----------------------------------------------------------------*/ - -enum join_mode { - B_ROUND_JOIN = 0, - B_MITER_JOIN, - B_BEVEL_JOIN, - B_BUTT_JOIN, - B_SQUARE_JOIN -}; - -enum cap_mode { - B_ROUND_CAP=B_ROUND_JOIN, - B_BUTT_CAP=B_BUTT_JOIN, - B_SQUARE_CAP=B_SQUARE_JOIN -}; - -const float B_DEFAULT_MITER_LIMIT = 10.0F; - -/*----------------------------------------------------------------*/ - struct scroll_bar_info { bool proportional; bool double_arrows; @@ -174,8 +192,6 @@ int32 min_knob_size; }; -/*----------------------------------------------------------------*/ - enum alignment { B_ALIGN_LEFT, B_ALIGN_RIGHT, @@ -188,9 +204,9 @@ }; enum vertical_alignment { - B_ALIGN_TOP = 0x10L, - B_ALIGN_MIDDLE = 0x20, - B_ALIGN_BOTTOM = 0x30, + B_ALIGN_TOP = 0x10L, + B_ALIGN_MIDDLE = 0x20, + B_ALIGN_BOTTOM = 0x30, B_ALIGN_VERTICAL_CENTER = B_ALIGN_MIDDLE, @@ -199,43 +215,28 @@ B_ALIGN_USE_FULL_HEIGHT = -2L }; -/*----------------------------------------------------------------*/ -enum { - B_CONTROL_TABLE = 0x00000001, - B_OPTION_CAPS_SHIFT_TABLE = 0x00000002, - B_OPTION_CAPS_TABLE = 0x00000004, - B_OPTION_SHIFT_TABLE = 0x00000008, - B_OPTION_TABLE = 0x00000010, - B_CAPS_SHIFT_TABLE = 0x00000020, - B_CAPS_TABLE = 0x00000040, - B_SHIFT_TABLE = 0x00000080, - B_NORMAL_TABLE = 0x00000100 +// Line join and cap modes + +enum join_mode { + B_ROUND_JOIN = 0, + B_MITER_JOIN, + B_BEVEL_JOIN, + B_BUTT_JOIN, + B_SQUARE_JOIN }; -/*----------------------------------------------------------------*/ - -enum { - B_SHIFT_KEY = 0x00000001, - B_COMMAND_KEY = 0x00000002, - B_CONTROL_KEY = 0x00000004, - B_CAPS_LOCK = 0x00000008, - B_SCROLL_LOCK = 0x00000010, - B_NUM_LOCK = 0x00000020, - B_OPTION_KEY = 0x00000040, - B_MENU_KEY = 0x00000080, - B_LEFT_SHIFT_KEY = 0x00000100, - B_RIGHT_SHIFT_KEY = 0x00000200, - B_LEFT_COMMAND_KEY = 0x00000400, - B_RIGHT_COMMAND_KEY = 0x00000800, - B_LEFT_CONTROL_KEY = 0x00001000, - B_RIGHT_CONTROL_KEY = 0x00002000, - B_LEFT_OPTION_KEY = 0x00004000, - B_RIGHT_OPTION_KEY = 0x00008000 +enum cap_mode { + B_ROUND_CAP = B_ROUND_JOIN, + B_BUTT_CAP = B_BUTT_JOIN, + B_SQUARE_CAP = B_SQUARE_JOIN }; -/*----------------------------------------------------------------*/ +const float B_DEFAULT_MITER_LIMIT = 10.0F; + +// Bitmap and overlay constants + enum bitmap_tiling { B_TILE_BITMAP_X = 0x00000001, B_TILE_BITMAP_Y = 0x00000002, @@ -249,67 +250,9 @@ B_OVERLAY_TRANSFER_CHANNEL = 0x00080000 }; -/*----------------------------------------------------------------*/ -status_t get_deskbar_frame(BRect *frame); +// Default UI Colors -const color_map *system_colors(); - -status_t set_screen_space(int32 index, uint32 res, - bool stick = true); - -status_t get_scroll_bar_info(scroll_bar_info *info); -status_t set_scroll_bar_info(scroll_bar_info *info); - -status_t get_mouse_type(int32 *type); -status_t set_mouse_type(int32 type); -status_t get_mouse_map(mouse_map *map); -status_t set_mouse_map(mouse_map *map); -status_t get_click_speed(bigtime_t *speed); -status_t set_click_speed(bigtime_t speed); -status_t get_mouse_speed(int32 *speed); -status_t set_mouse_speed(int32 speed); -status_t get_mouse_acceleration(int32 *speed); -status_t set_mouse_acceleration(int32 speed); - -status_t get_key_repeat_rate(int32 *rate); -status_t set_key_repeat_rate(int32 rate); -status_t get_key_repeat_delay(bigtime_t *delay); -status_t set_key_repeat_delay(bigtime_t delay); - -uint32 modifiers(); -status_t get_key_info(key_info *info); -void get_key_map(key_map **map, char **key_buffer); -status_t get_keyboard_id(uint16 *id); -void set_modifier_key(uint32 modifier, uint32 key); -void set_keyboard_locks(uint32 modifiers); - -rgb_color keyboard_navigation_color(); - -int32 count_workspaces(); -void set_workspace_count(int32 count); -int32 current_workspace(); -void activate_workspace(int32 workspace); - -bigtime_t idle_time(); - -void run_select_printer_panel(); -void run_add_printer_panel(); -void run_be_about(); - -void set_focus_follows_mouse(bool follow); -bool focus_follows_mouse(); - -enum mode_mouse { - B_NORMAL_MOUSE = 0, - B_FOCUS_FOLLOWS_MOUSE = 1, - B_WARP_MOUSE = 3, - B_INSTANT_WARP_MOUSE = 7 -}; - -void set_mouse_mode(mode_mouse mode); -mode_mouse mouse_mode(); - enum color_which { B_PANEL_BACKGROUND_COLOR = 1, B_PANEL_TEXT_COLOR = 10, @@ -350,27 +293,85 @@ B_WINDOW_INACTIVE_TEXT_COLOR = 24 }; -rgb_color ui_color(color_which which); -void set_ui_color(const color_which &which, - const rgb_color &color); -rgb_color tint_color(rgb_color color, float tint); -extern "C" status_t _init_interface_kit_(); - /* effects on standard gray level */ -const float B_LIGHTEN_MAX_TINT = 0.0F; /* 216 --> 255.0 (255) */ -const float B_LIGHTEN_2_TINT = 0.385F; /* 216 --> 240.0 (240) */ -const float B_LIGHTEN_1_TINT = 0.590F; /* 216 --> 232.0 (232) */ +// Color tinting -const float B_NO_TINT = 1.0F; /* 216 --> 216.0 (216) */ +const float B_LIGHTEN_MAX_TINT = 0.0f; // 216 --> 255.0 (255) +const float B_LIGHTEN_2_TINT = 0.385f; // 216 --> 240.0 (240) +const float B_LIGHTEN_1_TINT = 0.590f; // 216 --> 232.0 (232) -const float B_DARKEN_1_TINT = 1.147F; /* 216 --> 184.2 (184) */ -const float B_DARKEN_2_TINT = 1.295F; /* 216 --> 152.3 (152) */ -const float B_DARKEN_3_TINT = 1.407F; /* 216 --> 128.1 (128) */ -const float B_DARKEN_4_TINT = 1.555F; /* 216 --> 96.1 (96) */ -const float B_DARKEN_MAX_TINT = 2.0F; /* 216 --> 0.0 (0) */ +const float B_NO_TINT = 1.0f; // 216 --> 216.0 (216) +const float B_DARKEN_1_TINT = 1.147f; // 216 --> 184.2 (184) +const float B_DARKEN_2_TINT = 1.295f; // 216 --> 152.3 (152) +const float B_DARKEN_3_TINT = 1.407f; // 216 --> 128.1 (128) +const float B_DARKEN_4_TINT = 1.555f; // 216 --> 96.1 (96) +const float B_DARKEN_MAX_TINT = 2.0f; // 216 --> 0.0 (0) + // effects on standard gray level + const float B_DISABLED_LABEL_TINT = B_DARKEN_3_TINT; const float B_HIGHLIGHT_BACKGROUND_TINT = B_DARKEN_2_TINT; const float B_DISABLED_MARK_TINT = B_LIGHTEN_2_TINT; + +status_t get_deskbar_frame(BRect* frame); + +const color_map* system_colors(); + +status_t set_screen_space(int32 index, uint32 resolution, + bool save = true); + +status_t get_scroll_bar_info(scroll_bar_info* info); +status_t set_scroll_bar_info(scroll_bar_info* info); + +status_t get_mouse_type(int32* type); +status_t set_mouse_type(int32 type); +status_t get_mouse_map(mouse_map* map); +status_t set_mouse_map(mouse_map* map); +status_t get_click_speed(bigtime_t* speed); +status_t set_click_speed(bigtime_t speed); +status_t get_mouse_speed(int32* speed); +status_t set_mouse_speed(int32 speed); +status_t get_mouse_acceleration(int32* speed); +status_t set_mouse_acceleration(int32 speed); + +status_t get_key_repeat_rate(int32* rate); +status_t set_key_repeat_rate(int32 rate); +status_t get_key_repeat_delay(bigtime_t* delay); +status_t set_key_repeat_delay(bigtime_t delay); + +uint32 modifiers(); +status_t get_key_info(key_info* info); +void get_key_map(key_map** _map, char** _keyBuffer); +status_t get_keyboard_id(uint16* _id); +void set_modifier_key(uint32 modifier, uint32 key); +void set_keyboard_locks(uint32 modifiers); + +rgb_color keyboard_navigation_color(); + +int32 count_workspaces(); +void set_workspace_count(int32 count); +int32 current_workspace(); +void activate_workspace(int32 workspace); + +bigtime_t idle_time(); + +void run_select_printer_panel(); +void run_add_printer_panel(); +void run_be_about(); + +void set_focus_follows_mouse(bool follow); +bool focus_follows_mouse(); + +void set_mouse_mode(mode_mouse mode); +mode_mouse mouse_mode(); + +rgb_color ui_color(color_which which); +void set_ui_color(const color_which& which, const rgb_color& color); +rgb_color tint_color(rgb_color color, float tint); + +extern "C" status_t _init_interface_kit_(); + // for convenience, should be removed including the friend declarations + // in Menu.h, ... + #endif // _INTERFACE_DEFS_H Copied: haiku/trunk/headers/private/interface/InterfacePrivate.h (from rev 24864, haiku/trunk/headers/private/interface/interface_misc.h) =================================================================== --- haiku/trunk/headers/private/interface/interface_misc.h 2008-04-08 09:17:07 UTC (rev 24864) +++ haiku/trunk/headers/private/interface/InterfacePrivate.h 2008-04-09 10:07:35 UTC (rev 24869) @@ -0,0 +1,23 @@ +/* + * Copyright 2007-2008, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stefano Ceccherini + */ +#ifndef _INTERFACE_PRIVATE_H +#define _INTERFACE_PRIVATE_H + + +#include + + +namespace BPrivate { + +bool get_mode_parameter(uint32 mode, int32& width, int32& height, + uint32& colorSpace); + +} // namespace BPrivate + + +#endif // _INTERFACE_PRIVATE_H Deleted: haiku/trunk/headers/private/interface/interface_misc.h Modified: haiku/trunk/src/kits/app/Application.cpp =================================================================== --- haiku/trunk/src/kits/app/Application.cpp 2008-04-08 21:14:21 UTC (rev 24868) +++ haiku/trunk/src/kits/app/Application.cpp 2008-04-09 10:07:35 UTC (rev 24869) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -9,26 +9,22 @@ */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include + #include #include -#include -#include #include #include #include #include #include +#include #include #include #include @@ -36,14 +32,20 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include using namespace BPrivate; + BApplication *be_app = NULL; BMessenger be_app_messenger; @@ -1227,8 +1229,9 @@ if (error != B_OK) return error; - // Initialize the IK after we have set be_app because of a construction of a - // AppServerLink (which depends on be_app) nested inside the call to get_menu_info. + // Initialize the IK after we have set be_app because of a construction + // of a AppServerLink (which depends on be_app) nested inside the call + // to get_menu_info. error = _init_interface_kit_(); if (error != B_OK) return error; Modified: haiku/trunk/src/kits/game/WindowScreen.cpp =================================================================== --- haiku/trunk/src/kits/game/WindowScreen.cpp 2008-04-08 21:14:21 UTC (rev 24868) +++ haiku/trunk/src/kits/game/WindowScreen.cpp 2008-04-09 10:07:35 UTC (rev 24869) @@ -1,5 +1,5 @@ /* - * Copyright 2002-2007, Haiku. All Rights Reserved. + * Copyright 2002-2008, Haiku. All Rights Reserved. * Copyright 2002-2005, * Marcus Overhagen, * Stefano Ceccherini (stefano.ceccherini at gmail.com), @@ -10,33 +10,33 @@ */ -#include -#include -#include #include +#include #include #include #include -#include +#include +#include +#include +#include #include -#include // For IS_SET_MOUSE_POSITION -#include +#include +#include +#include #include -#include -#include using BPrivate::AppServerLink; //#define TRACE_WINDOWSCREEN 1 #if TRACE_WINDOWSCREEN -#define CALLED() printf("%s\n", __PRETTY_FUNCTION__); +# define CALLED() printf("%s\n", __PRETTY_FUNCTION__); #else -#define CALLED() ; +# define CALLED() ; #endif @@ -902,7 +902,7 @@ int32 width, height; uint32 colorSpace; - if (!get_mode_parameter(space, width, height, colorSpace)) + if (!BPrivate::get_mode_parameter(space, width, height, colorSpace)) return B_BAD_VALUE; for (uint32 i = 0; i < fModeCount; i++) { Modified: haiku/trunk/src/kits/interface/InterfaceDefs.cpp =================================================================== --- haiku/trunk/src/kits/interface/InterfaceDefs.cpp 2008-04-08 21:14:21 UTC (rev 24868) +++ haiku/trunk/src/kits/interface/InterfaceDefs.cpp 2008-04-09 10:07:35 UTC (rev 24869) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku, Inc. + * Copyright 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -8,12 +8,23 @@ * Axel D?rfler, axeld at pinc-software.de */ -/** Global functions and variables for the Interface Kit */ +/*! Global functions and variables for the Interface Kit */ -#include -#include -#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + #include #include #include @@ -23,23 +34,12 @@ #include #include #include +#include +#include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - // Private definitions not placed in public headers void _init_global_fonts_(); extern "C" status_t _fini_interface_kit_(); @@ -94,6 +94,8 @@ const rgb_color* BPrivate::kDefaultColors = &_kDefaultColors[0]; +namespace BPrivate { + /*! Fills the \a width, \a height, and \a colorSpace parameters according to the window screen's mode. @@ -190,7 +192,9 @@ return true; } +} // namespace BPrivate + const color_map * system_colors() { @@ -204,7 +208,7 @@ int32 width; int32 height; uint32 depth; - if (!get_mode_parameter(space, width, height, depth)) + if (!BPrivate::get_mode_parameter(space, width, height, depth)) return B_BAD_VALUE; BScreen screen(B_MAIN_SCREEN_ID); From axeld at mail.berlios.de Wed Apr 9 13:04:27 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Apr 2008 13:04:27 +0200 Subject: [Haiku-commits] r24870 - haiku/trunk/src/system/kernel/cache Message-ID: <200804091104.m39B4R0b020240@sheep.berlios.de> Author: axeld Date: 2008-04-09 13:04:26 +0200 (Wed, 09 Apr 2008) New Revision: 24870 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24870&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * block_cache_sync[_etc]() now also waits for all notifications to be handled. This fixes a potential problem where a volume would be left marked dirty on a clean reboot as reported by Vasilis; no harm would have been done to the data on the volume, though (it would just replay a log entry that it didn't need to). * Unified the naming of the notifier/writer thread: renamed the thread to "block notifier/writer", and the variable holding the thread ID to sNotifierWriterThread. * Added a few more doxygen descriptions to the private functions. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-09 10:07:35 UTC (rev 24869) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-04-09 11:04:26 UTC (rev 24870) @@ -31,7 +31,6 @@ // 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. @@ -287,7 +286,7 @@ static mutex sCachesLock; static sem_id sEventSemaphore; static mutex sNotificationsLock; -static thread_id sWriterNotifyThread; +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; @@ -296,6 +295,7 @@ // #pragma mark - notifications/listener +/*! Checks wether or not this is an event that closes a transaction. */ static inline bool is_closing_event(int32 event) { @@ -310,6 +310,10 @@ } +/*! 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) { @@ -329,6 +333,7 @@ } +/*! Initializes the \a notification as specified. */ static void set_notification(cache_transaction *transaction, cache_notification ¬ification, int32 events, @@ -661,7 +666,7 @@ } -//! Should be called with the cache's lock held. +/*! Should be called with the cache's lock held. */ block_cache::~block_cache() { deleting = true; @@ -871,6 +876,11 @@ // #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) { @@ -941,8 +951,7 @@ } -/*! - Retrieves the block \a blockNumber from the hash table, if it's already +/*! Retrieves the block \a blockNumber from the hash table, if it's already there, or reads it from the disk. \param _allocated tells you wether or not a new block has been allocated @@ -1002,8 +1011,7 @@ } -/*! - Returns the writable block data for the requested blockNumber. +/*! Returns the writable block data for the requested blockNumber. If \a cleared is true, the block is not read from disk; an empty block is returned. @@ -1115,6 +1123,12 @@ } +/*! Writes the specified \a block back to disk. It will always only write back + the oldest change of the block if it is part of more than one transaction. + It will automatically send out TRANSACTION_WRITTEN notices, as well as + delete transactions when they are no longer used, and \a deleteTransaction + is \c true. +*/ static status_t write_cached_block(block_cache *cache, cached_block *block, bool deleteTransaction) @@ -1178,6 +1192,7 @@ #ifdef DEBUG_BLOCK_CACHE + static void dump_block(cached_block *block) { @@ -1427,9 +1442,16 @@ return 0; } + #endif // DEBUG_BLOCK_CACHE +/*! Traverses through the block_cache list, and returns one cache after the + other. The cache returned is automatically locked when you get it, and + unlocked with the next call to this function. Ignores caches that are in + deletion state. + Returns \c NULL when the end of the list is reached. +*/ static block_cache * get_next_locked_block_cache(block_cache *last) { @@ -1472,6 +1494,10 @@ } +/*! Background thread that continuously checks for pending notifications of + all caches. + Every two seconds, it will also write back up to 64 blocks per cache. +*/ static status_t block_notifier_and_writer(void *) { @@ -1556,6 +1582,7 @@ } +/*! Notify function for wait_for_notifications(). */ static void notify_sync(int32 transactionID, int32 event, void *_cache) { @@ -1565,10 +1592,14 @@ } +/*! Waits until all pending notifications are carried out. + Safe to be called from the block writer/notifier thread. + You must not hold the \a cache lock when calling this function. +*/ static void wait_for_notifications(block_cache *cache) { - if (find_thread(NULL) == sWriterNotifyThread) { + if (find_thread(NULL) == sNotifierWriterThread) { // We're the notifier thread, don't wait, but flush all pending // notifications directly. flush_pending_notifications(cache); @@ -1608,10 +1639,10 @@ if (sEventSemaphore < B_OK) return sEventSemaphore; - sWriterNotifyThread = spawn_kernel_thread(&block_notifier_and_writer, - "block writer/notifier", B_LOW_PRIORITY, NULL); - if (sWriterNotifyThread >= B_OK) - send_signal_etc(sWriterNotifyThread, SIGCONT, B_DO_NOT_RESCHEDULE); + sNotifierWriterThread = spawn_kernel_thread(&block_notifier_and_writer, + "block notifier/writer", B_LOW_PRIORITY, NULL); + if (sNotifierWriterThread >= B_OK) + send_signal_etc(sNotifierWriterThread, SIGCONT, B_DO_NOT_RESCHEDULE); #ifdef DEBUG_BLOCK_CACHE add_debugger_command_etc("block_caches", &dump_caches, @@ -2229,6 +2260,11 @@ } hash_close(cache->hash, &iterator, false); + locker.Unlock(); + + wait_for_notifications(cache); + // make sure that all pending TRANSACTION_WRITTEN notifications + // are handled after we return return B_OK; } @@ -2265,6 +2301,11 @@ } } + locker.Unlock(); + + wait_for_notifications(cache); + // make sure that all pending TRANSACTION_WRITTEN notifications + // are handled after we return return B_OK; } @@ -2359,8 +2400,7 @@ } -/*! - Changes the internal status of a writable block to \a dirty. This can be +/*! Changes the internal status of a writable block to \a dirty. This can be helpful in case you realize you don't need to change that block anymore for whatever reason. From axeld at mail.berlios.de Wed Apr 9 16:21:07 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Apr 2008 16:21:07 +0200 Subject: [Haiku-commits] r24871 - in haiku/trunk: headers/os/drivers src/system/kernel src/system/kernel/fs Message-ID: <200804091421.m39EL7VE016362@sheep.berlios.de> Author: axeld Date: 2008-04-09 16:21:06 +0200 (Wed, 09 Apr 2008) New Revision: 24871 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24871&view=rev Modified: haiku/trunk/headers/os/drivers/KernelExport.h haiku/trunk/src/system/kernel/fs/vfs.cpp haiku/trunk/src/system/kernel/sem.cpp haiku/trunk/src/system/kernel/signal.cpp haiku/trunk/src/system/kernel/timer.c Log: * Cleaned up KernelExport.h completely, removed deprecated and non implemented API, uses the _PRINTFLIKE macro where appropriate. * Got rid of the "qent" structure, struct timer now contains everything we need. This makes the affected code in sem.cpp, signal.cpp, and timer.c much cleaner, and resolves a few TODOs. * Minor cleanup in vfs.cpp. Modified: haiku/trunk/headers/os/drivers/KernelExport.h =================================================================== --- haiku/trunk/headers/os/drivers/KernelExport.h 2008-04-09 11:04:26 UTC (rev 24870) +++ haiku/trunk/headers/os/drivers/KernelExport.h 2008-04-09 14:21:06 UTC (rev 24871) @@ -1,6 +1,5 @@ -/* Kernel only exports for kernel add-ons - * - * Copyright 2005, Haiku Inc. All Rights Reserved. +/* + * Copyright 2005-2008, Haiku Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _KERNEL_EXPORT_H @@ -11,31 +10,11 @@ #include -#ifdef __cplusplus -extern "C" { -#endif - -/*-------------------------------------------------------------*/ /* interrupts and spinlocks */ -/* disable/restore interrupts on the current CPU */ - typedef ulong cpu_status; - -extern cpu_status disable_interrupts(void); -extern void restore_interrupts(cpu_status status); - - -/* spinlocks. Note that acquire/release should be called with - * interrupts disabled. - */ - typedef vint32 spinlock; -extern void acquire_spinlock(spinlock *lock); -extern void release_spinlock(spinlock *lock); - - /* interrupt handling support for device drivers */ typedef int32 (*interrupt_handler)(void *data); @@ -49,36 +28,16 @@ #define B_NO_ENABLE_COUNTER 1 #define B_NO_LOCK_VECTOR 2 -extern status_t install_io_interrupt_handler(long interrupt_number, - interrupt_handler handler, void *data, ulong flags); -extern status_t remove_io_interrupt_handler(long interrupt_number, - interrupt_handler handler, void *data); - -/*-------------------------------------------------------------*/ /* timer interrupts services */ -/* The BeOS qent structure is probably part of a general double linked list - * interface used all over the kernel; a struct is required to have a qent - * entry struct as first element, so it can be linked to other elements - * easily. The key field is probably just an id, eventually used to order - * the list. - * Since we don't use this kind of interface, but we have to provide it - * to keep compatibility, we can use the qent struct for other purposes... - * - * ToDo: don't do this! Drop source compatibility, but don't overdefine those values! - */ -typedef struct qent { - int64 key; /* We use this as the sched time */ - struct qent *next; /* This is used as a pointer to next timer */ - struct qent *prev; /* This can be used for callback args */ -} qent; - typedef struct timer timer; typedef int32 (*timer_hook)(timer *); struct timer { - qent entry; + struct timer *next; + int64 schedule_time; + void *user_data; uint16 flags; uint16 cpu; timer_hook hook; @@ -89,24 +48,7 @@ #define B_ONE_SHOT_RELATIVE_TIMER 2 #define B_PERIODIC_TIMER 3 -extern status_t add_timer(timer *t, timer_hook hook, bigtime_t period, int32 flags); -extern bool cancel_timer(timer *t); - -/*-------------------------------------------------------------*/ -/* kernel threads */ - -extern thread_id spawn_kernel_thread(thread_func function, const char *threadName, - int32 priority, void *arg); - - -/*-------------------------------------------------------------*/ -/* signal functions */ - -extern int send_signal_etc(pid_t thread, uint sig, uint32 flags); - - -/*-------------------------------------------------------------*/ /* virtual memory buffer functions */ #define B_DMA_IO 0x00000001 @@ -117,11 +59,6 @@ ulong size; /* size of block */ } physical_entry; -extern long lock_memory(void *buffer, ulong numBytes, ulong flags); -extern long unlock_memory(void *buffer, ulong numBytes, ulong flags); -extern long get_memory_map(const void *buffer, ulong size, - physical_entry *table, long numEntries); - /* address specifications for mapping physical memory */ #define B_ANY_KERNEL_BLOCK_ADDRESS (B_ANY_KERNEL_ADDRESS + 1) @@ -130,14 +67,8 @@ #define B_KERNEL_WRITE_AREA 32 #define B_USER_CLONEABLE_AREA 256 -/* call to map physical memory - typically used for memory-mapped i/o */ - -extern area_id map_physical_memory(const char *areaName, void *physicalAddress, - size_t size, uint32 flags, uint32 protection, void **mappedAddress); - - /* MTR attributes for mapping physical memory (Intel Architecture only) */ -// ToDo: what have those to do here? +// TODO: rename those to something more meaningful #define B_MTR_UC 0x10000000 #define B_MTR_WC 0x20000000 #define B_MTR_WT 0x30000000 @@ -146,78 +77,83 @@ #define B_MTR_MASK 0xf0000000 -/*-------------------------------------------------------------*/ -/* hardware inquiry */ +/* kernel daemon service */ -/* platform_type return value is defined in OS.h */ +typedef void (*daemon_hook)(void *arg, int iteration); -extern platform_type platform(); -#if __POWERPC__ -extern long motherboard_version(void); -extern long io_card_version(void); -#endif +/* kernel debugging facilities */ -/*-------------------------------------------------------------*/ -/* primitive kernel debugging facilities */ +/* special return codes for kernel debugger */ +#define B_KDEBUG_CONT 2 +#define B_KDEBUG_QUIT 3 -/* Standard debug output is on... - * mac: modem port - * pc: com1 - * ...at 19.2 kbaud, no parity, 8 bit, 1 stop bit. - * - * Note: the kernel settings file can override these defaults - */ +typedef int (*debugger_command_hook)(int argc, char **argv); -#if __GNUC__ -extern void dprintf(const char *format, ...) /* just like printf */ - __attribute__ ((format (__printf__, 1, 2))); -extern void kprintf(const char *fmt, ...) /* only for debugger cmds */ - __attribute__ ((format (__printf__, 1, 2))); -#else -extern void dprintf(const char *format, ...); /* just like printf */ -extern void kprintf(const char *fmt, ...); /* only for debugger cmds */ + +#ifdef __cplusplus +extern "C" { #endif -extern void dump_block(const char *buffer, int size, const char *prefix); - /* hexdumps given buffer */ +/* interrupts, spinlock, and timers */ +extern cpu_status disable_interrupts(void); +extern void restore_interrupts(cpu_status status); -extern bool set_dprintf_enabled(bool new_state); /* returns old state */ +extern void acquire_spinlock(spinlock *lock); +extern void release_spinlock(spinlock *lock); -#if __GNUC__ -extern void panic(const char *format, ...) __attribute__ ((format (__printf__, 1, 2))); -#else -extern void panic(const char *format, ...); -#endif +extern status_t install_io_interrupt_handler(long interrupt_number, + interrupt_handler handler, void *data, ulong flags); +extern status_t remove_io_interrupt_handler(long interrupt_number, + interrupt_handler handler, void *data); -extern void kernel_debugger(const char *message); /* enter kernel debugger */ -extern uint64 parse_expression(const char *string); /* utility for debugger cmds */ +extern status_t add_timer(timer *t, timer_hook hook, bigtime_t period, + int32 flags); +extern bool cancel_timer(timer *t); -/* special return codes for kernel debugger */ -#define B_KDEBUG_CONT 2 -#define B_KDEBUG_QUIT 3 +/* kernel threads */ +extern thread_id spawn_kernel_thread(thread_func function, + const char *name, int32 priority, void *arg); -typedef int (*debugger_command_hook)(int argc, char **argv); +/* signal functions */ +extern int send_signal_etc(pid_t thread, uint signal, uint32 flags); -extern int add_debugger_command(char *name, debugger_command_hook hook, char *help); -extern int remove_debugger_command(char *name, debugger_command_hook hook); +/* virtual memory */ +extern long lock_memory(void *buffer, ulong numBytes, ulong flags); +extern long unlock_memory(void *buffer, ulong numBytes, ulong flags); +extern long get_memory_map(const void *buffer, ulong size, + physical_entry *table, long numEntries); +extern area_id map_physical_memory(const char *areaName, + void *physicalAddress, size_t size, uint32 flags, + uint32 protection, void **_mappedAddress); -extern status_t load_driver_symbols(const char *driverName); +/* kernel debugging facilities */ +extern void dprintf(const char *format, ...) _PRINTFLIKE(1, 2); +extern void kprintf(const char *fmt, ...) _PRINTFLIKE(1, 2); +extern void dump_block(const char *buffer, int size, const char *prefix); + /* TODO: temporary API: hexdumps given buffer */ -/*-------------------------------------------------------------*/ -/* misc */ +extern bool set_dprintf_enabled(bool new_state); -extern void spin(bigtime_t microseconds); - /* does a busy delay loop for at least "microseconds" */ +extern void panic(const char *format, ...) _PRINTFLIKE(1, 2); -typedef void (*daemon_hook)(void *arg, int iteration); +extern void kernel_debugger(const char *message); +extern uint64 parse_expression(const char *string); -extern status_t register_kernel_daemon(daemon_hook hook, void *arg, int frequency); +extern int add_debugger_command(char *name, debugger_command_hook hook, char *help); +extern int remove_debugger_command(char *name, + debugger_command_hook hook); + +/* Miscellaneous */ +extern void spin(bigtime_t microseconds); + +extern status_t register_kernel_daemon(daemon_hook hook, void *arg, + int frequency); extern status_t unregister_kernel_daemon(daemon_hook hook, void *arg); -extern void call_all_cpus(void (*f)(void *, int), void *cookie); -extern void call_all_cpus_sync(void (*f)(void *, int), void *cookie); +extern void call_all_cpus(void (*func)(void *, int), void *cookie); +extern void call_all_cpus_sync(void (*func)(void *, int), void *cookie); /* safe methods to access user memory without having to lock it */ extern status_t user_memcpy(void *to, const void *from, size_t size); Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-09 11:04:26 UTC (rev 24870) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-09 14:21:06 UTC (rev 24871) @@ -5370,16 +5370,16 @@ FUNCTION(("common_rename(fd = %d, path = %s, newFD = %d, newPath = %s, kernel = %d)\n", fd, path, newFD, newPath, kernel)); status = fd_and_path_to_dir_vnode(fd, path, &fromVnode, fromName, kernel); - if (status < 0) + if (status < B_OK) return status; status = fd_and_path_to_dir_vnode(newFD, newPath, &toVnode, toName, kernel); - if (status < 0) - goto err; + if (status < B_OK) + goto err1; if (fromVnode->device != toVnode->device) { status = B_CROSS_DEVICE_LINK; - goto err1; + goto err2; } if (HAS_FS_CALL(fromVnode, rename)) @@ -5387,9 +5387,9 @@ else status = EROFS; +err2: + put_vnode(toVnode); err1: - put_vnode(toVnode); -err: put_vnode(fromVnode); return status; Modified: haiku/trunk/src/system/kernel/sem.cpp =================================================================== --- haiku/trunk/src/system/kernel/sem.cpp 2008-04-09 11:04:26 UTC (rev 24870) +++ haiku/trunk/src/system/kernel/sem.cpp 2008-04-09 14:21:06 UTC (rev 24871) @@ -285,7 +285,7 @@ static int32 sem_timeout(timer *data) { - struct sem_timeout_args *args = (struct sem_timeout_args *)data->entry.prev; + struct sem_timeout_args *args = (struct sem_timeout_args *)data->user_data; struct thread *thread; int slot; int state; @@ -879,7 +879,8 @@ if ((sSems[slot].u.used.count -= count) < 0) { // we need to block struct thread *thread = thread_get_current_thread(); - timer timeout_timer; // stick it on the stack, since we may be blocking here + timer timeoutTimer; + // stick it on the stack, since we may be blocking here struct sem_timeout_args args; TRACE(("switch_sem_etc(id = %ld): block name = %s, thread = %p," @@ -917,9 +918,8 @@ args.blocked_thread = thread->id; args.sem_count = count; - // ToDo: another evil hack: pass the args into timer->entry.prev - timeout_timer.entry.prev = (qent *)&args; - add_timer(&timeout_timer, &sem_timeout, timeout, + timeoutTimer.user_data = &args; + add_timer(&timeoutTimer, &sem_timeout, timeout, flags & B_RELATIVE_TIMEOUT ? B_ONE_SHOT_RELATIVE_TIMER : B_ONE_SHOT_ABSOLUTE_TIMER); } @@ -964,7 +964,7 @@ if (thread->sem.acquire_status != B_TIMED_OUT) { // cancel the timer event, the sem may have been deleted or interrupted // with the timer still active - cancel_timer(&timeout_timer); + cancel_timer(&timeoutTimer); } } Modified: haiku/trunk/src/system/kernel/signal.cpp =================================================================== --- haiku/trunk/src/system/kernel/signal.cpp 2008-04-09 11:04:26 UTC (rev 24870) +++ haiku/trunk/src/system/kernel/signal.cpp 2008-04-09 14:21:06 UTC (rev 24871) @@ -785,7 +785,7 @@ TRACE(("set_alarm: thread = %p\n", thread)); if (thread->alarm.period) - remainingTime = (bigtime_t)thread->alarm.entry.key - system_time(); + remainingTime = (bigtime_t)thread->alarm.schedule_time - system_time(); cancel_timer(&thread->alarm); Modified: haiku/trunk/src/system/kernel/timer.c =================================================================== --- haiku/trunk/src/system/kernel/timer.c 2008-04-09 11:04:26 UTC (rev 24870) +++ haiku/trunk/src/system/kernel/timer.c 2008-04-09 14:21:06 UTC (rev 24871) @@ -1,14 +1,14 @@ -/* Policy info for timers */ - /* -** Copyright 2002-2004, The OpenBeOS Team. All rights reserved. -** Distributed under the terms of the OpenBeOS License. -** -** Copyright 2001, Travis Geiselbrecht. All rights reserved. -** Distributed under the terms of the NewOS License. -*/ + * Copyright 2002-2008, Haiku. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Copyright 2001, Travis Geiselbrecht. All rights reserved. + * Distributed under the terms of the NewOS License. + */ +/*! Policy info for timers */ + #include #include @@ -44,8 +44,7 @@ } -/** NOTE: expects interrupts to be off */ - +/*! NOTE: expects interrupts to be off */ static void add_event_to_list(timer *event, timer * volatile *list) { @@ -53,16 +52,16 @@ timer *last = NULL; // stick it in the event list - for (next = *list; next; last = next, next = (timer *)next->entry.next) { - if ((bigtime_t)next->entry.key >= (bigtime_t)event->entry.key) + for (next = *list; next; last = next, next = (timer *)next->next) { + if ((bigtime_t)next->schedule_time >= (bigtime_t)event->schedule_time) break; } if (last != NULL) { - event->entry.next = last->entry.next; - last->entry.next = (qent*)event; + event->next = last->next; + last->next = event; } else { - event->entry.next = (qent*)next; + event->next = next; *list = event; } } @@ -76,7 +75,8 @@ int currentCPU = smp_get_current_cpu(); int32 rc = B_HANDLED_INTERRUPT; - TRACE(("timer_interrupt: time 0x%x 0x%x, cpu %d\n", system_time(), smp_get_current_cpu())); + TRACE(("timer_interrupt: time 0x%x 0x%x, cpu %d\n", system_time(), + smp_get_current_cpu())); spinlock = &sTimerSpinlock[currentCPU]; @@ -84,25 +84,23 @@ restart_scan: event = sEvents[currentCPU]; - if (event != NULL && ((bigtime_t)event->entry.key < system_time())) { + if (event != NULL && ((bigtime_t)event->schedule_time < system_time())) { // this event needs to happen int mode = event->flags; - sEvents[currentCPU] = (timer *)event->entry.next; - event->entry.key = 0; + sEvents[currentCPU] = (timer *)event->next; + event->schedule_time = 0; release_spinlock(spinlock); - TRACE(("timer_interrupt: calling hook %p for event %p\n", event->hook, event)); + TRACE(("timer_interrupt: calling hook %p for event %p\n", event->hook, + event)); // call the callback // note: if the event is not periodic, it is ok // to delete the event structure inside the callback - if (event->hook) { + if (event->hook) rc = event->hook(event); -// if (event->func(event->data) == INT_RESCHEDULE) -// rc = INT_RESCHEDULE; - } acquire_spinlock(spinlock); @@ -114,7 +112,7 @@ // it to one, since zero represents not scheduled scheduleTime = 1; } - event->entry.key = (int64)scheduleTime; + event->schedule_time = (int64)scheduleTime; add_event_to_list(event, &sEvents[currentCPU]); } @@ -122,8 +120,10 @@ } // setup the next hardware timer - if (sEvents[currentCPU] != NULL) - arch_timer_set_hardware_timer((bigtime_t)sEvents[currentCPU]->entry.key - system_time()); + if (sEvents[currentCPU] != NULL) { + arch_timer_set_hardware_timer( + (bigtime_t)sEvents[currentCPU]->schedule_time - system_time()); + } release_spinlock(spinlock); @@ -150,7 +150,7 @@ if (scheduleTime == 0) scheduleTime = 1; - event->entry.key = (int64)scheduleTime; + event->schedule_time = (int64)scheduleTime; event->period = period; event->hook = hook; event->flags = flags; @@ -173,11 +173,9 @@ } -/** This is a fast path to be called from reschedule() and from - * cancel_timer(). - * Must always be invoked with interrupts disabled. - */ - +/*! This is a fast path to be called from reschedule() and from cancel_timer(). + Must always be invoked with interrupts disabled. +*/ status_t _local_timer_cancel_event(int cpu, timer *event) { @@ -190,21 +188,23 @@ if (current == event) { // we found it if (current == sEvents[cpu]) - sEvents[cpu] = (timer *)current->entry.next; + sEvents[cpu] = current->next; else - last->entry.next = current->entry.next; - current->entry.next = NULL; + last->next = current->next; + current->next = NULL; // break out of the whole thing break; } last = current; - current = (timer *)current->entry.next; + current = current->next; } if (sEvents[cpu] == NULL) arch_timer_clear_hardware_timer(); - else - arch_timer_set_hardware_timer((bigtime_t)sEvents[cpu]->entry.key - system_time()); + else { + arch_timer_set_hardware_timer( + (bigtime_t)sEvents[cpu]->schedule_time - system_time()); + } release_spinlock(&sTimerSpinlock[cpu]); @@ -244,19 +244,19 @@ if (current == event) { // we found it if (current == sEvents[cpu]) - sEvents[cpu] = (timer *)current->entry.next; + sEvents[cpu] = current->next; else - last->entry.next = current->entry.next; - current->entry.next = NULL; + last->next = current->next; + current->next = NULL; // break out of the whole thing release_spinlock(&sTimerSpinlock[cpu]); restore_interrupts(state); - return (bigtime_t)event->entry.key < system_time(); + return (bigtime_t)event->schedule_time < system_time(); } last = current; - current = (timer *)current->entry.next; + current = current->next; } release_spinlock(&sTimerSpinlock[cpu]); } @@ -272,6 +272,7 @@ { bigtime_t time = system_time(); - while((system_time() - time) < microseconds) + while ((system_time() - time) < microseconds) { PAUSE(); + } } From axeld at mail.berlios.de Wed Apr 9 16:21:45 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Apr 2008 16:21:45 +0200 Subject: [Haiku-commits] r24872 - haiku/trunk/headers/os Message-ID: <200804091421.m39ELj2Z016413@sheep.berlios.de> Author: axeld Date: 2008-04-09 16:21:45 +0200 (Wed, 09 Apr 2008) New Revision: 24872 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24872&view=rev Modified: haiku/trunk/headers/os/BeBuild.h Log: Added some macros and an error message if another compiler than GCC is used. Modified: haiku/trunk/headers/os/BeBuild.h =================================================================== --- haiku/trunk/headers/os/BeBuild.h 2008-04-09 14:21:06 UTC (rev 24871) +++ haiku/trunk/headers/os/BeBuild.h 2008-04-09 14:21:45 UTC (rev 24872) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Haiku, Inc. All Rights Reserved. + * Copyright 2007-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. */ #ifndef _BE_BUILD_H @@ -21,6 +21,11 @@ # define _PRINTFLIKE(_format_, _args_) \ __attribute__((format(__printf__, _format_, _args_))) # define _EXPORT +#else +# define _UNUSED(argument) argument +# error Define _PACKED for your compiler +# define _PRINTFLIKE(format, args) +# define _EXPORT #endif #endif /* _BE_BUILD_H */ From axeld at mail.berlios.de Wed Apr 9 16:36:04 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Apr 2008 16:36:04 +0200 Subject: [Haiku-commits] r24873 - in haiku/trunk: headers/os/drivers src/system/kernel src/tests/add-ons/kernel Message-ID: <200804091436.m39Ea4h9017284@sheep.berlios.de> Author: axeld Date: 2008-04-09 16:36:04 +0200 (Wed, 09 Apr 2008) New Revision: 24873 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24873&view=rev Modified: haiku/trunk/headers/os/drivers/module.h haiku/trunk/src/system/kernel/module.cpp haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp Log: * Added open_module_list_etc() that also allows to specify a required name suffix. You can use this to verify the version of a module_info structure. * Made module_info::std_ops optional. * Minor cleanup in module.h. Modified: haiku/trunk/headers/os/drivers/module.h =================================================================== --- haiku/trunk/headers/os/drivers/module.h 2008-04-09 14:21:45 UTC (rev 24872) +++ haiku/trunk/headers/os/drivers/module.h 2008-04-09 14:36:04 UTC (rev 24873) @@ -1,8 +1,7 @@ -/* Modules Definitions -** -** Distributed under the terms of the OpenBeOS License. -*/ - +/* + * Copyright 2002-2008, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _MODULE_H #define _MODULE_H @@ -46,10 +45,13 @@ extern status_t get_module(const char *path, module_info **_info); extern status_t put_module(const char *path); -extern status_t get_next_loaded_module_name(uint32 *cookie, char *buffer, size_t *_bufferSize); +extern status_t get_next_loaded_module_name(uint32 *cookie, char *buffer, + size_t *_bufferSize); +extern void *open_module_list_etc(const char *prefix, const char *suffix); extern void *open_module_list(const char *prefix); extern status_t close_module_list(void *cookie); -extern status_t read_next_module_name(void *cookie, char *buffer, size_t *_bufferSize); +extern status_t read_next_module_name(void *cookie, char *buffer, + size_t *_bufferSize); #ifdef __cplusplus } Modified: haiku/trunk/src/system/kernel/module.cpp =================================================================== --- haiku/trunk/src/system/kernel/module.cpp 2008-04-09 14:21:45 UTC (rev 24872) +++ haiku/trunk/src/system/kernel/module.cpp 2008-04-09 14:36:04 UTC (rev 24873) @@ -120,6 +120,8 @@ char *prefix; size_t prefix_length; + const char *suffix; + size_t suffix_length; DIR *current_dir; status_t status; int32 module_offset; @@ -570,7 +572,10 @@ // init module TRACE(("initializing module %s (at %p)... \n", module->name, module->info->std_ops)); - status = module->info->std_ops(B_MODULE_INIT); + + if (module->info->std_ops != NULL) + status = module->info->std_ops(B_MODULE_INIT); + TRACE(("...done (%s)\n", strerror(status))); if (status >= B_OK) @@ -626,17 +631,18 @@ case MODULE_READY: { - status_t status; - + status_t status = B_OK; module->state = MODULE_UNINIT; TRACE(("uninitializing module %s...\n", module->name)); - status = module->info->std_ops(B_MODULE_UNINIT); + + if (module->info->std_ops != NULL) + status = module->info->std_ops(B_MODULE_UNINIT); + TRACE(("...done (%s)\n", strerror(status))); - if (status == B_NO_ERROR) { + if (status == B_OK) { module->state = MODULE_LOADED; - put_dependent_modules(module); return B_OK; } @@ -689,6 +695,21 @@ } +static bool +match_iterator_suffix(module_iterator *iterator, const char *name) +{ + if (iterator->suffix == NULL || iterator->suffix_length == 0) + return true; + + size_t length = strlen(name); + if (length <= iterator->suffix_length) + return false; + + return name[length - iterator->suffix_length - 1] == '/' + && !strcmp(name + length - iterator->suffix_length, iterator->suffix); +} + + static status_t iterator_get_next_module(module_iterator *iterator, char *buffer, size_t *_bufferSize) @@ -701,7 +722,8 @@ for (int32 i = iterator->module_offset; sBuiltInModules[i] != NULL; i++) { // the module name must fit the prefix if (strncmp(sBuiltInModules[i]->name, iterator->prefix, - iterator->prefix_length)) + iterator->prefix_length) + || !match_iterator_suffix(iterator, sBuiltInModules[i]->name)) continue; *_bufferSize = strlcpy(buffer, sBuiltInModules[i]->name, @@ -722,7 +744,8 @@ for (int32 i = 0; module != NULL; i++) { if (i >= iterator->module_offset) { if (!strncmp(module->name, iterator->prefix, - iterator->prefix_length)) { + iterator->prefix_length) + && match_iterator_suffix(iterator, module->name)) { *_bufferSize = strlcpy(buffer, module->name, *_bufferSize); iterator->module_offset = i + 1; @@ -740,7 +763,7 @@ // prevent from falling into modules hash iteration again iterator->loaded_modules = false; } - + nextPath: if (iterator->current_dir == NULL) { // get next directory path from the stack @@ -849,12 +872,14 @@ while (*iterator->current_header != NULL) { module_info *info = *iterator->current_header; - // ToDo: we might want to create a module here and cache it in the hash table + // TODO: we might want to create a module here and cache it in the + // hash table iterator->current_header++; iterator->module_offset++; - if (strncmp(info->name, iterator->prefix, iterator->prefix_length)) + if (strncmp(info->name, iterator->prefix, iterator->prefix_length) + || !match_iterator_suffix(iterator, info->name)) continue; *_bufferSize = strlcpy(buffer, info->name, *_bufferSize); @@ -1092,18 +1117,15 @@ /*! This returns a pointer to a structure that can be used to iterate through a list of all modules available under - a given prefix. + a given prefix that adhere to the specified suffix. All paths will be searched and the returned list will contain all modules available under the prefix. The structure is then used by read_next_module_name(), and must be freed by calling close_module_list(). */ void * -open_module_list(const char *prefix) +open_module_list_etc(const char *prefix, const char *suffix) { - module_iterator *iterator; - uint32 i; - TRACE(("open_module_list(prefix = %s)\n", prefix)); if (sModulesHash == NULL) { @@ -1111,7 +1133,8 @@ return NULL; } - iterator = (module_iterator *)malloc(sizeof(module_iterator)); + module_iterator *iterator = (module_iterator *)malloc( + sizeof(module_iterator)); if (!iterator) return NULL; @@ -1124,6 +1147,10 @@ } iterator->prefix_length = strlen(iterator->prefix); + iterator->suffix = suffix; + if (suffix != NULL) + iterator->suffix_length = strlen(iterator->suffix); + if (gBootDevice > 0) { // We do have a boot device to scan @@ -1132,7 +1159,7 @@ iterator->loaded_modules = false; // put all search paths on the stack - for (i = 0; i < kNumModulePaths; i++) { + for (uint32 i = 0; i < kNumModulePaths; i++) { if (sDisableUserAddOns && i >= kFirstNonSystemModulePath) break; @@ -1183,6 +1210,13 @@ } +void * +open_module_list(const char *prefix) +{ + return open_module_list_etc(prefix, NULL); +} + + /*! Frees the cookie allocated by open_module_list() */ status_t close_module_list(void *cookie) Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-04-09 14:21:45 UTC (rev 24872) +++ haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-04-09 14:36:04 UTC (rev 24873) @@ -273,7 +273,8 @@ { status_t error = (fInfo ? B_OK : B_NO_INIT); if (error == B_OK && !fInitialized) { - error = fInfo->std_ops(B_MODULE_INIT); + if (fInfo->std_ops != NULL) + error = fInfo->std_ops(B_MODULE_INIT); if (error == B_OK) fInitialized = true; } @@ -286,7 +287,8 @@ { status_t error = (fInfo ? B_OK : B_NO_INIT); if (error == B_OK && fInitialized) { - error = fInfo->std_ops(B_MODULE_UNINIT); + if (fInfo->std_ops != NULL) + error = fInfo->std_ops(B_MODULE_UNINIT); fInitialized = false; } return error; From axeld at mail.berlios.de Wed Apr 9 16:45:18 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Apr 2008 16:45:18 +0200 Subject: [Haiku-commits] r24874 - haiku/trunk/src/tests/add-ons/kernel Message-ID: <200804091445.m39EjIB3018053@sheep.berlios.de> Author: axeld Date: 2008-04-09 16:45:17 +0200 (Wed, 09 Apr 2008) New Revision: 24874 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24874&view=rev Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp Log: * Implemented open_module_list_etc() in libkernel_emu.so as well. * Added license. Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-04-09 14:36:04 UTC (rev 24873) +++ haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-04-09 14:45:17 UTC (rev 24874) @@ -1,4 +1,11 @@ -// kernelland_emu.cpp +/* + * Copyright 2002-2008, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT license. + * + * Authors: + * Ingo Weinhold, bonefish at cs.tu-berlin.de. + * Axel D?rfler, axeld at pinc-software.de. + */ #include #include @@ -112,7 +119,8 @@ status_t GetNextLoadedModuleName(uint32 *cookie, char *buffer, size_t *bufferSize); - module_name_list *OpenModuleList(const char *prefix); + module_name_list *OpenModuleList(const char *prefix, + const char *suffix = NULL); status_t ReadNextModuleName(module_name_list *list, char *buffer, size_t *bufferSize); status_t CloseModuleList(module_name_list *list); @@ -123,9 +131,11 @@ void PutDependencies(image_id image); private: + bool _MatchSuffix(const char *name, const char *suffix); void _FindModules(BDirectory &dir, const char *moduleDir, + const char *suffix, module_name_list *list); + void _FindBuiltInModules(const char *prefix, const char *suffix, module_name_list *list); - void _FindBuiltInModules(const char *prefix, module_name_list *list); status_t _GetAddOn(const char *path, ModuleAddOn **addon); void _PutAddOn(ModuleAddOn *addon); @@ -476,19 +486,19 @@ // OpenModuleList module_name_list * -ModuleManager::OpenModuleList(const char *prefix) +ModuleManager::OpenModuleList(const char *prefix, const char *suffix) { module_name_list *list = NULL; if (prefix) { list = new module_name_list; - _FindBuiltInModules(prefix, list); + _FindBuiltInModules(prefix, suffix, list); for (int32 i = 0; gModuleDirs[i]; i++) { BPath path; BDirectory dir; if (path.SetTo(gModuleDirs[i], prefix) == B_OK && dir.SetTo(path.Path()) == B_OK) { - _FindModules(dir, gModuleDirs[i], list); + _FindModules(dir, gModuleDirs[i], suffix, list); } } @@ -578,9 +588,25 @@ } +bool +ModuleManager::_MatchSuffix(const char *name, const char *suffix) +{ + if (suffix == NULL || suffix[0] == '\0') + return true; + + size_t suffixLength = strlen(suffix); + size_t length = strlen(name); + if (length <= suffixLength) + return false; + + return name[length - suffixLength - 1] == '/' + && !strcmp(name + length - suffixLength, suffix); +} + + void ModuleManager::_FindModules(BDirectory &dir, const char *moduleDir, - module_name_list *list) + const char *suffix, module_name_list *list) { BEntry entry; while (dir.GetNextEntry(&entry) == B_OK) { @@ -591,28 +617,31 @@ && addon.Load(path.Path(), moduleDir) == B_OK) { module_info **infos = addon.ModuleInfos(); for (int32 i = 0; infos[i]; i++) { - if (infos[i]->name) + if (infos[i]->name + && _MatchSuffix(infos[i]->name, suffix)) list->names.insert(infos[i]->name); } } } else if (entry.IsDirectory()) { BDirectory subdir; if (subdir.SetTo(&entry) == B_OK) - _FindModules(subdir, moduleDir, list); + _FindModules(subdir, moduleDir, suffix, list); } } } void -ModuleManager::_FindBuiltInModules(const char *prefix, module_name_list *list) +ModuleManager::_FindBuiltInModules(const char *prefix, const char *suffix, + module_name_list *list) { uint32 count = fModules.CountModules(); uint32 prefixLength = strlen(prefix); for (uint32 i = 0; i < count; i++) { Module *module = fModules.ModuleAt(i); - if (!strncmp(module->Info()->name, prefix, prefixLength)) + if (!strncmp(module->Info()->name, prefix, prefixLength) + && _MatchSuffix(module->Info()->name, suffix)) list->names.insert(module->Info()->name); } } @@ -740,13 +769,21 @@ void * +open_module_list_etc(const char *prefix, const char *suffix) +{ + TRACE(("open_module_list_etc('%s', '%s')\n", prefix, suffix)); + return (void*)ModuleManager::Default()->OpenModuleList(prefix, suffix); +} + + +void * open_module_list(const char *prefix) { - TRACE(("open_module_list(`%s')\n", prefix)); + TRACE(("open_module_list('%s')\n", prefix)); return (void*)ModuleManager::Default()->OpenModuleList(prefix); } -// read_next_module_name + status_t read_next_module_name(void *cookie, char *buf, size_t *bufsize) { @@ -755,7 +792,7 @@ (module_name_list*)cookie, buf, bufsize); } -// close_module_list + status_t close_module_list(void *cookie) { @@ -766,7 +803,8 @@ thread_id -spawn_kernel_thread(thread_func func, const char *name, int32 priority, void *data) +spawn_kernel_thread(thread_func func, const char *name, int32 priority, + void *data) { return spawn_thread(func, name, priority, data); } From axeld at mail.berlios.de Wed Apr 9 19:48:37 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 9 Apr 2008 19:48:37 +0200 Subject: [Haiku-commits] r24875 - in haiku/trunk/src/add-ons/kernel/drivers: audio/ac97/auich audio/ac97/auvia audio/ac97/es1370 audio/cmedia audio/echo audio/emuxki audio/sis7018 audio/usb_audio bus/firewire bus/pcmcia dvb/cx23882 input/wacom network/sis900 ports/usb_serial video/usb_vision Message-ID: <200804091748.m39Hmbu8027301@sheep.berlios.de> Author: axeld Date: 2008-04-09 19:48:36 +0200 (Wed, 09 Apr 2008) New Revision: 24875 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24875&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm.c haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c haiku/trunk/src/add-ons/kernel/drivers/audio/sis7018/sis7018.c haiku/trunk/src/add-ons/kernel/drivers/audio/usb_audio/usb_audio.c haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c haiku/trunk/src/add-ons/kernel/drivers/dvb/cx23882/driver.c haiku/trunk/src/add-ons/kernel/drivers/input/wacom/wacom.c haiku/trunk/src/add-ons/kernel/drivers/network/sis900/device.c haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp haiku/trunk/src/add-ons/kernel/drivers/video/usb_vision/usb_vision.c Log: Made sure load_driver_symbols() is not used anymore when building for Haiku; it's a no-op, and I removed the prototype from KernelExport.h. 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 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auich/auich.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -745,17 +745,15 @@ status_t init_driver(void) { - int ix=0; + int ix = 0; void *settings_handle; - pci_info info; num_cards = 0; - + PRINT(("init_driver()\n")); - load_driver_symbols("auich"); - + // get driver settings - settings_handle = load_driver_settings ("auich.settings"); + settings_handle = load_driver_settings("auich.settings"); if (settings_handle != NULL) { const char *item; char *end; 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 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/auvia/auvia.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -55,7 +55,6 @@ const char ** publish_devices(void); device_hooks * find_device(const char *); -static char pci_name[] = B_PCI_MODULE_NAME; pci_module_info *pci; int32 num_cards; @@ -567,15 +566,14 @@ status_t init_driver(void) { - int ix=0; - pci_info info; + int ix = 0; + num_cards = 0; - + PRINT(("init_driver()\n")); - load_driver_symbols("auvia"); - if (get_module(B_PCI_MODULE_NAME, (module_info **) &pci)) + if (get_module(B_PCI_MODULE_NAME, (module_info **)&pci)) return ENOSYS; while ((*pci->get_nth_pci_info)(ix, &info) == B_OK) { Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -489,15 +489,13 @@ status_t init_driver(void) { - int ix=0; void *settings_handle; - pci_info info; num_cards = 0; - + int ix = 0; + PRINT(("init_driver()\n")); - load_driver_symbols("es1370"); - + // get driver settings settings_handle = load_driver_settings ("es1370.settings"); if (settings_handle != NULL) { Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -511,17 +511,17 @@ status_t init_driver(void) { - int ix=0; pci_info info; + int ix = 0; + num_cards = 0; ddprintf(("cmedia_pci: init_driver()\n")); - load_driver_symbols("cmedia_pci"); - if (get_module(pci_name, (module_info **) &pci)) + if (get_module(pci_name, (module_info **)&pci)) return ENOSYS; - if (get_module(gameport_name, (module_info **) &gameport)) { + if (get_module(gameport_name, (module_info **)&gameport)) { put_module(pci_name); return ENOSYS; } Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/echo/echo.cpp 2008-04-09 17:48:36 UTC (rev 24875) @@ -522,7 +522,6 @@ init_driver(void) { PRINT(("init_driver()\n")); - load_driver_symbols(DRIVER_NAME); void *settings_handle; // get driver settings Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -2765,17 +2765,15 @@ status_t init_driver(void) { - int ix=0; void *settings_handle; - pci_info info; num_cards = 0; + int ix = 0; PRINT(("init_driver()\n")); - load_driver_symbols("emuxki"); // get driver settings - settings_handle = load_driver_settings ("emuxki.settings"); + settings_handle = load_driver_settings("emuxki.settings"); if (settings_handle != NULL) { const char *item; char *end; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/sis7018/sis7018.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/sis7018/sis7018.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/sis7018/sis7018.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -284,18 +284,18 @@ return err; } -/* init_driver - optional function - called every time the drive is loaded. */ -status_t init_driver (void) + +status_t +init_driver(void) { - int ix=0, jx=0; + int ix = 0, jx = 0; pci_info info; num_cards = 0; - + reload_sis7018_setting(); create_log(); TRACE("\n>>> init_driver()\n"); - load_driver_symbols(CHIPNAME); if (get_module(B_PCI_MODULE_NAME, (module_info **) &pci)) return ENOSYS; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/usb_audio/usb_audio.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/usb_audio/usb_audio.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/usb_audio/usb_audio.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -812,7 +812,7 @@ int i; DPRINTF((ID "init_driver(), built %s %s\n", __DATE__, __TIME__)); -#if DEBUG_DRIVER +#if DEBUG_DRIVER && !defined(__HAIKU__) if(load_driver_symbols(drivername) == B_OK) { DPRINTF((ID "loaded symbols\n")); } else { Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/firewire/fw_raw.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -977,7 +977,7 @@ struct firewire_softc *sc = NULL; uint32 i; -#if DEBUG +#if DEBUG && !defined(__HAIKU__) load_driver_symbols("fw_raw"); #endif Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/pcmcia/ds.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -354,7 +354,7 @@ client_handle_t handle; uint32 i; -#if DEBUG +#if DEBUG && !defined(__HAIKU__) load_driver_symbols("ds"); #endif Modified: haiku/trunk/src/add-ons/kernel/drivers/dvb/cx23882/driver.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/dvb/cx23882/driver.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/dvb/cx23882/driver.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -120,7 +120,7 @@ int index; int cards; -#ifdef DEBUG +#if defined(DEBUG) && !defined(__HAIKU__) set_dprintf_enabled(true); load_driver_symbols("cx23882"); #endif Modified: haiku/trunk/src/add-ons/kernel/drivers/input/wacom/wacom.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/input/wacom/wacom.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/input/wacom/wacom.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -582,7 +582,7 @@ { DPRINTF_INFO((ID "init_driver(), built %s %s\n", __DATE__, __TIME__)); -#if DEBUG_DRIVER +#if DEBUG_DRIVER && !defined(__HAIKU__) if (load_driver_symbols(kDriverName) == B_OK) { DPRINTF_INFO((ID "loaded symbols\n")); } else { Modified: haiku/trunk/src/add-ons/kernel/drivers/network/sis900/device.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/sis900/device.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/network/sis900/device.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -242,10 +242,6 @@ info = (struct sis_info *)*cookie; memset(info, 0, sizeof(struct sis_info)); -#ifdef DEBUG - load_driver_symbols("sis900"); -#endif - info->cookieMagic = SiS_COOKIE_MAGIC; info->thisArea = area; info->id = id; Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp 2008-04-09 17:48:36 UTC (rev 24875) @@ -134,7 +134,6 @@ gSerialDevices[i] = 0; gDeviceNames[0] = NULL; - //load_driver_symbols(DRIVER_NAME); gDriverLock = create_sem(1, DRIVER_NAME"_devices_table_lock"); if (gDriverLock < B_OK) { Modified: haiku/trunk/src/add-ons/kernel/drivers/video/usb_vision/usb_vision.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/video/usb_vision/usb_vision.c 2008-04-09 14:45:17 UTC (rev 24874) +++ haiku/trunk/src/add-ons/kernel/drivers/video/usb_vision/usb_vision.c 2008-04-09 17:48:36 UTC (rev 24875) @@ -59,7 +59,6 @@ usb_vision_devices[i] = 0; usb_vision_names[0] = NULL; - load_driver_symbols(DRIVER_NAME); (*usb->register_driver)(DRIVER_NAME, supported_devices, SIZEOF(supported_devices), DRIVER_NAME); (*usb->install_notify)(DRIVER_NAME, ¬ify_hooks); From anevilyak at mail.berlios.de Wed Apr 9 20:16:54 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 9 Apr 2008 20:16:54 +0200 Subject: [Haiku-commits] r24876 - haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki Message-ID: <200804091816.m39IGsbr029247@sheep.berlios.de> Author: anevilyak Date: 2008-04-09 20:16:53 +0200 (Wed, 09 Apr 2008) New Revision: 24876 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24876&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c Log: Build fix :) Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-04-09 17:48:36 UTC (rev 24875) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki/emuxki.c 2008-04-09 18:16:53 UTC (rev 24876) @@ -2767,8 +2767,8 @@ { void *settings_handle; pci_info info; + int ix = 0; num_cards = 0; - int ix = 0; PRINT(("init_driver()\n")); From mmu_man at mail.berlios.de Wed Apr 9 20:46:25 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Apr 2008 20:46:25 +0200 Subject: [Haiku-commits] r24877 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200804091846.m39IkPrG032641@sheep.berlios.de> Author: mmu_man Date: 2008-04-09 20:46:24 +0200 (Wed, 09 Apr 2008) New Revision: 24877 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24877&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp Log: Fix building usb bus manager with TRACE on. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp 2008-04-09 18:16:53 UTC (rev 24876) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp 2008-04-09 18:46:24 UTC (rev 24877) @@ -33,7 +33,9 @@ #ifdef TRACE_USB set_dprintf_enabled(true); +#ifndef __HAIKU__ load_driver_symbols("usb"); +#endif TRACE(("usb_module: init\n")); #endif Stack *stack = new(std::nothrow) Stack(); From axeld at pinc-software.de Wed Apr 9 20:47:15 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Wed, 09 Apr 2008 20:47:15 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24876_-_haiku/trunk/src/add-ons/?= =?iso-8859-15?q?kernel/drivers/audio/emuxki?= In-Reply-To: <200804091816.m39IGsbr029247@sheep.berlios.de> Message-ID: <27738537268-BeMail@zon> anevilyak at BerliOS wrote: > Log: > Build fix :) Thanks! That poor BeOS machine is still busy compiling... In my defense, that wouldn't have happened if it would follow our style guide ;-) Bye, Axel. From anevilyak at gmail.com Wed Apr 9 20:57:32 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 9 Apr 2008 13:57:32 -0500 Subject: [Haiku-commits] r24876 - haiku/trunk/src/add-ons/kernel/drivers/audio/emuxki In-Reply-To: <27738537268-BeMail@zon> References: <200804091816.m39IGsbr029247@sheep.berlios.de> <27738537268-BeMail@zon> Message-ID: On Wed, Apr 9, 2008 at 1:47 PM, Axel D?rfler wrote: > anevilyak at BerliOS wrote: > > Log: > > Build fix :) > > Thanks! That poor BeOS machine is still busy compiling... > In my defense, that wouldn't have happened if it would follow our style > guide ;-) np :) I just noticed it on linux and it seemed an easy enough fix :) Regards, Rene From mauricek at mail.berlios.de Wed Apr 9 21:43:50 2008 From: mauricek at mail.berlios.de (mauricek at BerliOS) Date: Wed, 9 Apr 2008 21:43:50 +0200 Subject: [Haiku-commits] r24878 - haiku/trunk/src/kits/media Message-ID: <200804091943.m39Jhofp006312@sheep.berlios.de> Author: mauricek Date: 2008-04-09 21:43:49 +0200 (Wed, 09 Apr 2008) New Revision: 24878 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24878&view=rev Modified: haiku/trunk/src/kits/media/FileInterface.cpp Log: Don't reset the duration value after passing it to SetRef as pointed out by Marcus. Sorry for taking so long to commit this... Modified: haiku/trunk/src/kits/media/FileInterface.cpp =================================================================== --- haiku/trunk/src/kits/media/FileInterface.cpp 2008-04-09 18:46:24 UTC (rev 24877) +++ haiku/trunk/src/kits/media/FileInterface.cpp 2008-04-09 19:43:49 UTC (rev 24878) @@ -63,7 +63,7 @@ reply.duration = request->duration; rv = SetRef(ref, request->create, &reply.duration); - reply.duration = request->duration; + request->SendReply(rv, &reply, sizeof(reply)); return B_OK; } From mauricek at mail.berlios.de Wed Apr 9 22:28:55 2008 From: mauricek at mail.berlios.de (mauricek at BerliOS) Date: Wed, 9 Apr 2008 22:28:55 +0200 Subject: [Haiku-commits] r24879 - haiku/trunk/src/kits/media Message-ID: <200804092028.m39KStFD010587@sheep.berlios.de> Author: mauricek Date: 2008-04-09 22:28:55 +0200 (Wed, 09 Apr 2008) New Revision: 24879 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24879&view=rev Modified: haiku/trunk/src/kits/media/MediaRoster.cpp haiku/trunk/src/kits/media/OldBufferStream.cpp haiku/trunk/src/kits/media/OldBufferStream.h Log: fix some gcc4 related warnings... Modified: haiku/trunk/src/kits/media/MediaRoster.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaRoster.cpp 2008-04-09 19:43:49 UTC (rev 24878) +++ haiku/trunk/src/kits/media/MediaRoster.cpp 2008-04-09 20:28:55 UTC (rev 24879) @@ -98,7 +98,10 @@ request.team = team; request.messenger = BMessenger(NULL, this); rv = QueryServer(SERVER_REGISTER_APP, &request, sizeof(request), &reply, sizeof(reply)); - *out_error = (rv != B_OK) ? B_MEDIA_SYSTEM_FAILURE : B_OK; + if (rv != B_OK) + *out_error = B_MEDIA_SYSTEM_FAILURE; + else + *out_error = B_OK; } status_t Modified: haiku/trunk/src/kits/media/OldBufferStream.cpp =================================================================== --- haiku/trunk/src/kits/media/OldBufferStream.cpp 2008-04-09 19:43:49 UTC (rev 24878) +++ haiku/trunk/src/kits/media/OldBufferStream.cpp 2008-04-09 20:28:55 UTC (rev 24879) @@ -9,7 +9,13 @@ /************************************************************* * public BAbstractBufferStream *************************************************************/ +#if __GNUC__ > 3 +BAbstractBufferStream::~BAbstractBufferStream() +{ +} +#endif + status_t BAbstractBufferStream::GetStreamParameters(size_t *bufferSize, int32 *bufferCount, Modified: haiku/trunk/src/kits/media/OldBufferStream.h =================================================================== --- haiku/trunk/src/kits/media/OldBufferStream.h 2008-04-09 19:43:49 UTC (rev 24878) +++ haiku/trunk/src/kits/media/OldBufferStream.h 2008-04-09 20:28:55 UTC (rev 24879) @@ -74,6 +74,9 @@ class BAbstractBufferStream { public: +#if __GNUC__ > 3 + virtual ~BAbstractBufferStream(); +#endif virtual status_t GetStreamParameters(size_t *bufferSize, int32 *bufferCount, From philippe.houdoin at free.fr Wed Apr 9 22:37:15 2008 From: philippe.houdoin at free.fr (philippe.houdoin at free.fr) Date: Wed, 9 Apr 2008 22:37:15 +0200 Subject: [Haiku-commits] Re: r24873 - in haiku/trunk: headers/os/drivers src/system/kernel src/tests/add-ons/kernel Message-ID: > * Added open_module_list_etc() that also allows to specify a required name > suffix. You can use this to verify the version of a module_info structure. AFAIK, we do have fnmatch() here standing ready to help anyone in our libroot/kernel. Instead of adding an *_etc() extra API, poor open_module_list() may have been enhanced to support wildcard(s), like this: list = open_module_list("network/protocol/*/v1"); Just my .02 cent to keep API simple. > * Made module_info::std_ops optional. Nice, this is very welcomed, in particular since we have helpful module_dependencies automagical feature. - Philippe From ingo_weinhold at gmx.de Wed Apr 9 23:21:46 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 09 Apr 2008 23:21:46 +0200 Subject: [Haiku-commits] r24873 - in haiku/trunk: headers/os/drivers src/system/kernel src/tests/add-ons/kernel In-Reply-To: References: Message-ID: <20080409232146.1003.2@knochen-vm.1207775225.fake> On 2008-04-09 at 22:37:15 [+0200], philippe.houdoin at free.fr wrote: > > * Added open_module_list_etc() that also allows to specify a required name > > suffix. You can use this to verify the version of a module_info > > structure. > > AFAIK, we do have fnmatch() here standing ready to help anyone in our > libroot/kernel. > Instead of adding an *_etc() extra API, poor open_module_list() may have > been enhanced to support wildcard(s), like this: > > list = open_module_list("network/protocol/*/v1"); > > Just my .02 cent to keep API simple. Sounds good. BTW, our fnmatch.c should be updated. It's governed by the BSD license with advertising clause. CU, Ingo From mmu_man at mail.berlios.de Wed Apr 9 23:53:12 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 9 Apr 2008 23:53:12 +0200 Subject: [Haiku-commits] r24880 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200804092153.m39LrCVj016285@sheep.berlios.de> Author: mmu_man Date: 2008-04-09 23:53:11 +0200 (Wed, 09 Apr 2008) New Revision: 24880 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24880&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp Log: Fix building usb busses with tracing on. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-09 20:28:55 UTC (rev 24879) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-09 21:53:11 UTC (rev 24880) @@ -501,8 +501,10 @@ { #ifdef TRACE_USB set_dprintf_enabled(true); +#ifndef __HAIKU__ load_driver_symbols("ehci"); #endif +#endif if (!sPCIModule) { status_t status = get_module(B_PCI_MODULE_NAME, (module_info **)&sPCIModule); Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-04-09 20:28:55 UTC (rev 24879) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ohci.cpp 2008-04-09 21:53:11 UTC (rev 24880) @@ -1024,8 +1024,10 @@ { #ifdef TRACE_USB set_dprintf_enabled(true); +#ifndef __HAIKU__ load_driver_symbols("ohci"); #endif +#endif if (!sPCIModule) { status_t status = get_module(B_PCI_MODULE_NAME, (module_info **)&sPCIModule); Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-09 20:28:55 UTC (rev 24879) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-09 21:53:11 UTC (rev 24880) @@ -1600,8 +1600,10 @@ { #ifdef TRACE_USB set_dprintf_enabled(true); +#ifndef __HAIKU__ load_driver_symbols("uhci"); #endif +#endif if (!sPCIModule) { status_t status = get_module(B_PCI_MODULE_NAME, (module_info **)&sPCIModule); From bonefish at mail.berlios.de Thu Apr 10 05:04:04 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 10 Apr 2008 05:04:04 +0200 Subject: [Haiku-commits] r24881 - haiku/trunk/headers/posix/sys Message-ID: <200804100304.m3A344Ye032620@sheep.berlios.de> Author: bonefish Date: 2008-04-10 05:04:03 +0200 (Thu, 10 Apr 2008) New Revision: 24881 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24881&view=rev Modified: haiku/trunk/headers/posix/sys/stat.h Log: Added socket macros. Modified: haiku/trunk/headers/posix/sys/stat.h =================================================================== --- haiku/trunk/headers/posix/sys/stat.h 2008-04-09 21:53:11 UTC (rev 24880) +++ haiku/trunk/headers/posix/sys/stat.h 2008-04-10 03:04:03 UTC (rev 24881) @@ -50,6 +50,7 @@ /* standard file types */ #define S_IFMT 00000170000 /* type of file */ +#define S_IFSOCK 00000140000 /* socket */ #define S_IFLNK 00000120000 /* symbolic link */ #define S_IFREG 00000100000 /* regular */ #define S_IFBLK 00000060000 /* block special */ @@ -63,6 +64,7 @@ #define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR) #define S_ISCHR(mode) (((mode) & S_IFMT) == S_IFCHR) #define S_ISFIFO(mode) (((mode) & S_IFMT) == S_IFIFO) +#define S_ISSOCK(mode) (((mode) & S_IFMT) == S_IFSOCK) #define S_ISINDEX(mode) (((mode) & S_INDEX_DIR) == S_INDEX_DIR) #define S_IUMSK 07777 /* user settable bits */ From bonefish at mail.berlios.de Thu Apr 10 05:06:12 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 10 Apr 2008 05:06:12 +0200 Subject: [Haiku-commits] r24882 - haiku/trunk/headers/posix/sys Message-ID: <200804100306.m3A36CCT032726@sheep.berlios.de> Author: bonefish Date: 2008-04-10 05:06:11 +0200 (Thu, 10 Apr 2008) New Revision: 24882 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24882&view=rev Modified: haiku/trunk/headers/posix/sys/un.h Log: Rather use a char[] for the path. uint8_t[] is rather uncomfortable to use with the string and *printf() functions. Modified: haiku/trunk/headers/posix/sys/un.h =================================================================== --- haiku/trunk/headers/posix/sys/un.h 2008-04-10 03:04:03 UTC (rev 24881) +++ haiku/trunk/headers/posix/sys/un.h 2008-04-10 03:06:11 UTC (rev 24882) @@ -12,7 +12,7 @@ struct sockaddr_un { uint8_t sun_len; uint8_t sun_family; - uint8_t sun_path[128]; + char sun_path[128]; }; #endif /* _SYS_UN_H */ From bonefish at mail.berlios.de Thu Apr 10 05:07:08 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 10 Apr 2008 05:07:08 +0200 Subject: [Haiku-commits] r24883 - in haiku/trunk: headers/private/kernel src/system/kernel/fs Message-ID: <200804100307.m3A378Xp000012@sheep.berlios.de> Author: bonefish Date: 2008-04-10 05:07:07 +0200 (Thu, 10 Apr 2008) New Revision: 24883 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24883&view=rev Modified: haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/src/system/kernel/fs/vfs.cpp Log: New service function vfs_create_special_node() to create special nodes. Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2008-04-10 03:06:11 UTC (rev 24882) +++ haiku/trunk/headers/private/kernel/vfs.h 2008-04-10 03:07:07 UTC (rev 24883) @@ -128,6 +128,11 @@ status_t vfs_normalize_path(const char *path, char *buffer, size_t bufferSize, bool kernel); +/* service call for whoever wants to create a special node */ +status_t vfs_create_special_node(const char *path, fs_vnode *subVnode, + mode_t mode, uint32 flags, bool kernel, fs_vnode *_superVnode, + struct vnode **_createdVnode); + /* service call for the node monitor */ status_t resolve_mount_point_to_volume_root(dev_t mountID, ino_t nodeID, dev_t *resolvedMountID, ino_t *resolvedNodeID); Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-10 03:06:11 UTC (rev 24882) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-10 03:07:07 UTC (rev 24883) @@ -3737,6 +3737,87 @@ } +/*! \brief Creates a special node in the file system. + + The caller gets a reference to the newly created node (which is passed + back through \a _createdVnode) and is responsible for releasing it. + + \param path The path where to create the entry for the node. Can be \c NULL, + in which case the node is created without an entry in the root FS -- it + will automatically be deleted when the last reference has been released. + \param subVnode The definition of the subnode. Can be \c NULL, in which case + the target file system will just create the node with its standard + operations. Depending on the type of the node a subnode might be created + automatically, though. + \param mode The type and permissions for the node to be created. + \param flags Flags to be passed to the creating FS. + \param kernel \c true, if called in the kernel context (relevant only if + \a path is not \c NULL and not absolute). + \param _superVnode Pointer to a pre-allocated structure to be filled by the + file system creating the node, with the private data pointer and + operations for the super node. Can be \c NULL. + \param _createVnode Pointer to pre-allocated storage where to store the + pointer to the newly created node. + \return \c B_OK, if everything went fine, another error code otherwise. +*/ +status_t +vfs_create_special_node(const char *path, fs_vnode *subVnode, mode_t mode, + uint32 flags, bool kernel, fs_vnode *_superVnode, + struct vnode **_createdVnode) +{ + struct vnode* dirNode; + char _leaf[B_FILE_NAME_LENGTH]; + char* leaf = NULL; + + if (path) { + // We've got a path. Get the dir vnode and the leaf name. + KPath tmpPathBuffer(B_PATH_NAME_LENGTH + 1); + if (tmpPathBuffer.InitCheck() != B_OK) + return B_NO_MEMORY; + + char* tmpPath = tmpPathBuffer.LockBuffer(); + if (strlcpy(tmpPath, path, B_PATH_NAME_LENGTH) >= B_PATH_NAME_LENGTH) + return B_NAME_TOO_LONG; + + // get the dir vnode and the leaf name + leaf = _leaf; + status_t error = path_to_dir_vnode(tmpPath, &dirNode, leaf, kernel); + if (error != B_OK) + return error; + } else { + // No path. Create the node in the root FS. + dirNode = sRoot; + inc_vnode_ref_count(dirNode); + } + + VNodePutter _(dirNode); + + // check support for creating special nodes + if (!HAS_FS_CALL(dirNode, create_special_node)) + return B_UNSUPPORTED; + + // create the node + fs_vnode superVnode; + ino_t nodeID; + status_t status = FS_CALL(sRoot, create_special_node, leaf, subVnode, + mode, flags, _superVnode != NULL ? _superVnode : &superVnode, &nodeID); + if (status != B_OK) + return status; + + // lookup the node + mutex_lock(&sVnodeMutex); + *_createdVnode = lookup_vnode(dirNode->mount->id, nodeID); + mutex_unlock(&sVnodeMutex); + + if (*_createdVnode == NULL) { + panic("vfs_create_special_node(): lookup of node failed"); + return B_ERROR; + } + + return B_OK; +} + + extern "C" void vfs_put_vnode(struct vnode *vnode) { From bonefish at mail.berlios.de Thu Apr 10 05:17:11 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 10 Apr 2008 05:17:11 +0200 Subject: [Haiku-commits] r24884 - in haiku/trunk/src/add-ons/kernel/network/protocols: . unix Message-ID: <200804100317.m3A3HBtT000608@sheep.berlios.de> Author: bonefish Date: 2008-04-10 05:17:05 +0200 (Thu, 10 Apr 2008) New Revision: 24884 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24884&view=rev Added: haiku/trunk/src/add-ons/kernel/network/protocols/unix/ haiku/trunk/src/add-ons/kernel/network/protocols/unix/Jamfile haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.cpp haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.h haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddressManager.h haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixDebug.h haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.h haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.h haiku/trunk/src/add-ons/kernel/network/protocols/unix/unix.cpp haiku/trunk/src/add-ons/kernel/network/protocols/unix/unix.h Modified: haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile Log: Protocol module for Unix domain stream type sockets. The implementation is almost complete, but still quite buggy (receiving data has a good chance to drop into KDL). Modified: haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile 2008-04-10 03:07:07 UTC (rev 24883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/Jamfile 2008-04-10 03:17:05 UTC (rev 24884) @@ -4,3 +4,4 @@ SubInclude HAIKU_TOP src add-ons kernel network protocols ipv4 ; SubInclude HAIKU_TOP src add-ons kernel network protocols tcp ; SubInclude HAIKU_TOP src add-ons kernel network protocols udp ; +SubInclude HAIKU_TOP src add-ons kernel network protocols unix ; Added: haiku/trunk/src/add-ons/kernel/network/protocols/unix/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/Jamfile 2008-04-10 03:07:07 UTC (rev 24883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/Jamfile 2008-04-10 03:17:05 UTC (rev 24884) @@ -0,0 +1,17 @@ +SubDir HAIKU_TOP src add-ons kernel network protocols unix ; + +UsePrivateKernelHeaders ; +UsePrivateHeaders net ; +UsePrivateHeaders shared ; + +KernelAddon unix : + unix.cpp + UnixAddress.cpp + UnixEndpoint.cpp + UnixFifo.cpp + + Referenceable.cpp +; + +SEARCH on [ FGristFiles Referenceable.cpp ] + = [ FDirName $(HAIKU_TOP) src kits support ] ; Added: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.cpp 2008-04-10 03:07:07 UTC (rev 24883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.cpp 2008-04-10 03:17:05 UTC (rev 24884) @@ -0,0 +1,306 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "UnixAddress.h" + +#include +#include +#include + +#include + +#include +#include + +#include "unix.h" + + +static const sockaddr_un kEmptyAddress = { + 4, // sun_len + AF_UNIX, // sun_family + { '\0', '\0' } // sun_path +}; + + +char* +UnixAddress::ToString(char *buffer, size_t bufferSize) const +{ + if (!IsValid()) + strlcpy(buffer, "", bufferSize); + else if (IsInternalAddress()) + snprintf(buffer, bufferSize, "<%05lx>", fInternalID); + else + snprintf(buffer, bufferSize, "<%ld, %lld>", fVolumeID, fNodeID); + + return buffer; +} + + +// #pragma mark - + + +static status_t +unix_copy_address(const sockaddr *from, sockaddr **to, bool replaceWithZeros, + const sockaddr *mask) +{ + if (replaceWithZeros) { + sockaddr_un* newAddress = (sockaddr_un*)malloc(kEmptyAddress.sun_len); + if (newAddress == NULL) + return B_NO_MEMORY; + + memcpy(newAddress, &kEmptyAddress, kEmptyAddress.sun_len); + + *to = (sockaddr*)newAddress; + return B_OK; + } else { + if (from->sa_family != AF_UNIX) + return B_MISMATCHED_VALUES; + + *to = (sockaddr*)malloc(from->sa_len); + if (*to == NULL) + return B_NO_MEMORY; + + memcpy(*to, from, from->sa_len); + + return B_OK; + } +} + + +static bool +unix_equal_addresses(const sockaddr *a, const sockaddr *b) +{ + // NOTE: We compare syntactically only. The real check would involve + // looking up the node, if for FS addresses. + if (a->sa_len != b->sa_len) + return false; + + return memcmp(a, b, a->sa_len) == 0; +} + + +static bool +unix_equal_ports(const sockaddr *a, const sockaddr *b) +{ + // no ports + return true; +} + + +static bool +unix_equal_addresses_and_ports(const sockaddr *a, const sockaddr *b) +{ + return unix_equal_addresses(a, b); +} + + +static bool +unix_equal_masked_addresses(const sockaddr *a, const sockaddr *b, + const sockaddr *mask) +{ + // no masks + return unix_equal_addresses(a, b); +} + + +static bool +unix_is_empty_address(const sockaddr *address, bool checkPort) +{ + return address->sa_len >= kEmptyAddress.sun_len + && memcmp(address, &kEmptyAddress, kEmptyAddress.sun_len) == 0; +} + + +static int32 +unix_first_mask_bit(const sockaddr *mask) +{ + return 0; +} + + +static bool +unix_check_mask(const sockaddr *address) +{ + return false; +} + + +static status_t +unix_print_address_buffer(const sockaddr *_address, char *buffer, + size_t bufferSize, bool printPort) +{ + if (!buffer) + return B_BAD_VALUE; + + sockaddr_un* address = (sockaddr_un*)_address; + + if (address == NULL) + strlcpy(buffer, "", bufferSize); + else if (address->sun_path[0] != '\0') + strlcpy(buffer, address->sun_path, bufferSize); + else if (address->sun_path[1] != '\0') + snprintf(buffer, bufferSize, "<%.5s>", address->sun_path + 1); + else + strlcpy(buffer, "", bufferSize); + + return B_OK; +} + + +static status_t +unix_print_address(const sockaddr *address, char **_buffer, bool printPort) +{ + char buffer[128]; + status_t error = unix_print_address_buffer(address, buffer, sizeof(buffer), + printPort); + if (error != B_OK) + return error; + + *_buffer = strdup(buffer); + return *_buffer != NULL ? B_OK : B_NO_MEMORY; +} + + +static uint16 +unix_get_port(const sockaddr *address) +{ + return 0; +} + + +static status_t +unix_set_port(sockaddr *address, uint16 port) +{ + return B_BAD_VALUE; +} + + +static status_t +unix_set_to(sockaddr *address, const sockaddr *from) +{ + if (address == NULL || from == NULL) + return B_BAD_VALUE; + + if (from->sa_family != AF_UNIX) + return B_MISMATCHED_VALUES; + + memcpy(address, from, from->sa_len); + return B_OK; +} + + +static status_t +unix_set_to_empty_address(sockaddr *address) +{ + return unix_set_to(address, (sockaddr*)&kEmptyAddress); +} + + +static status_t +unix_mask_address(const sockaddr *address, const sockaddr *mask, + sockaddr *result) +{ + // no masks + return unix_set_to(result, address); +} + + +static status_t +unix_set_to_defaults(sockaddr *defaultMask, sockaddr *defaultBroadcast, + sockaddr *address, sockaddr *netmask) +{ + if (address == NULL) + return B_BAD_VALUE; + + status_t error = B_OK; + if (defaultMask != NULL) + error = unix_set_to_empty_address(defaultMask); + if (error == B_OK && defaultBroadcast != NULL) + error = unix_set_to_empty_address(defaultBroadcast); + + return error; +} + + +static status_t +unix_update_to(sockaddr *address, const sockaddr *from) +{ + if (address == NULL || from == NULL) + return B_BAD_VALUE; + + if (unix_is_empty_address(from, false)) + return B_OK; + + return unix_set_to(address, from); +} + + +static uint32 +hash_address(const sockaddr_un* address) +{ + if (address == NULL) + return 0; + + if (address->sun_path[0] == '\0') { + char buffer[6]; + strlcpy(buffer, address->sun_path + 1, 6); + return hash_hash_string(buffer); + } + + return hash_hash_string(address->sun_path); +} + + +static uint32 +unix_hash_address_pair(const sockaddr *ourAddress, const sockaddr *peerAddress) +{ + return hash_address((sockaddr_un*)ourAddress) * 17 + + hash_address((sockaddr_un*)peerAddress); +} + + +static status_t +unix_checksum_address(struct Checksum *checksum, const sockaddr *_address) +{ + if (checksum == NULL || _address == NULL) + return B_BAD_VALUE; + + sockaddr_un* address = (sockaddr_un*)_address; + int len = (char*)address + address->sun_len - address->sun_path; + for (int i = 0; i < len; i++) + (*checksum) << (uint8)address->sun_path[i]; + + return B_OK; +} + + +net_address_module_info gAddressModule = { + { + NULL, + 0, + NULL + }, + + unix_copy_address, + unix_mask_address, + unix_equal_addresses, + unix_equal_ports, + unix_equal_addresses_and_ports, + unix_equal_masked_addresses, + unix_is_empty_address, + unix_first_mask_bit, + unix_check_mask, + unix_print_address, + unix_print_address_buffer, + unix_get_port, + unix_set_port, + unix_set_to, + unix_set_to_empty_address, + unix_set_to_defaults, + unix_update_to, + unix_hash_address_pair, + unix_checksum_address, + NULL // matches_broadcast_address +}; Added: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.h 2008-04-10 03:07:07 UTC (rev 24883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddress.h 2008-04-10 03:17:05 UTC (rev 24884) @@ -0,0 +1,174 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef UNIX_ADDRESS_H +#define UNIX_ADDRESS_H + +#include + +#include + + +// NOTE: We support the standard FS address space as well as the alternative +// internal address space Linux features (sun_path[0] is 0, followed by 5 hex +// digits, without null-termination). The latter one is nice to have, because +// the address lookup is quick (hash table lookup, instead of asking the VFS to +// resolve the path), and we don't have to pollute the FS when auto-binding +// sockets (e.g. on connect()). + + +#define INTERNAL_UNIX_ADDRESS_LEN (2 + 1 + 5) + // sun_len + sun_family + null byte + 5 hex digits + + +struct vnode; + + +class UnixAddress { +public: + UnixAddress() + { + Unset(); + } + + UnixAddress(const UnixAddress& other) + { + *this = other; + } + + UnixAddress(int32 internalID) + { + SetTo(internalID); + } + + UnixAddress(dev_t volumeID, ino_t nodeID, struct vnode* vnode) + { + SetTo(volumeID, nodeID, vnode); + } + + void SetTo(int32 internalID) + { + fInternalID = internalID; + fVolumeID = -1; + fNodeID = -1; + fVnode = NULL; + } + + void SetTo(dev_t volumeID, ino_t nodeID, struct vnode* vnode) + { + fInternalID = -1; + fVolumeID = volumeID; + fNodeID = nodeID; + fVnode = vnode; + } + + void Unset() + { + fInternalID = -1; + fVolumeID = -1; + fNodeID = -1; + fVnode = NULL; + } + + bool IsValid() const + { + return fInternalID >= 0 || fVolumeID >= 0; + } + + bool IsInternalAddress() const + { + return fInternalID >= 0; + } + + int32 InternalID() const + { + return fInternalID; + } + + int32 VolumeID() const + { + return fVolumeID; + } + + int32 NodeID() const + { + return fNodeID; + } + + struct vnode* Vnode() const + { + return fVnode; + } + + uint32 HashCode() const + { + return fInternalID >= 0 + ? fInternalID + : uint32(fVolumeID) ^ uint32(fNodeID); + } + + char* ToString(char *buffer, size_t bufferSize) const; + + UnixAddress& operator=(const UnixAddress& other) + { + fInternalID = other.fInternalID; + fVolumeID = other.fVolumeID; + fNodeID = other.fNodeID; + fVnode = other.fVnode; + return *this; + } + + bool operator==(const UnixAddress& other) const + { + return fInternalID >= 0 + ? fInternalID == other.fInternalID + : fVolumeID == other.fVolumeID + && fNodeID == other.fNodeID; + } + + bool operator!=(const UnixAddress& other) const + { + return !(*this == other); + } + + static bool IsEmptyAddress(const sockaddr_un& address) + { + return address.sun_len == sizeof(sockaddr) + && address.sun_path[0] == '\0' && address.sun_path[1] == '\0'; + } + + static int32 InternalID(const sockaddr_un& address) + { + if (address.sun_len < INTERNAL_UNIX_ADDRESS_LEN + || address.sun_path[0] != '\0') { + return B_BAD_VALUE; + } + + // parse the ID + int32 id = 0; + + for (int32 i = 0; i < 5; i++) { + char c = address.sun_path[i + 1]; + if (c >= '0' && c <= '9') + id = (id << 4) + (c - '0'); + else if (c >= 'a' && c <= 'f') + id = (id << 4) + 10 + (c - 'a'); + else + return B_BAD_VALUE; + } + + return id; + } + +private: + // fat interface: If fInternalID is >= 0, it's an address in the internal + // namespace, otherwise a FS address. + int32 fInternalID; + dev_t fVolumeID; + ino_t fNodeID; + struct vnode* fVnode; +}; + + +#endif // UNIX_ADDRESS_H Added: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddressManager.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddressManager.h 2008-04-10 03:07:07 UTC (rev 24883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixAddressManager.h 2008-04-10 03:17:05 UTC (rev 24884) @@ -0,0 +1,119 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef UNIX_ADDRESS_MANAGER_H +#define UNIX_ADDRESS_MANAGER_H + +#include +#include + +#include "UnixAddress.h" +#include "UnixEndpoint.h" + + +struct UnixAddressHashDefinition { + typedef UnixAddress KeyType; + typedef UnixEndpoint ValueType; + + size_t HashKey(const KeyType& key) const + { + return key.HashCode(); + } + + size_t Hash(UnixEndpoint* endpoint) const + { + return HashKey(endpoint->Address()); + } + + bool Compare(const KeyType& key, UnixEndpoint* endpoint) const + { + return key == endpoint->Address(); + } + + HashTableLink* GetLink(UnixEndpoint* endpoint) const + { + return endpoint->HashTableLink(); + } +}; + + +class UnixAddressManager { +public: + UnixAddressManager() + { + fLock.sem = -1; + } + + ~UnixAddressManager() + { + if (fLock.sem >= 0) + benaphore_destroy(&fLock); + } + + status_t Init() + { + status_t error = fBoundEndpoints.InitCheck(); + if (error != B_OK) + return error; + + return benaphore_init(&fLock, "unix address manager"); + } + + bool Lock() + { + return benaphore_lock(&fLock) == B_OK; + } + + void Unlock() + { + benaphore_unlock(&fLock); + } + + UnixEndpoint* Lookup(const UnixAddress& address) const + { + return fBoundEndpoints.Lookup(address); + } + + void Add(UnixEndpoint* endpoint) + { + fBoundEndpoints.Insert(endpoint); + } + + void Remove(UnixEndpoint* endpoint) + { + fBoundEndpoints.Remove(endpoint); + } + + int32 NextInternalID() + { + int32 id = fNextInternalID; + fNextInternalID = (id + 1) & 0xfffff; + return id; + } + + int32 NextUnusedInternalID() + { + for (int32 i = 0xfffff; i >= 0; i--) { + int32 id = NextInternalID(); + UnixAddress address(id); + if (Lookup(address) == NULL) + return id; + } + + return ENOBUFS; + } + +private: + typedef OpenHashTable EndpointTable; + + benaphore fLock; + EndpointTable fBoundEndpoints; + int32 fNextInternalID; +}; + + +typedef AutoLocker UnixAddressManagerLocker; + + +#endif // UNIX_ADDRESS_MANAGER_H Added: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixDebug.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixDebug.h 2008-04-10 03:07:07 UTC (rev 24883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixDebug.h 2008-04-10 03:17:05 UTC (rev 24884) @@ -0,0 +1,49 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef UNIX_DEBUG_H +#define UNIX_DEBUG_H + + +#include + + +#if UNIX_DEBUG_LEVEL +# define TRACE(args...) dprintf(args) +# define PRINT_ERROR(error) \ + do { \ + dprintf("[%ld] l. %d: %s: %s\n", find_thread(NULL), \ + __LINE__, __PRETTY_FUNCTION__, strerror(error)); \ + } while (false) +# if UNIX_DEBUG_LEVEL >= 2 +# define REPORT_ERROR(error) PRINT_ERROR(error) +# define RETURN_ERROR(error) \ + do { \ + __typeof(error) error_RETURN_ERROR = (error); \ + PRINT_ERROR(error_RETURN_ERROR); \ + return error_RETURN_ERROR; \ + } while (false) +# else +# define REPORT_ERROR(error) \ + do { \ + __typeof(error) error_REPORT_ERROR = (error); \ + if (error_REPORT_ERROR < 0) \ + PRINT_ERROR(error_REPORT_ERROR); \ + } while (false) +# define RETURN_ERROR(error) \ + do { \ + __typeof(error) error_RETURN_ERROR = (error); \ + if (error_RETURN_ERROR < 0) \ + PRINT_ERROR(error_RETURN_ERROR); \ + return error_RETURN_ERROR; \ + } while (false) +# endif +#else +# define TRACE(args...) do {} while (false) +# define REPORT_ERROR(error) +# define RETURN_ERROR(error) +#endif + + +#endif // UNIX_DEBUG_H Added: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2008-04-10 03:07:07 UTC (rev 24883) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2008-04-10 03:17:05 UTC (rev 24884) @@ -0,0 +1,783 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include "UnixEndpoint.h" + +#include +#include + +#include + +#include + +#include "UnixAddressManager.h" +#include "UnixFifo.h" + + +#define UNIX_ENDPOINT_DEBUG_LEVEL 2 +#define UNIX_DEBUG_LEVEL UNIX_ENDPOINT_DEBUG_LEVEL +#include "UnixDebug.h" + + +// Note on locking order (outermost -> innermost): +// UnixEndpoint: connecting -> listening -> child +// -> UnixFifo (never lock more than one at a time) +// -> UnixAddressManager + + +static inline bigtime_t +absolute_timeout(bigtime_t timeout) +{ + if (timeout == 0 || timeout == B_INFINITE_TIMEOUT) + return timeout; + +// TODO: Make overflow safe! + return timeout + system_time(); +} + + +UnixEndpoint::UnixEndpoint(net_socket* socket) + : + ProtocolSocket(socket), + fAddress(), + fAddressHashLink(), + fPeerEndpoint(NULL), + fReceiveFifo(NULL), + fState(UNIX_ENDPOINT_CLOSED), + fAcceptSemaphore(-1), + fIsChild(false) +{ + TRACE("[%ld] %p->UnixEndpoint::UnixEndpoint()\n", find_thread(NULL), this); + + fLock.sem = -1; +} + + +UnixEndpoint::~UnixEndpoint() +{ + TRACE("[%ld] %p->UnixEndpoint::~UnixEndpoint()\n", find_thread(NULL), this); + + if (fLock.sem >= 0) + benaphore_destroy(&fLock); +} + + +status_t +UnixEndpoint::Init() +{ + TRACE("[%ld] %p->UnixEndpoint::Init()\n", find_thread(NULL), this); + + status_t error = benaphore_init(&fLock, "unix endpoint"); + if (error != B_OK) + RETURN_ERROR(ENOBUFS); + + RETURN_ERROR(B_OK); +} + + +void +UnixEndpoint::Uninit() +{ + TRACE("[%ld] %p->UnixEndpoint::Uninit()\n", find_thread(NULL), this); + + // check whether we're closed + UnixEndpointLocker locker(this); + bool closed = (fState == UNIX_ENDPOINT_CLOSED); + locker.Unlock(); + + if (!closed) { + // That probably means, we're a child endpoint of a listener and + // have been fully connected, but not yet accepted. Our Close() + // hook isn't called in this case. Do it manually. + Close(); + } + + RemoveReference(); +} + + +status_t +UnixEndpoint::Open() +{ + TRACE("[%ld] %p->UnixEndpoint::Open()\n", find_thread(NULL), this); + + status_t error = ProtocolSocket::Open(); + if (error != B_OK) + RETURN_ERROR(error); + + fState = UNIX_ENDPOINT_NOT_CONNECTED; + + RETURN_ERROR(B_OK); +} + + +status_t +UnixEndpoint::Close() +{ + TRACE("[%ld] %p->UnixEndpoint::Close()\n", find_thread(NULL), this); + + UnixEndpointLocker locker(this); + + if (fState == UNIX_ENDPOINT_CONNECTED) { + UnixEndpointLocker peerLocker; + if (_LockConnectedEndpoints(locker, peerLocker) == B_OK) { + // We're still connected. Disconnect both endpoints! + fPeerEndpoint->_Disconnect(); + _Disconnect(); + } + } + + if (fState == UNIX_ENDPOINT_LISTENING) + _StopListening(); + + _Unbind(); + + fState = UNIX_ENDPOINT_CLOSED; + RETURN_ERROR(B_OK); +} + + +status_t +UnixEndpoint::Free() +{ + TRACE("[%ld] %p->UnixEndpoint::Free()\n", find_thread(NULL), this); + + RETURN_ERROR(B_OK); +} + + +status_t +UnixEndpoint::Bind(const struct sockaddr *_address) +{ + if (_address->sa_family != AF_UNIX) + RETURN_ERROR(EAFNOSUPPORT); + + TRACE("[%ld] %p->UnixEndpoint::Bind(\"%s\")\n", find_thread(NULL), this, + ConstSocketAddress(&gAddressModule, _address).AsString().Data()); + + const sockaddr_un* address = (const sockaddr_un*)_address; + + UnixEndpointLocker endpointLocker(this); + + if (fState != UNIX_ENDPOINT_NOT_CONNECTED || IsBound()) + RETURN_ERROR(B_BAD_VALUE); + + if (address->sun_path[0] == '\0') { + UnixAddressManagerLocker addressLocker(gAddressManager); + + // internal address space (or empty address) + int32 internalID; + if (UnixAddress::IsEmptyAddress(*address)) + internalID = gAddressManager.NextUnusedInternalID(); + else + internalID = UnixAddress::InternalID(*address); + if (internalID < 0) + RETURN_ERROR(internalID); + + status_t error = _Bind(internalID); + if (error != B_OK) + RETURN_ERROR(error); + + sockaddr_un* outAddress = (sockaddr_un*)&socket->address; + outAddress->sun_path[0] = '\0'; + sprintf(outAddress->sun_path + 1, "%05lx", internalID); + outAddress->sun_len = INTERNAL_UNIX_ADDRESS_LEN; + // null-byte + 5 hex digits + + gAddressManager.Add(this); + } else { + // FS address space + size_t pathLen = strnlen(address->sun_path, sizeof(address->sun_path)); + if (pathLen == 0 || pathLen == sizeof(address->sun_path)) + RETURN_ERROR(B_BAD_VALUE); + + bool kernel = false; + // TODO: We don't have the info at this point! + struct vnode* vnode; + status_t error = vfs_create_special_node(address->sun_path, + NULL, S_IFSOCK | 0644, 0, kernel, NULL, &vnode); + if (error != B_OK) + RETURN_ERROR(error == B_FILE_EXISTS ? EADDRINUSE : error); + + error = _Bind(vnode); + if (error != B_OK) { + vfs_put_vnode(vnode); + RETURN_ERROR(error); + } + + size_t addressLen = address->sun_path + pathLen + 1 - (char*)address; + memcpy(&socket->address, address, addressLen); + socket->address.ss_len = addressLen; + + UnixAddressManagerLocker addressLocker(gAddressManager); + gAddressManager.Add(this); + } + + RETURN_ERROR(B_OK); +} + + +status_t +UnixEndpoint::Unbind() +{ + TRACE("[%ld] %p->UnixEndpoint::Unbind()\n", find_thread(NULL), this); + + UnixEndpointLocker endpointLocker(this); + + RETURN_ERROR(_Unbind()); +} + + +status_t +UnixEndpoint::Listen(int backlog) +{ + TRACE("[%ld] %p->UnixEndpoint::Listen(%d)\n", find_thread(NULL), this, + backlog); + + UnixEndpointLocker endpointLocker(this); + + if (!IsBound()) + RETURN_ERROR(EDESTADDRREQ); + if (fState != UNIX_ENDPOINT_NOT_CONNECTED) + RETURN_ERROR(EINVAL); + + gSocketModule->set_max_backlog(socket, backlog); + + fAcceptSemaphore = create_sem(0, "unix accept"); + if (fAcceptSemaphore < 0) + RETURN_ERROR(ENOBUFS); + + fState = UNIX_ENDPOINT_LISTENING; + + RETURN_ERROR(B_OK); +} + + +status_t +UnixEndpoint::Connect(const struct sockaddr *_address) +{ + if (_address->sa_family != AF_UNIX) + RETURN_ERROR(EAFNOSUPPORT); + + TRACE("[%ld] %p->UnixEndpoint::Connect(\"%s\")\n", find_thread(NULL), this, + ConstSocketAddress(&gAddressModule, _address).AsString().Data()); + + const sockaddr_un* address = (const sockaddr_un*)_address; + + UnixEndpointLocker endpointLocker(this); + + if (fState == UNIX_ENDPOINT_CONNECTED) + RETURN_ERROR(EISCONN); + + if (fState != UNIX_ENDPOINT_NOT_CONNECTED) + RETURN_ERROR(B_BAD_VALUE); +// TODO: If listening, we could set the backlog to 0 and connect. + + // check the address first + UnixAddress unixAddress; + + if (address->sun_path[0] == '\0') { + // internal address space (or empty address) + int32 internalID; + if (UnixAddress::IsEmptyAddress(*address)) + RETURN_ERROR(B_BAD_VALUE); + + internalID = UnixAddress::InternalID(*address); + if (internalID < 0) + RETURN_ERROR(internalID); + [... truncated: 1510 lines follow ...] From bonefish at mail.berlios.de Thu Apr 10 05:27:34 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 10 Apr 2008 05:27:34 +0200 Subject: [Haiku-commits] r24885 - haiku/trunk/src/add-ons/kernel/network/protocols/unix Message-ID: <200804100327.m3A3RYgv001212@sheep.berlios.de> Author: bonefish Date: 2008-04-10 05:27:31 +0200 (Thu, 10 Apr 2008) New Revision: 24885 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24885&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp Log: Looks like I had been fallen asleep before finishing the implementation. After successfully copying the data from the receive queue into a new buffer, we should actually return that buffer and update the queue size. recv() doesn't KDL anymore when reading less data than queued. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-10 03:17:05 UTC (rev 24884) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-10 03:27:31 UTC (rev 24885) @@ -89,7 +89,10 @@ // remove the part we've copied gBufferModule->remove_header(buffer, size); - + + fSize -= size; + *_buffer = newBuffer; + return B_OK; } From bonefish at mail.berlios.de Thu Apr 10 06:12:46 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 10 Apr 2008 06:12:46 +0200 Subject: [Haiku-commits] r24886 - haiku/trunk/src/add-ons/kernel/network/protocols/unix Message-ID: <200804100412.m3A4Ck1j003976@sheep.berlios.de> Author: bonefish Date: 2008-04-10 06:12:40 +0200 (Thu, 10 Apr 2008) New Revision: 24886 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24886&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp Log: * Added some debug output. * Flags and timeout arguments to acquire_sem_etc() were swapped. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-10 03:27:31 UTC (rev 24885) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-10 04:12:40 UTC (rev 24886) @@ -8,6 +8,11 @@ #include "unix.h" +#define UNIX_FIFO_DEBUG_LEVEL 1 +#define UNIX_DEBUG_LEVEL UNIX_FIFO_DEBUG_LEVEL +#include "UnixDebug.h" + + UnixBufferQueue::UnixBufferQueue(size_t capacity) : fSize(0), @@ -180,6 +185,9 @@ status_t UnixFifo::Read(size_t numBytes, bigtime_t timeout, net_buffer** _buffer) { + TRACE("[%ld] UnixFifo::Read(%lu, %lld)\n", find_thread(NULL), numBytes, + timeout); + if (IsReadShutdown()) return UNIX_FIFO_SHUTDOWN; @@ -206,7 +214,7 @@ release_sem_etc(fWriterSem, 1, B_RELEASE_ALL); } - return error; + RETURN_ERROR(error); } @@ -239,7 +247,7 @@ release_sem_etc(fReaderSem, 1, B_RELEASE_ALL); } - return error; + RETURN_ERROR(error); } @@ -287,18 +295,18 @@ { // wait for the request to reach the front of the queue if (fReaders.Head() != &request && timeout == 0) - return B_WOULD_BLOCK; + RETURN_ERROR(B_WOULD_BLOCK); while (fReaders.Head() != &request && !IsReadShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fReaderSem, 1, timeout, - B_ABSOLUTE_TIMEOUT); + status_t error = acquire_sem_etc(fReaderSem, 1, B_ABSOLUTE_TIMEOUT, + timeout); benaphore_lock(&fLock); if (error != B_OK) - return error; + RETURN_ERROR(error); } if (IsReadShutdown()) @@ -306,24 +314,24 @@ // wait for any data to become available if (fBuffer.Readable() == 0 && timeout == 0) - return B_WOULD_BLOCK; + RETURN_ERROR(B_WOULD_BLOCK); while (fBuffer.Readable() == 0 && !IsReadShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fReaderSem, 1, timeout, - B_ABSOLUTE_TIMEOUT); + status_t error = acquire_sem_etc(fReaderSem, 1, B_ABSOLUTE_TIMEOUT, + timeout); benaphore_lock(&fLock); if (error != B_OK) - return error; + RETURN_ERROR(error); } if (IsReadShutdown()) return UNIX_FIFO_SHUTDOWN; - return fBuffer.Read(numBytes, _buffer); + RETURN_ERROR(fBuffer.Read(numBytes, _buffer)); } @@ -332,18 +340,18 @@ { // wait for the request to reach the front of the queue if (fWriters.Head() != &request && timeout == 0) - return B_WOULD_BLOCK; + RETURN_ERROR(B_WOULD_BLOCK); while (fWriters.Head() != &request && !IsWriteShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fWriterSem, 1, timeout, - B_ABSOLUTE_TIMEOUT); + status_t error = acquire_sem_etc(fWriterSem, 1, B_ABSOLUTE_TIMEOUT, + timeout); benaphore_lock(&fLock); if (error != B_OK) - return error; + RETURN_ERROR(error); } if (IsWriteShutdown()) @@ -351,22 +359,22 @@ // wait for any space to become available if (fBuffer.Writable() < request.size && timeout == 0) - return B_WOULD_BLOCK; + RETURN_ERROR(B_WOULD_BLOCK); while (fBuffer.Writable() < request.size && !IsWriteShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fWriterSem, 1, timeout, - B_ABSOLUTE_TIMEOUT); + status_t error = acquire_sem_etc(fWriterSem, 1, B_ABSOLUTE_TIMEOUT, + timeout); benaphore_lock(&fLock); if (error != B_OK) - return error; + RETURN_ERROR(error); } if (IsWriteShutdown()) return UNIX_FIFO_SHUTDOWN; - return fBuffer.Write(buffer); + RETURN_ERROR(fBuffer.Write(buffer)); } From bonefish at mail.berlios.de Thu Apr 10 07:01:23 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 10 Apr 2008 07:01:23 +0200 Subject: [Haiku-commits] r24887 - haiku/trunk/src/add-ons/kernel/network/protocols/unix Message-ID: <200804100501.m3A51NFP013646@sheep.berlios.de> Author: bonefish Date: 2008-04-10 07:01:21 +0200 (Thu, 10 Apr 2008) New Revision: 24887 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24887&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp Log: Wait states should be interruptable. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-10 04:12:40 UTC (rev 24886) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-10 05:01:21 UTC (rev 24887) @@ -300,8 +300,8 @@ while (fReaders.Head() != &request && !IsReadShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fReaderSem, 1, B_ABSOLUTE_TIMEOUT, - timeout); + status_t error = acquire_sem_etc(fReaderSem, 1, + B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout); benaphore_lock(&fLock); @@ -319,8 +319,8 @@ while (fBuffer.Readable() == 0 && !IsReadShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fReaderSem, 1, B_ABSOLUTE_TIMEOUT, - timeout); + status_t error = acquire_sem_etc(fReaderSem, 1, + B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout); benaphore_lock(&fLock); @@ -345,8 +345,8 @@ while (fWriters.Head() != &request && !IsWriteShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fWriterSem, 1, B_ABSOLUTE_TIMEOUT, - timeout); + status_t error = acquire_sem_etc(fWriterSem, 1, + B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout); benaphore_lock(&fLock); @@ -364,8 +364,8 @@ while (fBuffer.Writable() < request.size && !IsWriteShutdown()) { benaphore_unlock(&fLock); - status_t error = acquire_sem_etc(fWriterSem, 1, B_ABSOLUTE_TIMEOUT, - timeout); + status_t error = acquire_sem_etc(fWriterSem, 1, + B_ABSOLUTE_TIMEOUT | B_CAN_INTERRUPT, timeout); benaphore_lock(&fLock); From revol at free.fr Thu Apr 10 12:51:57 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 10 Apr 2008 12:51:57 +0200 CEST Subject: [Haiku-commits] =?windows-1252?q?r24884_-_in_haiku/trunk/src/add-?= =?windows-1252?q?ons/kernel/network/protocols=3A_=2E_unix?= In-Reply-To: <200804100317.m3A3HBtT000608@sheep.berlios.de> Message-ID: <609399118-BeMail@laptop> > Protocol module for Unix domain stream type sockets. The > implementation > is almost complete, but still quite buggy (receiving data has a good > chance to drop into KDL). Oh you beat me to that. :) Fran?ois. From axeld at pinc-software.de Thu Apr 10 12:59:23 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 10 Apr 2008 12:59:23 +0200 CEST Subject: [Haiku-commits] r24873 - in haiku/trunk: headers/os/drivers src/system/kernel src/tests/add-ons/kernel In-Reply-To: Message-ID: <11968071607-BeMail@zon> wrote: > > * Added open_module_list_etc() that also allows to specify a > > required name > > suffix. You can use this to verify the version of a module_info > > structure. > AFAIK, we do have fnmatch() here standing ready to help anyone in our > libroot/kernel. Not in the kernel yet, though. > Instead of adding an *_etc() extra API, poor open_module_list() may > have been > enhanced to support wildcard(s), like this: > > list = open_module_list("network/protocol/*/v1"); Nice idea, actually. I didn't think of that :-) But OTOH it would quite complicate the implementation (independently from adding fnmatch()), so I'll keep the _etc() version around for now, until someone really wants to change that. Bye, Axel. From axeld at pinc-software.de Thu Apr 10 13:02:29 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 10 Apr 2008 13:02:29 +0200 CEST Subject: [Haiku-commits] r24873 - in haiku/trunk: headers/os/drivers src/system/kernel src/tests/add-ons/kernel In-Reply-To: <20080409232146.1003.2@knochen-vm.1207775225.fake> Message-ID: <12154557335-BeMail@zon> Ingo Weinhold wrote: > BTW, our fnmatch.c should be updated. It's governed by the BSD > license with > advertising clause. I just had a look, and the current FreeBSD version of that file no longer contains it (and adds multibyte support, too) - the license looks strange now, though, as they enumerate 1., 2., 4. - and have no 3. Bye, Axel. From revol at free.fr Thu Apr 10 13:06:38 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 10 Apr 2008 13:06:38 +0200 CEST Subject: [Haiku-commits] r24884 - in haiku/trunk/src/add-ons/kernel/network/protocols: . unix In-Reply-To: <609399118-BeMail@laptop> Message-ID: <1490268682-BeMail@laptop> > > Protocol module for Unix domain stream type sockets. The > > implementation > > is almost complete, but still quite buggy (receiving data has a > > good > > chance to drop into KDL). > > Oh you beat me to that. :) It still seems to miss the ugliest part (anciliary data) :P Not the most used part, but I think ssh uses that for the agent. Fran?ois. From axeld at mail.berlios.de Thu Apr 10 13:43:45 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 10 Apr 2008 13:43:45 +0200 Subject: [Haiku-commits] r24888 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200804101143.m3ABhjoM017983@sheep.berlios.de> Author: axeld Date: 2008-04-10 13:43:45 +0200 (Thu, 10 Apr 2008) New Revision: 24888 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24888&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp Log: * Looks like r24456 was a bit premature: with string attributes, it makes sense to ignore a trailing null byte, which the code now didn't do anymore. * This caused bug #2054. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2008-04-10 05:01:21 UTC (rev 24887) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2008-04-10 11:43:45 UTC (rev 24888) @@ -2311,8 +2311,16 @@ case B_STRING_TYPE: { int result = memcmp(key1, key2, min_c(keyLength1, keyLength2)); - if (result == 0) + if (result == 0) { + // ignore trailing null bytes + if ((keyLength1 == keyLength2 + 1 + && ((uint8 *)key1)[keyLength2] == '\0') + || (keyLength2 == keyLength1 + 1 + && ((uint8 *)key2)[keyLength1] == '\0')) + return 0; + result = keyLength1 - keyLength2; + } return result; } From ingo_weinhold at gmx.de Thu Apr 10 14:41:03 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 10 Apr 2008 14:41:03 +0200 Subject: [Haiku-commits] r24884 - in haiku/trunk/src/add-ons/kernel/network/protocols: . unix In-Reply-To: <1490268682-BeMail@laptop> References: <1490268682-BeMail@laptop> Message-ID: <20080410144103.523.2@knochen-vm.1207828595.fake> On 2008-04-10 at 13:06:38 [+0200], Fran?ois Revol wrote: > > > Protocol module for Unix domain stream type sockets. The > > > implementation > > > is almost complete, but still quite buggy (receiving data has a > > > good > > > chance to drop into KDL). > > > > Oh you beat me to that. :) > > It still seems to miss the ugliest part (anciliary data) :P ATM, that's mostly a limitation of the net stack -- it completely ignores the msghdr::msg_control field, and doesn't pass anything on to the protocol module either. I definitely want to support SCM_RIGHTS, though. > Not the most used part, but I think ssh uses that for the agent. OpenSSH is the main reason I do that for, anyway. :-) CU, Ingo From axeld at mail.berlios.de Thu Apr 10 14:48:42 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 10 Apr 2008 14:48:42 +0200 Subject: [Haiku-commits] r24889 - haiku/trunk/src/system/kernel/util Message-ID: <200804101248.m3ACmgcF024199@sheep.berlios.de> Author: axeld Date: 2008-04-10 14:48:42 +0200 (Thu, 10 Apr 2008) New Revision: 24889 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24889&view=rev Modified: haiku/trunk/src/system/kernel/util/khash.c Log: Removed unused variables. Modified: haiku/trunk/src/system/kernel/util/khash.c =================================================================== --- haiku/trunk/src/system/kernel/util/khash.c 2008-04-10 11:43:45 UTC (rev 24888) +++ haiku/trunk/src/system/kernel/util/khash.c 2008-04-10 12:48:42 UTC (rev 24889) @@ -78,8 +78,6 @@ uint32 newSize = get_prime_table_size(table->num_elements); struct hash_element **newTable; uint32 index; - void *start; - bool status; if (table->table_size >= newSize) return B_OK; From ingo_weinhold at gmx.de Thu Apr 10 15:00:36 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 10 Apr 2008 15:00:36 +0200 Subject: [Haiku-commits] r24873 - in haiku/trunk: headers/os/drivers src/system/kernel src/tests/add-ons/kernel In-Reply-To: <11968071607-BeMail@zon> References: <11968071607-BeMail@zon> Message-ID: <20080410150036.639.3@knochen-vm.1207828595.fake> On 2008-04-10 at 12:59:23 [+0200], Axel D?rfler wrote: > wrote: > > Instead of adding an *_etc() extra API, poor open_module_list() may > > have been > > enhanced to support wildcard(s), like this: > > > > list = open_module_list("network/protocol/*/v1"); > > Nice idea, actually. I didn't think of that :-) > But OTOH it would quite complicate the implementation (independently > from adding fnmatch()), so I'll keep the _etc() version around for now, > until someone really wants to change that. Rethinking that, it's probably more a glob()-like thing one wants to use (with only fnmatch() one had to enumerate all modules and filter them), but working on module names, which usually aren't path names, it can't be used directly. So this seems to be a little more complicated than it originally looked. It would be a nice feature nonetheless. :-) CU, Ingo From ingo_weinhold at gmx.de Thu Apr 10 15:02:02 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 10 Apr 2008 15:02:02 +0200 Subject: [Haiku-commits] r24873 - in haiku/trunk: headers/os/drivers src/system/kernel src/tests/add-ons/kernel In-Reply-To: <12154557335-BeMail@zon> References: <12154557335-BeMail@zon> Message-ID: <20080410150202.669.4@knochen-vm.1207828595.fake> On 2008-04-10 at 13:02:29 [+0200], Axel D?rfler wrote: > Ingo Weinhold wrote: > > BTW, our fnmatch.c should be updated. It's governed by the BSD > > license with > > advertising clause. > > I just had a look, and the current FreeBSD version of that file no > longer contains it (and adds multibyte support, too) - the license > looks strange now, though, as they enumerate 1., 2., 4. - and have no > 3. I think that's normal. They've supposedly got the permission to remove the advertising clause, which, if I understand it correctly, is point 3. CU, Ingo From mmu_man at mail.berlios.de Thu Apr 10 16:52:36 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Apr 2008 16:52:36 +0200 Subject: [Haiku-commits] r24890 - haiku/trunk/data/artwork/icons Message-ID: <200804101452.m3AEqaVY002962@sheep.berlios.de> Author: mmu_man Date: 2008-04-10 16:52:36 +0200 (Thu, 10 Apr 2008) New Revision: 24890 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24890&view=rev Added: haiku/trunk/data/artwork/icons/App_TkWish Log: The artist's reinterpretation of the Tcl/Tk interpreter (wish) icon, derived from the GLTeapot one. It's the old oil lamp with the genius getting out. Would miss a top cover. Added: haiku/trunk/data/artwork/icons/App_TkWish =================================================================== (Binary files differ) Property changes on: haiku/trunk/data/artwork/icons/App_TkWish ___________________________________________________________________ Name: svn:mime-type + application/octet-stream From superstippi at gmx.de Thu Apr 10 17:02:32 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 10 Apr 2008 17:02:32 +0200 Subject: [Haiku-commits] r24890 - haiku/trunk/data/artwork/icons In-Reply-To: <200804101452.m3AEqaVY002962@sheep.berlios.de> References: <200804101452.m3AEqaVY002962@sheep.berlios.de> Message-ID: <20080410170232.2032.2@stippis2.1207833571.fake> mmu_man at BerliOS wrote: > Author: mmu_man > Date: 2008-04-10 16:52:36 +0200 (Thu, 10 Apr 2008) New Revision: 24890 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24890&view=rev > > Added: > haiku/trunk/data/artwork/icons/App_TkWish > Log: > The artist's reinterpretation of the Tcl/Tk interpreter (wish) icon, > derived from the GLTeapot one. It's the old oil lamp with the genius > getting out. Would miss a top cover. Nice! :-) -Stephan From mmu_man at mail.berlios.de Thu Apr 10 18:46:34 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Apr 2008 18:46:34 +0200 Subject: [Haiku-commits] r24891 - haiku/trunk/src/kits/device Message-ID: <200804101646.m3AGkYx7007442@sheep.berlios.de> Author: mmu_man Date: 2008-04-10 18:46:26 +0200 (Thu, 10 Apr 2008) New Revision: 24891 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24891&view=rev Modified: haiku/trunk/src/kits/device/USBDevice.cpp Log: Set close-on-exec flag on USB Kit device descriptors, so apps launched by Tracker won't inherit all the fds to hubs as they do on Zeta :) Modified: haiku/trunk/src/kits/device/USBDevice.cpp =================================================================== --- haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-10 14:52:36 UTC (rev 24890) +++ haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-10 16:46:26 UTC (rev 24891) @@ -49,7 +49,7 @@ return B_BAD_VALUE; fPath = strdup(path); - fRawFD = open(path, O_RDWR); + fRawFD = open(path, O_RDWR|O_CLOEXEC); if (fRawFD < 0) { Unset(); return B_ERROR; From ingo_weinhold at gmx.de Thu Apr 10 19:24:34 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 10 Apr 2008 19:24:34 +0200 Subject: [Haiku-commits] r24891 - haiku/trunk/src/kits/device In-Reply-To: <200804101646.m3AGkYx7007442@sheep.berlios.de> References: <200804101646.m3AGkYx7007442@sheep.berlios.de> Message-ID: <20080410192434.1173.10@knochen-vm.1207828595.fake> On 2008-04-10 at 18:46:34 [+0200], mmu_man at BerliOS wrote: > Author: mmu_man > Date: 2008-04-10 18:46:26 +0200 (Thu, 10 Apr 2008) > New Revision: 24891 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24891&view=rev > > Modified: > haiku/trunk/src/kits/device/USBDevice.cpp > Log: > Set close-on-exec flag on USB Kit device descriptors, so apps launched by > Tracker won't inherit all the fds to hubs as they do on Zeta :) > > > Modified: haiku/trunk/src/kits/device/USBDevice.cpp > =================================================================== > --- haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-10 14:52:36 UTC > (rev 24890) > +++ haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-10 16:46:26 UTC > (rev 24891) > @@ -49,7 +49,7 @@ > return B_BAD_VALUE; > > fPath = strdup(path); > - fRawFD = open(path, O_RDWR); > + fRawFD = open(path, O_RDWR|O_CLOEXEC); Coding style? CU, Ingo From anevilyak at gmail.com Thu Apr 10 19:28:53 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 10 Apr 2008 12:28:53 -0500 Subject: [Haiku-commits] r24888 - haiku/trunk/src/add-ons/kernel/file_systems/bfs In-Reply-To: <200804101143.m3ABhjoM017983@sheep.berlios.de> References: <200804101143.m3ABhjoM017983@sheep.berlios.de> Message-ID: On Thu, Apr 10, 2008 at 6:43 AM, axeld at BerliOS wrote: > =================================================================== > --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2008-04-10 05:01:21 UTC (rev 24887) > +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BPlusTree.cpp 2008-04-10 11:43:45 UTC (rev 24888) > @@ -2311,8 +2311,16 @@ > case B_STRING_TYPE: > { > int result = memcmp(key1, key2, min_c(keyLength1, keyLength2)); > - if (result == 0) I'm just curious, are B_STRING_TYPE attrs not guaranteed to be null terminated? If they are, wouldn't it be simpler to use strncmp since that will factor in the trailing nulls anyways? Regards, Rene From mmu_man at mail.berlios.de Thu Apr 10 20:05:00 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Apr 2008 20:05:00 +0200 Subject: [Haiku-commits] r24892 - haiku/trunk/src/kits/device Message-ID: <200804101805.m3AI50UN011453@sheep.berlios.de> Author: mmu_man Date: 2008-04-10 20:05:00 +0200 (Thu, 10 Apr 2008) New Revision: 24892 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24892&view=rev Modified: haiku/trunk/src/kits/device/USBDevice.cpp Log: Coding style :P Modified: haiku/trunk/src/kits/device/USBDevice.cpp =================================================================== --- haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-10 16:46:26 UTC (rev 24891) +++ haiku/trunk/src/kits/device/USBDevice.cpp 2008-04-10 18:05:00 UTC (rev 24892) @@ -49,7 +49,7 @@ return B_BAD_VALUE; fPath = strdup(path); - fRawFD = open(path, O_RDWR|O_CLOEXEC); + fRawFD = open(path, O_RDWR | O_CLOEXEC); if (fRawFD < 0) { Unset(); return B_ERROR; From mmu_man at mail.berlios.de Thu Apr 10 21:27:26 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Apr 2008 21:27:26 +0200 Subject: [Haiku-commits] r24893 - haiku/trunk/src/system/kernel Message-ID: <200804101927.m3AJRQ6r017725@sheep.berlios.de> Author: mmu_man Date: 2008-04-10 21:27:26 +0200 (Thu, 10 Apr 2008) New Revision: 24893 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24893&view=rev Modified: haiku/trunk/src/system/kernel/thread.cpp Log: Report the stack size from getrlimit(), we might want to get fancier later but that should be enough. Tcl will want that. Modified: haiku/trunk/src/system/kernel/thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/thread.cpp 2008-04-10 18:05:00 UTC (rev 24892) +++ haiku/trunk/src/system/kernel/thread.cpp 2008-04-10 19:27:26 UTC (rev 24893) @@ -2380,6 +2380,11 @@ case RLIMIT_NOVMON: return vfs_getrlimit(resource, rlp); + case RLIMIT_STACK: + rlp->rlim_cur = USER_STACK_SIZE; + rlp->rlim_max = USER_STACK_SIZE; + return 0; + default: return EINVAL; } From mmlr at mail.berlios.de Thu Apr 10 21:55:52 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Thu, 10 Apr 2008 21:55:52 +0200 Subject: [Haiku-commits] r24894 - in haiku/trunk/src/add-ons/kernel: bus_managers/usb drivers/bus/usb Message-ID: <200804101955.m3AJtqTj019528@sheep.berlios.de> Author: mmlr Date: 2008-04-10 21:55:51 +0200 (Thu, 10 Apr 2008) New Revision: 24894 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24894&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h 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/drivers/bus/usb/usb_raw.cpp Log: A few more things to get the USB stack working under BeOS again. We now have KDEBUG on by default which causes benaphores to always use their semaphore. Therefore when initing the benaphore with the inline compatibility function and then using it using the lock.h provided inline would always cause a deadlock and a hanging system under BeOS. Also we now (re-)define the B_KERNEL_{READ|WRITE}_AREA defines for non Haiku targets to 0 apparently which would probably also cause the stack to misbehave. Therefore they are now just redefined (again) to plain B_{READ|WRITE}_AREA in BeOSCompatibility.h. Change the inclusion order in some places so things work as expected. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h 2008-04-10 19:27:26 UTC (rev 24893) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h 2008-04-10 19:55:51 UTC (rev 24894) @@ -2,11 +2,13 @@ #define _USB_BEOS_COMPATIBILITY_H_ #ifndef HAIKU_TARGET_PLATFORM_HAIKU -#include +// prevent inclusion of original lock.h as it conflicts with what we have here +#define _KERNEL_LOCK_H + #include #include +#include - #define IS_USER_ADDRESS(x) (((uint32)x & 0x80000000) > 0) #define IS_KERNEL_ADDRESS(x) (((uint32)x & 0x80000000) == 0) @@ -27,6 +29,13 @@ }; #endif + +typedef struct benaphore { + sem_id sem; + int32 count; +} benaphore; + + inline status_t benaphore_init(benaphore *ben, const char *name) { @@ -50,6 +59,24 @@ } +inline status_t +benaphore_lock(benaphore *ben) +{ + if (atomic_add(&ben->count, -1) <= 0) + return acquire_sem(ben->sem); + return B_OK; +} + + +inline status_t +benaphore_unlock(benaphore *ben) +{ + if (atomic_add(&ben->count, 1) < 0) + return release_sem(ben->sem); + return B_OK; +} + + inline void load_driver_symbols(char *driver) { @@ -67,5 +94,10 @@ return result; } +#undef B_KERNEL_READ_AREA +#define B_KERNEL_READ_AREA B_READ_AREA +#undef B_KERNEL_WRITE_AREA +#define B_KERNEL_WRITE_AREA B_WRITE_AREA + #endif // !HAIKU_TARGET_PLATFORM_HAIKU #endif // !_USB_BEOS_COMPATIBILITY_H_ Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp 2008-04-10 19:27:26 UTC (rev 24893) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb.cpp 2008-04-10 19:55:51 UTC (rev 24894) @@ -20,6 +20,7 @@ { switch (op) { case B_MODULE_INIT: { + TRACE(("usb_module: init\n")); if (gUSBStack) return B_OK; @@ -28,6 +29,7 @@ if (shared >= B_OK && clone_area("usb stack clone", &address, B_ANY_KERNEL_ADDRESS, B_KERNEL_READ_AREA, shared) >= B_OK) { gUSBStack = *((Stack **)address); + TRACE(("usb_module: found shared stack at %p\n", gUSBStack)); return B_OK; } @@ -36,9 +38,9 @@ #ifndef __HAIKU__ load_driver_symbols("usb"); #endif - TRACE(("usb_module: init\n")); #endif Stack *stack = new(std::nothrow) Stack(); + TRACE(("usb_module: stack created %p\n", stack)); if (!stack) return B_NO_MEMORY; 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 2008-04-10 19:27:26 UTC (rev 24893) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/usb_p.h 2008-04-10 19:55:51 UTC (rev 24894) @@ -10,9 +10,9 @@ #ifndef _USB_P_ #define _USB_P_ +#include "BeOSCompatibility.h" +#include "usbspec_p.h" #include -#include "usbspec_p.h" -#include "BeOSCompatibility.h" #ifdef TRACE_USB Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-10 19:27:26 UTC (rev 24893) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-10 19:55:51 UTC (rev 24894) @@ -6,14 +6,15 @@ * Michael Lotz */ +#include "BeOSCompatibility.h" +#include "usb_raw.h" + #include #include #include #include #include #include -#include "usb_raw.h" -#include "BeOSCompatibility.h" //#define TRACE_USB_RAW #ifdef TRACE_USB_RAW From mmlr at mlotz.ch Thu Apr 10 22:08:29 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Thu, 10 Apr 2008 22:08:29 +0200 Subject: [Haiku-commits] =?windows-1252?q?r24894_-_in_haiku/trunk/src/add-?= =?windows-1252?q?ons/kernel=3A_bus=5Fmanagers/usb__drivers/bus/usb?= In-Reply-To: <200804101955.m3AJtqTj019528@sheep.berlios.de> Message-ID: <5465819895-BeMail@primary> > Author: mmlr > Date: 2008-04-10 21:55:51 +0200 (Thu, 10 Apr 2008) > New Revision: 24894 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24894&view=rev > Log: > A few more things to get the USB stack working under BeOS again. We > now have > KDEBUG on by default which causes benaphores to always use their > semaphore. > Therefore when initing the benaphore with the inline compatibility > function > and then using it using the lock.h provided inline would always cause > a > deadlock and a hanging system under BeOS. Of course now I realize that this was caused by r23820 that changed the benaphore behaviour when KDEBUG is on and not that KDEBUG is on itself ... Regards Michael From jackburton at mail.berlios.de Thu Apr 10 22:48:39 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 10 Apr 2008 22:48:39 +0200 Subject: [Haiku-commits] r24895 - haiku/trunk/src/kits/tracker Message-ID: <200804102048.m3AKmdOB024346@sheep.berlios.de> Author: jackburton Date: 2008-04-10 22:48:38 +0200 (Thu, 10 Apr 2008) New Revision: 24895 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24895&view=rev Modified: haiku/trunk/src/kits/tracker/MountMenu.cpp Log: fixed warnings. Modified: haiku/trunk/src/kits/tracker/MountMenu.cpp =================================================================== --- haiku/trunk/src/kits/tracker/MountMenu.cpp 2008-04-10 19:55:51 UTC (rev 24894) +++ haiku/trunk/src/kits/tracker/MountMenu.cpp 2008-04-10 20:48:38 UTC (rev 24895) @@ -98,7 +98,7 @@ AddMenuItemVisitor::Visit(BPartition *partition, int32 level) { if (!partition->ContainsFileSystem()) - return NULL; + return false; // get name (and eventually the type) BString name = partition->ContentName(); @@ -107,7 +107,7 @@ if (name.Length() == 0) { const char *type = partition->ContentType(); if (type == NULL) - return NULL; + return false; name = "(unnamed "; name << type; From jackburton at mail.berlios.de Thu Apr 10 22:57:30 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 10 Apr 2008 22:57:30 +0200 Subject: [Haiku-commits] r24896 - haiku/trunk/src/apps/codycam Message-ID: <200804102057.m3AKvUlY025398@sheep.berlios.de> Author: jackburton Date: 2008-04-10 22:57:29 +0200 (Thu, 10 Apr 2008) New Revision: 24896 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24896&view=rev Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp Log: fixed warning. Modified: haiku/trunk/src/apps/codycam/CodyCam.cpp =================================================================== --- haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-04-10 20:48:38 UTC (rev 24895) +++ haiku/trunk/src/apps/codycam/CodyCam.cpp 2008-04-10 20:57:29 UTC (rev 24896) @@ -598,7 +598,6 @@ case msg_upl_client: if (control != NULL) { - int32 client; message->FindInt32("client", &(fFtpInfo.uploadClient)); FTPINFO("upl client = %ld\n", fFtpInfo.uploadClient); } From jackburton at mail.berlios.de Thu Apr 10 22:58:33 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Thu, 10 Apr 2008 22:58:33 +0200 Subject: [Haiku-commits] r24897 - haiku/trunk/src/apps/aboutsystem Message-ID: <200804102058.m3AKwXIX025706@sheep.berlios.de> Author: jackburton Date: 2008-04-10 22:58:32 +0200 (Thu, 10 Apr 2008) New Revision: 24897 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24897&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Fixed warning. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-10 20:57:29 UTC (rev 24896) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-04-10 20:58:32 UTC (rev 24897) @@ -45,7 +45,6 @@ static const char *UptimeToString(char string[], size_t size); static const char *MemUsageToString(char string[], size_t size, system_info *info); -static const char *CacheUsageToString(char string[], size_t size, system_info *info); static const rgb_color kDarkGrey = { 100, 100, 100, 255 }; static const rgb_color kHaikuGreen = { 42, 131, 36, 255 }; From axeld at pinc-software.de Thu Apr 10 23:26:52 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 10 Apr 2008 23:26:52 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24894_-_in_haiku/trunk/src/add-o?= =?iso-8859-15?q?ns/kernel=3A_bus=5Fmanagers/usb__drivers/bus/usb?= In-Reply-To: <200804101955.m3AJtqTj019528@sheep.berlios.de> Message-ID: <49617931747-BeMail@zon> mmlr at BerliOS wrote: > +#undef B_KERNEL_READ_AREA > +#define B_KERNEL_READ_AREA B_READ_AREA > +#undef B_KERNEL_WRITE_AREA > +#define B_KERNEL_WRITE_AREA B_WRITE_AREA But this is wrong! It B_READ_AREA means readable for userspace. B_WRITE_AREA mean writable for userspace. That's certainly not what you want, or is it? "0" is what it should be in BeOS. Bye, Axel. From axeld at pinc-software.de Thu Apr 10 23:28:57 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 10 Apr 2008 23:28:57 +0200 CEST Subject: [Haiku-commits] r24893 - haiku/trunk/src/system/kernel In-Reply-To: <200804101927.m3AJRQ6r017725@sheep.berlios.de> Message-ID: <49742128664-BeMail@zon> mmu_man at BerliOS wrote: > + case RLIMIT_STACK: > + rlp->rlim_cur = USER_STACK_SIZE; > + rlp->rlim_max = USER_STACK_SIZE; > + return 0; That's only correct for the "other" threads - the main stack uses USER_MAIN_THREAD_STACK_SIZE (16 MB). You can easily test for the main thread - it's stored in the team as well (ie. thread == thread->team-> main_thread). Bye, Axel. From mmlr at mlotz.ch Thu Apr 10 23:30:48 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Thu, 10 Apr 2008 23:30:48 +0200 Subject: [Haiku-commits] r24894 - in haiku/trunk/src/add-ons/kernel: bus_managers/usb drivers/bus/usb In-Reply-To: <49617931747-BeMail@zon> Message-ID: <1672952721-BeMail@primary> > mmlr at BerliOS wrote: > > +#undef B_KERNEL_READ_AREA > > +#define B_KERNEL_READ_AREA B_READ_AREA > > +#undef B_KERNEL_WRITE_AREA > > +#define B_KERNEL_WRITE_AREA B_WRITE_AREA > > But this is wrong! It B_READ_AREA means readable for userspace. > B_WRITE_AREA mean writable for userspace. That's certainly not what > you > want, or is it? "0" is what it should be in BeOS. So areas are always read/writeable from kernel space under BeOS? In fact I haven't tested that at all. I just put that in as a first try to resolve the problem as I saw some redefinition warnings. Afterwards I didn't try without it. But if it's not needed I'll just remove it in that case. Regards Michael From axeld at pinc-software.de Thu Apr 10 23:30:45 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Thu, 10 Apr 2008 23:30:45 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24888_-_haiku/trunk/src/add-ons/?= =?iso-8859-15?q?kernel/file=5Fsystems/bfs?= In-Reply-To: Message-ID: <49850934284-BeMail@zon> "Rene Gollent" wrote: > > > I'm just curious, are B_STRING_TYPE attrs not guaranteed to be null > terminated? If they are, wouldn't it be simpler to use strncmp since > that will factor in the trailing nulls anyways? They just don't have to be null terminated :-) Bye, Axel. From mmu_man at mail.berlios.de Thu Apr 10 23:56:22 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Thu, 10 Apr 2008 23:56:22 +0200 Subject: [Haiku-commits] r24898 - haiku/trunk/src/system/kernel Message-ID: <200804102156.m3ALuMbH030401@sheep.berlios.de> Author: mmu_man Date: 2008-04-10 23:56:22 +0200 (Thu, 10 Apr 2008) New Revision: 24898 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24898&view=rev Modified: haiku/trunk/src/system/kernel/thread.cpp Log: Use the thread's stack size for RLIMIT_STACK, this should work even if we ever implement changing a thread's stack. Modified: haiku/trunk/src/system/kernel/thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/thread.cpp 2008-04-10 20:58:32 UTC (rev 24897) +++ haiku/trunk/src/system/kernel/thread.cpp 2008-04-10 21:56:22 UTC (rev 24898) @@ -2381,9 +2381,14 @@ return vfs_getrlimit(resource, rlp); case RLIMIT_STACK: - rlp->rlim_cur = USER_STACK_SIZE; - rlp->rlim_max = USER_STACK_SIZE; + { + struct thread *thread = thread_get_current_thread(); + if (!thread) + return B_ERROR; + rlp->rlim_cur = thread->user_stack_size; + rlp->rlim_max = thread->user_stack_size; return 0; + } default: return EINVAL; From mmu_man at mail.berlios.de Fri Apr 11 01:29:46 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 11 Apr 2008 01:29:46 +0200 Subject: [Haiku-commits] r24899 - in haiku/trunk/headers/os/drivers: . tty Message-ID: <200804102329.m3ANTkU3026318@sheep.berlios.de> Author: mmu_man Date: 2008-04-11 01:29:45 +0200 (Fri, 11 Apr 2008) New Revision: 24899 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24899&view=rev Added: haiku/trunk/headers/os/drivers/tty/ haiku/trunk/headers/os/drivers/tty/ttylayer.h Log: start of a header for a beos compatible tty module. Added: haiku/trunk/headers/os/drivers/tty/ttylayer.h =================================================================== --- haiku/trunk/headers/os/drivers/tty/ttylayer.h 2008-04-10 21:56:22 UTC (rev 24898) +++ haiku/trunk/headers/os/drivers/tty/ttylayer.h 2008-04-10 23:29:45 UTC (rev 24899) @@ -0,0 +1,76 @@ +/* + * BeOS R5 compatible TTY module API + * + * Copyright 2008, Haiku Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ + +#ifndef _TTY_TTYLAYER_H +#define _TTY_TTYLAYER_H + +#include +#include + +struct ddrover { + +}; + +struct ddomain { + +}; + +typedef bool (*tty_service_func)(struct tty *, struct ddrover *, uint ); + +struct tty { + uint nopen; + uint flags; + struct ddomain dd; + struct ddomain ddi; // used in interrupt context + pid_t pgid; + struct termios t; + uint iactivity; + bool ibusy; + struct str istr; + struct str rstr; + struct str ostr; + struct winsize wsize; + tty_service_func service; + struct sel *sel; + struct tty *ttysel; +}; + +struct ttyfile { + struct tty *tty; + uint flags; + bigtime_t vtime; +}; + + +typedef struct tty_module_info tty_module_info; + +struct tty_module_info { + // not a real bus manager... no rescan() ! + module_info mi; + status_t (*ttyopen)(struct ttyfile *, struct ddrover *, tty_service_func); + status_t (*ttyclose)(struct ttyfile *, struct ddrover *); + status_t (*ttyfree)(struct ttyfile *, struct ddrover *); + status_t (*ttyread)(struct ttyfile *, struct ddrover *, char *, size_t *); + status_t (*ttywrite)(struct ttyfile *, struct ddrover *, const char *, size_t *); + status_t (*ttycontrol)(struct ttyfile *, struct ddrover *, ulong, void *, size_t); +#if 0 /* Dano! */ + status_t (*ttyselect)(struct ttyfile *, struct ddrover *, uint8, uint32, selectsync *); + status_t (*ttydeselect)(struct ttyfile *, struct ddrover *, uint8, selectsync *); +#endif + void (*ttyinit)(struct tty *, bool); + void (*ttyilock)(struct tty *, struct ddrover *, bool ); + void (*ttyhwsignal)(struct tty *, struct ddrover *, int, bool); + int (*ttyin)(struct tty *, struct ddrover *, int); + int (*ttyout)(struct tty *, struct ddrover *); + struct ddrover *(*ddrstart)(struct ddrover *); + void (*ddrdone)(struct ddrover *); + void (*ddracquire)(struct ddrover *, struct ddomain *); +}; + +#define B_TTY_MODULE_NAME "bus_managers/tty/v1" + +#endif /* _TTY_TTYLAYER_H */ From ingo_weinhold at gmx.de Fri Apr 11 02:12:45 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 11 Apr 2008 02:12:45 +0200 Subject: [Haiku-commits] r24899 - in haiku/trunk/headers/os/drivers: . tty In-Reply-To: <200804102329.m3ANTkU3026318@sheep.berlios.de> References: <200804102329.m3ANTkU3026318@sheep.berlios.de> Message-ID: <20080411021245.1030.4@knochen-vm.1207854000.fake> On 2008-04-11 at 01:29:46 [+0200], mmu_man at BerliOS wrote: > Author: mmu_man > Date: 2008-04-11 01:29:45 +0200 (Fri, 11 Apr 2008) > New Revision: 24899 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24899&view=rev > > Added: > haiku/trunk/headers/os/drivers/tty/ > haiku/trunk/headers/os/drivers/tty/ttylayer.h > Log: > start of a header for a beos compatible tty module. Mmh, we don't really need to be compatible, or do we? And from what I've seen we probably don't even want to. CU, Ingo From bonefish at mail.berlios.de Fri Apr 11 05:23:52 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:23:52 +0200 Subject: [Haiku-commits] r24900 - haiku/trunk/headers/private/shared Message-ID: <200804110323.m3B3Nq8E007212@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:23:51 +0200 (Fri, 11 Apr 2008) New Revision: 24900 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24900&view=rev Added: haiku/trunk/headers/private/shared/syscall_utils.h Log: Finally decided to put the often copied RETURN_AND_SET_ERRNO() macro into a header. This version instantiates the given argument only once. Added: haiku/trunk/headers/private/shared/syscall_utils.h =================================================================== --- haiku/trunk/headers/private/shared/syscall_utils.h 2008-04-10 23:29:45 UTC (rev 24899) +++ haiku/trunk/headers/private/shared/syscall_utils.h 2008-04-11 03:23:51 UTC (rev 24900) @@ -0,0 +1,18 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef _SYSCALL_UTILS_H +#define _SYSCALL_UTILS_H + +#define RETURN_AND_SET_ERRNO(err) \ + do { \ + __typeof(err) raseResult = (err); \ + if (raseResult < 0) { \ + errno = raseResult; \ + return -1; \ + } \ + return raseResult; \ + } while (false) + +#endif // _SYSCALL_UTILS_H From bonefish at mail.berlios.de Fri Apr 11 05:25:56 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:25:56 +0200 Subject: [Haiku-commits] r24901 - haiku/trunk/headers/private/libroot/time Message-ID: <200804110325.m3B3Pux5007298@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:25:56 +0200 (Fri, 11 Apr 2008) New Revision: 24901 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24901&view=rev Modified: haiku/trunk/headers/private/libroot/time/private.h Log: Define HAVE_STDINT_H unconditionally. We have it, and some header modification seemed to have caused the macro not to get defined anymore. Modified: haiku/trunk/headers/private/libroot/time/private.h =================================================================== --- haiku/trunk/headers/private/libroot/time/private.h 2008-04-11 03:23:51 UTC (rev 24900) +++ haiku/trunk/headers/private/libroot/time/private.h 2008-04-11 03:25:56 UTC (rev 24901) @@ -131,9 +131,7 @@ ** (glibc 2.1 and later have stdint.h, even with pre-C99 compilers.) */ #ifndef HAVE_STDINT_H -#define HAVE_STDINT_H \ - (199901 <= __STDC_VERSION__ || \ - 2 < (__GLIBC__ + (0 < __GLIBC_MINOR__))) +#define HAVE_STDINT_H 1 #endif /* !defined HAVE_STDINT_H */ #if HAVE_STDINT_H From bonefish at mail.berlios.de Fri Apr 11 05:27:54 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:27:54 +0200 Subject: [Haiku-commits] r24902 - haiku/trunk/headers/posix/sys Message-ID: <200804110327.m3B3RsRE007344@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:27:53 +0200 (Fri, 11 Apr 2008) New Revision: 24902 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24902&view=rev Modified: haiku/trunk/headers/posix/sys/socket.h Log: Changed the type of msghdr::{msg_name,msg_control} to void* as dictated by POSIX. Modified: haiku/trunk/headers/posix/sys/socket.h =================================================================== --- haiku/trunk/headers/posix/sys/socket.h 2008-04-11 03:25:56 UTC (rev 24901) +++ haiku/trunk/headers/posix/sys/socket.h 2008-04-11 03:27:53 UTC (rev 24902) @@ -94,11 +94,11 @@ }; struct msghdr { - char *msg_name; /* address we're using (optional) */ + void *msg_name; /* address we're using (optional) */ socklen_t msg_namelen; /* length of address */ struct iovec *msg_iov; /* scatter/gather array we'll use */ int msg_iovlen; /* # elements in msg_iov */ - char *msg_control; /* extra data */ + void *msg_control; /* extra data */ socklen_t msg_controllen; /* length of extra data */ int msg_flags; /* flags */ }; From bonefish at mail.berlios.de Fri Apr 11 05:29:42 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:29:42 +0200 Subject: [Haiku-commits] r24903 - haiku/trunk/headers/private/kernel Message-ID: <200804110329.m3B3TgpF007404@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:29:42 +0200 (Fri, 11 Apr 2008) New Revision: 24903 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24903&view=rev Modified: haiku/trunk/headers/private/kernel/syscall_restart.h Log: Added two helper classes for dealing with restarts of ioctl() like syscalls. Modified: haiku/trunk/headers/private/kernel/syscall_restart.h =================================================================== --- haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-11 03:27:53 UTC (rev 24902) +++ haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-11 03:29:42 UTC (rev 24903) @@ -113,4 +113,47 @@ } +struct IoctlSyscallFlagUnsetter { + IoctlSyscallFlagUnsetter() + { + struct thread *thread = thread_get_current_thread(); + fWasSyscall = (atomic_and(&thread->flags, ~THREAD_FLAGS_IOCTL_SYSCALL) + & THREAD_FLAGS_IOCTL_SYSCALL) != 0; + } + + ~IoctlSyscallFlagUnsetter() + { + struct thread *thread = thread_get_current_thread(); + if (fWasSyscall) + atomic_or(&thread->flags, THREAD_FLAGS_IOCTL_SYSCALL); + } + +private: + bool fWasSyscall; +}; + + +template +struct IoctlSyscallRestartWrapper { + IoctlSyscallRestartWrapper(const Type& result) + : fResult(result) + { + struct thread *thread = thread_get_current_thread(); + atomic_or(&thread->flags, THREAD_FLAGS_IOCTL_SYSCALL); + } + + ~IoctlSyscallRestartWrapper() + { + struct thread *thread = thread_get_current_thread(); + atomic_and(&thread->flags, ~THREAD_FLAGS_IOCTL_SYSCALL); + + if (fResult < 0) + syscall_restart_ioctl_handle_post(fResult); + } + +private: + const Type& fResult; +}; + + #endif // _KERNEL_SYSCALL_RESTART_H From bonefish at mail.berlios.de Fri Apr 11 05:32:46 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:32:46 +0200 Subject: [Haiku-commits] r24904 - haiku/trunk/src/system/kernel/fs Message-ID: <200804110332.m3B3WkFh007739@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:32:45 +0200 (Fri, 11 Apr 2008) New Revision: 24904 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24904&view=rev Modified: haiku/trunk/src/system/kernel/fs/fd.cpp Log: * Fixed some checks for user addresses. IS_KERNEL_ADDRESS is not the same as !IS_USER_ADDRESS. * Use the new IoctlSyscallFlagUnsetter helper class in _kern_ioctl(). The former implementation wasn't checking correctly for a previous syscall flag. Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-11 03:29:42 UTC (rev 24903) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-11 03:32:45 UTC (rev 24904) @@ -624,7 +624,7 @@ static ssize_t common_user_io(int fd, off_t pos, void *buffer, size_t length, bool write) { - if (IS_KERNEL_ADDRESS(buffer)) + if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; if (pos < -1) @@ -814,7 +814,7 @@ { struct file_descriptor *descriptor; - if (IS_KERNEL_ADDRESS(buffer)) + if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; TRACE(("user_ioctl: fd %d\n", fd)); @@ -835,7 +835,7 @@ struct file_descriptor *descriptor; ssize_t retval; - if (IS_KERNEL_ADDRESS(buffer)) + if (!IS_USER_ADDRESS(buffer)) return B_BAD_ADDRESS; TRACE(("user_read_dir(fd = %d, buffer = %p, bufferSize = %ld, count = %lu)\n", fd, buffer, bufferSize, maxCount)); @@ -1120,15 +1120,9 @@ { TRACE(("kern_ioctl: fd %d\n", fd)); - struct thread *thread = thread_get_current_thread(); - bool wasSyscall = atomic_and(&thread->flags, ~THREAD_FLAGS_IOCTL_SYSCALL); + IoctlSyscallFlagUnsetter _; - status_t status = fd_ioctl(true, fd, op, buffer, length); - - if (wasSyscall) - atomic_or(&thread->flags, THREAD_FLAGS_IOCTL_SYSCALL); - - return status; + return fd_ioctl(true, fd, op, buffer, length); } From bonefish at mail.berlios.de Fri Apr 11 05:34:00 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:34:00 +0200 Subject: [Haiku-commits] r24905 - haiku/trunk/headers/private/kernel/fs Message-ID: <200804110334.m3B3Y0bx007839@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:33:59 +0200 (Fri, 11 Apr 2008) New Revision: 24905 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24905&view=rev Modified: haiku/trunk/headers/private/kernel/fs/fd.h Log: Preparation for socket file descriptors. Modified: haiku/trunk/headers/private/kernel/fs/fd.h =================================================================== --- haiku/trunk/headers/private/kernel/fs/fd.h 2008-04-11 03:32:45 UTC (rev 24904) +++ haiku/trunk/headers/private/kernel/fs/fd.h 2008-04-11 03:33:59 UTC (rev 24905) @@ -17,6 +17,7 @@ struct file_descriptor; struct io_context; +struct net_socket; struct selectsync; struct select_info; @@ -47,6 +48,7 @@ union { struct vnode *vnode; struct fs_mount *mount; + struct net_socket *socket; } u; void *cookie; int32 open_mode; From bonefish at mail.berlios.de Fri Apr 11 05:35:16 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:35:16 +0200 Subject: [Haiku-commits] r24906 - haiku/trunk/src/system/kernel/fs Message-ID: <200804110335.m3B3ZG0w007942@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:35:15 +0200 (Fri, 11 Apr 2008) New Revision: 24906 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24906&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Resolved TODO: We can check for sockets, now. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 03:33:59 UTC (rev 24905) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 03:35:15 UTC (rev 24906) @@ -4759,8 +4759,9 @@ // some kinds of files are not seekable switch (stat.st_mode & S_IFMT) { case S_IFIFO: + case S_IFSOCK: return ESPIPE; -// TODO: We don't catch sockets here, but they are not seekable either (ESPIPE)! + // The Open Group Base Specs don't mention any file types besides pipes, // fifos, and sockets specially, so we allow seeking them. case S_IFREG: From bonefish at mail.berlios.de Fri Apr 11 05:37:20 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 05:37:20 +0200 Subject: [Haiku-commits] r24907 - haiku/trunk/src/system/kernel Message-ID: <200804110337.m3B3bKvA008003@sheep.berlios.de> Author: bonefish Date: 2008-04-11 05:37:18 +0200 (Fri, 11 Apr 2008) New Revision: 24907 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24907&view=rev Modified: haiku/trunk/src/system/kernel/syscalls.cpp Log: Removed unused _kern_socket() dummy. Modified: haiku/trunk/src/system/kernel/syscalls.cpp =================================================================== --- haiku/trunk/src/system/kernel/syscalls.cpp 2008-04-11 03:35:15 UTC (rev 24906) +++ haiku/trunk/src/system/kernel/syscalls.cpp 2008-04-11 03:37:18 UTC (rev 24907) @@ -171,15 +171,6 @@ } -// TODO: Replace when networking code is added to the build. - -static inline int -_user_socket(int family, int type, int proto) -{ - return 0; -} - - // #pragma mark - From bonefish at mail.berlios.de Fri Apr 11 06:12:26 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 06:12:26 +0200 Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs Message-ID: <200804110412.m3B4CQWo010103@sheep.berlios.de> Author: bonefish Date: 2008-04-11 06:12:23 +0200 (Fri, 11 Apr 2008) New Revision: 24908 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24908&view=rev Added: haiku/trunk/headers/private/net/net_stack_interface.h haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp haiku/trunk/src/system/kernel/fs/socket.cpp Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/headers/private/kernel/syscalls.h haiku/trunk/headers/private/kernel/vfs.h haiku/trunk/headers/private/net/net_socket.h haiku/trunk/src/add-ons/kernel/network/stack/Jamfile haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp haiku/trunk/src/add-ons/kernel/network/stack/stack_private.h haiku/trunk/src/bin/network/netstat/Jamfile haiku/trunk/src/bin/network/netstat/netstat.cpp haiku/trunk/src/kits/network/Jamfile haiku/trunk/src/kits/network/socket.cpp haiku/trunk/src/system/kernel/fs/Jamfile Log: * Changed the way the socket functions work: - The net_stack driver is no longer used. Instead we have a kernel module which is directly used by syscall implementations in the kernel. I.e. we no longer tunnel those functions through ioctls, but have normal syscalls. - Removed the superfluous net starter module. - Implemented the FDTYPE_SOCKET type file_descriptors, that is sockets are no longer vnode based. - Adjusted libnetwork (the socket function implementations) accordingly. - Adjusted netstat accordingly. * Socket module: - Implemented socketpair(). - Added "kernel" parameter to the control hook. Quite a few more hooks would actually need the parameter, but I didn't change those yet, since that would probably also require changes to the protocol module interface. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/build/jam/HaikuImage 2008-04-11 04:12:23 UTC (rev 24908) @@ -125,7 +125,7 @@ ; BEOS_ADD_ONS_DRIVERS_MIDI = emuxki ; BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com etherpci $(X86_ONLY)ipro1000 - $(X86_ONLY)rtl8139 rtl8169 sis900 $(X86_ONLY)via_rhine wb840 net_stack + $(X86_ONLY)rtl8139 rtl8169 sis900 $(X86_ONLY)via_rhine wb840 $(X86_ONLY)ipro100 $(X86_ONLY)nforce #vlance $(X86_ONLY)marvell_yukon $(X86_ONLY)syskonnect $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x Modified: haiku/trunk/headers/private/kernel/syscalls.h =================================================================== --- haiku/trunk/headers/private/kernel/syscalls.h 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/headers/private/kernel/syscalls.h 2008-04-11 04:12:23 UTC (rev 24908) @@ -12,6 +12,7 @@ #include #include +#include #ifdef __cplusplus @@ -23,6 +24,7 @@ struct fd_set; struct fs_info; struct iovec; +struct net_stat; struct pollfd; struct rlimit; struct sigaction; @@ -222,6 +224,44 @@ extern status_t _kern_get_next_fd_info(team_id team, uint32 *_cookie, struct fd_info *info, size_t infoSize); +// socket functions +extern int _kern_socket(int family, int type, int protocol); +extern status_t _kern_bind(int socket, const struct sockaddr *address, + socklen_t addressLength); +extern status_t _kern_shutdown_socket(int socket, int how); +extern status_t _kern_connect(int socket, const struct sockaddr *address, + socklen_t addressLength); +extern status_t _kern_listen(int socket, int backlog); +extern int _kern_accept(int socket, struct sockaddr *address, + socklen_t *_addressLength); +extern ssize_t _kern_recv(int socket, void *data, size_t length, + int flags); +extern ssize_t _kern_recvfrom(int socket, void *data, size_t length, + int flags, struct sockaddr *address, + socklen_t *_addressLength); +extern ssize_t _kern_recvmsg(int socket, struct msghdr *message, + int flags); +extern ssize_t _kern_send(int socket, const void *data, size_t length, + int flags); +extern ssize_t _kern_sendto(int socket, const void *data, size_t length, + int flags, const struct sockaddr *address, + socklen_t addressLength); +extern ssize_t _kern_sendmsg(int socket, const struct msghdr *message, + int flags); +extern status_t _kern_getsockopt(int socket, int level, int option, + void *value, socklen_t *_length); +extern status_t _kern_setsockopt(int socket, int level, int option, + const void *value, socklen_t length); +extern status_t _kern_getpeername(int socket, struct sockaddr *address, + socklen_t *_addressLength); +extern status_t _kern_getsockname(int socket, struct sockaddr *address, + socklen_t *_addressLength); +extern int _kern_sockatmark(int socket); +extern status_t _kern_socketpair(int family, int type, int protocol, + int *socketVector); +extern status_t _kern_get_next_socket_stat(int family, uint32 *cookie, + struct net_stat *stat); + // node monitor functions extern status_t _kern_stop_notifying(port_id port, uint32 token); extern status_t _kern_start_watching(dev_t device, ino_t node, uint32 flags, Modified: haiku/trunk/headers/private/kernel/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/vfs.h 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/headers/private/kernel/vfs.h 2008-04-11 04:12:23 UTC (rev 24908) @@ -17,6 +17,7 @@ #include #include +#include #include #include @@ -28,12 +29,13 @@ #define B_UNMOUNT_BUSY_PARTITION 0x80000000 +struct file_descriptor; struct kernel_args; -struct vm_cache; -struct file_descriptor; +struct net_stat; +struct pollfd; struct selectsync; struct select_info; -struct pollfd; +struct vm_cache; struct vnode; @@ -197,7 +199,7 @@ int _user_open_query(dev_t device, const char *query, size_t queryLength, uint32 flags, port_id port, int32 token); -/* fd user prototypes (implementation located in fd.c) */ +/* fd user prototypes (implementation located in fd.cpp) */ extern ssize_t _user_read(int fd, off_t pos, void *buffer, size_t bufferSize); extern ssize_t _user_readv(int fd, off_t pos, const iovec *vecs, size_t count); extern ssize_t _user_write(int fd, off_t pos, const void *buffer, size_t bufferSize); @@ -211,6 +213,44 @@ extern status_t _user_lock_node(int fd); extern status_t _user_unlock_node(int fd); +/* socket user prototypes (implementation in socket.cpp) */ +extern int _user_socket(int family, int type, int protocol); +extern status_t _user_bind(int socket, const struct sockaddr *address, + socklen_t addressLength); +extern status_t _user_shutdown_socket(int socket, int how); +extern status_t _user_connect(int socket, const struct sockaddr *address, + socklen_t addressLength); +extern status_t _user_listen(int socket, int backlog); +extern int _user_accept(int socket, struct sockaddr *address, + socklen_t *_addressLength); +extern ssize_t _user_recv(int socket, void *data, size_t length, + int flags); +extern ssize_t _user_recvfrom(int socket, void *data, size_t length, + int flags, struct sockaddr *address, + socklen_t *_addressLength); +extern ssize_t _user_recvmsg(int socket, struct msghdr *message, + int flags); +extern ssize_t _user_send(int socket, const void *data, size_t length, + int flags); +extern ssize_t _user_sendto(int socket, const void *data, size_t length, + int flags, const struct sockaddr *address, + socklen_t addressLength); +extern ssize_t _user_sendmsg(int socket, const struct msghdr *message, + int flags); +extern status_t _user_getsockopt(int socket, int level, int option, + void *value, socklen_t *_length); +extern status_t _user_setsockopt(int socket, int level, int option, + const void *value, socklen_t length); +extern status_t _user_getpeername(int socket, struct sockaddr *address, + socklen_t *_addressLength); +extern status_t _user_getsockname(int socket, struct sockaddr *address, + socklen_t *_addressLength); +extern int _user_sockatmark(int socket); +extern status_t _user_socketpair(int family, int type, int protocol, + int *socketVector); +extern status_t _user_get_next_socket_stat(int family, uint32 *cookie, + struct net_stat *stat); + /* vfs entry points... */ #ifdef __cplusplus Modified: haiku/trunk/headers/private/net/net_socket.h =================================================================== --- haiku/trunk/headers/private/net/net_socket.h 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/headers/private/net/net_socket.h 2008-04-11 04:12:23 UTC (rev 24908) @@ -53,7 +53,7 @@ status_t (*writev)(net_socket *socket, const iovec *vecs, size_t vecCount, size_t *_length); status_t (*control)(net_socket *socket, int32 op, void *data, - size_t length); + size_t length, bool kernel); ssize_t (*read_avail)(net_socket *socket); ssize_t (*send_avail)(net_socket *socket); @@ -81,7 +81,7 @@ // notifications status_t (*request_notification)(net_socket *socket, uint8 event, - uint32 ref, struct selectsync *sync); + struct selectsync *sync); status_t (*cancel_notification)(net_socket *socket, uint8 event, struct selectsync *sync); status_t (*notify)(net_socket *socket, uint8 event, int32 value); @@ -107,6 +107,8 @@ int (*setsockopt)(net_socket *socket, int level, int option, const void *optionValue, int optionLength); int (*shutdown)(net_socket *socket, int direction); + status_t (*socketpair)(int family, int type, int protocol, + net_socket* _sockets[2]); }; #endif // NET_SOCKET_H Added: haiku/trunk/headers/private/net/net_stack_interface.h =================================================================== --- haiku/trunk/headers/private/net/net_stack_interface.h 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/headers/private/net/net_stack_interface.h 2008-04-11 04:12:23 UTC (rev 24908) @@ -0,0 +1,83 @@ +/* + * Copyright 2008, Haiku, Inc. All Rights Reserved. + * This file may be used under the terms of the MIT License. + */ +#ifndef NET_STACK_INTERFACE_H +#define NET_STACK_INTERFACE_H + + +#include + + +// name of the kernel stack interface +#define NET_STACK_INTERFACE_MODULE_NAME "network/stack/kernel_interface/v1" + +// name of the userland stack interface +#define NET_STACK_USERLAND_INTERFACE_MODULE_NAME \ + "network/stack/userland_interface/v1" + + +struct net_socket; +struct net_stat; + + +struct net_stack_interface_module_info { + module_info info; + + status_t (*open)(int family, int type, int protocol, net_socket** _socket); + status_t (*close)(net_socket* socket); + status_t (*free)(net_socket* socket); + + status_t (*bind)(net_socket* socket, const struct sockaddr* address, + socklen_t addressLength, bool kernel); + status_t (*shutdown)(net_socket* socket, int how); + status_t (*connect)(net_socket* socket, const struct sockaddr* address, + socklen_t addressLength, bool kernel); + status_t (*listen)(net_socket* socket, int backlog); + status_t (*accept)(net_socket* socket, struct sockaddr* address, + socklen_t* _addressLength, net_socket** _acceptedSocket); + + ssize_t (*recv)(net_socket* socket, void* data, size_t length, int flags, + bool kernel); + ssize_t (*recvfrom)(net_socket* socket, void* data, size_t length, + int flags, struct sockaddr* address, + socklen_t* _addressLength, bool kernel); + ssize_t (*recvmsg)(net_socket* socket, struct msghdr* message, int flags, + bool kernel); + + ssize_t (*send)(net_socket* socket, const void* data, size_t length, + int flags, bool kernel); + ssize_t (*sendto)(net_socket* socket, const void* data, size_t length, + int flags, const struct sockaddr* address, + socklen_t addressLength, bool kernel); + ssize_t (*sendmsg)(net_socket* socket, const struct msghdr* message, + int flags, bool kernel); + + status_t (*getsockopt)(net_socket* socket, int level, int option, + void* value, socklen_t* _length); + status_t (*setsockopt)(net_socket* socket, int level, int option, + const void* value, socklen_t length); + + status_t (*getpeername)(net_socket* socket, struct sockaddr* address, + socklen_t* _addressLength); + status_t (*getsockname)(net_socket* socket, struct sockaddr* address, + socklen_t* _addressLength); + + int (*sockatmark)(net_socket* socket); + + status_t (*socketpair)(int family, int type, int protocol, + net_socket* _sockets[2]); + + status_t (*ioctl)(net_socket* socket, uint32 op, void *buffer, + size_t length, bool kernel); + status_t (*select)(net_socket* socket, uint8 event, + struct selectsync *sync); + status_t (*deselect)(net_socket* socket, uint8 event, + struct selectsync *sync); + + status_t (*get_next_socket_stat)(int family, uint32 *cookie, + struct net_stat *stat); +}; + + +#endif // NET_STACK_INTERFACE_H Modified: haiku/trunk/src/add-ons/kernel/network/stack/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/Jamfile 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/add-ons/kernel/network/stack/Jamfile 2008-04-11 04:12:23 UTC (rev 24908) @@ -24,6 +24,7 @@ radix.c routes.cpp stack.cpp + stack_interface.cpp utility.cpp ; Modified: haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/add-ons/kernel/network/stack/interfaces.cpp 2008-04-11 04:12:23 UTC (rev 24908) @@ -270,7 +270,7 @@ // Grab a reference to the networking stack, to make sure it won't be // unloaded as long as an interface exists module_info *module; - get_module(NET_STARTER_MODULE_NAME, &module); + get_module(gNetStackInterfaceModule.info.name, &module); *_interface = interface; return B_OK; @@ -320,7 +320,7 @@ // Release reference of the stack - at this point, our stack may be unloaded // if no other interfaces or sockets are left - put_module(NET_STARTER_MODULE_NAME); + put_module(gNetStackInterfaceModule.info.name); } Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-04-11 04:12:23 UTC (rev 24908) @@ -9,21 +9,26 @@ #include "stack_private.h" -#include -#include -#include +#include +#include +#include +#include +#include + +#include #include #include #include #include #include + #include +#include -#include -#include -#include -#include +#include +#include +#include struct net_socket_private : net_socket { @@ -42,6 +47,8 @@ void socket_delete(net_socket *socket); int socket_bind(net_socket *socket, const struct sockaddr *address, socklen_t addressLength); +int socket_setsockopt(net_socket *socket, int level, int option, + const void *value, int length); struct list sSocketList; @@ -236,8 +243,37 @@ status_t -socket_control(net_socket *socket, int32 op, void *data, size_t length) +socket_control(net_socket *socket, int32 op, void *data, size_t length, + bool kernel) { + switch (op) { + case FIONBIO: + { + if (data == NULL) + return B_BAD_VALUE; + + int value; + if (kernel) { + value = *(int*)data; + } else { + if (!IS_USER_ADDRESS(data) + || user_memcpy(&value, data, sizeof(int)) != B_OK) { + return B_BAD_ADDRESS; + } + } + return socket_setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &value, + sizeof(int)); + } + + case B_SET_BLOCKING_IO: + case B_SET_NONBLOCKING_IO: + { + int value = op == B_SET_NONBLOCKING_IO; + return socket_setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &value, + sizeof(int)); + } + } + return socket->first_info->control(socket->first_protocol, LEVEL_DRIVER_IOCTL, op, data, &length); } @@ -499,8 +535,7 @@ status_t -socket_request_notification(net_socket *_socket, uint8 event, uint32 ref, - selectsync *sync) +socket_request_notification(net_socket *_socket, uint8 event, selectsync *sync) { net_socket_private *socket = (net_socket_private *)_socket; @@ -1177,6 +1212,59 @@ } +status_t +socket_socketpair(int family, int type, int protocol, net_socket* sockets[2]) +{ + sockets[0] = NULL; + sockets[1] = NULL; + + // create sockets + status_t error = socket_open(family, type, protocol, &sockets[0]); + if (error != B_OK) + return error; + + if (error == B_OK) + error = socket_open(family, type, protocol, &sockets[1]); + + // bind one + if (error == B_OK) + error = socket_bind(sockets[0], NULL, 0); + + // start listening + if (error == B_OK) + error = socket_listen(sockets[0], 1); + + // connect them + if (error == B_OK) { + error = socket_connect(sockets[1], (sockaddr*)&sockets[0]->address, + sockets[0]->address.ss_len); + } + + // accept a socket + net_socket* acceptedSocket = NULL; + if (error == B_OK) + error = socket_accept(sockets[0], NULL, NULL, &acceptedSocket); + + if (error == B_OK) { + // everything worked: close the listener socket + socket_close(sockets[0]); + socket_free(sockets[0]); + sockets[0] = acceptedSocket; + } else { + // close sockets on error + for (int i = 0; i < 2; i++) { + if (sockets[i] != NULL) { + socket_close(sockets[i]); + socket_free(sockets[i]); + sockets[i] = NULL; + } + } + } + + return error; +} + + // #pragma mark - @@ -1254,5 +1342,6 @@ socket_send, socket_setsockopt, socket_shutdown, + socket_socketpair }; Modified: haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp 2008-04-11 04:12:23 UTC (rev 24908) @@ -737,7 +737,7 @@ } -static status_t +status_t init_stack() { status_t status = init_domains(); @@ -859,21 +859,6 @@ static status_t -starter_std_ops(int32 op, ...) -{ - switch (op) { - case B_MODULE_INIT: - return init_stack(); - case B_MODULE_UNINIT: - return uninit_stack(); - - default: - return B_ERROR; - } -} - - -static status_t stack_std_ops(int32 op, ...) { switch (op) { @@ -938,18 +923,12 @@ restore_syscall_restart_timeout, }; -static module_info sNetStarterModule = { - NET_STARTER_MODULE_NAME, - 0, - starter_std_ops -}; - module_info *modules[] = { (module_info *)&gNetStackModule, - (module_info *)&sNetStarterModule, (module_info *)&gNetBufferModule, (module_info *)&gNetSocketModule, (module_info *)&gNetDatalinkModule, (module_info *)&gLinkModule, + (module_info *)&gNetStackInterfaceModule, NULL }; Added: haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp 2008-04-11 04:12:23 UTC (rev 24908) @@ -0,0 +1,306 @@ + + + +#include "stack_private.h" + + +/* Interface module providing networking to the kernel. +*/ + + +static status_t +stack_interface_open(int family, int type, int protocol, net_socket** _socket) +{ + return gNetSocketModule.open_socket(family, type, protocol, _socket); +} + + +static status_t +stack_interface_close(net_socket* socket) +{ + return gNetSocketModule.close(socket); +} + + +static status_t +stack_interface_free(net_socket* socket) +{ + return gNetSocketModule.free(socket); +} + + +static status_t +stack_interface_bind(net_socket* socket, const struct sockaddr* address, + socklen_t addressLength, bool kernel) +{ +// TODO: Pass kernel flag! + return gNetSocketModule.bind(socket, address, addressLength); +} + + +static status_t +stack_interface_shutdown(net_socket* socket, int how) +{ + return gNetSocketModule.shutdown(socket, how); +} + + +static status_t +stack_interface_connect(net_socket* socket, const struct sockaddr* address, + socklen_t addressLength, bool kernel) +{ +// TODO: Pass kernel flag! + return gNetSocketModule.connect(socket, address, addressLength); +} + + +static status_t +stack_interface_listen(net_socket* socket, int backlog) +{ + return gNetSocketModule.listen(socket, backlog); +} + + +static status_t +stack_interface_accept(net_socket* socket, struct sockaddr* address, + socklen_t* _addressLength, net_socket** _acceptedSocket) +{ + return gNetSocketModule.accept(socket, address, _addressLength, + _acceptedSocket); +} + + +static ssize_t +stack_interface_recv(net_socket* socket, void* data, size_t length, int flags, + bool kernel) +{ +// TODO: Pass kernel flag! + return gNetSocketModule.receive(socket, NULL, data, length, flags); +} + + +static ssize_t +stack_interface_recvfrom(net_socket* socket, void* data, size_t length, + int flags, struct sockaddr* address, socklen_t* _addressLength, bool kernel) +{ + msghdr message; + iovec vecs[1] = { { data, length } }; + message.msg_name = address; + message.msg_namelen = *_addressLength; + message.msg_iov = vecs; + message.msg_iovlen = 1; + message.msg_control = NULL; + message.msg_controllen = 0; + message.msg_flags = 0; + +// TODO: Pass kernel flag! + status_t error = gNetSocketModule.receive(socket, &message, data, length, + flags); + if (error != B_OK) + return error; + + *_addressLength = message.msg_namelen; + return B_OK; +} + + +static ssize_t +stack_interface_recvmsg(net_socket* socket, struct msghdr* message, int flags, + bool kernel) +{ + void* buffer = NULL; + size_t len = 0; + if (message->msg_iovlen > 0) { + buffer = message->msg_iov[0].iov_base; + len = message->msg_iov[0].iov_len; + } + +// TODO: Pass kernel flag! + return gNetSocketModule.receive(socket, message, buffer, len, flags); +} + + +static ssize_t +stack_interface_send(net_socket* socket, const void* data, size_t length, + int flags, bool kernel) +{ +// TODO: Pass kernel flag! + return gNetSocketModule.send(socket, NULL, data, length, flags); +} + + +static ssize_t +stack_interface_sendto(net_socket* socket, const void* data, size_t length, + int flags, const struct sockaddr* address, socklen_t addressLength, + bool kernel) +{ + msghdr message; + iovec vecs[1] = { { (void*)data, length } }; + message.msg_name = (void*)address; + message.msg_namelen = addressLength; + message.msg_iov = vecs; + message.msg_iovlen = 1; + message.msg_control = NULL; + message.msg_controllen = 0; + message.msg_flags = 0; + +// TODO: Pass kernel flag! + return gNetSocketModule.send(socket, &message, data, length, flags); +} + + +static ssize_t +stack_interface_sendmsg(net_socket* socket, const struct msghdr* message, + int flags, bool kernel) +{ + void* buffer = NULL; + size_t len = 0; + if (message->msg_iovlen > 0) { + buffer = message->msg_iov[0].iov_base; + len = message->msg_iov[0].iov_len; + } + +// TODO: Pass kernel flag! + return gNetSocketModule.send(socket, (msghdr*)message, buffer, len, flags); +} + + +static status_t +stack_interface_getsockopt(net_socket* socket, int level, int option, + void* value, socklen_t* _length) +{ + int length = *_length; + status_t error = gNetSocketModule.getsockopt(socket, level, option, value, + &length); + *_length = length; + return error; +} + + +static status_t +stack_interface_setsockopt(net_socket* socket, int level, int option, + const void* value, socklen_t length) +{ + return gNetSocketModule.setsockopt(socket, level, option, value, length); +} + + +static status_t +stack_interface_getpeername(net_socket* socket, struct sockaddr* address, + socklen_t* _addressLength) +{ + return gNetSocketModule.getpeername(socket, address, _addressLength); +} + + +static status_t +stack_interface_getsockname(net_socket* socket, struct sockaddr* address, + socklen_t* _addressLength) +{ + return gNetSocketModule.getsockname(socket, address, _addressLength); +} + + +static int +stack_interface_sockatmark(net_socket* socket) +{ +// TODO:... + return B_UNSUPPORTED; +} + + +static status_t +stack_interface_socketpair(int family, int type, int protocol, + net_socket* _sockets[2]) +{ + return gNetSocketModule.socketpair(family, type, protocol, _sockets); +} + + +static status_t +stack_interface_ioctl(net_socket* socket, uint32 op, void *buffer, + size_t length, bool kernel) +{ + return gNetSocketModule.control(socket, op, buffer, length, kernel); +} + + +static status_t +stack_interface_select(net_socket* socket, uint8 event, struct selectsync *sync) +{ + return gNetSocketModule.request_notification(socket, event, sync); +} + + +static status_t +stack_interface_deselect(net_socket* socket, uint8 event, + struct selectsync *sync) +{ + return gNetSocketModule.cancel_notification(socket, event, sync); +} + + +status_t +stack_interface_get_next_socket_stat(int family, uint32 *cookie, + struct net_stat *stat) +{ + return gNetSocketModule.get_next_stat(cookie, family, stat); +} + + +static status_t +stack_interface_std_ops(int32 op, ...) +{ + switch (op) { + case B_MODULE_INIT: + return init_stack(); + case B_MODULE_UNINIT: + return uninit_stack(); + + default: + return B_ERROR; + } +} + + +net_stack_interface_module_info gNetStackInterfaceModule = { + { + NET_STACK_INTERFACE_MODULE_NAME, + 0, + stack_interface_std_ops + }, + + &stack_interface_open, + &stack_interface_close, + &stack_interface_free, + + &stack_interface_bind, + &stack_interface_shutdown, + &stack_interface_connect, + &stack_interface_listen, + &stack_interface_accept, + + &stack_interface_recv, + &stack_interface_recvfrom, + &stack_interface_recvmsg, + + &stack_interface_send, + &stack_interface_sendto, + &stack_interface_sendmsg, + + &stack_interface_getsockopt, + &stack_interface_setsockopt, + + &stack_interface_getpeername, + &stack_interface_getsockname, + + &stack_interface_sockatmark, + + &stack_interface_socketpair, + + &stack_interface_ioctl, + &stack_interface_select, + &stack_interface_deselect, + + &stack_interface_get_next_socket_stat +}; Modified: haiku/trunk/src/add-ons/kernel/network/stack/stack_private.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/stack_private.h 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/add-ons/kernel/network/stack/stack_private.h 2008-04-11 04:12:23 UTC (rev 24908) @@ -15,15 +15,15 @@ #include #include #include +#include -#define NET_STARTER_MODULE_NAME "network/stack/starter/v1" - extern net_stack_module_info gNetStackModule; extern net_buffer_module_info gNetBufferModule; extern net_socket_module_info gNetSocketModule; extern net_datalink_module_info gNetDatalinkModule; extern net_datalink_protocol_module_info gDatalinkInterfaceProtocolModule; +extern net_stack_interface_module_info gNetStackInterfaceModule; // stack.cpp status_t register_domain_datalink_protocols(int family, int type, ...); @@ -33,4 +33,7 @@ status_t get_domain_datalink_protocols(net_interface *interface); status_t put_domain_datalink_protocols(net_interface *interface); +status_t init_stack(); +status_t uninit_stack(); + #endif // STACK_PRIVATE_H Modified: haiku/trunk/src/bin/network/netstat/Jamfile =================================================================== --- haiku/trunk/src/bin/network/netstat/Jamfile 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/bin/network/netstat/Jamfile 2008-04-11 04:12:23 UTC (rev 24908) @@ -1,6 +1,7 @@ SubDir HAIKU_TOP src bin network netstat ; UsePrivateHeaders net ; +UsePrivateKernelHeaders ; # for syscalls.h BinCommand netstat : netstat.cpp Modified: haiku/trunk/src/bin/network/netstat/netstat.cpp =================================================================== --- haiku/trunk/src/bin/network/netstat/netstat.cpp 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/bin/network/netstat/netstat.cpp 2008-04-11 04:12:23 UTC (rev 24908) @@ -7,25 +7,23 @@ * James Woodcock */ - -#include - -#include -#include - #include -#include +#include +#include #include +#include #include - -#include #include #include #include #include -#include +#include +#include +#include + + extern const char* __progname; const char* kProgramName = __progname; @@ -110,22 +108,6 @@ } -status_t -get_next_stat(int stack, uint32& cookie, int family, net_stat& stat) -{ - get_next_stat_args args; - args.cookie = cookie; - args.family = family; - - if (ioctl(stack, NET_STACK_GET_NEXT_STAT, &args, sizeof(args)) < 0) - return errno; - - cookie = args.cookie; - memcpy(&stat, &args.stat, sizeof(net_stat)); - return B_OK; -} - - bool get_address_family(const char* argument, int32& familyIndex) { @@ -177,13 +159,6 @@ } } while (opt != -1); - int stack = open(NET_STACK_DRIVER_PATH, O_RDWR); - if (stack < 0) { - fprintf(stderr, "%s: The networking stack doesn't seem to be " - "available.\n", kProgramName); - return -1; - } - bool printProgram = true; // TODO: add some more program options... :-) @@ -193,7 +168,7 @@ uint32 cookie = 0; int family = -1; net_stat stat; - while (get_next_stat(stack, cookie, family, stat) == B_OK) { + while (_kern_get_next_socket_stat(family, &cookie, &stat) == B_OK) { protoent* proto = getprotobynumber(stat.protocol); if (proto != NULL) printf("%-6s ", proto->p_name); @@ -226,7 +201,6 @@ printf("%ld\n", stat.owner); } - close(stack); return 0; } Modified: haiku/trunk/src/kits/network/Jamfile =================================================================== --- haiku/trunk/src/kits/network/Jamfile 2008-04-11 03:37:18 UTC (rev 24907) +++ haiku/trunk/src/kits/network/Jamfile 2008-04-11 04:12:23 UTC (rev 24908) @@ -1,6 +1,7 @@ SubDir HAIKU_TOP src kits network ; -UsePrivateHeaders libroot net ; +UsePrivateHeaders libroot net shared ; +UsePrivateKernelHeaders ; [... truncated: 1639 lines follow ...] From zharik at gmx.li Fri Apr 11 07:37:43 2008 From: zharik at gmx.li (Siarzhuk Zharski) Date: Fri, 11 Apr 2008 07:37:43 +0200 Subject: [Haiku-commits] r24899 - in haiku/trunk/headers/os/drivers: . tty In-Reply-To: <20080411021245.1030.4@knochen-vm.1207854000.fake> References: <200804102329.m3ANTkU3026318@sheep.berlios.de> <20080411021245.1030.4@knochen-vm.1207854000.fake> Message-ID: <47FEF927.6060204@gmx.li> Hi, Ingo! Ingo Weinhold wrote: > On 2008-04-11 at 01:29:46 [+0200], mmu_man at BerliOS > wrote: > >> start of a header for a beos compatible tty module. >> > > Mmh, we don't really need to be compatible, or do we? And from what I've seen > we probably don't even want to. > Lucent and pctel winmodem (and Vigor ISDN?) drivers use that module API and not open-sourced. Should we be aware using those drivers in binary compatibility mode? Theoretically it is possible to link with object modules from Linux drivers - I have some success years ago with smlink one. ;-) From other side original tty module APIs for vanilla R5 and "BONE-ed" R5/Dano has the _same version_ but different layout - look on this select/deselect inside of methods table. :-) So it is not compatible by it's nature. :-D PS: Yes, I understand that almost nobody use those dog-slow modem connections at modern time. ;-) --- Kind Regards, S.Zharski From stefano.ceccherini at gmail.com Fri Apr 11 08:42:16 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Fri, 11 Apr 2008 08:42:16 +0200 Subject: [Haiku-commits] r24899 - in haiku/trunk/headers/os/drivers: . tty In-Reply-To: <47FEF927.6060204@gmx.li> References: <200804102329.m3ANTkU3026318@sheep.berlios.de> <20080411021245.1030.4@knochen-vm.1207854000.fake> <47FEF927.6060204@gmx.li> Message-ID: <894b9700804102342x6dbe3c8ehc4b50fee9847f551@mail.gmail.com> 2008/4/11, Siarzhuk Zharski : > PS: Yes, I understand that almost nobody use those dog-slow modem > connections at modern time. ;-) I do :) And I've a crappy softmodem, too (supported by linux's sl-modem driver) From axeld at pinc-software.de Fri Apr 11 09:36:58 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 11 Apr 2008 09:36:58 +0200 CEST Subject: [Haiku-commits] r24899 - in haiku/trunk/headers/os/drivers: . tty In-Reply-To: <200804102329.m3ANTkU3026318@sheep.berlios.de> Message-ID: <1092913319-BeMail@zon> mmu_man at BerliOS wrote: > Log: > start of a header for a beos compatible tty module. There is really no reason to make this BeOS compatible, though. The TTY part was really ugly, and we only have a single driver (usb_serial) using this - which I would rather port. Bye, Axel. From axeld at pinc-software.de Fri Apr 11 09:57:41 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 11 Apr 2008 09:57:41 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24908_-_in_haiku/trunk=3A_build/?= =?iso-8859-15?q?jam_headers/private/kernel_headers/private/net_src/add-on?= =?iso-8859-15?q?s/kernel/network/stack_src/bin/network/netstat_src/kits/n?= =?iso-8859-15?q?etwork__src/system/kernel/fs?= In-Reply-To: <200804110412.m3B4CQWo010103@sheep.berlios.de> Message-ID: <2335643575-BeMail@zon> bonefish at BerliOS wrote: > - Removed the superfluous net starter module. You mean it is now superfluous, right? ;-) > - Added "kernel" parameter to the control hook. Quite a few more > hooks > would actually need the parameter, but I didn't change those yet, > since that would probably also require changes to the protocol > module interface. I would still rather see a function is_called_from_kernel() or similar that retrieves that information. That would allow us to use it in drivers as well. Bye, Axel. From jackburton at mail.berlios.de Fri Apr 11 10:22:10 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 11 Apr 2008 10:22:10 +0200 Subject: [Haiku-commits] r24909 - in haiku/trunk: headers/os/interface headers/private/interface src/kits/interface Message-ID: <200804110822.m3B8MAnp017146@sheep.berlios.de> Author: jackburton Date: 2008-04-11 10:22:09 +0200 (Fri, 11 Apr 2008) New Revision: 24909 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24909&view=rev Modified: haiku/trunk/headers/os/interface/Menu.h haiku/trunk/headers/private/interface/MenuPrivate.h haiku/trunk/src/kits/interface/Menu.cpp haiku/trunk/src/kits/interface/MenuItem.cpp haiku/trunk/src/kits/interface/Window.cpp Log: Added a class MenuPrivate to handle access to private BMenu methods. BMenuItem and BWindow are no longer friends of BMenu, but use this class instead. Modified: haiku/trunk/headers/os/interface/Menu.h =================================================================== --- haiku/trunk/headers/os/interface/Menu.h 2008-04-11 04:12:23 UTC (rev 24908) +++ haiku/trunk/headers/os/interface/Menu.h 2008-04-11 08:22:09 UTC (rev 24909) @@ -19,6 +19,7 @@ class BMenuWindow; class ExtraMenuData; class TriggerList; + class MenuPrivate; } enum menu_layout { @@ -159,9 +160,8 @@ void* state); private: - friend class BWindow; friend class BMenuBar; - friend class BMenuItem; + friend class BPrivate::MenuPrivate; friend status_t _init_interface_kit_(); friend status_t set_menu_info(menu_info* info); friend status_t get_menu_info(menu_info* info); Modified: haiku/trunk/headers/private/interface/MenuPrivate.h =================================================================== --- haiku/trunk/headers/private/interface/MenuPrivate.h 2008-04-11 04:12:23 UTC (rev 24908) +++ haiku/trunk/headers/private/interface/MenuPrivate.h 2008-04-11 08:22:09 UTC (rev 24909) @@ -8,6 +8,41 @@ MENU_STATE_CLOSED = 5 }; +class BMenu; +class BWindow; + +namespace BPrivate { + +class MenuPrivate { +public: + MenuPrivate(BMenu *menu); + + menu_layout Layout() const; + + void ItemMarked(BMenuItem *item); + void CacheFontInfo(); + + float FontHeight() const; + float Ascent() const; + BRect Padding() const; + void GetItemMargins(float *, float *, float *, float *) const; + + bool IsAltCommandKey() const; + int State(BMenuItem **item = NULL) const; + + void Install(BWindow *window); + void Uninstall(); + void SetSuper(BMenu *menu); + void SetSuperItem(BMenuItem *item); + void InvokeItem(BMenuItem *item, bool now = false); + void QuitTracking(bool thisMenuOnly = true); + +private: + BMenu *fMenu; +}; + +}; + extern const char *kEmptyMenuLabel; Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-04-11 04:12:23 UTC (rev 24908) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-04-11 08:22:09 UTC (rev 24909) @@ -2620,3 +2620,121 @@ return status; } + + +// MenuPrivate +namespace BPrivate { + +MenuPrivate::MenuPrivate(BMenu *menu) + : + fMenu(menu) +{ +} + + +menu_layout +MenuPrivate::Layout() const +{ + return fMenu->Layout(); +} + + +void +MenuPrivate::ItemMarked(BMenuItem *item) +{ + fMenu->_ItemMarked(item); +} + + +void +MenuPrivate::CacheFontInfo() +{ + fMenu->_CacheFontInfo(); +} + + +float +MenuPrivate::FontHeight() const +{ + return fMenu->fFontHeight; +} + + +float +MenuPrivate::Ascent() const +{ + return fMenu->fAscent; +} + + +BRect +MenuPrivate::Padding() const +{ + return fMenu->fPad; +} + + +void +MenuPrivate::GetItemMargins(float *left, float *top, + float *right, float *bottom) const +{ + fMenu->GetItemMargins(left, top, right, bottom); +} + + +bool +MenuPrivate::IsAltCommandKey() const +{ + return fMenu->sAltAsCommandKey; +} + + +int +MenuPrivate::State(BMenuItem **item) const +{ + return fMenu->State(item); +} + + +void +MenuPrivate::Install(BWindow *window) +{ + fMenu->_Install(window); +} + + +void +MenuPrivate::Uninstall() +{ + fMenu->_Uninstall(); +} + + +void +MenuPrivate::SetSuper(BMenu *menu) +{ + fMenu->fSuper = menu; +} + + +void +MenuPrivate::SetSuperItem(BMenuItem *item) +{ + fMenu->fSuperitem = item; +} + + +void +MenuPrivate::InvokeItem(BMenuItem *item, bool now) +{ + fMenu->InvokeItem(item, now); +} + + +void +MenuPrivate::QuitTracking(bool thisMenuOnly) +{ + fMenu->QuitTracking(thisMenuOnly); +} + +} ; Modified: haiku/trunk/src/kits/interface/MenuItem.cpp =================================================================== --- haiku/trunk/src/kits/interface/MenuItem.cpp 2008-04-11 04:12:23 UTC (rev 24908) +++ haiku/trunk/src/kits/interface/MenuItem.cpp 2008-04-11 08:22:09 UTC (rev 24909) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2007, Haiku, Inc. + * Copyright 2001-2008, Haiku, Inc. * Distributed under the terms of the MIT License. * * Authors: @@ -21,6 +21,8 @@ #include #include +#include + #include "utf8_functions.h" const unsigned char kCtrlBits[] = { @@ -69,6 +71,7 @@ const float kLightBGTint = (B_LIGHTEN_1_TINT + B_LIGHTEN_1_TINT + B_NO_TINT) / 3.0; +using BPrivate::MenuPrivate; BMenuItem::BMenuItem(const char *label, BMessage *message, char shortcut, uint32 modifiers) @@ -247,8 +250,10 @@ { fMark = state; - if (state && Menu() != NULL) - Menu()->_ItemMarked(this); + if (state && Menu() != NULL) { + MenuPrivate priv(Menu()); + priv.ItemMarked(this); + } } @@ -372,14 +377,18 @@ void BMenuItem::GetContentSize(float *width, float *height) { - fSuper->_CacheFontInfo(); + // TODO: Get rid of this. BMenu should handle this + // automatically. Maybe it's not even needed, since our + // BFont::Height() caches the value locally + MenuPrivate(fSuper).CacheFontInfo(); fCachedWidth = fSuper->StringWidth(fLabel); if (width) *width = (float)ceil(fCachedWidth); - if (height) - *height = fSuper->fFontHeight; + if (height) { + *height = MenuPrivate(fSuper).FontHeight(); + } } @@ -399,9 +408,9 @@ void BMenuItem::DrawContent() { - fSuper->_CacheFontInfo(); + MenuPrivate(fSuper).CacheFontInfo(); - fSuper->MovePenBy(0, fSuper->fAscent); + fSuper->MovePenBy(0, MenuPrivate(fSuper).Ascent()); BPoint lineStart = fSuper->PenLocation(); float labelWidth, labelHeight; @@ -472,7 +481,8 @@ DrawContent(); // draw extra symbols - if (fSuper->Layout() == B_ITEMS_IN_COLUMN) { + const menu_layout layout = MenuPrivate(fSuper).Layout(); + if (layout == B_ITEMS_IN_COLUMN) { if (IsMarked()) _DrawMarkSymbol(bgColor); @@ -504,8 +514,10 @@ BPoint BMenuItem::ContentLocation() const { - return BPoint(fBounds.left + Menu()->fPad.left, - fBounds.top + Menu()->fPad.top); + const BRect &padding = MenuPrivate(fSuper).Padding(); + + return BPoint(fBounds.left + padding.left, + fBounds.top + padding.top); } @@ -550,7 +562,8 @@ BMenuItem::_InitMenuData(BMenu *menu) { fSubmenu = menu; - fSubmenu->fSuperitem = this; + + MenuPrivate(fSubmenu).SetSuperItem(this); BMenuItem *item = menu->FindMarked(); @@ -564,9 +577,10 @@ void BMenuItem::Install(BWindow *window) { - if (fSubmenu) - fSubmenu->_Install(window); - + if (fSubmenu) { + MenuPrivate(fSubmenu).Install(window); + } + fWindow = window; if (fShortcutChar != 0 && (fModifiers & B_COMMAND_KEY) && fWindow) @@ -619,9 +633,10 @@ void BMenuItem::Uninstall() { - if (fSubmenu != NULL) - fSubmenu->_Uninstall(); - + if (fSubmenu != NULL) { + MenuPrivate(fSubmenu).Uninstall(); + } + if (Target() == fWindow) SetTarget(BMessenger()); @@ -640,7 +655,7 @@ debugger("Error - can't add menu or menu item to more than 1 container (either menu or menubar)."); if (fSubmenu != NULL) { - fSubmenu->fSuper = super; + MenuPrivate(fSubmenu).SetSuper(super); } fSuper = super; @@ -667,7 +682,7 @@ BRect r(fBounds); float leftMargin; - fSuper->GetItemMargins(&leftMargin, NULL, NULL, NULL); + MenuPrivate(fSuper).GetItemMargins(&leftMargin, NULL, NULL, NULL); r.right = r.left + leftMargin - 3; r.left += 1; @@ -715,28 +730,30 @@ if (fSubmenu) where.x -= fBounds.Height() - 3; + const float ascent = MenuPrivate(fSuper).Ascent(); switch (fShortcutChar) { case B_DOWN_ARROW: case B_UP_ARROW: case B_LEFT_ARROW: case B_RIGHT_ARROW: case B_ENTER: - _DrawControlChar(fShortcutChar, where + BPoint(0, fSuper->fAscent)); + _DrawControlChar(fShortcutChar, where + BPoint(0, ascent)); break; default: - fSuper->DrawChar(fShortcutChar, where + BPoint(0, fSuper->fAscent)); + fSuper->DrawChar(fShortcutChar, where + BPoint(0, ascent)); break; } where.y += (fBounds.Height() - 11) / 2 - 1; where.x -= 4; + const bool altCommandKey = MenuPrivate(fSuper).IsAltCommandKey(); if (fModifiers & B_COMMAND_KEY) { BRect rect(0,0,16,10); BBitmap control(rect, B_CMAP8); - if (BMenu::sAltAsCommandKey) + if (altCommandKey) control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8); else control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8); @@ -749,7 +766,7 @@ BRect rect(0,0,16,10); BBitmap control(rect, B_CMAP8); - if (BMenu::sAltAsCommandKey) + if (altCommandKey) control.ImportBits(kCtrlBits, sizeof(kCtrlBits), 17, 0, B_CMAP8); else control.ImportBits(kAltBits, sizeof(kAltBits), 17, 0, B_CMAP8); @@ -774,7 +791,7 @@ BRect r(fBounds); float rightMargin; - fSuper->GetItemMargins(NULL, NULL, &rightMargin, NULL); + MenuPrivate(fSuper).GetItemMargins(NULL, NULL, &rightMargin, NULL); r.left = r.right - rightMargin + 3; r.right -= 1; Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-04-11 04:12:23 UTC (rev 24908) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-04-11 08:22:09 UTC (rev 24909) @@ -94,6 +94,7 @@ using BPrivate::gDefaultTokens; +using BPrivate::MenuPrivate; static property_info sWindowPropInfo[] = { { @@ -359,8 +360,9 @@ BWindow::~BWindow() { - if (BMenu *menu = dynamic_cast(fFocus)) - menu->QuitTracking(); + if (BMenu *menu = dynamic_cast(fFocus)) { + MenuPrivate(menu).QuitTracking(); + } // The BWindow is locked when the destructor is called, // we need to unlock because the menubar thread tries @@ -1052,9 +1054,10 @@ // Close an eventually opened menu // unless the target is the menu itself BMenu *menu = dynamic_cast(fFocus); + MenuPrivate privMenu(menu); if (menu != NULL && menu != view - && menu->State() != MENU_STATE_CLOSED) { - menu->QuitTracking(); + && privMenu.State() != MENU_STATE_CLOSED) { + privMenu.QuitTracking(); return; } @@ -3260,8 +3263,10 @@ // example) if (shortcut->MenuItem() != NULL) { BMenu* menu = shortcut->MenuItem()->Menu(); - if (menu != NULL) - menu->InvokeItem(shortcut->MenuItem(), true); + if (menu != NULL) { + MenuPrivate(menu).InvokeItem(shortcut->MenuItem(), + true); + } } else { BHandler* target = shortcut->Target(); if (target == NULL) From jackburton at mail.berlios.de Fri Apr 11 10:29:54 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 11 Apr 2008 10:29:54 +0200 Subject: [Haiku-commits] r24910 - haiku/trunk/headers/private/interface Message-ID: <200804110829.m3B8Ts0h017612@sheep.berlios.de> Author: jackburton Date: 2008-04-11 10:29:54 +0200 (Fri, 11 Apr 2008) New Revision: 24910 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24910&view=rev Modified: haiku/trunk/headers/private/interface/MenuPrivate.h Log: added missing header Modified: haiku/trunk/headers/private/interface/MenuPrivate.h =================================================================== --- haiku/trunk/headers/private/interface/MenuPrivate.h 2008-04-11 08:22:09 UTC (rev 24909) +++ haiku/trunk/headers/private/interface/MenuPrivate.h 2008-04-11 08:29:54 UTC (rev 24910) @@ -1,3 +1,11 @@ +/* + * Copyright 2006-2008, Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stefano Ceccherini (stefano.ceccherini at gmail.com) + */ + #ifndef __MENU_PRIVATE_H #define __MENU_PRIVATE_H @@ -54,26 +62,6 @@ return square(pointA.x - pointB.x) + square(pointA.y - pointB.y); } -/* -static float -point_rect_distance(const BPoint &point, const BRect &rect) -{ - float horizontal = 0; - float vertical = 0; - if (point.x < rect.left) - horizontal = rect.left - point.x; - else if (point.x > rect.right) - horizontal = point.x - rect.right; - - if (point.y < rect.top) - vertical = rect.top - point.y; - else if (point.y > rect.bottom) - vertical = point.y - rect.bottom; - - return square(horizontal) + square(vertical); -} -*/ - #undef square From jackburton at mail.berlios.de Fri Apr 11 10:53:26 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 11 Apr 2008 10:53:26 +0200 Subject: [Haiku-commits] r24911 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200804110853.m3B8rQki019138@sheep.berlios.de> Author: jackburton Date: 2008-04-11 10:53:25 +0200 (Fri, 11 Apr 2008) New Revision: 24911 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24911&view=rev Modified: haiku/trunk/headers/os/interface/Menu.h haiku/trunk/src/kits/interface/Menu.cpp Log: Renamed some private methods to have the underline prefix, now that BWindow doesn't call them directly anymore. Modified: haiku/trunk/headers/os/interface/Menu.h =================================================================== --- haiku/trunk/headers/os/interface/Menu.h 2008-04-11 08:29:54 UTC (rev 24910) +++ haiku/trunk/headers/os/interface/Menu.h 2008-04-11 08:53:25 UTC (rev 24911) @@ -236,10 +236,9 @@ bool _CustomTrackingWantsToQuit(); - // private methods called by BWindow - int State(BMenuItem** _item = NULL) const; - void InvokeItem(BMenuItem* item, bool now = false); - void QuitTracking(bool onlyThis = true); + int _State(BMenuItem** _item = NULL) const; + void _InvokeItem(BMenuItem* item, bool now = false); + void _QuitTracking(bool onlyThis = true); static menu_info sMenuInfo; static bool sAltAsCommandKey; Modified: haiku/trunk/src/kits/interface/Menu.cpp =================================================================== --- haiku/trunk/src/kits/interface/Menu.cpp 2008-04-11 08:29:54 UTC (rev 24910) +++ haiku/trunk/src/kits/interface/Menu.cpp 2008-04-11 08:53:25 UTC (rev 24911) @@ -869,13 +869,13 @@ case B_ENTER: case B_SPACE: if (fSelected) { - InvokeItem(fSelected); - QuitTracking(false); + _InvokeItem(fSelected); + _QuitTracking(false); } break; case B_ESCAPE: - QuitTracking(); + _QuitTracking(); break; default: @@ -887,7 +887,7 @@ if (item->fTriggerIndex < 0 || item->fTrigger != trigger) continue; - InvokeItem(item); + _InvokeItem(item); } break; } @@ -2135,20 +2135,20 @@ int -BMenu::State(BMenuItem **item) const +BMenu::_State(BMenuItem **item) const { if (fState == MENU_STATE_TRACKING || fState == MENU_STATE_CLOSED) return fState; if (fSelected != NULL && fSelected->Submenu() != NULL) - return fSelected->Submenu()->State(item); + return fSelected->Submenu()->_State(item); return fState; } void -BMenu::InvokeItem(BMenuItem *item, bool now) +BMenu::_InvokeItem(BMenuItem *item, bool now) { if (!item->IsEnabled()) return; @@ -2564,7 +2564,7 @@ void -BMenu::QuitTracking(bool onlyThis) +BMenu::_QuitTracking(bool onlyThis) { _SelectItem(NULL); if (BMenuBar *menuBar = dynamic_cast(this)) @@ -2692,7 +2692,7 @@ int MenuPrivate::State(BMenuItem **item) const { - return fMenu->State(item); + return fMenu->_State(item); } @@ -2727,14 +2727,14 @@ void MenuPrivate::InvokeItem(BMenuItem *item, bool now) { - fMenu->InvokeItem(item, now); + fMenu->_InvokeItem(item, now); } void MenuPrivate::QuitTracking(bool thisMenuOnly) { - fMenu->QuitTracking(thisMenuOnly); + fMenu->_QuitTracking(thisMenuOnly); } } ; From jackburton at mail.berlios.de Fri Apr 11 11:26:11 2008 From: jackburton at mail.berlios.de (jackburton at BerliOS) Date: Fri, 11 Apr 2008 11:26:11 +0200 Subject: [Haiku-commits] r24912 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200804110926.m3B9QB0M023469@sheep.berlios.de> Author: jackburton Date: 2008-04-11 11:26:11 +0200 (Fri, 11 Apr 2008) New Revision: 24912 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24912&view=rev Modified: haiku/trunk/headers/os/interface/View.h haiku/trunk/headers/os/interface/Window.h haiku/trunk/src/kits/interface/PrintJob.cpp haiku/trunk/src/kits/interface/View.cpp Log: Removed unused BWindow friend classes, renamed some BView member variables to fit our guidelines. Modified: haiku/trunk/headers/os/interface/View.h =================================================================== --- haiku/trunk/headers/os/interface/View.h 2008-04-11 08:53:25 UTC (rev 24911) +++ haiku/trunk/headers/os/interface/View.h 2008-04-11 09:26:11 UTC (rev 24912) @@ -632,12 +632,12 @@ int16 fShowLevel; bool fTopLevelView; bool fNoISInteraction; - BPicture* cpicture; - _array_data_* comm; + BPicture* fCurrentPicture; + _array_data_* fCommArray; BScrollBar* fVerScroller; BScrollBar* fHorScroller; - bool f_is_printing; + bool fIsPrinting; bool fAttached; bool _unused_bool1; bool _unused_bool2; Modified: haiku/trunk/headers/os/interface/Window.h =================================================================== --- haiku/trunk/headers/os/interface/Window.h 2008-04-11 08:53:25 UTC (rev 24911) +++ haiku/trunk/headers/os/interface/Window.h 2008-04-11 09:26:11 UTC (rev 24912) @@ -259,14 +259,12 @@ friend class BApplication; friend class BBitmap; - friend class BScrollBar; friend class BView; friend class BMenuItem; friend class BWindowScreen; friend class BDirectWindow; friend class BFilePanel; - friend class BHandler; - friend class _BEventMask; + friend void _set_menu_sem_(BWindow* w, sem_id sem); friend status_t _safe_get_server_token_(const BLooper*, int32*); Modified: haiku/trunk/src/kits/interface/PrintJob.cpp =================================================================== --- haiku/trunk/src/kits/interface/PrintJob.cpp 2008-04-11 08:53:25 UTC (rev 24911) +++ haiku/trunk/src/kits/interface/PrintJob.cpp 2008-04-11 09:26:11 UTC (rev 24912) @@ -663,13 +663,13 @@ region.Set(BRect(rect.left, rect.top, rect.right, rect.bottom)); view->AppendToPicture(picture); - view->f_is_printing = true; + view->fIsPrinting = true; view->PushState(); view->SetOrigin(origin); view->ConstrainClippingRegion(®ion); view->Draw(rect); view->PopState(); - view->f_is_printing = false; + view->fIsPrinting = false; view->EndPicture(); BView *child = view->ChildAt(0); @@ -684,13 +684,13 @@ if (view->Flags() & B_DRAW_ON_CHILDREN) { view->AppendToPicture(picture); - view->f_is_printing = true; + view->fIsPrinting = true; view->PushState(); view->SetOrigin(origin); view->ConstrainClippingRegion(®ion); view->DrawAfterChildren(rect); view->PopState(); - view->f_is_printing = false; + view->fIsPrinting = false; view->EndPicture(); } } Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-04-11 08:53:25 UTC (rev 24911) +++ haiku/trunk/src/kits/interface/View.cpp 2008-04-11 09:26:11 UTC (rev 24912) @@ -966,7 +966,7 @@ bool BView::IsPrinting() const { - return f_is_printing; + return fIsPrinting; } @@ -3017,20 +3017,20 @@ _CheckLock(); - if (comm) { + if (fCommArray) { debugger("Can't nest BeginLineArray calls"); // not fatal, but it helps during // development of your app and is in // line with R5... - delete [] comm->array; - delete comm; + delete [] fCommArray->array; + delete fCommArray; } - comm = new _array_data_; + fCommArray = new _array_data_; - comm->maxCount = count; - comm->count = 0; - comm->array = new _array_hdr_[count]; + fCommArray->maxCount = count; + fCommArray->count = 0; + fCommArray->array = new _array_hdr_[count]; } @@ -3040,19 +3040,20 @@ if (fOwner == NULL) return; - if (!comm) + if (!fCommArray) debugger("BeginLineArray must be called before using AddLine"); _CheckLock(); - if (comm->count < comm->maxCount) { - comm->array[comm->count].startX = pt0.x; - comm->array[comm->count].startY = pt0.y; - comm->array[comm->count].endX = pt1.x; - comm->array[comm->count].endY = pt1.y; - comm->array[comm->count].color = col; + const uint32 &arrayCount = fCommArray->count; + if (arrayCount < fCommArray->maxCount) { + fCommArray->array[arrayCount].startX = pt0.x; + fCommArray->array[arrayCount].startY = pt0.y; + fCommArray->array[arrayCount].endX = pt1.x; + fCommArray->array[arrayCount].endY = pt1.y; + fCommArray->array[arrayCount].color = col; - comm->count++; + fCommArray->count++; } } @@ -3063,14 +3064,15 @@ if (fOwner == NULL) return; - if (!comm) + if (!fCommArray) debugger("Can't call EndLineArray before BeginLineArray"); _CheckLockAndSwitchCurrent(); fOwner->fLink->StartMessage(AS_STROKE_LINEARRAY); - fOwner->fLink->Attach(comm->count); - fOwner->fLink->Attach(comm->array, comm->count * sizeof(_array_hdr_)); + fOwner->fLink->Attach(fCommArray->count); + fOwner->fLink->Attach(fCommArray->array, + fCommArray->count * sizeof(_array_hdr_)); _FlushIfNotInTransaction(); @@ -3094,9 +3096,10 @@ void BView::BeginPicture(BPicture *picture) { - if (_CheckOwnerLockAndSwitchCurrent() && picture && picture->fUsurped == NULL) { - picture->Usurp(cpicture); - cpicture = picture; + if (_CheckOwnerLockAndSwitchCurrent() + && picture && picture->fUsurped == NULL) { + picture->Usurp(fCurrentPicture); + fCurrentPicture = picture; fOwner->fLink->StartMessage(AS_VIEW_BEGIN_PICTURE); } @@ -3115,8 +3118,8 @@ BeginPicture(picture); } else { picture->SetToken(-1); - picture->Usurp(cpicture); - cpicture = picture; + picture->Usurp(fCurrentPicture); + fCurrentPicture = picture; fOwner->fLink->StartMessage(AS_VIEW_APPEND_TO_PICTURE); fOwner->fLink->Attach(token); } @@ -3127,7 +3130,7 @@ BPicture * BView::EndPicture() { - if (_CheckOwnerLockAndSwitchCurrent() && cpicture) { + if (_CheckOwnerLockAndSwitchCurrent() && fCurrentPicture) { int32 token; fOwner->fLink->StartMessage(AS_VIEW_END_PICTURE); @@ -3136,8 +3139,8 @@ if (fOwner->fLink->FlushWithReply(code) == B_OK && code == B_OK && fOwner->fLink->Read(&token) == B_OK) { - BPicture *picture = cpicture; - cpicture = picture->StepDown(); + BPicture *picture = fCurrentPicture; + fCurrentPicture = picture->StepDown(); picture->SetToken(token); return picture; @@ -4223,13 +4226,13 @@ fShowLevel = 0; fTopLevelView = false; - cpicture = NULL; - comm = NULL; + fCurrentPicture = NULL; + fCommArray = NULL; fVerScroller = NULL; fHorScroller = NULL; - f_is_printing = false; + fIsPrinting = false; fAttached = false; fState = new BPrivate::ViewState; @@ -4248,10 +4251,10 @@ void BView::_RemoveCommArray() { - if (comm) { - delete [] comm->array; - delete comm; - comm = NULL; + if (fCommArray) { + delete [] fCommArray->array; + delete fCommArray; + fCommArray = NULL; } } @@ -4927,10 +4930,10 @@ fBounds.left, fBounds.top, fBounds.right, fBounds.bottom, fShowLevel, fTopLevelView ? "YES" : "NO", - cpicture? "YES" : "NULL", + fCurrentPicture? "YES" : "NULL", fVerScroller? "YES" : "NULL", fHorScroller? "YES" : "NULL", - f_is_printing? "YES" : "NO", + fIsPrinting? "YES" : "NO", fShelf? "YES" : "NO", fEventMask, fEventOptions); From axeld at pinc-software.de Fri Apr 11 12:41:46 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 11 Apr 2008 12:41:46 +0200 CEST Subject: [Haiku-commits] r24894 - in haiku/trunk/src/add-ons/kernel: bus_managers/usb drivers/bus/usb In-Reply-To: <1672952721-BeMail@primary> Message-ID: <7030343521-BeMail@zon> "Michael Lotz" wrote: > > mmlr at BerliOS wrote: > > > +#undef B_KERNEL_READ_AREA > > > +#define B_KERNEL_READ_AREA B_READ_AREA > > > +#undef B_KERNEL_WRITE_AREA > > > +#define B_KERNEL_WRITE_AREA B_WRITE_AREA > > But this is wrong! It B_READ_AREA means readable for userspace. > > B_WRITE_AREA mean writable for userspace. That's certainly not what > > you want, or is it? "0" is what it should be in BeOS. > So areas are always read/writeable from kernel space under BeOS? In > fact I haven't tested that at all. I just put that in as a first try > to > resolve the problem as I saw some redefinition warnings. Afterwards I > didn't try without it. But if it's not needed I'll just remove it in > that case. Areas are always readable and writable in kernel space - as long as they aren't explicitly set to read-only (IIRC x86 can only differentiate between r/w and user/kernel, and not mix them). Specifying B_WRITE_AREA allows every application to shredder your data, that's probably not what you intended :-) Bye, Axel. From revol at free.fr Fri Apr 11 13:48:02 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 11 Apr 2008 13:48:02 +0200 CEST Subject: [Haiku-commits] r24899 - in haiku/trunk/headers/os/drivers: . tty In-Reply-To: <20080411021245.1030.4@knochen-vm.1207854000.fake> Message-ID: <981117012-BeMail@laptop> > > On 2008-04-11 at 01:29:46 [+0200], mmu_man at BerliOS > wrote: > > Author: mmu_man > > Date: 2008-04-11 01:29:45 +0200 (Fri, 11 Apr 2008) > > New Revision: 24899 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24899&view=rev > > > > Added: > > haiku/trunk/headers/os/drivers/tty/ > > haiku/trunk/headers/os/drivers/tty/ttylayer.h > > Log: > > start of a header for a beos compatible tty module. > > Mmh, we don't really need to be compatible, or do we? And from what > I've seen > we probably don't even want to. Well, we at least have the usb_serial driver which is in need for it. And I think some modem drivers use it too. And we need a serial port driver also... Doesn't mean we have to stick to it though. Fran?ois. From revol at free.fr Fri Apr 11 13:58:20 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 11 Apr 2008 13:58:20 +0200 CEST Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <2335643575-BeMail@zon> Message-ID: <1599930767-BeMail@laptop> > You mean it is now superfluous, right? ;-) > > > - Added "kernel" parameter to the control hook. Quite a few more > > hooks > > would actually need the parameter, but I didn't change those > > yet, > > since that would probably also require changes to the protocol > > module interface. > > I would still rather see a function is_called_from_kernel() or > similar > that retrieves that information. > That would allow us to use it in drivers as well. Yes something that checks for a thread flag... The kernel versions of the calls would just unset this flag. Fran?ois. From ingo_weinhold at gmx.de Fri Apr 11 15:35:55 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 11 Apr 2008 15:35:55 +0200 Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <2335643575-BeMail@zon> References: <2335643575-BeMail@zon> Message-ID: <20080411153555.679.2@knochen-vm.1207918391.fake> On 2008-04-11 at 09:57:41 [+0200], Axel D?rfler wrote: > bonefish at BerliOS wrote: > > - Removed the superfluous net starter module. > > You mean it is now superfluous, right? ;-) > > > - Added "kernel" parameter to the control hook. Quite a few more > > hooks > > would actually need the parameter, but I didn't change those yet, > > since that would probably also require changes to the protocol > > module interface. > > I would still rather see a function is_called_from_kernel() or similar > that retrieves that information. > That would allow us to use it in drivers as well. I suppose we could use the THREAD_FLAGS_IOCTL_SYSCALL flag (and rename it). It is already set in the socket syscalls that potentially block, but I guess it doesn't harm to do that for all syscalls that enter the network stack. CU, Ingo From ingo_weinhold at gmx.de Fri Apr 11 15:40:25 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 11 Apr 2008 15:40:25 +0200 Subject: [Haiku-commits] r24909 - in haiku/trunk: headers/os/interface headers/private/interface src/kits/interface In-Reply-To: <200804110822.m3B8MAnp017146@sheep.berlios.de> References: <200804110822.m3B8MAnp017146@sheep.berlios.de> Message-ID: <20080411154025.710.3@knochen-vm.1207918391.fake> On 2008-04-11 at 10:22:10 [+0200], jackburton at BerliOS wrote: > Author: jackburton > Date: 2008-04-11 10:22:09 +0200 (Fri, 11 Apr 2008) > New Revision: 24909 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24909&view=rev > > Modified: > haiku/trunk/headers/os/interface/Menu.h > haiku/trunk/headers/private/interface/MenuPrivate.h > haiku/trunk/src/kits/interface/Menu.cpp > haiku/trunk/src/kits/interface/MenuItem.cpp > haiku/trunk/src/kits/interface/Window.cpp > Log: > Added a class MenuPrivate to handle access to private BMenu methods. BTW, for other classes (BMessage, BMessenger, BRoster) we already do a similar thing. There the friend class is an inner class simply called Private, though. CU, Ingo From axeld at mail.berlios.de Fri Apr 11 16:37:49 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 11 Apr 2008 16:37:49 +0200 Subject: [Haiku-commits] r24913 - haiku/trunk/src/system/kernel/fs Message-ID: <200804111437.m3BEbnVS022374@sheep.berlios.de> Author: axeld Date: 2008-04-11 16:37:48 +0200 (Fri, 11 Apr 2008) New Revision: 24913 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24913&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: Applied patch by Christian Fasshauer: * get_dir_path_and_leaf() now removes trailing slashes from the path. * This fixes bug #2016, thanks! Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 09:26:11 UTC (rev 24912) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 14:37:48 UTC (rev 24913) @@ -1750,16 +1750,25 @@ strcpy(path, "."); } else { p++; - if (*p == '\0') { - // special case: the path ends in '/' - strcpy(filename, "."); - } else { - // normal leaf: replace the leaf portion of the path with a '.' - if (strlcpy(filename, p, B_FILE_NAME_LENGTH) - >= B_FILE_NAME_LENGTH) { - return B_NAME_TOO_LONG; + if (p[0] == '\0') { + // special case: the path ends in one or more '/' - remove them + while (*--p == '/' && p != path); + p[1] = '\0'; + + if (p == path && p[0] == '/') { + // This path points to the root of the file system + strcpy(filename, "."); + return B_OK; } + for (; p != path && *(p - 1) != '/'; p--); + // rewind to the start of the leaf before the '/' } + + // normal leaf: replace the leaf portion of the path with a '.' + if (strlcpy(filename, p, B_FILE_NAME_LENGTH) + >= B_FILE_NAME_LENGTH) { + return B_NAME_TOO_LONG; + } p[0] = '.'; p[1] = '\0'; } From axeld at pinc-software.de Fri Apr 11 17:31:19 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 11 Apr 2008 17:31:19 +0200 CEST Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <20080411153555.679.2@knochen-vm.1207918391.fake> Message-ID: <5548672060-BeMail@zon> Ingo Weinhold wrote: > I suppose we could use the THREAD_FLAGS_IOCTL_SYSCALL flag (and > rename it). > It is already set in the socket syscalls that potentially block, but > I > guess it doesn't harm to do that for all syscalls that enter the > network > stack. And the drivers :-) Bye, Axel. From bonefish at mail.berlios.de Fri Apr 11 18:13:49 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 18:13:49 +0200 Subject: [Haiku-commits] r24914 - in haiku/trunk: headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/system/kernel/fs Message-ID: <200804111613.m3BGDnoZ031822@sheep.berlios.de> Author: bonefish Date: 2008-04-11 18:13:47 +0200 (Fri, 11 Apr 2008) New Revision: 24914 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24914&view=rev Modified: haiku/trunk/headers/private/kernel/syscall_restart.h haiku/trunk/headers/private/kernel/thread_types.h haiku/trunk/headers/private/net/net_socket.h haiku/trunk/headers/private/net/net_stack.h haiku/trunk/headers/private/net/net_stack_interface.h haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp haiku/trunk/src/add-ons/kernel/network/stack/utility.cpp haiku/trunk/src/add-ons/kernel/network/stack/utility.h haiku/trunk/src/system/kernel/fs/fd.cpp haiku/trunk/src/system/kernel/fs/socket.cpp Log: * Renamed THREAD_FLAGS_IOCTL_SYSCALL to THREAD_FLAGS_SYSCALL, syscall_restart_ioctl_is_restarted() to syscall_restart_is_restarted, IoctlSyscallFlagUnsetter to SyscallFlagUnsetter, and IoctlSyscallRestartWrapper to SyscallRestartWrapper, as they are no longer only used for ioctl(). * Removed unused syscall_restart_ioctl_handle_post(). * Made SyscallRestartWrapper a lot fancier. Instead of storing a reference to the result value, it stores the value itself, and it features all the interesting operators that make it appear like that value. This simplifies the use of the class quite a bit. * THREAD_FLAGS_SYSCALL is now set for all socket function and the read[v](), write[v]() syscalls. * Added is_syscall() function and net_stack hook to the net stack. * Removed "kernel" parameter from all net_stack_interface and net_socket module hooks. They aren't need any longer, since is_syscall() can be used instead. Modified: haiku/trunk/headers/private/kernel/syscall_restart.h =================================================================== --- haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-11 16:13:47 UTC (rev 24914) @@ -90,69 +90,73 @@ static inline bool -syscall_restart_ioctl_is_restarted() +syscall_restart_is_restarted() { struct thread* thread = thread_get_current_thread(); - return (thread->flags & THREAD_FLAGS_IOCTL_SYSCALL) != 0 + return (thread->flags & THREAD_FLAGS_SYSCALL) != 0 && (thread->flags & THREAD_FLAGS_SYSCALL_RESTARTED) != 0; } -static inline status_t -syscall_restart_ioctl_handle_post(status_t error) -{ - if (error == B_INTERRUPTED) { - // interrupted -- set flag for syscall restart - struct thread* thread = thread_get_current_thread(); - if ((thread->flags & THREAD_FLAGS_IOCTL_SYSCALL) != 0) - atomic_or(&thread->flags, THREAD_FLAGS_RESTART_SYSCALL); - } - - return error; -} - - -struct IoctlSyscallFlagUnsetter { - IoctlSyscallFlagUnsetter() +struct SyscallFlagUnsetter { + SyscallFlagUnsetter() { - struct thread *thread = thread_get_current_thread(); - fWasSyscall = (atomic_and(&thread->flags, ~THREAD_FLAGS_IOCTL_SYSCALL) - & THREAD_FLAGS_IOCTL_SYSCALL) != 0; + fThread = thread_get_current_thread(); + fWasSyscall = (atomic_and(&fThread->flags, ~THREAD_FLAGS_SYSCALL) + & THREAD_FLAGS_SYSCALL) != 0; } - ~IoctlSyscallFlagUnsetter() + ~SyscallFlagUnsetter() { - struct thread *thread = thread_get_current_thread(); if (fWasSyscall) - atomic_or(&thread->flags, THREAD_FLAGS_IOCTL_SYSCALL); + atomic_or(&fThread->flags, THREAD_FLAGS_SYSCALL); } private: - bool fWasSyscall; + struct thread* fThread; + bool fWasSyscall; }; template -struct IoctlSyscallRestartWrapper { - IoctlSyscallRestartWrapper(const Type& result) - : fResult(result) +struct SyscallRestartWrapper { + SyscallRestartWrapper(Type initialValue = 0) + : fResult(initialValue) { - struct thread *thread = thread_get_current_thread(); - atomic_or(&thread->flags, THREAD_FLAGS_IOCTL_SYSCALL); + fThread = thread_get_current_thread(); + atomic_or(&fThread->flags, THREAD_FLAGS_SYSCALL); } - ~IoctlSyscallRestartWrapper() + ~SyscallRestartWrapper() { - struct thread *thread = thread_get_current_thread(); - atomic_and(&thread->flags, ~THREAD_FLAGS_IOCTL_SYSCALL); + atomic_and(&fThread->flags, ~THREAD_FLAGS_SYSCALL); - if (fResult < 0) - syscall_restart_ioctl_handle_post(fResult); + if (fResult == B_INTERRUPTED) { + // interrupted -- set flag for syscall restart + if ((fThread->flags & THREAD_FLAGS_SYSCALL) != 0) + atomic_or(&fThread->flags, THREAD_FLAGS_RESTART_SYSCALL); + } } + SyscallRestartWrapper& operator=(const Type& other) + { + fResult = other; + return *this; + } + + bool operator==(const Type& other) const { return fResult == other; } + bool operator!=(const Type& other) const { return fResult != other; } + bool operator<=(const Type& other) const { return fResult <= other; } + bool operator>=(const Type& other) const { return fResult >= other; } + bool operator<(const Type& other) const { return fResult < other; } + bool operator>(const Type& other) const { return fResult > other; } + + operator Type() const { return fResult; } + private: - const Type& fResult; + Type fResult; + struct thread* fThread; }; Modified: haiku/trunk/headers/private/kernel/thread_types.h =================================================================== --- haiku/trunk/headers/private/kernel/thread_types.h 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/headers/private/kernel/thread_types.h 2008-04-11 16:13:47 UTC (rev 24914) @@ -311,7 +311,8 @@ #define THREAD_FLAGS_RESTART_SYSCALL 0x0040 #define THREAD_FLAGS_DONT_RESTART_SYSCALL 0x0080 #define THREAD_FLAGS_SYSCALL_RESTARTED 0x0100 -#define THREAD_FLAGS_IOCTL_SYSCALL 0x0200 +#define THREAD_FLAGS_SYSCALL 0x0200 + // Note: Set only for certain syscalls. #endif /* _KERNEL_THREAD_TYPES_H */ Modified: haiku/trunk/headers/private/net/net_socket.h =================================================================== --- haiku/trunk/headers/private/net/net_socket.h 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/headers/private/net/net_socket.h 2008-04-11 16:13:47 UTC (rev 24914) @@ -53,7 +53,7 @@ status_t (*writev)(net_socket *socket, const iovec *vecs, size_t vecCount, size_t *_length); status_t (*control)(net_socket *socket, int32 op, void *data, - size_t length, bool kernel); + size_t length); ssize_t (*read_avail)(net_socket *socket); ssize_t (*send_avail)(net_socket *socket); Modified: haiku/trunk/headers/private/net/net_stack.h =================================================================== --- haiku/trunk/headers/private/net/net_stack.h 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/headers/private/net/net_stack.h 2008-04-11 16:13:47 UTC (rev 24914) @@ -135,6 +135,7 @@ bool (*is_timer_active)(struct net_timer *timer); // syscall restart + bool (*is_syscall)(void); bool (*is_restarted_syscall)(void); void (*store_syscall_restart_timeout)(bigtime_t timeout); bigtime_t (*restore_syscall_restart_timeout)(void); Modified: haiku/trunk/headers/private/net/net_stack_interface.h =================================================================== --- haiku/trunk/headers/private/net/net_stack_interface.h 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/headers/private/net/net_stack_interface.h 2008-04-11 16:13:47 UTC (rev 24914) @@ -29,29 +29,27 @@ status_t (*free)(net_socket* socket); status_t (*bind)(net_socket* socket, const struct sockaddr* address, - socklen_t addressLength, bool kernel); + socklen_t addressLength); status_t (*shutdown)(net_socket* socket, int how); status_t (*connect)(net_socket* socket, const struct sockaddr* address, - socklen_t addressLength, bool kernel); + socklen_t addressLength); status_t (*listen)(net_socket* socket, int backlog); status_t (*accept)(net_socket* socket, struct sockaddr* address, socklen_t* _addressLength, net_socket** _acceptedSocket); - ssize_t (*recv)(net_socket* socket, void* data, size_t length, int flags, - bool kernel); + ssize_t (*recv)(net_socket* socket, void* data, size_t length, int flags); ssize_t (*recvfrom)(net_socket* socket, void* data, size_t length, int flags, struct sockaddr* address, - socklen_t* _addressLength, bool kernel); - ssize_t (*recvmsg)(net_socket* socket, struct msghdr* message, int flags, - bool kernel); + socklen_t* _addressLength); + ssize_t (*recvmsg)(net_socket* socket, struct msghdr* message, int flags); ssize_t (*send)(net_socket* socket, const void* data, size_t length, - int flags, bool kernel); + int flags); ssize_t (*sendto)(net_socket* socket, const void* data, size_t length, int flags, const struct sockaddr* address, - socklen_t addressLength, bool kernel); + socklen_t addressLength); ssize_t (*sendmsg)(net_socket* socket, const struct msghdr* message, - int flags, bool kernel); + int flags); status_t (*getsockopt)(net_socket* socket, int level, int option, void* value, socklen_t* _length); @@ -69,7 +67,7 @@ net_socket* _sockets[2]); status_t (*ioctl)(net_socket* socket, uint32 op, void *buffer, - size_t length, bool kernel); + size_t length); status_t (*select)(net_socket* socket, uint8 event, struct selectsync *sync); status_t (*deselect)(net_socket* socket, uint8 event, Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-04-11 16:13:47 UTC (rev 24914) @@ -30,7 +30,9 @@ #include #include +#include "utility.h" + struct net_socket_private : net_socket { struct list_link link; team_id owner; @@ -243,8 +245,7 @@ status_t -socket_control(net_socket *socket, int32 op, void *data, size_t length, - bool kernel) +socket_control(net_socket *socket, int32 op, void *data, size_t length) { switch (op) { case FIONBIO: @@ -253,14 +254,14 @@ return B_BAD_VALUE; int value; - if (kernel) { - value = *(int*)data; - } else { + if (is_syscall()) { if (!IS_USER_ADDRESS(data) || user_memcpy(&value, data, sizeof(int)) != B_OK) { return B_BAD_ADDRESS; } - } + } else + value = *(int*)data; + return socket_setsockopt(socket, SOL_SOCKET, SO_NONBLOCK, &value, sizeof(int)); } Modified: haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/src/add-ons/kernel/network/stack/stack.cpp 2008-04-11 16:13:47 UTC (rev 24914) @@ -918,6 +918,7 @@ cancel_timer, is_timer_active, + is_syscall, is_restarted_syscall, store_syscall_restart_timeout, restore_syscall_restart_timeout, Modified: haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/src/add-ons/kernel/network/stack/stack_interface.cpp 2008-04-11 16:13:47 UTC (rev 24914) @@ -1,6 +1,8 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ - - #include "stack_private.h" @@ -31,9 +33,8 @@ static status_t stack_interface_bind(net_socket* socket, const struct sockaddr* address, - socklen_t addressLength, bool kernel) + socklen_t addressLength) { -// TODO: Pass kernel flag! return gNetSocketModule.bind(socket, address, addressLength); } @@ -47,9 +48,8 @@ static status_t stack_interface_connect(net_socket* socket, const struct sockaddr* address, - socklen_t addressLength, bool kernel) + socklen_t addressLength) { -// TODO: Pass kernel flag! return gNetSocketModule.connect(socket, address, addressLength); } @@ -71,17 +71,15 @@ static ssize_t -stack_interface_recv(net_socket* socket, void* data, size_t length, int flags, - bool kernel) +stack_interface_recv(net_socket* socket, void* data, size_t length, int flags) { -// TODO: Pass kernel flag! return gNetSocketModule.receive(socket, NULL, data, length, flags); } static ssize_t stack_interface_recvfrom(net_socket* socket, void* data, size_t length, - int flags, struct sockaddr* address, socklen_t* _addressLength, bool kernel) + int flags, struct sockaddr* address, socklen_t* _addressLength) { msghdr message; iovec vecs[1] = { { data, length } }; @@ -93,7 +91,6 @@ message.msg_controllen = 0; message.msg_flags = 0; -// TODO: Pass kernel flag! status_t error = gNetSocketModule.receive(socket, &message, data, length, flags); if (error != B_OK) @@ -105,8 +102,7 @@ static ssize_t -stack_interface_recvmsg(net_socket* socket, struct msghdr* message, int flags, - bool kernel) +stack_interface_recvmsg(net_socket* socket, struct msghdr* message, int flags) { void* buffer = NULL; size_t len = 0; @@ -115,24 +111,21 @@ len = message->msg_iov[0].iov_len; } -// TODO: Pass kernel flag! return gNetSocketModule.receive(socket, message, buffer, len, flags); } static ssize_t stack_interface_send(net_socket* socket, const void* data, size_t length, - int flags, bool kernel) + int flags) { -// TODO: Pass kernel flag! return gNetSocketModule.send(socket, NULL, data, length, flags); } static ssize_t stack_interface_sendto(net_socket* socket, const void* data, size_t length, - int flags, const struct sockaddr* address, socklen_t addressLength, - bool kernel) + int flags, const struct sockaddr* address, socklen_t addressLength) { msghdr message; iovec vecs[1] = { { (void*)data, length } }; @@ -144,14 +137,13 @@ message.msg_controllen = 0; message.msg_flags = 0; -// TODO: Pass kernel flag! return gNetSocketModule.send(socket, &message, data, length, flags); } static ssize_t stack_interface_sendmsg(net_socket* socket, const struct msghdr* message, - int flags, bool kernel) + int flags) { void* buffer = NULL; size_t len = 0; @@ -160,7 +152,6 @@ len = message->msg_iov[0].iov_len; } -// TODO: Pass kernel flag! return gNetSocketModule.send(socket, (msghdr*)message, buffer, len, flags); } @@ -219,9 +210,9 @@ static status_t stack_interface_ioctl(net_socket* socket, uint32 op, void *buffer, - size_t length, bool kernel) + size_t length) { - return gNetSocketModule.control(socket, op, buffer, length, kernel); + return gNetSocketModule.control(socket, op, buffer, length); } Modified: haiku/trunk/src/add-ons/kernel/network/stack/utility.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/utility.cpp 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/src/add-ons/kernel/network/stack/utility.cpp 2008-04-11 16:13:47 UTC (rev 24914) @@ -576,9 +576,17 @@ bool +is_syscall(void) +{ + struct thread* thread = thread_get_current_thread(); + return (thread->flags & THREAD_FLAGS_SYSCALL) != 0; +} + + +bool is_restarted_syscall(void) { - return syscall_restart_ioctl_is_restarted(); + return syscall_restart_is_restarted(); } @@ -586,7 +594,7 @@ store_syscall_restart_timeout(bigtime_t timeout) { struct thread* thread = thread_get_current_thread(); - if ((thread->flags & THREAD_FLAGS_IOCTL_SYSCALL) != 0) + if ((thread->flags & THREAD_FLAGS_SYSCALL) != 0) *(bigtime_t*)thread->syscall_restart.parameters = timeout; } Modified: haiku/trunk/src/add-ons/kernel/network/stack/utility.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/utility.h 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/src/add-ons/kernel/network/stack/utility.h 2008-04-11 16:13:47 UTC (rev 24914) @@ -102,6 +102,7 @@ void uninit_timers(void); // syscall restart +bool is_syscall(void); bool is_restarted_syscall(void); void store_syscall_restart_timeout(bigtime_t timeout); bigtime_t restore_syscall_restart_timeout(void); Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-11 16:13:47 UTC (rev 24914) @@ -651,14 +651,15 @@ return B_BAD_VALUE; } - status_t status; + SyscallRestartWrapper status; + if (write) status = descriptor->ops->fd_write(descriptor, pos, buffer, &length); else status = descriptor->ops->fd_read(descriptor, pos, buffer, &length); if (status < B_OK) - return syscall_restart_handle_post(status); + return status; if (movePosition) descriptor->pos = pos + length; @@ -710,10 +711,11 @@ return B_BAD_VALUE; } + SyscallRestartWrapper status; + ssize_t bytesTransferred = 0; for (uint32 i = 0; i < count; i++) { size_t length = vecs[i].iov_len; - status_t status; if (write) { status = descriptor->ops->fd_write(descriptor, pos, vecs[i].iov_base, &length); @@ -724,7 +726,8 @@ if (status < B_OK) { if (bytesTransferred == 0) - return syscall_restart_handle_post(status); + return status; + status = B_OK; break; } @@ -819,13 +822,9 @@ TRACE(("user_ioctl: fd %d\n", fd)); - struct thread *thread = thread_get_current_thread(); - atomic_or(&thread->flags, THREAD_FLAGS_IOCTL_SYSCALL); + SyscallRestartWrapper status; - status_t status = fd_ioctl(false, fd, op, buffer, length); - - atomic_and(&thread->flags, ~THREAD_FLAGS_IOCTL_SYSCALL); - return status; + return status = fd_ioctl(false, fd, op, buffer, length); } @@ -908,19 +907,16 @@ ssize_t _kern_read(int fd, off_t pos, void *buffer, size_t length) { - struct file_descriptor *descriptor; - ssize_t bytesRead; - if (pos < -1) return B_BAD_VALUE; - descriptor = get_fd(get_current_io_context(true), fd); + FDGetter fdGetter; + struct file_descriptor *descriptor = fdGetter.SetTo(fd, true); + if (!descriptor) return B_FILE_ERROR; - if ((descriptor->open_mode & O_RWMASK) == O_WRONLY) { - put_fd(descriptor); + if ((descriptor->open_mode & O_RWMASK) == O_WRONLY) return B_FILE_ERROR; - } bool movePosition = false; if (pos == -1) { @@ -928,21 +924,23 @@ movePosition = true; } - if (descriptor->ops->fd_read) { - bytesRead = descriptor->ops->fd_read(descriptor, pos, buffer, &length); - if (bytesRead >= B_OK) { - if (length > SSIZE_MAX) - bytesRead = SSIZE_MAX; - else - bytesRead = (ssize_t)length; + SyscallFlagUnsetter _; - if (movePosition) - descriptor->pos = pos + length; - } - } else - bytesRead = B_BAD_VALUE; + if (descriptor->ops->fd_read == NULL) + return B_BAD_VALUE; - put_fd(descriptor); + ssize_t bytesRead = descriptor->ops->fd_read(descriptor, pos, buffer, + &length); + if (bytesRead >= B_OK) { + if (length > SSIZE_MAX) + bytesRead = SSIZE_MAX; + else + bytesRead = (ssize_t)length; + + if (movePosition) + descriptor->pos = pos + length; + } + return bytesRead; } @@ -950,52 +948,53 @@ ssize_t _kern_readv(int fd, off_t pos, const iovec *vecs, size_t count) { - struct file_descriptor *descriptor; bool movePosition = false; - ssize_t bytesRead = 0; status_t status; uint32 i; if (pos < -1) return B_BAD_VALUE; - descriptor = get_fd(get_current_io_context(true), fd); + FDGetter fdGetter; + struct file_descriptor *descriptor = fdGetter.SetTo(fd, true); + if (!descriptor) return B_FILE_ERROR; - if ((descriptor->open_mode & O_RWMASK) == O_WRONLY) { - put_fd(descriptor); + if ((descriptor->open_mode & O_RWMASK) == O_WRONLY) return B_FILE_ERROR; - } if (pos == -1) { pos = descriptor->pos; movePosition = true; } - if (descriptor->ops->fd_read) { - for (i = 0; i < count; i++) { - size_t length = vecs[i].iov_len; - status = descriptor->ops->fd_read(descriptor, pos, vecs[i].iov_base, - &length); - if (status < B_OK) { - bytesRead = status; - break; - } + if (descriptor->ops->fd_read == NULL) + return B_BAD_VALUE; - if ((uint64)bytesRead + length > SSIZE_MAX) - bytesRead = SSIZE_MAX; - else - bytesRead += (ssize_t)length; + SyscallFlagUnsetter _; - pos += vecs[i].iov_len; + ssize_t bytesRead = 0; + + for (i = 0; i < count; i++) { + size_t length = vecs[i].iov_len; + status = descriptor->ops->fd_read(descriptor, pos, vecs[i].iov_base, + &length); + if (status < B_OK) { + bytesRead = status; + break; } - } else - bytesRead = B_BAD_VALUE; + if ((uint64)bytesRead + length > SSIZE_MAX) + bytesRead = SSIZE_MAX; + else + bytesRead += (ssize_t)length; + + pos += vecs[i].iov_len; + } + if (movePosition) descriptor->pos = pos; - put_fd(descriptor); return bytesRead; } @@ -1003,19 +1002,16 @@ ssize_t _kern_write(int fd, off_t pos, const void *buffer, size_t length) { - struct file_descriptor *descriptor; - ssize_t bytesWritten; - if (pos < -1) return B_BAD_VALUE; - descriptor = get_fd(get_current_io_context(true), fd); + FDGetter fdGetter; + struct file_descriptor *descriptor = fdGetter.SetTo(fd, true); + if (descriptor == NULL) return B_FILE_ERROR; - if ((descriptor->open_mode & O_RWMASK) == O_RDONLY) { - put_fd(descriptor); + if ((descriptor->open_mode & O_RWMASK) == O_RDONLY) return B_FILE_ERROR; - } bool movePosition = false; if (pos == -1) { @@ -1023,22 +1019,23 @@ movePosition = true; } - if (descriptor->ops->fd_write) { - bytesWritten = descriptor->ops->fd_write(descriptor, pos, buffer, - &length); - if (bytesWritten >= B_OK) { - if (length > SSIZE_MAX) - bytesWritten = SSIZE_MAX; - else - bytesWritten = (ssize_t)length; + if (descriptor->ops->fd_write == NULL) + return B_BAD_VALUE; - if (movePosition) - descriptor->pos = pos + length; - } - } else - bytesWritten = B_BAD_VALUE; + SyscallFlagUnsetter _; - put_fd(descriptor); + ssize_t bytesWritten = descriptor->ops->fd_write(descriptor, pos, buffer, + &length); + if (bytesWritten >= B_OK) { + if (length > SSIZE_MAX) + bytesWritten = SSIZE_MAX; + else + bytesWritten = (ssize_t)length; + + if (movePosition) + descriptor->pos = pos + length; + } + return bytesWritten; } @@ -1046,52 +1043,53 @@ ssize_t _kern_writev(int fd, off_t pos, const iovec *vecs, size_t count) { - struct file_descriptor *descriptor; bool movePosition = false; - ssize_t bytesWritten = 0; status_t status; uint32 i; if (pos < -1) return B_BAD_VALUE; - descriptor = get_fd(get_current_io_context(true), fd); + FDGetter fdGetter; + struct file_descriptor *descriptor = fdGetter.SetTo(fd, true); + if (!descriptor) return B_FILE_ERROR; - if ((descriptor->open_mode & O_RWMASK) == O_RDONLY) { - put_fd(descriptor); + if ((descriptor->open_mode & O_RWMASK) == O_RDONLY) return B_FILE_ERROR; - } if (pos == -1) { pos = descriptor->pos; movePosition = true; } - if (descriptor->ops->fd_write) { - for (i = 0; i < count; i++) { - size_t length = vecs[i].iov_len; - status = descriptor->ops->fd_write(descriptor, pos, - vecs[i].iov_base, &length); - if (status < B_OK) { - bytesWritten = status; - break; - } + if (descriptor->ops->fd_write == NULL) + return B_BAD_VALUE; - if ((uint64)bytesWritten + length > SSIZE_MAX) - bytesWritten = SSIZE_MAX; - else - bytesWritten += (ssize_t)length; + SyscallFlagUnsetter _; - pos += vecs[i].iov_len; + ssize_t bytesWritten = 0; + + for (i = 0; i < count; i++) { + size_t length = vecs[i].iov_len; + status = descriptor->ops->fd_write(descriptor, pos, + vecs[i].iov_base, &length); + if (status < B_OK) { + bytesWritten = status; + break; } - } else - bytesWritten = B_BAD_VALUE; + if ((uint64)bytesWritten + length > SSIZE_MAX) + bytesWritten = SSIZE_MAX; + else + bytesWritten += (ssize_t)length; + + pos += vecs[i].iov_len; + } + if (movePosition) descriptor->pos = pos; - put_fd(descriptor); return bytesWritten; } @@ -1120,7 +1118,7 @@ { TRACE(("kern_ioctl: fd %d\n", fd)); - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; return fd_ioctl(true, fd, op, buffer, length); } Modified: haiku/trunk/src/system/kernel/fs/socket.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-11 14:37:48 UTC (rev 24913) +++ haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-11 16:13:47 UTC (rev 24914) @@ -189,7 +189,7 @@ size_t *_length) { ssize_t bytesRead = sStackInterface->recv(descriptor->u.socket, buffer, - *_length, 0, !IS_USER_ADDRESS(buffer)); + *_length, 0); *_length = bytesRead >= 0 ? bytesRead : 0; return bytesRead >= 0 ? B_OK : bytesRead; } @@ -200,7 +200,7 @@ size_t *_length) { ssize_t bytesWritten = sStackInterface->send(descriptor->u.socket, buffer, - *_length, 0, !IS_USER_ADDRESS(buffer)); + *_length, 0); *_length = bytesWritten >= 0 ? bytesWritten : 0; return bytesWritten >= 0 ? B_OK : bytesWritten; } @@ -210,8 +210,7 @@ socket_ioctl(struct file_descriptor *descriptor, ulong op, void *buffer, size_t length) { - return sStackInterface->ioctl(descriptor->u.socket, op, buffer, - length, !IS_USER_ADDRESS(buffer)); + return sStackInterface->ioctl(descriptor->u.socket, op, buffer, length); } @@ -341,8 +340,7 @@ GET_SOCKET_FD_OR_RETURN(fd, kernel, descriptor); FDPutter _(descriptor); - return sStackInterface->bind(descriptor->u.socket, address, addressLength, - kernel); + return sStackInterface->bind(descriptor->u.socket, address, addressLength); } @@ -366,7 +364,7 @@ FDPutter _(descriptor); return sStackInterface->connect(descriptor->u.socket, address, - addressLength, kernel); + addressLength); } @@ -413,8 +411,7 @@ GET_SOCKET_FD_OR_RETURN(fd, kernel, descriptor); FDPutter _(descriptor); - return sStackInterface->recv(descriptor->u.socket, data, length, flags, - kernel); + return sStackInterface->recv(descriptor->u.socket, data, length, flags); } @@ -427,7 +424,7 @@ FDPutter _(descriptor); return sStackInterface->recvfrom(descriptor->u.socket, data, length, - flags, address, _addressLength, kernel); + flags, address, _addressLength); } @@ -438,8 +435,7 @@ GET_SOCKET_FD_OR_RETURN(fd, kernel, descriptor); FDPutter _(descriptor); - return sStackInterface->recvmsg(descriptor->u.socket, message, flags, - kernel); + return sStackInterface->recvmsg(descriptor->u.socket, message, flags); } @@ -450,8 +446,7 @@ GET_SOCKET_FD_OR_RETURN(fd, kernel, descriptor); FDPutter _(descriptor); - return sStackInterface->send(descriptor->u.socket, data, length, flags, - kernel); + return sStackInterface->send(descriptor->u.socket, data, length, flags); } @@ -464,7 +459,7 @@ FDPutter _(descriptor); return sStackInterface->sendto(descriptor->u.socket, data, length, flags, - address, addressLength, kernel); + address, addressLength); } @@ -475,8 +470,7 @@ GET_SOCKET_FD_OR_RETURN(fd, kernel, descriptor); FDPutter _(descriptor); - return sStackInterface->sendmsg(descriptor->u.socket, message, flags, - kernel); + return sStackInterface->sendmsg(descriptor->u.socket, message, flags); } @@ -585,6 +579,7 @@ int socket(int family, int type, int protocol) { + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_socket(family, type, protocol, true)); } @@ -592,6 +587,7 @@ int bind(int socket, const struct sockaddr *address, socklen_t addressLength) { + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_bind(socket, address, addressLength, true)); } @@ -599,6 +595,7 @@ int shutdown(int socket, int how) { + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_shutdown(socket, how, true)); } @@ -606,7 +603,7 @@ int connect(int socket, const struct sockaddr *address, socklen_t addressLength) { - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_connect(socket, address, addressLength, true)); } @@ -614,6 +611,7 @@ int listen(int socket, int backlog) { + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_listen(socket, backlog, true)); } @@ -621,7 +619,7 @@ int accept(int socket, struct sockaddr *address, socklen_t *_addressLength) { - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_accept(socket, address, _addressLength, true)); } @@ -629,7 +627,7 @@ ssize_t recv(int socket, void *data, size_t length, int flags) { - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_recv(socket, data, length, flags, true)); } @@ -638,7 +636,7 @@ recvfrom(int socket, void *data, size_t length, int flags, struct sockaddr *address, socklen_t *_addressLength) { - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_recvfrom(socket, data, length, flags, address, _addressLength, true)); } @@ -647,7 +645,7 @@ ssize_t recvmsg(int socket, struct msghdr *message, int flags) { - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_recvmsg(socket, message, flags, true)); } @@ -655,7 +653,7 @@ ssize_t send(int socket, const void *data, size_t length, int flags) { - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; RETURN_AND_SET_ERRNO(common_send(socket, data, length, flags, true)); } @@ -664,7 +662,7 @@ sendto(int socket, const void *data, size_t length, int flags, const struct sockaddr *address, socklen_t addressLength) { - IoctlSyscallFlagUnsetter _; + SyscallFlagUnsetter _; [... truncated: 282 lines follow ...] From ingo_weinhold at gmx.de Fri Apr 11 18:19:09 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 11 Apr 2008 18:19:09 +0200 Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <5548672060-BeMail@zon> References: <5548672060-BeMail@zon> Message-ID: <20080411181909.1023.5@knochen-vm.1207918391.fake> On 2008-04-11 at 17:31:19 [+0200], Axel D?rfler wrote: > Ingo Weinhold wrote: > > I suppose we could use the THREAD_FLAGS_IOCTL_SYSCALL flag (and > > rename it). > > It is already set in the socket syscalls that potentially block, but > > I > > guess it doesn't harm to do that for all syscalls that enter the > > network > > stack. > > And the drivers :-) I've done that for the read[v](), write[v]() syscalls, and ioctl() was already fine. I just realized, I need to adjust [de]select(), but when I've done that, the interesting driver hooks should be happy anyway. If you think more is needed, feel free to add it. :-P CU, Ingo From ingo_weinhold at gmx.de Fri Apr 11 18:38:34 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 11 Apr 2008 18:38:34 +0200 Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <20080411181909.1023.5@knochen-vm.1207918391.fake> References: <5548672060-BeMail@zon> <20080411181909.1023.5@knochen-vm.1207918391.fake> Message-ID: <20080411183834.1112.7@knochen-vm.1207918391.fake> On 2008-04-11 at 18:19:09 [+0200], Ingo Weinhold wrote: > > On 2008-04-11 at 17:31:19 [+0200], Axel D?rfler > wrote: > > Ingo Weinhold wrote: > > > I suppose we could use the THREAD_FLAGS_IOCTL_SYSCALL flag (and > > > rename it). > > > It is already set in the socket syscalls that potentially block, but > > > I > > > guess it doesn't harm to do that for all syscalls that enter the > > > network > > > stack. > > > > And the drivers :-) > > I've done that for the read[v](), write[v]() syscalls, and ioctl() was > already fine. I just realized, I need to adjust [de]select(), [...] Apparently I'm really getting senile. Yesterday night I already came to the conclusion that it is not really interesting for the [de]select() hooks to know whether this is a syscall, since no data are passed and file descriptors can be shared between kernel and userland anyway. In my defense, it was really late yesterday... :-) CU, Ingo From axeld at pinc-software.de Fri Apr 11 18:52:38 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Fri, 11 Apr 2008 18:52:38 +0200 CEST Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <20080411181909.1023.5@knochen-vm.1207918391.fake> Message-ID: <10427304212-BeMail@zon> Ingo Weinhold wrote: > On 2008-04-11 at 17:31:19 [+0200], Axel D?rfler > > wrote: > > And the drivers :-) > I've done that for the read[v](), write[v]() syscalls, and ioctl() > was > already fine. I just realized, I need to adjust [de]select(), but > when I've > done that, the interesting driver hooks should be happy anyway. If > you > think more is needed, feel free to add it. :-P Looks fine to me! :-) We just need a is_syscall() function now. Bye, Axel. From revol at free.fr Fri Apr 11 19:01:35 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 11 Apr 2008 19:01:35 +0200 CEST Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <20080411183834.1112.7@knochen-vm.1207918391.fake> Message-ID: <4662076643-BeMail@laptop> > > On 2008-04-11 at 18:19:09 [+0200], Ingo Weinhold < > ingo_weinhold at gmx.de> > wrote: > > > > On 2008-04-11 at 17:31:19 [+0200], Axel D?rfler > > > > wrote: > > > Ingo Weinhold wrote: > > > > I suppose we could use the THREAD_FLAGS_IOCTL_SYSCALL flag (and > > > > rename it). > > > > It is already set in the socket syscalls that potentially > > > > block, but > > > > I > > > > guess it doesn't harm to do that for all syscalls that enter > > > > the > > > > network > > > > stack. > > > > > > And the drivers :-) > > > > I've done that for the read[v](), write[v]() syscalls, and ioctl() > > was > > already fine. I just realized, I need to adjust [de]select(), [...] > > Apparently I'm really getting senile. Yesterday night I already came > to the > conclusion that it is not really interesting for the [de]select() > hooks to > know whether this is a syscall, since no data are passed and file > descriptors can be shared between kernel and userland anyway. In my > defense, > it was really late yesterday... :-) IIRC some events are supposed to generate signals (SIGPIPE ?), except when being waited on by select(). But it's probably a bad idea to generate a signal to a thread when it's actually a kernel descriptor in question, so knowing it in [de]select() might help (re)setting flags to generate or not a signal. Likewise open/close calls should also know about the fd being passed is for the kernel or not. I didn't look but is it semantically the same as is_syscall() ? Fran?ois. From axeld at mail.berlios.de Fri Apr 11 19:01:26 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 11 Apr 2008 19:01:26 +0200 Subject: [Haiku-commits] r24915 - haiku/trunk/src/system/kernel/fs Message-ID: <200804111701.m3BH1Qsa014451@sheep.berlios.de> Author: axeld Date: 2008-04-11 19:01:25 +0200 (Fri, 11 Apr 2008) New Revision: 24915 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24915&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: The fs_sync() function (or any other, for that matter) must not hold the sMountMutex lock when calling sync() on a file system. This fixes a potential deadlock (I just encountered for the first time). Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 16:13:47 UTC (rev 24914) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 17:01:25 UTC (rev 24915) @@ -6721,13 +6721,9 @@ // And then, let the file systems do their synchronizing work - mutex_lock(&sMountMutex); - if (HAS_FS_MOUNT_CALL(mount, sync)) status = FS_MOUNT_CALL_NO_PARAMS(mount, sync); - mutex_unlock(&sMountMutex); - put_mount(mount); return status; } From stippi at mail.berlios.de Fri Apr 11 19:35:11 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 11 Apr 2008 19:35:11 +0200 Subject: [Haiku-commits] r24916 - in haiku/trunk: headers/private/firewire src/add-ons/kernel/bus_managers/firewire Message-ID: <200804111735.m3BHZB9x029957@sheep.berlios.de> Author: stippi Date: 2008-04-11 19:35:11 +0200 (Fri, 11 Apr 2008) New Revision: 24916 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24916&view=rev Modified: haiku/trunk/headers/private/firewire/firewirereg.h haiku/trunk/src/add-ons/kernel/bus_managers/firewire/firewire.c Log: Applied patch by JiSheng Zhang: Synchronized firewire bus manager with FreeBSD current. Modified: haiku/trunk/headers/private/firewire/firewirereg.h =================================================================== --- haiku/trunk/headers/private/firewire/firewirereg.h 2008-04-11 17:01:25 UTC (rev 24915) +++ haiku/trunk/headers/private/firewire/firewirereg.h 2008-04-11 17:35:11 UTC (rev 24916) @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/firewire/firewirereg.h,v 1.49 2007/07/15 13:20:48 simokawa Exp $ + * $FreeBSD: src/sys/dev/firewire/firewirereg.h,v 1.50 2007/07/20 03:42:57 simokawa Exp $ * */ #ifndef _FIREWIREREG_H @@ -173,6 +173,11 @@ *arq, *atq, *ars, *ats, *it[FW_MAX_DMACH],*ir[FW_MAX_DMACH]; struct fw_xferlist tlabels[0x40]; u_char last_tlabel[0x40]; +#ifndef __HAIKU__ + struct mtx tlabel_lock; +#else + benaphore tlabel_lock; +#endif STAILQ_HEAD(, fw_bind) binds; STAILQ_HEAD(, fw_device) devices; u_int sid_cnt; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/firewire/firewire.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/firewire/firewire.c 2008-04-11 17:01:25 UTC (rev 24915) +++ haiku/trunk/src/add-ons/kernel/bus_managers/firewire/firewire.c 2008-04-11 17:35:11 UTC (rev 24916) @@ -31,7 +31,7 @@ * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.99 2007/07/15 13:00:29 simokawa Exp $ + * $FreeBSD: src/sys/dev/firewire/firewire.c,v 1.100 2007/07/20 03:42:57 simokawa Exp $ * */ #include @@ -301,7 +301,7 @@ STAILQ_INIT(&xfer_timeout); s = splfw(); - FW_GLOCK(fc); + mtx_lock(&fc->tlabel_lock); for (i = 0; i < 0x40; i ++) { while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) { if ((xfer->flag & FWXF_SENT) == 0) @@ -320,7 +320,7 @@ STAILQ_INSERT_TAIL(&xfer_timeout, xfer, tlabel); } } - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); splx(s); fc->timeout(fc); @@ -436,6 +436,7 @@ // fwdev_makedev(sc); mtx_init(&fc->wait_lock, "fwwait", NULL, MTX_DEF); + mtx_init(&fc->tlabel_lock, "fwtlabel", NULL, MTX_DEF); // CALLOUT_INIT(&fc->timeout_callout); // CALLOUT_INIT(&fc->bmr_callout); // CALLOUT_INIT(&fc->busprobe_callout); @@ -527,6 +528,7 @@ free(fc->speed_map); free(fc->crom_src_buf); + mtx_destroy(&fc->tlabel_lock); mtx_destroy(&fc->wait_lock); // return(0); } @@ -569,7 +571,9 @@ fw_xferq_drain(fc->ats); for(i = 0; i < fc->nisodma; i++) fw_xferq_drain(fc->it[i]); + FW_GUNLOCK(fc); + mtx_lock(&fc->tlabel_lock); for (i = 0; i < 0x40; i ++) while ((xfer = STAILQ_FIRST(&fc->tlabels[i])) != NULL) { if (firewire_debug) @@ -578,7 +582,7 @@ STAILQ_REMOVE_HEAD(&fc->tlabels[i], tlabel); STAILQ_INSERT_TAIL(&xfer_drain, xfer, tlabel); } - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); STAILQ_FOREACH_SAFE(xfer, &xfer_drain, tlabel, txfer) xfer->hand(xfer); @@ -1035,7 +1039,7 @@ return; s = splfw(); - FW_GLOCK(fc); + mtx_lock(&fc->tlabel_lock); #if 1 /* make sure the label is allocated */ STAILQ_FOREACH(txfer, &fc->tlabels[xfer->tl], tlabel) if(txfer == xfer) @@ -1047,14 +1051,14 @@ fw_dump_hdr(&xfer->send.hdr, "send"); fw_dump_hdr(&xfer->recv.hdr, "recv"); // kdb_backtrace(); - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); splx(s); return; } #endif STAILQ_REMOVE(&fc->tlabels[xfer->tl], xfer, fw_xfer, tlabel); - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); splx(s); return; } @@ -1069,10 +1073,10 @@ int s = splfw(); int req; - FW_GLOCK(fc); + mtx_lock(&fc->tlabel_lock); STAILQ_FOREACH(xfer, &fc->tlabels[tlabel], tlabel) if(xfer->send.hdr.mode.hdr.dst == node) { - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); splx(s); KASSERT(xfer->tl == tlabel, ("xfer->tl 0x%x != 0x%x", xfer->tl, tlabel)); @@ -1089,7 +1093,7 @@ printf("fw_tl2xfer: found tl=%d\n", tlabel); return(xfer); } - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); if (firewire_debug > 1) printf("fw_tl2xfer: not found tl=%d\n", tlabel); splx(s); @@ -1797,7 +1801,7 @@ dst = xfer->send.hdr.mode.hdr.dst & 0x3f; s = splfw(); - FW_GLOCK(fc); + mtx_lock(&fc->tlabel_lock); new_tlabel = (fc->last_tlabel[dst] + 1) & 0x3f; STAILQ_FOREACH(txfer, &fc->tlabels[new_tlabel], tlabel) if ((txfer->send.hdr.mode.hdr.dst & 0x3f) == dst) @@ -1805,7 +1809,7 @@ if(txfer == NULL) { fc->last_tlabel[dst] = new_tlabel; STAILQ_INSERT_TAIL(&fc->tlabels[new_tlabel], xfer, tlabel); - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); splx(s); xfer->tl = new_tlabel; xfer->send.hdr.mode.hdr.tlrt = new_tlabel << 2; @@ -1813,7 +1817,7 @@ printf("fw_get_tlabel: dst=%d tl=%d\n", dst, new_tlabel); return (new_tlabel); } - FW_GUNLOCK(fc); + mtx_unlock(&fc->tlabel_lock); splx(s); if (firewire_debug > 1) From ingo_weinhold at gmx.de Fri Apr 11 20:11:52 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Fri, 11 Apr 2008 20:11:52 +0200 Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <4662076643-BeMail@laptop> References: <4662076643-BeMail@laptop> Message-ID: <20080411201152.1296.10@knochen-vm.1207918391.fake> On 2008-04-11 at 19:01:35 [+0200], Fran?ois Revol wrote: > > IIRC some events are supposed to generate signals (SIGPIPE ?), except > when being waited on by select(). Haven't heard of that yet. The select() specification doesn't seem to refer to anything in that respect. SIGPIPE is generated by write()s to a closed pipe or socket. SIGURG is generated when out-of-band data arrive on a socket. To my knowledge neither is influenced by select(). > But it's probably a bad idea to generate a signal to a thread when it's > actually a kernel descriptor in question, so knowing it in [de]select() > might help (re)setting flags to generate or not a signal. > Likewise open/close calls should also know about the fd being passed is > for the kernel or not. There is no such thing as a kernel or userland file descriptor. The only difference between calls from kernel and userland in this respect is which file descriptor table is indexed (the one of the kernel or the one of the userland team). The referred to file descriptors have no kernel/userland indication -- they couldn't anyway, since they can be shared by the kernel and userland teams. > I didn't look but is it semantically the same as > is_syscall() ? For some calls it simply indicates whether the call was made from a syscall or from within the kernel. It's main purpose is for interpreting the parameters passed to the call, e.g. if a supplied data buffer is supposed to reside in userland or if a given relative path has to be intepreted relative to the working directory of the current team or that of the kernel. CU, Ingo From bonefish at mail.berlios.de Fri Apr 11 21:21:15 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 21:21:15 +0200 Subject: [Haiku-commits] r24917 - in haiku/trunk: headers/private/kernel/fs src/system/kernel/fs Message-ID: <200804111921.m3BJLFrQ007870@sheep.berlios.de> Author: bonefish Date: 2008-04-11 21:21:14 +0200 (Fri, 11 Apr 2008) New Revision: 24917 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24917&view=rev Modified: haiku/trunk/headers/private/kernel/fs/fd.h haiku/trunk/src/system/kernel/fs/socket.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * Added fd_ops::set_flags() hook. It's only implemented by socket FDs ATM. * Changed common_fcntl() to also work for non-vnode-based FDs. Only the operations that require a vnode do fail now. F_SETFL uses the new fd_ops::set_flags() if available, falling back to the vnode respective operation. * Changed some direct accesses to file_descriptor::u::vnode. It was safe in those cases, but might not be anymore if we ever change fd_vnode(). ftp can at least connect to servers again, now, but apparently we still have a problem with syscall restarts -- downloads fail after one second, when the timer goes off. Modified: haiku/trunk/headers/private/kernel/fs/fd.h =================================================================== --- haiku/trunk/headers/private/kernel/fs/fd.h 2008-04-11 17:35:11 UTC (rev 24916) +++ haiku/trunk/headers/private/kernel/fs/fd.h 2008-04-11 19:21:14 UTC (rev 24917) @@ -26,6 +26,7 @@ status_t (*fd_write)(struct file_descriptor *, off_t pos, const void *buffer, size_t *length); off_t (*fd_seek)(struct file_descriptor *, off_t pos, int seekType); status_t (*fd_ioctl)(struct file_descriptor *, ulong op, void *buffer, size_t length); + status_t (*fd_set_flags)(struct file_descriptor *, int flags); status_t (*fd_select)(struct file_descriptor *, uint8 event, struct selectsync *sync); status_t (*fd_deselect)(struct file_descriptor *, uint8 event, Modified: haiku/trunk/src/system/kernel/fs/socket.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-11 17:35:11 UTC (rev 24916) +++ haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-11 19:21:14 UTC (rev 24917) @@ -215,6 +215,17 @@ static status_t +socket_set_flags(struct file_descriptor *descriptor, int flags) +{ + // we ignore O_APPEND, but O_NONBLOCK we need to translate + uint32 op = (flags & O_NONBLOCK) != 0 + ? B_SET_NONBLOCKING_IO : B_SET_BLOCKING_IO; + + return sStackInterface->ioctl(descriptor->u.socket, op, NULL, 0); +} + + +static status_t socket_select(struct file_descriptor *descriptor, uint8 event, struct selectsync *sync) { @@ -272,6 +283,7 @@ &socket_write, NULL, // fd_seek &socket_ioctl, + &socket_set_flags, &socket_select, &socket_deselect, NULL, // fd_read_dir Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 17:35:11 UTC (rev 24916) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-04-11 19:21:14 UTC (rev 24917) @@ -292,6 +292,7 @@ file_write, file_seek, common_ioctl, + NULL, // set_flags file_select, file_deselect, NULL, // read_dir() @@ -307,6 +308,7 @@ NULL, // write() NULL, // seek() common_ioctl, + NULL, // set_flags NULL, // select() NULL, // deselect() dir_read, @@ -322,6 +324,7 @@ NULL, // write() NULL, // seek() common_ioctl, + NULL, // set_flags NULL, // select() NULL, // deselect() attr_dir_read, @@ -337,6 +340,7 @@ attr_write, attr_seek, common_ioctl, + NULL, // set_flags NULL, // select() NULL, // deselect() NULL, // read_dir() @@ -352,6 +356,7 @@ NULL, // write() NULL, // seek() NULL, // ioctl() + NULL, // set_flags NULL, // select() NULL, // deselect() index_dir_read, @@ -368,6 +373,7 @@ NULL, // write() NULL, // seek() NULL, // ioctl() + NULL, // set_flags NULL, // select() NULL, // deselect() NULL, // dir_read() @@ -384,6 +390,7 @@ NULL, // write() NULL, // seek() NULL, // ioctl() + NULL, // set_flags NULL, // select() NULL, // deselect() query_read, @@ -2435,7 +2442,8 @@ if (descriptor == NULL) return NULL; - if (fd_vnode(descriptor) == NULL) { + struct vnode* vnode = fd_vnode(descriptor); + if (vnode == NULL) { put_fd(descriptor); return NULL; } @@ -2443,7 +2451,7 @@ // ToDo: when we can close a file descriptor at any point, investigate // if this is still valid to do (accessing the vnode without ref_count // or locking) - *_vnode = descriptor->u.vnode; + *_vnode = vnode; return descriptor; } @@ -5121,17 +5129,18 @@ static status_t common_fcntl(int fd, int op, uint32 argument, bool kernel) { - struct file_descriptor *descriptor; - struct vnode *vnode; struct flock flock; FUNCTION(("common_fcntl(fd = %d, op = %d, argument = %lx, %s)\n", fd, op, argument, kernel ? "kernel" : "user")); - descriptor = get_fd_and_vnode(fd, &vnode, kernel); + struct file_descriptor *descriptor = get_fd(get_current_io_context(kernel), + fd); if (descriptor == NULL) return B_FILE_ERROR; + struct vnode* vnode = fd_vnode(descriptor); + status_t status = B_OK; if (op == F_SETLK || op == F_SETLKW || op == F_GETLK) { @@ -5175,19 +5184,23 @@ case F_SETFL: // Set file descriptor open mode - if (HAS_FS_CALL(vnode, set_flags)) { - // we only accept changes to O_APPEND and O_NONBLOCK - argument &= O_APPEND | O_NONBLOCK; + // we only accept changes to O_APPEND and O_NONBLOCK + argument &= O_APPEND | O_NONBLOCK; + if (descriptor->ops->fd_set_flags != NULL) { + status = descriptor->ops->fd_set_flags(descriptor, argument); + } else if (vnode != NULL && HAS_FS_CALL(vnode, set_flags)) { status = FS_CALL(vnode, set_flags, descriptor->cookie, (int)argument); - if (status == B_OK) { - // update this descriptor's open_mode field - descriptor->open_mode = (descriptor->open_mode - & ~(O_APPEND | O_NONBLOCK)) | argument; - } } else status = EOPNOTSUPP; + + if (status == B_OK) { + // update this descriptor's open_mode field + descriptor->open_mode = (descriptor->open_mode + & ~(O_APPEND | O_NONBLOCK)) | argument; + } + break; case F_GETFL: @@ -5211,12 +5224,15 @@ } case F_GETLK: - status = get_advisory_lock(descriptor->u.vnode, &flock); - if (status == B_OK) { - // copy back flock structure - status = user_memcpy((struct flock *)argument, &flock, - sizeof(struct flock)); - } + if (vnode != NULL) { + status = get_advisory_lock(vnode, &flock); + if (status == B_OK) { + // copy back flock structure + status = user_memcpy((struct flock *)argument, &flock, + sizeof(struct flock)); + } + } else + status = B_BAD_VALUE; break; case F_SETLK: @@ -5225,9 +5241,11 @@ if (status < B_OK) break; - if (flock.l_type == F_UNLCK) - status = release_advisory_lock(descriptor->u.vnode, &flock); - else { + if (vnode == NULL) { + status = B_BAD_VALUE; + } else if (flock.l_type == F_UNLCK) { + 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 @@ -5235,7 +5253,7 @@ && flock.l_type == F_RDLCK) status = B_FILE_ERROR; else { - status = acquire_advisory_lock(descriptor->u.vnode, -1, + status = acquire_advisory_lock(vnode, -1, &flock, op == F_SETLKW); } } @@ -8023,9 +8041,9 @@ flock.l_type = (op & LOCK_SH) != 0 ? F_RDLCK : F_WRLCK; if ((op & LOCK_UN) != 0) - status = release_advisory_lock(descriptor->u.vnode, &flock); + status = release_advisory_lock(vnode, &flock); else { - status = acquire_advisory_lock(descriptor->u.vnode, + status = acquire_advisory_lock(vnode, thread_get_current_thread()->team->session_id, &flock, (op & LOCK_NB) == 0); } From bonefish at mail.berlios.de Fri Apr 11 22:36:52 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 22:36:52 +0200 Subject: [Haiku-commits] r24918 - haiku/trunk/headers/private/kernel Message-ID: <200804112036.m3BKaq5q016680@sheep.berlios.de> Author: bonefish Date: 2008-04-11 22:36:50 +0200 (Fri, 11 Apr 2008) New Revision: 24918 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24918&view=rev Modified: haiku/trunk/headers/private/kernel/syscall_restart.h Log: Yep, first clear THREAD_FLAGS_SYSCALL, then check whether it is set. That would explain why syscall restarts were broken. In fact there's no reason to check the flag at all, since we know we set it. ftp appears to work again. Modified: haiku/trunk/headers/private/kernel/syscall_restart.h =================================================================== --- haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-11 19:21:14 UTC (rev 24917) +++ haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-11 20:36:50 UTC (rev 24918) @@ -130,13 +130,12 @@ ~SyscallRestartWrapper() { - atomic_and(&fThread->flags, ~THREAD_FLAGS_SYSCALL); - if (fResult == B_INTERRUPTED) { // interrupted -- set flag for syscall restart - if ((fThread->flags & THREAD_FLAGS_SYSCALL) != 0) - atomic_or(&fThread->flags, THREAD_FLAGS_RESTART_SYSCALL); + atomic_or(&fThread->flags, THREAD_FLAGS_RESTART_SYSCALL); } + + atomic_and(&fThread->flags, ~THREAD_FLAGS_SYSCALL); } SyscallRestartWrapper& operator=(const Type& other) From bonefish at mail.berlios.de Fri Apr 11 22:43:40 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 11 Apr 2008 22:43:40 +0200 Subject: [Haiku-commits] r24919 - haiku/trunk/src/add-ons/kernel/network/protocols/unix Message-ID: <200804112043.m3BKhejE017859@sheep.berlios.de> Author: bonefish Date: 2008-04-11 22:43:40 +0200 (Fri, 11 Apr 2008) New Revision: 24919 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24919&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp Log: Resolved TODOs: We now do know whether the call comes from userland or the kernel. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2008-04-11 20:36:50 UTC (rev 24918) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2008-04-11 20:43:40 UTC (rev 24919) @@ -193,11 +193,10 @@ if (pathLen == 0 || pathLen == sizeof(address->sun_path)) RETURN_ERROR(B_BAD_VALUE); - bool kernel = false; - // TODO: We don't have the info at this point! struct vnode* vnode; status_t error = vfs_create_special_node(address->sun_path, - NULL, S_IFSOCK | 0644, 0, kernel, NULL, &vnode); + NULL, S_IFSOCK | 0644, 0, !gStackModule->is_syscall(), NULL, + &vnode); if (error != B_OK) RETURN_ERROR(error == B_FILE_EXISTS ? EADDRINUSE : error); @@ -295,11 +294,9 @@ if (pathLen == 0 || pathLen == sizeof(address->sun_path)) RETURN_ERROR(B_BAD_VALUE); - bool kernel = false; - // TODO: We don't have the info at this point! struct stat st; status_t error = vfs_read_stat(-1, address->sun_path, true, &st, - kernel); + !gStackModule->is_syscall()); if (error != B_OK) RETURN_ERROR(error); From mmlr at mail.berlios.de Fri Apr 11 23:52:39 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Fri, 11 Apr 2008 23:52:39 +0200 Subject: [Haiku-commits] r24920 - haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial Message-ID: <200804112152.m3BLqdDp025971@sheep.berlios.de> Author: mmlr Date: 2008-04-11 23:52:39 +0200 (Fri, 11 Apr 2008) New Revision: 24920 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24920&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h Log: Correct the way serial devices are deleted. They are either deleted on removal when they are not open or they are deleted on free when they are already removed. This should fix the sudden crashes when you unplugged a device that might not have been fully closed yet. Also handle the case of removal correctly and don't use the usb_device anymore after releasing it by returning from the device removed hook. Calls to the device just return B_DEV_NOT_READY in that case. Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp 2008-04-11 20:43:40 UTC (rev 24919) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/Driver.cpp 2008-04-11 21:52:39 UTC (rev 24920) @@ -87,8 +87,13 @@ SerialDevice *device = (SerialDevice *)cookie; for (int32 i = 0; i < DEVICES_COUNT; i++) { if (gSerialDevices[i] == device) { - delete device; - gSerialDevices[i] = NULL; + if (device->IsOpen()) { + // the device will be deleted upon being freed + device->Removed(); + } else { + delete device; + gSerialDevices[i] = NULL; + } break; } } @@ -131,7 +136,7 @@ } for (int32 i = 0; i < DEVICES_COUNT; i++) - gSerialDevices[i] = 0; + gSerialDevices[i] = NULL; gDeviceNames[0] = NULL; @@ -293,7 +298,22 @@ { TRACE_FUNCALLS("> usb_serial_free(0x%08x)\n", cookie); SerialDevice *device = (SerialDevice *)cookie; - return device->Free(); + acquire_sem(gDriverLock); + status_t status = device->Free(); + if (device->IsRemoved()) { + for (int32 i = 0; i < DEVICES_COUNT; i++) { + if (gSerialDevices[i] == device) { + // the device is removed already but as it was open the + // removed hook has not deleted the object + delete device; + gSerialDevices[i] = NULL; + break; + } + } + } + + release_sem(gDriverLock); + return status; } Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp 2008-04-11 20:43:40 UTC (rev 24919) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.cpp 2008-04-11 21:52:39 UTC (rev 24920) @@ -19,6 +19,8 @@ fVendorID(vendorID), fProductID(productID), fDescription(description), + fDeviceOpen(false), + fDeviceRemoved(false), fControlPipe(0), fReadPipe(0), fWritePipe(0), @@ -43,19 +45,13 @@ SerialDevice::~SerialDevice() { - fStopDeviceThread = true; - gUSBModule->cancel_queued_transfers(fReadPipe); - gUSBModule->cancel_queued_transfers(fWritePipe); - gUSBModule->cancel_queued_transfers(fControlPipe); + Removed(); if (fDoneRead >= B_OK) delete_sem(fDoneRead); if (fDoneWrite >= B_OK) delete_sem(fDoneWrite); - int32 result = B_OK; - wait_for_thread(fDeviceThread, &result); - if (fBufferArea >= B_OK) delete_area(fBufferArea); @@ -250,6 +246,12 @@ status_t SerialDevice::Open(uint32 flags) { + if (fDeviceOpen) + return B_BUSY; + + if (fDeviceRemoved) + return B_DEV_NOT_READY; + gTTYModule->ttyinit(&fTTY, true); fTTYFile.tty = &fTTY; fTTYFile.flags = flags; @@ -285,17 +287,18 @@ fInterruptBufferSize, InterruptCallbackFunction, this); if (status < B_OK) TRACE_ALWAYS("failed to queue initial interrupt\n"); - return status; + + fDeviceOpen = true; + return B_OK; } status_t SerialDevice::Read(char *buffer, size_t *numBytes) { - struct ddrover *ddr = gTTYModule->ddrstart(NULL); - if (!ddr) { + if (fDeviceRemoved) { *numBytes = 0; - return B_NO_MEMORY; + return B_DEV_NOT_READY; } status_t status = benaphore_lock(&fReadLock); @@ -305,6 +308,13 @@ return status; } + struct ddrover *ddr = gTTYModule->ddrstart(NULL); + if (!ddr) { + *numBytes = 0; + benaphore_unlock(&fReadLock); + return B_NO_MEMORY; + } + status = gTTYModule->ttyread(&fTTYFile, ddr, buffer, numBytes); gTTYModule->ddrdone(ddr); @@ -325,6 +335,11 @@ return status; } + if (fDeviceRemoved) { + benaphore_unlock(&fWriteLock); + return B_DEV_NOT_READY; + } + while (bytesLeft > 0) { size_t length = MIN(bytesLeft, fWriteBufferSize); OnWrite(buffer, &length); @@ -367,6 +382,9 @@ status_t SerialDevice::Control(uint32 op, void *arg, size_t length) { + if (fDeviceRemoved) + return B_DEV_NOT_READY; + struct ddrover *ddr = gTTYModule->ddrstart(NULL); if (!ddr) return B_NO_MEMORY; @@ -380,6 +398,9 @@ status_t SerialDevice::Select(uint8 event, uint32 ref, selectsync *sync) { + if (fDeviceRemoved) + return B_DEV_NOT_READY; + struct ddrover *ddr = gTTYModule->ddrstart(NULL); if (!ddr) return B_NO_MEMORY; @@ -393,6 +414,9 @@ status_t SerialDevice::DeSelect(uint8 event, selectsync *sync) { + if (fDeviceRemoved) + return B_DEV_NOT_READY; + struct ddrover *ddr = gTTYModule->ddrstart(NULL); if (!ddr) return B_NO_MEMORY; @@ -408,9 +432,11 @@ { OnClose(); - gUSBModule->cancel_queued_transfers(fReadPipe); - gUSBModule->cancel_queued_transfers(fWritePipe); - gUSBModule->cancel_queued_transfers(fControlPipe); + if (!fDeviceRemoved) { + gUSBModule->cancel_queued_transfers(fReadPipe); + gUSBModule->cancel_queued_transfers(fWritePipe); + gUSBModule->cancel_queued_transfers(fControlPipe); + } struct ddrover *ddr = gTTYModule->ddrstart(NULL); if (!ddr) @@ -418,6 +444,8 @@ status_t status = gTTYModule->ttyclose(&fTTYFile, ddr); gTTYModule->ddrdone(ddr); + + fDeviceOpen = false; return status; } @@ -435,6 +463,31 @@ } +void +SerialDevice::Removed() +{ + if (fDeviceRemoved) + return; + + // notifies us that the device was removed + fDeviceRemoved = true; + + // we need to ensure that we do not use the device anymore + fStopDeviceThread = true; + fInputStopped = false; + gUSBModule->cancel_queued_transfers(fReadPipe); + gUSBModule->cancel_queued_transfers(fWritePipe); + gUSBModule->cancel_queued_transfers(fControlPipe); + + int32 result = B_OK; + wait_for_thread(fDeviceThread, &result); + fDeviceThread = -1; + + benaphore_lock(&fWriteLock); + benaphore_unlock(&fWriteLock); +} + + status_t SerialDevice::AddDevice(const usb_configuration_info *config) { @@ -586,7 +639,7 @@ // ToDo: maybe handle those somehow? - if (status == B_OK) { + if (status == B_OK && !device->fDeviceRemoved) { status = gUSBModule->queue_interrupt(device->fControlPipe, device->fInterruptBuffer, device->fInterruptBufferSize, device->InterruptCallbackFunction, device); Modified: haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h 2008-04-11 20:43:40 UTC (rev 24919) +++ haiku/trunk/src/add-ons/kernel/drivers/ports/usb_serial/SerialDevice.h 2008-04-11 21:52:39 UTC (rev 24920) @@ -55,6 +55,10 @@ status_t Close(); status_t Free(); + bool IsOpen() { return fDeviceOpen; }; + void Removed(); + bool IsRemoved() { return fDeviceRemoved; }; + /* virtual interface to be overriden as necessary */ virtual status_t AddDevice(const usb_configuration_info *config); @@ -84,6 +88,8 @@ uint16 fVendorID; uint16 fProductID; const char * fDescription; // informational description + bool fDeviceOpen; + bool fDeviceRemoved; /* communication pipes */ usb_pipe fControlPipe; From mmlr at mail.berlios.de Sat Apr 12 00:03:34 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Apr 2008 00:03:34 +0200 Subject: [Haiku-commits] r24921 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200804112203.m3BM3Yj2026969@sheep.berlios.de> Author: mmlr Date: 2008-04-12 00:03:34 +0200 (Sat, 12 Apr 2008) New Revision: 24921 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24921&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h Log: Redefine B_KERNEL_{READ|WRITE}_AREA to 0 for BeOS compatibility and not to B_{READ|WRITE}_AREA. Otherwise we'd allow any user process to shredder our data as Axel put it so nicely ;-) Thanks for the clarification. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h 2008-04-11 21:52:39 UTC (rev 24920) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/BeOSCompatibility.h 2008-04-11 22:03:34 UTC (rev 24921) @@ -95,9 +95,9 @@ } #undef B_KERNEL_READ_AREA -#define B_KERNEL_READ_AREA B_READ_AREA +#define B_KERNEL_READ_AREA 0 #undef B_KERNEL_WRITE_AREA -#define B_KERNEL_WRITE_AREA B_WRITE_AREA +#define B_KERNEL_WRITE_AREA 0 #endif // !HAIKU_TARGET_PLATFORM_HAIKU #endif // !_USB_BEOS_COMPATIBILITY_H_ From mmu_man at mail.berlios.de Sat Apr 12 04:40:12 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Apr 2008 04:40:12 +0200 Subject: [Haiku-commits] r24922 - in haiku/trunk: . build/scripts Message-ID: <200804120240.m3C2eCgU032707@sheep.berlios.de> Author: mmu_man Date: 2008-04-12 04:40:10 +0200 (Sat, 12 Apr 2008) New Revision: 24922 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24922&view=rev Modified: haiku/trunk/build/scripts/build_cross_tools haiku/trunk/configure Log: Remove use of bashisms since we use #!/bin/sh. This should help supporting solaris. Added sunos to the list of platforms, but it needs more work. Modified: haiku/trunk/build/scripts/build_cross_tools =================================================================== --- haiku/trunk/build/scripts/build_cross_tools 2008-04-11 22:03:34 UTC (rev 24921) +++ haiku/trunk/build/scripts/build_cross_tools 2008-04-12 02:40:10 UTC (rev 24922) @@ -3,7 +3,7 @@ # parameters [ ] # get and check the parameters -if [ $# \< 2 ]; then +if [ $# -lt 2 ]; then echo Usage: $0 ' [ ]' >&2 exit 1 fi @@ -11,7 +11,7 @@ haikuSourceDir=$1 buildToolsDir=$2/legacy -if [ $# \< 3 ]; then +if [ $# -lt 3 ]; then haikuOutputDir=$haikuSourceDir/generated else haikuOutputDir=$3 @@ -33,18 +33,18 @@ # get absolute paths -currentDir=$(pwd) +currentDir=`pwd` cd $haikuSourceDir -haikuSourceDir=$(pwd) +haikuSourceDir=`pwd` cd $currentDir cd $buildToolsDir -buildToolsDir=$(pwd) +buildToolsDir=`pwd` cd $currentDir cd $haikuOutputDir -haikuOutputDir=$(pwd) +haikuOutputDir=`pwd` # create the object and installation directories for the cross compilation tools @@ -80,10 +80,10 @@ sourceDir=$1 targetDir=$2 - headers="$(find $sourceDir -name \*\.h | grep -v /.svn)" - headers="$(echo $headers | sed -e s@$sourceDir/@@g)" + headers="`find $sourceDir -name \*\.h | grep -v /.svn`" + headers="`echo $headers | sed -e s@$sourceDir/@@g`" for f in $headers; do - headerTargetDir=$targetDir/$(dirname $f) + headerTargetDir=$targetDir/`dirname $f` mkdir -p $headerTargetDir cp $sourceDir/$f $headerTargetDir done Modified: haiku/trunk/configure =================================================================== --- haiku/trunk/configure 2008-04-11 22:03:34 UTC (rev 24921) +++ haiku/trunk/configure 2008-04-12 02:40:10 UTC (rev 24922) @@ -187,9 +187,9 @@ if [ -f "$path" ]; then # get absolute path - local oldPwd=$(pwd) - cd $(dirname "$path") - path="$(pwd)/$(basename "$path")" + local oldPwd="`pwd`" + cd "`dirname "$path"`" + path="`pwd`/`basename "$path"`" cd $oldPwd else which "$path" &> /dev/null || { @@ -232,7 +232,8 @@ buildCrossToolsScript="$sourceDir/build/scripts/build_cross_tools" buildCrossToolsMachine= -export haikuRequiredLegacyGCCVersion="2.95.3-haiku-080323" +haikuRequiredLegacyGCCVersion="2.95.3-haiku-080323" +export haikuRequiredLegacyGCCVersion # version of legacy gcc required to build haiku set_default_value HAIKU_AR ar @@ -304,6 +305,7 @@ FreeBSD) buildPlatform=freebsd ;; Haiku) buildPlatform=haiku_host ;; Linux) buildPlatform=linux ;; + SunOS) buildPlatform=sunos ;; *) echo Unsupported platform: ${platform} exit 1 ;; esac From mmu_man at mail.berlios.de Sat Apr 12 04:45:27 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 12 Apr 2008 04:45:27 +0200 Subject: [Haiku-commits] r24923 - haiku/trunk/build/scripts Message-ID: <200804120245.m3C2jRVL000441@sheep.berlios.de> Author: mmu_man Date: 2008-04-12 04:45:21 +0200 (Sat, 12 Apr 2008) New Revision: 24923 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24923&view=rev Modified: haiku/trunk/build/scripts/build_cross_tools Log: export foo=bar doesn't seem to work with plain sh... Modified: haiku/trunk/build/scripts/build_cross_tools =================================================================== --- haiku/trunk/build/scripts/build_cross_tools 2008-04-12 02:40:10 UTC (rev 24922) +++ haiku/trunk/build/scripts/build_cross_tools 2008-04-12 02:45:21 UTC (rev 24923) @@ -69,7 +69,8 @@ make || exit 1 make install || exit 1 -export PATH=$PATH:$installDir/bin +PATH=$PATH:$installDir/bin +export PATH # build gcc From ingo_weinhold at gmx.de Sat Apr 12 05:15:40 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 12 Apr 2008 05:15:40 +0200 Subject: [Haiku-commits] r24922 - in haiku/trunk: . build/scripts In-Reply-To: <200804120240.m3C2eCgU032707@sheep.berlios.de> References: <200804120240.m3C2eCgU032707@sheep.berlios.de> Message-ID: <20080412051540.379.1@knochen-vm.1207969939.fake> On 2008-04-12 at 04:40:12 [+0200], mmu_man at BerliOS wrote: > Author: mmu_man > Date: 2008-04-12 04:40:10 +0200 (Sat, 12 Apr 2008) > New Revision: 24922 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24922&view=rev > > Modified: > haiku/trunk/build/scripts/build_cross_tools > haiku/trunk/configure > Log: > Remove use of bashisms since we use #!/bin/sh. This should help supporting > solaris. Er, none of your changes has to do with bashisms. The "\<" instead of "-lt" was just wrong, so thanks for fixing it, but "$(...)" is mandated by POSIX, as is "export var=value". I'd rather like to see you use a POSIX compliant sh than to uglify our scripts, really. CU, Ingo From anevilyak at mail.berlios.de Sat Apr 12 05:28:15 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 12 Apr 2008 05:28:15 +0200 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap Message-ID: <200804120328.m3C3SF8S002299@sheep.berlios.de> Author: anevilyak Date: 2008-04-12 05:28:12 +0200 (Sat, 12 Apr 2008) New Revision: 24924 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24924&view=rev Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp haiku/trunk/src/preferences/keymap/Keymap.h haiku/trunk/src/preferences/keymap/KeymapWindow.cpp haiku/trunk/src/preferences/keymap/KeymapWindow.h Log: Keymap preferences now saves an attribute on the Key_map file to indicate what keymap it came from. This allows us to indicate the current keymap in the list views. I'm not sure how to get the build system to populate that attribute by default though. Modified: haiku/trunk/src/preferences/keymap/Keymap.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.cpp 2008-04-12 02:45:21 UTC (rev 24923) +++ haiku/trunk/src/preferences/keymap/Keymap.cpp 2008-04-12 03:28:12 UTC (rev 24924) @@ -113,6 +113,7 @@ if (err < B_OK) { fprintf(stderr, "error reading keymap chars: %s\n", strerror(err)); } + strlcpy(fName, ref.name, sizeof(fName)); return err; } @@ -149,6 +150,8 @@ if ((err = file.Write(fChars, fCharsSize)) < (ssize_t)fCharsSize) return err; + + err = file.WriteAttr("keymap:name", B_STRING_TYPE, 0, fName, strlen(fName)); return B_OK; } Modified: haiku/trunk/src/preferences/keymap/Keymap.h =================================================================== --- haiku/trunk/src/preferences/keymap/Keymap.h 2008-04-12 02:45:21 UTC (rev 24923) +++ haiku/trunk/src/preferences/keymap/Keymap.h 2008-04-12 03:28:12 UTC (rev 24924) @@ -29,6 +29,7 @@ char *fChars; key_map fKeys; uint32 fCharsSize; + char fName[B_FILE_NAME_LENGTH]; }; Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2008-04-12 02:45:21 UTC (rev 24923) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2008-04-12 03:28:12 UTC (rev 24924) @@ -220,6 +220,11 @@ FillSystemMaps(); FillUserMaps(); + + // try and find the current map name in the two list views (if the name was read at all) + if (SelectCurrentMap(fSystemListView)) + if (!SelectCurrentMap(fUserListView)) + fUserListView->Select(0L); } @@ -443,6 +448,17 @@ fUserListView->AddItem(new KeymapListItem(ref, "(Current)")); + BNode node(&ref); + char name[B_FILE_NAME_LENGTH]; + name[0] = '\0'; + if (node.InitCheck() == B_OK) { + ssize_t readSize = node.ReadAttr("keymap:name", B_STRING_TYPE, 0, name, sizeof(name) - 1); + if (readSize > 0) { + name[readSize] = '\0'; + fCurrentMapName = name; + } + } + if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) return; @@ -454,11 +470,28 @@ while( directory.GetNextRef(&ref) == B_OK ) { fUserListView->AddItem(new KeymapListItem(ref)); } - - fUserListView->Select(0); } +bool +KeymapWindow::SelectCurrentMap(BListView *view) +{ + bool found = false; + if (fCurrentMapName.Length() > 0) { + for (int32 i = 0; i < view->CountItems(); i++) { + BStringItem *current = dynamic_cast(view->ItemAt(i)); + if (current && (fCurrentMapName == current->Text())) { + found = true; + view->Select(i); + view->ScrollToSelection(); + break; + } + } + } + return found; +} + + MapView::MapView(BRect rect, const char *name, Keymap* keymap) : BControl(rect, name, NULL, NULL, B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW), fCurrentFont(*be_plain_font), Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.h =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.h 2008-04-12 02:45:21 UTC (rev 24923) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.h 2008-04-12 03:28:12 UTC (rev 24924) @@ -14,10 +14,12 @@ #include #include #include +#include +#include #include -#include + +#include "Keymap.h" #include "KeymapTextView.h" -#include "Keymap.h" class KeymapListItem; class BBitmap; @@ -82,7 +84,8 @@ void FillSystemMaps(); void FillUserMaps(); - + + bool SelectCurrentMap(BListView *list); BListView *fSystemListView; BListView *fUserListView; @@ -97,6 +100,7 @@ Keymap fPreviousMap; Keymap fAppliedMap; bool fFirstTime; + BString fCurrentMapName; BFilePanel *fOpenPanel; // the file panel to open BFilePanel *fSavePanel; // the file panel to save From revol at free.fr Sat Apr 12 05:32:25 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 12 Apr 2008 05:32:25 +0200 CEST Subject: [Haiku-commits] r24922 - in haiku/trunk: . build/scripts In-Reply-To: <20080412051540.379.1@knochen-vm.1207969939.fake> Message-ID: <1177106443-BeMail@laptop> > > Remove use of bashisms since we use #!/bin/sh. This should help > > supporting > > solaris. > > Er, none of your changes has to do with bashisms. The "\<" instead of > "-lt" > was just wrong, so thanks for fixing it, but "$(...)" is mandated by > POSIX, > as is "export var=value". I'd rather like to see you use a POSIX > compliant sh > than to uglify our scripts, really. Well someone is trying to build on s(l)o(w)laris and their sh choke on those... It seems it still isn't posix compliant. Fran?ois. From anevilyak at gmail.com Sat Apr 12 05:30:20 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Fri, 11 Apr 2008 22:30:20 -0500 Subject: [Haiku-commits] r24922 - in haiku/trunk: . build/scripts In-Reply-To: <20080412051540.379.1@knochen-vm.1207969939.fake> References: <200804120240.m3C2eCgU032707@sheep.berlios.de> <20080412051540.379.1@knochen-vm.1207969939.fake> Message-ID: On Fri, Apr 11, 2008 at 10:15 PM, Ingo Weinhold wrote: > > Er, none of your changes has to do with bashisms. The "\<" instead of "-lt" > was just wrong, so thanks for fixing it, but "$(...)" is mandated by POSIX, > as is "export var=value". I'd rather like to see you use a POSIX compliant sh > than to uglify our scripts, really. > > CU, Ingo tcsh isn't POSIX compliant? that's the default /bin/sh on Solaris anyways, and I don't think any other is guaranteed to be installed. Regards, Rene From revol at free.fr Sat Apr 12 05:42:55 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 12 Apr 2008 05:42:55 +0200 CEST Subject: [Haiku-commits] r24922 - in haiku/trunk: . build/scripts In-Reply-To: Message-ID: <1807617279-BeMail@laptop> > On Fri, Apr 11, 2008 at 10:15 PM, Ingo Weinhold > wrote: > > > > Er, none of your changes has to do with bashisms. The "\<" instead > > of "-lt" > > was just wrong, so thanks for fixing it, but "$(...)" is mandated > > by POSIX, > > as is "export var=value". I'd rather like to see you use a POSIX > > compliant sh > > than to uglify our scripts, really. > > > > CU, Ingo > > tcsh isn't POSIX compliant? that's the default /bin/sh on Solaris > anyways, and I don't think any other is guaranteed to be installed. "default shell" and /bin/sh are two different things. the default shell is the one used by default on login, that you can change by chsh, and is stored in /etc/passwd, which for solaris is /bin /tcsh. /bin/sh should be a standard korn compatible shell though... but it seems it's not compatible enough. Fran?ois. From ingo_weinhold at gmx.de Sat Apr 12 05:53:13 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 12 Apr 2008 05:53:13 +0200 Subject: [Haiku-commits] r24922 - in haiku/trunk: . build/scripts In-Reply-To: References: <200804120240.m3C2eCgU032707@sheep.berlios.de> <20080412051540.379.1@knochen-vm.1207969939.fake> Message-ID: <20080412055313.448.2@knochen-vm.1207969939.fake> On 2008-04-12 at 05:30:20 [+0200], Rene Gollent wrote: > On Fri, Apr 11, 2008 at 10:15 PM, Ingo Weinhold > wrote: > > > > Er, none of your changes has to do with bashisms. The "\<" instead of > > "-lt" > > was just wrong, so thanks for fixing it, but "$(...)" is mandated by > > POSIX, > > as is "export var=value". I'd rather like to see you use a POSIX > > compliant sh > > than to uglify our scripts, really. > > tcsh isn't POSIX compliant? If it doesn't support the mentioned stuff, it obivously isn't. Maybe it was once, but at least since Issue 6 of the Open Group Base Specs those features are required. The Specs date back to 2004 and some of the features are probably older. > that's the default /bin/sh on Solaris > anyways, and I don't think any other is guaranteed to be installed. If one has the permissions, one can install bash or any other compliant shell at any time and link it to /bin/sh. If not, tough luck... CU, Ingo From alex at zappotek.com Sat Apr 12 14:42:15 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Sat, 12 Apr 2008 14:42:15 +0200 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap In-Reply-To: <200804120328.m3C3SF8S002299@sheep.berlios.de> References: <200804120328.m3C3SF8S002299@sheep.berlios.de> Message-ID: <4800AE27.80404@zappotek.com> anevilyak at BerliOS a ?crit : > Log: > Keymap preferences now saves an attribute on the Key_map file to indicate > what keymap it came from. This allows us to indicate the current keymap in > the list views. I'm not sure how to get the build system to populate that > attribute by default though. > > Nice! Was on my would_be_nice_todo list :-) Sorry i can't help you with the build system thing though... From revol at free.fr Sat Apr 12 18:11:24 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 12 Apr 2008 18:11:24 +0200 CEST Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <20080411201152.1296.10@knochen-vm.1207918391.fake> Message-ID: <3150541498-BeMail@laptop> > > IIRC some events are supposed to generate signals (SIGPIPE ?), > > except > > when being waited on by select(). > > Haven't heard of that yet. The select() specification doesn't seem to > refer > to anything in that respect. SIGPIPE is generated by write()s to a > closed > pipe or socket. SIGURG is generated when out-of-band data arrive on a > socket. > To my knowledge neither is influenced by select(). I was quite sure there was something with select and signals, but maybe I invented that part. > > > But it's probably a bad idea to generate a signal to a thread when > > it's > > actually a kernel descriptor in question, so knowing it in > > [de]select() > > might help (re)setting flags to generate or not a signal. > > Likewise open/close calls should also know about the fd being > > passed is > > for the kernel or not. > > There is no such thing as a kernel or userland file descriptor. The > only > difference between calls from kernel and userland in this respect is > which > file descriptor table is indexed (the one of the kernel or the one of > the > userland team). The referred to file descriptors have no kernel/ > userland > indication -- they couldn't anyway, since they can be shared by the > kernel > and userland teams. While there is no difference on the structure itself as you said there is a contextual difference, that's what I meant. It's probably a bad securitywise to let the kernel use a team's fd though anyway. Still, as I said, sending a signal to a user thread when it's indeed a kernel fd that is causing the condition is generally a bad idea. > > I didn't look but is it semantically the same as > > is_syscall() ? > > For some calls it simply indicates whether the call was made from a > syscall > or from within the kernel. It's main purpose is for interpreting the > parameters passed to the call, e.g. if a supplied data buffer is > supposed to > reside in userland or if a given relative path has to be intepreted > relative > to the working directory of the current team or that of the kernel. Yes that's the point. Linux did it differently IIRC (we had that discussions long ago already), it hacked a value indicating the last (or first, can't remember) user allowed address, so when calling from the kernel the copy_to/from_user functions would be fooled and accept kernel buffers. Though it's not semantically exactly the same... It's probably cleaner with an is_syscall() func. I thought I saw you called it on the socket module, is it a hook there or a plain kernel export ? it's probably simpler to export from the kernel, drivers shouldn't need to load the network stack to use that. Fran?ois. From anevilyak at gmail.com Sat Apr 12 17:24:37 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 12 Apr 2008 10:24:37 -0500 Subject: [Haiku-commits] r24918 - haiku/trunk/headers/private/kernel In-Reply-To: References: <200804112036.m3BKaq5q016680@sheep.berlios.de> Message-ID: On Sat, Apr 12, 2008 at 10:16 AM, Rene Gollent wrote: > One of these socket-related changes seems to have broken Firefox...it > segfaults on startup in the newer builds now. I can't yet try to > binary search to find out the exact revision though since berlios > appears to currently be down. > Using this build of Firefox btw: ftp://ftp.binarychicken.com/mmadia/firefox-2.0.0.15pre.en-US.BeOS-bone-2008040520.zip Worked prior to the changes at least. Regards, Rene From mmlr at mail.berlios.de Sat Apr 12 08:10:37 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Apr 2008 08:10:37 +0200 Subject: [Haiku-commits] r24926 - haiku/trunk/src/add-ons/kernel/bus_managers/usb Message-ID: <200804120610.m3C6Ab7J003711@sheep.berlios.de> Author: mmlr Date: 2008-04-12 08:10:36 +0200 (Sat, 12 Apr 2008) New Revision: 24926 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24926&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp Log: Use a list of host controller modules instead of using open_module_list() and read_next_module_name(). This is ugly and less flexible but it allows us to explicitly force an initialization order. As detailed by the added comment there seem to be controllers/BIOSes that require the EHCI controller to be initialized after the companion host controller or else they refuse to publish any high speed devices. This was the case for bug #1236 and my laptop when legacy emulation is enabled and any device was plugged in at boot. This change fixed the problem for me and hopefully closes bug #1236 too. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp 2008-04-12 06:10:28 UTC (rev 24925) +++ haiku/trunk/src/add-ons/kernel/bus_managers/usb/Stack.cpp 2008-04-12 06:10:36 UTC (rev 24926) @@ -52,27 +52,37 @@ } // Check for host controller modules - void *moduleList = open_module_list("busses/usb"); - char moduleName[B_PATH_NAME_LENGTH]; - size_t bufferSize = sizeof(moduleName); + // While using a fixed list of names is inflexible it allows us to control + // the order in which we try modules. There are controllers/BIOSes that + // require UHCI/OHCI to be initialized before EHCI or otherwise they + // refuse to publish any high-speed devices. + // On other systems the ordering is probably ensured because the EHCI + // controller is required to have a higher PCI function number than the + // companion host controllers (per the EHCI specs) and it would therefore + // be enumerated as the last item. As this does not apply to us we have to + // ensure ordering using another method. + const char *moduleNames[] = { + "busses/usb/uhci", + "busses/usb/ohci", + "busses/usb/ehci", + NULL + }; TRACE(("USB Stack: looking for host controller modules\n")); - while (read_next_module_name(moduleList, moduleName, &bufferSize) == B_OK) { - bufferSize = sizeof(moduleName); - TRACE(("USB Stack: found module %s\n", moduleName)); + for (uint32 i = 0; moduleNames[i]; i++) { + TRACE(("USB Stack: looking for module %s\n", moduleNames[i])); usb_host_controller_info *module = NULL; - if (get_module(moduleName, (module_info **)&module) != B_OK) + if (get_module(moduleNames[i], (module_info **)&module) != B_OK) continue; + TRACE(("USB Stack: adding module %s\n", moduleNames[i])); if (module->add_to(this) < B_OK) continue; - TRACE(("USB Stack: module %s successfully loaded\n", moduleName)); + TRACE(("USB Stack: module %s successfully loaded\n", moduleNames[i])); } - close_module_list(moduleList); - if (fBusManagers.Count() == 0) { TRACE_ERROR(("USB Stack: no bus managers available\n")); return; From mmlr at mail.berlios.de Sat Apr 12 08:10:29 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Apr 2008 08:10:29 +0200 Subject: [Haiku-commits] r24925 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200804120610.m3C6AT8n003674@sheep.berlios.de> Author: mmlr Date: 2008-04-12 08:10:28 +0200 (Sat, 12 Apr 2008) New Revision: 24925 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24925&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp Log: * Set the interrupt threshold of the controller when doing the rest of the initialization as suggested by the EHCI spec and do not touch it again once the controller is running. Doing so would result in undefined behaviour according to EHCI specs. * Set the port routing policy after the controller has started and not before as suggested by the EHCI specs. * Explicitly set the segment register after resetting the host controller and not before, as this likely has no real effect ;-) Might help with some legacy support or UHCI/OHCI to EHCI handover problems. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-12 03:28:12 UTC (rev 24924) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-12 06:10:28 UTC (rev 24925) @@ -200,15 +200,15 @@ // disable interrupts WriteOpReg(EHCI_USBINTR, 0); - // reset the segment register - WriteOpReg(EHCI_CTRDSSEGMENT, 0); - // reset the host controller if (ControllerReset() < B_OK) { TRACE_ERROR(("usb_ehci: host controller failed to reset\n")); return; } + // reset the segment register + WriteOpReg(EHCI_CTRDSSEGMENT, 0); + // create semaphores the finisher thread will wait for fAsyncAdvanceSem = create_sem(0, "EHCI Async Advance"); fFinishTransfersSem = create_sem(0, "EHCI Finish Transfers"); @@ -359,11 +359,8 @@ WriteOpReg(EHCI_USBCMD, ReadOpReg(EHCI_USBCMD) | EHCI_USBCMD_RUNSTOP | EHCI_USBCMD_ASENABLE | EHCI_USBCMD_PSENABLE | (frameListSize << EHCI_USBCMD_FLS_SHIFT) - | (2 << EHCI_USBCMD_ITC_SHIFT)); + | (1 << EHCI_USBCMD_ITC_SHIFT)); - // route all ports to us - WriteOpReg(EHCI_CONFIGFLAG, EHCI_CONFIGFLAG_FLAG); - bool running = false; for (int32 i = 0; i < 10; i++) { uint32 status = ReadOpReg(EHCI_USBSTS); @@ -377,15 +374,15 @@ } } - // set the interrupt threshold - WriteOpReg(EHCI_USBCMD, ReadOpReg(EHCI_USBCMD) - | (1 << EHCI_USBCMD_ITC_SHIFT)); - if (!running) { TRACE(("usb_ehci: Host Controller didn't start\n")); return B_ERROR; } + // route all ports to us + WriteOpReg(EHCI_CONFIGFLAG, EHCI_CONFIGFLAG_FLAG); + snooze(10000); + fRootHubAddress = AllocateAddress(); fRootHub = new(std::nothrow) EHCIRootHub(RootObject(), fRootHubAddress); if (!fRootHub) { From revol at free.fr Sat Apr 12 18:34:38 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 12 Apr 2008 18:34:38 +0200 CEST Subject: [Haiku-commits] r24922 - in haiku/trunk: . build/scripts In-Reply-To: <20080412051540.379.1@knochen-vm.1207969939.fake> Message-ID: <4544572118-BeMail@laptop> > > Log: > > Remove use of bashisms since we use #!/bin/sh. This should help > > supporting > > solaris. > > Er, none of your changes has to do with bashisms. The "\<" instead of > "-lt" > was just wrong, so thanks for fixing it, but "$(...)" is mandated by > POSIX, > as is "export var=value". I'd rather like to see you use a POSIX > compliant sh > than to uglify our scripts, really. Btw, if you look at configure, there are already tons of other uses of ``, so it's not like it was only nice-looking $() around. Btw, some are unsafely unquoted. But I suppose we don't support using space in the source path :) Fran?ois. From korli at mail.berlios.de Sat Apr 12 09:04:45 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Apr 2008 09:04:45 +0200 Subject: [Haiku-commits] r24927 - haiku/trunk/src/system/kernel/fs Message-ID: <200804120704.m3C74jW3011537@sheep.berlios.de> Author: korli Date: 2008-04-12 09:04:45 +0200 (Sat, 12 Apr 2008) New Revision: 24927 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24927&view=rev Modified: haiku/trunk/src/system/kernel/fs/fd.cpp Log: gcc4 build fix. Here is one of the two errors: src/system/kernel/fs/fd.cpp: In function 'ssize_t common_user_vector_io(int, off_t, const iovec*, size_t, bool)': src/system/kernel/fs/fd.cpp:727: error: ISO C++ says that these are ambiguous, even though the worst conversion for the first is better than the worst conversion for the second: headers/private/kernel/syscall_restart.h:151: note: candidate 1: bool SyscallRestartWrapper::operator<(const Type&) const [with Type = long int] src/system/kernel/fs/fd.cpp:727: note: candidate 2: operator<(long int, int) Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 06:10:36 UTC (rev 24926) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 07:04:45 UTC (rev 24927) @@ -658,7 +658,7 @@ else status = descriptor->ops->fd_read(descriptor, pos, buffer, &length); - if (status < B_OK) + if (status.operator>(B_OK)) return status; if (movePosition) @@ -724,7 +724,7 @@ &length); } - if (status < B_OK) { + if (status.operator<(B_OK)) { if (bytesTransferred == 0) return status; status = B_OK; From korli at mail.berlios.de Sat Apr 12 09:08:57 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Apr 2008 09:08:57 +0200 Subject: [Haiku-commits] r24928 - haiku/trunk/src/system/kernel/fs Message-ID: <200804120708.m3C78vhl012302@sheep.berlios.de> Author: korli Date: 2008-04-12 09:08:56 +0200 (Sat, 12 Apr 2008) New Revision: 24928 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24928&view=rev Modified: haiku/trunk/src/system/kernel/fs/fd.cpp Log: hmm I managed to break the comparaison order... Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 07:04:45 UTC (rev 24927) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 07:08:56 UTC (rev 24928) @@ -658,7 +658,7 @@ else status = descriptor->ops->fd_read(descriptor, pos, buffer, &length); - if (status.operator>(B_OK)) + if (status.operator<(B_OK)) return status; if (movePosition) From korli at mail.berlios.de Sat Apr 12 09:17:01 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Apr 2008 09:17:01 +0200 Subject: [Haiku-commits] r24929 - haiku/trunk/src/system/kernel/fs Message-ID: <200804120717.m3C7H1u6013670@sheep.berlios.de> Author: korli Date: 2008-04-12 09:17:01 +0200 (Sat, 12 Apr 2008) New Revision: 24929 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24929&view=rev Modified: haiku/trunk/src/system/kernel/fs/fd.cpp haiku/trunk/src/system/kernel/fs/socket.cpp Log: better cast to the good type to avoid confusing gcc Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 07:08:56 UTC (rev 24928) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 07:17:01 UTC (rev 24929) @@ -658,7 +658,7 @@ else status = descriptor->ops->fd_read(descriptor, pos, buffer, &length); - if (status.operator<(B_OK)) + if (status < (status_t)B_OK) return status; if (movePosition) @@ -724,7 +724,7 @@ &length); } - if (status.operator<(B_OK)) { + if (status < (status_t)B_OK) { if (bytesTransferred == 0) return status; status = B_OK; Modified: haiku/trunk/src/system/kernel/fs/socket.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 07:08:56 UTC (rev 24928) +++ haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 07:17:01 UTC (rev 24929) @@ -866,7 +866,7 @@ char address[MAX_SOCKET_ADDRESS_LEN]; result = common_recvfrom(socket, data, length, flags, userAddress != NULL ? (sockaddr*)address : NULL, &addressLength, false); - if (result < 0) + if (result < (ssize_t)0) return result; // copy address size and address back to userland @@ -900,7 +900,7 @@ SyscallRestartWrapper result; result = common_recvmsg(socket, &message, flags, false); - if (result < 0) + if (result < (ssize_t)0) return result; // copy the address and address length back to userland @@ -1000,7 +1000,7 @@ SyscallRestartWrapper error; error = common_getsockopt(socket, level, option, value, &length, false); - if (error != B_OK) + if (error != (status_t)B_OK) return error; // copy value back to userland @@ -1042,14 +1042,14 @@ SyscallRestartWrapper error; error = prepare_userland_address_result(userAddress, _addressLength, addressLength, true); - if (error != B_OK) + if (error != (status_t)B_OK) return error; // getpeername() char address[MAX_SOCKET_ADDRESS_LEN]; error = common_getpeername(socket, (sockaddr*)address, &addressLength, false); - if (error != B_OK) + if (error != (status_t)B_OK) return error; // copy address size and address back to userland @@ -1073,14 +1073,14 @@ SyscallRestartWrapper error; error = prepare_userland_address_result(userAddress, _addressLength, addressLength, true); - if (error != B_OK) + if (error != (status_t)B_OK) return error; // getsocknam() char address[MAX_SOCKET_ADDRESS_LEN]; error = common_getsockname(socket, (sockaddr*)address, &addressLength, false); - if (error != B_OK) + if (error != (status_t)B_OK) return error; // copy address size and address back to userland @@ -1116,7 +1116,7 @@ int socketVector[2]; SyscallRestartWrapper error; error = common_socketpair(family, type, protocol, socketVector, false); - if (error != B_OK) + if (error != (status_t)B_OK) return error; // copy FDs back to userland @@ -1147,7 +1147,7 @@ net_stat stat; SyscallRestartWrapper error; error = common_get_next_socket_stat(family, &cookie, &stat); - if (error != B_OK) + if (error != (status_t)B_OK) return error; // copy cookie and data back to userland From ingo_weinhold at gmx.de Sun Apr 13 15:35:42 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 15:35:42 +0200 Subject: [Haiku-commits] r24929 - haiku/trunk/src/system/kernel/fs In-Reply-To: <200804120717.m3C7H1u6013670@sheep.berlios.de> References: <200804120717.m3C7H1u6013670@sheep.berlios.de> Message-ID: <20080413153542.701.3@knochen-vm.1208089234.fake> On 2008-04-12 at 09:17:01 [+0200], korli at BerliOS wrote: > Author: korli > Date: 2008-04-12 09:17:01 +0200 (Sat, 12 Apr 2008) > New Revision: 24929 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24929&view=rev > > Modified: > haiku/trunk/src/system/kernel/fs/fd.cpp > haiku/trunk/src/system/kernel/fs/socket.cpp > Log: > better cast to the good type to avoid confusing gcc > > > Modified: haiku/trunk/src/system/kernel/fs/fd.cpp > =================================================================== > --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 07:08:56 UTC (rev > 24928) > +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 07:17:01 UTC (rev > 24929) > @@ -658,7 +658,7 @@ > else > status = descriptor->ops->fd_read(descriptor, pos, buffer, > &length); > > - if (status.operator<(B_OK)) > + if (status < (status_t)B_OK) > return status; I guess the nicest alternative is to simply remove the respective SyscallRestartWrapper operators. I added them without really thinking whether they were needed or not. The cast operator makes them superfluous, though. CU, Ingo From korli at mail.berlios.de Sat Apr 12 09:58:43 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Apr 2008 09:58:43 +0200 Subject: [Haiku-commits] r24930 - haiku/trunk/src/apps/expander Message-ID: <200804120758.m3C7whqI019861@sheep.berlios.de> Author: korli Date: 2008-04-12 09:58:43 +0200 (Sat, 12 Apr 2008) New Revision: 24930 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24930&view=rev Modified: haiku/trunk/src/apps/expander/ExpanderRules.cpp Log: Applied patch from n3s: the check for file extension was broken. Thanks! This fixes bug #2034 Modified: haiku/trunk/src/apps/expander/ExpanderRules.cpp =================================================================== --- haiku/trunk/src/apps/expander/ExpanderRules.cpp 2008-04-12 07:17:01 UTC (rev 24929) +++ haiku/trunk/src/apps/expander/ExpanderRules.cpp 2008-04-12 07:58:43 UTC (rev 24930) @@ -124,9 +124,12 @@ int32 length = fileName.Length(); for (int32 i = 0; i < count; i++) { ExpanderRule *rule = (ExpanderRule *)fList.ItemAt(i); - if ((rule->MimeType().IsValid() && rule->MimeType() == filetype) - || (fileName.FindLast(rule->FilenameExtension()) == (length - rule->FilenameExtension().Length()))) + if (rule->MimeType().IsValid() && rule->MimeType() == filetype) return rule; + int32 extPosition = fileName.FindLast(rule->FilenameExtension()); + if (extPosition != -1 + && extPosition == (length - rule->FilenameExtension().Length())) + return rule; } return NULL; } From ingo_weinhold at gmx.de Sun Apr 13 15:37:11 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 15:37:11 +0200 Subject: [Haiku-commits] r24918 - haiku/trunk/headers/private/kernel In-Reply-To: References: <200804112036.m3BKaq5q016680@sheep.berlios.de> Message-ID: <20080413153711.740.4@knochen-vm.1208089234.fake> On 2008-04-12 at 17:24:37 [+0200], Rene Gollent wrote: > On Sat, Apr 12, 2008 at 10:16 AM, Rene Gollent wrote: > > One of these socket-related changes seems to have broken Firefox...it > > segfaults on startup in the newer builds now. I can't yet try to > > binary search to find out the exact revision though since berlios > > appears to currently be down. > > > > Using this build of Firefox btw: > > ftp://ftp.binarychicken.com/mmadia/firefox-2.0.0.15pre.en-US.BeOS-bone-2008040520.zip > > Worked prior to the changes at least. Will have a look. CU, Ingo From ingo_weinhold at gmx.de Sun Apr 13 15:43:21 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 15:43:21 +0200 Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <3150541498-BeMail@laptop> References: <3150541498-BeMail@laptop> Message-ID: <20080413154321.770.5@knochen-vm.1208089234.fake> On 2008-04-12 at 18:11:24 [+0200], Fran?ois Revol wrote: [...] > It's probably cleaner with an is_syscall() func. > I thought I saw you called it on the socket module, is it a hook there > or a plain kernel export ? it's probably simpler to export from the > kernel, drivers shouldn't need to load the network stack to use that. Having drivers use the network stack makes little sense, of course. I just added it there, because I needed it there and there already are related functions. I suppose all of those have to become public API at some point. CU, Ingo From laplace at mail.berlios.de Sat Apr 12 10:10:30 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 12 Apr 2008 10:10:30 +0200 Subject: [Haiku-commits] r24931 - haiku/trunk/src/apps/bootman Message-ID: <200804120810.m3C8AUIR021601@sheep.berlios.de> Author: laplace Date: 2008-04-12 10:10:29 +0200 (Sat, 12 Apr 2008) New Revision: 24931 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24931&view=rev Added: haiku/trunk/src/apps/bootman/bootman.S Log: Boot menu and loader by Dengg David. Added: haiku/trunk/src/apps/bootman/bootman.S =================================================================== --- haiku/trunk/src/apps/bootman/bootman.S 2008-04-12 07:58:43 UTC (rev 24930) +++ haiku/trunk/src/apps/bootman/bootman.S 2008-04-12 08:10:29 UTC (rev 24931) @@ -0,0 +1,376 @@ +; +; Copyright 2007, Dengg David, david-d at gmx.at. All rights reserved. +; Distributed under the terms of the MIT License. +; +%assign BIOS_VIDEO_SERVICES 0x10 +%assign BIOS_KEYBOARD_SERVICES 0x16 +%assign WRITE_CHAR 0x0e ; al - char + ; bh - page + ; bl - foreground color (graphics mode only) + +[bits 16] ; Real Mode yeah +start: +; ======================= SCREEN SETUP ================================= + mov ax, 0x07C0 ; Segment Location 0x07C0 + mov ds, ax ; Set Data Segment to 0x07C0 + mov es, ax ; Set Extra Segment to 0x07C0 + mov ss, ax ; Set Stack Segment to 0x07C0 + mov sp, 0xFFFF + + mov ah, 0x00 ; Set Screen Resolution to 640x480 + mov al, 0x12 + mov bx, 0x0 + mov cx, 0x1 + int 0x10 + + mov ah, 0x02 ; Set cursor position + mov dx, 0x0120 + int 0x10 + + + mov si, signation ; Print "Haiku Bootmanager" + call printstr + + + mov ah, 0x02 ; Set cursor position + mov dx, 0x1B1B + int 0x10 + + mov si, select_os ; Print "Select Os..." + call printstr + + mov ah, 0 + int 0x16 + +; ======================= LOAD 3 MORE SECTORS INTO MEM ================= +load_from_disk: ; load 3 more sectors into mem + mov ah, 0x42 + mov dl, 0x80 + mov si, DAP + int 0x13 + mov si, error + jc printstr + jmp secsec ; Jump into the second sector + +ende: + mov ah, 0x0e + mov al, 'F' + mov bx, 0x2 + mov cx, 0x1 + int 0x10 + jmp $ ; Final Loopy. Never reached + +%if 0 +printstr: ; Poor mans printf + lodsb + mov ah, 0x0E + mov bx, 0x0F + mov cx, 0x01 + int 0x10 + cmp al, 0x00 + jnz printstr + ret +%else +printstr: + ; page and foreground color + jmp .loop_condition +.loop + mov ah, WRITE_CHAR + mov bx, 0x0F + mov cx, 1 + int BIOS_VIDEO_SERVICES +.loop_condition + lodsb + cmp al, 0 + jnz .loop + ret +%endif + +DAP: + db 0x10 ; Size of DAP + db 0x00 ; unused (zero) + db 0x03 ; number of sectors to read + db 0x00 ; unused (zero) + dw 0x0200 ; segment:offset pointer to buffer + dw 0x07C0 ; segment:offset pointer to buffer + dw 0x0001 ; LBA address + dw 0x0000 + dw 0x0000 + dw 0x0000 + +WinDAP: + db 0x0B ; Size of DAP + db 0x00 ; unused (zero) + db 0x01 ; number of sectors to read + db 0x00 ; unused (zero) + dw 0x0000 ; segment:offset pointer to buffer + dw 0x07C0 ; segment:offset pointer to buffer + dw 0x003F ; LBA address + dw 0x0000 + + +signation: + db 'Haiku Bootmanager', 0x00 +select_os: + db 'Select an OS from the menu', 0x00 + + times 510 -($-$$) db 'B' ; Fill the missing space to reach 510 byte and set the + dw 0xAA55 ; magic marker "AA55" (to identify a valid bootrecord) + +; ====================================================================== +; ======================= SECOND SECTOR ================================ +; ====================================================================== + +secsec: +; ======================= Center list ================================== + xor bx,bx ; Get ready for the Division + xor ax, ax ; Get ready for the Division + mov al, [list_items] + mov bl, 2 ; Divide by two + div bl ; Divide + + mov bl, 12 + sub bl, al ; Substract from 12 (screen is 80x25) + mov dh, bl + mov [first_position], dx + +; ======================= Print the OS list ============================ +print_list: + mov dx, [first_position] + mov [position], dx + + mov ah, 0x02 ; Set cursor position + int 0x10 + mov si, list ; Load the List + xor cx,cx ; Load listitems to CX + mov byte [colour], 0x0000 ; Reset Colour +print_list_loop: + lodsb ; Get lenght of string from list into al + ; Get the Text to be in the middle (40 - lenght/2) + xor bx,bx ; Get ready for the Division + mov ah, 0x00 + mov bl, 2 ; Divide by two + div bl ; Divide + + mov bl, 40 + sub bl, al ; Substract from 40 (screen is 80x25) + mov al, bl + mov dx, [position] ; Get last position + inc dh ; Next line + mov dl, al ; Move it to the place where the row should be for the interrupt (DL) + + mov ah, 0x02 ; Set cursor position + mov [position], dx + int 0x10 + + mov dx, [selection] + mov byte bl, [colour] ; Load Colour + and bx, 0x03 ; Just + inc bl ; Colours ... 1-4 + cmp cx, [selection] + jnz no_highlight + xor bx, 0x08 ; Highlight selected item +no_highlight: + mov byte [colour], bl ; Store Colour + call print_list_item + inc cx + cmp cx, [list_items] + jne print_list_loop + +; ================== Wait for a key and do something with it ================== + +main_loopy: + mov ah, 0x02 ; Set cursor position + mov dx, 0x181C + int 0x10 + + mov ah, 0x00 ; Keyboard Read: wait for key + int 0x16 ; AL = ASCII Code, AH = Scancode + cmp ah, 0x50 + jz key_down ; Was it key_down, key_up... ? + cmp ah, 0x48 + jz key_up + cmp ah, 0x1C + jz key_enter + + jmp main_loopy + +key_down: + mov ax, [selection] + mov bx, [list_items] + dec bx + cmp ax, bx + je key_down_no ; Are we at the bottom of the list? + inc ax + mov [selection], ax +key_down_no: + jmp print_list +key_up: + mov ax, [selection] + mov bx, [list_items] + cmp ax, 0 + je key_down_no ; Are we at the top of the list? + dec ax + mov [selection], ax +key_up_no: + jmp print_list + + +; ========================== Chainload ========================== + +key_enter: + mov cx, [selection] + mov si, list + inc cx +load_LBA: + lodsb + cmp al, 0x80 + jne load_LBA + loop load_LBA + + lodsw + mov [LBA_selectionA], ax + lodsw + mov [LBA_selectionB], ax + + mov si, ChainLoad_DAP ; Load the List + mov ax, [LBA_selectionA] + mov word [si+8], ax + mov ax, [LBA_selectionB] + mov word [si+10], ax + + mov ah, 0x42 + mov dl, 0x80 + mov si, ChainLoad_DAP + int 0x13 + mov si, error_lfd + jc print_debug + + mov si, 0x0 + xor ax, ax + mov si, error_nb + mov byte al, [0x01FE] + cmp al, 0x55 + jne print_debug + + mov byte al, [0x01FF] + cmp al, 0xAA + jne print_debug + + mov si, yeah ; Yeah + jmp print_debug + + + + +fin: + mov ah, 0x0e + mov al, 'F' + mov bx, 0x2 + mov cx, 0x1 + int 0x10 + jmp $ + + +; ====================== THE print_list function ================ + +print_list_item: +print_list_item_loop: + lodsb + cmp al,0x80 + jz print_list_item_end + mov ah, 0x0E + int 0x10 + jmp print_list_item_loop +print_list_item_end: + lodsw + lodsw + ret + +print_debug: ; Poor mans printf again + lodsb + mov ah, 0x0E + mov bx, 0x0F + mov cx, 0x01 + int 0x10 + cmp al, 0x00 + jnz print_debug + jmp $ + +; ================================ DATA =========================== + +error_lfd: + db 'Error loading Sectors', 0x00 +error_nb: + db 'Not a bootable partition', 0x00 +LBA_selectionA: + dw 0x0000 +LBA_selectionB: + dw 0x0000 +selection: + dw 0x0000 +position: + dw 0x091D +lenght: + dw 0x0000 +colour: + dw 0x0000 +first_position: + dw 0x091F +nobots: + db 'Boot sector signature not found', 0x00 +error: + db 'Error loading sectors', 0x00 +yeah: + db 'Boot!', 0x00 + + + +list_items: + dw 0x06 +list: + db 0x05 + db 'HAIKU' , 0x80 + dw 0x003E + dw 0x0000 + + db 0x07 + db 'FreeBSD' , 0x80 + dw 0x003F + dw 0x0000 + + db 0x03 + db 'DOS' , 0x80 + dw 0x003E + dw 0x0000 + + db 0x05 + db 'LINUX' , 0x80 + dw 0x003F + dw 0x0000 + + db 0x07 + db 'BeOS R5' , 0x80 + dw 0x003F + dw 0x0000 + + db 0x07 + db 'OpenBSD' , 0x80 + dw 0xAAAA + dw 0x0000 + +ChainLoad_DAP: + db 0x10 ; Size of DAP + db 0x00 ; unused (zero) + db 0x01 ; number of sectors to read + db 0x00 ; unused (zero) + dw 0x0000 ; segment:offset pointer to buffer + dw 0x07C0 ; segment:offset pointer to buffer + dw 0x003F ; LBA address + dw 0x0000 + dw 0x0000 + dw 0x0000 + + + + From laplace at mail.berlios.de Sat Apr 12 10:10:58 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 12 Apr 2008 10:10:58 +0200 Subject: [Haiku-commits] r24932 - haiku/trunk/src/apps/bootman Message-ID: <200804120810.m3C8AwLW021698@sheep.berlios.de> Author: laplace Date: 2008-04-12 10:10:57 +0200 (Sat, 12 Apr 2008) New Revision: 24932 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24932&view=rev Added: haiku/trunk/src/apps/bootman/MakeArray.cpp Log: Helper application that converts the contents of a file into an uint8 array. Added: haiku/trunk/src/apps/bootman/MakeArray.cpp =================================================================== --- haiku/trunk/src/apps/bootman/MakeArray.cpp 2008-04-12 08:10:29 UTC (rev 24931) +++ haiku/trunk/src/apps/bootman/MakeArray.cpp 2008-04-12 08:10:57 UTC (rev 24932) @@ -0,0 +1,48 @@ +#include +#include +#include + +int main(int argc, char* argv[]) +{ + const char* application = argv[0]; + if (argc != 3) { + fprintf(stderr, "Usage:\n%s ", application); + return 1; + } + const char* variableName = argv[1]; + const char* fileName = argv[2]; + + int fd = open(fileName, 0); + if (fd < 0) { + fprintf(stderr, "%s: Error opening file '%s'!\n", application, fileName); + return 1; + } + + const int kSize = 1024; + unsigned char buffer[kSize]; + int size = read(fd, buffer, kSize); + const int COLUMNS = 16; + int column = COLUMNS - 1; + bool first = true; + printf("// THIS FILE WAS GENERATED WITH\n"); + printf("// %s %s %s\n\n", application, variableName, fileName); + printf("static const uint8 %s[] = {", variableName); + while (size > 0) { + for (int i = 0; i < size; i ++) { + if (first) + first = false; + else + printf(", "); + column ++; + if (column == COLUMNS) { + printf("\n\t"); + column = 0; + } + printf("0x%2.2x", (int)buffer[i]); + } + size = read(fd, buffer, kSize); + } + printf("\n};\n"); + + close(fd); +} \ No newline at end of file From philippe.houdoin at free.fr Sun Apr 13 15:53:49 2008 From: philippe.houdoin at free.fr (philippe.houdoin at free.fr) Date: Sun, 13 Apr 2008 15:53:49 +0200 Subject: [Haiku-commits] Re: r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs Message-ID: Fran?ois said: > I thought I saw you called it on the socket module, is it a hook there > or a plain kernel export ? it's probably simpler to export from the > kernel, drivers shouldn't need to load the network stack to use that. Why not moving every module services into kernel and drop this silly modular kernel design, then? ;-) BTW, am I the only one concerned that the recent change remove the ability to unload the whole net stack modules without rebooting, or did I miss something? - Philippe From ingo_weinhold at gmx.de Sun Apr 13 15:56:57 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 15:56:57 +0200 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap In-Reply-To: <200804120328.m3C3SF8S002299@sheep.berlios.de> References: <200804120328.m3C3SF8S002299@sheep.berlios.de> Message-ID: <20080413155657.899.6@knochen-vm.1208089234.fake> On 2008-04-12 at 05:28:15 [+0200], anevilyak at BerliOS wrote: > Author: anevilyak > Date: 2008-04-12 05:28:12 +0200 (Sat, 12 Apr 2008) > New Revision: 24924 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24924&view=rev > > Modified: > haiku/trunk/src/preferences/keymap/Keymap.cpp > haiku/trunk/src/preferences/keymap/Keymap.h > haiku/trunk/src/preferences/keymap/KeymapWindow.cpp > haiku/trunk/src/preferences/keymap/KeymapWindow.h > Log: > Keymap preferences now saves an attribute on the Key_map file to indicate > what keymap it came from. This allows us to indicate the current keymap in > the list views. I'm not sure how to get the build system to populate that > attribute by default though. If you tell me what exactly you need and where, I'm sure we can work something out. :-) CU, Ingo From laplace at mail.berlios.de Sat Apr 12 10:19:26 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 12 Apr 2008 10:19:26 +0200 Subject: [Haiku-commits] r24933 - haiku/trunk/src/apps/bootman Message-ID: <200804120819.m3C8JQuu023038@sheep.berlios.de> Author: laplace Date: 2008-04-12 10:19:25 +0200 (Sat, 12 Apr 2008) New Revision: 24933 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24933&view=rev Modified: haiku/trunk/src/apps/bootman/bootman.S Log: Refactored and reformatted. Select default item at start. Added timeout handling. Don't switch to graphics mode, stay in text mode instead. Graphics mode led to display issues with lilo. Reverted order of text color like it is in original bootman. Fixed bugs. Modified: haiku/trunk/src/apps/bootman/bootman.S =================================================================== --- haiku/trunk/src/apps/bootman/bootman.S 2008-04-12 08:10:57 UTC (rev 24932) +++ haiku/trunk/src/apps/bootman/bootman.S 2008-04-12 08:19:25 UTC (rev 24933) @@ -1,376 +1,561 @@ ; ; Copyright 2007, Dengg David, david-d at gmx.at. All rights reserved. +; Copyright 2008, Michael Pfeiffer, laplace at users.sourceforge.net. All rights reserved. +; Copyright 2005, Ingo Weinhold, bonefish at users.sf.net. ; Distributed under the terms of the MIT License. -; -%assign BIOS_VIDEO_SERVICES 0x10 -%assign BIOS_KEYBOARD_SERVICES 0x16 -%assign WRITE_CHAR 0x0e ; al - char + +; Steps to create BootLoader.h +; 1. nasm -f bin bootman.S -o bootman.bin +; 2. cc MakeArray.cpp -o make_array -lstdc++ +; 3. ./make_array kBootLoader bootman.bin > BootLoader.h +; or +; nasm -f bin bootman.S -o bootman.bin && ./make_array kBootLoader bootman.bin > BootLoader.h + +%assign USE_TEST_MENU 0 + +%assign BOOT_BLOCK_START_ADDRESS 0x7c00 + +%assign MBR_SIGNATURE 0xAA55 + +; BIOS calls + +%assign BIOS_VIDEO_SERVICES 0x10 +%assign BIOS_DISK_SERVICES 0x13 +%assign BIOS_KEYBOARD_SERVICES 0x16 +%assign BIOS_REBOOT 0x19 +%assign BIOS_TIME_SERVICES 0x1A + +; video services +%assign SET_VIDEO_MODE 0x00 ; al - mode + +%assign SET_CURSOR 0x02 ; dl - column + ; dh - row ; bh - page + + +%assign GET_CURSOR 0x03 ; bh - page + ; -> dl - column + ; dh - row + ; Cursor shape: + ; ch - starting scan line + ; cl - ending scan line + +%assign SCROLL_UP 0x06 ; al - lines (0: clear screen) + ; bh - attribute + ; ch - upper line + ; cl - left column + ; dh - lower line + ; dl - right column + +%assign WRITE_CHAR 0x09 ; al - char + ; bh - page + ; bl - attribute + ; cx - count + +;%assign WRITE_CHAR 0x0e ; al - char + ; bh - page ; bl - foreground color (graphics mode only) -[bits 16] ; Real Mode yeah -start: -; ======================= SCREEN SETUP ================================= - mov ax, 0x07C0 ; Segment Location 0x07C0 - mov ds, ax ; Set Data Segment to 0x07C0 - mov es, ax ; Set Extra Segment to 0x07C0 - mov ss, ax ; Set Stack Segment to 0x07C0 - mov sp, 0xFFFF +; disk services +%assign READ_DISK_SECTORS 0x02 ; dl - drive + ; es:bx - buffer + ; dh - head (0 - 15) + ; ch - track 7:0 (0 - 1023) + ; cl - track 9:8, + ; sector (1 - 17) + ; al - sector count + ; -> al - sectors read +%assign READ_DRIVE_PARAMETERS 0x08 ; dl - drive + ; -> cl - max cylinder 9:8 + ; - sectors per track + ; ch - max cylinder 7:0 + ; dh - max head + ; dl - number of drives (?) +%assign CHECK_DISK_EXTENSIONS_PRESENT 0x41 ; bx - 0x55aa + ; dl - drive + ; -> success: carry clear + ; ah - extension version + ; bx - 0xaa55 + ; cx - support bit mask + ; -> error: carry set +%assign EXTENDED_READ 0x42 ; dl - drive + ; ds:si - address packet + ; -> success: carry clear + ; -> error: carry set - mov ah, 0x00 ; Set Screen Resolution to 640x480 - mov al, 0x12 - mov bx, 0x0 - mov cx, 0x1 - int 0x10 +%assign FIXED_DISK_SUPPORT 0x1 ; flag indicating fixed disk + ; extension command subset - mov ah, 0x02 ; Set cursor position - mov dx, 0x0120 - int 0x10 +; keyboard services +%assign READ_CHAR 0x00 ; -> al - ASCII char + ; ah - scan code +%assign PROBE_CHAR 0x01 ; -> zf = 0 + ; al - ASCII char + ; ah - scan code +; timer services +%assign READ_CLOCK 0x00 ; -> cx - high word + ; dx - low word + ; one tick = 1/18.2s - mov si, signation ; Print "Haiku Bootmanager" - call printstr +%assign TICKS_PER_SECOND 19 +; video modes +%assign GRAPHIC_MODE_80x25 0x12 ; 640 x 480 graphic mode - mov ah, 0x02 ; Set cursor position - mov dx, 0x1B1B - int 0x10 +%assign TEXT_COLUMNS 80 ; Number of columns +%assign TEXT_ROWS 25 ; Number of rows - mov si, select_os ; Print "Select Os..." - call printstr +; Colors +%assign BLACK 0 +%assign BLUE 1 +%assign GREEN 2 +%assign CYAN 3 +%assign RED 4 +%assign MAGENTA 5 +%assign BROWN 6 +%assign LIGHT_GRAY 7 +%assign DARK_GRAY 8 +%assign LIGHT_BLUE 9 +%assign LIGHT_GREEN 10 +%assign LIGHT_CYAN 11 +%assign LIGHT_RED 12 +%assign LIGHT_MAGENTA 13 +%assign YELLOW 14 +%assign WHITE 15 - mov ah, 0 - int 0x16 +%assign BRIGHT_COLOR_MASK 8 -; ======================= LOAD 3 MORE SECTORS INTO MEM ================= -load_from_disk: ; load 3 more sectors into mem - mov ah, 0x42 - mov dl, 0x80 - mov si, DAP - int 0x13 - mov si, error - jc printstr - jmp secsec ; Jump into the second sector -ende: - mov ah, 0x0e - mov al, 'F' - mov bx, 0x2 - mov cx, 0x1 - int 0x10 - jmp $ ; Final Loopy. Never reached +; Key codes +%assign KEY_DOWN 0x50 +%assign KEY_UP 0x48 +%assign KEY_RETURN 0x1C -%if 0 -printstr: ; Poor mans printf - lodsb - mov ah, 0x0E - mov bx, 0x0F - mov cx, 0x01 - int 0x10 - cmp al, 0x00 - jnz printstr - ret -%else -printstr: - ; page and foreground color - jmp .loop_condition +; String constants with their length +%define TITLE 'Haiku Boot Manager' +%strlen TITLE_LENGTH TITLE +%define SELECT_OS_MESSAGE 'Select an OS from the menu' +%strlen SELECT_OS_MESSAGE_LENGTH SELECT_OS_MESSAGE + +; 16 bit code +SECTION +BITS 16 + + +; nicer way to get the size of a structure +%define sizeof(s) s %+ _size + +; using a structure in a another structure definition +%macro nstruc 1-2 1 + resb sizeof(%1) * %2 +%endmacro + +%macro DEBUG_PAUSE 0 + push ax + mov ah, READ_CHAR + int BIOS_KEYBOARD_SERVICES + pop ax +%endmacro + +%macro clearScreen 0 + mov ah, SCROLL_UP + xor al, al + mov bh, WHITE + xor cx, cx + mov dx, (TEXT_ROWS-1) * 0x100 + (TEXT_COLUMNS-1) + int BIOS_VIDEO_SERVICES +%endmacro + +; Prints a null terminated string +; si ... offset to string +%macro printString 0 + push cx + jmp .loop_condition .loop - mov ah, WRITE_CHAR - mov bx, 0x0F - mov cx, 1 - int BIOS_VIDEO_SERVICES -.loop_condition + mov cx, 1 + mov ah, WRITE_CHAR + int BIOS_VIDEO_SERVICES + mov ah, GET_CURSOR + int BIOS_VIDEO_SERVICES + inc dl + mov ah, SET_CURSOR + int BIOS_VIDEO_SERVICES +.loop_condition lodsb - cmp al, 0 - jnz .loop + cmp al, 0 + jnz .loop + pop cx ret -%endif - -DAP: - db 0x10 ; Size of DAP - db 0x00 ; unused (zero) - db 0x03 ; number of sectors to read - db 0x00 ; unused (zero) - dw 0x0200 ; segment:offset pointer to buffer - dw 0x07C0 ; segment:offset pointer to buffer - dw 0x0001 ; LBA address - dw 0x0000 - dw 0x0000 - dw 0x0000 - -WinDAP: - db 0x0B ; Size of DAP - db 0x00 ; unused (zero) - db 0x01 ; number of sectors to read - db 0x00 ; unused (zero) - dw 0x0000 ; segment:offset pointer to buffer - dw 0x07C0 ; segment:offset pointer to buffer - dw 0x003F ; LBA address - dw 0x0000 +%endmacro +; 64 bit value +struc quadword + .lower resd 1 + .upper resd 1 +endstruc -signation: - db 'Haiku Bootmanager', 0x00 -select_os: - db 'Select an OS from the menu', 0x00 +; address packet as required by the EXTENDED_READ BIOS call +struc AddressPacket + .packet_size resb 1 + .reserved1 resb 1 + .block_count resb 1 + .reserved2 resb 1 + .buffer resd 1 + .offset nstruc quadword +endstruc + +; use code available in stage 1 +%define printstr printStringStage1 + +stage1: + mov ax, 0x07C0 ; BOOT_BLOCK_START_ADDRESS / 16 + mov ds, ax ; Setup segment registers + mov es, ax + mov ss, ax - times 510 -($-$$) db 'B' ; Fill the missing space to reach 510 byte and set the - dw 0xAA55 ; magic marker "AA55" (to identify a valid bootrecord) + mov sp, 0xFFFF ; Make stack empty + + cld ; String operations increment index registers + + clearScreen + mov bh, 0 ; Text output on page 0 + + ; Print title centered at row 2 + mov ah, SET_CURSOR + mov dx, 1 * 0x100 + (40 - TITLE_LENGTH / 2) + int BIOS_VIDEO_SERVICES + + mov si, kTitle + mov bl, WHITE + call printstr + + ; Print message centered at second last row + mov ah, SET_CURSOR + mov dx, (TEXT_ROWS-2) * 0x100 + (40 - SELECT_OS_MESSAGE_LENGTH / 2) + mov bl, LIGHT_GRAY + int BIOS_VIDEO_SERVICES + + mov si, kSelectOSMessage + call printstr + + ; Chain load rest of boot loader + mov ah, EXTENDED_READ ; Load 3 more sectors + mov dl, 0x80 ; First HDD + mov si, nextStageDAP + int BIOS_DISK_SERVICES + jc .error ; I/O error + jmp stage2 ; Continue in loaded stage 2 + +.error: + mov si, kError + mov bl, RED + call printstr +.halt + mov ah, READ_CHAR + int BIOS_KEYBOARD_SERVICES + hlt + jmp .halt + +printStringStage1: + printString + +nextStageDAP: + istruc AddressPacket + at AddressPacket.packet_size, db 0x10 + at AddressPacket.block_count, db 0x03 + at AddressPacket.buffer, dw 0x0200, 0x07c0 + at AddressPacket.offset, dw 1 + iend + +kTitle: + db TITLE, 0x00 +kSelectOSMessage: + db SELECT_OS_MESSAGE, 0x00 +kError: + db 'Error loading sectors!', 0x00 + + ; Fill the missing space to reach 510 byte + times 510 -($-$$) db 'B' + +signature: + ; Magic marker "AA55" (to identify a valid boot record) + dw MBR_SIGNATURE + ; ====================================================================== ; ======================= SECOND SECTOR ================================ ; ====================================================================== -secsec: -; ======================= Center list ================================== - xor bx,bx ; Get ready for the Division - xor ax, ax ; Get ready for the Division - mov al, [list_items] - mov bl, 2 ; Divide by two - div bl ; Divide +; Use code available in stage 1 +%define printstr printStringStage2 - mov bl, 12 - sub bl, al ; Substract from 12 (screen is 80x25) - mov dh, bl - mov [first_position], dx +%assign TIMEOUT_OFF 0xffff -; ======================= Print the OS list ============================ -print_list: - mov dx, [first_position] - mov [position], dx - mov ah, 0x02 ; Set cursor position - int 0x10 - mov si, list ; Load the List - xor cx,cx ; Load listitems to CX - mov byte [colour], 0x0000 ; Reset Colour -print_list_loop: - lodsb ; Get lenght of string from list into al - ; Get the Text to be in the middle (40 - lenght/2) - xor bx,bx ; Get ready for the Division - mov ah, 0x00 - mov bl, 2 ; Divide by two - div bl ; Divide - - mov bl, 40 - sub bl, al ; Substract from 40 (screen is 80x25) - mov al, bl - mov dx, [position] ; Get last position - inc dh ; Next line - mov dl, al ; Move it to the place where the row should be for the interrupt (DL) +stage2: + mov ax, [defaultItem] ; Select default item + mov [selection], ax - mov ah, 0x02 ; Set cursor position - mov [position], dx - int 0x10 + mov ax, TICKS_PER_SECOND ; Calculate timeout ticks + mul word [timeout] + mov bx, dx + push ax - mov dx, [selection] - mov byte bl, [colour] ; Load Colour - and bx, 0x03 ; Just - inc bl ; Colours ... 1-4 - cmp cx, [selection] - jnz no_highlight - xor bx, 0x08 ; Highlight selected item -no_highlight: - mov byte [colour], bl ; Store Colour - call print_list_item - inc cx - cmp cx, [list_items] - jne print_list_loop + mov ah, READ_CLOCK + int BIOS_TIME_SERVICES -; ================== Wait for a key and do something with it ================== + pop ax ; Add current ticks + add ax, dx + adc bx, cx + mov [timeoutTicks], ax + mov [timeoutTicks + 2], bx + + mov al, [listItemCount] ; Calculate start row for menu + shr al, 1 + mov bl, TEXT_ROWS / 2 + sub bl, al ; y = TEXT_ROWS / 2 - number of items / 2 + mov [firstLine], bl -main_loopy: - mov ah, 0x02 ; Set cursor position - mov dx, 0x181C - int 0x10 - - mov ah, 0x00 ; Keyboard Read: wait for key - int 0x16 ; AL = ASCII Code, AH = Scancode - cmp ah, 0x50 - jz key_down ; Was it key_down, key_up... ? - cmp ah, 0x48 - jz key_up - cmp ah, 0x1C - jz key_enter + call printMenu - jmp main_loopy + cmp word [timeout], TIMEOUT_OFF + je inputLoop -key_down: - mov ax, [selection] - mov bx, [list_items] - dec bx - cmp ax, bx - je key_down_no ; Are we at the bottom of the list? - inc ax - mov [selection], ax -key_down_no: - jmp print_list -key_up: - mov ax, [selection] - mov bx, [list_items] - cmp ax, 0 - je key_down_no ; Are we at the top of the list? - dec ax - mov [selection], ax -key_up_no: - jmp print_list +timeoutLoop: + mov ah, PROBE_CHAR + int BIOS_KEYBOARD_SERVICES + jnz inputLoop ; cancel timeout if key is pressed + call isTimeoutReached + jnc timeoutLoop + jmp bootSelectedPartition +isTimeoutReached: + mov ah, READ_CLOCK + int BIOS_TIME_SERVICES + cmp cx, [timeoutTicks + 2] + jb .returnFalse + ja .returnTrue + cmp dx, [timeoutTicks] + ja .returnTrue +.returnFalse: + clc + ret +.returnTrue: + stc + ret + +; ================== Wait for a key and do something with it ================== +mainLoop: + call printMenu + +inputLoop: + mov ah, READ_CHAR + int BIOS_KEYBOARD_SERVICES ; AL = ASCII Code, AH = Scancode -; ========================== Chainload ========================== - -key_enter: - mov cx, [selection] - mov si, list - inc cx -load_LBA: - lodsb - cmp al, 0x80 - jne load_LBA - loop load_LBA + cmp ah, KEY_DOWN + je selectNextPartition - lodsw - mov [LBA_selectionA], ax - lodsw - mov [LBA_selectionB], ax + cmp ah, KEY_UP + je selectPreviousPartition - mov si, ChainLoad_DAP ; Load the List - mov ax, [LBA_selectionA] - mov word [si+8], ax - mov ax, [LBA_selectionB] - mov word [si+10], ax + cmp ah, KEY_RETURN + je bootSelectedPartition + + jmp inputLoop - mov ah, 0x42 - mov dl, 0x80 - mov si, ChainLoad_DAP - int 0x13 - mov si, error_lfd - jc print_debug +selectNextPartition: + mov ax, [selection] + inc ax + cmp ax, [listItemCount] + jne .done ; At end of list? + xor ax, ax ; Then jump to first entry +.done: + mov [selection], ax + jmp mainLoop + +selectPreviousPartition: + mov ax, [selection] + or ax, ax + jnz .done ; At top of list? + mov ax, [listItemCount] ; Then jump to last entry +.done: + dec ax + mov [selection], ax + jmp mainLoop - mov si, 0x0 - xor ax, ax - mov si, error_nb - mov byte al, [0x01FE] - cmp al, 0x55 - jne print_debug + +; ======================= Print the OS list ============================ +printMenu: + mov al, [firstLine] + mov [currentLine], al - mov byte al, [0x01FF] - cmp al, 0xAA - jne print_debug + mov si, list ; Start at top of list + xor cx, cx ; The index of the current item + +.loop: + lodsb ; String length incl. 0-terminator + dec al ; center menu item + shr al, 1 ; x = TEXT_COLUMNS / 2 - length / 2 + mov dl, TEXT_COLUMNS / 2 + sub dl, al + + mov dh, [currentLine] + mov ah, SET_CURSOR + int BIOS_VIDEO_SERVICES - mov si, yeah ; Yeah - jmp print_debug + mov di, cx + and di, 3 + mov bl, [kColorTable + di] ; Text color + cmp cx, [selection] + jne .print ; Selected item reached? + xor bl, BRIGHT_COLOR_MASK ; Highlight it + +.print: + call printstr + add si, sizeof(quadword) ; Skip start sector quad word + + inc byte [currentLine] + inc cx + + cmp cx, [listItemCount] + jne .loop + mov ah, SET_CURSOR ; Set cursor position + mov dx, (TEXT_ROWS-4) * 0x100 + (TEXT_COLUMNS / 3) + mov dx, 0x181C + int BIOS_VIDEO_SERVICES + ret -fin: - mov ah, 0x0e - mov al, 'F' - mov bx, 0x2 - mov cx, 0x1 - int 0x10 - jmp $ +; ========================== Chainload ========================== +bootSelectedPartition: -; ====================== THE print_list function ================ + mov si, list ; Search address of start sector + ; of the selected item. + mov cx, [selection] + inc cx ; Number of required iterations + + xor ah, ah ; The high-byte of the string length + ; see loop body + jmp .search_loop_entry + +.search_loop: + add si, sizeof(quadword) ; Skip to begin of next menu item -print_list_item: -print_list_item_loop: - lodsb - cmp al,0x80 - jz print_list_item_end - mov ah, 0x0E - int 0x10 - jmp print_list_item_loop -print_list_item_end: +.search_loop_entry: + lodsb ; Length of menu item name + add si, ax ; Skip name to address of start sector + loop .search_loop + + mov di, bootSectorDAP+AddressPacket.offset ; Copy start sector + mov cx, 4 ; It is stored in a quad word +.copy_start_sector lodsw - lodsw - ret + stosw + loop .copy_start_sector -print_debug: ; Poor mans printf again - lodsb - mov ah, 0x0E - mov bx, 0x0F - mov cx, 0x01 - int 0x10 - cmp al, 0x00 - jnz print_debug - jmp $ + mov ah, EXTENDED_READ ; Now read start sector from HD + mov dl, 0x80 ; overwriting our first stage + mov si, bootSectorDAP + int BIOS_DISK_SERVICES + mov si, kReadError + jc printAndHalt ; Failed to read sector + + mov ax, [signature] + cmp ax, MBR_SIGNATURE + mov si, kNoBootablePartitionError + jne printAndHalt ; Missing signature + jmp $$ ; Start loaded boot loader + + +; ====================== THE printMenu function ================ + +printStringStage2: + printString + +printAndHalt: + mov bx, 0x0F ; Page number and foreground color + call printstr +.halt + mov ah, READ_CHAR + int BIOS_KEYBOARD_SERVICES + hlt + jmp .halt + ; ================================ DATA =========================== -error_lfd: - db 'Error loading Sectors', 0x00 -error_nb: - db 'Not a bootable partition', 0x00 -LBA_selectionA: - dw 0x0000 -LBA_selectionB: - dw 0x0000 -selection: - dw 0x0000 -position: - dw 0x091D -lenght: - dw 0x0000 -colour: - dw 0x0000 -first_position: - dw 0x091F -nobots: - db 'Boot sector signature not found', 0x00 -error: - db 'Error loading sectors', 0x00 -yeah: - db 'Boot!', 0x00 +selection: + dw 0x0000 +firstLine: + db 0 +currentLine: + db 0 +timeoutTicks: + dw 0, 0 +bootSectorDAP: + istruc AddressPacket + at AddressPacket.packet_size, db 0x10 + at AddressPacket.block_count, db 0x01 + at AddressPacket.buffer, dw 0x0000, 0x07c0 + iend +kColorTable: + db BLUE, RED, CYAN, GREEN +kReadError: + db 'Error loading sectors', 0x00 +kNoBootablePartitionError: + db 'Not a bootable partition', 0x00 +kBootMessage: + db 'Boot!', 0x00 -list_items: - dw 0x06 -list: - db 0x05 - db 'HAIKU' , 0x80 - dw 0x003E - dw 0x0000 - db 0x07 - db 'FreeBSD' , 0x80 - dw 0x003F - dw 0x0000 +listItemCount: +defaultItem equ listItemCount + 2 +timeout equ defaultItem + 2 +list equ timeout + 2 + +; dw number of entries +; dw the default entry +; dw the timeout (-1 for none) +; entry: +; db size of partition name 0-terminated string +; db 0-terminated string with partition name +; quadword start sector - db 0x03 - db 'DOS' , 0x80 - dw 0x003E - dw 0x0000 +%if USE_TEST_MENU + dw 0x06 + + dw 2 + + dw 5 - db 0x05 - db 'LINUX' , 0x80 - dw 0x003F - dw 0x0000 + db 0x06 + db 'HAIKU', 0 + dw 1, 0, 0, 0 - db 0x07 - db 'BeOS R5' , 0x80 - dw 0x003F - dw 0x0000 + db 0x08 + db 'FreeBSD', 0 + dw 0x003F, 0, 0, 0 - db 0x07 - db 'OpenBSD' , 0x80 - dw 0xAAAA - dw 0x0000 + db 0x04 + db 'DOS', 0 + dw 0x003E, 0, 0, 0 -ChainLoad_DAP: - db 0x10 ; Size of DAP - db 0x00 ; unused (zero) - db 0x01 ; number of sectors to read - db 0x00 ; unused (zero) - dw 0x0000 ; segment:offset pointer to buffer - dw 0x07C0 ; segment:offset pointer to buffer - dw 0x003F ; LBA address - dw 0x0000 - dw 0x0000 - dw 0x0000 + db 0x06 + db 'LINUX', 0 + dw 0x003F, 0, 0, 0 + db 0x08 + db 'BeOS R5', 0 + dw 0x003F, 0, 0, 0 + db 0x07 + db 'OpenBSD', 0 + dw 0xAAAA, 0, 0, 0 +%endif - From laplace at mail.berlios.de Sat Apr 12 10:21:35 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 12 Apr 2008 10:21:35 +0200 Subject: [Haiku-commits] r24934 - haiku/trunk/src/apps/bootman Message-ID: <200804120821.m3C8LZdo023347@sheep.berlios.de> Author: laplace Date: 2008-04-12 10:21:35 +0200 (Sat, 12 Apr 2008) New Revision: 24934 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24934&view=rev Modified: haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp Log: Removed debug code. Modified: haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp =================================================================== --- haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp 2008-04-12 08:19:25 UTC (rev 24933) +++ haiku/trunk/src/apps/bootman/DefaultPartitionPage.cpp 2008-04-12 08:21:35 UTC (rev 24934) @@ -173,7 +173,7 @@ return button; } -#include + void DefaultPartitionPage::_Layout() { @@ -181,7 +181,6 @@ float left = fDefaultPartition->Frame().left; float top = fDescription->Frame().bottom + kTextDistance; - printf("top %f\n", top); BView* controls[] = { fDefaultPartition, @@ -192,11 +191,9 @@ }; for (int i = 0; i < 5; i ++) { - printf("*"); BView* view = controls[i]; view->MoveTo(left, top); top = view->Frame().bottom + 3; } - printf("\n"); } From laplace at mail.berlios.de Sat Apr 12 10:25:39 2008 From: laplace at mail.berlios.de (laplace at BerliOS) Date: Sat, 12 Apr 2008 10:25:39 +0200 Subject: [Haiku-commits] r24935 - haiku/trunk/src/apps/bootman Message-ID: <200804120825.m3C8PdhE023979@sheep.berlios.de> Author: laplace Date: 2008-04-12 10:25:38 +0200 (Sat, 12 Apr 2008) New Revision: 24935 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24935&view=rev Added: haiku/trunk/src/apps/bootman/BootLoader.h Modified: haiku/trunk/src/apps/bootman/BootDrive.h haiku/trunk/src/apps/bootman/BootManagerController.cpp haiku/trunk/src/apps/bootman/BootManagerController.h haiku/trunk/src/apps/bootman/Jamfile haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp haiku/trunk/src/apps/bootman/LegacyBootDrive.h haiku/trunk/src/apps/bootman/TestBootDrive.cpp haiku/trunk/src/apps/bootman/TestBootDrive.h Log: Save and restore MBR and write boot menu. Modified: haiku/trunk/src/apps/bootman/BootDrive.h =================================================================== --- haiku/trunk/src/apps/bootman/BootDrive.h 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/BootDrive.h 2008-04-12 08:25:38 UTC (rev 24935) @@ -23,17 +23,23 @@ "path" String (path to partition in /dev/...) "size" long (size of partition in bytes) */ + +enum { + // Not enough space free before first partition for boot loader + kErrorBootSectorTooSmall = B_ERRORS_END + 1, +}; + class BootDrive { public: BootDrive() {} virtual ~BootDrive() {} - virtual bool IsBootMenuInstalled() = 0; - virtual status_t ReadPartitions(BMessage *message) = 0; - virtual status_t WriteBootMenu(BMessage *message) = 0; - virtual status_t SaveMasterBootRecord(BFile *file) = 0; - virtual status_t RestoreMasterBootRecord(BFile *file) = 0; + virtual bool IsBootMenuInstalled(BMessage* settings) = 0; + virtual status_t ReadPartitions(BMessage* settings) = 0; + virtual status_t WriteBootMenu(BMessage* settings) = 0; + virtual status_t SaveMasterBootRecord(BMessage* settings, BFile* file) = 0; + virtual status_t RestoreMasterBootRecord(BMessage* settings, BFile* file) = 0; }; #endif // BOOT_DRIVE_H Added: haiku/trunk/src/apps/bootman/BootLoader.h =================================================================== --- haiku/trunk/src/apps/bootman/BootLoader.h 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/BootLoader.h 2008-04-12 08:25:38 UTC (rev 24935) @@ -0,0 +1,69 @@ +// THIS FILE WAS GENERATED WITH +// ./make_array kBootLoader bootman.bin + +static const uint8 kBootLoader[] = { + 0xb8, 0xc0, 0x07, 0x8e, 0xd8, 0x8e, 0xc0, 0x8e, 0xd0, 0xbc, 0xff, 0xff, 0xfc, 0xb4, 0x06, 0x30, + 0xc0, 0xb7, 0x0f, 0x31, 0xc9, 0xba, 0x4f, 0x18, 0xcd, 0x10, 0xb7, 0x00, 0xb4, 0x02, 0xba, 0x1f, + 0x01, 0xcd, 0x10, 0xbe, 0x83, 0x00, 0xb3, 0x0f, 0xe8, 0x2c, 0x00, 0xb4, 0x02, 0xba, 0x1b, 0x17, + 0xb3, 0x07, 0xcd, 0x10, 0xbe, 0x96, 0x00, 0xe8, 0x1d, 0x00, 0xb4, 0x42, 0xb2, 0x80, 0xbe, 0x73, + 0x00, 0xcd, 0x13, 0x72, 0x03, 0xe9, 0xb8, 0x01, 0xbe, 0xb1, 0x00, 0xb3, 0x04, 0xe8, 0x07, 0x00, + 0xb4, 0x00, 0xcd, 0x16, 0xf4, 0xeb, 0xf9, 0x51, 0xe9, 0x11, 0x00, 0xb9, 0x01, 0x00, 0xb4, 0x09, + 0xcd, 0x10, 0xb4, 0x03, 0xcd, 0x10, 0xfe, 0xc2, 0xb4, 0x02, 0xcd, 0x10, 0xac, 0x3c, 0x00, 0x75, + 0xea, 0x59, 0xc3, 0x10, 0x00, 0x03, 0x00, 0x00, 0x02, 0xc0, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x48, 0x61, 0x69, 0x6b, 0x75, 0x20, 0x42, 0x6f, 0x6f, 0x74, 0x20, 0x4d, 0x61, + 0x6e, 0x61, 0x67, 0x65, 0x72, 0x00, 0x53, 0x65, 0x6c, 0x65, 0x63, 0x74, 0x20, 0x61, 0x6e, 0x20, + 0x4f, 0x53, 0x20, 0x66, 0x72, 0x6f, 0x6d, 0x20, 0x74, 0x68, 0x65, 0x20, 0x6d, 0x65, 0x6e, 0x75, + 0x00, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, 0x73, + 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x21, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x55, 0xaa, + 0xa1, 0x99, 0x03, 0xa3, 0x46, 0x03, 0xb8, 0x13, 0x00, 0xf7, 0x26, 0x9b, 0x03, 0x89, 0xd3, 0x50, + 0xb4, 0x00, 0xcd, 0x1a, 0x58, 0x01, 0xd0, 0x11, 0xcb, 0xa3, 0x4a, 0x03, 0x89, 0x1e, 0x4c, 0x03, + 0xa0, 0x97, 0x03, 0xd0, 0xe8, 0xb3, 0x0c, 0x28, 0xc3, 0x88, 0x1e, 0x48, 0x03, 0xe8, 0x65, 0x00, + 0x81, 0x3e, 0x9b, 0x03, 0xff, 0xff, 0x74, 0x27, 0xb4, 0x01, 0xcd, 0x16, 0x75, 0x21, 0xe8, 0x05, + 0x00, 0x73, 0xf5, 0xe9, 0x9b, 0x00, 0xb4, 0x00, 0xcd, 0x1a, 0x3b, 0x0e, 0x4c, 0x03, 0x72, 0x08, + 0x77, 0x08, 0x3b, 0x16, 0x4a, 0x03, 0x77, 0x02, 0xf8, 0xc3, 0xf9, 0xc3, 0xe8, 0x36, 0x00, 0xb4, + 0x00, 0xcd, 0x16, 0x80, 0xfc, 0x50, 0x74, 0x0c, 0x80, 0xfc, 0x48, 0x74, 0x18, 0x80, 0xfc, 0x1c, + 0x74, 0x6f, 0xeb, 0xeb, 0xa1, 0x46, 0x03, 0x40, 0x3b, 0x06, 0x97, 0x03, 0x75, 0x02, 0x31, 0xc0, + 0xa3, 0x46, 0x03, 0xeb, 0xd7, 0xa1, 0x46, 0x03, 0x09, 0xc0, 0x75, 0x03, 0xa1, 0x97, 0x03, 0x48, + 0xa3, 0x46, 0x03, 0xeb, 0xc7, 0xa0, 0x48, 0x03, 0xa2, 0x49, 0x03, 0xbe, 0x9d, 0x03, 0x31, 0xc9, + 0xac, 0xfe, 0xc8, 0xd0, 0xe8, 0xb2, 0x28, 0x28, 0xc2, 0x8a, 0x36, 0x49, 0x03, 0xb4, 0x02, 0xcd, + 0x10, 0x89, 0xcf, 0x81, 0xe7, 0x03, 0x00, 0x8a, 0x9d, 0x5e, 0x03, 0x3b, 0x0e, 0x46, 0x03, 0x75, + 0x03, 0x80, 0xf3, 0x08, 0xe8, 0x56, 0x00, 0x81, 0xc6, 0x08, 0x00, 0xfe, 0x06, 0x49, 0x03, 0x41, + 0x3b, 0x0e, 0x97, 0x03, 0x75, 0xca, 0xb4, 0x02, 0xba, 0x1a, 0x15, 0xba, 0x1c, 0x18, 0xcd, 0x10, + 0xc3, 0xbe, 0x9d, 0x03, 0x8b, 0x0e, 0x46, 0x03, 0x41, 0x30, 0xe4, 0xe9, 0x04, 0x00, 0x81, 0xc6, + 0x08, 0x00, 0xac, 0x01, 0xc6, 0xe2, 0xf7, 0xbf, 0x56, 0x03, 0xb9, 0x04, 0x00, 0xad, 0xab, 0xe2, + 0xfc, 0xb4, 0x42, 0xb2, 0x80, 0xbe, 0x4e, 0x03, 0xcd, 0x13, 0xbe, 0x62, 0x03, 0x72, 0x2a, 0xa1, + 0xfe, 0x01, 0x3d, 0x55, 0xaa, 0xbe, 0x78, 0x03, 0x75, 0x1f, 0xe9, 0xe3, 0xfc, 0x51, 0xe9, 0x11, + 0x00, 0xb9, 0x01, 0x00, 0xb4, 0x09, 0xcd, 0x10, 0xb4, 0x03, 0xcd, 0x10, 0xfe, 0xc2, 0xb4, 0x02, + 0xcd, 0x10, 0xac, 0x3c, 0x00, 0x75, 0xea, 0x59, 0xc3, 0xbb, 0x0f, 0x00, 0xe8, 0xde, 0xff, 0xb4, + 0x00, 0xcd, 0x16, 0xf4, 0xeb, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, + 0x01, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x04, + 0x03, 0x02, 0x45, 0x72, 0x72, 0x6f, 0x72, 0x20, 0x6c, 0x6f, 0x61, 0x64, 0x69, 0x6e, 0x67, 0x20, + 0x73, 0x65, 0x63, 0x74, 0x6f, 0x72, 0x73, 0x00, 0x4e, 0x6f, 0x74, 0x20, 0x61, 0x20, 0x62, 0x6f, + 0x6f, 0x74, 0x61, 0x62, 0x6c, 0x65, 0x20, 0x70, 0x61, 0x72, 0x74, 0x69, 0x74, 0x69, 0x6f, 0x6e, + 0x00, 0x42, 0x6f, 0x6f, 0x74, 0x21, 0x00, 0x06, 0x00, 0x02, 0x00, 0x05, 0x00, 0x06, 0x48, 0x41, + 0x49, 0x4b, 0x55, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x46, 0x72, 0x65, + 0x65, 0x42, 0x53, 0x44, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x44, 0x4f, + 0x53, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x4c, 0x49, 0x4e, 0x55, 0x58, + 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x42, 0x65, 0x4f, 0x53, 0x20, 0x52, + 0x35, 0x00, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x4f, 0x70, 0x65, 0x6e, 0x42, + 0x53, 0x44, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 +}; Modified: haiku/trunk/src/apps/bootman/BootManagerController.cpp =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerController.cpp 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/BootManagerController.cpp 2008-04-12 08:25:38 UTC (rev 24935) @@ -61,7 +61,7 @@ fSettings.AddString("file", ""); } - fBootDrive->ReadPartitions(&fSettings); + fReadPartitionsStatus = fBootDrive->ReadPartitions(&fSettings); } @@ -73,7 +73,9 @@ int32 BootManagerController::InitialState() { - return kStateEntry; + if (fReadPartitionsStatus == B_OK) + return kStateEntry; + return kStateErrorEntry; } @@ -86,7 +88,7 @@ bool install; fSettings.FindBool("install", &install); if (install) { - if (fBootDrive->IsBootMenuInstalled()) + if (fBootDrive->IsBootMenuInstalled(&fSettings)) return kStatePartitions; else return kStateSaveMBR; @@ -94,6 +96,10 @@ else return kStateUninstall; } + + case kStateErrorEntry: + be_app->PostMessage(B_QUIT_REQUESTED); + break; case kStateSaveMBR: if (_SaveMBR()) @@ -162,10 +168,7 @@ if (alert->Go() == 1) return false; - status_t status = fBootDrive->WriteBootMenu(&fSettings); - fSettings.RemoveName("installStatus"); - fSettings.AddInt32("installStatus", status); - + fWriteBootMenuStatus = fBootDrive->WriteBootMenu(&fSettings); return true; } @@ -173,11 +176,10 @@ bool BootManagerController::_SaveMBR() { - BFile file("", B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); - status_t state = fBootDrive->SaveMasterBootRecord(&file); - fSettings.RemoveName("saveMBRStatus"); - fSettings.AddInt32("saveMBRStatus", state); - + BString path; + fSettings.FindString("file", &path); + BFile file(path.String(), B_READ_WRITE | B_CREATE_FILE | B_ERASE_FILE); + fSaveMBRStatus = fBootDrive->SaveMasterBootRecord(&fSettings, &file); return true; } @@ -201,10 +203,7 @@ return false; BFile file(path.String(), B_READ_ONLY); - status_t state = fBootDrive->RestoreMasterBootRecord(&file); - fSettings.RemoveName("restoreMBRStatus"); - fSettings.AddInt32("restoreMBRStatus", state); - + fRestoreMBRStatus = fBootDrive->RestoreMasterBootRecord(&fSettings, &file); return true; } @@ -220,6 +219,11 @@ page = new EntryPage(&fSettings, frame, "entry"); wizard->SetPreviousButtonHidden(true); break; + case kStateErrorEntry: + page = _CreateErrorEntryPage(frame); + wizard->SetPreviousButtonHidden(true); + wizard->SetNextButtonLabel("Done"); + break; case kStateSaveMBR: page = _CreateSaveMBRPage(frame); wizard->SetPreviousButtonHidden(false); @@ -259,6 +263,26 @@ WizardPageView* +BootManagerController::_CreateErrorEntryPage(BRect frame) +{ + BString description; + + if (fReadPartitionsStatus == kErrorBootSectorTooSmall) + description << + "Partition Table Not Compatible\n\n" + "The partition table of the first hard disk is not compatible " + "with Boot Manager.\n" + "Boot Manager needs 2 KB available space before the first partition."; + else + description << + "Error Reading Partition Table\n\n" + "Boot Manager is unable to read the partition table!"; + + return new DescriptionPage(frame, "errorEntry", description.String(), true); +} + + +WizardPageView* BootManagerController::_CreateSaveMBRPage(BRect frame) { BString description; @@ -275,9 +299,8 @@ "you later wish to remove the boot menu, simply run the " "bootman program and choose to 'Uninstall' option."; - FileSelectionPage* page = new FileSelectionPage(&fSettings, frame, "saveMBR", description.String(), + return new FileSelectionPage(&fSettings, frame, "saveMBR", description.String(), B_SAVE_PANEL); - return page; } @@ -288,13 +311,19 @@ BString file; fSettings.FindString("file", &file); - description << - "Old Master Boot Record Saved\n\n" - "The old Master Boot Record was successfully save to " - << file << ".\n"; + if (fSaveMBRStatus == B_OK) { + description << + "Old Master Boot Record Saved\n\n" + "The old Master Boot Record was successfully save to " + << file << ".\n"; + } else { + description << + "Old Master Boot Record Saved Failure\n\n" + "The old Master Boot Record could not be saved to " + << file << ".\n"; + } - DescriptionPage* page = new DescriptionPage(frame, "summary", description.String(), true); - return page; + return new DescriptionPage(frame, "summary", description.String(), true); } @@ -325,8 +354,7 @@ description << name << "\t(" << path << ")\n"; } - DescriptionPage* page = new DescriptionPage(frame, "summary", description.String(), true); - return page; + return new DescriptionPage(frame, "summary", description.String(), true); } @@ -335,20 +363,17 @@ { const char* description; - int32 status; - fSettings.FindInt32("installStatus", &status); - if (status == B_OK) { + if (fWriteBootMenuStatus == B_OK) { description = "Installation Boot Menu Completed\n\n" "The boot manager has been successfully installed " "on your system."; } else { - // TODO description = "Installation Boot Menu Failed\n\n" - "TODO"; + "An error occured writing the boot menu. The Master Boot Record " + "might be destroyed, you should restore the MBR now!"; } - DescriptionPage* page = new DescriptionPage(frame, "done", description, true); - return page; + return new DescriptionPage(frame, "done", description, true); } @@ -363,9 +388,8 @@ "restore from. This is the file that was created when the " "boot manager was first installed."; - FileSelectionPage* page = new FileSelectionPage(&fSettings, frame, "restoreMBR", description.String(), + return new FileSelectionPage(&fSettings, frame, "restoreMBR", description.String(), B_OPEN_PANEL); - return page; } @@ -378,22 +402,17 @@ fSettings.FindString("disk", &disk); fSettings.FindString("file", &file); - int32 status; - fSettings.FindInt32("restoreMBRStatus", &status); - if (status == B_OK) { + if (fRestoreMBRStatus == B_OK) { description << "Uninstallation Boot Menu Completed\n\n" "The Master Boot Record of the boot device " "(" << disk << ") has been successfully restored from " << file << "."; } else { - // TODO description << "Uninstallation Boot Menu Failed\n\n" - "TODO"; + "The Master Boot Record could not be restored!"; } - DescriptionPage* page = new DescriptionPage(frame, "summary", description.String(), true); - return page; - + return new DescriptionPage(frame, "summary", description.String(), true); } Modified: haiku/trunk/src/apps/bootman/BootManagerController.h =================================================================== --- haiku/trunk/src/apps/bootman/BootManagerController.h 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/BootManagerController.h 2008-04-12 08:25:38 UTC (rev 24935) @@ -25,9 +25,6 @@ "file" String (the file where the backup of the MBR is saved) "defaultPartition" int32 (index of default partition) "timeout" int32 (timeout in seconds, -1 for no timeout) - "installStatus" int32 (status_t) - "saveMBRStatus" int32 (status_t) - "restoreMBRStatus" int32 (status_t) */ class BootManagerController : public WizardController @@ -45,6 +42,7 @@ enum State { kStateEntry, + kStateErrorEntry, // Install states kStateSaveMBR, @@ -64,6 +62,7 @@ bool _SaveMBR(); bool _RestoreMBR(); + WizardPageView* _CreateErrorEntryPage(BRect frame); WizardPageView* _CreateSaveMBRPage(BRect frame); WizardPageView* _CreateMBRSavedPage(BRect frame); WizardPageView* _CreateInstallSummaryPage(BRect frame); @@ -73,6 +72,11 @@ BMessage fSettings; BootDrive* fBootDrive; + + status_t fReadPartitionsStatus; + status_t fWriteBootMenuStatus; + status_t fSaveMBRStatus; + status_t fRestoreMBRStatus; }; Modified: haiku/trunk/src/apps/bootman/Jamfile =================================================================== --- haiku/trunk/src/apps/bootman/Jamfile 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/Jamfile 2008-04-12 08:25:38 UTC (rev 24935) @@ -13,7 +13,6 @@ FileSelectionPage.cpp LegacyBootDrive.cpp PartitionsPage.cpp - TestBootDrive.cpp UninstallPage.cpp WizardController.cpp WizardPageView.cpp Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-12 08:25:38 UTC (rev 24935) @@ -17,9 +17,95 @@ #include #include +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include "BootLoader.h" + + +#define USE_SECOND_DISK 0 + + +class Buffer : public BMallocIO +{ +public: + Buffer() : BMallocIO() {} + bool WriteInt8(int8 value); + bool WriteInt16(int16 value); + bool WriteInt32(int32 value); + bool WriteInt64(int64 value); + bool WriteString(const char* value); + bool Align(int16 alignment); + bool Fill(int16 size, int8 fillByte); +}; + + +bool +Buffer::WriteInt8(int8 value) +{ + return Write(&value, sizeof(value)) == sizeof(value); +} + + +bool +Buffer::WriteInt16(int16 value) +{ + return WriteInt8(value & 0xff) && WriteInt8(value >> 8); +} + + +bool +Buffer::WriteInt32(int32 value) +{ + return WriteInt8(value & 0xff) && WriteInt8(value >> 8) && + WriteInt8(value >> 16) && WriteInt8(value >> 24); +} + + +bool +Buffer::WriteInt64(int64 value) +{ + return WriteInt32(value) && WriteInt32(value >> 32); +} + + +bool +Buffer::WriteString(const char* value) +{ + int len = strlen(value) + 1; + return WriteInt8(len) && Write(value, len) == len; +} + + +bool +Buffer::Align(int16 alignment) +{ + if ((Position() % alignment) == 0) + return true; + return Fill(alignment - (Position() % alignment), 0); +} + + +bool +Buffer::Fill(int16 size, int8 fillByte) +{ + for (int i = 0; i < size; i ++) { + if (!WriteInt8(fillByte)) + return false; + } + return true; +} + + class PartitionRecorder : public BDiskDeviceVisitor { public: @@ -28,16 +114,22 @@ virtual bool Visit(BDiskDevice* device); virtual bool Visit(BPartition* partition, int32 level); + bool HasPartitions() const; + off_t FirstOffset() const; + private: bool _Record(BPartition* partition); BMessage* fSettings; int32 fIndex; + off_t fFirstOffset; }; PartitionRecorder::PartitionRecorder(BMessage* settings) : fSettings(settings) + , fIndex(0) + , fFirstOffset((off_t)-1) { } @@ -57,6 +149,20 @@ bool +PartitionRecorder::HasPartitions() const +{ + return fFirstOffset != (off_t)-1; +} + + +off_t +PartitionRecorder::FirstOffset() const +{ + return fFirstOffset; +} + + +bool PartitionRecorder::_Record(BPartition* partition) { BPath partitionPath; @@ -75,13 +181,20 @@ type = "Unknown"; BMessage message; + // Data as required by BootLoader.h message.AddBool("show", true); message.AddString("name", name); message.AddString("type", type); message.AddString("path", partitionPath.Path()); message.AddInt64("size", partition->ContentSize()); - fSettings->AddMessage("partition", &message); + // Specific data + message.AddInt64("offset", partition->Offset()); + + fSettings->AddMessage("partition", &message); + if (partition->Offset() < fFirstOffset) + fFirstOffset = partition->Offset(); + return false; } @@ -97,62 +210,279 @@ bool -LegacyBootDrive::IsBootMenuInstalled() +LegacyBootDrive::IsBootMenuInstalled(BMessage* settings) { + // TODO detect bootman return false; } status_t -LegacyBootDrive::ReadPartitions(BMessage *message) +LegacyBootDrive::ReadPartitions(BMessage *settings) { BDiskDeviceRoster diskDeviceRoster; BDiskDevice device; - // first disk only - if (diskDeviceRoster.GetNextDevice(&device) == B_OK) { + bool diskFound = false; + while (diskDeviceRoster.GetNextDevice(&device) == B_OK) { BPath path; if (device.GetPath(&path) != B_OK) return B_ERROR; - - message->AddString("disk", path.Path()); + + PartitionRecorder recorder(settings); + device.VisitEachDescendant(&recorder); + if (!diskFound) { + settings->AddString("disk", path.Path()); + diskFound = true; - PartitionRecorder recorder(message); - device.VisitEachDescendant(&recorder); + #if not USE_SECOND_DISK + // ignored in test build + off_t size = sizeof(kBootLoader); + if (!recorder.HasPartitions() || recorder.FirstOffset() < size) + return kErrorBootSectorTooSmall; + #endif + } } - return B_OK; + + #if USE_SECOND_DISK + // for testing only write boot menu to second hdd + settings->ReplaceString("disk", "/dev/disk/ata/1/master/raw"); + #endif + + if (diskFound) + return B_OK; + else + return B_ERROR; } status_t -LegacyBootDrive::WriteBootMenu(BMessage *message) +LegacyBootDrive::WriteBootMenu(BMessage *settings) { - // TODO printf("WriteBootMenu:\n"); - message->PrintToStream(); + settings->PrintToStream(); + + BString path; + if (settings->FindString("disk", &path) != B_OK) + return B_BAD_VALUE; + int32 defaultPartitionIndex; + if (settings->FindInt32("defaultPartition", &defaultPartitionIndex) != B_OK) + return B_BAD_VALUE; + + int32 timeout; + if (settings->FindInt32("timeout", &timeout) != B_OK) + return B_BAD_VALUE; + + int fd = open(path.String(), O_RDWR); + if (fd < 0) + return B_IO_ERROR; + + MasterBootRecord oldMBR; + if (read(fd, &oldMBR, sizeof(oldMBR)) != sizeof(oldMBR)) { + close(fd); + return B_IO_ERROR; + } + + if (!_IsValid(&oldMBR)) { + close(fd); + return B_BAD_VALUE; + } + + Buffer newBootLoader; + ssize_t size = sizeof(kBootLoader); + if (newBootLoader.Write(kBootLoader, size) != size) { + close(fd); + return B_NO_MEMORY; + } + + MasterBootRecord* newMBR = (MasterBootRecord*)newBootLoader.BMallocIO::Buffer(); + _CopyPartitionTable(newMBR, &oldMBR); + + int menuEntries = 0; BMessage partition; - int32 index = 0; - for (; message->FindMessage("partition", index, &partition) == B_OK; index ++) { - printf("Partition %d:\n", (int)index); - partition.PrintToStream(); + int32 index; + for (index = 0; settings->FindMessage("partition", index, &partition) == B_OK; index ++) { + bool show; + partition.FindBool("show", &show); + if (!show) + continue; + + menuEntries ++; } + newBootLoader.WriteInt16(menuEntries); + newBootLoader.WriteInt16(defaultPartitionIndex); + newBootLoader.WriteInt16(timeout); - return B_OK; + + for (index = 0; settings->FindMessage("partition", index, &partition) == B_OK; index ++) { + bool show; + BString name; + BString path; + int64 offset; + partition.FindBool("show", &show); + partition.FindString("name", &name); + partition.FindString("path", &path); + // LegacyBootDrive provides offset in message as well + partition.FindInt64("offset", &offset); + if (!show) + continue; + + newBootLoader.WriteString(name.String()); + newBootLoader.WriteInt64(offset / kBlockSize); + } + + if (!newBootLoader.Align(kBlockSize)) { + close(fd); + return B_ERROR; + } + + lseek(fd, 0, SEEK_SET); + const uint8* buffer = (uint8*)newBootLoader.BMallocIO::Buffer(); + status_t status = _WriteBlocks(fd, buffer, newBootLoader.Position()); + close(fd); + return status; } status_t -LegacyBootDrive::SaveMasterBootRecord(BFile *file) +LegacyBootDrive::SaveMasterBootRecord(BMessage* settings, BFile* file) +{ + BString path; + + if (settings->FindString("disk", &path) != B_OK) + return B_BAD_VALUE; + + int fd = open(path.String(), O_RDONLY); + if (fd < 0) + return B_IO_ERROR; + + ssize_t size = kBlockSize * kNumberOfBootLoaderBlocks; + uint8* buffer = new uint8[size]; + if (buffer == NULL) { + close(fd); + return B_NO_MEMORY; + } + + status_t status = _ReadBlocks(fd, buffer, size); + if (status != B_OK) { + close(fd); + delete buffer; + return B_IO_ERROR; + } + + MasterBootRecord* mbr = (MasterBootRecord*)buffer; + if (!_IsValid(mbr)) { + close(fd); + delete buffer; + return B_BAD_VALUE; + } + + if (file->Write(buffer, size) != size) + status = B_IO_ERROR; + delete buffer; + close(fd); + return status; +} + + +status_t +LegacyBootDrive::RestoreMasterBootRecord(BMessage* settings, BFile* file) { - // TODO implement + BString path; + if (settings->FindString("disk", &path) != B_OK) + return B_BAD_VALUE; + + int fd = open(path.String(), O_RDWR); + if (fd < 0) + return B_IO_ERROR; + + MasterBootRecord oldMBR; + if (read(fd, &oldMBR, sizeof(oldMBR)) != sizeof(oldMBR)) { + close(fd); + return B_IO_ERROR; + } + if (!_IsValid(&oldMBR)) { + close(fd); + return B_BAD_VALUE; + } + + lseek(fd, 0, SEEK_SET); + + size_t size = kBlockSize * kNumberOfBootLoaderBlocks; + uint8* buffer = new uint8[size]; + if (buffer == NULL) { + close(fd); + return B_NO_MEMORY; + } + + if (file->Read(buffer, size) != (ssize_t)size) { + close(fd); + delete buffer; + return B_IO_ERROR; + } + + MasterBootRecord* newMBR = (MasterBootRecord*)buffer; + if (!_IsValid(newMBR)) { + close(fd); + delete buffer; + return B_BAD_VALUE; + } + + _CopyPartitionTable(newMBR, &oldMBR); + + status_t status = _WriteBlocks(fd, buffer, size); + delete buffer; + close(fd); + return status; +} + + +status_t +LegacyBootDrive::_ReadBlocks(int fd, uint8* buffer, size_t size) +{ + if (size % kBlockSize != 0) { + fprintf(stderr, "_ReadBlocks buffer size must be a multiple of %d\n", (int)kBlockSize); + return B_BAD_VALUE; + } + const size_t blocks = size / kBlockSize; + uint8* block = buffer; + for (size_t i = 0; i < blocks; i ++, block += kBlockSize) { + if (read(fd, block, kBlockSize) != (ssize_t)kBlockSize) + return B_IO_ERROR; + } return B_OK; } status_t -LegacyBootDrive::RestoreMasterBootRecord(BFile *file) +LegacyBootDrive::_WriteBlocks(int fd, const uint8* buffer, size_t size) { - // TODO implement + if (size % kBlockSize != 0) { + fprintf(stderr, "_WriteBlocks buffer size must be a multiple of %d\n", (int)kBlockSize); + return B_BAD_VALUE; + } + const size_t blocks = size / kBlockSize; + const uint8* block = buffer; + for (size_t i = 0; i < blocks; i ++, block += kBlockSize) { + if (write(fd, block, kBlockSize) != (ssize_t)kBlockSize) + return B_IO_ERROR; + } return B_OK; } + + +void +LegacyBootDrive::_CopyPartitionTable(MasterBootRecord* destination, + const MasterBootRecord* source) +{ + memcpy(destination->partition, source->partition, sizeof(source->partition)); +} + + +bool +LegacyBootDrive::_IsValid(const MasterBootRecord* mbr) +{ + return mbr->signature[0] == (kMBRSignature & 0xff) && + mbr->signature[1] == (kMBRSignature >> 8); +} Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.h =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.h 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.h 2008-04-12 08:25:38 UTC (rev 24935) @@ -10,17 +10,41 @@ #include "BootDrive.h" +#include + +const uint32 kBlockSize = 512; +// The number of blocks required to store the +// MBR including the Haiku boot loader. +const uint32 kNumberOfBootLoaderBlocks = 4; + +const uint32 kMBRSignature = 0xAA55; + +typedef struct { + uint8 bootLoader[440]; + uint8 diskSignature[4]; + uint8 reserved[2]; + uint8 partition[64]; + uint8 signature[2]; +} MasterBootRecord; + class LegacyBootDrive : public BootDrive { public: LegacyBootDrive(); virtual ~LegacyBootDrive(); - virtual bool IsBootMenuInstalled(); - virtual status_t ReadPartitions(BMessage *message); - virtual status_t WriteBootMenu(BMessage *message); - virtual status_t SaveMasterBootRecord(BFile *file); - virtual status_t RestoreMasterBootRecord(BFile *file); + virtual bool IsBootMenuInstalled(BMessage* settings); + virtual status_t ReadPartitions(BMessage* settings); + virtual status_t WriteBootMenu(BMessage* settings); + virtual status_t SaveMasterBootRecord(BMessage* settings, BFile* file); + virtual status_t RestoreMasterBootRecord(BMessage* settings, BFile* file); + +private: + status_t _ReadBlocks(int fd, uint8* buffer, size_t size); + status_t _WriteBlocks(int fd, const uint8* buffer, size_t size); + void _CopyPartitionTable(MasterBootRecord* destination, + const MasterBootRecord* source); + bool _IsValid(const MasterBootRecord* mbr); }; #endif // LEGACY_BOOT_DRIVE_H Modified: haiku/trunk/src/apps/bootman/TestBootDrive.cpp =================================================================== --- haiku/trunk/src/apps/bootman/TestBootDrive.cpp 2008-04-12 08:21:35 UTC (rev 24934) +++ haiku/trunk/src/apps/bootman/TestBootDrive.cpp 2008-04-12 08:25:38 UTC (rev 24935) @@ -9,10 +9,21 @@ #include "TestBootDrive.h" - +#include +#include #include +#include +#include +#include +#include +#include +#include +#include +#include "BootLoader.h" + + TestBootDrive::TestBootDrive() { } @@ -24,16 +35,16 @@ bool -TestBootDrive::IsBootMenuInstalled() +TestBootDrive::IsBootMenuInstalled(BMessage* settings) { return false; } status_t -TestBootDrive::ReadPartitions(BMessage *message) +TestBootDrive::ReadPartitions(BMessage *settings) { - message->AddString("disk", "/dev/disk/ide/ata/0/master/0/raw"); + settings->AddString("disk", "bootcylinder"); BMessage partition; @@ -42,7 +53,7 @@ partition.AddString("type", "bfs"); partition.AddString("path", "/dev/disk/ide/ata/0/master/0/0_0"); partition.AddInt64("size", 3 * (int64)1024 * 1024 * 1024); - message->AddMessage("partition", &partition); + settings->AddMessage("partition", &partition); partition.MakeEmpty(); @@ -51,7 +62,7 @@ partition.AddString("type", "dos"); partition.AddString("path", "/dev/disk/ide/ata/0/slave/0/0_0"); partition.AddInt64("size", 10 * (int64)1024 * 1024 * 1024); - message->AddMessage("partition", &partition); + settings->AddMessage("partition", &partition); partition.MakeEmpty(); partition.AddBool("show", true); @@ -59,21 +70,21 @@ partition.AddString("type", "unknown"); partition.AddString("path", "/dev/disk/ide/ata/0/slave/0/0_1"); partition.AddInt64("size", 250 * (int64)1024 * 1024 * 1024); - message->AddMessage("partition", &partition); + settings->AddMessage("partition", &partition); return B_OK; } status_t -TestBootDrive::WriteBootMenu(BMessage *message) +TestBootDrive::WriteBootMenu(BMessage *settings) { printf("WriteBootMenu:\n"); - message->PrintToStream(); [... truncated: 54 lines follow ...] From bonefish at mail.berlios.de Sat Apr 12 10:30:26 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 10:30:26 +0200 Subject: [Haiku-commits] r24936 - haiku/trunk/headers/posix/sys Message-ID: <200804120830.m3C8UQUa024568@sheep.berlios.de> Author: bonefish Date: 2008-04-12 10:30:25 +0200 (Sat, 12 Apr 2008) New Revision: 24936 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24936&view=rev Modified: haiku/trunk/headers/posix/sys/socket.h Log: * Added include, which is needed for _ALIGN(). * Added SCM_RIGHTS macro. * Added a few non-standard but widely-used CMSG_*() macros. Modified: haiku/trunk/headers/posix/sys/socket.h =================================================================== --- haiku/trunk/headers/posix/sys/socket.h 2008-04-12 08:25:38 UTC (rev 24935) +++ haiku/trunk/headers/posix/sys/socket.h 2008-04-12 08:30:25 UTC (rev 24936) @@ -7,6 +7,7 @@ #include +#include #include #include @@ -136,8 +137,14 @@ ((mhdr)->msg_controllen >= sizeof(struct cmsghdr) \ ? (struct cmsghdr *)(mhdr)->msg_control \ : (struct cmsghdr *)NULL) +#define CMSG_SPACE(len) (_ALIGN(sizeof(struct cmsghdr)) + _ALIGN(len)) +#define CMSG_LEN(len) (_ALIGN(sizeof(struct cmsghdr)) + (len)) +#define CMSG_ALIGN(len) _ALIGN(len) +/* SOL_SOCKET control message types */ +#define SCM_RIGHTS 0x01 + #if __cplusplus extern "C" { #endif From anevilyak at gmail.com Sat Apr 12 17:16:39 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 12 Apr 2008 10:16:39 -0500 Subject: [Haiku-commits] r24918 - haiku/trunk/headers/private/kernel In-Reply-To: <200804112036.m3BKaq5q016680@sheep.berlios.de> References: <200804112036.m3BKaq5q016680@sheep.berlios.de> Message-ID: Hi Ingo, On Fri, Apr 11, 2008 at 3:36 PM, bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-04-11 22:36:50 +0200 (Fri, 11 Apr 2008) > New Revision: 24918 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24918&view=rev > > Modified: > haiku/trunk/headers/private/kernel/syscall_restart.h > Log: > Yep, first clear THREAD_FLAGS_SYSCALL, then check whether it is set. > That would explain why syscall restarts were broken. In fact there's no > reason to check the flag at all, since we know we set it. > > ftp appears to work again. > One of these socket-related changes seems to have broken Firefox...it segfaults on startup in the newer builds now. I can't yet try to binary search to find out the exact revision though since berlios appears to currently be down. Regards, Rene From bonefish at mail.berlios.de Sat Apr 12 10:32:31 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 10:32:31 +0200 Subject: [Haiku-commits] r24937 - in haiku/trunk: headers/private/kernel/fs src/system/kernel/fs Message-ID: <200804120832.m3C8WV5n024966@sheep.berlios.de> Author: bonefish Date: 2008-04-12 10:32:29 +0200 (Sat, 12 Apr 2008) New Revision: 24937 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24937&view=rev Modified: haiku/trunk/headers/private/kernel/fs/fd.h haiku/trunk/src/system/kernel/fs/fd.cpp Log: Added close_fd_index() which is pretty much like close(), but gets the IO context in which to close the FD. Modified: haiku/trunk/headers/private/kernel/fs/fd.h =================================================================== --- haiku/trunk/headers/private/kernel/fs/fd.h 2008-04-12 08:30:25 UTC (rev 24936) +++ haiku/trunk/headers/private/kernel/fs/fd.h 2008-04-12 08:32:29 UTC (rev 24937) @@ -80,6 +80,7 @@ extern int new_fd(struct io_context *, struct file_descriptor *); extern struct file_descriptor *get_fd(struct io_context *, int); extern void close_fd(struct file_descriptor *descriptor); +extern status_t close_fd_index(struct io_context *context, int fd); extern void put_fd(struct file_descriptor *descriptor); extern void disconnect_fd(struct file_descriptor *descriptor); extern void inc_fd_ref_count(struct file_descriptor *descriptor); Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 08:30:25 UTC (rev 24936) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 08:32:29 UTC (rev 24937) @@ -31,6 +31,7 @@ static struct file_descriptor* get_fd_locked(struct io_context* context, int fd); +static struct file_descriptor *remove_fd(struct io_context *context, int fd); static void deselect_select_infos(file_descriptor* descriptor, select_info* infos); @@ -236,6 +237,22 @@ } +status_t +close_fd_index(struct io_context *context, int fd) +{ + struct file_descriptor *descriptor = remove_fd(context, fd); + + if (descriptor == NULL) + return B_FILE_ERROR; + + close_fd(descriptor); + put_fd(descriptor); + // the reference associated with the slot + + return B_OK; +} + + /** This descriptor's underlying object will be closed and freed * as soon as possible (in one of the next calls to put_fd() - * get_fd() will no longer succeed on this descriptor). @@ -602,22 +619,7 @@ static status_t common_close(int fd, bool kernel) { - struct io_context *io = get_current_io_context(kernel); - struct file_descriptor *descriptor = remove_fd(io, fd); - - if (descriptor == NULL) - return B_FILE_ERROR; - -#ifdef TRACE_FD - if (!kernel) - TRACE(("_user_close(descriptor = %p)\n", descriptor)); -#endif - - close_fd(descriptor); - put_fd(descriptor); - // the reference associated with the slot - - return B_OK; + return close_fd_index(get_current_io_context(kernel), fd); } From korli at mail.berlios.de Sat Apr 12 10:37:04 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Apr 2008 10:37:04 +0200 Subject: [Haiku-commits] r24938 - haiku/trunk/src/preferences/keymap Message-ID: <200804120837.m3C8b4xp025840@sheep.berlios.de> Author: korli Date: 2008-04-12 10:37:03 +0200 (Sat, 12 Apr 2008) New Revision: 24938 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24938&view=rev Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp Log: fixed bug #2067 Modified: haiku/trunk/src/preferences/keymap/KeymapWindow.cpp =================================================================== --- haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2008-04-12 08:32:29 UTC (rev 24937) +++ haiku/trunk/src/preferences/keymap/KeymapWindow.cpp 2008-04-12 08:37:03 UTC (rev 24938) @@ -222,7 +222,7 @@ FillUserMaps(); // try and find the current map name in the two list views (if the name was read at all) - if (SelectCurrentMap(fSystemListView)) + if (!SelectCurrentMap(fSystemListView)) if (!SelectCurrentMap(fUserListView)) fUserListView->Select(0L); } From bonefish at mail.berlios.de Sat Apr 12 10:50:18 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 10:50:18 +0200 Subject: [Haiku-commits] r24939 - haiku/trunk/src/system/kernel/fs Message-ID: <200804120850.m3C8oIDG027513@sheep.berlios.de> Author: bonefish Date: 2008-04-12 10:50:17 +0200 (Sat, 12 Apr 2008) New Revision: 24939 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24939&view=rev Modified: haiku/trunk/src/system/kernel/fs/socket.cpp Log: * _user_{send,recf}msg() no longer copy iovecs on the stack. They use the heap and the IOV_MAX limit. * They also take the responsibility of copying the ancillary data in and out. * These syscalls were badly broken. They used a member of an uninitialized structure instead of the iovec pointer passed from userland. sendmsg() would thus fail or send arbitrary data, recvmsg() would overwrite arbitrary memory. Modified: haiku/trunk/src/system/kernel/fs/socket.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 08:37:03 UTC (rev 24938) +++ haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 08:50:17 UTC (rev 24939) @@ -6,6 +6,7 @@ #include #include +#include #include @@ -24,7 +25,7 @@ #define MAX_SOCKET_ADDRESS_LEN (sizeof(sockaddr_storage)) #define MAX_SOCKET_OPTION_LEN 128 -#define MAX_IO_VEC_COUNT 128 +#define MAX_ANCILLARY_DATA_LEN 1024 static net_stack_interface_module_info* sStackInterface = NULL; @@ -112,7 +113,8 @@ static status_t prepare_userland_msghdr(const msghdr* userMessage, msghdr& message, - iovec*& userVecs, iovec* vecs, void*& userAddress, char* address) + iovec*& userVecs, MemoryDeleter& vecsDeleter, void*& userAddress, + char* address) { if (userMessage == NULL) return B_BAD_VALUE; @@ -123,10 +125,18 @@ return B_BAD_ADDRESS; } + userVecs = message.msg_iov; + userAddress = message.msg_name; + // copy iovecs from userland + if (message.msg_iovlen < 0 || message.msg_iovlen > IOV_MAX) + return EMSGSIZE; if (userVecs != NULL && message.msg_iovlen > 0) { - if (message.msg_iovlen > MAX_IO_VEC_COUNT || message.msg_iov == NULL) - return B_BAD_VALUE; + iovec* vecs = (iovec*)malloc(sizeof(iovec) * message.msg_iovlen); + if (vecs == NULL) + return B_NO_MEMORY; + vecsDeleter.SetTo(vecs); + if (!IS_USER_ADDRESS(message.msg_iov) || user_memcpy(vecs, message.msg_iov, message.msg_iovlen * sizeof(iovec)) != B_OK) { @@ -886,16 +896,35 @@ { // copy message from userland msghdr message; - iovec* userVecs = message.msg_iov; - iovec vecs[MAX_IO_VEC_COUNT]; - void* userAddress = message.msg_name; + iovec* userVecs; + MemoryDeleter vecsDeleter; + void* userAddress; char address[MAX_SOCKET_ADDRESS_LEN]; status_t error = prepare_userland_msghdr(userMessage, message, userVecs, - vecs, userAddress, address); + vecsDeleter, userAddress, address); if (error != B_OK) return error; + // prepare a buffer for ancillary data + MemoryDeleter ancillaryDeleter; + void* ancillary = NULL; + void* userAncillary = message.msg_control; + if (userAncillary != NULL) { + if (!IS_USER_ADDRESS(userAncillary)) + return B_BAD_ADDRESS; + if (message.msg_controllen < 0) + return B_BAD_VALUE; + if (message.msg_controllen > MAX_ANCILLARY_DATA_LEN) + message.msg_controllen > MAX_ANCILLARY_DATA_LEN; + + message.msg_control = ancillary = malloc(message.msg_controllen); + if (message.msg_control == NULL) + return B_NO_MEMORY; + + ancillaryDeleter.SetTo(ancillary); + } + // recvmsg() SyscallRestartWrapper result; @@ -903,11 +932,16 @@ if (result < (ssize_t)0) return result; - // copy the address and address length back to userland + // copy the address, the ancillary data, and the message header back to + // userland + message.msg_name = userAddress; + message.msg_iov = userVecs; + message.msg_control = userAncillary; if (userAddress != NULL && user_memcpy(userAddress, address, - message.msg_namelen) != B_OK - || user_memcpy(&userMessage->msg_namelen, &message.msg_namelen, - sizeof(message.msg_namelen)) != B_OK) { + 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; } @@ -954,13 +988,13 @@ { // copy message from userland msghdr message; - iovec* userVecs = message.msg_iov; - iovec vecs[MAX_IO_VEC_COUNT]; - void* userAddress = message.msg_name; + iovec* userVecs; + MemoryDeleter vecsDeleter; + void* userAddress; char address[MAX_SOCKET_ADDRESS_LEN]; status_t error = prepare_userland_msghdr(userMessage, message, userVecs, - vecs, userAddress, address); + vecsDeleter, userAddress, address); if (error != B_OK) return error; @@ -970,6 +1004,28 @@ return B_BAD_ADDRESS; } + // copy ancillary data from userland + MemoryDeleter ancillaryDeleter; + void* userAncillary = message.msg_control; + if (userAncillary != NULL) { + if (!IS_USER_ADDRESS(userAncillary)) + return B_BAD_ADDRESS; + if (message.msg_controllen < 0 + || message.msg_controllen > MAX_ANCILLARY_DATA_LEN) { + return B_BAD_VALUE; + } + + message.msg_control = malloc(message.msg_controllen); + if (message.msg_control == NULL) + return B_NO_MEMORY; + ancillaryDeleter.SetTo(message.msg_control); + + if (user_memcpy(message.msg_control, userAncillary, + message.msg_controllen) != B_OK) { + return B_BAD_ADDRESS; + } + } + // sendmsg() SyscallRestartWrapper result; From bonefish at mail.berlios.de Sat Apr 12 11:19:44 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 11:19:44 +0200 Subject: [Haiku-commits] r24940 - in haiku/trunk: headers/private/net src/add-ons/kernel/network/stack Message-ID: <200804120919.m3C9JiAn030216@sheep.berlios.de> Author: bonefish Date: 2008-04-12 11:19:44 +0200 (Sat, 12 Apr 2008) New Revision: 24940 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24940&view=rev Modified: haiku/trunk/headers/private/net/net_buffer.h haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp Log: Added support for attaching ancillary data to a net_buffer. It's a naive implementation ATM, since it malloc()s the required memory. Modified: haiku/trunk/headers/private/net/net_buffer.h =================================================================== --- haiku/trunk/headers/private/net/net_buffer.h 2008-04-12 08:50:17 UTC (rev 24939) +++ haiku/trunk/headers/private/net/net_buffer.h 2008-04-12 09:19:44 UTC (rev 24940) @@ -37,6 +37,12 @@ uint8 protocol; } net_buffer; +typedef struct ancillary_data_header { + int level; + int type; + size_t len; +} ancillary_data_header; + struct net_buffer_module_info { module_info info; @@ -68,6 +74,17 @@ status_t (*associate_data)(net_buffer *buffer, void *data); + status_t (*attach_ancillary_data)(net_buffer *buffer, + const ancillary_data_header *header, const void *data, + void (*destructor)(const ancillary_data_header*, void*), + void **_allocatedData); + status_t (*detach_ancillary_data)(net_buffer *buffer, void *data, + bool destroy); + void * (*transfer_ancillary_data)(net_buffer *from, + net_buffer *to); + void * (*next_ancillary_data)(net_buffer *buffer, + void *previousData, ancillary_data_header *_header); + status_t (*direct_access)(net_buffer *buffer, uint32 offset, size_t bytes, void **_data); status_t (*read)(net_buffer *buffer, uint32 offset, void *data, Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp 2008-04-12 08:50:17 UTC (rev 24939) +++ haiku/trunk/src/add-ons/kernel/network/stack/net_buffer.cpp 2008-04-12 09:19:44 UTC (rev 24940) @@ -16,6 +16,7 @@ #include #include #include +#include #include #include @@ -58,11 +59,31 @@ data_node *first_node; }; +#define MAX_ANCILLARY_DATA_SIZE 128 + +struct ancillary_data : DoublyLinkedListLinkImpl { + void* Data() + { + return (char*)this + _ALIGN(sizeof(ancillary_data)); + } + + static ancillary_data* FromData(void* data) + { + return (ancillary_data*)((char*)data - _ALIGN(sizeof(ancillary_data))); + } + + ancillary_data_header header; + void (*destructor)(const ancillary_data_header*, void*); +}; + +typedef DoublyLinkedList ancillary_data_list; + #define MAX_FREE_BUFFER_SIZE (BUFFER_SIZE - sizeof(data_header)) struct net_buffer_private : net_buffer { - struct list buffers; - data_node first_node; + struct list buffers; + data_node first_node; + ancillary_data_list ancillary_data; struct { struct sockaddr_storage source; @@ -353,6 +374,8 @@ list_init(&buffer->buffers); list_add_item(&buffer->buffers, &buffer->first_node); + new(&buffer->ancillary_data) ancillary_data_list; + buffer->source = (sockaddr *)&buffer->storage.source; buffer->destination = (sockaddr *)&buffer->storage.destination; @@ -382,6 +405,12 @@ remove_data_node(node); } + while (ancillary_data* data = buffer->ancillary_data.RemoveHead()) { + if (data->destructor != NULL) + data->destructor(&data->header, data->Data()); + free(data); + } + free_net_buffer(buffer); } @@ -1068,6 +1097,160 @@ /*! + Attaches ancillary data to the given buffer. The data are completely + orthogonal to the data the buffer stores. + + \param buffer The buffer. + \param header Description of the data. + \param data If not \c NULL, the data are copied into the allocated storage. + \param destructor If not \c NULL, this function will be invoked with the + data as parameter when the buffer is destroyed. + \param _allocatedData Will be set to the storage allocated for the data. + \return \c B_OK when everything goes well, another error code otherwise. +*/ +static status_t +attach_ancillary_data(net_buffer *_buffer, const ancillary_data_header *header, + const void *data, void (*destructor)(const ancillary_data_header*, void*), + void **_allocatedData) +{ + // TODO: Obviously it would be nice to allocate the memory for the + // ancillary data in the buffer. + net_buffer_private *buffer = (net_buffer_private *)_buffer; + + // check parameters + if (header == NULL) + return B_BAD_VALUE; + + if (header->len > MAX_ANCILLARY_DATA_SIZE) + return ENOBUFS; + + // allocate buffer + void *dataBuffer = malloc(_ALIGN(sizeof(ancillary_data)) + header->len); + if (dataBuffer == NULL) + return B_NO_MEMORY; + + // init and attach the structure + ancillary_data *ancillaryData = new(dataBuffer) ancillary_data; + ancillaryData->header = *header; + ancillaryData->destructor = destructor; + + buffer->ancillary_data.Add(ancillaryData); + + if (data != NULL) + memcpy(ancillaryData->Data(), data, header->len); + + if (_allocatedData != NULL) + *_allocatedData = ancillaryData->Data(); + + return B_OK; +} + + +/*! + Detaches ancillary data from the given buffer. The associated memory is + free, i.e. the \a data pointer must no longer be used after calling this + function. Depending on \a destroy, the destructor is invoked before freeing + the data. + + \param buffer The buffer. + \param data Pointer to the data to be removed (as returned by + attach_ancillary_data() or next_ancillary_data()). + \param destroy If \c true, the destructor, if one was passed to + attach_ancillary_data(), is invoked for the data. + \return \c B_OK when everything goes well, another error code otherwise. +*/ +static status_t +detach_ancillary_data(net_buffer *_buffer, void *data, bool destroy) +{ + net_buffer_private *buffer = (net_buffer_private *)_buffer; + + if (data == NULL) + return B_BAD_VALUE; + + ancillary_data *ancillaryData = ancillary_data::FromData(data); + + buffer->ancillary_data.Remove(ancillaryData); + + if (destroy && ancillaryData->destructor != NULL) { + ancillaryData->destructor(&ancillaryData->header, + ancillaryData->Data()); + } + + free(ancillaryData); + + return B_OK; +} + + +/*! + Moves all ancillary data from buffer \c from to the end of the list of + ancillary data of buffer \c to. Note, that this is the only function that + transfers or copies ancillary data from one buffer to another. + + \param from The buffer from which to remove the ancillary data. + \param to The buffer to which to add teh ancillary data. + \return A pointer to the first of the moved ancillary data, if any, \c NULL + otherwise. +*/ +static void * +transfer_ancillary_data(net_buffer *_from, net_buffer *_to) +{ + net_buffer_private *from = (net_buffer_private *)_from; + net_buffer_private *to = (net_buffer_private *)_to; + + if (from == NULL || to == NULL) + return NULL; + + ancillary_data *ancillaryData = from->ancillary_data.Head(); + to->ancillary_data.MoveFrom(&from->ancillary_data); + + return ancillaryData != NULL ? ancillaryData->Data() : NULL; +} + + +/*! + Returns the next ancillary data. When iterating over the data, initially + a \c NULL pointer shall be passed as \a previousData, subsequently the + previously returned data pointer. After the last item, \c NULL is returned. + + Note, that it is not safe to call detach_ancillary_data() for a data item + and then pass that pointer to this function. First get the next item, then + detach the previous one. + + \param buffer The buffer. + \param previousData The pointer to the previous data returned by this + function. Initially \c NULL shall be passed. + \param header Pointer to allocated storage into which the data description + is written. May be \c NULL. + \return A pointer to the next ancillary data in the buffer. \c NULL after + the last one. +*/ +static void* +next_ancillary_data(net_buffer *_buffer, void *previousData, + ancillary_data_header *_header) +{ + net_buffer_private *buffer = (net_buffer_private *)_buffer; + + ancillary_data *ancillaryData; + + if (previousData == NULL) { + ancillaryData = buffer->ancillary_data.Head(); + } else { + ancillaryData = ancillary_data::FromData(previousData); + ancillaryData = buffer->ancillary_data.GetNext(ancillaryData); + } + + if (ancillaryData == NULL) + return NULL; + + if (_header != NULL) + *_header = ancillaryData->header; + + return ancillaryData->Data(); +} + + +/*! Tries to directly access the requested space in the buffer. If the space is contiguous, the function will succeed and place a pointer to that space into \a _contiguousBuffer. @@ -1257,6 +1440,11 @@ NULL, // associate_data + attach_ancillary_data, + detach_ancillary_data, + transfer_ancillary_data, + next_ancillary_data, + direct_access, read_data, write_data, From bonefish at mail.berlios.de Sat Apr 12 11:28:07 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 11:28:07 +0200 Subject: [Haiku-commits] r24941 - in haiku/trunk: headers/private/net src/add-ons/kernel/network/stack Message-ID: <200804120928.m3C9S75h031129@sheep.berlios.de> Author: bonefish Date: 2008-04-12 11:28:05 +0200 (Sat, 12 Apr 2008) New Revision: 24941 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24941&view=rev Modified: haiku/trunk/headers/private/net/net_protocol.h haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp Log: Added support for sending/receiving ancillary data. The protocol modules have two more optional hooks for attaching supplied ancillary data to a net_buffer and for processing received ancillary data. Not sure, if that is flexible enough for all kinds of ancillary data, but it is for SCM_RIGHTS and also should for SCM_CRED[ENTIAL]S (if we ever decide to implement one of those) -- don't know any other types on other protocol levels. Modified: haiku/trunk/headers/private/net/net_protocol.h =================================================================== --- haiku/trunk/headers/private/net/net_protocol.h 2008-04-12 09:19:44 UTC (rev 24940) +++ haiku/trunk/headers/private/net/net_protocol.h 2008-04-12 09:28:05 UTC (rev 24941) @@ -68,6 +68,12 @@ status_t (*error)(uint32 code, net_buffer *data); status_t (*error_reply)(net_protocol *self, net_buffer *causedError, uint32 code, void *errorData); + + status_t (*attach_ancillary_data)(net_protocol *self, net_buffer *buffer, + const cmsghdr *header); + ssize_t (*process_ancillary_data)(net_protocol *self, + const ancillary_data_header *header, const void *data, + void *buffer, size_t bufferSize); }; #endif // NET_PROTOCOL_H Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-04-12 09:19:44 UTC (rev 24940) +++ haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-04-12 09:28:05 UTC (rev 24941) @@ -133,6 +133,62 @@ } +static status_t +attach_ancillary_data(net_socket *socket, net_buffer *buffer, void *data, + size_t dataLen) +{ + cmsghdr *header = (cmsghdr*)data; + + while (dataLen > 0) { + if (header->cmsg_len < sizeof(cmsghdr) || header->cmsg_len > dataLen) + return B_BAD_VALUE; + + if (socket->first_info->attach_ancillary_data == NULL) + return EOPNOTSUPP; + + status_t status = socket->first_info->attach_ancillary_data( + socket->first_protocol, buffer, header); + if (status != B_OK) + return status; + + dataLen -= _ALIGN(header->cmsg_len); + header = (cmsghdr*)((uint8*)header + _ALIGN(header->cmsg_len)); + } + + return B_OK; +} + + +static status_t +process_ancillary_data(net_socket *socket, net_buffer *buffer, msghdr *_header) +{ + uint8 *dataBuffer = (uint8*)_header->msg_control; + int dataBufferLen = _header->msg_controllen; + + ancillary_data_header header; + void *data = NULL; + + while ((data = gNetBufferModule.next_ancillary_data(buffer, data, &header)) + != NULL) { + + if (socket->first_info->process_ancillary_data == NULL) + return EOPNOTSUPP; + + ssize_t bytesWritten = socket->first_info->process_ancillary_data( + socket->first_protocol, &header, data, dataBuffer, dataBufferLen); + if (bytesWritten < 0) + return bytesWritten; + + dataBuffer += bytesWritten; + dataBufferLen -= bytesWritten; + } + + _header->msg_controllen -= dataBufferLen; + + return B_OK; +} + + // #pragma mark - @@ -891,6 +947,18 @@ if (status < B_OK) return status; + // process ancillary data + if (header != NULL) { + if (buffer != NULL && header->msg_control != NULL) { + status = process_ancillary_data(socket, buffer, header); + if (status != B_OK) { + gNetBufferModule.free(buffer); + return status; + } + } else + header->msg_controllen = 0; + } + // TODO: - returning a NULL buffer when received 0 bytes // may not make much sense as we still need the address // - gNetBufferModule.read() uses memcpy() instead of user_memcpy @@ -969,9 +1037,14 @@ // present, { data, length } would have been iovec[0] and is // always considered like that + cmsghdr *ancillaryData = NULL; + size_t ancillaryDataLen = 0; + if (header != NULL) { address = (const sockaddr *)header->msg_name; addressLength = header->msg_namelen; + ancillaryData = (cmsghdr *)header->msg_control; + ancillaryDataLen = header->msg_controllen; if (header->msg_iovlen <= 1) header = NULL; @@ -1060,13 +1133,23 @@ } } + // attach ancillary data to the first buffer + status_t status = B_OK; + if (ancillaryData != NULL) { + status = attach_ancillary_data(socket, buffer, ancillaryData, + ancillaryDataLen); + ancillaryData = NULL; + } + size_t bufferSize = buffer->size; buffer->flags = flags; memcpy(buffer->source, &socket->address, socket->address.ss_len); memcpy(buffer->destination, address, addressLength); - status_t status = socket->first_info->send_data(socket->first_protocol, - buffer); + if (status == B_OK) { + status = socket->first_info->send_data(socket->first_protocol, + buffer); + } if (status < B_OK) { size_t sizeAfterSend = buffer->size; gNetBufferModule.free(buffer); From korli at mail.berlios.de Sat Apr 12 11:30:48 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Apr 2008 11:30:48 +0200 Subject: [Haiku-commits] r24942 - haiku/trunk/src/bin/bzip2 Message-ID: <200804120930.m3C9Um4k031336@sheep.berlios.de> Author: korli Date: 2008-04-12 11:30:47 +0200 (Sat, 12 Apr 2008) New Revision: 24942 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24942&view=rev Modified: haiku/trunk/src/bin/bzip2/LICENSE haiku/trunk/src/bin/bzip2/blocksort.c haiku/trunk/src/bin/bzip2/bzip2.c haiku/trunk/src/bin/bzip2/bzip2.rdef haiku/trunk/src/bin/bzip2/bzip2recover.c haiku/trunk/src/bin/bzip2/bzlib.c haiku/trunk/src/bin/bzip2/bzlib.h haiku/trunk/src/bin/bzip2/bzlib_private.h haiku/trunk/src/bin/bzip2/compress.c haiku/trunk/src/bin/bzip2/crctable.c haiku/trunk/src/bin/bzip2/decompress.c haiku/trunk/src/bin/bzip2/huffman.c haiku/trunk/src/bin/bzip2/randtable.c Log: updated bzip2 to 1.0.5 Modified: haiku/trunk/src/bin/bzip2/LICENSE =================================================================== --- haiku/trunk/src/bin/bzip2/LICENSE 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/LICENSE 2008-04-12 09:30:47 UTC (rev 24942) @@ -2,7 +2,7 @@ -------------------------------------------------------------------------- This program, "bzip2", the associated library "libbzip2", and all -documentation, are copyright (C) 1996-2006 Julian R Seward. All +documentation, are copyright (C) 1996-2007 Julian R Seward. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -36,8 +36,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Julian Seward, Cambridge, UK. -jseward at bzip.org -bzip2/libbzip2 version 1.0.4 of 20 December 2006 +Julian Seward, jseward at bzip.org +bzip2/libbzip2 version 1.0.5 of 10 December 2007 -------------------------------------------------------------------------- Modified: haiku/trunk/src/bin/bzip2/blocksort.c =================================================================== --- haiku/trunk/src/bin/bzip2/blocksort.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/blocksort.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: haiku/trunk/src/bin/bzip2/bzip2.c =================================================================== --- haiku/trunk/src/bin/bzip2/bzip2.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/bzip2.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -7,8 +7,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -1605,11 +1605,11 @@ "bzip2, a block-sorting file compressor. " "Version %s.\n" " \n" - " Copyright (C) 1996-2006 by Julian Seward.\n" + " Copyright (C) 1996-2007 by Julian Seward.\n" " \n" " This program is free software; you can redistribute it and/or modify\n" " it under the terms set out in the LICENSE file, which is included\n" - " in the bzip2-1.0.4 source distribution.\n" + " in the bzip2-1.0.5 source distribution.\n" " \n" " This program is distributed in the hope that it will be useful,\n" " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" Modified: haiku/trunk/src/bin/bzip2/bzip2.rdef =================================================================== --- haiku/trunk/src/bin/bzip2/bzip2.rdef 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/bzip2.rdef 2008-04-12 09:30:47 UTC (rev 24942) @@ -2,10 +2,10 @@ { major = 1, middle = 0, - minor = 3, + minor = 5, variety = 5, internal = 0, - short_info = "1.03", - long_info = "1.03 ?2005 Julian R Seward" + short_info = "1.0.5", + long_info = "1.0.5 ?2007 Julian R Seward" }; Modified: haiku/trunk/src/bin/bzip2/bzip2recover.c =================================================================== --- haiku/trunk/src/bin/bzip2/bzip2recover.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/bzip2recover.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -7,8 +7,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -313,7 +313,7 @@ inFileName[0] = outFileName[0] = 0; fprintf ( stderr, - "bzip2recover 1.0.4: extracts blocks from damaged .bz2 files.\n" ); + "bzip2recover 1.0.5: extracts blocks from damaged .bz2 files.\n" ); if (argc != 2) { fprintf ( stderr, "%s: usage is `%s damaged_file_name'.\n", Modified: haiku/trunk/src/bin/bzip2/bzlib.c =================================================================== --- haiku/trunk/src/bin/bzip2/bzlib.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/bzlib.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -48,7 +48,7 @@ "component, you should also report this bug to the author(s)\n" "of that program. Please make an effort to report this bug;\n" "timely and accurate bug reports eventually lead to higher\n" - "quality software. Thanks. Julian Seward, 15 February 2005.\n\n", + "quality software. Thanks. Julian Seward, 10 December 2007.\n\n", errcode, BZ2_bzlibVersion() ); @@ -598,6 +598,7 @@ UInt32 c_tPos = s->tPos; char* cs_next_out = s->strm->next_out; unsigned int cs_avail_out = s->strm->avail_out; + Int32 ro_blockSize100k = s->blockSize100k; /* end restore */ UInt32 avail_out_INIT = cs_avail_out; Modified: haiku/trunk/src/bin/bzip2/bzlib.h =================================================================== --- haiku/trunk/src/bin/bzip2/bzlib.h 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/bzlib.h 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: haiku/trunk/src/bin/bzip2/bzlib_private.h =================================================================== --- haiku/trunk/src/bin/bzip2/bzlib_private.h 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/bzlib_private.h 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. @@ -36,7 +36,7 @@ /*-- General stuff. --*/ -#define BZ_VERSION "1.0.4, 20-Dec-2006" +#define BZ_VERSION "1.0.5, 10-Dec-2007" typedef char Char; typedef unsigned char Bool; @@ -442,11 +442,15 @@ /*-- Macros for decompression. --*/ #define BZ_GET_FAST(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ s->tPos = s->tt[s->tPos]; \ cccc = (UChar)(s->tPos & 0xff); \ s->tPos >>= 8; #define BZ_GET_FAST_C(cccc) \ + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (c_tPos >= (UInt32)100000 * (UInt32)ro_blockSize100k) return True; \ c_tPos = c_tt[c_tPos]; \ cccc = (UChar)(c_tPos & 0xff); \ c_tPos >>= 8; @@ -469,8 +473,10 @@ (((UInt32)s->ll16[i]) | (GET_LL4(i) << 16)) #define BZ_GET_SMALL(cccc) \ - cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ - s->tPos = GET_LL(s->tPos); + /* c_tPos is unsigned, hence test < 0 is pointless. */ \ + if (s->tPos >= (UInt32)100000 * (UInt32)s->blockSize100k) return True; \ + cccc = BZ2_indexIntoF ( s->tPos, s->cftab ); \ + s->tPos = GET_LL(s->tPos); /*-- externs for decompression. --*/ Modified: haiku/trunk/src/bin/bzip2/compress.c =================================================================== --- haiku/trunk/src/bin/bzip2/compress.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/compress.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: haiku/trunk/src/bin/bzip2/crctable.c =================================================================== --- haiku/trunk/src/bin/bzip2/crctable.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/crctable.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: haiku/trunk/src/bin/bzip2/decompress.c =================================================================== --- haiku/trunk/src/bin/bzip2/decompress.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/decompress.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: haiku/trunk/src/bin/bzip2/huffman.c =================================================================== --- haiku/trunk/src/bin/bzip2/huffman.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/huffman.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. Modified: haiku/trunk/src/bin/bzip2/randtable.c =================================================================== --- haiku/trunk/src/bin/bzip2/randtable.c 2008-04-12 09:28:05 UTC (rev 24941) +++ haiku/trunk/src/bin/bzip2/randtable.c 2008-04-12 09:30:47 UTC (rev 24942) @@ -8,8 +8,8 @@ This file is part of bzip2/libbzip2, a program and library for lossless, block-sorting data compression. - bzip2/libbzip2 version 1.0.4 of 20 December 2006 - Copyright (C) 1996-2006 Julian Seward + bzip2/libbzip2 version 1.0.5 of 10 December 2007 + Copyright (C) 1996-2007 Julian Seward Please read the WARNING, DISCLAIMER and PATENTS sections in the README file. From bonefish at mail.berlios.de Sat Apr 12 11:37:14 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 11:37:14 +0200 Subject: [Haiku-commits] r24943 - haiku/trunk/src/add-ons/kernel/network/protocols/unix Message-ID: <200804120937.m3C9bEOq032211@sheep.berlios.de> Author: bonefish Date: 2008-04-12 11:37:13 +0200 (Sat, 12 Apr 2008) New Revision: 24943 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24943&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.h haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp haiku/trunk/src/add-ons/kernel/network/protocols/unix/unix.cpp Log: * Added support for SCM_RIGHTS (sending file descriptors). * Fixed shutdown(). It was computing the wrong fifo flags and set the wrong ones from the wrong variable on the peer fifo. * Generally made the Unix sockets behave more like they should. E.g. after closing one end, it must still be possible to read from the other (as long as there are buffered data). Also fine-tuned when to return what errors from recv()/send(). Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2008-04-12 09:30:47 UTC (rev 24942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.cpp 2008-04-12 09:37:13 UTC (rev 24943) @@ -144,6 +144,10 @@ { TRACE("[%ld] %p->UnixEndpoint::Free()\n", find_thread(NULL), this); + UnixEndpointLocker locker(this); + + _UnsetReceiveFifo(); + RETURN_ERROR(B_OK); } @@ -248,6 +252,8 @@ if (fAcceptSemaphore < 0) RETURN_ERROR(ENOBUFS); + _UnsetReceiveFifo(); + fState = UNIX_ENDPOINT_LISTENING; RETURN_ERROR(B_OK); @@ -348,6 +354,9 @@ connectedEndpoint->_Spawn(this, peerFifo); + // update our attributes + _UnsetReceiveFifo(); + fPeerEndpoint = connectedEndpoint; PeerAddress().SetTo(&connectedEndpoint->socket->address); fPeerEndpoint->AddReference(); @@ -459,23 +468,30 @@ if (notifyWrite) gSocketModule->notify(socket, B_SELECT_WRITE, writable); - if (error == UNIX_FIFO_SHUTDOWN) { - // This might either mean, that someone called shutdown() or close(), - // or our peer closed the connection. - if (fPeerEndpoint == peerEndpoint) { - // Orderly shutdown. - error = EPIPE; - } else if (fState == UNIX_ENDPOINT_CLOSED) { - // The FD has been closed. - error = EBADF; - } else { - // Peer closed the connection. - error = EPIPE; - send_signal(find_thread(NULL), SIGPIPE); - } - } else if (error == B_TIMED_OUT && timeout == 0) { - // translate non-blocking timeouts to the correct error code - error = B_WOULD_BLOCK; + switch (error) { + case UNIX_FIFO_SHUTDOWN: + if (fPeerEndpoint == peerEndpoint + && fState == UNIX_ENDPOINT_CONNECTED) { + // Orderly write shutdown on our side. + // Note: Linux and Solaris also send a SIGPIPE, but according + // the send() specification that shouldn't be done. + error = EPIPE; + } else { + // The FD has been closed. + error = EBADF; + } + break; + case EPIPE: + // The peer closed connection or shutdown its read side. Reward + // the caller with a SIGPIPE. + if (gStackModule->is_syscall()) + send_signal(find_thread(NULL), SIGPIPE); + break; + case B_TIMED_OUT: + // Translate non-blocking timeouts to the correct error code. + if (timeout == 0) + error = B_WOULD_BLOCK; + break; } RETURN_ERROR(error); @@ -496,12 +512,11 @@ UnixEndpointLocker locker(this); - if (fState != UNIX_ENDPOINT_CONNECTED) + // We can read as long as we have a FIFO. I.e. we are still connected, or + // disconnected and not yet reconnected/listening/closed. + if (fReceiveFifo == NULL) RETURN_ERROR(ENOTCONN); - UnixEndpoint* peerEndpoint = fPeerEndpoint; - Reference peerReference(peerEndpoint); - // lock our FIFO UnixFifo* fifo = fReceiveFifo; Reference _(fifo); @@ -533,23 +548,28 @@ if (notifyWrite) gSocketModule->notify(socket, B_SELECT_WRITE, writable); - if (error == UNIX_FIFO_SHUTDOWN) { - // This might either mean, that someone called shutdown() or close(), - // or our peer closed the connection. - if (fPeerEndpoint == peerEndpoint) { - // Orderly shutdown. Return B_OK, but a size of 0. - error = B_OK; - *_buffer = NULL; - } else if (fState == UNIX_ENDPOINT_CLOSED) { - // The FD has been closed. - error = EBADF; - } else { - // The connection has been closed by our peer. - error = ECONNRESET; - } - } else if (error == B_TIMED_OUT && timeout == 0) { - // translate non-blocking timeouts to the correct error code - error = B_WOULD_BLOCK; + switch (error) { + case UNIX_FIFO_SHUTDOWN: + // Either our socket was closed or read shutdown. + if (fState == UNIX_ENDPOINT_CLOSED) { + // The FD has been closed. + error = EBADF; + } else { + // if (fReceiveFifo == fifo) { + // Orderly shutdown or the peer closed the connection. + // } else { + // Weird case: Peer closed connection and we are already + // reconnected (or listening). + // } + error = B_OK; + *_buffer = NULL; + } + break; + case B_TIMED_OUT: + // translate non-blocking timeouts to the correct error code + if (timeout == 0) + error = B_WOULD_BLOCK; + break; } RETURN_ERROR(error); @@ -616,19 +636,19 @@ uint32 shutdown; uint32 peerShutdown; - // translate the direction into shutdown flags + // translate the direction into shutdown flags for our and the peer fifo switch (direction) { case SHUT_RD: shutdown = UNIX_FIFO_SHUTDOWN_READ; - peerShutdown = UNIX_FIFO_SHUTDOWN_WRITE; + peerShutdown = 0; break; case SHUT_WR: - shutdown = UNIX_FIFO_SHUTDOWN_WRITE; - peerShutdown = UNIX_FIFO_SHUTDOWN_READ; + shutdown = 0; + peerShutdown = UNIX_FIFO_SHUTDOWN_WRITE; break; case SHUT_RDWR: - shutdown = peerShutdown = UNIX_FIFO_SHUTDOWN_READ - | UNIX_FIFO_SHUTDOWN_WRITE; + shutdown = UNIX_FIFO_SHUTDOWN_READ; + peerShutdown = UNIX_FIFO_SHUTDOWN_WRITE; break; default: RETURN_ERROR(B_BAD_VALUE); @@ -649,7 +669,7 @@ // shutdown peer FIFO fPeerEndpoint->fReceiveFifo->Lock(); - fPeerEndpoint->fReceiveFifo->Shutdown(shutdown); + fPeerEndpoint->fReceiveFifo->Shutdown(peerShutdown); fPeerEndpoint->fReceiveFifo->Unlock(); RETURN_ERROR(B_OK); @@ -678,12 +698,10 @@ { // Both endpoints must be locked. - // Shutdown and unset the receive FIFO. + // Write shutdown the receive FIFO. fReceiveFifo->Lock(); - fReceiveFifo->Shutdown(UNIX_FIFO_SHUTDOWN_READ | UNIX_FIFO_SHUTDOWN_WRITE); + fReceiveFifo->Shutdown(UNIX_FIFO_SHUTDOWN_WRITE); fReceiveFifo->Unlock(); - fReceiveFifo->RemoveReference(); - fReceiveFifo = NULL; // select() notification. gSocketModule->notify(socket, B_SELECT_WRITE, ECONNRESET); @@ -770,6 +788,16 @@ void +UnixEndpoint::_UnsetReceiveFifo() +{ + if (fReceiveFifo) { + fReceiveFifo->RemoveReference(); + fReceiveFifo = NULL; + } +} + + +void UnixEndpoint::_StopListening() { if (fState == UNIX_ENDPOINT_LISTENING) { Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.h =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.h 2008-04-12 09:30:47 UTC (rev 24942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixEndpoint.h 2008-04-12 09:37:13 UTC (rev 24943) @@ -101,6 +101,7 @@ status_t _Bind(int32 internalID); status_t _Unbind(); + void _UnsetReceiveFifo(); void _StopListening(); private: Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-12 09:30:47 UTC (rev 24942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/UnixFifo.cpp 2008-04-12 09:37:13 UTC (rev 24943) @@ -8,7 +8,7 @@ #include "unix.h" -#define UNIX_FIFO_DEBUG_LEVEL 1 +#define UNIX_FIFO_DEBUG_LEVEL 2 #define UNIX_DEBUG_LEVEL UNIX_FIFO_DEBUG_LEVEL #include "UnixDebug.h" @@ -64,6 +64,9 @@ return B_OK; } + // transfer the ancillary data + gBufferModule->transfer_ancillary_data(nextBuffer, buffer); + if (nextBuffer->size > toCopy) { // remove the part we've copied gBufferModule->remove_header(nextBuffer, toCopy); @@ -92,6 +95,9 @@ return error; } + // transfer the ancillary data + gBufferModule->transfer_ancillary_data(buffer, newBuffer); + // remove the part we've copied gBufferModule->remove_header(buffer, size); @@ -174,11 +180,11 @@ { fShutdown |= shutdown; - if ((shutdown & UNIX_FIFO_SHUTDOWN_READ) != 0) + if (shutdown != 0) { + // Shutting down either end also effects the other, so notify both. + release_sem_etc(fWriterSem, 1, B_RELEASE_ALL); release_sem_etc(fReaderSem, 1, B_RELEASE_ALL); - - if ((shutdown & UNIX_FIFO_SHUTDOWN_WRITE) != 0) - release_sem_etc(fWriterSem, 1, B_RELEASE_ALL); + } } @@ -312,11 +318,20 @@ if (IsReadShutdown()) return UNIX_FIFO_SHUTDOWN; + if (fBuffer.Readable() == 0) { + if (IsWriteShutdown()) { + *_buffer = NULL; + RETURN_ERROR(B_OK); + } + + if (timeout == 0) + RETURN_ERROR(B_WOULD_BLOCK); + } + // wait for any data to become available - if (fBuffer.Readable() == 0 && timeout == 0) - RETURN_ERROR(B_WOULD_BLOCK); - - while (fBuffer.Readable() == 0 && !IsReadShutdown()) { +// TODO: Support low water marks! + while (fBuffer.Readable() == 0 + && !IsReadShutdown() && !IsWriteShutdown()) { benaphore_unlock(&fLock); status_t error = acquire_sem_etc(fReaderSem, 1, @@ -331,6 +346,11 @@ if (IsReadShutdown()) return UNIX_FIFO_SHUTDOWN; + if (fBuffer.Readable() == 0 && IsWriteShutdown()) { + *_buffer = NULL; + RETURN_ERROR(B_OK); + } + RETURN_ERROR(fBuffer.Read(numBytes, _buffer)); } @@ -357,11 +377,15 @@ if (IsWriteShutdown()) return UNIX_FIFO_SHUTDOWN; + if (IsReadShutdown()) + return EPIPE; + // wait for any space to become available if (fBuffer.Writable() < request.size && timeout == 0) RETURN_ERROR(B_WOULD_BLOCK); - while (fBuffer.Writable() < request.size && !IsWriteShutdown()) { + while (fBuffer.Writable() < request.size && !IsWriteShutdown() + && !IsReadShutdown()) { benaphore_unlock(&fLock); status_t error = acquire_sem_etc(fWriterSem, 1, @@ -376,5 +400,8 @@ if (IsWriteShutdown()) return UNIX_FIFO_SHUTDOWN; + if (IsReadShutdown()) + return EPIPE; + RETURN_ERROR(fBuffer.Write(buffer)); } Modified: haiku/trunk/src/add-ons/kernel/network/protocols/unix/unix.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/unix/unix.cpp 2008-04-12 09:30:47 UTC (rev 24942) +++ haiku/trunk/src/add-ons/kernel/network/protocols/unix/unix.cpp 2008-04-12 09:37:13 UTC (rev 24943) @@ -8,6 +8,9 @@ #include +#include + +#include #include #include #include @@ -37,6 +40,23 @@ static struct net_domain *sDomain; +void +destroy_scm_rights_descriptors(const ancillary_data_header* header, + void* data) +{ + int count = header->len / sizeof(file_descriptor*); + file_descriptor** descriptors = (file_descriptor**)data; + + for (int i = 0; i < count; i++) { + if (descriptors[i] != NULL) + put_fd(descriptors[i]); + } +} + + +// #pragma mark - + + net_protocol * unix_init_protocol(net_socket *socket) { @@ -247,6 +267,119 @@ } +status_t +unix_attach_ancillary_data(net_protocol *self, net_buffer *buffer, + const cmsghdr *header) +{ + TRACE("[%ld] unix_attach_ancillary_data(%p, %p, %p (level: %d, type: %d, " + "len: %d))\n", find_thread(NULL), self, buffer, header, + header->cmsg_level, header->cmsg_type, (int)header->cmsg_len); + + // we support only SCM_RIGHTS + if (header->cmsg_level != SOL_SOCKET || header->cmsg_type != SCM_RIGHTS) + return B_BAD_VALUE; + + int* fds = (int*)CMSG_DATA(header); + int count = (header->cmsg_len - CMSG_ALIGN(sizeof(cmsghdr))) / sizeof(int); + if (count == 0) + return B_BAD_VALUE; + + file_descriptor** descriptors = new(std::nothrow) file_descriptor*[count]; + if (descriptors == NULL) + return ENOBUFS; + ArrayDeleter _(descriptors); + memset(descriptors, 0, sizeof(file_descriptor*) * count); + + // get the file descriptors + io_context* ioContext = get_current_io_context(!gStackModule->is_syscall()); + + status_t error = B_OK; + for (int i = 0; i < count; i++) { + descriptors[i] = get_fd(ioContext, fds[i]); + if (descriptors[i] == NULL) { + error = EBADF; + break; + } + } + + // attach the ancillary data to the buffer + if (error == B_OK) { + ancillary_data_header header; + header.level = SOL_SOCKET; + header.type = SCM_RIGHTS; + header.len = count * sizeof(file_descriptor*); + + TRACE("[%ld] unix_attach_ancillary_data(): attaching %d FDs to " + "buffer\n", find_thread(NULL), count); + + error = gBufferModule->attach_ancillary_data(buffer, &header, + descriptors, destroy_scm_rights_descriptors, NULL); + } + + // cleanup on error + if (error != B_OK) { + for (int i = 0; i < count; i++) { + if (descriptors[i] != NULL) + put_fd(descriptors[i]); + } + } + + return error; +} + + +ssize_t +unix_process_ancillary_data(net_protocol *self, + const ancillary_data_header *header, const void *data, void *buffer, + size_t bufferSize) +{ + TRACE("[%ld] unix_process_ancillary_data(%p, %p (level: %d, type: %d, " + "len: %lu), %p, %p, %lu)\n", find_thread(NULL), self, header, + header->level, header->type, header->len, data, buffer, bufferSize); + + // we support only SCM_RIGHTS + if (header->level != SOL_SOCKET || header->type != SCM_RIGHTS) + return B_BAD_VALUE; + + int count = header->len / sizeof(file_descriptor*); + file_descriptor** descriptors = (file_descriptor**)data; + + // check if there's enough space in the buffer + size_t neededBufferSpace = CMSG_SPACE(sizeof(int) * count); + if (bufferSize < neededBufferSpace) + return B_BAD_VALUE; + + // init header + cmsghdr* messageHeader = (cmsghdr*)buffer; + messageHeader->cmsg_level = header->level; + messageHeader->cmsg_type = header->type; + messageHeader->cmsg_len = CMSG_LEN(sizeof(int) * count); + + // create FDs for the current process + int* fds = (int*)CMSG_DATA(messageHeader); + io_context* ioContext = get_current_io_context(!gStackModule->is_syscall()); + + status_t error = B_OK; + for (int i = 0; i < count; i++) { + // get an additional reference which will go to the FD table index + inc_fd_ref_count(descriptors[i]); + fds[i] = new_fd(ioContext, descriptors[i]); + + if (fds[i] < 0) { + error = fds[i]; + put_fd(descriptors[i]); + + // close FD indices + for (int k = i - 1; k >= 0; k--) + close_fd_index(ioContext, fds[k]); + break; + } + } + + return error == B_OK ? neededBufferSpace : error; +} + + // #pragma mark - @@ -335,6 +468,8 @@ unix_deliver_data, unix_error, unix_error_reply, + unix_attach_ancillary_data, + unix_process_ancillary_data }; module_dependency module_dependencies[] = { From ingo_weinhold at gmx.de Sun Apr 13 17:28:09 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 17:28:09 +0200 Subject: [Haiku-commits] r24932 - haiku/trunk/src/apps/bootman In-Reply-To: <200804120810.m3C8AwLW021698@sheep.berlios.de> References: <200804120810.m3C8AwLW021698@sheep.berlios.de> Message-ID: <20080413172809.444.1@knochen-vm.1208099803.fake> On 2008-04-12 at 10:10:58 [+0200], laplace at BerliOS wrote: > Author: laplace > Date: 2008-04-12 10:10:57 +0200 (Sat, 12 Apr 2008) > New Revision: 24932 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24932&view=rev > > Added: > haiku/trunk/src/apps/bootman/MakeArray.cpp > Log: > Helper application that converts the contents of a file into an uint8 array. There's already a build tool doing exactly that (src/tools/data_to_source.cpp) and a build system rule to use it: rule DataFileToSourceFile sourceFile : dataFile : dataVariable : sizeVariable CU, Ingo From umccullough at gmail.com Sun Apr 13 17:53:19 2008 From: umccullough at gmail.com (Urias McCullough) Date: Sun, 13 Apr 2008 08:53:19 -0700 Subject: [Haiku-commits] r24918 - haiku/trunk/headers/private/kernel In-Reply-To: References: <200804112036.m3BKaq5q016680@sheep.berlios.de> Message-ID: <1e80d8750804130853g6390b584iaed1bd3f8e1240b2@mail.gmail.com> On 12/04/2008, Rene Gollent wrote: > Using this build of Firefox btw: > > ftp://ftp.binarychicken.com/mmadia/firefox-2.0.0.15pre.en-US.BeOS-bone-2008040520.zip > > Worked prior to the changes at least. The above location probably won't last forever (since it's hosted over my ADSL here) - it was just a temporary place I had mmadia upload a build for me to test. No worries though. He has since found a place to host his builds and you should be able to find the same file here: http://bezilla.beuser.de/builds/firefox-2.0.0.15pre.en-US.BeOS-bone-2008041302.zip Thanks, Urias From umccullough at gmail.com Sun Apr 13 18:03:32 2008 From: umccullough at gmail.com (Urias McCullough) Date: Sun, 13 Apr 2008 09:03:32 -0700 Subject: [Haiku-commits] r24935 - haiku/trunk/src/apps/bootman In-Reply-To: <200804120825.m3C8PdhE023979@sheep.berlios.de> References: <200804120825.m3C8PdhE023979@sheep.berlios.de> Message-ID: <1e80d8750804130903t4a906495p8fb90ee5ab5260af@mail.gmail.com> On 12/04/2008, laplace at BerliOS wrote: > Author: laplace > Date: 2008-04-12 10:25:38 +0200 (Sat, 12 Apr 2008) > New Revision: 24935 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24935&view=rev > > + #if not USE_SECOND_DISK > + // ignored in test build > + off_t size = sizeof(kBootLoader); > + if (!recorder.HasPartitions() || recorder.FirstOffset() < size) > + return kErrorBootSectorTooSmall; > + #endif busted the build for me - I changed mine to #if !USE_SECOND_DISK From mmlr at mail.berlios.de Sat Apr 12 12:27:05 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Apr 2008 12:27:05 +0200 Subject: [Haiku-commits] r24944 - haiku/trunk/src/apps/bootman Message-ID: <200804121027.m3CAR5vZ008462@sheep.berlios.de> Author: mmlr Date: 2008-04-12 12:27:04 +0200 (Sat, 12 Apr 2008) New Revision: 24944 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24944&view=rev Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp Log: Quick buildfix. Modified: haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp =================================================================== --- haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-12 09:37:13 UTC (rev 24943) +++ haiku/trunk/src/apps/bootman/LegacyBootDrive.cpp 2008-04-12 10:27:04 UTC (rev 24944) @@ -235,7 +235,7 @@ settings->AddString("disk", path.Path()); diskFound = true; - #if not USE_SECOND_DISK + #if !USE_SECOND_DISK // ignored in test build off_t size = sizeof(kBootLoader); if (!recorder.HasPartitions() || recorder.FirstOffset() < size) From mmlr at mlotz.ch Sun Apr 13 18:07:56 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Sun, 13 Apr 2008 18:07:56 +0200 Subject: [Haiku-commits] r24944 - haiku/trunk/src/apps/bootman In-Reply-To: <200804121027.m3CAR5vZ008462@sheep.berlios.de> Message-ID: <3845943843-BeMail@primary> > Author: mmlr > Date: 2008-04-12 12:27:04 +0200 (Sat, 12 Apr 2008) > New Revision: 24944 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24944&view=rev Hmm funny thing. Looks like those servers still life in the past. I'm pretty sure that I commited that just some minutes ago. Might this cause any problems? Regards Michael From anevilyak at gmail.com Sun Apr 13 18:10:08 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 13 Apr 2008 11:10:08 -0500 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap In-Reply-To: <20080413155657.899.6@knochen-vm.1208089234.fake> References: <200804120328.m3C3SF8S002299@sheep.berlios.de> <20080413155657.899.6@knochen-vm.1208089234.fake> Message-ID: On Sun, Apr 13, 2008 at 8:56 AM, Ingo Weinhold wrote: > > If you tell me what exactly you need and where, I'm sure we can work > something out. :-) > > CU, Ingo All that's needed is that the attribute keymap:name is written to config/settings/Key_map with the contents being the filename that the keymap was sourced from :) Regards, Rene From ingo_weinhold at gmx.de Sun Apr 13 18:22:49 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 18:22:49 +0200 Subject: [Haiku-commits] r24944 - haiku/trunk/src/apps/bootman In-Reply-To: <3845943843-BeMail@primary> References: <3845943843-BeMail@primary> Message-ID: <20080413182249.1742.3@knochen-vm.1208099803.fake> On 2008-04-13 at 18:07:56 [+0200], Michael Lotz wrote: > > Author: mmlr > > Date: 2008-04-12 12:27:04 +0200 (Sat, 12 Apr 2008) > > New Revision: 24944 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24944&view=rev > > Hmm funny thing. Looks like those servers still life in the past. I'm > pretty sure that I commited that just some minutes ago. Might this > cause any problems? Besides confusing the readers of the mailing list, it won't. CU, Ingo From ingo_weinhold at gmx.de Sun Apr 13 18:30:23 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 18:30:23 +0200 Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: References: Message-ID: <20080413183023.1774.4@knochen-vm.1208099803.fake> On 2008-04-13 at 15:53:49 [+0200], philippe.houdoin at free.fr wrote: > Fran?ois said: > > BTW, am I the only one concerned that the recent change remove the ability > to unload the whole net stack modules without rebooting, or did I miss > something? Currently that doesn't work, since the sockets.cpp kernel file will keep a reference to the stack interface module once loaded. If someone needs it, it can easily be changed to work like the previous mechanism, i.e. use reference counting and unload it when unreferenced. CU, Ingo From anevilyak at gmail.com Sun Apr 13 18:11:24 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 13 Apr 2008 11:11:24 -0500 Subject: [Haiku-commits] r24938 - haiku/trunk/src/preferences/keymap In-Reply-To: <200804120837.m3C8b4xp025840@sheep.berlios.de> References: <200804120837.m3C8b4xp025840@sheep.berlios.de> Message-ID: On Sat, Apr 12, 2008 at 3:37 AM, korli at BerliOS wrote: > Author: korli > Date: 2008-04-12 10:37:03 +0200 (Sat, 12 Apr 2008) > New Revision: 24938 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24938&view=rev > > Modified: > haiku/trunk/src/preferences/keymap/KeymapWindow.cpp > Log: > fixed bug #2067 > > Oops :) Thanks for fixing. Rene From michael.pfeiffer at utanet.at Sun Apr 13 18:50:45 2008 From: michael.pfeiffer at utanet.at (Michael Pfeiffer) Date: Sun, 13 Apr 2008 18:50:45 +0200 Subject: [Haiku-commits] r24932 - haiku/trunk/src/apps/bootman In-Reply-To: <20080413172809.444.1@knochen-vm.1208099803.fake> References: <200804120810.m3C8AwLW021698@sheep.berlios.de> <20080413172809.444.1@knochen-vm.1208099803.fake> Message-ID: <02E954DB-4BAC-4A25-B7F5-0FE1A684CC37@utanet.at> Am 13.04.2008 um 17:28 schrieb Ingo Weinhold: > > On 2008-04-12 at 10:10:58 [+0200], laplace at BerliOS > wrote: >> Author: laplace >> Date: 2008-04-12 10:10:57 +0200 (Sat, 12 Apr 2008) >> New Revision: 24932 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24932&view=rev >> >> Added: >> haiku/trunk/src/apps/bootman/MakeArray.cpp >> Log: >> Helper application that converts the contents of a file into an >> uint8 array. > > There's already a build tool doing exactly that > (src/tools/data_to_source.cpp) and a build system rule to use it: > > rule DataFileToSourceFile sourceFile : dataFile : dataVariable : > sizeVariable It is used in a manual process where an assembly code is compiled and then the binary is converted into an array stored in an header file. Is there also a rule for compiling assembly code using nasm? Regards, Michael From ingo_weinhold at gmx.de Sun Apr 13 19:04:20 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 13 Apr 2008 19:04:20 +0200 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap In-Reply-To: References: <200804120328.m3C3SF8S002299@sheep.berlios.de> <20080413155657.899.6@knochen-vm.1208089234.fake> Message-ID: <20080413190420.1915.5@knochen-vm.1208099803.fake> On 2008-04-13 at 18:10:08 [+0200], Rene Gollent wrote: > On Sun, Apr 13, 2008 at 8:56 AM, Ingo Weinhold wrote: > > > > If you tell me what exactly you need and where, I'm sure we can work > > something out. :-) > > All that's needed is that the attribute keymap:name is written to > config/settings/Key_map with the contents being the filename that the > keymap was sourced from :) I'm still not quite sure what to do. The build system doesn't create ~/config/settings/Key_map; I suppose the input server (or some add-on or driver) does that. I think the input server (or whoever creates the file) should be adjusted. Or do I miss something? CU, Ingo From anevilyak at gmail.com Sun Apr 13 19:15:17 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 13 Apr 2008 12:15:17 -0500 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap In-Reply-To: <20080413190420.1915.5@knochen-vm.1208099803.fake> References: <200804120328.m3C3SF8S002299@sheep.berlios.de> <20080413155657.899.6@knochen-vm.1208089234.fake> <20080413190420.1915.5@knochen-vm.1208099803.fake> Message-ID: On Sun, Apr 13, 2008 at 12:04 PM, Ingo Weinhold wrote: > > I'm still not quite sure what to do. The build system doesn't create > ~/config/settings/Key_map; I suppose the input server (or some add-on or > driver) does that. I think the input server (or whoever creates the file) > should be adjusted. Or do I miss something? Ah, I thought it was the build system that was writing the default keymap, I was using a rule in UserBuildConfig to override it since the default breaks the ~ key on my layout. Will look and see what's doing it. Regards, Rene From stippi at mail.berlios.de Sat Apr 12 15:24:33 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 12 Apr 2008 15:24:33 +0200 Subject: [Haiku-commits] r24945 - haiku/trunk/src/add-ons/media/plugins/xvid_decoder Message-ID: <200804121324.m3CDOXZM019970@sheep.berlios.de> Author: stippi Date: 2008-04-12 15:24:33 +0200 (Sat, 12 Apr 2008) New Revision: 24945 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24945&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h Log: * Cleanup and improvements in the debug output * Handles wrapping of the chunk buffer for the case that we need to read additional chunk data, but still need the data from the last chunk buffer as well. * Don't skip the very first frame when calculating the timing. * Includes some new code to handle seeking internally, but it is currently disabled and incomplete. * Prepared to recover from floating point exceptions generated in some rare situations by xvid, but we are currently missing fenv.h in our public POSIX headers, so it is disabled. Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile 2008-04-12 10:27:04 UTC (rev 24944) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/Jamfile 2008-04-12 13:24:33 UTC (rev 24945) @@ -13,4 +13,4 @@ libmedia.so ; -#SubInclude HAIKU_TOP src add-ons media plugins xvid_decoder libxvid ; +#SubIncludeGPL HAIKU_TOP src add-ons media plugins xvid_decoder libxvid ; Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2008-04-12 10:27:04 UTC (rev 24944) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.cpp 2008-04-12 13:24:33 UTC (rev 24945) @@ -18,10 +18,17 @@ * */ #define DEBUG 0 +#define PROPER_SEEKING 0 +#define PRINT_FOURCC 0 +#define MIN_USEFUL_BYTES 1 + #include "XvidDecoder.h" +//#include #include +#include +#include #include #include @@ -141,9 +148,6 @@ // #pragma mark - -#define MIN_USEFUL_BYTES 1 - - XvidDecoder::XvidDecoder() : Decoder() , fInputFormat() @@ -156,6 +160,7 @@ , fIndexInCodecTable(-1) , fChunkBuffer(NULL) + , fWrappedChunkBuffer(NULL) , fChunkBufferHandle(NULL) , fChunkBufferSize(0) , fLeftInChunkBuffer(0) @@ -167,6 +172,7 @@ XvidDecoder::~XvidDecoder() { _XvidUninit(); + delete[] fWrappedChunkBuffer; } @@ -202,7 +208,7 @@ if (inputFormat->type != B_MEDIA_ENCODED_VIDEO) return B_BAD_VALUE; - PRINT(("XvidDecoder::Sniff()\n")); +// PRINT(("%p->XvidDecoder::Sniff()\n", this)); //#if DEBUG // char buffer[1024]; @@ -235,19 +241,29 @@ codecID = descr.u.quicktime.codec; familyID = B_QUICKTIME_FORMAT_FAMILY; - #if DEBUG + #if PRINT_FOURCC uint32 bigEndianID = B_HOST_TO_BENDIAN_INT32(codecID); - PRINT(("XvidDecoder::Sniff() - QT 4CC: %.4s\n", (const char*)&bigEndianID)); + printf("%p->XvidDecoder::Setup() - QT 4CC: %.4s\n", this, + (const char*)&bigEndianID); #endif } else if (formats.GetCodeFor(*inputFormat, B_AVI_FORMAT_FAMILY, &descr) == B_OK) { codecID = descr.u.avi.codec; familyID = B_AVI_FORMAT_FAMILY; - #if DEBUG + #if PRINT_FOURCC uint32 bigEndianID = B_HOST_TO_BENDIAN_INT32(codecID); - PRINT(("XvidDecoder::Sniff() - AVI 4CC: %.4s\n", (const char*)&codecID)); + printf("%p->XvidDecoder::Sniff() - AVI 4CC: %.4s\n", this, + (const char*)&bigEndianID); #endif + } else if (formats.GetCodeFor(*inputFormat, B_MPEG_FORMAT_FAMILY, + &descr) == B_OK) { + codecID = descr.u.mpeg.id; + familyID = B_MPEG_FORMAT_FAMILY; + + #if PRINT_FOURCC + printf("%p->XvidDecoder::Setup() - MPEG ID: %ld\n", this, codecID); + #endif } } @@ -257,14 +273,18 @@ for (int32 i = 0; i < gSupportedCodecsCount; i++) { if (gCodecTable[i].family == familyID && gCodecTable[i].fourcc == codecID) { - PRINT(("XvidDecoder::Sniff() - found codec in the table at %ld.\n", i)); + PRINT(("%p->XvidDecoder::Setup() - found codec in the table " + "at %ld.\n", this, i)); fIndexInCodecTable = i; fInputFormat = *inputFormat; return B_OK; } } - PRINT(("XvidDecoder::Sniff() - no matching codec found in the table.\n")); + #if PRINT_FOURCC + printf("%p->XvidDecoder::Setup() - no matching codec found in the " + "table.\n", this); + #endif return B_ERROR; } @@ -273,13 +293,14 @@ status_t XvidDecoder::NegotiateOutputFormat(media_format* _inoutFormat) { - PRINT((" XvidDecoder::NegotiateOutputFormat()\n")); + PRINT(("%p->XvidDecoder::NegotiateOutputFormat()\n", this)); if (_inoutFormat == NULL) return B_BAD_VALUE; #if DEBUG char buffer[1024]; + buffer[0] = 0; if (string_for_format(*_inoutFormat, buffer, sizeof(buffer)) == B_OK) PRINT((" _inoutFormat = %s\n", buffer)); #endif @@ -353,8 +374,8 @@ _inoutFormat->deny_flags = B_MEDIA_MAUI_UNDEFINED_FLAGS; #if DEBUG - string_for_format(*_inoutFormat, buffer, sizeof(buffer)); - PRINT(("XvidDecoder: out_format=%s\n", buffer)); + if (string_for_format(*_inoutFormat, buffer, sizeof(buffer)) == B_OK) + PRINT(("%p->XvidDecoder: out_format=%s\n", this, buffer)); #endif return _XvidInit(true, 0) == 0 ? B_OK : B_ERROR; @@ -362,18 +383,20 @@ status_t -XvidDecoder::Decode(void* outBuffer, int64 *outFrameCount, media_header *mh, - media_decode_info *info) +XvidDecoder::Decode(void* outBuffer, int64* outFrameCount, media_header* mh, + media_decode_info* info) { if (outBuffer == NULL || outFrameCount == NULL || mh == NULL) return B_BAD_VALUE; - PRINT(("XvidDecoder::Decode()\n")); +// PRINT((%p->"XvidDecoder::Decode()\n", this)); + + *outFrameCount = 0; // are we in a hurry ? bool hurryUp = (!info || (info->time_to_decode > 0)) ? false : true; - mh->type = B_MEDIA_RAW_VIDEO; + mh->type = B_MEDIA_UNKNOWN_TYPE; mh->start_time = 0; mh->size_used = 0; mh->file_pos = 0; @@ -394,16 +417,58 @@ do { if (fLeftInChunkBuffer <= MIN_USEFUL_BYTES) { + uint8* leftOverBuffer = NULL; + size_t leftOverBufferSize = 0; + if (fLeftInChunkBuffer > 0) { + // we need to wrap the chunk buffer + // create a temporary buffer to hold the remaining data + leftOverBufferSize = fLeftInChunkBuffer; + leftOverBuffer = new (nothrow) uint8[leftOverBufferSize]; + if (!leftOverBuffer) + ret = B_NO_MEMORY; + else { + memcpy(leftOverBuffer, fChunkBufferHandle, + leftOverBufferSize); + } + } + // we don't need the previous wrapped buffer anymore in + // case we had it + delete[] fWrappedChunkBuffer; + fWrappedChunkBuffer = NULL; + // read new data - ret = GetNextChunk(&fChunkBuffer, &fChunkBufferSize, mh); + if (ret >= B_OK) + ret = GetNextChunk(&fChunkBuffer, &fChunkBufferSize, mh); if (ret >= B_OK) { - fLeftInChunkBuffer = fChunkBufferSize; - fChunkBufferHandle = (const char*)fChunkBuffer; - } else { + if (leftOverBuffer) { + fWrappedChunkBuffer = new (nothrow) uint8[fChunkBufferSize + + leftOverBufferSize]; + if (!fWrappedChunkBuffer) + ret = B_NO_MEMORY; + else { + // copy the left over buffer to the beginning of the + // wrapped chunk buffer + memcpy(fWrappedChunkBuffer, leftOverBuffer, + leftOverBufferSize); + // copy the new chunk buffer after that + memcpy(fWrappedChunkBuffer + leftOverBufferSize, + fChunkBuffer, fChunkBufferSize); + + fChunkBufferSize += leftOverBufferSize; + fLeftInChunkBuffer = fChunkBufferSize; + fChunkBufferHandle = (const char*)fWrappedChunkBuffer; + } + } else { + fLeftInChunkBuffer = fChunkBufferSize; + fChunkBufferHandle = (const char*)fChunkBuffer; + } + } + if (ret < B_OK) { fChunkBufferSize = 0; fChunkBuffer = NULL; fChunkBufferHandle = NULL; } + delete[] leftOverBuffer; } // Check if there is a negative number of useful bytes left in buffer @@ -417,8 +482,9 @@ // This loop is needed to handle VOL/NVOP reading do { // Decode frame - int usedBytes = _XvidDecode((uchar*)fChunkBufferHandle, (uchar*)outBuffer, - fLeftInChunkBuffer, &xvidDecoderStats, hurryUp); + int usedBytes = _XvidDecode((uchar*)fChunkBufferHandle, + (uchar*)outBuffer, fLeftInChunkBuffer, &xvidDecoderStats, + hurryUp); // Resize image buffer if needed if (xvidDecoderStats.type == XVID_TYPE_VOL) { @@ -429,9 +495,10 @@ < xvidDecoderStats.data.vol.width * xvidDecoderStats.data.vol.height) { - PRINT(("XvidDecoder::Decode() - image size changed!\n", + fprintf(stderr, "XvidDecoder::Decode() - image size " + "changed: %dx%d\n", xvidDecoderStats.data.vol.width, - xvidDecoderStats.data.vol.height)); + xvidDecoderStats.data.vol.height); return B_ERROR; } @@ -443,8 +510,9 @@ fLeftInChunkBuffer -= usedBytes; } - PRINT(("XvidDecoder::Decode() - chunk %d: %d bytes consumed, " - "%d bytes in buffer\n", chunk++, usedBytes, fLeftInChunkBuffer)); +// PRINT((%p->"XvidDecoder::Decode() - chunk %d: %d bytes consumed, " +// "%d bytes in buffer\n", this, chunk++, usedBytes, +// fLeftInChunkBuffer)); } while (xvidDecoderStats.type <= 0 && fLeftInChunkBuffer > MIN_USEFUL_BYTES); @@ -458,27 +526,35 @@ } while (fLeftInChunkBuffer > MIN_USEFUL_BYTES || ret >= B_OK); - if (ret != B_OK) + if (ret != B_OK) { + PRINT(("%p->XvidDecoder::Decode() - error: %s\n", this, + strerror(ret))); return ret; + } - fFrame++; - - mh->start_time = (bigtime_t) (1000000.0 * fFrame / fOutputVideoFormat.field_rate); + mh->type = B_MEDIA_RAW_VIDEO; + mh->start_time = (bigtime_t) (1000000.0 * fFrame + / fOutputVideoFormat.field_rate); mh->u.raw_video.field_sequence = fFrame; + mh->u.raw_video.first_active_line = 1; mh->u.raw_video.line_count = fOutputVideoFormat.display.line_count; -/**/ - PRINT(("XvidDecoder::Decode() - start_time=%02d:%02d.%02d field_sequence=%u\n", - int((mh->start_time / 60000000) % 60), - int((mh->start_time / 1000000) % 60), - int((mh->start_time / 10000) % 100), - mh->u.raw_video.field_sequence)); -/**/ -#if DEBUG - print_media_header(mh); - print_media_decode_info(info); -#endif + *outFrameCount = 1; + fFrame++; + + PRINT(("%p->XvidDecoder::Decode() - start_time=%02d:%02d.%02d " + "field_sequence=%u\n", this, + int((mh->start_time / 60000000) % 60), + int((mh->start_time / 1000000) % 60), + int((mh->start_time / 10000) % 100), + mh->u.raw_video.field_sequence)); + +//#if DEBUG +// print_media_header(mh); +// print_media_decode_info(info); +//#endif + return B_OK; } @@ -487,16 +563,19 @@ XvidDecoder::Seek(uint32 inToWhat, int64 inRequiredFrame, int64 *_inOutFrame, bigtime_t inRequiredTime, bigtime_t *_inOutTime) { - PRINT((" XvidDecoder::Seek(flags=%ld, inRequiredFrame=%lld, _inOutFrame=%lld, " - "inRequiredTime=%lld, _inOutTime=%lld)\n", inToWhat, inRequiredFrame, - *_inOutFrame, inRequiredTime, *_inOutTime)); + PRINT(("%p->XvidDecoder::Seek(flags=%ld, inRequiredFrame=%lld, " + "_inOutFrame=%lld, inRequiredTime=%lld, _inOutTime=%lld)\n", + this, inToWhat, inRequiredFrame, *_inOutFrame, inRequiredTime, + *_inOutTime)); -// printf(" XvidDecoder::Reset(flags=%ld, inRequiredFrame=%lld, _inOutFrame=%lld, " -// "inRequiredTime=%lld, _inOutTime=%lld)\n", inToWhat, inRequiredFrame, -// *_inOutFrame, inRequiredTime, *_inOutTime); +#if PROPER_SEEKING + status_t ret = B_OK; + if (inToWhat == B_SEEK_BY_FRAME) { -// status_t ret = B_OK; -// if (inToWhat & B_MEDIA_SEEK_TO_FRAME) { +printf("%p->XvidDecoder::Reset(B_SEEK_BY_FRAME, inRequiredFrame=%lld,\n" +" _inOutFrame=%lld, inRequiredTime=%lld, _inOutTime=%lld)\n", +this, inRequiredFrame, *_inOutFrame, inRequiredTime, *_inOutTime); + // int64 wantedFrame = *_inOutFrame; // ret = fTrack->FindKeyFrameForFrame(_inOutFrame, B_MEDIA_SEEK_CLOSEST_BACKWARD); // if (ret == B_OK && *_inOutFrame != wantedFrame) { @@ -504,7 +583,12 @@ // // note, this might cause us to enter the function // // again, but that's ok as long as we can seek to the frame // } -// } else if (inToWhat & B_MEDIA_SEEK_TO_TIME) { + } else if (inToWhat == B_SEEK_BY_TIME) { + +printf("%p->XvidDecoder::Reset(B_SEEK_BY_TIME, inRequiredFrame=%lld,\n" +" _inOutFrame=%lld, inRequiredTime=%lld, _inOutTime=%lld)\n", +this, inRequiredFrame, *_inOutFrame, inRequiredTime, *_inOutTime); + // bigtime_t wantedTime = *_inOutTime; // ret = fTrack->FindKeyFrameForTime(_inOutTime, B_MEDIA_SEEK_CLOSEST_BACKWARD); // if (ret == B_OK && *_inOutTime != wantedTime) { @@ -513,14 +597,14 @@ // // again, but that's ok as long as we can seek to the frame // *_inOutFrame = fTrack->CurrentFrame(); // } -// } -// -// if (ret != B_OK) { -// fprintf(stderr, "XvidDecoder::Seek() - failed to seek\n"); -// return ret; -// } -// - // TODO: reset xvid decode info? + } + + if (ret != B_OK) { + fprintf(stderr, "%p->XvidDecoder::Reset() - failed to seek\n", this); + return ret; + } +#endif // PROPER_SEEKING + fFrame = *_inOutFrame; fChunkBuffer = NULL; @@ -528,6 +612,7 @@ fChunkBufferSize = 0; fLeftInChunkBuffer = 0; + // this will cause the xvid core to discard any cached stuff fDiscontinuity = true; return B_OK; @@ -541,11 +626,10 @@ int XvidDecoder::_XvidInit(int useAssembler, int debugLevel) { - int ret = _XvidUninit(); - if (ret < 0) - return ret; + if (fXvidDecoderHandle != NULL) + return 0; - xvid_gbl_init_t xvidGlobalInit; + xvid_gbl_init_t xvidGlobalInit; xvid_dec_create_t xvidDecoderCreate; // reset the structure with zeros @@ -576,7 +660,7 @@ xvidDecoderCreate.width = 0; xvidDecoderCreate.height = 0; - ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvidDecoderCreate, NULL); + int ret = xvid_decore(NULL, XVID_DEC_CREATE, &xvidDecoderCreate, NULL); if (ret == 0) fXvidDecoderHandle = xvidDecoderCreate.handle; @@ -599,15 +683,28 @@ return ret; } +// handle_fp_exeption +static void +handle_fp_exeption(int sig, void* opaque) +{ + printf("_XvidDecode(): WARNING: Xvid decoder raised SIGFPE exception.\n"); + +// TODO: enable when fenv.h is available +// feclearexcept(FE_ALL_EXCEPT); + + //jump back before xvid_decore() and take the other branch + siglongjmp((sigjmp_buf)opaque, 1); +} + // _XvidDecode int -XvidDecoder::_XvidDecode(uchar *istream, uchar *ostream, int inStreamSize, +XvidDecoder::_XvidDecode(uchar *inStream, uchar *outStream, int inStreamSize, xvid_dec_stats_t* xvidDecoderStats, bool hurryUp) { - PRINT(("XvidDecoder::_XvidDecode(%p, %p, %d)\n", istream, ostream, - inStreamSize)); + PRINT(("%p->XvidDecoder::_XvidDecode(%p, %p, %d)\n", this, inStream, + outStream, inStreamSize)); - if (istream == NULL || inStreamSize == 0) + if (inStream == NULL || inStreamSize == 0) return -1; xvid_dec_frame_t xvid_dec_frame; @@ -630,17 +727,43 @@ } // input stream - xvid_dec_frame.bitstream = istream; + xvid_dec_frame.bitstream = inStream; xvid_dec_frame.length = inStreamSize; // output frame structure - xvid_dec_frame.output.plane[0] = ostream; - xvid_dec_frame.output.stride[0] = ostream ? + xvid_dec_frame.output.plane[0] = outStream; + xvid_dec_frame.output.stride[0] = outStream ? fOutputVideoFormat.display.bytes_per_row : 0; xvid_dec_frame.output.csp = fXvidColorspace; - return xvid_decore(fXvidDecoderHandle, XVID_DEC_DECODE, &xvid_dec_frame, - xvidDecoderStats); + // prepare for possible floating point exception + sigjmp_buf preDecoreEnv; + + struct sigaction action; + struct sigaction oldAction; + memset(&action, 0, sizeof(struct sigaction)); + action.sa_flags = 0; + action.sa_handler = (__signal_func_ptr)handle_fp_exeption; + action.sa_userdata = preDecoreEnv; + + if (sigaction(SIGFPE, &action, &oldAction) != 0) + return -1; + + int usedBytes; + if (sigsetjmp(preDecoreEnv, 1) == 0) { + // decode + usedBytes = xvid_decore(fXvidDecoderHandle, XVID_DEC_DECODE, + &xvid_dec_frame, xvidDecoderStats); + } else { + // make sure the state changes before calling xvid_decore again + // or we'll cause the same exception + usedBytes = 1; + } + + if (sigaction(SIGFPE, &oldAction, &action) != 0) + return -1; + + return usedBytes; } // #pragma mark - @@ -690,7 +813,7 @@ if (err < B_OK) { fprintf(stderr, "XvidDecoder: BMediaFormats::MakeFormatFor: " "error %s\n", strerror(err)); - return err; + continue; } gXvidFormats[i] = format; Modified: haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h 2008-04-12 10:27:04 UTC (rev 24944) +++ haiku/trunk/src/add-ons/media/plugins/xvid_decoder/XvidDecoder.h 2008-04-12 13:24:33 UTC (rev 24945) @@ -50,10 +50,6 @@ bigtime_t inRequiredTime, bigtime_t* _inOutTime); - protected: - media_header fHeader; - media_decode_info fInfo; - private: int _XvidInit(int useAssembler, int debugLevel); int _XvidUninit(); @@ -73,6 +69,7 @@ int32 fIndexInCodecTable; const void* fChunkBuffer; + uint8* fWrappedChunkBuffer; const char* fChunkBufferHandle; size_t fChunkBufferSize; int32 fLeftInChunkBuffer; From korli at mail.berlios.de Sat Apr 12 15:36:34 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 12 Apr 2008 15:36:34 +0200 Subject: [Haiku-commits] r24946 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200804121336.m3CDaYKB021338@sheep.berlios.de> Author: korli Date: 2008-04-12 15:36:33 +0200 (Sat, 12 Apr 2008) New Revision: 24946 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24946&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp Log: disabled check for memory overlaps for the time being Modified: haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp 2008-04-12 13:24:33 UTC (rev 24945) +++ haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp 2008-04-12 13:36:33 UTC (rev 24946) @@ -169,6 +169,7 @@ if (sMemoryTypeRegisterCount == 0) return B_NOT_SUPPORTED; +#if 0 // check if it overlaps if (type == IA32_MTR_WRITE_COMBINING && is_memory_overlapping(base, length, &index)) { @@ -178,6 +179,7 @@ } // we replace an existing write-combining mtrr with a bigger one at the index position } +#endif // length must be a power of 2; just round it up to the next value length = nearest_power(length); From marcusoverhagen at arcor.de Sun Apr 13 21:31:08 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Sun, 13 Apr 2008 21:31:08 +0200 Subject: [Haiku-commits] r24946 - haiku/trunk/src/system/kernel/arch/x86 In-Reply-To: <200804121336.m3CDaYKB021338@sheep.berlios.de> References: <200804121336.m3CDaYKB021338@sheep.berlios.de> Message-ID: <48025F7C.4000007@arcor.de> korli at BerliOS schrieb: > Modified: > haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp > Log: > disabled check for memory overlaps for the time being Why? regards Marcus From mmlr at mail.berlios.de Sat Apr 12 16:20:54 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sat, 12 Apr 2008 16:20:54 +0200 Subject: [Haiku-commits] r24947 - haiku/trunk/src/add-ons/kernel/drivers/bus/usb Message-ID: <200804121420.m3CEKsh0028301@sheep.berlios.de> Author: mmlr Date: 2008-04-12 16:20:53 +0200 (Sat, 12 Apr 2008) New Revision: 24947 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24947&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp Log: Make a local copy of the passed in isochronous packet descriptors before handing them over to the USB stack. Otherwise the finisher (kernel) thread would have no way to fill those packets when they came from a user space address range. Completely untested though. Modified: haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-12 13:36:33 UTC (rev 24946) +++ haiku/trunk/src/add-ons/kernel/drivers/bus/usb/usb_raw.cpp 2008-04-12 14:20:53 UTC (rev 24947) @@ -591,9 +591,25 @@ return B_OK; } - benaphore_lock(&device->lock); + size_t descriptorsSize = 0; + usb_iso_packet_descriptor *packetDescriptors = NULL; + if (op == B_USB_RAW_COMMAND_ISOCHRONOUS_TRANSFER) { + descriptorsSize = sizeof(usb_iso_packet_descriptor) + * command->isochronous.packet_count; + packetDescriptors + = (usb_iso_packet_descriptor *)malloc(descriptorsSize); + if (!packetDescriptors) { + command->transfer.status = B_USB_RAW_STATUS_NO_MEMORY; + command->transfer.length = 0; + return B_OK; + } + memcpy(packetDescriptors, + command->isochronous.packet_descriptors, descriptorsSize); + } + status_t status; + benaphore_lock(&device->lock); if (op == B_USB_RAW_COMMAND_INTERRUPT_TRANSFER) { status = gUSBModule->queue_interrupt(endpointInfo->handle, command->transfer.data, command->transfer.length, @@ -605,14 +621,14 @@ } else { status = gUSBModule->queue_isochronous(endpointInfo->handle, command->isochronous.data, command->isochronous.length, - command->isochronous.packet_descriptors, - command->isochronous.packet_count, NULL, 0, - usb_raw_callback, device); + packetDescriptors, command->isochronous.packet_count, NULL, + 0, usb_raw_callback, device); } if (status < B_OK) { command->transfer.status = B_USB_RAW_STATUS_FAILED; command->transfer.length = 0; + free(packetDescriptors); benaphore_unlock(&device->lock); return B_OK; } @@ -621,6 +637,13 @@ command->transfer.status = device->status; command->transfer.length = device->actual_length; benaphore_unlock(&device->lock); + + if (op == B_USB_RAW_COMMAND_ISOCHRONOUS_TRANSFER) { + memcpy(command->isochronous.packet_descriptors, + packetDescriptors, descriptorsSize); + free(packetDescriptors); + } + return B_OK; } } From ingo_weinhold at gmx.de Mon Apr 14 00:01:11 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 14 Apr 2008 00:01:11 +0200 Subject: [Haiku-commits] r24932 - haiku/trunk/src/apps/bootman In-Reply-To: <02E954DB-4BAC-4A25-B7F5-0FE1A684CC37@utanet.at> References: <200804120810.m3C8AwLW021698@sheep.berlios.de> <20080413172809.444.1@knochen-vm.1208099803.fake> <02E954DB-4BAC-4A25-B7F5-0FE1A684CC37@utanet.at> Message-ID: <20080414000111.2035.7@knochen-vm.1208099803.fake> On 2008-04-13 at 18:50:45 [+0200], Michael Pfeiffer wrote: > Am 13.04.2008 um 17:28 schrieb Ingo Weinhold: > > > > On 2008-04-12 at 10:10:58 [+0200], laplace at BerliOS > > wrote: > >> Author: laplace > >> Date: 2008-04-12 10:10:57 +0200 (Sat, 12 Apr 2008) > >> New Revision: 24932 > >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24932&view=rev > >> > >> Added: > >> haiku/trunk/src/apps/bootman/MakeArray.cpp > >> Log: > >> Helper application that converts the contents of a file into an > >> uint8 array. > > > > There's already a build tool doing exactly that > > (src/tools/data_to_source.cpp) and a build system rule to use it: > > > > rule DataFileToSourceFile sourceFile : dataFile : dataVariable : > > sizeVariable > > It is used in a manual process where an assembly code is compiled and > then the binary is converted into an array stored in an header file. > > Is there also a rule for compiling assembly code using nasm? Nope, nasm isn't a build system requirement (yet) and there's no rule. So for the time being just add the binary as well. Converting it to source code can be done with the build system, though. Alternatively you can choose the same strategy as for makebootable and add it as a resource. CU, Ingo From ingo_weinhold at gmx.de Mon Apr 14 00:05:20 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 14 Apr 2008 00:05:20 +0200 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap In-Reply-To: References: <200804120328.m3C3SF8S002299@sheep.berlios.de> <20080413155657.899.6@knochen-vm.1208089234.fake> <20080413190420.1915.5@knochen-vm.1208099803.fake> Message-ID: <20080414000520.2072.8@knochen-vm.1208099803.fake> On 2008-04-13 at 19:15:17 [+0200], Rene Gollent wrote: > On Sun, Apr 13, 2008 at 12:04 PM, Ingo Weinhold > wrote: > > > > I'm still not quite sure what to do. The build system doesn't create > > ~/config/settings/Key_map; I suppose the input server (or some add-on or > > driver) does that. I think the input server (or whoever creates the file) > > should be adjusted. Or do I miss something? > > Ah, I thought it was the build system that was writing the default > keymap, I was using a rule in UserBuildConfig to override it since the > default breaks the ~ key on my layout. Similarly here. It works like one of those keys that change the char of the next key pressed, i.e. I have to press it twice or the space key afterwards to get a tilde. > Will look and see what's doing > it. Greatly appreciated! CU, Ingo From korli at users.berlios.de Mon Apr 14 00:13:16 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Mon, 14 Apr 2008 00:13:16 +0200 Subject: [Haiku-commits] r24946 - haiku/trunk/src/system/kernel/arch/x86 In-Reply-To: <48025F7C.4000007@arcor.de> References: <200804121336.m3CDaYKB021338@sheep.berlios.de> <48025F7C.4000007@arcor.de> Message-ID: 2008/4/13, Marcus Overhagen : > korli at BerliOS schrieb: > > > Modified: > > haiku/trunk/src/system/kernel/arch/x86/arch_vm.cpp > > Log: > > disabled check for memory overlaps for the time being > > Why? > It seems bug #1959 appeared around when this check was committed. This check was introduced as a try, it didn't fix any bugs so far. Bye, J?r?me From bonefish at mail.berlios.de Sat Apr 12 18:59:51 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 18:59:51 +0200 Subject: [Haiku-commits] r24948 - haiku/trunk/src/system/kernel/fs Message-ID: <200804121659.m3CGxp6I019340@sheep.berlios.de> Author: bonefish Date: 2008-04-12 18:59:49 +0200 (Sat, 12 Apr 2008) New Revision: 24948 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24948&view=rev Modified: haiku/trunk/src/system/kernel/fs/socket.cpp Log: The syscalls that were returning an address always copied back the full address back to userland, even if the provided buffer was smaller. Fixes a problem with Firefox, which is for some reason providing a buffer smaller than our sockaddr_in. Modified: haiku/trunk/src/system/kernel/fs/socket.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 14:20:53 UTC (rev 24947) +++ haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 16:59:49 UTC (rev 24948) @@ -112,6 +112,24 @@ static status_t +copy_address_to_userland(const void* address, socklen_t addressLength, + sockaddr* userAddress, socklen_t userAddressBufferSize, + socklen_t* userAddressLength) +{ + // copy address size and address back to userland + if (user_memcpy(userAddressLength, &addressLength, + sizeof(socklen_t)) != B_OK + || userAddress != NULL + && user_memcpy(userAddress, address, + min_c(addressLength, userAddressBufferSize)) != B_OK) { + return B_BAD_ADDRESS; + } + + return B_OK; +} + + +static status_t prepare_userland_msghdr(const msghdr* userMessage, msghdr& message, iovec*& userVecs, MemoryDeleter& vecsDeleter, void*& userAddress, char* address) @@ -835,14 +853,13 @@ SyscallRestartWrapper result; char address[MAX_SOCKET_ADDRESS_LEN]; + socklen_t userAddressBufferSize = addressLength; result = common_accept(socket, userAddress != NULL ? (sockaddr*)address : NULL, &addressLength, false); // copy address size and address back to userland - if (user_memcpy(_addressLength, &addressLength, - sizeof(socklen_t)) != B_OK - || userAddress != NULL - && user_memcpy(userAddress, address, addressLength) != B_OK) { + if (copy_address_to_userland(address, addressLength, userAddress, + userAddressBufferSize, _addressLength) != B_OK) { _user_close(result); return B_BAD_ADDRESS; } @@ -874,16 +891,15 @@ SyscallRestartWrapper result; char address[MAX_SOCKET_ADDRESS_LEN]; + socklen_t userAddressBufferSize = addressLength; result = common_recvfrom(socket, data, length, flags, userAddress != NULL ? (sockaddr*)address : NULL, &addressLength, false); if (result < (ssize_t)0) return result; // copy address size and address back to userland - if (user_memcpy(_addressLength, &addressLength, - sizeof(socklen_t)) != B_OK - || userAddress != NULL - && user_memcpy(userAddress, address, addressLength) != B_OK) { + if (copy_address_to_userland(address, addressLength, userAddress, + userAddressBufferSize, _addressLength) != B_OK) { return B_BAD_ADDRESS; } @@ -1103,16 +1119,15 @@ // getpeername() char address[MAX_SOCKET_ADDRESS_LEN]; + socklen_t userAddressBufferSize = addressLength; error = common_getpeername(socket, (sockaddr*)address, &addressLength, false); if (error != (status_t)B_OK) return error; // copy address size and address back to userland - if (user_memcpy(_addressLength, &addressLength, - sizeof(socklen_t)) != B_OK - || userAddress != NULL - && user_memcpy(userAddress, address, addressLength) != B_OK) { + if (copy_address_to_userland(address, addressLength, userAddress, + userAddressBufferSize, _addressLength) != B_OK) { return B_BAD_ADDRESS; } @@ -1132,18 +1147,17 @@ if (error != (status_t)B_OK) return error; - // getsocknam() + // getsockname() char address[MAX_SOCKET_ADDRESS_LEN]; + socklen_t userAddressBufferSize = addressLength; error = common_getsockname(socket, (sockaddr*)address, &addressLength, false); if (error != (status_t)B_OK) return error; // copy address size and address back to userland - if (user_memcpy(_addressLength, &addressLength, - sizeof(socklen_t)) != B_OK - || userAddress != NULL - && user_memcpy(userAddress, address, addressLength) != B_OK) { + if (copy_address_to_userland(address, addressLength, userAddress, + userAddressBufferSize, _addressLength) != B_OK) { return B_BAD_ADDRESS; } From ingo_weinhold at gmx.de Mon Apr 14 00:43:08 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Mon, 14 Apr 2008 00:43:08 +0200 Subject: [Haiku-commits] r24918 - haiku/trunk/headers/private/kernel In-Reply-To: <20080413153711.740.4@knochen-vm.1208089234.fake> References: <200804112036.m3BKaq5q016680@sheep.berlios.de> <20080413153711.740.4@knochen-vm.1208089234.fake> Message-ID: <20080414004308.387.1@knochen-vm.1208126329.fake> On 2008-04-13 at 15:37:11 [+0200], Ingo Weinhold wrote: > > On 2008-04-12 at 17:24:37 [+0200], Rene Gollent wrote: > > On Sat, Apr 12, 2008 at 10:16 AM, Rene Gollent > > wrote: > > > One of these socket-related changes seems to have broken Firefox...it > > > segfaults on startup in the newer builds now. I can't yet try to > > > binary search to find out the exact revision though since berlios > > > appears to currently be down. > > > > > > > Using this build of Firefox btw: > > > > ftp://ftp.binarychicken.com/mmadia/firefox-2.0.0.15pre.en-US.BeOS-bone-2008040520.zip > > > > Worked prior to the changes at least. > > Will have a look. Fixed in r24948. Firefox provides a 28 bytes sized buffer to getsockname(), but our sockaddr_in is 32 bytes big. Since we didn't truncate the copied back address, we were overwriting stack which led to the crash. Nevertheless the Bezilla folks should have a look at why the short buffer is passed in the first place. CU, Ingo From bonefish at mail.berlios.de Sat Apr 12 19:18:33 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 19:18:33 +0200 Subject: [Haiku-commits] r24949 - in haiku/trunk: headers/private/kernel src/system/kernel/fs Message-ID: <200804121718.m3CHIXP5010743@sheep.berlios.de> Author: bonefish Date: 2008-04-12 19:18:31 +0200 (Sat, 12 Apr 2008) New Revision: 24949 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24949&view=rev Modified: haiku/trunk/headers/private/kernel/syscall_restart.h haiku/trunk/src/system/kernel/fs/fd.cpp haiku/trunk/src/system/kernel/fs/socket.cpp Log: * Removed SyscallRestartWrapper comparison operators. They are not needed, since we've got a cast operator. * Reverted r24927-r24929. There's no potential ambiguity anymore. Modified: haiku/trunk/headers/private/kernel/syscall_restart.h =================================================================== --- haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-12 16:59:49 UTC (rev 24948) +++ haiku/trunk/headers/private/kernel/syscall_restart.h 2008-04-12 17:18:31 UTC (rev 24949) @@ -144,13 +144,6 @@ return *this; } - bool operator==(const Type& other) const { return fResult == other; } - bool operator!=(const Type& other) const { return fResult != other; } - bool operator<=(const Type& other) const { return fResult <= other; } - bool operator>=(const Type& other) const { return fResult >= other; } - bool operator<(const Type& other) const { return fResult < other; } - bool operator>(const Type& other) const { return fResult > other; } - operator Type() const { return fResult; } private: Modified: haiku/trunk/src/system/kernel/fs/fd.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 16:59:49 UTC (rev 24948) +++ haiku/trunk/src/system/kernel/fs/fd.cpp 2008-04-12 17:18:31 UTC (rev 24949) @@ -660,7 +660,7 @@ else status = descriptor->ops->fd_read(descriptor, pos, buffer, &length); - if (status < (status_t)B_OK) + if (status < B_OK) return status; if (movePosition) @@ -726,7 +726,7 @@ &length); } - if (status < (status_t)B_OK) { + if (status < B_OK) { if (bytesTransferred == 0) return status; status = B_OK; Modified: haiku/trunk/src/system/kernel/fs/socket.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 16:59:49 UTC (rev 24948) +++ haiku/trunk/src/system/kernel/fs/socket.cpp 2008-04-12 17:18:31 UTC (rev 24949) @@ -894,7 +894,7 @@ socklen_t userAddressBufferSize = addressLength; result = common_recvfrom(socket, data, length, flags, userAddress != NULL ? (sockaddr*)address : NULL, &addressLength, false); - if (result < (ssize_t)0) + if (result < 0) return result; // copy address size and address back to userland @@ -945,7 +945,7 @@ SyscallRestartWrapper result; result = common_recvmsg(socket, &message, flags, false); - if (result < (ssize_t)0) + if (result < 0) return result; // copy the address, the ancillary data, and the message header back to @@ -1072,7 +1072,7 @@ SyscallRestartWrapper error; error = common_getsockopt(socket, level, option, value, &length, false); - if (error != (status_t)B_OK) + if (error != B_OK) return error; // copy value back to userland @@ -1114,7 +1114,7 @@ SyscallRestartWrapper error; error = prepare_userland_address_result(userAddress, _addressLength, addressLength, true); - if (error != (status_t)B_OK) + if (error != B_OK) return error; // getpeername() @@ -1122,7 +1122,7 @@ socklen_t userAddressBufferSize = addressLength; error = common_getpeername(socket, (sockaddr*)address, &addressLength, false); - if (error != (status_t)B_OK) + if (error != B_OK) return error; // copy address size and address back to userland @@ -1144,7 +1144,7 @@ SyscallRestartWrapper error; error = prepare_userland_address_result(userAddress, _addressLength, addressLength, true); - if (error != (status_t)B_OK) + if (error != B_OK) return error; // getsockname() @@ -1152,7 +1152,7 @@ socklen_t userAddressBufferSize = addressLength; error = common_getsockname(socket, (sockaddr*)address, &addressLength, false); - if (error != (status_t)B_OK) + if (error != B_OK) return error; // copy address size and address back to userland @@ -1186,7 +1186,7 @@ int socketVector[2]; SyscallRestartWrapper error; error = common_socketpair(family, type, protocol, socketVector, false); - if (error != (status_t)B_OK) + if (error != B_OK) return error; // copy FDs back to userland @@ -1217,7 +1217,7 @@ net_stat stat; SyscallRestartWrapper error; error = common_get_next_socket_stat(family, &cookie, &stat); - if (error != (status_t)B_OK) + if (error != B_OK) return error; // copy cookie and data back to userland From bonefish at mail.berlios.de Sat Apr 12 20:42:13 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 12 Apr 2008 20:42:13 +0200 Subject: [Haiku-commits] r24950 - haiku/trunk/build/jam Message-ID: <200804121842.m3CIgDWL009393@sheep.berlios.de> Author: bonefish Date: 2008-04-12 20:42:12 +0200 (Sat, 12 Apr 2008) New Revision: 24950 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24950&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Added unix sockets protocol module. There's still quite some debug output enabled. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-12 17:18:31 UTC (rev 24949) +++ haiku/trunk/build/jam/HaikuImage 2008-04-12 18:42:12 UTC (rev 24950) @@ -78,7 +78,7 @@ BEOS_NETWORK_DATALINK_PROTOCOLS = ethernet_frame arp loopback_frame ipv4_datagram ; #BEOS_NETWORK_PPP = ipcp modem pap pppoe ; -BEOS_NETWORK_PROTOCOLS = ipv4 tcp udp icmp ; +BEOS_NETWORK_PROTOCOLS = ipv4 tcp udp icmp unix ; BEOS_ADD_ONS_ACCELERANTS = $(X86_ONLY)radeon.accelerant $(X86_ONLY)nvidia.accelerant $(X86_ONLY)matrox.accelerant $(X86_ONLY)neomagic.accelerant From anevilyak at mail.berlios.de Sun Apr 13 00:41:22 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 13 Apr 2008 00:41:22 +0200 Subject: [Haiku-commits] r24951 - in haiku/trunk/src: bin/keymap servers/input Message-ID: <200804122241.m3CMfMtl019577@sheep.berlios.de> Author: anevilyak Date: 2008-04-13 00:41:19 +0200 (Sun, 13 Apr 2008) New Revision: 24951 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24951&view=rev Modified: haiku/trunk/src/bin/keymap/Keymap.cpp haiku/trunk/src/bin/keymap/Keymap.h haiku/trunk/src/bin/keymap/main.cpp haiku/trunk/src/servers/input/InputServer.cpp haiku/trunk/src/servers/input/InputServer.h Log: Modified bin/keymap's -h option to write a variable to the generated header indicating the name of the keymap. Correspondingly, modified input_server to use the aforementioned variable in order to write the name attribute to ~/config/Key_map. This allows Keymap prefs to correctly recognize the name of the default keymap on a fresh build. Modified: haiku/trunk/src/bin/keymap/Keymap.cpp =================================================================== --- haiku/trunk/src/bin/keymap/Keymap.cpp 2008-04-12 18:42:12 UTC (rev 24950) +++ haiku/trunk/src/bin/keymap/Keymap.cpp 2008-04-12 22:41:19 UTC (rev 24951) @@ -773,13 +773,22 @@ into the input_server, for example. */ void -Keymap::SaveAsHeader(entry_ref &ref) +Keymap::SaveAsHeader(entry_ref &ref, const char *mapName) { BPath path; status_t err = path.SetTo(&ref); if (err < B_OK) return; + BString name = mapName; + int slashidx = name.FindLast('/'); + if (slashidx > 0) { + // prune off path + name.Remove(0, slashidx + 1); + } + // prune ".keymap" + name.Remove(name.FindLast('.'), 7); + FILE* file = fopen(path.Path(), "w"); fprintf(file, "/*\n" @@ -787,6 +796,7 @@ " * This file is generated automatically. Don't edit!\n" " */\n\n"); fprintf(file, "#include \n\n"); + fprintf(file, "const char *kSystemKeymapName = \"%s\";\n\n", name.String()); fprintf(file, "const key_map kSystemKeymap = {\n"); fprintf(file, "\tversion:%ld,\n", fKeys.version); fprintf(file, "\tcaps_key:0x%lx,\n", fKeys.caps_key); Modified: haiku/trunk/src/bin/keymap/Keymap.h =================================================================== --- haiku/trunk/src/bin/keymap/Keymap.h 2008-04-12 18:42:12 UTC (rev 24950) +++ haiku/trunk/src/bin/keymap/Keymap.h 2008-04-12 22:41:19 UTC (rev 24951) @@ -27,7 +27,7 @@ status_t LoadSource(FILE *f); status_t LoadSourceFromRef(entry_ref &ref); void SaveAsCurrent(); - void SaveAsHeader(entry_ref &ref); + void SaveAsHeader(entry_ref &ref, const char *mapname); status_t Use(); void Dump(); bool IsModifierKey(uint32 keyCode); Modified: haiku/trunk/src/bin/keymap/main.cpp =================================================================== --- haiku/trunk/src/bin/keymap/main.cpp 2008-04-12 18:42:12 UTC (rev 24950) +++ haiku/trunk/src/bin/keymap/main.cpp 2008-04-12 22:41:19 UTC (rev 24951) @@ -117,7 +117,7 @@ } else if (operation == 'h') { Keymap keymap; load_keymap_source(keymap, argv[i]); - keymap.SaveAsHeader(outputRef); + keymap.SaveAsHeader(outputRef, argv[i]); return 0; } else if (operation == 'b') { entry_ref ref; Modified: haiku/trunk/src/servers/input/InputServer.cpp =================================================================== --- haiku/trunk/src/servers/input/InputServer.cpp 2008-04-12 18:42:12 UTC (rev 24950) +++ haiku/trunk/src/servers/input/InputServer.cpp 2008-04-12 22:41:19 UTC (rev 24951) @@ -309,12 +309,12 @@ memcpy(fChars, kSystemKeyChars, fCharsSize); // TODO: why are we doing this? - return _SaveKeymap(); + return _SaveKeymap(true); } status_t -InputServer::_SaveKeymap() +InputServer::_SaveKeymap(bool isDefault) { // we save this keymap to file BPath path; @@ -349,6 +349,12 @@ if ((err = file.Write(fChars, fCharsSize)) < (ssize_t)fCharsSize) return err; + // don't bother reporting an error if this fails, since this isn't fatal + // the keymap will still be functional, and will just be identified as (Current) in prefs instead of its + // actual name + if (isDefault) + file.WriteAttr("keymap:name", B_STRING_TYPE, 0, kSystemKeymapName, strlen(kSystemKeymapName)); + return B_OK; } Modified: haiku/trunk/src/servers/input/InputServer.h =================================================================== --- haiku/trunk/src/servers/input/InputServer.h 2008-04-12 18:42:12 UTC (rev 24950) +++ haiku/trunk/src/servers/input/InputServer.h 2008-04-12 22:41:19 UTC (rev 24951) @@ -173,7 +173,7 @@ status_t _LoadKeymap(); status_t _LoadSystemKeymap(); - status_t _SaveKeymap(); + status_t _SaveKeymap(bool isDefault = false); void _InitKeyboardMouseStates(); status_t _StartEventLoop(); From axeld at pinc-software.de Mon Apr 14 09:02:15 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 14 Apr 2008 09:02:15 +0200 CEST Subject: [Haiku-commits] r24908 - in haiku/trunk: build/jam headers/private/kernel headers/private/net src/add-ons/kernel/network/stack src/bin/network/netstat src/kits/network src/system/kernel/fs In-Reply-To: <20080413183023.1774.4@knochen-vm.1208099803.fake> Message-ID: <591418693-BeMail@zon> Ingo Weinhold wrote: > On 2008-04-13 at 15:53:49 [+0200], philippe.houdoin at free.fr wrote: > > BTW, am I the only one concerned that the recent change remove the > > ability > > to unload the whole net stack modules without rebooting, or did I > > miss > > something? > Currently that doesn't work, since the sockets.cpp kernel file will > keep a > reference to the stack interface module once loaded. If someone needs > it, it > can easily be changed to work like the previous mechanism, i.e. use > reference counting and unload it when unreferenced. That's indeed definitely wanted. Didn't notice yet that it got lost, actually. This allows you to replace protocol and stack modules at runtime without having to reboot. But don't worry, I will add it back in again. Bye, Axel. From axeld at pinc-software.de Mon Apr 14 09:18:16 2008 From: axeld at pinc-software.de (Axel =?iso-8859-15?q?D=F6rfler?=) Date: Mon, 14 Apr 2008 09:18:16 +0200 CEST Subject: [Haiku-commits] =?iso-8859-15?q?r24926_-_haiku/trunk/src/add-ons/?= =?iso-8859-15?q?kernel/bus=5Fmanagers/usb?= In-Reply-To: <200804120610.m3C6Ab7J003711@sheep.berlios.de> Message-ID: <1552177948-BeMail@zon> mmlr at BerliOS wrote: > Log: > Use a list of host controller modules instead of using > open_module_list() and > read_next_module_name(). This is ugly and less flexible but it allows > us to > explicitly force an initialization order. As detailed by the added > comment > there seem to be controllers/BIOSes that require the EHCI controller > to be > initialized after the companion host controller or else they refuse > to publish > any high speed devices. This was the case for bug #1236 and my laptop > when > legacy emulation is enabled and any device was plugged in at boot. > This change > fixed the problem for me and hopefully closes bug #1236 too. Maybe it would be nicer to still use open_module_list(), but leave out ehci when you encounter it, and do it last in any case? Bye, Axel. From axeld at mail.berlios.de Sun Apr 13 04:28:44 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Apr 2008 04:28:44 +0200 Subject: [Haiku-commits] r24952 - haiku/trunk/headers/compatibility/bsd/sys Message-ID: <200804130228.m3D2Sikb015504@sheep.berlios.de> Author: axeld Date: 2008-04-13 04:28:43 +0200 (Sun, 13 Apr 2008) New Revision: 24952 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24952&view=rev Removed: haiku/trunk/headers/compatibility/bsd/sys/time.h Log: This header is no longer necessary, since Ingo added the BSD timer macros to our sys/time.h - this fixes a lot of warnings, too. Deleted: haiku/trunk/headers/compatibility/bsd/sys/time.h From korli at users.berlios.de Mon Apr 14 10:33:15 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Mon, 14 Apr 2008 10:33:15 +0200 Subject: [Haiku-commits] r24951 - in haiku/trunk/src: bin/keymap servers/input In-Reply-To: <200804122241.m3CMfMtl019577@sheep.berlios.de> References: <200804122241.m3CMfMtl019577@sheep.berlios.de> Message-ID: Hi Rene, 2008/4/13, anevilyak at BerliOS : > + file.WriteAttr("keymap:name", B_STRING_TYPE, 0, kSystemKeymapName, strlen(kSystemKeymapName)); Cool! Maybe keymap:name should be defined in a header somewhere (InterfaceDefs.h ?). Bye, J?r?me From mmlr at mlotz.ch Mon Apr 14 11:19:27 2008 From: mmlr at mlotz.ch (Michael Lotz) Date: Mon, 14 Apr 2008 11:19:27 +0200 Subject: [Haiku-commits] r24926 - haiku/trunk/src/add-ons/kernel/bus_managers/usb In-Reply-To: <1552177948-BeMail@zon> Message-ID: <650296761-BeMail@primary> > mmlr at BerliOS wrote: > > Log: > > Use a list of host controller modules instead of using > > open_module_list() and > > read_next_module_name(). This is ugly and less flexible but it > > allows > > us to > > explicitly force an initialization order. As detailed by the added > Maybe it would be nicer to still use open_module_list(), but leave > out > ehci when you encounter it, and do it last in any case? Not really. If this list gets any longer (USB 3.0) then we'd probably want that hci to be loaded last again. I don't think it's much of a problem anyway, as it's really only those three modules. If we filtered out EHCI then there are only two other modules left. That'd be a bit much of an overhead to separate them just for the sake of using open_module_list(). And since we have the luxury of it being open source we don't have to fear that at some point we'd need to binary patch that to something newer ;-) Regards Michael From axeld at mail.berlios.de Sun Apr 13 06:57:17 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Apr 2008 06:57:17 +0200 Subject: [Haiku-commits] r24953 - haiku/trunk/src/preferences/network Message-ID: <200804130457.m3D4vHvF014089@sheep.berlios.de> Author: axeld Date: 2008-04-13 06:57:13 +0200 (Sun, 13 Apr 2008) New Revision: 24953 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24953&view=rev Modified: haiku/trunk/src/preferences/network/EthernetSettingsView.cpp haiku/trunk/src/preferences/network/NetworkWindow.cpp haiku/trunk/src/preferences/network/NetworkWindow.h Log: Some cleanup: * Reordered to have the constructor/destructor first. * Two blanks between functions. * Removed superfluous constructor calls. Modified: haiku/trunk/src/preferences/network/EthernetSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2008-04-13 02:28:43 UTC (rev 24952) +++ haiku/trunk/src/preferences/network/EthernetSettingsView.cpp 2008-04-13 04:57:13 UTC (rev 24953) @@ -1,11 +1,11 @@ /* - * Copyright 2004-2007 Haiku Inc. All rights reserved. + * Copyright 2004-2008 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * - * Author: + * Authors: * Andre Alves Garzia, andre at andregarzia.com - * With code from: - * Axel Dorfler + * Stephan Assmu? + * Axel D?rfler * Hugo Santos */ @@ -79,97 +79,19 @@ } -bool -EthernetSettingsView::_PrepareRequest(struct ifreq& request, const char* name) -{ - // This function is used for talking direct to the stack. - // It's used by _ShowConfiguration. - - if (strlen(name) > IF_NAMESIZE) - return false; +// #pragma mark - - strcpy(request.ifr_name, name); - return true; -} - -void -EthernetSettingsView::_GatherInterfaces() -{ - // iterate over all interfaces and retrieve minimal status - - ifconf config; - config.ifc_len = sizeof(config.ifc_value); - if (ioctl(fSocket, SIOCGIFCOUNT, &config, sizeof(struct ifconf)) < 0) - return; - - uint32 count = (uint32)config.ifc_value; - if (count == 0) - return; - - void* buffer = malloc(count * sizeof(struct ifreq)); - if (buffer == NULL) - return; - - MemoryDeleter deleter(buffer); - - config.ifc_len = count * sizeof(struct ifreq); - config.ifc_buf = buffer; - if (ioctl(fSocket, SIOCGIFCONF, &config, sizeof(struct ifconf)) < 0) - return; - - ifreq* interface = (ifreq*)buffer; - - fInterfaces.MakeEmpty(); - - for (uint32 i = 0; i < count; i++) { - if (strncmp(interface->ifr_name, "loop", 4) && interface->ifr_name[0]) { - fInterfaces.AddItem(new BString(interface->ifr_name)); - fSettings.AddItem(new Settings(interface->ifr_name)); - } - - interface = (ifreq*)((addr_t)interface + IF_NAMESIZE - + interface->ifr_addr.sa_len); - } -} - - -void -EthernetSettingsView::AttachedToWindow() -{ - fApplyButton->SetTarget(this); - fRevertButton->SetTarget(this); - fIPTextControl->SetTarget(this); - fNetMaskTextControl->SetTarget(this); - fGatewayTextControl->SetTarget(this); - fPrimaryDNSTextControl->SetTarget(this); - fSecondaryDNSTextControl->SetTarget(this); - fDeviceMenuField->Menu()->SetTargetForItems(this); - fTypeMenuField->Menu()->SetTargetForItems(this); - - // display settigs of first adapter on startup - _ShowConfiguration(fSettings.ItemAt(0)); -} - - -void -EthernetSettingsView::DetachedFromWindow() -{ -} - - EthernetSettingsView::EthernetSettingsView() - : BView("EthernetSettingsView", 0, NULL) - , fInterfaces() - , fSettings() - , fCurrentSettings(NULL) + : BView("EthernetSettingsView", 0, NULL), + fCurrentSettings(NULL) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fSocket = socket(AF_INET, SOCK_DGRAM, 0); _GatherInterfaces(); - // build the GUI + // build the GUI BGroupLayout* rootLayout = new BGroupLayout(B_VERTICAL); SetLayout(rootLayout); @@ -198,11 +120,11 @@ //modeMenu->AddSeparatorItem(); //BMenuItem* offItem = new BMenuItem("Disabled", NULL); //modeMenu->AddItem(offItem); - + fDeviceMenuField = new BMenuField("Adapter:", deviceMenu); layout->AddItem(fDeviceMenuField->CreateLabelLayoutItem(), 0, 0); layout->AddItem(fDeviceMenuField->CreateMenuBarLayoutItem(), 1, 0); - + fTypeMenuField = new BMenuField("Mode:", modeMenu); layout->AddItem(fTypeMenuField->CreateLabelLayoutItem(), 0, 1); layout->AddItem(fTypeMenuField->CreateMenuBarLayoutItem(), 1, 1); @@ -234,7 +156,7 @@ SetupTextControl(fPrimaryDNSTextControl); layout->AddItem(fPrimaryDNSTextControl->CreateLabelLayoutItem(), 0, 5); layout->AddItem(fPrimaryDNSTextControl->CreateTextViewLayoutItem(), 1, 5); - + fSecondaryDNSTextControl = new BTextControl("DNS #2:", "", NULL); SetupTextControl(fSecondaryDNSTextControl); layout->AddItem(fSecondaryDNSTextControl->CreateLabelLayoutItem(), 0, 6); @@ -257,12 +179,93 @@ rootLayout->AddView(buttonGroup); } + EthernetSettingsView::~EthernetSettingsView() { close(fSocket); } + +bool +EthernetSettingsView::_PrepareRequest(struct ifreq& request, const char* name) +{ + // This function is used for talking direct to the stack. + // It's used by _ShowConfiguration. + + if (strlen(name) > IF_NAMESIZE) + return false; + + strcpy(request.ifr_name, name); + return true; +} + + void +EthernetSettingsView::_GatherInterfaces() +{ + // iterate over all interfaces and retrieve minimal status + + ifconf config; + config.ifc_len = sizeof(config.ifc_value); + if (ioctl(fSocket, SIOCGIFCOUNT, &config, sizeof(struct ifconf)) < 0) + return; + + uint32 count = (uint32)config.ifc_value; + if (count == 0) + return; + + void* buffer = malloc(count * sizeof(struct ifreq)); + if (buffer == NULL) + return; + + MemoryDeleter deleter(buffer); + + config.ifc_len = count * sizeof(struct ifreq); + config.ifc_buf = buffer; + if (ioctl(fSocket, SIOCGIFCONF, &config, sizeof(struct ifconf)) < 0) + return; + + ifreq* interface = (ifreq*)buffer; + + fInterfaces.MakeEmpty(); + + for (uint32 i = 0; i < count; i++) { + if (strncmp(interface->ifr_name, "loop", 4) && interface->ifr_name[0]) { + fInterfaces.AddItem(new BString(interface->ifr_name)); + fSettings.AddItem(new Settings(interface->ifr_name)); + } + + interface = (ifreq*)((addr_t)interface + IF_NAMESIZE + + interface->ifr_addr.sa_len); + } +} + + +void +EthernetSettingsView::AttachedToWindow() +{ + fApplyButton->SetTarget(this); + fRevertButton->SetTarget(this); + fIPTextControl->SetTarget(this); + fNetMaskTextControl->SetTarget(this); + fGatewayTextControl->SetTarget(this); + fPrimaryDNSTextControl->SetTarget(this); + fSecondaryDNSTextControl->SetTarget(this); + fDeviceMenuField->Menu()->SetTargetForItems(this); + fTypeMenuField->Menu()->SetTargetForItems(this); + + // display settigs of first adapter on startup + _ShowConfiguration(fSettings.ItemAt(0)); +} + + +void +EthernetSettingsView::DetachedFromWindow() +{ +} + + +void EthernetSettingsView::_ShowConfiguration(Settings* settings) { fCurrentSettings = settings; @@ -299,7 +302,7 @@ if (settings->fNameservers.CountItems() >= 2) { fSecondaryDNSTextControl->SetText( settings->fNameservers.ItemAt(1)->String()); - } + } if (settings->fNameservers.CountItems() >= 1) { fPrimaryDNSTextControl->SetText( @@ -340,9 +343,9 @@ fPrimaryDNSTextControl->Text())); fCurrentSettings->fNameservers.AddItem(new BString( fSecondaryDNSTextControl->Text())); - + fApplyButton->SetEnabled(false); - fRevertButton->SetEnabled(true); + fRevertButton->SetEnabled(true); } @@ -390,7 +393,7 @@ status_t status = _GetPath("interfaces", path); if (status < B_OK) return; - + FILE* fp = NULL; // loop over all adapters. open the settings file only once, // append the settins of each non-autoconfiguring adapter @@ -410,11 +413,11 @@ fprintf(fp, "interface %s {\n\t\taddress {\n", fSettings.ItemAt(i)->GetName()); fprintf(fp, "\t\t\tfamily\tinet\n"); - fprintf(fp, "\t\t\taddress\t%s\n", + fprintf(fp, "\t\t\taddress\t%s\n", fSettings.ItemAt(i)->GetIP()); - fprintf(fp, "\t\t\tgateway\t%s\n", + fprintf(fp, "\t\t\tgateway\t%s\n", fSettings.ItemAt(i)->GetGateway()); - fprintf(fp, "\t\t\tmask\t%s\n", + fprintf(fp, "\t\t\tmask\t%s\n", fSettings.ItemAt(i)->GetNetmask()); fprintf(fp, "\t\t}\n}\n\n"); } Modified: haiku/trunk/src/preferences/network/NetworkWindow.cpp =================================================================== --- haiku/trunk/src/preferences/network/NetworkWindow.cpp 2008-04-13 02:28:43 UTC (rev 24952) +++ haiku/trunk/src/preferences/network/NetworkWindow.cpp 2008-04-13 04:57:13 UTC (rev 24953) @@ -1,18 +1,16 @@ /* - * Copyright 2004-2007 Haiku Inc. All rights reserved. + * Copyright 2004-2008 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Author: * Andre Alves Garzia, andre at andregarzia.com - * With code from: - * Axel Dorfler - * Hugo Santos */ +#include "NetworkWindow.h" + #include #include -#include "NetworkWindow.h" #include "EthernetSettingsView.h" @@ -22,11 +20,16 @@ | B_AUTO_UPDATE_SIZE_LIMITS) { SetLayout(new BGroupLayout(B_HORIZONTAL)); - fEthView = new EthernetSettingsView(); - GetLayout()->AddView(fEthView); + fEthernetView = new EthernetSettingsView(); + GetLayout()->AddView(fEthernetView); } - + +NetworkWindow::~NetworkWindow() +{ +} + + void NetworkWindow::MessageReceived(BMessage* message) { @@ -37,11 +40,7 @@ } -NetworkWindow::~NetworkWindow() -{ -} - bool NetworkWindow::QuitRequested() { Modified: haiku/trunk/src/preferences/network/NetworkWindow.h =================================================================== --- haiku/trunk/src/preferences/network/NetworkWindow.h 2008-04-13 02:28:43 UTC (rev 24952) +++ haiku/trunk/src/preferences/network/NetworkWindow.h 2008-04-13 04:57:13 UTC (rev 24953) @@ -1,30 +1,28 @@ /* - * Copyright 2004-2007 Haiku Inc. All rights reserved. + * Copyright 2004-2008 Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. * * Author: * Andre Alves Garzia, andre at andregarzia.com - * With code from: - * Axel Dorfler - * Hugo Santos */ #ifndef NETWORK_WINDOW_H #define NETWORK_WINDOW_H + #include + #include "EthernetSettingsView.h" + class NetworkWindow : public BWindow { - public: - NetworkWindow(); - virtual ~NetworkWindow(); - virtual bool QuitRequested(); - virtual void MessageReceived(BMessage* mesage); +public: + NetworkWindow(); + virtual ~NetworkWindow(); + virtual bool QuitRequested(); + virtual void MessageReceived(BMessage* mesage); - private: - EthernetSettingsView *fEthView; - +private: + EthernetSettingsView* fEthernetView; }; - -#endif /* NETWORK_WINDOW_H */ +#endif /* NETWORK_WINDOW_H */ From mmlr at mail.berlios.de Sun Apr 13 07:56:10 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 13 Apr 2008 07:56:10 +0200 Subject: [Haiku-commits] r24954 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200804130556.m3D5uAup007007@sheep.berlios.de> Author: mmlr Date: 2008-04-13 07:56:10 +0200 (Sun, 13 Apr 2008) New Revision: 24954 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24954&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp Log: * Initialize all of the fields in the UHCI class so in case of an error in the constructor the object can be safely deleted (as documented for bug #1473) * Some simplifications by caching the Pipe object for a transfer * Minor cleanup Modified: haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-13 04:57:13 UTC (rev 24953) +++ haiku/trunk/src/add-ons/kernel/busses/usb/uhci.cpp 2008-04-13 05:56:10 UTC (rev 24954) @@ -292,14 +292,19 @@ fStack(stack), fFrameArea(-1), fFrameList(NULL), + fFrameBandwidth(NULL), + fFirstIsochronousDescriptor(NULL), + fLastIsochronousDescriptor(NULL), fQueueCount(0), fQueues(NULL), fFirstTransfer(NULL), fLastTransfer(NULL), + fFinishTransfersSem(-1), fFinishThread(-1), fStopFinishThread(false), fFirstIsochronousTransfer(NULL), fLastIsochronousTransfer(NULL), + fFinishIsochronousTransfersSem(-1), fFinishIsochronousThread(-1), fStopFinishIsochronousThread(false), fRootHub(NULL), @@ -561,16 +566,17 @@ UHCI::SubmitTransfer(Transfer *transfer) { // Short circuit the root hub - if (transfer->TransferPipe()->DeviceAddress() == fRootHubAddress) + Pipe *pipe = transfer->TransferPipe(); + if (pipe->DeviceAddress() == fRootHubAddress) return fRootHub->ProcessTransfer(this, transfer); TRACE(("usb_uhci: submit transfer called for device %d\n", - transfer->TransferPipe()->DeviceAddress())); - if (transfer->TransferPipe()->Type() & USB_OBJECT_CONTROL_PIPE) + pipe->DeviceAddress())); + if (pipe->Type() & USB_OBJECT_CONTROL_PIPE) return SubmitRequest(transfer); // Process isochronous transfers - if (transfer->TransferPipe()->Type() & USB_OBJECT_ISO_PIPE) + if (pipe->Type() & USB_OBJECT_ISO_PIPE) return SubmitIsochronous(transfer); uhci_td *firstDescriptor = NULL; @@ -581,12 +587,10 @@ return result; Queue *queue = NULL; - Pipe *pipe = transfer->TransferPipe(); - if (pipe->Type() & USB_OBJECT_INTERRUPT_PIPE) { + if (pipe->Type() & USB_OBJECT_INTERRUPT_PIPE) queue = fQueues[UHCI_INTERRUPT_QUEUE]; - } else { + else queue = fQueues[UHCI_BULK_QUEUE]; - } bool directionIn = (pipe->Direction() == Pipe::In); result = AddPendingTransfer(transfer, queue, transferQueue, @@ -727,11 +731,10 @@ } Queue *queue = NULL; - if (pipe->Speed() == USB_SPEED_LOWSPEED) { + if (pipe->Speed() == USB_SPEED_LOWSPEED) queue = fQueues[UHCI_LOW_SPEED_CONTROL_QUEUE]; - } else { + else queue = fQueues[UHCI_FULL_SPEED_CONTROL_QUEUE]; - } uhci_qh *transferQueue = CreateTransferQueue(setupDescriptor); status_t result = AddPendingTransfer(transfer, queue, transferQueue, @@ -844,8 +847,7 @@ packetSize /= isochronousData->packet_count; uint16 currentFrame; - if (packetSize > pipe->MaxPacketSize()) - { + if (packetSize > pipe->MaxPacketSize()) { TRACE_ERROR(("usb_uhci: isochronous packetSize is bigger" " than pipe MaxPacketSize\n")); return B_BAD_VALUE; From axeld at mail.berlios.de Sun Apr 13 08:02:46 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Apr 2008 08:02:46 +0200 Subject: [Haiku-commits] r24955 - haiku/trunk/src/apps/activitymonitor Message-ID: <200804130602.m3D62koI007487@sheep.berlios.de> Author: axeld Date: 2008-04-13 08:02:45 +0200 (Sun, 13 Apr 2008) New Revision: 24955 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24955&view=rev Modified: haiku/trunk/src/apps/activitymonitor/ActivityView.cpp haiku/trunk/src/apps/activitymonitor/ActivityView.h haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp haiku/trunk/src/apps/activitymonitor/ActivityWindow.h haiku/trunk/src/apps/activitymonitor/DataSource.cpp haiku/trunk/src/apps/activitymonitor/DataSource.h haiku/trunk/src/apps/activitymonitor/Jamfile haiku/trunk/src/apps/activitymonitor/SystemInfo.cpp haiku/trunk/src/apps/activitymonitor/SystemInfo.h Log: Some more work on the ActivityMonitor: * Added legend. * Added network receiving/sending DataSource. * Now uses the new layout engine. * Added support for per CPU DataSources, and added a per CPU CPU usage DataSource. * The DataSources can now be turned on and off via popup menu. * You can now add more than one view to the window. * The DataSources of the ActivityViews are now remembered. * Now uses an offscreen bitmap to reduce flicker (it should now no longer flicker with accelerated graphics). Modified: haiku/trunk/src/apps/activitymonitor/ActivityView.cpp =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityView.cpp 2008-04-13 05:56:10 UTC (rev 24954) +++ haiku/trunk/src/apps/activitymonitor/ActivityView.cpp 2008-04-13 06:02:45 UTC (rev 24955) @@ -32,6 +32,7 @@ const uint32 kMsgRefresh = 'refr'; const uint32 kMsgToggleDataSource = 'tgds'; +const uint32 kMsgToggleLegend = 'tglg'; extern const char* kSignature; @@ -123,12 +124,11 @@ ActivityView::ActivityView(BRect frame, const char* name, - const BMessage& settings, uint32 resizingMode) + const BMessage* settings, uint32 resizingMode) : BView(frame, name, resizingMode, - B_WILL_DRAW | B_SUBPIXEL_PRECISE | B_FULL_UPDATE_ON_RESIZE - | B_FRAME_EVENTS) + B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS) { - _Init(&settings); + _Init(settings); BRect rect(Bounds()); rect.top = rect.bottom - 7; @@ -139,6 +139,20 @@ } +ActivityView::ActivityView(const char* name, const BMessage* settings) + : BView(name, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE | B_FRAME_EVENTS) +{ + _Init(settings); + + BRect rect(Bounds()); + rect.top = rect.bottom - 7; + rect.left = rect.right - 7; + BDragger* dragger = new BDragger(rect, this, + B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); + AddChild(dragger); +} + + ActivityView::ActivityView(BMessage* archive) : BView(archive) { @@ -148,6 +162,7 @@ ActivityView::~ActivityView() { + delete fOffscreen; } @@ -155,17 +170,29 @@ ActivityView::_Init(const BMessage* settings) { fBackgroundColor = (rgb_color){255, 255, 240}; - SetLowColor(fBackgroundColor); + fOffscreen = NULL; + SetViewColor(B_TRANSPARENT_COLOR); + SetLowColor(ui_color(B_PANEL_BACKGROUND_COLOR)); fRefreshInterval = kInitialRefreshInterval; fDrawInterval = kInitialRefreshInterval * 2; fLastRefresh = 0; fDrawResolution = 1; - AddDataSource(new UsedMemoryDataSource()); - AddDataSource(new CachedMemoryDataSource()); - AddDataSource(new ThreadsDataSource()); - AddDataSource(new CpuUsageDataSource()); + if (settings == NULL + || settings->FindBool("show legend", &fShowLegend) != B_OK) + fShowLegend = true; + + if (settings == NULL) { + AddDataSource(new UsedMemoryDataSource()); + AddDataSource(new CachedMemoryDataSource()); + return; + } + + const char* name; + for (int32 i = 0; settings->FindString("source", i, &name) == B_OK; i++) { + AddDataSource(DataSource::FindSource(name)); + } } @@ -203,16 +230,30 @@ status_t ActivityView::SaveState(BMessage& state) const { - return B_ERROR; + status_t status = state.AddBool("show legend", fShowLegend); + if (status != B_OK) + return status; + + for (int32 i = 0; i < fSources.CountItems(); i++) { + DataSource* source = fSources.ItemAt(i); + + if (!source->PerCPU() || source->CPU() == 0) + status = state.AddString("source", source->Name()); + if (status != B_OK) + return status; + + // TODO: save and restore color as well + } + return B_OK; } DataSource* -ActivityView::FindDataSource(const char* name) +ActivityView::FindDataSource(const DataSource* search) { for (int32 i = fSources.CountItems(); i-- > 0;) { DataSource* source = fSources.ItemAt(i); - if (!strcmp(source->Label(), name)) + if (!strcmp(source->Name(), search->Name())) return source; } @@ -221,39 +262,74 @@ status_t -ActivityView::AddDataSource(DataSource* source) +ActivityView::AddDataSource(const DataSource* source) { - DataHistory* values = new(std::nothrow) DataHistory(10 * 60000000LL, - fRefreshInterval); - if (values == NULL) - return B_NO_MEMORY; - if (!fValues.AddItem(values)) { - delete values; - return B_NO_MEMORY; + if (source == NULL) + return B_BAD_VALUE; + + int32 insert = DataSource::IndexOf(source); + for (int32 i = 0; i < fSources.CountItems() && i < insert; i++) { + DataSource* before = fSources.ItemAt(i); + if (DataSource::IndexOf(before) > insert) { + insert = i; + break; + } } + if (insert > fSources.CountItems()) + insert = fSources.CountItems(); - if (!fSources.AddItem(source)) { - fValues.RemoveItem(values); - delete values; - return B_NO_MEMORY; + uint32 count = 1; + if (source->PerCPU()) { + SystemInfo info; + count = info.CPUCount(); } + for (uint32 i = 0; i < count; i++) { + DataHistory* values = new(std::nothrow) DataHistory(10 * 60000000LL, + fRefreshInterval); + if (values == NULL) + return B_NO_MEMORY; + + if (!fValues.AddItem(values, insert + i)) { + delete values; + return B_NO_MEMORY; + } + + DataSource* copy; + if (source->PerCPU()) + copy = source->CopyForCPU(i); + else + copy = source->Copy(); + + if (!fSources.AddItem(copy, insert + i)) { + fValues.RemoveItem(values); + delete values; + return B_NO_MEMORY; + } + } + return B_OK; } status_t -ActivityView::RemoveDataSource(DataSource* source) +ActivityView::RemoveDataSource(const DataSource* remove) { - int32 index = fSources.IndexOf(source); - if (index < 0) - return B_ENTRY_NOT_FOUND; + while (true) { + DataSource* source = FindDataSource(remove); + if (source == NULL) + return B_OK; - fSources.RemoveItemAt(index); - delete source; - DataHistory* values = fValues.RemoveItemAt(index); - delete values; + int32 index = fSources.IndexOf(source); + if (index < 0) + return B_ENTRY_NOT_FOUND; + fSources.RemoveItemAt(index); + delete source; + DataHistory* values = fValues.RemoveItemAt(index); + delete values; + } + return B_OK; } @@ -271,6 +347,8 @@ { BMessage refresh(kMsgRefresh); fRunner = new BMessageRunner(this, &refresh, fRefreshInterval); + + FrameResized(Bounds().Width(), Bounds().Height()); } @@ -281,13 +359,51 @@ } +BSize +ActivityView::MinSize() +{ + BSize size(32, 32); + if (fShowLegend) + size.height = _LegendFrame().Height(); + + return size; +} + + void ActivityView::FrameResized(float /*width*/, float /*height*/) { + _UpdateOffscreenBitmap(); } void +ActivityView::_UpdateOffscreenBitmap() +{ + BRect frame = _HistoryFrame(); + if (fOffscreen != NULL && frame == fOffscreen->Bounds()) + return; + + delete fOffscreen; + + // create offscreen bitmap + + fOffscreen = new(std::nothrow) BBitmap(frame, B_BITMAP_ACCEPTS_VIEWS, + B_RGB32); + if (fOffscreen == NULL || fOffscreen->InitCheck() != B_OK) { + delete fOffscreen; + fOffscreen = NULL; + return; + } + + BView* view = new BView(frame, NULL, B_FOLLOW_NONE, B_SUBPIXEL_PRECISE); + view->SetViewColor(fBackgroundColor); + view->SetLowColor(view->ViewColor()); + fOffscreen->AddChild(view); +} + + +void ActivityView::MouseDown(BPoint where) { #if 0 @@ -301,21 +417,30 @@ BPopUpMenu *menu = new BPopUpMenu(B_EMPTY_STRING, false, false); menu->SetFont(be_plain_font); + + SystemInfo info; BMenuItem* item; for (int32 i = 0; i < DataSource::CountSources(); i++) { const DataSource* source = DataSource::SourceAt(i); + if (source->MultiCPUOnly() && info.CPUCount() == 1) + continue; + BMessage* message = new BMessage(kMsgToggleDataSource); message->AddInt32("index", i); - item = new BMenuItem(source->Label(), message); - if (FindDataSource(source->Label())) + item = new BMenuItem(source->Name(), message); + if (FindDataSource(source)) item->SetMarked(true); menu->AddItem(item); } + menu->AddSeparatorItem(); + menu->AddItem(new BMenuItem(fShowLegend ? "Hide Legend" : "Show Legend", + new BMessage(kMsgToggleLegend))); + menu->SetTargetForItems(this); ConvertToScreen(&where); @@ -353,9 +478,9 @@ if (baseSource == NULL) break; - DataSource* source = FindDataSource(baseSource->Label()); + DataSource* source = FindDataSource(baseSource); if (source == NULL) - AddDataSource(baseSource->Copy()); + AddDataSource(baseSource); else RemoveDataSource(source); @@ -363,6 +488,11 @@ break; } + case kMsgToggleLegend: + fShowLegend = !fShowLegend; + Invalidate(); + break; + case B_MOUSE_WHEEL_CHANGED: { float deltaY = 0.0f; @@ -391,6 +521,56 @@ } +BRect +ActivityView::_HistoryFrame() const +{ + if (!fShowLegend) + return Bounds(); + + BRect frame = Bounds(); + BRect legendFrame = _LegendFrame(); + + frame.bottom = legendFrame.top - 1; + + return frame; +} + + +BRect +ActivityView::_LegendFrame() const +{ + BRect frame = Bounds(); + font_height fontHeight; + GetFontHeight(&fontHeight); + + int32 rows = (fSources.CountItems() + 1) / 2; + frame.top = frame.bottom - rows * (4 + ceilf(fontHeight.ascent) + + ceilf(fontHeight.descent) + ceilf(fontHeight.leading)); + + return frame; +} + + +BRect +ActivityView::_LegendFrameAt(BRect frame, int32 index) const +{ + int32 column = index & 1; + int32 row = index / 2; + if (column == 0) + frame.right = frame.left + floorf(frame.Width() / 2) - 5; + else + frame.left = frame.right - floorf(frame.Width() / 2) + 5; + + int32 rows = (fSources.CountItems() + 1) / 2; + float height = floorf((frame.Height() - 5) / rows); + + frame.top = frame.top + 5 + row * height; + frame.bottom = frame.top + height - 1; + + return frame; +} + + float ActivityView::_PositionForValue(DataSource* source, DataHistory* values, int64 value) @@ -408,14 +588,25 @@ if (value < min) value = min; - float height = Bounds().Height(); + float height = _HistoryFrame().Height(); return height - (value - min) * height / (max - min); } void -ActivityView::Draw(BRect /*updateRect*/) +ActivityView::_DrawHistory() { + _UpdateOffscreenBitmap(); + + BView* view = this; + if (fOffscreen != NULL) { + fOffscreen->Lock(); + view = fOffscreen->ChildAt(0); + } + + BRect frame = _HistoryFrame(); + view->FillRect(frame, B_SOLID_LOW); + uint32 step = 2; uint32 resolution = fDrawResolution; if (fDrawResolution > 1) { @@ -423,21 +614,28 @@ resolution--; } - uint32 width = Bounds().IntegerWidth() - 10; + uint32 width = frame.IntegerWidth() - 10; uint32 steps = width / step; bigtime_t timeStep = fRefreshInterval * resolution; bigtime_t now = system_time(); - SetPenSize(2); + view->SetPenSize(1); + view->SetHighColor(tint_color(view->ViewColor(), B_DARKEN_2_TINT)); + view->StrokeRect(frame); + view->StrokeLine(BPoint(frame.left, frame.top + frame.Height() / 2), + BPoint(frame.right, frame.top + frame.Height() / 2)); + + view->SetPenSize(2); + for (uint32 i = fSources.CountItems(); i-- > 0;) { DataSource* source = fSources.ItemAt(i); DataHistory* values = fValues.ItemAt(i); bigtime_t time = now - steps * timeStep; // for now steps pixels per second - BeginLineArray(steps); - SetHighColor(source->Color()); + view->BeginLineArray(steps); + view->SetHighColor(source->Color()); float lastY = FLT_MIN; uint32 lastX = 0; @@ -462,21 +660,76 @@ } float y = _PositionForValue(source, values, value); - if (lastY != FLT_MIN) - AddLine(BPoint(lastX, lastY), BPoint(x, y), source->Color()); + if (lastY != FLT_MIN) { + view->AddLine(BPoint(lastX, lastY), BPoint(x, y), + source->Color()); + } lastX = x; lastY = y; } - EndLineArray(); + view->EndLineArray(); } // TODO: add marks when an app started or quit + view->Sync(); + if (fOffscreen != NULL) { + fOffscreen->Unlock(); + DrawBitmap(fOffscreen); + } } void +ActivityView::Draw(BRect /*updateRect*/) +{ + _DrawHistory(); + + if (!fShowLegend) + return; + + // draw legend + + BRect legendFrame = _LegendFrame(); + FillRect(legendFrame, B_SOLID_LOW); + + font_height fontHeight; + GetFontHeight(&fontHeight); + + for (int32 i = 0; i < fSources.CountItems(); i++) { + DataSource* source = fSources.ItemAt(i); + DataHistory* values = fValues.ItemAt(i); + BRect frame = _LegendFrameAt(legendFrame, i); + + // draw color box + BRect colorBox = frame.InsetByCopy(2, 2); + colorBox.right = colorBox.left + colorBox.Height(); + SetHighColor(tint_color(source->Color(), B_DARKEN_1_TINT)); + StrokeRect(colorBox); + SetHighColor(source->Color()); + colorBox.InsetBy(1, 1); + FillRect(colorBox); + + // show current value and label + float y = frame.top + ceilf(fontHeight.ascent); + int64 value = values->ValueAt(values->End()); + BString text; + source->Print(text, value); + float width = StringWidth(text.String()); + + BString label = source->Label(); + TruncateString(&label, B_TRUNCATE_MIDDLE, + frame.right - colorBox.right - 12 - width); + + SetHighColor(ui_color(B_CONTROL_TEXT_COLOR)); + DrawString(label.String(), BPoint(6 + colorBox.right, y)); + DrawString(text.String(), BPoint(frame.right - width, y)); + } +} + + +void ActivityView::_Refresh() { SystemInfo info; Modified: haiku/trunk/src/apps/activitymonitor/ActivityView.h =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityView.h 2008-04-13 05:56:10 UTC (rev 24954) +++ haiku/trunk/src/apps/activitymonitor/ActivityView.h 2008-04-13 06:02:45 UTC (rev 24955) @@ -11,6 +11,7 @@ #include "CircularBuffer.h" +class BBitmap; class BMessageRunner; class DataSource; struct data_item; @@ -43,7 +44,9 @@ class ActivityView : public BView { public: ActivityView(BRect frame, const char* name, - const BMessage& settings, uint32 resizingMode); + const BMessage* settings, uint32 resizingMode); + ActivityView(const char* name, + const BMessage* settings); ActivityView(BMessage* archive); virtual ~ActivityView(); @@ -52,15 +55,17 @@ status_t SaveState(BMessage& state) const; - DataSource* FindDataSource(const char* name); - status_t AddDataSource(DataSource* source); - status_t RemoveDataSource(DataSource* source); + DataSource* FindDataSource(const DataSource* source); + status_t AddDataSource(const DataSource* source); + status_t RemoveDataSource(const DataSource* source); void RemoveAllDataSources(); protected: virtual void AttachedToWindow(); virtual void DetachedFromWindow(); + virtual BSize MinSize(); + virtual void FrameResized(float width, float height); virtual void MouseDown(BPoint where); virtual void MouseMoved(BPoint where, uint32 transit, @@ -73,10 +78,16 @@ private: void _Init(const BMessage* settings); void _Refresh(); + void _UpdateOffscreenBitmap(); + BRect _HistoryFrame() const; + BRect _LegendFrame() const; + BRect _LegendFrameAt(BRect frame, int32 index) const; float _PositionForValue(DataSource* source, DataHistory* values, int64 value); + void _DrawHistory(); rgb_color fBackgroundColor; + BBitmap* fOffscreen; BObjectList fSources; BObjectList fValues; BMessageRunner* fRunner; @@ -84,6 +95,7 @@ bigtime_t fLastRefresh; bigtime_t fDrawInterval; int32 fDrawResolution; + bool fShowLegend; }; #endif // ACTIVITY_VIEW_H Modified: haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp 2008-04-13 05:56:10 UTC (rev 24954) +++ haiku/trunk/src/apps/activitymonitor/ActivityWindow.cpp 2008-04-13 06:02:45 UTC (rev 24955) @@ -11,6 +11,7 @@ #include #include #include +#include #include #include #include @@ -21,6 +22,10 @@ #include "ActivityView.h" +const uint32 kMsgAddView = 'advw'; +const uint32 kMsgRemoveView = 'rmvw'; + + ActivityWindow::ActivityWindow() : BWindow(BRect(100, 100, 500, 250), "ActivityMonitor", B_TITLED_WINDOW, B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE) @@ -32,24 +37,34 @@ if (settings.FindRect("window frame", &frame) == B_OK) { MoveTo(frame.LeftTop()); ResizeTo(frame.Width(), frame.Height()); - frame.OffsetTo(B_ORIGIN); - } else - frame = Bounds(); + } + BGroupLayout* layout = new BGroupLayout(B_VERTICAL); + SetLayout(layout); + // create GUI - BMenuBar* menuBar = new BMenuBar(Bounds(), "menu"); - AddChild(menuBar); + BMenuBar* menuBar = new BMenuBar("menu"); + layout->AddView(menuBar); - frame.top = menuBar->Frame().bottom; + fLayout = new BGroupLayout(B_VERTICAL); + float inset = ceilf(be_plain_font->Size() * 0.7); + fLayout->SetInsets(inset, inset, inset, inset); + fLayout->SetSpacing(inset); - BView* top = new BView(frame, NULL, B_FOLLOW_ALL, B_WILL_DRAW); + BView* top = new BView("top", 0, fLayout); top->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - AddChild(top); + layout->AddView(top); - fActivityView = new ActivityView(top->Bounds().InsetByCopy(10, 10), - "ActivityMonitor", settings, B_FOLLOW_ALL); - top->AddChild(fActivityView); + BMessage viewState; + int32 count = 0; + for (int32 i = 0; settings.FindMessage("activity view", i, &viewState) + == B_OK; i++) { + fLayout->AddView(new ActivityView("ActivityMonitor", &viewState)); + count++; + } + if (count == 0) + fLayout->AddView(new ActivityView("ActivityMonitor", NULL)); // add menu @@ -57,6 +72,11 @@ BMenu* menu = new BMenu("File"); BMenuItem* item; + menu->AddItem(new BMenuItem("Add View", new BMessage(kMsgAddView))); + menu->AddItem(fRemoveItem = new BMenuItem("Remove View", + new BMessage(kMsgRemoveView))); + menu->AddSeparatorItem(); + menu->AddItem(item = new BMenuItem("About ActivityMonitor" B_UTF8_ELLIPSIS, new BMessage(B_ABOUT_REQUESTED))); menu->AddSeparatorItem(); @@ -65,6 +85,8 @@ menu->SetTargetForItems(this); item->SetTarget(be_app); menuBar->AddItem(menu); + + _UpdateRemoveItem(); } @@ -109,6 +131,26 @@ BMessage settings('actm'); status = settings.AddRect("window frame", Frame()); + if (status != B_OK) + return status; + + BView* top = GetLayout()->View(); + int32 count = top->CountChildren(); + for (int32 i = 0; i < count; i++) { + ActivityView* view = dynamic_cast(top->ChildAt(i)); + if (view == NULL) + continue; + + BMessage* viewState = new BMessage; + status = view->SaveState(*viewState); + if (status == B_OK) + status = settings.AddMessage("activity view", viewState); + if (status != B_OK) { + delete viewState; + break; + } + } + if (status == B_OK) status = settings.Flatten(&file); @@ -117,6 +159,16 @@ void +ActivityWindow::_UpdateRemoveItem() +{ + BView* view = fLayout->View(); + int32 count = view->CountChildren(); + + fRemoveItem->SetEnabled(count >= 2); +} + + +void ActivityWindow::_MessageDropped(BMessage* message) { entry_ref ref; @@ -140,6 +192,32 @@ _MessageDropped(message); break; + case kMsgAddView: + { + BView* view = fLayout->View()->ChildAt(0); + fLayout->AddView(new ActivityView("ActivityMonitor", NULL)); + if (view != NULL) + ResizeBy(0, view->Bounds().Height() + fLayout->Spacing()); + _UpdateRemoveItem(); + break; + } + + case kMsgRemoveView: + { + BView* view = fLayout->View(); + int32 count = view->CountChildren(); + if (count == 1) + return; + + BView* last = view->ChildAt(count - 1); + fLayout->RemoveView(last); + ResizeBy(0, -last->Bounds().Height() - fLayout->Spacing()); + delete last; + + _UpdateRemoveItem(); + break; + } + default: BWindow::MessageReceived(message); break; Modified: haiku/trunk/src/apps/activitymonitor/ActivityWindow.h =================================================================== --- haiku/trunk/src/apps/activitymonitor/ActivityWindow.h 2008-04-13 05:56:10 UTC (rev 24954) +++ haiku/trunk/src/apps/activitymonitor/ActivityWindow.h 2008-04-13 06:02:45 UTC (rev 24955) @@ -9,6 +9,8 @@ #include class BFile; +class BGroupLayout; +class BMenuItem; class ActivityView; @@ -25,9 +27,11 @@ status_t _LoadSettings(BMessage& settings); status_t _SaveSettings(); + void _UpdateRemoveItem(); void _MessageDropped(BMessage *message); - ActivityView* fActivityView; + BGroupLayout* fLayout; + BMenuItem* fRemoveItem; }; #endif // ACTIVITY_WINDOW_H Modified: haiku/trunk/src/apps/activitymonitor/DataSource.cpp =================================================================== --- haiku/trunk/src/apps/activitymonitor/DataSource.cpp 2008-04-13 05:56:10 UTC (rev 24954) +++ haiku/trunk/src/apps/activitymonitor/DataSource.cpp 2008-04-13 06:02:45 UTC (rev 24955) @@ -18,7 +18,10 @@ new UsedMemoryDataSource(), new CachedMemoryDataSource(), new ThreadsDataSource(), - new CpuUsageDataSource(), + new CPUUsageDataSource(), + new CPUCombinedUsageDataSource(), + new NetworkUsageDataSource(true), + new NetworkUsageDataSource(false) }; const size_t kSourcesCount = sizeof(kSources) / sizeof(kSources[0]); @@ -65,6 +68,13 @@ } +DataSource* +DataSource::CopyForCPU(int32 cpu) const +{ + return Copy(); +} + + int64 DataSource::Minimum() const { @@ -124,6 +134,13 @@ const char* +DataSource::Name() const +{ + return Label(); +} + + +const char* DataSource::Label() const { return ""; @@ -151,6 +168,27 @@ } +int32 +DataSource::CPU() const +{ + return 0; +} + + +bool +DataSource::PerCPU() const +{ + return false; +} + + +bool +DataSource::MultiCPUOnly() const +{ + return false; +} + + /*static*/ int32 DataSource::CountSources() { @@ -168,6 +206,33 @@ } +/*static*/ const DataSource* +DataSource::FindSource(const char* name) +{ + for (uint32 i = 0; i < kSourcesCount; i++) { + const DataSource* source = kSources[i]; + if (!strcmp(source->Name(), name)) + return source; + } + + return NULL; +} + + +/*static*/ int32 +DataSource::IndexOf(const DataSource* source) +{ + const char* name = source->Name(); + + for (uint32 i = 0; i < kSourcesCount; i++) { + if (!strcmp(kSources[i]->Name(), name)) + return i; + } + + return -1; +} + + // #pragma mark - @@ -189,7 +254,7 @@ MemoryDataSource::Print(BString& text, int64 value) const { char buffer[32]; - snprintf(buffer, sizeof(buffer), "%.1g MB", value / 1048576.0); + snprintf(buffer, sizeof(buffer), "%.1f MB", value / 1048576.0); text = buffer; } @@ -232,7 +297,7 @@ const char* UsedMemoryDataSource::Label() const { - return "Available Memory"; + return "Used Memory"; } @@ -321,7 +386,7 @@ // #pragma mark - -CpuUsageDataSource::CpuUsageDataSource() +CPUUsageDataSource::CPUUsageDataSource(int32 cpu) : fPreviousActive(0), fPreviousTime(0) @@ -329,41 +394,170 @@ fMinimum = 0; fMaximum = 1000; + _SetCPU(cpu); +} + + +CPUUsageDataSource::CPUUsageDataSource(const CPUUsageDataSource& other) + : DataSource(other) +{ + fPreviousActive = other.fPreviousActive; + fPreviousTime = other.fPreviousTime; + fCPU = other.fCPU; + fLabel = other.fLabel; +} + + +CPUUsageDataSource::~CPUUsageDataSource() +{ +} + + +DataSource* +CPUUsageDataSource::Copy() const +{ + return new CPUUsageDataSource(*this); +} + + +DataSource* +CPUUsageDataSource::CopyForCPU(int32 cpu) const +{ + CPUUsageDataSource* copy = new CPUUsageDataSource(*this); + copy->_SetCPU(cpu); + + return copy; +} + + +void +CPUUsageDataSource::Print(BString& text, int64 value) const +{ + char buffer[32]; + snprintf(buffer, sizeof(buffer), "%.1f%%", value / 10.0); + + text = buffer; +} + + +int64 +CPUUsageDataSource::NextValue(SystemInfo& info) +{ + bigtime_t active = info.Info().cpu_infos[fCPU].active_time; + + int64 percent = int64(1000.0 * (active - fPreviousActive) + / (info.Time() - fPreviousTime)); + if (percent < 0) + percent = 0; + if (percent > 1000) + percent = 1000; + + fPreviousActive = active; + fPreviousTime = info.Time(); [... truncated: 501 lines follow ...] From axeld at mail.berlios.de Sun Apr 13 08:03:48 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 13 Apr 2008 08:03:48 +0200 Subject: [Haiku-commits] r24956 - haiku/trunk/build/jam Message-ID: <200804130603.m3D63mOY007620@sheep.berlios.de> Author: axeld Date: 2008-04-13 08:03:48 +0200 (Sun, 13 Apr 2008) New Revision: 24956 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24956&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Added ActivityMonitor to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-04-13 06:02:45 UTC (rev 24955) +++ haiku/trunk/build/jam/HaikuImage 2008-04-13 06:03:48 UTC (rev 24956) @@ -49,10 +49,10 @@ ; -BEOS_APPS = AboutSystem CodyCam DeskCalc DiskProbe DriveSetup CDPlayer Expander - Icon-O-Matic Installer LaunchBox Magnify Mail MediaPlayer MidiPlayer - NetworkStatus PackageInstaller People PowerStatus ProcessController - ShowImage SoundRecorder StyledEdit Terminal TV Workspaces +BEOS_APPS = AboutSystem ActivityMonitor CodyCam DeskCalc DiskProbe DriveSetup + CDPlayer Expander Icon-O-Matic Installer LaunchBox Magnify Mail MediaPlayer + MidiPlayer NetworkStatus PackageInstaller People PowerStatus + ProcessController ShowImage SoundRecorder StyledEdit Terminal TV Workspaces ; BEOS_PREFERENCES = Appearance Backgrounds DataTranslations E-mail FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers Screen From mmlr at mail.berlios.de Sun Apr 13 08:04:20 2008 From: mmlr at mail.berlios.de (mmlr at BerliOS) Date: Sun, 13 Apr 2008 08:04:20 +0200 Subject: [Haiku-commits] r24957 - haiku/trunk/src/add-ons/kernel/busses/usb Message-ID: <200804130604.m3D64KAB007660@sheep.berlios.de> Author: mmlr Date: 2008-04-13 08:04:20 +0200 (Sun, 13 Apr 2008) New Revision: 24957 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24957&view=rev Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp Log: Fully clear the EHCI members too, so an incompletely constructed object can be safely deleted. Modified: haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-13 06:03:48 UTC (rev 24956) +++ haiku/trunk/src/add-ons/kernel/busses/usb/ehci.cpp 2008-04-13 06:04:20 UTC (rev 24957) @@ -98,13 +98,21 @@ EHCI::EHCI(pci_info *info, Stack *stack) : BusManager(stack), + fCapabilityRegisters(NULL), + fOperationalRegisters(NULL), + fRegisterArea(-1), fPCIInfo(info), fStack(stack), fPeriodicFrameListArea(-1), fPeriodicFrameList(NULL), + fInterruptEntries(NULL), + fAsyncQueueHead(NULL), + fAsyncAdvanceSem(-1), fFirstTransfer(NULL), fLastTransfer(NULL), + fFinishTransfersSem(-1), fFinishThread(-1), + fCleanupSem(-1), fCleanupThread(-1), fStopThreads(false), fFreeListHead(NULL), From anevilyak at gmail.com Mon Apr 14 13:42:13 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 14 Apr 2008 06:42:13 -0500 Subject: [Haiku-commits] r24951 - in haiku/trunk/src: bin/keymap servers/input In-Reply-To: References: <200804122241.m3CMfMtl019577@sheep.berlios.de> Message-ID: Hi J?r?me, On Mon, Apr 14, 2008 at 3:33 AM, J?r?me Duval wrote: > Hi Rene, > > 2008/4/13, anevilyak at BerliOS : > > + file.WriteAttr("keymap:name", B_STRING_TYPE, 0, kSystemKeymapName, strlen(kSystemKeymapName)); > > Cool! Maybe keymap:name should be defined in a header somewhere > (InterfaceDefs.h ?). > It'd make sense to define it in a private header somewhere, but a public one? I wasn't really anticipating any use for that attr other than the keymap preflet itself, did you have something else in mind? Regards, Rene From alex at zappotek.com Mon Apr 14 14:20:43 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Mon, 14 Apr 2008 14:20:43 +0200 Subject: [Haiku-commits] r24924 - haiku/trunk/src/preferences/keymap In-Reply-To: <200804120328.m3C3SF8S002299@sheep.berlios.de> References: <200804120328.m3C3SF8S002299@sheep.berlios.de> Message-ID: <48034C1B.4030009@zappotek.com> anevilyak at BerliOS a ?crit : > Keymap preferences now saves an attribute on the Key_map file to indicate > what keymap it came from. This allows us to indicate the current keymap in > the list views. I'm not sure how to get the build system to populate that > attribute by default though. > > > Hi, i don't have any haiku-time at the moment, but i still have time for lurking and suggesting :-) What would be nice is to have a solution that also works in read-only mode. What about enhancing the input server to allow changing the current keymap by passing a reference to a keymap file, that would remove the need for the Key_map file. The input server would write (when in read/write mode) a flatened BMessage containing the active keymap file reference (and maybe also the default one). When in read-only mode we would also need a method in the input server that returns the active keymap's ref. Regards, Alex From bga at mail.berlios.de Sun Apr 13 09:27:13 2008 From: bga at mail.berlios.de (bga at BerliOS) Date: Sun, 13 Apr 2008 09:27:13 +0200 Subject: [Haiku-commits] r24958 - in haiku/trunk: headers/os/kernel headers/private/shared src/system/kernel/arch/x86 Message-ID: <200804130727.m3D7RD7X018295@sheep.berlios.de> Author: bga Date: 2008-04-13 09:27:12 +0200 (Sun, 13 Apr 2008) New Revision: 24958 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=24958&view=rev Modified: haiku/trunk/headers/os/kernel/OS.h haiku/trunk/headers/private/shared/cpu_type.h haiku/trunk/src/system/kernel/arch/x86/arch_system_info.c Log: Applied patch by Herv?\195?\169 W. - Updated Intel processor IDs. - Only take extended family/model into account on Intel processors. Modified: haiku/trunk/headers/os/kernel/OS.h =================================================================== --- haiku/trunk/headers/os/kernel/OS.h 2008-04-13 06:04:20 UTC (rev 24957) +++ haiku/trunk/headers/os/kernel/OS.h 2008-04-13 07:27:12 UTC (rev 24958) @@ -427,35 +427,37 @@ /* Updated according to Intel(R) Processor Identification and * the CPUID instruction (Table 4) - * AP-485 Intel - 24161828.pdf + * AP-485 Intel - 24161832.pdf */ - B_CPU_INTEL_x86 = 0x1000, - B_CPU_INTEL_PENTIUM = 0x1051, + B_CPU_INTEL_x86 = 0x100000, + B_CPU_INTEL_PENTIUM = 0x100501, B_CPU_INTEL_PENTIUM75, B_CPU_INTEL_PENTIUM_486_OVERDRIVE, B_CPU_INTEL_PENTIUM_MMX, B_CPU_INTEL_PENTIUM_MMX_MODEL_4 = B_CPU_INTEL_PENTIUM_MMX, - B_CPU_INTEL_PENTIUM_MMX_MODEL_8 = 0x1058, + B_CPU_INTEL_PENTIUM_MMX_MODEL_8 = 0x100508, B_CPU_INTEL_PENTIUM75_486_OVERDRIVE, - B_CPU_INTEL_PENTIUM_PRO = 0x1061, - B_CPU_INTEL_PENTIUM_II = 0x1063, - B_CPU_INTEL_PENTIUM_II_MODEL_3 = 0x1063, - B_CPU_INTEL_PENTIUM_II_MODEL_5 = 0x1065, - B_CPU_INTEL_CELERON = 0x1066, - B_CPU_INTEL_PENTIUM_III = 0x1067, - B_CPU_INTEL_PENTIUM_III_MODEL_8 = 0x1068, - B_CPU_INTEL_PENTIUM_M = 0x1069, - B_CPU_INTEL_PENTIUM_III_XEON = 0x106a, - B_CPU_INTEL_PENTIUM_III_MODEL_11 = 0x106b, - B_CPU_INTEL_PENTIUM_M_MODEL_13 = 0x106d, /* Dothan */ + B_CPU_INTEL_PENTIUM_PRO = 0x100601, + B_CPU_INTEL_PENTIUM_II = 0x100603, + B_CPU_INTEL_PENTIUM_II_MODEL_3 = 0x100603, + B_CPU_INTEL_PENTIUM_II_MODEL_5 = 0x100605, + B_CPU_INTEL_CELERON = 0x100606, + B_CPU_INTEL_CELERON_MODEL_22 = 0x101606, + B_CPU_INTEL_PENTIUM_III = 0x100607, + B_CPU_INTEL_PENTIUM_III_MODEL_8 = 0x100608, + B_CPU_INTEL_PENTIUM_M = 0x100609, + B_CPU_INTEL_PENTIUM_III_XEON = 0x10060a, + B_CPU_INTEL_PENTIUM_III_MODEL_11 = 0x10060b, + B_CPU_INTEL_PENTIUM_M_MODEL_13 = 0x10060d, /* Dothan */ B_CPU_INTEL_PENTIUM_CORE, B_CPU_INTEL_PENTIUM_CORE_2, - B_CPU_INTEL_PENTIUM_IV = 0x10f0, + B_CPU_INTEL_PENTIUM_CORE_2_EXTREME = 0x101607, /* Core 2 Extreme or Xeon + model 23 on 45 nm */ + B_CPU_INTEL_PENTIUM_IV = 0x100f00, B_CPU_INTEL_PENTIUM_IV_MODEL_1, B_CPU_INTEL_PENTIUM_IV_MODEL_2, B_CPU_INTEL_PENTIUM_IV_MODEL_3, B_CPU_INTEL_PENTIUM_IV_MODEL_4, - B_CPU_INTEL_PENTIUM_CORE_2_EXTREME = 0x1467, /* AMD */ @@ -463,29 +465,29 @@ * (Table 3) * 20734.pdf */ - B_CPU_AMD_x86 = 0x1100, - B_CPU_AMD_K5_MODEL_0 = 0x1150, + B_CPU_AMD_x86 = 0x110000, + B_CPU_AMD_K5_MODEL_0 = 0x110500, B_CPU_AMD_K5_MODEL_1, B_CPU_AMD_K5_MODEL_2, B_CPU_AMD_K5_MODEL_3, - B_CPU_AMD_K6_MODEL_6 = 0x1156, - B_CPU_AMD_K6_MODEL_7 = 0x1157, - B_CPU_AMD_K6_MODEL_8 = 0x1158, - B_CPU_AMD_K6_2 = 0x1158, - B_CPU_AMD_K6_MODEL_9 = 0x