From axeld at pinc-software.de Sat Nov 1 10:42:03 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 01 Nov 2008 10:42:03 +0100 CET Subject: [Haiku-commits] r28415 - haiku/trunk/src/kits/media In-Reply-To: <200810312236.m9VMaoWv022865@sheep.berlios.de> Message-ID: <873046767-BeMail@zon> dlmcpaul at BerliOS wrote: > Log: > added a possible todo Those should better be marked with "TODO" so that everyone knows it is one, and can easily scan the sources for work left to do. Bye, Axel. From stippi at mail.berlios.de Sat Nov 1 11:48:49 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 11:48:49 +0100 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad Message-ID: <200811011048.mA1AmnfV008779@sheep.berlios.de> Author: stippi Date: 2008-11-01 11:48:35 +0100 (Sat, 01 Nov 2008) New Revision: 28416 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28416&view=rev Added: haiku/trunk/headers/private/input/touchpad_driver.h haiku/trunk/headers/private/input/touchpad_settings.h haiku/trunk/src/add-ons/input_server/devices/touchpad/ haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.h haiku/trunk/src/preferences/touchpad/ haiku/trunk/src/preferences/touchpad/Jamfile haiku/trunk/src/preferences/touchpad/Touchpad.rdef haiku/trunk/src/preferences/touchpad/TouchpadPref.cpp haiku/trunk/src/preferences/touchpad/TouchpadPref.h haiku/trunk/src/preferences/touchpad/TouchpadPrefView.cpp haiku/trunk/src/preferences/touchpad/TouchpadPrefView.h haiku/trunk/src/preferences/touchpad/main.cpp Modified: haiku/trunk/headers/private/input/kb_mouse_driver.h haiku/trunk/src/add-ons/input_server/devices/Jamfile haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_defs.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_mouse.c haiku/trunk/src/preferences/Jamfile Log: Patch by Clemens Zeilder: * Implemented Synaptics touchpad support in the PS2 bus_manager by refactoring/splitting the structure some and adding touchpad device handling. * Implemented Touchpad input_server device add-on * Created Touchpad preflet for configuring advances Synaptics touchpad options like scroll region (both horizontal and vertical) as well as other neat stuff Thanks a lot, Clemens! Modified: haiku/trunk/headers/private/input/kb_mouse_driver.h =================================================================== --- haiku/trunk/headers/private/input/kb_mouse_driver.h 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/headers/private/input/kb_mouse_driver.h 2008-11-01 10:48:35 UTC (rev 28416) @@ -62,6 +62,8 @@ MS_GET_CLICKSPEED, MS_SET_CLICKSPEED, MS_NUM_SERIAL_MICE, + MS_IS_TOUCHPAD, + MS_SET_TOUCHPAD_SETTINGS, IIC_WRITE = B_DEVICE_OP_CODES_END + 200, RESTART_SYSTEM, @@ -117,6 +119,25 @@ float tilt_y; } tablet_movement; +#define B_ONE_FINGER 0x01 +#define B_TWO_FINGER 0x02 +#define B_MULTI_FINGER 0x04 +#define B_PEN 0x08 + +typedef struct +{ + uint8 buttons; + uint32 xPosition; + uint32 yPosition; + uint8 zPressure; + uint8 fingers; + bool gesture; + uint8 fingerWidth; + // 1 - 4 normal width + // 5 - 11 very wide finger or palm + // 12 maximum reportable width; extrem wide contact +} touchpad_movement; + #ifdef __cplusplus } #endif Added: haiku/trunk/headers/private/input/touchpad_driver.h =================================================================== --- haiku/trunk/headers/private/input/touchpad_driver.h 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/headers/private/input/touchpad_driver.h 2008-11-01 10:48:35 UTC (rev 28416) @@ -0,0 +1,38 @@ +// +// kb_mouse_driver.h +// +#ifndef _TOUCHPAD_DRIVER_H +#define _TOUCHPAD_DRIVER_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define B_ONE_FINGER 0x01 +#define B_TWO_FINGER 0x02 +#define B_MULTI_FINGER 0x04 +#define B_PEN 0x08 + +typedef struct { + uint8 buttons; + uint32 xPosition; + uint32 yPosition; + uint8 zPressure; + uint8 fingers; + bool gesture; + uint8 fingerWidth; + // 1 - 4 normal width + // 5 - 11 very wide finger or palm + // 12 maximum reportable width; extrem wide contact +} touchpad_movement; + + +#ifdef __cplusplus +} +#endif + +#endif + Added: haiku/trunk/headers/private/input/touchpad_settings.h =================================================================== --- haiku/trunk/headers/private/input/touchpad_settings.h 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/headers/private/input/touchpad_settings.h 2008-11-01 10:48:35 UTC (rev 28416) @@ -0,0 +1,39 @@ +/* + * Copyright 2001-2008, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ +#ifndef TOUCHPAD_SETTINGS_H +#define TOUCHPAD_SETTINGS_H + +#include + + +typedef struct { + bool scroll_twofinger; + bool scroll_multifinger; + float scroll_rightrange; // from 0 to 1 + float scroll_bottomrange; // from 0 to 1 + uint16 scroll_xstepsize; + uint16 scroll_ystepsize; + uint8 scroll_acceleration; // from 0 to 20 + + uint8 tapgesture_sensibility; // 0 : no tapgesture + // 20: very light tip is enough (default) +} touchpad_settings; + + +const static touchpad_settings kDefaultTouchpadSettings = { + true, + true, + 0.15, + 0.15, + 7, + 10, + 10, + 20 +}; + +#define TOUCHPAD_SETTINGS_FILE "Touchpad_settings" + + +#endif /* TOUCHPAD_SETTINGS_H */ Modified: haiku/trunk/src/add-ons/input_server/devices/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/Jamfile 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/src/add-ons/input_server/devices/Jamfile 2008-11-01 10:48:35 UTC (rev 28416) @@ -5,5 +5,6 @@ SubInclude HAIKU_TOP src add-ons input_server devices mouse ; #SubInclude HAIKU_TOP src add-ons input_server devices serial_mouse ; #SubInclude HAIKU_TOP src add-ons input_server devices tablet ; +SubInclude HAIKU_TOP src add-ons input_server devices touchpad ; SubInclude HAIKU_TOP src add-ons input_server devices wacom ; Added: haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile 2008-11-01 10:48:35 UTC (rev 28416) @@ -0,0 +1,13 @@ +SubDir HAIKU_TOP src add-ons input_server devices touchpad ; + +SetSubDirSupportedPlatformsBeOSCompatible ; + +UsePrivateHeaders input ; + +Addon touchpad : + TouchpadInputDevice.cpp + : be input_server ; + +Package haiku-inputkit-cvs : + touchpad : + boot home config add-ons input_server devices ; Added: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-01 10:48:35 UTC (rev 28416) @@ -0,0 +1,685 @@ +/* + * Copyright 2004-2007, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stefano Ceccherini (stefano.ceccherini at gmail.com) + * J?r?me Duval + * Axel D?rfler, axeld at pinc-software.de + */ + + +#include "TouchpadInputDevice.h" +#include "kb_mouse_driver.h" +#include "kb_mouse_settings.h" +#include "touchpad_settings.h" + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include + +#if DEBUG +FILE *TouchpadInputDevice::sLogFile = NULL; +# define LOG_ERR(text...) LOG(text) +#else +# define LOG(text...) +# define LOG_ERR(text...) fprintf(stderr, text) +#endif + +#define CALLED() LOG("%s\n", __PRETTY_FUNCTION__) + +const static uint32 kMouseThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; + +// "/dev/" is automatically prepended by StartMonitoringDevice() +const static char *kTouchpadDevicesDirectoryPS2 = "input/touchpad/ps2"; + + +class TouchpadDevice { + public: + TouchpadDevice(BInputServerDevice& target, const char* path); + ~TouchpadDevice(); + + status_t Start(); + void Stop(); + + status_t UpdateSettings(); + + const char* Path() const { return fPath.String(); } + input_device_ref* DeviceRef() { return &fDeviceRef; } + + bool IsTouchpad() { return fIsTouchpad; } + status_t ReadTouchpadSettingsMsg(BMessage* msg); + status_t UpdateTouchpadSettings(); + + private: + void _Run(); + static status_t _ThreadFunction(void *arg); + + BMessage* _BuildMouseMessage(uint32 what, uint64 when, uint32 buttons, + int32 deltaX, int32 deltaY) const; + void _ComputeAcceleration(const mouse_movement& movements, + int32& deltaX, int32& deltaY) const; + uint32 _RemapButtons(uint32 buttons) const; + + char* _BuildShortName() const; + + status_t GetSettingsPath(BPath &path); + + private: + BInputServerDevice& fTarget; + BString fPath; + int fDevice; + + input_device_ref fDeviceRef; + mouse_settings fSettings; + bool fDeviceRemapsButtons; + + thread_id fThread; + volatile bool fActive; + + bool fIsTouchpad; + touchpad_settings fTouchpadSettings; +}; + + +#if DEBUG +inline void +LOG(const char *fmt, ...) +{ + char buf[1024]; + va_list ap; + va_start(ap, fmt); + vsprintf(buf, fmt, ap); va_end(ap); + fputs(buf, TouchpadInputDevice::sLogFile); fflush(TouchpadInputDevice::sLogFile); +} +#endif + + +extern "C" BInputServerDevice * +instantiate_input_device() +{ + return new (std::nothrow) TouchpadInputDevice(); +} + + +// #pragma mark - + + +TouchpadDevice::TouchpadDevice(BInputServerDevice& target, const char *driverPath) + : + fTarget(target), + fDevice(-1), + fThread(-1), + fActive(false), + fIsTouchpad(false) +{ + fPath = driverPath; + + fDeviceRef.name = _BuildShortName(); + fDeviceRef.type = B_POINTING_DEVICE; + fDeviceRef.cookie = this; + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + fSettings.map.button[0] = B_PRIMARY_MOUSE_BUTTON; + fSettings.map.button[1] = B_SECONDARY_MOUSE_BUTTON; + fSettings.map.button[2] = B_TERTIARY_MOUSE_BUTTON; +#endif + + fDeviceRemapsButtons = false; +}; + + +TouchpadDevice::~TouchpadDevice() +{ + if (fActive) + Stop(); + + free(fDeviceRef.name); +} + + +status_t +TouchpadDevice::GetSettingsPath(BPath &path) +{ + status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); + if(status < B_OK) + return status; + path.Append(TOUCHPAD_SETTINGS_FILE); + return B_OK; +} + + +status_t +TouchpadDevice::Start() +{ + fDevice = open(fPath.String(), O_RDWR); + if (fDevice < 0) + return errno; + + // touchpad settings + if(ioctl(fDevice, MS_IS_TOUCHPAD, NULL) == B_OK){ + LOG("is touchpad %s\n", fPath.String()); + fIsTouchpad = true; + } + + fTouchpadSettings = kDefaultTouchpadSettings; + + BPath path; + status_t status = GetSettingsPath(path); + BFile settingsFile(path.Path(), B_READ_ONLY); + if(status == B_OK && settingsFile.InitCheck() == B_OK){ + if(settingsFile.Read(&fTouchpadSettings, sizeof(touchpad_settings)) + != sizeof(touchpad_settings)) + { + LOG("failed to load settings\n"); + } + } + + UpdateTouchpadSettings(); + + UpdateSettings(); + + char threadName[B_OS_NAME_LENGTH]; + snprintf(threadName, B_OS_NAME_LENGTH, "%s watcher", fDeviceRef.name); + + fThread = spawn_thread(_ThreadFunction, threadName, + kMouseThreadPriority, (void *)this); + + if (fThread < B_OK) + status = fThread; + else { + fActive = true; + status = resume_thread(fThread); + } + + if (status < B_OK) { + LOG_ERR("%s: can't spawn/resume watching thread: %s\n", + fDeviceRef.name, strerror(status)); + close(fDevice); + return status; + } + + return B_OK; +} + + +void +TouchpadDevice::Stop() +{ + fActive = false; + // this will stop the thread as soon as it reads the next packet + + if (fThread >= B_OK) { + // unblock the thread, which might wait on a semaphore. + suspend_thread(fThread); + resume_thread(fThread); + + status_t dummy; + wait_for_thread(fThread, &dummy); + } + + close(fDevice); +} + + +status_t +TouchpadDevice::UpdateSettings() +{ + CALLED(); + + // retrieve current values + + if (get_mouse_map(&fSettings.map) != B_OK) + LOG_ERR("error when get_mouse_map\n"); + else + fDeviceRemapsButtons = ioctl(fDevice, MS_SET_MAP, &fSettings.map) == B_OK; + + if (get_click_speed(&fSettings.click_speed) != B_OK) + LOG_ERR("error when get_click_speed\n"); + else + ioctl(fDevice, MS_SET_CLICKSPEED, &fSettings.click_speed); + + if (get_mouse_speed(&fSettings.accel.speed) != B_OK) + LOG_ERR("error when get_mouse_speed\n"); + else { + if (get_mouse_acceleration(&fSettings.accel.accel_factor) != B_OK) + LOG_ERR("error when get_mouse_acceleration\n"); + else { + mouse_accel accel; + ioctl(fDevice, MS_GET_ACCEL, &accel); + accel.speed = fSettings.accel.speed; + accel.accel_factor = fSettings.accel.accel_factor; + ioctl(fDevice, MS_SET_ACCEL, &fSettings.accel); + } + } + + if (get_mouse_type(&fSettings.type) != B_OK) + LOG_ERR("error when get_mouse_type\n"); + else + ioctl(fDevice, MS_SET_TYPE, &fSettings.type); + + return B_OK; + +} + + +status_t +TouchpadDevice::ReadTouchpadSettingsMsg(BMessage* msg) +{ + msg->FindBool("scroll_twofinger", &(fTouchpadSettings.scroll_twofinger)); + msg->FindBool("scroll_multifinger", &(fTouchpadSettings.scroll_multifinger)); + msg->FindFloat("scroll_rightrange", &(fTouchpadSettings.scroll_rightrange)); + msg->FindFloat("scroll_bottomrange", &(fTouchpadSettings.scroll_bottomrange)); + msg->FindInt16("scroll_xstepsize", (int16*)&(fTouchpadSettings.scroll_xstepsize)); + msg->FindInt16("scroll_ystepsize", (int16*)&(fTouchpadSettings.scroll_ystepsize)); + msg->FindInt8("scroll_acceleration", (int8*)&(fTouchpadSettings.scroll_acceleration)); + msg->FindInt8("tapgesture_sensibility", (int8*)&(fTouchpadSettings.tapgesture_sensibility)); + + return B_OK; +} + + +status_t +TouchpadDevice::UpdateTouchpadSettings() +{ + if(fIsTouchpad){ + ioctl(fDevice, MS_SET_TOUCHPAD_SETTINGS, &fTouchpadSettings); + return B_OK; + } + return B_ERROR; +} + + +void +TouchpadDevice::_Run() +{ + uint32 lastButtons = 0; + + while (fActive) { + mouse_movement movements; + memset(&movements, 0, sizeof(movements)); + + if (ioctl(fDevice, MS_READ, &movements) != B_OK) + return; + + uint32 buttons = lastButtons ^ movements.buttons; + + uint32 remappedButtons = _RemapButtons(movements.buttons); + int32 deltaX, deltaY; + _ComputeAcceleration(movements, deltaX, deltaY); + + /*LOG("%s: buttons: 0x%lx, x: %ld, y: %ld, clicks:%ld, wheel_x:%ld, wheel_y:%ld\n", + device->device_ref.name, movements.buttons, movements.xdelta, movements.ydelta, + movements.clicks, movements.wheel_xdelta, movements.wheel_ydelta); + LOG("%s: x: %ld, y: %ld\n", device->device_ref.name, deltaX, deltaY);*/ + + BMessage *message = NULL; + + // Send single messages for each event + + if (buttons != 0) { + bool pressedButton = (buttons & movements.buttons) > 0; + BMessage* message = _BuildMouseMessage( + pressedButton ? B_MOUSE_DOWN : B_MOUSE_UP, + movements.timestamp, remappedButtons, deltaX, deltaY); + if (message != NULL) { + if (pressedButton) { + message->AddInt32("clicks", movements.clicks); + LOG("B_MOUSE_DOWN\n"); + } else + LOG("B_MOUSE_UP\n"); + + fTarget.EnqueueMessage(message); + lastButtons = movements.buttons; + } + } + + if (movements.xdelta != 0 || movements.ydelta != 0) { + BMessage* message = _BuildMouseMessage(B_MOUSE_MOVED, + movements.timestamp, remappedButtons, deltaX, deltaY); + if (message != NULL) + fTarget.EnqueueMessage(message); + } + + if ((movements.wheel_ydelta != 0) || (movements.wheel_xdelta != 0)) { + message = new BMessage(B_MOUSE_WHEEL_CHANGED); + if (message == NULL) + continue; + + if (message->AddInt64("when", movements.timestamp) == B_OK + && message->AddFloat("be:wheel_delta_x", movements.wheel_xdelta) == B_OK + && message->AddFloat("be:wheel_delta_y", movements.wheel_ydelta) == B_OK) + fTarget.EnqueueMessage(message); + else + delete message; + } + } +} + + +status_t +TouchpadDevice::_ThreadFunction(void* arg) +{ + TouchpadDevice* device = (TouchpadDevice *)arg; + device->_Run(); + return B_OK; +} + + +BMessage* +TouchpadDevice::_BuildMouseMessage(uint32 what, uint64 when, uint32 buttons, + int32 deltaX, int32 deltaY) const +{ + BMessage* message = new BMessage(what); + if (message == NULL) + return NULL; + + if (message->AddInt64("when", when) < B_OK + || message->AddInt32("buttons", buttons) < B_OK + || message->AddInt32("x", deltaX) < B_OK + || message->AddInt32("y", deltaY) < B_OK) { + delete message; + return NULL; + } + + return message; +} + + +void +TouchpadDevice::_ComputeAcceleration(const mouse_movement& movements, + int32& deltaX, int32& deltaY) const +{ + // basic mouse speed + deltaX = movements.xdelta * fSettings.accel.speed >> 16; + deltaY = movements.ydelta * fSettings.accel.speed >> 16; + + // acceleration + double acceleration = 1; + if (fSettings.accel.accel_factor) { + acceleration = 1 + sqrt(deltaX * deltaX + deltaY * deltaY) + * fSettings.accel.accel_factor / 524288.0; + } + + // make sure that we move at least one pixel (if there was a movement) + if (deltaX > 0) + deltaX = (int32)floor(deltaX * acceleration); + else + deltaX = (int32)ceil(deltaX * acceleration); + + if (deltaY > 0) + deltaY = (int32)floor(deltaY * acceleration); + else + deltaY = (int32)ceil(deltaY * acceleration); +} + + +uint32 +TouchpadDevice::_RemapButtons(uint32 buttons) const +{ + if (fDeviceRemapsButtons) + return buttons; + + uint32 newButtons = 0; + for (int32 i = 0; buttons; i++) { + if (buttons & 0x1) { +#if defined(HAIKU_TARGET_PLATFORM_HAIKU) || defined(HAIKU_TARGET_PLATFORM_DANO) + newButtons |= fSettings.map.button[i]; +#else + if (i == 0) + newButtons |= fSettings.map.left; + if (i == 1) + newButtons |= fSettings.map.right; + if (i == 2) + newButtons |= fSettings.map.middle; +#endif + } + buttons >>= 1; + } + + return newButtons; +} + + +char * +TouchpadDevice::_BuildShortName() const +{ + BString string(fPath); + BString name; + + int32 slash = string.FindLast("/"); + string.CopyInto(name, slash + 1, string.Length() - slash); + //int32 index = atoi(name.String()) + 1; + + BString final = "Touchpad_"; + final+= name; + + LOG("NAME %s, %s\n", final.String(), fPath.String()); + + return strdup(final.String()); +} + + +// #pragma mark - + + +TouchpadInputDevice::TouchpadInputDevice() +{ +#if DEBUG + sLogFile = fopen("/var/log/mouse_device_log.log", "a"); +#endif + CALLED(); + + StartMonitoringDevice(kTouchpadDevicesDirectoryPS2); + + _RecursiveScan(kTouchpadDevicesDirectoryPS2); +} + + +TouchpadInputDevice::~TouchpadInputDevice() +{ + CALLED(); + StopMonitoringDevice(kTouchpadDevicesDirectoryPS2); + + int32 count = fDevices.CountItems(); + while (count-- > 0) { + delete (TouchpadDevice *)fDevices.RemoveItem(count); + } + +#if DEBUG + fclose(sLogFile); +#endif +} + + +status_t +TouchpadInputDevice::InitCheck() +{ + CALLED(); + return BInputServerDevice::InitCheck(); +} + + +status_t +TouchpadInputDevice::Start(const char *name, void *cookie) +{ + LOG("%s(%s)\n", __PRETTY_FUNCTION__, name); + TouchpadDevice* device = (TouchpadDevice*)cookie; + + return device->Start(); +} + + +status_t +TouchpadInputDevice::Stop(const char *name, void *cookie) +{ + LOG("%s(%s)\n", __PRETTY_FUNCTION__, name); + TouchpadDevice* device = (TouchpadDevice*)cookie; + + device->Stop(); + return B_OK; +} + + +status_t +TouchpadInputDevice::Control(const char* name, void* cookie, + uint32 command, BMessage* message) +{ + LOG("%s(%s, code: %lu)\n", __PRETTY_FUNCTION__, name, command); + TouchpadDevice* device = (TouchpadDevice*)cookie; + + if (command == MS_SET_TOUCHPAD_SETTINGS){ + device->ReadTouchpadSettingsMsg(message); + return device->UpdateTouchpadSettings(); + } + + if (command == B_NODE_MONITOR) + return _HandleMonitor(message); + + if (command >= B_MOUSE_TYPE_CHANGED + && command <= B_MOUSE_ACCELERATION_CHANGED) + return device->UpdateSettings(); + + return B_BAD_VALUE; +} + + +// TODO: Test this. USB doesn't work on my machine +status_t +TouchpadInputDevice::_HandleMonitor(BMessage* message) +{ + CALLED(); + + int32 opcode; + if (message->FindInt32("opcode", &opcode) < B_OK) + return B_BAD_VALUE; + + if (opcode != B_ENTRY_CREATED && opcode != B_ENTRY_REMOVED) + return B_OK; + + BEntry entry; + BPath path; + dev_t device; + ino_t directory; + const char *name; + + if (message->FindInt32("device", &device) < B_OK + || message->FindInt64("directory", &directory) < B_OK + || message->FindString("name", &name) < B_OK) + return B_BAD_VALUE; + + entry_ref ref(device, directory, name); + status_t status; + + if ((status = entry.SetTo(&ref)) != B_OK) + return status; + if ((status = entry.GetPath(&path)) != B_OK) + return status; + if ((status = path.InitCheck()) != B_OK) + return status; + + if (opcode == B_ENTRY_CREATED) + status = _AddDevice(path.Path()); + else + status = _RemoveDevice(path.Path()); + + return status; +} + + +TouchpadDevice* +TouchpadInputDevice::_FindDevice(const char *path) +{ + CALLED(); + + for (int32 i = fDevices.CountItems(); i-- > 0;) { + TouchpadDevice* device = (TouchpadDevice*)fDevices.ItemAt(i); + if (!strcmp(device->Path(), path)) + return device; + } + + return NULL; +} + + +status_t +TouchpadInputDevice::_AddDevice(const char *path) +{ + CALLED(); + + TouchpadDevice* device = new (std::nothrow) TouchpadDevice(*this, path); + if (!device) { + LOG("No memory\n"); + return B_NO_MEMORY; + } + + if (!fDevices.AddItem(device)) { + delete device; + return B_NO_MEMORY; + } + + input_device_ref *devices[2]; + devices[0] = device->DeviceRef(); + devices[1] = NULL; + + return RegisterDevices(devices); +} + + +status_t +TouchpadInputDevice::_RemoveDevice(const char *path) +{ + CALLED(); + + TouchpadDevice* device = _FindDevice(path); + if (device == NULL) + return B_ENTRY_NOT_FOUND; + + fDevices.RemoveItem(device); + + input_device_ref *devices[2]; + devices[0] = device->DeviceRef(); + devices[1] = NULL; + + UnregisterDevices(devices); + + delete device; + return B_OK; +} + + +void +TouchpadInputDevice::_RecursiveScan(const char* directory) +{ + CALLED(); + + BEntry entry; + BDirectory dir(directory); + while (dir.GetNextEntry(&entry) == B_OK) { + BPath path; + entry.GetPath(&path); + + if (!strcmp(path.Leaf(), "serial")) { + // skip serial + continue; + } + + if (entry.IsDirectory()) + _RecursiveScan(path.Path()); + else + _AddDevice(path.Path()); + } +} + Added: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-11-01 10:48:35 UTC (rev 28416) @@ -0,0 +1,51 @@ +/* + * Copyright 2004-2006, Haiku. + * Distributed under the terms of the MIT License. + * + * Authors: + * Stefano Ceccherini + */ +#ifndef MOUSE_INPUT_DEVICE_H +#define MOUSE_INPUT_DEVICE_H + + +#include +#include +#include + +#include +#define DEBUG 1 + +class TouchpadDevice; + +class TouchpadInputDevice : public BInputServerDevice { + public: + TouchpadInputDevice(); + ~TouchpadInputDevice(); + + virtual status_t InitCheck(); + + virtual status_t Start(const char* name, void* cookie); + virtual status_t Stop(const char* name, void* cookie); + + virtual status_t Control(const char* name, void* cookie, + uint32 command, BMessage* message); + + private: + status_t _HandleMonitor(BMessage* message); + void _RecursiveScan(const char* directory); + + TouchpadDevice* _FindDevice(const char* path); + status_t _AddDevice(const char* path); + status_t _RemoveDevice(const char* path); + + BList fDevices; +#ifdef DEBUG +public: + static FILE *sLogFile; +#endif +}; + +extern "C" BInputServerDevice* instantiate_input_device(); + +#endif // MOUSE_INPUT_DEVICE_H Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile 2008-11-01 10:48:35 UTC (rev 28416) @@ -9,6 +9,9 @@ ps2_dev.c ps2_keyboard.c ps2_module.c - ps2_mouse.c + ps2_standart_mouse.c + ps2_synaptics.c + ps2_trackpoint.c ps2_service.c + movement_maker.c ; Added: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-10-31 22:36:49 UTC (rev 28415) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-01 10:48:35 UTC (rev 28416) @@ -0,0 +1,278 @@ +#include "movement_maker.h" + +#include +#if 1 +# define INFO(x...) dprintf(x) +#else +# define INFO(x...) +#endif + +typedef union +{ + float value; + /* FIXME: Assumes 32 bit int. */ + unsigned int word; +} ieee_float_shape_type; + +/* Get a 32 bit int from a float. */ + +#define GET_FLOAT_WORD(i,d) \ +do { \ + ieee_float_shape_type gf_u; \ + gf_u.value = (d); \ + (i) = gf_u.word; \ +} while (0) + +/* Set a float from a 32 bit int. */ + +#define SET_FLOAT_WORD(d,i) \ +do { \ + ieee_float_shape_type sf_u; \ + sf_u.word = (i); \ + (d) = sf_u.value; \ +} while (0) + +static const float huge = 1.0e30; + +float +floorf(float x) +{ + int32 i0,j0; + uint32 i; + GET_FLOAT_WORD(i0,x); + j0 = ((i0>>23)&0xff)-0x7f; + if(j0<23) { + if(j0<0) { /* raise inexact if x != 0 */ + if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ + if(i0>=0) {i0=0;} + else if((i0&0x7fffffff)!=0) + { i0=0xbf800000;} + } + } else { + i = (0x007fffff)>>j0; + if((i0&i)==0) return x; /* x is integral */ + if(huge+x>(float)0.0) { /* raise inexact flag */ + if(i0<0) i0 += (0x00800000)>>j0; + i0 &= (~i); + } + } + } else { + if(j0==0x80) return x+x; /* inf or NaN */ + else return x; /* x is integral */ + } + SET_FLOAT_WORD(x,i0); + return x; +} + + +float +ceilf(float x) +{ + int32 i0,j0; [... truncated: 3812 lines follow ...] From stippi at mail.berlios.de Sat Nov 1 11:49:47 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 11:49:47 +0100 Subject: [Haiku-commits] r28417 - haiku/trunk/build/jam Message-ID: <200811011049.mA1AnluM008835@sheep.berlios.de> Author: stippi Date: 2008-11-01 11:49:46 +0100 (Sat, 01 Nov 2008) New Revision: 28417 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28417&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Added Synaptics touchpad preflet and input_server add-on to the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-01 10:48:35 UTC (rev 28416) +++ haiku/trunk/build/jam/HaikuImage 2008-11-01 10:49:46 UTC (rev 28417) @@ -65,7 +65,7 @@ ; BEOS_PREFERENCES = Appearance Backgrounds DataTranslations E-mail FileTypes Fonts Keyboard Keymap Media Menu Mouse Network Printers Screen - ScreenSaver Sounds Time VirtualMemory + ScreenSaver Sounds Time Touchpad VirtualMemory ; BEOS_DEMOS = BSnow Chart Clock $(X86_ONLY)Cortex FontDemo $(X86_ONLY)GLDirectMode $(X86_ONLY)GLTeapot Mandelbrot Pairs @@ -412,7 +412,7 @@ AddSymlinkToHaikuImage beos system add-ons Tracker : /boot/beos/apps/DiskUsage : DiskUsage-I ; AddFilesToHaikuImage beos system add-ons input_server devices - : keyboard mouse wacom ; + : keyboard mouse touchpad wacom ; AddFilesToHaikuImage beos system add-ons input_server filters : screen_saver ; AddFilesToHaikuImage beos system add-ons kernel network : stack ; AddFilesToHaikuImage beos system add-ons kernel network devices From stippi at mail.berlios.de Sat Nov 1 11:53:59 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 11:53:59 +0100 Subject: [Haiku-commits] r28418 - haiku/trunk/src/apps/aboutsystem Message-ID: <200811011053.mA1ArxGj009229@sheep.berlios.de> Author: stippi Date: 2008-11-01 11:53:58 +0100 (Sat, 01 Nov 2008) New Revision: 28418 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28418&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Added Clemens Zeidler to the list of contributors for his Synaptics Touchpad driver patch. Thanks! Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-01 10:49:46 UTC (rev 28417) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-01 10:53:58 UTC (rev 28418) @@ -535,6 +535,7 @@ "James Woodcock\n" "Artur Wyszynski\n" "Gerald Zajac\n" + "Clemens Zeidler\n" "?ukasz Zemczak\n" "JiSheng Zhang\n" "Zhao Shuai\n" From axeld at mail.berlios.de Sat Nov 1 11:54:51 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 11:54:51 +0100 Subject: [Haiku-commits] r28419 - haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check Message-ID: <200811011054.mA1AspHL009326@sheep.berlios.de> Author: axeld Date: 2008-11-01 11:54:51 +0100 (Sat, 01 Nov 2008) New Revision: 28419 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28419&view=rev Added: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/AdaptiveBuffering.cpp haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/AdaptiveBuffering.h haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/Jamfile haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp Log: * The AdaptiveBuffering::_Write() method was exiting early, causing the possibly random SHA hashes. * Moved AdaptiveBuffering into its own file. * Fixed updating a hash file. * Implemented the "consistency_check" app that checks if a file has changed, and prints warnings if there are any. Copied: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/AdaptiveBuffering.cpp (from rev 28412, haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp) =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp 2008-10-31 22:30:41 UTC (rev 28412) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/AdaptiveBuffering.cpp 2008-11-01 10:54:51 UTC (rev 28419) @@ -0,0 +1,228 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include "AdaptiveBuffering.h" + +#include + + +//#define TRACE(x...) printf(x) +#define TRACE(x...) ; + + +AdaptiveBuffering::AdaptiveBuffering(size_t initialBufferSize, + size_t maxBufferSize, uint32 count) + : + fWriterThread(-1), + fBuffers(NULL), + fReadBytes(NULL), + fBufferCount(count), + fReadIndex(0), + fWriteIndex(0), + fReadCount(0), + fWriteCount(0), + fMaxBufferSize(maxBufferSize), + fCurrentBufferSize(initialBufferSize), + fReadSem(-1), + fWriteSem(-1), + fFinishedSem(-1), + fWriteStatus(B_OK), + fWriteTime(0), + fFinished(false), + fQuit(false) +{ +} + + +AdaptiveBuffering::~AdaptiveBuffering() +{ + _QuitWriter(); + + delete_sem(fReadSem); + delete_sem(fWriteSem); + + if (fBuffers != NULL) { + for (uint32 i = 0; i < fBufferCount; i++) { + if (fBuffers[i] == NULL) + break; + + free(fBuffers[i]); + } + + free(fBuffers); + } + + free(fReadBytes); +} + + +status_t +AdaptiveBuffering::Init() +{ + fReadBytes = (size_t*)malloc(fBufferCount * sizeof(size_t)); + if (fReadBytes == NULL) + return B_NO_MEMORY; + + fBuffers = (uint8**)malloc(fBufferCount * sizeof(uint8*)); + if (fBuffers == NULL) + return B_NO_MEMORY; + + for (uint32 i = 0; i < fBufferCount; i++) { + fBuffers[i] = (uint8*)malloc(fMaxBufferSize); + if (fBuffers[i] == NULL) + return B_NO_MEMORY; + } + + fReadSem = create_sem(0, "reader"); + if (fReadSem < B_OK) + return fReadSem; + + fWriteSem = create_sem(fBufferCount - 1, "writer"); + if (fWriteSem < B_OK) + return fWriteSem; + + fFinishedSem = create_sem(0, "finished"); + if (fFinishedSem < B_OK) + return fFinishedSem; + + fWriterThread = spawn_thread(&_Writer, "buffer reader", B_LOW_PRIORITY, + this); + if (fWriterThread < B_OK) + return fWriterThread; + + return resume_thread(fWriterThread); +} + + +status_t +AdaptiveBuffering::Read(uint8* /*buffer*/, size_t* _length) +{ + *_length = 0; + return B_OK; +} + + +status_t +AdaptiveBuffering::Write(uint8* /*buffer*/, size_t /*length*/) +{ + return B_OK; +} + + +status_t +AdaptiveBuffering::Run() +{ + fReadIndex = 0; + fWriteIndex = 0; + fReadCount = 0; + fWriteCount = 0; + fWriteStatus = B_OK; + fWriteTime = 0; + + while (fWriteStatus >= B_OK) { + bigtime_t start = system_time(); + int32 index = fReadIndex; + + TRACE("%ld. read index %lu, buffer size %lu\n", fReadCount, index, + fCurrentBufferSize); + + fReadBytes[index] = fCurrentBufferSize; + status_t status = Read(fBuffers[index], &fReadBytes[index]); + if (status < B_OK) + return status; + + TRACE("%ld. read -> %lu bytes\n", fReadCount, fReadBytes[index]); + + fReadCount++; + fReadIndex = (index + 1) % fBufferCount; + if (fReadBytes[index] == 0) + fFinished = true; + release_sem(fReadSem); + + while (acquire_sem(fWriteSem) == B_INTERRUPTED) + ; + + if (fFinished) + break; + + bigtime_t readTime = system_time() - start; + uint32 writeTime = fWriteTime; + if (writeTime) { + if (writeTime > readTime) { + fCurrentBufferSize = fCurrentBufferSize * 8/9; + fCurrentBufferSize &= ~65535; + } else { + fCurrentBufferSize = fCurrentBufferSize * 9/8; + fCurrentBufferSize = (fCurrentBufferSize + 65535) & ~65535; + + if (fCurrentBufferSize > fMaxBufferSize) + fCurrentBufferSize = fMaxBufferSize; + } + } + } + + while (acquire_sem(fFinishedSem) == B_INTERRUPTED) + ; + + return fWriteStatus; +} + + +void +AdaptiveBuffering::_QuitWriter() +{ + if (fWriterThread >= B_OK) { + fQuit = true; + release_sem(fReadSem); + + status_t status; + wait_for_thread(fWriterThread, &status); + + fWriterThread = -1; + } +} + + +status_t +AdaptiveBuffering::_Writer() +{ + while (true) { + while (acquire_sem(fReadSem) == B_INTERRUPTED) + ; + if (fQuit) + break; + + bigtime_t start = system_time(); + + TRACE("%ld. write index %lu, %p, bytes %lu\n", fWriteCount, fWriteIndex, + fBuffers[fWriteIndex], fReadBytes[fWriteIndex]); + + fWriteStatus = Write(fBuffers[fWriteIndex], fReadBytes[fWriteIndex]); + + TRACE("%ld. write done\n", fWriteCount); + + fWriteIndex = (fWriteIndex + 1) % fBufferCount; + fWriteTime = uint32(system_time() - start); + fWriteCount++; + + release_sem(fWriteSem); + + if (fWriteStatus < B_OK) + return fWriteStatus; + if (fFinished && fWriteCount == fReadCount) + release_sem(fFinishedSem); + } + + return B_OK; +} + + +/*static*/ status_t +AdaptiveBuffering::_Writer(void* self) +{ + return ((AdaptiveBuffering*)self)->_Writer(); +} + Added: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/AdaptiveBuffering.h =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/AdaptiveBuffering.h 2008-11-01 10:53:58 UTC (rev 28418) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/AdaptiveBuffering.h 2008-11-01 10:54:51 UTC (rev 28419) @@ -0,0 +1,49 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ +#ifndef ADAPTIVE_BUFFERING_H +#define ADAPTIVE_BUFFERING_H + + +#include + + +class AdaptiveBuffering { +public: + AdaptiveBuffering(size_t initialBufferSize, + size_t maxBufferSize, uint32 count); + virtual ~AdaptiveBuffering(); + + virtual status_t Init(); + + virtual status_t Read(uint8* buffer, size_t* _length); + virtual status_t Write(uint8* buffer, size_t length); + + status_t Run(); + +private: + void _QuitWriter(); + status_t _Writer(); + static status_t _Writer(void* self); + + thread_id fWriterThread; + uint8** fBuffers; + size_t* fReadBytes; + uint32 fBufferCount; + uint32 fReadIndex; + uint32 fWriteIndex; + uint32 fReadCount; + uint32 fWriteCount; + size_t fMaxBufferSize; + size_t fCurrentBufferSize; + sem_id fReadSem; + sem_id fWriteSem; + sem_id fFinishedSem; + status_t fWriteStatus; + uint32 fWriteTime; + bool fFinished; + bool fQuit; +}; + +#endif // ADAPTIVE_BUFFERING_H Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/Jamfile =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/Jamfile 2008-11-01 10:53:58 UTC (rev 28418) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/Jamfile 2008-11-01 10:54:51 UTC (rev 28419) @@ -2,6 +2,14 @@ SimpleTest generate_hashs : generate_hashs.cpp + AdaptiveBuffering.cpp SHA256.cpp : be $(TARGET_LIBSTDC++) ; + +SimpleTest consistency_check : + consistency_check.cpp + AdaptiveBuffering.cpp + SHA256.cpp + : be $(TARGET_LIBSTDC++) +; Added: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp 2008-11-01 10:53:58 UTC (rev 28418) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp 2008-11-01 10:54:51 UTC (rev 28419) @@ -0,0 +1,235 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "AdaptiveBuffering.h" +#include "SHA256.h" + + +//#define TRACE(x...) printf(x) +#define TRACE(x...) ; + + +extern const char *__progname; +static const char *kProgramName = __progname; + +const size_t kInitialBufferSize = 1 * 1024 * 1024; +const size_t kMaxBufferSize = 10 * 1024 * 1024; + + +class SHAProcessor : public AdaptiveBuffering { +public: + SHAProcessor() + : AdaptiveBuffering(kInitialBufferSize, kMaxBufferSize, 3), + fFile(-1) + { + } + + virtual ~SHAProcessor() + { + Unset(); + } + + void Unset() + { + if (fFile >= 0) + close(fFile); + } + + status_t Process(int file) + { + Unset(); + fSHA.Init(); + fFile = file; + + return Run(); + } + + virtual status_t Read(uint8* buffer, size_t* _length) + { + ssize_t bytes = read(fFile, buffer, *_length); + if (bytes < B_OK) + return errno; + + *_length = bytes; + return B_OK; + } + + virtual status_t Write(uint8* buffer, size_t length) + { + fSHA.Update(buffer, length); + return B_OK; + } + + const uint8* Digest() { return fSHA.Digest(); } + size_t DigestLength() const { return fSHA.DigestLength(); } + +private: + SHA256 fSHA; + int fFile; +}; + +struct file_entry { + uint8 hash[SHA_DIGEST_LENGTH]; + ino_t node; + std::string path; + + bool operator<(const struct file_entry& other) const + { + return path < other.path; + } + + std::string HashString() const + { + char buffer[128]; + for (int i = 0; i < SHA_DIGEST_LENGTH; i++) { + sprintf(buffer + i * 2, "%02x", hash[i]); + } + + return buffer; + } +}; + +typedef std::vector FileList; + +void process_file(const char* path); + + +SHAProcessor gSHA; +FileList gFiles; + + +void +process_file(const file_entry& entry) +{ + struct stat stat; + if (::stat(entry.path.c_str(), &stat) != 0) { + fprintf(stderr, "Could not stat file \"%s\": %s\n", entry.path.c_str(), + strerror(errno)); + return; + } + + if (stat.st_ino != entry.node) { + fprintf(stderr, "\"%s\": inode changed from %Ld to %Ld\n", + entry.path.c_str(), entry.node, stat.st_ino); + } + + int file = open(entry.path.c_str(), O_RDONLY); + if (file < 0) { + fprintf(stderr, "Could not open file \"%s\": %s\n", entry.path.c_str(), + strerror(errno)); + return; + } + + status_t status = gSHA.Process(file); + if (status != B_OK) { + fprintf(stderr, "Computing SHA failed \"%s\": %s\n", entry.path.c_str(), + strerror(status)); + return; + } + + if (memcmp(entry.hash, gSHA.Digest(), SHA_DIGEST_LENGTH)) + fprintf(stderr, "\"%s\": Contents differ!\n", entry.path.c_str()); +} + + +int +main(int argc, char** argv) +{ + if (argc != 2) { + fprintf(stderr, "usage: %s \n", kProgramName); + return 1; + } + + const char* hashFileName = argv[1]; + + status_t status = gSHA.Init(); + if (status != B_OK) { + fprintf(stderr, "%s: Could not initialize SHA processor: %s\n", + kProgramName, strerror(status)); + return 1; + } + + // read files from hash file + + int file = open(hashFileName, O_RDONLY); + if (file < 0) { + fprintf(stderr, "%s: Could not open hash file \"%s\": %s\n", + kProgramName, hashFileName, strerror(status)); + return 1; + } + + char buffer[2048]; + read(file, buffer, 4); + if (memcmp(buffer, "HASH", 4)) { + fprintf(stderr, "%s: \"%s\" is not a hash file\n", + kProgramName, hashFileName); + close(file); + return 1; + } + + int fileCount; + read(file, &fileCount, sizeof(int)); + TRACE("Skip %d path(s)\n", fileCount); + + // Skip paths, we don't need it for the consistency check + + for (int i = 0; i < fileCount; i++) { + int length; + read(file, &length, sizeof(int)); + lseek(file, length + 1, SEEK_CUR); + } + + // Read file names and their hash + + read(file, &fileCount, sizeof(int)); + TRACE("Found %d file(s)\n", fileCount); + + for (int i = 0; i < fileCount; i++) { + file_entry entry; + read(file, entry.hash, SHA_DIGEST_LENGTH); + read(file, &entry.node, sizeof(ino_t)); + + int length; + read(file, &length, sizeof(int)); + read(file, buffer, length + 1); + + entry.path = buffer; + + gFiles.push_back(entry); + } + + close(file); + + bigtime_t start = system_time(); + + for (int i = 0; i < fileCount; i++) { + process_file(gFiles[i]); + } + + bigtime_t runtime = system_time() - start; + + if (gFiles.size() > 0) { + printf("Consistency check for %ld files in %g seconds, %g msec per " + "file.\n", gFiles.size(), runtime / 1000000.0, + runtime / 1000.0 / gFiles.size()); + } + + return 0; +} Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp 2008-11-01 10:53:58 UTC (rev 28418) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp 2008-11-01 10:54:51 UTC (rev 28419) @@ -16,7 +16,9 @@ #include #include +#include +#include "AdaptiveBuffering.h" #include "SHA256.h" @@ -31,43 +33,6 @@ const size_t kMaxBufferSize = 10 * 1024 * 1024; -class AdaptiveBuffering { -public: - AdaptiveBuffering(size_t initialBufferSize, - size_t maxBufferSize, uint32 count); - virtual ~AdaptiveBuffering(); - - virtual status_t Init(); - - virtual status_t Read(uint8* buffer, size_t* _length); - virtual status_t Write(uint8* buffer, size_t length); - - status_t Run(); - -private: - void _QuitWriter(); - status_t _Writer(); - static status_t _Writer(void* self); - - thread_id fWriterThread; - uint8** fBuffers; - size_t* fReadBytes; - uint32 fBufferCount; - uint32 fReadIndex; - uint32 fWriteIndex; - uint32 fReadCount; - uint32 fWriteCount; - size_t fMaxBufferSize; - size_t fCurrentBufferSize; - sem_id fReadSem; - sem_id fWriteSem; - sem_id fFinishedSem; - status_t fWriteStatus; - uint32 fWriteTime; - bool fFinished; - bool fQuit; -}; - class SHAProcessor : public AdaptiveBuffering { public: SHAProcessor() @@ -150,224 +115,7 @@ FileList gFiles; -AdaptiveBuffering::AdaptiveBuffering(size_t initialBufferSize, - size_t maxBufferSize, uint32 count) - : - fWriterThread(-1), - fBuffers(NULL), - fReadBytes(NULL), - fBufferCount(count), - fReadIndex(0), - fWriteIndex(0), - fReadCount(0), - fWriteCount(0), - fMaxBufferSize(maxBufferSize), - fCurrentBufferSize(initialBufferSize), - fReadSem(-1), - fWriteSem(-1), - fFinishedSem(-1), - fWriteStatus(B_OK), - fWriteTime(0), - fFinished(false), - fQuit(false) -{ -} - - -AdaptiveBuffering::~AdaptiveBuffering() -{ - _QuitWriter(); - - delete_sem(fReadSem); - delete_sem(fWriteSem); - - if (fBuffers != NULL) { - for (uint32 i = 0; i < fBufferCount; i++) { - if (fBuffers[i] == NULL) - break; - - free(fBuffers[i]); - } - - free(fBuffers); - } - - free(fReadBytes); -} - - -status_t -AdaptiveBuffering::Init() -{ - fReadBytes = (size_t*)malloc(fBufferCount * sizeof(size_t)); - if (fReadBytes == NULL) - return B_NO_MEMORY; - - fBuffers = (uint8**)malloc(fBufferCount * sizeof(uint8*)); - if (fBuffers == NULL) - return B_NO_MEMORY; - - for (uint32 i = 0; i < fBufferCount; i++) { - fBuffers[i] = (uint8*)malloc(fMaxBufferSize); - if (fBuffers[i] == NULL) - return B_NO_MEMORY; - } - - fReadSem = create_sem(0, "reader"); - if (fReadSem < B_OK) - return fReadSem; - - fWriteSem = create_sem(fBufferCount - 1, "writer"); - if (fWriteSem < B_OK) - return fWriteSem; - - fFinishedSem = create_sem(0, "finished"); - if (fFinishedSem < B_OK) - return fFinishedSem; - - fWriterThread = spawn_thread(&_Writer, "buffer reader", B_LOW_PRIORITY, - this); - if (fWriterThread < B_OK) - return fWriterThread; - - return resume_thread(fWriterThread); -} - - -status_t -AdaptiveBuffering::Read(uint8* /*buffer*/, size_t* _length) -{ - *_length = 0; - return B_OK; -} - - -status_t -AdaptiveBuffering::Write(uint8* /*buffer*/, size_t /*length*/) -{ - return B_OK; -} - - -status_t -AdaptiveBuffering::Run() -{ - fReadIndex = 0; - fWriteIndex = 0; - fReadCount = 0; - fWriteCount = 0; - fWriteStatus = B_OK; - fWriteTime = 0; - - while (fWriteStatus >= B_OK) { - bigtime_t start = system_time(); - int32 index = fReadIndex; - - TRACE("%ld. read index %lu, buffer size %lu\n", fReadCount, index, - fCurrentBufferSize); - - fReadBytes[index] = fCurrentBufferSize; - status_t status = Read(fBuffers[index], &fReadBytes[index]); - if (status < B_OK) - return status; - - TRACE("%ld. read -> %lu bytes\n", fReadCount, fReadBytes[index]); - - fReadCount++; - fReadIndex = (index + 1) % fBufferCount; - if (fReadBytes[index] == 0) - fFinished = true; - release_sem(fReadSem); - - while (acquire_sem(fWriteSem) == B_INTERRUPTED) - ; - - if (fFinished) - break; - - bigtime_t readTime = system_time() - start; - uint32 writeTime = fWriteTime; - if (writeTime) { - if (writeTime > readTime) { - fCurrentBufferSize = fCurrentBufferSize * 8/9; - fCurrentBufferSize &= ~65535; - } else { - fCurrentBufferSize = fCurrentBufferSize * 9/8; - fCurrentBufferSize = (fCurrentBufferSize + 65535) & ~65535; - - if (fCurrentBufferSize > fMaxBufferSize) - fCurrentBufferSize = fMaxBufferSize; - } - } - } - - while (acquire_sem(fFinishedSem) == B_INTERRUPTED) - ; - - return fWriteStatus; -} - - void -AdaptiveBuffering::_QuitWriter() -{ - if (fWriterThread >= B_OK) { - fQuit = true; - release_sem(fReadSem); - - status_t status; - wait_for_thread(fWriterThread, &status); - - fWriterThread = -1; - } -} - - -status_t -AdaptiveBuffering::_Writer() -{ - while (true) { - while (acquire_sem(fReadSem) == B_INTERRUPTED) - ; - if (fQuit) - break; - - bigtime_t start = system_time(); - - TRACE("%ld. write index %lu, %p, bytes %lu\n", fWriteCount, fWriteIndex, - fBuffers[fWriteIndex], fReadBytes[fWriteIndex]); - - fWriteStatus = Write(fBuffers[fWriteIndex], fReadBytes[fWriteIndex]); - - TRACE("%ld. write done\n", fWriteCount); - - fWriteIndex = (fWriteIndex + 1) % fBufferCount; - fWriteTime = uint32(system_time() - start); - fWriteCount++; - - release_sem(fWriteSem); - - if (fWriteStatus < B_OK) - return fWriteStatus; - if (fFinished) - release_sem(fFinishedSem); - } - - return B_OK; -} - - -/*static*/ status_t -AdaptiveBuffering::_Writer(void* self) -{ - return ((AdaptiveBuffering*)self)->_Writer(); -} - - -// #pragma mark - - - -void process_directory(const char* path) { DIR* dir = opendir(path); @@ -428,7 +176,7 @@ entry.node = stat.st_ino; entry.path = path; - printf("%s %s\n", entry.HashString().c_str(), path); + //printf("%s %s\n", entry.HashString().c_str(), path); gFiles.push_back(entry); } @@ -489,42 +237,88 @@ return 1; } - bigtime_t start = system_time(); + int fileCount = argc - 2; + char** files = argv + 2; if (argc == 2) { + // read files from hash file + int file = open(hashFileName, O_RDONLY); if (file < 0) { + fprintf(stderr, "%s: Could not open hash file \"%s\": %s\n", + kProgramName, hashFileName, strerror(status)); return 1; } char buffer[2048]; read(file, buffer, 4); if (memcmp(buffer, "HASH", 4)) { + fprintf(stderr, "%s: \"%s\" is not a hash file\n", + kProgramName, hashFileName); close(file); return 1; } - int fileCount; read(file, &fileCount, sizeof(int)); + TRACE("Found %d path(s):\n", fileCount); + files = (char**)malloc(fileCount * sizeof(char*)); + if (files == NULL) { + fprintf(stderr, "%s: Could not allocate %ld bytes\n", + kProgramName, fileCount * sizeof(char*)); + close(file); + return 1; + } + for (int i = 0; i < fileCount; i++) { int length; read(file, &length, sizeof(int)); - read(file, buffer, length + 1); - process_file(buffer); + + files[i] = (char*)malloc(length + 1); + if (files[i] == NULL) { + fprintf(stderr, "%s: Could not allocate %d bytes\n", + kProgramName, length + 1); + close(file); + // TODO: we actually leak memory here, but it's not important in this context + return 1; + } + read(file, files[i], length + 1); + TRACE("\t%s\n", files[i]); } close(file); } else { - for (int i = 2; i < argc; i++) { - process_file(argv[i]); + // Normalize paths + char** normalizedFiles = (char**)malloc(fileCount * sizeof(char*)); + if (normalizedFiles == NULL) { + fprintf(stderr, "%s: Could not allocate %ld bytes\n", + kProgramName, fileCount * sizeof(char*)); + return 1; } + + for (int i = 0; i < fileCount; i++) { + BPath path(files[i], NULL, true); + normalizedFiles[i] = strdup(path.Path()); + if (normalizedFiles[i] == NULL) { + fprintf(stderr, "%s: Could not allocate %ld bytes\n", + kProgramName, strlen(path.Path()) + 1); + return 1; + } + } + + files = normalizedFiles; } + bigtime_t start = system_time(); + + for (int i = 0; i < fileCount; i++) { + process_file(files[i]); + } + sort(gFiles.begin(), gFiles.end()); bigtime_t runtime = system_time() - start; - write_hash_file(hashFileName, argc - 2, argv + 2); + write_hash_file(hashFileName, fileCount, files); if (gFiles.size() > 0) { printf("Generated hashes for %ld files in %g seconds, %g msec per " @@ -532,5 +326,10 @@ runtime / 1000.0 / gFiles.size()); } + for (int i = 0; i < fileCount; i++) { + free(files[i]); + } + free(files); + return 0; } From stippi at mail.berlios.de Sat Nov 1 12:09:33 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 12:09:33 +0100 Subject: [Haiku-commits] r28420 - in haiku/trunk/src/add-ons/input_server/devices: keyboard mouse touchpad Message-ID: <200811011109.mA1B9XUC010404@sheep.berlios.de> Author: stippi Date: 2008-11-01 12:09:28 +0100 (Sat, 01 Nov 2008) New Revision: 28420 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28420&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h Log: * Added Clemens Zeidler to list of authors of the Touchpad add-on. * Added myself to Mouse and Keyboard add-ons for my recent work on them. * Small cleanup in KeyboardInputDevice.h- Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-01 10:54:51 UTC (rev 28419) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-01 11:09:28 UTC (rev 28420) @@ -1,6 +1,7 @@ /* * Copyright 2004-2006, J?r?me Duval. All rights reserved. * Copyright 2005-2008, Axel D?rfler, axeld at pinc-software.de. + * Copyright 2008, Stephan A?mus, superstippi at gmx.de. * * Distributed under the terms of the MIT License. */ Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h 2008-11-01 10:54:51 UTC (rev 28419) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h 2008-11-01 11:09:28 UTC (rev 28420) @@ -1,5 +1,6 @@ /* * Copyright 2004-2008, J?r?me Duval. All rights reserved. + * Copyright 2008, Stephan A?mus, superstippi at gmx.de. * Distributed under the terms of the MIT License. */ #ifndef KEYBOARD_INPUT_DEVICE_H @@ -47,16 +48,16 @@ int32 _Thread(); private: - KeyboardInputDevice* fOwner; - input_device_ref fDeviceRef; - char fPath[B_PATH_NAME_LENGTH]; - int fFD; - thread_id fThread; - kb_settings fSettings; + KeyboardInputDevice* fOwner; + input_device_ref fDeviceRef; + char fPath[B_PATH_NAME_LENGTH]; + int fFD; + thread_id fThread; + kb_settings fSettings; volatile bool fActive; - bool fIsAT; + bool fIsAT; volatile bool fInputMethodStarted; - uint32 fModifiers; + uint32 fModifiers; Keymap fKeymap; BLocker fKeymapLock; Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-01 10:54:51 UTC (rev 28419) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-01 11:09:28 UTC (rev 28420) @@ -6,6 +6,7 @@ * Stefano Ceccherini (stefano.ceccherini at gmail.com) * J?r?me Duval * Axel D?rfler, axeld at pinc-software.de + * Stephan A?mus, superstippi at gmx.de */ Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-01 10:54:51 UTC (rev 28419) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-01 11:09:28 UTC (rev 28420) @@ -1,11 +1,12 @@ /* - * Copyright 2004-2007, Haiku. + * Copyright 2004-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: * Stefano Ceccherini (stefano.ceccherini at gmail.com) * J?r?me Duval * Axel D?rfler, axeld at pinc-software.de + * Clemens Zeidler, haiku at clemens-zeidler.de */ Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-11-01 10:54:51 UTC (rev 28419) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-11-01 11:09:28 UTC (rev 28420) @@ -1,9 +1,10 @@ /* - * Copyright 2004-2006, Haiku. + * Copyright 2004-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: * Stefano Ceccherini + * Clemens Zeidler, haiku at clemens-zeidler.de */ #ifndef MOUSE_INPUT_DEVICE_H #define MOUSE_INPUT_DEVICE_H From marcusoverhagen at arcor.de Sat Nov 1 12:24:38 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Sat, 01 Nov 2008 12:24:38 +0100 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad In-Reply-To: <200811011048.mA1AmnfV008779@sheep.berlios.de> References: <200811011048.mA1AmnfV008779@sheep.berlios.de> Message-ID: <490C3C76.4010700@arcor.de> stippi at mail.berlios.de schrieb: > haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.c > haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.h Oh NOOOOOOOOOOO. Please rename!!!!!! Marcus From axeld at pinc-software.de Sat Nov 1 12:36:42 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 01 Nov 2008 12:36:42 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28416_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate/input_src/add-ons/input=5Fserver/devices_src/add-ons/input?= =?utf-8?q?=5Fserver/devices/touchpad__src/add-ons/kernel/bus=5Fmanagers/p?= =?utf-8?q?s2_src/preferences_src/preferences/touchpad?= In-Reply-To: <490C3C76.4010700@arcor.de> Message-ID: <7752136390-BeMail@zon> Marcus Overhagen wrote: > stippi at mail.berlios.de schrieb: > > haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ > > ps2_standart_mouse.c > > haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ > > ps2_standart_mouse.h > Oh NOOOOOOOOOOO. > Please rename!!!!!! Yup :-)) Bye, Axel. From superstippi at gmx.de Sat Nov 1 12:38:00 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 01 Nov 2008 12:38:00 +0100 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad In-Reply-To: <490C3C76.4010700@arcor.de> References: <200811011048.mA1AmnfV008779@sheep.berlios.de> <490C3C76.4010700@arcor.de> Message-ID: <20081101123800.1481.2@stippis2.1225534427.fake> Marcus Overhagen wrote: > stippi at mail.berlios.de schrieb: > > > haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.c > > haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.h > > Oh NOOOOOOOOOOO. > > Please rename!!!!!! Will do. While I have your attention, could you please have a look through the patch and tell me whether mouse and touchpad should become separate add-ons to the ps2 bus_manager? Best regards, -Stephan From stippi at mail.berlios.de Sat Nov 1 12:40:52 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 12:40:52 +0100 Subject: [Haiku-commits] r28421 - haiku/trunk/src/add-ons/input_server/devices/touchpad Message-ID: <200811011140.mA1Beq0D026150@sheep.berlios.de> Author: stippi Date: 2008-11-01 12:40:48 +0100 (Sat, 01 Nov 2008) New Revision: 28421 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28421&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h Log: * Coding style cleanup * Applied the changes that were done to MouseInputDevice: - use BObjectList, - take adventage of BPathMonitor node monitor message fieds - remove the device in the polling thread upon ioctl() error * Added TODOs about refactoring the code together with MouseInputDevice. Untested, but the code is so similar, I am pretty confident it still works. (famous last words... will test soon anyways) Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile 2008-11-01 11:09:28 UTC (rev 28420) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/Jamfile 2008-11-01 11:40:48 UTC (rev 28421) @@ -1,13 +1,7 @@ SubDir HAIKU_TOP src add-ons input_server devices touchpad ; -SetSubDirSupportedPlatformsBeOSCompatible ; +UsePrivateHeaders input shared ; -UsePrivateHeaders input ; - Addon touchpad : TouchpadInputDevice.cpp : be input_server ; - -Package haiku-inputkit-cvs : - touchpad : - boot home config add-ons input_server devices ; Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-01 11:09:28 UTC (rev 28420) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-01 11:40:48 UTC (rev 28421) @@ -49,7 +49,7 @@ class TouchpadDevice { public: - TouchpadDevice(BInputServerDevice& target, const char* path); + TouchpadDevice(TouchpadInputDevice& target, const char* path); ~TouchpadDevice(); status_t Start(); @@ -76,22 +76,22 @@ char* _BuildShortName() const; - status_t GetSettingsPath(BPath &path); + status_t _GetSettingsPath(BPath &path); private: - BInputServerDevice& fTarget; - BString fPath; - int fDevice; + TouchpadInputDevice& fTarget; + BString fPath; + int fDevice; - input_device_ref fDeviceRef; - mouse_settings fSettings; - bool fDeviceRemapsButtons; + input_device_ref fDeviceRef; + mouse_settings fSettings; + bool fDeviceRemapsButtons; - thread_id fThread; - volatile bool fActive; + thread_id fThread; + volatile bool fActive; - bool fIsTouchpad; - touchpad_settings fTouchpadSettings; + bool fIsTouchpad; + touchpad_settings fTouchpadSettings; }; @@ -118,10 +118,12 @@ // #pragma mark - -TouchpadDevice::TouchpadDevice(BInputServerDevice& target, const char *driverPath) +TouchpadDevice::TouchpadDevice(TouchpadInputDevice& target, + const char* driverPath) : fTarget(target), fDevice(-1), + fDeviceRemapsButtons(false), fThread(-1), fActive(false), fIsTouchpad(false) @@ -138,7 +140,6 @@ fSettings.map.button[2] = B_TERTIARY_MOUSE_BUTTON; #endif - fDeviceRemapsButtons = false; }; @@ -152,13 +153,12 @@ status_t -TouchpadDevice::GetSettingsPath(BPath &path) +TouchpadDevice::_GetSettingsPath(BPath &path) { status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if(status < B_OK) + if (status < B_OK) return status; - path.Append(TOUCHPAD_SETTINGS_FILE); - return B_OK; + return path.Append(TOUCHPAD_SETTINGS_FILE); } @@ -170,7 +170,7 @@ return errno; // touchpad settings - if(ioctl(fDevice, MS_IS_TOUCHPAD, NULL) == B_OK){ + if (ioctl(fDevice, MS_IS_TOUCHPAD, NULL) == B_OK) { LOG("is touchpad %s\n", fPath.String()); fIsTouchpad = true; } @@ -178,25 +178,23 @@ fTouchpadSettings = kDefaultTouchpadSettings; BPath path; - status_t status = GetSettingsPath(path); + status_t status = _GetSettingsPath(path); BFile settingsFile(path.Path(), B_READ_ONLY); - if(status == B_OK && settingsFile.InitCheck() == B_OK){ - if(settingsFile.Read(&fTouchpadSettings, sizeof(touchpad_settings)) - != sizeof(touchpad_settings)) - { + if (status == B_OK && settingsFile.InitCheck() == B_OK) { + if (settingsFile.Read(&fTouchpadSettings, sizeof(touchpad_settings)) + != sizeof(touchpad_settings)) { LOG("failed to load settings\n"); } } UpdateTouchpadSettings(); - UpdateSettings(); char threadName[B_OS_NAME_LENGTH]; snprintf(threadName, B_OS_NAME_LENGTH, "%s watcher", fDeviceRef.name); fThread = spawn_thread(_ThreadFunction, threadName, - kMouseThreadPriority, (void *)this); + kMouseThreadPriority, (void*)this); if (fThread < B_OK) status = fThread; @@ -222,6 +220,9 @@ fActive = false; // this will stop the thread as soon as it reads the next packet + close(fDevice); + fDevice = -1; + if (fThread >= B_OK) { // unblock the thread, which might wait on a semaphore. suspend_thread(fThread); @@ -230,14 +231,14 @@ status_t dummy; wait_for_thread(fThread, &dummy); } - - close(fDevice); } status_t TouchpadDevice::UpdateSettings() { + // TODO: This is duplicated in MouseInputDevice.cpp -> Refactor + CALLED(); // retrieve current values @@ -272,21 +273,28 @@ ioctl(fDevice, MS_SET_TYPE, &fSettings.type); return B_OK; - } status_t TouchpadDevice::ReadTouchpadSettingsMsg(BMessage* msg) { - msg->FindBool("scroll_twofinger", &(fTouchpadSettings.scroll_twofinger)); - msg->FindBool("scroll_multifinger", &(fTouchpadSettings.scroll_multifinger)); - msg->FindFloat("scroll_rightrange", &(fTouchpadSettings.scroll_rightrange)); - msg->FindFloat("scroll_bottomrange", &(fTouchpadSettings.scroll_bottomrange)); - msg->FindInt16("scroll_xstepsize", (int16*)&(fTouchpadSettings.scroll_xstepsize)); - msg->FindInt16("scroll_ystepsize", (int16*)&(fTouchpadSettings.scroll_ystepsize)); - msg->FindInt8("scroll_acceleration", (int8*)&(fTouchpadSettings.scroll_acceleration)); - msg->FindInt8("tapgesture_sensibility", (int8*)&(fTouchpadSettings.tapgesture_sensibility)); + msg->FindBool("scroll_twofinger", + &(fTouchpadSettings.scroll_twofinger)); + msg->FindBool("scroll_multifinger", + &(fTouchpadSettings.scroll_multifinger)); + msg->FindFloat("scroll_rightrange", + &(fTouchpadSettings.scroll_rightrange)); + msg->FindFloat("scroll_bottomrange", + &(fTouchpadSettings.scroll_bottomrange)); + msg->FindInt16("scroll_xstepsize", + (int16*)&(fTouchpadSettings.scroll_xstepsize)); + msg->FindInt16("scroll_ystepsize", + (int16*)&(fTouchpadSettings.scroll_ystepsize)); + msg->FindInt8("scroll_acceleration", + (int8*)&(fTouchpadSettings.scroll_acceleration)); + msg->FindInt8("tapgesture_sensibility", + (int8*)&(fTouchpadSettings.tapgesture_sensibility)); return B_OK; } @@ -295,7 +303,7 @@ status_t TouchpadDevice::UpdateTouchpadSettings() { - if(fIsTouchpad){ + if (fIsTouchpad) { ioctl(fDevice, MS_SET_TOUCHPAD_SETTINGS, &fTouchpadSettings); return B_OK; } @@ -306,14 +314,27 @@ void TouchpadDevice::_Run() { + // TODO: Exact duplicate of MouseDevice::_Run() -> Refactor uint32 lastButtons = 0; while (fActive) { mouse_movement movements; memset(&movements, 0, sizeof(movements)); - if (ioctl(fDevice, MS_READ, &movements) != B_OK) + if (ioctl(fDevice, MS_READ, &movements) != B_OK) { + if (fActive) { + fThread = -1; + fTarget._RemoveDevice(fPath.String()); + } else { + // In case active is already false, another thread + // waits for this thread to quit, and may already hold + // locks that _RemoveDevice() wants to acquire. In another + // words, the device is already being removed, so we simply + // quit here. + } + // TOAST! return; + } uint32 buttons = lastButtons ^ movements.buttons; @@ -326,8 +347,6 @@ movements.clicks, movements.wheel_xdelta, movements.wheel_ydelta); LOG("%s: x: %ld, y: %ld\n", device->device_ref.name, deltaX, deltaY);*/ - BMessage *message = NULL; - // Send single messages for each event if (buttons != 0) { @@ -355,7 +374,7 @@ } if ((movements.wheel_ydelta != 0) || (movements.wheel_xdelta != 0)) { - message = new BMessage(B_MOUSE_WHEEL_CHANGED); + BMessage* message = new BMessage(B_MOUSE_WHEEL_CHANGED); if (message == NULL) continue; @@ -373,7 +392,7 @@ status_t TouchpadDevice::_ThreadFunction(void* arg) { - TouchpadDevice* device = (TouchpadDevice *)arg; + TouchpadDevice* device = (TouchpadDevice*)arg; device->_Run(); return B_OK; } @@ -383,6 +402,8 @@ TouchpadDevice::_BuildMouseMessage(uint32 what, uint64 when, uint32 buttons, int32 deltaX, int32 deltaY) const { + // TODO: Exact duplicate of MouseDevice::_BuildMouseMessage() -> Refactor + BMessage* message = new BMessage(what); if (message == NULL) return NULL; @@ -403,6 +424,8 @@ TouchpadDevice::_ComputeAcceleration(const mouse_movement& movements, int32& deltaX, int32& deltaY) const { + // TODO: Exact duplicate of MouseDevice::_ComputeAcceleration() -> Refactor + // basic mouse speed deltaX = movements.xdelta * fSettings.accel.speed >> 16; deltaY = movements.ydelta * fSettings.accel.speed >> 16; @@ -430,6 +453,8 @@ uint32 TouchpadDevice::_RemapButtons(uint32 buttons) const { + // TODO: Exact duplicate of MouseDevice::_RemapButtons() -> Refactor + if (fDeviceRemapsButtons) return buttons; @@ -464,8 +489,8 @@ string.CopyInto(name, slash + 1, string.Length() - slash); //int32 index = atoi(name.String()) + 1; - BString final = "Touchpad_"; - final+= name; + BString final = "Touchpad "; + final += name; LOG("NAME %s, %s\n", final.String(), fPath.String()); @@ -484,7 +509,6 @@ CALLED(); StartMonitoringDevice(kTouchpadDevicesDirectoryPS2); - _RecursiveScan(kTouchpadDevicesDirectoryPS2); } @@ -493,12 +517,8 @@ { CALLED(); StopMonitoringDevice(kTouchpadDevicesDirectoryPS2); + fDevices.MakeEmpty(); - int32 count = fDevices.CountItems(); - while (count-- > 0) { - delete (TouchpadDevice *)fDevices.RemoveItem(count); - } - #if DEBUG fclose(sLogFile); #endif @@ -541,14 +561,14 @@ LOG("%s(%s, code: %lu)\n", __PRETTY_FUNCTION__, name, command); TouchpadDevice* device = (TouchpadDevice*)cookie; - if (command == MS_SET_TOUCHPAD_SETTINGS){ + if (command == B_NODE_MONITOR) + return _HandleMonitor(message); + + if (command == MS_SET_TOUCHPAD_SETTINGS) { device->ReadTouchpadSettingsMsg(message); return device->UpdateTouchpadSettings(); } - if (command == B_NODE_MONITOR) - return _HandleMonitor(message); - if (command >= B_MOUSE_TYPE_CHANGED && command <= B_MOUSE_ACCELERATION_CHANGED) return device->UpdateSettings(); @@ -557,46 +577,46 @@ } -// TODO: Test this. USB doesn't work on my machine status_t TouchpadInputDevice::_HandleMonitor(BMessage* message) { CALLED(); + const char* path; int32 opcode; - if (message->FindInt32("opcode", &opcode) < B_OK) + if (message->FindInt32("opcode", &opcode) != B_OK + || (opcode != B_ENTRY_CREATED && opcode != B_ENTRY_REMOVED) + || message->FindString("path", &path) != B_OK) return B_BAD_VALUE; - if (opcode != B_ENTRY_CREATED && opcode != B_ENTRY_REMOVED) - return B_OK; + if (opcode == B_ENTRY_CREATED) + return _AddDevice(path); - BEntry entry; - BPath path; - dev_t device; - ino_t directory; - const char *name; +#if 0 + return _RemoveDevice(path); +#else + // Don't handle B_ENTRY_REMOVED, let the control thread take care of it. + return B_OK; +#endif +} - if (message->FindInt32("device", &device) < B_OK - || message->FindInt64("directory", &directory) < B_OK - || message->FindString("name", &name) < B_OK) - return B_BAD_VALUE; - entry_ref ref(device, directory, name); - status_t status; +void +TouchpadInputDevice::_RecursiveScan(const char* directory) +{ + CALLED(); - if ((status = entry.SetTo(&ref)) != B_OK) - return status; - if ((status = entry.GetPath(&path)) != B_OK) - return status; - if ((status = path.InitCheck()) != B_OK) - return status; + BEntry entry; + BDirectory dir(directory); + while (dir.GetNextEntry(&entry) == B_OK) { + BPath path; + entry.GetPath(&path); - if (opcode == B_ENTRY_CREATED) - status = _AddDevice(path.Path()); - else - status = _RemoveDevice(path.Path()); - - return status; + if (entry.IsDirectory()) + _RecursiveScan(path.Path()); + else + _AddDevice(path.Path()); + } } @@ -605,9 +625,9 @@ { CALLED(); - for (int32 i = fDevices.CountItems(); i-- > 0;) { - TouchpadDevice* device = (TouchpadDevice*)fDevices.ItemAt(i); - if (!strcmp(device->Path(), path)) + for (int32 i = fDevices.CountItems() - 1; i >= 0; i--) { + TouchpadDevice* device = fDevices.ItemAt(i); + if (strcmp(device->Path(), path) == 0) return device; } @@ -631,7 +651,7 @@ return B_NO_MEMORY; } - input_device_ref *devices[2]; + input_device_ref* devices[2]; devices[0] = device->DeviceRef(); devices[1] = NULL; @@ -648,39 +668,15 @@ if (device == NULL) return B_ENTRY_NOT_FOUND; - fDevices.RemoveItem(device); - - input_device_ref *devices[2]; + input_device_ref* devices[2]; devices[0] = device->DeviceRef(); devices[1] = NULL; UnregisterDevices(devices); - delete device; + fDevices.RemoveItem(device); + return B_OK; } -void -TouchpadInputDevice::_RecursiveScan(const char* directory) -{ - CALLED(); - - BEntry entry; - BDirectory dir(directory); - while (dir.GetNextEntry(&entry) == B_OK) { - BPath path; - entry.GetPath(&path); - - if (!strcmp(path.Leaf(), "serial")) { - // skip serial - continue; - } - - if (entry.IsDirectory()) - _RecursiveScan(path.Path()); - else - _AddDevice(path.Path()); - } -} - Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-11-01 11:09:28 UTC (rev 28420) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-11-01 11:40:48 UTC (rev 28421) @@ -12,38 +12,43 @@ #include #include -#include +#include + #include #define DEBUG 1 class TouchpadDevice; class TouchpadInputDevice : public BInputServerDevice { - public: - TouchpadInputDevice(); - ~TouchpadInputDevice(); +public: + TouchpadInputDevice(); + virtual ~TouchpadInputDevice(); - virtual status_t InitCheck(); + virtual status_t InitCheck(); - virtual status_t Start(const char* name, void* cookie); - virtual status_t Stop(const char* name, void* cookie); + virtual status_t Start(const char* name, void* cookie); + virtual status_t Stop(const char* name, void* cookie); - virtual status_t Control(const char* name, void* cookie, - uint32 command, BMessage* message); + virtual status_t Control(const char* name, void* cookie, + uint32 command, BMessage* message); private: - status_t _HandleMonitor(BMessage* message); - void _RecursiveScan(const char* directory); + friend class TouchpadDevice; + // TODO: needed by the control thread to remove a dead device + // find a better way... - TouchpadDevice* _FindDevice(const char* path); - status_t _AddDevice(const char* path); - status_t _RemoveDevice(const char* path); + status_t _HandleMonitor(BMessage* message); + void _RecursiveScan(const char* directory); - BList fDevices; + TouchpadDevice* _FindDevice(const char* path); + status_t _AddDevice(const char* path); + status_t _RemoveDevice(const char* path); + + BObjectList fDevices; #ifdef DEBUG public: - static FILE *sLogFile; + static FILE* sLogFile; #endif }; From julun at mail.berlios.de Sat Nov 1 12:58:07 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Sat, 1 Nov 2008 12:58:07 +0100 Subject: [Haiku-commits] r28422 - haiku/trunk/src/preferences/touchpad Message-ID: <200811011158.mA1Bw7xf014813@sheep.berlios.de> Author: julun Date: 2008-11-01 12:58:03 +0100 (Sat, 01 Nov 2008) New Revision: 28422 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28422&view=rev Modified: haiku/trunk/src/preferences/touchpad/main.cpp Log: * gcc4 build fix Modified: haiku/trunk/src/preferences/touchpad/main.cpp =================================================================== --- haiku/trunk/src/preferences/touchpad/main.cpp 2008-11-01 11:40:48 UTC (rev 28421) +++ haiku/trunk/src/preferences/touchpad/main.cpp 2008-11-01 11:58:03 UTC (rev 28422) @@ -14,13 +14,13 @@ window_type type, uint32 flags) :BWindow(frame, title, type, flags) - {}; + {} - virtual bool TouchpadPrefWindow::QuitRequested() + virtual bool QuitRequested() { be_app->PostMessage(B_QUIT_REQUESTED); return true; - }; + } }; @@ -36,4 +36,4 @@ delete app; return 0; -} \ No newline at end of file +} From host.haiku at gmx.de Sat Nov 1 13:04:34 2008 From: host.haiku at gmx.de (julun) Date: Sat, 01 Nov 2008 13:04:34 +0100 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad In-Reply-To: <200811011048.mA1AmnfV008779@sheep.berlios.de> References: <200811011048.mA1AmnfV008779@sheep.berlios.de> Message-ID: <490C45D2.9060006@gmx.de> stippi at mail.berlios.de schrieb: > Author: stippi > Date: 2008-11-01 11:48:35 +0100 (Sat, 01 Nov 2008) > New Revision: 28416 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28416&view=rev > > Log: > Patch by Clemens Zeilder: > * Implemented Synaptics touchpad support in the PS2 bus_manager by > refactoring/splitting the structure some and adding touchpad device > handling. > * Implemented Touchpad input_server device add-on > * Created Touchpad preflet for configuring advances Synaptics touchpad > options like scroll region (both horizontal and vertical) as well > as other neat stuff > > Thanks a lot, Clemens! great work Clemens! Though i noticed a really huge slowdown moving the mouse around if there is no Touchpad present. It also crashes while pressing the preflets 'Default' button. Best regards, Karsten From marcusoverhagen at arcor.de Sat Nov 1 13:13:38 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Sat, 01 Nov 2008 13:13:38 +0100 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad In-Reply-To: <20081101123800.1481.2@stippis2.1225534427.fake> References: <200811011048.mA1AmnfV008779@sheep.berlios.de> <490C3C76.4010700@arcor.de> <20081101123800.1481.2@stippis2.1225534427.fake> Message-ID: <490C47F2.2090300@arcor.de> Stephan Assmus schrieb: >> Please rename!!!!!! > > Will do. While I have your attention, could you please have a look through > the patch and tell me whether mouse and touchpad should become separate > add-ons to the ps2 bus_manager? In an ideal world, the ps2 busmanager would act similar to the usb busmanager, and drivers for keyboard, mice and touchpad would use it. The busmanager would provide data streams of the available serial connections. However, I don't think thats it's worth the effort to implement that. Generally, I'm happy that touchpad support is finally beeing added, but the patch contains some issues. ps2_mouse.c is now emtpy, and ps2_standart_mouse.c has no history. Please rename r28415 ps2_mouse.c into ps2_standard_mouse.c, and apply the patches afterwards. movement_maker.c looks alien. Was this copied from BSD? It also has no copyright statement. Please rename all standart into standard. That error is all over the place. There are various strange names, like #define standart_mouse_HISTORY_SIZE #define F_pointing_dev_TYPE_INTELLIMOUSE Additionally, there are plenty of coding style violations, especially for() and while() without space. Finally, struct member alignment in touchpad_movement and other structs could be improved. regards Marcus From axeld at mail.berlios.de Sat Nov 1 13:35:28 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 13:35:28 +0100 Subject: [Haiku-commits] r28423 - haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check Message-ID: <200811011235.mA1CZSWr009058@sheep.berlios.de> Author: axeld Date: 2008-11-01 13:35:28 +0100 (Sat, 01 Nov 2008) New Revision: 28423 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28423&view=rev Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp Log: * Don't traverse symlinks. Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp 2008-11-01 11:58:03 UTC (rev 28422) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp 2008-11-01 12:35:28 UTC (rev 28423) @@ -146,7 +146,7 @@ process_file(const char* path) { struct stat stat; - if (::stat(path, &stat) != 0) { + if (::lstat(path, &stat) != 0) { fprintf(stderr, "Could not stat file \"%s\": %s\n", path, strerror(errno)); return; @@ -156,6 +156,8 @@ process_directory(path); return; } + if (S_ISLNK(stat.st_mode)) + return; int file = open(path, O_RDONLY); if (file < 0) { From axeld at mail.berlios.de Sat Nov 1 13:51:20 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 13:51:20 +0100 Subject: [Haiku-commits] r28424 - haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check Message-ID: <200811011251.mA1CpK4b010615@sheep.berlios.de> Author: axeld Date: 2008-11-01 13:51:20 +0100 (Sat, 01 Nov 2008) New Revision: 28424 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28424&view=rev Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp Log: * Added "progress bars". Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp 2008-11-01 12:35:28 UTC (rev 28423) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/consistency_check.cpp 2008-11-01 12:51:20 UTC (rev 28424) @@ -116,7 +116,7 @@ void -process_file(const file_entry& entry) +process_file(const file_entry& entry, int number) { struct stat stat; if (::stat(entry.path.c_str(), &stat) != 0) { @@ -146,6 +146,12 @@ if (memcmp(entry.hash, gSHA.Digest(), SHA_DIGEST_LENGTH)) fprintf(stderr, "\"%s\": Contents differ!\n", entry.path.c_str()); + + static bigtime_t sLastUpdate = -1; + if (system_time() - sLastUpdate > 500000) { + printf("%ld files scanned\33[1A\n", number); + sLastUpdate = system_time(); + } } @@ -220,7 +226,7 @@ bigtime_t start = system_time(); for (int i = 0; i < fileCount; i++) { - process_file(gFiles[i]); + process_file(gFiles[i], i); } bigtime_t runtime = system_time() - start; Modified: haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp 2008-11-01 12:35:28 UTC (rev 28423) +++ haiku/trunk/src/tests/add-ons/kernel/file_systems/consistency_check/generate_hashs.cpp 2008-11-01 12:51:20 UTC (rev 28424) @@ -181,6 +181,12 @@ //printf("%s %s\n", entry.HashString().c_str(), path); gFiles.push_back(entry); + + static bigtime_t sLastUpdate = -1; + if (system_time() - sLastUpdate > 500000) { + printf("%ld files scanned\33[1A\n", gFiles.size()); + sLastUpdate = system_time(); + } } From stippi at mail.berlios.de Sat Nov 1 14:00:10 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 14:00:10 +0100 Subject: [Haiku-commits] r28425 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811011300.mA1D0AXn011263@sheep.berlios.de> Author: stippi Date: 2008-11-01 14:00:00 +0100 (Sat, 01 Nov 2008) New Revision: 28425 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28425&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h Removed: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.h Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.h Log: * standart -> standard * Hopefully fixed most of the coding style violations * ps2_trackpoint.h had the wrong header guard Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile 2008-11-01 12:51:20 UTC (rev 28424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/Jamfile 2008-11-01 13:00:00 UTC (rev 28425) @@ -9,7 +9,7 @@ ps2_dev.c ps2_keyboard.c ps2_module.c - ps2_standart_mouse.c + ps2_standard_mouse.c ps2_synaptics.c ps2_trackpoint.c ps2_service.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-01 12:51:20 UTC (rev 28424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-01 13:00:00 UTC (rev 28425) @@ -7,8 +7,7 @@ # define INFO(x...) #endif -typedef union -{ +typedef union { float value; /* FIXME: Assumes 32 bit int. */ unsigned int word; @@ -41,23 +40,23 @@ uint32 i; GET_FLOAT_WORD(i0,x); j0 = ((i0>>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0>=0) {i0=0;} - else if((i0&0x7fffffff)!=0) + if (j0<23) { + if (j0<0) { /* raise inexact if x != 0 */ + if (huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ + if (i0>=0) {i0=0;} + else if ((i0&0x7fffffff)!=0) { i0=0xbf800000;} } } else { i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>(float)0.0) { /* raise inexact flag */ - if(i0<0) i0 += (0x00800000)>>j0; + if ((i0&i)==0) return x; /* x is integral */ + if (huge+x>(float)0.0) { /* raise inexact flag */ + if (i0<0) i0 += (0x00800000)>>j0; i0 &= (~i); } } } else { - if(j0==0x80) return x+x; /* inf or NaN */ + if (j0==0x80) return x+x; /* inf or NaN */ else return x; /* x is integral */ } SET_FLOAT_WORD(x,i0); @@ -73,22 +72,22 @@ GET_FLOAT_WORD(i0,x); j0 = ((i0>>23)&0xff)-0x7f; - if(j0<23) { - if(j0<0) { /* raise inexact if x != 0 */ - if(huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ - if(i0<0) {i0=0x80000000;} - else if(i0!=0) { i0=0x3f800000;} + if (j0<23) { + if (j0<0) { /* raise inexact if x != 0 */ + if (huge+x>(float)0.0) {/* return 0*sign(x) if |x|<1 */ + if (i0<0) {i0=0x80000000;} + else if (i0!=0) { i0=0x3f800000;} } } else { i = (0x007fffff)>>j0; - if((i0&i)==0) return x; /* x is integral */ - if(huge+x>(float)0.0) { /* raise inexact flag */ - if(i0>0) i0 += (0x00800000)>>j0; + if ((i0&i)==0) return x; /* x is integral */ + if (huge+x>(float)0.0) { /* raise inexact flag */ + if (i0>0) i0 += (0x00800000)>>j0; i0 &= (~i); } } } else { - if(j0==0x80) return x+x; /* inf or NaN */ + if (j0==0x80) return x+x; /* inf or NaN */ else return x; /* x is integral */ } SET_FLOAT_WORD(x,i0); @@ -108,25 +107,25 @@ GET_FLOAT_WORD(ix,x); /* take care of Inf and NaN */ - if((ix&0x7f800000)==0x7f800000) { + if ((ix&0x7f800000)==0x7f800000) { return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf sqrt(-inf)=sNaN */ } /* take care of zero */ - if(ix<=0) { - if((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ - else if(ix<0) + if (ix<=0) { + if ((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ + else if (ix<0) return (x-x)/(x-x); /* sqrt(-ve) = sNaN */ } /* normalize x */ m = (ix>>23); - if(m==0) { /* subnormal x */ + if (m==0) { /* subnormal x */ for(i=0;(ix&0x00800000)==0;i++) ix<<=1; m -= i-1; } m -= 127; /* unbias exponent */ ix = (ix&0x007fffff)|0x00800000; - if(m&1) /* odd m, double x to make it even */ + if (m&1) /* odd m, double x to make it even */ ix += ix; m >>= 1; /* m = [m/2] */ @@ -137,7 +136,7 @@ while(r!=0) { t = s+r; - if(t<=ix) { + if (t<=ix) { s = t+r; ix -= t; q += r; @@ -147,7 +146,7 @@ } /* use floating add to find out rounding direction */ - if(ix!=0) { + if (ix!=0) { z = one-tiny; /* trigger inexact flag */ if (z>=one) { z = one+tiny; @@ -165,8 +164,9 @@ int32 -make_small(float value){ - if(value > 0) +make_small(float value) +{ + if (value > 0) return floorf(value); else return ceilf(value); @@ -181,15 +181,14 @@ float meanX = 0, meanY = 0; // calculate mean - for(i = 0; i < move->n_points; i++){ + for (i = 0; i < move->n_points; i++) { meanXOld+= move->historyX[i]; meanYOld+= move->historyY[i]; } - if(move->n_points == 0){ + if (move->n_points == 0) { meanXOld = posX; meanYOld = posY; - } - else{ + } else { meanXOld = meanXOld / move->n_points; meanYOld = meanYOld / move->n_points; } @@ -198,14 +197,14 @@ meanY = (meanYOld + posY) / 2; // fill history - for(i = 0; i < HISTORY_SIZE - 1; i++){ + for (i = 0; i < HISTORY_SIZE - 1; i++) { move->historyX[i] = move->historyX[i + 1]; move->historyY[i] = move->historyY[i + 1]; } move->historyX[HISTORY_SIZE - 1] = meanX; move->historyY[HISTORY_SIZE - 1] = meanY; - if(move->n_points < HISTORY_SIZE){ + if (move->n_points < HISTORY_SIZE) { move->n_points++; move->xDelta = 0; move->yDelta = 0; @@ -266,9 +265,9 @@ void start_new_movment(movement_maker *move) { - if(move->scrolling_xStep <= 0) + if (move->scrolling_xStep <= 0) move->scrolling_xStep = 1; - if(move->scrolling_yStep <= 0) + if (move->scrolling_yStep <= 0) move->scrolling_yStep = 1; move->n_points = 0; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 12:51:20 UTC (rev 28424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 13:00:00 UTC (rev 28425) @@ -12,7 +12,7 @@ #include "ps2_dev.h" #include "ps2_service.h" -#include "ps2_standart_mouse.h" +#include "ps2_standard_mouse.h" #include "ps2_synaptics.h" #include "ps2_trackpoint.h" @@ -22,12 +22,12 @@ ps2_dev ps2_device[PS2_DEVICE_COUNT] = { - { .name = "input/mouse/ps2/0", .active = false, .idx = 0, .result_sem = -1, .command = standart_command_timeout }, - { .name = "input/mouse/ps2/1", .active = false, .idx = 1, .result_sem = -1, .command = standart_command_timeout }, - { .name = "input/mouse/ps2/2", .active = false, .idx = 2, .result_sem = -1, .command = standart_command_timeout }, - { .name = "input/mouse/ps2/3", .active = false, .idx = 3, .result_sem = -1, .command = standart_command_timeout }, + { .name = "input/mouse/ps2/0", .active = false, .idx = 0, .result_sem = -1, .command = standard_command_timeout }, + { .name = "input/mouse/ps2/1", .active = false, .idx = 1, .result_sem = -1, .command = standard_command_timeout }, + { .name = "input/mouse/ps2/2", .active = false, .idx = 2, .result_sem = -1, .command = standard_command_timeout }, + { .name = "input/mouse/ps2/3", .active = false, .idx = 3, .result_sem = -1, .command = standard_command_timeout }, { .name = "input/mouse/ps2/synaptics_passthrough", .active = false, .result_sem = -1, .command = passthrough_command}, - { .name = "input/keyboard/at/0", .active = false, .result_sem = -1, .flags = PS2_FLAG_KEYB, .command = standart_command_timeout } + { .name = "input/keyboard/at/0", .active = false, .result_sem = -1, .flags = PS2_FLAG_KEYB, .command = standard_command_timeout } }; @@ -67,29 +67,29 @@ // the probe function has to set the dev name and the dev packet size status = probe_trackpoint(dev); - if (status == B_OK){ - *hooks = &gStandartMouseDeviceHooks; + if (status == B_OK) { + *hooks = &gStandardMouseDeviceHooks; goto dev_found; } status = probe_synaptics(dev); - if (status == B_OK){ + if (status == B_OK) { *hooks = &gSynapticsDeviceHooks; goto dev_found; } - status = probe_standart_mouse(dev); - if (status == B_OK){ - *hooks = &gStandartMouseDeviceHooks; + status = probe_standard_mouse(dev); + if (status == B_OK) { + *hooks = &gStandardMouseDeviceHooks; goto dev_found; } return B_ERROR; dev_found: - if(dev == &(ps2_device[PS2_DEVICE_SYN_PASSTHROUGH])){ + if (dev == &(ps2_device[PS2_DEVICE_SYN_PASSTHROUGH])) synaptics_pt_set_packagesize(dev, dev->packet_size); - } + return B_OK; } @@ -134,13 +134,12 @@ if (dev->active) return; - if(atomic_get(&dev->flags) & PS2_FLAG_KEYB){ + if (atomic_get(&dev->flags) & PS2_FLAG_KEYB) { status = devfs_publish_device(dev->name, &gKeyboardDeviceHooks); - } - else{ + } else { device_hooks *hooks; status = ps2_dev_detect_pointing(dev, &hooks); - if(status == B_OK){ + if (status == B_OK) { status = devfs_publish_device(dev->name, hooks); } @@ -265,7 +264,7 @@ status_t -standart_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout) +standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout) { status_t res; bigtime_t start; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h 2008-11-01 12:51:20 UTC (rev 28424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h 2008-11-01 13:00:00 UTC (rev 28425) @@ -41,7 +41,8 @@ // functions void (*disconnect)(ps2_dev *); int32 (*handle_int)(ps2_dev *); - status_t (*command)(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout); + status_t (*command)(ps2_dev *dev, uint8 cmd, const uint8 *out, + int out_count, uint8 *in, int in_count, bigtime_t timeout); }; #define PS2_DEVICE_COUNT 6 @@ -52,13 +53,13 @@ #define PS2_DEVICE_SYN_PASSTHROUGH 4 #define PS2_DEVICE_KEYB 5 -#define PS2_FLAG_KEYB (1<<0) -#define PS2_FLAG_OPEN (1<<1) -#define PS2_FLAG_ENABLED (1<<2) -#define PS2_FLAG_CMD (1<<3) -#define PS2_FLAG_ACK (1<<4) -#define PS2_FLAG_NACK (1<<5) -#define PS2_FLAG_GETID (1<<6) +#define PS2_FLAG_KEYB (1 << 0) +#define PS2_FLAG_OPEN (1 << 1) +#define PS2_FLAG_ENABLED (1 << 2) +#define PS2_FLAG_CMD (1 << 3) +#define PS2_FLAG_ACK (1 << 4) +#define PS2_FLAG_NACK (1 << 5) +#define PS2_FLAG_GETID (1 << 6) void ps2_dev_send(ps2_dev *dev, uint8 data); @@ -67,10 +68,13 @@ status_t ps2_dev_init(void); void ps2_dev_exit(void); -status_t standart_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout); +status_t standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, + int out_count, uint8 *in, int in_count, bigtime_t timeout); -status_t ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count); -status_t ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout); +status_t ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, + int out_count, uint8 *in, int in_count); +status_t ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, + int out_count, uint8 *in, int in_count, bigtime_t timeout); void ps2_dev_publish(ps2_dev *dev); void ps2_dev_unpublish(ps2_dev *dev); Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c (from rev 28419, haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.c) =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.c 2008-11-01 10:54:51 UTC (rev 28419) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-01 13:00:00 UTC (rev 28425) @@ -0,0 +1,518 @@ +/* + * Copyright 2001-2008 Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * PS/2 mouse device driver + * + * Authors (in chronological order): + * Elad Lahav (elad at eldarshany.com) + * Stefano Ceccherini (burton666 at libero.it) + * Axel D?rfler, axeld at pinc-software.de + * Marcus Overhagen + * Clemens Zeidler + */ + +/* + * A PS/2 mouse is connected to the IBM 8042 controller, and gets its + * name from the IBM PS/2 personal computer, which was the first to + * use this device. All resources are shared between the keyboard, and + * the mouse, referred to as the "Auxiliary Device". + * + * I/O: + * ~~~ + * The controller has 3 I/O registers: + * 1. Status (input), mapped to port 64h + * 2. Control (output), mapped to port 64h + * 3. Data (input/output), mapped to port 60h + * + * Data: + * ~~~~ + * A packet read from the mouse data port is composed of + * three bytes: + * byte 0: status byte, where + * - bit 7: Y overflow (1 = true) + * - bit 6: X overflow (1 = true) + * - bit 5: MSB of Y offset + * - bit 4: MSB of X offset + * - bit 3: Syncronization bit (always 1) + * - bit 2: Middle button (1 = down) + * - bit 1: Right button (1 = down) + * - bit 0: Left button (1 = down) + * byte 1: X position change, since last probed (-127 to +127) + * byte 2: Y position change, since last probed (-127 to +127) + * + * Intellimouse mice send a four byte packet, where the first three + * bytes are the same as standard mice, and the last one reports the + * Z position, which is, usually, the wheel movement. + * + * Interrupts: + * ~~~~~~~~~~ + * The PS/2 mouse device is connected to interrupt 12. + * The controller uses 3 consecutive interrupts to inform the computer + * that it has new data. On the first the data register holds the status + * byte, on the second the X offset, and on the 3rd the Y offset. + */ + +#include +#include + +#include "kb_mouse_driver.h" +#include "ps2_service.h" +#include "ps2_standard_mouse.h" + + +const char* kStandardMousePath[4] = { + "input/mouse/ps2/standard_0", + "input/mouse/ps2/standard_1", + "input/mouse/ps2/standard_2", + "input/mouse/ps2/standard_3" +}; +const char* kIntelliMousePath[4] = { + "input/mouse/ps2/intelli_0", + "input/mouse/ps2/intelli_1", + "input/mouse/ps2/intelli_2", + "input/mouse/ps2/intelli_3" +}; + +/** Set sampling rate of the ps2 port. + */ +static inline status_t +ps2_set_sample_rate(ps2_dev *dev, uint8 rate) +{ + return ps2_dev_command(dev, PS2_CMD_SET_SAMPLE_RATE, &rate, 1, NULL, 0); +} + + +/** Converts a packet received by the mouse to a "movement". + */ +static void +ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[], + mouse_movement *pos) +{ + int buttons = packet[0] & 7; + int xDelta = ((packet[0] & 0x10) ? ~0xff : 0) | packet[1]; + int yDelta = ((packet[0] & 0x20) ? ~0xff : 0) | packet[2]; + int xDeltaWheel = 0; + int yDeltaWheel = 0; + bigtime_t currentTime = system_time(); + + if (buttons != 0 && cookie->buttons_state == 0) { + if (cookie->click_last_time + cookie->click_speed > currentTime) + cookie->click_count++; + else + cookie->click_count = 1; + + cookie->click_last_time = currentTime; + } + + cookie->buttons_state = buttons; + + if (cookie->flags & F_pointing_dev_TYPE_INTELLIMOUSE) { + yDeltaWheel = packet[3] & 0x07; + if (packet[3] & 0x08) + yDeltaWheel |= ~0x07; + } +/* + if (cookie->flags & F_standard_mouse_TYPE_2WHEELS) { + switch (packet[3] & 0x0F) { + case 0x01: yDeltaWheel = +1; break; // wheel 1 down + case 0x0F: yDeltaWheel = -1; break; // wheel 1 up + case 0x02: xDeltaWheel = +1; break; // wheel 2 down + case 0x0E: xDeltaWheel = -1; break; // wheel 2 up + } + } +*/ + +// TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, " +// "w-yd %d\n", packet[0], packet[1], packet[2], packet[3], +// xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel, +// yDeltaWheel); + + if (pos) { + pos->xdelta = xDelta; + pos->ydelta = yDelta; + pos->buttons = buttons; + pos->clicks = cookie->click_count; + pos->modifiers = 0; + pos->timestamp = currentTime; + pos->wheel_ydelta = yDeltaWheel; + pos->wheel_xdelta = xDeltaWheel; + + TRACE("ps2: ps2_packet_to_movement xdelta: %d, ydelta: %d, buttons %x, " + "clicks: %d, timestamp %Ld\n", + xDelta, yDelta, buttons, cookie->click_count, currentTime); + } +} + + +/** Read a mouse event from the mouse events chain buffer. + */ +static status_t +standard_mouse_read_event(standard_mouse_cookie *cookie, + mouse_movement *movement) +{ + uint8 packet[PS2_MAX_PACKET_SIZE]; + status_t status; + + TRACE("ps2: standard_mouse_read_event\n"); + + status = acquire_sem_etc(cookie->standard_mouse_sem, 1, B_CAN_INTERRUPT, 0); + TRACE("ps2: standard_mouse_read_event acquired\n"); + if (status < B_OK) + return status; + + if (!cookie->dev->active) { + TRACE("ps2: standard_mouse_read_event: Error device no longer " + "active\n"); + return B_ERROR; + } + + if (packet_buffer_read(cookie->standard_mouse_buffer, packet, + cookie->dev->packet_size) != cookie->dev->packet_size) { + TRACE("ps2: error copying buffer\n"); + return B_ERROR; + } + + if (!(packet[0] & 8)) + panic("ps2: got broken data from packet_buffer_read\n"); + + ps2_packet_to_movement(cookie, packet, movement); + return B_OK; +} + + +void +standard_mouse_disconnect(ps2_dev *dev) +{ + // the mouse device might not be opened at this point + INFO("ps2: ps2_standard_mouse_disconnect %s\n", dev->name); + if (dev->flags & PS2_FLAG_OPEN) + release_sem(((standard_mouse_cookie *)dev->cookie)->standard_mouse_sem); +} + + +/** Interrupt handler for the mouse device. Called whenever the I/O + * controller generates an interrupt for the PS/2 mouse. Reads mouse + * information from the data port, and stores it, so it can be accessed + * by read() operations. The full data is obtained using 3 consecutive + * calls to the handler, each holds a different byte on the data port. + */ +int32 +standard_mouse_handle_int(ps2_dev *dev) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)dev->cookie; + const uint8 data = dev->history[0].data; + + TRACE("ps2: standard mouse: %1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\n", + data >> 7 & 1, data >> 6 & 1, data >> 5 & 1, + data >> 4 & 1, data >> 3 & 1, data >> 2 & 1, + data >> 1 & 1, data >> 0 & 1); + + if (cookie->packet_index == 0 && !(data & 8)) { + INFO("ps2: bad mouse data, trying resync\n"); + return B_HANDLED_INTERRUPT; + } + + // Workarounds for active multiplexing keyboard controllers + // that lose data or send them to the wrong port. + if (cookie->packet_index == 0 && (data & 0xc0)) { + INFO("ps2: strange mouse data, x/y overflow, trying resync\n"); + return B_HANDLED_INTERRUPT; + } + if (cookie->packet_index == 1) { + int xDelta + = ((cookie->packet_buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data; + if (xDelta < -100 || xDelta > 100) { + INFO("ps2: strange mouse data, x-delta %d, trying resync\n", + xDelta); + cookie->packet_index = 0; + return B_HANDLED_INTERRUPT; + } + } + if (cookie->packet_index == 2) { + int yDelta + = ((cookie->packet_buffer[0] & 0x20) ? 0xFFFFFF00 : 0) | data; + if (yDelta < -100 || yDelta > 100) { + INFO("ps2: strange mouse data, y-delta %d, trying resync\n", + yDelta); + cookie->packet_index = 0; + return B_HANDLED_INTERRUPT; + } + } + + cookie->packet_buffer[cookie->packet_index++] = data; + + if (cookie->packet_index != dev->packet_size) { + // packet not yet complete + return B_HANDLED_INTERRUPT; + } + + // complete packet is assembled + + cookie->packet_index = 0; + if (packet_buffer_write(cookie->standard_mouse_buffer, + cookie->packet_buffer, dev->packet_size) != dev->packet_size) { + // buffer is full, drop new data + return B_HANDLED_INTERRUPT; + } + + release_sem_etc(cookie->standard_mouse_sem, 1, B_DO_NOT_RESCHEDULE); + return B_INVOKE_SCHEDULER; +} + + +// #pragma mark - + + +status_t +probe_standard_mouse(ps2_dev * dev) +{ + status_t status; + uint8 deviceId = 0; + + // get device id + status = ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, &deviceId, 1); + if (status != B_OK) { + INFO("ps2: probe_mouse get device id failed\n"); + return B_ERROR; + } + + TRACE("ps2: probe_mouse device id: %2x\n", deviceId); + + // check for MS Intellimouse + if (deviceId == 0) { + uint8 alternate_device_id; + status = ps2_set_sample_rate(dev, 200); + status |= ps2_set_sample_rate(dev, 100); + status |= ps2_set_sample_rate(dev, 80); + status |= ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, + &alternate_device_id, 1); + if (status == 0) { + TRACE("ps2: probe_mouse alternate device id: %2x\n", + alternate_device_id); + deviceId = alternate_device_id; + } + } + + if (deviceId == PS2_DEV_ID_STANDARD) { + INFO("ps2: probe_mouse Standard PS/2 mouse found\n"); + dev->name = kStandardMousePath[dev->idx]; + dev->packet_size = PS2_PACKET_STANDARD; + } else if (deviceId == PS2_DEV_ID_INTELLIMOUSE) { + dev->name = kIntelliMousePath[dev->idx]; + dev->packet_size = PS2_PACKET_INTELLIMOUSE; + INFO("ps2: probe_mouse Extended PS/2 mouse found\n"); + } else { + INFO("ps2: probe_mouse Error unknown device id.\n"); + return B_ERROR; + } + + return B_OK; +} + + +// #pragma mark - +// Device functions + + +status_t +standard_mouse_open(const char *name, uint32 flags, void **_cookie) +{ + standard_mouse_cookie *cookie; + status_t status; + ps2_dev *dev = NULL; + int i; + + TRACE("ps2: standard_mouse_open %s\n", name); + + for (dev = NULL, i = 0; i < PS2_DEVICE_COUNT; i++) { + if (0 == strcmp(ps2_device[i].name, name)) { + dev = &ps2_device[i]; + break; + } + /*if (0 == strcmp(g_passthrough_dev.name, name)) { + dev = &g_passthrough_dev; + isSynapticsPTDevice = true; + break; + }*/ + } + + if (dev == NULL) { + TRACE("ps2: dev = NULL\n"); + return B_ERROR; + } + + if (atomic_or(&dev->flags, PS2_FLAG_OPEN) & PS2_FLAG_OPEN) + return B_BUSY; + + cookie = malloc(sizeof(standard_mouse_cookie)); + if (cookie == NULL) + goto err1; + + *_cookie = cookie; + memset(cookie, 0, sizeof(*cookie)); + + cookie->dev = dev; + dev->cookie = cookie; + dev->disconnect = &standard_mouse_disconnect; + dev->handle_int = &standard_mouse_handle_int; + + if (strstr(dev->name, "standard_mouse") != NULL) + cookie->flags = F_pointing_dev_TYPE_STANDARD; + + if (strstr(dev->name, "intelli_mouse") != NULL) + cookie->flags = F_pointing_dev_TYPE_INTELLIMOUSE; + + cookie->standard_mouse_buffer + = create_packet_buffer(standard_mouse_HISTORY_SIZE * dev->packet_size); + if (cookie->standard_mouse_buffer == NULL) { + TRACE("ps2: can't allocate mouse actions buffer\n"); + goto err2; + } + + // create the mouse semaphore, used for synchronization between + // the interrupt handler and the read operation + cookie->standard_mouse_sem = create_sem(0, "ps2_standard_mouse_sem"); + if (cookie->standard_mouse_sem < 0) { + TRACE("ps2: failed creating PS/2 mouse semaphore!\n"); + goto err3; + } + + status = ps2_dev_command(dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); + if (status < B_OK) { + INFO("ps2: cannot enable mouse %s\n", name); + goto err4; + } + + atomic_or(&dev->flags, PS2_FLAG_ENABLED); + + + TRACE("ps2: standard_mouse_open %s success\n", name); + return B_OK; + +err4: + delete_sem(cookie->standard_mouse_sem); +err3: + delete_packet_buffer(cookie->standard_mouse_buffer); +err2: + free(cookie); +err1: + atomic_and(&dev->flags, ~PS2_FLAG_OPEN); + + TRACE("ps2: standard_mouse_open %s failed\n", name); + return B_ERROR; +} + + +status_t +standard_mouse_close(void *_cookie) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; + + TRACE("ps2: standard_mouse_close %s enter\n", cookie->dev->name); + + ps2_dev_command_timeout(cookie->dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0, + 150000); + + delete_packet_buffer(cookie->standard_mouse_buffer); + delete_sem(cookie->standard_mouse_sem); + + atomic_and(&cookie->dev->flags, ~PS2_FLAG_OPEN); + atomic_and(&cookie->dev->flags, ~PS2_FLAG_ENABLED); + + TRACE("ps2: standard_mouse_close %s done\n", cookie->dev->name); + return B_OK; +} + + +status_t +standard_mouse_freecookie(void *_cookie) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; + free(cookie); + return B_OK; +} + + +static status_t +standard_mouse_read(void *cookie, off_t pos, void *buffer, size_t *_length) +{ + *_length = 0; + return B_NOT_ALLOWED; +} + + +static status_t +standard_mouse_write(void *cookie, off_t pos, const void *buffer, + size_t *_length) +{ + *_length = 0; + return B_NOT_ALLOWED; +} + + +status_t +standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; + + switch (op) { + case MS_NUM_EVENTS: + { + int32 count; + TRACE("ps2: ioctl MS_NUM_EVENTS\n"); + get_sem_count(cookie->standard_mouse_sem, &count); + return count; + } + + case MS_READ: + { + mouse_movement movement; + status_t status; + TRACE("ps2: ioctl MS_READ\n"); + if ((status = standard_mouse_read_event(cookie, &movement)) < B_OK) + return status; +// TRACE("%s %d %d %d %d\n", cookie->dev->name, +// movement.xdelta, movement.ydelta, movement.buttons, +// movement.clicks); + return user_memcpy(buffer, &movement, sizeof(movement)); + } + + case MS_SET_TYPE: + TRACE("ps2: ioctl MS_SET_TYPE not implemented\n"); + return B_BAD_VALUE; + + case MS_SET_MAP: + TRACE("ps2: ioctl MS_SET_MAP (set mouse mapping) not " + "implemented\n"); + return B_BAD_VALUE; + + case MS_GET_ACCEL: + TRACE("ps2: ioctl MS_GET_ACCEL (get mouse acceleration) not " + "implemented\n"); + return B_BAD_VALUE; + + case MS_SET_ACCEL: + TRACE("ps2: ioctl MS_SET_ACCEL (set mouse acceleration) not " + "implemented\n"); + return B_BAD_VALUE; + + case MS_SET_CLICKSPEED: + TRACE("ps2: ioctl MS_SETCLICK (set click speed)\n"); + return user_memcpy(&cookie->click_speed, buffer, sizeof(bigtime_t)); + + default: + TRACE("ps2: ioctl unknown mouse opcode: %ld\n", op); + return B_BAD_VALUE; + } +} + + +device_hooks gStandardMouseDeviceHooks = { + standard_mouse_open, + standard_mouse_close, + standard_mouse_freecookie, + standard_mouse_ioctl, + standard_mouse_read, + standard_mouse_write, +}; Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h (from rev 28419, haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.h) =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.h 2008-11-01 10:54:51 UTC (rev 28419) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h 2008-11-01 13:00:00 UTC (rev 28425) @@ -0,0 +1,60 @@ +/* + * Copyright 2001-2008 Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * PS/2 mouse device driver + * + * Authors (in chronological order): + * Elad Lahav (elad at eldarshany.com) + * Stefano Ceccherini (burton666 at libero.it) + * Axel D?rfler, axeld at pinc-software.de + * Marcus Overhagen + * Clemens Zeidler + */ + +#ifndef __PS2_STANDARD_standard_mouse_H +#define __PS2_STANDARD_standard_mouse_H + +#include + +#include "packet_buffer.h" + +#define standard_mouse_HISTORY_SIZE 256 + // we record that many mouse packets before we start to drop them + +#define F_pointing_dev_TYPE_STANDARD 0x1 +#define F_pointing_dev_TYPE_INTELLIMOUSE 0x2 + +typedef struct +{ + ps2_dev * dev; + + sem_id standard_mouse_sem; + packet_buffer * standard_mouse_buffer; + bigtime_t click_last_time; + bigtime_t click_speed; + int click_count; + int buttons_state; + int flags; + size_t packet_index; + uint8 packet_buffer[PS2_MAX_PACKET_SIZE]; + +} standard_mouse_cookie; + + +status_t probe_standard_mouse(ps2_dev *dev); + +status_t standard_mouse_open(const char *name, uint32 flags, void **_cookie); +status_t standard_mouse_close(void *_cookie); +status_t standard_mouse_freecookie(void *_cookie); +status_t standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, + size_t length); + +int32 standard_mouse_handle_int(ps2_dev *dev); +void standard_mouse_disconnect(ps2_dev *dev); + +device_hooks gStandardMouseDeviceHooks; + + +#endif /* __PS2_STANDARD_standard_mouse_H */ + Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.c Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standart_mouse.h Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 12:51:20 UTC (rev 28424) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 13:00:00 UTC (rev 28425) @@ -16,13 +16,15 @@ #include "ps2_synaptics.h" #include "kb_mouse_driver.h" -const char* kSynapticsPath[4] = {"input/touchpad/ps2/synaptics_0", - "input/touchpad/ps2/synaptics_1", - "input/touchpad/ps2/synaptics_2", - "input/touchpad/ps2/synaptics_3"}; +const char* kSynapticsPath[4] = { + "input/touchpad/ps2/synaptics_0", + "input/touchpad/ps2/synaptics_1", + "input/touchpad/ps2/synaptics_2", + "input/touchpad/ps2/synaptics_3" +}; -static touchpad_info g_touchpad_info; -ps2_dev *g_passthrough_dev = &ps2_device[PS2_DEVICE_SYN_PASSTHROUGH]; +static touchpad_info gTouchpadInfo; +ps2_dev *gPassthroughDevice = &ps2_device[PS2_DEVICE_SYN_PASSTHROUGH]; void @@ -37,7 +39,8 @@ { synaptics_cookie* syn_cookie = dev->parent_dev->cookie; - status_t status = ps2_dev_command(dev->parent_dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0); + status_t status = ps2_dev_command(dev->parent_dev, PS2_CMD_DISABLE, NULL, + 0, NULL, 0); if (status < B_OK) { INFO("SYNAPTICS: cannot disable touchpad %s\n", dev->parent_dev->name); return B_ERROR; @@ -45,12 +48,10 @@ syn_cookie->packet_index = 0; - if(size == 4){ + if (size == 4) syn_cookie->mode|= SYN_FOUR_BYTE_CHILD; - } - else{ + else syn_cookie->mode&= ~SYN_FOUR_BYTE_CHILD; - } set_touchpad_mode(dev->parent_dev, syn_cookie->mode); status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); @@ -63,16 +64,18 @@ [... truncated: 676 lines follow ...] From superstippi at gmx.de Sat Nov 1 14:06:29 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 01 Nov 2008 14:06:29 +0100 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad In-Reply-To: <490C47F2.2090300@arcor.de> References: <200811011048.mA1AmnfV008779@sheep.berlios.de> <490C3C76.4010700@arcor.de> <20081101123800.1481.2@stippis2.1225534427.fake> <490C47F2.2090300@arcor.de> Message-ID: <20081101140629.3841.3@stippis2.1225534427.fake> Hi, Marcus Overhagen wrote: > Stephan Assmus schrieb: > > >> Please rename!!!!!! > > > > Will do. While I have your attention, could you please have a look > > through the patch and tell me whether mouse and touchpad should become > > separate add-ons to the ps2 bus_manager? > > In an ideal world, the ps2 busmanager would act similar to the usb > busmanager, and drivers for keyboard, mice and touchpad would use it. The > busmanager would provide data streams of the available serial connections. > > However, I don't think thats it's worth the effort to implement that. Ok, thanks. > Generally, I'm happy that touchpad support is finally beeing added, but > the patch contains some issues. > > ps2_mouse.c is now emtpy, and ps2_standart_mouse.c has no history. Please > rename r28415 ps2_mouse.c into ps2_standard_mouse.c, and apply the > patches afterwards. Darn. How do I do this after the fact? > movement_maker.c looks alien. Was this copied from BSD? It also has no > copyright statement. I guess the float functions were. Clemens, are you reading this? > Please rename all standart into standard. That error is all over the > place. Done. > There are various strange names, like > > #define standart_mouse_HISTORY_SIZE > #define F_pointing_dev_TYPE_INTELLIMOUSE Ok, will look into those as well. > Additionally, there are plenty of coding style violations, especially > for() and while() without space. Should have fixed most of those in r28425. > Finally, struct member alignment in touchpad_movement and other structs > could be improved. Ok, I can have a look, but I probably know too little about it. Best regards, -Stephan From stippi at mail.berlios.de Sat Nov 1 14:11:55 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 14:11:55 +0100 Subject: [Haiku-commits] r28426 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811011311.mA1DBtO8012414@sheep.berlios.de> Author: stippi Date: 2008-11-01 14:11:53 +0100 (Sat, 01 Nov 2008) New Revision: 28426 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28426&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c Removed: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_mouse.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c Log: ps2_mouse.c was refactored into ps2_standard_mouse.c, but I applied the patch wrongly. This should hopefully fix it. Only my coding style cleanup history should be "lost" this way. Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_mouse.c Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c Copied: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c (from rev 28419, haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_mouse.c) From host.haiku at gmx.de Sat Nov 1 14:17:08 2008 From: host.haiku at gmx.de (julun) Date: Sat, 01 Nov 2008 14:17:08 +0100 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad In-Reply-To: <490C45D2.9060006@gmx.de> References: <200811011048.mA1AmnfV008779@sheep.berlios.de> <490C45D2.9060006@gmx.de> Message-ID: <490C56D4.1090803@gmx.de> Hi, julun schrieb: > stippi at mail.berlios.de schrieb: >> Author: stippi >> Date: 2008-11-01 11:48:35 +0100 (Sat, 01 Nov 2008) >> New Revision: 28416 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28416&view=rev >> > > > >> Log: >> Patch by Clemens Zeilder: >> * Implemented Synaptics touchpad support in the PS2 bus_manager by >> refactoring/splitting the structure some and adding touchpad device >> handling. >> * Implemented Touchpad input_server device add-on >> * Created Touchpad preflet for configuring advances Synaptics touchpad >> options like scroll region (both horizontal and vertical) as well >> as other neat stuff >> >> Thanks a lot, Clemens! > > great work Clemens! > > Though i noticed a really huge slowdown moving the mouse around if > there is no Touchpad present. It also crashes while pressing the > preflets 'Default' button. and the mouse scroll wheel stopped working at all (vmware) ... -- Karsten From stippi at mail.berlios.de Sat Nov 1 14:22:31 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 14:22:31 +0100 Subject: [Haiku-commits] r28427 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811011322.mA1DMVSp013492@sheep.berlios.de> Author: stippi Date: 2008-11-01 14:22:29 +0100 (Sat, 01 Nov 2008) New Revision: 28427 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28427&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c Log: Darn, SVN checked only modified stamps of the files, not the content. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-01 13:11:53 UTC (rev 28426) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-01 13:22:29 UTC (rev 28427) @@ -0,0 +1,518 @@ +/* + * Copyright 2001-2008 Haiku, Inc. + * Distributed under the terms of the MIT License. + * + * PS/2 mouse device driver + * + * Authors (in chronological order): + * Elad Lahav (elad at eldarshany.com) + * Stefano Ceccherini (burton666 at libero.it) + * Axel D?rfler, axeld at pinc-software.de + * Marcus Overhagen + * Clemens Zeidler + */ + +/* + * A PS/2 mouse is connected to the IBM 8042 controller, and gets its + * name from the IBM PS/2 personal computer, which was the first to + * use this device. All resources are shared between the keyboard, and + * the mouse, referred to as the "Auxiliary Device". + * + * I/O: + * ~~~ + * The controller has 3 I/O registers: + * 1. Status (input), mapped to port 64h + * 2. Control (output), mapped to port 64h + * 3. Data (input/output), mapped to port 60h + * + * Data: + * ~~~~ + * A packet read from the mouse data port is composed of + * three bytes: + * byte 0: status byte, where + * - bit 7: Y overflow (1 = true) + * - bit 6: X overflow (1 = true) + * - bit 5: MSB of Y offset + * - bit 4: MSB of X offset + * - bit 3: Syncronization bit (always 1) + * - bit 2: Middle button (1 = down) + * - bit 1: Right button (1 = down) + * - bit 0: Left button (1 = down) + * byte 1: X position change, since last probed (-127 to +127) + * byte 2: Y position change, since last probed (-127 to +127) + * + * Intellimouse mice send a four byte packet, where the first three + * bytes are the same as standard mice, and the last one reports the + * Z position, which is, usually, the wheel movement. + * + * Interrupts: + * ~~~~~~~~~~ + * The PS/2 mouse device is connected to interrupt 12. + * The controller uses 3 consecutive interrupts to inform the computer + * that it has new data. On the first the data register holds the status + * byte, on the second the X offset, and on the 3rd the Y offset. + */ + +#include +#include + +#include "kb_mouse_driver.h" +#include "ps2_service.h" +#include "ps2_standard_mouse.h" + + +const char* kStandardMousePath[4] = { + "input/mouse/ps2/standard_0", + "input/mouse/ps2/standard_1", + "input/mouse/ps2/standard_2", + "input/mouse/ps2/standard_3" +}; +const char* kIntelliMousePath[4] = { + "input/mouse/ps2/intelli_0", + "input/mouse/ps2/intelli_1", + "input/mouse/ps2/intelli_2", + "input/mouse/ps2/intelli_3" +}; + +/** Set sampling rate of the ps2 port. + */ +static inline status_t +ps2_set_sample_rate(ps2_dev *dev, uint8 rate) +{ + return ps2_dev_command(dev, PS2_CMD_SET_SAMPLE_RATE, &rate, 1, NULL, 0); +} + + +/** Converts a packet received by the mouse to a "movement". + */ +static void +ps2_packet_to_movement(standard_mouse_cookie *cookie, uint8 packet[], + mouse_movement *pos) +{ + int buttons = packet[0] & 7; + int xDelta = ((packet[0] & 0x10) ? ~0xff : 0) | packet[1]; + int yDelta = ((packet[0] & 0x20) ? ~0xff : 0) | packet[2]; + int xDeltaWheel = 0; + int yDeltaWheel = 0; + bigtime_t currentTime = system_time(); + + if (buttons != 0 && cookie->buttons_state == 0) { + if (cookie->click_last_time + cookie->click_speed > currentTime) + cookie->click_count++; + else + cookie->click_count = 1; + + cookie->click_last_time = currentTime; + } + + cookie->buttons_state = buttons; + + if (cookie->flags & F_pointing_dev_TYPE_INTELLIMOUSE) { + yDeltaWheel = packet[3] & 0x07; + if (packet[3] & 0x08) + yDeltaWheel |= ~0x07; + } +/* + if (cookie->flags & F_standard_mouse_TYPE_2WHEELS) { + switch (packet[3] & 0x0F) { + case 0x01: yDeltaWheel = +1; break; // wheel 1 down + case 0x0F: yDeltaWheel = -1; break; // wheel 1 up + case 0x02: xDeltaWheel = +1; break; // wheel 2 down + case 0x0E: xDeltaWheel = -1; break; // wheel 2 up + } + } +*/ + +// TRACE("packet: %02x %02x %02x %02x: xd %d, yd %d, 0x%x (%d), w-xd %d, " +// "w-yd %d\n", packet[0], packet[1], packet[2], packet[3], +// xDelta, yDelta, buttons, cookie->click_count, xDeltaWheel, +// yDeltaWheel); + + if (pos) { + pos->xdelta = xDelta; + pos->ydelta = yDelta; + pos->buttons = buttons; + pos->clicks = cookie->click_count; + pos->modifiers = 0; + pos->timestamp = currentTime; + pos->wheel_ydelta = yDeltaWheel; + pos->wheel_xdelta = xDeltaWheel; + + TRACE("ps2: ps2_packet_to_movement xdelta: %d, ydelta: %d, buttons %x, " + "clicks: %d, timestamp %Ld\n", + xDelta, yDelta, buttons, cookie->click_count, currentTime); + } +} + + +/** Read a mouse event from the mouse events chain buffer. + */ +static status_t +standard_mouse_read_event(standard_mouse_cookie *cookie, + mouse_movement *movement) +{ + uint8 packet[PS2_MAX_PACKET_SIZE]; + status_t status; + + TRACE("ps2: standard_mouse_read_event\n"); + + status = acquire_sem_etc(cookie->standard_mouse_sem, 1, B_CAN_INTERRUPT, 0); + TRACE("ps2: standard_mouse_read_event acquired\n"); + if (status < B_OK) + return status; + + if (!cookie->dev->active) { + TRACE("ps2: standard_mouse_read_event: Error device no longer " + "active\n"); + return B_ERROR; + } + + if (packet_buffer_read(cookie->standard_mouse_buffer, packet, + cookie->dev->packet_size) != cookie->dev->packet_size) { + TRACE("ps2: error copying buffer\n"); + return B_ERROR; + } + + if (!(packet[0] & 8)) + panic("ps2: got broken data from packet_buffer_read\n"); + + ps2_packet_to_movement(cookie, packet, movement); + return B_OK; +} + + +void +standard_mouse_disconnect(ps2_dev *dev) +{ + // the mouse device might not be opened at this point + INFO("ps2: ps2_standard_mouse_disconnect %s\n", dev->name); + if (dev->flags & PS2_FLAG_OPEN) + release_sem(((standard_mouse_cookie *)dev->cookie)->standard_mouse_sem); +} + + +/** Interrupt handler for the mouse device. Called whenever the I/O + * controller generates an interrupt for the PS/2 mouse. Reads mouse + * information from the data port, and stores it, so it can be accessed + * by read() operations. The full data is obtained using 3 consecutive + * calls to the handler, each holds a different byte on the data port. + */ +int32 +standard_mouse_handle_int(ps2_dev *dev) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)dev->cookie; + const uint8 data = dev->history[0].data; + + TRACE("ps2: standard mouse: %1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\n", + data >> 7 & 1, data >> 6 & 1, data >> 5 & 1, + data >> 4 & 1, data >> 3 & 1, data >> 2 & 1, + data >> 1 & 1, data >> 0 & 1); + + if (cookie->packet_index == 0 && !(data & 8)) { + INFO("ps2: bad mouse data, trying resync\n"); + return B_HANDLED_INTERRUPT; + } + + // Workarounds for active multiplexing keyboard controllers + // that lose data or send them to the wrong port. + if (cookie->packet_index == 0 && (data & 0xc0)) { + INFO("ps2: strange mouse data, x/y overflow, trying resync\n"); + return B_HANDLED_INTERRUPT; + } + if (cookie->packet_index == 1) { + int xDelta + = ((cookie->packet_buffer[0] & 0x10) ? 0xFFFFFF00 : 0) | data; + if (xDelta < -100 || xDelta > 100) { + INFO("ps2: strange mouse data, x-delta %d, trying resync\n", + xDelta); + cookie->packet_index = 0; + return B_HANDLED_INTERRUPT; + } + } + if (cookie->packet_index == 2) { + int yDelta + = ((cookie->packet_buffer[0] & 0x20) ? 0xFFFFFF00 : 0) | data; + if (yDelta < -100 || yDelta > 100) { + INFO("ps2: strange mouse data, y-delta %d, trying resync\n", + yDelta); + cookie->packet_index = 0; + return B_HANDLED_INTERRUPT; + } + } + + cookie->packet_buffer[cookie->packet_index++] = data; + + if (cookie->packet_index != dev->packet_size) { + // packet not yet complete + return B_HANDLED_INTERRUPT; + } + + // complete packet is assembled + + cookie->packet_index = 0; + if (packet_buffer_write(cookie->standard_mouse_buffer, + cookie->packet_buffer, dev->packet_size) != dev->packet_size) { + // buffer is full, drop new data + return B_HANDLED_INTERRUPT; + } + + release_sem_etc(cookie->standard_mouse_sem, 1, B_DO_NOT_RESCHEDULE); + return B_INVOKE_SCHEDULER; +} + + +// #pragma mark - + + +status_t +probe_standard_mouse(ps2_dev * dev) +{ + status_t status; + uint8 deviceId = 0; + + // get device id + status = ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, &deviceId, 1); + if (status != B_OK) { + INFO("ps2: probe_mouse get device id failed\n"); + return B_ERROR; + } + + TRACE("ps2: probe_mouse device id: %2x\n", deviceId); + + // check for MS Intellimouse + if (deviceId == 0) { + uint8 alternate_device_id; + status = ps2_set_sample_rate(dev, 200); + status |= ps2_set_sample_rate(dev, 100); + status |= ps2_set_sample_rate(dev, 80); + status |= ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, + &alternate_device_id, 1); + if (status == 0) { + TRACE("ps2: probe_mouse alternate device id: %2x\n", + alternate_device_id); + deviceId = alternate_device_id; + } + } + + if (deviceId == PS2_DEV_ID_STANDARD) { + INFO("ps2: probe_mouse Standard PS/2 mouse found\n"); + dev->name = kStandardMousePath[dev->idx]; + dev->packet_size = PS2_PACKET_STANDARD; + } else if (deviceId == PS2_DEV_ID_INTELLIMOUSE) { + dev->name = kIntelliMousePath[dev->idx]; + dev->packet_size = PS2_PACKET_INTELLIMOUSE; + INFO("ps2: probe_mouse Extended PS/2 mouse found\n"); + } else { + INFO("ps2: probe_mouse Error unknown device id.\n"); + return B_ERROR; + } + + return B_OK; +} + + +// #pragma mark - +// Device functions + + +status_t +standard_mouse_open(const char *name, uint32 flags, void **_cookie) +{ + standard_mouse_cookie *cookie; + status_t status; + ps2_dev *dev = NULL; + int i; + + TRACE("ps2: standard_mouse_open %s\n", name); + + for (dev = NULL, i = 0; i < PS2_DEVICE_COUNT; i++) { + if (0 == strcmp(ps2_device[i].name, name)) { + dev = &ps2_device[i]; + break; + } + /*if (0 == strcmp(g_passthrough_dev.name, name)) { + dev = &g_passthrough_dev; + isSynapticsPTDevice = true; + break; + }*/ + } + + if (dev == NULL) { + TRACE("ps2: dev = NULL\n"); + return B_ERROR; + } + + if (atomic_or(&dev->flags, PS2_FLAG_OPEN) & PS2_FLAG_OPEN) + return B_BUSY; + + cookie = malloc(sizeof(standard_mouse_cookie)); + if (cookie == NULL) + goto err1; + + *_cookie = cookie; + memset(cookie, 0, sizeof(*cookie)); + + cookie->dev = dev; + dev->cookie = cookie; + dev->disconnect = &standard_mouse_disconnect; + dev->handle_int = &standard_mouse_handle_int; + + if (strstr(dev->name, "standard_mouse") != NULL) + cookie->flags = F_pointing_dev_TYPE_STANDARD; + + if (strstr(dev->name, "intelli_mouse") != NULL) + cookie->flags = F_pointing_dev_TYPE_INTELLIMOUSE; + + cookie->standard_mouse_buffer + = create_packet_buffer(standard_mouse_HISTORY_SIZE * dev->packet_size); + if (cookie->standard_mouse_buffer == NULL) { + TRACE("ps2: can't allocate mouse actions buffer\n"); + goto err2; + } + + // create the mouse semaphore, used for synchronization between + // the interrupt handler and the read operation + cookie->standard_mouse_sem = create_sem(0, "ps2_standard_mouse_sem"); + if (cookie->standard_mouse_sem < 0) { + TRACE("ps2: failed creating PS/2 mouse semaphore!\n"); + goto err3; + } + + status = ps2_dev_command(dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); + if (status < B_OK) { + INFO("ps2: cannot enable mouse %s\n", name); + goto err4; + } + + atomic_or(&dev->flags, PS2_FLAG_ENABLED); + + + TRACE("ps2: standard_mouse_open %s success\n", name); + return B_OK; + +err4: + delete_sem(cookie->standard_mouse_sem); +err3: + delete_packet_buffer(cookie->standard_mouse_buffer); +err2: + free(cookie); +err1: + atomic_and(&dev->flags, ~PS2_FLAG_OPEN); + + TRACE("ps2: standard_mouse_open %s failed\n", name); + return B_ERROR; +} + + +status_t +standard_mouse_close(void *_cookie) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; + + TRACE("ps2: standard_mouse_close %s enter\n", cookie->dev->name); + + ps2_dev_command_timeout(cookie->dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0, + 150000); + + delete_packet_buffer(cookie->standard_mouse_buffer); + delete_sem(cookie->standard_mouse_sem); + + atomic_and(&cookie->dev->flags, ~PS2_FLAG_OPEN); + atomic_and(&cookie->dev->flags, ~PS2_FLAG_ENABLED); + + TRACE("ps2: standard_mouse_close %s done\n", cookie->dev->name); + return B_OK; +} + + +status_t +standard_mouse_freecookie(void *_cookie) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; + free(cookie); + return B_OK; +} + + +static status_t +standard_mouse_read(void *cookie, off_t pos, void *buffer, size_t *_length) +{ + *_length = 0; + return B_NOT_ALLOWED; +} + + +static status_t +standard_mouse_write(void *cookie, off_t pos, const void *buffer, + size_t *_length) +{ + *_length = 0; + return B_NOT_ALLOWED; +} + + +status_t +standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length) +{ + standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; + + switch (op) { + case MS_NUM_EVENTS: + { + int32 count; + TRACE("ps2: ioctl MS_NUM_EVENTS\n"); + get_sem_count(cookie->standard_mouse_sem, &count); + return count; + } + + case MS_READ: + { + mouse_movement movement; + status_t status; + TRACE("ps2: ioctl MS_READ\n"); + if ((status = standard_mouse_read_event(cookie, &movement)) < B_OK) + return status; +// TRACE("%s %d %d %d %d\n", cookie->dev->name, +// movement.xdelta, movement.ydelta, movement.buttons, +// movement.clicks); + return user_memcpy(buffer, &movement, sizeof(movement)); + } + + case MS_SET_TYPE: + TRACE("ps2: ioctl MS_SET_TYPE not implemented\n"); + return B_BAD_VALUE; + + case MS_SET_MAP: + TRACE("ps2: ioctl MS_SET_MAP (set mouse mapping) not " + "implemented\n"); + return B_BAD_VALUE; + + case MS_GET_ACCEL: + TRACE("ps2: ioctl MS_GET_ACCEL (get mouse acceleration) not " + "implemented\n"); + return B_BAD_VALUE; + + case MS_SET_ACCEL: + TRACE("ps2: ioctl MS_SET_ACCEL (set mouse acceleration) not " + "implemented\n"); + return B_BAD_VALUE; + + case MS_SET_CLICKSPEED: + TRACE("ps2: ioctl MS_SETCLICK (set click speed)\n"); + return user_memcpy(&cookie->click_speed, buffer, sizeof(bigtime_t)); + + default: + TRACE("ps2: ioctl unknown mouse opcode: %ld\n", op); + return B_BAD_VALUE; + } +} + + +device_hooks gStandardMouseDeviceHooks = { + standard_mouse_open, + standard_mouse_close, + standard_mouse_freecookie, + standard_mouse_ioctl, + standard_mouse_read, + standard_mouse_write, +}; From bonefish at mail.berlios.de Sat Nov 1 15:30:10 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 1 Nov 2008 15:30:10 +0100 Subject: [Haiku-commits] r28428 - haiku/trunk/src/system/libroot/posix/pthread Message-ID: <200811011430.mA1EUAqR023196@sheep.berlios.de> Author: bonefish Date: 2008-11-01 15:30:09 +0100 (Sat, 01 Nov 2008) New Revision: 28428 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28428&view=rev Modified: haiku/trunk/src/system/libroot/posix/pthread/pthread_mutex.c Log: Spotted by "daste": When unlocking the mutex owner must be set to -1 also for error check mutexes, otherwise the next pthread_mutex_lock() will fail. Modified: haiku/trunk/src/system/libroot/posix/pthread/pthread_mutex.c =================================================================== --- haiku/trunk/src/system/libroot/posix/pthread/pthread_mutex.c 2008-11-01 13:22:29 UTC (rev 28427) +++ haiku/trunk/src/system/libroot/posix/pthread/pthread_mutex.c 2008-11-01 14:30:09 UTC (rev 28428) @@ -160,13 +160,13 @@ if (mutex->owner != find_thread(NULL)) return EPERM; - if (MUTEX_TYPE(mutex) == PTHREAD_MUTEX_RECURSIVE) { - if (mutex->owner_count-- > 1) - return B_OK; - - mutex->owner = -1; + if (MUTEX_TYPE(mutex) == PTHREAD_MUTEX_RECURSIVE + && mutex->owner_count-- > 1) { + return B_OK; } + mutex->owner = -1; + if (atomic_add((vint32*)&mutex->count, -1) > 1) return release_sem(mutex->sem); From stippi at mail.berlios.de Sat Nov 1 16:02:39 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 16:02:39 +0100 Subject: [Haiku-commits] r28429 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811011502.mA1F2d3s025938@sheep.berlios.de> Author: stippi Date: 2008-11-01 16:02:35 +0100 (Sat, 01 Nov 2008) New Revision: 28429 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28429&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h Log: * Fixed some of the weirdly changed define names. * A few more style cleanups. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.h 2008-11-01 14:30:09 UTC (rev 28428) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.h 2008-11-01 15:02:35 UTC (rev 28429) @@ -60,7 +60,8 @@ void ps2_flush(void); -extern status_t ps2_command(uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count); +extern status_t ps2_command(uint8 cmd, const uint8 *out, int out_count, + uint8 *in, int in_count); // prototypes from keyboard.c & mouse.c extern status_t probe_keyboard(void); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h 2008-11-01 14:30:09 UTC (rev 28428) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h 2008-11-01 15:02:35 UTC (rev 28429) @@ -16,15 +16,13 @@ #include "ps2_common.h" -typedef struct -{ +typedef struct { bigtime_t time; uint8 data; bool error; } data_history; -struct ps2_dev -{ +struct ps2_dev { const char * name; bool active; uint8 idx; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-01 14:30:09 UTC (rev 28428) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-01 15:02:35 UTC (rev 28429) @@ -107,13 +107,13 @@ cookie->buttons_state = buttons; - if (cookie->flags & F_pointing_dev_TYPE_INTELLIMOUSE) { + if (cookie->flags & F_MOUSE_TYPE_INTELLIMOUSE) { yDeltaWheel = packet[3] & 0x07; if (packet[3] & 0x08) yDeltaWheel |= ~0x07; } /* - if (cookie->flags & F_standard_mouse_TYPE_2WHEELS) { + if (cookie->flags & F_MOUSE_TYPE_2WHEELS) { switch (packet[3] & 0x0F) { case 0x01: yDeltaWheel = +1; break; // wheel 1 down case 0x0F: yDeltaWheel = -1; break; // wheel 1 up @@ -358,13 +358,13 @@ dev->handle_int = &standard_mouse_handle_int; if (strstr(dev->name, "standard_mouse") != NULL) - cookie->flags = F_pointing_dev_TYPE_STANDARD; + cookie->flags = F_MOUSE_TYPE_STANDARD; if (strstr(dev->name, "intelli_mouse") != NULL) - cookie->flags = F_pointing_dev_TYPE_INTELLIMOUSE; + cookie->flags = F_MOUSE_TYPE_INTELLIMOUSE; cookie->standard_mouse_buffer - = create_packet_buffer(standard_mouse_HISTORY_SIZE * dev->packet_size); + = create_packet_buffer(MOUSE_HISTORY_SIZE * dev->packet_size); if (cookie->standard_mouse_buffer == NULL) { TRACE("ps2: can't allocate mouse actions buffer\n"); goto err2; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h 2008-11-01 14:30:09 UTC (rev 28428) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h 2008-11-01 15:02:35 UTC (rev 28429) @@ -12,18 +12,18 @@ * Clemens Zeidler */ -#ifndef __PS2_STANDARD_standard_mouse_H -#define __PS2_STANDARD_standard_mouse_H +#ifndef __PS2_STANDARD_MOUSE_H +#define __PS2_STANDARD_MOUSE_H #include #include "packet_buffer.h" -#define standard_mouse_HISTORY_SIZE 256 +#define MOUSE_HISTORY_SIZE 256 // we record that many mouse packets before we start to drop them -#define F_pointing_dev_TYPE_STANDARD 0x1 -#define F_pointing_dev_TYPE_INTELLIMOUSE 0x2 +#define F_MOUSE_TYPE_STANDARD 0x1 +#define F_MOUSE_TYPE_INTELLIMOUSE 0x2 typedef struct { @@ -56,5 +56,5 @@ device_hooks gStandardMouseDeviceHooks; -#endif /* __PS2_STANDARD_standard_mouse_H */ +#endif /* __PS2_STANDARD_MOUSE_H */ Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 14:30:09 UTC (rev 28428) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 15:02:35 UTC (rev 28429) @@ -539,7 +539,7 @@ dev->packet_size = PS2_PACKET_SYNAPTICS; cookie->synaptics_ring_buffer - = create_packet_buffer(synaptics_HISTORY_SIZE * dev->packet_size); + = create_packet_buffer(SYNAPTICS_HISTORY_SIZE * dev->packet_size); if (cookie->synaptics_ring_buffer == NULL) { TRACE("ps2: can't allocate mouse actions buffer\n"); goto err2; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2008-11-01 14:30:09 UTC (rev 28428) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2008-11-01 15:02:35 UTC (rev 28429) @@ -38,14 +38,14 @@ #define MIN_PRESSURE 30 #define MAX_PRESSURE 200 -#define synaptics_HISTORY_SIZE 256 +#define SYNAPTICS_HISTORY_SIZE 256 // no touchpad / left / right button pressed -#define IS_SYN_PT_PACKAGE(val) ((val[0] & 0xFC) == 0x84 && (val[3] & 0xCC) == 0xc4) +#define IS_SYN_PT_PACKAGE(val) ((val[0] & 0xFC) == 0x84 \ + && (val[3] & 0xCC) == 0xc4) -typedef struct -{ +typedef struct { uint8 majorVersion; uint8 minorVersion; @@ -59,8 +59,7 @@ } touchpad_info; -typedef struct -{ +typedef struct { uint8 buttons; uint32 xPosition; uint32 yPosition; @@ -105,11 +104,14 @@ status_t send_touchpad_arg(ps2_dev *dev, uint8 arg); status_t send_touchpad_arg_timeout(ps2_dev *dev, uint8 arg, bigtime_t timeout); status_t set_touchpad_mode(ps2_dev *dev, uint8 mode); -status_t passthrough_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout); +status_t passthrough_command(ps2_dev *dev, uint8 cmd, const uint8 *out, + int out_count, uint8 *in, int in_count, bigtime_t timeout); bool edge_motion(mouse_movement *movement, touch_event *event, bool validStart); -status_t touchevent_to_movement(synaptics_cookie* cookie, touch_event *event, mouse_movement *movement); -status_t get_synaptics_movment(synaptics_cookie* cookie, mouse_movement *movement); +status_t touchevent_to_movement(synaptics_cookie* cookie, touch_event *event, + mouse_movement *movement); +status_t get_synaptics_movment(synaptics_cookie* cookie, + mouse_movement *movement); void query_capability(ps2_dev *dev); status_t probe_synaptics(ps2_dev *dev); From korli at mail.berlios.de Sat Nov 1 16:07:38 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 1 Nov 2008 16:07:38 +0100 Subject: [Haiku-commits] r28430 - haiku/trunk/src/add-ons/opengl/mesa_software_renderer Message-ID: <200811011507.mA1F7c9X026308@sheep.berlios.de> Author: korli Date: 2008-11-01 16:07:38 +0100 (Sat, 01 Nov 2008) New Revision: 28430 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28430&view=rev Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.h Log: maintain our own copy of direct_buffer_info as it can change without notice fixed bug #3001 Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp =================================================================== --- haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2008-11-01 15:02:35 UTC (rev 28429) +++ haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2008-11-01 15:07:38 UTC (rev 28430) @@ -17,6 +17,7 @@ #include "MesaSoftwareRenderer.h" +#include #include #include @@ -203,6 +204,7 @@ fBitmap(NULL), fDirectModeEnabled(false), fInfo(NULL), + fInfoLocker("info locker"), fContext(NULL), fVisual(NULL), fFrameBuffer(NULL), @@ -324,6 +326,7 @@ BRect b = GLView()->Bounds(); color_space cs = B_RGBA32; + if (fDirectModeEnabled && fInfo != NULL) { cs = BScreen(GLView()->Window()).ColorSpace(); } @@ -436,6 +439,7 @@ GLView()->DrawBitmap(fBitmap); GLView()->UnlockLooper(); } else { + BAutolock lock(fInfoLocker); uint8 bytesPerPixel = fInfo->bits_per_pixel / 8; uint32 bytesPerRow = fBitmap->BytesPerRow(); for (uint32 i = 0; i < fInfo->clip_list_count; i++) { @@ -555,8 +559,17 @@ void MesaSoftwareRenderer::DirectConnected(direct_buffer_info *info) -{ - fInfo = info; +{ + BAutolock lock(fInfoLocker); + if (info) { + if (!fInfo) + fInfo = new direct_buffer_info(); + memcpy(fInfo, info, sizeof(*info)); + } else if (fInfo) { + delete fInfo; + fInfo = NULL; + } + } Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.h =================================================================== --- haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.h 2008-11-01 15:02:35 UTC (rev 28429) +++ haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.h 2008-11-01 15:07:38 UTC (rev 28430) @@ -61,7 +61,8 @@ BBitmap* fBitmap; bool fDirectModeEnabled; - direct_buffer_info* fInfo; + direct_buffer_info* fInfo; + BLocker fInfoLocker; GLcontext* fContext; GLvisual* fVisual; From anevilyak at mail.berlios.de Sat Nov 1 16:21:52 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 1 Nov 2008 16:21:52 +0100 Subject: [Haiku-commits] r28431 - haiku/trunk/build/jam Message-ID: <200811011521.mA1FLq8P029974@sheep.berlios.de> Author: anevilyak Date: 2008-11-01 16:21:52 +0100 (Sat, 01 Nov 2008) New Revision: 28431 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28431&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Update Vision package for some minor fixes: - fixed layout of font preflet - enabled InfoPopper support - incorporate recent BCLV changes Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-01 15:07:38 UTC (rev 28430) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-01 15:21:52 UTC (rev 28431) @@ -442,12 +442,12 @@ AddSymlinkToHaikuImage home config be Applications : /boot/apps/Vision-0.9.7-H-18072008/Vision ; } else { - InstallOptionalHaikuImagePackage Vision-0.9.7-H-21072008 - : http://vision.sf.net/Vision-0.9.7-H-21072008.zip + InstallOptionalHaikuImagePackage Vision-0.9.7-H-01112008 + : http://vision.sf.net/Vision-0.9.7-H-01112008.zip : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/Vision-0.9.7-H-21072008/Vision ; + : /boot/apps/Vision-0.9.7-H-11012008/Vision ; } } From revol at free.fr Sat Nov 1 16:35:08 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 01 Nov 2008 16:35:08 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28416_-_in_haiku/trunk=3A_heade?= =?windows-1252?q?rs/private/input_src/add-ons/input=5Fserver/devices_src/?= =?windows-1252?q?add-ons/input=5Fserver/devices/touchpad__src/add-ons/ker?= =?windows-1252?q?nel/bus=5Fmanagers/ps2_src/preferences_src/preferences/t?= =?windows-1252?q?ouchpad?= In-Reply-To: <490C47F2.2090300@arcor.de> Message-ID: <3927518122-BeMail@laptop> > Stephan Assmus schrieb: > > >> Please rename!!!!!! > > > > Will do. While I have your attention, could you please have a look > > through > > the patch and tell me whether mouse and touchpad should become > > separate > > add-ons to the ps2 bus_manager? > > In an ideal world, the ps2 busmanager would act similar to the usb > busmanager, and drivers for keyboard, mice and touchpad would use it. > The busmanager would provide data streams of the available serial > connections. > > However, I don't think thats it's worth the effort to implement that. Well, for once Linux does it now it seems. It'd probably help adding support for non-standard stuff (though barcode scanners fake keyboards IIRC). Fran?ois. From anevilyak at gmail.com Sat Nov 1 16:34:26 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 1 Nov 2008 10:34:26 -0500 Subject: [Haiku-commits] r28416 - in haiku/trunk: headers/private/input src/add-ons/input_server/devices src/add-ons/input_server/devices/touchpad src/add-ons/kernel/bus_managers/ps2 src/preferences src/preferences/touchpad In-Reply-To: <3927518122-BeMail@laptop> References: <490C47F2.2090300@arcor.de> <3927518122-BeMail@laptop> Message-ID: On Sat, Nov 1, 2008 at 10:35 AM, Fran?ois Revol wrote: > Well, for once Linux does it now it seems. > It'd probably help adding support for non-standard stuff (though > barcode scanners fake keyboards IIRC). The ones we had at one of my previous jobs did :) Was amusing that you could scan a barcode and have the text appear in whatever random text editor you were in at the time. Regards, Rene From revol at free.fr Sat Nov 1 16:41:17 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 01 Nov 2008 16:41:17 +0100 CET Subject: [Haiku-commits] r28422 - haiku/trunk/src/preferences/touchpad In-Reply-To: <200811011158.mA1Bw7xf014813@sheep.berlios.de> Message-ID: <4296646528-BeMail@laptop> > Author: julun > Date: 2008-11-01 12:58:03 +0100 (Sat, 01 Nov 2008) > New Revision: 28422 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28422&view=rev > > Modified: > haiku/trunk/src/preferences/touchpad/main.cpp Should probably be merged into the Mouse pref somehow later... Fran?ois. From superstippi at gmx.de Sat Nov 1 16:48:45 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 01 Nov 2008 16:48:45 +0100 Subject: [Haiku-commits] r28422 - haiku/trunk/src/preferences/touchpad In-Reply-To: <4296646528-BeMail@laptop> References: <4296646528-BeMail@laptop> Message-ID: <20081101164845.7696.6@stippis2.1225534427.fake> Fran?ois Revol wrote: > > Author: julun > > Date: 2008-11-01 12:58:03 +0100 (Sat, 01 Nov 2008) New Revision: 28422 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28422&view=rev > > > > Modified: > > haiku/trunk/src/preferences/touchpad/main.cpp > > Should probably be merged into the Mouse pref somehow later... Yes, Axel said the same thing already when I talked to him. It would be nice if we supported individual settings per device. It's not very far fetched that you'd want a different acceleration for your mouse than for your touch pad or a different mouse with different resolution and so on. Then all this could be integrated into one panel which shows each device you have connected. Best regards, -Stephan From stippi at mail.berlios.de Sat Nov 1 17:08:58 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 17:08:58 +0100 Subject: [Haiku-commits] r28432 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811011608.mA1G8wXe000972@sheep.berlios.de> Author: stippi Date: 2008-11-01 17:08:57 +0100 (Sat, 01 Nov 2008) New Revision: 28432 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28432&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c Log: * Fixed more coding style issues. * White space cleanup. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 15:21:52 UTC (rev 28431) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 16:08:57 UTC (rev 28432) @@ -22,12 +22,47 @@ ps2_dev ps2_device[PS2_DEVICE_COUNT] = { - { .name = "input/mouse/ps2/0", .active = false, .idx = 0, .result_sem = -1, .command = standard_command_timeout }, - { .name = "input/mouse/ps2/1", .active = false, .idx = 1, .result_sem = -1, .command = standard_command_timeout }, - { .name = "input/mouse/ps2/2", .active = false, .idx = 2, .result_sem = -1, .command = standard_command_timeout }, - { .name = "input/mouse/ps2/3", .active = false, .idx = 3, .result_sem = -1, .command = standard_command_timeout }, - { .name = "input/mouse/ps2/synaptics_passthrough", .active = false, .result_sem = -1, .command = passthrough_command}, - { .name = "input/keyboard/at/0", .active = false, .result_sem = -1, .flags = PS2_FLAG_KEYB, .command = standard_command_timeout } + { + .name = "input/mouse/ps2/0", + .active = false, + .idx = 0, + .result_sem = -1, + .command = standard_command_timeout + }, + { + .name = "input/mouse/ps2/1", + .active = false, + .idx = 1, + .result_sem = -1, + .command = standard_command_timeout + }, + { + .name = "input/mouse/ps2/2", + .active = false, + .idx = 2, + .result_sem = -1, + .command = standard_command_timeout + }, + { + .name = "input/mouse/ps2/3", + .active = false, + .idx = 3, + .result_sem = -1, + .command = standard_command_timeout + }, + { + .name = "input/mouse/ps2/synaptics_passthrough", + .active = false, + .result_sem = -1, + .command = passthrough_command + }, + { + .name = "input/keyboard/at/0", + .active = false, + .result_sem = -1, + .flags = PS2_FLAG_KEYB, + .command = standard_command_timeout + } }; @@ -36,20 +71,21 @@ { uint8 data[2]; status_t status; - + TRACE("ps2: ps2_reset_mouse\n"); - + status = ps2_dev_command(dev, PS2_CMD_RESET, NULL, 0, data, 2); - + if (status == B_OK && data[0] != 0xAA && data[1] != 0x00) { - TRACE("ps2: reset mouse failed, response was: 0x%02x 0x%02x\n", data[0], data[1]); + TRACE("ps2: reset mouse failed, response was: 0x%02x 0x%02x\n", data[0], + data[1]); status = B_ERROR; } else if (status != B_OK) { TRACE("ps2: reset mouse failed\n"); } else { TRACE("ps2: reset mouse success\n"); } - + return status; } @@ -62,31 +98,31 @@ INFO("ps2: reset failed\n"); return B_ERROR; } - + // probe devices // the probe function has to set the dev name and the dev packet size - + status = probe_trackpoint(dev); if (status == B_OK) { *hooks = &gStandardMouseDeviceHooks; goto dev_found; } - + status = probe_synaptics(dev); if (status == B_OK) { *hooks = &gSynapticsDeviceHooks; goto dev_found; } - + status = probe_standard_mouse(dev); if (status == B_OK) { *hooks = &gStandardMouseDeviceHooks; goto dev_found; } - + return B_ERROR; - -dev_found: + +dev_found: if (dev == &(ps2_device[PS2_DEVICE_SYN_PASSTHROUGH])) synaptics_pt_set_packagesize(dev, dev->packet_size); @@ -130,10 +166,10 @@ { status_t status; TRACE("ps2: ps2_dev_publish %s\n", dev->name); - + if (dev->active) return; - + if (atomic_get(&dev->flags) & PS2_FLAG_KEYB) { status = devfs_publish_device(dev->name, &gKeyboardDeviceHooks); } else { @@ -142,12 +178,12 @@ if (status == B_OK) { status = devfs_publish_device(dev->name, hooks); } - + //status = devfs_publish_device(dev->name, &gPointingDeviceHooks); } - + dev->active = true; - + INFO("ps2: devfs_publish_device %s, status = 0x%08lx\n", dev->name, status); } @@ -160,9 +196,9 @@ if (!dev->active) return; - + dev->active = false; - + status = devfs_unpublish_device(dev->name, true); if ((dev->flags & PS2_FLAG_ENABLED) && dev->disconnect) @@ -177,9 +213,9 @@ { const uint8 data = dev->history[0].data; uint32 flags; - + flags = atomic_get(&dev->flags); - + if (flags & PS2_FLAG_CMD) { if ((flags & (PS2_FLAG_ACK | PS2_FLAG_NACK)) == 0) { int cnt = 1; @@ -223,7 +259,7 @@ } return B_HANDLED_INTERRUPT; } - + pass_to_handler: if ((flags & PS2_FLAG_KEYB) == 0) { @@ -253,12 +289,12 @@ } return B_HANDLED_INTERRUPT; } - + if ((flags & PS2_FLAG_ENABLED) == 0) { TRACE("ps2: %s not enabled, data 0x%02x dropped\n", dev->name, data); return B_HANDLED_INTERRUPT; } - + return dev->handle_int(dev); } @@ -287,7 +323,7 @@ dev->result_buf_cnt = in_count; dev->result_buf_idx = 0; dev->result_buf = in; - + res = B_OK; for (i = -1; res == B_OK && i < out_count; i++) { @@ -341,7 +377,7 @@ if (res != B_OK) break; - } + } if (res == B_OK) { if (in_count == 0) { @@ -360,7 +396,7 @@ } TRACE("ps2: ps2_dev_command wait for input res 0x%08lx, wait-time %Ld\n", res, system_time() - start); - + for (i = 0; i < in_count; i++) TRACE("ps2: ps2_dev_command rx: 0x%02x\n", in[i]); } From stippi at mail.berlios.de Sat Nov 1 17:28:48 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 17:28:48 +0100 Subject: [Haiku-commits] r28433 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811011628.mA1GSmeg003727@sheep.berlios.de> Author: stippi Date: 2008-11-01 17:28:45 +0100 (Sat, 01 Nov 2008) New Revision: 28433 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28433&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c Log: More coding style cleanups. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 16:08:57 UTC (rev 28432) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 16:28:45 UTC (rev 28433) @@ -77,8 +77,8 @@ status = ps2_dev_command(dev, PS2_CMD_RESET, NULL, 0, data, 2); if (status == B_OK && data[0] != 0xAA && data[1] != 0x00) { - TRACE("ps2: reset mouse failed, response was: 0x%02x 0x%02x\n", data[0], - data[1]); + TRACE("ps2: reset mouse failed, response was: 0x%02x 0x%02x\n", + data[0], data[1]); status = B_ERROR; } else if (status != B_OK) { TRACE("ps2: reset mouse failed\n"); @@ -204,7 +204,8 @@ if ((dev->flags & PS2_FLAG_ENABLED) && dev->disconnect) dev->disconnect(dev); - INFO("ps2: devfs_unpublish_device %s, status = 0x%08lx\n", dev->name, status); + INFO("ps2: devfs_unpublish_device %s, status = 0x%08lx\n", dev->name, + status); } @@ -223,9 +224,12 @@ atomic_or(&dev->flags, PS2_FLAG_ACK); } else if (data == PS2_REPLY_RESEND || data == PS2_REPLY_ERROR) { atomic_or(&dev->flags, PS2_FLAG_NACK); - } else if ((flags & PS2_FLAG_GETID) && (data == 0 || data == 3 || data == 4)) { - // workaround for broken mice that don't ack the "get id" command - TRACE("ps2: ps2_dev_handle_int: mouse didn't ack the 'get id' command\n"); + } else if ((flags & PS2_FLAG_GETID) + && (data == 0 || data == 3 || data == 4)) { + // workaround for broken mice that don't ack the "get id" + // command + TRACE("ps2: ps2_dev_handle_int: mouse didn't ack the 'get id' " + "command\n"); atomic_or(&dev->flags, PS2_FLAG_ACK); if (dev->result_buf_cnt) { dev->result_buf[dev->result_buf_idx] = data; @@ -237,7 +241,8 @@ } } } else { -// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x while waiting for ack\n", data); +// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x while " +// "waiting for ack\n", data); TRACE("ps2: int1 %02x\n", data); goto pass_to_handler; } @@ -253,7 +258,8 @@ return B_INVOKE_SCHEDULER; } } else { -// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x during command processing\n", data); +// TRACE("ps2: ps2_dev_handle_int unexpected data 0x%02x during " +// "command processing\n", data); TRACE("ps2: int2 %02x\n", data); goto pass_to_handler; } @@ -268,10 +274,12 @@ ps2_service_notify_device_removed(dev); return B_INVOKE_SCHEDULER; } - if (data == 0x00 && dev->history[1].data == 0xaa && (dev->history[0].time - dev->history[1].time) < 50000) { + if (data == 0x00 && dev->history[1].data == 0xaa + && (dev->history[0].time - dev->history[1].time) < 50000) { INFO("ps2: hot plugin of %s\n", dev->name); if (dev->active) { - INFO("ps2: device %s still active, republishing...\n", dev->name); + INFO("ps2: device %s still active, republishing...\n", + dev->name); ps2_service_notify_device_republish(dev); } else { ps2_service_notify_device_added(dev); @@ -300,14 +308,16 @@ status_t -standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout) +standard_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, + int out_count, uint8 *in, int in_count, bigtime_t timeout) { status_t res; bigtime_t start; int32 sem_count; int i; - TRACE("ps2: ps2_dev_command cmd 0x%02x, out-count %d, in-count %d, dev %s\n", cmd, out_count, in_count, dev->name); + TRACE("ps2: ps2_dev_command cmd 0x%02x, out-count %d, in-count %d, " + "dev %s\n", cmd, out_count, in_count, dev->name); for (i = 0; i < out_count; i++) TRACE("ps2: ps2_dev_command tx: 0x%02x\n", out[i]); @@ -327,7 +337,8 @@ res = B_OK; for (i = -1; res == B_OK && i < out_count; i++) { - atomic_and(&dev->flags, ~(PS2_FLAG_ACK | PS2_FLAG_NACK | PS2_FLAG_GETID)); + atomic_and(&dev->flags, + ~(PS2_FLAG_ACK | PS2_FLAG_NACK | PS2_FLAG_GETID)); acquire_sem(gControllerSem); @@ -363,7 +374,8 @@ if (res != B_OK) atomic_and(&dev->flags, ~PS2_FLAG_CMD); - TRACE("ps2: ps2_dev_command wait for ack res 0x%08lx, wait-time %Ld\n", res, system_time() - start); + TRACE("ps2: ps2_dev_command wait for ack res 0x%08lx, wait-time %Ld\n", + res, system_time() - start); if (atomic_get(&dev->flags) & PS2_FLAG_ACK) { TRACE("ps2: ps2_dev_command got ACK\n"); @@ -384,18 +396,21 @@ atomic_and(&dev->flags, ~PS2_FLAG_CMD); } else { start = system_time(); - res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT, timeout); + res = acquire_sem_etc(dev->result_sem, 1, B_RELATIVE_TIMEOUT, + timeout); atomic_and(&dev->flags, ~PS2_FLAG_CMD); if (dev->result_buf_cnt != 0) { - TRACE("ps2: ps2_dev_command error: %d rx bytes not received\n", dev->result_buf_cnt); + TRACE("ps2: ps2_dev_command error: %d rx bytes not received\n", + dev->result_buf_cnt); in_count -= dev->result_buf_cnt; dev->result_buf_cnt = 0; res = B_IO_ERROR; } - TRACE("ps2: ps2_dev_command wait for input res 0x%08lx, wait-time %Ld\n", res, system_time() - start); + TRACE("ps2: ps2_dev_command wait for input res 0x%08lx, " + "wait-time %Ld\n", res, system_time() - start); for (i = 0; i < in_count; i++) TRACE("ps2: ps2_dev_command rx: 0x%02x\n", in[i]); @@ -409,14 +424,17 @@ status_t -ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count) +ps2_dev_command(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, + uint8 *in, int in_count) { - return ps2_dev_command_timeout(dev, cmd, out, out_count, in, in_count, 4000000); + return ps2_dev_command_timeout(dev, cmd, out, out_count, in, in_count, + 4000000); } status_t -ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, int out_count, uint8 *in, int in_count, bigtime_t timeout) +ps2_dev_command_timeout(ps2_dev *dev, uint8 cmd, const uint8 *out, + int out_count, uint8 *in, int in_count, bigtime_t timeout) { return dev->command(dev, cmd, out, out_count, in, in_count, timeout); } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-01 16:08:57 UTC (rev 28432) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-01 16:28:45 UTC (rev 28433) @@ -271,7 +271,8 @@ uint8 deviceId = 0; // get device id - status = ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, &deviceId, 1); + status = ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, + &deviceId, 1); if (status != B_OK) { INFO("ps2: probe_mouse get device id failed\n"); return B_ERROR; @@ -311,8 +312,7 @@ } -// #pragma mark - -// Device functions +// #pragma mark - Device functions status_t Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 16:08:57 UTC (rev 28432) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 16:28:45 UTC (rev 28433) @@ -54,7 +54,8 @@ syn_cookie->mode&= ~SYN_FOUR_BYTE_CHILD; set_touchpad_mode(dev->parent_dev, syn_cookie->mode); - status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); + status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, + 0); if (status < B_OK) { INFO("SYNAPTICS: cannot enable touchpad %s\n", dev->parent_dev->name); return B_ERROR; @@ -76,8 +77,8 @@ int8 i; uint8 val[8]; for (i = 0; i < 4; i++) { - val[2*i] = (arg >> (6-2*i)) & 3; - val[2*i + 1] = 0xE8; + val[2 * i] = (arg >> (6 - 2 * i)) & 3; + val[2 * i + 1] = 0xE8; } return ps2_dev_command_timeout(dev, 0xE8, val, 7, NULL, 0, timeout); } @@ -142,7 +143,8 @@ in[i - 1] = pt_in[i * 6 + 1]; } - status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); + status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, + 0); if (status != B_OK) return status; @@ -456,13 +458,16 @@ } +// #pragma mark - + + status_t probe_synaptics(ps2_dev *dev) { uint8 val[3]; uint8 deviceId; TRACE("SYNAPTICS: probe\n"); - + send_touchpad_arg(dev, 0x00); ps2_dev_command(dev, 0xE9, NULL, 0, val, 3); @@ -479,7 +484,7 @@ gTouchpadInfo.minorVersion); // version >= 4.0? if (gTouchpadInfo.minorVersion <= 2 - && gTouchpadInfo.majorVersion <= 3) { + && gTouchpadInfo.majorVersion <= 3) { TRACE("SYNAPTICS: too old touchpad not supported\n"); return B_ERROR; } @@ -488,6 +493,9 @@ } +// #pragma mark - Device functions + + status_t synaptics_open(const char *name, uint32 flags, void **_cookie) { From anevilyak at mail.berlios.de Sat Nov 1 17:52:46 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 1 Nov 2008 17:52:46 +0100 Subject: [Haiku-commits] r28434 - haiku/trunk/build/jam Message-ID: <200811011652.mA1GqktW005865@sheep.berlios.de> Author: anevilyak Date: 2008-11-01 17:52:45 +0100 (Sat, 01 Nov 2008) New Revision: 28434 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28434&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Correct slight error. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-01 16:28:45 UTC (rev 28433) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-01 16:52:45 UTC (rev 28434) @@ -447,7 +447,7 @@ : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/Vision-0.9.7-H-11012008/Vision ; + : /boot/apps/Vision-0.9.7-H-01112008/Vision ; } } From axeld at mail.berlios.de Sat Nov 1 18:28:11 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 18:28:11 +0100 Subject: [Haiku-commits] r28435 - in haiku/trunk: build/jam src/bin src/kits/storage/disk_device Message-ID: <200811011728.mA1HSBL2009150@sheep.berlios.de> Author: axeld Date: 2008-11-01 18:28:10 +0100 (Sat, 01 Nov 2008) New Revision: 28435 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28435&view=rev Added: haiku/trunk/src/bin/checkfs.cpp Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/bin/Jamfile haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp Log: * Made repairing partitions work theoretically. * Implemented a small app "checkfs" to check partitions and put it on the image. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-01 16:52:45 UTC (rev 28434) +++ haiku/trunk/build/jam/HaikuImage 2008-11-01 17:28:10 UTC (rev 28435) @@ -30,9 +30,9 @@ GPL_ONLY = "" ; } -BEOS_BIN = "[" addattr alert arp base64 basename bc beep bootman bzip2 cal cat - catattr chgrp chmod chop chown chroot cksum clear clockconfig cmp comm - compress cp copyattr $(X86_ONLY)CortexAddOnHost +BEOS_BIN = "[" addattr alert arp base64 basename bc beep bootman bzip2 + cal cat catattr checkfs chgrp chmod chop chown chroot cksum clear + clockconfig cmp comm compress cp copyattr $(X86_ONLY)CortexAddOnHost csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname draggers driveinfo dstcheck du echo eject env error expand expr expr factor false fdinfo ffm find finddir fmt fold fortune frcode ftp ftpd Modified: haiku/trunk/src/bin/Jamfile =================================================================== --- haiku/trunk/src/bin/Jamfile 2008-11-01 16:52:45 UTC (rev 28434) +++ haiku/trunk/src/bin/Jamfile 2008-11-01 17:28:10 UTC (rev 28435) @@ -75,6 +75,7 @@ StdBinCommands alert.cpp beep.cpp + checkfs.cpp clipboard.cpp df.cpp dpms.cpp Added: haiku/trunk/src/bin/checkfs.cpp =================================================================== --- haiku/trunk/src/bin/checkfs.cpp 2008-11-01 16:52:45 UTC (rev 28434) +++ haiku/trunk/src/bin/checkfs.cpp 2008-11-01 17:28:10 UTC (rev 28435) @@ -0,0 +1,147 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + +#include +#include +#include + + +extern "C" const char* __progname; +static const char* kProgramName = __progname; + + +void +usage(FILE* output) +{ + fprintf(output, + "Usage: %s \n" + "\n" + "Options:\n" + " -h, --help - print this help text\n" + " -c, --check-only - do not make any changes to the file system\n", + kProgramName); +} + + +int +main(int argc, char** argv) +{ + const struct option kLongOptions[] = { + { "help", 0, NULL, 'h' }, + { "check-only", 0, NULL, 'c' }, + { NULL, 0, NULL, 0 } + }; + const char* kShortOptions = "hc"; + + // parse argument list + bool checkOnly = false; + + while (true) { + int nextOption = getopt_long(argc, argv, kShortOptions, kLongOptions, + NULL); + if (nextOption == -1) + break; + + switch (nextOption) { + case 'h': // --help + usage(stdout); + return 0; + case 'c': // --check-only + checkOnly = true; + break; + case -1: // done with options + break; + default: // everything else + usage(stderr); + return 1; + } + } + + // the device name should be the only non-option element + if (optind != argc - 1) { + usage(stderr); + return 1; + } + + const char* path = argv[optind]; + //UnregisterFileDevice unregisterFileDevice; + + BDiskDeviceRoster roster; + BPartition* partition; + BDiskDevice device; + + status_t status = roster.GetPartitionForPath(path, &device, + &partition); + if (status != B_OK) { + if (strncmp(path, "/dev", 4)) { + // try mounted volume + status = roster.FindPartitionByMountPoint(path, &device, &partition) + ? B_OK : B_BAD_VALUE; + } + + // TODO: try to register file device + + if (status != B_OK) { + fprintf(stderr, "%s: Failed to get disk device for path \"%s\": " + "%s\n", kProgramName, path, strerror(status)); + return 1; + } + } + + // Prepare the device for modifications + + status = device.PrepareModifications(); + if (status != B_OK) { + fprintf(stderr, "%s: Could not prepare the device for modifications: " + "%s\n", kProgramName, strerror(status)); + return false; + } + + // Check if the partition supports repairing + + bool canRepairWhileMounted; + bool canRepair = partition->CanRepair(checkOnly, &canRepairWhileMounted); + if (!canRepair && !canRepairWhileMounted) { + fprintf(stderr, "%s: The disk system does not support repairing.\n", + kProgramName); + return 1; + } + + if (partition->IsMounted() && !canRepairWhileMounted) { + fprintf(stderr, "%s: The disk system does not support repairing a " + "mounted volume.\n", kProgramName); + return 1; + } + if (!partition->IsMounted() && !canRepair) { + fprintf(stderr, "%s: The disk system does not support repairing a " + "volume that is not mounted.\n", kProgramName); + return 1; + } + + BDiskSystem diskSystem; + status = partition->GetDiskSystem(&diskSystem); + if (status != B_OK) { + fprintf(stderr, "%s: Failed to get disk system for partition: %s\n", + kProgramName, strerror(status)); + return 1; + } + + // Repair the volume + + status = partition->Repair(checkOnly); + if (status != B_OK) { + fprintf(stderr, "%s: Repairing failed: %s\n", kProgramName, + strerror(status)); + return 1; + } + + status = device.CommitModifications(); + + return 0; +} Modified: haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp 2008-11-01 16:52:45 UTC (rev 28434) +++ haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp 2008-11-01 17:28:10 UTC (rev 28435) @@ -163,8 +163,10 @@ status_t BPartition::Delegate::Repair(bool checkOnly) { -// TODO: Implement! - return B_BAD_VALUE; + if (fPartitionHandle == NULL) + return B_NO_INIT; + + return fPartitionHandle->Repair(checkOnly); } From axeld at mail.berlios.de Sat Nov 1 18:29:46 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 18:29:46 +0100 Subject: [Haiku-commits] r28436 - haiku/trunk/src/kits/storage/disk_device Message-ID: <200811011729.mA1HTjLj009229@sheep.berlios.de> Author: axeld Date: 2008-11-01 18:29:45 +0100 (Sat, 01 Nov 2008) New Revision: 28436 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28436&view=rev Modified: haiku/trunk/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp haiku/trunk/src/kits/storage/disk_device/DiskSystemAddOnManager.cpp Log: * Calmed down debug output. Modified: haiku/trunk/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp 2008-11-01 17:28:10 UTC (rev 28435) +++ haiku/trunk/src/kits/storage/disk_device/DiskDeviceJobGenerator.cpp 2008-11-01 17:29:45 UTC (rev 28436) @@ -31,8 +31,8 @@ #undef TRACE -//#define TRACE(x...) -#define TRACE(x...) printf(x) +#define TRACE(x...) +//#define TRACE(x...) printf(x) using std::nothrow; @@ -72,7 +72,7 @@ }; -// PartitionRefInfo +// PartitionRefInfo struct DiskDeviceJobGenerator::PartitionRefInfo { PartitionRefInfo() : partition(NULL), Modified: haiku/trunk/src/kits/storage/disk_device/DiskSystemAddOnManager.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/DiskSystemAddOnManager.cpp 2008-11-01 17:28:10 UTC (rev 28435) +++ haiku/trunk/src/kits/storage/disk_device/DiskSystemAddOnManager.cpp 2008-11-01 17:29:45 UTC (rev 28436) @@ -25,8 +25,8 @@ #undef TRACE -//#define TRACE(format...) -#define TRACE(format...) printf(format) +#define TRACE(format...) +//#define TRACE(format...) printf(format) using std::nothrow; From axeld at mail.berlios.de Sat Nov 1 18:31:32 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 18:31:32 +0100 Subject: [Haiku-commits] r28437 - haiku/trunk/src/add-ons/disk_systems/bfs Message-ID: <200811011731.mA1HVWJg010644@sheep.berlios.de> Author: axeld Date: 2008-11-01 18:31:31 +0100 (Sat, 01 Nov 2008) New Revision: 28437 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28437&view=rev Modified: haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.cpp haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.h Log: * Implemented a "chkbfs" using the old ioctl interface formerly only used by the old bfs_shell. This is probably not how Ingo anticipated this to be used :-) * It still seems to work, though, haven't yet tested on a partition with harder errors. Modified: haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.cpp =================================================================== --- haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.cpp 2008-11-01 17:29:45 UTC (rev 28436) +++ haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.cpp 2008-11-01 17:31:31 UTC (rev 28437) @@ -1,5 +1,7 @@ /* * Copyright 2007, Ingo Weinhold, ingo_weinhold at gmx.de. + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. + * * Distributed under the terms of the MIT License. */ @@ -7,14 +9,22 @@ #include +#include #include +#include +#include #include #include #include +#ifdef ASSERT +# undef ASSERT +#endif + #include "bfs.h" +#include "bfs_control.h" #include "bfs_disk_system.h" @@ -33,8 +43,8 @@ | B_DISK_SYSTEM_SUPPORTS_CONTENT_NAME // | B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING // | B_DISK_SYSTEM_SUPPORTS_DEFRAGMENTING_WHILE_MOUNTED -// | B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED -// | B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED + | B_DISK_SYSTEM_SUPPORTS_CHECKING_WHILE_MOUNTED + | B_DISK_SYSTEM_SUPPORTS_REPAIRING_WHILE_MOUNTED // | B_DISK_SYSTEM_SUPPORTS_RESIZING_WHILE_MOUNTED // | B_DISK_SYSTEM_SUPPORTS_MOVING_WHILE_MOUNTED // | B_DISK_SYSTEM_SUPPORTS_SETTING_CONTENT_NAME_WHILE_MOUNTED @@ -166,20 +176,17 @@ // #pragma mark - BFSPartitionHandle -// constructor BFSPartitionHandle::BFSPartitionHandle(BMutablePartition* partition) : BPartitionHandle(partition) { } -// destructor BFSPartitionHandle::~BFSPartitionHandle() { } -// Init status_t BFSPartitionHandle::Init() { @@ -188,6 +195,100 @@ } +uint32 +BFSPartitionHandle::SupportedOperations(uint32 mask) +{ + return kDiskSystemFlags & mask; +} + + +status_t +BFSPartitionHandle::Repair(bool checkOnly) +{ + BVolume volume(Partition()->VolumeID()); + BDirectory directory; + volume.GetRootDirectory(&directory); + BPath path; + path.SetTo(&directory, "."); + + int fd = open(path.Path(), O_RDONLY); + if (fd < 0) { + printf("chkbfs: error opening '.'\n"); + return errno; + } + + struct check_control result; + memset(&result, 0, sizeof(result)); + result.magic = BFS_IOCTL_CHECK_MAGIC; + result.flags = !checkOnly ? BFS_FIX_BITMAP_ERRORS : 0; + if (!checkOnly) { + //printf("will fix any severe errors!\n"); + result.flags |= BFS_REMOVE_WRONG_TYPES | BFS_REMOVE_INVALID; + } + + // start checking + if (ioctl(fd, BFS_IOCTL_START_CHECKING, &result, sizeof(result)) < 0) { + printf("chkbfs: error starting!\n"); + return errno; + } + + off_t attributeDirectories = 0, attributes = 0; + off_t files = 0, directories = 0, indices = 0; + off_t counter = 0; + + // check all files and report errors + while (ioctl(fd, BFS_IOCTL_CHECK_NEXT_NODE, &result, sizeof(result)) == 0) { + if (++counter % 50 == 0) + printf("%9Ld nodes processed\x1b[1A\n", counter); + + if (result.errors) { + printf("%s (inode = %Ld)", result.name, result.inode); + if (result.errors & BFS_MISSING_BLOCKS) + printf(", some blocks weren't allocated"); + if (result.errors & BFS_BLOCKS_ALREADY_SET) + printf(", has blocks already set"); + if (result.errors & BFS_INVALID_BLOCK_RUN) + printf(", has invalid block run(s)"); + if (result.errors & BFS_COULD_NOT_OPEN) + printf(", could not be opened"); + if (result.errors & BFS_WRONG_TYPE) + printf(", has wrong type"); + if (result.errors & BFS_NAMES_DONT_MATCH) + printf(", names don't match"); + putchar('\n'); + } + if ((result.mode & (S_INDEX_DIR | 0777)) == S_INDEX_DIR) + indices++; + else if (result.mode & S_ATTR_DIR) + attributeDirectories++; + else if (result.mode & S_ATTR) + attributes++; + else if (S_ISDIR(result.mode)) + directories++; + else + files++; + } + + // stop checking + if (ioctl(fd, BFS_IOCTL_STOP_CHECKING, &result, sizeof(result)) < 0) + printf("chkbfs: error stopping!\n"); + + close(fd); + + printf("checked %Ld nodes, %Ld blocks not allocated, %Ld blocks already " + "set, %Ld blocks could be freed\n", counter, result.stats.missing, + result.stats.already_set, result.stats.freed); + printf("\tfiles\t\t%Ld\n\tdirectories\t%Ld\n\tattributes\t%Ld\n\tattr. " + "dirs\t%Ld\n\tindices\t\t%Ld\n", files, directories, attributes, + attributeDirectories, indices); + + if (result.status == B_ENTRY_NOT_FOUND) + result.status = B_OK; + + return result.status; +} + + // #pragma mark - Modified: haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.h =================================================================== --- haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.h 2008-11-01 17:29:45 UTC (rev 28436) +++ haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.h 2008-11-01 17:31:31 UTC (rev 28437) @@ -38,6 +38,10 @@ ~BFSPartitionHandle(); status_t Init(); + + virtual uint32 SupportedOperations(uint32 mask); + + virtual status_t Repair(bool checkOnly); }; From axeld at mail.berlios.de Sat Nov 1 20:04:15 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 20:04:15 +0100 Subject: [Haiku-commits] r28438 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200811011904.mA1J4Fjn011960@sheep.berlios.de> Author: axeld Date: 2008-11-01 20:04:14 +0100 (Sat, 01 Nov 2008) New Revision: 28438 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28438&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h Log: * The check mechanism in the block allocator now locks the journal as well to fix a potential deadlock. * Journal::Lock() now accepts another parameter that specified whether child transactions should be split - this is nothing you would want in normal operation unless the parent transaction is only there to prevent others from writing (such as with the block allocator check stuff). Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-11-01 17:31:31 UTC (rev 28437) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-11-01 19:04:14 UTC (rev 28438) @@ -1116,14 +1116,20 @@ if (!_IsValidCheckControl(control)) return B_BAD_VALUE; + fVolume->GetJournal(0)->Lock(NULL, true); + // Lock the volume's journal + status_t status = mutex_lock(&fLock); - if (status < B_OK) + if (status < B_OK) { + fVolume->GetJournal(0)->Unlock(NULL, true); return status; + } size_t size = BitmapSize(); fCheckBitmap = (uint32*)malloc(size); if (fCheckBitmap == NULL) { mutex_unlock(&fLock); + fVolume->GetJournal(0)->Unlock(NULL, true); return B_NO_MEMORY; } @@ -1132,6 +1138,7 @@ free(fCheckBitmap); fCheckBitmap = NULL; mutex_unlock(&fLock); + fVolume->GetJournal(0)->Unlock(NULL, true); return B_NO_MEMORY; } @@ -1209,7 +1216,7 @@ = HOST_ENDIAN_TO_BFS_INT64(usedBlocks); int32 blocksInBitmap = fNumGroups * fBlocksPerGroup; - int32 blockSize = fVolume->BlockSize(); + size_t blockSize = fVolume->BlockSize(); for (int32 i = 0; i < blocksInBitmap; i += 512) { Transaction transaction(fVolume, 1 + i); @@ -1235,6 +1242,7 @@ fCheckCookie = NULL; delete cookie; mutex_unlock(&fLock); + fVolume->GetJournal(0)->Unlock(NULL, true); return B_OK; } Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-11-01 17:31:31 UTC (rev 28437) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-11-01 19:04:14 UTC (rev 28438) @@ -403,7 +403,8 @@ fMaxTransactionSize(fLogSize / 2 - 5), fUsed(0), fUnwrittenTransactions(0), - fHasSubtransaction(false) + fHasSubtransaction(false), + fSeparateSubTransactions(false) { recursive_lock_init(&fLock, "bfs journal"); mutex_init(&fEntriesLock, "bfs journal entries"); @@ -909,17 +910,20 @@ status_t -Journal::Lock(Transaction* owner) +Journal::Lock(Transaction* owner, bool separateSubTransactions) { status_t status = recursive_lock_lock(&fLock); if (status != B_OK) return status; - if (recursive_lock_get_recursion(&fLock) > 1) { + if (!fSeparateSubTransactions && recursive_lock_get_recursion(&fLock) > 1) { // we'll just use the current transaction again return B_OK; } + if (separateSubTransactions) + fSeparateSubTransactions = true; + fOwner = owner; // TODO: we need a way to find out how big the current transaction is; @@ -951,13 +955,18 @@ void Journal::Unlock(Transaction* owner, bool success) { - if (recursive_lock_get_recursion(&fLock) == 1) { + if (fSeparateSubTransactions || recursive_lock_get_recursion(&fLock) == 1) { // we only end the transaction if we would really unlock it // TODO: what about failing transactions that do not unlock? + // (they must make the parent fail, too) _TransactionDone(success); fTimestamp = system_time(); fOwner = NULL; + + if (fSeparateSubTransactions + && recursive_lock_get_recursion(&fLock) == 1) + fSeparateSubTransactions = false; } recursive_lock_unlock(&fLock); @@ -1061,7 +1070,7 @@ return B_OK; fJournal = volume->GetJournal(refBlock); - if (fJournal != NULL && fJournal->Lock(this) == B_OK) + if (fJournal != NULL && fJournal->Lock(this, false) == B_OK) return B_OK; fJournal = NULL; Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-11-01 17:31:31 UTC (rev 28437) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.h 2008-11-01 19:04:14 UTC (rev 28438) @@ -26,7 +26,8 @@ status_t InitCheck(); - status_t Lock(Transaction* owner); + status_t Lock(Transaction* owner, + bool separateSubTransactions); void Unlock(Transaction* owner, bool success); status_t ReplayLog(); @@ -69,6 +70,7 @@ bigtime_t fTimestamp; int32 fTransactionID; bool fHasSubtransaction; + bool fSeparateSubTransactions; }; From axeld at mail.berlios.de Sat Nov 1 20:05:23 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sat, 1 Nov 2008 20:05:23 +0100 Subject: [Haiku-commits] r28439 - haiku/trunk/src/kits/storage/disk_device Message-ID: <200811011905.mA1J5Nnw012100@sheep.berlios.de> Author: axeld Date: 2008-11-01 20:05:23 +0100 (Sat, 01 Nov 2008) New Revision: 28439 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28439&view=rev Modified: haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp Log: * Turned off debug output. Modified: haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp =================================================================== --- haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp 2008-11-01 19:04:14 UTC (rev 28438) +++ haiku/trunk/src/kits/storage/disk_device/PartitionDelegate.cpp 2008-11-01 19:05:23 UTC (rev 28439) @@ -11,8 +11,8 @@ #undef TRACE -//#define TRACE(format...) -#define TRACE(format...) printf(format) +#define TRACE(format...) +//#define TRACE(format...) printf(format) // constructor From ingo_weinhold at gmx.de Sat Nov 1 20:12:44 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 01 Nov 2008 20:12:44 +0100 Subject: [Haiku-commits] r28437 - haiku/trunk/src/add-ons/disk_systems/bfs In-Reply-To: <200811011731.mA1HVWJg010644@sheep.berlios.de> References: <200811011731.mA1HVWJg010644@sheep.berlios.de> Message-ID: <20081101201244.793.1@knochen-vm.localdomain> On 2008-11-01 at 18:31:32 [+0100], axeld at BerliOS wrote: > Author: axeld > Date: 2008-11-01 18:31:31 +0100 (Sat, 01 Nov 2008) > New Revision: 28437 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28437&view=rev > > Modified: > haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.cpp > haiku/trunk/src/add-ons/disk_systems/bfs/BFSAddOn.h > Log: > * Implemented a "chkbfs" using the old ioctl interface formerly only used by > the old bfs_shell. This is probably not how Ingo anticipated this to be > used :-) Indeed. CU, Ingo From anevilyak at mail.berlios.de Sat Nov 1 21:14:56 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 1 Nov 2008 21:14:56 +0100 Subject: [Haiku-commits] r28440 - haiku/trunk/src/kits/interface Message-ID: <200811012014.mA1KEuqt016903@sheep.berlios.de> Author: anevilyak Date: 2008-11-01 21:14:56 +0100 (Sat, 01 Nov 2008) New Revision: 28440 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28440&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp Log: Fixed numerous problems in BWindow::_FindView: 1) If a view contained the point, but had children, that view would never be returned as a result, even if none of the children matched. 2) When converting coordinates to the child's coordinate space, it was using the bounds rectangle rather than the frame. This in most cases had the result that the coordinate was unchanged, and thus messed up the search completely. This fixes ticket #3000. Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-11-01 19:05:23 UTC (rev 28439) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-11-01 20:14:56 UTC (rev 28440) @@ -3507,19 +3507,21 @@ // point is assumed to be already in view's coordinates // TODO: since BView::Bounds() potentially queries the app_server anyway, // we could just let the app_server answer this query directly. - if (view->Bounds().Contains(point) && !view->fFirstChild) - return view; - - BView* child = view->fFirstChild; - - while (child != NULL) { - BPoint childPoint = point - child->LeftTop(); - if ((view = _FindView(child, childPoint)) != NULL) + if (view->Bounds().Contains(point)) { + if (!view->fFirstChild) return view; + else { + BView* child = view->fFirstChild; + while (child != NULL) { + BPoint childPoint = point - child->Frame().LeftTop(); + if ((view = _FindView(child, childPoint)) != NULL) + return view; + child = child->fNextSibling; + } + } - child = child->fNextSibling; + return view; } - return NULL; } From bonefish at mail.berlios.de Sat Nov 1 21:21:47 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 1 Nov 2008 21:21:47 +0100 Subject: [Haiku-commits] r28441 - haiku/trunk/src/bin/debug/profile Message-ID: <200811012021.mA1KLlE5017609@sheep.berlios.de> Author: bonefish Date: 2008-11-01 21:21:47 +0100 (Sat, 01 Nov 2008) New Revision: 28441 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28441&view=rev Modified: haiku/trunk/src/bin/debug/profile/Thread.h Log: AbstractThreadProfileResult::SynchronizeImages(): New images were only added, if their creation event was now or in the future. Obviously we're only interested in images that do already exist, though. Also get rid of "new" images that already have been deleted in the meantime. Fixes problem that for some threads (almost) no images were added and thus no functions could be resolved. Modified: haiku/trunk/src/bin/debug/profile/Thread.h =================================================================== --- haiku/trunk/src/bin/debug/profile/Thread.h 2008-11-01 20:14:56 UTC (rev 28440) +++ haiku/trunk/src/bin/debug/profile/Thread.h 2008-11-01 20:21:47 UTC (rev 28441) @@ -255,9 +255,14 @@ // add new images it = fNewImages.GetIterator(); while (ThreadImageType* image = it.Next()) { - if (image->GetImage()->CreationEvent() >= event) { + if (image->GetImage()->CreationEvent() <= event) { it.Remove(); - fImages.Add(image); + int32 deleted = image->GetImage()->DeletionEvent(); + if (deleted >= 0 && event >= deleted) { + // image already deleted + delete image; + } else + fImages.Add(image); } } } From stippi at mail.berlios.de Sat Nov 1 21:29:51 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 21:29:51 +0100 Subject: [Haiku-commits] r28442 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811012029.mA1KTprd017870@sheep.berlios.de> Author: stippi Date: 2008-11-01 21:29:50 +0100 (Sat, 01 Nov 2008) New Revision: 28442 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28442&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c Log: * Check the return codes returned by the command functions in probe_synaptics(). * Automatic whitespace cleanup. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 20:21:47 UTC (rev 28441) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-01 20:29:50 UTC (rev 28442) @@ -7,7 +7,7 @@ * Authors (in chronological order): * Clemens Zeidler (haiku at Clemens-Zeidler.de) */ - + #include #include #include @@ -27,7 +27,7 @@ ps2_dev *gPassthroughDevice = &ps2_device[PS2_DEVICE_SYN_PASSTHROUGH]; -void +void default_settings(touchpad_settings *set) { memcpy(set, &kDefaultTouchpadSettings, sizeof(touchpad_settings)); @@ -37,23 +37,23 @@ status_t synaptics_pt_set_packagesize(ps2_dev *dev, uint8 size) { - synaptics_cookie* syn_cookie = dev->parent_dev->cookie; - + synaptics_cookie* syn_cookie = dev->parent_dev->cookie; + status_t status = ps2_dev_command(dev->parent_dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0); if (status < B_OK) { INFO("SYNAPTICS: cannot disable touchpad %s\n", dev->parent_dev->name); return B_ERROR; } - + syn_cookie->packet_index = 0; - + if (size == 4) syn_cookie->mode|= SYN_FOUR_BYTE_CHILD; else syn_cookie->mode&= ~SYN_FOUR_BYTE_CHILD; set_touchpad_mode(dev->parent_dev, syn_cookie->mode); - + status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); if (status < B_OK) { @@ -64,14 +64,14 @@ } -status_t +status_t send_touchpad_arg(ps2_dev *dev, uint8 arg) { return send_touchpad_arg_timeout(dev, arg, 4000000); } -status_t +status_t send_touchpad_arg_timeout(ps2_dev *dev, uint8 arg, bigtime_t timeout) { int8 i; @@ -84,7 +84,7 @@ } -status_t +status_t set_touchpad_mode(ps2_dev *dev, uint8 mode) { uint8 sample_rate = SYN_CHANGE_MODE; @@ -104,14 +104,14 @@ uint32 pt_in_count = (in_count + 1) * 6; uint8 pt_in[pt_in_count]; int8 i; - + TRACE("SYNAPTICS: passthrough command 0x%x\n", cmd); - + status = ps2_dev_command(dev->parent_dev, PS2_CMD_DISABLE, NULL, 0, NULL, 0); if (status != B_OK) return status; - + for (i = -1; i < out_count; i++) { if (i == -1) val = cmd; @@ -131,7 +131,7 @@ &pt_cmd, 1, pt_in, pt_in_count, timeout); if (status != B_OK) return status; - + for (i = 0; i < in_count + 1; i++) { uint8 *inPointer = &(pt_in[i * 6]); if (!IS_SYN_PT_PACKAGE(inPointer)) { @@ -142,12 +142,12 @@ continue; in[i - 1] = pt_in[i * 6 + 1]; } - + status = ps2_dev_command(dev->parent_dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); if (status != B_OK) return status; - + return B_OK; } @@ -157,22 +157,22 @@ { int32 xdelta = 0; int32 ydelta = 0; - + if (event->xPosition < SYN_AREA_START_X + SYN_EDGE_MOTION_WIDTH) xdelta = -SYN_EDGE_MOTION_SPEED; else if (event->xPosition > SYN_AREA_END_X - SYN_EDGE_MOTION_WIDTH) xdelta = SYN_EDGE_MOTION_SPEED; - + if (event->yPosition < SYN_AREA_START_Y + SYN_EDGE_MOTION_WIDTH) ydelta = -SYN_EDGE_MOTION_SPEED; else if (event->yPosition > SYN_AREA_END_Y - SYN_EDGE_MOTION_WIDTH) ydelta = SYN_EDGE_MOTION_SPEED; - + if (xdelta && validStart) movement->xdelta = xdelta; if (ydelta && validStart) movement->ydelta = ydelta; - + if ((xdelta || ydelta) && !validStart) return false; @@ -191,10 +191,10 @@ float sens = 0; bigtime_t currentTime = system_time(); touchpad_settings * settings = &(cookie->settings); - + if (!movement) return B_ERROR; - + movement->xdelta = 0; movement->ydelta = 0; movement->buttons = 0; @@ -203,7 +203,7 @@ movement->modifiers = 0; movement->clicks = 0; movement->timestamp = currentTime; - + if ((currentTime - cookie->tap_time) > SYN_TAP_TIMEOUT) { TRACE("SYNAPTICS: tap gesture timed out\n"); cookie->tap_started = false; @@ -212,21 +212,21 @@ cookie->tap_clicks = 0; } } - + if (event->buttons != 0) { cookie->tap_clicks = 0; cookie->tapdrag_started = false; cookie->tap_started = false; cookie->valid_edge_motion = false; } - + if (event->zPressure >= MIN_PRESSURE && event->zPressure < MAX_PRESSURE && ((event->wValue >=4 && event->wValue <=7) || event->wValue == 0 || event->wValue == 1) && (event->xPosition != 0 || event->yPosition != 0)) { isInTouch = true; } - + if (isInTouch) { if ((SYN_AREA_END_X - SYN_AREA_WIDTH_X * settings->scroll_rightrange < event->xPosition && !cookie->movement_started @@ -259,20 +259,20 @@ cookie->movement_started = true; start_new_movment(&(cookie->movement_maker)); } - + get_movement(&(cookie->movement_maker), event->xPosition, event->yPosition); - + movement->xdelta = cookie->movement_maker.xDelta; movement->ydelta = cookie->movement_maker.yDelta; - + // tap gesture cookie->tap_delta_x+= cookie->movement_maker.xDelta; cookie->tap_delta_y+= cookie->movement_maker.yDelta; - + if (cookie->tapdrag_started) { movement->buttons = 0x01; // left button movement->clicks = 0; - + cookie->valid_edge_motion = edge_motion(movement, event, cookie->valid_edge_motion); TRACE("SYNAPTICS: tap drag\n"); @@ -280,21 +280,21 @@ TRACE("SYNAPTICS: movement set buttons\n"); movement->buttons = event->buttons; } - + // use only a fraction of pressure range, the max pressure seems to be // to high sens = 20 * (event->zPressure - MIN_PRESSURE) / (MAX_PRESSURE - MIN_PRESSURE - 100); if (!cookie->tap_started - && isStartOfMovement - && settings->tapgesture_sensibility > (20 - sens)) { + && isStartOfMovement + && settings->tapgesture_sensibility > (20 - sens)) { TRACE("SYNAPTICS: tap started\n"); cookie->tap_started = true; cookie->tap_time = system_time(); cookie->tap_delta_x = 0; cookie->tap_delta_y = 0; } - + return B_OK; scrolling: @@ -311,13 +311,13 @@ event->yPosition); movement->wheel_ydelta = cookie->movement_maker.yDelta; movement->wheel_xdelta = cookie->movement_maker.xDelta; - + if (isSideScrollingV && !isSideScrollingH) movement->wheel_xdelta = 0; else if (isSideScrollingH && !isSideScrollingV) movement->wheel_ydelta = 0; return B_OK; - + notouch: TRACE("SYNAPTICS: no touch event\n"); cookie->scrolling_started = false; @@ -325,29 +325,29 @@ movement->buttons = event->buttons; if (event->buttons) movement->clicks = 1; - + if (cookie->tapdrag_started && (currentTime - cookie->tap_time) < SYN_TAP_TIMEOUT) { movement->buttons = 0x01; movement->clicks = 0; } - + // if the movement stopped switch off the dap trag when timeout is expired if ((currentTime - cookie->tap_time) > SYN_TAP_TIMEOUT) { cookie->tapdrag_started = false; cookie->valid_edge_motion = false; TRACE("SYNAPTICS: tap drag gesture timed out\n"); } - + if (abs(cookie->tap_delta_x) > 15 || abs(cookie->tap_delta_y) > 15) { cookie->tap_started = false; cookie->tap_clicks = 0; } - + if (cookie->tap_started || cookie->double_click) { TRACE("SYNAPTICS: tap gesture\n"); cookie->tap_clicks++; - + if (cookie->tap_clicks > 1) { TRACE("SYNAPTICS: empty click\n"); movement->buttons = 0x00; @@ -362,12 +362,12 @@ cookie->double_click = false; } } - + return B_OK; } -status_t +status_t get_synaptics_movment(synaptics_cookie* cookie, mouse_movement *movement) { status_t status; @@ -376,7 +376,7 @@ uint8 wValue0, wValue1, wValue2, wValue3, wValue; uint32 val32; uint32 xTwelfBit, yTwelfBit; - + status = acquire_sem_etc(cookie->synaptics_sem, 1, B_CAN_INTERRUPT, 0); if (status < B_OK) return status; @@ -385,27 +385,27 @@ TRACE("SYNAPTICS: read_event: Error device no longer active\n"); return B_ERROR; } - + if (packet_buffer_read(cookie->synaptics_ring_buffer, event_buffer, cookie->dev->packet_size) != cookie->dev->packet_size) { TRACE("SYNAPTICS: error copying buffer\n"); return B_ERROR; } - + event.buttons = event_buffer[0] & 3; event.zPressure = event_buffer[2]; - + if (gTouchpadInfo.capExtended) { wValue0 = event_buffer[3] >> 2 & 1; wValue1 = event_buffer[0] >> 2 & 1; wValue2 = event_buffer[0] >> 4 & 1; wValue3 = event_buffer[0] >> 5 & 1; - + wValue = wValue0; wValue = wValue | (wValue1 << 1); wValue = wValue | (wValue2 << 2); wValue = wValue | (wValue3 << 3); - + event.wValue = wValue; event.gesture = false; } else { @@ -416,22 +416,22 @@ } event.gesture = event_buffer[0] >> 2 & 1; } - + event.xPosition = event_buffer[4]; event.yPosition = event_buffer[5]; - + val32 = event_buffer[1] & 0x0F; event.xPosition+= val32 << 8; val32 = event_buffer[1] >> 4 & 0x0F; event.yPosition+= val32 << 8; - + xTwelfBit = event_buffer[3] >> 4 & 1; event.xPosition+= xTwelfBit << 12; yTwelfBit = event_buffer[3] >> 5 & 1; event.yPosition+= yTwelfBit << 12; - + status = touchevent_to_movement(cookie, &event, movement); - + return B_OK; } @@ -442,7 +442,7 @@ uint8 val[3]; send_touchpad_arg(dev, 0x02); ps2_dev_command(dev, 0xE9, NULL, 0, val, 3); - + gTouchpadInfo.capExtended = val[0] >> 7 & 1; TRACE("SYNAPTICS: extended mode %2x\n", val[0] >> 7 & 1); TRACE("SYNAPTICS: sleep mode %2x\n", val[2] >> 4 & 1); @@ -466,18 +466,23 @@ { uint8 val[3]; uint8 deviceId; + status_t status; TRACE("SYNAPTICS: probe\n"); - send_touchpad_arg(dev, 0x00); - ps2_dev_command(dev, 0xE9, NULL, 0, val, 3); - + status = send_touchpad_arg(dev, 0x00); + if (status != B_OK) + return status; + status = ps2_dev_command(dev, 0xE9, NULL, 0, val, 3); + if (status != B_OK) + return status; + gTouchpadInfo.minorVersion = val[0]; deviceId = val[1]; if (deviceId != SYN_TOUCHPAD) { TRACE("SYNAPTICS: not found\n"); return B_ERROR; } - + TRACE("SYNAPTICS: Touchpad found id:l %2x\n", deviceId); gTouchpadInfo.majorVersion = val[2] & 0x0F; TRACE("SYNAPTICS: version %d.%d\n", gTouchpadInfo.majorVersion, @@ -496,43 +501,43 @@ // #pragma mark - Device functions -status_t +status_t synaptics_open(const char *name, uint32 flags, void **_cookie) { status_t status; synaptics_cookie* cookie; ps2_dev *dev; int i; - + for (dev = NULL, i = 0; i < PS2_DEVICE_COUNT; i++) { if (0 == strcmp(ps2_device[i].name, name)) { dev = &ps2_device[i]; break; } } - + if (dev == NULL) { TRACE("ps2: dev = NULL\n"); return B_ERROR; } - + if (atomic_or(&dev->flags, PS2_FLAG_OPEN) & PS2_FLAG_OPEN) return B_BUSY; - - cookie = (synaptics_cookie*)malloc(sizeof(synaptics_cookie)); + + cookie = (synaptics_cookie*)malloc(sizeof(synaptics_cookie)); if (cookie == NULL) goto err1; - + *_cookie = cookie; memset(cookie, 0, sizeof(synaptics_cookie)); - + cookie->dev = dev; dev->cookie = cookie; dev->disconnect = &synaptics_disconnect; dev->handle_int = &synaptics_handle_int; - + default_settings(&(cookie->settings)); - + cookie->movement_maker.speed = 1; cookie->movement_maker.scrolling_xStep = cookie->settings.scroll_xstepsize; cookie->movement_maker.scrolling_yStep = cookie->settings.scroll_ystepsize; @@ -543,16 +548,16 @@ cookie->tap_started = false; cookie->double_click = false; cookie->valid_edge_motion = false; - + dev->packet_size = PS2_PACKET_SYNAPTICS; - + cookie->synaptics_ring_buffer = create_packet_buffer(SYNAPTICS_HISTORY_SIZE * dev->packet_size); if (cookie->synaptics_ring_buffer == NULL) { TRACE("ps2: can't allocate mouse actions buffer\n"); goto err2; } - + // create the mouse semaphore, used for synchronization between // the interrupt handler and the read operation cookie->synaptics_sem = create_sem(0, "ps2_synaptics_sem"); @@ -561,7 +566,7 @@ goto err3; } query_capability(dev); - + // create pass through dev if (gTouchpadInfo.capPassThrough) { TRACE("SYNAPTICS: pass through detected\n"); @@ -569,7 +574,7 @@ gPassthroughDevice->idx = dev->idx; ps2_service_notify_device_added(gPassthroughDevice); } - + // Set Mode if (gTouchpadInfo.capExtended) cookie->mode = SYN_ABSOLUTE_W_MODE; @@ -580,19 +585,19 @@ if (status < B_OK) { INFO("SYNAPTICS: cannot set mode %s\n", name); goto err4; - } - + } + status = ps2_dev_command(dev, PS2_CMD_ENABLE, NULL, 0, NULL, 0); if (status < B_OK) { INFO("SYNAPTICS: cannot enable touchpad %s\n", name); goto err4; } - + atomic_or(&dev->flags, PS2_FLAG_ENABLED); - + TRACE("SYNAPTICS: open %s success\n", name); return B_OK; - + err4: delete_sem(cookie->synaptics_sem); err3: @@ -601,7 +606,7 @@ free(cookie); err1: atomic_and(&dev->flags, ~PS2_FLAG_OPEN); - + TRACE("SYNAPTICS: synaptics_open %s failed\n", name); return B_ERROR; } @@ -620,10 +625,10 @@ atomic_and(&cookie->dev->flags, ~PS2_FLAG_OPEN); atomic_and(&cookie->dev->flags, ~PS2_FLAG_ENABLED); - + if (gTouchpadInfo.capPassThrough) ps2_service_notify_device_removed(gPassthroughDevice); - + TRACE("SYNAPTICS: close %s done\n", cookie->dev->name); return B_OK; } @@ -659,7 +664,7 @@ synaptics_cookie *cookie = _cookie; mouse_movement movement; status_t status; - + switch (op) { case MS_READ: TRACE("SYNAPTICS: MS_READ get event\n"); @@ -667,7 +672,7 @@ return status; return user_memcpy(buffer, &movement, sizeof(movement)); case MS_IS_TOUCHPAD: - TRACE("SYNAPTICS: MS_IS_TOUCHPAD\n"); + TRACE("SYNAPTICS: MS_IS_TOUCHPAD\n"); return B_OK; case MS_SET_TOUCHPAD_SETTINGS: TRACE("SYNAPTICS: MS_SET_TOUCHPAD_SETTINGS"); @@ -686,14 +691,14 @@ } -int32 +int32 synaptics_handle_int(ps2_dev *dev) { synaptics_cookie *cookie = dev->cookie; uint8 val; - + val = cookie->dev->history[0].data; - + if ((cookie->packet_index == 0 || cookie->packet_index == 3) && val & 8) { INFO("SYNAPTICS: bad mouse data, trying resync\n"); cookie->packet_index = 0; @@ -709,32 +714,32 @@ goto unhandled; } cookie->packet_buffer[cookie->packet_index] = val; - + cookie->packet_index++; if (cookie->packet_index >= 6) { cookie->packet_index = 0; - + // check if package is a pass through package if true pass it // too the pass through interrupt handle - if (gPassthroughDevice->active + if (gPassthroughDevice->active && gPassthroughDevice->handle_int != NULL && IS_SYN_PT_PACKAGE(cookie->packet_buffer)) { status_t status; - + gPassthroughDevice->history[0].data = cookie->packet_buffer[1]; gPassthroughDevice->handle_int(gPassthroughDevice); gPassthroughDevice->history[0].data = cookie->packet_buffer[4]; gPassthroughDevice->handle_int(gPassthroughDevice); gPassthroughDevice->history[0].data = cookie->packet_buffer[5]; status = gPassthroughDevice->handle_int(gPassthroughDevice); - + if (cookie->dev->packet_size == 4) { gPassthroughDevice->history[0].data = cookie->packet_buffer[2]; status = gPassthroughDevice->handle_int(gPassthroughDevice); } - return status; + return status; } - + if (packet_buffer_write(cookie->synaptics_ring_buffer, cookie->packet_buffer, cookie->dev->packet_size) != cookie->dev->packet_size) { @@ -742,10 +747,10 @@ return B_HANDLED_INTERRUPT; } release_sem_etc(cookie->synaptics_sem, 1, B_DO_NOT_RESCHEDULE); - + return B_INVOKE_SCHEDULER; } - + return B_HANDLED_INTERRUPT; unhandled: return B_UNHANDLED_INTERRUPT; From stippi at mail.berlios.de Sat Nov 1 21:33:16 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 1 Nov 2008 21:33:16 +0100 Subject: [Haiku-commits] r28443 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811012033.mA1KXGhJ018218@sheep.berlios.de> Author: stippi Date: 2008-11-01 21:33:14 +0100 (Sat, 01 Nov 2008) New Revision: 28443 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28443&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c Log: Turn off synaptics touchpad support for the time being. I am also not happy with the acceleration yet and as reported by others, there are problems with real mice as well (now wheel support anymore). With the plain PS/2 driver, I can slide my finger slowly over the touchpad and the cursor would react/follow precisely the movement. In Synaptics mode however, there are unexpected pauses in the movement of the cursor. In any case, the patch is finally in and I or anyone else can continue to work on it. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 20:29:50 UTC (rev 28442) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-01 20:33:14 UTC (rev 28443) @@ -102,6 +102,7 @@ // probe devices // the probe function has to set the dev name and the dev packet size +#if 0 status = probe_trackpoint(dev); if (status == B_OK) { *hooks = &gStandardMouseDeviceHooks; @@ -113,6 +114,7 @@ *hooks = &gSynapticsDeviceHooks; goto dev_found; } +#endif status = probe_standard_mouse(dev); if (status == B_OK) { From mmu_man at mail.berlios.de Sat Nov 1 21:33:39 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 1 Nov 2008 21:33:39 +0100 Subject: [Haiku-commits] r28444 - haiku/trunk/headers/private/kernel/platform/atari_m68k Message-ID: <200811012033.mA1KXdg1018266@sheep.berlios.de> Author: mmu_man Date: 2008-11-01 21:33:39 +0100 (Sat, 01 Nov 2008) New Revision: 28444 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28444&view=rev Modified: haiku/trunk/headers/private/kernel/platform/atari_m68k/MFP.h Log: add header & (c) Modified: haiku/trunk/headers/private/kernel/platform/atari_m68k/MFP.h =================================================================== --- haiku/trunk/headers/private/kernel/platform/atari_m68k/MFP.h 2008-11-01 20:33:14 UTC (rev 28443) +++ haiku/trunk/headers/private/kernel/platform/atari_m68k/MFP.h 2008-11-01 20:33:39 UTC (rev 28444) @@ -1,3 +1,10 @@ +/* + * Copyright 2008, Haiku Inc. All rights reserved. + * Distributed under the terms of the MIT License. + * + * Authors: + * Fran?ois Revol + */ #ifndef _MFP_H #define _MFP_H From mmu_man at mail.berlios.de Sat Nov 1 21:39:15 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 1 Nov 2008 21:39:15 +0100 Subject: [Haiku-commits] r28445 - in haiku/trunk: headers/private/kernel/boot src/system/boot/loader src/system/boot/loader/file_systems/fat Message-ID: <200811012039.mA1KdFXu018518@sheep.berlios.de> Author: mmu_man Date: 2008-11-01 21:39:14 +0100 (Sat, 01 Nov 2008) New Revision: 28445 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28445&view=rev Modified: haiku/trunk/headers/private/kernel/boot/FileMapDisk.h haiku/trunk/headers/private/kernel/boot/vfs.h haiku/trunk/src/system/boot/loader/FileMapDisk.cpp haiku/trunk/src/system/boot/loader/file_systems/fat/File.cpp haiku/trunk/src/system/boot/loader/file_systems/fat/File.h haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.cpp haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.h haiku/trunk/src/system/boot/loader/partitions.cpp haiku/trunk/src/system/boot/loader/vfs.cpp Log: Work in progress to pass the image extents to the kernel, - code is disabled yet as the bootloader doesn't have add_boot_item.. will need to pass via kernel args - add a GetFileMap() method to the vfs, and implement it in FAT code. Modified: haiku/trunk/headers/private/kernel/boot/FileMapDisk.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/FileMapDisk.h 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/headers/private/kernel/boot/FileMapDisk.h 2008-11-01 20:39:14 UTC (rev 28445) @@ -22,6 +22,14 @@ off_t len; }; +struct file_map_boot_item { + int32 block_size; + int32 num_runs; + struct file_map_run runs[FMAP_MAX_RUNS]; +}; + +#ifdef _BOOT_MODE + class FileMap { public: FileMap(); @@ -49,12 +57,13 @@ size_t bufferSize); virtual status_t GetName(char *nameBuffer, size_t bufferSize) const; + virtual status_t GetFileMap(struct file_map_run *runs, int32 *count); virtual off_t Size() const; - status_t GetFileMap(FileMap **map); - static FileMapDisk *FindAnyFileMapDisk(Directory *volume); + status_t RegisterFileMapBootItem(); + private: Node *fNode; /* @@ -65,4 +74,6 @@ }; +#endif // _BOOT_MODE + #endif // _BOOT_FILE_MAP_DISK_H Modified: haiku/trunk/headers/private/kernel/boot/vfs.h =================================================================== --- haiku/trunk/headers/private/kernel/boot/vfs.h 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/headers/private/kernel/boot/vfs.h 2008-11-01 20:39:14 UTC (rev 28445) @@ -14,6 +14,8 @@ #ifdef __cplusplus +struct file_map_run; + /** This is the base class for all VFS nodes */ class Node : public DoublyLinkedListLinkImpl { @@ -28,6 +30,7 @@ virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) = 0; virtual status_t GetName(char *nameBuffer, size_t bufferSize) const; + virtual status_t GetFileMap(struct file_map_run *runs, int32 *count); virtual int32 Type() const; virtual off_t Size() const; virtual ino_t Inode() const; Modified: haiku/trunk/src/system/boot/loader/FileMapDisk.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/FileMapDisk.cpp 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/src/system/boot/loader/FileMapDisk.cpp 2008-11-01 20:39:14 UTC (rev 28445) @@ -4,6 +4,7 @@ */ #include +#include #include @@ -117,7 +118,14 @@ return B_OK; } -// Size + +status_t +FileMapDisk::GetFileMap(struct file_map_run *runs, int32 *count) +{ + return fNode->GetFileMap(runs, count); +} + + off_t FileMapDisk::Size() const { @@ -127,14 +135,6 @@ } -status_t -FileMapDisk::GetFileMap(FileMap **map) -{ - return ENOSYS; -} - - -// FindAnyFileMapDisk FileMapDisk * FileMapDisk::FindAnyFileMapDisk(Directory *volume) { @@ -168,3 +168,22 @@ return disk; } + + +status_t +FileMapDisk::RegisterFileMapBootItem() +{ + return B_ERROR; + struct file_map_boot_item *item; + item = (struct file_map_boot_item *)malloc(sizeof(struct file_map_boot_item)); + item->num_runs = FMAP_MAX_RUNS; + status_t err; + err = GetFileMap(item->runs, &item->num_runs); + if (err < B_OK) + return err; +// err = add_boot_item("file_map_disk", item, sizeof(struct file_map_boot_item)); + err = B_ERROR; + return err; +} + + Modified: haiku/trunk/src/system/boot/loader/file_systems/fat/File.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/file_systems/fat/File.cpp 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/src/system/boot/loader/file_systems/fat/File.cpp 2008-11-01 20:39:14 UTC (rev 28445) @@ -34,7 +34,7 @@ } -status_t +status_t File::InitCheck() { if (!fStream.InitCheck() < B_OK) @@ -44,7 +44,7 @@ } -status_t +status_t File::Open(void **_cookie, int mode) { TRACE(("FATFS::File::%s(, %d)\n", __FUNCTION__, mode)); @@ -55,14 +55,14 @@ } -status_t +status_t File::Close(void *cookie) { return B_OK; } -ssize_t +ssize_t File::ReadAt(void *cookie, off_t pos, void *buffer, size_t bufferSize) { TRACE(("FATFS::File::%s(, %Ld,, %d)\n", __FUNCTION__, pos, bufferSize)); @@ -74,20 +74,27 @@ } -ssize_t +ssize_t File::WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize) { return EROFS; } -status_t +status_t File::GetName(char *nameBuffer, size_t bufferSize) const { return fStream.GetName(nameBuffer, bufferSize); } +status_t +File::GetFileMap(struct file_map_run *runs, int32 *count) +{ + return fStream.GetFileMap(runs, count); +} + + int32 File::Type() const { Modified: haiku/trunk/src/system/boot/loader/file_systems/fat/File.h =================================================================== --- haiku/trunk/src/system/boot/loader/file_systems/fat/File.h 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/src/system/boot/loader/file_systems/fat/File.h 2008-11-01 20:39:14 UTC (rev 28445) @@ -28,6 +28,7 @@ virtual ssize_t WriteAt(void *cookie, off_t pos, const void *buffer, size_t bufferSize); virtual status_t GetName(char *nameBuffer, size_t bufferSize) const; + virtual status_t GetFileMap(struct file_map_run *runs, int32 *count); virtual int32 Type() const; virtual off_t Size() const; virtual ino_t Inode() const; Modified: haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.cpp 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.cpp 2008-11-01 20:39:14 UTC (rev 28445) @@ -13,6 +13,7 @@ #include "File.h" #include +#include #include #include @@ -70,6 +71,39 @@ status_t +Stream::GetFileMap(struct file_map_run *runs, int32 *count) +{ + int32 i; + uint32 cluster = fFirstCluster; + uint32 next = fVolume.InvalidClusterID(); + off_t offset = 0LL; + + for (i = 0; i < *count; i++) { + runs[i].offset = offset; + runs[i].block = fVolume.ToBlock(cluster); + runs[i].len = fVolume.ClusterSize(); + do { + next = fVolume.NextCluster(cluster); + if (next != cluster + 1) + break; + runs[i].len += fVolume.ClusterSize(); + } while (true); + if (!fVolume.IsValidCluster(next)) + break; + cluster = next; + offset += runs[i].len; + } + + // too big + if (i == *count && fVolume.IsValidCluster(next)) + return B_ERROR; + + *count = i; + return B_OK; +} + + +status_t Stream::FindBlock(off_t pos, off_t &block, off_t &offset) { //TRACE(("FATFS::Stream::%s(%Ld,,)\n", __FUNCTION__, pos)); Modified: haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.h =================================================================== --- haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.h 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/src/system/boot/loader/file_systems/fat/Stream.h 2008-11-01 20:39:14 UTC (rev 28445) @@ -17,6 +17,7 @@ class Node; +struct file_map_run; namespace FATFS { @@ -29,6 +30,7 @@ Volume &GetVolume() const { return fVolume; } status_t GetName(char *nameBuffer, size_t bufferSize) const; + status_t GetFileMap(struct file_map_run *runs, int32 *count); off_t Size() const { return fSize; } uint32 FirstCluster() const { return fFirstCluster; } Modified: haiku/trunk/src/system/boot/loader/partitions.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/partitions.cpp 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/src/system/boot/loader/partitions.cpp 2008-11-01 20:39:14 UTC (rev 28445) @@ -243,6 +243,7 @@ FileMapDisk *disk = FileMapDisk::FindAnyFileMapDisk(fileSystem); if (disk) { TRACE(("%p Partition::_Mount: found FileMapDisk\n", this)); + disk->RegisterFileMapBootItem(); add_partitions_for(disk, true, false); } } Modified: haiku/trunk/src/system/boot/loader/vfs.cpp =================================================================== --- haiku/trunk/src/system/boot/loader/vfs.cpp 2008-11-01 20:33:39 UTC (rev 28444) +++ haiku/trunk/src/system/boot/loader/vfs.cpp 2008-11-01 20:39:14 UTC (rev 28445) @@ -99,6 +99,13 @@ } +status_t +Node::GetFileMap(struct file_map_run *runs, int32 *count) +{ + return B_ERROR; +} + + int32 Node::Type() const { @@ -128,6 +135,7 @@ return B_OK; } + status_t Node::Release() { From bonefish at mail.berlios.de Sat Nov 1 22:06:44 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 1 Nov 2008 22:06:44 +0100 Subject: [Haiku-commits] r28446 - haiku/trunk/src/bin/debug/profile Message-ID: <200811012106.mA1L6iDf020634@sheep.berlios.de> Author: bonefish Date: 2008-11-01 22:06:44 +0100 (Sat, 01 Nov 2008) New Revision: 28446 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28446&view=rev Modified: haiku/trunk/src/bin/debug/profile/CallgrindThreadProfileResult.cpp Log: Callgrind output: Encode the thread name and the total time the thread used into the file name. This makes it easier to find the thread(s) one is looking for. Modified: haiku/trunk/src/bin/debug/profile/CallgrindThreadProfileResult.cpp =================================================================== --- haiku/trunk/src/bin/debug/profile/CallgrindThreadProfileResult.cpp 2008-11-01 20:39:14 UTC (rev 28445) +++ haiku/trunk/src/bin/debug/profile/CallgrindThreadProfileResult.cpp 2008-11-01 21:06:44 UTC (rev 28446) @@ -167,12 +167,24 @@ CallgrindThreadProfileResult::PrintResults() { // create output file + + // create output dir mkdir(gOptions.callgrind_directory, S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH); + // get the thread name and replace slashes by hyphens + char threadName[B_OS_NAME_LENGTH]; + strlcpy(threadName, fThread->Name(), sizeof(threadName)); + char* slash = threadName; + while ((slash = strchr(slash, '/')) != NULL) + *slash = '-'; + + // create the file name char fileName[B_PATH_NAME_LENGTH]; - snprintf(fileName, sizeof(fileName), "%s/callgrind.out.%ld", - gOptions.callgrind_directory, fThread->ID()); + snprintf(fileName, sizeof(fileName), "%s/callgrind.out.%ld.%s.%lldms", + gOptions.callgrind_directory, fThread->ID(), threadName, + fTotalTicks * fInterval); + // create the file FILE* out = fopen(fileName, "w+"); if (out == NULL) { fprintf(stderr, "%s: Failed to open output file \"%s\": %s\n", From mmu_man at mail.berlios.de Sat Nov 1 23:17:19 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 1 Nov 2008 23:17:19 +0100 Subject: [Haiku-commits] r28447 - haiku/trunk/src/apps/stylededit Message-ID: <200811012217.mA1MHJnA027194@sheep.berlios.de> Author: mmu_man Date: 2008-11-01 23:17:19 +0100 (Sat, 01 Nov 2008) New Revision: 28447 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28447&view=rev Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp Log: No need for NULL there. Modified: haiku/trunk/src/apps/stylededit/StyledEditApp.cpp =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2008-11-01 21:06:44 UTC (rev 28446) +++ haiku/trunk/src/apps/stylededit/StyledEditApp.cpp 2008-11-01 22:17:19 UTC (rev 28447) @@ -38,7 +38,7 @@ void cascade() { - BScreen screen(NULL); + BScreen screen; BRect screenBorder = screen.Frame(); float left = gWindowRect.left + 15; if (left + gWindowRect.Width() > screenBorder.right) @@ -55,7 +55,7 @@ void uncascade() { - BScreen screen(NULL); + BScreen screen; BRect screenBorder = screen.Frame(); float left = gWindowRect.left - 15; From dlmcpaul at mail.berlios.de Sat Nov 1 23:57:26 2008 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sat, 1 Nov 2008 23:57:26 +0100 Subject: [Haiku-commits] r28448 - haiku/trunk/src/kits/media Message-ID: <200811012257.mA1MvQDh003000@sheep.berlios.de> Author: dlmcpaul Date: 2008-11-01 23:57:25 +0100 (Sat, 01 Nov 2008) New Revision: 28448 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28448&view=rev Modified: haiku/trunk/src/kits/media/MediaExtractor.cpp Log: put TODO in front of my todo comment Modified: haiku/trunk/src/kits/media/MediaExtractor.cpp =================================================================== --- haiku/trunk/src/kits/media/MediaExtractor.cpp 2008-11-01 22:17:19 UTC (rev 28447) +++ haiku/trunk/src/kits/media/MediaExtractor.cpp 2008-11-01 22:57:25 UTC (rev 28448) @@ -280,7 +280,7 @@ return res; } - // Here we should work out a way so that if there is a setup failure we can try the next decoder + // TODO Here we should work out a way so that if there is a setup failure we can try the next decoder res = _plugin_manager.CreateDecoder(&decoder, fStreamInfo[stream].encodedFormat); if (res != B_OK) { From dlmcpaul at mail.berlios.de Sat Nov 1 23:58:43 2008 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sat, 1 Nov 2008 23:58:43 +0100 Subject: [Haiku-commits] r28449 - haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec Message-ID: <200811012258.mA1Mwh1S003250@sheep.berlios.de> Author: dlmcpaul Date: 2008-11-01 23:58:43 +0100 (Sat, 01 Nov 2008) New Revision: 28449 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28449&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/mpegaudiodec.c Log: improve error logging message Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/mpegaudiodec.c =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/mpegaudiodec.c 2008-11-01 22:57:25 UTC (rev 28448) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/mpegaudiodec.c 2008-11-01 22:58:43 UTC (rev 28449) @@ -2425,7 +2425,7 @@ av_log(avctx, AV_LOG_ERROR, "incomplete frame\n"); return -1; }else if(s->frame_size < buf_size){ - av_log(avctx, AV_LOG_ERROR, "incorrect frame size\n"); + av_log(avctx, AV_LOG_ERROR, "incorrect frame size expected %d found %d\n",s->frame_size,buf_size); buf_size= s->frame_size; } From dlmcpaul at mail.berlios.de Sat Nov 1 23:59:53 2008 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sat, 1 Nov 2008 23:59:53 +0100 Subject: [Haiku-commits] r28450 - haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec Message-ID: <200811012259.mA1Mxr4A003414@sheep.berlios.de> Author: dlmcpaul Date: 2008-11-01 23:59:52 +0100 (Sat, 01 Nov 2008) New Revision: 28450 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28450&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/adpcm.c Log: Log an error before returning error result Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/adpcm.c =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/adpcm.c 2008-11-01 22:58:43 UTC (rev 28449) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/adpcm.c 2008-11-01 22:59:52 UTC (rev 28450) @@ -915,8 +915,10 @@ //should protect all 4bit ADPCM variants //8 is needed for CODEC_ID_ADPCM_IMA_WAV with 2 channels // - if(*data_size/4 < buf_size + 8) + if(*data_size/4 < buf_size + 8) { + av_log(avctx, AV_LOG_ERROR, "ERROR: Data size too small\n"); return -1; + } samples = data; samples_end= samples + *data_size/2; From dlmcpaul at mail.berlios.de Sun Nov 2 00:03:15 2008 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sun, 2 Nov 2008 00:03:15 +0100 Subject: [Haiku-commits] r28451 - in haiku/trunk/src/add-ons/media/plugins/avcodec: . libavcodec Message-ID: <200811012303.mA1N3Fse003802@sheep.berlios.de> Author: dlmcpaul Date: 2008-11-02 00:03:15 +0100 (Sun, 02 Nov 2008) New Revision: 28451 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28451&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/Jamfile haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h Log: Turn on more decoders Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp 2008-11-01 22:59:52 UTC (rev 28450) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/avcodec.cpp 2008-11-01 23:03:15 UTC (rev 28451) @@ -117,16 +117,14 @@ if (isAudio && !fOutputBuffer) fOutputBuffer = new char[100000]; -#if DEBUG +//#if DEBUG char buffer[1024]; - string_for_format(*ioEncodedFormat, buffer, sizeof(buffer); + string_for_format(*ioEncodedFormat, buffer, sizeof(buffer)); TRACE("[%c] input_format=%s\n", isAudio?('a'):('v'), buffer); TRACE("[%c] infoSize=%ld\n", isAudio?('a'):('v'), infoSize); - TRACE("[%c] user_data_type=%08lx\n", isAudio?('a'):('v'), - ioEncodedFormat->user_data_type); -// TRACE("[%c] meta_data_size=%ld\n", isAudio?('a'):('v'), -// ioEncodedFormat->meta_data_size); -#endif + TRACE("[%c] user_data_type=%08lx\n", isAudio?('a'):('v'), ioEncodedFormat->user_data_type); +// TRACE("[%c] meta_data_size=%ld\n", isAudio?('a'):('v'), ioEncodedFormat->meta_data_size); +//#endif media_format_description descr; for (int32 i = 0; gCodecTable[i].id; i++) { @@ -157,10 +155,10 @@ | descr.u.misc.codec; break; default: - puts("ERR family"); + puts("ERR family"); return B_ERROR; } - TRACE(" codec id = \"%c%c%c%c\"\n", (char)((cid >> 24) & 0xff), + TRACE(" 0x%04lx codec id = \"%c%c%c%c\"\n", uint32(cid), (char)((cid >> 24) & 0xff), (char)((cid >> 16) & 0xff), (char)((cid >> 8) & 0xff), (char)(cid & 0xff)); @@ -393,7 +391,7 @@ set_thread_priority(find_thread(NULL), B_NORMAL_PRIORITY); #endif - TRACE("[%c] avCodec::Decode()\n", isAudio?('a'):('v')); +// TRACE("[%c] avCodec::Decode()\n", isAudio?('a'):('v')); if (isAudio) { @@ -432,7 +430,7 @@ status_t err; err = GetNextChunk(&fChunkBuffer, &fChunkBufferSize, &chunk_mh); if (err != B_OK || fChunkBufferSize < 0) { - TRACE("GetNextChunk error\n"); + TRACE("GetNextChunk error %ld\n",fChunkBufferSize); fChunkBufferSize = 0; break; } @@ -456,8 +454,7 @@ fChunkBufferOffset = 0; fChunkBufferSize = 0; // } else { -// TRACE("audio decode: len %d, out_size %d\n", len, -// out_size); +// TRACE("audio decode: len %d, out_size %d\n", len, out_size); } fChunkBufferOffset += len; fChunkBufferSize -= len; @@ -475,8 +472,7 @@ err = GetNextChunk(&data, &size, &chunk_mh); if (err != B_OK) { - TRACE("avCodec::Decode(): error 0x%08lx from GetNextChunk()\n", - err); + TRACE("avCodec::Decode(): error 0x%08lx from GetNextChunk()\n", err); return err; } @@ -527,8 +523,8 @@ #ifdef DO_PROFILING prof_t2 = system_time(); #endif - TRACE("ONE FRAME OUT !! len=%d size=%ld (%s)\n", len, size, - pixfmt_to_string(ffc->pix_fmt)); +// TRACE("ONE FRAME OUT !! len=%d size=%ld (%s)\n", len, size, +// pixfmt_to_string(ffc->pix_fmt)); /* opicture.data[0] = (uint8_t *)out_buffer; opicture.linesize[0] = fOutputVideoFormat.display.bytes_per_row; Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp 2008-11-01 22:59:52 UTC (rev 28450) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/codectbl.cpp 2008-11-01 23:03:15 UTC (rev 28451) @@ -49,6 +49,7 @@ {CODEC_ID_MP2, B_MEDIA_ENCODED_AUDIO, B_QUICKTIME_FORMAT_FAMILY, 0x6D730050, "MP Layer2"}, {CODEC_ID_MP2, B_MEDIA_ENCODED_AUDIO, B_QUICKTIME_FORMAT_FAMILY, 0x6D730055, "MP Layer3"}, {CODEC_ID_ADPCM_IMA_QT, B_MEDIA_ENCODED_AUDIO, B_QUICKTIME_FORMAT_FAMILY, 'ima4', "Quicktime IMA4"}, + {CODEC_ID_ADPCM_IMA_QT, B_MEDIA_ENCODED_AUDIO, B_QUICKTIME_FORMAT_FAMILY, 'IMA4', "Quicktime IMA4"}, {CODEC_ID_MPEG4AAC, B_MEDIA_ENCODED_AUDIO, B_QUICKTIME_FORMAT_FAMILY, 'mp4a', "MPEG4 AAC"}, {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'mp4v', "MPEG4 Video"}, {CODEC_ID_MPEG4AAC, B_MEDIA_ENCODED_AUDIO, B_QUICKTIME_FORMAT_FAMILY, 'a4pm', "MPEG4 AAC"}, @@ -62,8 +63,8 @@ #endif #if 0 - {CODEC_ID_MP2, B_MEDIA_ENCODED_AUDIO, B_WAV_FORMAT_FAMILY, 0x50, "MPEG Audio Layer 2"}, /* mpeg audio layer 2 */ - {CODEC_ID_MP2, B_MEDIA_ENCODED_AUDIO, B_WAV_FORMAT_FAMILY, 0x55, "MPEG Audio Layer 3"}, /* mpeg audio layer 3 */ + {CODEC_ID_MP2, B_MEDIA_ENCODED_AUDIO, B_WAV_FORMAT_FAMILY, 0x0050, "MPEG Audio Layer 2"}, /* mpeg audio layer 2 */ + {CODEC_ID_MP2, B_MEDIA_ENCODED_AUDIO, B_WAV_FORMAT_FAMILY, 0x0055, "MPEG Audio Layer 3"}, /* mpeg audio layer 3 */ #endif {CODEC_ID_WMAV1, B_MEDIA_ENCODED_AUDIO, B_WAV_FORMAT_FAMILY, 0x160, "MS WMA v1"}, @@ -95,6 +96,7 @@ {CODEC_ID_H264, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, 'h264', "H264"}, {CODEC_ID_H264, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, 'H264', "H264"}, + {CODEC_ID_H264, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'avc1', "AVC"}, /* MPEG-4 AVC */ #ifdef HAS_PHOTO_JPEG {CODEC_ID_MJPEG, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'JPEG', "Photo-JPEG"}, @@ -116,7 +118,7 @@ {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, '4PMF', "ffmpeg MPEG4"}, {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'DIVX', "MPEG4"}, /* OpenDivX */ /* XXX: doesn't seem to work */ {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'divx', "MPEG4"}, /* OpenDivX */ - {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'mp4v', "MPEG4"}, /* OpenDivX */ + {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'mp4v', "MPEG4"}, /* MPEG-4 ASP */ {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_QUICKTIME_FORMAT_FAMILY, 'XVID', "XviD (MPEG4)"}, /* OpenDivX ??? XXX: test */ {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, 'FMP4', "ffmpeg MPEG4"}, {CODEC_ID_MPEG4, B_MEDIA_ENCODED_VIDEO, B_AVI_FORMAT_FAMILY, '4PMF', "ffmpeg MPEG4"}, Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp 2008-11-01 22:59:52 UTC (rev 28450) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/gfx_util.cpp 2008-11-01 23:03:15 UTC (rev 28451) @@ -55,7 +55,7 @@ } } - if (pixelFormat == PIX_FMT_YUV420P) { + if (pixelFormat == PIX_FMT_YUV420P || pixelFormat == PIX_FMT_YUVJ420P) { #if INCLUDE_MMX if (mmx) { TRACE("resolve_colorspace: gfx_conv_yuv420p_rgb32_mmx\n"); @@ -107,7 +107,7 @@ } } - if (pixelFormat == PIX_FMT_YUV420P) { + if (pixelFormat == PIX_FMT_YUV420P || pixelFormat == PIX_FMT_YUVJ420P) { #if INCLUDE_MMX if (mmx) { TRACE("resolve_colorspace: gfx_conv_yuv420p_ycbcr422_mmx\n"); @@ -147,6 +147,10 @@ switch(p) { case PIX_FMT_YUV420P: return "PIX_FMT_YUV420P"; + case PIX_FMT_YUVJ420P: + return "PIX_FMT_YUVJ420P - YUV420P (Jpeg)"; + case PIX_FMT_YUVA420P: + return "PIX_FMT_YUVA420P - YUV420P (Alpha)"; case PIX_FMT_YUV422: return "PIX_FMT_YUV422"; case PIX_FMT_RGB24: Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/Jamfile =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/Jamfile 2008-11-01 22:59:52 UTC (rev 28450) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/Jamfile 2008-11-01 23:03:15 UTC (rev 28451) @@ -20,11 +20,11 @@ aac_parser.c aactab.c aasc.c -# ac3.c -# ac3_parser.c -# ac3dec.c -# ac3dec_data.c -# ac3tab.c + ac3.c + ac3_parser.c + ac3dec.c + ac3dec_data.c + ac3tab.c acelp_filters.c acelp_math.c acelp_pitch_delay.c @@ -33,7 +33,7 @@ adxdec.c alac.c allcodecs.c -# apedec.c + apedec.c asv1.c atrac3.c audioconvert.c @@ -140,9 +140,9 @@ mjpega_dump_header_bsf.c mjpegbdec.c mjpegdec.c -# mlp.c -# mlp_parser.c -# mlpdec.c + mlp.c + mlp_parser.c + mlpdec.c # mmvideo.c motion_est.c motionpixels.c @@ -166,9 +166,9 @@ msmpeg4.c msmpeg4data.c msrle.c -# msvideo1.c -# nellymoser.c -# nellymoserdec.c + msvideo1.c + nellymoser.c + nellymoserdec.c noise_bsf.c nuv.c opt.c @@ -177,8 +177,8 @@ pcx.c png.c # pngdec.c -# pnm.c -# pnm_parser.c + pnm.c + pnm_parser.c # pnmenc.c pthread.c ptx.c @@ -197,67 +197,67 @@ resample2.c rl2.c rle.c -# roqaudioenc.c -# roqvideo.c -# roqvideodec.c + roqaudioenc.c + roqvideo.c + roqvideodec.c # roqvideoenc.c rpza.c rtjpeg.c -# rv10.c + rv10.c # rv30.c # rv30dsp.c # rv34.c -# rv40.c + rv40.c s3tc.c sgidec.c shorten.c simple_idct.c -# smacker.c + smacker.c smc.c # snow.c sonic.c -# sp5xdec.c + sp5xdec.c # sunrast.c -# svq1.c -# svq1dec.c -# svq3.c + svq1.c + svq1dec.c +# svq3.c - Included by h264 # targa.c # tiertexseqv.c # tiff.c # tiffenc.c -# truemotion1.c -# truemotion2.c -# truespeech.c + truemotion1.c + truemotion2.c + truespeech.c # tscc.c # tta.c # txd.c ulti.c utils.c vb.c -# vc1.c -# vc1_parser.c -# vc1data.c -# vc1dsp.c -# vcr1.c -# vmdav.c + vc1.c + vc1_parser.c + vc1data.c + vc1dsp.c + vcr1.c + vmdav.c # vmnc.c vorbis.c vorbis_data.c vorbis_dec.c -# vp3.c -# vp3_parser.c -# vp3dsp.c -# vp5.c -# vp56.c -# vp56data.c -# vp6.c + vp3.c + vp3_parser.c + vp3dsp.c + vp5.c + vp56.c + vp56data.c + vp6.c # vqavideo.c wavpack.c -# wma.c -# wmadec.c + wma.c + wmadec.c wmv2.c -# wmv2dec.c -# wnv1.c + wmv2dec.c + wnv1.c # ws-snd1.c # xan.c xiph.c Modified: haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h 2008-11-01 22:59:52 UTC (rev 28450) +++ haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/config.h 2008-11-01 23:03:15 UTC (rev 28451) @@ -10,6 +10,14 @@ #define CONFIG_MPEGAUDIO_HP 1 #define CONFIG_HAVE_DLOPEN 1 #define CONFIG_AUDIO_BEOS 1 +#define CONFIG_MP2_DECODER 1 +#define CONFIG_MP3_DECODER 1 +#define CONFIG_MP3ON4_DECODER 1 +#define CONFIG_MP3ADU_DECODER 1 +#define CONFIG_VC1_DECODER 1 +#define CONFIG_WMV2_DECODER 1 +#define CONFIG_WMV3_DECODER 1 +#define CONFIG_AC3_DECODER 1 /* #define CONFIG_NETWORK 1 */ /* #define CONFIG_ZLIB 1 */ #define HAVE_MALLOC_H 1 @@ -153,8 +161,8 @@ #define ENABLE_SP5X_DECODER 0 #define ENABLE_SUNRAST_DECODER 0 #define ENABLE_SVQ1_ENCODER 0 -#define ENABLE_SVQ1_DECODER 0 -#define ENABLE_SVQ3_DECODER 0 +#define ENABLE_SVQ1_DECODER 1 +#define ENABLE_SVQ3_DECODER 1 #define ENABLE_TARGA_ENCODER 0 #define ENABLE_TARGA_DECODER 0 #define ENABLE_THEORA_DECODER 0 @@ -179,11 +187,11 @@ #define ENABLE_VP6F_DECODER 0 #define ENABLE_VQA_DECODER 0 #define ENABLE_WMV1_ENCODER 0 -#define ENABLE_WMV1_DECODER 0 +#define ENABLE_WMV1_DECODER 1 #define ENABLE_WMV2_ENCODER 0 -#define ENABLE_WMV2_DECODER 0 -#define ENABLE_WMV3_DECODER 0 -#define ENABLE_WNV1_DECODER 0 +#define ENABLE_WMV2_DECODER 1 +#define ENABLE_WMV3_DECODER 1 +#define ENABLE_WNV1_DECODER 1 #define ENABLE_XAN_WC3_DECODER 0 #define ENABLE_XL_DECODER 0 #define ENABLE_XSUB_DECODER 0 @@ -193,7 +201,7 @@ #define ENABLE_ZMBV_DECODER 0 #define ENABLE_AAC_DECODER 1 #define ENABLE_AC3_ENCODER 0 -#define ENABLE_AC3_DECODER 0 +#define ENABLE_AC3_DECODER 1 #define ENABLE_ALAC_ENCODER 0 #define ENABLE_ALAC_DECODER 1 #define ENABLE_APE_DECODER 0 @@ -208,10 +216,10 @@ #define ENABLE_MACE6_DECODER 1 #define ENABLE_MLP_DECODER 0 #define ENABLE_MP2_ENCODER 0 -#define ENABLE_MP2_DECODER 0 -#define ENABLE_MP3_DECODER 0 -#define ENABLE_MP3ADU_DECODER 0 -#define ENABLE_MP3ON4_DECODER 0 +#define ENABLE_MP2_DECODER 1 +#define ENABLE_MP3_DECODER 1 +#define ENABLE_MP3ADU_DECODER 1 +#define ENABLE_MP3ON4_DECODER 1 #define ENABLE_MPC7_DECODER 1 #define ENABLE_MPC8_DECODER 1 #define ENABLE_NELLYMOSER_DECODER 0 @@ -353,7 +361,7 @@ #define ENABLE_DVDSUB_PARSER 0 #define ENABLE_H261_PARSER 0 #define ENABLE_H263_PARSER 0 -#define ENABLE_H264_PARSER 0 +#define ENABLE_H264_PARSER 1 #define ENABLE_MJPEG_PARSER 0 #define ENABLE_MLP_PARSER 0 #define ENABLE_MPEG4VIDEO_PARSER 0 From revol at free.fr Sun Nov 2 00:09:22 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sun, 02 Nov 2008 00:09:22 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28450_-_haiku/trunk/src/add-ons?= =?windows-1252?q?/media/plugins/avcodec/libavcodec?= In-Reply-To: <200811012259.mA1Mxr4A003414@sheep.berlios.de> Message-ID: <31181913879-BeMail@laptop> > Author: dlmcpaul > Date: 2008-11-01 23:59:52 +0100 (Sat, 01 Nov 2008) > New Revision: 28450 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28450&view=rev > > Modified: > haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/adpcm.c > Log: > Log an error before returning error result > Hmm probably not a good idea to touch the lavc source if you don't want to have to merge stuff... Fran?ois. From dlmcpaul at mail.berlios.de Sun Nov 2 00:08:08 2008 From: dlmcpaul at mail.berlios.de (dlmcpaul at BerliOS) Date: Sun, 2 Nov 2008 00:08:08 +0100 Subject: [Haiku-commits] r28452 - in haiku/trunk/src/add-ons/media/plugins/mp4_reader: . libMP4 Message-ID: <200811012308.mA1N884R004116@sheep.berlios.de> Author: dlmcpaul Date: 2008-11-02 00:08:08 +0100 (Sun, 02 Nov 2008) New Revision: 28452 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28452&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.h haiku/trunk/src/add-ons/media/plugins/mp4_reader/mp4_reader.cpp Log: Turn off TRACE and some cleanup Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.h =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.h 2008-11-01 23:03:15 UTC (rev 28451) +++ haiku/trunk/src/add-ons/media/plugins/mp4_reader/libMP4/MP4Parser.h 2008-11-01 23:08:08 UTC (rev 28452) @@ -172,7 +172,7 @@ char *OnGetAtomName(); uint64 getSUMCounts() { return SUMCounts; }; - uint64 getSUMDurations() { return SUMDurations; }; + bigtime_t getSUMDurations() { return SUMDurations; }; uint32 getSampleForTime(bigtime_t pTime); uint32 getSampleForFrame(uint32 pFrame); void setFrameRate(float pFrameRate) { FrameRate = pFrameRate; }; Modified: haiku/trunk/src/add-ons/media/plugins/mp4_reader/mp4_reader.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp4_reader/mp4_reader.cpp 2008-11-01 23:03:15 UTC (rev 28451) +++ haiku/trunk/src/add-ons/media/plugins/mp4_reader/mp4_reader.cpp 2008-11-01 23:08:08 UTC (rev 28452) @@ -38,7 +38,7 @@ #include -#define TRACE_MP4_READER +//#define TRACE_MP4_READER #ifdef TRACE_MP4_READER # define TRACE printf #else @@ -266,7 +266,7 @@ format->u.raw_audio.buffer_size = stream_header->suggested_buffer_size; } else { - printf("codecid %s codecsubtype %s\n",&audio_format->compression,&audio_format->codecSubType); + TRACE("codecid %s codecsubtype %s\n",&audio_format->compression,&audio_format->codecSubType); description.family = B_QUICKTIME_FORMAT_FAMILY; @@ -376,8 +376,8 @@ #ifdef TRACE_MP4_READER if (data) { uint8 *p = (uint8 *)data; - TRACE("extra_data: %ld: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", - size , p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9], p[10], p[11], p[12], p[13], p[14], p[15], p[16], p[17]); + TRACE("extra_data: %ld: %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n", + size, p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7], p[8], p[9]); } #endif @@ -650,7 +650,7 @@ bool keyframe; if (theFileReader->GetNextChunkInfo(cookie->stream, (cookie->frame_pos / cookie->frame_size), &start, &size, &keyframe) == false) { - TRACE("LAST BUFFER ERROR %ld\n",cookie->frame_pos); + TRACE("LAST BUFFER : %d (%ld)\n",cookie->stream, cookie->frame_pos); return B_LAST_BUFFER_ERROR; } @@ -663,11 +663,11 @@ mediaHeader->start_time = bigtime_t(double(cookie->frame_pos) * 1000000.0 * double(cookie->frames_per_sec_scale)) / cookie->frames_per_sec_rate; if (cookie->audio) { -// TRACE("Audio"); + TRACE("Audio"); mediaHeader->type = B_MEDIA_ENCODED_AUDIO; mediaHeader->u.encoded_audio.buffer_flags = keyframe ? B_MEDIA_KEY_FRAME : 0; } else { -// TRACE("Video"); + TRACE("Video"); mediaHeader->type = B_MEDIA_ENCODED_VIDEO; mediaHeader->u.encoded_video.field_flags = keyframe ? B_MEDIA_KEY_FRAME : 0; mediaHeader->u.encoded_video.first_active_line = 0; @@ -675,7 +675,7 @@ mediaHeader->u.encoded_video.field_number = 0; mediaHeader->u.encoded_video.field_sequence = cookie->frame_pos; } -// TRACE(" stream %d: frame %ld start time %.6f file pos %lld Size %ld key frame %s\n",cookie->stream, (cookie->frame_pos / cookie->frame_size), mediaHeader->start_time / 1000000.0, start, size, keyframe ? "true" : "false"); + TRACE(" stream %d: frame %ld start time %.6f file pos %lld Size %ld key frame %s\n",cookie->stream, (cookie->frame_pos / cookie->frame_size), mediaHeader->start_time / 1000000.0, start, size, keyframe ? "true" : "false"); cookie->frame_pos += cookie->frame_size; From dlmcpaul at gmail.com Sun Nov 2 00:10:59 2008 From: dlmcpaul at gmail.com (David McPaul) Date: Sun, 2 Nov 2008 10:10:59 +1100 Subject: [Haiku-commits] r28450 - haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec In-Reply-To: <31181913879-BeMail@laptop> References: <200811012259.mA1Mxr4A003414@sheep.berlios.de> <31181913879-BeMail@laptop> Message-ID: 2008/11/2 Fran?ois Revol : >> Author: dlmcpaul >> Date: 2008-11-01 23:59:52 +0100 (Sat, 01 Nov 2008) >> New Revision: 28450 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28450&view=rev >> >> Modified: >> haiku/trunk/src/add-ons/media/plugins/avcodec/libavcodec/adpcm.c >> Log: >> Log an error before returning error result >> > > Hmm probably not a good idea to touch the lavc source if you don't want > to have to merge stuff... Yeah, I know. But damn it is annoying to get an error with no reason shown. -- Cheers David From bonefish at mail.berlios.de Sun Nov 2 03:58:39 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 2 Nov 2008 03:58:39 +0100 Subject: [Haiku-commits] r28453 - haiku/trunk/src/system/libroot/os/arch/x86 Message-ID: <200811020258.mA22wd2k018541@sheep.berlios.de> Author: bonefish Date: 2008-11-02 03:58:38 +0100 (Sun, 02 Nov 2008) New Revision: 28453 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28453&view=rev Modified: haiku/trunk/src/system/libroot/os/arch/x86/system_time_asm.S Log: Moved the variable cv_factor from the text to the bss section. Modified: haiku/trunk/src/system/libroot/os/arch/x86/system_time_asm.S =================================================================== --- haiku/trunk/src/system/libroot/os/arch/x86/system_time_asm.S 2008-11-01 23:08:08 UTC (rev 28452) +++ haiku/trunk/src/system/libroot/os/arch/x86/system_time_asm.S 2008-11-02 02:58:38 UTC (rev 28453) @@ -6,12 +6,12 @@ #include +/* saves the conversion factor needed for system_time */ +.lcomm cv_factor 4 + + .text -/* saves the conversion factor needed for system_time */ -cv_factor: - .word 0 - FUNCTION(__x86_setup_system_time): movl 4(%esp),%eax movl %eax,cv_factor From bonefish at mail.berlios.de Sun Nov 2 03:59:16 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 2 Nov 2008 03:59:16 +0100 Subject: [Haiku-commits] r28454 - haiku/trunk/src/system/runtime_loader Message-ID: <200811020259.mA22xG3A018579@sheep.berlios.de> Author: bonefish Date: 2008-11-02 03:59:15 +0100 (Sun, 02 Nov 2008) New Revision: 28454 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28454&view=rev Modified: haiku/trunk/src/system/runtime_loader/heap.cpp Log: Implemented realloc(). Modified: haiku/trunk/src/system/runtime_loader/heap.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/heap.cpp 2008-11-02 02:58:38 UTC (rev 28453) +++ haiku/trunk/src/system/runtime_loader/heap.cpp 2008-11-02 02:59:15 UTC (rev 28454) @@ -24,7 +24,7 @@ * linked list). * When memory is allocated, the smallest free chunk that contains * the requested size is split (or taken as a whole if it can't be - * splitted anymore), and it's lower half will be removed from the + * splitted anymore), and it's lower half will be removed from the * free list. * The free list is ordered by size, starting with the smallest * free chunk available. When a chunk is freed, it will be joint @@ -120,7 +120,7 @@ } -void +void free_chunk::Remove(free_chunk *previous) { if (previous == NULL) { @@ -143,7 +143,7 @@ } -void +void free_chunk::Enqueue() { free_chunk *chunk = sFreeAnchor.next, *last = &sFreeAnchor; @@ -237,10 +237,31 @@ void * -realloc(void *buffer, size_t newSize) +realloc(void *allocation, size_t newSize) { - // not implemented - return NULL; + // free, if new size is 0 + if (newSize == 0) { + free(allocation); + return NULL; + } + + // just malloc(), if no previous allocation + if (allocation == NULL) + return malloc(newSize); + + // we're lazy and don't shrink allocations + free_chunk* chunk = free_chunk::SetToAllocated(allocation); + if (chunk->Size() >= newSize) + return allocation; + + // the allocation needs to grow -- allocate a new one and memcpy() + void* newAllocation = malloc(newSize); + if (newAllocation != NULL) { + memcpy(newAllocation, allocation, chunk->Size()); + free(allocation); + } + + return newAllocation; } @@ -322,7 +343,7 @@ // remove the joined chunk from the list last->next = freedChunk->next; chunk = last; - + if (++joinCount == 2) break; } @@ -331,7 +352,7 @@ chunk = chunk->next; } - // enqueue the link at the right position; the + // enqueue the link at the right position; the // free link queue is ordered by size freedChunk->Enqueue(); From bonefish at mail.berlios.de Sun Nov 2 04:16:31 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 2 Nov 2008 04:16:31 +0100 Subject: [Haiku-commits] r28455 - in haiku/trunk: headers/private/runtime_loader src/system/runtime_loader Message-ID: <200811020316.mA23GV5o025671@sheep.berlios.de> Author: bonefish Date: 2008-11-02 04:16:30 +0100 (Sun, 02 Nov 2008) New Revision: 28455 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28455&view=rev Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h haiku/trunk/src/system/runtime_loader/elf.cpp Log: * Changed the way symbols are resolved. For each root image (program, add-on) we create a breadth-first sorted image list and use that to search for symbols. * Added support for preloading libraries. The environment variable LD_PRELOAD can contain a whitespace-separated list of shared objects that will be loaded before the program. This allows to replace symbols without changing the executable or libraries. * Resolved TODO in load_program() regarding the order of remapping the images and initializing the dependencies (problem fixed in r28453). Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h =================================================================== --- haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-02 02:59:15 UTC (rev 28454) +++ haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-02 03:16:30 UTC (rev 28455) @@ -65,6 +65,11 @@ uint32 num_needed; struct image_t **needed; + // For "root" images (the program, add-ons): Symbols are searched in the + // images in array order. + uint32 symbol_resolution_image_count; + struct image_t **symbol_resolution_images; + // describes the text and data regions uint32 num_regions; elf_region_t regions[1]; Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-02 02:59:15 UTC (rev 28454) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-02 03:16:30 UTC (rev 28455) @@ -11,13 +11,13 @@ #include "runtime_loader_private.h" -#include - -#include +#include #include #include #include +#include + #include #include #include @@ -83,6 +83,8 @@ static bool sProgramLoaded = false; static const char *sSearchPathSubDir = NULL; static bool sInvalidImageIDs; +static image_t **sPreloadedImages = NULL; +static uint32 sPreloadedImageCount = 0; // a recursive lock static sem_id sSem; @@ -1002,29 +1004,19 @@ static struct Elf32_Sym* -find_symbol_recursively_impl(image_t* image, const char* name, +find_symbol_in_root_image_list(image_t* rootImage, const char* name, image_t** foundInImage) { - image->flags |= RFLAG_VISITED; - - struct Elf32_Sym *symbol; - - // look up the symbol in this image - if (image->dynamic_ptr) { - symbol = find_symbol(image, name, B_SYMBOL_TYPE_ANY); - if (symbol) { - *foundInImage = image; - return symbol; - } - } - - // recursively search dependencies - for (uint32 i = 0; i < image->num_needed; i++) { - if (!(image->needed[i]->flags & RFLAG_VISITED)) { - symbol = find_symbol_recursively_impl(image->needed[i], name, - foundInImage); - if (symbol) + int32 count = rootImage->symbol_resolution_image_count; + image_t** images = rootImage->symbol_resolution_images; + for (int32 i = 0; i < count; i++) { + image_t* image = images[i]; + if (image->dynamic_ptr) { + Elf32_Sym* symbol = find_symbol(image, name, B_SYMBOL_TYPE_ANY); + if (symbol) { + *foundInImage = image; return symbol; + } } } @@ -1032,60 +1024,15 @@ } -static void -clear_image_flag_recursively(image_t* image, uint32 flag) -{ - image->flags &= ~flag; - - for (uint32 i = 0; i < image->num_needed; i++) { - if (image->needed[i]->flags & flag) - clear_image_flag_recursively(image->needed[i], flag); - } -} - - static struct Elf32_Sym* -find_symbol_recursively(image_t* image, const char* name, - image_t** foundInImage) -{ - struct Elf32_Sym* symbol = find_symbol_recursively_impl(image, name, - foundInImage); - clear_image_flag_recursively(image, RFLAG_VISITED); - return symbol; -} - - -static struct Elf32_Sym* -find_symbol_in_loaded_images(const char* name, image_t** foundInImage) -{ - return find_symbol_recursively(sLoadedImages.head, name, foundInImage); -} - - -static struct Elf32_Sym* find_undefined_symbol(image_t* rootImage, image_t* image, const char* name, image_t** foundInImage) { // If not simulating BeOS style symbol resolution, undefined symbols are // searched recursively starting from the root image. - // TODO: Breadth first might be better than the depth first strategy used - // here. We're also visiting images multiple times. Consider building a - // breadth-first sorted array of images for each root image. - if ((rootImage->flags & IMAGE_FLAG_R5_SYMBOL_RESOLUTION) == 0) { - Elf32_Sym* symbol = find_symbol_recursively(rootImage, name, - foundInImage); - if (symbol != NULL) - return symbol; + if ((rootImage->flags & IMAGE_FLAG_R5_SYMBOL_RESOLUTION) == 0) + return find_symbol_in_root_image_list(rootImage, name, foundInImage); - // If the root image is not the program image (i.e. it is a dynamically - // loaded add-on or library), we try the program image hierarchy too. - image_t* programImage = get_program_image(); - if (rootImage != programImage) - return find_symbol_recursively(programImage, name, foundInImage); - - return NULL; - } - // BeOS style symbol resolution: It is sufficient to check the direct // dependencies. The linker would have complained, if the symbol wasn't // there. @@ -1561,6 +1508,36 @@ } +static uint32 +topological_sort_breadth_first(image_t* image, image_t** list, uint32 sortFlag) +{ + if ((image->flags & sortFlag) != 0) + return 0; + + // We directly use the result list as queue for the breadth first search. + list[0] = image; + image->flags |= sortFlag; + + int32 index = 0; + int32 count = 1; + + while (index < count) { + image = list[index++]; + + for (uint32 i = 0; i < image->num_needed; i++) { + image_t* neededImage = image->needed[i]; + if ((neededImage->flags & sortFlag) == 0) { + // dependency not yet visited -- add to queue + list[count++] = neededImage; + neededImage->flags |= sortFlag; + } + } + } + + return count; +} + + static ssize_t get_sorted_image_list(image_t *image, image_t ***_list, uint32 sortFlag) { @@ -1580,17 +1557,81 @@ } +static ssize_t +get_sorted_image_list_breadth_first(image_t* image, image_t*** _list, + uint32 sortFlag) +{ + image_t** list = (image_t**)malloc(sLoadedImageCount * sizeof(image_t*)); + if (list == NULL) { + FATAL("memory shortage in get_sorted_image_list()"); + *_list = NULL; + return B_NO_MEMORY; + } + + memset(list, 0, sLoadedImageCount * sizeof(image_t *)); + + *_list = list; + + return topological_sort_breadth_first(image, list, sortFlag); +} + + static status_t relocate_dependencies(image_t *image) { - ssize_t count, i; + // build an array of images in the order we want to lookup symbols + image_t** lookupList; + ssize_t lookupCount = get_sorted_image_list_breadth_first(image, + &lookupList, RFLAG_VISITED); + if (lookupCount < 0) + return lookupCount; + + // If the image is not the program image, add it and its dependencies, too. + if (sProgramImage != NULL && image != sProgramImage) { + lookupCount += topological_sort_breadth_first(sProgramImage, + lookupList + lookupCount, RFLAG_VISITED); + } + + // If we have pre-loaded images, prepend them. + if (sPreloadedImageCount > 0) { + // Count the ones that have to be added -- normally all, but one never + // knows. + uint32 preloadedCount = 0; + for (uint32 i = 0; i < sPreloadedImageCount; i++) { + image_t* preloadedImage = sPreloadedImages[i]; + if ((preloadedImage->flags & RFLAG_VISITED) == 0) + preloadedCount++; + } + + // add them + if (preloadedCount > 0) { + memmove(lookupList + preloadedCount, lookupList, + lookupCount * sizeof(image_t*)); + lookupCount += preloadedCount; + + preloadedCount = 0; + for (uint32 i = 0; i < sPreloadedImageCount; i++) { + image_t* preloadedImage = sPreloadedImages[i]; + if ((preloadedImage->flags & RFLAG_VISITED) == 0) + lookupList[preloadedCount++] = preloadedImage; + } + } + } + + // clear the "visited" flag + for (int32 i = 0; i < lookupCount; i++) + lookupList[i]->flags &= ~RFLAG_VISITED; + + image->symbol_resolution_images = lookupList; + image->symbol_resolution_image_count = lookupCount; + + // get the images that still have to be relocated image_t **list; - - count = get_sorted_image_list(image, &list, RFLAG_RELOCATED); + ssize_t count = get_sorted_image_list(image, &list, RFLAG_RELOCATED); if (count < B_OK) return count; - for (i = 0; i < count; i++) { + for (ssize_t i = 0; i < count; i++) { status_t status = relocate_image(image, list[i]); if (status < B_OK) return status; @@ -1652,6 +1693,124 @@ } +void +inject_runtime_loader_api(image_t* rootImage) +{ + // We patch any exported __gRuntimeLoader symbols to point to our private + // API. + image_t* image; + Elf32_Sym* symbol = find_symbol_in_root_image_list(rootImage, + "__gRuntimeLoader", &image); + + if (symbol != NULL) { + void** _export = (void**)(symbol->st_value + image->regions[0].delta); + *_export = &gRuntimeLoader; + } +} + + +static status_t +add_preloaded_image(image_t* image) +{ + // We realloc() everytime -- not particularly efficient, but good enough for + // small number of preloaded images. + image_t** newArray = (image_t**)realloc(sPreloadedImages, + sizeof(image_t*) * (sPreloadedImageCount + 1)); + if (newArray == NULL) + return B_NO_MEMORY; + + sPreloadedImages = newArray; + newArray[sPreloadedImageCount++] = image; + + return B_OK; +} + + +image_id +preload_image(char const* path) +{ + if (path == NULL) + return B_BAD_VALUE; + + KTRACE("rld: preload_image(\"%s\")", path); + + image_t *image = NULL; + status_t status = load_container(path, B_ADD_ON_IMAGE, NULL, &image); + if (status < B_OK) { + rld_unlock(); + KTRACE("rld: preload_image(\"%s\") failed to load container: %s", path, + strerror(status)); + return status; + } + + for (image_t* otherImage = sLoadedImages.head; otherImage != NULL; + otherImage = otherImage->next) { + status = load_dependencies(otherImage); + if (status < B_OK) + goto err; + } + + status = relocate_dependencies(image); + if (status < B_OK) + goto err; + + status = add_preloaded_image(image); + if (status < B_OK) + goto err; + + inject_runtime_loader_api(image); + + remap_images(); + init_dependencies(image, true); + + KTRACE("rld: preload_image(\"%s\") done: id: %ld", path, image->id); + + return image->id; + +err: + KTRACE("rld: preload_image(\"%s\") failed: %s", path, strerror(status)); + + dequeue_image(&sLoadedImages, image); + sLoadedImageCount--; + delete_image(image); + return status; +} + + +static void +preload_images() +{ + const char* imagePaths = getenv("LD_PRELOAD"); + if (imagePaths == NULL) + return; + + while (*imagePaths != '\0') { + // find begin of image path + while (*imagePaths != '\0' && isspace(*imagePaths)) + imagePaths++; + + if (*imagePaths == '\0') + break; + + // find end of image path + const char* imagePath = imagePaths; + while (*imagePaths != '\0' && !isspace(*imagePaths)) + imagePaths++; + + // extract the path + char path[B_PATH_NAME_LENGTH]; + size_t pathLen = imagePaths - imagePath; + if (pathLen > sizeof(path) - 1) + continue; + memcpy(path, imagePath, pathLen); + path[pathLen] = '\0'; + + // load the image + preload_image(path); + } +} + + // #pragma mark - libroot.so exported functions @@ -1666,6 +1825,8 @@ rld_lock(); // for now, just do stupid simple global locking + preload_images(); + TRACE(("rld: load %s\n", path)); status = load_container(path, B_APP_IMAGE, NULL, &sProgramImage); @@ -1682,25 +1843,17 @@ if (status < B_OK) goto err; - // We patch any exported __gRuntimeLoader symbols to point to our private API - { - struct Elf32_Sym *symbol = find_symbol_in_loaded_images( - "__gRuntimeLoader", &image); - if (symbol != NULL) { - void **_export = (void **)(symbol->st_value + image->regions[0].delta); - *_export = &gRuntimeLoader; - } - } + inject_runtime_loader_api(sProgramImage); - init_dependencies(sLoadedImages.head, true); remap_images(); - // ToDo: once setup_system_time() is fixed, move this one line higher! + init_dependencies(sProgramImage, true); // Since the images are initialized now, we no longer should use our // getenv(), but use the one from libroot.so { - struct Elf32_Sym *symbol = find_symbol_in_loaded_images("getenv", - &image); + struct Elf32_Sym *symbol = find_symbol_in_root_image_list(sProgramImage, + "getenv", &image); + if (symbol != NULL) gGetEnv = (char* (*)(const char*)) (symbol->st_value + image->regions[0].delta); From bonefish at mail.berlios.de Sun Nov 2 04:43:03 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 2 Nov 2008 04:43:03 +0100 Subject: [Haiku-commits] r28456 - in haiku/trunk: headers/private/runtime_loader headers/private/system src/system/libroot src/system/libroot/os src/system/libroot/posix src/system/libroot/posix/stdlib src/system/libroot/posix/unistd Message-ID: <200811020343.mA23h3eQ026884@sheep.berlios.de> Author: bonefish Date: 2008-11-02 04:43:01 +0100 (Sun, 02 Nov 2008) New Revision: 28456 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28456&view=rev Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h haiku/trunk/headers/private/system/user_runtime.h haiku/trunk/src/system/libroot/Jamfile haiku/trunk/src/system/libroot/libroot_init.c haiku/trunk/src/system/libroot/os/Jamfile haiku/trunk/src/system/libroot/os/image.cpp haiku/trunk/src/system/libroot/posix/Jamfile haiku/trunk/src/system/libroot/posix/dlfcn.c haiku/trunk/src/system/libroot/posix/stdlib/Jamfile haiku/trunk/src/system/libroot/posix/stdlib/env.cpp haiku/trunk/src/system/libroot/posix/stdlib/exit.c haiku/trunk/src/system/libroot/posix/unistd/Jamfile haiku/trunk/src/system/libroot/posix/unistd/fork.c Log: Moved the rld_export structure from to , since it isn't a kernel <-> userland interface. Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h =================================================================== --- haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-02 03:43:01 UTC (rev 28456) @@ -15,6 +15,39 @@ #include + +// #pragma mark - runtime loader libroot interface + + +struct user_space_program_args; + +struct rld_export { + // runtime loader API export + image_id (*load_add_on)(char const *path, uint32 flags); + status_t (*unload_add_on)(image_id imageID); + status_t (*get_image_symbol)(image_id imageID, char const *symbolName, + int32 symbolType, void **_location); + status_t (*get_nth_image_symbol)(image_id imageID, int32 num, char *symbolName, + int32 *nameLength, int32 *symbolType, void **_location); + status_t (*test_executable)(const char *path, char *interpreter); + status_t (*get_next_image_dependency)(image_id id, uint32 *cookie, + const char **_name); + + status_t (*reinit_after_fork)(); + + void (*call_atexit_hooks_for_range)(addr_t start, addr_t size); + + void (*call_termination_hooks)(); + + const struct user_space_program_args *program_args; +}; + +extern struct rld_export *__gRuntimeLoader; + + +// #pragma mark - runtime loader debugger interface + + typedef struct elf_region_t { area_id id; addr_t start; Modified: haiku/trunk/headers/private/system/user_runtime.h =================================================================== --- haiku/trunk/headers/private/system/user_runtime.h 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/headers/private/system/user_runtime.h 2008-11-02 03:43:01 UTC (rev 28456) @@ -30,27 +30,4 @@ char **env; }; -struct rld_export { - // runtime linker API export - image_id (*load_add_on)(char const *path, uint32 flags); - status_t (*unload_add_on)(image_id imageID); - status_t (*get_image_symbol)(image_id imageID, char const *symbolName, - int32 symbolType, void **_location); - status_t (*get_nth_image_symbol)(image_id imageID, int32 num, char *symbolName, - int32 *nameLength, int32 *symbolType, void **_location); - status_t (*test_executable)(const char *path, char *interpreter); - status_t (*get_next_image_dependency)(image_id id, uint32 *cookie, - const char **_name); - - status_t (*reinit_after_fork)(); - - void (*call_atexit_hooks_for_range)(addr_t start, addr_t size); - - void (*call_termination_hooks)(); - - const struct user_space_program_args *program_args; -}; - -extern struct rld_export *__gRuntimeLoader; - #endif /* KERNEL_USER_RUNTIME_H_ */ Modified: haiku/trunk/src/system/libroot/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/Jamfile 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/Jamfile 2008-11-02 03:43:01 UTC (rev 28456) @@ -1,13 +1,13 @@ SubDir HAIKU_TOP src system libroot ; -UsePrivateHeaders libroot ; +UsePrivateHeaders libroot runtime_loader ; UsePrivateSystemHeaders ; UnarchiveObjects $(TARGET_GCC_LIBGCC_OBJECTS) : $(TARGET_GCC_LIBGCC) ; # we need to link against libgcc.a objects and make # it available to other applications as in BeOS -local librootObjects = +local librootObjects = os_main.o os_arch_$(TARGET_ARCH).o Modified: haiku/trunk/src/system/libroot/libroot_init.c =================================================================== --- haiku/trunk/src/system/libroot/libroot_init.c 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/libroot_init.c 2008-11-02 03:43:01 UTC (rev 28456) @@ -3,15 +3,15 @@ * Distributed under the terms of the MIT License. */ +#include +#include +#include #include +#include #include -#include -#include -#include - void initialize_before(image_id imageID); void _call_atexit_hooks_for_range(addr_t start, addr_t size); void __init_exit_stack_lock(); Modified: haiku/trunk/src/system/libroot/os/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/os/Jamfile 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/os/Jamfile 2008-11-02 03:43:01 UTC (rev 28456) @@ -3,7 +3,7 @@ UsePrivateSystemHeaders ; UsePrivateHeaders kernel ; # for util/KMessage.h -UsePrivateHeaders libroot ; +UsePrivateHeaders libroot runtime_loader ; MergeObject os_main.o : area.c Modified: haiku/trunk/src/system/libroot/os/image.cpp =================================================================== --- haiku/trunk/src/system/libroot/os/image.cpp 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/os/image.cpp 2008-11-02 03:43:01 UTC (rev 28456) @@ -5,8 +5,9 @@ #include +#include +#include #include -#include #include #include Modified: haiku/trunk/src/system/libroot/posix/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/Jamfile 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/posix/Jamfile 2008-11-02 03:43:01 UTC (rev 28456) @@ -4,7 +4,7 @@ UsePrivateSystemHeaders ; UsePrivateHeaders kernel ; # For util/KMessage.h -UsePrivateHeaders libroot ; +UsePrivateHeaders libroot runtime_loader ; if $(HAIKU_MULTIUSER_QUERY) = 1 { PWD_BACKEND = pwd_query.c ; Modified: haiku/trunk/src/system/libroot/posix/dlfcn.c =================================================================== --- haiku/trunk/src/system/libroot/posix/dlfcn.c 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/posix/dlfcn.c 2008-11-02 03:43:01 UTC (rev 28456) @@ -8,12 +8,14 @@ #include -#include #include #include +#include +#include + static status_t sStatus; // Note, this is not thread-safe Modified: haiku/trunk/src/system/libroot/posix/stdlib/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/stdlib/Jamfile 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/posix/stdlib/Jamfile 2008-11-02 03:43:01 UTC (rev 28456) @@ -1,6 +1,6 @@ SubDir HAIKU_TOP src system libroot posix stdlib ; -UsePrivateHeaders drivers libroot ; +UsePrivateHeaders drivers libroot runtime_loader ; UsePrivateSystemHeaders ; MergeObject posix_stdlib.o : Modified: haiku/trunk/src/system/libroot/posix/stdlib/env.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/stdlib/env.cpp 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/posix/stdlib/env.cpp 2008-11-02 03:43:01 UTC (rev 28456) @@ -13,6 +13,7 @@ #include #include +#include #include Modified: haiku/trunk/src/system/libroot/posix/stdlib/exit.c =================================================================== --- haiku/trunk/src/system/libroot/posix/stdlib/exit.c 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/posix/stdlib/exit.c 2008-11-02 03:43:01 UTC (rev 28456) @@ -15,8 +15,8 @@ #include #include +#include #include -#include extern void _IO_cleanup(void); Modified: haiku/trunk/src/system/libroot/posix/unistd/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/Jamfile 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/posix/unistd/Jamfile 2008-11-02 03:43:01 UTC (rev 28456) @@ -1,7 +1,7 @@ SubDir HAIKU_TOP src system libroot posix unistd ; UsePrivateSystemHeaders ; -UsePrivateHeaders libroot ; +UsePrivateHeaders libroot runtime_loader ; MergeObject posix_unistd.o : access.c Modified: haiku/trunk/src/system/libroot/posix/unistd/fork.c =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/fork.c 2008-11-02 03:16:30 UTC (rev 28455) +++ haiku/trunk/src/system/libroot/posix/unistd/fork.c 2008-11-02 03:43:01 UTC (rev 28456) @@ -11,8 +11,8 @@ #include #include +#include #include -#include typedef struct fork_hook { From stippi at mail.berlios.de Sun Nov 2 11:46:51 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 2 Nov 2008 11:46:51 +0100 Subject: [Haiku-commits] r28457 - haiku/trunk/src/preferences/touchpad Message-ID: <200811021046.mA2Akp5v018785@sheep.berlios.de> Author: stippi Date: 2008-11-02 11:46:50 +0100 (Sun, 02 Nov 2008) New Revision: 28457 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28457&view=rev Modified: haiku/trunk/src/preferences/touchpad/TouchpadPref.cpp Log: Patch by Clemens Zeidler: Move debugging output after the check for fConnected in UpdateSettings() to avoid a crash when there is no TouchPad at all. Changes by myself: Adapted coding style and added a comment to ConnectToTouchPad() on why the loop is not exited as soon as the device is found. Modified: haiku/trunk/src/preferences/touchpad/TouchpadPref.cpp =================================================================== --- haiku/trunk/src/preferences/touchpad/TouchpadPref.cpp 2008-11-02 03:43:01 UTC (rev 28456) +++ haiku/trunk/src/preferences/touchpad/TouchpadPref.cpp 2008-11-02 10:46:50 UTC (rev 28457) @@ -14,21 +14,21 @@ // default center position fWindowPosition.x = -1; fWindowPosition.y = -1; - + ConnectToTouchPad(); - - if(LoadSettings() != B_OK){ + + if (LoadSettings() != B_OK) Defaults(); - } + fStartSettings = fSettings; } TouchpadPref::~TouchpadPref() { - if(fConnected){ + if (fConnected) delete fTouchPad; - } + SaveSettings(); } @@ -40,14 +40,14 @@ } -status_t +status_t TouchpadPref::UpdateSettings() { - LOG("UpdateSettings of device %s\n", fTouchPad->Name()); - if(!fConnected){ + if (!fConnected) return B_ERROR; - } + LOG("UpdateSettings of device %s\n", fTouchPad->Name()); + BMessage msg; msg.AddBool("scroll_twofinger", fSettings.scroll_twofinger); msg.AddBool("scroll_multifinger", fSettings.scroll_multifinger); @@ -57,7 +57,8 @@ msg.AddInt16("scroll_ystepsize", fSettings.scroll_ystepsize); msg.AddInt8("scroll_acceleration", fSettings.scroll_acceleration); msg.AddInt8("tapgesture_sensibility", fSettings.tapgesture_sensibility); - return fTouchPad->Control(MS_SET_TOUCHPAD_SETTINGS, &msg); + + return fTouchPad->Control(MS_SET_TOUCHPAD_SETTINGS, &msg); } @@ -72,10 +73,10 @@ TouchpadPref::GetSettingsPath(BPath &path) { status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); - if(status < B_OK) + if (status < B_OK) return status; - path.Append(TOUCHPAD_SETTINGS_FILE); - return B_OK; + + return path.Append(TOUCHPAD_SETTINGS_FILE); } @@ -84,27 +85,26 @@ { BPath path; status_t status = GetSettingsPath(path); - if(status != B_OK) + if (status != B_OK) return status; - + BFile settingsFile(path.Path(), B_READ_ONLY); status = settingsFile.InitCheck(); - if(status != B_OK) + if (status != B_OK) return status; - - if(settingsFile.Read(&fSettings, sizeof(touchpad_settings)) - != sizeof(touchpad_settings)) - { + + if (settingsFile.Read(&fSettings, sizeof(touchpad_settings)) + != sizeof(touchpad_settings)) { LOG("failed to load settings\n"); return B_ERROR; } - - if(settingsFile.Read(&fWindowPosition, sizeof(BPoint)) - != sizeof(BPoint)) - { + + if (settingsFile.Read(&fWindowPosition, sizeof(BPoint)) + != sizeof(BPoint)) { LOG("failed to load settings\n"); return B_ERROR; - } + } + return B_OK; } @@ -114,27 +114,26 @@ { BPath path; status_t status = GetSettingsPath(path); - if(status != B_OK) + if (status != B_OK) return status; - + BFile settingsFile(path.Path(), B_READ_WRITE | B_CREATE_FILE); status = settingsFile.InitCheck(); - if(status != B_OK) + if (status != B_OK) return status; - - if(settingsFile.Write(&fSettings, sizeof(touchpad_settings)) - != sizeof(touchpad_settings)) - { + + if (settingsFile.Write(&fSettings, sizeof(touchpad_settings)) + != sizeof(touchpad_settings)) { LOG("can't save settings\n"); return B_ERROR; } - - if(settingsFile.Write(&fWindowPosition, sizeof(BPoint)) - != sizeof(BPoint)) - { + + if (settingsFile.Write(&fWindowPosition, sizeof(BPoint)) + != sizeof(BPoint)) { LOG("can't save window position\n"); return B_ERROR; - } + } + return B_OK; } @@ -144,36 +143,34 @@ { BList devList; status_t status = get_input_devices(&devList); - if(status != B_OK){ + if (status != B_OK) return status; - } + int32 i = 0; - while(true){ - BInputDevice * dev = (BInputDevice*)devList.ItemAt(i); - if(!dev) + while (true) { + BInputDevice* dev = (BInputDevice*)devList.ItemAt(i); + if (dev == NULL) break; i++; - + LOG("input device %s\n", dev->Name()); - - bool isTouchpad = false; + BString name = dev->Name(); - - if(name.FindFirst("Touchpad") != B_ERROR + + if (name.FindFirst("Touchpad") >= 0 && dev->Type() == B_POINTING_DEVICE - && !fConnected) - { - isTouchpad = true; + && !fConnected) { fConnected = true; fTouchPad = dev; - } - else{ + // Don't bail out here, since we need to delete the other devices + // yet. + } else { delete dev; } } - if(fConnected) + if (fConnected) return B_OK; - + LOG("touchpad input device NOT found\n"); return B_ENTRY_NOT_FOUND; } From stippi at mail.berlios.de Sun Nov 2 11:49:25 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 2 Nov 2008 11:49:25 +0100 Subject: [Haiku-commits] r28458 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811021049.mA2AnPwC019248@sheep.berlios.de> Author: stippi Date: 2008-11-02 11:49:23 +0100 (Sun, 02 Nov 2008) New Revision: 28458 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28458&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c Log: Patch by Clemens Zeidler: I (stippi) broke the detection for standard versus extended PS/2 mice by simplifying the naming of the devices but forgetting to adapt this part of the code. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-02 10:46:50 UTC (rev 28457) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.c 2008-11-02 10:49:23 UTC (rev 28458) @@ -40,7 +40,7 @@ * - bit 0: Left button (1 = down) * byte 1: X position change, since last probed (-127 to +127) * byte 2: Y position change, since last probed (-127 to +127) - * + * * Intellimouse mice send a four byte packet, where the first three * bytes are the same as standard mice, and the last one reports the * Z position, which is, usually, the wheel movement. @@ -108,9 +108,9 @@ cookie->buttons_state = buttons; if (cookie->flags & F_MOUSE_TYPE_INTELLIMOUSE) { - yDeltaWheel = packet[3] & 0x07; - if (packet[3] & 0x08) - yDeltaWheel |= ~0x07; + yDeltaWheel = packet[3] & 0x07; + if (packet[3] & 0x08) + yDeltaWheel |= ~0x07; } /* if (cookie->flags & F_MOUSE_TYPE_2WHEELS) { @@ -155,7 +155,7 @@ status_t status; TRACE("ps2: standard_mouse_read_event\n"); - + status = acquire_sem_etc(cookie->standard_mouse_sem, 1, B_CAN_INTERRUPT, 0); TRACE("ps2: standard_mouse_read_event acquired\n"); if (status < B_OK) @@ -165,14 +165,14 @@ TRACE("ps2: standard_mouse_read_event: Error device no longer " "active\n"); return B_ERROR; - } - + } + if (packet_buffer_read(cookie->standard_mouse_buffer, packet, cookie->dev->packet_size) != cookie->dev->packet_size) { TRACE("ps2: error copying buffer\n"); return B_ERROR; } - + if (!(packet[0] & 8)) panic("ps2: got broken data from packet_buffer_read\n"); @@ -199,15 +199,15 @@ */ int32 standard_mouse_handle_int(ps2_dev *dev) -{ +{ standard_mouse_cookie *cookie = (standard_mouse_cookie*)dev->cookie; const uint8 data = dev->history[0].data; - + TRACE("ps2: standard mouse: %1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\t%1x\n", - data >> 7 & 1, data >> 6 & 1, data >> 5 & 1, - data >> 4 & 1, data >> 3 & 1, data >> 2 & 1, + data >> 7 & 1, data >> 6 & 1, data >> 5 & 1, + data >> 4 & 1, data >> 3 & 1, data >> 2 & 1, data >> 1 & 1, data >> 0 & 1); - + if (cookie->packet_index == 0 && !(data & 8)) { INFO("ps2: bad mouse data, trying resync\n"); return B_HANDLED_INTERRUPT; @@ -248,7 +248,7 @@ } // complete packet is assembled - + cookie->packet_index = 0; if (packet_buffer_write(cookie->standard_mouse_buffer, cookie->packet_buffer, dev->packet_size) != dev->packet_size) { @@ -269,7 +269,7 @@ { status_t status; uint8 deviceId = 0; - + // get device id status = ps2_dev_command(dev, PS2_CMD_GET_DEVICE_ID, NULL, 0, &deviceId, 1); @@ -278,7 +278,7 @@ return B_ERROR; } - TRACE("ps2: probe_mouse device id: %2x\n", deviceId); + TRACE("ps2: probe_mouse device id: %2x\n", deviceId); // check for MS Intellimouse if (deviceId == 0) { @@ -307,7 +307,7 @@ INFO("ps2: probe_mouse Error unknown device id.\n"); return B_ERROR; } - + return B_OK; } @@ -315,16 +315,16 @@ // #pragma mark - Device functions -status_t +status_t standard_mouse_open(const char *name, uint32 flags, void **_cookie) { standard_mouse_cookie *cookie; status_t status; ps2_dev *dev = NULL; int i; - + TRACE("ps2: standard_mouse_open %s\n", name); - + for (dev = NULL, i = 0; i < PS2_DEVICE_COUNT; i++) { if (0 == strcmp(ps2_device[i].name, name)) { dev = &ps2_device[i]; @@ -336,33 +336,33 @@ break; }*/ } - + if (dev == NULL) { TRACE("ps2: dev = NULL\n"); return B_ERROR; } - + if (atomic_or(&dev->flags, PS2_FLAG_OPEN) & PS2_FLAG_OPEN) return B_BUSY; - + cookie = malloc(sizeof(standard_mouse_cookie)); if (cookie == NULL) goto err1; - + *_cookie = cookie; memset(cookie, 0, sizeof(*cookie)); - + cookie->dev = dev; dev->cookie = cookie; dev->disconnect = &standard_mouse_disconnect; dev->handle_int = &standard_mouse_handle_int; - - if (strstr(dev->name, "standard_mouse") != NULL) + + if (strstr(dev->name, "standard") != NULL) cookie->flags = F_MOUSE_TYPE_STANDARD; - if (strstr(dev->name, "intelli_mouse") != NULL) + if (strstr(dev->name, "intelli") != NULL) cookie->flags = F_MOUSE_TYPE_INTELLIMOUSE; - + cookie->standard_mouse_buffer = create_packet_buffer(MOUSE_HISTORY_SIZE * dev->packet_size); if (cookie->standard_mouse_buffer == NULL) { @@ -385,8 +385,8 @@ } atomic_or(&dev->flags, PS2_FLAG_ENABLED); - + TRACE("ps2: standard_mouse_open %s success\n", name); return B_OK; @@ -398,7 +398,7 @@ free(cookie); err1: atomic_and(&dev->flags, ~PS2_FLAG_OPEN); - + TRACE("ps2: standard_mouse_open %s failed\n", name); return B_ERROR; } @@ -455,7 +455,7 @@ standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length) { standard_mouse_cookie *cookie = (standard_mouse_cookie*)_cookie; - + switch (op) { case MS_NUM_EVENTS: { @@ -472,7 +472,7 @@ TRACE("ps2: ioctl MS_READ\n"); if ((status = standard_mouse_read_event(cookie, &movement)) < B_OK) return status; -// TRACE("%s %d %d %d %d\n", cookie->dev->name, +// TRACE("%s %d %d %d %d\n", cookie->dev->name, // movement.xdelta, movement.ydelta, movement.buttons, // movement.clicks); return user_memcpy(buffer, &movement, sizeof(movement)); From stippi at mail.berlios.de Sun Nov 2 12:30:49 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 2 Nov 2008 12:30:49 +0100 Subject: [Haiku-commits] r28459 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811021130.mA2BUnEw023858@sheep.berlios.de> Author: stippi Date: 2008-11-02 12:30:41 +0100 (Sun, 02 Nov 2008) New Revision: 28459 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28459&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/PS2.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_module.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_service.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c Log: Automatic white space cleanup. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/PS2.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/PS2.h 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/PS2.h 2008-11-02 11:30:41 UTC (rev 28459) @@ -20,8 +20,8 @@ typedef struct { bus_manager_info binfo; - int32 (*function1)(); - int32 (*function2)(); + int32 (*function1)(); + int32 (*function2)(); } ps2_module_info; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 11:30:41 UTC (rev 28459) @@ -100,17 +100,17 @@ sqrtf(float x) { float z; - int32 sign = (int)0x80000000; + int32 sign = (int)0x80000000; int32 ix,s,q,m,t,i; uint32 r; GET_FLOAT_WORD(ix,x); /* take care of Inf and NaN */ - if ((ix&0x7f800000)==0x7f800000) { + if ((ix&0x7f800000)==0x7f800000) { return x*x+x; /* sqrt(NaN)=NaN, sqrt(+inf)=+inf sqrt(-inf)=sNaN */ - } + } /* take care of zero */ if (ix<=0) { if ((ix&(~sign))==0) return x;/* sqrt(+-0) = +-0 */ @@ -135,12 +135,12 @@ r = 0x01000000; /* r = moving bit from right to left */ while(r!=0) { - t = s+r; - if (t<=ix) { - s = t+r; - ix -= t; - q += r; - } + t = s+r; + if (t<=ix) { + s = t+r; + ix -= t; + q += r; + } ix += ix; r>>=1; } @@ -163,7 +163,7 @@ } -int32 +int32 make_small(float value) { if (value > 0) @@ -173,17 +173,17 @@ } -void +void get_raw_movement(movement_maker *move, uint32 posX, uint32 posY) { int16 i; float meanXOld = 0, meanYOld = 0; float meanX = 0, meanY = 0; - + // calculate mean for (i = 0; i < move->n_points; i++) { - meanXOld+= move->historyX[i]; - meanYOld+= move->historyY[i]; + meanXOld += move->historyX[i]; + meanYOld += move->historyY[i]; } if (move->n_points == 0) { meanXOld = posX; @@ -192,10 +192,10 @@ meanXOld = meanXOld / move->n_points; meanYOld = meanYOld / move->n_points; } - + meanX = (meanXOld + posX) / 2; meanY = (meanYOld + posY) / 2; - + // fill history for (i = 0; i < HISTORY_SIZE - 1; i++) { move->historyX[i] = move->historyX[i + 1]; @@ -203,14 +203,14 @@ } move->historyX[HISTORY_SIZE - 1] = meanX; move->historyY[HISTORY_SIZE - 1] = meanY; - + if (move->n_points < HISTORY_SIZE) { move->n_points++; move->xDelta = 0; move->yDelta = 0; return; } - + move->xDelta = make_small((meanX - meanXOld) / 16); move->yDelta = make_small((meanY - meanYOld) / 16); } @@ -221,9 +221,9 @@ { // acceleration float acceleration = 1; - if (accel_factor) { - acceleration = 1 + sqrtf(move->xDelta * move->xDelta + move->yDelta * move->yDelta) - * accel_factor / 50.0; + if (accel_factor != 0) { + acceleration = 1 + sqrtf(move->xDelta * move->xDelta + + move->yDelta * move->yDelta) * accel_factor / 50.0; } move->xDelta = make_small(move->xDelta * acceleration); @@ -231,7 +231,7 @@ } -void +void get_movement(movement_maker *move, uint32 posX, uint32 posY) { get_raw_movement(move, posX, posY); @@ -244,21 +244,21 @@ get_scrolling(movement_maker *move, uint32 posX, uint32 posY) { int32 stepsX = 0, stepsY = 0; - + get_raw_movement(move, posX, posY); compute_acceleration(move, move->scroll_acceleration); - + move->scrolling_x+= move->xDelta; move->scrolling_y+= move->yDelta; - + stepsX = make_small(move->scrolling_x / move->scrolling_xStep); stepsY = make_small(move->scrolling_y / move->scrolling_yStep); - + move->scrolling_x-= stepsX * move->scrolling_xStep; move->scrolling_y-= stepsY * move->scrolling_yStep; - + move->xDelta = stepsX; - move->yDelta = -1 * stepsY; + move->yDelta = -1 * stepsY; } @@ -269,7 +269,7 @@ move->scrolling_xStep = 1; if (move->scrolling_yStep <= 0) move->scrolling_yStep = 1; - + move->n_points = 0; move->scrolling_x = 0; move->scrolling_y = 0; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h 2008-11-02 11:30:41 UTC (rev 28459) @@ -11,20 +11,19 @@ float sqrtf(float x); int32 make_small(float value); -typedef struct -{ +typedef struct { int32 xDelta; int32 yDelta; - + int8 acceleration; int8 speed; - + float scrolling_x; float scrolling_y; int32 scrolling_xStep; int32 scrolling_yStep; int32 scroll_acceleration; - + uint8 n_points; float historyX[HISTORY_SIZE]; float historyY[HISTORY_SIZE]; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.cpp 2008-11-02 11:30:41 UTC (rev 28459) @@ -31,7 +31,8 @@ struct packet_buffer * create_packet_buffer(size_t size) { - struct packet_buffer *buffer = (packet_buffer *)malloc(sizeof(packet_buffer)); + struct packet_buffer *buffer + = (packet_buffer *)malloc(sizeof(packet_buffer)); if (buffer == NULL) return NULL; @@ -126,7 +127,8 @@ size_t -packet_buffer_write(struct packet_buffer *buffer, const uint8 *data, size_t length) +packet_buffer_write(struct packet_buffer *buffer, const uint8 *data, + size_t length) { cpu_status state = disable_interrupts(); acquire_spinlock(&buffer->lock); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.h 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/packet_buffer.h 2008-11-02 11:30:41 UTC (rev 28459) @@ -23,8 +23,10 @@ size_t packet_buffer_readable(struct packet_buffer *buffer); size_t packet_buffer_writable(struct packet_buffer *buffer); void packet_buffer_flush(struct packet_buffer *buffer, size_t bytes); -size_t packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t length); -size_t packet_buffer_write(struct packet_buffer *buffer, const uint8 *data, size_t length); +size_t packet_buffer_read(struct packet_buffer *buffer, uint8 *data, size_t + length); +size_t packet_buffer_write(struct packet_buffer *buffer, const uint8 *data, + size_t length); #ifdef __cplusplus } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.c 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_common.c 2008-11-02 11:30:41 UTC (rev 28459) @@ -321,7 +321,7 @@ ps2_init(void) { status_t status; - + TRACE("ps2: init\n"); status = get_module(B_ISA_MODULE_NAME, (module_info **)&gIsa); @@ -383,7 +383,7 @@ ps2_service_notify_device_added(&ps2_device[PS2_DEVICE_MOUSE]); ps2_service_notify_device_added(&ps2_device[PS2_DEVICE_KEYB]); } - + TRACE("ps2: init done!\n"); return B_OK; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-02 11:30:41 UTC (rev 28459) @@ -102,7 +102,7 @@ // probe devices // the probe function has to set the dev name and the dev packet size -#if 0 +#if 1 status = probe_trackpoint(dev); if (status == B_OK) { *hooks = &gStandardMouseDeviceHooks; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.h 2008-11-02 11:30:41 UTC (rev 28459) @@ -35,7 +35,7 @@ data_history history[2]; ps2_dev * parent_dev; size_t packet_size; - + // functions void (*disconnect)(ps2_dev *); int32 (*handle_int)(ps2_dev *); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_keyboard.c 2008-11-02 11:30:41 UTC (rev 28459) @@ -60,7 +60,7 @@ set_typematic(int32 rate, bigtime_t delay) { uint8 value; - + TRACE("ps2: set_typematic rate %ld, delay %Ld\n", rate, delay); // input server and keyboard preferences *seem* to use a range of 20-300 @@ -68,22 +68,22 @@ rate = 20; if (rate > 300) rate = 300; - + // map this into range 0-31 rate = ((rate - 20) * 31) / (300 - 20); // keyboard uses 0 == fast, 31 == slow value = 31 - rate; - + if (delay >= 875000) value |= 3 << 5; else if (delay >= 625000) value |= 2 << 5; else if (delay >= 375000) value |= 1 << 5; - else + else value |= 0 << 5; - + return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], PS2_CMD_KEYBOARD_SET_TYPEMATIC, &value, 1, NULL, 0); } @@ -103,13 +103,13 @@ sIsExtended = true; // TRACE("Extended key\n"); return B_HANDLED_INTERRUPT; - } + } // TRACE("scancode: %x\n", scancode); if (scancode & 0x80) { keyInfo.is_keydown = false; - scancode &= 0x7f; + scancode &= 0x7f; } else keyInfo.is_keydown = true; @@ -143,7 +143,7 @@ status = acquire_sem_etc(sKeyboardSem, 1, B_CAN_INTERRUPT, 0); if (status < B_OK) return status; - + if (!ps2_device[PS2_DEVICE_KEYB].active) { TRACE("ps2: read_keyboard_packet, Error device no longer active\n"); return B_ERROR; @@ -219,7 +219,7 @@ if (atomic_or(&sKeyboardOpenMask, 1) != 0) return B_BUSY; - + status = probe_keyboard(); if (status != B_OK) { INFO("ps2: keyboard probing failed\n"); @@ -269,7 +269,7 @@ delete_sem(sKeyboardSem); atomic_and(&ps2_device[PS2_DEVICE_KEYB].flags, ~PS2_FLAG_ENABLED); - + atomic_and(&sKeyboardOpenMask, 0); TRACE("ps2: keyboard_close done\n"); @@ -338,7 +338,7 @@ // 0xF8 (Set All Keys Make/Break) - Keyboard responds with "ack" (0xFA). return ps2_dev_command(&ps2_device[PS2_DEVICE_KEYB], 0xf8, NULL, 0, NULL, 0); } - + case KB_SET_KEY_REPEAT_RATE: { int32 key_repeat_rate; @@ -350,7 +350,7 @@ sKeyboardRepeatRate = key_repeat_rate; return B_OK; } - + case KB_GET_KEY_REPEAT_RATE: { TRACE("ps2: ioctl KB_GET_KEY_REPEAT_RATE\n"); @@ -367,7 +367,7 @@ return B_ERROR; sKeyboardRepeatDelay = key_repeat_delay; return B_OK; - + } case KB_GET_KEY_REPEAT_DELAY: Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_module.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_module.c 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_module.c 2008-11-02 11:30:41 UTC (rev 28459) @@ -34,31 +34,31 @@ case B_MODULE_INIT: return ps2_init(); - case B_MODULE_UNINIT: + case B_MODULE_UNINIT: ps2_uninit(); - break; - default: + break; + default: return B_ERROR; } - return B_OK; + return B_OK; } static ps2_module_info ps2_module = { .binfo = { - .minfo = { + .minfo = { .name = B_PS2_MODULE_NAME, .flags = B_KEEP_LOADED, .std_ops = std_ops, }, .rescan = NULL, }, - &function1, - &function2, + &function1, + &function2, }; -module_info *modules[] = { - (module_info *)&ps2_module, +module_info *modules[] = { + (module_info *)&ps2_module, NULL }; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_service.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_service.c 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_service.c 2008-11-02 11:30:41 UTC (rev 28459) @@ -42,10 +42,10 @@ ps2_service_cmd cmd; TRACE("ps2: ps2_service_notify_device_added %s\n", dev->name); - + cmd.id = PS2_SERVICE_NOTIFY_DEVICE_ADDED; cmd.dev = dev; - + packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd)); release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE); @@ -59,10 +59,10 @@ ps2_service_cmd cmd; TRACE("ps2: ps2_service_notify_device_republish %s\n", dev->name); - + cmd.id = PS2_SERVICE_NOTIFY_DEVICE_REPUBLISH; cmd.dev = dev; - + packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd)); release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE); @@ -79,7 +79,7 @@ cmd.id = PS2_SERVICE_NOTIFY_DEVICE_REMOVED; cmd.dev = dev; - + packet_buffer_write(sServiceCmdBuffer, (const uint8 *)&cmd, sizeof(cmd)); release_sem_etc(sServiceSem, 1, B_DO_NOT_RESCHEDULE); @@ -115,7 +115,7 @@ snooze(2500000); ps2_dev_publish(cmd.dev); break; - + case PS2_SERVICE_NOTIFY_DEVICE_REMOVED: TRACE("ps2: PS2_SERVICE_NOTIFY_DEVICE_REMOVED %s\n", cmd.dev->name); ps2_dev_unpublish(cmd.dev); @@ -139,7 +139,7 @@ ps2_republish(int argc, char **argv) { int dev = 4; - if (argc == 2) + if (argc == 2) dev = strtoul(argv[1], NULL, 0); if (dev < 0 || dev > 4) dev = 4; @@ -171,7 +171,7 @@ TRACE("ps2: ps2_service_init done\n"); return B_OK; - + err3: delete_sem(sServiceSem); err2: Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_standard_mouse.h 2008-11-02 11:30:41 UTC (rev 28459) @@ -28,7 +28,7 @@ typedef struct { ps2_dev * dev; - + sem_id standard_mouse_sem; packet_buffer * standard_mouse_buffer; bigtime_t click_last_time; @@ -49,11 +49,11 @@ status_t standard_mouse_freecookie(void *_cookie); status_t standard_mouse_ioctl(void *_cookie, uint32 op, void *buffer, size_t length); - + int32 standard_mouse_handle_int(ps2_dev *dev); void standard_mouse_disconnect(ps2_dev *dev); -device_hooks gStandardMouseDeviceHooks; +device_hooks gStandardMouseDeviceHooks; #endif /* __PS2_STANDARD_MOUSE_H */ Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2008-11-02 11:30:41 UTC (rev 28459) @@ -11,7 +11,7 @@ #define SYN_TOUCHPAD 0x47 // Synaptics modes -#define SYN_ABSOLUTE_MODE 0x80 +#define SYN_ABSOLUTE_MODE 0x80 // Absolute plus w mode #define SYN_ABSOLUTE_W_MODE 0x81 #define SYN_FOUR_BYTE_CHILD (1 << 1) @@ -25,7 +25,7 @@ // synaptics touchpad proportions #define SYN_EDGE_MOTION_WIDTH 50 #define SYN_EDGE_MOTION_SPEED 5 -#define SYN_AREA_OFFSET 40 // increase the touchpad size a little bit +#define SYN_AREA_OFFSET 40 // increase the touchpad size a little bit #define SYN_AREA_START_X (1472 - SYN_AREA_OFFSET) #define SYN_AREA_END_X (5472 + SYN_AREA_OFFSET) #define SYN_AREA_WIDTH_X (SYN_AREA_END_X - SYN_AREA_START_X) @@ -48,14 +48,14 @@ typedef struct { uint8 majorVersion; uint8 minorVersion; - + bool capExtended; bool capSleep; bool capFourButtons; bool capMultiFinger; bool capPalmDetection; bool capPassThrough; - + } touchpad_info; @@ -68,20 +68,20 @@ bool finger; bool gesture; // absolut w mode - uint8 wValue; + uint8 wValue; } touch_event; typedef struct { ps2_dev * dev; - + sem_id synaptics_sem; packet_buffer * synaptics_ring_buffer; size_t packet_index; uint8 packet_buffer[PS2_PACKET_SYNAPTICS]; uint8 mode; - + movement_maker movement_maker; bool movement_started; bool scrolling_started; @@ -93,7 +93,7 @@ bool tapdrag_started; bool valid_edge_motion; bool double_click; - + touchpad_settings settings; } synaptics_cookie; @@ -119,7 +119,7 @@ status_t synaptics_close(void *_cookie); status_t synaptics_freecookie(void *_cookie); status_t synaptics_ioctl(void *_cookie, uint32 op, void *buffer, size_t length); - + int32 synaptics_handle_int(ps2_dev *dev); void synaptics_disconnect(ps2_dev *dev); Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c 2008-11-02 10:49:23 UTC (rev 28458) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_trackpoint.c 2008-11-02 11:30:41 UTC (rev 28459) @@ -19,14 +19,14 @@ TRACE("TRACKPOINT: probe\n"); ps2_dev_command(dev, 0xE1, NULL, 0, val, 2); - + if (val[0] != 0x01) { TRACE("TRACKPOINT: not found\n"); return B_ERROR; } dev->name = kTrackpointPath[dev->idx]; dev->packet_size = 3; - TRACE("TRACKPOINT: version 0x%x found\n", val[1]); - + TRACE("TRACKPOINT: version 0x%x found\n", val[1]); + return B_OK; } From stippi at mail.berlios.de Sun Nov 2 12:48:04 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 2 Nov 2008 12:48:04 +0100 Subject: [Haiku-commits] r28460 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811021148.mA2Bm48h009502@sheep.berlios.de> Author: stippi Date: 2008-11-02 12:47:51 +0100 (Sun, 02 Nov 2008) New Revision: 28460 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28460&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c Log: * ps2_synaptics.c - small cleanup * ps2_dev.c - accidentally turned Synaptics support back on with my last commit. Sorry. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-02 11:30:41 UTC (rev 28459) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-02 11:47:51 UTC (rev 28460) @@ -102,7 +102,7 @@ // probe devices // the probe function has to set the dev name and the dev packet size -#if 1 +#if 0 status = probe_trackpoint(dev); if (status == B_OK) { *hooks = &gStandardMouseDeviceHooks; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-02 11:30:41 UTC (rev 28459) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-02 11:47:51 UTC (rev 28460) @@ -421,14 +421,14 @@ event.yPosition = event_buffer[5]; val32 = event_buffer[1] & 0x0F; - event.xPosition+= val32 << 8; + event.xPosition += val32 << 8; val32 = event_buffer[1] >> 4 & 0x0F; - event.yPosition+= val32 << 8; + event.yPosition += val32 << 8; xTwelfBit = event_buffer[3] >> 4 & 1; - event.xPosition+= xTwelfBit << 12; + event.xPosition += xTwelfBit << 12; yTwelfBit = event_buffer[3] >> 5 & 1; - event.yPosition+= yTwelfBit << 12; + event.yPosition += yTwelfBit << 12; status = touchevent_to_movement(cookie, &event, movement); From korli at mail.berlios.de Sun Nov 2 13:33:32 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 2 Nov 2008 13:33:32 +0100 Subject: [Haiku-commits] r28461 - in haiku/trunk: headers/private/interface src/kits/interface Message-ID: <200811021233.mA2CXWDx024635@sheep.berlios.de> Author: korli Date: 2008-11-02 13:33:32 +0100 (Sun, 02 Nov 2008) New Revision: 28461 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28461&view=rev Modified: haiku/trunk/headers/private/interface/ColumnTypes.h haiku/trunk/src/kits/interface/ColumnTypes.cpp Log: takes into account the column title width Modified: haiku/trunk/headers/private/interface/ColumnTypes.h =================================================================== --- haiku/trunk/headers/private/interface/ColumnTypes.h 2008-11-02 11:47:51 UTC (rev 28460) +++ haiku/trunk/headers/private/interface/ColumnTypes.h 2008-11-02 12:33:32 UTC (rev 28461) @@ -41,6 +41,8 @@ void Title (BString* forTitle) const; // sets the BString arg to be the title float FontHeight () const; + virtual float GetPreferredWidth(BField* field, BView* parent) const; + private: float fFontHeight; BString fTitle; Modified: haiku/trunk/src/kits/interface/ColumnTypes.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColumnTypes.cpp 2008-11-02 11:47:51 UTC (rev 28460) +++ haiku/trunk/src/kits/interface/ColumnTypes.cpp 2008-11-02 12:33:32 UTC (rev 28461) @@ -103,6 +103,15 @@ } +float +BTitledColumn::GetPreferredWidth(BField *_field, BView* parent) const +{ + BFont font; + parent->GetFont(&font); + return font.StringWidth(fTitle.String()) + 2 * kTEXT_MARGIN; +} + + // #pragma mark - @@ -193,7 +202,9 @@ BStringField* field = static_cast(_field); BFont font; parent->GetFont(&font); - return font.StringWidth(field->String()) + 2 * kTEXT_MARGIN; + float width = font.StringWidth(field->String()) + 2 * kTEXT_MARGIN; + float parentWidth = BTitledColumn::GetPreferredWidth(_field, parent); + return max_c(width, parentWidth); } From korli at mail.berlios.de Sun Nov 2 13:34:31 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 2 Nov 2008 13:34:31 +0100 Subject: [Haiku-commits] r28462 - haiku/trunk/src/apps/drivesetup Message-ID: <200811021234.mA2CYV54024720@sheep.berlios.de> Author: korli Date: 2008-11-02 13:34:31 +0100 (Sun, 02 Nov 2008) New Revision: 28462 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28462&view=rev Modified: haiku/trunk/src/apps/drivesetup/PartitionList.cpp haiku/trunk/src/apps/drivesetup/PartitionList.h Log: implemented PartitionColumn::GetPreferredWidth() Modified: haiku/trunk/src/apps/drivesetup/PartitionList.cpp =================================================================== --- haiku/trunk/src/apps/drivesetup/PartitionList.cpp 2008-11-02 12:33:32 UTC (rev 28461) +++ haiku/trunk/src/apps/drivesetup/PartitionList.cpp 2008-11-02 12:34:31 UTC (rev 28462) @@ -127,6 +127,35 @@ } } + +float +PartitionColumn::GetPreferredWidth(BField *_field, BView* parent) const +{ + BBitmapStringField* bitmapField + = dynamic_cast(_field); + BStringField* stringField = dynamic_cast(_field); + + float parentWidth = Inherited::GetPreferredWidth(_field, parent); + float width = 0.0; + + if (bitmapField) { + const BBitmap* bitmap = bitmapField->Bitmap(); + BFont font; + parent->GetFont(&font); + width = font.StringWidth(bitmapField->String()) + 3 * fTextMargin; + if (bitmap) + width += bitmap->Bounds().Width(); + else + width += 16; + } else if (stringField) { + BFont font; + parent->GetFont(&font); + width = font.StringWidth(stringField->String()) + 2 * fTextMargin; + } + return max_c(width, parentWidth); +} + + bool PartitionColumn::AcceptsField(const BField* field) const { Modified: haiku/trunk/src/apps/drivesetup/PartitionList.h =================================================================== --- haiku/trunk/src/apps/drivesetup/PartitionList.h 2008-11-02 12:33:32 UTC (rev 28461) +++ haiku/trunk/src/apps/drivesetup/PartitionList.h 2008-11-02 12:34:31 UTC (rev 28462) @@ -49,6 +49,7 @@ virtual void DrawField(BField* field, BRect rect, BView* parent); + virtual float GetPreferredWidth(BField* field, BView* parent) const; virtual bool AcceptsField(const BField* field) const; From stippi at mail.berlios.de Sun Nov 2 13:55:18 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 2 Nov 2008 13:55:18 +0100 Subject: [Haiku-commits] r28463 - haiku/trunk/src/add-ons/input_server/devices/touchpad Message-ID: <200811021255.mA2CtIN8026264@sheep.berlios.de> Author: stippi Date: 2008-11-02 13:55:18 +0100 (Sun, 02 Nov 2008) New Revision: 28463 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28463&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h Log: * Followed a suggestion made by Axel and removed the custom logfile solution and replaced it by dumping output to the syslog. (Also disabled debug output by default.) * Fixed wrong header guard. Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-02 12:34:31 UTC (rev 28462) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-02 12:55:18 UTC (rev 28463) @@ -31,16 +31,18 @@ #include #include -#if DEBUG -FILE *TouchpadInputDevice::sLogFile = NULL; +//#define TRACE_TOUCHPAD_DEVICE +#ifdef TRACE_TOUCHPAD_DEVICE +# define LOG(text...) debug_printf(text) # define LOG_ERR(text...) LOG(text) #else -# define LOG(text...) -# define LOG_ERR(text...) fprintf(stderr, text) +# define LOG(text...) do {} while (0) +# define LOG_ERR(text...) debug_printf(text) #endif #define CALLED() LOG("%s\n", __PRETTY_FUNCTION__) + const static uint32 kMouseThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; // "/dev/" is automatically prepended by StartMonitoringDevice() @@ -95,19 +97,6 @@ }; -#if DEBUG -inline void -LOG(const char *fmt, ...) -{ - char buf[1024]; - va_list ap; - va_start(ap, fmt); - vsprintf(buf, fmt, ap); va_end(ap); - fputs(buf, TouchpadInputDevice::sLogFile); fflush(TouchpadInputDevice::sLogFile); -} -#endif - - extern "C" BInputServerDevice * instantiate_input_device() { @@ -503,9 +492,6 @@ TouchpadInputDevice::TouchpadInputDevice() { -#if DEBUG - sLogFile = fopen("/var/log/mouse_device_log.log", "a"); -#endif CALLED(); StartMonitoringDevice(kTouchpadDevicesDirectoryPS2); @@ -518,10 +504,6 @@ CALLED(); StopMonitoringDevice(kTouchpadDevicesDirectoryPS2); fDevices.MakeEmpty(); - -#if DEBUG - fclose(sLogFile); -#endif } Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-11-02 12:34:31 UTC (rev 28462) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h 2008-11-02 12:55:18 UTC (rev 28463) @@ -6,8 +6,8 @@ * Stefano Ceccherini * Clemens Zeidler, haiku at clemens-zeidler.de */ -#ifndef MOUSE_INPUT_DEVICE_H -#define MOUSE_INPUT_DEVICE_H +#ifndef TOUCHPAD_INPUT_DEVICE_H +#define TOUCHPAD_INPUT_DEVICE_H #include @@ -16,8 +16,8 @@ #include #include -#define DEBUG 1 + class TouchpadDevice; class TouchpadInputDevice : public BInputServerDevice { @@ -46,12 +46,8 @@ status_t _RemoveDevice(const char* path); BObjectList fDevices; -#ifdef DEBUG -public: - static FILE* sLogFile; -#endif }; extern "C" BInputServerDevice* instantiate_input_device(); -#endif // MOUSE_INPUT_DEVICE_H +#endif // TOUCHPAD_INPUT_DEVICE_H From stippi at mail.berlios.de Sun Nov 2 14:15:48 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 2 Nov 2008 14:15:48 +0100 Subject: [Haiku-commits] r28464 - haiku/trunk/src/add-ons/input_server/devices/touchpad Message-ID: <200811021315.mA2DFmbN027875@sheep.berlios.de> Author: stippi Date: 2008-11-02 14:15:47 +0100 (Sun, 02 Nov 2008) New Revision: 28464 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28464&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp Log: Recursive scanning of already existing touchpad devices in the devfs never worked, because the root scanning directory was declared without "/dev/". This makes restarting the input_server work with the touchpad driver. Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-02 12:55:18 UTC (rev 28463) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-02 13:15:47 UTC (rev 28464) @@ -45,8 +45,7 @@ const static uint32 kMouseThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; -// "/dev/" is automatically prepended by StartMonitoringDevice() -const static char *kTouchpadDevicesDirectoryPS2 = "input/touchpad/ps2"; +const static char* kTouchpadDevicesDirectoryPS2 = "/dev/input/touchpad/ps2"; class TouchpadDevice { @@ -586,7 +585,7 @@ void TouchpadInputDevice::_RecursiveScan(const char* directory) { - CALLED(); + LOG("TouchpadInputDevice::_RecursiveScan(%s)\n", directory); BEntry entry; BDirectory dir(directory); @@ -633,6 +632,8 @@ return B_NO_MEMORY; } + LOG_ERR("TouchpadInputDevice::_AddDevice(%s)\n", path); + input_device_ref* devices[2]; devices[0] = device->DeviceRef(); devices[1] = NULL; @@ -650,6 +651,8 @@ if (device == NULL) return B_ENTRY_NOT_FOUND; + LOG_ERR("TouchpadInputDevice::_RemoveDevice(%s)\n", path); + input_device_ref* devices[2]; devices[0] = device->DeviceRef(); devices[1] = NULL; From rudolfc at mail.berlios.de Sun Nov 2 17:29:22 2008 From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de) Date: Sun, 2 Nov 2008 17:29:22 +0100 Subject: [Haiku-commits] r28465 - haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370 Message-ID: <200811021629.mA2GTMcs012984@sheep.berlios.de> Author: rudolfc Date: 2008-11-02 17:29:20 +0100 (Sun, 02 Nov 2008) New Revision: 28465 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28465&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370reg.h Log: added a few registerdefines for codec, added unmute mixer output. ES1370, SB PCI128 now produces sound on haiku over here. 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-11-02 13:15:47 UTC (rev 28464) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.c 2008-11-02 16:29:20 UTC (rev 28465) @@ -463,15 +463,23 @@ /* reset the codec */ PRINT(("codec reset\n")); - es1370_codec_write(&card->config, CODEC_RES_PD, 0x2); - es1370_codec_write(&card->config, CODEC_RES_PD, 0x3); - es1370_codec_write(&card->config, CODEC_CSEL, 0x0); + es1370_codec_write(&card->config, CODEC_RESET_PWRDWN, 0x2); + snooze (20); + es1370_codec_write(&card->config, CODEC_RESET_PWRDWN, 0x3); + snooze (20); + es1370_codec_write(&card->config, CODEC_CLOCK_SEL, 0x0); - es1370_codec_write(&card->config, 0x0, 0x0); - es1370_codec_write(&card->config, 0x1, 0x0); - es1370_codec_write(&card->config, 0x2, 0x0); - es1370_codec_write(&card->config, 0x3, 0x0); + /* set max volume on master and mixer outputs */ + es1370_codec_write(&card->config, CODEC_MASTER_VOL_L, 0x0); + es1370_codec_write(&card->config, CODEC_MASTER_VOL_R, 0x0); + es1370_codec_write(&card->config, CODEC_VOICE_VOL_L, 0x0); + es1370_codec_write(&card->config, CODEC_VOICE_VOL_R, 0x0); + /* unmute CD playback */ + es1370_codec_write(&card->config, CODEC_OUTPUT_MIX1, ES1370_OUTPUT_MIX1_CDL | ES1370_OUTPUT_MIX1_CDR); + /* unmute mixer output */ + es1370_codec_write(&card->config, CODEC_OUTPUT_MIX2, ES1370_OUTPUT_MIX2_VOICEL | ES1370_OUTPUT_MIX2_VOICER); + snooze(50000); // 50 ms PRINT(("installing interrupt : %lx\n", card->config.irq)); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370reg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370reg.h 2008-11-02 13:15:47 UTC (rev 28464) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370reg.h 2008-11-02 16:29:20 UTC (rev 28465) @@ -118,17 +118,50 @@ #define STAT_DAC2 0x00000002 /* DAC2 int pending */ #define STAT_ADC 0x00000001 /* ADC int pending */ -#define CODEC_OMIX1 0x10 -#define CODEC_OMIX2 0x11 -#define CODEC_LIMIX1 0x12 -#define CODEC_RIMIX1 0x13 -#define CODEC_LIMIX2 0x14 -#define CODEC_RIMIX2 0x15 -#define CODEC_RES_PD 0x16 -#define CODEC_CSEL 0x17 -#define CODEC_ADSEL 0x18 -#define CODEC_MGAIN 0x19 +/* AKM AK4531 CODEC Control Register Map */ +#define CODEC_MASTER_VOL_L 0x00 +#define CODEC_MASTER_VOL_R 0x01 +#define CODEC_VOICE_VOL_L 0x02 +#define CODEC_VOICE_VOL_R 0x03 +#define CODEC_FM_VOL_L 0x04 +#define CODEC_FM_VOL_R 0x05 +#define CODEC_CD_VOL_L 0x06 +#define CODEC_CD_VOL_R 0x07 +#define CODEC_LINE_VOL_L 0x08 +#define CODEC_LINE_VOL_R 0x09 +#define CODEC_AUX_VOL_L 0x0A +#define CODEC_AUX_VOL_R 0x0B +#define CODEC_MONO1_VOL 0x0C +#define CODEC_MONO2_VOL 0x0D +#define CODEC_MIC_VOL 0x0E +#define CODEC_MONO_OUT_VOL 0x0F +#define CODEC_OUTPUT_MIX1 0x10 +#define CODEC_OUTPUT_MIX2 0x11 +#define CODEC_L_INPUT_MIX1 0x12 +#define CODEC_R_INPUT_MIX1 0x13 +#define CODEC_L_INPUT_MIX2 0x14 +#define CODEC_R_INPUT_MIX2 0x15 +#define CODEC_RESET_PWRDWN 0x16 +#define CODEC_CLOCK_SEL 0x17 +#define CODEC_AD_INPUT_SEL 0x18 +#define CODEC_MIC_AMP_GAIN 0x19 + +/* output mixer mute bit positions */ +#define ES1370_OUTPUT_MIX1_FML (1<<6) +#define ES1370_OUTPUT_MIX1_FMR (1<<5) +#define ES1370_OUTPUT_MIX1_LINEL (1<<4) +#define ES1370_OUTPUT_MIX1_LINER (1<<3) +#define ES1370_OUTPUT_MIX1_CDL (1<<2) +#define ES1370_OUTPUT_MIX1_CDR (1<<1) +#define ES1370_OUTPUT_MIX1_MIC (1<<0) +#define ES1370_OUTPUT_MIX2_AUXL (1<<5) +#define ES1370_OUTPUT_MIX2_AUXR (1<<4) +#define ES1370_OUTPUT_MIX2_VOICEL (1<<3) +#define ES1370_OUTPUT_MIX2_VOICER (1<<2) +#define ES1370_OUTPUT_MIX2_MONO2 (1<<1) +#define ES1370_OUTPUT_MIX2_MONO1 (1<<0) + /* ES1371 specific */ #define CODEC_ID_SESHIFT 10 From korli at mail.berlios.de Sun Nov 2 18:45:24 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 2 Nov 2008 18:45:24 +0100 Subject: [Haiku-commits] r28466 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/sys Message-ID: <200811021745.mA2HjOd9005415@sheep.berlios.de> Author: korli Date: 2008-11-02 18:45:22 +0100 (Sun, 02 Nov 2008) New Revision: 28466 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28466&view=rev Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h haiku/trunk/src/libs/compat/freebsd_network/fbsd_mbuf.c Log: * imported m_collapse() * added an expected header dependency in rman.h Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h 2008-11-02 16:29:20 UTC (rev 28465) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h 2008-11-02 17:45:22 UTC (rev 28466) @@ -114,6 +114,7 @@ u_int m_length(struct mbuf *m, struct mbuf **last); u_int m_fixhdr(struct mbuf *m); void m_cat(struct mbuf *m, struct mbuf *n); +struct mbuf *m_collapse(struct mbuf *m, int how, int maxfrags); void m_copydata(const struct mbuf *m, int off, int len, caddr_t cp); struct ifnet; Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h 2008-11-02 16:29:20 UTC (rev 28465) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/rman.h 2008-11-02 17:45:22 UTC (rev 28466) @@ -7,6 +7,7 @@ #include +#include #define RF_ACTIVE 0x0002 Modified: haiku/trunk/src/libs/compat/freebsd_network/fbsd_mbuf.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/fbsd_mbuf.c 2008-11-02 16:29:20 UTC (rev 28465) +++ haiku/trunk/src/libs/compat/freebsd_network/fbsd_mbuf.c 2008-11-02 17:45:22 UTC (rev 28466) @@ -520,3 +520,89 @@ out: if (((m = m0)->m_flags & M_PKTHDR) && (m->m_pkthdr.len < totlen)) m->m_pkthdr.len = totlen; } + +/* + * Defragment an mbuf chain, returning at most maxfrags separate + * mbufs+clusters. If this is not possible NULL is returned and + * the original mbuf chain is left in it's present (potentially + * modified) state. We use two techniques: collapsing consecutive + * mbufs and replacing consecutive mbufs by a cluster. + * + * NB: this should really be named m_defrag but that name is taken + */ +struct mbuf * +m_collapse(struct mbuf *m0, int how, int maxfrags) +{ + struct mbuf *m, *n, *n2, **prev; + u_int curfrags; + + /* + * Calculate the current number of frags. + */ + curfrags = 0; + for (m = m0; m != NULL; m = m->m_next) + curfrags++; + /* + * First, try to collapse mbufs. Note that we always collapse + * towards the front so we don't need to deal with moving the + * pkthdr. This may be suboptimal if the first mbuf has much + * less data than the following. + */ + m = m0; +again: + for (;;) { + n = m->m_next; + if (n == NULL) + break; + if ((m->m_flags & M_RDONLY) == 0 && + n->m_len < M_TRAILINGSPACE(m)) { + bcopy(mtod(n, void *), mtod(m, char *) + m->m_len, + n->m_len); + m->m_len += n->m_len; + m->m_next = n->m_next; + m_free(n); + if (--curfrags <= maxfrags) + return m0; + } else + m = n; + } + KASSERT(maxfrags > 1, + ("maxfrags %u, but normal collapse failed", maxfrags)); + /* + * Collapse consecutive mbufs to a cluster. + */ + prev = &m0->m_next; /* NB: not the first mbuf */ + while ((n = *prev) != NULL) { + if ((n2 = n->m_next) != NULL && + n->m_len + n2->m_len < MCLBYTES) { + m = m_getcl(how, MT_DATA, 0); + if (m == NULL) + goto bad; + bcopy(mtod(n, void *), mtod(m, void *), n->m_len); + bcopy(mtod(n2, void *), mtod(m, char *) + n->m_len, + n2->m_len); + m->m_len = n->m_len + n2->m_len; + m->m_next = n2->m_next; + *prev = m; + m_free(n); + m_free(n2); + if (--curfrags <= maxfrags) /* +1 cl -2 mbufs */ + return m0; + /* + * Still not there, try the normal collapse + * again before we allocate another cluster. + */ + goto again; + } + prev = &n->m_next; + } + /* + * No place where we can collapse to a cluster; punt. + * This can occur if, for example, you request 2 frags + * but the packet requires that both be clusters (we + * never reallocate the first mbuf to avoid moving the + * packet header). + */ +bad: + return NULL; +} From anevilyak at mail.berlios.de Sun Nov 2 19:19:28 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 2 Nov 2008 19:19:28 +0100 Subject: [Haiku-commits] r28467 - haiku/trunk/build/jam Message-ID: <200811021819.mA2IJSW5011163@sheep.berlios.de> Author: anevilyak Date: 2008-11-02 19:19:27 +0100 (Sun, 02 Nov 2008) New Revision: 28467 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28467&view=rev Modified: haiku/trunk/build/jam/ReleaseBuildProfiles Log: Add BeBook to optional packages for pre-alpha image. Modified: haiku/trunk/build/jam/ReleaseBuildProfiles =================================================================== --- haiku/trunk/build/jam/ReleaseBuildProfiles 2008-11-02 17:45:22 UTC (rev 28466) +++ haiku/trunk/build/jam/ReleaseBuildProfiles 2008-11-02 18:19:27 UTC (rev 28467) @@ -13,7 +13,7 @@ AddOptionalHaikuImagePackages BePDF Firefox Pe Vision VLC WonderBrush ; AddOptionalHaikuImagePackages CVS Development Subversion OpenSSH Yasm ; - AddOptionalHaikuImagePackages Welcome ; + AddOptionalHaikuImagePackages Welcome BeBook ; } case "beta-*" : { From stippi at mail.berlios.de Sun Nov 2 20:43:09 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 2 Nov 2008 20:43:09 +0100 Subject: [Haiku-commits] r28468 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811021943.mA2Jh9rF022422@sheep.berlios.de> Author: stippi Date: 2008-11-02 20:43:08 +0100 (Sun, 02 Nov 2008) New Revision: 28468 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28468&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h Log: Experimented with the way the absolute touchpad coordinates are translated into relative mouse movements. Removed the "history" and replaced it with a method to accumulate the deltas. Very small deltas are somewhat suppressed, but still accumulate. Overall, this improves the touchpad sensitivity for small movements without introducing unwanted jitter. This also keeps the direction of slightly "non-straight" movements better. I also changed the scale somewhat so that the acceleration does not feel too little anymore. These are the remaining problems I have: * Tap-clicks are sometimes not recognized * releasing the finger from the pad (which is pressure sensitive) sometimes still injects unwanted mouse movement, which may be possible to be supressed when looking at the pressure change and recognizing the release. * scrolling has changed a bit due to my changes and feels a bit too sensitive now Please check it out if you like (ps2_dev.c:105) and tell me what you think. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 18:19:27 UTC (rev 28467) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 19:43:08 UTC (rev 28468) @@ -176,43 +176,62 @@ void get_raw_movement(movement_maker *move, uint32 posX, uint32 posY) { - int16 i; - float meanXOld = 0, meanYOld = 0; - float meanX = 0, meanY = 0; + int diff; + float xDelta, yDelta; + const float acceleration = 0.7; - // calculate mean - for (i = 0; i < move->n_points; i++) { - meanXOld += move->historyX[i]; - meanYOld += move->historyY[i]; + if (move->movementStarted) { + move->movementStarted = false; + // init delta tracking + move->previousX = posX; + move->previousY = posY; + // deltas are automatically reset } - if (move->n_points == 0) { - meanXOld = posX; - meanYOld = posY; - } else { - meanXOld = meanXOld / move->n_points; - meanYOld = meanYOld / move->n_points; - } - meanX = (meanXOld + posX) / 2; - meanY = (meanYOld + posY) / 2; + // accumulate delta and store current pos, reset if pos did not change + diff = posX - move->previousX; + // lessen the effect of small diffs + if ((diff > -3 && diff < -1) || (diff > 1 && diff < 3)) + diff /= 2; + if (diff == 0) + move->deltaSumX = 0.0; + else + move->deltaSumX += diff; - // fill history - for (i = 0; i < HISTORY_SIZE - 1; i++) { - move->historyX[i] = move->historyX[i + 1]; - move->historyY[i] = move->historyY[i + 1]; + diff = posY - move->previousY; + // lessen the effect of small diffs + if ((diff > -3 && diff < -1) || (diff > 1 && diff < 3)) + diff /= 2; + if (diff == 0) + move->deltaSumY = 0.0; + else + move->deltaSumY += diff; + + move->previousX = posX; + move->previousY = posY; + + // compute current delta and reset accumulated delta if + // abs() is greater than 1 + xDelta = move->deltaSumX / 10.0; + yDelta = move->deltaSumY / 10.0; + if (xDelta > 1.0) { + move->deltaSumX = 0.0; + xDelta = 1.0 + (xDelta - 1.0) * acceleration; + } else if (xDelta < -1.0) { + move->deltaSumX = 0.0; + xDelta = -1.0 + (xDelta + 1.0) * acceleration; } - move->historyX[HISTORY_SIZE - 1] = meanX; - move->historyY[HISTORY_SIZE - 1] = meanY; - if (move->n_points < HISTORY_SIZE) { - move->n_points++; - move->xDelta = 0; - move->yDelta = 0; - return; + if (yDelta > 1.0) { + move->deltaSumY = 0.0; + yDelta = 1.0 + (yDelta - 1.0) * acceleration; + } else if (yDelta < -1.0) { + move->deltaSumY = 0.0; + yDelta = -1.0 + (yDelta + 1.0) * acceleration; } - move->xDelta = make_small((meanX - meanXOld) / 16); - move->yDelta = make_small((meanY - meanYOld) / 16); + move->xDelta = make_small(xDelta); + move->yDelta = make_small(yDelta); } @@ -235,6 +254,11 @@ get_movement(movement_maker *move, uint32 posX, uint32 posY) { get_raw_movement(move, posX, posY); + + INFO("SYN: pos: %lu x %lu, delta: %ld x %ld, sums: %ld x %ld\n", + posX, posY, move->xDelta, move->yDelta, + move->deltaSumX, move->deltaSumY); + move->xDelta = move->xDelta * move->speed; move->yDelta = move->yDelta * move->speed; } @@ -248,8 +272,8 @@ get_raw_movement(move, posX, posY); compute_acceleration(move, move->scroll_acceleration); - move->scrolling_x+= move->xDelta; - move->scrolling_y+= move->yDelta; + move->scrolling_x += move->xDelta; + move->scrolling_y += move->yDelta; stepsX = make_small(move->scrolling_x / move->scrolling_xStep); stepsY = make_small(move->scrolling_y / move->scrolling_yStep); @@ -270,7 +294,7 @@ if (move->scrolling_yStep <= 0) move->scrolling_yStep = 1; - move->n_points = 0; + move->movementStarted = true; move->scrolling_x = 0; move->scrolling_y = 0; } Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h 2008-11-02 18:19:27 UTC (rev 28467) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.h 2008-11-02 19:43:08 UTC (rev 28468) @@ -4,8 +4,6 @@ #include -#define HISTORY_SIZE 1 - float floorf(float x); float ceilf(float x); float sqrtf(float x); @@ -24,9 +22,11 @@ int32 scrolling_yStep; int32 scroll_acceleration; - uint8 n_points; - float historyX[HISTORY_SIZE]; - float historyY[HISTORY_SIZE]; + bool movementStarted; + uint32 previousX; + uint32 previousY; + int32 deltaSumX; + int32 deltaSumY; } movement_maker; From stippi at mail.berlios.de Sun Nov 2 20:46:55 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 2 Nov 2008 20:46:55 +0100 Subject: [Haiku-commits] r28469 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811021946.mA2JktCG022608@sheep.berlios.de> Author: stippi Date: 2008-11-02 20:46:54 +0100 (Sun, 02 Nov 2008) New Revision: 28469 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28469&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c Log: Forgot to disable debug output. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 19:43:08 UTC (rev 28468) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 19:46:54 UTC (rev 28469) @@ -255,9 +255,9 @@ { get_raw_movement(move, posX, posY); - INFO("SYN: pos: %lu x %lu, delta: %ld x %ld, sums: %ld x %ld\n", - posX, posY, move->xDelta, move->yDelta, - move->deltaSumX, move->deltaSumY); +// INFO("SYN: pos: %lu x %lu, delta: %ld x %ld, sums: %ld x %ld\n", +// posX, posY, move->xDelta, move->yDelta, +// move->deltaSumX, move->deltaSumY); move->xDelta = move->xDelta * move->speed; move->yDelta = move->yDelta * move->speed; From stippi at mail.berlios.de Sun Nov 2 21:08:27 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 2 Nov 2008 21:08:27 +0100 Subject: [Haiku-commits] r28470 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811022008.mA2K8RKG025055@sheep.berlios.de> Author: stippi Date: 2008-11-02 21:08:27 +0100 (Sun, 02 Nov 2008) New Revision: 28470 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28470&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c Log: These values feel slightly more like running without Synaptics driver. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 19:46:54 UTC (rev 28469) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/movement_maker.c 2008-11-02 20:08:27 UTC (rev 28470) @@ -176,9 +176,11 @@ void get_raw_movement(movement_maker *move, uint32 posX, uint32 posY) { + const float acceleration = 0.8; + const float translation = 12.0; + int diff; float xDelta, yDelta; - const float acceleration = 0.7; if (move->movementStarted) { move->movementStarted = false; @@ -212,8 +214,8 @@ // compute current delta and reset accumulated delta if // abs() is greater than 1 - xDelta = move->deltaSumX / 10.0; - yDelta = move->deltaSumY / 10.0; + xDelta = move->deltaSumX / translation; + yDelta = move->deltaSumY / translation; if (xDelta > 1.0) { move->deltaSumX = 0.0; xDelta = 1.0 + (xDelta - 1.0) * acceleration; From stippi at mail.berlios.de Sun Nov 2 22:40:45 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 2 Nov 2008 22:40:45 +0100 Subject: [Haiku-commits] r28471 - haiku/trunk/src/kits/interface Message-ID: <200811022140.mA2Lej82030753@sheep.berlios.de> Author: stippi Date: 2008-11-02 22:40:44 +0100 (Sun, 02 Nov 2008) New Revision: 28471 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28471&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp Log: Tracked down a busy loop that I could reproduce pretty reliably with tool tips in WonderBrush. The reason was that the text rect is getting smaller and smaller each time the tool tip is shown (even though there is only one word), and the line break moves one char towards the beginning each time. After four times, the busy loop would kick in reliably. I cannot really say that I understand the code, though. But that's the spot anyways. Stefano, could you have a look? Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2008-11-02 20:08:27 UTC (rev 28470) +++ haiku/trunk/src/kits/interface/TextView.cpp 2008-11-02 21:40:44 UTC (rev 28471) @@ -3485,7 +3485,7 @@ // if the line breaks have changed, force an erase if (fromLine != saveFromLine || toLine != saveToLine - || newHeight != saveHeight ) { + || newHeight != saveHeight) { erase = true; fromOffset = -1; } @@ -3566,7 +3566,7 @@ int32 nextOffset = _NextInitialByte(fromOffset); if (toOffset < nextOffset && fromOffset < textLength) toOffset = nextOffset; - + // set the ascent of this line curLine->ascent = ascent; @@ -3767,6 +3767,7 @@ offset += delta; delta = 0; + } while (offset < limit && !done); if (offset - fromOffset < 1) { @@ -3777,7 +3778,7 @@ strWidth = 0.0; int32 current = fromOffset; - for (offset = fromOffset; offset <= limit; current = offset, + for (offset = fromOffset; offset < limit; current = offset, offset = _NextInitialByte(offset)) { strWidth += _StyledWidth(current, offset - current, &ascent, &descent); From mmu_man at mail.berlios.de Sun Nov 2 23:00:43 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 2 Nov 2008 23:00:43 +0100 Subject: [Haiku-commits] r28472 - haiku/trunk/src/apps/bsnow Message-ID: <200811022200.mA2M0hlH032626@sheep.berlios.de> Author: mmu_man Date: 2008-11-02 23:00:43 +0100 (Sun, 02 Nov 2008) New Revision: 28472 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28472&view=rev Modified: haiku/trunk/src/apps/bsnow/SnowView.cpp Log: Fix comment Modified: haiku/trunk/src/apps/bsnow/SnowView.cpp =================================================================== --- haiku/trunk/src/apps/bsnow/SnowView.cpp 2008-11-02 21:40:44 UTC (rev 28471) +++ haiku/trunk/src/apps/bsnow/SnowView.cpp 2008-11-02 22:00:43 UTC (rev 28472) @@ -500,7 +500,7 @@ msg.AddSpecifier("Replicant", "BSnow"); msg.AddSpecifier("Shelf"); msg.AddSpecifier("View", "PoseView"); - msg.AddSpecifier("Window", 1); /* 0 is Twitcher */ + msg.AddSpecifier("Window", 1); /* 0 is Tracker Status */ if ((msgr.SendMessage(&msg, &reply) == B_OK) && (reply.what == B_NO_REPLY || reply.what == B_REPLY)) { //reply.PrintToStream(); From stefano.ceccherini at gmail.com Mon Nov 3 10:53:49 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Mon, 3 Nov 2008 10:53:49 +0100 Subject: [Haiku-commits] r28471 - haiku/trunk/src/kits/interface In-Reply-To: <200811022140.mA2Lej82030753@sheep.berlios.de> References: <200811022140.mA2Lej82030753@sheep.berlios.de> Message-ID: <894b9700811030153r79b752fufe83c95f966b68db@mail.gmail.com> 2008/11/2 stippi at BerliOS : > Author: stippi > Date: 2008-11-02 22:40:44 +0100 (Sun, 02 Nov 2008) > New Revision: 28471 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28471&view=rev > > Modified: > haiku/trunk/src/kits/interface/TextView.cpp > Log: > Tracked down a busy loop that I could reproduce pretty reliably with > tool tips in WonderBrush. The reason was that the text rect is getting > smaller and smaller each time the tool tip is shown (even though there > is only one word), and the line break moves one char towards the beginning > each time. After four times, the busy loop would kick in reliably. I cannot > really say that I understand the code, though. But that's the spot anyways. > Stefano, could you have a look? > Hi Stephan. I added the <= in r10386. Line wrapping was done a character off before this. Can you confirm it's still working correctly ? From axeld at mail.berlios.de Mon Nov 3 12:02:02 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 3 Nov 2008 12:02:02 +0100 Subject: [Haiku-commits] r28473 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200811031102.mA3B22gL011696@sheep.berlios.de> Author: axeld Date: 2008-11-03 12:02:02 +0100 (Mon, 03 Nov 2008) New Revision: 28473 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28473&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp Log: * "devfs_node" now also dumps the partition info, if any. Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2008-11-02 22:00:43 UTC (rev 28472) +++ haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2008-11-03 11:02:02 UTC (rev 28473) @@ -801,6 +801,19 @@ kprintf(" device: %p\n", vnode->stream.u.dev.device); kprintf(" node: %p\n", vnode->stream.u.dev.device->Node()); kprintf(" partition: %p\n", vnode->stream.u.dev.partition); + if (vnode->stream.u.dev.partition != NULL) { + partition_info& info = vnode->stream.u.dev.partition->info; + kprintf(" raw device node: %p\n", + vnode->stream.u.dev.partition->raw_device); + kprintf(" offset: %Ld\n", info.offset); + kprintf(" size: %Ld\n", info.size); + kprintf(" block size: %ld\n", info.logical_block_size); + kprintf(" session: %ld\n", info.session); + kprintf(" partition: %ld\n", info.partition); + kprintf(" device: %s\n", info.device); + set_debug_variable("_raw", + (addr_t)vnode->stream.u.dev.partition->raw_device); + } } return 0; From bonefish at mail.berlios.de Mon Nov 3 14:15:16 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 3 Nov 2008 14:15:16 +0100 Subject: [Haiku-commits] r28474 - in haiku/trunk: headers/private/kernel/util src/system/kernel/util Message-ID: <200811031315.mA3DFG4x018316@sheep.berlios.de> Author: bonefish Date: 2008-11-03 14:15:12 +0100 (Mon, 03 Nov 2008) New Revision: 28474 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28474&view=rev Modified: haiku/trunk/headers/private/kernel/util/kernel_cpp.h haiku/trunk/src/system/kernel/util/kernel_cpp.cpp Log: * Made kernel_cpp.h usable in the runtime loader. * Added new(mynothrow) operators which avoid clashes when also linking against libgcc. Modified: haiku/trunk/headers/private/kernel/util/kernel_cpp.h =================================================================== --- haiku/trunk/headers/private/kernel/util/kernel_cpp.h 2008-11-03 11:02:02 UTC (rev 28473) +++ haiku/trunk/headers/private/kernel/util/kernel_cpp.h 2008-11-03 13:15:12 UTC (rev 28474) @@ -11,20 +11,16 @@ #include #include -#if _KERNEL_MODE +#if _KERNEL_MODE || _LOADER_MODE using namespace std; extern const nothrow_t std::nothrow; -// Oh no! C++ in the kernel! Are you nuts? -// -// - no exceptions -// - (almost) no virtuals (well, the Query code now uses them) -// - it's basically only the C++ syntax, and type checking -// - since one tend to encapsulate everything in classes, it has a slightly -// higher memory overhead -// - nicer code -// - easier to maintain +// We need new() versions we can use when also linking against libgcc. +// std::nothrow can't be used since it's defined in both libgcc and +// kernel_cpp.cpp. +typedef struct {} mynothrow_t; +extern const mynothrow_t mynothrow; inline void * @@ -34,7 +30,7 @@ // keep the prototype as specified in , or else GCC 3 // won't like us return malloc(size); -} +} inline void * @@ -42,8 +38,8 @@ { return malloc(size); } - + inline void * operator new(size_t size, const std::nothrow_t &) throw () { @@ -58,11 +54,25 @@ } +inline void * +operator new(size_t size, const mynothrow_t &) throw () +{ + return malloc(size); +} + + +inline void * +operator new[](size_t size, const mynothrow_t &) throw () +{ + return malloc(size); +} + + inline void operator delete(void *ptr) throw () { free(ptr); -} +} inline void Modified: haiku/trunk/src/system/kernel/util/kernel_cpp.cpp =================================================================== --- haiku/trunk/src/system/kernel/util/kernel_cpp.cpp 2008-11-03 11:02:02 UTC (rev 28473) +++ haiku/trunk/src/system/kernel/util/kernel_cpp.cpp 2008-11-03 13:15:12 UTC (rev 28474) @@ -1,7 +1,7 @@ /* * Copyright 2003-2007, Haiku Inc. All rights reserved. * Distributed under the terms of the MIT License. - * + * * Authors: * Axel D?rfler, axeld at pinc-software.de. * Ingo Weinhold, bonefish at users.sf.net. @@ -38,6 +38,8 @@ # endif #endif +const mynothrow_t mynothrow = {}; + #if __GNUC__ == 2 extern "C" void From bonefish at mail.berlios.de Mon Nov 3 14:27:14 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 3 Nov 2008 14:27:14 +0100 Subject: [Haiku-commits] r28475 - in haiku/trunk: headers/private/runtime_loader src/system/runtime_loader Message-ID: <200811031327.mA3DREHb021137@sheep.berlios.de> Author: bonefish Date: 2008-11-03 14:27:14 +0100 (Mon, 03 Nov 2008) New Revision: 28475 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28475&view=rev Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h haiku/trunk/src/system/runtime_loader/elf.cpp Log: * Added an "add-on" interface for the runtime loader. Pre-loaded images can export a structure containing callback hooks invoked by the runtime loader when certain image events occur (image loaded, relocated, initialized, etc.). * Also added a mechanism to patch image symbols. For an image callback functions can be installed that patch symbols exported or imported by the image. Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h =================================================================== --- haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-03 13:15:12 UTC (rev 28474) +++ haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-03 13:27:14 UTC (rev 28475) @@ -48,6 +48,8 @@ // #pragma mark - runtime loader debugger interface +struct RuntimeLoaderSymbolPatcher; + typedef struct elf_region_t { area_id id; addr_t start; @@ -103,6 +105,11 @@ uint32 symbol_resolution_image_count; struct image_t **symbol_resolution_images; + // Singly-linked list of symbol patchers for symbols defined respectively + // referenced by this image. + struct RuntimeLoaderSymbolPatcher *defined_symbol_patchers; + struct RuntimeLoaderSymbolPatcher *undefined_symbol_patchers; + // describes the text and data regions uint32 num_regions; elf_region_t regions[1]; @@ -134,4 +141,48 @@ image_queue_t *loaded_images; } runtime_loader_debug_area; + +// #pragma mark - runtime loader add-on interface + + +// symbol patcher callback +typedef void runtime_loader_symbol_patcher(void* cookie, + struct image_t* rootImage, struct image_t* image, const char* name, + struct image_t** foundInImage, void** symbol, int32* type); + +// interface provided to add-ons +struct runtime_loader_add_on_export { + status_t (*register_defined_symbol_patcher)(struct image_t* image, + runtime_loader_symbol_patcher* patcher, void* cookie); + void (*unregister_defined_symbol_patcher)(struct image_t* image, + runtime_loader_symbol_patcher* patcher, void* cookie); + status_t (*register_undefined_symbol_patcher)(struct image_t* image, + runtime_loader_symbol_patcher* patcher, void* cookie); + void (*unregister_undefined_symbol_patcher)(struct image_t* image, + runtime_loader_symbol_patcher* patcher, void* cookie); +}; + + +#define RUNTIME_LOADER_ADD_ON_VERSION 1 + +typedef struct runtime_loader_add_on { + uint32 version; + uint32 flags; + + // called after the add-on image has been loaded + void (*init)(struct rld_export* standardInterface, + struct runtime_loader_add_on_export* addOnInterface); + + // called whenever the respective image event occurs + void (*image_loaded)(struct image_t* image); + void (*image_relocated)(struct image_t* image); + void (*image_initialized)(struct image_t* image); + void (*image_uninitializing)(struct image_t* image); + void (*image_unloading)(struct image_t* image); +} runtime_loader_add_on; + +// This is the variable a preloaded shared object has to export to get picked up +// by the runtime loader as an add-on. +extern runtime_loader_add_on __gRuntimeLoaderAddOn; + #endif // _RUNTIME_LOADER_H Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-03 13:15:12 UTC (rev 28474) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-03 13:27:14 UTC (rev 28475) @@ -8,7 +8,6 @@ * Distributed under the terms of the NewOS License. */ - #include "runtime_loader_private.h" #include @@ -22,6 +21,8 @@ #include #include #include +#include +#include #include #include @@ -36,8 +37,8 @@ #endif -// ToDo: implement better locking strategy -// ToDo: implement lazy binding +// TODO: implement better locking strategy +// TODO: implement lazy binding #define PAGE_MASK (B_PAGE_SIZE - 1) @@ -75,6 +76,47 @@ typedef void (*init_term_function)(image_id); + +// image events +enum { + IMAGE_EVENT_LOADED, + IMAGE_EVENT_RELOCATED, + IMAGE_EVENT_INITIALIZED, + IMAGE_EVENT_UNINITIALIZING, + IMAGE_EVENT_UNLOADING +}; + + +struct RuntimeLoaderAddOn + : public DoublyLinkedListLinkImpl { + image_t* image; + runtime_loader_add_on* addOn; + + RuntimeLoaderAddOn(image_t* image, runtime_loader_add_on* addOn) + : + image(image), + addOn(addOn) + { + } +}; + +typedef DoublyLinkedList AddOnList; + +struct RuntimeLoaderSymbolPatcher { + RuntimeLoaderSymbolPatcher* next; + runtime_loader_symbol_patcher* patcher; + void* cookie; + + RuntimeLoaderSymbolPatcher(runtime_loader_symbol_patcher* patcher, + void* cookie) + : + patcher(patcher), + cookie(cookie) + { + } +}; + + static image_queue_t sLoadedImages = {0, 0}; static image_queue_t sDisposableImages = {0, 0}; static uint32 sLoadedImageCount = 0; @@ -85,13 +127,16 @@ static bool sInvalidImageIDs; static image_t **sPreloadedImages = NULL; static uint32 sPreloadedImageCount = 0; +static AddOnList sAddOns; // a recursive lock static sem_id sSem; static thread_id sSemOwner; static int32 sSemCount; +extern runtime_loader_add_on_export gRuntimeLoaderAddOnExport; + void dprintf(const char *format, ...) { @@ -456,7 +501,19 @@ memset(image->needed, 0xa5, sizeof(image->needed[0]) * image->num_needed); #endif free(image->needed); + free(image->symbol_resolution_images); + while (RuntimeLoaderSymbolPatcher* patcher + = image->defined_symbol_patchers) { + image->defined_symbol_patchers = patcher->next; + delete patcher; + } + while (RuntimeLoaderSymbolPatcher* patcher + = image->undefined_symbol_patchers) { + image->undefined_symbol_patchers = patcher->next; + delete patcher; + } + #ifdef DEBUG // overwrite images to make sure they aren't accidently reused anywhere memset(image, 0xa5, size); @@ -970,6 +1027,110 @@ } +static void +patch_defined_symbol(image_t* image, const char* name, void** symbol, + int32* type) +{ + RuntimeLoaderSymbolPatcher* patcher = image->defined_symbol_patchers; + while (patcher != NULL && *symbol != 0) { + image_t* inImage = image; + patcher->patcher(patcher->cookie, NULL, image, name, &inImage, + symbol, type); + patcher = patcher->next; + } +} + + +static void +patch_undefined_symbol(image_t* rootImage, image_t* image, const char* name, + image_t** foundInImage, void** symbol, int32* type) +{ + if (*foundInImage != NULL) + patch_defined_symbol(*foundInImage, name, symbol, type); + + RuntimeLoaderSymbolPatcher* patcher = image->undefined_symbol_patchers; + while (patcher != NULL) { + patcher->patcher(patcher->cookie, rootImage, image, name, foundInImage, + symbol, type); + patcher = patcher->next; + } +} + + +status_t +register_defined_symbol_patcher(struct image_t* image, + runtime_loader_symbol_patcher* _patcher, void* cookie) +{ + RuntimeLoaderSymbolPatcher* patcher + = new(mynothrow) RuntimeLoaderSymbolPatcher(_patcher, cookie); + if (patcher == NULL) + return B_NO_MEMORY; + + patcher->next = image->defined_symbol_patchers; + image->defined_symbol_patchers = patcher; + + return B_OK; +} + + +void +unregister_defined_symbol_patcher(struct image_t* image, + runtime_loader_symbol_patcher* _patcher, void* cookie) +{ + RuntimeLoaderSymbolPatcher** patcher = &image->defined_symbol_patchers; + while (*patcher != NULL) { + if ((*patcher)->patcher == _patcher && (*patcher)->cookie == cookie) { + RuntimeLoaderSymbolPatcher* toDelete = *patcher; + *patcher = (*patcher)->next; + delete toDelete; + return; + } + patcher = &(*patcher)->next; + } +} + + +status_t +register_undefined_symbol_patcher(struct image_t* image, + runtime_loader_symbol_patcher* _patcher, void* cookie) +{ + RuntimeLoaderSymbolPatcher* patcher + = new(mynothrow) RuntimeLoaderSymbolPatcher(_patcher, cookie); + if (patcher == NULL) + return B_NO_MEMORY; + + patcher->next = image->undefined_symbol_patchers; + image->undefined_symbol_patchers = patcher; + + return B_OK; +} + + +void +unregister_undefined_symbol_patcher(struct image_t* image, + runtime_loader_symbol_patcher* _patcher, void* cookie) +{ + RuntimeLoaderSymbolPatcher** patcher = &image->undefined_symbol_patchers; + while (*patcher != NULL) { + if ((*patcher)->patcher == _patcher && (*patcher)->cookie == cookie) { + RuntimeLoaderSymbolPatcher* toDelete = *patcher; + *patcher = (*patcher)->next; + delete toDelete; + return; + } + patcher = &(*patcher)->next; + } +} + + +runtime_loader_add_on_export gRuntimeLoaderAddOnExport = { + register_defined_symbol_patcher, + unregister_defined_symbol_patcher, + register_undefined_symbol_patcher, + unregister_undefined_symbol_patcher +}; + + static struct Elf32_Sym * find_symbol(image_t *image, const char *name, int32 type) { @@ -1003,6 +1164,25 @@ } +static status_t +find_symbol(image_t* image, char const* symbolName, int32 symbolType, + void **_location) +{ + // get the symbol in the image + struct Elf32_Sym* symbol = find_symbol(image, symbolName, symbolType); + if (symbol == NULL) + return B_ENTRY_NOT_FOUND; + + void* location = (void*)(symbol->st_value + image->regions[0].delta); + patch_defined_symbol(image, symbolName, &location, &symbolType); + + if (_location != NULL) + *_location = location; + + return B_OK; +} + + static struct Elf32_Sym* find_symbol_in_root_image_list(image_t* rootImage, const char* name, image_t** foundInImage) @@ -1051,7 +1231,7 @@ } -/*! This functions is called when we run BeOS images on Haiku. +/*! This function is called when we run BeOS images on Haiku. It allows us to redirect functions to ensure compatibility. */ static const char* @@ -1062,7 +1242,12 @@ const char* to; }; static const struct symbol_mapping kMappings[] = { - // TODO: improve this, and also use it for libnet.so compatibility! + // TODO: Improve this, and also use it for libnet.so compatibility! + // Allow an image to provide a function that will be invoked for every + // (transitively) depending image. The function can return a table to + // remap symbols (probably better address to address). All the tables + // for a single image would be combined into a hash table and an + // undefined symbol patcher using this hash table would be added. {"fstat", "__be_fstat"}, {"lstat", "__be_lstat"}, {"stat", "__be_stat"}, @@ -1097,33 +1282,73 @@ symName = beos_compatibility_map_symbol(symName); } + int32 type = B_SYMBOL_TYPE_ANY; + if (ELF32_ST_TYPE(sym->st_info) == STT_FUNC) + type = B_SYMBOL_TYPE_TEXT; + else if (ELF32_ST_TYPE(sym->st_info) == STT_OBJECT) + type = B_SYMBOL_TYPE_DATA; + // it's undefined, must be outside this image, try the other images sharedSym = find_undefined_symbol(rootImage, image, symName, &sharedImage); + void* location = NULL; + + enum { + ERROR_NO_SYMBOL, + ERROR_WRONG_TYPE, + ERROR_NOT_EXPORTED, + ERROR_UNPATCHED + }; + uint32 lookupError = ERROR_UNPATCHED; + if (sharedSym == NULL) { - FATAL("elf_resolve_symbol: could not resolve symbol '%s'\n", - symName); - return B_MISSING_SYMBOL; - } - - // make sure they're the same type - if (ELF32_ST_TYPE(sym->st_info) != STT_NOTYPE + // symbol not found at all + lookupError = ERROR_NO_SYMBOL; + sharedImage = NULL; + } else if (ELF32_ST_TYPE(sym->st_info) != STT_NOTYPE && ELF32_ST_TYPE(sym->st_info) != ELF32_ST_TYPE(sharedSym->st_info)) { - FATAL("elf_resolve_symbol: found symbol '%s' in shared image " - "but wrong type\n", symName); - return B_MISSING_SYMBOL; + // symbol not of the requested type + lookupError = ERROR_WRONG_TYPE; + sharedImage = NULL; + } else if (ELF32_ST_BIND(sharedSym->st_info) != STB_GLOBAL + && ELF32_ST_BIND(sharedSym->st_info) != STB_WEAK) { + // symbol not exported + lookupError = ERROR_NOT_EXPORTED; + sharedImage = NULL; + } else { + // symbol is fine, get its location + location = (void*)(sharedSym->st_value + + sharedImage->regions[0].delta); } - if (ELF32_ST_BIND(sharedSym->st_info) != STB_GLOBAL - && ELF32_ST_BIND(sharedSym->st_info) != STB_WEAK) { - FATAL("elf_resolve_symbol: found symbol '%s' but not " - "exported\n", symName); + patch_undefined_symbol(rootImage, image, symName, &sharedImage, + &location, &type); + + if (location == NULL) { + switch (lookupError) { + case ERROR_NO_SYMBOL: + FATAL("elf_resolve_symbol: could not resolve symbol " + "'%s'\n", symName); + break; + case ERROR_WRONG_TYPE: + FATAL("elf_resolve_symbol: found symbol '%s' in shared " + "image but wrong type\n", symName); + break; + case ERROR_NOT_EXPORTED: + FATAL("elf_resolve_symbol: found symbol '%s', but not " + "exported\n", symName); + break; + case ERROR_UNPATCHED: + FATAL("elf_resolve_symbol: found symbol '%s', but was " + "hidden by symbol patchers\n", symName); + break; + } return B_MISSING_SYMBOL; } - *symAddress = sharedSym->st_value + sharedImage->regions[0].delta; - return B_NO_ERROR; + *symAddress = (addr_t)location; + return B_OK; } case SHN_ABS: @@ -1144,6 +1369,37 @@ static void +image_event(image_t* image, uint32 event) +{ + AddOnList::Iterator it = sAddOns.GetIterator(); + while (RuntimeLoaderAddOn* addOn = it.Next()) { + void (*function)(image_t* image) = NULL; + + switch (event) { + case IMAGE_EVENT_LOADED: + function = addOn->addOn->image_loaded; + break; + case IMAGE_EVENT_RELOCATED: + function = addOn->addOn->image_relocated; + break; + case IMAGE_EVENT_INITIALIZED: + function = addOn->addOn->image_initialized; + break; + case IMAGE_EVENT_UNINITIALIZING: + function = addOn->addOn->image_uninitializing; + break; + case IMAGE_EVENT_UNLOADING: + function = addOn->addOn->image_unloading; + break; + } + + if (function != NULL) + function(image); + } +} + + +static void register_image(image_t *image, int fd, const char *path) { struct stat stat; @@ -1185,6 +1441,7 @@ } _kern_image_relocated(image->id); + image_event(image, IMAGE_EVENT_RELOCATED); return B_OK; } @@ -1357,6 +1614,7 @@ image->type = type; register_image(image, fd, path); + image_event(image, IMAGE_EVENT_LOADED); _kern_close(fd); @@ -1666,6 +1924,8 @@ if (image->init_routine != 0) ((init_term_function)image->init_routine)(image->id); + + image_event(image, IMAGE_EVENT_INITIALIZED); } TRACE(("%ld: init done.\n", find_thread(NULL))); @@ -1763,6 +2023,18 @@ remap_images(); init_dependencies(image, true); + // if the image contains an add-on, register it + runtime_loader_add_on* addOnStruct; + if (find_symbol(image, "__gRuntimeLoaderAddOn", B_SYMBOL_TYPE_DATA, + (void**)&addOnStruct) == B_OK) { + RuntimeLoaderAddOn* addOn = new(mynothrow) RuntimeLoaderAddOn(image, + addOnStruct); + if (addOn != NULL) { + sAddOns.Add(addOn); + addOnStruct->init(&gRuntimeLoader, &gRuntimeLoaderAddOnExport); + } + } + KTRACE("rld: preload_image(\"%s\") done: id: %ld", path, image->id); return image->id; @@ -2006,12 +2278,16 @@ image->regions[0].vmstart, image->regions[0].vmsize); } + image_event(image, IMAGE_EVENT_UNINITIALIZING); + if (image->term_routine) ((init_term_function)image->term_routine)(image->id); dequeue_image(&sDisposableImages, image); unmap_image(image); + image_event(image, IMAGE_EVENT_UNLOADING); + delete_image(image); } } @@ -2044,21 +2320,27 @@ struct Elf32_Sym *symbol = &image->syms[j]; if (count == num) { - strlcpy(nameBuffer, SYMNAME(image, symbol), *_nameLength); - *_nameLength = strlen(SYMNAME(image, symbol)); + const char* symbolName = SYMNAME(image, symbol); + strlcpy(nameBuffer, symbolName, *_nameLength); + *_nameLength = strlen(symbolName); - if (_type != NULL) { - // ToDo: check with the return types of that BeOS function - if (ELF32_ST_TYPE(symbol->st_info) == STT_FUNC) - *_type = B_SYMBOL_TYPE_TEXT; - else if (ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT) - *_type = B_SYMBOL_TYPE_DATA; - else - *_type = B_SYMBOL_TYPE_ANY; - } + void* location = (void*)(symbol->st_value + + image->regions[0].delta); + int32 type; + if (ELF32_ST_TYPE(symbol->st_info) == STT_FUNC) + type = B_SYMBOL_TYPE_TEXT; + else if (ELF32_ST_TYPE(symbol->st_info) == STT_OBJECT) + type = B_SYMBOL_TYPE_DATA; + else + type = B_SYMBOL_TYPE_ANY; + // TODO: check with the return types of that BeOS function + patch_defined_symbol(image, symbolName, &location, &type); + + if (_type != NULL) + *_type = type; if (_location != NULL) - *_location = (void *)(symbol->st_value + image->regions[0].delta); + *_location = location; goto out; } count++; @@ -2091,17 +2373,9 @@ // get the image from those who have been already initialized image = find_loaded_image_by_id(imageID); - if (image != NULL) { - struct Elf32_Sym *symbol; - - // get the symbol in the image - symbol = find_symbol(image, symbolName, symbolType); - if (symbol) { - if (_location != NULL) - *_location = (void *)(symbol->st_value + image->regions[0].delta); - } else - status = B_ENTRY_NOT_FOUND; - } else + if (image != NULL) + status = find_symbol(image, symbolName, symbolType, _location); + else status = B_BAD_IMAGE_ID; rld_unlock(); @@ -2190,8 +2464,12 @@ TRACE(("%ld: term: %s\n", find_thread(NULL), image->name)); + image_event(image, IMAGE_EVENT_UNINITIALIZING); + if (image->term_routine) ((init_term_function)image->term_routine)(image->id); + + image_event(image, IMAGE_EVENT_UNLOADING); } TRACE(("%ld: term done.\n", find_thread(NULL))); @@ -2202,6 +2480,9 @@ void rldelf_init(void) { + // invoke static constructors + new(&sAddOns) AddOnList; + sSem = create_sem(1, "runtime loader"); sSemOwner = -1; sSemCount = 0; From bonefish at mail.berlios.de Mon Nov 3 14:36:57 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 3 Nov 2008 14:36:57 +0100 Subject: [Haiku-commits] r28476 - in haiku/trunk/src/bin/debug: . ltrace ltrace/arch ltrace/arch/m68k ltrace/arch/ppc ltrace/arch/x86 Message-ID: <200811031336.mA3Daviv022027@sheep.berlios.de> Author: bonefish Date: 2008-11-03 14:36:57 +0100 (Mon, 03 Nov 2008) New Revision: 28476 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28476&view=rev Added: haiku/trunk/src/bin/debug/ltrace/ haiku/trunk/src/bin/debug/ltrace/Jamfile haiku/trunk/src/bin/debug/ltrace/arch/ haiku/trunk/src/bin/debug/ltrace/arch/ltrace_stub.h haiku/trunk/src/bin/debug/ltrace/arch/m68k/ haiku/trunk/src/bin/debug/ltrace/arch/m68k/Jamfile haiku/trunk/src/bin/debug/ltrace/arch/ppc/ haiku/trunk/src/bin/debug/ltrace/arch/ppc/Jamfile haiku/trunk/src/bin/debug/ltrace/arch/x86/ haiku/trunk/src/bin/debug/ltrace/arch/x86/Jamfile haiku/trunk/src/bin/debug/ltrace/arch/x86/arch_ltrace_stub.S haiku/trunk/src/bin/debug/ltrace/ltrace.cpp haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp Modified: haiku/trunk/src/bin/debug/Jamfile Log: The beginnings of an ltrace command. Currently merely a proof of concept for the runtime loader add-on interface. There's a small library (libltrace_stub.so) that when preloaded reroutes all library calls through a stub that prints the function name and some of its arguments to the debug output. Modified: haiku/trunk/src/bin/debug/Jamfile =================================================================== --- haiku/trunk/src/bin/debug/Jamfile 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/Jamfile 2008-11-03 13:36:57 UTC (rev 28476) @@ -7,5 +7,6 @@ StaticLibrary debug_utils.a : debug_utils.cpp ; +HaikuSubInclude ltrace ; HaikuSubInclude profile ; HaikuSubInclude strace ; Added: haiku/trunk/src/bin/debug/ltrace/Jamfile =================================================================== --- haiku/trunk/src/bin/debug/ltrace/Jamfile 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/Jamfile 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,21 @@ +SubDir HAIKU_TOP src bin debug ltrace ; + +UsePrivateHeaders debug ; +UsePrivateHeaders kernel ; +UsePrivateHeaders runtime_loader ; +UsePrivateHeaders shared ; +UsePrivateSystemHeaders ; + +BinCommand ltrace + : + ltrace.cpp +; + +SharedLibrary libltrace_stub.so + : + ltrace_stub.cpp + : + arch_ltrace_stub.a +; + +HaikuSubInclude arch $(TARGET_ARCH) ; Added: haiku/trunk/src/bin/debug/ltrace/arch/ltrace_stub.h =================================================================== --- haiku/trunk/src/bin/debug/ltrace/arch/ltrace_stub.h 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/arch/ltrace_stub.h 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,17 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ +#ifndef ARCH_LTRACE_STUB_H +#define ARCH_LTRACE_STUB_H + + +extern "C" { + +size_t arch_call_stub_size(); +void arch_init_call_stub(void* stub, void* callback, void* function); + +} // extern "C" + + +#endif // ARCH_LTRACE_STUB_H Added: haiku/trunk/src/bin/debug/ltrace/arch/m68k/Jamfile =================================================================== --- haiku/trunk/src/bin/debug/ltrace/arch/m68k/Jamfile 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/arch/m68k/Jamfile 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src bin debug ltrace arch m68k ; + +# TODO: Implement! Added: haiku/trunk/src/bin/debug/ltrace/arch/ppc/Jamfile =================================================================== --- haiku/trunk/src/bin/debug/ltrace/arch/ppc/Jamfile 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/arch/ppc/Jamfile 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src bin debug ltrace arch ppc ; + +# TODO: Implement! Added: haiku/trunk/src/bin/debug/ltrace/arch/x86/Jamfile =================================================================== --- haiku/trunk/src/bin/debug/ltrace/arch/x86/Jamfile 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/arch/x86/Jamfile 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,8 @@ +SubDir HAIKU_TOP src bin debug ltrace arch x86 ; + +UsePrivateSystemHeaders ; + +StaticLibrary arch_ltrace_stub.a + : + arch_ltrace_stub.S +; Added: haiku/trunk/src/bin/debug/ltrace/arch/x86/arch_ltrace_stub.S =================================================================== --- haiku/trunk/src/bin/debug/ltrace/arch/x86/arch_ltrace_stub.S 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/arch/x86/arch_ltrace_stub.S 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,69 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include + + +call_stub: + // push a pointer to arguments and a pointer to ourselves on the stack + lea 4(%esp), %eax + push %eax + call 1f +1: + pop %eax + subl $(1b - call_stub), %eax + push %eax + + // call the wrapper function + movl (call_stub_callback_address - call_stub)(%eax), %eax + call *%eax + // returns a pointer to the actual function + lea 8(%esp), %esp + + jmp *%eax + +.align 4 +call_stub_callback_address: + .long 0 +call_stub_end: + + +// size_t arch_call_stub_size(); +FUNCTION(arch_call_stub_size): + movl $(call_stub_end - call_stub), %eax + ret +FUNCTION_END(arch_call_stub_size) + + + +// void arch_init_call_stub(void* stub, void* callback, void* function); +FUNCTION(arch_init_call_stub): + push %ebp + movl %esp, %ebp + + // stub address to %edi + push %edi + movl 8(%ebp), %edi + + // copy the stub + movl $(call_stub_end - call_stub), %eax + push %eax + movl $call_stub, %eax + push %eax + push %edi + call memcpy + lea 12(%esp), %esp + + // set the callback address in the stub + movl 12(%ebp), %eax + movl %eax, (call_stub_callback_address - call_stub)(%edi) + + // restore %edi + pop %edi + + movl %ebp, %esp + pop %ebp + ret +FUNCTION_END(arch_init_call_stub) Added: haiku/trunk/src/bin/debug/ltrace/ltrace.cpp =================================================================== --- haiku/trunk/src/bin/debug/ltrace/ltrace.cpp 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/ltrace.cpp 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,10 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +int +main() +{ + return 0; +} Added: haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp =================================================================== --- haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp 2008-11-03 13:27:14 UTC (rev 28475) +++ haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp 2008-11-03 13:36:57 UTC (rev 28476) @@ -0,0 +1,233 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ + +#include +#include + +#include + +#include + +#include +#include + +#include "arch/ltrace_stub.h" + + +static void* function_call_callback(const void* stub, const void* args); + + +struct PatchEntry { + HashTableLink originalTableLink; + HashTableLink patchedTableLink; + + void* originalFunction; + void* patchedFunction; + const char* functionName; + + static PatchEntry* Create(const char* name, void* function) + { + void* memory = malloc(_ALIGN(sizeof(PatchEntry)) + + arch_call_stub_size()); + if (memory == NULL) + return NULL; + + PatchEntry* entry = new(memory) PatchEntry; + + void* stub = (uint8*)memory + _ALIGN(sizeof(PatchEntry)); + arch_init_call_stub(stub, &function_call_callback, function); + + entry->originalFunction = function; + entry->patchedFunction = stub; + entry->functionName = name; + + return entry; + } +}; + + +struct OriginalTableDefinition { + typedef const void* KeyType; + typedef PatchEntry ValueType; + + size_t HashKey(const void* key) const + { + return (addr_t)key >> 2; + } + + size_t Hash(PatchEntry* value) const + { + return HashKey(value->originalFunction); + } + + bool Compare(const void* key, PatchEntry* value) const + { + return value->originalFunction == key; + } + + HashTableLink* GetLink(PatchEntry* value) const + { + return &value->originalTableLink; + } +}; + + +struct PatchedTableDefinition { + typedef const void* KeyType; + typedef PatchEntry ValueType; + + size_t HashKey(const void* key) const + { + return (addr_t)key >> 2; + } + + size_t Hash(PatchEntry* value) const + { + return HashKey(value->patchedFunction); + } + + bool Compare(const void* key, PatchEntry* value) const + { + return value->patchedFunction == key; + } + + HashTableLink* GetLink(PatchEntry* value) const + { + return &value->patchedTableLink; + } +}; + + +static rld_export* sRuntimeLoaderInterface; +static runtime_loader_add_on_export* sRuntimeLoaderAddOnInterface; + +static OpenHashTable sOriginalTable; +static OpenHashTable sPatchedTable; + + +static void* +function_call_callback(const void* stub, const void* _args) +{ + PatchEntry* entry = sPatchedTable.Lookup(stub); + if (entry == NULL) +{ +debug_printf("function_call_callback(): CALLED FOR UNKNOWN FUNCTION!\n"); + return NULL; +} + + const uint32* args = (const uint32*)_args; + debug_printf("ltrace: %s(", entry->functionName); + for (int32 i = 0; i < 5; i++) + debug_printf("%s%#lx", i == 0 ? "" : ", ", args[i]); + debug_printf(")\n"); + + return entry->originalFunction; +} + + +static void +symbol_patcher(void* cookie, image_t* rootImage, image_t* image, + const char* name, image_t** foundInImage, void** symbol, int32* type) +{ + debug_printf("symbol_patcher(%p, %p, %p, \"%s\", %p, %p, %ld)\n", + cookie, rootImage, image, name, *foundInImage, *symbol, *type); + + // patch functions only + if (*type != B_SYMBOL_TYPE_TEXT) + return; + + // already patched? + PatchEntry* entry = sOriginalTable.Lookup(*symbol); + if (entry != NULL) { + *foundInImage = NULL; + *symbol = entry->patchedFunction; + return; + } + + entry = PatchEntry::Create(name, *symbol); + if (entry == NULL) + return; + + sOriginalTable.Insert(entry); + sPatchedTable.Insert(entry); + + debug_printf(" -> patching to %p\n", entry->patchedFunction); + + *foundInImage = NULL; + *symbol = entry->patchedFunction; +} + + +static void +ltrace_stub_init(rld_export* standardInterface, + runtime_loader_add_on_export* addOnInterface) +{ + debug_printf("ltrace_stub_init(%p, %p)\n", standardInterface, addOnInterface); + sRuntimeLoaderInterface = standardInterface; + sRuntimeLoaderAddOnInterface = addOnInterface; + + sOriginalTable.Init(); + sPatchedTable.Init(); +} + + +static void +ltrace_stub_image_loaded(image_t* image) +{ + debug_printf("ltrace_stub_image_loaded(%p): \"%s\" (%ld)\n", image, image->path, + image->id); + + if (sRuntimeLoaderAddOnInterface->register_undefined_symbol_patcher(image, + symbol_patcher, (void*)(addr_t)0xc0011eaf) != B_OK) { + debug_printf(" failed to install symbol patcher\n"); + } +} + + +static void +ltrace_stub_image_relocated(image_t* image) +{ + debug_printf("ltrace_stub_image_relocated(%p): \"%s\" (%ld)\n", image, + image->path, image->id); +} + + +static void +ltrace_stub_image_initialized(image_t* image) +{ + debug_printf("ltrace_stub_image_initialized(%p): \"%s\" (%ld)\n", image, + image->path, image->id); +} + + +static void +ltrace_stub_image_uninitializing(image_t* image) +{ + debug_printf("ltrace_stub_image_uninitializing(%p): \"%s\" (%ld)\n", image, + image->path, image->id); +} + + +static void +ltrace_stub_image_unloading(image_t* image) +{ + debug_printf("ltrace_stub_image_unloading(%p): \"%s\" (%ld)\n", image, + image->path, image->id); +} + + +// interface for the runtime loader +runtime_loader_add_on __gRuntimeLoaderAddOn = { + RUNTIME_LOADER_ADD_ON_VERSION, // version + 0, // flags + + ltrace_stub_init, + + ltrace_stub_image_loaded, + ltrace_stub_image_relocated, + ltrace_stub_image_initialized, + ltrace_stub_image_uninitializing, + ltrace_stub_image_unloading +}; From axeld at mail.berlios.de Mon Nov 3 14:37:53 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 3 Nov 2008 14:37:53 +0100 Subject: [Haiku-commits] r28477 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200811031337.mA3Dbrs3022181@sheep.berlios.de> Author: axeld Date: 2008-11-03 14:37:53 +0100 (Mon, 03 Nov 2008) New Revision: 28477 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28477&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp Log: * Improved output of "bfs" command. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-11-03 13:36:57 UTC (rev 28476) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Debug.cpp 2008-11-03 13:37:53 UTC (rev 28477) @@ -343,9 +343,12 @@ return 0; } + kprintf("id: %ld\n", volume->ID()); kprintf("block cache: %p\n", volume->BlockCache()); + kprintf("journal: %p\n", volume->GetJournal(0)); + kprintf("allocator: %p\n", &volume->Allocator()); kprintf("root node: %p\n", volume->RootNode()); - kprintf("indices node: %p\n", volume->IndicesNode()); + kprintf("indices node: %p\n\n", volume->IndicesNode()); dump_super_block(&volume->SuperBlock()); From axeld at mail.berlios.de Mon Nov 3 14:39:33 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 3 Nov 2008 14:39:33 +0100 Subject: [Haiku-commits] r28478 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200811031339.mA3DdXpi022348@sheep.berlios.de> Author: axeld Date: 2008-11-03 14:39:33 +0100 (Mon, 03 Nov 2008) New Revision: 28478 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28478&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp Log: * "checkfs" would run into a panic (transaction still open) when trying to write back the bitmap. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-11-03 13:37:53 UTC (rev 28477) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/Journal.cpp 2008-11-03 13:39:33 UTC (rev 28478) @@ -933,21 +933,22 @@ // For that, it would be nice to have some call-back interface in the // cache transaction API... - if (fUnwrittenTransactions > 0) { - // start a sub transaction - cache_start_sub_transaction(fVolume->BlockCache(), fTransactionID); - fHasSubtransaction = true; - } else - fTransactionID = cache_start_transaction(fVolume->BlockCache()); + if (fOwner != NULL) { + if (fUnwrittenTransactions > 0) { + // start a sub transaction + cache_start_sub_transaction(fVolume->BlockCache(), fTransactionID); + fHasSubtransaction = true; + } else + fTransactionID = cache_start_transaction(fVolume->BlockCache()); - if (fTransactionID < B_OK) { - recursive_lock_unlock(&fLock); - return fTransactionID; + if (fTransactionID < B_OK) { + recursive_lock_unlock(&fLock); + return fTransactionID; + } + + cache_add_transaction_listener(fVolume->BlockCache(), fTransactionID, + TRANSACTION_IDLE, _TransactionIdle, this); } - - cache_add_transaction_listener(fVolume->BlockCache(), fTransactionID, - TRANSACTION_IDLE, _TransactionIdle, this); - return B_OK; } @@ -959,7 +960,8 @@ // we only end the transaction if we would really unlock it // TODO: what about failing transactions that do not unlock? // (they must make the parent fail, too) - _TransactionDone(success); + if (fOwner != NULL) + _TransactionDone(success); fTimestamp = system_time(); fOwner = NULL; From bonefish at mail.berlios.de Mon Nov 3 17:35:10 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 3 Nov 2008 17:35:10 +0100 Subject: [Haiku-commits] r28479 - haiku/trunk/src/system/libroot/posix/unistd Message-ID: <200811031635.mA3GZA82008693@sheep.berlios.de> Author: bonefish Date: 2008-11-03 17:35:09 +0100 (Mon, 03 Nov 2008) New Revision: 28479 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28479&view=rev Modified: haiku/trunk/src/system/libroot/posix/unistd/system.cpp Log: system() is supposed to return a waitpid() style exit status value. wait_for_thread() doesn't provide that; use waitpid() instead. Modified: haiku/trunk/src/system/libroot/posix/unistd/system.cpp =================================================================== --- haiku/trunk/src/system/libroot/posix/unistd/system.cpp 2008-11-03 13:39:33 UTC (rev 28478) +++ haiku/trunk/src/system/libroot/posix/unistd/system.cpp 2008-11-03 16:35:09 UTC (rev 28479) @@ -1,14 +1,14 @@ -/* -** Copyright 2004, Ingo Weinhold, bonefish at cs.tu-berlin.de. All rights reserved. -** Distributed under the terms of the Haiku License. -*/ +/* + * Copyright 2004-2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. + */ - #include +#include +#include +#include #include -#include -#include extern "C" int @@ -26,15 +26,17 @@ return -1; } - status_t returnValue; - status_t error; - do { - error = wait_for_thread(thread, &returnValue); - } while (error == B_INTERRUPTED); - - if (error != B_OK) { - errno = error; + resume_thread(thread); + + int exitStatus; + pid_t result; + while ((result = waitpid(thread, &exitStatus, 0)) < 0 + && errno == B_INTERRUPTED) { + // waitpid() was interrupted by a signal, retry... + } + + if (result < 0) return -1; - } - return returnValue; + + return exitStatus; } From stippi at mail.berlios.de Mon Nov 3 20:31:30 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 3 Nov 2008 20:31:30 +0100 Subject: [Haiku-commits] r28480 - haiku/trunk/src/servers/app/drawing Message-ID: <200811031931.mA3JVUm1025771@sheep.berlios.de> Author: stippi Date: 2008-11-03 20:31:26 +0100 (Mon, 03 Nov 2008) New Revision: 28480 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28480&view=rev Modified: haiku/trunk/src/servers/app/drawing/HWInterface.h haiku/trunk/src/servers/app/drawing/ViewHWInterface.cpp haiku/trunk/src/servers/app/drawing/ViewHWInterface.h Log: To allow testing the ViewHWInterface (used in the test environment) with both double buffering and single buffering, Invalidate() needs to be virtual and ViewHWInterface needs to decide where to invalidate it's host window. Modified: haiku/trunk/src/servers/app/drawing/HWInterface.h =================================================================== --- haiku/trunk/src/servers/app/drawing/HWInterface.h 2008-11-03 16:35:09 UTC (rev 28479) +++ haiku/trunk/src/servers/app/drawing/HWInterface.h 2008-11-03 19:31:26 UTC (rev 28480) @@ -143,7 +143,7 @@ virtual bool IsDoubleBuffered() const; // Invalidate is used for scheduling an area for updating - status_t Invalidate(const BRect& frame); + virtual status_t Invalidate(const BRect& frame); // while as CopyBackToFront() actually performs the operation // either directly or asynchronously by the UpdateQueue thread virtual status_t CopyBackToFront(const BRect& frame); Modified: haiku/trunk/src/servers/app/drawing/ViewHWInterface.cpp =================================================================== --- haiku/trunk/src/servers/app/drawing/ViewHWInterface.cpp 2008-11-03 16:35:09 UTC (rev 28479) +++ haiku/trunk/src/servers/app/drawing/ViewHWInterface.cpp 2008-11-03 19:31:26 UTC (rev 28480) @@ -758,6 +758,17 @@ return HWInterface::IsDoubleBuffered(); } +// Invalidate +status_t +ViewHWInterface::Invalidate(const BRect& frame) +{ + status_t ret = HWInterface::Invalidate(frame); + + if (ret >= B_OK && fWindow && !IsDoubleBuffered()) + fWindow->Invalidate(frame); + return ret; +} + // CopyBackToFront status_t ViewHWInterface::CopyBackToFront(const BRect& frame) Modified: haiku/trunk/src/servers/app/drawing/ViewHWInterface.h =================================================================== --- haiku/trunk/src/servers/app/drawing/ViewHWInterface.h 2008-11-03 16:35:09 UTC (rev 28479) +++ haiku/trunk/src/servers/app/drawing/ViewHWInterface.h 2008-11-03 19:31:26 UTC (rev 28480) @@ -53,6 +53,7 @@ virtual RenderingBuffer* BackBuffer() const; virtual bool IsDoubleBuffered() const; + virtual status_t Invalidate(const BRect& frame); virtual status_t CopyBackToFront(const BRect& frame); private: From stippi at mail.berlios.de Mon Nov 3 20:34:17 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 3 Nov 2008 20:34:17 +0100 Subject: [Haiku-commits] r28481 - haiku/trunk/src/servers/app Message-ID: <200811031934.mA3JYHfq026035@sheep.berlios.de> Author: stippi Date: 2008-11-03 20:34:13 +0100 (Mon, 03 Nov 2008) New Revision: 28481 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28481&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp haiku/trunk/src/servers/app/Desktop.h haiku/trunk/src/servers/app/ServerWindow.cpp Log: Implemented respecting B_LOCK_WINDOW_FOCUS that a view can set using SetMouseEventMask() from within it's mouse hooks. Among other things, scroll bars won't stop scrolling in FFM mode now if you accidentally leave the window with the mouse, something which is very likely. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-11-03 19:31:26 UTC (rev 28480) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-11-03 19:34:13 UTC (rev 28481) @@ -262,7 +262,7 @@ *_target = NULL; } - fDesktop->SetLastMouseState(where, buttons); + fDesktop->SetLastMouseState(where, buttons, window); fDesktop->UnlockAllWindows(); @@ -311,6 +311,7 @@ fMouseEventWindow(NULL), fWindowUnderMouse(NULL), + fLockedFocusWindow(NULL), fViewUnderMouse(B_NULL_TOKEN), fLastMousePosition(B_ORIGIN), fLastMouseButtons(0), @@ -750,10 +751,17 @@ void -Desktop::SetLastMouseState(const BPoint& position, int32 buttons) +Desktop::SetLastMouseState(const BPoint& position, int32 buttons, + Window* windowUnderMouse) { + // The all-window-lock is write-locked. fLastMousePosition = position; fLastMouseButtons = buttons; + + if (fLastMouseButtons == 0 && fLockedFocusWindow) { + fLockedFocusWindow = NULL; + SetFocusWindow(windowUnderMouse); + } } @@ -1375,10 +1383,14 @@ if (!LockAllWindows()) return; + // test for B_LOCK_WINDOW_FOCUS + if (fLockedFocusWindow && focus != fLockedFocusWindow) { + UnlockAllWindows(); + return; + } + bool hasModal = _WindowHasModal(focus); - // TODO: test for B_LOCK_WINDOW_FOCUS - if (focus == fFocus && focus != NULL && !focus->IsHidden() && (focus->Flags() & B_AVOID_FOCUS) == 0 && !hasModal) { // the window that is supposed to get focus already has focus @@ -1462,6 +1474,23 @@ void +Desktop::SetFocusLocked(const Window* window) +{ + AutoWriteLocker _(fWindowLock); + + if (window != NULL) { + // Don't allow this to be set when no mouse buttons + // are pressed. (BView::SetMouseEventMask() should only be called + // from mouse hooks.) + if (fLastMouseButtons == 0) + return; + } + + fLockedFocusWindow = window; +} + + +void Desktop::_BringWindowsToFront(WindowList& windows, int32 list, bool wereVisible) { Modified: haiku/trunk/src/servers/app/Desktop.h =================================================================== --- haiku/trunk/src/servers/app/Desktop.h 2008-11-03 19:31:26 UTC (rev 28480) +++ haiku/trunk/src/servers/app/Desktop.h 2008-11-03 19:34:13 UTC (rev 28481) @@ -82,7 +82,7 @@ void SetCursor(ServerCursor* cursor); ServerCursorReference Cursor() const; void SetLastMouseState(const BPoint& position, - int32 buttons); + int32 buttons, Window* windowUnderMouse); // for use by the mouse filter only // both mouse position calls require // the Desktop object to be locked @@ -164,6 +164,7 @@ void SetFocusWindow(Window* window = NULL); EventTarget* KeyboardEventTarget(); + void SetFocusLocked(const Window* window); Window* FindWindowByClientToken(int32 token, team_id teamID); @@ -303,6 +304,7 @@ Window* fMouseEventWindow; const Window* fWindowUnderMouse; + const Window* fLockedFocusWindow; int32 fViewUnderMouse; BPoint fLastMousePosition; int32 fLastMouseButtons; Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-03 19:31:26 UTC (rev 28480) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-03 19:34:13 UTC (rev 28481) @@ -1343,6 +1343,8 @@ fDesktop->UnlockSingleWindow(); // TODO: possible deadlock if (eventMask != 0 || options != 0) { + if (options & B_LOCK_WINDOW_FOCUS) + fDesktop->SetFocusLocked(fWindow); fDesktop->EventDispatcher().AddTemporaryListener(EventTarget(), fCurrentView->Token(), eventMask, options); } else { From rudolfc at mail.berlios.de Mon Nov 3 20:36:32 2008 From: rudolfc at mail.berlios.de (rudolfc at mail.berlios.de) Date: Mon, 3 Nov 2008 20:36:32 +0100 Subject: [Haiku-commits] r28482 - haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370 Message-ID: <200811031936.mA3JaWqA026214@sheep.berlios.de> Author: rudolfc Date: 2008-11-03 20:36:31 +0100 (Mon, 03 Nov 2008) New Revision: 28482 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28482&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.h haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.settings haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c Log: (re)enabled settings file just like it ac97, modified es1370_play_inth to be same as ac97 auich to remove stuttering sound. Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.h 2008-11-03 19:34:13 UTC (rev 28481) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.h 2008-11-03 19:36:31 UTC (rev 28482) @@ -111,6 +111,7 @@ multi_dev multi; } es1370_dev; +#define ES1370_SETTINGS "es1370.settings" typedef struct { uint32 sample_rate; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.settings =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.settings 2008-11-03 19:34:13 UTC (rev 28481) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/es1370.settings 2008-11-03 19:36:31 UTC (rev 28482) @@ -4,6 +4,6 @@ # ~/config/settings/kernel/drivers/ # -#sample_rate 48000 +#sample_rate 44100 #buffer_frames 512 #buffer_count 2 Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c 2008-11-03 19:34:13 UTC (rev 28481) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/ac97/es1370/multi.c 2008-11-03 19:36:31 UTC (rev 28482) @@ -8,6 +8,7 @@ * Jerome Duval, jerome.duval at free.fr */ +#include #include #include #include @@ -582,7 +583,8 @@ acquire_spinlock(&slock); stream->real_time = system_time(); stream->frames_count += current_settings.buffer_frames; - stream->buffer_cycle = stream->trigblk; + stream->buffer_cycle = (stream->trigblk + + stream->blkmod - 1) % stream->blkmod; stream->update_needed = true; release_spinlock(&slock); @@ -775,6 +777,7 @@ es1370_open(const char *name, uint32 flags, void** cookie) { es1370_dev *card = NULL; + void *settings_handle; int ix; LOG(("open()\n")); @@ -803,6 +806,31 @@ *cookie = card; card->multi.card = card; + // get driver settings + settings_handle = load_driver_settings(ES1370_SETTINGS); + if (settings_handle != NULL) { + const char *item; + char *end; + uint32 value; + + item = get_driver_parameter (settings_handle, "sample_rate", "44100", "44100"); + value = strtoul (item, &end, 0); + if (*end == '\0') + current_settings.sample_rate = value; + + item = get_driver_parameter (settings_handle, "buffer_frames", "512", "512"); + value = strtoul (item, &end, 0); + if (*end == '\0') + current_settings.buffer_frames = value; + + item = get_driver_parameter (settings_handle, "buffer_count", "2", "2"); + value = strtoul (item, &end, 0); + if (*end == '\0') + current_settings.buffer_count = value; + + unload_driver_settings(settings_handle); + } + LOG(("stream_new\n")); card->rstream = es1370_stream_new(card, ES1370_USE_RECORD, current_settings.buffer_frames, current_settings.buffer_count); From stippi at mail.berlios.de Mon Nov 3 20:57:08 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 3 Nov 2008 20:57:08 +0100 Subject: [Haiku-commits] r28483 - haiku/trunk/src/servers/app Message-ID: <200811031957.mA3Jv87X027865@sheep.berlios.de> Author: stippi Date: 2008-11-03 20:57:05 +0100 (Mon, 03 Nov 2008) New Revision: 28483 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28483&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: Oversight: When FFM is turned off, don't focus the window under the mouse on mouse up if there was a focus-locked window. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-11-03 19:36:31 UTC (rev 28482) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-11-03 19:57:05 UTC (rev 28483) @@ -760,7 +760,8 @@ if (fLastMouseButtons == 0 && fLockedFocusWindow) { fLockedFocusWindow = NULL; - SetFocusWindow(windowUnderMouse); + if (fSettings->FocusFollowsMouse()) + SetFocusWindow(windowUnderMouse); } } From korli at mail.berlios.de Mon Nov 3 21:06:20 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 3 Nov 2008 21:06:20 +0100 Subject: [Haiku-commits] r28484 - haiku/trunk/src/kits/interface Message-ID: <200811032006.mA3K6K7t028520@sheep.berlios.de> Author: korli Date: 2008-11-03 21:06:19 +0100 (Mon, 03 Nov 2008) New Revision: 28484 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28484&view=rev Modified: haiku/trunk/src/kits/interface/ColorControl.cpp Log: don't accept clicks when disabled Modified: haiku/trunk/src/kits/interface/ColorControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorControl.cpp 2008-11-03 19:57:05 UTC (rev 28483) +++ haiku/trunk/src/kits/interface/ColorControl.cpp 2008-11-03 20:06:19 UTC (rev 28484) @@ -675,6 +675,8 @@ void BColorControl::MouseDown(BPoint point) { + if (!IsEnabled()) + return; if (!fPaletteFrame.Contains(point)) return; From stippi at mail.berlios.de Mon Nov 3 23:26:39 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 3 Nov 2008 23:26:39 +0100 Subject: [Haiku-commits] r28485 - haiku/trunk/build/jam Message-ID: <200811032226.mA3MQdGM012893@sheep.berlios.de> Author: stippi Date: 2008-11-03 23:26:37 +0100 (Mon, 03 Nov 2008) New Revision: 28485 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28485&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Updated several optional packages: * Firefox -> 2.0.0.17, includes new HVIF icon * VLC -> renamed VLC to "VLC media player" which is what the official name is * Pe -> updated to most recent version (called it RC2) which includes a few fixes and new HVIF icons for most of it's supported document types. Renamed the application folder to "Pe" and removed the "Drag lpe here to install" link. Renamed the application itself to "Pe". Hope these changes are alright with everyone. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-03 20:06:19 UTC (rev 28484) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-03 22:26:37 UTC (rev 28485) @@ -277,8 +277,8 @@ } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { Echo "No optional package Firefox available for gcc4" ; } else { - InstallOptionalHaikuImagePackage Firefox - : http://www.yellowbites.com/downloads/Firefox-2.0.0.12.zip + InstallOptionalHaikuImagePackage Firefox-2.0.0.17 + : http://www.yellowbites.com/downloads/Firefox-2.0.0.17.zip : apps ; AddSymlinkToHaikuImage home config be Applications @@ -384,17 +384,15 @@ } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { Echo "No optional package Pe available for gcc4" ; } else { - InstallOptionalHaikuImagePackage pe-2.4.1-x86 - : http://dl.hirschkaefer.de/beos/pe-2.4.1-x86.zip + InstallOptionalHaikuImagePackage pe-2.4.1-x86-rc2 + : http://www.yellowbites.com/downloads/pe-2.4.1-x86.zip : apps ; - # TODO: The installation directory should probably be renamed to just - # "pe" (or "Pe") and the contained "(drag lpe here...)" be removed. AddSymlinkToHaikuImage home config be Applications - : /boot/apps/pe-2.4.1-x86/pe ; + : /boot/apps/Pe/Pe ; AddSymlinkToHaikuImage home config bin - : /boot/apps/pe-2.4.1-x86/lpe ; + : /boot/apps/Pe/lpe ; } } @@ -458,12 +456,12 @@ } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { Echo "No optional package VLC available for gcc4" ; } else { - InstallOptionalHaikuImagePackage VLC + InstallOptionalHaikuImagePackage VLC-0.8.6c : http://www.yellowbites.com/downloads/vlc-0.8.6c.zip : apps ; AddSymlinkToHaikuImage home config be Applications - : /boot/apps/vlc-0.8.6c/vlc ; + : "/boot/apps/vlc-0.8.6c/VLC media player" ; } } From bonefish at mail.berlios.de Tue Nov 4 00:33:16 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 4 Nov 2008 00:33:16 +0100 Subject: [Haiku-commits] r28486 - in haiku/trunk: build/jam src/bin Message-ID: <200811032333.mA3NXGr7024277@sheep.berlios.de> Author: bonefish Date: 2008-11-04 00:33:15 +0100 (Tue, 04 Nov 2008) New Revision: 28486 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28486&view=rev Removed: haiku/trunk/src/bin/m4/ Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/build/jam/OptionalPackages haiku/trunk/src/bin/Jamfile Log: * Removed GNU M4 sources from the tree. * Added GNU M4 1.4.12 package to the Development optional package. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-03 22:26:37 UTC (rev 28485) +++ haiku/trunk/build/jam/HaikuImage 2008-11-03 23:33:15 UTC (rev 28486) @@ -40,9 +40,10 @@ gawk $(X86_ONLY)gdb grep groups gzip gzexe hd head hey hostname id ident ideinfo idestatus ifconfig install installsound iroster isvolume join keymap kill less lessecho lesskey link listarea listattr listimage listdev - listport listres listsem ln locate logger login logname ls lsindex m4 make - makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex modifiers - mount mount_nfs mountvolume mv nc netstat nl nohup od open passwd paste + listport listres listsem ln locate logger login logname ls lsindex + make makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex + modifiers mount mount_nfs mountvolume mv + nc netstat nl nohup od open passwd paste patch pathchk pc ping play playfile playsound playwav pr prio printenv printf profile ps ptx pwd query quit rc readlink release renice rescan rlog rm rmattr rmindex rmdir roster route Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-03 22:26:37 UTC (rev 28485) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-03 23:33:15 UTC (rev 28486) @@ -236,8 +236,11 @@ : $(baseURL)/gcc-2.95.3-haiku-081024.zip : ; - # other tools + InstallOptionalHaikuImagePackage m4-1.4.12-gcc2-2008-11-04 + : $(baseURL)/m4-1.4.12-gcc2-2008-11-04.zip + : + ; InstallOptionalHaikuImagePackage autoconf-2.61-gcc2-2008-03-24 : $(baseURL)/autoconf-2.61-gcc2-2008-03-24.zip : home Modified: haiku/trunk/src/bin/Jamfile =================================================================== --- haiku/trunk/src/bin/Jamfile 2008-11-03 22:26:37 UTC (rev 28485) +++ haiku/trunk/src/bin/Jamfile 2008-11-03 23:33:15 UTC (rev 28486) @@ -189,7 +189,6 @@ SubInclude HAIKU_TOP src bin keymap ; SubInclude HAIKU_TOP src bin less ; SubInclude HAIKU_TOP src bin listdev ; -SubInclude HAIKU_TOP src bin m4 ; SubInclude HAIKU_TOP src bin make ; SubInclude HAIKU_TOP src bin makebootable ; #SubInclude HAIKU_TOP src bin makeudfimage ; From revol at free.fr Tue Nov 4 00:42:35 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 04 Nov 2008 00:42:35 +0100 CET Subject: [Haiku-commits] r28486 - in haiku/trunk: build/jam src/bin In-Reply-To: <200811032333.mA3NXGr7024277@sheep.berlios.de> Message-ID: <13240759990-BeMail@laptop> > Log: > * Removed GNU M4 sources from the tree. > * Added GNU M4 1.4.12 package to the Development optional package. Hmmm While it cleans up the sources, it also means one less thing available when cross-building... I'd be really nice to be able to cross build a full distro... at least for ppc. And I'm not even thinking about building packages on a Falcon :D Fran?ois. From ingo_weinhold at gmx.de Tue Nov 4 02:11:24 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Tue, 04 Nov 2008 02:11:24 +0100 Subject: [Haiku-commits] r28486 - in haiku/trunk: build/jam src/bin In-Reply-To: <13240759990-BeMail@laptop> References: <13240759990-BeMail@laptop> Message-ID: <20081104021124.352.2@knochen-vm.localdomain> On 2008-11-04 at 00:42:35 [+0100], Fran?ois Revol wrote: > > Log: > > * Removed GNU M4 sources from the tree. > > * Added GNU M4 1.4.12 package to the Development optional package. > > Hmmm > While it cleans up the sources, it also means one less thing available > when cross-building... > I'd be really nice to be able to cross build a full distro... > at least for ppc. > And I'm not even thinking about building packages on a Falcon :D I understand your concerns. It's just that stuff like M4 (or Make BTW) really doesn't belong to the "core" Haiku. Keeping it in the repository makes the source tree heavier and the build times longer. Also from experience the ported software in our source tree tends to get quite outdated. The two years old M4 1.4.8 we had there is even a relatively harmless example. Outsourcing (pun intended) this stuff to HaikuPorts, where the people are focussing on porting software and keeping the ports up to date, seems to be the best option. Anyway, I can imagine a kind of meta build system for those ported software packages. One would simply configure what packages to build and the build system would download the sources, patch them (if necessary), build (natively or cross), and spit out a gift-wrapped, ready-to-install archive. I haven't looked into BePorter yet. AFAIK it does something like that for individual packages. To do it nicely for many software packages probably needs quite a bit of integration so that package dependencies are dealt with correctly etc. CU, Ingo From revol at free.fr Tue Nov 4 04:23:12 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 04 Nov 2008 04:23:12 +0100 CET Subject: [Haiku-commits] r28486 - in haiku/trunk: build/jam src/bin In-Reply-To: <20081104021124.352.2@knochen-vm.localdomain> Message-ID: <26477902065-BeMail@laptop> > > While it cleans up the sources, it also means one less thing > > available > > when cross-building... > > I'd be really nice to be able to cross build a full distro... > > at least for ppc. > > And I'm not even thinking about building packages on a Falcon :D > > I understand your concerns. It's just that stuff like M4 (or Make > BTW) > really doesn't belong to the "core" Haiku. Keeping it in the > repository > makes the source tree heavier and the build times longer. Also from > experience the ported software in our source tree tends to get quite > outdated. The two years old M4 1.4.8 we had there is even a > relatively > harmless example. Outsourcing (pun intended) this stuff to > HaikuPorts, > where the people are focussing on porting software and keeping the > ports up > to date, seems to be the best option. Yes I know, just wanted to make sure you didn't forget. > > Anyway, I can imagine a kind of meta build system for those ported > software > packages. One would simply configure what packages to build and the > build > system would download the sources, patch them (if necessary), build > (natively or cross), and spit out a gift-wrapped, ready-to-install > archive. > I haven't looked into BePorter yet. AFAIK it does something like that > for > individual packages. To do it nicely for many software packages > probably > needs quite a bit of integration so that package dependencies are > dealt > with correctly etc. Yes, that's what I tried to do with my branches/developer/mmu_man/ distro stuff, but didn't really finished. It should probably be somewhat integrated with BePorter to automatically get a known revision, apply the patch, and build the thing as part of the distribution. I still intend of looking into it someday. I actually have 2 different unfinished patches to it I didn't commit... Fran?ois. From leavengood at mail.berlios.de Tue Nov 4 07:10:19 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Tue, 4 Nov 2008 07:10:19 +0100 Subject: [Haiku-commits] r28487 - in haiku/trunk/src/add-ons/translators: exr gif hpgs ico jpeg jpeg2000 pcx ppm raw Message-ID: <200811040610.mA46AJH4008572@sheep.berlios.de> Author: leavengood Date: 2008-11-04 07:10:14 +0100 (Tue, 04 Nov 2008) New Revision: 28487 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28487&view=rev Modified: haiku/trunk/src/add-ons/translators/exr/EXRTranslator.cpp haiku/trunk/src/add-ons/translators/gif/GIFTranslator.cpp haiku/trunk/src/add-ons/translators/hpgs/HPGSTranslator.cpp haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp haiku/trunk/src/add-ons/translators/jpeg/JPEGTranslator.cpp haiku/trunk/src/add-ons/translators/jpeg2000/JPEG2000Translator.cpp haiku/trunk/src/add-ons/translators/pcx/PCXTranslator.cpp haiku/trunk/src/add-ons/translators/ppm/PPMTranslator.cpp haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp Log: Fixed #3043, which was listed as a ShowImage bug but really was a bug in several translators which used the incorrect MIME type for the base Be Bitmap Format. Please when adding translators use image/x-be-bitmap, not just x-be-bitmap. Though I suppose the if statement in ShowImage could be changed to only look for x-be-bitmap at the end of the string when filtering, I think this is the proper fix. While I was editing the translators I also made the naming more consistant by adding the translator name in parenthesis after Be Bitmap Format for those that did not have it. Modified: haiku/trunk/src/add-ons/translators/exr/EXRTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/exr/EXRTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/exr/EXRTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -34,8 +34,8 @@ B_TRANSLATOR_BITMAP, BITS_OUT_QUALITY, BITS_OUT_CAPABILITY, - "x-be-bitmap", - "Be Bitmap image" + "image/x-be-bitmap", + "Be Bitmap Format (EXRTranslator)" }, }; Modified: haiku/trunk/src/add-ons/translators/gif/GIFTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/gif/GIFTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/gif/GIFTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -46,13 +46,13 @@ translation_format inputFormats[] = { { GIF_TYPE, B_TRANSLATOR_BITMAP, 0.8, 0.8, "image/gif", "GIF image" }, - { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.3, 0.3, "image/x-be-bitmap", "Be Bitmap image" }, + { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.3, 0.3, "image/x-be-bitmap", "Be Bitmap Format (GIFTranslator)" }, { 0 } }; translation_format outputFormats[] = { { GIF_TYPE, B_TRANSLATOR_BITMAP, 0.8, 0.8, "image/gif", "GIF image" }, - { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.3, 0.3, "image/x-be-bitmap", "Be Bitmap image" }, + { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.3, 0.3, "image/x-be-bitmap", "Be Bitmap Format (GIFTranslator)" }, { 0 } }; @@ -156,7 +156,7 @@ outInfo->type = B_TRANSLATOR_BITMAP; outInfo->quality = 0.3; outInfo->capability = 0.3; - strcpy(outInfo->name, "Be Bitmap image"); + strcpy(outInfo->name, "Be Bitmap Format (GIFTranslator)"); strcpy(outInfo->MIME, "image/x-be-bitmap"); } return B_OK; Modified: haiku/trunk/src/add-ons/translators/hpgs/HPGSTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/hpgs/HPGSTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/hpgs/HPGSTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -60,8 +60,8 @@ B_TRANSLATOR_BITMAP, BITS_OUT_QUALITY, BITS_OUT_CAPABILITY, - "x-be-bitmap", - "Be Bitmap image" + "image/x-be-bitmap", + "Be Bitmap Format (HPGSTranslator)" }, }; Modified: haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -35,8 +35,8 @@ B_TRANSLATOR_BITMAP, BITS_IN_QUALITY, BITS_IN_CAPABILITY, - "x-be-bitmap", - "Be Bitmap image" + "images/x-be-bitmap", + "Be Bitmap Format (ICOTranslator)" }, }; @@ -55,8 +55,8 @@ B_TRANSLATOR_BITMAP, BITS_OUT_QUALITY, BITS_OUT_CAPABILITY, - "x-be-bitmap", - "Be Bitmap image" + "images/x-be-bitmap", + "Be Bitmap Format (ICOTranslator)" }, }; Modified: haiku/trunk/src/add-ons/translators/jpeg/JPEGTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg/JPEGTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/jpeg/JPEGTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -47,7 +47,7 @@ // The translation kit's native file type #define B_TRANSLATOR_BITMAP_MIME_STRING "image/x-be-bitmap" -#define B_TRANSLATOR_BITMAP_DESCRIPTION "Be Bitmap image" +#define B_TRANSLATOR_BITMAP_DESCRIPTION "Be Bitmap Format (JPEGTranslator)" // Translation Kit required globals char translatorName[] = "JPEG Images"; Modified: haiku/trunk/src/add-ons/translators/jpeg2000/JPEG2000Translator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg2000/JPEG2000Translator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/jpeg2000/JPEG2000Translator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -45,7 +45,7 @@ // The translation kit's native file type #define B_TRANSLATOR_BITMAP_MIME_STRING "image/x-be-bitmap" -#define B_TRANSLATOR_BITMAP_DESCRIPTION "Be Bitmap image" +#define B_TRANSLATOR_BITMAP_DESCRIPTION "Be Bitmap Format (JPEG2000Translator)" // Translation Kit required globals char translatorName[] = "JPEG2000 Images"; Modified: haiku/trunk/src/add-ons/translators/pcx/PCXTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/pcx/PCXTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/pcx/PCXTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -32,8 +32,8 @@ B_TRANSLATOR_BITMAP, BITS_IN_QUALITY, BITS_IN_CAPABILITY, - "x-be-bitmap", - "Be Bitmap image" + "image/x-be-bitmap", + "Be Bitmap Format (PCXTranslator)" },*/ }; @@ -52,8 +52,8 @@ B_TRANSLATOR_BITMAP, BITS_OUT_QUALITY, BITS_OUT_CAPABILITY, - "x-be-bitmap", - "Be Bitmap image" + "image/x-be-bitmap", + "Be Bitmap Format (PCXTranslator)" }, }; Modified: haiku/trunk/src/add-ons/translators/ppm/PPMTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/ppm/PPMTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/ppm/PPMTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -62,13 +62,13 @@ /* These two data arrays are a really good idea to export from Translators, but not required. */ translation_format inputFormats[] = { - { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.4, 0.8, "image/x-be-bitmap", "Be Bitmap image" }, + { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.4, 0.8, "image/x-be-bitmap", "Be Bitmap Format (PPMTranslator)" }, { PPM_TYPE, B_TRANSLATOR_BITMAP, 0.3, 0.8, "image/x-portable-pixmap", "PPM image" }, { 0, 0, 0, 0, "\0", "\0" } }; /* optional (else Identify is always called) */ translation_format outputFormats[] = { - { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.4, 0.8, "image/x-be-bitmap", "Be Bitmap image" }, + { B_TRANSLATOR_BITMAP, B_TRANSLATOR_BITMAP, 0.4, 0.8, "image/x-be-bitmap", "Be Bitmap Format (PPMTranslator)" }, { PPM_TYPE, B_TRANSLATOR_BITMAP, 0.3, 0.8, "image/x-portable-pixmap", "PPM image" }, { 0, 0, 0, 0, "\0", "\0" } }; /* optional (else Translate is called anyway) */ @@ -269,7 +269,7 @@ outInfo->type = B_TRANSLATOR_BITMAP; outInfo->quality = 0.4; /* B_TRANSLATOR_BITMAP can do alpha, at least */ outInfo->capability = 0.8; /* and we might not know many variations thereof */ - strcpy(outInfo->name, "Be Bitmap image"); + strcpy(outInfo->name, "Be Bitmap Format (PPMTranslator)"); strcpy(outInfo->MIME, "image/x-be-bitmap"); /* this is the MIME type of B_TRANSLATOR_BITMAP */ } return B_OK; Modified: haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp 2008-11-03 23:33:15 UTC (rev 28486) +++ haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) @@ -71,8 +71,8 @@ B_TRANSLATOR_BITMAP, BITS_OUT_QUALITY, BITS_OUT_CAPABILITY, - "x-be-bitmap", - "Be Bitmap image" + "image/x-be-bitmap", + "Be Bitmap Format (RAWTranslator)" }, }; From umccullough at gmail.com Tue Nov 4 08:13:18 2008 From: umccullough at gmail.com (Urias McCullough) Date: Mon, 3 Nov 2008 23:13:18 -0800 Subject: [Haiku-commits] r28487 - in haiku/trunk/src/add-ons/translators: exr gif hpgs ico jpeg jpeg2000 pcx ppm raw In-Reply-To: <200811040610.mA46AJH4008572@sheep.berlios.de> References: <200811040610.mA46AJH4008572@sheep.berlios.de> Message-ID: <1e80d8750811032313i10e11649re92f6235e7949ee7@mail.gmail.com> On Mon, Nov 3, 2008 at 10:10 PM, leavengood at BerliOS wrote: ... > Format. Please when adding translators use image/x-be-bitmap, not just ... > + "images/x-be-bitmap", > + "Be Bitmap Format (ICOTranslator)" ... > + "images/x-be-bitmap", > + "Be Bitmap Format (ICOTranslator)" It seems you've set a couple to "images/" instead of "image/" - Urias From leavengood at mail.berlios.de Tue Nov 4 08:16:53 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Tue, 4 Nov 2008 08:16:53 +0100 Subject: [Haiku-commits] r28488 - haiku/trunk/src/add-ons/translators/ico Message-ID: <200811040716.mA47GrvA006893@sheep.berlios.de> Author: leavengood Date: 2008-11-04 08:16:52 +0100 (Tue, 04 Nov 2008) New Revision: 28488 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28488&view=rev Modified: haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp Log: Fixing a typo from my last commit, thanks Urias. Modified: haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp 2008-11-04 06:10:14 UTC (rev 28487) +++ haiku/trunk/src/add-ons/translators/ico/ICOTranslator.cpp 2008-11-04 07:16:52 UTC (rev 28488) @@ -35,7 +35,7 @@ B_TRANSLATOR_BITMAP, BITS_IN_QUALITY, BITS_IN_CAPABILITY, - "images/x-be-bitmap", + "image/x-be-bitmap", "Be Bitmap Format (ICOTranslator)" }, }; @@ -55,7 +55,7 @@ B_TRANSLATOR_BITMAP, BITS_OUT_QUALITY, BITS_OUT_CAPABILITY, - "images/x-be-bitmap", + "image/x-be-bitmap", "Be Bitmap Format (ICOTranslator)" }, }; From leavengood at gmail.com Tue Nov 4 08:17:47 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Tue, 4 Nov 2008 02:17:47 -0500 Subject: [Haiku-commits] r28487 - in haiku/trunk/src/add-ons/translators: exr gif hpgs ico jpeg jpeg2000 pcx ppm raw In-Reply-To: <1e80d8750811032313i10e11649re92f6235e7949ee7@mail.gmail.com> References: <200811040610.mA46AJH4008572@sheep.berlios.de> <1e80d8750811032313i10e11649re92f6235e7949ee7@mail.gmail.com> Message-ID: On Tue, Nov 4, 2008 at 2:13 AM, Urias McCullough wrote: > > It seems you've set a couple to "images/" instead of "image/" Thanks. Fixed in r28488. Ryan From stippi at mail.berlios.de Tue Nov 4 11:54:35 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 4 Nov 2008 11:54:35 +0100 Subject: [Haiku-commits] r28489 - haiku/trunk/src/kits/interface Message-ID: <200811041054.mA4AsZ4G019904@sheep.berlios.de> Author: stippi Date: 2008-11-04 11:54:34 +0100 (Tue, 04 Nov 2008) New Revision: 28489 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28489&view=rev Modified: haiku/trunk/src/kits/interface/TextView.cpp Log: SetWordWrap() did not work when the BTextView was not (yet) attached to a window this fixes the tool tip size/layout in apps that use BubbleHelper (Beam, WonderBrush, ...). Thanks to Rene and Stefano for sending me a test application. Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2008-11-04 07:16:52 UTC (rev 28488) +++ haiku/trunk/src/kits/interface/TextView.cpp 2008-11-04 10:54:34 UTC (rev 28489) @@ -2348,28 +2348,27 @@ { if (wrap == fWrap) return; - - if (Window() != NULL) { - if (fActive) { - // hide the caret, unhilite the selection - if (fSelStart != fSelEnd) - Highlight(fSelStart, fSelEnd); - else { - _HideCaret(); - } + + bool updateOnScreen = fActive && Window() != NULL; + if (updateOnScreen) { + // hide the caret, unhilite the selection + if (fSelStart != fSelEnd) + Highlight(fSelStart, fSelEnd); + else { + _HideCaret(); } - - fWrap = wrap; - _Refresh(0, fText->Length(), true, true); - - if (fActive) { - // show the caret, hilite the selection - if (fSelStart != fSelEnd && fSelectable) - Highlight(fSelStart, fSelEnd); - else - _ShowCaret(); - } } + + fWrap = wrap; + _Refresh(0, fText->Length(), true, true); + + if (updateOnScreen) { + // show the caret, hilite the selection + if (fSelStart != fSelEnd && fSelectable) + Highlight(fSelStart, fSelEnd); + else + _ShowCaret(); + } } From jackburton at mail.berlios.de Tue Nov 4 13:53:38 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 4 Nov 2008 13:53:38 +0100 Subject: [Haiku-commits] r28490 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811041253.mA4CrcVm029858@sheep.berlios.de> Author: jackburton Date: 2008-11-04 13:53:36 +0100 (Tue, 04 Nov 2008) New Revision: 28490 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28490&view=rev Added: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp Removed: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/Jamfile Log: more work on the acpi dumper: I had to limit the amount of returned data to 200 iterations, because it seems that the acpi dumping method enters an endless loop (after the device _AMR it goes back to the parent). There are still some issues, but it's still better than now Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/Jamfile 2008-11-04 10:54:34 UTC (rev 28489) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/Jamfile 2008-11-04 12:53:36 UTC (rev 28490) @@ -188,7 +188,7 @@ acpi_busman.c acpi_module.c acpi_device.c - acpi_ns_dump.c + acpi_ns_dump.cpp : libacpi_ca.a ; Deleted: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.c Added: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 10:54:34 UTC (rev 28489) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 12:53:36 UTC (rev 28490) @@ -0,0 +1,478 @@ +/* ++++++++++ + ACPI namespace dump. + Nothing special here, just tree enumeration and type identification. ++++++ */ + +#include +#include +#include +#include +#include + +#include "acpi_priv.h" + +#include +#include + +class RingBuffer { +public: + RingBuffer(size_t size = 1024); + ~RingBuffer(); + ssize_t Read(void *buffer, size_t length); + ssize_t Write(const void *buffer, size_t length); + size_t WritableAmount() const; + size_t ReadableAmount() const; + + bool Lock(); + void Unlock(); +private: + ring_buffer *fBuffer; + sem_id fLock; +}; + + +typedef struct acpi_ns_device_info { + device_node *node; + acpi_root_info *acpi; + void *acpi_cookie; + thread_id thread; + sem_id read_sem; + RingBuffer *buffer; +} acpi_ns_device_info; + + + +// called with the buffer lock held +static bool +make_space(acpi_ns_device_info *device, size_t space) +{ + size_t available = device->buffer->WritableAmount(); + if (space <= available) + return true; + bool released = false; + do { + /*if (!released) { + released = true; + if (release_sem(device->read_sem) != B_OK) { + panic("can't release sem"); + return false; + } + }*/ + device->buffer->Unlock(); + + if (!released) { + dprintf("try to release\n"); + if (release_sem_etc(device->read_sem, 1, B_RELEASE_IF_WAITING_ONLY) == B_OK) { + dprintf("released\n"); + released = true; + } + } + snooze(10000); + + if (!device->buffer->Lock()) { + return false; + } + + } while (device->buffer->WritableAmount() < space); + + return true; +} + + +static int32 sNumCount = 0; + +static void +dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) +{ + char result[255]; + char output[255]; + char tabs[255]; + char hid[9]; + int i; + size_t written = 0; + hid[8] = '\0'; + tabs[0] = '\0'; + for (i = 0; i < indenting; i++) { + sprintf(tabs, "%s| ", tabs); + } + sprintf(tabs, "%s|--- ", tabs); + int depth = sizeof(char) * 5 * indenting + sizeof(char); // index into result where the device name will be. + + if (atomic_add(&sNumCount, 1) >= 200) { + dprintf("above 200"); + // TODO: Without this, the function never finishes + // to dump the acpi tree, so there seems to be something + // weird with the acpi code + exit_thread(B_ERROR); + } + + void *counter = NULL; + while (device->acpi->get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) { + uint32 type = device->acpi->get_object_type(result); + sprintf(output, "%s%s", tabs, result + depth); + switch(type) { + case ACPI_TYPE_ANY: + default: + break; + case ACPI_TYPE_INTEGER: + snprintf(output, sizeof(output), "%s INTEGER", output); + break; + case ACPI_TYPE_STRING: + snprintf(output, sizeof(output), "%s STRING", output); + break; + case ACPI_TYPE_BUFFER: + snprintf(output, sizeof(output), "%s BUFFER", output); + break; + case ACPI_TYPE_PACKAGE: + snprintf(output, sizeof(output), "%s PACKAGE", output); + break; + case ACPI_TYPE_FIELD_UNIT: + snprintf(output, sizeof(output), "%s FIELD UNIT", output); + break; + case ACPI_TYPE_DEVICE: + device->acpi->get_device_hid(result, hid); + snprintf(output, sizeof(output), "%s DEVICE (%s)", output, hid); + break; + case ACPI_TYPE_EVENT: + snprintf(output, sizeof(output), "%s EVENT", output); + break; + case ACPI_TYPE_METHOD: + snprintf(output, sizeof(output), "%s METHOD", output); + break; + case ACPI_TYPE_MUTEX: + snprintf(output, sizeof(output), "%s MUTEX", output); + break; + case ACPI_TYPE_REGION: + snprintf(output, sizeof(output), "%s REGION", output); + break; + case ACPI_TYPE_POWER: + snprintf(output, sizeof(output), "%s POWER", output); + break; + case ACPI_TYPE_PROCESSOR: + snprintf(output, sizeof(output), "%s PROCESSOR", output); + break; + case ACPI_TYPE_THERMAL: + snprintf(output, sizeof(output), "%s THERMAL", output); + break; + case ACPI_TYPE_BUFFER_FIELD: + snprintf(output, sizeof(output), "%s BUFFER_FIELD", output); + break; + } + //strcat(output, "\n"); + written = 0; + RingBuffer &ringBuffer = *device->buffer; + size_t toWrite = strlen(output); + if (toWrite > 0) { + strlcat(output, "\n", sizeof(output)); + toWrite++; + if (ringBuffer.Lock()) { + if (ringBuffer.WritableAmount() < toWrite) { + //dprintf("not enough space\n"); + if (!make_space(device, toWrite)) { + panic("couldn't make space"); + exit_thread(0); + } + } + + if (ringBuffer.WritableAmount() < toWrite) + panic("fuck!!!"); + written = ringBuffer.Write(output, toWrite); + //dprintf("written %ld bytes\n", written); + ringBuffer.Unlock(); + } + + dump_acpi_namespace(device, result, indenting + 1); + } + + } + //dprintf("Reached end of devices, root %s, counter %p\n", root, counter); + //panic("reached end of device!!!"); +} + + +static int32 +acpi_namespace_dump(void *arg) +{ + acpi_ns_device_info *device = (acpi_ns_device_info*)(arg); + dprintf("**** start dumping ****\n"); + dump_acpi_namespace(device, NULL, 0); + dprintf("**** finished dumping. Writing last line ****\n"); + if (device->buffer->Lock()) { + size_t writable = device->buffer->WritableAmount(); + if (writable < 1) + make_space(device, 1); + device->buffer->Unlock(); + } + + if (device->buffer->Lock()) { + device->buffer->Write("\n", 1); + device->buffer->Unlock(); + } + + dprintf("written. exiting\n"); + return 0; +} + +extern "C" { +/* ---------- + acpi_namespace_open - handle open() calls +----- */ + +static status_t +acpi_namespace_open(void *_cookie, const char* path, int flags, void** cookie) +{ + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; + + dprintf("\nacpi_ns_dump: device_open\n"); + + *cookie = device; + + RingBuffer *ringBuffer = new RingBuffer(1024); + if (ringBuffer == NULL) + return B_NO_MEMORY; + + device->read_sem = create_sem(0, "read_sem"); + + device->thread = spawn_kernel_thread(acpi_namespace_dump, "acpi dumper", + B_NORMAL_PRIORITY, device); + if (device->thread < 0) { + delete ringBuffer; + return device->thread; + } + + device->buffer = ringBuffer; + sNumCount = 0; + resume_thread(device->thread); + return B_OK; +} + + +/* ---------- + acpi_namespace_read - handle read() calls +----- */ +static status_t +acpi_namespace_read(void *_cookie, off_t position, void *buf, size_t* num_bytes) +{ + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; + size_t bytesRead = 0; + size_t readable = 0; + //dprintf("acpi_namespace_read(cookie: %p, position: %lld, buffer: %p, size: %ld)\n", + // _cookie, position, buf, *num_bytes); + + RingBuffer &ringBuffer = *device->buffer; + + if (ringBuffer.Lock()) { + readable = ringBuffer.ReadableAmount(); + + //dprintf("%ld bytes readable\n", readable); + if (readable <= 0) { + //dprintf("acquiring read sem...\n"); + ringBuffer.Unlock(); + status_t status = acquire_sem_etc(device->read_sem, 1, B_CAN_INTERRUPT, 0); + if (status < B_OK) { + //dprintf("read: acquire_sem returned %s\n", strerror(status)); + *num_bytes = 0; + return status; + } + //dprintf("read sem acquired\n"); + if (!ringBuffer.Lock()) { + dprintf("read: couldn't acquire lock. bailing\n"); + *num_bytes = 0; + return B_ERROR; + } + } + + //dprintf("readable %ld\n", ringBuffer.ReadableAmount()); + bytesRead = ringBuffer.Read(buf, *num_bytes); + ringBuffer.Unlock(); + } + + //dprintf("read: read %ld bytes\n", bytesRead); + if (bytesRead < 0) { + *num_bytes = 0; + return bytesRead; + } + + *num_bytes = bytesRead; + + return B_OK; +} + + +/* ---------- + acpi_namespace_write - handle write() calls +----- */ + +static status_t +acpi_namespace_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes) +{ + dprintf("acpi_ns_dump: device_write\n"); + *num_bytes = 0; /* tell caller nothing was written */ + return B_IO_ERROR; +} + + +/* ---------- + acpi_namespace_control - handle ioctl calls +----- */ + +static status_t +acpi_namespace_control(void* cookie, uint32 op, void* arg, size_t len) +{ + dprintf("acpi_ns_dump: device_control\n"); + return B_BAD_VALUE; +} + + +/* ---------- + acpi_namespace_close - handle close() calls +----- */ + +static status_t +acpi_namespace_close(void* cookie) +{ + status_t status; + acpi_ns_device_info *device = (acpi_ns_device_info *)cookie; + dprintf("acpi_ns_dump: device_close\n"); + if (device->read_sem >= 0) + delete_sem(device->read_sem); + + kill_thread(device->thread); + + delete device->buffer; + + return B_OK; +} + + +/* ----- + acpi_namespace_free - called after the last device is closed, and after + all i/o is complete. +----- */ +static status_t +acpi_namespace_free(void* cookie) +{ + dprintf("acpi_ns_dump: device_free\n"); + + return B_OK; +} + + +// #pragma mark - device module API + + +static status_t +acpi_namespace_init_device(void *_cookie, void **cookie) +{ + device_node *node = (device_node *)_cookie; + status_t err; + + acpi_ns_device_info *device = (acpi_ns_device_info *)calloc(1, sizeof(*device)); + if (device == NULL) + return B_NO_MEMORY; + + device->node = node; + err = gDeviceManager->get_driver(node, (driver_module_info **)&device->acpi, + (void **)&device->acpi_cookie); + if (err != B_OK) { + free(device); + return err; + } + + *cookie = device; + return B_OK; +} + + +static void +acpi_namespace_uninit_device(void *_cookie) +{ + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; + free(device); +} + +} + +struct device_module_info acpi_ns_dump_module = { + { + ACPI_NS_DUMP_DEVICE_MODULE_NAME, + 0, + NULL + }, + + acpi_namespace_init_device, + acpi_namespace_uninit_device, + NULL, + + acpi_namespace_open, + acpi_namespace_close, + acpi_namespace_free, + acpi_namespace_read, + acpi_namespace_write, + NULL, + acpi_namespace_control, + + NULL, + NULL +}; + + +RingBuffer::RingBuffer(size_t size) +{ + fBuffer = create_ring_buffer(size); + fLock = create_sem(1, "ring buffer lock"); +} + + +RingBuffer::~RingBuffer() +{ + delete_sem(fLock); + delete_ring_buffer(fBuffer); +} + + +ssize_t +RingBuffer::Read(void *buffer, size_t size) +{ + return ring_buffer_read(fBuffer, (uint8*)buffer, size); +} + + +ssize_t +RingBuffer::Write(const void *buffer, size_t size) +{ + return ring_buffer_write(fBuffer, (uint8*)buffer, size); +} + + +size_t +RingBuffer::ReadableAmount() const +{ + return ring_buffer_readable(fBuffer); +} + + +size_t +RingBuffer::WritableAmount() const +{ + return ring_buffer_writable(fBuffer); +} + + +bool +RingBuffer::Lock() +{ + //status_t status = acquire_sem_etc(fLock, 1, B_CAN_INTERRUPT, 0); + status_t status = acquire_sem(fLock); + return status == B_OK; +} + + +void +RingBuffer::Unlock() +{ + release_sem(fLock); +} + + + From jackburton at mail.berlios.de Tue Nov 4 15:22:57 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 4 Nov 2008 15:22:57 +0100 Subject: [Haiku-commits] r28491 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811041422.mA4EMvRX005232@sheep.berlios.de> Author: jackburton Date: 2008-11-04 15:22:55 +0100 (Tue, 04 Nov 2008) New Revision: 28491 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28491&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp Log: found out the problem with the endless loop, or at least, worked around it: get_device_hid() was screwing the tree enumeration in some way, so I commented it out for the time being. Some snprintf -> strlcpy changes, reduced debug output Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 12:53:36 UTC (rev 28490) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 14:22:55 UTC (rev 28491) @@ -6,8 +6,8 @@ #include #include #include +#include #include -#include #include "acpi_priv.h" @@ -51,19 +51,12 @@ return true; bool released = false; do { - /*if (!released) { - released = true; - if (release_sem(device->read_sem) != B_OK) { - panic("can't release sem"); - return false; - } - }*/ device->buffer->Unlock(); if (!released) { - dprintf("try to release\n"); + //dprintf("try to release\n"); if (release_sem_etc(device->read_sem, 1, B_RELEASE_IF_WAITING_ONLY) == B_OK) { - dprintf("released\n"); + //dprintf("released\n"); released = true; } } @@ -92,28 +85,18 @@ size_t written = 0; hid[8] = '\0'; tabs[0] = '\0'; - for (i = 0; i < indenting; i++) { - sprintf(tabs, "%s| ", tabs); - } - sprintf(tabs, "%s|--- ", tabs); + for (i = 0; i < indenting; i++) + strlcat(tabs, "| ", sizeof(tabs)); + + strlcat(tabs, "|--- ", sizeof(tabs)); + int depth = sizeof(char) * 5 * indenting + sizeof(char); // index into result where the device name will be. - if (atomic_add(&sNumCount, 1) >= 200) { - dprintf("above 200"); - // TODO: Without this, the function never finishes - // to dump the acpi tree, so there seems to be something - // weird with the acpi code - exit_thread(B_ERROR); - } - void *counter = NULL; while (device->acpi->get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) { uint32 type = device->acpi->get_object_type(result); - sprintf(output, "%s%s", tabs, result + depth); + snprintf(output, sizeof(output), "%s%s", tabs, result + depth); switch(type) { - case ACPI_TYPE_ANY: - default: - break; case ACPI_TYPE_INTEGER: snprintf(output, sizeof(output), "%s INTEGER", output); break; @@ -130,7 +113,8 @@ snprintf(output, sizeof(output), "%s FIELD UNIT", output); break; case ACPI_TYPE_DEVICE: - device->acpi->get_device_hid(result, hid); + // TODO: Commented out for the time being, since it screws the outpu + //device->acpi->get_device_hid(result, hid); snprintf(output, sizeof(output), "%s DEVICE (%s)", output, hid); break; case ACPI_TYPE_EVENT: @@ -157,8 +141,10 @@ case ACPI_TYPE_BUFFER_FIELD: snprintf(output, sizeof(output), "%s BUFFER_FIELD", output); break; + case ACPI_TYPE_ANY: + default: + break; } - //strcat(output, "\n"); written = 0; RingBuffer &ringBuffer = *device->buffer; size_t toWrite = strlen(output); @@ -183,10 +169,7 @@ dump_acpi_namespace(device, result, indenting + 1); } - } - //dprintf("Reached end of devices, root %s, counter %p\n", root, counter); - //panic("reached end of device!!!"); } @@ -232,17 +215,25 @@ return B_NO_MEMORY; device->read_sem = create_sem(0, "read_sem"); + if (device->read_sem < B_OK) { + delete ringBuffer; + return device->read_sem; + } device->thread = spawn_kernel_thread(acpi_namespace_dump, "acpi dumper", B_NORMAL_PRIORITY, device); if (device->thread < 0) { delete ringBuffer; + delete_sem(device->read_sem); return device->thread; } device->buffer = ringBuffer; + sNumCount = 0; + resume_thread(device->thread); + return B_OK; } @@ -331,9 +322,9 @@ static status_t acpi_namespace_close(void* cookie) { - status_t status; acpi_ns_device_info *device = (acpi_ns_device_info *)cookie; dprintf("acpi_ns_dump: device_close\n"); + if (device->read_sem >= 0) delete_sem(device->read_sem); From jackburton at mail.berlios.de Tue Nov 4 15:27:22 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 4 Nov 2008 15:27:22 +0100 Subject: [Haiku-commits] r28492 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811041427.mA4ERMuL005403@sheep.berlios.de> Author: jackburton Date: 2008-11-04 15:27:21 +0100 (Tue, 04 Nov 2008) New Revision: 28492 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28492&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp Log: this situation should never occur anymore, and anyway, the language used wasn't really safe.... Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 14:22:55 UTC (rev 28491) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 14:27:21 UTC (rev 28492) @@ -113,7 +113,7 @@ snprintf(output, sizeof(output), "%s FIELD UNIT", output); break; case ACPI_TYPE_DEVICE: - // TODO: Commented out for the time being, since it screws the outpu + // TODO: Commented out for the time being, since it screws the output //device->acpi->get_device_hid(result, hid); snprintf(output, sizeof(output), "%s DEVICE (%s)", output, hid); break; @@ -160,8 +160,6 @@ } } - if (ringBuffer.WritableAmount() < toWrite) - panic("fuck!!!"); written = ringBuffer.Write(output, toWrite); //dprintf("written %ld bytes\n", written); ringBuffer.Unlock(); From jackburton at mail.berlios.de Tue Nov 4 15:40:31 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 4 Nov 2008 15:40:31 +0100 Subject: [Haiku-commits] r28493 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811041440.mA4EeVbT006439@sheep.berlios.de> Author: jackburton Date: 2008-11-04 15:40:30 +0100 (Tue, 04 Nov 2008) New Revision: 28493 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28493&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp Log: the last read() call would never return. Fixed. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 14:27:21 UTC (rev 28492) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 14:40:30 UTC (rev 28493) @@ -72,7 +72,6 @@ } -static int32 sNumCount = 0; static void dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) @@ -175,22 +174,18 @@ acpi_namespace_dump(void *arg) { acpi_ns_device_info *device = (acpi_ns_device_info*)(arg); - dprintf("**** start dumping ****\n"); dump_acpi_namespace(device, NULL, 0); - dprintf("**** finished dumping. Writing last line ****\n"); if (device->buffer->Lock()) { size_t writable = device->buffer->WritableAmount(); if (writable < 1) make_space(device, 1); - device->buffer->Unlock(); - } - - if (device->buffer->Lock()) { device->buffer->Write("\n", 1); device->buffer->Unlock(); } - dprintf("written. exiting\n"); + delete_sem(device->read_sem); + device->read_sem = -1; + return 0; } @@ -228,8 +223,6 @@ device->buffer = ringBuffer; - sNumCount = 0; - resume_thread(device->thread); return B_OK; @@ -258,7 +251,7 @@ //dprintf("acquiring read sem...\n"); ringBuffer.Unlock(); status_t status = acquire_sem_etc(device->read_sem, 1, B_CAN_INTERRUPT, 0); - if (status < B_OK) { + if (status == B_INTERRUPTED) { //dprintf("read: acquire_sem returned %s\n", strerror(status)); *num_bytes = 0; return status; From stippi at mail.berlios.de Tue Nov 4 15:46:01 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 4 Nov 2008 15:46:01 +0100 Subject: [Haiku-commits] r28494 - haiku/trunk/src/kits/interface Message-ID: <200811041446.mA4Ek1Fe007101@sheep.berlios.de> Author: stippi Date: 2008-11-04 15:45:58 +0100 (Tue, 04 Nov 2008) New Revision: 28494 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28494&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp Log: Fixed two more problems with BWindow::FindView(BPoint): * The function is not supposed to return hidden views. * After iterating over the child views, the "view" variable was clobbered, so it didn't work to return the current view if none of it's child views were hit. Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-11-04 14:40:30 UTC (rev 28493) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-11-04 14:45:58 UTC (rev 28494) @@ -3505,21 +3505,20 @@ BWindow::_FindView(BView* view, BPoint point) const { // point is assumed to be already in view's coordinates - // TODO: since BView::Bounds() potentially queries the app_server anyway, - // we could just let the app_server answer this query directly. - if (view->Bounds().Contains(point)) { + if (!view->IsHidden() && view->Bounds().Contains(point)) { if (!view->fFirstChild) return view; else { BView* child = view->fFirstChild; while (child != NULL) { BPoint childPoint = point - child->Frame().LeftTop(); - if ((view = _FindView(child, childPoint)) != NULL) - return view; - child = child->fNextSibling; + BView* subView = _FindView(child, childPoint); + if (subView != NULL) + return subView; + + child = child->fNextSibling; } } - return view; } return NULL; From stippi at mail.berlios.de Tue Nov 4 15:47:21 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 4 Nov 2008 15:47:21 +0100 Subject: [Haiku-commits] r28495 - in haiku/trunk/src/tests/servers/app: . find_view Message-ID: <200811041447.mA4ElLBj007193@sheep.berlios.de> Author: stippi Date: 2008-11-04 15:47:18 +0100 (Tue, 04 Nov 2008) New Revision: 28495 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28495&view=rev Added: haiku/trunk/src/tests/servers/app/find_view/ haiku/trunk/src/tests/servers/app/find_view/FindView.cpp haiku/trunk/src/tests/servers/app/find_view/Jamfile haiku/trunk/src/tests/servers/app/find_view/run Modified: haiku/trunk/src/tests/servers/app/Jamfile Log: Added test for BWindow::FindView(BPoint). Modified: haiku/trunk/src/tests/servers/app/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/Jamfile 2008-11-04 14:45:58 UTC (rev 28494) +++ haiku/trunk/src/tests/servers/app/Jamfile 2008-11-04 14:47:18 UTC (rev 28495) @@ -173,6 +173,7 @@ SubInclude HAIKU_TOP src tests servers app drawing_debugger ; SubInclude HAIKU_TOP src tests servers app drawing_modes ; SubInclude HAIKU_TOP src tests servers app event_mask ; +SubInclude HAIKU_TOP src tests servers app find_view ; SubInclude HAIKU_TOP src tests servers app following ; SubInclude HAIKU_TOP src tests servers app idle_test ; SubInclude HAIKU_TOP src tests servers app lagging_get_mouse ; Added: haiku/trunk/src/tests/servers/app/find_view/FindView.cpp =================================================================== --- haiku/trunk/src/tests/servers/app/find_view/FindView.cpp 2008-11-04 14:45:58 UTC (rev 28494) +++ haiku/trunk/src/tests/servers/app/find_view/FindView.cpp 2008-11-04 14:47:18 UTC (rev 28495) @@ -0,0 +1,83 @@ +/* + * Copyright 2008, Stephan A?mus + * Distributed under the terms of the MIT License. + */ + + +#include +#include +#include + +#include + + +class View : public BView { +public: + View(BRect rect, const char* name, uint32 followMode, + uint8 red, uint8 green, uint8 blue) + : BView(rect, name, followMode, 0) + { + SetViewColor(red, green, blue); + } +}; + + +class TestView : public View { +public: + TestView(BRect rect, const char* name, uint32 followMode, + uint8 red, uint8 green, uint8 blue) + : View(rect, name, followMode, red, green, blue) + { + SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); + } + + virtual void MouseMoved(BPoint where, uint32 transit, + const BMessage* dragMessage) + { + ConvertToScreen(&where); + where -= Window()->Frame().LeftTop(); + BView* view = Window()->FindView(where); + printf("View at (%.1f, %.1f): %s\n", where.x, where.y, + view ? view->Name() : "NULL"); + } +}; + + +// #pragma mark - + + +int +main(int argc, char **argv) +{ + BApplication app("application/x-vnd.haiku-find_view"); + + BWindow* window = new BWindow(BRect(100, 100, 400, 400), + "ViewTransit-Test", B_TITLED_WINDOW, + B_ASYNCHRONOUS_CONTROLS | B_QUIT_ON_WINDOW_CLOSE); + + // TestView + BRect frame = window->Bounds(); + View* testView = new TestView(frame, "Test View", B_FOLLOW_ALL, 255, 0, 0); + window->AddChild(testView); + + // View 1 + frame.InsetBy(20, 20); + frame.right /= 2; + View* view1 = new View(frame, "View 1", + B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT, 0, 255, 0); + testView->AddChild(view1); + + // View 2 + frame.left = frame.right + 1; + frame.right = window->Bounds().right - 20; + View* view2 = new View(frame, "View 2", + B_FOLLOW_TOP_BOTTOM | B_FOLLOW_RIGHT, 0, 0, 255); + testView->AddChild(view2); + view2->Hide(); + + + window->Show(); + + app.Run(); + return 0; +} Added: haiku/trunk/src/tests/servers/app/find_view/Jamfile =================================================================== --- haiku/trunk/src/tests/servers/app/find_view/Jamfile 2008-11-04 14:45:58 UTC (rev 28494) +++ haiku/trunk/src/tests/servers/app/find_view/Jamfile 2008-11-04 14:47:18 UTC (rev 28495) @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src tests servers app find_view ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseHeaders [ FDirName os app ] ; +UseHeaders [ FDirName os interface ] ; + +Application FindView : + FindView.cpp + : be +; + +if ( $(TARGET_PLATFORM) = libbe_test ) { + HaikuInstall install-test-apps : $(HAIKU_APP_TEST_DIR) : FindView + : tests!apps ; +} + Added: haiku/trunk/src/tests/servers/app/find_view/run =================================================================== --- haiku/trunk/src/tests/servers/app/find_view/run 2008-11-04 14:45:58 UTC (rev 28494) +++ haiku/trunk/src/tests/servers/app/find_view/run 2008-11-04 14:47:18 UTC (rev 28495) @@ -0,0 +1,18 @@ +#!/bin/sh + +../../../../../generated/tests/libbe_test/x86/apps/run_haiku_registrar || exit + +if test -f ../../../../../generated/tests/libbe_test/x86/apps/haiku_app_server; then + ../../../../../generated/tests/libbe_test/x86/apps/haiku_app_server & +else + echo "You need to \"TARGET_PLATFORM=libbe_test jam install-test-apps\" first." +fi + +sleep 1s + +if test -f ../../../../../generated/tests/libbe_test/x86/apps/FindView; then + ../../../../../generated/tests/libbe_test/x86/apps/FindView +else + echo "You need to \"TARGET_PLATFORM=libbe_test jam install-test-apps\" first." +fi + Property changes on: haiku/trunk/src/tests/servers/app/find_view/run ___________________________________________________________________ Name: svn:executable + * From anevilyak at gmail.com Tue Nov 4 15:48:20 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Tue, 4 Nov 2008 08:48:20 -0600 Subject: [Haiku-commits] r28494 - haiku/trunk/src/kits/interface In-Reply-To: <200811041446.mA4Ek1Fe007101@sheep.berlios.de> References: <200811041446.mA4Ek1Fe007101@sheep.berlios.de> Message-ID: On Tue, Nov 4, 2008 at 8:46 AM, wrote: > Modified: > haiku/trunk/src/kits/interface/Window.cpp > Log: > Fixed two more problems with BWindow::FindView(BPoint): > * The function is not supposed to return hidden views. > * After iterating over the child views, the "view" variable was clobbered, > so it didn't work to return the current view if none of it's child views > were hit. > Oops, sorry :) Those were completely my fault. Good catch! Regards, Rene From axeld at mail.berlios.de Tue Nov 4 15:49:34 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 4 Nov 2008 15:49:34 +0100 Subject: [Haiku-commits] r28496 - in haiku/trunk: headers/os/drivers headers/private/fs_shell src/system/kernel/cache src/tests/system/kernel/cache src/tools/fs_shell Message-ID: <200811041449.mA4EnYXj007363@sheep.berlios.de> Author: axeld Date: 2008-11-04 15:49:33 +0100 (Tue, 04 Nov 2008) New Revision: 28496 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28496&view=rev Added: haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp 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/tests/system/kernel/cache/Jamfile haiku/trunk/src/tools/fs_shell/block_cache.cpp Log: * Added function block_cache_discard() that flushes blocks from the block cache, discarding their changes. This functionality currently only works correctly when no transactions are used. * Started test application for the block cache, doesn't do anything yet. Modified: haiku/trunk/headers/os/drivers/fs_cache.h =================================================================== --- haiku/trunk/headers/os/drivers/fs_cache.h 2008-11-04 14:47:18 UTC (rev 28495) +++ haiku/trunk/headers/os/drivers/fs_cache.h 2008-11-04 14:49:33 UTC (rev 28496) @@ -33,70 +33,72 @@ #endif /* transactions */ -extern int32 cache_start_transaction(void *_cache); -extern status_t cache_sync_transaction(void *_cache, int32 id); -extern status_t cache_end_transaction(void *_cache, int32 id, +extern int32 cache_start_transaction(void *cache); +extern status_t cache_sync_transaction(void *cache, int32 id); +extern status_t cache_end_transaction(void *cache, int32 id, transaction_notification_hook hook, void *data); -extern status_t cache_abort_transaction(void *_cache, int32 id); -extern int32 cache_detach_sub_transaction(void *_cache, int32 id, +extern status_t cache_abort_transaction(void *cache, int32 id); +extern int32 cache_detach_sub_transaction(void *cache, int32 id, transaction_notification_hook hook, void *data); -extern status_t cache_abort_sub_transaction(void *_cache, int32 id); -extern status_t cache_start_sub_transaction(void *_cache, int32 id); -extern status_t cache_add_transaction_listener(void *_cache, int32 id, +extern status_t cache_abort_sub_transaction(void *cache, int32 id); +extern status_t cache_start_sub_transaction(void *cache, int32 id); +extern status_t cache_add_transaction_listener(void *cache, int32 id, int32 events, transaction_notification_hook hook, void *data); -extern status_t cache_remove_transaction_listener(void *_cache, int32 id, +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, +extern status_t cache_next_block_in_transaction(void *cache, int32 id, bool mainOnly, long *_cookie, off_t *_blockNumber, void **_data, void **_unchangedData); -extern int32 cache_blocks_in_transaction(void *_cache, int32 id); -extern int32 cache_blocks_in_main_transaction(void *_cache, int32 id); -extern int32 cache_blocks_in_sub_transaction(void *_cache, int32 id); +extern int32 cache_blocks_in_transaction(void *cache, int32 id); +extern int32 cache_blocks_in_main_transaction(void *cache, int32 id); +extern int32 cache_blocks_in_sub_transaction(void *cache, int32 id); /* block cache */ -extern void block_cache_delete(void *_cache, bool allowWrites); +extern void block_cache_delete(void *cache, bool allowWrites); extern void *block_cache_create(int fd, off_t numBlocks, size_t blockSize, bool readOnly); -extern status_t block_cache_sync(void *_cache); -extern status_t block_cache_sync_etc(void *_cache, off_t blockNumber, +extern status_t block_cache_sync(void *cache); +extern status_t block_cache_sync_etc(void *cache, off_t blockNumber, size_t numBlocks); -extern status_t block_cache_make_writable(void *_cache, off_t blockNumber, +extern void block_cache_discard(void *cache, off_t blockNumber, + size_t numBlocks); +extern status_t block_cache_make_writable(void *cache, off_t blockNumber, int32 transaction); -extern void *block_cache_get_writable_etc(void *_cache, off_t blockNumber, +extern void *block_cache_get_writable_etc(void *cache, off_t blockNumber, off_t base, off_t length, int32 transaction); -extern void *block_cache_get_writable(void *_cache, off_t blockNumber, +extern void *block_cache_get_writable(void *cache, off_t blockNumber, int32 transaction); -extern void *block_cache_get_empty(void *_cache, off_t blockNumber, +extern void *block_cache_get_empty(void *cache, off_t blockNumber, int32 transaction); -extern const void *block_cache_get_etc(void *_cache, off_t blockNumber, +extern const void *block_cache_get_etc(void *cache, off_t blockNumber, off_t base, off_t length); -extern const void *block_cache_get(void *_cache, off_t blockNumber); -extern status_t block_cache_set_dirty(void *_cache, off_t blockNumber, +extern const void *block_cache_get(void *cache, off_t blockNumber); +extern status_t block_cache_set_dirty(void *cache, off_t blockNumber, bool isDirty, int32 transaction); -extern void block_cache_put(void *_cache, off_t blockNumber); +extern void block_cache_put(void *cache, off_t blockNumber); /* file cache */ extern void *file_cache_create(dev_t mountID, ino_t vnodeID, off_t size); -extern void file_cache_delete(void *_cacheRef); -extern void file_cache_enable(void *_cacheRef); -extern bool file_cache_is_enabled(void *_cacheRef); -extern status_t file_cache_disable(void *_cacheRef); -extern status_t file_cache_set_size(void *_cacheRef, off_t size); -extern status_t file_cache_sync(void *_cache); +extern void file_cache_delete(void *cacheRef); +extern void file_cache_enable(void *cacheRef); +extern bool file_cache_is_enabled(void *cacheRef); +extern status_t file_cache_disable(void *cacheRef); +extern status_t file_cache_set_size(void *cacheRef, off_t size); +extern status_t file_cache_sync(void *cache); -extern status_t file_cache_read(void *_cacheRef, void *cookie, off_t offset, +extern status_t file_cache_read(void *cacheRef, void *cookie, off_t offset, void *bufferBase, size_t *_size); -extern status_t file_cache_write(void *_cacheRef, void *cookie, off_t offset, +extern status_t file_cache_write(void *cacheRef, void *cookie, off_t offset, const void *buffer, size_t *_size); /* file map */ extern void *file_map_create(dev_t mountID, ino_t vnodeID, off_t size); -extern void file_map_delete(void *_map); -extern void file_map_set_size(void *_map, off_t size); -extern void file_map_invalidate(void *_map, off_t offset, off_t size); -extern status_t file_map_set_mode(void *_map, uint32 mode); -extern status_t file_map_translate(void *_map, off_t offset, size_t size, +extern void file_map_delete(void *map); +extern void file_map_set_size(void *map, off_t size); +extern void file_map_invalidate(void *map, off_t offset, off_t size); +extern status_t file_map_set_mode(void *map, uint32 mode); +extern status_t file_map_translate(void *map, off_t offset, size_t size, struct file_io_vec *vecs, size_t *_count, size_t align); /* entry cache */ Modified: haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-11-04 14:47:18 UTC (rev 28495) +++ haiku/trunk/headers/private/fs_shell/fssh_api_wrapper.h 2008-11-04 14:49:33 UTC (rev 28496) @@ -820,6 +820,7 @@ #define block_cache_create fssh_block_cache_create #define block_cache_sync fssh_block_cache_sync #define block_cache_sync_etc fssh_block_cache_sync_etc +#define block_cache_discard fssh_block_cache_discard #define block_cache_make_writable fssh_block_cache_make_writable #define block_cache_get_writable_etc fssh_block_cache_get_writable_etc #define block_cache_get_writable fssh_block_cache_get_writable Modified: haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h =================================================================== --- haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-11-04 14:47:18 UTC (rev 28495) +++ haiku/trunk/headers/private/fs_shell/fssh_fs_cache.h 2008-11-04 14:49:33 UTC (rev 28496) @@ -70,6 +70,8 @@ extern fssh_status_t fssh_block_cache_sync(void *_cache); extern fssh_status_t fssh_block_cache_sync_etc(void *_cache, fssh_off_t blockNumber, fssh_size_t numBlocks); +extern void fssh_block_cache_discard(void *_cache, + fssh_off_t blockNumber, fssh_size_t numBlocks); extern fssh_status_t fssh_block_cache_make_writable(void *_cache, fssh_off_t blockNumber, int32_t transaction); extern void * fssh_block_cache_get_writable_etc(void *_cache, Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-04 14:47:18 UTC (rev 28495) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-04 14:49:33 UTC (rev 28496) @@ -74,6 +74,7 @@ bool is_writing : 1; bool is_dirty : 1; bool unused : 1; + bool discard : 1; cache_transaction *transaction; cache_transaction *previous_transaction; @@ -122,12 +123,13 @@ 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(); + void RemoveBlock(cached_block* block); + void FreeBlock(cached_block* block); + cached_block* NewBlock(off_t blockNumber); + void Free(void* buffer); + void* Allocate(); - static void LowMemoryHandler(void *data, uint32 resources, int32 level); + static void LowMemoryHandler(void* data, uint32 resources, int32 level); private: cached_block *_GetUnusedBlock(); @@ -909,6 +911,7 @@ block->parent_data = NULL; block->is_dirty = false; block->unused = false; + block->discard = false; #if BLOCK_CACHE_DEBUG_CHANGED block->compare = NULL; #endif @@ -918,6 +921,14 @@ void +block_cache::RemoveBlock(cached_block* block) +{ + hash_remove(hash, block); + FreeBlock(block); +} + + +void block_cache::RemoveUnusedBlocks(int32 maxAccessed, int32 count) { TRACE(("block_cache: remove up to %ld unused blocks\n", count)); @@ -932,15 +943,13 @@ block->block_number, block->accessed)); // this can only happen if no transactions are used - if (block->is_dirty) + if (block->is_dirty && !block->discard) write_cached_block(this, block, false); // remove block from lists iterator.Remove(); - hash_remove(hash, block); + RemoveBlock(block); - FreeBlock(block); - if (--count <= 0) break; } @@ -1022,17 +1031,20 @@ } if (--block->ref_count == 0 - && block->transaction == NULL - && block->previous_transaction == NULL) { - // put this block in the list of unused blocks - block->unused = true; -if (block->original_data != NULL || block->parent_data != NULL) - panic("put_cached_block(): %p (%Ld): %p, %p\n", block, block->block_number, block->original_data, block->parent_data); - cache->unused_blocks.Add(block); -// block->current_data = cache->allocator->Release(block->current_data); + && block->transaction == NULL && block->previous_transaction == NULL) { + // This block is not used anymore, and not part of any transaction + if (block->discard) { + cache->RemoveBlock(block); + } else { + // put this block in the list of unused blocks + block->unused = true; + ASSERT(block->original_data == NULL + && block->parent_data == NULL); + cache->unused_blocks.Add(block); + } } - // free some blocks according to the low memory state + // Free some blocks according to the low memory state // (if there is enough memory left, we don't free any) int32 free = 1; @@ -1111,8 +1123,7 @@ ssize_t bytesRead = read_pos(cache->fd, blockNumber * blockSize, block->current_data, blockSize); if (bytesRead < blockSize) { - hash_remove(cache->hash, block); - cache->FreeBlock(block); + cache->RemoveBlock(block); TB(Error(cache, blockNumber, "read failed", bytesRead)); FATAL(("could not read block %Ld: bytesRead: %ld, error: %s\n", @@ -1160,6 +1171,8 @@ if (block == NULL) return NULL; + block->discard = false; + // if there is no transaction support, we just return the current block if (transactionID == -1) { if (cleared) @@ -1843,8 +1856,9 @@ T(Action("sync", cache, transaction)); while (transaction->num_blocks > 0) { // sort blocks to speed up writing them back - // TODO: ideally, this should be handled by the I/O scheduler - block_list::Iterator iterator = transaction->blocks.GetIterator(); + // TODO: this should be handled by the I/O scheduler + block_list::Iterator iterator + = transaction->blocks.GetIterator(); uint32 maxCount = transaction->num_blocks; cached_block *buffer[16]; cached_block **blocks = (cached_block **)malloc(maxCount @@ -1984,6 +1998,7 @@ block->transaction_next = NULL; block->transaction = NULL; + block->discard = false; } hash_remove(cache->transaction_hash, transaction); @@ -2251,10 +2266,16 @@ else block = block->transaction_next; - if (mainOnly && transaction->has_sub_transaction) { - // find next block that the parent changed - while (block != NULL && block->parent_data == NULL) - block = block->transaction_next; + if (transaction->has_sub_transaction) { + if (mainOnly) { + // find next block that the parent changed + while (block != NULL && block->parent_data == NULL) + block = block->transaction_next; + } else { + // find next non-discarded block + while (block != NULL && block->discard) + block = block->transaction_next; + } } if (block == NULL) @@ -2427,8 +2448,6 @@ if (block == NULL) continue; - // TODO: sort blocks! - if (block->previous_transaction != NULL || (block->transaction == NULL && block->is_dirty)) { status_t status = write_cached_block(cache, block); @@ -2446,6 +2465,32 @@ } +extern "C" void +block_cache_discard(void* _cache, off_t blockNumber, size_t numBlocks) +{ + block_cache* cache = (block_cache*)_cache; + MutexLocker locker(&cache->lock); + + for (; numBlocks > 0; numBlocks--, blockNumber++) { + cached_block* block = (cached_block*)hash_lookup(cache->hash, + &blockNumber); + if (block == NULL) + continue; + + if (block->unused) { + cache->unused_blocks.Remove(block); + cache->RemoveBlock(block); + } else { + // mark them as discarded (in the current transaction only, if any) + if (block->previous_transaction != NULL) + write_cached_block(cache, block); + + block->discard = true; + } + } +} + + extern "C" status_t block_cache_make_writable(void *_cache, off_t blockNumber, int32 transaction) { Modified: haiku/trunk/src/tests/system/kernel/cache/Jamfile =================================================================== --- haiku/trunk/src/tests/system/kernel/cache/Jamfile 2008-11-04 14:47:18 UTC (rev 28495) +++ haiku/trunk/src/tests/system/kernel/cache/Jamfile 2008-11-04 14:49:33 UTC (rev 28496) @@ -1,11 +1,10 @@ SubDir HAIKU_TOP src tests system kernel cache ; +UsePrivateSystemHeaders ; +UsePrivateKernelHeaders ; + SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src system kernel cache ] ; SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src system kernel util ] ; - -UsePrivateHeaders kernel ; -UsePrivateHeaders [ FDirName kernel arch $(TARGET_ARCH) ] ; -UsePrivateHeaders [ FDirName kernel boot platform $(TARGET_BOOT_PLATFORM) ] ; UseHeaders [ FDirName $(HAIKU_TOP) src system kernel cache ] ; StdBinCommands @@ -18,6 +17,10 @@ khash.c : libkernelland_emu.so ; +SimpleTest block_cache_test : + block_cache_test.cpp + : libkernelland_emu.so ; + SimpleTest pages_io_test : pages_io_test.cpp ; Added: haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp =================================================================== --- haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp 2008-11-04 14:47:18 UTC (rev 28495) +++ haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp 2008-11-04 14:49:33 UTC (rev 28496) @@ -0,0 +1,13 @@ +/* + * Copyright 2008, Axel D?rfler, axeld at pinc-software.de. + * Distributed under the terms of the MIT License. + */ + +#include "block_cache.cpp" + + +int +main(int argc, char** argv) +{ + return 0; +} Modified: haiku/trunk/src/tools/fs_shell/block_cache.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-11-04 14:47:18 UTC (rev 28495) +++ haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-11-04 14:49:33 UTC (rev 28496) @@ -3,6 +3,7 @@ * Distributed under the terms of the MIT License. */ + #include #include @@ -73,7 +74,7 @@ bool is_writing : 1; bool is_dirty : 1; bool unused : 1; - bool unmapped : 1; + bool discard : 1; cache_transaction *transaction; cache_transaction *previous_transaction; @@ -106,6 +107,7 @@ fssh_status_t InitCheck(); void RemoveUnusedBlocks(int32_t maxAccessed = LONG_MAX, int32_t count = LONG_MAX); + void RemoveBlock(cached_block* block); void FreeBlock(cached_block *block); cached_block *NewBlock(fssh_off_t blockNumber); void Free(void *address); @@ -364,6 +366,7 @@ block->parent_data = NULL; block->is_dirty = false; block->unused = false; + block->discard = false; #ifdef DEBUG_CHANGED block->compare = NULL; #endif @@ -375,13 +378,20 @@ void +block_cache::RemoveBlock(cached_block* block) +{ + hash_remove(hash, block); + FreeBlock(block); +} + + +void block_cache::RemoveUnusedBlocks(int32_t maxAccessed, int32_t count) { TRACE(("block_cache: remove up to %ld unused blocks\n", count)); - for (block_list::Iterator it = unused_blocks.GetIterator(); - cached_block *block = it.Next();) { - + for (block_list::Iterator iterator = unused_blocks.GetIterator(); + cached_block *block = iterator.Next();) { if (maxAccessed < block->accessed) continue; @@ -393,11 +403,9 @@ write_cached_block(this, block, false); // remove block from lists - it.Remove(); - hash_remove(hash, block); + iterator.Remove(); + RemoveBlock(block); - FreeBlock(block); - if (--count <= 0) break; } @@ -426,11 +434,15 @@ #endif if (--block->ref_count == 0 - && block->transaction == NULL - && block->previous_transaction == NULL) { - // put this block in the list of unused blocks - block->unused = true; - cache->unused_blocks.Add(block); + && block->transaction == NULL && block->previous_transaction == NULL) { + // This block is not used anymore, and not part of any transaction + if (block->discard) { + cache->RemoveBlock(block); + } else { + // put this block in the list of unused blocks + block->unused = true; + cache->unused_blocks.Add(block); + } } if (cache->allocated_block_count > kMaxBlockCount) { @@ -539,6 +551,8 @@ if (block == NULL) return NULL; + block->discard = false; + // if there is no transaction support, we just return the current block if (transactionID == -1) { if (cleared) @@ -1117,10 +1131,16 @@ else block = block->transaction_next; - if (mainOnly && transaction->has_sub_transaction) { - // find next block that the parent changed - while (block != NULL && block->parent_data == NULL) - block = block->transaction_next; + if (transaction->has_sub_transaction) { + if (mainOnly) { + // find next block that the parent changed + while (block != NULL && block->parent_data == NULL) + block = block->transaction_next; + } else { + // find next non-discarded block + while (block != NULL && block->discard) + block = block->transaction_next; + } } if (block == NULL) @@ -1282,6 +1302,7 @@ &blockNumber); if (block == NULL) continue; + if (block->previous_transaction != NULL || (block->transaction == NULL && block->is_dirty)) { fssh_status_t status = write_cached_block(cache, block); @@ -1294,8 +1315,36 @@ } +void +fssh_block_cache_discard(void* _cache, fssh_off_t blockNumber, + fssh_size_t numBlocks) +{ + block_cache* cache = (block_cache*)_cache; + MutexLocker locker(&cache->lock); + + for (; numBlocks > 0; numBlocks--, blockNumber++) { + cached_block* block = (cached_block*)hash_lookup(cache->hash, + &blockNumber); + if (block == NULL) + continue; + + if (block->unused) { + cache->unused_blocks.Remove(block); + cache->RemoveBlock(block); + } else { + // mark them as discarded (in the current transaction only, if any) + if (block->previous_transaction != NULL) + write_cached_block(cache, block); + + block->discard = true; + } + } +} + + fssh_status_t -fssh_block_cache_make_writable(void *_cache, fssh_off_t blockNumber, int32_t transaction) +fssh_block_cache_make_writable(void *_cache, fssh_off_t blockNumber, + int32_t transaction) { block_cache *cache = (block_cache *)_cache; MutexLocker locker(&cache->lock); From axeld at mail.berlios.de Tue Nov 4 16:02:10 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 4 Nov 2008 16:02:10 +0100 Subject: [Haiku-commits] r28497 - haiku/trunk/src/system/kernel/cache Message-ID: <200811041502.mA4F2Ao9008588@sheep.berlios.de> Author: axeld Date: 2008-11-04 16:02:09 +0100 (Tue, 04 Nov 2008) New Revision: 28497 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28497&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * Cleanup, no functional change. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-04 14:49:33 UTC (rev 28496) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-04 15:02:09 UTC (rev 28497) @@ -58,15 +58,15 @@ typedef DoublyLinkedListLink block_link; struct cached_block { - cached_block *next; // next in hash - cached_block *transaction_next; + 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; + void* current_data; + void* original_data; + void* parent_data; #if BLOCK_CACHE_DEBUG_CHANGED - void *compare; + void* compare; #endif int32 ref_count; int32 accessed; @@ -75,11 +75,11 @@ bool is_dirty : 1; bool unused : 1; bool discard : 1; - cache_transaction *transaction; - cache_transaction *previous_transaction; + 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); + static int Compare(void* _cacheEntry, const void* _block); + static uint32 Hash(void* _cacheEntry, const void* _block, uint32 range); }; typedef DoublyLinkedList NotificationList; struct block_cache : DoublyLinkedListLinkImpl { - hash_table *hash; + hash_table* hash; mutex lock; int fd; off_t max_blocks; size_t block_size; int32 next_transaction_id; - cache_transaction *last_transaction; - hash_table *transaction_hash; + cache_transaction* last_transaction; + hash_table* transaction_hash; - object_cache *buffer_cache; + object_cache* buffer_cache; block_list unused_blocks; uint32 num_dirty_blocks; @@ -132,7 +132,7 @@ static void LowMemoryHandler(void* data, uint32 resources, int32 level); private: - cached_block *_GetUnusedBlock(); + cached_block* _GetUnusedBlock(); }; struct cache_listener; @@ -149,12 +149,12 @@ struct cache_transaction { cache_transaction(); - cache_transaction *next; + cache_transaction* next; int32 id; int32 num_blocks; int32 main_num_blocks; int32 sub_num_blocks; - cached_block *first_block; + cached_block* first_block; block_list blocks; ListenerList listeners; bool open; @@ -167,7 +167,7 @@ class Action : public AbstractTraceEntry { public: - Action(block_cache *cache, cached_block* block) + Action(block_cache* cache, cached_block* block) : fCache(cache), fBlockNumber(block->block_number), @@ -194,7 +194,7 @@ virtual const char* _Action() const = 0; private: - block_cache *fCache; + block_cache* fCache; uint64 fBlockNumber; bool fIsDirty; bool fHasOriginal; @@ -205,7 +205,7 @@ class Get : public Action { public: - Get(block_cache *cache, cached_block* block) + Get(block_cache* cache, cached_block* block) : Action(cache, block) { Initialized(); @@ -216,7 +216,7 @@ class Put : public Action { public: - Put(block_cache *cache, cached_block* block) + Put(block_cache* cache, cached_block* block) : Action(cache, block) { Initialized(); @@ -227,7 +227,7 @@ class Read : public Action { public: - Read(block_cache *cache, cached_block* block) + Read(block_cache* cache, cached_block* block) : Action(cache, block) { Initialized(); @@ -238,7 +238,7 @@ class Write : public Action { public: - Write(block_cache *cache, cached_block* block) + Write(block_cache* cache, cached_block* block) : Action(cache, block) { Initialized(); @@ -249,7 +249,7 @@ class Flush : public Action { public: - Flush(block_cache *cache, cached_block* block, bool getUnused = false) + Flush(block_cache* cache, cached_block* block, bool getUnused = false) : Action(cache, block), fGetUnused(getUnused) { @@ -265,7 +265,7 @@ class Error : public AbstractTraceEntry { public: - Error(block_cache *cache, uint64 blockNumber, const char* message, + Error(block_cache* cache, uint64 blockNumber, const char* message, status_t status = B_OK) : fCache(cache), @@ -302,8 +302,8 @@ class Action : public AbstractTraceEntry { public: - Action(const char *label, block_cache *cache, - cache_transaction *transaction) + Action(const char* label, block_cache* cache, + cache_transaction* transaction) : fCache(cache), fTransaction(transaction), @@ -335,8 +335,8 @@ class Detach : public AbstractTraceEntry { public: - Detach(block_cache *cache, cache_transaction *transaction, - cache_transaction *newTransaction) + Detach(block_cache* cache, cache_transaction* transaction, + cache_transaction* newTransaction) : fCache(cache), fTransaction(transaction), @@ -367,7 +367,7 @@ class Abort : public AbstractTraceEntry { public: - Abort(block_cache *cache, cache_transaction *transaction) + Abort(block_cache* cache, cache_transaction* transaction) : fCache(cache), fTransaction(transaction), @@ -377,9 +377,9 @@ bool isSub = transaction->has_sub_transaction; fNumBlocks = isSub ? transaction->sub_num_blocks : transaction->num_blocks; - fBlocks = (off_t *)alloc_tracing_buffer(fNumBlocks * sizeof(off_t)); + fBlocks = (off_t*)alloc_tracing_buffer(fNumBlocks * sizeof(off_t)); if (fBlocks != NULL) { - cached_block *block = transaction->first_block; + cached_block* block = transaction->first_block; for (int32 i = 0; block != NULL && i < fNumBlocks; block = block->transaction_next) { fBlocks[i++] = block->block_number; @@ -413,7 +413,7 @@ #endif -static status_t write_cached_block(block_cache *cache, cached_block *block, +static status_t write_cached_block(block_cache* cache, cached_block* block, bool deleteTransaction = true); @@ -424,7 +424,7 @@ 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; +static object_cache* sBlockCache; // #pragma mark - notifications/listener @@ -450,7 +450,7 @@ If there is no pending event anymore, it will return \c false. */ static bool -get_next_pending_event(cache_notification *notification, int32 *_event) +get_next_pending_event(cache_notification* notification, int32* _event) { for (int32 eventMask = 1; eventMask <= TRANSACTION_IDLE; eventMask <<= 1) { int32 pending = atomic_and(¬ification->events_pending, @@ -470,9 +470,9 @@ /*! Initializes the \a notification as specified. */ static void -set_notification(cache_transaction *transaction, +set_notification(cache_transaction* transaction, cache_notification ¬ification, int32 events, - transaction_notification_hook hook, void *data) + transaction_notification_hook hook, void* data) { notification.transaction_id = transaction != NULL ? transaction->id : -1; notification.events_pending = 0; @@ -487,7 +487,7 @@ when possible, or marks it for deletion if the notification is pending. */ static void -delete_notification(cache_notification *notification) +delete_notification(cache_notification* notification) { MutexLocker locker(sNotificationsLock); @@ -505,7 +505,7 @@ Triggers the notifier thread to run. */ static void -add_notification(block_cache *cache, cache_notification *notification, +add_notification(block_cache* cache, cache_notification* notification, int32 event, bool deleteNotification) { if (notification->hook == NULL) @@ -535,7 +535,7 @@ TRANSACTION_WRITTEN will be removed. */ static void -notify_transaction_listeners(block_cache *cache, cache_transaction *transaction, +notify_transaction_listeners(block_cache* cache, cache_transaction* transaction, int32 event) { T(Action("notify", cache, transaction)); @@ -545,7 +545,7 @@ ListenerList::Iterator iterator = transaction->listeners.GetIterator(); while (iterator.HasNext()) { - cache_listener *listener = iterator.Next(); + cache_listener* listener = iterator.Next(); bool remove = isClosing && !is_written_event(listener->events) || isWritten && is_written_event(listener->events); @@ -561,12 +561,12 @@ static void -flush_pending_notifications(block_cache *cache) +flush_pending_notifications(block_cache* cache) { while (true) { MutexLocker locker(sNotificationsLock); - cache_notification *notification = cache->pending_notifications.Head(); + cache_notification* notification = cache->pending_notifications.Head(); if (notification == NULL) return; @@ -606,7 +606,7 @@ DoublyLinkedList::Iterator iterator = sCaches.GetIterator(); while (iterator.HasNext()) { - block_cache *cache = iterator.Next(); + block_cache* cache = iterator.Next(); flush_pending_notifications(cache); } @@ -617,11 +617,11 @@ transaction. */ static void -remove_transaction_listeners(block_cache *cache, cache_transaction *transaction) +remove_transaction_listeners(block_cache* cache, cache_transaction* transaction) { ListenerList::Iterator iterator = transaction->listeners.GetIterator(); while (iterator.HasNext()) { - cache_listener *listener = iterator.Next(); + cache_listener* listener = iterator.Next(); iterator.Remove(); delete_notification(listener); @@ -630,12 +630,12 @@ static status_t -add_transaction_listener(block_cache *cache, cache_transaction *transaction, - int32 events, transaction_notification_hook hookFunction, void *data) +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(); + cache_listener* listener = iterator.Next(); if (listener->data == data && listener->hook == hookFunction) { // this listener already exists, just update it @@ -644,7 +644,7 @@ } } - cache_listener *listener = new(std::nothrow) cache_listener; + cache_listener* listener = new(std::nothrow) cache_listener; if (listener == NULL) return B_NO_MEMORY; @@ -669,20 +669,20 @@ static int -transaction_compare(void *_transaction, const void *_id) +transaction_compare(void* _transaction, const void* _id) { - cache_transaction *transaction = (cache_transaction *)_transaction; - const int32 *id = (const int32 *)_id; + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32* id = (const int32*)_id; return transaction->id - *id; } static uint32 -transaction_hash(void *_transaction, const void *_id, uint32 range) +transaction_hash(void* _transaction, const void* _id, uint32 range) { - cache_transaction *transaction = (cache_transaction *)_transaction; - const int32 *id = (const int32 *)_id; + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32* id = (const int32*)_id; if (transaction != NULL) return transaction->id % range; @@ -692,7 +692,7 @@ static void -delete_transaction(block_cache *cache, cache_transaction *transaction) +delete_transaction(block_cache* cache, cache_transaction* transaction) { if (cache->last_transaction == transaction) cache->last_transaction = NULL; @@ -702,10 +702,10 @@ } -static cache_transaction * -lookup_transaction(block_cache *cache, int32 id) +static cache_transaction* +lookup_transaction(block_cache* cache, int32 id) { - return (cache_transaction *)hash_lookup(cache->transaction_hash, &id); + return (cache_transaction*)hash_lookup(cache->transaction_hash, &id); } @@ -713,10 +713,10 @@ int -compare_blocks(const void *_blockA, const void *_blockB) +compare_blocks(const void* _blockA, const void* _blockB) { - cached_block *blockA = *(cached_block **)_blockA; - cached_block *blockB = *(cached_block **)_blockB; + cached_block* blockA = *(cached_block**)_blockA; + cached_block* blockB = *(cached_block**)_blockB; off_t diff = blockA->block_number - blockB->block_number; if (diff > 0) @@ -727,10 +727,10 @@ /*static*/ int -cached_block::Compare(void *_cacheEntry, const void *_block) +cached_block::Compare(void* _cacheEntry, const void* _block) { - cached_block *cacheEntry = (cached_block *)_cacheEntry; - const off_t *block = (const off_t *)_block; + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const off_t* block = (const off_t*)_block; off_t diff = cacheEntry->block_number - *block; if (diff > 0) @@ -742,10 +742,10 @@ /*static*/ uint32 -cached_block::Hash(void *_cacheEntry, const void *_block, uint32 range) +cached_block::Hash(void* _cacheEntry, const void* _block, uint32 range) { - cached_block *cacheEntry = (cached_block *)_cacheEntry; - const off_t *block = (const off_t *)_block; + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const off_t* block = (const off_t*)_block; if (cacheEntry != NULL) return cacheEntry->block_number % range; @@ -815,14 +815,14 @@ void -block_cache::Free(void *buffer) +block_cache::Free(void* buffer) { if (buffer != NULL) object_cache_free(buffer_cache, buffer); } -void * +void* block_cache::Allocate() { return object_cache_alloc(buffer_cache, 0); @@ -830,7 +830,7 @@ void -block_cache::FreeBlock(cached_block *block) +block_cache::FreeBlock(cached_block* block) { Free(block->current_data); @@ -847,13 +847,13 @@ } -cached_block * +cached_block* block_cache::_GetUnusedBlock() { TRACE(("block_cache: get unused block\n")); for (block_list::Iterator iterator = unused_blocks.GetIterator(); - cached_block *block = iterator.Next();) { + cached_block* block = iterator.Next();) { TB(Flush(this, block, true)); // this can only happen if no transactions are used if (block->is_dirty) @@ -878,10 +878,10 @@ /*! Allocates a new block for \a blockNumber, ready for use */ -cached_block * +cached_block* block_cache::NewBlock(off_t blockNumber) { - cached_block *block = (cached_block *)object_cache_alloc(sBlockCache, 0); + cached_block* block = (cached_block*)object_cache_alloc(sBlockCache, 0); if (block == NULL) { TB(Error(this, blockNumber, "allocation failed")); dprintf("block allocation failed, unused list is %sempty.\n", @@ -934,7 +934,7 @@ TRACE(("block_cache: remove up to %ld unused blocks\n", count)); for (block_list::Iterator iterator = unused_blocks.GetIterator(); - cached_block *block = iterator.Next();) { + cached_block* block = iterator.Next();) { if (maxAccessed < block->accessed) continue; @@ -957,9 +957,9 @@ void -block_cache::LowMemoryHandler(void *data, uint32 resources, int32 level) +block_cache::LowMemoryHandler(void* data, uint32 resources, int32 level) { - block_cache *cache = (block_cache *)data; + block_cache* cache = (block_cache*)data; MutexLocker locker(&cache->lock); if (!locker.IsLocked()) { @@ -1007,15 +1007,15 @@ but not necessarily the \a block it just released. */ static void -put_cached_block(block_cache *cache, cached_block *block) +put_cached_block(block_cache* cache, cached_block* block) { #if BLOCK_CACHE_DEBUG_CHANGED if (!block->is_dirty && block->compare != NULL && memcmp(block->current_data, block->compare, cache->block_size)) { dprintf("new block:\n"); - dump_block((const char *)block->current_data, 256, " "); + dump_block((const char*)block->current_data, 256, " "); dprintf("unchanged block:\n"); - dump_block((const char *)block->compare, 256, " "); + dump_block((const char*)block->compare, 256, " "); write_cached_block(cache, block); panic("block_cache: supposed to be clean block was changed!\n"); @@ -1068,14 +1068,14 @@ static void -put_cached_block(block_cache *cache, off_t blockNumber) +put_cached_block(block_cache* cache, off_t blockNumber) { if (blockNumber < 0 || blockNumber >= cache->max_blocks) { 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); + cached_block* block = (cached_block*)hash_lookup(cache->hash, &blockNumber); if (block != NULL) put_cached_block(cache, block); else { @@ -1093,8 +1093,8 @@ not already in the cache. The block you retrieve may contain random data. */ -static cached_block * -get_cached_block(block_cache *cache, off_t blockNumber, bool *_allocated, +static cached_block* +get_cached_block(block_cache* cache, off_t blockNumber, bool* _allocated, bool readBlock = true) { if (blockNumber < 0 || blockNumber >= cache->max_blocks) { @@ -1103,7 +1103,7 @@ return NULL; } - cached_block *block = (cached_block *)hash_lookup(cache->hash, + cached_block* block = (cached_block*)hash_lookup(cache->hash, &blockNumber); *_allocated = false; @@ -1153,8 +1153,8 @@ This is the only method to insert a block into a transaction. It makes sure that the previous block contents are preserved in that case. */ -static void * -get_writable_cached_block(block_cache *cache, off_t blockNumber, off_t base, +static void* +get_writable_cached_block(block_cache* cache, off_t blockNumber, off_t base, off_t length, int32 transactionID, bool cleared) { TRACE(("get_writable_cached_block(blockNumber = %Ld, transaction = %ld)\n", @@ -1166,7 +1166,7 @@ } bool allocated; - cached_block *block = get_cached_block(cache, blockNumber, &allocated, + cached_block* block = get_cached_block(cache, blockNumber, &allocated, !cleared); if (block == NULL) return NULL; @@ -1188,7 +1188,7 @@ return block->current_data; } - cache_transaction *transaction = block->transaction; + cache_transaction* transaction = block->transaction; if (transaction != NULL && transaction->id != transactionID) { // ToDo: we have to wait here until the other transaction is done. @@ -1271,13 +1271,13 @@ is \c true. */ static status_t -write_cached_block(block_cache *cache, cached_block *block, +write_cached_block(block_cache* cache, cached_block* block, bool deleteTransaction) { - cache_transaction *previous = block->previous_transaction; + cache_transaction* previous = block->previous_transaction; int32 blockSize = cache->block_size; - void *data = previous && block->original_data + void* data = previous && block->original_data ? block->original_data : block->current_data; // we first need to write back changes from previous transactions @@ -1337,7 +1337,7 @@ #if DEBUG_BLOCK_CACHE static void -dump_block(cached_block *block) +dump_block(cached_block* block) { kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c %08lx " "%08lx\n", (addr_t)block, block->block_number, @@ -1351,13 +1351,13 @@ static int -dump_cache(int argc, char **argv) +dump_cache(int argc, char** argv) { bool showTransactions = false; bool showBlocks = false; int32 i = 1; while (argv[i] != NULL && argv[i][0] == '-') { - for (char *arg = &argv[i][1]; arg[0]; arg++) { + for (char* arg = &argv[i][1]; arg[0]; arg++) { switch (arg[0]) { case 'b': showBlocks = true; @@ -1378,7 +1378,7 @@ return 0; } - block_cache *cache = (struct block_cache *)parse_expression(argv[i]); + block_cache* cache = (struct block_cache*)parse_expression(argv[i]); if (cache == NULL) { kprintf("invalid cache address\n"); return 0; @@ -1387,7 +1387,7 @@ off_t blockNumber = -1; if (i + 1 < argc) { blockNumber = parse_expression(argv[i + 1]); - cached_block *block = (cached_block *)hash_lookup(cache->hash, + cached_block* block = (cached_block*)hash_lookup(cache->hash, &blockNumber); if (block != NULL) { kprintf("BLOCK %p\n", block); @@ -1439,7 +1439,7 @@ NotificationList::Iterator iterator = cache->pending_notifications.GetIterator(); while (iterator.HasNext()) { - cache_notification *notification = iterator.Next(); + cache_notification* notification = iterator.Next(); kprintf(" %p %5lx %p - %p\n", notification, notification->events_pending, notification->hook, @@ -1454,8 +1454,8 @@ hash_iterator iterator; hash_open(cache->transaction_hash, &iterator); - cache_transaction *transaction; - while ((transaction = (cache_transaction *)hash_next( + cache_transaction* transaction; + while ((transaction = (cache_transaction*)hash_next( cache->transaction_hash, &iterator)) != NULL) { kprintf("%p %5ld %-7s %5ld %5ld %5ld\n", transaction, transaction->id, transaction->open ? "open" : "closed", @@ -1475,8 +1475,8 @@ uint32 dirty = 0; hash_iterator iterator; hash_open(cache->hash, &iterator); - cached_block *block; - while ((block = (cached_block *)hash_next(cache->hash, &iterator)) != NULL) { + cached_block* block; + while ((block = (cached_block*)hash_next(cache->hash, &iterator)) != NULL) { if (showBlocks) dump_block(block); @@ -1496,7 +1496,7 @@ static int -dump_transaction(int argc, char **argv) +dump_transaction(int argc, char** argv) { bool showBlocks = false; int i = 1; @@ -1510,12 +1510,12 @@ return 0; } - cache_transaction *transaction = NULL; + cache_transaction* transaction = NULL; if (argc - i == 1) { - transaction = (cache_transaction *)parse_expression(argv[i]); + transaction = (cache_transaction*)parse_expression(argv[i]); } else { - block_cache *cache = (block_cache *)parse_expression(argv[i]); + block_cache* cache = (block_cache*)parse_expression(argv[i]); int32 id = parse_expression(argv[i + 1]); transaction = lookup_transaction(cache, id); if (transaction == NULL) { @@ -1539,7 +1539,7 @@ ListenerList::Iterator iterator = transaction->listeners.GetIterator(); while (iterator.HasNext()) { - cache_listener *listener = iterator.Next(); + cache_listener* listener = iterator.Next(); kprintf(" %p %5lx %p - %p\n", listener, listener->events_pending, listener->hook, listener->data); @@ -1552,7 +1552,7 @@ kprintf("address block no. current original parent refs access " "flags transact prev. trans\n"); - cached_block *block = transaction->first_block; + cached_block* block = transaction->first_block; while (block != NULL) { dump_block(block); block = block->transaction_next; @@ -1571,13 +1571,13 @@ static int -dump_caches(int argc, char **argv) +dump_caches(int argc, char** argv) { kprintf("Block caches:\n"); DoublyLinkedList::Iterator i = sCaches.GetIterator(); while (i.HasNext()) { - block_cache *cache = i.Next(); - if (cache == (block_cache *)&sMarkCache) + block_cache* cache = i.Next(); + if (cache == (block_cache*)&sMarkCache) continue; kprintf(" %p\n", cache); @@ -1595,23 +1595,23 @@ deletion state. Returns \c NULL when the end of the list is reached. */ -static block_cache * -get_next_locked_block_cache(block_cache *last) +static block_cache* +get_next_locked_block_cache(block_cache* last) { MutexLocker _(sCachesLock); - block_cache *cache; + block_cache* cache; if (last != NULL) { mutex_unlock(&last->lock); - cache = sCaches.GetNext((block_cache *)&sMarkCache); - sCaches.Remove((block_cache *)&sMarkCache); + cache = sCaches.GetNext((block_cache*)&sMarkCache); + sCaches.Remove((block_cache*)&sMarkCache); } else cache = sCaches.Head(); if (cache != NULL) { mutex_lock(&cache->lock); - sCaches.Insert(sCaches.GetNext(cache), (block_cache *)&sMarkCache); + sCaches.Insert(sCaches.GetNext(cache), (block_cache*)&sMarkCache); } return cache; @@ -1623,7 +1623,7 @@ Every two seconds, it will also write back up to 64 blocks per cache. */ static status_t -block_notifier_and_writer(void */*data*/) +block_notifier_and_writer(void* /*data*/) { const bigtime_t kTimeout = 2000000LL; bigtime_t timeout = kTimeout; @@ -1643,10 +1643,10 @@ // TODO: change this once we have an I/O scheduler timeout = kTimeout; - block_cache *cache = NULL; + block_cache* cache = NULL; while ((cache = get_next_locked_block_cache(cache)) != NULL) { const uint32 kMaxCount = 64; - cached_block *blocks[kMaxCount]; + cached_block* blocks[kMaxCount]; uint32 count = 0; if (cache->num_dirty_blocks) { @@ -1655,9 +1655,9 @@ hash_iterator iterator; hash_open(cache->hash, &iterator); - cached_block *block; + cached_block* block; while (count < kMaxCount - && (block = (cached_block *)hash_next(cache->hash, + && (block = (cached_block*)hash_next(cache->hash, &iterator)) != NULL) { if (block->is_dirty) blocks[count++] = block; @@ -1668,8 +1668,8 @@ hash_iterator iterator; hash_open(cache->transaction_hash, &iterator); - cache_transaction *transaction; - while ((transaction = (cache_transaction *)hash_next( + cache_transaction* transaction; + while ((transaction = (cache_transaction*)hash_next( cache->transaction_hash, &iterator)) != NULL && count < kMaxCount) { if (transaction->open) { @@ -1695,7 +1695,7 @@ hash_close(cache->transaction_hash, &iterator, false); } - qsort(blocks, count, sizeof(void *), &compare_blocks); + qsort(blocks, count, sizeof(void*), &compare_blocks); for (uint32 i = 0; i < count; i++) { if (write_cached_block(cache, blocks[i], true) != B_OK) @@ -1708,9 +1708,9 @@ /*! Notify function for wait_for_notifications(). */ static void -notify_sync(int32 transactionID, int32 event, void *_cache) +notify_sync(int32 transactionID, int32 event, void* _cache) { - block_cache *cache = (block_cache *)_cache; + block_cache* cache = (block_cache*)_cache; cache->condition_variable.NotifyOne(); } @@ -1721,7 +1721,7 @@ You must not hold the \a cache lock when calling this function. */ static void -wait_for_notifications(block_cache *cache) +wait_for_notifications(block_cache* cache) { if (find_thread(NULL) == sNotifierWriterThread) { // We're the notifier thread, don't wait, but flush all pending @@ -1808,9 +1808,9 @@ extern "C" int32 -cache_start_transaction(void *_cache) +cache_start_transaction(void* _cache) { - block_cache *cache = (block_cache *)_cache; + block_cache* cache = (block_cache*)_cache; MutexLocker locker(&cache->lock); if (cache->last_transaction && cache->last_transaction->open) { @@ -1818,7 +1818,7 @@ cache->last_transaction->id); } - cache_transaction *transaction = new(nothrow) cache_transaction; + cache_transaction* transaction = new(nothrow) cache_transaction; if (transaction == NULL) return B_NO_MEMORY; @@ -1835,9 +1835,9 @@ extern "C" status_t -cache_sync_transaction(void *_cache, int32 id) +cache_sync_transaction(void* _cache, int32 id) { - block_cache *cache = (block_cache *)_cache; + block_cache* cache = (block_cache*)_cache; MutexLocker locker(&cache->lock); status_t status = B_ENTRY_NOT_FOUND; @@ -1846,8 +1846,8 @@ hash_iterator iterator; hash_open(cache->transaction_hash, &iterator); - cache_transaction *transaction; - while ((transaction = (cache_transaction *)hash_next( + cache_transaction* transaction; + while ((transaction = (cache_transaction*)hash_next( cache->transaction_hash, &iterator)) != NULL) { // close all earlier transactions which haven't been closed yet @@ -1860,9 +1860,9 @@ block_list::Iterator iterator = transaction->blocks.GetIterator(); uint32 maxCount = transaction->num_blocks; - cached_block *buffer[16]; - cached_block **blocks = (cached_block **)malloc(maxCount - * sizeof(void *)); + cached_block* buffer[16]; + cached_block** blocks = (cached_block**)malloc(maxCount + * sizeof(void*)); if (blocks == NULL) { maxCount = 16; blocks = buffer; @@ -1872,7 +1872,7 @@ for (; count < maxCount && iterator.HasNext(); count++) { blocks[count] = iterator.Next(); } - qsort(blocks, count, sizeof(void *), &compare_blocks); + qsort(blocks, count, sizeof(void*), &compare_blocks); for (uint32 i = 0; i < count; i++) { status = write_cached_block(cache, blocks[i], false); @@ -1903,15 +1903,15 @@ extern "C" status_t -cache_end_transaction(void *_cache, int32 id, - transaction_notification_hook hook, void *data) +cache_end_transaction(void* _cache, int32 id, + transaction_notification_hook hook, void* data) { - block_cache *cache = (block_cache *)_cache; + block_cache* cache = (block_cache*)_cache; MutexLocker locker(&cache->lock); TRACE(("cache_end_transaction(id = %ld)\n", id)); - cache_transaction *transaction = lookup_transaction(cache, id); + cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { panic("cache_end_transaction(): invalid transaction ID\n"); return B_BAD_VALUE; @@ -1928,7 +1928,8 @@ // iterate through all blocks and free the unchanged original contents - cached_block *block = transaction->first_block, *next; + cached_block* block = transaction->first_block; + cached_block* next; for (; block != NULL; block = next) { next = block->transaction_next; @@ -1961,14 +1962,14 @@ extern "C" status_t -cache_abort_transaction(void *_cache, int32 id) +cache_abort_transaction(void* _cache, int32 id) { - block_cache *cache = (block_cache *)_cache; + block_cache* cache = (block_cache*)_cache; MutexLocker locker(&cache->lock); TRACE(("cache_abort_transaction(id = %ld)\n", id)); - cache_transaction *transaction = lookup_transaction(cache, id); + cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { panic("cache_abort_transaction(): invalid transaction ID\n"); return B_BAD_VALUE; @@ -1979,7 +1980,8 @@ // iterate through all blocks and restore their original contents - cached_block *block = transaction->first_block, *next; + cached_block* block = transaction->first_block; + cached_block* next; for (; block != NULL; block = next) { next = block->transaction_next; @@ -2012,15 +2014,15 @@ The new transaction also gets a new transaction ID. */ extern "C" int32 -cache_detach_sub_transaction(void *_cache, int32 id, - transaction_notification_hook hook, void *data) +cache_detach_sub_transaction(void* _cache, int32 id, + transaction_notification_hook hook, void* data) { - block_cache *cache = (block_cache *)_cache; + block_cache* cache = (block_cache*)_cache; MutexLocker locker(&cache->lock); TRACE(("cache_detach_sub_transaction(id = %ld)\n", id)); - cache_transaction *transaction = lookup_transaction(cache, id); + cache_transaction* transaction = lookup_transaction(cache, id); if (transaction == NULL) { panic("cache_detach_sub_transaction(): invalid transaction ID\n"); [... truncated: 411 lines follow ...] From stippi at mail.berlios.de Tue Nov 4 16:27:58 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 4 Nov 2008 16:27:58 +0100 Subject: [Haiku-commits] r28498 - haiku/trunk/src/servers/app Message-ID: <200811041527.mA4FRwxT011356@sheep.berlios.de> Author: stippi Date: 2008-11-04 16:27:56 +0100 (Tue, 04 Nov 2008) New Revision: 28498 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28498&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: * The app_server implementation of BView::GetClippingRegion() was using the wrong check to see if the view was currently visible. This fixes the problem that tool tips would popup for windows that are located on other workspaces. * Removed commented out code that is no longer needed. Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-04 15:02:09 UTC (rev 28497) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-04 15:27:56 UTC (rev 28498) @@ -1779,21 +1779,6 @@ break; fCurrentView->SetUserClipping(®ion); - -// TODO: reenable AS_VIEW_CLIP_TO_PICTURE -#if 0 - if (rootLayer && !(fCurrentView->IsHidden()) && !fWindow->InUpdate()) { - BRegion invalidRegion; - fCurrentView->GetOnScreenRegion(invalidRegion); - - // TODO: this is broken! a smaller area may be invalidated! - - fCurrentView->fParent->MarkForRebuild(invalidRegion); - fCurrentView->fParent->TriggerRebuild(); - rootLayer->MarkForRedraw(invalidRegion); - rootLayer->TriggerRedraw(); - } -#endif break; } @@ -1803,7 +1788,7 @@ // if this View is hidden, it is clear that its visible region is void. fLink.StartMessage(B_OK); - if (fCurrentView->IsHidden()) { + if (!fWindow->IsVisible() || !fCurrentView->IsVisible()) { BRegion empty; fLink.AttachRegion(empty); } else { From axeld at mail.berlios.de Tue Nov 4 16:32:02 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 4 Nov 2008 16:32:02 +0100 Subject: [Haiku-commits] r28499 - haiku/trunk/src/tests/system Message-ID: <200811041532.mA4FW2QJ011829@sheep.berlios.de> Author: axeld Date: 2008-11-04 16:32:02 +0100 (Tue, 04 Nov 2008) New Revision: 28499 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28499&view=rev Removed: haiku/trunk/src/tests/system/vm2/ Log: * No need to keep Michael's old VM stuff around. From axeld at mail.berlios.de Tue Nov 4 17:05:38 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 4 Nov 2008 17:05:38 +0100 Subject: [Haiku-commits] r28500 - haiku/trunk/src/add-ons/kernel/network/stack Message-ID: <200811041605.mA4G5cri015907@sheep.berlios.de> Author: axeld Date: 2008-11-04 17:05:38 +0100 (Tue, 04 Nov 2008) New Revision: 28500 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28500&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp Log: * Minor cleanup. Modified: haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-11-04 15:32:02 UTC (rev 28499) +++ haiku/trunk/src/add-ons/kernel/network/stack/net_socket.cpp 2008-11-04 16:05:38 UTC (rev 28500) @@ -119,16 +119,14 @@ link)); status_t status = get_domain_protocols(socket); - if (status < B_OK) - goto err2; + if (status < B_OK) { + mutex_destroy(&socket->lock); + delete socket; + return status; + } *_socket = socket; return B_OK; - -err2: - mutex_destroy(&socket->lock); - delete socket; - return status; } From jackburton at mail.berlios.de Tue Nov 4 17:27:51 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 4 Nov 2008 17:27:51 +0100 Subject: [Haiku-commits] r28501 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811041627.mA4GRp5H018209@sheep.berlios.de> Author: jackburton Date: 2008-11-04 17:27:49 +0100 (Tue, 04 Nov 2008) New Revision: 28501 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28501&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp Log: "char string[9]; string[9] = 0;" -> not nice. Enabled getting the device hid again, as it works correctly now Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-11-04 16:05:38 UTC (rev 28500) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-11-04 16:27:49 UTC (rev 28501) @@ -88,7 +88,7 @@ switch (type) { case ACPI_TYPE_DEVICE: { - char hid[9] = ""; + char hid[16] = ""; device_attr attrs[] = { // info about device { B_DEVICE_BUS, B_STRING_TYPE, { string: "acpi" }}, Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 16:05:38 UTC (rev 28500) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-04 16:27:49 UTC (rev 28501) @@ -54,17 +54,13 @@ device->buffer->Unlock(); if (!released) { - //dprintf("try to release\n"); - if (release_sem_etc(device->read_sem, 1, B_RELEASE_IF_WAITING_ONLY) == B_OK) { - //dprintf("released\n"); + if (release_sem_etc(device->read_sem, 1, B_RELEASE_IF_WAITING_ONLY) == B_OK) released = true; - } } snooze(10000); - if (!device->buffer->Lock()) { + if (!device->buffer->Lock()) return false; - } } while (device->buffer->WritableAmount() < space); @@ -77,12 +73,12 @@ dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) { char result[255]; - char output[255]; + char output[320]; char tabs[255]; - char hid[9]; + char hid[16]; int i; size_t written = 0; - hid[8] = '\0'; + hid[0] = '\0'; tabs[0] = '\0'; for (i = 0; i < indenting; i++) strlcat(tabs, "| ", sizeof(tabs)); @@ -112,8 +108,7 @@ snprintf(output, sizeof(output), "%s FIELD UNIT", output); break; case ACPI_TYPE_DEVICE: - // TODO: Commented out for the time being, since it screws the output - //device->acpi->get_device_hid(result, hid); + device->acpi->get_device_hid(result, hid); snprintf(output, sizeof(output), "%s DEVICE (%s)", output, hid); break; case ACPI_TYPE_EVENT: @@ -175,13 +170,6 @@ { acpi_ns_device_info *device = (acpi_ns_device_info*)(arg); dump_acpi_namespace(device, NULL, 0); - if (device->buffer->Lock()) { - size_t writable = device->buffer->WritableAmount(); - if (writable < 1) - make_space(device, 1); - device->buffer->Write("\n", 1); - device->buffer->Unlock(); - } delete_sem(device->read_sem); device->read_sem = -1; From axeld at mail.berlios.de Tue Nov 4 17:46:09 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 4 Nov 2008 17:46:09 +0100 Subject: [Haiku-commits] r28502 - in haiku/trunk/src/tests: add-ons/kernel kits/net/tcp_shell Message-ID: <200811041646.mA4Gk9Ow021043@sheep.berlios.de> Author: axeld Date: 2008-11-04 17:46:08 +0100 (Tue, 04 Nov 2008) New Revision: 28502 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28502&view=rev Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp haiku/trunk/src/tests/kits/net/tcp_shell/Jamfile haiku/trunk/src/tests/kits/net/tcp_shell/tcp_shell.cpp Log: * Brought libkernelland_emu.so up-to-date again. * Added Slab stubs (from tcp_shell). * Added (yet untested) support for anonymous condition variables. * Added low resource manager functions. * Allows including thread.h now. Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-11-04 16:27:49 UTC (rev 28501) +++ haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-11-04 16:46:08 UTC (rev 28502) @@ -7,8 +7,10 @@ * Axel D?rfler, axeld at pinc-software.de. */ -#include -#include +#include +#include +#include +#include #include #include @@ -21,16 +23,25 @@ #include #include -#include -#include -#include +#ifdef ASSERT +# undef ASSERT +#endif +#include +#include +#include +#include +#include +#include + #ifdef TRACE # undef TRACE #endif #define TRACE(x) //#define TRACE(x) printf x +#define RW_MAX_READERS 10000 + static const char *gModuleDirs[] = { "distro/x86.R1/beos/system/add-ons/userland", NULL @@ -848,22 +859,37 @@ } -extern "C" uint64 -parse_expression(const char* arg) +extern "C" int +send_signal_etc(pid_t thread, uint signal, uint32 flags) { - return strtoull(arg, NULL, 0); + return send_signal(thread, signal); } -extern "C" int -add_debugger_command(char *name, int (*func)(int, char **), char *desc) +extern "C" int32 +low_resource_state(uint32 resources) { + return B_NO_LOW_RESOURCE; +} + + +extern "C" void +low_resource(uint32 resource, uint64 requirements, uint32 flags, + uint32 timeout) +{ +} + + +extern "C" status_t +register_low_resource_handler(low_resource_func function, void *data, + uint32 resources, int32 priority) +{ return B_OK; } -extern "C" int -remove_debugger_command(char * name, int (*func)(int, char **)) +extern "C" status_t +unregister_low_resource_handler(low_resource_func function, void *data) { return B_OK; } @@ -1002,38 +1028,159 @@ } +// #pragma mark - Debugger + + +extern "C" uint64 +parse_expression(const char* arg) +{ + return strtoull(arg, NULL, 0); +} + + +extern "C" bool +set_debug_variable(const char* variableName, uint64 value) +{ + return true; +} + + +extern "C" bool +print_debugger_command_usage(const char* command) +{ + return true; +} + + +extern "C" status_t +add_debugger_command_etc(const char* name, debugger_command_hook func, + const char* description, const char* usage, uint32 flags) +{ + return B_OK; +} + + +extern "C" int +add_debugger_command(char *name, int (*func)(int, char **), char *desc) +{ + return B_OK; +} + + +extern "C" int +remove_debugger_command(char * name, int (*func)(int, char **)) +{ + return B_OK; +} + + +// #pragma mark - Slab allocator + + +extern "C" void * +object_cache_alloc(object_cache *cache, uint32 flags) +{ + return malloc((size_t)cache); +} + + +extern "C" void +object_cache_free(object_cache *cache, void *object) +{ + free(object); +} + + +extern "C" object_cache * +create_object_cache_etc(const char *name, size_t objectSize, + size_t alignment, size_t maxByteUsage, uint32 flags, void *cookie, + object_cache_constructor constructor, object_cache_destructor destructor, + object_cache_reclaimer reclaimer) +{ + return (object_cache*)objectSize; +} + + +extern "C" object_cache * +create_object_cache(const char *name, size_t objectSize, + size_t alignment, void *cookie, object_cache_constructor constructor, + object_cache_destructor) +{ + return (object_cache*)objectSize; +} + + +extern "C" void +delete_object_cache(object_cache *cache) +{ +} + + +extern "C" void +object_cache_get_usage(object_cache *cache, size_t *_allocatedMemory) +{ + *_allocatedMemory = 100; +} + + +// #pragma mark - Thread/scheduler functions + + +struct scheduler_ops kScheduler = { + NULL, + NULL, + NULL, + NULL, +}; +struct scheduler_ops* gScheduler = &kScheduler; + + // #pragma mark - Private locking functions int32 recursive_lock_get_recursion(recursive_lock *lock) { - thread_id thid = find_thread(NULL); + thread_id thread = find_thread(NULL); - if (lock->holder == thid) +#if !KDEBUG + if (lock->holder == thread) return lock->recursion; +#else + if (lock->lock.holder == thread) + return lock->recursion; +#endif return -1; } -status_t -recursive_lock_init(recursive_lock *lock, const char *name) +void +recursive_lock_init_etc(recursive_lock *lock, const char *name, uint32 flags) { if (lock == NULL) - return B_BAD_VALUE; + return; if (name == NULL) name = "recursive lock"; +#if !KDEBUG lock->holder = -1; +#else + lock->lock.holder = -1; +#endif lock->recursion = 0; - lock->sem = create_sem(1, name); + lock->lock.waiters = (mutex_waiter*)create_sem(1, name); - if (lock->sem >= B_OK) - return B_OK; + if ((sem_id)lock->lock.waiters < B_OK) + panic("recursive lock creation failed: %s\n", name); +} - return lock->sem; + +void +recursive_lock_init(recursive_lock *lock, const char *name) +{ + recursive_lock_init_etc(lock, name, 0); } @@ -1043,8 +1190,8 @@ if (lock == NULL) return; - delete_sem(lock->sem); - lock->sem = -1; + delete_sem((sem_id)lock->lock.waiters); + lock->lock.waiters = (mutex_waiter*)-1; } @@ -1053,13 +1200,29 @@ { thread_id thread = find_thread(NULL); +#if !KDEBUG if (thread != lock->holder) { - status_t status = acquire_sem(lock->sem); + status_t status; + do { + status = acquire_sem((sem_id)lock->lock.waiters); + } while (status == B_INTERRUPTED); if (status < B_OK) return status; lock->holder = thread; } +#else + if (thread != lock->lock.holder) { + status_t status; + do { + status = acquire_sem((sem_id)lock->lock.waiters); + } while (status == B_INTERRUPTED); + if (status < B_OK) + return status; + + lock->lock.holder = thread; + } +#endif lock->recursion++; return B_OK; } @@ -1068,12 +1231,21 @@ void recursive_lock_unlock(recursive_lock *lock) { +#if !KDEBUG if (find_thread(NULL) != lock->holder) panic("recursive_lock %p unlocked by non-holder thread!\n", lock); +#else + if (find_thread(NULL) != lock->lock.holder) + panic("recursive_lock %p unlocked by non-holder thread!\n", lock); +#endif if (--lock->recursion == 0) { +#if !KDEBUG lock->holder = -1; - release_sem_etc(lock->sem, 1, 0/*B_DO_NOT_RESCHEDULE*/); +#else + lock->lock.holder = -1; +#endif + release_sem_etc((sem_id)lock->lock.waiters, 1, 0); } } @@ -1129,19 +1301,28 @@ status_t _mutex_trylock(mutex *mutex) { - return acquire_sem_etc((sem_id)mutex->waiters, 1, B_RELATIVE_TIMEOUT, 0); + status_t status; + do { + status = acquire_sem_etc((sem_id)mutex->waiters, 1, B_RELATIVE_TIMEOUT, + 0); + } while (status == B_INTERRUPTED); + return status; } status_t _mutex_lock(mutex *mutex, bool threadsLocked) { - return acquire_sem((sem_id)mutex->waiters); + status_t status; + do { + status = acquire_sem((sem_id)mutex->waiters); + } while (status == B_INTERRUPTED); + return status; } void -_mutex_unlock(mutex *mutex) +_mutex_unlock(mutex *mutex, bool threadsLocked) { release_sem((sem_id)mutex->waiters); } @@ -1150,46 +1331,25 @@ // #pragma mark - -status_t -benaphore_init(benaphore *ben, const char *name) +void +rw_lock_init_etc(rw_lock *lock, const char *name, uint32 flags) { - if (ben == NULL || name == NULL) - return B_BAD_VALUE; + if (lock == NULL) + return; - ben->count = 1; - ben->sem = create_sem(0, name); - if (ben->sem >= B_OK) - return B_OK; + if (name == NULL) + name = "r/w lock"; - return ben->sem; + lock->waiters = (rw_lock_waiter*)create_sem(RW_MAX_READERS, name); + if ((sem_id)lock->waiters < B_OK) + panic("r/w lock \"%s\" creation failed.", name); } void -benaphore_destroy(benaphore *ben) -{ - delete_sem(ben->sem); - ben->sem = -1; -} - - -// #pragma mark - - - -status_t rw_lock_init(rw_lock *lock, const char *name) { - if (lock == NULL) - return B_BAD_VALUE; - - if (name == NULL) - name = "r/w lock"; - - lock->sem = create_sem(RW_MAX_READERS, name); - if (lock->sem >= B_OK) - return B_OK; - - return lock->sem; + rw_lock_init_etc(lock, name, 0); } @@ -1199,34 +1359,146 @@ if (lock == NULL) return; - delete_sem(lock->sem); + delete_sem((sem_id)lock->waiters); } status_t rw_lock_read_lock(rw_lock *lock) { - return acquire_sem(lock->sem); + status_t status; + do { + status = acquire_sem((sem_id)lock->waiters); + } while (status == B_INTERRUPTED); + return status; } status_t rw_lock_read_unlock(rw_lock *lock) { - return release_sem(lock->sem); + return release_sem((sem_id)lock->waiters); } status_t rw_lock_write_lock(rw_lock *lock) { - return acquire_sem_etc(lock->sem, RW_MAX_READERS, 0, 0); + status_t status; + do { + status = acquire_sem_etc((sem_id)lock->waiters, RW_MAX_READERS, 0, 0); + } while (status == B_INTERRUPTED); + return status; } status_t rw_lock_write_unlock(rw_lock *lock) { - return release_sem_etc(lock->sem, RW_MAX_READERS, 0); + return release_sem_etc((sem_id)lock->waiters, RW_MAX_READERS, 0); } + +// #pragma mark - Condition variables (anonymous only) + + +#define STATUS_ADDED 1 +#define STATUS_WAITING 2 + + +struct condition_private { + mutex lock; + sem_id wait_sem; + const void* object; +}; + + +status_t +ConditionVariableEntry::Wait(uint32 flags, bigtime_t timeout) +{ + if (fVariable == NULL) + return fWaitStatus; + + condition_private* condition = (condition_private*)fVariable->fObject; + fWaitStatus = STATUS_WAITING; + + status_t status; + do { + status = acquire_sem_etc(condition->wait_sem, 1, flags, timeout); + } while (status == B_INTERRUPTED); + + mutex_lock(&condition->lock); + + // remove entry from variable, if not done yet + if (fVariable != NULL) { + fVariable->fEntries.Remove(this); + fVariable = NULL; + } + + mutex_unlock(&condition->lock); + + return status; +} + + +inline void +ConditionVariableEntry::AddToVariable(ConditionVariable* variable) +{ + fVariable = variable; + fWaitStatus = STATUS_ADDED; + fVariable->fEntries.Add(this); +} + + +// #pragma mark - + + +void +ConditionVariable::Init(const void* object, const char* objectType) +{ + fObjectType = objectType; + new(&fEntries) EntryList; + + condition_private* condition = new condition_private; + mutex_init(&condition->lock, objectType); + condition->wait_sem = create_sem(0, "condition variable wait"); + if (condition->wait_sem < B_OK) + panic("cannot create condition variable."); + + condition->object = object; + + fObject = condition; +} + + +void +ConditionVariable::Add(ConditionVariableEntry* entry) +{ + entry->AddToVariable(this); +} + + +void +ConditionVariable::_Notify(bool all, bool threadsLocked) +{ + condition_private* condition = (condition_private*)fObject; + mutex_lock(&condition->lock); + + uint32 count = 0; + + while (ConditionVariableEntry* entry = fEntries.RemoveHead()) { + entry->fVariable = NULL; + if (entry->fWaitStatus <= 0) + continue; + + entry->fWaitStatus = B_OK; + count++; + + if (!all) + break; + } + + release_sem_etc(condition->wait_sem, count, 0); + mutex_unlock(&condition->lock); +} + Modified: haiku/trunk/src/tests/kits/net/tcp_shell/Jamfile =================================================================== --- haiku/trunk/src/tests/kits/net/tcp_shell/Jamfile 2008-11-04 16:27:49 UTC (rev 28501) +++ haiku/trunk/src/tests/kits/net/tcp_shell/Jamfile 2008-11-04 16:46:08 UTC (rev 28502) @@ -12,6 +12,7 @@ tcp_shell.cpp # stack + ancillary_data.cpp net_buffer.cpp utility.cpp @@ -37,7 +38,7 @@ ] = [ FDirName $(HAIKU_TOP) src add-ons kernel network protocols ipv4 ] ; SEARCH on [ FGristFiles - net_buffer.cpp utility.cpp + ancillary_data.cpp net_buffer.cpp utility.cpp ] = [ FDirName $(HAIKU_TOP) src add-ons kernel network stack ] ; SEARCH on [ FGristFiles Modified: haiku/trunk/src/tests/kits/net/tcp_shell/tcp_shell.cpp =================================================================== --- haiku/trunk/src/tests/kits/net/tcp_shell/tcp_shell.cpp 2008-11-04 16:27:49 UTC (rev 28501) +++ haiku/trunk/src/tests/kits/net/tcp_shell/tcp_shell.cpp 2008-11-04 16:46:08 UTC (rev 28502) @@ -61,7 +61,7 @@ struct list connected_children; struct select_sync_pool *select_pool; - benaphore lock; + mutex lock; }; @@ -141,44 +141,6 @@ } -// #pragma mark - misc kernel - - -void * -object_cache_alloc(object_cache *cache, uint32 flags) -{ - return malloc((size_t)cache); -} - - -void -object_cache_free(object_cache *cache, void *object) -{ - free(object); -} - - -object_cache * -create_object_cache(const char *name, size_t objectSize, - size_t alignment, void *cookie, object_cache_constructor constructor, - object_cache_destructor) -{ - return (object_cache*)objectSize; -} - - -void -delete_object_cache(object_cache *cache) -{ -} - - -extern "C" void -scheduler_enqueue_in_run_queue(struct thread *thread) -{ -} - - // #pragma mark - stack @@ -279,12 +241,16 @@ init_timer, set_timer, cancel_timer, + wait_for_timer, is_timer_active, + is_timer_running, dummy_is_syscall, dummy_is_restarted_syscall, dummy_store_syscall_restart_timeout, NULL, // restore_syscall_restart_timeout + + // ancillary data is not used by TCP }; @@ -305,9 +271,7 @@ socket->type = type; socket->protocol = protocol; - status_t status = benaphore_init(&socket->lock, "socket"); - if (status < B_OK) - goto err1; + mutex_init(&socket->lock, "socket"); // set defaults (may be overridden by the protocols) socket->send.buffer_size = 65535; @@ -323,7 +287,9 @@ socket->first_protocol = gTCPModule->init_protocol(socket); if (socket->first_protocol == NULL) { fprintf(stderr, "tcp_tester: cannot create protocol\n"); - goto err2; + mutex_destroy(&socket->lock); + delete socket; + return B_ERROR; } socket->first_info = gTCPModule; @@ -338,12 +304,6 @@ *_socket = socket; return B_OK; - -err2: - benaphore_destroy(&socket->lock); -err1: - delete socket; - return status; } @@ -356,7 +316,7 @@ panic("socket still has a parent!"); socket->first_info->uninit_protocol(socket->first_protocol); - benaphore_destroy(&socket->lock); + mutex_destroy(&socket->lock); delete socket; } @@ -508,7 +468,7 @@ { net_socket_private *parent = (net_socket_private *)_parent; - BenaphoreLocker locker(parent->lock); + MutexLocker locker(parent->lock); // We actually accept more pending connections to compensate for those // that never complete, and also make sure at least a single connection @@ -545,7 +505,7 @@ { net_socket_private *parent = (net_socket_private *)_parent; - benaphore_lock(&parent->lock); + mutex_lock(&parent->lock); net_socket *socket = (net_socket *)list_remove_head_item(&parent->connected_children); if (socket != NULL) { @@ -554,7 +514,7 @@ *_socket = socket; } - benaphore_unlock(&parent->lock); + mutex_unlock(&parent->lock); return socket != NULL ? B_OK : B_ENTRY_NOT_FOUND; } @@ -564,7 +524,7 @@ { net_socket_private *parent = (net_socket_private *)_parent; - BenaphoreLocker _(parent->lock); + MutexLocker _(parent->lock); ssize_t count = 0; void *item = NULL; @@ -586,7 +546,7 @@ if (backlog > 256) backlog = 256; - benaphore_lock(&socket->lock); + mutex_lock(&socket->lock); // first remove the pending connections, then the already connected ones as needed net_socket *child; @@ -603,7 +563,7 @@ } socket->max_backlog = backlog; - benaphore_unlock(&socket->lock); + mutex_unlock(&socket->lock); return B_OK; } @@ -619,12 +579,12 @@ if (parent == NULL) return B_BAD_VALUE; - benaphore_lock(&parent->lock); + mutex_lock(&parent->lock); list_remove_item(&parent->pending_children, socket); list_add_item(&parent->connected_children, socket); - benaphore_unlock(&parent->lock); + mutex_unlock(&parent->lock); return B_OK; } @@ -634,7 +594,7 @@ { net_socket_private *socket = (net_socket_private *)_socket; - benaphore_lock(&socket->lock); + mutex_lock(&socket->lock); bool notify = true; @@ -659,7 +619,7 @@ if (notify) ; - benaphore_unlock(&socket->lock); + mutex_unlock(&socket->lock); return B_OK; } From korli at mail.berlios.de Tue Nov 4 20:08:26 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 4 Nov 2008 20:08:26 +0100 Subject: [Haiku-commits] r28503 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200811041908.mA4J8QZS032282@sheep.berlios.de> Author: korli Date: 2008-11-04 20:08:26 +0100 (Tue, 04 Nov 2008) New Revision: 28503 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28503&view=rev Modified: haiku/trunk/headers/os/interface/ColorControl.h haiku/trunk/src/kits/interface/ColorControl.cpp Log: * whitespace cleanup * implemented the disabled look and color ramping Modified: haiku/trunk/headers/os/interface/ColorControl.h =================================================================== --- haiku/trunk/headers/os/interface/ColorControl.h 2008-11-04 16:46:08 UTC (rev 28502) +++ haiku/trunk/headers/os/interface/ColorControl.h 2008-11-04 19:08:26 UTC (rev 28503) @@ -91,8 +91,8 @@ void _DrawColorArea(BView* target, BRect update); void _DrawSelectors(BView* target); void _ColorRamp(BRect rect, BView* target, - rgb_color baseColor, int16 flag, - bool focused, BRect update); + rgb_color baseColor, rgb_color compColor, + int16 flag, bool focused, BRect update); BPoint _SelectorPosition(const BRect& rampRect, uint8 shade) const; BRect _PaletteSelectorFrame(uint8 colorIndex) const; BRect _RampFrame(uint8 rampIndex) const; Modified: haiku/trunk/src/kits/interface/ColorControl.cpp =================================================================== --- haiku/trunk/src/kits/interface/ColorControl.cpp 2008-11-04 16:46:08 UTC (rev 28502) +++ haiku/trunk/src/kits/interface/ColorControl.cpp 2008-11-04 19:08:26 UTC (rev 28503) @@ -6,6 +6,7 @@ * Marc Flerackers (mflerackers at androme.be) * Axel D?rfler, axeld at pinc-software.de * Alexandre Deckner, alex at zappotek.com + * J?r?me Duval */ /** BColorControl displays a palette of selectable colors. */ @@ -145,7 +146,7 @@ BRect bounds = fPaletteFrame; bounds.InsetBy(-2.0f, -2.0f); - fBitmap = new BBitmap(bounds, B_RGB32, true, false); + fBitmap = new BBitmap(bounds, B_RGB32, true, false); fOffscreenView = new BView(bounds, "off_view", 0, 0); fBitmap->Lock(); @@ -253,26 +254,26 @@ if (fSelectedPaletteColorIndex == -1 || c != c2) { //here SetValue hasn't been called by mouse tracking fSelectedPaletteColorIndex = BScreen(Window()).IndexForColor(c2); - } + } - c2 = BScreen(Window()).ColorForIndex(fSelectedPaletteColorIndex); + c2 = BScreen(Window()).ColorForIndex(fSelectedPaletteColorIndex); Invalidate(_PaletteSelectorFrame(fPreviousSelectedPaletteColorIndex)); - Invalidate(_PaletteSelectorFrame(fSelectedPaletteColorIndex)); + Invalidate(_PaletteSelectorFrame(fSelectedPaletteColorIndex)); fPreviousSelectedPaletteColorIndex = fSelectedPaletteColorIndex; - } else { + } else { float invalidateRadius = kSelectorSize/2 + kSelectorPenSize; BPoint p; if (c1.red != c2.red) { p = _SelectorPosition(_RampFrame(1), c1.red); Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, - p.x + invalidateRadius, p.y + invalidateRadius)); + p.x + invalidateRadius, p.y + invalidateRadius)); p = _SelectorPosition(_RampFrame(1), c2.red); Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, - p.x + invalidateRadius, p.y + invalidateRadius)); + p.x + invalidateRadius, p.y + invalidateRadius)); } if (c1.green != c2.green) { p = _SelectorPosition(_RampFrame(2), c1.green); @@ -281,17 +282,17 @@ p = _SelectorPosition(_RampFrame(2), c2.green); Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, - p.x + invalidateRadius, p.y + invalidateRadius)); + p.x + invalidateRadius, p.y + invalidateRadius)); } if (c1.blue != c2.blue) { p = _SelectorPosition(_RampFrame(3), c1.blue); Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, p.x + invalidateRadius, p.y + invalidateRadius)); - + p = _SelectorPosition(_RampFrame(3), c2.blue); Invalidate(BRect(p.x - invalidateRadius, p.y - invalidateRadius, - p.x + invalidateRadius, p.y + invalidateRadius)); - } + p.x + invalidateRadius, p.y + invalidateRadius)); + } } // the textcontrols have to be updated even when the color @@ -371,8 +372,8 @@ color.red = min_c(strtol(fRedText->Text(), NULL, 10), 255); color.green = min_c(strtol(fGreenText->Text(), NULL, 10), 255); color.blue = min_c(strtol(fBlueText->Text(), NULL, 10), 255); - color.alpha = 255; - + color.alpha = 255; + SetValue(color); Invoke(); break; @@ -413,69 +414,91 @@ BRegion region(update); target->ConstrainClippingRegion(®ion); - rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR), - lightenmax = tint_color(noTint, B_LIGHTEN_MAX_TINT), - darken1 = tint_color(noTint, B_DARKEN_1_TINT), - darken4 = tint_color(noTint, B_DARKEN_4_TINT); + rgb_color noTint = ui_color(B_PANEL_BACKGROUND_COLOR); + rgb_color lighten1 = tint_color(noTint, B_LIGHTEN_1_TINT); + rgb_color lightenmax = tint_color(noTint, B_LIGHTEN_MAX_TINT); + rgb_color darken1 = tint_color(noTint, B_DARKEN_1_TINT); + rgb_color darken2 = tint_color(noTint, B_DARKEN_2_TINT); + rgb_color darken4 = tint_color(noTint, B_DARKEN_4_TINT); BRect bevelRect = fPaletteFrame.InsetByCopy(-2.0,-2.0); //bevel - + + bool enabled = IsEnabled(); + // First bevel - target->SetHighColor(darken1); + if (enabled) + target->SetHighColor(darken1); + else + target->SetHighColor(noTint); target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop()); target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop()); - target->SetHighColor(lightenmax); + if (enabled) + target->SetHighColor(lightenmax); + else + target->SetHighColor(lighten1); target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom), bevelRect.RightBottom()); target->StrokeLine(bevelRect.RightBottom(), BPoint(bevelRect.right, bevelRect.top + 1.0f)); bevelRect.InsetBy(1.0f, 1.0f); // Second bevel - target->SetHighColor(darken4); + if (enabled) + target->SetHighColor(darken4); + else + target->SetHighColor(darken2); target->StrokeLine(bevelRect.LeftBottom(), bevelRect.LeftTop()); target->StrokeLine(bevelRect.LeftTop(), bevelRect.RightTop()); target->SetHighColor(noTint); target->StrokeLine(BPoint(bevelRect.left + 1.0f, bevelRect.bottom), bevelRect.RightBottom()); target->StrokeLine(bevelRect.RightBottom(), BPoint(bevelRect.right, bevelRect.top + 1.0f)); - if (fPaletteMode) { - int colBegin = max_c(0, -1 + int(update.left) / int(fCellSize)); - int colEnd = min_c(fColumns, 2 + int(update.right) / int(fCellSize)); - int rowBegin = max_c(0, -1 + int(update.top) / int(fCellSize)); - int rowEnd = min_c(fRows, 2 + int(update.bottom) / int(fCellSize)); - - //grid - target->SetHighColor(darken1); - for (int xi = 0; xi < fColumns+1; xi++){ + if (fPaletteMode) { + int colBegin = max_c(0, -1 + int(update.left) / int(fCellSize)); + int colEnd = min_c(fColumns, 2 + int(update.right) / int(fCellSize)); + int rowBegin = max_c(0, -1 + int(update.top) / int(fCellSize)); + int rowEnd = min_c(fRows, 2 + int(update.bottom) / int(fCellSize)); + + //grid + if (enabled) + target->SetHighColor(darken1); + else + target->SetHighColor(noTint); + for (int xi = 0; xi < fColumns+1; xi++) { float x = fPaletteFrame.left + float(xi) * fCellSize; - target->StrokeLine(BPoint(x, fPaletteFrame.top), BPoint(x, fPaletteFrame.bottom)); + target->StrokeLine(BPoint(x, fPaletteFrame.top), BPoint(x, fPaletteFrame.bottom)); } - for (int yi = 0; yi < fRows+1; yi++){ + for (int yi = 0; yi < fRows+1; yi++) { float y = fPaletteFrame.top + float(yi) * fCellSize; - target->StrokeLine(BPoint(fPaletteFrame.left, y), BPoint(fPaletteFrame.right, y)); - } - - //colors - for (int col = colBegin; col < colEnd; col++){ - for (int row = rowBegin; row < rowEnd; row++){ - uint8 colorIndex = row * fColumns + col; - float x = fPaletteFrame.left + col * fCellSize; + target->StrokeLine(BPoint(fPaletteFrame.left, y), BPoint(fPaletteFrame.right, y)); + } + + //colors + for (int col = colBegin; col < colEnd; col++) { + for (int row = rowBegin; row < rowEnd; row++) { + uint8 colorIndex = row * fColumns + col; + float x = fPaletteFrame.left + col * fCellSize; float y = fPaletteFrame.top + row * fCellSize; - - target->SetHighColor(system_colors()->color_list[colorIndex]); + + target->SetHighColor(system_colors()->color_list[colorIndex]); target->FillRect(BRect(x+1, y+1, x + fCellSize - 1, y + fCellSize - 1)); - } - } + } + } } else { rgb_color white = {255, 255, 255, 255}; rgb_color red = {255, 0, 0, 255}; rgb_color green = {0, 255, 0, 255}; rgb_color blue = {0, 0, 255, 255}; - - _ColorRamp(_RampFrame(0), target, white, 0, false, update); - _ColorRamp(_RampFrame(1), target, red, 0, false, update); - _ColorRamp(_RampFrame(2), target, green, 0, false, update); - _ColorRamp(_RampFrame(3), target, blue, 0, false, update); + + rgb_color compColor = {0, 0, 0, 255}; + if (!enabled) { + compColor.red = compColor.green = compColor.blue = 156; + red.red = green.green = blue.blue = 70; + white.red = white.green = white.blue = 70; + } + _ColorRamp(_RampFrame(0), target, white, compColor, 0, false, update); + _ColorRamp(_RampFrame(1), target, red, compColor, 0, false, update); + _ColorRamp(_RampFrame(2), target, green, compColor, 0, false, update); + _ColorRamp(_RampFrame(3), target, blue, compColor, 0, false, update); } ConstrainClippingRegion(NULL); @@ -489,13 +512,13 @@ rgb_color lightenmax = tint_color(noTint, B_LIGHTEN_MAX_TINT); if (fPaletteMode) { - if (fSelectedPaletteColorIndex != -1) { + if (fSelectedPaletteColorIndex != -1) { target->SetHighColor(lightenmax); target->StrokeRect(_PaletteSelectorFrame(fSelectedPaletteColorIndex)); - } + } } else { - rgb_color color = ValueAsColor(); - target->SetPenSize(kSelectorPenSize); + rgb_color color = ValueAsColor(); + target->SetPenSize(kSelectorPenSize); target->SetHighColor(255, 255, 255); target->StrokeEllipse(_SelectorPosition(_RampFrame(1), color.red), @@ -505,14 +528,14 @@ target->StrokeEllipse(_SelectorPosition(_RampFrame(3), color.blue), kSelectorSize / 2, kSelectorSize / 2); - target->SetPenSize(1.0f); + target->SetPenSize(1.0f); } } void BColorControl::_ColorRamp(BRect rect, BView* target, - rgb_color baseColor, int16 flag, bool focused, BRect update) + rgb_color baseColor, rgb_color compColor, int16 flag, bool focused, BRect update) { float width = rect.Width() + 1; rgb_color color; @@ -524,12 +547,11 @@ target->BeginLineArray((int32)update.Width() + 1); for (float i = (update.left - rect.left); i <= (update.right - rect.left) + 1; i++) { - color.red = (uint8)(i * baseColor.red / width); - color.green = (uint8)(i * baseColor.green / width); - color.blue = (uint8)(i * baseColor.blue / width); - + color.red = (uint8)(i * baseColor.red / width) + compColor.red; + color.green = (uint8)(i * baseColor.green / width) + compColor.green; + color.blue = (uint8)(i * baseColor.blue / width) + compColor.blue; target->AddLine(BPoint(rect.left + i, rect.top), - BPoint(rect.left + i, rect.bottom - 1), color); + BPoint(rect.left + i, rect.bottom - 1), color); } target->EndLineArray(); @@ -574,7 +596,7 @@ void BColorControl::_InitOffscreen() { - if (fBitmap->Lock()) { + if (fBitmap->Lock()) { _DrawColorArea(fOffscreenView, fPaletteFrame.InsetByCopy(-2.0f,-2.0f)); fOffscreenView->Sync(); fBitmap->Unlock(); @@ -680,20 +702,20 @@ if (!fPaletteFrame.Contains(point)) return; - if (fPaletteMode) { - int column = (int) ( (point.x - fPaletteFrame.left) / fCellSize ); + if (fPaletteMode) { + int column = (int) ( (point.x - fPaletteFrame.left) / fCellSize ); int row = (int) ( (point.y - fPaletteFrame.top) / fCellSize ); - int colorIndex = row * fColumns + column; - if (colorIndex >= 0 && colorIndex < 256) { - fSelectedPaletteColorIndex = colorIndex; - SetValue(system_colors()->color_list[colorIndex]); - } + int colorIndex = row * fColumns + column; + if (colorIndex >= 0 && colorIndex < 256) { + fSelectedPaletteColorIndex = colorIndex; + SetValue(system_colors()->color_list[colorIndex]); + } } else { rgb_color color = ValueAsColor(); uint8 shade = (unsigned char)max_c(0, - min_c((point.x - _RampFrame(0).left) * 255 / _RampFrame(0).Width(), 255)); - + min_c((point.x - _RampFrame(0).left) * 255 / _RampFrame(0).Width(), 255)); + if (_RampFrame(0).Contains(point)) { color.red = color.green = color.blue = shade; fFocusedComponent = 1; @@ -727,16 +749,15 @@ if (!IsTracking()) return; - if (fPaletteMode && fPaletteFrame.Contains(point)) { - int column = (int) ( (point.x - fPaletteFrame.left) / fCellSize ); + if (fPaletteMode && fPaletteFrame.Contains(point)) { + int column = (int) ( (point.x - fPaletteFrame.left) / fCellSize ); int row = (int) ( (point.y - fPaletteFrame.top) / fCellSize ); - int colorIndex = row * fColumns + column; - if (colorIndex >= 0 && colorIndex < 256) { - fSelectedPaletteColorIndex = colorIndex; - SetValue(system_colors()->color_list[colorIndex]); - } - - } else { + int colorIndex = row * fColumns + column; + if (colorIndex >= 0 && colorIndex < 256) { + fSelectedPaletteColorIndex = colorIndex; + SetValue(system_colors()->color_list[colorIndex]); + } + } else { if (fFocusedComponent == 0) return; @@ -781,7 +802,7 @@ { BRect rect = fPaletteFrame.InsetByCopy(-2.0,-2.0); //bevel - if (rect.Height() < fBlueText->Frame().bottom) { + if (rect.Height() < fBlueText->Frame().bottom) { // adjust the height to fit rect.bottom = fBlueText->Frame().bottom; } From korli at mail.berlios.de Tue Nov 4 21:17:03 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 4 Nov 2008 21:17:03 +0100 Subject: [Haiku-commits] r28504 - haiku/trunk/src/add-ons/opengl/mesa_software_renderer Message-ID: <200811042017.mA4KH3E1009058@sheep.berlios.de> Author: korli Date: 2008-11-04 21:17:02 +0100 (Tue, 04 Nov 2008) New Revision: 28504 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28504&view=rev Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp Log: we need to allocate more than sizeof(direct_buffer_info), we use B_PAGE_SIZE this should fix bug #3001 hopefully Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp =================================================================== --- haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2008-11-04 19:08:26 UTC (rev 28503) +++ haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2008-11-04 20:17:02 UTC (rev 28504) @@ -562,11 +562,14 @@ { BAutolock lock(fInfoLocker); if (info) { - if (!fInfo) - fInfo = new direct_buffer_info(); - memcpy(fInfo, info, sizeof(*info)); + if (!fInfo) { + // TODO size of info != sizeof(direct_buffer_info) + // see GLView.cpp in glview_direct_info::glview_direct_info() + fInfo = (direct_buffer_info *)calloc(1, B_PAGE_SIZE); + } + memcpy(fInfo, info, B_PAGE_SIZE); } else if (fInfo) { - delete fInfo; + free(fInfo); fInfo = NULL; } From korli at mail.berlios.de Tue Nov 4 21:36:58 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 4 Nov 2008 21:36:58 +0100 Subject: [Haiku-commits] r28505 - haiku/trunk/src/apps/soundrecorder Message-ID: <200811042036.mA4KawO1013329@sheep.berlios.de> Author: korli Date: 2008-11-04 21:36:57 +0100 (Tue, 04 Nov 2008) New Revision: 28505 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28505&view=rev Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp haiku/trunk/src/apps/soundrecorder/RecorderWindow.h Log: remove the length limit control, it simplifies the UI. Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-04 20:17:02 UTC (rev 28504) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-04 20:36:57 UTC (rev 28505) @@ -114,7 +114,6 @@ fStopButton = NULL; fSaveButton = NULL; fLoopButton = NULL; - fLengthControl = NULL; fInputField = NULL; fRecordNode = 0; fRecording = false; @@ -453,22 +452,6 @@ fInputField->SetDivider(fInputField->StringWidth("Input:") + 4.0f); fBottomBox->AddChild(fInputField); - // Text field for entering length to record (in seconds) - r.OffsetBy(0, 1); - r.left = r.right + 10; - r.right = frame.right - (frame.right - frame.left) / 4; - msg = new BMessage(LENGTH_CHANGED); - fLengthControl = new BTextControl(r, "Length", "Length:", "8", msg); - fLengthControl->SetDivider(fLengthControl->StringWidth("Length:") + 4.0f); - fLengthControl->SetAlignment(B_ALIGN_RIGHT, B_ALIGN_RIGHT); - fBottomBox->AddChild(fLengthControl); - - r.left += r.Width()+5; - r.right = r.left + 65; - r.bottom -= 1; - BStringView* lenUnits = new BStringView(r, "Seconds", "seconds"); - fBottomBox->AddChild(lenUnits); - fBottomBox->AddChild(fFileInfoBox); fBottomBox->Hide(); @@ -523,9 +506,6 @@ case INPUT_SELECTED: Input(message); break; - case LENGTH_CHANGED: - Length(message); - break; case SOUND_SELECTED: Selected(message); break; @@ -621,12 +601,6 @@ { // User pressed Record button fRecording = true; - int seconds = atoi(fLengthControl->Text()); - if (seconds < 1) { - ErrorAlert("record a sound that's shorter than a second", B_ERROR); - return; - } - if (fButtonState != btnPaused) { StopRecording(); return; // user is too fast on the mouse @@ -654,7 +628,7 @@ return; } // Reserve space on disk (creates fewer fragments) - err = fRecFile.SetSize(seconds * fRecordFormat.u.raw_audio.channel_count + err = fRecFile.SetSize(4 * fRecordFormat.u.raw_audio.channel_count * fRecordFormat.u.raw_audio.frame_rate * (fRecordFormat.u.raw_audio.format & 0xf)); if (err < B_OK) { ErrorAlert("record a sound that long", err); @@ -662,8 +636,6 @@ fRecEntry.Unset(); return; } - fRecLimit = (off_t)(seconds * fRecordFormat.u.raw_audio.channel_count - * fRecordFormat.u.raw_audio.frame_rate * (fRecordFormat.u.raw_audio.format & 0xf)); fRecSize = 0; fRecFile.Seek(sizeof(struct wave_struct), SEEK_SET); @@ -809,36 +781,6 @@ void -RecorderWindow::Length(BMessage * message) -{ - // User changed the Length field -- validate - const char * ptr = fLengthControl->Text(); - const char * start = ptr; - const char * anchor = ptr; - const char * end = fLengthControl->Text() + fLengthControl->TextView()->TextLength(); - while (ptr < end) { - // Remember the last start-of-character for UTF-8 compatibility - // needed in call to Select() below (which takes bytes). - if (*ptr & 0x80) { - if (*ptr & 0xc0 == 0xc0) { - anchor = ptr; - } - } - else { - anchor = ptr; - } - if (!isdigit(*ptr)) { - fLengthControl->TextView()->MakeFocus(true); - fLengthControl->TextView()->Select(anchor-start, fLengthControl->TextView()->TextLength()); - beep(); - break; - } - ptr++; - } -} - - -void RecorderWindow::Input(BMessage * message) { // User selected input from pop-up @@ -1006,7 +948,6 @@ // Close the file. fRecFile.Unset(); // No more recording going on. - fRecLimit = 0; fRecSize = 0; SetButtonState(btnPaused); fRecordButton->SetStopped(); @@ -1051,7 +992,6 @@ fForwardButton->SetEnabled((fButtonState != btnRecording) && hasSelection); fStopButton->SetEnabled(fButtonState != btnPaused); fSaveButton->SetEnabled(hasSelection && (fButtonState != btnRecording)); - fLengthControl->SetEnabled(fButtonState != btnRecording); fInputField->SetEnabled(fButtonState != btnRecording); } @@ -1217,14 +1157,9 @@ if (window->fRecording) { // Write the data to file (we don't buffer or guard file access // or anything) - if (window->fRecSize < window->fRecLimit) { - window->fRecFile.WriteAt(window->fRecSize, data, size); - window->fVUView->ComputeNextLevel(data, size); - window->fRecSize += size; - } else { - // We're done! - window->PostMessage(STOP_RECORDING); - } + window->fRecFile.WriteAt(window->fRecSize, data, size); + window->fVUView->ComputeNextLevel(data, size); + window->fRecSize += size; } } Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.h =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.h 2008-11-04 20:17:02 UTC (rev 28504) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.h 2008-11-04 20:36:57 UTC (rev 28505) @@ -30,7 +30,6 @@ class BBox; class BButton; class BCheckBox; -class BTextControl; class BMenuField; class SoundConsumer; class SoundListView; @@ -58,7 +57,6 @@ VIEW_LIST, LOOP, INPUT_SELECTED = 'cW00', // control messages - LENGTH_CHANGED, SOUND_SELECTED, STOP_PLAYING, STOP_RECORDING, @@ -84,7 +82,6 @@ VolumeSlider *fVolumeSlider; TrackSlider *fTrackSlider; UpDownButton * fUpDownButton; - BTextControl * fLengthControl; BMenuField * fInputField; SoundConsumer * fRecordNode; BSoundPlayer * fPlayer; @@ -114,7 +111,6 @@ media_format fRecordFormat; BFile fRecFile; - off_t fRecLimit; off_t fRecSize; media_node fAudioInputNode; From stippi at mail.berlios.de Tue Nov 4 21:47:57 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Tue, 4 Nov 2008 21:47:57 +0100 Subject: [Haiku-commits] r28506 - in haiku/trunk/src/apps: aboutsystem deskcalc deskcalc/mapm_4.9.5 Message-ID: <200811042047.mA4KlvpR015370@sheep.berlios.de> Author: stippi Date: 2008-11-04 21:47:41 +0100 (Tue, 04 Nov 2008) New Revision: 28506 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28506&view=rev Added: haiku/trunk/src/apps/deskcalc/mapm_4.9.5/ haiku/trunk/src/apps/deskcalc/mapm_4.9.5/README haiku/trunk/src/apps/deskcalc/mapm_4.9.5/m_apm.h haiku/trunk/src/apps/deskcalc/mapm_4.9.5/m_apm_lc.h haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm5sin.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_add.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_cpi.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_div.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_exp.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_fam.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_fft.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_flr.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_fpf.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_gcd.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_lg2.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_lg3.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_lg4.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_log.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_mul.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_pow.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_rcp.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_rnd.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_set.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapm_sin.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmasin.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmasn0.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmcbrt.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmcnst.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmfact.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmfmul.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmgues.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmhasn.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmhsin.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmipwr.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmistr.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmpwr2.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmrsin.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmsqrt.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmstck.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmutil.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmutl1.c haiku/trunk/src/apps/deskcalc/mapm_4.9.5/mapmutl2.c Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp haiku/trunk/src/apps/deskcalc/CalcView.cpp haiku/trunk/src/apps/deskcalc/DeskCalc.cpp haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp haiku/trunk/src/apps/deskcalc/ExpressionParser.h haiku/trunk/src/apps/deskcalc/Jamfile Log: Included "Mike's Arbitrary Precision Math Library" in DeskCalc (BSD style license) and rebased the ExpressionParser from double on the MAPM data type. Currently, the binary operators are not supported anymore, but the imprecise calculations were getting on my nerves. I think a lot more neat functions could now be supported, but I have not looked into it further. I also didn't dare look closer at the C code of the library, but it seems to be well tested. It's portable by all means, I guess even if the target platform has 8.3 char file names to hold the code... Luckily, the library inclused a C++ wrapper class for the data type (MAPM) which makes it fairly comfortable to use and hides the ugly C stuff and messy memory management. The result seems to be quite nice so far. Previously, I couldn't even calculate my finances without eventually getting some rounding errors. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-04 20:36:57 UTC (rev 28505) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-04 20:47:41 UTC (rev 28506) @@ -762,6 +762,12 @@ "Copyright " B_UTF8_COPYRIGHT " 1996-1997 Jeff Prosise. " "All rights reserved."); + // MAPM (Mike's Arbitrary Precision Math Library) used by DeskCalc + AddCopyrightEntry("MAPM", + "Copyright " B_UTF8_COPYRIGHT "1999-2007 Michael C. Ring. " + "All rights reserved.", + "http://tc.umn.edu/~ringx004"); + // OpenSound // AddCopyrightEntry("OpenSound", // "Copyright " B_UTF8_COPYRIGHT " 1996-2008 4Front Technologies ", Modified: haiku/trunk/src/apps/deskcalc/CalcView.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/CalcView.cpp 2008-11-04 20:36:57 UTC (rev 28505) +++ haiku/trunk/src/apps/deskcalc/CalcView.cpp 2008-11-04 20:47:41 UTC (rev 28506) @@ -774,9 +774,6 @@ void CalcView::Evaluate() { - const double EXP_SWITCH_HI = 1e12; // # digits to switch from std->exp form - const double EXP_SWITCH_LO = 1e-12; - BString expression = fExpressionTextView->Text(); if (expression.Length() == 0) { @@ -792,10 +789,8 @@ play_sound(&zimp_ref, true, false, false); } -//printf("evaluate: %s\n", expression.String()); - // evaluate expression - double value = 0.0; + BString value; try { ExpressionParser parser; @@ -807,37 +802,8 @@ return; } -//printf(" -> value: %f\n", value); - - // beautify the expression - // TODO: see if this is necessary at all - char buf[64]; - if (value == 0) { - strcpy(buf, "0"); - } else if (((value < EXP_SWITCH_HI) && (value > EXP_SWITCH_LO)) || - ((value > -EXP_SWITCH_HI) && (value < -EXP_SWITCH_LO))) { - // print in std form - sprintf(buf, "%.13f", value); - - // hack to remove surplus zeros! - if (strchr(buf, '.')) { - int32 i = strlen(buf) - 1; - for (; i > 0; i--) { - if (buf[i] == '0') - buf[i] = '\0'; - else - break; - } - if (buf[i] == '.') - buf[i] = '\0'; - } - } else { - // print in exponential form - sprintf(buf, "%e", value); - } - // render new result to display - fExpressionTextView->SetExpression(buf); + fExpressionTextView->SetExpression(value.String()); } Modified: haiku/trunk/src/apps/deskcalc/DeskCalc.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/DeskCalc.cpp 2008-11-04 20:36:57 UTC (rev 28505) +++ haiku/trunk/src/apps/deskcalc/DeskCalc.cpp 2008-11-04 20:47:41 UTC (rev 28506) @@ -33,7 +33,8 @@ try { ExpressionParser parser; - printf("%f\n", parser.Evaluate(expression.String())); + BString result = parser.Evaluate(expression.String()); + printf("%s\n", result.String()); } catch (ParseException e) { printf("%s at %ld\n", e.message.String(), e.position + 1); return 1; Modified: haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp 2008-11-04 20:36:57 UTC (rev 28505) +++ haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp 2008-11-04 20:47:41 UTC (rev 28506) @@ -12,8 +12,12 @@ #include #include +#include "m_apm.h" + #include "ExpressionParser.h" +static const int32 kMaxDigits = 64; + enum { TOKEN_IDENTIFIER = 'a', @@ -44,7 +48,7 @@ Token() : string(""), type(TOKEN_NONE), - value(0.0), + value(0), position(0) { } @@ -60,7 +64,7 @@ Token(const char* string, int32 length, int32 position, int32 type) : string(string, length), type(type), - value(0.0), + value(0), position(position) { } @@ -76,7 +80,7 @@ BString string; int32 type; - double value; + MAPM value; int32 position; }; @@ -137,23 +141,30 @@ fCurrentChar++; } int32 length = fCurrentChar - begin; - temp << "&_"; + BString test = temp; + test << "&_"; double value; char t[2]; - int32 matches = sscanf(temp.String(), "%lf&%s", &value, t); - if (matches != 2) - throw ParseException("error in constant", _CurrentPos() - length); + int32 matches = sscanf(test.String(), "%lf&%s", &value, t); + if (matches != 2) { + throw ParseException("error in constant", + _CurrentPos() - length); + } - fCurrentToken = Token(begin, length, _CurrentPos() - length, TOKEN_CONSTANT); - fCurrentToken.value = value;; + fCurrentToken = Token(begin, length, _CurrentPos() - length, + TOKEN_CONSTANT); + fCurrentToken.value = temp.String(); } else if (isalpha(*fCurrentChar)) { const char* begin = fCurrentChar; - while (*fCurrentChar != 0 && (isalpha(*fCurrentChar) || isdigit(*fCurrentChar))) + while (*fCurrentChar != 0 && (isalpha(*fCurrentChar) + || isdigit(*fCurrentChar))) { fCurrentChar++; + } int32 length = fCurrentChar - begin; - fCurrentToken = Token(begin, length, _CurrentPos() - length, TOKEN_IDENTIFIER); + fCurrentToken = Token(begin, length, _CurrentPos() - length, + TOKEN_IDENTIFIER); } else { @@ -172,7 +183,8 @@ case '&': case '|': case '~': - fCurrentToken = Token(fCurrentChar, 1, _CurrentPos(), *fCurrentChar); + fCurrentToken = Token(fCurrentChar, 1, _CurrentPos(), + *fCurrentChar); fCurrentChar++; break; @@ -215,48 +227,73 @@ } -double +BString ExpressionParser::Evaluate(const char* expressionString) { fTokenizer->SetTo(expressionString); - double value = _ParseBinary(); + MAPM value = _ParseBinary(); Token token = fTokenizer->NextToken(); if (token.type != TOKEN_END_OF_LINE) throw ParseException("parse error", token.position); - return value; + if (value == 0) + return BString("0"); + + BString result; + char* buffer = result.LockBuffer(kMaxDigits + 1); + // + 1 for the decimal point + if (buffer == NULL) + throw ParseException("out of memory", 0); + + value.toFixPtString(buffer, kMaxDigits); + + // remove surplus zeros + int32 lastChar = strlen(buffer) - 1; + if (strchr(buffer, '.')) { + while (buffer[lastChar] == '0') + lastChar--; + if (buffer[lastChar] == '.') + lastChar--; + } + result.UnlockBuffer(lastChar + 1); + + return result; } -double +MAPM ExpressionParser::_ParseBinary() { - double value = _ParseSum(); + return _ParseSum(); + // binary operation appearantly not supported by m_apm library, + // should not be too hard to implement though.... - while (true) { - Token token = fTokenizer->NextToken(); - switch (token.type) { - case TOKEN_AND: - value = (uint64)value & (uint64)_ParseSum(); - break; - case TOKEN_OR: - value = (uint64)value | (uint64)_ParseSum(); - break; - - default: - fTokenizer->RewindToken(); - return value; - } - } +// double value = _ParseSum(); +// +// while (true) { +// Token token = fTokenizer->NextToken(); +// switch (token.type) { +// case TOKEN_AND: +// value = (uint64)value & (uint64)_ParseSum(); +// break; +// case TOKEN_OR: +// value = (uint64)value | (uint64)_ParseSum(); +// break; +// +// default: +// fTokenizer->RewindToken(); +// return value; +// } +// } } -double +MAPM ExpressionParser::_ParseSum() { // TODO: check isnan()... - double value = _ParseProduct(); + MAPM value = _ParseProduct(); while (true) { Token token = fTokenizer->NextToken(); @@ -276,11 +313,11 @@ } -double +MAPM ExpressionParser::_ParseProduct() { // TODO: check isnan()... - double value = _ParsePower(); + MAPM value = _ParsePower(); while (true) { Token token = fTokenizer->NextToken(); @@ -289,17 +326,17 @@ value = value * _ParsePower(); break; case TOKEN_SLASH: { - double rhs = _ParsePower(); - if (rhs == 0.0) + MAPM rhs = _ParsePower(); + if (rhs == MAPM(0)) throw ParseException("division by zero", token.position); value = value / rhs; break; } case TOKEN_MODULO: { - double rhs = _ParsePower(); - if (rhs == 0.0) + MAPM rhs = _ParsePower(); + if (rhs == MAPM(0)) throw ParseException("modulo by zero", token.position); - value = fmod(value, rhs); + value = value % rhs; break; } @@ -311,10 +348,10 @@ } -double +MAPM ExpressionParser::_ParsePower() { - double value = _ParseUnary(); + MAPM value = _ParseUnary(); while (true) { Token token = fTokenizer->NextToken(); @@ -322,12 +359,12 @@ fTokenizer->RewindToken(); return value; } - value = pow(value, _ParseUnary()); + value.pow(_ParseUnary()); } } -double +MAPM ExpressionParser::_ParseUnary() { Token token = fTokenizer->NextToken(); @@ -339,8 +376,9 @@ return _ParseUnary(); case TOKEN_MINUS: return -_ParseUnary(); - case TOKEN_NOT: - return ~(uint64)_ParseUnary(); +// TODO: Implement ! +// case TOKEN_NOT: +// return ~(uint64)_ParseUnary(); case TOKEN_IDENTIFIER: return _ParseFunction(token); @@ -350,7 +388,7 @@ return _ParseAtom(); } - return 0.0; + return MAPM(0); } @@ -358,76 +396,96 @@ const char* name; int argumentCount; void* function; - double value; + MAPM value; }; -static const Function kFunctions[] = { - { "e", 0, NULL, M_E }, - { "pi", 0, NULL, M_PI }, - { "abs", 1, (void*)&fabs }, - { "acos", 1, (void*)&acos }, - { "asin", 1, (void*)&asin }, - { "atan", 1, (void*)&atan }, - { "atan2", 2, (void*)&atan2 }, - { "ceil", 1, (void*)&ceil }, - { "cos", 1, (void*)&cos }, - { "cosh", 1, (void*)&cosh }, - { "exp", 1, (void*)&exp }, - { "fabs", 1, (void*)&fabs }, - { "floor", 1, (void*)&floor }, - { "fmod", 2, (void*)&fmod }, - { "log", 1, (void*)&log }, - { "log10", 1, (void*)&log10 }, - { "pow", 2, (void*)&pow }, - { "sin", 1, (void*)&sin }, - { "sinh", 1, (void*)&sinh }, - { "sqrt", 1, (void*)&sqrt }, - { "tan", 1, (void*)&tan }, - { "tanh", 1, (void*)&tanh }, - { "hypot", 2, (void*)&hypot }, - - { NULL }, -}; - -double -ExpressionParser::_ParseFunction(const Token& token) +void +ExpressionParser::_InitArguments(MAPM values[], int32 argumentCount) { - const Function* function = _FindFunction(token.string.String()); - if (!function) - throw ParseException("unknown identifier", token.position); - - if (function->argumentCount == 0) - return function->value; - _EatToken(TOKEN_OPENING_BRACKET); - double values[function->argumentCount]; - for (int32 i = 0; i < function->argumentCount; i++) { + for (int32 i = 0; i < argumentCount; i++) values[i] = _ParseBinary(); - } _EatToken(TOKEN_CLOSING_BRACKET); +} + +MAPM +ExpressionParser::_ParseFunction(const Token& token) +{ + if (strcasecmp("e", token.string.String()) == 0) + return MAPM(M_E); + else if (strcasecmp("pi", token.string.String()) == 0) + return MAPM(M_PI); + // hard coded cases for different count of arguments - switch (function->argumentCount) { - case 1: - return ((double (*)(double))function->function)(values[0]); - case 2: - return ((double (*)(double, double))function->function)(values[0], - values[1]); - case 3: - return ((double (*)(double, double, double))function->function)( - values[0], values[1], values[2]); + // supports functions with 3 arguments at most - default: - throw ParseException("unsupported function argument count", - token.position); + MAPM values[3]; + + if (strcasecmp("abs", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].abs(); + } else if (strcasecmp("acos", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].acos(); + } else if (strcasecmp("asin", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].asin(); + } else if (strcasecmp("atan", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].atan(); + } else if (strcasecmp("atan2", token.string.String()) == 0) { + _InitArguments(values, 2); + return values[0].atan2(values[1]); + } else if (strcasecmp("ceil", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].ceil(); + } else if (strcasecmp("cos", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].cos(); + } else if (strcasecmp("cosh", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].cosh(); + } else if (strcasecmp("exp", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].exp(); + } else if (strcasecmp("floor", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].floor(); + } else if (strcasecmp("log", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].log(); + } else if (strcasecmp("log10", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].log10(); + } else if (strcasecmp("pow", token.string.String()) == 0) { + _InitArguments(values, 2); + return values[0].pow(values[1]); + } else if (strcasecmp("sin", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].sin(); + } else if (strcasecmp("sinh", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].sinh(); + } else if (strcasecmp("sqrt", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].sqrt(); + } else if (strcasecmp("tan", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].tan(); + } else if (strcasecmp("tanh", token.string.String()) == 0) { + _InitArguments(values, 1); + return values[0].tanh(); } + + throw ParseException("unknown identifier", token.position); } -double +MAPM ExpressionParser::_ParseAtom() { Token token = fTokenizer->NextToken(); @@ -441,7 +499,7 @@ _EatToken(TOKEN_OPENING_BRACKET); - double value = _ParseBinary(); + MAPM value = _ParseBinary(); _EatToken(TOKEN_CLOSING_BRACKET); @@ -460,15 +518,3 @@ } } - -const Function* -ExpressionParser::_FindFunction(const char* name) const -{ - for (int32 i = 0; kFunctions[i].name; i++) { - if (strcasecmp(kFunctions[i].name, name) == 0) - return &kFunctions[i]; - } - - return NULL; -} - Modified: haiku/trunk/src/apps/deskcalc/ExpressionParser.h =================================================================== --- haiku/trunk/src/apps/deskcalc/ExpressionParser.h 2008-11-04 20:36:57 UTC (rev 28505) +++ haiku/trunk/src/apps/deskcalc/ExpressionParser.h 2008-11-04 20:47:41 UTC (rev 28506) @@ -6,12 +6,13 @@ * Ingo Weinhold * Stephan A?mus */ - #ifndef EXPRESSION_PARSER_H #define EXPRESSION_PARSER_H + #include + class Tokenizer; class ParseException { @@ -34,26 +35,28 @@ struct Function; struct Token; +class MAPM; class ExpressionParser { public: ExpressionParser(); ~ExpressionParser(); - double Evaluate(const char* expressionString); + BString Evaluate(const char* expressionString); private: - double _ParseBinary(); - double _ParseSum(); - double _ParseProduct(); - double _ParsePower(); - double _ParseUnary(); - double _ParseFunction(const Token& token); - double _ParseAtom(); + MAPM _ParseBinary(); + MAPM _ParseSum(); + MAPM _ParseProduct(); + MAPM _ParsePower(); + MAPM _ParseUnary(); + void _InitArguments(MAPM values[], + int32 argumentCount); + MAPM _ParseFunction(const Token& token); + MAPM _ParseAtom(); void _EatToken(int32 type); - const Function* _FindFunction(const char* name) const; Tokenizer* fTokenizer; }; Modified: haiku/trunk/src/apps/deskcalc/Jamfile =================================================================== --- haiku/trunk/src/apps/deskcalc/Jamfile 2008-11-04 20:36:57 UTC (rev 28505) +++ haiku/trunk/src/apps/deskcalc/Jamfile 2008-11-04 20:47:41 UTC (rev 28506) @@ -2,6 +2,8 @@ SetSubDirSupportedPlatformsBeOSCompatible ; +SEARCH_SOURCE += [ FDirName $(HAIKU_TOP) src apps deskcalc mapm_4.9.5 ] ; + Application DeskCalc : CalcApplication.cpp CalcOptionsWindow.cpp @@ -11,6 +13,47 @@ ExpressionParser.cpp ExpressionTextView.cpp InputTextView.cpp + + # m_apm files + mapmhasn.c + mapmhsin.c + mapm_pow.c + mapm_log.c + mapm_lg2.c + mapm_lg4.c + mapm_exp.c + mapm_lg3.c + mapmasin.c + mapmasn0.c + mapm_sin.c + mapm5sin.c + mapmrsin.c + mapm_cpi.c + mapmsqrt.c + mapmcbrt.c + mapmgues.c + mapmfact.c + mapm_gcd.c + mapmipwr.c + mapmpwr2.c + mapm_rnd.c + mapm_flr.c + mapm_fpf.c + mapm_rcp.c + mapmstck.c + mapm_div.c + mapm_mul.c + mapmfmul.c + mapm_fft.c + mapm_add.c + mapmistr.c + mapm_set.c + mapm_fam.c + mapmutil.c + mapmutl2.c + mapmutl1.c + mapmcnst.c + : be $(TARGET_LIBSTDC++) media : DeskCalc.rdef ; Added: haiku/trunk/src/apps/deskcalc/mapm_4.9.5/README =================================================================== --- haiku/trunk/src/apps/deskcalc/mapm_4.9.5/README 2008-11-04 20:36:57 UTC (rev 28505) +++ haiku/trunk/src/apps/deskcalc/mapm_4.9.5/README 2008-11-04 20:47:41 UTC (rev 28506) @@ -0,0 +1,769 @@ +************************************************************************** + + MAPM + + Version 4.9.5 + + December 10, 2007 + + Michael C. Ring + + ringx004 at tc.umn.edu + + Latest release will be available at + http://tc.umn.edu/~ringx004 + +*************************************************************************** +* * +* Copyright (C) 1999 - 2007 Michael C. Ring * +* * +* This software is Freeware. * +* * +* Permission to use, copy, and distribute this software and its * +* documentation for any purpose with or without fee is hereby granted, * +* provided that the above copyright notice appear in all copies and * +* that both that copyright notice and this permission notice appear * +* in supporting documentation. * +* * +* Permission to modify the software is granted. Permission to distribute * +* the modified code is granted. Modifications are to be distributed by * +* using the file 'license.txt' as a template to modify the file header. * +* 'license.txt' is available in the official MAPM distribution. * +* * +* To distribute modified source code, insert the file 'license.txt' * +* at the top of all modified source code files and edit accordingly. * +* * +* This software is provided "as is" without express or implied warranty. * +* * +*************************************************************************** + + --------------------------------------- + Mike's Arbitrary Precision Math Library + --------------------------------------- + +Mike's Arbitrary Precision Math Library is a set of functions that +allow the user to perform math to any level of accuracy that is +desired. The inspiration for this library was Lloyd Zusman's similar +APM package that was released in ~1988. I borrowed some of his ideas +in my implementation, creating a new data type (MAPM) and how the data +type was used by the user. However, there were a few things I wanted +my library to do that the original library did not : + +1) Round a value to any desired precision. This is very handy when + multiplying for many iterations. Since multiplication guarantees an + exact result, the number of digits will grow without bound. I wanted + a way to trim the number of significant digits that were retained. + +2) A natural support for floating point values. From most of the other + libraries I looked at, they seem to have a preference for integer + only type math manipulations. (However, this library will also do + integer only math if you desire). + + And if a library can only do integers, it can't do ... + +3) Trig functions and other common C math library functions. This library + will perform the following functions to any desired precision level : + SQRT, CBRT, SIN, COS, TAN, ARC-SIN, ARC-COS, ARC-TAN, ARC-TAN2, LOG, + LOG10, EXP, POW, SINH, COSH, TANH, ARC-SINH, ARC-COSH, ARC-TANH, and + also FACTORIAL. The full 'math.h' is not duplicated, though I think + these are most of the important ones. My definition of what's important + is what I've actually used in a real application. + +************************************************************************** + +NOTE: + +There is a COMPILER BUG in Microsoft's Visual C++ 7.x (VS.NET 2003) which +prevents a C++ MAPM application from compiling. + +This only affects C++ applications. C applications are OK. + +The compiler bug creates an error C2676 similar to this: + +...\mapm-49\M_APM.H(###) : error C2676: binary operator '-': 'MAPM' +doesn't define this operator or a conversion to a suitable type for the +predefined operator. + +To work around this bug, go to http://www.microsoft.com + +In the upper right corner of web page, search for "814455". + +The results of the search will point you to an article on how to work +around the problem. + +************************************************************************** + +NOTE: MAPM Library History can now be found in 'history.txt' + +************************************************************************** + +ANOTHER NOTE: For the Windows/DOS distribution, the filename convention +will always be in 8.3 format. This is because there are some users who +still use 16 bit DOS .... + +(I really wasn't sure what to call this library. 'Arbitrary Precision Math' +is a defacto standard for what this does, but that name was already taken, +so I just put an 'M' in front of it ...) + +************************************************************************** + +MAPM LIBRARY NUMERICAL LIMITATIONS: + +A general floating point number is of the form: + +Sn.nnnnnnnnE+yyyy ex: -4.318384739357974916E+6215 +Sn.nnnnnnnnE-yyyy ex: +8.208237913789131096523645193E-12873 + +'S' is the sign, + or -. + +In MAPM, a number (n.nnnn...) may contain up to ( INT_MAX - 1 ) digits. + +For example, an MAPM number with a 16 bit integer may contain 2^15 or 32,767 +digits. An MAPM number with a 32 bit integer may contain 2^31 or 2,147,483,647 +digits. All MAPM numbers are stored in RAM, there is no "data on disk" option. +So to represent the maximum number of digits on a 32 bit CPU will require +greater than 2 Gig of RAM. + +If you have a CPU with 64 bit ints, then the limitation is 2^63 or +9,223,372,036,854,775,807. It should be a very long time before computers +have this much RAM in them. + +For the exponent (yyyy), the limitations are also INT_MAX and INT_MIN. + +For a 16 bit CPU, the largest number you can represent is approx +0.9999999....E+32767. (H) + +For a 16 bit CPU, the smallest number you can represent (other than 0) +is approx 0.1E-32767. (L) + +For a 32 bit CPU, the largest number you can represent is approx +0.9999999....E+2147483647. (H) + +For a 32 bit CPU, the smallest number you can represent (other than 0) +is approx 0.1E-2147483647. (L) + +The limitations for negative numbers are the same as positive numbers. + + + Real Number Axis + + +------------------------+ --- +--------------------------+ + | | | | | + -H -L 0.0 +L +H + + + +MAPM can represent real numbers from -H to -L, 0.0, +L to +H. + +The number of significant digits is typically only limited by available RAM. + +In MAPM, numerical overflows and underflows are not handled very well +(actually not at all). There really isn't a clean and portable way to +detect integer overflow and underflow. Per K&R C, the result of integer +overflow/underflow is implementation dependent. In assembly language, when +you add two numbers, you have access to a "carry flag" to see if an overflow +occurred. C has no analogous operator to a carry flag. + +It is up to the user to decide if the results are valid for a given operation. +In a 32 bit environment, the limit is so large that this is likely not an +issue for most typical applications. However, it doesn't take much to overflow +a 16 bit int so care should taken in a 16 bit environment. + +The reaction to an integer overflow/underflow is unknown at run-time: + + o) adding 2 large positive numbers may silently roll over to a + negative number. + o) in some embedded applications an integer overflow/underflow triggers + a hardware exception. + +Since I don't have control over where this library could possibly run, +I chose to ignore the problem for now. If anyone has some suggestions +(that's portable), please let me know. + +************************************************************************** + +KNOWN BUGS : (Other than integer overflow discussed above....) None + +************************************************************************** + +IF YOU ARE IN A HURRY ... + +UNIX: (assumes gcc compiler) + +run make (build library + 4 executables) + +run make -f makefile.osx (for MAC OSX) + +--- OR --- + +run: mklib (this will create the library, lib_mapm.a) + +run: mkdemo (this will create 4 executables, 'calc', 'validate', + 'primenum', and 'cpp_demo') + + +DOS / Win NT/9x (in a DOS window for NT/9x): + +see the file 'README.DOS' for instructions. + + +************************************************************************** + +calc: This is a command line version of an RPN calculator. If you are + familiar with RPN calculators, the use of this program will be + quite obvious. The default is 30 decimal places but this can be + changed with the '-d' command line option. This is not an + interactive program, it just computes an expression from the command + line. Run 'calc' with no arguments to get a list of the operators. + + compute : (345.2 * 87.33) - (11.88 / 3.21E-2) + + calc 345.2 87.33 x 11.88 3.21E-2 / - + result: 29776.22254205607476635514018692 + + + compute PI to 70 decimal places : (6 * arcsin(0.5)) + + calc -d70 6 .5 as x + result : +3.1415926535897932384626433832795028841971693993751058209749445923078164 + + calc -d70 -1 ac (arccos(-1) for fastest possible way) + +validate : This program will compare the MAPM math functions to the C + standard library functions, like sqrt, sin, exp, etc. This + should give the user a good idea that the library is operating + correctly. The program will also perform high precision math + using known quantities like PI, log(2), etc. + + 'validate' also attempts to obtain as much code coverage of the + library as is practical. I used 'gcov' (available with the gcc + distribution) to test the code coverage. 100% coverage is not + obtained, compromises must be made in order to have the program + run in a reasonable amount of time. + +primenum: This program will generate the first 10 prime numbers starting + with the number entered as an argument. + + Example: primenum 1234567890 will output (actually 1 per line): + this took ~3 sec on my Linux PC, a 350MHz PII. + + 1234567891, 1234567907, 1234567913, 1234567927, 1234567949, + 1234567967, 1234567981, 1234568021, 1234568029, 1234568047 + + +************************************************************************** + +To use the library, simply include 'm_apm.h' and link your program +with the library, libmapm.a (unix) or mapm.lib (dos). + +Note: If your system creates libraries with a '.a' extension, then the +library will be named libmapm.a. (This conforms to typical unix naming +conventions). + +Note: If your system creates libraries with a '.lib' extension, then the +library will be named mapm.lib. + +For unix builds, you also may need to specify the math library (-lm) when +linking. The reason is some of the MAPM functions use an iterative algorithm. +When you use an iterative solution, you have to supply an initial guess. I +use the standard math library to generate this initial guess. I debated +whether this library should be stand-alone, i.e. generate it's own initial +guesses with some algorithm. In the end, I decided using the standard math +library would not be a big inconvienence and also it was just too tempting +having an immediate 15 digits of precision. When you prime the iterative +routines with 15 accurate digits, the MAPM functions converge faster. + +See the file 'algorithms.used' to see a description of the algorithms I +used in the library. Some I derived on my own, others I borrowed from people +smarter than me. Version 2 of the library supports a 'fast' multiplication +algorithm. The algorithm used is described in the algorithms.used file. A +considerable amount of time went into finding fast algorithms for the +library. However, some could possibly be even better. If anyone has a +more efficient algorithm for any of these functions, I would like to here +from you. + +See the file 'function.ref' to see a description of all the functions in +the library and the calling conventions, prototypes, etc. + +See the file 'struct.ref' which documents how I store the numbers internally +in the MAPM data structure. This will not be needed for normal use, but it +will be very useful if you need to change/add to the existing library. + +************************************************************************** + +USING MAPM IN A MULTI-THREADED APPLICATION : + +Note that the default MAPM library is NOT thread safe. MAPM internal data +structures could get corrupted if multiple MAPM functions are active at the +same time. The user should guarantee that only one thread is performing +MAPM functions. This can usually be achieved by a call to the operating +system to obtain a 'semaphore', 'mutex', or 'critical code section' so the +operating system will guarantee that only one MAPM thread will be active +at a time. + +The necessary function wrappers for thread safe operation can be found in +the sub-directory 'multi_thread' (unix) or 'multithd' (Win/Dos). For now, +only Microsoft Visual C++ 6.0 is supported. + +************************************************************************** + +QUICK TEMPLATE FOR NORMAL USE : + +The MAPM math is done on a new data type called "M_APM". This is +actually a pointer to a structure, but the contents of the structure +should never be manipulated: all operations on MAPM entities are done +through a functional interface. + +The MAPM routines will automatically allocate enough space in their +results to hold the proper number of digits. + +The caller must initialize all MAPM values before the routines can +operate on them (including the values intended to contain results of +calculations). Once this initialization is done, the user never needs +to worry about resizing the MAPM values, as this is handled inside the [... truncated: 11985 lines follow ...] From korli at mail.berlios.de Tue Nov 4 22:52:57 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 4 Nov 2008 22:52:57 +0100 Subject: [Haiku-commits] r28507 - haiku/trunk/src/apps/showimage Message-ID: <200811042152.mA4LqvQN022683@sheep.berlios.de> Author: korli Date: 2008-11-04 22:52:57 +0100 (Tue, 04 Nov 2008) New Revision: 28507 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28507&view=rev Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp Log: fix a style violation Modified: haiku/trunk/src/apps/showimage/ShowImageView.cpp =================================================================== --- haiku/trunk/src/apps/showimage/ShowImageView.cpp 2008-11-04 20:47:41 UTC (rev 28506) +++ haiku/trunk/src/apps/showimage/ShowImageView.cpp 2008-11-04 21:52:57 UTC (rev 28507) @@ -1166,17 +1166,14 @@ // avoid flickering of dragged bitmap caused by drawing into the window AnimateSelection(false); // only use a transparent bitmap on selections less than 400x400 (taking into account zooming) - if ((fSelectionRect.Width() * fZoom) < 400.0 && (fSelectionRect.Height() * fZoom) < 400.0) - { + if ((fSelectionRect.Width() * fZoom) < 400.0 && (fSelectionRect.Height() * fZoom) < 400.0) { sourcePoint -= fSelectionRect.LeftTop(); sourcePoint.x *= fZoom; sourcePoint.y *= fZoom; // DragMessage takes ownership of bitmap DragMessage(&drag, bitmap, B_OP_ALPHA, sourcePoint); bitmap = NULL; - } - else - { + } else { delete bitmap; // Offset and scale the rect BRect rect(fSelectionRect); From axeld at mail.berlios.de Tue Nov 4 23:40:12 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 4 Nov 2008 23:40:12 +0100 Subject: [Haiku-commits] r28508 - in haiku/trunk/src: system/kernel/cache tests/system/kernel/cache Message-ID: <200811042240.mA4MeCgD001961@sheep.berlios.de> Author: axeld Date: 2008-11-04 23:40:11 +0100 (Tue, 04 Nov 2008) New Revision: 28508 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28508&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp Log: * The first functions now handle the "discard" flag correctly (namely cache_end_transaction(), and cache_start_sub_transaction()). * Further work on the test application, it's now actually usable, first test passes. * dump_block() did erroneously print 'B' for the dirty flag; now both dirty and discard have the 'D' (3rd and 5th column). * block_cache::LowMemoryHandler() is now private (and got an underscore prefix). * Minor cleanup, shuffled some methods around. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-04 21:52:57 UTC (rev 28507) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-04 22:40:11 UTC (rev 28508) @@ -116,23 +116,26 @@ NotificationList pending_notifications; ConditionVariable condition_variable; - block_cache(int fd, off_t numBlocks, size_t blockSize, bool readOnly); - ~block_cache(); + block_cache(int fd, off_t numBlocks, size_t blockSize, + bool readOnly); + ~block_cache(); - status_t Init(); + status_t Init(); - void RemoveUnusedBlocks(int32 maxAccessed = LONG_MAX, - int32 count = LONG_MAX); - void RemoveBlock(cached_block* block); - void FreeBlock(cached_block* block); - cached_block* NewBlock(off_t blockNumber); - void Free(void* buffer); - void* Allocate(); + void Free(void* buffer); + void* Allocate(); + void RemoveUnusedBlocks(int32 maxAccessed = LONG_MAX, + int32 count = LONG_MAX); + void RemoveBlock(cached_block* block); + void DiscardBlock(cached_block* block); + void FreeBlock(cached_block* block); + cached_block* NewBlock(off_t blockNumber); - static void LowMemoryHandler(void* data, uint32 resources, int32 level); private: - cached_block* _GetUnusedBlock(); + static void _LowMemoryHandler(void* data, uint32 resources, + int32 level); + cached_block* _GetUnusedBlock(); }; struct cache_listener; @@ -777,7 +780,7 @@ /*! Should be called with the cache's lock held. */ block_cache::~block_cache() { - unregister_low_resource_handler(&block_cache::LowMemoryHandler, this); + unregister_low_resource_handler(&_LowMemoryHandler, this); hash_uninit(transaction_hash); hash_uninit(hash); @@ -809,7 +812,7 @@ if (transaction_hash == NULL) return B_NO_MEMORY; - return register_low_resource_handler(&block_cache::LowMemoryHandler, this, + return register_low_resource_handler(&_LowMemoryHandler, this, B_KERNEL_RESOURCE_PAGES | B_KERNEL_RESOURCE_MEMORY, 0); } @@ -847,36 +850,6 @@ } -cached_block* -block_cache::_GetUnusedBlock() -{ - TRACE(("block_cache: get unused block\n")); - - for (block_list::Iterator iterator = unused_blocks.GetIterator(); - cached_block* block = iterator.Next();) { - TB(Flush(this, block, true)); - // this can only happen if no transactions are used - if (block->is_dirty) - write_cached_block(this, block, false); - - // remove block from lists - iterator.Remove(); - hash_remove(hash, block); - - // TODO: see if parent/compare data is handled correctly here! - if (block->parent_data != NULL - && block->parent_data != block->original_data) - Free(block->parent_data); - if (block->original_data != NULL) - Free(block->original_data); - - return block; - } - - return NULL; -} - - /*! Allocates a new block for \a blockNumber, ready for use */ cached_block* block_cache::NewBlock(off_t blockNumber) @@ -921,14 +894,6 @@ void -block_cache::RemoveBlock(cached_block* block) -{ - hash_remove(hash, block); - FreeBlock(block); -} - - -void block_cache::RemoveUnusedBlocks(int32 maxAccessed, int32 count) { TRACE(("block_cache: remove up to %ld unused blocks\n", count)); @@ -957,8 +922,38 @@ void -block_cache::LowMemoryHandler(void* data, uint32 resources, int32 level) +block_cache::RemoveBlock(cached_block* block) { + hash_remove(hash, block); + FreeBlock(block); +} + + +/*! Discards the block from a transaction (this method must not be called + for blocks not part of a transaction). +*/ +void +block_cache::DiscardBlock(cached_block* block) +{ + ASSERT(block->discard); + + if (block->parent_data != NULL && block->parent_data != block->current_data) + Free(block->parent_data); + + block->parent_data = NULL; + + if (block->original_data != NULL) { + Free(block->original_data); + block->original_data = NULL; + } + + RemoveBlock(block); +} + + +void +block_cache::_LowMemoryHandler(void* data, uint32 resources, int32 level) +{ block_cache* cache = (block_cache*)data; MutexLocker locker(&cache->lock); @@ -998,6 +993,36 @@ } +cached_block* +block_cache::_GetUnusedBlock() +{ + TRACE(("block_cache: get unused block\n")); + + for (block_list::Iterator iterator = unused_blocks.GetIterator(); + cached_block* block = iterator.Next();) { + TB(Flush(this, block, true)); + // this can only happen if no transactions are used + if (block->is_dirty) + write_cached_block(this, block, false); + + // remove block from lists + iterator.Remove(); + hash_remove(hash, block); + + // TODO: see if parent/compare data is handled correctly here! + if (block->parent_data != NULL + && block->parent_data != block->original_data) + Free(block->parent_data); + if (block->original_data != NULL) + Free(block->original_data); + + return block; + } + + return NULL; +} + + // #pragma mark - private block functions @@ -1339,12 +1364,13 @@ static void dump_block(cached_block* block) { - kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c %08lx " - "%08lx\n", (addr_t)block, block->block_number, + kprintf("%08lx %9Ld %08lx %08lx %08lx %5ld %6ld %c%c%c%c%c %08lx %08lx\n", + (addr_t)block, block->block_number, (addr_t)block->current_data, (addr_t)block->original_data, (addr_t)block->parent_data, block->ref_count, block->accessed, block->busy ? 'B' : '-', block->is_writing ? 'W' : '-', - block->is_dirty ? 'B' : '-', block->unused ? 'U' : '-', + block->is_dirty ? 'D' : '-', block->unused ? 'U' : '-', + block->discard ? 'D' : '-', (addr_t)block->transaction, (addr_t)block->previous_transaction); } @@ -1473,6 +1499,7 @@ uint32 referenced = 0; uint32 count = 0; uint32 dirty = 0; + uint32 discarded = 0; hash_iterator iterator; hash_open(cache->hash, &iterator); cached_block* block; @@ -1482,13 +1509,16 @@ if (block->is_dirty) dirty++; + if (block->discard) + discarded++; if (block->ref_count) referenced++; count++; } - kprintf(" %ld blocks total, %ld dirty, %ld referenced, %ld in unused.\n", count, dirty, - referenced, cache->unused_blocks.Size()); + kprintf(" %ld blocks total, %ld dirty, %ld discarded, %ld referenced, %ld " + "in unused.\n", count, dirty, discarded, referenced, + cache->unused_blocks.Size()); hash_close(cache->hash, &iterator, false); return 0; @@ -1937,6 +1967,12 @@ // need to write back pending changes write_cached_block(cache, block); } + if (block->discard) { + // This block has been discarded in the transaction + cache->DiscardBlock(block); + transaction->num_blocks--; + continue; + } if (block->original_data != NULL) { cache->Free(block->original_data); @@ -2175,10 +2211,21 @@ // move all changed blocks up to the parent cached_block* block = transaction->first_block; + cached_block* last = NULL; cached_block* next; for (; block != NULL; block = next) { next = block->transaction_next; + if (block->discard) { + // This block has been discarded in the parent transaction + if (last != NULL) + last->transaction_next = next; + else + transaction->first_block = next; + + cache->DiscardBlock(block); + continue; + } if (transaction->has_sub_transaction && block->parent_data != NULL && block->parent_data != block->current_data) { @@ -2190,6 +2237,7 @@ // we "allocate" the parent data lazily, that means, we don't copy // the data (and allocate memory for it) until we need to block->parent_data = block->current_data; + last = block; } // all subsequent changes will go into the sub transaction @@ -2483,14 +2531,14 @@ if (block == NULL) continue; + if (block->previous_transaction != NULL) + write_cached_block(cache, block); + if (block->unused) { cache->unused_blocks.Remove(block); cache->RemoveBlock(block); } else { - // mark them as discarded (in the current transaction only, if any) - if (block->previous_transaction != NULL) - write_cached_block(cache, block); - + // mark it as discarded (in the current transaction only, if any) block->discard = true; } } Modified: haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp =================================================================== --- haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp 2008-11-04 21:52:57 UTC (rev 28507) +++ haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp 2008-11-04 22:40:11 UTC (rev 28508) @@ -3,11 +3,225 @@ * Distributed under the terms of the MIT License. */ + +#define write_pos block_cache_write_pos +#define read_pos block_cache_read_pos + #include "block_cache.cpp" +#undef write_pos +#undef read_pos + +#define MAX_BLOCKS 100 + +#define TEST_BLOCK_DATA(block, number, type) \ + if ((block)->type ## _data != NULL && gBlocks[(number)]. type == 0) \ + error("Block %Ld: " #type " should be NULL!", (number)); \ + if ((block)->type ## _data != NULL && gBlocks[(number)]. type != 0 \ + && *(int32*)(block)->type ## _data != gBlocks[(number)]. type) { \ + error("Block %Ld: " #type " wrong (%ld should be %ld)!", (number), \ + *(int32*)(block)->type ## _data, gBlocks[(number)]. type); \ + } + +struct test_block { + int32 current; + int32 original; + int32 parent; + int32 previous_transaction; + int32 transaction; + bool unused; + bool is_dirty; + bool discard; + + bool write; + + bool read; + bool written; + bool present; +}; + +test_block gBlocks[MAX_BLOCKS]; +block_cache* gCache; +size_t gBlockSize; +int32 gTest; +const char* gTestName; + + +ssize_t +block_cache_write_pos(int fd, off_t offset, const void* buffer, size_t size) +{ + //printf("write: %Ld, %p, %lu\n", offset, buffer, size); + gBlocks[offset / gBlockSize].written = true; + return size; +} + + +ssize_t +block_cache_read_pos(int fd, off_t offset, void* buffer, size_t size) +{ + //printf("read: %Ld, %p, %lu\n", offset, buffer, size); + memset(buffer, 0xcc, size); + int32* value = (int32*)buffer; + *value = offset / gBlockSize + 1; + gBlocks[offset / gBlockSize].read = true; + + return size; +} + + +void +init_test_blocks() +{ + memset(gBlocks, 0, sizeof(test_block) * MAX_BLOCKS); + + for (uint32 i = 0; i < MAX_BLOCKS; i++) { + gBlocks[i].current = i + 1; + gBlocks[i].unused = true; + } +} + + +void +error(const char* format, ...) +{ + va_list args; + va_start(args, format); + + fprintf(stderr, "ERROR: "); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); + + va_end(args); + + char cacheString[32]; + sprintf(cacheString, "%p", gCache); + char* argv[4]; + argv[0] = "dump"; + argv[1] = "-bt"; + argv[2] = cacheString; + argv[3] = NULL; + dump_cache(3, argv); + + exit(1); +} + + +void +test_blocks(off_t number, int32 count) +{ + for (int32 i = 0; i < count; i++, number++) { + MutexLocker locker(&gCache->lock); + + cached_block* block = (cached_block*)hash_lookup(gCache->hash, &number); + if (block == NULL) { + if (gBlocks[number].present) + error("Block %Ld not found!", number); + continue; + } + if (!gBlocks[number].present) + error("Block %Ld is present, but should not!", number); + + if (block->is_dirty != gBlocks[number].is_dirty) { + error("Block %Ld: dirty bit differs (%d should be %d)!", number, + block->is_dirty, gBlocks[number].is_dirty); + } +#if 0 + if (block->unused != gBlocks[number].unused) { + error("Block %ld: discard bit differs (%d should be %d)!", number, + block->unused, gBlocks[number].unused); + } +#endif + if (block->discard != gBlocks[number].discard) { + error("Block %Ld: discard bit differs (%d should be %d)!", number, + block->discard, gBlocks[number].discard); + } + if (gBlocks[number].write && !gBlocks[number].written) + error("Block %Ld: has not been written yet!", number); + + TEST_BLOCK_DATA(block, number, current); + TEST_BLOCK_DATA(block, number, original); + TEST_BLOCK_DATA(block, number, parent); + } +} + + +void +test_block(off_t block) +{ + test_blocks(block, 1); +} + + +void +stop_test(void) +{ + if (gCache == NULL) + return; + test_blocks(0, MAX_BLOCKS); + + block_cache_delete(gCache, true); +} + + +void +start_test(int32 test, const char* name, bool init = false) +{ + if (init) { + stop_test(); + + gBlockSize = 2048; + gCache = (block_cache*)block_cache_create(-1, MAX_BLOCKS, gBlockSize, + false); + + init_test_blocks(); + } + + gTest = test; + gTestName = name; + printf("----------- Test %ld%s%s -----------\n", gTest, + gTestName[0] ? " - " : "", gTestName); +} + + int main(int argc, char** argv) { + block_cache_init(); + + const void* block; + + // TODO: test transaction-less block caches + // TODO: test read-only block caches + + // Test transactions and block caches + + start_test(1, "Discard simple", true); + + int32 id = cache_start_transaction(gCache); + + gBlocks[0].present = true; + gBlocks[0].read = true; + + block = block_cache_get(gCache, 0); + block_cache_put(gCache, 0); + + gBlocks[1].present = true; + gBlocks[1].read = true; + gBlocks[1].write = true; + + block = block_cache_get_writable(gCache, 1, id); + block_cache_put(gCache, 1); + + gBlocks[2].present = false; + + block = block_cache_get_empty(gCache, 2, id); + block_cache_discard(gCache, 2, 1); + block_cache_put(gCache, 2); + + cache_end_transaction(gCache, id, NULL, NULL); + cache_sync_transaction(gCache, id); + + stop_test(); return 0; } From leavengood at mail.berlios.de Wed Nov 5 00:48:01 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Wed, 5 Nov 2008 00:48:01 +0100 Subject: [Haiku-commits] r28509 - haiku/trunk/src/add-ons/media/media-add-ons/mixer Message-ID: <200811042348.mA4Nm1Sv032022@sheep.berlios.de> Author: leavengood Date: 2008-11-05 00:47:54 +0100 (Wed, 05 Nov 2008) New Revision: 28509 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28509&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp Log: Bug #1571: I think diver is right, the Info tab is pretty useless on the mixer's controls, so I am removing it. If someone disagrees, this code can be added back easily. Modified: haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp 2008-11-04 22:40:11 UTC (rev 28508) +++ haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp 2008-11-04 23:47:54 UTC (rev 28509) @@ -1698,18 +1698,6 @@ group->MakeDiscreteParameter(PARAM_ETC(80), B_MEDIA_RAW_AUDIO, "Refuse output format changes", B_ENABLE); group->MakeDiscreteParameter(PARAM_ETC(90), B_MEDIA_RAW_AUDIO, "Refuse input format changes", B_ENABLE); - top = web->MakeGroup("Info"); // top level group - group = top->MakeGroup(""); - - group->MakeNullParameter(PARAM_ETC(1001), B_MEDIA_RAW_AUDIO, "Info:", B_GENERIC); - group->MakeNullParameter(PARAM_ETC(1002), B_MEDIA_RAW_AUDIO, "Haiku audio mixer", B_GENERIC); - group->MakeNullParameter(PARAM_ETC(1003), B_MEDIA_RAW_AUDIO, "Version: " VERSION_STRING , B_GENERIC); - group->MakeNullParameter(PARAM_ETC(1004), B_MEDIA_RAW_AUDIO, "Build: " BUILD_STRING - #if DEBUG - ", debugging enabled" - #endif - , B_GENERIC); - fCore->Unlock(); SetParameterWeb(web); } From ingo_weinhold at gmx.de Wed Nov 5 01:39:16 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 05 Nov 2008 01:39:16 +0100 Subject: [Haiku-commits] r28506 - in haiku/trunk/src/apps: aboutsystem deskcalc deskcalc/mapm_4.9.5 In-Reply-To: <200811042047.mA4KlvpR015370@sheep.berlios.de> References: <200811042047.mA4KlvpR015370@sheep.berlios.de> Message-ID: <20081105013916.451.1@knochen-vm.localdomain> On 2008-11-04 at 21:47:57 [+0100], stippi at mail.berlios.de wrote: > Author: stippi > Date: 2008-11-04 21:47:41 +0100 (Tue, 04 Nov 2008) > New Revision: 28506 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28506&view=rev > > Added: > haiku/trunk/src/apps/deskcalc/mapm_4.9.5/ * Including version numbers in directory names is generally frowned upon. * Usually when importing sources of third party projects a vendor branch should be used. An exception can be made, if the software is no longer maintained. CU, Ingo From anevilyak at mail.berlios.de Wed Nov 5 05:22:56 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 5 Nov 2008 05:22:56 +0100 Subject: [Haiku-commits] r28510 - haiku/trunk/build/jam Message-ID: <200811050422.mA54MunF012172@sheep.berlios.de> Author: anevilyak Date: 2008-11-05 05:22:56 +0100 (Wed, 05 Nov 2008) New Revision: 28510 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28510&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Temporarily symlink m4 and perl to their new locations until the other dev packages are updated. This unbreaks bison and a few other things. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-04 23:47:54 UTC (rev 28509) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-05 04:22:56 UTC (rev 28510) @@ -241,6 +241,8 @@ : $(baseURL)/m4-1.4.12-gcc2-2008-11-04.zip : ; + AddSymlinkToHaikuImage bin : /boot/common/bin/m4 : m4 ; + InstallOptionalHaikuImagePackage autoconf-2.61-gcc2-2008-03-24 : $(baseURL)/autoconf-2.61-gcc2-2008-03-24.zip : home @@ -412,6 +414,8 @@ : $(baseURL)/perl-5.10.0-gcc2-2008-10-29.zip : ; + AddSymlinkToHaikuImage bin : /boot/common/bin/perl : perl ; + } } From stefano.ceccherini at gmail.com Wed Nov 5 10:14:58 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Wed, 5 Nov 2008 10:14:58 +0100 Subject: [Haiku-commits] r28504 - haiku/trunk/src/add-ons/opengl/mesa_software_renderer In-Reply-To: <200811042017.mA4KH3E1009058@sheep.berlios.de> References: <200811042017.mA4KH3E1009058@sheep.berlios.de> Message-ID: <894b9700811050114t3b61233bk8a15539db4f427cb@mail.gmail.com> 2008/11/4 korli at BerliOS : > Modified: > haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp > Log: > we need to allocate more than sizeof(direct_buffer_info), we use B_PAGE_SIZE That's what the app_server uses to allocate that area, so this should be okay. From korli at users.berlios.de Wed Nov 5 11:11:59 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 5 Nov 2008 11:11:59 +0100 Subject: [Haiku-commits] r28504 - haiku/trunk/src/add-ons/opengl/mesa_software_renderer In-Reply-To: <894b9700811050114t3b61233bk8a15539db4f427cb@mail.gmail.com> References: <200811042017.mA4KH3E1009058@sheep.berlios.de> <894b9700811050114t3b61233bk8a15539db4f427cb@mail.gmail.com> Message-ID: 2008/11/5 Stefano Ceccherini : > 2008/11/4 korli at BerliOS : > >> Modified: >> haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp >> Log: >> we need to allocate more than sizeof(direct_buffer_info), we use B_PAGE_SIZE > > That's what the app_server uses to allocate that area, so this should be okay. I thought it was BDirectWindow which allocates that area. It's unclear to me how to better specify and handles this size: the size should be defined in a header somewhere. Bye, J?r?me From axeld at mail.berlios.de Wed Nov 5 12:05:02 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 12:05:02 +0100 Subject: [Haiku-commits] r28511 - haiku/trunk/src/tests/add-ons/kernel Message-ID: <200811051105.mA5B52kW000300@sheep.berlios.de> Author: axeld Date: 2008-11-05 12:05:02 +0100 (Wed, 05 Nov 2008) New Revision: 28511 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28511&view=rev Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp Log: * Make static initializers sort of work in the test environment. Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-11-05 04:22:56 UTC (rev 28510) +++ haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-11-05 11:05:02 UTC (rev 28511) @@ -1313,6 +1313,11 @@ status_t _mutex_lock(mutex *mutex, bool threadsLocked) { + if (mutex->waiters == NULL) { + // MUTEX_INITIALIZER has been used; this is not thread-safe! + mutex_init(mutex, mutex->name); + } + status_t status; do { status = acquire_sem((sem_id)mutex->waiters); From axeld at mail.berlios.de Wed Nov 5 12:16:04 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 12:16:04 +0100 Subject: [Haiku-commits] r28512 - haiku/trunk/src/system/kernel/cache Message-ID: <200811051116.mA5BG4iX001773@sheep.berlios.de> Author: axeld Date: 2008-11-05 12:16:04 +0100 (Wed, 05 Nov 2008) New Revision: 28512 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28512&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * Fixed a potential race condition: when wait_for_notifications() is called from the block notifier, the cache could be deleted before we have the chance to lock it. We now lock the sCachesLock, and see if this cache is still valid. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-05 11:05:02 UTC (rev 28511) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-05 11:16:04 UTC (rev 28512) @@ -1746,6 +1746,22 @@ } +/*! Must be called with the sCachesLock held. */ +static bool +is_valid_cache(block_cache* cache) +{ + ASSERT_LOCKED_MUTEX(&sCachesLock); + + DoublyLinkedList::Iterator iterator = sCaches.GetIterator(); + while (iterator.HasNext()) { + if (cache == iterator.Next()) + return true; + } + + return false; +} + + /*! 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. @@ -1756,7 +1772,9 @@ if (find_thread(NULL) == sNotifierWriterThread) { // We're the notifier thread, don't wait, but flush all pending // notifications directly. - flush_pending_notifications(cache); + MutexLocker _(sCachesLock); + if (is_valid_cache(cache)) + flush_pending_notifications(cache); return; } From axeld at mail.berlios.de Wed Nov 5 12:54:11 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 12:54:11 +0100 Subject: [Haiku-commits] r28513 - haiku/trunk/src/tests/add-ons/kernel Message-ID: <200811051154.mA5BsBHG032641@sheep.berlios.de> Author: axeld Date: 2008-11-05 12:54:09 +0100 (Wed, 05 Nov 2008) New Revision: 28513 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28513&view=rev Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp Log: * Now also sets the mutex::holder field (only present when KDEBUG is defind), to make ASSERT_LOCKED_MUTEX() work. Modified: haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp =================================================================== --- haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-11-05 11:16:04 UTC (rev 28512) +++ haiku/trunk/src/tests/add-ons/kernel/kernelland_emu.cpp 2008-11-05 11:54:09 UTC (rev 28513) @@ -1322,6 +1322,11 @@ do { status = acquire_sem((sem_id)mutex->waiters); } while (status == B_INTERRUPTED); + +#if KDEBUG + if (status == B_OK) + mutex->holder = find_thread(NULL); +#endif return status; } @@ -1329,6 +1334,9 @@ void _mutex_unlock(mutex *mutex, bool threadsLocked) { +#if KDEBUG + mutex->holder = -1; +#endif release_sem((sem_id)mutex->waiters); } From axeld at pinc-software.de Wed Nov 5 13:18:18 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 05 Nov 2008 13:18:18 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28504_-_haiku/trunk/src/add-ons/opengl?= =?utf-8?q?/mesa=5Fsoftware=5Frenderer?= In-Reply-To: Message-ID: <15363960132-BeMail@zon> "J?r?me Duval" wrote: > 2008/11/5 Stefano Ceccherini : > > 2008/11/4 korli at BerliOS : > >> Modified: > >> haiku/trunk/src/add-ons/opengl/mesa_software_renderer/ > > > MesaSoftwareRenderer.cpp > >> Log: > >> we need to allocate more than sizeof(direct_buffer_info), we use > > > B_PAGE_SIZE > > That's what the app_server uses to allocate that area, so this > > should be okay. > I thought it was BDirectWindow which allocates that area. > It's unclear to me how to better specify and handles this size: the > size should be defined in a header somewhere. As long as it's not dynamic, it should indeed :-) Bye, Axel. From korli at users.berlios.de Wed Nov 5 14:20:59 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Wed, 5 Nov 2008 14:20:59 +0100 Subject: [Haiku-commits] r28504 - haiku/trunk/src/add-ons/opengl/mesa_software_renderer In-Reply-To: <15363960132-BeMail@zon> References: <15363960132-BeMail@zon> Message-ID: 2008/11/5 Axel D?rfler : > "J?r?me Duval" wrote: >> 2008/11/5 Stefano Ceccherini : >> > 2008/11/4 korli at BerliOS : >> >> Modified: >> >> haiku/trunk/src/add-ons/opengl/mesa_software_renderer/ >> > > MesaSoftwareRenderer.cpp >> >> Log: >> >> we need to allocate more than sizeof(direct_buffer_info), we use >> > > B_PAGE_SIZE >> > That's what the app_server uses to allocate that area, so this >> > should be okay. >> I thought it was BDirectWindow which allocates that area. >> It's unclear to me how to better specify and handles this size: the >> size should be defined in a header somewhere. > > As long as it's not dynamic, it should indeed :-) Public or private header ? J?r?me From stefano.ceccherini at gmail.com Wed Nov 5 14:42:39 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Wed, 5 Nov 2008 14:42:39 +0100 Subject: [Haiku-commits] r28504 - haiku/trunk/src/add-ons/opengl/mesa_software_renderer In-Reply-To: <15363960132-BeMail@zon> References: <15363960132-BeMail@zon> Message-ID: <894b9700811050542t671b4a6dw31cf2c33590dfe35@mail.gmail.com> 2008/11/5 Axel D?rfler : >> I thought it was BDirectWindow which allocates that area. >> It's unclear to me how to better specify and handles this size: the >> size should be defined in a header somewhere. It's BDirectWindow, but in the app_server part of the implementation. From axeld at mail.berlios.de Wed Nov 5 14:52:34 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 14:52:34 +0100 Subject: [Haiku-commits] r28514 - in haiku/trunk/src: system/kernel/cache tests/system/kernel/cache Message-ID: <200811051352.mA5DqYvJ012845@sheep.berlios.de> Author: axeld Date: 2008-11-05 14:52:34 +0100 (Wed, 05 Nov 2008) New Revision: 28514 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28514&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp Log: * cache_detach_sub_transaction(), and cache_abort_sub_transaction() now support discarded blocks correctly as well. * cache_detach_sub_transaction() left cached_block::original_data unchanged even if the parent data was to become current (in case the sub transaction didn't change the block yet). This could cause outdated blocks to be written back. * cache_detach_sub_transaction() also set cached_block::previous_transaction for all blocks, not just the ones with a previous transaction. This could cause blocks to be written twice for no reason. * cache_start_sub_transaction() did not change the num_blocks count for discarded blocks. * block_cache_discard() now panics if the block was already changed in the current transaction. * Improved test application, added more tests, revealing the above bugs in cache_detach_sub_transaction(). * Minor cleanup. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-05 11:54:09 UTC (rev 28513) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-05 13:52:34 UTC (rev 28514) @@ -566,6 +566,8 @@ static void flush_pending_notifications(block_cache* cache) { + ASSERT_LOCKED_MUTEX(&sCachesLock); + while (true) { MutexLocker locker(sNotificationsLock); @@ -1203,12 +1205,12 @@ if (cleared) memset(block->current_data, 0, cache->block_size); - if (!block->is_dirty) + if (!block->is_dirty) { cache->num_dirty_blocks++; + block->is_dirty = true; + // mark the block as dirty + } - block->is_dirty = true; - // mark the block as dirty - TB(Get(cache, block)); return block->current_data; } @@ -2112,9 +2114,13 @@ // need to write back pending changes write_cached_block(cache, block); } + if (block->discard) { + cache->DiscardBlock(block); + transaction->main_num_blocks--; + continue; + } - if (block->original_data != NULL && block->parent_data != NULL - && block->parent_data != block->current_data) { + if (block->original_data != NULL && block->parent_data != NULL) { // free the original data if the parent data of the transaction // will be made current - but keep them otherwise cache->Free(block->original_data); @@ -2137,10 +2143,10 @@ if (block->parent_data != NULL) { // move the block to the previous transaction list transaction->blocks.Add(block); + block->previous_transaction = transaction; block->parent_data = NULL; } - block->previous_transaction = transaction; block->transaction_next = NULL; } @@ -2200,6 +2206,7 @@ } block->parent_data = NULL; + block->discard = false; } // all subsequent changes will go into the main transaction @@ -2242,6 +2249,7 @@ transaction->first_block = next; cache->DiscardBlock(block); + transaction->num_blocks--; continue; } if (transaction->has_sub_transaction @@ -2556,6 +2564,12 @@ cache->unused_blocks.Remove(block); cache->RemoveBlock(block); } else { + if (block->transaction != NULL && block->parent_data != NULL + && block->parent_data != block->current_data) { + panic("Discarded block %Ld has already been changed in this " + "transaction!", blockNumber); + } + // mark it as discarded (in the current transaction only, if any) block->discard = true; } Modified: haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp =================================================================== --- haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp 2008-11-05 11:54:09 UTC (rev 28513) +++ haiku/trunk/src/tests/system/kernel/cache/block_cache_test.cpp 2008-11-05 13:52:34 UTC (rev 28514) @@ -13,17 +13,29 @@ #undef read_pos -#define MAX_BLOCKS 100 +#define MAX_BLOCKS 100 +#define BLOCK_CHANGED_IN_MAIN (1L << 28) +#define BLOCK_CHANGED_IN_SUB (2L << 28) +#define TEST_BLOCKS(number, count) \ + test_blocks(number, count, __LINE__) + #define TEST_BLOCK_DATA(block, number, type) \ if ((block)->type ## _data != NULL && gBlocks[(number)]. type == 0) \ - error("Block %Ld: " #type " should be NULL!", (number)); \ + error(line, "Block %Ld: " #type " should be NULL!", (number)); \ if ((block)->type ## _data != NULL && gBlocks[(number)]. type != 0 \ && *(int32*)(block)->type ## _data != gBlocks[(number)]. type) { \ - error("Block %Ld: " #type " wrong (%ld should be %ld)!", (number), \ - *(int32*)(block)->type ## _data, gBlocks[(number)]. type); \ + error(line, "Block %Ld: " #type " wrong (0x%lx should be 0x%lx)!", \ + (number), *(int32*)(block)->type ## _data, \ + gBlocks[(number)]. type); \ } +#define TEST_ASSERT(statement) \ + if (!(statement)) { \ + error(__LINE__, "Assertion failed: " #statement); \ + } + + struct test_block { int32 current; int32 original; @@ -45,14 +57,68 @@ block_cache* gCache; size_t gBlockSize; int32 gTest; +int32 gSubTest; const char* gTestName; +void +error(int32 line, const char* format, ...) +{ + va_list args; + va_start(args, format); + + fprintf(stderr, "ERROR IN TEST LINE %ld: ", line); + vfprintf(stderr, format, args); + fprintf(stderr, "\n"); + + va_end(args); + + char cacheString[32]; + sprintf(cacheString, "%p", gCache); + char* argv[4]; + argv[0] = "dump"; + argv[1] = "-bt"; + argv[2] = cacheString; + argv[3] = NULL; + dump_cache(3, argv); + + exit(1); +} + + +void +or_block(void* block, int32 value) +{ + int32* data = (int32*)block; + *data |= value; +} + + +void +set_block(void* block, int32 value) +{ + int32* data = (int32*)block; + *data = value; +} + + +void +reset_block(void* block, int32 index) +{ + int32* data = (int32*)block; + *data = index + 1; +} + + ssize_t block_cache_write_pos(int fd, off_t offset, const void* buffer, size_t size) { - //printf("write: %Ld, %p, %lu\n", offset, buffer, size); - gBlocks[offset / gBlockSize].written = true; + int32 index = offset / gBlockSize; + + gBlocks[index].written = true; + if (!gBlocks[index].write) + error(__LINE__, "Block %ld should not be written!\n", index); + return size; } @@ -60,11 +126,12 @@ ssize_t block_cache_read_pos(int fd, off_t offset, void* buffer, size_t size) { - //printf("read: %Ld, %p, %lu\n", offset, buffer, size); + int32 index = offset / gBlockSize; + memset(buffer, 0xcc, size); - int32* value = (int32*)buffer; - *value = offset / gBlockSize + 1; - gBlocks[offset / gBlockSize].read = true; + reset_block(buffer, index); + if (!gBlocks[index].read) + error(__LINE__, "Block %ld should not be written!\n", index); return size; } @@ -83,48 +150,25 @@ void -error(const char* format, ...) +test_blocks(off_t number, int32 count, int32 line) { - va_list args; - va_start(args, format); + printf(" %ld\n", gSubTest++); - fprintf(stderr, "ERROR: "); - vfprintf(stderr, format, args); - fprintf(stderr, "\n"); - - va_end(args); - - char cacheString[32]; - sprintf(cacheString, "%p", gCache); - char* argv[4]; - argv[0] = "dump"; - argv[1] = "-bt"; - argv[2] = cacheString; - argv[3] = NULL; - dump_cache(3, argv); - - exit(1); -} - - -void -test_blocks(off_t number, int32 count) -{ for (int32 i = 0; i < count; i++, number++) { MutexLocker locker(&gCache->lock); cached_block* block = (cached_block*)hash_lookup(gCache->hash, &number); if (block == NULL) { if (gBlocks[number].present) - error("Block %Ld not found!", number); + error(line, "Block %Ld not found!", number); continue; } if (!gBlocks[number].present) - error("Block %Ld is present, but should not!", number); + error(line, "Block %Ld is present, but should not!", number); if (block->is_dirty != gBlocks[number].is_dirty) { - error("Block %Ld: dirty bit differs (%d should be %d)!", number, - block->is_dirty, gBlocks[number].is_dirty); + error(line, "Block %Ld: dirty bit differs (%d should be %d)!", + number, block->is_dirty, gBlocks[number].is_dirty); } #if 0 if (block->unused != gBlocks[number].unused) { @@ -133,11 +177,11 @@ } #endif if (block->discard != gBlocks[number].discard) { - error("Block %Ld: discard bit differs (%d should be %d)!", number, - block->discard, gBlocks[number].discard); + error(line, "Block %Ld: discard bit differs (%d should be %d)!", + number, block->discard, gBlocks[number].discard); } if (gBlocks[number].write && !gBlocks[number].written) - error("Block %Ld: has not been written yet!", number); + error(line, "Block %Ld: has not been written yet!", number); TEST_BLOCK_DATA(block, number, current); TEST_BLOCK_DATA(block, number, original); @@ -147,25 +191,18 @@ void -test_block(off_t block) -{ - test_blocks(block, 1); -} - - -void stop_test(void) { if (gCache == NULL) return; - test_blocks(0, MAX_BLOCKS); + TEST_BLOCKS(0, MAX_BLOCKS); block_cache_delete(gCache, true); } void -start_test(int32 test, const char* name, bool init = false) +start_test(const char* name, bool init = false) { if (init) { stop_test(); @@ -177,33 +214,99 @@ init_test_blocks(); } - gTest = test; + gTest++; gTestName = name; + gSubTest = 1; + printf("----------- Test %ld%s%s -----------\n", gTest, gTestName[0] ? " - " : "", gTestName); } +/*! Changes block 1 in main, block 2 if touchedInMain is \c true. + Changes block 0 in sub, discards block 2. + Performs two block tests. +*/ +void +basic_test_discard_in_sub(int32 id, bool touchedInMain) +{ + void* block; + + gBlocks[1].present = true; + gBlocks[1].read = true; + gBlocks[1].is_dirty = true; + gBlocks[1].original = gBlocks[1].current; + gBlocks[1].current |= BLOCK_CHANGED_IN_MAIN; + + block = block_cache_get_writable(gCache, 1, id); + or_block(block, BLOCK_CHANGED_IN_MAIN); + block_cache_put(gCache, 1); + + TEST_BLOCKS(0, 2); + + if (touchedInMain) { + gBlocks[2].present = true; + gBlocks[2].is_dirty = true; + gBlocks[2].current |= BLOCK_CHANGED_IN_MAIN; + + block = block_cache_get_empty(gCache, 2, id); + reset_block(block, 2); + or_block(block, BLOCK_CHANGED_IN_MAIN); + block_cache_put(gCache, 2); + } + + cache_start_sub_transaction(gCache, id); + + gBlocks[0].present = true; + gBlocks[0].read = true; + gBlocks[0].is_dirty = true; + if ((gBlocks[0].current & BLOCK_CHANGED_IN_MAIN) != 0) + gBlocks[0].parent = gBlocks[0].current; + else + gBlocks[0].original = gBlocks[0].current; + gBlocks[0].current |= BLOCK_CHANGED_IN_SUB; + + gBlocks[1].parent = gBlocks[1].current; + + block = block_cache_get_writable(gCache, 0, id); + or_block(block, BLOCK_CHANGED_IN_SUB); + block_cache_put(gCache, 0); + + gBlocks[2].discard = true; + + block_cache_discard(gCache, 2, 1); + + TEST_BLOCKS(0, 2); + + gBlocks[0].is_dirty = false; + gBlocks[0].write = true; + gBlocks[1].is_dirty = false; + gBlocks[1].write = true; + gBlocks[2].present = false; +} + + int main(int argc, char** argv) { block_cache_init(); - const void* block; + void* block; + int32 id; // TODO: test transaction-less block caches // TODO: test read-only block caches // Test transactions and block caches - start_test(1, "Discard simple", true); + start_test("Discard in main", true); - int32 id = cache_start_transaction(gCache); + id = cache_start_transaction(gCache); gBlocks[0].present = true; gBlocks[0].read = true; - block = block_cache_get(gCache, 0); + block_cache_get(gCache, 0); block_cache_put(gCache, 0); gBlocks[1].present = true; @@ -222,6 +325,109 @@ cache_end_transaction(gCache, id, NULL, NULL); cache_sync_transaction(gCache, id); + start_test("Discard in sub", true); + + id = cache_start_transaction(gCache); + + basic_test_discard_in_sub(id, false); + TEST_ASSERT(cache_blocks_in_sub_transaction(gCache, id) == 1); + + cache_end_transaction(gCache, id, NULL, NULL); + cache_sync_transaction(gCache, id); + + start_test("Discard in sub, present in main", true); + + id = cache_start_transaction(gCache); + + basic_test_discard_in_sub(id, true); + + cache_end_transaction(gCache, id, NULL, NULL); + cache_sync_transaction(gCache, id); + + start_test("Discard in sub, changed in main, abort sub", true); + + id = cache_start_transaction(gCache); + + basic_test_discard_in_sub(id, true); + TEST_ASSERT(cache_blocks_in_sub_transaction(gCache, id) == 1); + + gBlocks[0].current &= ~BLOCK_CHANGED_IN_SUB; + gBlocks[2].present = true; + gBlocks[2].is_dirty = false; + gBlocks[2].write = true; + gBlocks[2].discard = false; + + cache_abort_sub_transaction(gCache, id); + cache_end_transaction(gCache, id, NULL, NULL); + cache_sync_transaction(gCache, id); + + start_test("Discard in sub, changed in main, new sub", true); + + id = cache_start_transaction(gCache); + + basic_test_discard_in_sub(id, true); + + cache_start_sub_transaction(gCache, id); + cache_end_transaction(gCache, id, NULL, NULL); + cache_sync_transaction(gCache, id); + + start_test("Discard in sub, changed in main, detach sub", true); + + id = cache_start_transaction(gCache); + + basic_test_discard_in_sub(id, true); + + id = cache_detach_sub_transaction(gCache, id, NULL, NULL); + + gBlocks[0].is_dirty = true; + gBlocks[0].write = false; + gBlocks[1].is_dirty = true; + gBlocks[1].write = false; + + TEST_BLOCKS(0, 2); + + gBlocks[0].is_dirty = false; + gBlocks[0].write = true; + gBlocks[1].is_dirty = false; + gBlocks[1].write = true; + + cache_end_transaction(gCache, id, NULL, NULL); + cache_sync_transaction(gCache, id); + + start_test("Discard in sub, all changed in main, detach sub", true); + + id = cache_start_transaction(gCache); + + gBlocks[0].present = true; + gBlocks[0].read = true; + gBlocks[0].is_dirty = true; + gBlocks[0].original = gBlocks[0].current; + gBlocks[0].current |= BLOCK_CHANGED_IN_MAIN; + + block = block_cache_get_writable(gCache, 0, id); + or_block(block, BLOCK_CHANGED_IN_MAIN); + block_cache_put(gCache, 0); + + basic_test_discard_in_sub(id, true); + + id = cache_detach_sub_transaction(gCache, id, NULL, NULL); + + gBlocks[0].is_dirty = true; + gBlocks[0].write = false; + gBlocks[0].original |= BLOCK_CHANGED_IN_MAIN; + gBlocks[1].is_dirty = true; + gBlocks[1].write = false; + + TEST_BLOCKS(0, 2); + + gBlocks[0].is_dirty = false; + gBlocks[0].write = true; + gBlocks[1].is_dirty = false; + gBlocks[1].write = true; + + cache_end_transaction(gCache, id, NULL, NULL); + cache_sync_transaction(gCache, id); + stop_test(); return 0; } From axeld at mail.berlios.de Wed Nov 5 15:07:34 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 15:07:34 +0100 Subject: [Haiku-commits] r28515 - haiku/trunk/src/system/kernel/fs Message-ID: <200811051407.mA5E7YFV014468@sheep.berlios.de> Author: axeld Date: 2008-11-05 15:07:33 +0100 (Wed, 05 Nov 2008) New Revision: 28515 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28515&view=rev Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * Use parse_expression() for argument parsing. Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-11-05 13:52:34 UTC (rev 28514) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-11-05 14:07:33 UTC (rev 28515) @@ -3101,7 +3101,7 @@ struct hash_iterator iterator; dev_t device = parse_expression(argv[1]); - ino_t id = atoll(argv[2]); + ino_t id = parse_expression(argv[2]); hash_open(sVnodeTable, &iterator); while ((vnode = (struct vnode *)hash_next(sVnodeTable, &iterator)) != NULL) { @@ -3163,7 +3163,7 @@ // restrict dumped nodes to a certain device if requested dev_t device = -1; if (argc > 1) - device = atoi(argv[1]); + device = parse_expression(argv[1]); kprintf("address dev inode cache size pages\n"); From axeld at pinc-software.de Wed Nov 5 15:44:45 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 05 Nov 2008 15:44:45 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28504_-_haiku/trunk/src/add-ons/opengl?= =?utf-8?q?/mesa=5Fsoftware=5Frenderer?= In-Reply-To: Message-ID: <24150622054-BeMail@zon> "J?r?me Duval" wrote: > >> I thought it was BDirectWindow which allocates that area. > >> It's unclear to me how to better specify and handles this size: > > > the > >> size should be defined in a header somewhere. > > As long as it's not dynamic, it should indeed :-) > Public or private header ? That would be something for private only. Implementations should not assume a size, but use the clip_list_count field to know how much data to copy (and to see if their internal buffer is large enough to hold the array). Bye, Axel. From axeld at mail.berlios.de Wed Nov 5 16:22:58 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 16:22:58 +0100 Subject: [Haiku-commits] r28516 - haiku/trunk/src/system/kernel/cache Message-ID: <200811051522.mA5FMwI9020488@sheep.berlios.de> Author: axeld Date: 2008-11-05 16:22:58 +0100 (Wed, 05 Nov 2008) New Revision: 28516 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28516&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp Log: * wait_for_notifications() must make sure that the order of the notifications in the cache is the same as in the condition variable. It now uses the low-contention sCachesLock to accomplish this. * Also added an ASSERT to make sure the notification is no longer part of the list at this point. * Improved KDL command output. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-05 14:07:33 UTC (rev 28515) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-05 15:22:58 UTC (rev 28516) @@ -1431,6 +1431,8 @@ kprintf(" is-dirty"); if (block->unused) kprintf(" unused"); + if (block->discard) + kprintf(" discard"); kprintf("\n"); if (block->transaction != NULL) { kprintf(" transaction: %p (%ld)\n", block->transaction, @@ -1771,10 +1773,11 @@ static void wait_for_notifications(block_cache* cache) { + MutexLocker locker(sCachesLock); + if (find_thread(NULL) == sNotifierWriterThread) { // We're the notifier thread, don't wait, but flush all pending // notifications directly. - MutexLocker _(sCachesLock); if (is_valid_cache(cache)) flush_pending_notifications(cache); return; @@ -1789,9 +1792,14 @@ cache->condition_variable.Add(&entry); add_notification(cache, ¬ification, TRANSACTION_WRITTEN, false); + locker.Unlock(); // wait for notification hook to be called entry.Wait(); + + ASSERT(notification.GetDoublyLinkedListLink()->next == NULL + && notification.GetDoublyLinkedListLink()->previous == NULL + && cache->pending_notifications.Head() != ¬ification); } From stippi at mail.berlios.de Wed Nov 5 17:47:00 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 5 Nov 2008 17:47:00 +0100 Subject: [Haiku-commits] r28520 - haiku/trunk/src/apps/mediaplayer Message-ID: <200811051647.mA5Gl0fS029730@sheep.berlios.de> Author: stippi Date: 2008-11-05 17:46:59 +0100 (Wed, 05 Nov 2008) New Revision: 28520 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28520&view=rev Modified: haiku/trunk/src/apps/mediaplayer/Controller.h haiku/trunk/src/apps/mediaplayer/InfoWin.cpp Log: More or less applied patch by anxiety that implements showing a file icon in the MediaPlayer Info window. I changed it a bit, so that the icon retrieval only happens at the file change notification (quite important, since the info window receives playback position notifications). I also changed it to take the icon from the file first, if there is one. Thanks! Modified: haiku/trunk/src/apps/mediaplayer/Controller.h =================================================================== --- haiku/trunk/src/apps/mediaplayer/Controller.h 2008-11-05 16:17:33 UTC (rev 28519) +++ haiku/trunk/src/apps/mediaplayer/Controller.h 2008-11-05 16:46:59 UTC (rev 28520) @@ -79,6 +79,8 @@ // Controller status_t SetTo(const entry_ref &ref); + entry_ref Ref() const + { return fRef; } void PlayerActivated(bool active); void GetSize(int *width, int *height); Modified: haiku/trunk/src/apps/mediaplayer/InfoWin.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2008-11-05 16:17:33 UTC (rev 28519) +++ haiku/trunk/src/apps/mediaplayer/InfoWin.cpp 2008-11-05 16:46:59 UTC (rev 28520) @@ -23,8 +23,11 @@ #include #include +#include #include #include +#include +#include #include #include #include @@ -48,18 +51,40 @@ // should later draw an icon class InfoView : public BView { public: - InfoView(BRect frame, const char *name, float divider) - : BView(frame, name, B_FOLLOW_ALL, - B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE) - , fDivider(divider) - { } - virtual ~InfoView() - { } - void Draw(BRect updateRect); - float fDivider; + InfoView(BRect frame, const char* name, float divider); + virtual ~InfoView(); + virtual void Draw(BRect updateRect); + + status_t SetIcon(const entry_ref& ref); + status_t SetIcon(const char* mimeType); + void SetGenericIcon(); + +private: + float fDivider; + BBitmap* fIconBitmap; }; +InfoView::InfoView(BRect frame, const char *name, float divider) + : BView(frame, name, B_FOLLOW_ALL, B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), + fDivider(divider), + fIconBitmap(NULL) +{ + BRect rect(0, 0, B_LARGE_ICON - 1, B_LARGE_ICON - 1); + +#ifdef HAIKU_TARGET_PLATFORM_HAIKU + fIconBitmap = new BBitmap(rect, B_RGBA32); +#else + fIconBitmap = new BBitmap(rect, B_CMAP8); +#endif +} + + +InfoView::~InfoView() +{ + delete fIconBitmap; +} + void InfoView::Draw(BRect updateRect) { @@ -67,12 +92,66 @@ BRect r(Bounds()); r.right = r.left + fDivider; FillRect(r); + + if (fIconBitmap) { + float left = r.left + ( r.right - r.left ) / 2 - B_LARGE_ICON / 2; + SetDrawingMode(B_OP_ALPHA); + DrawBitmap(fIconBitmap, BPoint(left, r.top + B_LARGE_ICON / 2)); + } + SetHighColor(ui_color(B_DOCUMENT_TEXT_COLOR)); r.left = r.right; FillRect(r); } +status_t +InfoView::SetIcon(const entry_ref& ref) +{ + BNode node(&ref); + BNodeInfo info(&node); + return info.GetTrackerIcon(fIconBitmap, B_LARGE_ICON); +} + + +status_t +InfoView::SetIcon(const char* mimeTypeString) +{ + if (!mimeTypeString) + return B_BAD_VALUE; + + // get type icon + BMimeType mimeType(mimeTypeString); + status_t status = mimeType.GetIcon(fIconBitmap, B_LARGE_ICON); + + // get supertype icon + if (status != B_OK) { + BMimeType superType; + status = mimeType.GetSupertype(&superType); + if (status == B_OK) + status = superType.GetIcon(fIconBitmap, B_LARGE_ICON); + } + + return status; +} + + +void +InfoView::SetGenericIcon() +{ + // get default icon + BMimeType genericType(B_FILE_MIME_TYPE); + if (genericType.GetIcon(fIconBitmap, B_LARGE_ICON) != B_OK) { + // clear bitmap + uint8 transparent = 0; + if (fIconBitmap->ColorSpace() == B_CMAP8) + transparent = B_TRANSPARENT_MAGIC_CMAP8; + + memset(fIconBitmap->Bits(), transparent, fIconBitmap->BitsLength()); + } +} + + // #pragma mark - @@ -101,14 +180,13 @@ rect.right - 10, 20 + fh.ascent + 5), "filename", ""); + AddChild(fFilenameView); fFilenameView->SetFont(&bigFont); fFilenameView->SetViewColor(fInfoView->ViewColor()); fFilenameView->SetLowColor(fInfoView->ViewColor()); #ifdef B_BEOS_VERSION_DANO /* maybe we should support that as well ? */ fFilenameView->SetTruncation(B_TRUNCATE_END); #endif - AddChild(fFilenameView); - rect.top = BASE_HEIGHT; @@ -268,7 +346,7 @@ // audio track format information if ((which & INFO_AUDIO) && fController->AudioTrackCount() > 0) { - fLabelsView->Insert("Audio\n\n\n\n"); + fLabelsView->Insert("Audio\n\n\n"); BString s; media_format format; media_raw_audio_format audioFormat; @@ -361,14 +439,19 @@ } if (which & INFO_FILE) { + bool iconSet = false; if (fController->HasFile()) { - media_file_format ff; + entry_ref ref = fController->Ref(); + iconSet = fInfoView->SetIcon(ref) == B_OK; + media_file_format fileFormat; BString s; - if (fController->GetFileFormatInfo(&ff) == B_OK) { + if (fController->GetFileFormatInfo(&fileFormat) == B_OK) { fLabelsView->Insert("Container\n"); - s << ff.pretty_name; + s << fileFormat.pretty_name; s << "\n"; fContentsView->Insert(s.String()); + if (!iconSet) + iconSet = fInfoView->SetIcon(fileFormat.mime_type) == B_OK; } else fContentsView->Insert("\n"); fLabelsView->Insert("Location\n"); @@ -382,6 +465,8 @@ } else { fFilenameView->SetText(""); } + if (!iconSet) + fInfoView->SetGenericIcon(); } if ((which & INFO_COPYRIGHT) && fController->HasFile()) { From axeld at mail.berlios.de Wed Nov 5 17:09:47 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 17:09:47 +0100 Subject: [Haiku-commits] r28517 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200811051609.mA5G9lEx025415@sheep.berlios.de> Author: axeld Date: 2008-11-05 17:09:47 +0100 (Wed, 05 Nov 2008) New Revision: 28517 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28517&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp Log: * The block allocator now uses block_cache_discard() to make sure the file and the block cache don't interfere when working on the same blocks. * This has fixed all kinds of file corruptions I could reproduce before, therefore likely also bug #3010. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-11-05 15:22:58 UTC (rev 28516) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/BlockAllocator.cpp 2008-11-05 16:09:47 UTC (rev 28517) @@ -867,6 +867,11 @@ // If the value is not correct at mount time, it will be // fixed anyway. + // We need to flush any remaining blocks in the new allocation to make sure + // they won't interfere with the file cache. + block_cache_discard(fVolume->BlockCache(), fVolume->ToBlock(run), + run.Length()); + T(Allocate(run)); return B_OK; } From anevilyak at mail.berlios.de Wed Nov 5 17:17:34 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 5 Nov 2008 17:17:34 +0100 Subject: [Haiku-commits] r28519 - haiku/trunk/build/jam Message-ID: <200811051617.mA5GHYgw025990@sheep.berlios.de> Author: anevilyak Date: 2008-11-05 17:17:33 +0100 (Wed, 05 Nov 2008) New Revision: 28519 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28519&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: These dirs should exist by default in the image, various installers will fail since they're expected to be there. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-05 16:10:59 UTC (rev 28518) +++ haiku/trunk/build/jam/HaikuImage 2008-11-05 16:17:33 UTC (rev 28519) @@ -433,6 +433,8 @@ AddFilesToHaikuImage beos system add-ons disk_systems : intel bfs ; +AddDirectoryToHaikuImage home config add-ons kernel drivers bin ; +AddDirectoryToHaikuImage home config add-ons kernel drivers dev ; AddDirectoryToHaikuImage home config add-ons input_server devices ; AddDirectoryToHaikuImage home config add-ons input_server filters ; AddDirectoryToHaikuImage home config add-ons input_server methods ; From stippi at mail.berlios.de Wed Nov 5 17:11:00 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Wed, 5 Nov 2008 17:11:00 +0100 Subject: [Haiku-commits] r28518 - haiku/trunk/src/apps/mediaplayer Message-ID: <200811051611.mA5GB06O025643@sheep.berlios.de> Author: stippi Date: 2008-11-05 17:10:59 +0100 (Wed, 05 Nov 2008) New Revision: 28518 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28518&view=rev Modified: haiku/trunk/src/apps/mediaplayer/VideoView.cpp Log: Small cleanup. Use BitmapFlags() also in the other condition (don't hardcode overlay color space). Modified: haiku/trunk/src/apps/mediaplayer/VideoView.cpp =================================================================== --- haiku/trunk/src/apps/mediaplayer/VideoView.cpp 2008-11-05 16:09:47 UTC (rev 28517) +++ haiku/trunk/src/apps/mediaplayer/VideoView.cpp 2008-11-05 16:10:59 UTC (rev 28518) @@ -92,57 +92,60 @@ // we're going to deadlock when the window tells the node manager to // stop the nodes (Window -> NodeManager -> VideoConsumer -> VideoView // -> Window). - if (bitmap && LockLooperWithTimeout(10000) == B_OK) { - if (LockBitmap()) { - if (fOverlayMode || (BitmapFlags(bitmap) & B_BITMAP_WILL_OVERLAY)) { - if (!fOverlayMode) { - // init overlay - rgb_color key; - status_t ret = SetViewOverlay(bitmap, bitmap->Bounds(), - Bounds(), &key, B_FOLLOW_ALL, - B_OVERLAY_FILTER_HORIZONTAL - | B_OVERLAY_FILTER_VERTICAL); - if (ret == B_OK) { - fOverlayKeyColor = key; - SetViewColor(key); - SetLowColor(key); - snooze(20000); - FillRect(Bounds(), B_SOLID_LOW); - Sync(); - // use overlay from here on - fOverlayMode = true; + if (!bitmap || LockLooperWithTimeout(10000) != B_OK) + return; - // update restrictions - overlay_restrictions restrictions; - if (bitmap->GetOverlayRestrictions(&restrictions) - == B_OK) - fOverlayRestrictions = restrictions; - } else { - // try again next time - // synchronous draw - FillRect(Bounds()); - Sync(); - } + if (LockBitmap()) { + if (fOverlayMode + || (BitmapFlags(bitmap) & B_BITMAP_WILL_OVERLAY) != 0) { + if (!fOverlayMode) { + // init overlay + rgb_color key; + status_t ret = SetViewOverlay(bitmap, bitmap->Bounds(), + Bounds(), &key, B_FOLLOW_ALL, + B_OVERLAY_FILTER_HORIZONTAL + | B_OVERLAY_FILTER_VERTICAL); + if (ret == B_OK) { + fOverlayKeyColor = key; + SetViewColor(key); + SetLowColor(key); + snooze(20000); + FillRect(Bounds(), B_SOLID_LOW); + Sync(); + // use overlay from here on + fOverlayMode = true; + + // update restrictions + overlay_restrictions restrictions; + if (bitmap->GetOverlayRestrictions(&restrictions) + == B_OK) + fOverlayRestrictions = restrictions; } else { - // transfer overlay channel - rgb_color key; - SetViewOverlay(bitmap, bitmap->Bounds(), Bounds(), - &key, B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL - | B_OVERLAY_FILTER_VERTICAL - | B_OVERLAY_TRANSFER_CHANNEL); + // try again next time + // synchronous draw + FillRect(Bounds()); + Sync(); } - } else if (fOverlayMode && bitmap->ColorSpace() != B_YCbCr422) { - fOverlayMode = false; - ClearViewOverlay(); - SetViewColor(B_TRANSPARENT_COLOR); + } else { + // transfer overlay channel + rgb_color key; + SetViewOverlay(bitmap, bitmap->Bounds(), Bounds(), + &key, B_FOLLOW_ALL, B_OVERLAY_FILTER_HORIZONTAL + | B_OVERLAY_FILTER_VERTICAL + | B_OVERLAY_TRANSFER_CHANNEL); } - if (!fOverlayMode) - _DrawBitmap(bitmap); + } else if (fOverlayMode + && (BitmapFlags(bitmap) & B_BITMAP_WILL_OVERLAY) == 0) { + fOverlayMode = false; + ClearViewOverlay(); + SetViewColor(B_TRANSPARENT_COLOR); + } + if (!fOverlayMode) + _DrawBitmap(bitmap); - UnlockBitmap(); - } - UnlockLooper(); + UnlockBitmap(); } + UnlockLooper(); } From axeld at mail.berlios.de Wed Nov 5 19:12:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 19:12:01 +0100 Subject: [Haiku-commits] r28521 - in haiku/trunk: headers/os/kernel headers/private/kernel src/system/kernel Message-ID: <200811051812.mA5IC1vc014972@sheep.berlios.de> Author: axeld Date: 2008-11-05 19:11:58 +0100 (Wed, 05 Nov 2008) New Revision: 28521 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28521&view=rev Modified: haiku/trunk/headers/os/kernel/OS.h haiku/trunk/headers/private/kernel/thread_types.h haiku/trunk/src/system/kernel/thread.cpp Log: * Removed B_{MIN|MAX}_PRIORITY from OS.h - they were never really intended as public defines. They are now called THREAD_{MIN|MAX}_SET_PRIORITY to better reflect what they are for. Minimum priority is now 1, ie. you no longer can set another thread to the idle priority. This fixes part of ticket #2959. * set_thread_priority() will no longer allow to change the priority of the idle thread to something else. This fixes the rest of ticket #2959. * Automatic whitespace cleanup in OS.h. Modified: haiku/trunk/headers/os/kernel/OS.h =================================================================== --- haiku/trunk/headers/os/kernel/OS.h 2008-11-05 16:46:59 UTC (rev 28520) +++ haiku/trunk/headers/os/kernel/OS.h 2008-11-05 18:11:58 UTC (rev 28521) @@ -65,17 +65,17 @@ } area_info; /* area locking */ -#define B_NO_LOCK 0 -#define B_LAZY_LOCK 1 -#define B_FULL_LOCK 2 -#define B_CONTIGUOUS 3 +#define B_NO_LOCK 0 +#define B_LAZY_LOCK 1 +#define B_FULL_LOCK 2 +#define B_CONTIGUOUS 3 #define B_LOMEM 4 /* address spec for create_area(), and clone_area() */ -#define B_ANY_ADDRESS 0 -#define B_EXACT_ADDRESS 1 -#define B_BASE_ADDRESS 2 -#define B_CLONE_ADDRESS 3 +#define B_ANY_ADDRESS 0 +#define B_EXACT_ADDRESS 1 +#define B_BASE_ADDRESS 2 +#define B_CLONE_ADDRESS 3 #define B_ANY_KERNEL_ADDRESS 4 /* area protection */ @@ -153,7 +153,7 @@ } port_message_info; // similar to port_buffer_size_etc(), but returns (more) info -extern status_t _get_port_message_info_etc(port_id port, +extern status_t _get_port_message_info_etc(port_id port, port_message_info *info, size_t infoSize, uint32 flags, bigtime_t timeout); @@ -303,12 +303,10 @@ #define B_URGENT_PRIORITY 110 #define B_REAL_TIME_PRIORITY 120 -#define B_FIRST_REAL_TIME_PRIORITY B_REAL_TIME_DISPLAY_PRIORITY -#define B_MIN_PRIORITY B_IDLE_PRIORITY -#define B_MAX_PRIORITY B_REAL_TIME_PRIORITY - #define B_SYSTEM_TIMEBASE 0 +#define B_FIRST_REAL_TIME_PRIORITY B_REAL_TIME_DISPLAY_PRIORITY + typedef status_t (*thread_func)(void *); #define thread_entry thread_func /* thread_entry is for backward compatibility only! Use thread_func */ @@ -381,7 +379,7 @@ point errors, SIGILL for illegal instructions, etc). to re-enable the default debugger pass a zero. -*/ +*/ extern int disable_debugger(int state); // TODO: Remove. Temporary debug helper. @@ -452,9 +450,9 @@ B_CPU_PPC_IBM_POWER3 = 46, /* Intel */ - + /* Updated according to Intel(R) Processor Identification and - * the CPUID instruction (Table 4) + * the CPUID instruction (Table 4) * AP-485 Intel - 24161832.pdf */ B_CPU_INTEL_x86 = 0x1000, @@ -489,11 +487,11 @@ B_CPU_INTEL_PENTIUM_IV_MODEL_4, /* AMD */ - + /* Checked with "AMD Processor Recognition Application Note" * (Table 3) * 20734.pdf - */ + */ B_CPU_AMD_x86 = 0x1100, B_CPU_AMD_K5_MODEL_0 = 0x1150, B_CPU_AMD_K5_MODEL_1, @@ -517,15 +515,15 @@ B_CPU_AMD_ATHLON_XP_MODEL_7, B_CPU_AMD_ATHLON_XP_MODEL_8, B_CPU_AMD_ATHLON_XP_MODEL_10 = 0x116a, /* Barton */ - + B_CPU_AMD_SEMPRON_MODEL_8 = B_CPU_AMD_ATHLON_XP_MODEL_8, B_CPU_AMD_SEMPRON_MODEL_10 = B_CPU_AMD_ATHLON_XP_MODEL_10, /* According to "Revision Guide for AMD Family 10h - * Processors" (41322.pdf) + * Processors" (41322.pdf) */ B_CPU_AMD_PHENOM = 0x11f2, - + /* According to "Revision guide for AMD Athlon 64 * and AMD Opteron Processors" (25759.pdf) */ @@ -633,7 +631,7 @@ uint32 ebx; uint32 edx; uint32 ecx; - } regs; + } regs; } cpuid_info; extern status_t get_cpuid(cpuid_info *info, uint32 eaxRegister, uint32 cpuNum); Modified: haiku/trunk/headers/private/kernel/thread_types.h =================================================================== --- haiku/trunk/headers/private/kernel/thread_types.h 2008-11-05 16:46:59 UTC (rev 28520) +++ haiku/trunk/headers/private/kernel/thread_types.h 2008-11-05 18:11:58 UTC (rev 28521) @@ -34,6 +34,9 @@ // THREAD_STATE_BIRTH // thread is being created }; +#define THREAD_MIN_SET_PRIORITY B_LOWEST_ACTIVE_PRIORITY +#define THREAD_MAX_SET_PRIORITY B_REAL_TIME_PRIORITY + enum team_state { TEAM_STATE_NORMAL, // normal state TEAM_STATE_BIRTH, // being contructed @@ -49,6 +52,7 @@ JOB_CONTROL_STATE_DEAD } job_control_state; + struct image; // defined in image.c struct realtime_sem_context; // defined in realtime_sem.cpp struct select_info; Modified: haiku/trunk/src/system/kernel/thread.cpp =================================================================== --- haiku/trunk/src/system/kernel/thread.cpp 2008-11-05 16:46:59 UTC (rev 28520) +++ haiku/trunk/src/system/kernel/thread.cpp 2008-11-05 18:11:58 UTC (rev 28521) @@ -873,10 +873,10 @@ } prio = strtoul(argv[1], NULL, 0); - if (prio > B_MAX_PRIORITY) - prio = B_MAX_PRIORITY; - if (prio < B_MIN_PRIORITY) - prio = B_MIN_PRIORITY; + if (prio > THREAD_MAX_SET_PRIORITY) + prio = THREAD_MAX_SET_PRIORITY; + if (prio < THREAD_MIN_SET_PRIORITY) + prio = THREAD_MIN_SET_PRIORITY; if (argc > 2) id = strtoul(argv[2], NULL, 0); @@ -2502,33 +2502,35 @@ int32 oldPriority; // make sure the passed in priority is within bounds - if (priority > B_MAX_PRIORITY) - priority = B_MAX_PRIORITY; - if (priority < B_MIN_PRIORITY) - priority = B_MIN_PRIORITY; + if (priority > THREAD_MAX_SET_PRIORITY) + priority = THREAD_MAX_SET_PRIORITY; + if (priority < THREAD_MIN_SET_PRIORITY) + priority = THREAD_MIN_SET_PRIORITY; thread = thread_get_current_thread(); if (thread->id == id) { - // it's ourself, so we know we aren't in the run queue, and we can manipulate - // our structure directly + if (thread_is_idle_thread(thread)) + return B_NOT_ALLOWED; + + // It's ourself, so we know we aren't in the run queue, and we can + // manipulate our structure directly oldPriority = thread->priority; - // note that this might not return the correct value if we are preempted - // here, and another thread changes our priority before the next line is - // executed + // Note that this might not return the correct value if we are + // preempted here, and another thread changes our priority before + // the next line is executed. thread->priority = thread->next_priority = priority; } else { - cpu_status state = disable_interrupts(); - GRAB_THREAD_LOCK(); + InterruptsSpinLocker _(gThreadSpinlock); thread = thread_get_thread_struct_locked(id); - if (thread) { - oldPriority = thread->priority; - scheduler_set_thread_priority(thread, priority); - } else - oldPriority = B_BAD_THREAD_ID; + if (thread == NULL) + return B_BAD_THREAD_ID; - RELEASE_THREAD_LOCK(); - restore_interrupts(state); + if (thread_is_idle_thread(thread)) + return B_NOT_ALLOWED; + + oldPriority = thread->priority; + scheduler_set_thread_priority(thread, priority); } return oldPriority; From marcusoverhagen at arcor.de Wed Nov 5 20:14:57 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Wed, 05 Nov 2008 20:14:57 +0100 Subject: [Haiku-commits] r28509 - haiku/trunk/src/add-ons/media/media-add-ons/mixer In-Reply-To: <200811042348.mA4Nm1Sv032022@sheep.berlios.de> References: <200811042348.mA4Nm1Sv032022@sheep.berlios.de> Message-ID: <4911F0B1.6070108@arcor.de> leavengood at BerliOS schrieb: > Bug #1571: I think diver is right, the Info tab is pretty useless on the > mixer's controls, so I am removing it. Agreed. > - group->MakeNullParameter(PARAM_ETC(1003), B_MEDIA_RAW_AUDIO, "Version: " VERSION_STRING , B_GENERIC); > - group->MakeNullParameter(PARAM_ETC(1004), B_MEDIA_RAW_AUDIO, "Build: " BUILD_STRING Please also remove the definitions for those strings, they should be unused now. Thanks, Marcus From marcusoverhagen at arcor.de Wed Nov 5 20:49:04 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Wed, 05 Nov 2008 20:49:04 +0100 Subject: [Haiku-commits] r28501 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: <200811041627.mA4GRp5H018209@sheep.berlios.de> References: <200811041627.mA4GRp5H018209@sheep.berlios.de> Message-ID: <4911F8B0.1090707@arcor.de> jackburton at mail.berlios.de schrieb: > "char string[9]; string[9] = 0;" -> not nice. Enabled getting the device hid again, as it works correctly now Agreed, thats would be a buffer overrun. > + char hid[16] = ""; Thats ok. > - char hid[9]; > + char hid[16]; > - hid[8] = '\0'; > + hid[0] = '\0'; This was no buffer overrun. If the string needs to be empty initially, I would prefer the version with the = "" assignment. > - // TODO: Commented out for the time being, since it screws the output > - //device->acpi->get_device_hid(result, hid); > + device->acpi->get_device_hid(result, hid); Is there a reason why those get_* functions don't get passed the size of the buffer they are allowed to fill? perhaps can this be changed? regards MArcus From axeld at mail.berlios.de Wed Nov 5 22:37:29 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 5 Nov 2008 22:37:29 +0100 Subject: [Haiku-commits] r28522 - haiku/trunk/src/add-ons/kernel/file_systems/bfs Message-ID: <200811052137.mA5LbTr1016836@sheep.berlios.de> Author: axeld Date: 2008-11-05 22:37:28 +0100 (Wed, 05 Nov 2008) New Revision: 28522 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28522&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/ToDo Log: Brought ToDo file more or less up to date again. Modified: haiku/trunk/src/add-ons/kernel/file_systems/bfs/ToDo =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/bfs/ToDo 2008-11-05 18:11:58 UTC (rev 28521) +++ haiku/trunk/src/add-ons/kernel/file_systems/bfs/ToDo 2008-11-05 21:37:28 UTC (rev 28522) @@ -1,41 +1,23 @@ -BFS - ToDo, November 12th, 2004 +BFS - ToDo, November 5th, 2008 ----- BlockAllocator - - the BlockAllocator is only slightly optimized and probably slow - - the first free and the largest range are currently not correctly maintained (only efficiency suffers - it does work correctly) + - the BlockAllocator is only slightly optimized - the allocation policies will have to stand against some real world tests - - the access to the block bitmap is currently managed using a global lock (doesn't matter as long as transactions are serialized) DataStream - - only files are trimmed back (in bfs_close()), but every inode has a preallocated stream... - Inode::GrowStream(): merging of block_runs doesn't work between range/block boundaries - - check the array block size in BFS for different block sizes Queries - There shouldn't be any cases where you can speed up a query with reordering the query expression - test it - - Check permissions of the parent directories - - Add protection against crashing applications which had a query open - at least the original BeOS kernel does not free the cookie (which throws some memory away *and* prevents unmounting the disk), but that won't be needed for OpenBeOS - - the query set for "!=" and last_modified/size is not the same as for "="; last_modified/size don't contain directories - check if the query has to be checked for a live update - - accept hex values 0x... -Journal - - - Check if there are any standard and often-happening cases for a transaction to fail, and if so, start the transaction only when necessary - - if the system crashes between bfs_unlink() and bfs_remove_vnode(), the inode can be removed from the tree, but its memory is still allocated - this can happen if the inode is still in use by someone (and that's what the "chkbfs" utility is for, mainly). - - add delayed index updating (+ delete actions to solve the issue above) - - multiple log files, parallel transactions? (note that parallel transactions would require more locking to be done) - - variable sized log file - - as long as we have a fixed-sized log file, it should be possible to reserve space for a transaction to be able to decide if batching it is possible - - BPlusTree - BPlusTree::Remove() could trigger CachedNode::Free() to go through the free nodes list and free all pages at the end of the data stream @@ -49,7 +31,6 @@ - exchange Inode::OldLastModified() with Inode::NewLastModified(), and don't change the last_modified field directly in Inode::WriteAt() for consistency in case of a crash - the size is only updated in bfs_close() - but if the system crashes before, the entry in the size index doesn't match the one in the inode anymore - it would be better to let the data.size not reflect the real file size in this case (since the max_xxx_range entries are always correct) - Inode::FillGapWithZeros() currently disabled; apart from being slow, it really shouldn't be executed while a transaction is running, because that stops all other threads from doing anything (which can be a long time for a 100 MB file) - - need better locking mechanism in combination with B+trees etc.! Indices @@ -58,26 +39,27 @@ - clearing up Index::Update() and live query update (seems to be a bit confusing right now) - investigate adding an index cache to improve performance + Attributes - - Inode::WriteAttribute() doesn't check if the attribute data may fit into the small_data region if there already is that attribute as an attribute file - for indices, we could get the old data from there when doing a query update + - "pos" is ignored when writing attributes in the small data section (reading works) -Volume +Future BFS + - put more than just an inode into a block + - make query indices useful for user oriented queries (*[Hh][Oo][Ww]?*) + - delayed allocation to be able to make better block allocation decisions + - if the system crashes between bfs_unlink() and bfs_remove_vnode(), the inode can be removed from the tree, but its memory is still allocated - this can happen if the inode is still in use by someone (and that's what the "chkbfs" utility is for, mainly). + - add delayed index updating (+ delete actions to solve the issue above) + - multiple log files, parallel transactions? (note that parallel transactions would require more locking to be done) + - variable sized log file + - the access to the block bitmap is currently managed using a global lock (doesn't matter as long as transactions are serialized) + - Check permissions of the parent directories for query results + - ... -kernel_interface - - missing functions, maybe they are not really needed: bfs_rename_attr(), bfs_rename_index(), bfs_initialize(), bfs_link() - - bfs_rename() currently doesn't respect any permissions - - -general stuff - - - There are also some comments with a leading "ToDo:" directly in the code which may not be mentioned here. - - ----- Axel D?rfler axeld at pinc-software.de From bonefish at mail.berlios.de Thu Nov 6 00:02:33 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Thu, 6 Nov 2008 00:02:33 +0100 Subject: [Haiku-commits] r28523 - haiku/trunk/build/jam Message-ID: <200811052302.mA5N2XDa026916@sheep.berlios.de> Author: bonefish Date: 2008-11-06 00:02:33 +0100 (Thu, 06 Nov 2008) New Revision: 28523 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28523&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Perl's old location was /boot/home/config/bin not /bin. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-05 21:37:28 UTC (rev 28522) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-05 23:02:33 UTC (rev 28523) @@ -414,7 +414,7 @@ : $(baseURL)/perl-5.10.0-gcc2-2008-10-29.zip : ; - AddSymlinkToHaikuImage bin : /boot/common/bin/perl : perl ; + AddSymlinkToHaikuImage home config bin : /boot/common/bin/perl : perl ; } } From julun at mail.berlios.de Thu Nov 6 00:23:02 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Thu, 6 Nov 2008 00:23:02 +0100 Subject: [Haiku-commits] r28524 - in haiku/trunk: headers/private/shared src/kits/shared Message-ID: <200811052323.mA5NN2nA031279@sheep.berlios.de> Author: julun Date: 2008-11-06 00:23:02 +0100 (Thu, 06 Nov 2008) New Revision: 28524 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28524&view=rev Modified: haiku/trunk/headers/private/shared/DateTime.h haiku/trunk/src/kits/shared/DateTime.cpp Log: * fix wrong cast in Minute() * fix _SetTime(), was using the wrong * operator, resulting in an overflow at some point that lead to the mentioned jumping fixes 2878 and 3057 Modified: haiku/trunk/headers/private/shared/DateTime.h =================================================================== --- haiku/trunk/headers/private/shared/DateTime.h 2008-11-05 23:02:33 UTC (rev 28523) +++ haiku/trunk/headers/private/shared/DateTime.h 2008-11-05 23:23:02 UTC (rev 28524) @@ -71,8 +71,8 @@ private: bigtime_t _Microseconds() const; void _AddMicroseconds(bigtime_t microseconds); - bool _SetTime(int32 hour, int32 minute, int32 second, - int32 microsecond); + bool _SetTime(bigtime_t hour, bigtime_t minute, bigtime_t second, + bigtime_t microsecond); private: bigtime_t fMicroseconds; Modified: haiku/trunk/src/kits/shared/DateTime.cpp =================================================================== --- haiku/trunk/src/kits/shared/DateTime.cpp 2008-11-05 23:02:33 UTC (rev 28523) +++ haiku/trunk/src/kits/shared/DateTime.cpp 2008-11-05 23:23:02 UTC (rev 28524) @@ -24,8 +24,8 @@ const int32 kSecondsPerDay = 86400; const int32 kMillisecondsPerDay = 86400000; -const int32 kMicrosecondsPerSecond = 1000000; -const int32 kMicrosecondsPerMinute = 60000000; +const bigtime_t kMicrosecondsPerSecond = 1000000LL; +const bigtime_t kMicrosecondsPerMinute = 60000000LL; const bigtime_t kMicrosecondsPerHour = 3600000000LL; const bigtime_t kMicrosecondsPerDay = 86400000000LL; @@ -70,7 +70,7 @@ BTime - BTime::CurrentTime(time_type type) +BTime::CurrentTime(time_type type) { struct timeval tv; if (gettimeofday(&tv, NULL) != 0) { @@ -162,7 +162,7 @@ int32 BTime::Minute() const { - return int32((_Microseconds() % kMicrosecondsPerHour)) / kMicrosecondsPerMinute; + return int32(((_Microseconds() % kMicrosecondsPerHour)) / kMicrosecondsPerMinute); } @@ -274,7 +274,8 @@ bool -BTime::_SetTime(int32 hour, int32 minute, int32 second, int32 microsecond) +BTime::_SetTime(bigtime_t hour, bigtime_t minute, bigtime_t second, + bigtime_t microsecond) { fMicroseconds = hour * kMicrosecondsPerHour + minute * kMicrosecondsPerMinute + From korli at mail.berlios.de Thu Nov 6 00:40:30 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 6 Nov 2008 00:40:30 +0100 Subject: [Haiku-commits] r28525 - in haiku/trunk: headers/private/interface src/add-ons/opengl/mesa_software_renderer src/kits/opengl Message-ID: <200811052340.mA5NeU7a012782@sheep.berlios.de> Author: korli Date: 2008-11-06 00:40:29 +0100 (Thu, 06 Nov 2008) New Revision: 28525 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28525&view=rev Modified: haiku/trunk/headers/private/interface/DirectWindowPrivate.h haiku/trunk/src/add-ons/opengl/mesa_software_renderer/Jamfile haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp haiku/trunk/src/kits/opengl/GLView.cpp haiku/trunk/src/kits/opengl/Jamfile Log: now uses DIRECT_BUFFER_INFO_AREA_SIZE as the direct_buffer_info area size Modified: haiku/trunk/headers/private/interface/DirectWindowPrivate.h =================================================================== --- haiku/trunk/headers/private/interface/DirectWindowPrivate.h 2008-11-05 23:23:02 UTC (rev 28524) +++ haiku/trunk/headers/private/interface/DirectWindowPrivate.h 2008-11-05 23:40:29 UTC (rev 28525) @@ -9,6 +9,9 @@ #include +#define DIRECT_BUFFER_INFO_AREA_SIZE B_PAGE_SIZE + + struct direct_window_sync_data { area_id area; sem_id disable_sem; Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/Jamfile =================================================================== --- haiku/trunk/src/add-ons/opengl/mesa_software_renderer/Jamfile 2008-11-05 23:23:02 UTC (rev 28524) +++ haiku/trunk/src/add-ons/opengl/mesa_software_renderer/Jamfile 2008-11-05 23:40:29 UTC (rev 28525) @@ -26,7 +26,7 @@ SubDirC++Flags [ FDefines $(defines) ] ; } -UsePrivateHeaders opengl ; +UsePrivateHeaders interface opengl ; UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa ] ; UseHeaders [ FDirName $(HAIKU_TOP) src kits opengl mesa main ] ; Modified: haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp =================================================================== --- haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2008-11-05 23:23:02 UTC (rev 28524) +++ haiku/trunk/src/add-ons/opengl/mesa_software_renderer/MesaSoftwareRenderer.cpp 2008-11-05 23:40:29 UTC (rev 28525) @@ -18,6 +18,7 @@ #include "MesaSoftwareRenderer.h" #include +#include #include #include @@ -563,11 +564,9 @@ BAutolock lock(fInfoLocker); if (info) { if (!fInfo) { - // TODO size of info != sizeof(direct_buffer_info) - // see GLView.cpp in glview_direct_info::glview_direct_info() - fInfo = (direct_buffer_info *)calloc(1, B_PAGE_SIZE); + fInfo = (direct_buffer_info *)calloc(1, DIRECT_BUFFER_INFO_AREA_SIZE); } - memcpy(fInfo, info, B_PAGE_SIZE); + memcpy(fInfo, info, DIRECT_BUFFER_INFO_AREA_SIZE); } else if (fInfo) { free(fInfo); fInfo = NULL; Modified: haiku/trunk/src/kits/opengl/GLView.cpp =================================================================== --- haiku/trunk/src/kits/opengl/GLView.cpp 2008-11-05 23:23:02 UTC (rev 28524) +++ haiku/trunk/src/kits/opengl/GLView.cpp 2008-11-05 23:40:29 UTC (rev 28525) @@ -41,6 +41,7 @@ #include #include +#include "DirectWindowPrivate.h" #include "GLRendererRoster.h" struct glview_direct_info { @@ -568,7 +569,7 @@ glview_direct_info::glview_direct_info() { // TODO: See direct_window_data() in app_server's ServerWindow.cpp - direct_info = (direct_buffer_info *)calloc(1, B_PAGE_SIZE); + direct_info = (direct_buffer_info *)calloc(1, DIRECT_BUFFER_INFO_AREA_SIZE); direct_connected = false; enable_direct_mode = false; } Modified: haiku/trunk/src/kits/opengl/Jamfile =================================================================== --- haiku/trunk/src/kits/opengl/Jamfile 2008-11-05 23:23:02 UTC (rev 28524) +++ haiku/trunk/src/kits/opengl/Jamfile 2008-11-05 23:40:29 UTC (rev 28525) @@ -2,7 +2,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; -UsePrivateHeaders opengl ; +UsePrivateHeaders interface opengl ; UsePrivateSystemHeaders ; if $(TARGET_PLATFORM) != haiku { From korli at mail.berlios.de Thu Nov 6 00:44:15 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 6 Nov 2008 00:44:15 +0100 Subject: [Haiku-commits] r28526 - haiku/trunk/src/servers/app Message-ID: <200811052344.mA5NiFBb015849@sheep.berlios.de> Author: korli Date: 2008-11-06 00:44:14 +0100 (Thu, 06 Nov 2008) New Revision: 28526 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28526&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: now uses DIRECT_BUFFER_INFO_AREA_SIZE as the direct_buffer_info area size Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-05 23:40:29 UTC (rev 28525) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-05 23:44:14 UTC (rev 28526) @@ -3325,7 +3325,7 @@ fDirectWindowData->buffer_info->window_bounds = to_clipping_rect(fWindow->Frame()); // TODO: Review this - const int32 kMaxClipRectsCount = (B_PAGE_SIZE - sizeof(direct_buffer_info)) + const int32 kMaxClipRectsCount = (DIRECT_BUFFER_INFO_AREA_SIZE - sizeof(direct_buffer_info)) / sizeof(clipping_rect); // We just want the region inside the window, border excluded. From anevilyak at mail.berlios.de Thu Nov 6 01:35:19 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Thu, 6 Nov 2008 01:35:19 +0100 Subject: [Haiku-commits] r28527 - haiku/trunk/build/jam Message-ID: <200811060035.mA60ZJ1n001203@sheep.berlios.de> Author: anevilyak Date: 2008-11-06 01:35:19 +0100 (Thu, 06 Nov 2008) New Revision: 28527 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28527&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Incorrectly specified that jam rule, that link should go in beos/bin since that's what /bin actually points to. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-05 23:44:14 UTC (rev 28526) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-06 00:35:19 UTC (rev 28527) @@ -241,7 +241,7 @@ : $(baseURL)/m4-1.4.12-gcc2-2008-11-04.zip : ; - AddSymlinkToHaikuImage bin : /boot/common/bin/m4 : m4 ; + AddSymlinkToHaikuImage beos bin : /boot/common/bin/m4 : m4 ; InstallOptionalHaikuImagePackage autoconf-2.61-gcc2-2008-03-24 : $(baseURL)/autoconf-2.61-gcc2-2008-03-24.zip From anevilyak at mail.berlios.de Thu Nov 6 04:07:43 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Thu, 6 Nov 2008 04:07:43 +0100 Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse Message-ID: <200811060307.mA637hxL021728@sheep.berlios.de> Author: anevilyak Date: 2008-11-06 04:07:38 +0100 (Thu, 06 Nov 2008) New Revision: 28528 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28528&view=rev Modified: haiku/trunk/src/preferences/mouse/MouseView.cpp haiku/trunk/src/preferences/mouse/MouseView.h Log: Rework this a bit to handle ctrl+clicking and ctrl+alt+clicking for right and middle mouse button. Fixes ticket #3061. Modified: haiku/trunk/src/preferences/mouse/MouseView.cpp =================================================================== --- haiku/trunk/src/preferences/mouse/MouseView.cpp 2008-11-06 00:35:19 UTC (rev 28527) +++ haiku/trunk/src/preferences/mouse/MouseView.cpp 2008-11-06 03:07:38 UTC (rev 28528) @@ -100,6 +100,7 @@ //fMouseDownBitmap = BTranslationUtils::GetBitmap(B_PNG_FORMAT, "pressed_mouse_bmap"); fMouseDownBounds = fMouseDownBitmap->Bounds(); + SetEventMask(B_POINTER_EVENTS, B_NO_POINTER_HISTORY); } @@ -119,10 +120,34 @@ *_height = fMouseBitmap != NULL ? fMouseBitmap->Bounds().Height() : 82; } +void +MouseView::MouseUp(BPoint) +{ + fButtons = 0; + Invalidate(BRect(0, kButtonTop, fMouseDownBounds.Width(), + kButtonTop + fMouseDownBounds.Height())); + fOldButtons = fButtons; +} void MouseView::MouseDown(BPoint where) { + BMessage *mouseMsg = Window()->CurrentMessage(); + fButtons = mouseMsg->FindInt32("buttons"); + int32 modifiers = mouseMsg->FindInt32("modifiers"); + if (modifiers & B_CONTROL_KEY) { + if (modifiers & B_COMMAND_KEY) + fButtons = B_TERTIARY_MOUSE_BUTTON; + else + fButtons = B_SECONDARY_MOUSE_BUTTON; + } + + if (fOldButtons != fButtons) { + Invalidate(BRect(0, kButtonTop, + fMouseDownBounds.Width(), kButtonTop + fMouseDownBounds.Height())); + fOldButtons = fButtons; + } + const int32 *offset = getButtonOffsets(fType); int32 button = -1; for (int32 i = 0; i <= fType; i++) { @@ -168,20 +193,6 @@ } -void -MouseView::Pulse() -{ - BPoint point; - GetMouse(&point, &fButtons, true); - - if (fOldButtons != fButtons) { - Invalidate(BRect(0, kButtonTop, - fMouseDownBounds.Width(), kButtonTop + fMouseDownBounds.Height())); - fOldButtons = fButtons; - } -} - - void MouseView::Draw(BRect updateFrame) { Modified: haiku/trunk/src/preferences/mouse/MouseView.h =================================================================== --- haiku/trunk/src/preferences/mouse/MouseView.h 2008-11-06 00:35:19 UTC (rev 28527) +++ haiku/trunk/src/preferences/mouse/MouseView.h 2008-11-06 03:07:38 UTC (rev 28528) @@ -32,8 +32,8 @@ virtual void AttachedToWindow(); virtual void MouseDown(BPoint where); + virtual void MouseUp(BPoint where); virtual void Draw(BRect frame); - virtual void Pulse(); virtual void GetPreferredSize(float *_width, float *_height); void SetMouseType(int32 type); From axeld at pinc-software.de Thu Nov 6 09:31:48 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 06 Nov 2008 09:31:48 +0100 CET Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: <200811060307.mA637hxL021728@sheep.berlios.de> Message-ID: <2420802892-BeMail@zon> anevilyak at BerliOS wrote: > Log: > Rework this a bit to handle ctrl+clicking and ctrl+alt+clicking for > right and middle mouse button. > Fixes ticket #3061. I missed that bug; who is responsible for that mapping? And if it is system wide, why doesn't it work in the Mouse preferences app automatically? If it is not system wide, the Mouse preferences shouldn't fool you. Also, under BeOS, I can only use Ctrl+Alt-click for a right mouse button click, I didn't find a combination to simulate a middle mouse button. > @@ -119,10 +120,34 @@ > *_height = fMouseBitmap != NULL ? fMouseBitmap-> > Bounds().Height() : 82; > } > > +void Two blank lines between functions... > +MouseView::MouseUp(BPoint) > +{ [...] > +} > > void And again. Bye, Axel. From stefano.ceccherini at gmail.com Thu Nov 6 11:41:44 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 6 Nov 2008 11:41:44 +0100 Subject: [Haiku-commits] r28501 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: <4911F8B0.1090707@arcor.de> References: <200811041627.mA4GRp5H018209@sheep.berlios.de> <4911F8B0.1090707@arcor.de> Message-ID: <894b9700811060241i185e112bpab3596b3c94a2d49@mail.gmail.com> 2008/11/5 Marcus Overhagen : > jackburton at mail.berlios.de schrieb: > >> "char string[9]; string[9] = 0;" -> not nice. Enabled getting the device hid again, as it works correctly now > Agreed, thats would be a buffer overrun. > >> + char hid[16] = ""; > Thats ok. > > >> - char hid[9]; >> + char hid[16]; >> - hid[8] = '\0'; >> + hid[0] = '\0'; > > This was no buffer overrun. If the string needs to be empty initially, I > would prefer the version with the = "" assignment. Of course it was not. But still, the string needs to be empty initially. > Is there a reason why those get_* functions don't get passed the size of > the buffer they are allowed to fill? I don' t know. This is how it was done already. I guess that they assume that the passed buffers are big enough for the type of objects they want to retrieve. >perhaps can this be changed? Yes, I think this can be done. From stippi at mail.berlios.de Thu Nov 6 12:18:01 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 6 Nov 2008 12:18:01 +0100 Subject: [Haiku-commits] r28529 - haiku/trunk/src/apps/networkstatus Message-ID: <200811061118.mA6BI10A025282@sheep.berlios.de> Author: stippi Date: 2008-11-06 12:18:01 +0100 (Thu, 06 Nov 2008) New Revision: 28529 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28529&view=rev Modified: haiku/trunk/src/apps/networkstatus/NetworkStatusView.cpp Log: Free buffer in error case. Modified: haiku/trunk/src/apps/networkstatus/NetworkStatusView.cpp =================================================================== --- haiku/trunk/src/apps/networkstatus/NetworkStatusView.cpp 2008-11-06 03:07:38 UTC (rev 28528) +++ haiku/trunk/src/apps/networkstatus/NetworkStatusView.cpp 2008-11-06 11:18:01 UTC (rev 28529) @@ -447,8 +447,10 @@ config.ifc_len = count * sizeof(struct ifreq); config.ifc_buf = buffer; - if (ioctl(fSocket, SIOCGIFCONF, &config, sizeof(struct ifconf)) < 0) + if (ioctl(fSocket, SIOCGIFCONF, &config, sizeof(struct ifconf)) < 0) { + free(buffer); return; + } ifreq *interface = (ifreq *)buffer; From stippi at mail.berlios.de Thu Nov 6 12:18:26 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 6 Nov 2008 12:18:26 +0100 Subject: [Haiku-commits] r28530 - haiku/trunk/src/apps/soundrecorder Message-ID: <200811061118.mA6BIQNI025330@sheep.berlios.de> Author: stippi Date: 2008-11-06 12:18:26 +0100 (Thu, 06 Nov 2008) New Revision: 28530 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28530&view=rev Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp Log: Small coding style fix. Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-06 11:18:01 UTC (rev 28529) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-06 11:18:26 UTC (rev 28530) @@ -1148,7 +1148,8 @@ } void -RecorderWindow::RecordFile(void * cookie, bigtime_t timestamp, void * data, size_t size, const media_raw_audio_format & format) +RecorderWindow::RecordFile(void * cookie, bigtime_t timestamp, + void * data, size_t size, const media_raw_audio_format & format) { // Callback called from the SoundConsumer when receiving buffers. assert((format.format & 0x02) && format.channel_count); From axeld at mail.berlios.de Thu Nov 6 12:26:01 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 6 Nov 2008 12:26:01 +0100 Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix Message-ID: <200811061126.mA6BQ1JN025737@sheep.berlios.de> Author: axeld Date: 2008-11-06 12:26:01 +0100 (Thu, 06 Nov 2008) New Revision: 28531 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28531&view=rev Modified: haiku/trunk/src/system/libroot/posix/glob.c Log: * Updating glob() actually broke it, since Haiku does have broken mbrtowc(), and wcrtomb() functions. I worked around the issue, and added a build warning so that we don't forget to change it back once we have working versions of those. * This lets apps like "ftp", and "sftp" work again. Modified: haiku/trunk/src/system/libroot/posix/glob.c =================================================================== --- haiku/trunk/src/system/libroot/posix/glob.c 2008-11-06 11:18:26 UTC (rev 28530) +++ haiku/trunk/src/system/libroot/posix/glob.c 2008-11-06 11:26:01 UTC (rev 28531) @@ -109,7 +109,7 @@ #define SLASH '/' #define COMMA ',' -#ifndef DEBUG +#if !defined(DEBUG) && !defined(__HAIKU__) #define M_QUOTE 0x8000000000ULL #define M_PROTECT 0x4000000000ULL @@ -164,6 +164,30 @@ static void qprintf(const char *, Char *); #endif +#ifdef __HAIKU__ +# warning glob() wants to use wide character functions + +static size_t +my_wcrtomb(char* to, char wchar, mbstate_t* state) +{ + *to = wchar; + return 1; +} + +static size_t +my_mbrtowc(wchar_t* to, const char* string, size_t len, mbstate_t* state) +{ + if (!string[0]) + return 0; + *to = *string; + return 1; +} + +# define wcrtomb my_wcrtomb +# define mbrtowc my_mbrtowc +#endif + + int glob(const char *pattern, int flags, int (*errfunc)(const char *, int), glob_t *pglob) { From stippi at mail.berlios.de Thu Nov 6 12:31:43 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 6 Nov 2008 12:31:43 +0100 Subject: [Haiku-commits] r28532 - in haiku/trunk: headers/os/interface headers/private/interface src/kits/interface src/kits/interface/textview_support src/kits/tracker Message-ID: <200811061131.mA6BVhGQ027943@sheep.berlios.de> Author: stippi Date: 2008-11-06 12:31:40 +0100 (Thu, 06 Nov 2008) New Revision: 28532 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28532&view=rev Modified: haiku/trunk/headers/os/interface/TextView.h haiku/trunk/headers/private/interface/WidthBuffer.h haiku/trunk/src/kits/interface/InterfaceDefs.cpp haiku/trunk/src/kits/interface/TextView.cpp haiku/trunk/src/kits/interface/textview_support/WidthBuffer.cpp haiku/trunk/src/kits/tracker/PoseView.cpp haiku/trunk/src/kits/tracker/PoseView.h Log: * Moved the global BPrivate::WidthBuffer from BTextView into BPrivate as gWidthBuffer. * Tracker PoseView now uses BPrivate::gWidthBuffer instead of it's own instance. * TextView.h and PoseView.h are now a little cleaner. * InterfaceDefs.cpp now deletes gWidthBuffer in _fini_interface_kit_(). * Added binary compatibility support for NetPositive in WidthBuffer.h and .cpp. Obviously it kind of defeats the purpose of having WidthBuffer neatly tucked away in the BPrivate namespace, but Haiku should run NetPositive, I guess. Fixes #2879. Modified: haiku/trunk/headers/os/interface/TextView.h =================================================================== --- haiku/trunk/headers/os/interface/TextView.h 2008-11-06 11:26:01 UTC (rev 28531) +++ haiku/trunk/headers/os/interface/TextView.h 2008-11-06 11:31:40 UTC (rev 28532) @@ -16,9 +16,6 @@ class BList; class BMessageRunner; -extern "C" status_t _init_interface_kit_(); - - struct text_run { int32 offset; BFont font; @@ -40,7 +37,6 @@ }; namespace BPrivate { - class WidthBuffer; class TextGapBuffer; } // namespace BPrivate @@ -276,7 +272,6 @@ class TypingUndoBuffer; friend class TextTrackState; - friend status_t _init_interface_kit_(); virtual void _ReservedTextView3(); virtual void _ReservedTextView4(); @@ -417,8 +412,6 @@ LayoutData* fLayoutData; uint32 _reserved[8]; - - static BPrivate::WidthBuffer* sWidths; }; #endif // _TEXTVIEW_H Modified: haiku/trunk/headers/private/interface/WidthBuffer.h =================================================================== --- haiku/trunk/headers/private/interface/WidthBuffer.h 2008-11-06 11:26:01 UTC (rev 28531) +++ haiku/trunk/headers/private/interface/WidthBuffer.h 2008-11-06 11:31:40 UTC (rev 28532) @@ -78,6 +78,23 @@ static uint32 Hash(uint32); }; +extern WidthBuffer* gWidthBuffer; + } // namespace BPrivate +using BPrivate::WidthBuffer; + +#if __GNUC__ < 3 +//! NetPositive binary compatibility support + +class _BWidthBuffer_ : public _BTextViewSupportBuffer_ { + _BWidthBuffer_(); + virtual ~_BWidthBuffer_(); +}; + +extern +_BWidthBuffer_* gCompatibilityWidthBuffer; + +#endif // __GNUC__ < 3 + #endif // __WIDTHBUFFER_H Modified: haiku/trunk/src/kits/interface/InterfaceDefs.cpp =================================================================== --- haiku/trunk/src/kits/interface/InterfaceDefs.cpp 2008-11-06 11:26:01 UTC (rev 28531) +++ haiku/trunk/src/kits/interface/InterfaceDefs.cpp 2008-11-06 11:31:40 UTC (rev 28532) @@ -904,7 +904,7 @@ if (status < B_OK) return status; - BTextView::sWidths = new BPrivate::WidthBuffer; + BPrivate::gWidthBuffer = new BPrivate::WidthBuffer; _init_global_fonts_(); @@ -927,8 +927,11 @@ extern "C" status_t _fini_interface_kit_() { - //TODO: Implement ? + delete BPrivate::gWidthBuffer; + BPrivate::gWidthBuffer = NULL; + // TODO: Anything else? + return B_OK; } @@ -1470,4 +1473,3 @@ strlcpy(dest, source, length + 1); } } - Modified: haiku/trunk/src/kits/interface/TextView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TextView.cpp 2008-11-06 11:26:01 UTC (rev 28531) +++ haiku/trunk/src/kits/interface/TextView.cpp 2008-11-06 11:31:40 UTC (rev 28532) @@ -152,10 +152,7 @@ bool valid; }; -// Initialized/finalized by init/fini_interface_kit -BPrivate::WidthBuffer* BTextView::sWidths = NULL; - const static rgb_color kBlackColor = { 0, 0, 0, 255 }; const static rgb_color kBlueInputColor = { 152, 203, 255, 255 }; const static rgb_color kRedInputColor = { 255, 152, 152, 255 }; @@ -3824,8 +3821,9 @@ #if USE_WIDTHBUFFER // Use _BWidthBuffer_ if possible - if (sWidths != NULL) { - result += sWidths->StringWidth(*fText, fromOffset, numChars, font); + if (BPrivate::gWidthBuffer != NULL) { + result += BPrivate::gWidthBuffer->StringWidth(*fText, fromOffset, + numChars, font); } else { #endif const char* text = fText->GetString(fromOffset, &numChars); Modified: haiku/trunk/src/kits/interface/textview_support/WidthBuffer.cpp =================================================================== --- haiku/trunk/src/kits/interface/textview_support/WidthBuffer.cpp 2008-11-06 11:26:01 UTC (rev 28531) +++ haiku/trunk/src/kits/interface/textview_support/WidthBuffer.cpp 2008-11-06 11:31:40 UTC (rev 28532) @@ -20,13 +20,17 @@ #include +//! NetPositive binary compatibility support +class _BWidthBuffer_; + namespace BPrivate { const static uint32 kTableCount = 128; const static uint32 kInvalidCode = 0xFFFFFFFF; static BLocker sWidthLocker = BLocker("width buffer lock"); +WidthBuffer* gWidthBuffer = NULL; + // initialized in InterfaceDefs.cpp - struct hashed_escapement { uint32 code; float escapement; @@ -363,3 +367,28 @@ } // namespace BPrivate + +#if __GNUC__ < 3 +//! NetPositive binary compatibility support + +_BWidthBuffer_::_BWidthBuffer_() +{ +} + +_BWidthBuffer_::~_BWidthBuffer_() +{ +} + +_BWidthBuffer_* gCompatibilityWidthBuffer = NULL; + +extern "C" +float +StringWidth__14_BWidthBuffer_PCcllPC5BFont(_BWidthBuffer_* widthBuffer, + const char *inText, int32 fromOffset, int32 length, const BFont *inStyle) +{ + return BPrivate::gWidthBuffer->StringWidth(inText, fromOffset, length, + inStyle); +} + +#endif // __GNUC__ < 3 + Modified: haiku/trunk/src/kits/tracker/PoseView.cpp =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.cpp 2008-11-06 11:26:01 UTC (rev 28531) +++ haiku/trunk/src/kits/tracker/PoseView.cpp 2008-11-06 11:31:40 UTC (rev 28532) @@ -641,7 +641,8 @@ float BPoseView::StringWidth(const char *str) const { - return sWidthBuffer->StringWidth(str, 0, (int32)strlen(str), &sCurrentFont); + return BPrivate::gWidthBuffer->StringWidth(str, 0, (int32)strlen(str), + &sCurrentFont); } @@ -649,7 +650,7 @@ BPoseView::StringWidth(const char *str, int32 len) const { ASSERT(strlen(str) == (uint32)len); - return sWidthBuffer->StringWidth(str, 0, len, &sCurrentFont); + return BPrivate::gWidthBuffer->StringWidth(str, 0, len, &sCurrentFont); } @@ -9321,7 +9322,6 @@ float BPoseView::sFontHeight = -1; font_height BPoseView::sFontInfo = { 0, 0, 0 }; bigtime_t BPoseView::sLastKeyTime = 0; -BPrivate::WidthBuffer* BPoseView::sWidthBuffer = new BPrivate::WidthBuffer; BFont BPoseView::sCurrentFont; OffscreenBitmap *BPoseView::sOffscreen = new OffscreenBitmap; char BPoseView::sMatchString[] = ""; Modified: haiku/trunk/src/kits/tracker/PoseView.h =================================================================== --- haiku/trunk/src/kits/tracker/PoseView.h 2008-11-06 11:26:01 UTC (rev 28531) +++ haiku/trunk/src/kits/tracker/PoseView.h 2008-11-06 11:31:40 UTC (rev 28532) @@ -62,10 +62,6 @@ class BRefFilter; class BList; -// TODO: Get rid of this. -#include - // for BTextView::WidthBuffer; - namespace BPrivate { class BCountView; @@ -665,9 +661,6 @@ bigtime_t fLastDeskbarFrameCheckTime; BRect fDeskbarFrame; - // TODO: Get rid of this. - static BPrivate::WidthBuffer *sWidthBuffer; - static OffscreenBitmap *sOffscreen; typedef BView _inherited; From stefano.ceccherini at gmail.com Thu Nov 6 12:46:09 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 6 Nov 2008 12:46:09 +0100 Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <200811061126.mA6BQ1JN025737@sheep.berlios.de> References: <200811061126.mA6BQ1JN025737@sheep.berlios.de> Message-ID: <894b9700811060346g7689f4e7kcf626fca7fbd8cd@mail.gmail.com> 2008/11/6 axeld at BerliOS : > Author: axeld > Date: 2008-11-06 12:26:01 +0100 (Thu, 06 Nov 2008) > New Revision: 28531 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28531&view=rev > > Modified: > haiku/trunk/src/system/libroot/posix/glob.c > Log: > * Updating glob() actually broke it, since Haiku does have broken mbrtowc(), > and wcrtomb() functions. I worked around the issue, and added a build I'd vote for removing those from the build until we fix them, since they can cause all sorts of issues, but I think that this would cause missing symbols when running beos applications. Thoughts ? From stippi at mail.berlios.de Thu Nov 6 12:50:41 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 6 Nov 2008 12:50:41 +0100 Subject: [Haiku-commits] r28533 - haiku/trunk/src/kits/tracker Message-ID: <200811061150.mA6BofGe020965@sheep.berlios.de> Author: stippi Date: 2008-11-06 12:50:38 +0100 (Thu, 06 Nov 2008) New Revision: 28533 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28533&view=rev Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp Log: Always retrieve the "would be mount point" of the partition in AutoMounter::InitialMountVisitor::Visit(), otherwise restoring mount options, like read-only mounting, would never work. This kind of mixes the options of the mount settings, since it partially remembers the settings even if the option is not "only previously mounted disks", but it should not hurt anyways. As a side effect, this should also fix the mount notification sent to Tracker, as the path should only have been correct for the "mount previous disks" setting. Modified: haiku/trunk/src/kits/tracker/AutoMounter.cpp =================================================================== --- haiku/trunk/src/kits/tracker/AutoMounter.cpp 2008-11-06 11:31:40 UTC (rev 28532) +++ haiku/trunk/src/kits/tracker/AutoMounter.cpp 2008-11-06 11:50:38 UTC (rev 28533) @@ -135,11 +135,13 @@ return false; BPath path; + if (partition->GetPath(&path) != B_OK) + return false; + if (mode == kRestorePreviousVolumes) { // mount all volumes that were stored in the settings file const char *volumeName = NULL; - if (partition->GetPath(&path) != B_OK - || partition->ContentName() == NULL + if (partition->ContentName() == NULL || fPrevious.FindString(path.Path(), &volumeName) != B_OK || strcmp(volumeName, partition->ContentName())) From axeld at mail.berlios.de Thu Nov 6 13:44:26 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 6 Nov 2008 13:44:26 +0100 Subject: [Haiku-commits] r28534 - in haiku/trunk/src: kits/game servers/app Message-ID: <200811061244.mA6CiQOU025963@sheep.berlios.de> Author: axeld Date: 2008-11-06 13:44:26 +0100 (Thu, 06 Nov 2008) New Revision: 28534 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28534&view=rev Modified: haiku/trunk/src/kits/game/WindowScreen.cpp haiku/trunk/src/servers/app/ServerApp.cpp Log: * BWindowScreen::_InitClone() was broken, it called the "get clone info" method on uninitialized accelerant, but that's what AS_GET_DRIVER_PATH is for. * This should fix #2847. Modified: haiku/trunk/src/kits/game/WindowScreen.cpp =================================================================== --- haiku/trunk/src/kits/game/WindowScreen.cpp 2008-11-06 11:50:38 UTC (rev 28533) +++ haiku/trunk/src/kits/game/WindowScreen.cpp 2008-11-06 12:44:26 UTC (rev 28534) @@ -1,7 +1,7 @@ /* * Copyright 2002-2008, Haiku. All Rights Reserved. * Copyright 2002-2005, - * Marcus Overhagen, + * Marcus Overhagen, * Stefano Ceccherini (stefano.ceccherini at gmail.com), * Carwyn Jones (turok2 at currantbun.com) * All rights reserved. @@ -71,7 +71,7 @@ param.dest_top = dy; param.width = width; param.height = height; - + sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken); sBlitRectHook(sEngineToken, ¶m, 1); sReleaseEngineHook(sEngineToken, NULL); @@ -79,7 +79,7 @@ } // TODO: This function seems not to be exported through CardHookAt(). -// At least, nothing I've tried uses it. +// At least, nothing I've tried uses it. /* static int32 transparent_blit(int32 sx, int32 sy, int32 dx, int32 dy, @@ -92,7 +92,7 @@ param.dest_top = dy; param.width = width; param.height = height; - + sAcquireEngineHook(B_2D_ACCELERATION, 0xff, 0, &sEngineToken); sTransparentBlitHook(sEngineToken, transparent_color, ¶m, 1); sReleaseEngineHook(sEngineToken, 0); @@ -112,7 +112,7 @@ param.dest_top = dy; param.dest_width = dw; param.dest_height = dh; - + sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken); sScaledFilteredBlitHook(sEngineToken, ¶m, 1); sReleaseEngineHook(sEngineToken, NULL); @@ -128,7 +128,7 @@ param.top = sy; param.right = sw; param.bottom = sh; - + sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken); sFillRectHook(sEngineToken, color_index, ¶m, 1); sReleaseEngineHook(sEngineToken, NULL); @@ -144,7 +144,7 @@ param.top = sy; param.right = sw; param.bottom = sh; - + sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken); sFillRectHook(sEngineToken, color, ¶m, 1); sReleaseEngineHook(sEngineToken, NULL); @@ -160,7 +160,7 @@ param.top = sy; param.right = sw; param.bottom = sh; - + sAcquireEngineHook(B_2D_ACCELERATION, 0xff, NULL, &sEngineToken); sFillRectHook(sEngineToken, color, ¶m, 1); sReleaseEngineHook(sEngineToken, NULL); @@ -176,7 +176,7 @@ { BMessage command(IS_SET_MOUSE_POSITION); BMessage reply; - + command.AddPoint("where", BPoint(x, y)); _control_input_server_(&command, &reply); } @@ -196,7 +196,7 @@ if (debug_enable) attributes |= B_ENABLE_DEBUGGER; - status_t status = _InitData(space, attributes); + status_t status = _InitData(space, attributes); if (error) *error = status; } @@ -204,12 +204,12 @@ BWindowScreen::BWindowScreen(const char *title, uint32 space, uint32 attributes, status_t *error) - : BWindow(BScreen().Frame(), title, B_TITLED_WINDOW, + : BWindow(BScreen().Frame(), title, B_TITLED_WINDOW, kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE) { CALLED(); - status_t status = _InitData(space, attributes); + status_t status = _InitData(space, attributes); if (error) *error = status; } @@ -269,7 +269,7 @@ fWorkState = state; if (state) { if (fLockState == 0 && fWindowState) { - _Activate(); + _Activate(); if (!IsHidden()) { Activate(true); WindowActivated(true); @@ -292,7 +292,7 @@ { CALLED(); - Disconnect(); + Disconnect(); BWindow::Hide(); } @@ -320,7 +320,7 @@ return; if (Lock()) { - if (!fActivateState) { + if (!fActivateState) { // If we aren't active, we just change our local palette for (int32 x = firstIndex; x <= lastIndex; x++) { fPalette[x] = list[x]; @@ -405,7 +405,7 @@ { CALLED(); move_display_area moveDisplayArea = (move_display_area)fGetAccelerantHook(B_MOVE_DISPLAY, NULL); - if (moveDisplayArea && moveDisplayArea((int16)x, (int16)y) == B_OK) { + if (moveDisplayArea && moveDisplayArea((int16)x, (int16)y) == B_OK) { fFrameBufferInfo.display_x = x; fFrameBufferInfo.display_y = y; fDisplayMode->h_display_start = x; @@ -437,7 +437,7 @@ frame_buffer_info * BWindowScreen::FrameBufferInfo() { - CALLED(); + CALLED(); return &fFrameBufferInfo; } @@ -501,7 +501,7 @@ void *newDebugList = realloc(fDebugThreads, (fDebugThreadCount + 1) * sizeof(thread_id)); if (newDebugList != NULL) { - fDebugThreads = (thread_id *)newDebugList; + fDebugThreads = (thread_id *)newDebugList; fDebugThreads[fDebugThreadCount] = thread; fDebugThreadCount++; } @@ -520,14 +520,14 @@ BWindowScreen::Suspend(char* label) { CALLED(); - if (fDebugState) { + if (fDebugState) { fprintf(stderr, "## Debugger(\"%s\").", label); fprintf(stderr, " Press Alt-F%ld or Cmd-F%ld to resume.\n", fWorkspaceIndex + 1, fWorkspaceIndex + 1); - + if (IsLocked()) Unlock(); - + activate_workspace(fDebugWorkspace); // Suspend ourself @@ -564,7 +564,7 @@ BWindowScreen::_InitData(uint32 space, uint32 attributes) { CALLED(); - + fDebugState = attributes & B_ENABLE_DEBUGGER; fDebugThreadCount = 0; fDebugThreads = NULL; @@ -595,7 +595,7 @@ status = screen.GetMode(fOriginalDisplayMode); if (status < B_OK) throw status; - + status = screen.GetModeList(&fModeList, &fModeCount); if (status < B_OK) throw status; @@ -619,15 +619,15 @@ memcpy(fPalette, screen.ColorMap()->color_list, sizeof(fPalette)); fActivateState = 0; fWorkState = 1; - + status = B_OK; } catch (std::bad_alloc) { - status = B_NO_MEMORY; + status = B_NO_MEMORY; } catch (status_t error) { status = error; } catch (...) { - status = B_ERROR; + status = B_ERROR; } if (status < B_OK) @@ -644,17 +644,17 @@ Disconnect(); if (fAddonImage >= 0) { unload_add_on(fAddonImage); - fAddonImage = -1; + fAddonImage = -1; } - + delete_sem(fActivateSem); fActivateSem = -1; delete_sem(fDebugSem); - fDebugSem = -1; + fDebugSem = -1; if (fDebugState) activate_workspace(fDebugWorkspace); - + delete fDisplayMode; fDisplayMode = NULL; delete fOriginalDisplayMode; @@ -662,7 +662,7 @@ free(fModeList); fModeList = NULL; fModeCount = 0; - + fLockState = 0; } @@ -678,7 +678,7 @@ status = _SetupAccelerantHooks(true); if (status < B_OK) return status; - + if (!fActivateState) { do { status = acquire_sem(fActivateSem); @@ -691,13 +691,13 @@ SetColorList(fPalette); if (fDebugState && !fDebugFirst) { SuspensionHook(true); - _Resume(); + _Resume(); } else { fDebugFirst = true; ScreenConnected(true); } - return B_OK; + return B_OK; } @@ -713,8 +713,8 @@ ScreenConnected(false); status_t status = _SetupAccelerantHooks(false); - if (status == B_OK) { - be_app->ShowCursor(); + if (status == B_OK) { + be_app->ShowCursor(); if (fActivateState) { // TODO: reset palette } @@ -777,7 +777,7 @@ fWaitEngineIdle(); } } - + return status; } @@ -837,12 +837,12 @@ if (link.FlushWithReply(result) < B_OK || result < B_OK) return result; - frame_buffer_config config; + frame_buffer_config config; link.Read(&config); - + fCardInfo.frame_buffer = config.frame_buffer; fCardInfo.bytes_per_row = config.bytes_per_row; - + return B_OK; } @@ -867,7 +867,7 @@ } graphics_card_info *info = CardInfo(); - size_t fbSize = info->bytes_per_row * info->height; + size_t fbSize = info->bytes_per_row * info->height; // Save the content of the frame buffer into the local buffer fDebugFrameBuffer = (char *)malloc(fbSize); @@ -921,71 +921,64 @@ BWindowScreen::_InitClone() { CALLED(); - + if (fAddonImage >= 0) return B_OK; + BScreen screen(this); + AppServerLink link; link.StartMessage(AS_GET_ACCELERANT_PATH); - link.Attach(fWorkspaceIndex); - + link.Attach(screen.ID()); + status_t status = B_ERROR; if (link.FlushWithReply(status) < B_OK || status < B_OK) return status; BString accelerantPath; link.ReadString(accelerantPath); - fAddonImage = load_add_on(accelerantPath.String()); + + link.StartMessage(AS_GET_DRIVER_PATH); + link.Attach(screen.ID()); + + status = B_ERROR; + if (link.FlushWithReply(status) < B_OK || status < B_OK) + return status; + + BString driverPath; + link.ReadString(driverPath); + + fAddonImage = load_add_on(accelerantPath.String()); if (fAddonImage < B_OK) { fprintf(stderr, "InitClone: cannot load accelerant image\n"); return fAddonImage; } status = get_image_symbol(fAddonImage, B_ACCELERANT_ENTRY_POINT, - B_SYMBOL_TYPE_TEXT, (void **)&fGetAccelerantHook); + B_SYMBOL_TYPE_TEXT, (void**)&fGetAccelerantHook); if (status < B_OK) { fprintf(stderr, "InitClone: cannot get accelerant entry point\n"); unload_add_on(fAddonImage); fAddonImage = -1; - return status; + return B_NOT_SUPPORTED; } - - accelerant_clone_info_size cloneInfoSizeHook; - get_accelerant_clone_info cloneInfoHook; - clone_accelerant cloneHook; - cloneInfoSizeHook = (accelerant_clone_info_size)fGetAccelerantHook(B_ACCELERANT_CLONE_INFO_SIZE, NULL); - cloneInfoHook = (get_accelerant_clone_info)fGetAccelerantHook(B_GET_ACCELERANT_CLONE_INFO, NULL); - cloneHook = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL); - status = B_ERROR; - if (!cloneInfoSizeHook || !cloneInfoHook || !cloneHook) { + clone_accelerant cloneHook + = (clone_accelerant)fGetAccelerantHook(B_CLONE_ACCELERANT, NULL); + if (cloneHook == NULL) { fprintf(stderr, "InitClone: cannot get clone hook\n"); unload_add_on(fAddonImage); fAddonImage = -1; - return status; + return B_NOT_SUPPORTED; } - ssize_t cloneInfoSize = cloneInfoSizeHook(); - void *cloneInfo = malloc(cloneInfoSize); - if (!cloneInfo) { - unload_add_on(fAddonImage); - fAddonImage = -1; - return B_NO_MEMORY; - } - - cloneInfoHook(cloneInfo); - // no way to see if this call fails - - status = cloneHook(cloneInfo); - - free(cloneInfo); - + status = cloneHook((void*)driverPath.String()); if (status < B_OK) { fprintf(stderr, "InitClone: cannot clone accelerant\n"); unload_add_on(fAddonImage); fAddonImage = -1; } - + return status; } Modified: haiku/trunk/src/servers/app/ServerApp.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerApp.cpp 2008-11-06 11:50:38 UTC (rev 28533) +++ haiku/trunk/src/servers/app/ServerApp.cpp 2008-11-06 12:44:26 UTC (rev 28534) @@ -2524,8 +2524,8 @@ case AS_GET_ACCELERANT_PATH: { - int32 index; - fLink.Read(&index); + screen_id id; + fLink.Read(&id); BString path; status_t status = fDesktop->HWInterface()->GetAccelerantPath(path); @@ -2539,8 +2539,8 @@ case AS_GET_DRIVER_PATH: { - int32 index; - fLink.Read(&index); + screen_id id; + fLink.Read(&id); BString path; status_t status = fDesktop->HWInterface()->GetDriverPath(path); From stefano.ceccherini at gmail.com Thu Nov 6 13:58:29 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 6 Nov 2008 13:58:29 +0100 Subject: [Haiku-commits] r28534 - in haiku/trunk/src: kits/game servers/app In-Reply-To: <200811061244.mA6CiQOU025963@sheep.berlios.de> References: <200811061244.mA6CiQOU025963@sheep.berlios.de> Message-ID: <894b9700811060458u4eef00aeod1b41dd6fa473169@mail.gmail.com> 2008/11/6 axeld at BerliOS : > Author: axeld > Date: 2008-11-06 13:44:26 +0100 (Thu, 06 Nov 2008) > New Revision: 28534 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28534&view=rev > > Modified: > haiku/trunk/src/kits/game/WindowScreen.cpp > haiku/trunk/src/servers/app/ServerApp.cpp > Log: > * BWindowScreen::_InitClone() was broken, it called the "get clone info" method > on uninitialized accelerant, but that's what AS_GET_DRIVER_PATH is for. > * This should fix #2847. And I am even the culprit! Yeaaaaah! From axeld at pinc-software.de Thu Nov 6 14:18:26 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 06 Nov 2008 14:18:26 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28534_-_in_haiku/trunk/src=3A_kits/gam?= =?utf-8?q?e_servers/app?= In-Reply-To: <894b9700811060458u4eef00aeod1b41dd6fa473169@mail.gmail.com> Message-ID: <14602592353-BeMail@zon> "Stefano Ceccherini" wrote: > 2008/11/6 axeld at BerliOS : > > Log: > > * BWindowScreen::_InitClone() was broken, it called the "get clone > > info" method > > on uninitialized accelerant, but that's what AS_GET_DRIVER_PATH is > > for. > > * This should fix #2847. > And I am even the culprit! Yeaaaaah! It just can't always be me ;-) Bye, Axel. From anevilyak at gmail.com Thu Nov 6 14:55:28 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 6 Nov 2008 07:55:28 -0600 Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: <2420802892-BeMail@zon> References: <200811060307.mA637hxL021728@sheep.berlios.de> <2420802892-BeMail@zon> Message-ID: On Thu, Nov 6, 2008 at 2:31 AM, Axel D?rfler wrote: > Also, under BeOS, I can only use Ctrl+Alt-click for a right mouse > button click, I didn't find a combination to simulate a middle mouse > button. Ah, my mistake, I assumed Humdinger was referring to an already existing shortcut. In any case, would it be desirable to have input_server send a right click directly with ctrl+click instead of apps like Tracker having to do it manually? I'm not sure if that would cause any compat issues though (i.e. apps using ctrl+left click for other uses). > >> @@ -119,10 +120,34 @@ >> *_height = fMouseBitmap != NULL ? fMouseBitmap-> >> Bounds().Height() : 82; >> } >> >> +void > > Two blank lines between functions... > >> +MouseView::MouseUp(BPoint) >> +{ > [...] >> +} >> >> void > > And again. > Will fix those, sorry. Regards, Rene From anevilyak at mail.berlios.de Thu Nov 6 14:56:11 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Thu, 6 Nov 2008 14:56:11 +0100 Subject: [Haiku-commits] r28535 - haiku/trunk/src/preferences/mouse Message-ID: <200811061356.mA6DuBUb000358@sheep.berlios.de> Author: anevilyak Date: 2008-11-06 14:56:11 +0100 (Thu, 06 Nov 2008) New Revision: 28535 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28535&view=rev Modified: haiku/trunk/src/preferences/mouse/MouseView.cpp Log: Fix function spacing. Modified: haiku/trunk/src/preferences/mouse/MouseView.cpp =================================================================== --- haiku/trunk/src/preferences/mouse/MouseView.cpp 2008-11-06 12:44:26 UTC (rev 28534) +++ haiku/trunk/src/preferences/mouse/MouseView.cpp 2008-11-06 13:56:11 UTC (rev 28535) @@ -120,6 +120,7 @@ *_height = fMouseBitmap != NULL ? fMouseBitmap->Bounds().Height() : 82; } + void MouseView::MouseUp(BPoint) { @@ -129,6 +130,7 @@ fOldButtons = fButtons; } + void MouseView::MouseDown(BPoint where) { From axeld at pinc-software.de Thu Nov 6 15:06:44 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 06 Nov 2008 15:06:44 +0100 CET Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: Message-ID: <17500657093-BeMail@zon> "Rene Gollent" wrote: > On Thu, Nov 6, 2008 at 2:31 AM, Axel D?rfler > wrote: > > Also, under BeOS, I can only use Ctrl+Alt-click for a right mouse > > button click, I didn't find a combination to simulate a middle > > mouse > > button. > Ah, my mistake, I assumed Humdinger was referring to an already > existing shortcut. In any case, would it be desirable to have > input_server send a right click directly with ctrl+click instead of > apps like Tracker having to do it manually? I'm not sure if that > would > cause any compat issues though (i.e. apps using ctrl+left click for > other uses). It looks like Ctrl+Option is used to emulate the middle click in BeOS. And in any case, the input_server should do this automatically, but not with something common as Ctrl-click, only for Ctrl-Alt and Ctrl-Option. Just the Mouse preferences app doesn't need to know anything about that. Bye, Axel. From ingo_weinhold at gmx.de Thu Nov 6 15:23:15 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 06 Nov 2008 15:23:15 +0100 Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <894b9700811060346g7689f4e7kcf626fca7fbd8cd@mail.gmail.com> References: <200811061126.mA6BQ1JN025737@sheep.berlios.de> <894b9700811060346g7689f4e7kcf626fca7fbd8cd@mail.gmail.com> Message-ID: <20081106152315.540.1@knochen-vm.localdomain> On 2008-11-06 at 12:46:09 [+0100], Stefano Ceccherini wrote: > 2008/11/6 axeld at BerliOS : > > Author: axeld > > Date: 2008-11-06 12:26:01 +0100 (Thu, 06 Nov 2008) > > New Revision: 28531 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28531&view=rev > > > > Modified: > > haiku/trunk/src/system/libroot/posix/glob.c > > Log: > > * Updating glob() actually broke it, since Haiku does have broken > > mbrtowc(), > > and wcrtomb() functions. I worked around the issue, and added a build > > I'd vote for removing those from the build until we fix them, since > they can cause all sorts of issues, +1 I wasted a day to find out that some M4 tests would fail due to our broken wide char functions. > but I think that this would cause > missing symbols when running beos applications. Thoughts ? The BeOS headers don't contain any prototypes for those functions, so at least theoretically BeOS applications shouldn't use them. I'd actually even vote for making wchar_t 4 bytes wide in Haiku, like it is on other systems. CU, Ingo From anevilyak at gmail.com Thu Nov 6 15:25:49 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 6 Nov 2008 08:25:49 -0600 Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: <17500657093-BeMail@zon> References: <17500657093-BeMail@zon> Message-ID: On Thu, Nov 6, 2008 at 8:06 AM, Axel D?rfler wrote: > It looks like Ctrl+Option is used to emulate the middle click in BeOS. > And in any case, the input_server should do this automatically, but not > with something common as Ctrl-click, only for Ctrl-Alt and Ctrl-Option. > Just the Mouse preferences app doesn't need to know anything about > that. Alright, will look into fixing that this evening. Thanks for the feedback :) Regards, Rene From axeld at pinc-software.de Thu Nov 6 15:28:29 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 06 Nov 2008 15:28:29 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <20081106152315.540.1@knochen-vm.localdomain> Message-ID: <18805771757-BeMail@zon> Ingo Weinhold wrote: > > I'd vote for removing those from the build until we fix them, since > > they can cause all sorts of issues, > +1 > I wasted a day to find out that some M4 tests would fail due to our > broken > wide char functions. At least those two functions are pretty easily implemented, though (and only a bit harder to make them accept UTF-8 instead of ASCII). So if we don't need all the others for now, I could do that if it helps. > > but I think that this would cause > > missing symbols when running beos applications. Thoughts ? > The BeOS headers don't contain any prototypes for those functions, so > at > least theoretically BeOS applications shouldn't use them. I'd > actually even > vote for making wchar_t 4 bytes wide in Haiku, like it is on other > systems. +1. Bye, Axel. From stefano.ceccherini at gmail.com Thu Nov 6 15:31:26 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Thu, 6 Nov 2008 15:31:26 +0100 Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <18805771757-BeMail@zon> References: <20081106152315.540.1@knochen-vm.localdomain> <18805771757-BeMail@zon> Message-ID: <894b9700811060631o6a275741j3e2fda656ec04052@mail.gmail.com> 2008/11/6 Axel D?rfler : > Ingo Weinhold wrote: >> > I'd vote for removing those from the build until we fix them, since >> > they can cause all sorts of issues, >> +1 >> I wasted a day to find out that some M4 tests would fail due to our >> broken >> wide char functions. That would also mean remove all those definitions from wchar.h. Or "#if 0" the whole file. From revol at free.fr Thu Nov 6 15:39:44 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 06 Nov 2008 15:39:44 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <18805771757-BeMail@zon> Message-ID: <9526990853-BeMail@laptop> > > > but I think that this would cause > > > missing symbols when running beos applications. Thoughts ? > > The BeOS headers don't contain any prototypes for those functions, > > so > > at > > least theoretically BeOS applications shouldn't use them. I'd > > actually even > > vote for making wchar_t 4 bytes wide in Haiku, like it is on other > > systems. > > +1. If glibc itself can do it, why not. But I'd avoid doing so else, as too many apps think detecting glibc stuff means all of glibc is there... Fran?ois. From humdingerb at googlemail.com Thu Nov 6 15:47:51 2008 From: humdingerb at googlemail.com (Humdinger) Date: Thu, 06 Nov 2008 15:47:51 +0100 Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: References: <17500657093-BeMail@zon> Message-ID: <49130397.7070203@googlemail.com> >> On Thu, Nov 6, 2008 at 8:06 AM, Axel D?rfler wrote: >> It looks like Ctrl+Option is used to emulate the middle click in BeOS. 'Course it does. What? You calling me a liar? :) Rene Gollent wrote: > Alright, will look into fixing that this evening. Thanks for the feedback :) Thanks for looking into it. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-- Deutsche Haiku News @ http://haiku-gazette.blogspot.com From anevilyak at gmail.com Thu Nov 6 15:50:44 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 6 Nov 2008 08:50:44 -0600 Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: <49130397.7070203@googlemail.com> References: <17500657093-BeMail@zon> <49130397.7070203@googlemail.com> Message-ID: On Thu, Nov 6, 2008 at 8:47 AM, Humdinger wrote: > 'Course it does. What? You calling me a liar? :) Actually, your bug ticket said ctrl+alt, which is different from ctrl+option :) Regards, Rene From axeld at pinc-software.de Thu Nov 6 16:02:37 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 06 Nov 2008 16:02:37 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <9526990853-BeMail@laptop> Message-ID: <20853481592-BeMail@zon> "Fran?ois Revol" wrote: > > +1. > If glibc itself can do it, why not. > But I'd avoid doing so else, as too many apps think detecting glibc > stuff means all of glibc is there... I just looked into FreeBSD, and there the actual definition of the mbrtowc() and friends actually depends on the encoding you'll set via the locale. I haven't looked into glibc yet, but we could either import the FreeBSD version (I would guess UTF-8 is good enough for us), or fix glibc's (which would mean that we would need to include much more from glibc, as it's all "nicely" connected instead of modularized, like locale, gconv, etc.). Bye, Axel. From anevilyak at gmail.com Thu Nov 6 16:04:29 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Thu, 6 Nov 2008 09:04:29 -0600 Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <20853481592-BeMail@zon> References: <9526990853-BeMail@laptop> <20853481592-BeMail@zon> Message-ID: On Thu, Nov 6, 2008 at 9:02 AM, Axel D?rfler wrote: > I just looked into FreeBSD, and there the actual definition of the > mbrtowc() and friends actually depends on the encoding you'll set via > the locale. > I haven't looked into glibc yet, but we could either import the FreeBSD > version (I would guess UTF-8 is good enough for us), or fix glibc's > (which would mean that we would need to include much more from glibc, > as it's all "nicely" connected instead of modularized, like locale, > gconv, etc.). Since it's not a compat issue in this case, +1 for importing the FreeBSD variants from me at least. Regards, Rene From revol at free.fr Thu Nov 6 16:12:14 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 06 Nov 2008 16:12:14 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <20853481592-BeMail@zon> Message-ID: <11476165352-BeMail@laptop> > "Fran?ois Revol" wrote: > > > +1. > > If glibc itself can do it, why not. > > But I'd avoid doing so else, as too many apps think detecting glibc > > stuff means all of glibc is there... > > I just looked into FreeBSD, and there the actual definition of the > mbrtowc() and friends actually depends on the encoding you'll set via > the locale. > I haven't looked into glibc yet, but we could either import the > FreeBSD > version (I would guess UTF-8 is good enough for us), or fix glibc's ugh, can those *wc*() work with UTF-8 ? That's usually painful to see in ported software: checking for wcfoo... ok checking for wcbar... no disabled multibyte support and not getting UTF-8 support because the crappy code wants those ugly API... Fran?ois. From axeld at mail.berlios.de Thu Nov 6 16:21:16 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 6 Nov 2008 16:21:16 +0100 Subject: [Haiku-commits] r28536 - haiku/trunk/src/add-ons/kernel/file_systems/ext2 Message-ID: <200811061521.mA6FLGtE008734@sheep.berlios.de> Author: axeld Date: 2008-11-06 16:21:16 +0100 (Thu, 06 Nov 2008) New Revision: 28536 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28536&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/Inode.cpp haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp Log: * Changed to use Volume::InodeSize() over sizeof(ext2_inode) as described in ticket #2707. Thanks Adrian! Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/Inode.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/Inode.cpp 2008-11-06 13:56:11 UTC (rev 28535) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/Inode.cpp 2008-11-06 15:21:16 UTC (rev 28536) @@ -32,10 +32,12 @@ uint32 block; if (volume->GetInodeBlock(id, block) == B_OK) { TRACE("inode %Ld at block %lu\n", ID(), block); - ext2_inode* inodes = (ext2_inode*)block_cache_get(volume->BlockCache(), + uint8* inodeBlock = (uint8*)block_cache_get(volume->BlockCache(), block); - if (inodes != NULL) - fNode = inodes + volume->InodeBlockIndex(id); + if (inodeBlock != NULL) { + fNode = (ext2_inode*)(inodeBlock + volume->InodeBlockIndex(id) + * volume->InodeSize()); + } } if (fNode != NULL) { Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp 2008-11-06 13:56:11 UTC (rev 28535) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/Volume.cpp 2008-11-06 15:21:16 UTC (rev 28536) @@ -297,7 +297,7 @@ return B_NO_MEMORY; memset(fGroupBlocks, 0, blockCount * sizeof(void*)); - fInodesPerBlock = fBlockSize / sizeof(ext2_inode); + fInodesPerBlock = fBlockSize / InodeSize(); // check if the device size is large enough to hold the file system off_t diskSize; From humdingerb at googlemail.com Thu Nov 6 16:42:57 2008 From: humdingerb at googlemail.com (Humdinger) Date: Thu, 06 Nov 2008 16:42:57 +0100 Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: References: <17500657093-BeMail@zon> <49130397.7070203@googlemail.com> Message-ID: <49131081.10002@googlemail.com> Rene Gollent wrote: > On Thu, Nov 6, 2008 at 8:47 AM, Humdinger wrote: >> 'Course it does. What? You calling me a liar? :) > > Actually, your bug ticket said ctrl+alt, which is different from ctrl+option :) Well, I have an excuse ready for that... :) I just had Firefox to check what's the middle button and CTRL+ALT was the first thing that worked (opened link in new tab). CTRL+AltGr works, too. I get very confused when there's talk of "option" and "command" keys. Never know what's what... So, what is the right key-combo? Personally, I'd like CTRL+ALT better as it's much easier to reach with one hand. Regards, Humdinger -- --=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-=--=-- Deutsche Haiku News @ http://haiku-gazette.blogspot.com From alex at zappotek.com Thu Nov 6 17:17:41 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Thu, 06 Nov 2008 17:17:41 +0100 Subject: [Haiku-commits] r28528 - haiku/trunk/src/preferences/mouse In-Reply-To: <49131081.10002@googlemail.com> References: <17500657093-BeMail@zon> <49130397.7070203@googlemail.com> <49131081.10002@googlemail.com> Message-ID: <491318A5.40501@zappotek.com> Humdinger a ?crit : > [...] I get very confused when there's > talk of "option" and "command" keys. Never know what's what... > > So, what is the right key-combo? Personally, I'd like CTRL+ALT better as it's much easier > to reach with one hand. Impossible, you can't say CTRL+ALT in the Haiku/BeOS world :-D, you'd have to say either command+ALT or CTRL+command !! (depending on the alt or ctrl mode) ...just kidding Alex From axeld at pinc-software.de Thu Nov 6 17:14:13 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 06 Nov 2008 17:14:13 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <11476165352-BeMail@laptop> Message-ID: <25149321366-BeMail@zon> "Fran?ois Revol" wrote: > ugh, can those *wc*() work with UTF-8 ? They support a number of different encodings, glibc's version supports everything gconv can grok, FreeBSD supports 9 different encodings (one of them is ASCII where they explicitly check for the high bit, one for all other single byte encodings), among them UTF-8, and several Asian ones. Bye, Axel. From revol at free.fr Thu Nov 6 17:20:42 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 06 Nov 2008 17:20:42 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <25149321366-BeMail@zon> Message-ID: <15584503885-BeMail@laptop> > "Fran?ois Revol" wrote: > > ugh, can those *wc*() work with UTF-8 ? > > They support a number of different encodings, glibc's version > supports > everything gconv can grok, FreeBSD supports 9 different encodings > (one > of them is ASCII where they explicitly check for the high bit, one > for > all other single byte encodings), among them UTF-8, and several Asian > ones. I'm not talking about what they can convert to, but what they use internally. ie, can wchar_t be 8bits ?? Fran?ois. From ingo_weinhold at gmx.de Thu Nov 6 17:20:47 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 06 Nov 2008 17:20:47 +0100 Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <20853481592-BeMail@zon> References: <20853481592-BeMail@zon> Message-ID: <20081106172047.763.2@knochen-vm.localdomain> On 2008-11-06 at 16:02:37 [+0100], Axel D?rfler wrote: > "Fran?ois Revol" wrote: > > > +1. > > If glibc itself can do it, why not. > > But I'd avoid doing so else, as too many apps think detecting glibc > > stuff means all of glibc is there... > > I just looked into FreeBSD, and there the actual definition of the > mbrtowc() and friends actually depends on the encoding you'll set via > the locale. > I haven't looked into glibc yet, but we could either import the FreeBSD > version (I would guess UTF-8 is good enough for us), or fix glibc's > (which would mean that we would need to include much more from glibc, > as it's all "nicely" connected instead of modularized, like locale, > gconv, etc.). I'm fine with either solution. Typedefing wchar_t to int also implies changes to gcc BTW. I just had a quick look at libstdc++.r4.so and fortunately it doesn't seem to have any wchar related stuff compiled in. CU, Ingo From axeld at pinc-software.de Thu Nov 6 17:35:32 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Thu, 06 Nov 2008 17:35:32 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <15584503885-BeMail@laptop> Message-ID: <26428228200-BeMail@zon> "Fran?ois Revol" wrote: > I'm not talking about what they can convert to, but what they use > internally. > ie, can wchar_t be 8bits ?? I am not sure if that would be valid, but usually they use fixed 32 bit internally so that all characters can be encoded (usually in Unicode, of course). Bye, Axel. From revol at free.fr Thu Nov 6 18:24:17 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 06 Nov 2008 18:24:17 +0100 CET Subject: [Haiku-commits] r28531 - haiku/trunk/src/system/libroot/posix In-Reply-To: <26428228200-BeMail@zon> Message-ID: <218790574-BeMail@laptop> > "Fran?ois Revol" wrote: > > I'm not talking about what they can convert to, but what they use > > internally. > > ie, can wchar_t be 8bits ?? > > I am not sure if that would be valid, but usually they use fixed 32 > bit > internally so that all characters can be encoded (usually in Unicode, > of course). Well, Unicode decreted only the 1st plane should be used now, but who knows... Fran?ois. From stippi at mail.berlios.de Thu Nov 6 20:16:58 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 6 Nov 2008 20:16:58 +0100 Subject: [Haiku-commits] r28537 - haiku/trunk/src/servers/app Message-ID: <200811061916.mA6JGwU5019740@sheep.berlios.de> Author: stippi Date: 2008-11-06 20:16:56 +0100 (Thu, 06 Nov 2008) New Revision: 28537 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28537&view=rev Modified: haiku/trunk/src/servers/app/ServerWindow.cpp Log: * big cleanup of the tracing support, output useful information for most messages, use debug_printf(), cleanup line breaks * check return code of last link method in a lot more places * changed some printf() and fprintf() into debug_printf() Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-06 15:21:16 UTC (rev 28536) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-06 19:16:56 UTC (rev 28537) @@ -63,25 +63,41 @@ using std::nothrow; //#define TRACE_SERVER_WINDOW -//#define TRACE_SERVER_WINDOW_MESSAGES -//#define TRACE_SERVER_GRADIENTS -//#define PROFILE_MESSAGE_LOOP - - #ifdef TRACE_SERVER_WINDOW # include -# define STRACE(x) printf x +# define STRACE(x) debug_printf x #else # define STRACE(x) ; #endif +//#define TRACE_SERVER_WINDOW_MESSAGES #ifdef TRACE_SERVER_WINDOW_MESSAGES # include -# define DTRACE(x) printf x +static const char* kDrawingModeMap[] = { + "B_OP_COPY", + "B_OP_OVER", + "B_OP_ERASE", + "B_OP_INVERT", + "B_OP_ADD", + "B_OP_SUBTRACT", + "B_OP_BLEND", + "B_OP_MIN", + "B_OP_MAX", + "B_OP_SELECT", + "B_OP_ALPHA", + + "fix kDrawingModeMap", + "fix kDrawingModeMap", + "fix kDrawingModeMap", + "fix kDrawingModeMap", + "fix kDrawingModeMap", +}; +# define DTRACE(x) debug_printf x #else # define DTRACE(x) ; #endif +//#define TRACE_SERVER_GRADIENTS #ifdef TRACE_SERVER_GRADIENTS # include # define GTRACE(x) debug_printf x @@ -89,6 +105,7 @@ # define GTRACE(x) ; #endif +//#define PROFILE_MESSAGE_LOOP #ifdef PROFILE_MESSAGE_LOOP struct profile { int32 code; int32 count; bigtime_t time; }; static profile sMessageProfile[AS_LAST_CODE]; @@ -629,23 +646,27 @@ { switch (code) { case AS_SHOW_WINDOW: - STRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n", Title())); + DTRACE(("ServerWindow %s: Message AS_SHOW_WINDOW\n", Title())); _Show(); break; case AS_HIDE_WINDOW: - STRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n", Title())); + DTRACE(("ServerWindow %s: Message AS_HIDE_WINDOW\n", Title())); _Hide(); break; case AS_MINIMIZE_WINDOW: { - DTRACE(("ServerWindow %s: Message AS_MINIMIZE_WINDOW\n", Title())); int32 showLevel; bool minimize; link.Read(&minimize); if (link.Read(&showLevel) == B_OK) { + + DTRACE(("ServerWindow %s: Message AS_MINIMIZE_WINDOW, " + "showLevel: %ld, minimize: %d\n", Title(), showLevel, + minimize)); + if (showLevel <= 0) { // window is currently hidden - ignore the minimize request break; @@ -667,10 +688,12 @@ case AS_ACTIVATE_WINDOW: { - DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: View: %s\n", Title(), fCurrentView->Name())); bool activate = true; + if (link.Read(&activate) != B_OK) + break; - link.Read(&activate); + DTRACE(("ServerWindow %s: Message AS_ACTIVATE_WINDOW: activate: " + "%d\n", Title(), activate)); fDesktop->UnlockSingleWindow(); @@ -684,24 +707,28 @@ } case AS_SEND_BEHIND: { - STRACE(("ServerWindow %s: Message AS_SEND_BEHIND\n", Title())); int32 token; team_id teamID; - status_t status; + status_t status = B_ERROR; link.Read(&token); - link.Read(&teamID); + if (link.Read(&teamID) == B_OK) { + ::Window *behindOf = fDesktop->FindWindowByClientToken(token, + teamID); - ::Window *behindOf = fDesktop->FindWindowByClientToken(token, - teamID); - if (behindOf != NULL) { + DTRACE(("ServerWindow %s: Message AS_SEND_BEHIND %s\n", + Title(), behindOf ? behindOf->Title() : "NULL")); + + if (behindOf != NULL) { //fDesktop->UnlockSingleWindow(); -// TODO: there is a big race condition when we unlock here (window could be gone by now)! - fDesktop->SendWindowBehind(fWindow, behindOf); +// TODO: there is a big race condition when we unlock here +// (window could be gone by now)! + fDesktop->SendWindowBehind(fWindow, behindOf); //fDesktop->LockSingleWindow(); - status = B_OK; - } else - status = B_NAME_NOT_FOUND; + status = B_OK; + } else + status = B_NAME_NOT_FOUND; + } fLink.StartMessage(status); fLink.Flush(); @@ -709,38 +736,37 @@ } case B_QUIT_REQUESTED: - STRACE(("ServerWindow %s received quit request\n", Title())); + DTRACE(("ServerWindow %s received quit request\n", Title())); NotifyQuitRequested(); break; case AS_ENABLE_UPDATES: - { - STRACE(("ServerWindow %s: Message AS_ENABLE_UPDATES unimplemented\n", - Title())); + DTRACE(("ServerWindow %s: Message AS_ENABLE_UPDATES\n", Title())); fWindow->EnableUpdateRequests(); break; - } + case AS_DISABLE_UPDATES: - { - STRACE(("ServerWindow %s: Message AS_DISABLE_UPDATES unimplemented\n", - Title())); + DTRACE(("ServerWindow %s: Message AS_DISABLE_UPDATES\n", Title())); fWindow->DisableUpdateRequests(); break; - } + case AS_NEEDS_UPDATE: - { - STRACE(("ServerWindow %s: Message AS_NEEDS_UPDATE\n", Title())); + DTRACE(("ServerWindow %s: Message AS_NEEDS_UPDATE: %d\n", + Title(), fWindow->NeedsUpdate())); if (fWindow->NeedsUpdate()) fLink.StartMessage(B_OK); else fLink.StartMessage(B_ERROR); fLink.Flush(); break; - } + case AS_SET_WINDOW_TITLE: { char* newTitle; if (link.ReadString(&newTitle) == B_OK) { + DTRACE(("ServerWindow %s: Message AS_SET_WINDOW_TITLE: %s\n", + Title(), newTitle)); + SetTitle(newTitle); free(newTitle); } @@ -749,7 +775,7 @@ case AS_ADD_TO_SUBSET: { - STRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n", Title())); + DTRACE(("ServerWindow %s: Message AS_ADD_TO_SUBSET\n", Title())); status_t status = B_ERROR; int32 token; @@ -774,7 +800,7 @@ } case AS_REMOVE_FROM_SUBSET: { - STRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n", Title())); + DTRACE(("ServerWindow %s: Message AS_REM_FROM_SUBSET\n", Title())); status_t status = B_ERROR; int32 token; @@ -798,7 +824,7 @@ case AS_SET_LOOK: { - STRACE(("ServerWindow %s: Message AS_SET_LOOK\n", Title())); + DTRACE(("ServerWindow %s: Message AS_SET_LOOK\n", Title())); status_t status = B_ERROR; int32 look; @@ -820,7 +846,7 @@ } case AS_SET_FEEL: { - STRACE(("ServerWindow %s: Message AS_SET_FEEL\n", Title())); + DTRACE(("ServerWindow %s: Message AS_SET_FEEL\n", Title())); status_t status = B_ERROR; int32 feel; @@ -842,7 +868,7 @@ } case AS_SET_FLAGS: { - STRACE(("ServerWindow %s: Message AS_SET_FLAGS\n", Title())); + DTRACE(("ServerWindow %s: Message AS_SET_FLAGS\n", Title())); status_t status = B_ERROR; uint32 flags; @@ -866,24 +892,31 @@ case AS_SET_ALIGNMENT: { // TODO: Implement AS_SET_ALIGNMENT - STRACE(("ServerWindow %s: Message Set_Alignment unimplemented\n", Title())); + DTRACE(("ServerWindow %s: Message Set_Alignment unimplemented\n", + Title())); break; } case AS_GET_ALIGNMENT: { // TODO: Implement AS_GET_ALIGNMENT - STRACE(("ServerWindow %s: Message Get_Alignment unimplemented\n", Title())); + DTRACE(("ServerWindow %s: Message Get_Alignment unimplemented\n", + Title())); break; } #endif case AS_IS_FRONT_WINDOW: - fLink.StartMessage(fDesktop->FrontWindow() == fWindow ? B_OK : B_ERROR); + { + bool isFront = fDesktop->FrontWindow() == fWindow; + DTRACE(("ServerWindow %s: Message AS_IS_FRONT_WINDOW: %d\n", + Title(), isFront)); + fLink.StartMessage(isFront ? B_OK : B_ERROR); fLink.Flush(); break; + } case AS_GET_WORKSPACES: { - STRACE(("ServerWindow %s: Message AS_GET_WORKSPACES\n", Title())); + DTRACE(("ServerWindow %s: Message AS_GET_WORKSPACES\n", Title())); fLink.StartMessage(B_OK); fLink.Attach(fWindow->Workspaces()); fLink.Flush(); @@ -895,7 +928,7 @@ if (link.Read(&newWorkspaces) != B_OK) break; - STRACE(("ServerWindow %s: Message AS_SET_WORKSPACES %lx\n", + DTRACE(("ServerWindow %s: Message AS_SET_WORKSPACES %lx\n", Title(), newWorkspaces)); //fDesktop->UnlockSingleWindow(); @@ -911,7 +944,7 @@ if (link.Read(&yResizeBy) != B_OK) break; - STRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", + DTRACE(("ServerWindow %s: Message AS_WINDOW_RESIZE %.1f, %.1f\n", Title(), xResizeBy, yResizeBy)); // comment this code for the time being, as some apps rely @@ -937,7 +970,7 @@ if (link.Read(&yMoveBy) != B_OK) break; - STRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", + DTRACE(("ServerWindow %s: Message AS_WINDOW_MOVE: %.1f, %.1f\n", Title(), xMoveBy, yMoveBy)); if (fWindow->IsDragging()) { @@ -974,6 +1007,10 @@ link.Read(&minHeight); link.Read(&maxHeight); */ + DTRACE(("ServerWindow %s: Message AS_SET_SIZE_LIMITS: " + "x: %ld-%ld, y: %ld-%ld\n", + Title(), minWidth, maxWidth, minHeight, maxHeight)); + //fDesktop->UnlockSingleWindow(); if (fDesktop->LockAllWindows()) { @@ -1001,7 +1038,8 @@ case AS_SET_DECORATOR_SETTINGS: { - STRACE(("ServerWindow %s: Message AS_SET_DECORATOR_SETTINGS\n")); + DTRACE(("ServerWindow %s: Message AS_SET_DECORATOR_SETTINGS\n", + Title())); int32 size; if (fWindow && link.Read(&size) == B_OK) { @@ -1020,7 +1058,8 @@ case AS_GET_DECORATOR_SETTINGS: { - STRACE(("ServerWindow %s: Message AS_GET_DECORATOR_SETTINGS\n")); + DTRACE(("ServerWindow %s: Message AS_GET_DECORATOR_SETTINGS\n", + Title())); bool success = false; @@ -1146,11 +1185,15 @@ if (App()->ViewTokens().GetToken(token, B_HANDLER_TOKEN, (void**)¤t) != B_OK || current->Window()->ServerWindow() != this) { - // ToDo: if this happens, we probably want to kill the app and clean up - fprintf(stderr, "ServerWindow %s: Message AS_SET_CURRENT_VIEW: view not found, token %ld\n", fTitle, token); + // TODO: if this happens, we probably want to kill the app and + // clean up + debug_printf("ServerWindow %s: Message " + "\n\n\nAS_SET_CURRENT_VIEW: view not found, token %ld\n", + fTitle, token); current = NULL; } else { - DTRACE(("ServerWindow %s: Message AS_SET_CURRENT_VIEW: %s, token %ld\n", fTitle, current->Name(), token)); + DTRACE(("\n\n\nServerWindow %s: Message AS_SET_CURRENT_VIEW: %s, " + "token %ld\n", fTitle, current->Name(), token)); _SetCurrentView(current); } break; @@ -1158,12 +1201,14 @@ case AS_VIEW_CREATE_ROOT: { - STRACE(("ServerWindow %s: Message AS_VIEW_CREATE_ROOT\n", fTitle)); + DTRACE(("ServerWindow %s: Message AS_VIEW_CREATE_ROOT\n", fTitle)); // Start receiving top_view data -- pass NULL as the parent view. // This should be the *only* place where this happens. if (fCurrentView != NULL) { - fprintf(stderr, "ServerWindow %s: Message AS_VIEW_CREATE_ROOT: fCurrentView already set!!\n", fTitle); + debug_printf("ServerWindow %s: Message " + "AS_VIEW_CREATE_ROOT: fCurrentView already set!!\n", + fTitle); break; } @@ -1174,25 +1219,28 @@ case AS_VIEW_CREATE: { - STRACE(("ServerWindow %s: Message AS_VIEW_CREATE: View name: %s\n", fTitle, fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_CREATE: View name: " + "%s\n", fTitle, fCurrentView->Name())); View* parent = NULL; View* newView = _CreateView(link, &parent); if (parent != NULL && newView != NULL) parent->AddChild(newView); - else - fprintf(stderr, "ServerWindow %s: Message AS_VIEW_CREATE: parent or newView NULL!!\n", fTitle); + else { + debug_printf("ServerWindow %s: Message AS_VIEW_CREATE: " + "parent or newView NULL!!\n", fTitle); + } break; } default: - // TODO: when creating a View, check for yet non-existing View::InitCheck() - // and take appropriate actions, then checking for fCurrentView->CurrentState() - // is unnecessary + // TODO: when creating a View, check for yet non-existing + // View::InitCheck() and take appropriate actions, then checking + // for fCurrentView->CurrentState() is unnecessary if (fCurrentView == NULL || fCurrentView->CurrentState() == NULL) { BString codeName; string_for_message_code(code, codeName); - printf("ServerWindow %s received unexpected code - " + debug_printf("ServerWindow %s received unexpected code - " "message '%s' before top_view attached.\n", Title(), codeName.String()); if (link.NeedsReply()) { @@ -1221,12 +1269,14 @@ switch (code) { case AS_VIEW_SCROLL: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SCROLL: View name: %s\n", fTitle, fCurrentView->Name())); float dh; float dv; + link.Read(&dh); + if (link.Read(&dv) != B_OK) + break; - link.Read(&dh); - link.Read(&dv); + DTRACE(("ServerWindow %s: Message AS_VIEW_SCROLL: View name: " + "%s, %.1f x %.1f\n", fTitle, fCurrentView->Name(), dh, dv)); fWindow->ScrollViewBy(fCurrentView, dh, dv); break; } @@ -1236,8 +1286,15 @@ BRect dst; link.Read(&src); - link.Read(&dst); + if (link.Read(&dst) != B_OK) + break; + DTRACE(("ServerWindow %s: Message AS_VIEW_COPY_BITS: View name: " + "%s, BRect(%.1f, %.1f, %.1f, %.1f) -> " + "BRect(%.1f, %.1f, %.1f, %.1f)\n", fTitle, + fCurrentView->Name(), src.left, src.top, src.right, src.bottom, + dst.left, dst.top, dst.right, dst.bottom)); + BRegion contentRegion; // TODO: avoid copy operation maybe? fWindow->GetContentRegion(&contentRegion); @@ -1258,8 +1315,8 @@ && view->Window()->ServerWindow() == this) { View* parent = view->Parent(); - STRACE(("ServerWindow %s: AS_VIEW_DELETE view: %p, parent: %p\n", - fTitle, view, parent)); + DTRACE(("ServerWindow %s: AS_VIEW_DELETE view: %p, " + "parent: %p\n", fTitle, view, parent)); if (parent != NULL) { parent->RemoveChild(view); @@ -1283,7 +1340,8 @@ } case AS_VIEW_SET_STATE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_STATE: View name: %s\n", fTitle, fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_STATE: " + "View name: %s\n", fTitle, fCurrentView->Name())); fCurrentView->CurrentState()->ReadFromLink(link); // TODO: When is this used?!? @@ -1294,7 +1352,9 @@ } case AS_VIEW_SET_FONT_STATE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_FONT_STATE: View name: %s\n", fTitle, fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_FONT_STATE: " + "View name: %s\n", fTitle, fCurrentView->Name())); + fCurrentView->CurrentState()->ReadFontFromLink(link); fWindow->GetDrawingEngine()->SetFont( fCurrentView->CurrentState()); @@ -1302,7 +1362,8 @@ } case AS_VIEW_GET_STATE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_STATE: View name: %s\n", fTitle, fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_STATE: " + "View name: %s\n", fTitle, fCurrentView->Name())); fLink.StartMessage(B_OK); @@ -1313,7 +1374,8 @@ } case AS_VIEW_SET_EVENT_MASK: { - STRACE(("ServerWindow %s: Message AS_VIEW_SET_EVENT_MASK: View name: %s\n", fTitle, fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_EVENT_MASK: " + "View name: %s\n", fTitle, fCurrentView->Name())); uint32 eventMask, options; link.Read(&eventMask); @@ -1335,7 +1397,8 @@ } case AS_VIEW_SET_MOUSE_EVENT_MASK: { - STRACE(("ServerWindow %s: Message AS_VIEW_SET_MOUSE_EVENT_MASK: View name: %s\n", fTitle, fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_MOUSE_EVENT_MASK: " + "View name: %s\n", fTitle, fCurrentView->Name())); uint32 eventMask, options; link.Read(&eventMask); @@ -1359,13 +1422,14 @@ } case AS_VIEW_MOVE_TO: { - STRACE(("ServerWindow %s: Message AS_VIEW_MOVE_TO: View name: %s\n", - fTitle, fCurrentView->Name())); - float x, y; link.Read(&x); - link.Read(&y); + if (link.Read(&y) != B_OK) + break; + DTRACE(("ServerWindow %s: Message AS_VIEW_MOVE_TO: View name: " + "%s, x: %.1f, y: %.1f\n", fTitle, fCurrentView->Name(), x, y)); + float offsetX = x - fCurrentView->Frame().left; float offsetY = y - fCurrentView->Frame().top; @@ -1385,13 +1449,15 @@ } case AS_VIEW_RESIZE_TO: { - STRACE(("ServerWindow %s: Message AS_VIEW_RESIZE_TO: View name: %s\n", - fTitle, fCurrentView->Name())); - float newWidth, newHeight; link.Read(&newWidth); - link.Read(&newHeight); + if (link.Read(&newHeight) != B_OK) + break; + DTRACE(("ServerWindow %s: Message AS_VIEW_RESIZE_TO: View name: " + "%s, width: %.1f, height: %.1f\n", fTitle, + fCurrentView->Name(), newWidth, newHeight)); + float deltaWidth = newWidth - fCurrentView->Frame().Width(); float deltaHeight = newHeight - fCurrentView->Frame().Height(); @@ -1407,10 +1473,15 @@ } case AS_VIEW_GET_COORD: { - STRACE(("ServerWindow %s: Message AS_VIEW_GET_COORD: View: %s\n", Title(), fCurrentView->Name())); + // our offset in the parent -> will be originX and originY + // in BView + BPoint parentOffset = fCurrentView->Frame().LeftTop(); + + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_COORD: " + "View: %s -> x: %.1f, y: %.1f\n", Title(), + fCurrentView->Name(), parentOffset.x, parentOffset.y)); + fLink.StartMessage(B_OK); - // our offset in the parent -> will be originX and originY in BView - BPoint parentOffset = fCurrentView->Frame().LeftTop(); fLink.Attach(parentOffset); fLink.Attach(fCurrentView->Bounds()); fLink.Flush(); @@ -1418,38 +1489,49 @@ } case AS_VIEW_SET_ORIGIN: { - STRACE(("ServerWindow %s: Message AS_VIEW_SET_ORIGIN: View: %s\n", Title(), fCurrentView->Name())); - float x, y; link.Read(&x); - link.Read(&y); + if (link.Read(&y) != B_OK) + break; + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_ORIGIN: " + "View: %s -> x: %.1f, y: %.1f\n", Title(), + fCurrentView->Name(), x, y)); + fCurrentView->SetDrawingOrigin(BPoint(x, y)); _UpdateDrawState(fCurrentView); break; } case AS_VIEW_GET_ORIGIN: { - STRACE(("ServerWindow %s: Message AS_VIEW_GET_ORIGIN: View: %s\n", Title(), fCurrentView->Name())); + BPoint drawingOrigin = fCurrentView->DrawingOrigin(); + + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_ORIGIN: " + "View: %s -> x: %.1f, y: %.1f\n", Title(), + fCurrentView->Name(), drawingOrigin.x, drawingOrigin.y)); + fLink.StartMessage(B_OK); - fLink.Attach(fCurrentView->DrawingOrigin()); + fLink.Attach(drawingOrigin); fLink.Flush(); break; } case AS_VIEW_RESIZE_MODE: { - STRACE(("ServerWindow %s: Message AS_VIEW_RESIZE_MODE: View: %s\n", - Title(), fCurrentView->Name())); + uint32 resizeMode; + if (link.Read(&resizeMode) != B_OK) + break; - uint32 resizeMode; - if (link.Read(&resizeMode) == B_OK) - fCurrentView->SetResizeMode(resizeMode); + DTRACE(("ServerWindow %s: Message AS_VIEW_RESIZE_MODE: " + "View: %s -> %ld\n", Title(), fCurrentView->Name(), + resizeMode)); + + fCurrentView->SetResizeMode(resizeMode); break; } case AS_VIEW_SET_CURSOR: { - DTRACE(("ServerWindow %s: Message AS_VIEW_CURSOR: View: %s\n", Title(), - fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_CURSOR: View: %s\n", + Title(), fCurrentView->Name())); int32 token; bool sync; @@ -1460,7 +1542,8 @@ if (!fDesktop->GetCursorManager().Lock()) break; - ServerCursor* cursor = fDesktop->GetCursorManager().FindCursor(token); + ServerCursor* cursor + = fDesktop->GetCursorManager().FindCursor(token); fCurrentView->SetCursor(cursor); fDesktop->GetCursorManager().Unlock(); @@ -1485,30 +1568,34 @@ fCurrentView->SetFlags(flags); _UpdateDrawState(fCurrentView); - STRACE(("ServerWindow %s: Message AS_VIEW_SET_FLAGS: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_FLAGS: " + "View: %s -> flags: %lu\n", Title(), fCurrentView->Name(), + flags)); break; } case AS_VIEW_HIDE: - { - STRACE(("ServerWindow %s: Message AS_VIEW_HIDE: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_HIDE: View: %s\n", + Title(), fCurrentView->Name())); fCurrentView->SetHidden(true); break; - } + case AS_VIEW_SHOW: - { - STRACE(("ServerWindow %s: Message AS_VIEW_SHOW: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SHOW: View: %s\n", + Title(), fCurrentView->Name())); fCurrentView->SetHidden(false); break; - } + case AS_VIEW_SET_LINE_MODE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_LINE_MODE: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_LINE_MODE: " + "View: %s\n", Title(), fCurrentView->Name())); int8 lineCap, lineJoin; float miterLimit; link.Read(&lineCap); link.Read(&lineJoin); - link.Read(&miterLimit); + if (link.Read(&miterLimit) != B_OK) + break; fCurrentView->CurrentState()->SetLineCapMode((cap_mode)lineCap); fCurrentView->CurrentState()->SetLineJoinMode((join_mode)lineJoin); @@ -1522,7 +1609,8 @@ } case AS_VIEW_GET_LINE_MODE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_LINE_MODE: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_LINE_MODE: " + "View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); fLink.Attach((int8)(fCurrentView->CurrentState()->LineCapMode())); fLink.Attach((int8)(fCurrentView->CurrentState()->LineJoinMode())); @@ -1533,16 +1621,18 @@ } case AS_VIEW_PUSH_STATE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_PUSH_STATE: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_PUSH_STATE: View: " + "%s\n", Title(), fCurrentView->Name())); fCurrentView->PushState(); // TODO: is this necessary? - _UpdateDrawState(fCurrentView); +// _UpdateDrawState(fCurrentView); break; } case AS_VIEW_POP_STATE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_POP_STATE: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_POP_STATE: View: %s\n", + Title(), fCurrentView->Name())); fCurrentView->PopState(); _UpdateDrawState(fCurrentView); @@ -1550,49 +1640,68 @@ } case AS_VIEW_SET_SCALE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_SCALE: View: %s\n", Title(), fCurrentView->Name())); float scale; - link.Read(&scale); + if (link.Read(&scale) != B_OK) + break; + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_SCALE: " + "View: %s -> scale: %.2f\n", Title(), fCurrentView->Name(), + scale)); + fCurrentView->SetScale(scale); _UpdateDrawState(fCurrentView); break; } case AS_VIEW_GET_SCALE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_SCALE: View: %s\n", Title(), fCurrentView->Name())); + float scale = fCurrentView->CurrentState()->Scale(); + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_SCALE: " + "View: %s -> scale: %.2f\n", + Title(), fCurrentView->Name(), scale)); + fLink.StartMessage(B_OK); - fLink.Attach(fCurrentView->CurrentState()->Scale()); + fLink.Attach(scale); fLink.Flush(); break; } case AS_VIEW_SET_PEN_LOC: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_PEN_LOC: View: %s\n", Title(), fCurrentView->Name())); float x, y; - link.Read(&x); - link.Read(&y); + if (link.Read(&y) != B_OK) + break; + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_PEN_LOC: " + "View: %s -> BPoint(%.1f, %.1f)\n", Title(), + fCurrentView->Name(), x, y)); + fCurrentView->CurrentState()->SetPenLocation(BPoint(x, y)); break; } case AS_VIEW_GET_PEN_LOC: { - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_PEN_LOC: View: %s\n", Title(), fCurrentView->Name())); + BPoint location = fCurrentView->CurrentState()->PenLocation(); + + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_PEN_LOC: " + "View: %s -> BPoint(%.1f, %.1f)\n", Title(), + fCurrentView->Name(), location.x, location.y)); + fLink.StartMessage(B_OK); - fLink.Attach(fCurrentView->CurrentState()->PenLocation()); + fLink.Attach(location); fLink.Flush(); break; } case AS_VIEW_SET_PEN_SIZE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_PEN_SIZE: View: %s\n", Title(), fCurrentView->Name())); float penSize; - link.Read(&penSize); + if (link.Read(&penSize) != B_OK) + break; + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_PEN_SIZE: " + "View: %s -> %.1f\n", Title(), fCurrentView->Name(), penSize)); + fCurrentView->CurrentState()->SetPenSize(penSize); fWindow->GetDrawingEngine()->SetPenSize( fCurrentView->CurrentState()->PenSize()); @@ -1600,100 +1709,182 @@ } case AS_VIEW_GET_PEN_SIZE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_PEN_SIZE: View: %s\n", Title(), fCurrentView->Name())); + float penSize = fCurrentView->CurrentState()->UnscaledPenSize(); + + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_PEN_SIZE: " + "View: %s -> %.1f\n", Title(), fCurrentView->Name(), penSize)); + fLink.StartMessage(B_OK); - fLink.Attach( - fCurrentView->CurrentState()->UnscaledPenSize()); + fLink.Attach(penSize); fLink.Flush(); break; } case AS_VIEW_SET_VIEW_COLOR: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_VIEW_COLOR: View: %s\n", Title(), fCurrentView->Name())); - rgb_color c; + rgb_color color; + if (link.Read(&color, sizeof(rgb_color)) != B_OK) + break; - link.Read(&c, sizeof(rgb_color)); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_VIEW_COLOR: " + "View: %s -> rgb_color(%d, %d, %d, %d)\n", Title(), + fCurrentView->Name(), color.red, color.green, color.blue, + color.alpha)); - fCurrentView->SetViewColor(c); + fCurrentView->SetViewColor(color); break; } + case AS_VIEW_GET_VIEW_COLOR: + { + rgb_color color = fCurrentView->ViewColor(); - case AS_VIEW_GET_HIGH_COLOR: - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_HIGH_COLOR: View: %s\n", - Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_VIEW_COLOR: " + "View: %s -> rgb_color(%d, %d, %d, %d)\n", + Title(), fCurrentView->Name(), color.red, color.green, + color.blue, color.alpha)); fLink.StartMessage(B_OK); - fLink.Attach(fCurrentView->CurrentState()->HighColor()); + fLink.Attach(color); fLink.Flush(); break; + } + case AS_VIEW_SET_HIGH_COLOR: + { + rgb_color color; + if (link.Read(&color, sizeof(rgb_color)) != B_OK) + break; - case AS_VIEW_GET_LOW_COLOR: - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_LOW_COLOR: View: %s\n", - Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_HIGH_COLOR: " + "View: %s -> rgb_color(%d, %d, %d, %d)\n", + Title(), fCurrentView->Name(), color.red, color.green, + color.blue, color.alpha)); + fCurrentView->CurrentState()->SetHighColor(color); + fWindow->GetDrawingEngine()->SetHighColor(color); + break; + } + case AS_VIEW_GET_HIGH_COLOR: + { + rgb_color color = fCurrentView->CurrentState()->HighColor(); + + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_HIGH_COLOR: " + "View: %s -> rgb_color(%d, %d, %d, %d)\n", + Title(), fCurrentView->Name(), color.red, color.green, + color.blue, color.alpha)); + fLink.StartMessage(B_OK); - fLink.Attach(fCurrentView->CurrentState()->LowColor()); + fLink.Attach(color); fLink.Flush(); break; + } + case AS_VIEW_SET_LOW_COLOR: + { + rgb_color color; + if (link.Read(&color, sizeof(rgb_color)) != B_OK) + break; - case AS_VIEW_GET_VIEW_COLOR: - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_VIEW_COLOR: View: %s\n", - Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_LOW_COLOR: " + "View: %s -> rgb_color(%d, %d, %d, %d)\n", + Title(), fCurrentView->Name(), color.red, color.green, + color.blue, color.alpha)); + fCurrentView->CurrentState()->SetLowColor(color); + fWindow->GetDrawingEngine()->SetLowColor(color); + break; + } + case AS_VIEW_GET_LOW_COLOR: + { + rgb_color color = fCurrentView->CurrentState()->LowColor(); + + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_LOW_COLOR: " + "View: %s -> rgb_color(%d, %d, %d, %d)\n", + Title(), fCurrentView->Name(), color.red, color.green, + color.blue, color.alpha)); + fLink.StartMessage(B_OK); - fLink.Attach(fCurrentView->ViewColor()); + fLink.Attach(color); fLink.Flush(); break; + } + case AS_VIEW_SET_PATTERN: + { + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_PATTERN: " + "View: %s\n", fTitle, fCurrentView->Name())); + pattern pat; + if (link.Read(&pat, sizeof(pattern)) != B_OK) + break; + + fCurrentView->CurrentState()->SetPattern(Pattern(pat)); + fWindow->GetDrawingEngine()->SetPattern(pat); + break; + } + case AS_VIEW_SET_BLENDING_MODE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_BLEND_MODE: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_BLEND_MODE: " + "View: %s\n", Title(), fCurrentView->Name())); int8 srcAlpha, alphaFunc; link.Read(&srcAlpha); - link.Read(&alphaFunc); + if (link.Read(&alphaFunc) != B_OK) + break; - fCurrentView->CurrentState()->SetBlendingMode((source_alpha)srcAlpha, - (alpha_function)alphaFunc); - //_UpdateDrawState(fCurrentView); - fWindow->GetDrawingEngine()->SetBlendingMode((source_alpha)srcAlpha, - (alpha_function)alphaFunc); + fCurrentView->CurrentState()->SetBlendingMode( + (source_alpha)srcAlpha, (alpha_function)alphaFunc); + fWindow->GetDrawingEngine()->SetBlendingMode( + (source_alpha)srcAlpha, (alpha_function)alphaFunc); break; } case AS_VIEW_GET_BLENDING_MODE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_BLEND_MODE: View: %s\n", Title(), fCurrentView->Name())); + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_BLEND_MODE: " + "View: %s\n", Title(), fCurrentView->Name())); fLink.StartMessage(B_OK); - fLink.Attach((int8)(fCurrentView->CurrentState()->AlphaSrcMode())); - fLink.Attach((int8)(fCurrentView->CurrentState()->AlphaFncMode())); + fLink.Attach((int8)( + fCurrentView->CurrentState()->AlphaSrcMode())); + fLink.Attach((int8)( + fCurrentView->CurrentState()->AlphaFncMode())); fLink.Flush(); break; } case AS_VIEW_SET_DRAWING_MODE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_SET_DRAW_MODE: View: %s\n", Title(), fCurrentView->Name())); int8 drawingMode; + if (link.Read(&drawingMode) != B_OK) + break; - link.Read(&drawingMode); + DTRACE(("ServerWindow %s: Message AS_VIEW_SET_DRAW_MODE: " + "View: %s -> %s\n", Title(), fCurrentView->Name(), + kDrawingModeMap[drawingMode])); - fCurrentView->CurrentState()->SetDrawingMode((drawing_mode)drawingMode); - //_UpdateDrawState(fCurrentView); - fWindow->GetDrawingEngine()->SetDrawingMode((drawing_mode)drawingMode); + fCurrentView->CurrentState()->SetDrawingMode( + (drawing_mode)drawingMode); + fWindow->GetDrawingEngine()->SetDrawingMode( + (drawing_mode)drawingMode); break; } case AS_VIEW_GET_DRAWING_MODE: { - DTRACE(("ServerWindow %s: Message AS_VIEW_GET_DRAW_MODE: View: %s\n", Title(), fCurrentView->Name())); + int8 drawingMode + = (int8)(fCurrentView->CurrentState()->GetDrawingMode()); + + DTRACE(("ServerWindow %s: Message AS_VIEW_GET_DRAW_MODE: " + "View: %s -> %s\n", Title(), fCurrentView->Name(), + kDrawingModeMap[drawingMode])); + fLink.StartMessage(B_OK); - fLink.Attach((int8)(fCurrentView->CurrentState()->GetDrawingMode())); + fLink.Attach(drawingMode); fLink.Flush(); [... truncated: 705 lines follow ...] From stippi at mail.berlios.de Thu Nov 6 20:19:55 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 6 Nov 2008 20:19:55 +0100 Subject: [Haiku-commits] r28538 - haiku/trunk/src/servers/app Message-ID: <200811061919.mA6JJtC0019869@sheep.berlios.de> Author: stippi Date: 2008-11-06 20:19:54 +0100 (Thu, 06 Nov 2008) New Revision: 28538 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28538&view=rev Modified: haiku/trunk/src/servers/app/Window.cpp Log: * Don't invalidate anything in offscreen windows. NetPositive is doing slightly strange redrawing, including scrolling the offscreen view that it uses in "flicker free" mode (which is the default). Invalidation does not work in offscreen windows, since the client thread is not running and certainly won't redraw anything. But that will leave a non-drawable region on the app_server side of things. Simply don't invalidate in this case. From what I have seen, redrawing in NetPositive seems to work fine now. Modified: haiku/trunk/src/servers/app/Window.cpp =================================================================== --- haiku/trunk/src/servers/app/Window.cpp 2008-11-06 19:16:56 UTC (rev 28537) +++ haiku/trunk/src/servers/app/Window.cpp 2008-11-06 19:19:54 UTC (rev 28538) @@ -414,7 +414,7 @@ //fDrawingEngine->FillRegion(dirty, rgb_color{ 255, 0, 255, 255 }); //snooze(2000); - if (IsVisible() && view->IsVisible()) { + if (!IsOffscreenWindow() && IsVisible() && view->IsVisible()) { dirty->IntersectWith(&VisibleContentRegion()); _TriggerContentRedraw(*dirty); } @@ -669,7 +669,7 @@ // since this won't affect other windows, read locking // is sufficient. If there was no dirty region before, // an update message is triggered - if (fHidden) + if (fHidden || IsOffscreenWindow()) return; regionOnScreen.IntersectWith(&VisibleContentRegion()); @@ -682,7 +682,7 @@ Window::MarkContentDirtyAsync(BRegion& regionOnScreen) { // NOTE: see comments in ProcessDirtyRegion() - if (fHidden) + if (fHidden || IsOffscreenWindow()) return; regionOnScreen.IntersectWith(&VisibleContentRegion()); From ingo_weinhold at gmx.de Thu Nov 6 22:51:42 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 06 Nov 2008 22:51:42 +0100 Subject: [Haiku-commits] r28485 - haiku/trunk/build/jam In-Reply-To: <200811032226.mA3MQdGM012893@sheep.berlios.de> References: <200811032226.mA3MQdGM012893@sheep.berlios.de> Message-ID: <20081106225142.1009.3@knochen-vm.localdomain> On 2008-11-03 at 23:26:39 [+0100], stippi at mail.berlios.de wrote: > Author: stippi > Date: 2008-11-03 23:26:37 +0100 (Mon, 03 Nov 2008) > New Revision: 28485 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28485&view=rev > > Modified: > haiku/trunk/build/jam/OptionalPackages > Log: [...] > * Pe -> updated to most recent version (called it RC2) which includes a few > fixes and new HVIF icons for most of it's supported document types. > Renamed > the application folder to "Pe" and removed the "Drag lpe here to install" > link. Renamed the application itself to "Pe". If you've renamed the "pe" executable after the add-ons have been built, this might cause problems. At least I get messages in the syslog when starting Pe ("runtime_loader: cannot open file generated/distro/pe"), supposedly for the three extensions that are linked against the executable. The best solution is probably to change Pe's build system to build Pe with soname "_APP_". CU, Ingo From superstippi at gmx.de Thu Nov 6 23:22:31 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Thu, 06 Nov 2008 23:22:31 +0100 Subject: [Haiku-commits] r28485 - haiku/trunk/build/jam In-Reply-To: <20081106225142.1009.3@knochen-vm.localdomain> References: <200811032226.mA3MQdGM012893@sheep.berlios.de> <20081106225142.1009.3@knochen-vm.localdomain> Message-ID: <20081106232231.10050.2@stippis2.1225984834.fake> Ingo Weinhold wrote: > > On 2008-11-03 at 23:26:39 [+0100], stippi at mail.berlios.de wrote: > > Author: stippi > > Date: 2008-11-03 23:26:37 +0100 (Mon, 03 Nov 2008) New Revision: 28485 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28485&view=rev > > > > Modified: > > haiku/trunk/build/jam/OptionalPackages > > Log: > [...] > > * Pe -> updated to most recent version (called it RC2) which includes a > > few > > fixes and new HVIF icons for most of it's supported document types. > > Renamed > > the application folder to "Pe" and removed the "Drag lpe here to > > install" link. Renamed the application itself to "Pe". > > If you've renamed the "pe" executable after the add-ons have been built, > this might cause problems. At least I get messages in the syslog when > starting Pe ("runtime_loader: cannot open file generated/distro/pe"), > supposedly for the three extensions that are linked against the > executable. The best solution is probably to change Pe's build system to > build Pe with soname "_APP_". Oh, thanks for the note. I'll look into it tomorrow then. Best regards, -Stephan From axeld at mail.berlios.de Thu Nov 6 23:51:31 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Thu, 6 Nov 2008 23:51:31 +0100 Subject: [Haiku-commits] r28539 - in haiku/trunk/src/add-ons/kernel/drivers/network: . broadcom570x broadcom570x/dev broadcom570x/dev/bge broadcom570x/dev/mii Message-ID: <200811062251.mA6MpVM9006451@sheep.berlios.de> Author: axeld Date: 2008-11-06 23:51:31 +0100 (Thu, 06 Nov 2008) New Revision: 28539 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28539&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/ Removed: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom_bcm570x/ Modified: haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/Jamfile Log: * Renamed broadcom_bcm570x driver to broadcom570x. Modified: haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile 2008-11-06 19:19:54 UTC (rev 28538) +++ haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile 2008-11-06 22:51:31 UTC (rev 28539) @@ -14,8 +14,9 @@ # FreeBSD 7 drivers SubInclude HAIKU_TOP src add-ons kernel drivers network 3com ; -SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x ; +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom570x ; SubInclude HAIKU_TOP src add-ons kernel drivers network ipro100 ; +#SubInclude HAIKU_TOP src add-ons kernel drivers network jmicron ; 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 ; Copied: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x (from rev 28521, haiku/trunk/src/add-ons/kernel/drivers/network/broadcom_bcm570x) Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom_bcm570x/Jamfile 2008-11-05 18:11:58 UTC (rev 28521) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/Jamfile 2008-11-06 22:51:31 UTC (rev 28539) @@ -1,3 +1,3 @@ -SubDir HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x ; +SubDir HAIKU_TOP src add-ons kernel drivers network broadcom570x ; -SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x dev ; +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom570x dev ; Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/Jamfile 2008-11-05 18:11:58 UTC (rev 28521) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/Jamfile 2008-11-06 22:51:31 UTC (rev 28539) @@ -1,4 +1,4 @@ -SubDir HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x dev ; +SubDir HAIKU_TOP src add-ons kernel drivers network broadcom570x dev ; -SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x dev bge ; -SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x dev mii ; +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom570x dev bge ; +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom570x dev mii ; Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/Jamfile 2008-11-05 18:11:58 UTC (rev 28521) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/Jamfile 2008-11-06 22:51:31 UTC (rev 28539) @@ -1,4 +1,4 @@ -SubDir HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x dev bge ; +SubDir HAIKU_TOP src add-ons kernel drivers network broadcom570x dev bge ; SubDirCcFlags -Wall ; @@ -10,9 +10,9 @@ SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ; -KernelAddon broadcom_bcm570x : +KernelAddon broadcom570x : if_bge.c glue.c - : libfreebsd_network.a broadcom_bcm570x_mii.a + : libfreebsd_network.a broadcom570x_mii.a ; Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/bge/glue.c 2008-11-05 18:11:58 UTC (rev 28521) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c 2008-11-06 22:51:31 UTC (rev 28539) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Axel D?rfler, axeld at pinc-software.de. All Rights Reserved. + * Copyright 2007-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -7,7 +7,7 @@ #include -HAIKU_FBSD_DRIVER_GLUE(broadcom_bcm570x, bge, pci); +HAIKU_FBSD_DRIVER_GLUE(broadcom570x, bge, pci); HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE); Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom_bcm570x/dev/mii/Jamfile 2008-11-05 18:11:58 UTC (rev 28521) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/Jamfile 2008-11-06 22:51:31 UTC (rev 28539) @@ -1,4 +1,4 @@ -SubDir HAIKU_TOP src add-ons kernel drivers network broadcom_bcm570x dev mii ; +SubDir HAIKU_TOP src add-ons kernel drivers network broadcom570x dev mii ; UsePrivateHeaders kernel net ; @@ -7,7 +7,7 @@ SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ; -KernelStaticLibrary broadcom_bcm570x_mii.a +KernelStaticLibrary broadcom570x_mii.a : ukphy.c ukphy_subr.c From stippi at mail.berlios.de Thu Nov 6 23:52:51 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 6 Nov 2008 23:52:51 +0100 Subject: [Haiku-commits] r28540 - haiku/trunk/src/apps/aboutsystem Message-ID: <200811062252.mA6MqpiP006531@sheep.berlios.de> Author: stippi Date: 2008-11-06 23:52:50 +0100 (Thu, 06 Nov 2008) New Revision: 28540 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28540&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: Added Adrian Panasiuk for his very good bug reporting work and helpful patches. Thanks a lot! Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-06 22:51:31 UTC (rev 28539) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-06 22:52:50 UTC (rev 28540) @@ -513,6 +513,7 @@ "Alan Murta\n" "Pahtz\n" "Michael Paine\n" + "Adrian Panasiuk\n" "Francesco Piccinno\n" "David Powell\n" "Jeremy Rand\n" From mmu_man at mail.berlios.de Fri Nov 7 00:24:43 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 7 Nov 2008 00:24:43 +0100 Subject: [Haiku-commits] r28541 - haiku/trunk/src/system/libroot/posix/glibc/arch/ppc Message-ID: <200811062324.mA6NOhNs009385@sheep.berlios.de> Author: mmu_man Date: 2008-11-07 00:24:41 +0100 (Fri, 07 Nov 2008) New Revision: 28541 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28541&view=rev Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile Log: This seems to fix building libroot on ppc... the *l versions aren't used. Modified: haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile 2008-11-06 22:52:50 UTC (rev 28540) +++ haiku/trunk/src/system/libroot/posix/glibc/arch/ppc/Jamfile 2008-11-06 23:24:41 UTC (rev 28541) @@ -113,7 +113,7 @@ w_remainder.c w_remainderf.c # w_remainderl.c w_scalb.c w_scalbf.c # w_scalbl.c w_sinh.c w_sinhf.c # w_sinhl.c - w_tgamma.c w_tgammaf.c w_tgammal.c + w_tgamma.c w_tgammaf.c # w_tgammal.c ; MergeObject posix_gnu_arch_$(TARGET_ARCH)_generic.o : From leavengood at mail.berlios.de Fri Nov 7 01:11:59 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Fri, 7 Nov 2008 01:11:59 +0100 Subject: [Haiku-commits] r28542 - haiku/trunk/src/add-ons/media/media-add-ons/mixer Message-ID: <200811070011.mA70BxXC028581@sheep.berlios.de> Author: leavengood Date: 2008-11-07 01:11:57 +0100 (Fri, 07 Nov 2008) New Revision: 28542 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28542&view=rev Modified: haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp Log: Removed now unused constants as suggested by Marcus. Thanks! Modified: haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp 2008-11-06 23:24:41 UTC (rev 28541) +++ haiku/trunk/src/add-ons/media/media-add-ons/mixer/AudioMixer.cpp 2008-11-07 00:11:57 UTC (rev 28542) @@ -22,9 +22,6 @@ #include #include -#define VERSION_STRING "0.4" -#define BUILD_STRING __DATE__ " " __TIME__ - // the range of the gain sliders (in dB) #define DB_MAX 18.0 #define DB_MIN -60.0 From leavengood at gmail.com Fri Nov 7 01:12:12 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Thu, 6 Nov 2008 19:12:12 -0500 Subject: [Haiku-commits] r28509 - haiku/trunk/src/add-ons/media/media-add-ons/mixer In-Reply-To: <4911F0B1.6070108@arcor.de> References: <200811042348.mA4Nm1Sv032022@sheep.berlios.de> <4911F0B1.6070108@arcor.de> Message-ID: On Wed, Nov 5, 2008 at 2:14 PM, Marcus Overhagen wrote: > > Please also remove the definitions for those strings, they should be > unused now. Thanks for the note, done in r28542. Ryan From mmu_man at mail.berlios.de Fri Nov 7 03:35:46 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 7 Nov 2008 03:35:46 +0100 Subject: [Haiku-commits] r28543 - in haiku/trunk: . build/jam data/boot_cd Message-ID: <200811070235.mA72Zk8n023537@sheep.berlios.de> Author: mmu_man Date: 2008-11-07 03:35:46 +0100 (Fri, 07 Nov 2008) New Revision: 28543 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28543&view=rev Added: haiku/trunk/build/jam/CDBootPPCImage haiku/trunk/data/boot_cd/chrpboot.txt Modified: haiku/trunk/Jamfile haiku/trunk/build/jam/BuildSetup haiku/trunk/build/jam/ImageRules Log: First attempt at a PPC bootable iso, doesn't work yet. Modified: haiku/trunk/Jamfile =================================================================== --- haiku/trunk/Jamfile 2008-11-07 00:11:57 UTC (rev 28542) +++ haiku/trunk/Jamfile 2008-11-07 02:35:46 UTC (rev 28543) @@ -156,3 +156,4 @@ include [ FDirName $(HAIKU_BUILD_RULES_DIR) NetBootArchive ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) FloppyBootImage ] ; include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootImage ] ; +include [ FDirName $(HAIKU_BUILD_RULES_DIR) CDBootPPCImage ] ; Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2008-11-07 00:11:57 UTC (rev 28542) +++ haiku/trunk/build/jam/BuildSetup 2008-11-07 02:35:46 UTC (rev 28543) @@ -44,6 +44,13 @@ HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_IMAGE_CONTAINER_NAME) = HAIKU_CD_BOOT_IMAGE_INSTALL_TARGETS ; +# boot CD for PPC image +HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME = haiku-boot-cd-ppc-container ; +HAIKU_CONTAINER_GRIST on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) = CDBootPPCImage ; +# HAIKU_INCLUDE_IN_CONTAINER_VAR -- update only mode not supported +HAIKU_INSTALL_TARGETS_VAR on $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) + = HAIKU_CD_BOOT_PPC_IMAGE_INSTALL_TARGETS ; + # Haiku image/install defaults HAIKU_DEFAULT_IMAGE_NAME = haiku.image ; HAIKU_DEFAULT_IMAGE_DIR = $(HAIKU_OUTPUT_DIR) ; Added: haiku/trunk/build/jam/CDBootPPCImage =================================================================== --- haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 00:11:57 UTC (rev 28542) +++ haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 02:35:46 UTC (rev 28543) @@ -0,0 +1,24 @@ +# This file defines what ends up in the CD boot image and it executes the +# rules building the image. + +#HAIKU_BOOT_FLOPPY = haiku-boot-floppy.image ; +#MakeLocate $(HAIKU_BOOT_FLOPPY) : $(HAIKU_OUTPUT_DIR) ; + +# CD image target +HAIKU_CD_BOOT_PPC_IMAGE = haiku-boot-cd-ppc.iso ; +MakeLocate $(HAIKU_CD_BOOT_PPC_IMAGE) : $(HAIKU_OUTPUT_DIR) ; + +# the pseudo target all archive contents is attached to +NotFile $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) ; + +# extra files to put on the boot iso +local extras = chrpboot.txt README.html ; +SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; + +BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : $(HAIKU_BOOT_FLOPPY) : $(extras) ; + + +NotFile haiku-boot-cd-ppc ; +Depends haiku-boot-cd-ppc : $(HAIKU_CD_BOOT_PPC_IMAGE) ; + + Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-07 00:11:57 UTC (rev 28542) +++ haiku/trunk/build/jam/ImageRules 2008-11-07 02:35:46 UTC (rev 28543) @@ -1066,3 +1066,20 @@ } +#pragma mark - CD Boot PPC Image rules + +rule BuildCDBootPPCImage image : bootloader : extrafiles +{ + Depends $(image) : $(bootloader) ; + Depends $(image) : $(extrafiles) ; + + BuildCDBootPPCImage1 $(image) : $(bootloader) $(extrafiles) ; +} + +actions BuildCDBootPPCImage1 +{ + $(RM) $(<) + mkisofs -r -U -chrp-boot -V bootimg -o $(<) $(>[1]) $(>[2-]) +} + + Added: haiku/trunk/data/boot_cd/chrpboot.txt =================================================================== --- haiku/trunk/data/boot_cd/chrpboot.txt 2008-11-07 00:11:57 UTC (rev 28542) +++ haiku/trunk/data/boot_cd/chrpboot.txt 2008-11-07 02:35:46 UTC (rev 28543) @@ -0,0 +1,11 @@ + + +Haiku Boot Disk + + +Haiku + + +boot cd:\boot_loader_openfirmware + + From leavengood at mail.berlios.de Fri Nov 7 04:53:19 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Fri, 7 Nov 2008 04:53:19 +0100 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg Message-ID: <200811070353.mA73rJqC001947@sheep.berlios.de> Author: leavengood Date: 2008-11-07 04:53:18 +0100 (Fri, 07 Nov 2008) New Revision: 28544 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28544&view=rev Added: haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.c haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.h haiku/trunk/src/add-ons/translators/jpeg/libjpeg/jpegtran.c haiku/trunk/src/add-ons/translators/jpeg/libjpeg/rdswitch.c haiku/trunk/src/add-ons/translators/jpeg/libjpeg/transupp.c haiku/trunk/src/add-ons/translators/jpeg/libjpeg/transupp.h Modified: haiku/trunk/src/add-ons/translators/jpeg/Jamfile Log: Adding the jpegtran command and needed source files for part of Bug #1099. These were copied from the same code that originally was used for libjpeg (jpegsrc.v6b.tar.gz) in the JPEGTranslator with a few small changes. This will be used to implement JPEG lossless transformations in ShowImage in the way suggested by Michael Lotz in the email linked from the bug. Next up is changes to ShowImage. Modified: haiku/trunk/src/add-ons/translators/jpeg/Jamfile =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg/Jamfile 2008-11-07 02:35:46 UTC (rev 28543) +++ haiku/trunk/src/add-ons/translators/jpeg/Jamfile 2008-11-07 03:53:18 UTC (rev 28544) @@ -75,10 +75,14 @@ jquant1.c jquant2.c jutils.c - ; +; ObjectCcFlags [ FGristFiles $(jpeg_files:S=$(SUFOBJ)) ] : -w ; +StaticLibrary libjpeg.a : + $(jpeg_files) +; + Translator JPEGTranslator : # JPEGTranslator @@ -88,12 +92,18 @@ exif_parser.cpp JPEGTranslator.cpp - $(jpeg_files) - - : be translation + : be translation libjpeg.a : true ; +BinCommand jpegtran : + jpegtran.c + cdjpeg.c + rdswitch.c + transupp.c + : be libjpeg.a + ; + Package haiku-translationkit-cvs : JPEGTranslator : boot home config add-ons Translators ; Added: haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.c =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.c 2008-11-07 02:35:46 UTC (rev 28543) +++ haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.c 2008-11-07 03:53:18 UTC (rev 28544) @@ -0,0 +1,181 @@ +/* + * cdjpeg.c + * + * Copyright (C) 1991-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains common support routines used by the IJG application + * programs (cjpeg, djpeg, jpegtran). + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include /* to declare isupper(), tolower() */ +#ifdef NEED_SIGNAL_CATCHER +#include /* to declare signal() */ +#endif +#ifdef USE_SETMODE +#include /* to declare setmode()'s parameter macros */ +/* If you have setmode() but not , just delete this line: */ +#include /* to declare setmode() */ +#endif + + +/* + * Signal catcher to ensure that temporary files are removed before aborting. + * NB: for Amiga Manx C this is actually a global routine named _abort(); + * we put "#define signal_catcher _abort" in jconfig.h. Talk about bogus... + */ + +#ifdef NEED_SIGNAL_CATCHER + +static j_common_ptr sig_cinfo; + +void /* must be global for Manx C */ +signal_catcher (int signum) +{ + if (sig_cinfo != NULL) { + if (sig_cinfo->err != NULL) /* turn off trace output */ + sig_cinfo->err->trace_level = 0; + jpeg_destroy(sig_cinfo); /* clean up memory allocation & temp files */ + } + exit(EXIT_FAILURE); +} + + +GLOBAL(void) +enable_signal_catcher (j_common_ptr cinfo) +{ + sig_cinfo = cinfo; +#ifdef SIGINT /* not all systems have SIGINT */ + signal(SIGINT, signal_catcher); +#endif +#ifdef SIGTERM /* not all systems have SIGTERM */ + signal(SIGTERM, signal_catcher); +#endif +} + +#endif + + +/* + * Optional progress monitor: display a percent-done figure on stderr. + */ + +#ifdef PROGRESS_REPORT + +METHODDEF(void) +progress_monitor (j_common_ptr cinfo) +{ + cd_progress_ptr prog = (cd_progress_ptr) cinfo->progress; + int total_passes = prog->pub.total_passes + prog->total_extra_passes; + int percent_done = (int) (prog->pub.pass_counter*100L/prog->pub.pass_limit); + + if (percent_done != prog->percent_done) { + prog->percent_done = percent_done; + if (total_passes > 1) { + fprintf(stderr, "\rPass %d/%d: %3d%% ", + prog->pub.completed_passes + prog->completed_extra_passes + 1, + total_passes, percent_done); + } else { + fprintf(stderr, "\r %3d%% ", percent_done); + } + fflush(stderr); + } +} + + +GLOBAL(void) +start_progress_monitor (j_common_ptr cinfo, cd_progress_ptr progress) +{ + /* Enable progress display, unless trace output is on */ + if (cinfo->err->trace_level == 0) { + progress->pub.progress_monitor = progress_monitor; + progress->completed_extra_passes = 0; + progress->total_extra_passes = 0; + progress->percent_done = -1; + cinfo->progress = &progress->pub; + } +} + + +GLOBAL(void) +end_progress_monitor (j_common_ptr cinfo) +{ + /* Clear away progress display */ + if (cinfo->err->trace_level == 0) { + fprintf(stderr, "\r \r"); + fflush(stderr); + } +} + +#endif + + +/* + * Case-insensitive matching of possibly-abbreviated keyword switches. + * keyword is the constant keyword (must be lower case already), + * minchars is length of minimum legal abbreviation. + */ + +GLOBAL(boolean) +keymatch (char * arg, const char * keyword, int minchars) +{ + register int ca, ck; + register int nmatched = 0; + + while ((ca = *arg++) != '\0') { + if ((ck = *keyword++) == '\0') + return FALSE; /* arg longer than keyword, no good */ + if (isupper(ca)) /* force arg to lcase (assume ck is already) */ + ca = tolower(ca); + if (ca != ck) + return FALSE; /* no good */ + nmatched++; /* count matched characters */ + } + /* reached end of argument; fail if it's too short for unique abbrev */ + if (nmatched < minchars) + return FALSE; + return TRUE; /* A-OK */ +} + + +/* + * Routines to establish binary I/O mode for stdin and stdout. + * Non-Unix systems often require some hacking to get out of text mode. + */ + +GLOBAL(FILE *) +read_stdin (void) +{ + FILE * input_file = stdin; + +#ifdef USE_SETMODE /* need to hack file mode? */ + setmode(fileno(stdin), O_BINARY); +#endif +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ + if ((input_file = fdopen(fileno(stdin), READ_BINARY)) == NULL) { + fprintf(stderr, "Cannot reopen stdin\n"); + exit(EXIT_FAILURE); + } +#endif + return input_file; +} + + +GLOBAL(FILE *) +write_stdout (void) +{ + FILE * output_file = stdout; + +#ifdef USE_SETMODE /* need to hack file mode? */ + setmode(fileno(stdout), O_BINARY); +#endif +#ifdef USE_FDOPEN /* need to re-open in binary mode? */ + if ((output_file = fdopen(fileno(stdout), WRITE_BINARY)) == NULL) { + fprintf(stderr, "Cannot reopen stdout\n"); + exit(EXIT_FAILURE); + } +#endif + return output_file; +} Added: haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.h =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.h 2008-11-07 02:35:46 UTC (rev 28543) +++ haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cdjpeg.h 2008-11-07 03:53:18 UTC (rev 28544) @@ -0,0 +1,184 @@ +/* + * cdjpeg.h + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains common declarations for the sample applications + * cjpeg and djpeg. It is NOT used by the core JPEG library. + */ + +#define JPEG_CJPEG_DJPEG /* define proper options in jconfig.h */ +#define JPEG_INTERNAL_OPTIONS /* cjpeg.c,djpeg.c need to see xxx_SUPPORTED */ +#include "jinclude.h" +#include "jpeglib.h" +#include "jerror.h" /* get library error codes too */ +#include "cderror.h" /* get application-specific error codes */ + + +/* + * Object interface for cjpeg's source file decoding modules + */ + +typedef struct cjpeg_source_struct * cjpeg_source_ptr; + +struct cjpeg_source_struct { + JMETHOD(void, start_input, (j_compress_ptr cinfo, + cjpeg_source_ptr sinfo)); + JMETHOD(JDIMENSION, get_pixel_rows, (j_compress_ptr cinfo, + cjpeg_source_ptr sinfo)); + JMETHOD(void, finish_input, (j_compress_ptr cinfo, + cjpeg_source_ptr sinfo)); + + FILE *input_file; + + JSAMPARRAY buffer; + JDIMENSION buffer_height; +}; + + +/* + * Object interface for djpeg's output file encoding modules + */ + +typedef struct djpeg_dest_struct * djpeg_dest_ptr; + +struct djpeg_dest_struct { + /* start_output is called after jpeg_start_decompress finishes. + * The color map will be ready at this time, if one is needed. + */ + JMETHOD(void, start_output, (j_decompress_ptr cinfo, + djpeg_dest_ptr dinfo)); + /* Emit the specified number of pixel rows from the buffer. */ + JMETHOD(void, put_pixel_rows, (j_decompress_ptr cinfo, + djpeg_dest_ptr dinfo, + JDIMENSION rows_supplied)); + /* Finish up at the end of the image. */ + JMETHOD(void, finish_output, (j_decompress_ptr cinfo, + djpeg_dest_ptr dinfo)); + + /* Target file spec; filled in by djpeg.c after object is created. */ + FILE * output_file; + + /* Output pixel-row buffer. Created by module init or start_output. + * Width is cinfo->output_width * cinfo->output_components; + * height is buffer_height. + */ + JSAMPARRAY buffer; + JDIMENSION buffer_height; +}; + + +/* + * cjpeg/djpeg may need to perform extra passes to convert to or from + * the source/destination file format. The JPEG library does not know + * about these passes, but we'd like them to be counted by the progress + * monitor. We use an expanded progress monitor object to hold the + * additional pass count. + */ + +struct cdjpeg_progress_mgr { + struct jpeg_progress_mgr pub; /* fields known to JPEG library */ + int completed_extra_passes; /* extra passes completed */ + int total_extra_passes; /* total extra */ + /* last printed percentage stored here to avoid multiple printouts */ + int percent_done; +}; + +typedef struct cdjpeg_progress_mgr * cd_progress_ptr; + + +/* Short forms of external names for systems with brain-damaged linkers. */ + +#ifdef NEED_SHORT_EXTERNAL_NAMES +#define jinit_read_bmp jIRdBMP +#define jinit_write_bmp jIWrBMP +#define jinit_read_gif jIRdGIF +#define jinit_write_gif jIWrGIF +#define jinit_read_ppm jIRdPPM +#define jinit_write_ppm jIWrPPM +#define jinit_read_rle jIRdRLE +#define jinit_write_rle jIWrRLE +#define jinit_read_targa jIRdTarga +#define jinit_write_targa jIWrTarga +#define read_quant_tables RdQTables +#define read_scan_script RdScnScript +#define set_quant_slots SetQSlots +#define set_sample_factors SetSFacts +#define read_color_map RdCMap +#define enable_signal_catcher EnSigCatcher +#define start_progress_monitor StProgMon +#define end_progress_monitor EnProgMon +#define read_stdin RdStdin +#define write_stdout WrStdout +#endif /* NEED_SHORT_EXTERNAL_NAMES */ + +/* Module selection routines for I/O modules. */ + +EXTERN(cjpeg_source_ptr) jinit_read_bmp JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_bmp JPP((j_decompress_ptr cinfo, + boolean is_os2)); +EXTERN(cjpeg_source_ptr) jinit_read_gif JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_gif JPP((j_decompress_ptr cinfo)); +EXTERN(cjpeg_source_ptr) jinit_read_ppm JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_ppm JPP((j_decompress_ptr cinfo)); +EXTERN(cjpeg_source_ptr) jinit_read_rle JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_rle JPP((j_decompress_ptr cinfo)); +EXTERN(cjpeg_source_ptr) jinit_read_targa JPP((j_compress_ptr cinfo)); +EXTERN(djpeg_dest_ptr) jinit_write_targa JPP((j_decompress_ptr cinfo)); + +/* cjpeg support routines (in rdswitch.c) */ + +EXTERN(boolean) read_quant_tables JPP((j_compress_ptr cinfo, char * filename, + int scale_factor, boolean force_baseline)); +EXTERN(boolean) read_scan_script JPP((j_compress_ptr cinfo, char * filename)); +EXTERN(boolean) set_quant_slots JPP((j_compress_ptr cinfo, char *arg)); +EXTERN(boolean) set_sample_factors JPP((j_compress_ptr cinfo, char *arg)); + +/* djpeg support routines (in rdcolmap.c) */ + +EXTERN(void) read_color_map JPP((j_decompress_ptr cinfo, FILE * infile)); + +/* common support routines (in cdjpeg.c) */ + +EXTERN(void) enable_signal_catcher JPP((j_common_ptr cinfo)); +EXTERN(void) start_progress_monitor JPP((j_common_ptr cinfo, + cd_progress_ptr progress)); +EXTERN(void) end_progress_monitor JPP((j_common_ptr cinfo)); +EXTERN(boolean) keymatch JPP((char * arg, const char * keyword, int minchars)); +EXTERN(FILE *) read_stdin JPP((void)); +EXTERN(FILE *) write_stdout JPP((void)); + +/* miscellaneous useful macros */ + +#ifdef DONT_USE_B_MODE /* define mode parameters for fopen() */ +#define READ_BINARY "r" +#define WRITE_BINARY "w" +#else +#ifdef VMS /* VMS is very nonstandard */ +#define READ_BINARY "rb", "ctx=stm" +#define WRITE_BINARY "wb", "ctx=stm" +#else /* standard ANSI-compliant case */ +#define READ_BINARY "rb" +#define WRITE_BINARY "wb" +#endif +#endif + +#ifndef EXIT_FAILURE /* define exit() codes if not provided */ +#define EXIT_FAILURE 1 +#endif +#ifndef EXIT_SUCCESS +#ifdef VMS +#define EXIT_SUCCESS 1 /* VMS is very nonstandard */ +#else +#define EXIT_SUCCESS 0 +#endif +#endif +#ifndef EXIT_WARNING +#ifdef VMS +#define EXIT_WARNING 1 /* VMS is very nonstandard */ +#else +#define EXIT_WARNING 2 +#endif +#endif Added: haiku/trunk/src/add-ons/translators/jpeg/libjpeg/jpegtran.c =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg/libjpeg/jpegtran.c 2008-11-07 02:35:46 UTC (rev 28543) +++ haiku/trunk/src/add-ons/translators/jpeg/libjpeg/jpegtran.c 2008-11-07 03:53:18 UTC (rev 28544) @@ -0,0 +1,504 @@ +/* + * jpegtran.c + * + * Copyright (C) 1995-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains a command-line user interface for JPEG transcoding. + * It is very similar to cjpeg.c, but provides lossless transcoding between + * different JPEG file formats. It also provides some lossless and sort-of- + * lossless transformations of JPEG data. + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include "transupp.h" /* Support routines for jpegtran */ +#include "jversion.h" /* for version message */ + +#ifdef USE_CCOMMAND /* command-line reader for Macintosh */ +#ifdef __MWERKS__ +#include /* Metrowerks needs this */ +#include /* ... and this */ +#endif +#ifdef THINK_C +#include /* Think declares it here */ +#endif +#endif + + +/* + * Argument-parsing code. + * The switch parser is designed to be useful with DOS-style command line + * syntax, ie, intermixed switches and file names, where only the switches + * to the left of a given file name affect processing of that file. + * The main program in this file doesn't actually use this capability... + */ + + +static const char * progname; /* program name for error messages */ +static char * outfilename; /* for -outfile switch */ +static JCOPY_OPTION copyoption; /* -copy switch */ +static jpeg_transform_info transformoption; /* image transformation options */ + + +LOCAL(void) +usage (void) +/* complain about bad command line */ +{ + fprintf(stderr, "usage: %s [switches] ", progname); +#ifdef TWO_FILE_COMMANDLINE + fprintf(stderr, "inputfile outputfile\n"); +#else + fprintf(stderr, "[inputfile]\n"); +#endif + + fprintf(stderr, "Switches (names may be abbreviated):\n"); + fprintf(stderr, " -copy none Copy no extra markers from source file\n"); + fprintf(stderr, " -copy comments Copy only comment markers (default)\n"); + fprintf(stderr, " -copy all Copy all extra markers\n"); +#ifdef ENTROPY_OPT_SUPPORTED + fprintf(stderr, " -optimize Optimize Huffman table (smaller file, but slow compression)\n"); +#endif +#ifdef C_PROGRESSIVE_SUPPORTED + fprintf(stderr, " -progressive Create progressive JPEG file\n"); +#endif +#if TRANSFORMS_SUPPORTED + fprintf(stderr, "Switches for modifying the image:\n"); + fprintf(stderr, " -grayscale Reduce to grayscale (omit color data)\n"); + fprintf(stderr, " -flip [horizontal|vertical] Mirror image (left-right or top-bottom)\n"); + fprintf(stderr, " -rotate [90|180|270] Rotate image (degrees clockwise)\n"); + fprintf(stderr, " -transpose Transpose image\n"); + fprintf(stderr, " -transverse Transverse transpose image\n"); + fprintf(stderr, " -trim Drop non-transformable edge blocks\n"); +#endif /* TRANSFORMS_SUPPORTED */ + fprintf(stderr, "Switches for advanced users:\n"); + fprintf(stderr, " -restart N Set restart interval in rows, or in blocks with B\n"); + fprintf(stderr, " -maxmemory N Maximum memory to use (in kbytes)\n"); + fprintf(stderr, " -outfile name Specify name for output file\n"); + fprintf(stderr, " -verbose or -debug Emit debug output\n"); + fprintf(stderr, "Switches for wizards:\n"); +#ifdef C_ARITH_CODING_SUPPORTED + fprintf(stderr, " -arithmetic Use arithmetic coding\n"); +#endif +#ifdef C_MULTISCAN_FILES_SUPPORTED + fprintf(stderr, " -scans file Create multi-scan JPEG per script file\n"); +#endif + exit(EXIT_FAILURE); +} + + +LOCAL(void) +select_transform (JXFORM_CODE transform) +/* Silly little routine to detect multiple transform options, + * which we can't handle. + */ +{ +#if TRANSFORMS_SUPPORTED + if (transformoption.transform == JXFORM_NONE || + transformoption.transform == transform) { + transformoption.transform = transform; + } else { + fprintf(stderr, "%s: can only do one image transformation at a time\n", + progname); + usage(); + } +#else + fprintf(stderr, "%s: sorry, image transformation was not compiled\n", + progname); + exit(EXIT_FAILURE); +#endif +} + + +LOCAL(int) +parse_switches (j_compress_ptr cinfo, int argc, char **argv, + int last_file_arg_seen, boolean for_real) +/* Parse optional switches. + * Returns argv[] index of first file-name argument (== argc if none). + * Any file names with indexes <= last_file_arg_seen are ignored; + * they have presumably been processed in a previous iteration. + * (Pass 0 for last_file_arg_seen on the first or only iteration.) + * for_real is FALSE on the first (dummy) pass; we may skip any expensive + * processing. + */ +{ + int argn; + char * arg; + boolean simple_progressive; + char * scansarg = NULL; /* saves -scans parm if any */ + + /* Set up default JPEG parameters. */ + simple_progressive = FALSE; + outfilename = NULL; + copyoption = JCOPYOPT_DEFAULT; + transformoption.transform = JXFORM_NONE; + transformoption.trim = FALSE; + transformoption.force_grayscale = FALSE; + cinfo->err->trace_level = 0; + + /* Scan command line options, adjust parameters */ + + for (argn = 1; argn < argc; argn++) { + arg = argv[argn]; + if (*arg != '-') { + /* Not a switch, must be a file name argument */ + if (argn <= last_file_arg_seen) { + outfilename = NULL; /* -outfile applies to just one input file */ + continue; /* ignore this name if previously processed */ + } + break; /* else done parsing switches */ + } + arg++; /* advance past switch marker character */ + + if (keymatch(arg, "arithmetic", 1)) { + /* Use arithmetic coding. */ +#ifdef C_ARITH_CODING_SUPPORTED + cinfo->arith_code = TRUE; +#else + fprintf(stderr, "%s: sorry, arithmetic coding not supported\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "copy", 1)) { + /* Select which extra markers to copy. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (keymatch(argv[argn], "none", 1)) { + copyoption = JCOPYOPT_NONE; + } else if (keymatch(argv[argn], "comments", 1)) { + copyoption = JCOPYOPT_COMMENTS; + } else if (keymatch(argv[argn], "all", 1)) { + copyoption = JCOPYOPT_ALL; + } else + usage(); + + } else if (keymatch(arg, "debug", 1) || keymatch(arg, "verbose", 1)) { + /* Enable debug printouts. */ + /* On first -d, print version identification */ + static boolean printed_version = FALSE; + + if (! printed_version) { + fprintf(stderr, "Independent JPEG Group's JPEGTRAN, version %s\n%s\n", + JVERSION, JCOPYRIGHT); + printed_version = TRUE; + } + cinfo->err->trace_level++; + + } else if (keymatch(arg, "flip", 1)) { + /* Mirror left-right or top-bottom. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (keymatch(argv[argn], "horizontal", 1)) + select_transform(JXFORM_FLIP_H); + else if (keymatch(argv[argn], "vertical", 1)) + select_transform(JXFORM_FLIP_V); + else + usage(); + + } else if (keymatch(arg, "grayscale", 1) || keymatch(arg, "greyscale",1)) { + /* Force to grayscale. */ +#if TRANSFORMS_SUPPORTED + transformoption.force_grayscale = TRUE; +#else + select_transform(JXFORM_NONE); /* force an error */ +#endif + + } else if (keymatch(arg, "maxmemory", 3)) { + /* Maximum memory in Kb (or Mb with 'm'). */ + long lval; + char ch = 'x'; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) + usage(); + if (ch == 'm' || ch == 'M') + lval *= 1000L; + cinfo->mem->max_memory_to_use = lval * 1000L; + + } else if (keymatch(arg, "optimize", 1) || keymatch(arg, "optimise", 1)) { + /* Enable entropy parm optimization. */ +#ifdef ENTROPY_OPT_SUPPORTED + cinfo->optimize_coding = TRUE; +#else + fprintf(stderr, "%s: sorry, entropy optimization was not compiled\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "outfile", 4)) { + /* Set output file name. */ + if (++argn >= argc) /* advance to next argument */ + usage(); + outfilename = argv[argn]; /* save it away for later use */ + + } else if (keymatch(arg, "progressive", 1)) { + /* Select simple progressive mode. */ +#ifdef C_PROGRESSIVE_SUPPORTED + simple_progressive = TRUE; + /* We must postpone execution until num_components is known. */ +#else + fprintf(stderr, "%s: sorry, progressive output was not compiled\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "restart", 1)) { + /* Restart interval in MCU rows (or in MCUs with 'b'). */ + long lval; + char ch = 'x'; + + if (++argn >= argc) /* advance to next argument */ + usage(); + if (sscanf(argv[argn], "%ld%c", &lval, &ch) < 1) + usage(); + if (lval < 0 || lval > 65535L) + usage(); + if (ch == 'b' || ch == 'B') { + cinfo->restart_interval = (unsigned int) lval; + cinfo->restart_in_rows = 0; /* else prior '-restart n' overrides me */ + } else { + cinfo->restart_in_rows = (int) lval; + /* restart_interval will be computed during startup */ + } + + } else if (keymatch(arg, "rotate", 2)) { + /* Rotate 90, 180, or 270 degrees (measured clockwise). */ + if (++argn >= argc) /* advance to next argument */ + usage(); + if (keymatch(argv[argn], "90", 2)) + select_transform(JXFORM_ROT_90); + else if (keymatch(argv[argn], "180", 3)) + select_transform(JXFORM_ROT_180); + else if (keymatch(argv[argn], "270", 3)) + select_transform(JXFORM_ROT_270); + else + usage(); + + } else if (keymatch(arg, "scans", 1)) { + /* Set scan script. */ +#ifdef C_MULTISCAN_FILES_SUPPORTED + if (++argn >= argc) /* advance to next argument */ + usage(); + scansarg = argv[argn]; + /* We must postpone reading the file in case -progressive appears. */ +#else + fprintf(stderr, "%s: sorry, multi-scan output was not compiled\n", + progname); + exit(EXIT_FAILURE); +#endif + + } else if (keymatch(arg, "transpose", 1)) { + /* Transpose (across UL-to-LR axis). */ + select_transform(JXFORM_TRANSPOSE); + + } else if (keymatch(arg, "transverse", 6)) { + /* Transverse transpose (across UR-to-LL axis). */ + select_transform(JXFORM_TRANSVERSE); + + } else if (keymatch(arg, "trim", 3)) { + /* Trim off any partial edge MCUs that the transform can't handle. */ + transformoption.trim = TRUE; + + } else { + usage(); /* bogus switch */ + } + } + + /* Post-switch-scanning cleanup */ + + if (for_real) { + +#ifdef C_PROGRESSIVE_SUPPORTED + if (simple_progressive) /* process -progressive; -scans can override */ + jpeg_simple_progression(cinfo); +#endif + +#ifdef C_MULTISCAN_FILES_SUPPORTED + if (scansarg != NULL) /* process -scans if it was present */ + if (! read_scan_script(cinfo, scansarg)) + usage(); +#endif + } + + return argn; /* return index of next arg (file name) */ +} + + +/* + * The main program. + */ + +int +main (int argc, char **argv) +{ + struct jpeg_decompress_struct srcinfo; + struct jpeg_compress_struct dstinfo; + struct jpeg_error_mgr jsrcerr, jdsterr; +#ifdef PROGRESS_REPORT + struct cdjpeg_progress_mgr progress; +#endif + jvirt_barray_ptr * src_coef_arrays; + jvirt_barray_ptr * dst_coef_arrays; + int file_index; + FILE * input_file; + FILE * output_file; + + /* On Mac, fetch a command line. */ +#ifdef USE_CCOMMAND + argc = ccommand(&argv); +#endif + + progname = argv[0]; + if (progname == NULL || progname[0] == 0) + progname = "jpegtran"; /* in case C library doesn't provide it */ + + /* Initialize the JPEG decompression object with default error handling. */ + srcinfo.err = jpeg_std_error(&jsrcerr); + jpeg_create_decompress(&srcinfo); + /* Initialize the JPEG compression object with default error handling. */ + dstinfo.err = jpeg_std_error(&jdsterr); + jpeg_create_compress(&dstinfo); + + /* Now safe to enable signal catcher. + * Note: we assume only the decompression object will have virtual arrays. + */ +#ifdef NEED_SIGNAL_CATCHER + enable_signal_catcher((j_common_ptr) &srcinfo); +#endif + + /* Scan command line to find file names. + * It is convenient to use just one switch-parsing routine, but the switch + * values read here are mostly ignored; we will rescan the switches after + * opening the input file. Also note that most of the switches affect the + * destination JPEG object, so we parse into that and then copy over what + * needs to affects the source too. + */ + + file_index = parse_switches(&dstinfo, argc, argv, 0, FALSE); + jsrcerr.trace_level = jdsterr.trace_level; + srcinfo.mem->max_memory_to_use = dstinfo.mem->max_memory_to_use; + +#ifdef TWO_FILE_COMMANDLINE + /* Must have either -outfile switch or explicit output file name */ + if (outfilename == NULL) { + if (file_index != argc-2) { + fprintf(stderr, "%s: must name one input and one output file\n", + progname); + usage(); + } + outfilename = argv[file_index+1]; + } else { + if (file_index != argc-1) { + fprintf(stderr, "%s: must name one input and one output file\n", + progname); + usage(); + } + } +#else + /* Unix style: expect zero or one file name */ + if (file_index < argc-1) { + fprintf(stderr, "%s: only one input file\n", progname); + usage(); + } +#endif /* TWO_FILE_COMMANDLINE */ + + /* Open the input file. */ + if (file_index < argc) { + if ((input_file = fopen(argv[file_index], READ_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, argv[file_index]); + exit(EXIT_FAILURE); + } + } else { + /* default input file is stdin */ + input_file = read_stdin(); + } + + /* Open the output file. */ + if (outfilename != NULL) { + if ((output_file = fopen(outfilename, WRITE_BINARY)) == NULL) { + fprintf(stderr, "%s: can't open %s\n", progname, outfilename); + exit(EXIT_FAILURE); + } + } else { + /* default output file is stdout */ + output_file = write_stdout(); + } + +#ifdef PROGRESS_REPORT + start_progress_monitor((j_common_ptr) &dstinfo, &progress); +#endif + + /* Specify data source for decompression */ + jpeg_stdio_src(&srcinfo, input_file); + + /* Enable saving of extra markers that we want to copy */ + jcopy_markers_setup(&srcinfo, copyoption); + + /* Read file header */ + (void) jpeg_read_header(&srcinfo, TRUE); + + /* Any space needed by a transform option must be requested before + * jpeg_read_coefficients so that memory allocation will be done right. + */ +#if TRANSFORMS_SUPPORTED + jtransform_request_workspace(&srcinfo, &transformoption); +#endif + + /* Read source file as DCT coefficients */ + src_coef_arrays = jpeg_read_coefficients(&srcinfo); + + /* Initialize destination compression parameters from source values */ + jpeg_copy_critical_parameters(&srcinfo, &dstinfo); + + /* Adjust destination parameters if required by transform options; + * also find out which set of coefficient arrays will hold the output. + */ +#if TRANSFORMS_SUPPORTED + dst_coef_arrays = jtransform_adjust_parameters(&srcinfo, &dstinfo, + src_coef_arrays, + &transformoption); +#else + dst_coef_arrays = src_coef_arrays; +#endif + + /* Adjust default compression parameters by re-parsing the options */ + file_index = parse_switches(&dstinfo, argc, argv, 0, TRUE); + + /* Specify data destination for compression */ + jpeg_stdio_dest(&dstinfo, output_file); + + /* Start compressor (note no image data is actually written here) */ + jpeg_write_coefficients(&dstinfo, dst_coef_arrays); + + /* Copy to the output file any extra markers that we want to preserve */ + jcopy_markers_execute(&srcinfo, &dstinfo, copyoption); + + /* Execute image transformation, if any */ +#if TRANSFORMS_SUPPORTED + jtransform_execute_transformation(&srcinfo, &dstinfo, + src_coef_arrays, + &transformoption); +#endif + + /* Finish compression and release memory */ + jpeg_finish_compress(&dstinfo); + jpeg_destroy_compress(&dstinfo); + (void) jpeg_finish_decompress(&srcinfo); + jpeg_destroy_decompress(&srcinfo); + + /* Close files, if we opened them */ + if (input_file != stdin) + fclose(input_file); + if (output_file != stdout) + fclose(output_file); + +#ifdef PROGRESS_REPORT + end_progress_monitor((j_common_ptr) &dstinfo); +#endif + + /* All done. */ + exit(jsrcerr.num_warnings + jdsterr.num_warnings ?EXIT_WARNING:EXIT_SUCCESS); + return 0; /* suppress no-return-value warnings */ +} Added: haiku/trunk/src/add-ons/translators/jpeg/libjpeg/rdswitch.c =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg/libjpeg/rdswitch.c 2008-11-07 02:35:46 UTC (rev 28543) +++ haiku/trunk/src/add-ons/translators/jpeg/libjpeg/rdswitch.c 2008-11-07 03:53:18 UTC (rev 28544) @@ -0,0 +1,332 @@ +/* + * rdswitch.c + * + * Copyright (C) 1991-1996, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file contains routines to process some of cjpeg's more complicated + * command-line switches. Switches processed here are: + * -qtables file Read quantization tables from text file + * -scans file Read scan script from text file + * -qslots N[,N,...] Set component quantization table selectors + * -sample HxV[,HxV,...] Set component sampling factors + */ + +#include "cdjpeg.h" /* Common decls for cjpeg/djpeg applications */ +#include /* to declare isdigit(), isspace() */ + + +LOCAL(int) +text_getc (FILE * file) +/* Read next char, skipping over any comments (# to end of line) */ +/* A comment/newline sequence is returned as a newline */ +{ + register int ch; + + ch = getc(file); + if (ch == '#') { + do { + ch = getc(file); + } while (ch != '\n' && ch != EOF); + } + return ch; +} + + +LOCAL(boolean) +read_text_integer (FILE * file, long * result, int * termchar) +/* Read an unsigned decimal integer from a file, store it in result */ +/* Reads one trailing character after the integer; returns it in termchar */ +{ + register int ch; + register long val; + + /* Skip any leading whitespace, detect EOF */ + do { + ch = text_getc(file); + if (ch == EOF) { + *termchar = ch; + return FALSE; + } + } while (isspace(ch)); + + if (! isdigit(ch)) { + *termchar = ch; + return FALSE; + } + + val = ch - '0'; + while ((ch = text_getc(file)) != EOF) { + if (! isdigit(ch)) + break; + val *= 10; + val += ch - '0'; + } [... truncated: 1343 lines follow ...] From leavengood at mail.berlios.de Fri Nov 7 04:55:52 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Fri, 7 Nov 2008 04:55:52 +0100 Subject: [Haiku-commits] r28545 - haiku/trunk/build/jam Message-ID: <200811070355.mA73tqHp002514@sheep.berlios.de> Author: leavengood Date: 2008-11-07 04:55:52 +0100 (Fri, 07 Nov 2008) New Revision: 28545 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28545&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Added jpegtran to the bin commands, removed a duplicate expr and put cp in the proper alphabetical order. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-07 03:53:18 UTC (rev 28544) +++ haiku/trunk/build/jam/HaikuImage 2008-11-07 03:55:52 UTC (rev 28545) @@ -32,13 +32,14 @@ BEOS_BIN = "[" addattr alert arp base64 basename bc beep bootman bzip2 cal cat catattr checkfs chgrp chmod chop chown chroot cksum clear - clockconfig cmp comm compress cp copyattr $(X86_ONLY)CortexAddOnHost + clockconfig cmp comm compress copyattr $(X86_ONLY)CortexAddOnHost cp csplit ctags cut date dc dd desklink df diff diff3 dircolors dirname draggers driveinfo dstcheck du echo eject env error expand expr - expr factor false fdinfo ffm find finddir fmt fold fortune frcode ftp ftpd + factor false fdinfo ffm find finddir fmt fold fortune frcode ftp ftpd funzip fwcontrol - gawk $(X86_ONLY)gdb grep groups gzip gzexe hd head hey hostname id ident - ideinfo idestatus ifconfig install installsound iroster isvolume join + gawk $(X86_ONLY)gdb grep groups gzip gzexe hd head hey hostname + id ident ideinfo idestatus ifconfig install installsound iroster isvolume + join jpegtran keymap kill less lessecho lesskey link listarea listattr listimage listdev listport listres listsem ln locate logger login logname ls lsindex make makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex @@ -128,7 +129,7 @@ BEOS_ADD_ONS_PRINT_TRANSPORT = HP\ JetDirect IPP LPR Parallel\ Port Print\ To\ File Serial\ Port USB\ Port ; -BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider ; +BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider BuyNow Message ; BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki ; #hda BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme From revol at free.fr Thu Nov 6 23:52:58 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Thu, 06 Nov 2008 23:52:58 +0100 CET Subject: [Haiku-commits] r28485 - haiku/trunk/build/jam In-Reply-To: <20081106232231.10050.2@stippis2.1225984834.fake> Message-ID: <19939489694-BeMail@laptop> > > If you've renamed the "pe" executable after the add-ons have been > > built, > > this might cause problems. At least I get messages in the syslog > > when > > starting Pe ("runtime_loader: cannot open file generated/distro/ > > pe"), > > supposedly for the three extensions that are linked against the > > executable. The best solution is probably to change Pe's build > > system to > > build Pe with soname "_APP_". > > Oh, thanks for the note. I'll look into it tomorrow then. > I just fixed it in svn, you can sleep some more tomorrow :) Fran?ois. From leavengood at gmail.com Fri Nov 7 05:05:53 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Thu, 6 Nov 2008 23:05:53 -0500 Subject: [Haiku-commits] r28545 - haiku/trunk/build/jam In-Reply-To: <200811070355.mA73tqHp002514@sheep.berlios.de> References: <200811070355.mA73tqHp002514@sheep.berlios.de> Message-ID: On Thu, Nov 6, 2008 at 10:55 PM, leavengood at BerliOS wrote: > > Modified: haiku/trunk/build/jam/HaikuImage > -BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider ; > +BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider BuyNow Message ; Oops, I also added these. In my testing at least Message does not work well on Haiku, so I may remove it again, but I will test first. Ryan From mmu_man at mail.berlios.de Fri Nov 7 09:33:46 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 7 Nov 2008 09:33:46 +0100 Subject: [Haiku-commits] r28546 - haiku/trunk/build/jam Message-ID: <200811070833.mA78XkkI018138@sheep.berlios.de> Author: mmu_man Date: 2008-11-07 09:33:46 +0100 (Fri, 07 Nov 2008) New Revision: 28546 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28546&view=rev Modified: haiku/trunk/build/jam/CDBootPPCImage Log: OF bootloader might be of more use than a PC floppy image there... :) Modified: haiku/trunk/build/jam/CDBootPPCImage =================================================================== --- haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 03:55:52 UTC (rev 28545) +++ haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 08:33:46 UTC (rev 28546) @@ -15,7 +15,7 @@ local extras = chrpboot.txt README.html ; SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; -BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : $(HAIKU_BOOT_FLOPPY) : $(extras) ; +BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : boot_loader_openfirmware : $(extras) ; NotFile haiku-boot-cd-ppc ; From axeld at pinc-software.de Fri Nov 7 09:34:52 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 07 Nov 2008 09:34:52 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28544_-_in_haiku/trunk/src/add-ons/tra?= =?utf-8?q?nslators/jpeg=3A_=2E_libjpeg?= In-Reply-To: <200811070353.mA73rJqC001947@sheep.berlios.de> Message-ID: <747191846-BeMail@zon> leavengood at BerliOS wrote: > This will be used to implement JPEG lossless transformations in > ShowImage in > the way suggested by Michael Lotz in the email linked from the bug. Using EXIF information this is actually not really needed at all. Furthermore, I don't really like the solution that ShowImage should call an external application for that (and thus needs to load the data again). Accidently, I had written a Tracker add-on some time ago that would translate the ShowImage rotation attribute to EXIF. I haven't released it yet, but it works well so far (but only for JPEGs for now, not for TIFF images that can also have EXIF information). Most platforms support this way of rotation out of the box (as it is what digital cameras are using), though Windows XP is an exception. As long as a JPEG has EXIF information, I would prefer altering that (which is also a much cheaper and less destructing operation). I can mail you the sources if you like to include it into ShowImage (that was my plan, too, and that's why I didn't release it as is). Bye, Axel. From axeld at mail.berlios.de Fri Nov 7 10:25:42 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 7 Nov 2008 10:25:42 +0100 Subject: [Haiku-commits] r28547 - haiku/trunk/build/jam Message-ID: <200811070925.mA79PgFu022973@sheep.berlios.de> Author: axeld Date: 2008-11-07 10:25:41 +0100 (Fri, 07 Nov 2008) New Revision: 28547 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28547&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: * Removed jpegtran from the image - this fixes the build (missing header). * While I was at it, I also removed the extra screen savers until Ryan fixed the issue (bug #2339). Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-07 08:33:46 UTC (rev 28546) +++ haiku/trunk/build/jam/HaikuImage 2008-11-07 09:25:41 UTC (rev 28547) @@ -37,9 +37,10 @@ draggers driveinfo dstcheck du echo eject env error expand expr factor false fdinfo ffm find finddir fmt fold fortune frcode ftp ftpd funzip fwcontrol - gawk $(X86_ONLY)gdb grep groups gzip gzexe hd head hey hostname - id ident ideinfo idestatus ifconfig install installsound iroster isvolume - join jpegtran + gawk $(X86_ONLY)gdb grep groups gzip gzexe hd head hey hostname + id ident ideinfo idestatus ifconfig install installsound iroster + isvolume + join keymap kill less lessecho lesskey link listarea listattr listimage listdev listport listres listsem ln locate logger login logname ls lsindex make makebootable md5sum merge mimeset mkdos mkdir mkfifo mkfs mkindex @@ -129,7 +130,7 @@ BEOS_ADD_ONS_PRINT_TRANSPORT = HP\ JetDirect IPP LPR Parallel\ Port Print\ To\ File Serial\ Port USB\ Port ; -BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider BuyNow Message ; +BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider ; BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki ; #hda BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme From superstippi at gmx.de Fri Nov 7 10:40:15 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Fri, 07 Nov 2008 10:40:15 +0100 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: <747191846-BeMail@zon> References: <747191846-BeMail@zon> Message-ID: <20081107104015.931.1@stippis2.1226050004.fake> Axel D?rfler wrote: > leavengood at BerliOS wrote: > > This will be used to implement JPEG lossless transformations in > > ShowImage in > > the way suggested by Michael Lotz in the email linked from the bug. > > Using EXIF information this is actually not really needed at all. > Furthermore, I don't really like the solution that ShowImage should call > an external application for that (and thus needs to load the data again). > Accidently, I had written a Tracker add-on some time ago that would > translate the ShowImage rotation attribute to EXIF. I haven't released it > yet, but it works well so far (but only for JPEGs for now, not for TIFF > images that can also have EXIF information). Most platforms support this > way of rotation out of the box (as it is what digital cameras are using), > though Windows XP is an exception. As long as a JPEG has EXIF > information, I would prefer altering that (which is also a much cheaper > and less destructing operation). I can mail you the sources if you like > to include it into ShowImage (that was my plan, too, and that's why I > didn't release it as is). Real lossless JPEG rotation is not destructive and it's the fool-proof method. A lot of cameras do not come with an orientation sensor. I can tell you from a lot of experience that real rotation is definitely needed. The world is just full of half-finished, half-tested products. If we ever managed to have every HAIKU program read the EXIF information from the photos, or if the translator already returned rotated photos - nice! But then you copy everything to a USB drive, plug it into your TV set top box and realize that the photos are not properly rotated anymore, but in this moment you're really frustrated, because a large chunk of your family is sitting in the living room waiting and thinking you can't handle your gear. Best regards, -Stephan From mmu_man at mail.berlios.de Fri Nov 7 10:40:12 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 7 Nov 2008 10:40:12 +0100 Subject: [Haiku-commits] r28548 - in haiku/trunk: build/jam data/boot_cd Message-ID: <200811070940.mA79eCDH025250@sheep.berlios.de> Author: mmu_man Date: 2008-11-07 10:40:12 +0100 (Fri, 07 Nov 2008) New Revision: 28548 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28548&view=rev Added: haiku/trunk/data/boot_cd/ofboot.b Removed: haiku/trunk/data/boot_cd/chrpboot.txt Modified: haiku/trunk/build/jam/CDBootPPCImage Log: Rename to ofboot.b as it seems the be the usual name Modified: haiku/trunk/build/jam/CDBootPPCImage =================================================================== --- haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 09:25:41 UTC (rev 28547) +++ haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 09:40:12 UTC (rev 28548) @@ -12,7 +12,7 @@ NotFile $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) ; # extra files to put on the boot iso -local extras = chrpboot.txt README.html ; +local extras = ofboot.b README.html ; SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : boot_loader_openfirmware : $(extras) ; Deleted: haiku/trunk/data/boot_cd/chrpboot.txt Copied: haiku/trunk/data/boot_cd/ofboot.b (from rev 28546, haiku/trunk/data/boot_cd/chrpboot.txt) From axeld at pinc-software.de Fri Nov 7 11:17:11 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 07 Nov 2008 11:17:11 +0100 CET Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: <20081107104015.931.1@stippis2.1226050004.fake> Message-ID: <6886109405-BeMail@zon> Stephan Assmus wrote: > Real lossless JPEG rotation is not destructive and it's the fool- > proof > method. It rewrites the whole JPEG while as opposed to changing a single byte in the existing stream, as such, it is more destructive (and slower) as changing the EXIF rotation. > A lot of cameras do not come with an orientation sensor. I can tell > you from a lot of experience that real rotation is definitely needed. > The > world is just full of half-finished, half-tested products. If we ever > managed to have every HAIKU program read the EXIF information from > the > photos, or if the translator already returned rotated photos - nice! It definitely does that, I added support for that myself :-) > But then you copy everything to a USB drive, plug it into your TV set > top box > and realize that the photos are not properly rotated anymore, but in > this > moment you're really frustrated, because a large chunk of your family > is > sitting in the living room waiting and thinking you can't handle your > gear. True enough, but I would always vote for the faster method, and changing the EXIF rotation is instantaneously. We could add lossless JPEG rotation, and we could even make it the default if you insist on it, but I wouldn't like this to be the only option. Furthermore, EXIF tags are also found in other file formats (TIFF, RAW files) that would otherwise not be supported. Bye, Axel. From axeld at mail.berlios.de Fri Nov 7 12:36:23 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 7 Nov 2008 12:36:23 +0100 Subject: [Haiku-commits] r28549 - haiku/trunk/src/servers/app Message-ID: <200811071136.mA7BaNGg011561@sheep.berlios.de> Author: axeld Date: 2008-11-07 12:36:22 +0100 (Fri, 07 Nov 2008) New Revision: 28549 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28549&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: * When switching to a workspace a window is on in ActivateWindow(), only consider the workspaces in the configured count. * If the window is not on the current workspace after the workspace check, always move it to the current instead. This lets windows on workspaces outside of the ones currently configured show up on the current workspace as if they had the B_NOT_ANCHORED_ON_ACTIVATE flag set. * This fixes bug #3003. * Minor cleanup. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-11-07 09:40:12 UTC (rev 28548) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-11-07 11:36:22 UTC (rev 28549) @@ -1489,8 +1489,8 @@ fLockedFocusWindow = window; } - + void Desktop::_BringWindowsToFront(WindowList& windows, int32 list, bool wereVisible) @@ -1559,13 +1559,13 @@ return; bool windowOnOtherWorkspace = !window->InWorkspace(fCurrentWorkspace); - if (windowOnOtherWorkspace) { - if ((window->Flags() & B_NO_WORKSPACE_ACTIVATION) == 0 - && (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) { - // switch to the workspace on which this window is + if (windowOnOtherWorkspace + && (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) { + if ((window->Flags() & B_NO_WORKSPACE_ACTIVATION) == 0) { + // Switch to the workspace on which this window is // (we'll take the first one that the window is on) uint32 workspaces = window->Workspaces(); - for (int32 i = 0; i < 32; i++) { + for (int32 i = 0; i < fSettings->WorkspacesCount(); i++) { uint32 workspace = workspace_to_workspaces(i); if (workspaces & workspace) { SetWorkspace(i); @@ -1573,15 +1573,14 @@ break; } } - } else if ((window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) { + } else { UnlockAllWindows(); return; } } - if (windowOnOtherWorkspace - && (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) != 0) { - // bring the window to the current workspace + if (windowOnOtherWorkspace) { + // Bring the window to the current workspace // TODO: what if this window is on multiple workspaces?!? uint32 workspaces = workspace_to_workspaces(fCurrentWorkspace); SetWindowWorkspaces(window, workspaces); From korli at users.berlios.de Fri Nov 7 12:55:46 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 7 Nov 2008 12:55:46 +0100 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: <200811070353.mA73rJqC001947@sheep.berlios.de> References: <200811070353.mA73rJqC001947@sheep.berlios.de> Message-ID: 2008/11/7 leavengood at BerliOS : > > +BinCommand jpegtran : > + jpegtran.c > + cdjpeg.c > + rdswitch.c > + transupp.c > + : be libjpeg.a > + ; > + This shouldn't live in src/add-ons but in src/bin Bye, J?r?me From axeld at mail.berlios.de Fri Nov 7 13:22:05 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 7 Nov 2008 13:22:05 +0100 Subject: [Haiku-commits] r28550 - haiku/trunk/src/system/kernel Message-ID: <200811071222.mA7CM5IN003083@sheep.berlios.de> Author: axeld Date: 2008-11-07 13:22:05 +0100 (Fri, 07 Nov 2008) New Revision: 28550 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28550&view=rev Modified: haiku/trunk/src/system/kernel/kernel_daemon.cpp Log: * The kernel daemon now uses a recursive lock instead of a mutex. This fixes bug #3082. * Also, it now allows to remove daemons in their hook function. * Added a "daemons" KDL command that dumps all registered kernel daemons, and resource resizers. Modified: haiku/trunk/src/system/kernel/kernel_daemon.cpp =================================================================== --- haiku/trunk/src/system/kernel/kernel_daemon.cpp 2008-11-07 11:36:22 UTC (rev 28549) +++ haiku/trunk/src/system/kernel/kernel_daemon.cpp 2008-11-07 12:22:05 UTC (rev 28550) @@ -1,5 +1,5 @@ /* - * Copyright 2003-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2003-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -12,6 +12,7 @@ #include +#include #include #include #include @@ -42,12 +43,15 @@ int frequency); status_t Unregister(daemon_hook function, void* arg); + void Dump(); + private: static status_t _DaemonThreadEntry(void* data); + struct daemon* _NextDaemon(struct daemon& marker); status_t _DaemonThread(); private: - mutex fLock; + recursive_lock fLock; DaemonList fDaemons; thread_id fThread; }; @@ -60,8 +64,7 @@ status_t KernelDaemon::Init(const char* name) { - new(&fDaemons) DaemonList; - mutex_init(&fLock, name); + recursive_lock_init(&fLock, name); fThread = spawn_kernel_thread(&_DaemonThreadEntry, name, B_LOW_PRIORITY, this); @@ -88,7 +91,7 @@ daemon->arg = arg; daemon->frequency = frequency; - MutexLocker _(fLock); + RecursiveLocker _(fLock); if (frequency > 1) { // we try to balance the work-load for each daemon run @@ -114,7 +117,7 @@ status_t KernelDaemon::Unregister(daemon_hook function, void* arg) { - MutexLocker _(fLock); + RecursiveLocker _(fLock); DaemonList::Iterator iterator = fDaemons.GetIterator(); @@ -134,6 +137,31 @@ } +void +KernelDaemon::Dump() +{ + DaemonList::Iterator iterator = fDaemons.GetIterator(); + + while (iterator.HasNext()) { + struct daemon* daemon = iterator.Next(); + const char *symbol, *imageName; + bool exactMatch; + + status_t status = elf_debug_lookup_symbol_address( + (addr_t)daemon->function, NULL, &symbol, &imageName, &exactMatch); + if (status == B_OK && exactMatch) { + if (strchr(imageName, '/') != NULL) + imageName = strrchr(imageName, '/') + 1; + + kprintf("\t%s:%s (%p), arg %p\n", imageName, symbol, + daemon->function, daemon->arg); + } else { + kprintf("\t%p, arg %p\n", daemon->function, daemon->arg); + } + } +} + + /*static*/ status_t KernelDaemon::_DaemonThreadEntry(void* data) { @@ -141,25 +169,45 @@ } +struct daemon* +KernelDaemon::_NextDaemon(struct daemon& marker) +{ + struct daemon* daemon; + + if (marker.GetDoublyLinkedListLink()->next == NULL + && marker.GetDoublyLinkedListLink()->previous == NULL + && fDaemons.Head() != &marker) { + // Marker is not part of the list yet, just return the first entry + daemon = fDaemons.Head(); + } else { + daemon = marker.GetDoublyLinkedListLink()->next; + fDaemons.Remove(&marker); + } + + if (daemon != NULL) + fDaemons.Insert(daemon->GetDoublyLinkedListLink()->next, &marker); + + return daemon; +} + + status_t KernelDaemon::_DaemonThread() { + struct daemon marker; int32 iteration = 0; while (true) { - mutex_lock(&fLock); + RecursiveLocker locker(fLock); - DaemonList::Iterator iterator = fDaemons.GetIterator(); - // iterate through the list and execute each daemon if needed - while (iterator.HasNext()) { - struct daemon* daemon = iterator.Next(); - + while (struct daemon* daemon = _NextDaemon(marker)) { if (((iteration + daemon->offset) % daemon->frequency) == 0) daemon->function(daemon->arg, iteration); } - mutex_unlock(&fLock); + locker.Unlock(); + iteration++; snooze(100000); // 0.1 seconds } @@ -171,6 +219,22 @@ // #pragma mark - +static int +dump_daemons(int argc, char** argv) +{ + kprintf("kernel daemons:\n"); + sKernelDaemon.Dump(); + + kprintf("\nresource resizers:\n"); + sResourceResizer.Dump(); + + return 0; +} + + +// #pragma mark - + + extern "C" status_t register_kernel_daemon(daemon_hook function, void* arg, int frequency) { @@ -199,6 +263,9 @@ } +// #pragma mark - + + extern "C" status_t kernel_daemon_init(void) { @@ -210,5 +277,6 @@ if (sResourceResizer.Init("resource resizer") != B_OK) panic("kernel_daemon_init(): failed to init resource resizer"); + add_debugger_command("daemons", dump_daemons, "Shows registered kernel daemons."); return B_OK; } From axeld at mail.berlios.de Fri Nov 7 14:23:24 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 7 Nov 2008 14:23:24 +0100 Subject: [Haiku-commits] r28551 - haiku/trunk/src/system/kernel/device_manager Message-ID: <200811071323.mA7DNOpA005977@sheep.berlios.de> Author: axeld Date: 2008-11-07 14:23:24 +0100 (Fri, 07 Nov 2008) New Revision: 28551 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28551&view=rev Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp Log: * BaseDevice::InitDevice() and UninitDevice() must not be called with the devfs lock held - that was a relict of the past. * This fixes bug #2535. Modified: haiku/trunk/src/system/kernel/device_manager/devfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2008-11-07 12:22:05 UTC (rev 28550) +++ haiku/trunk/src/system/kernel/device_manager/devfs.cpp 2008-11-07 13:23:24 UTC (rev 28551) @@ -1066,6 +1066,8 @@ if (status < B_OK) return status; + locker.Unlock(); + *_newVnodeID = vnode->id; cookie = (struct devfs_cookie*)malloc(sizeof(struct devfs_cookie)); @@ -1080,15 +1082,12 @@ if (status < B_OK) return status; + locker.Lock(); char path[B_FILE_NAME_LENGTH]; get_device_name(vnode, path, sizeof(path)); - locker.Unlock(); status = device->Open(path, openMode, &cookie->device_cookie); - - locker.Lock(); - if (status != B_OK) device->UninitDevice(); } @@ -1123,22 +1122,17 @@ cookie->device_cookie = NULL; if (S_ISCHR(vnode->stream.type)) { - RecursiveLocker locker(fs->lock); - BaseDevice* device = vnode->stream.u.dev.device; status = device->InitDevice(); if (status < B_OK) return status; + RecursiveLocker locker(fs->lock); char path[B_FILE_NAME_LENGTH]; get_device_name(vnode, path, sizeof(path)); - locker.Unlock(); status = device->Open(path, openMode, &cookie->device_cookie); - - locker.Lock(); - if (status != B_OK) device->UninitDevice(); } @@ -1174,21 +1168,13 @@ { struct devfs_vnode *vnode = (struct devfs_vnode *)_vnode->private_node; struct devfs_cookie *cookie = (struct devfs_cookie *)_cookie; - struct devfs *fs = (struct devfs *)_volume->private_volume; TRACE(("devfs_freecookie: entry vnode %p, cookie %p\n", vnode, cookie)); if (S_ISCHR(vnode->stream.type)) { // pass the call through to the underlying device vnode->stream.u.dev.device->Free(cookie->device_cookie); - - RecursiveLocker _(fs->lock); vnode->stream.u.dev.device->UninitDevice(); - -#if 0 - if (vnode->stream.u.dev.driver != NULL) - vnode->stream.u.dev.driver->devices_used--; -#endif } free(cookie); From mmu_man at mail.berlios.de Fri Nov 7 17:45:30 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 7 Nov 2008 17:45:30 +0100 Subject: [Haiku-commits] r28552 - in haiku/trunk: build/jam data/boot_cd Message-ID: <200811071645.mA7GjUJE023943@sheep.berlios.de> Author: mmu_man Date: 2008-11-07 17:45:29 +0100 (Fri, 07 Nov 2008) New Revision: 28552 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28552&view=rev Added: haiku/trunk/data/boot_cd/hfs.map Modified: haiku/trunk/build/jam/CDBootPPCImage haiku/trunk/build/jam/ImageRules Log: - tried making an HFS CD, doesn't boot either in qemu yet. - add an HFS map file Modified: haiku/trunk/build/jam/CDBootPPCImage =================================================================== --- haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 13:23:24 UTC (rev 28551) +++ haiku/trunk/build/jam/CDBootPPCImage 2008-11-07 16:45:29 UTC (rev 28552) @@ -15,9 +15,15 @@ local extras = ofboot.b README.html ; SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; -BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : boot_loader_openfirmware : $(extras) ; +local hfsmaps = hfs.map ; +SEARCH on $(hfsmaps) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; + + +BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : $(hfsmaps) : boot_loader_openfirmware : $(extras) ; + + NotFile haiku-boot-cd-ppc ; Depends haiku-boot-cd-ppc : $(HAIKU_CD_BOOT_PPC_IMAGE) ; Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-07 13:23:24 UTC (rev 28551) +++ haiku/trunk/build/jam/ImageRules 2008-11-07 16:45:29 UTC (rev 28552) @@ -1068,18 +1068,21 @@ #pragma mark - CD Boot PPC Image rules -rule BuildCDBootPPCImage image : bootloader : extrafiles +rule BuildCDBootPPCImage image : hfsmaps : bootloader : extrafiles { Depends $(image) : $(bootloader) ; Depends $(image) : $(extrafiles) ; + Depends $(image) : $(hfsmaps) ; + MAPS on $(image) = $(hfsmaps) ; BuildCDBootPPCImage1 $(image) : $(bootloader) $(extrafiles) ; } -actions BuildCDBootPPCImage1 +actions BuildCDBootPPCImage1 bind MAPS { $(RM) $(<) - mkisofs -r -U -chrp-boot -V bootimg -o $(<) $(>[1]) $(>[2-]) + #mkisofs -r -U -chrp-boot -V bootimg -o $(<) $(>[1]) $(>[2-]) + mkisofs -r -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless . -o $(<) $(>[1]) $(>[2-]) } Added: haiku/trunk/data/boot_cd/hfs.map =================================================================== --- haiku/trunk/data/boot_cd/hfs.map 2008-11-07 13:23:24 UTC (rev 28551) +++ haiku/trunk/data/boot_cd/hfs.map 2008-11-07 16:45:29 UTC (rev 28552) @@ -0,0 +1,6 @@ +# This mapping is needed to successfully boot and to keep macos +# from treating everything like a text file (ugly!) +# +# EXTN XLate CREATOR TYPE Comment +.b Raw 'UNIX' 'tbxi' "bootstrap" +boot_loader_openfirmware Raw 'UNIX' 'boot' "bootstrap" From mmu_man at mail.berlios.de Fri Nov 7 20:15:55 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 7 Nov 2008 20:15:55 +0100 Subject: [Haiku-commits] r28553 - haiku/trunk/build/jam Message-ID: <200811071915.mA7JFtil030290@sheep.berlios.de> Author: mmu_man Date: 2008-11-07 20:15:55 +0100 (Fri, 07 Nov 2008) New Revision: 28553 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28553&view=rev Modified: haiku/trunk/build/jam/ImageRules Log: Try harder with PReP boot, still no go. Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-07 16:45:29 UTC (rev 28552) +++ haiku/trunk/build/jam/ImageRules 2008-11-07 19:15:55 UTC (rev 28553) @@ -1082,7 +1082,8 @@ { $(RM) $(<) #mkisofs -r -U -chrp-boot -V bootimg -o $(<) $(>[1]) $(>[2-]) - mkisofs -r -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless . -o $(<) $(>[1]) $(>[2-]) + mkisofs -hfs -r -U -chrp-boot -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) + # -hfs -hfs-bless . } From leavengood at gmail.com Fri Nov 7 21:20:09 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Fri, 7 Nov 2008 15:20:09 -0500 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: References: <200811070353.mA73rJqC001947@sheep.berlios.de> Message-ID: On Fri, Nov 7, 2008 at 6:55 AM, J?r?me Duval wrote: > 2008/11/7 leavengood at BerliOS : >> >> +BinCommand jpegtran : >> + jpegtran.c >> + cdjpeg.c >> + rdswitch.c >> + transupp.c >> + : be libjpeg.a >> + ; >> + > > This shouldn't live in src/add-ons but in src/bin I suppose, but that is probably up for debate. This is intimately related to the libjpeg code, and may one day be integrated into the translator, so I don't think it is that bad to put it here. Not all the commands put in the bin directory are in src/bin. If other people agree with J?r?me please speak up and I can probably be convinced to move it. Regards, Ryan From leavengood at mail.berlios.de Fri Nov 7 21:39:18 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Fri, 7 Nov 2008 21:39:18 +0100 Subject: [Haiku-commits] r28554 - haiku/trunk/src/add-ons/translators/jpeg/libjpeg Message-ID: <200811072039.mA7KdI0i005983@sheep.berlios.de> Author: leavengood Date: 2008-11-07 21:39:18 +0100 (Fri, 07 Nov 2008) New Revision: 28554 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28554&view=rev Added: haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cderror.h Log: Adding missing header, thanks for fixing the build Axel. Added: haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cderror.h =================================================================== --- haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cderror.h 2008-11-07 19:15:55 UTC (rev 28553) +++ haiku/trunk/src/add-ons/translators/jpeg/libjpeg/cderror.h 2008-11-07 20:39:18 UTC (rev 28554) @@ -0,0 +1,132 @@ +/* + * cderror.h + * + * Copyright (C) 1994-1997, Thomas G. Lane. + * This file is part of the Independent JPEG Group's software. + * For conditions of distribution and use, see the accompanying README file. + * + * This file defines the error and message codes for the cjpeg/djpeg + * applications. These strings are not needed as part of the JPEG library + * proper. + * Edit this file to add new codes, or to translate the message strings to + * some other language. + */ + +/* + * To define the enum list of message codes, include this file without + * defining macro JMESSAGE. To create a message string table, include it + * again with a suitable JMESSAGE definition (see jerror.c for an example). + */ +#ifndef JMESSAGE +#ifndef CDERROR_H +#define CDERROR_H +/* First time through, define the enum list */ +#define JMAKE_ENUM_LIST +#else +/* Repeated inclusions of this file are no-ops unless JMESSAGE is defined */ +#define JMESSAGE(code,string) +#endif /* CDERROR_H */ +#endif /* JMESSAGE */ + +#ifdef JMAKE_ENUM_LIST + +typedef enum { + +#define JMESSAGE(code,string) code , + +#endif /* JMAKE_ENUM_LIST */ + +JMESSAGE(JMSG_FIRSTADDONCODE=1000, NULL) /* Must be first entry! */ + +#ifdef BMP_SUPPORTED +JMESSAGE(JERR_BMP_BADCMAP, "Unsupported BMP colormap format") +JMESSAGE(JERR_BMP_BADDEPTH, "Only 8- and 24-bit BMP files are supported") +JMESSAGE(JERR_BMP_BADHEADER, "Invalid BMP file: bad header length") +JMESSAGE(JERR_BMP_BADPLANES, "Invalid BMP file: biPlanes not equal to 1") +JMESSAGE(JERR_BMP_COLORSPACE, "BMP output must be grayscale or RGB") +JMESSAGE(JERR_BMP_COMPRESSED, "Sorry, compressed BMPs not yet supported") +JMESSAGE(JERR_BMP_NOT, "Not a BMP file - does not start with BM") +JMESSAGE(JTRC_BMP, "%ux%u 24-bit BMP image") +JMESSAGE(JTRC_BMP_MAPPED, "%ux%u 8-bit colormapped BMP image") +JMESSAGE(JTRC_BMP_OS2, "%ux%u 24-bit OS2 BMP image") +JMESSAGE(JTRC_BMP_OS2_MAPPED, "%ux%u 8-bit colormapped OS2 BMP image") +#endif /* BMP_SUPPORTED */ + +#ifdef GIF_SUPPORTED +JMESSAGE(JERR_GIF_BUG, "GIF output got confused") +JMESSAGE(JERR_GIF_CODESIZE, "Bogus GIF codesize %d") +JMESSAGE(JERR_GIF_COLORSPACE, "GIF output must be grayscale or RGB") +JMESSAGE(JERR_GIF_IMAGENOTFOUND, "Too few images in GIF file") +JMESSAGE(JERR_GIF_NOT, "Not a GIF file") +JMESSAGE(JTRC_GIF, "%ux%ux%d GIF image") +JMESSAGE(JTRC_GIF_BADVERSION, + "Warning: unexpected GIF version number '%c%c%c'") +JMESSAGE(JTRC_GIF_EXTENSION, "Ignoring GIF extension block of type 0x%02x") +JMESSAGE(JTRC_GIF_NONSQUARE, "Caution: nonsquare pixels in input") +JMESSAGE(JWRN_GIF_BADDATA, "Corrupt data in GIF file") +JMESSAGE(JWRN_GIF_CHAR, "Bogus char 0x%02x in GIF file, ignoring") +JMESSAGE(JWRN_GIF_ENDCODE, "Premature end of GIF image") +JMESSAGE(JWRN_GIF_NOMOREDATA, "Ran out of GIF bits") +#endif /* GIF_SUPPORTED */ + +#ifdef PPM_SUPPORTED +JMESSAGE(JERR_PPM_COLORSPACE, "PPM output must be grayscale or RGB") +JMESSAGE(JERR_PPM_NONNUMERIC, "Nonnumeric data in PPM file") +JMESSAGE(JERR_PPM_NOT, "Not a PPM/PGM file") +JMESSAGE(JTRC_PGM, "%ux%u PGM image") +JMESSAGE(JTRC_PGM_TEXT, "%ux%u text PGM image") +JMESSAGE(JTRC_PPM, "%ux%u PPM image") +JMESSAGE(JTRC_PPM_TEXT, "%ux%u text PPM image") +#endif /* PPM_SUPPORTED */ + +#ifdef RLE_SUPPORTED +JMESSAGE(JERR_RLE_BADERROR, "Bogus error code from RLE library") +JMESSAGE(JERR_RLE_COLORSPACE, "RLE output must be grayscale or RGB") +JMESSAGE(JERR_RLE_DIMENSIONS, "Image dimensions (%ux%u) too large for RLE") +JMESSAGE(JERR_RLE_EMPTY, "Empty RLE file") +JMESSAGE(JERR_RLE_EOF, "Premature EOF in RLE header") +JMESSAGE(JERR_RLE_MEM, "Insufficient memory for RLE header") +JMESSAGE(JERR_RLE_NOT, "Not an RLE file") +JMESSAGE(JERR_RLE_TOOMANYCHANNELS, "Cannot handle %d output channels for RLE") +JMESSAGE(JERR_RLE_UNSUPPORTED, "Cannot handle this RLE setup") +JMESSAGE(JTRC_RLE, "%ux%u full-color RLE file") +JMESSAGE(JTRC_RLE_FULLMAP, "%ux%u full-color RLE file with map of length %d") +JMESSAGE(JTRC_RLE_GRAY, "%ux%u grayscale RLE file") +JMESSAGE(JTRC_RLE_MAPGRAY, "%ux%u grayscale RLE file with map of length %d") +JMESSAGE(JTRC_RLE_MAPPED, "%ux%u colormapped RLE file with map of length %d") +#endif /* RLE_SUPPORTED */ + +#ifdef TARGA_SUPPORTED +JMESSAGE(JERR_TGA_BADCMAP, "Unsupported Targa colormap format") +JMESSAGE(JERR_TGA_BADPARMS, "Invalid or unsupported Targa file") +JMESSAGE(JERR_TGA_COLORSPACE, "Targa output must be grayscale or RGB") +JMESSAGE(JTRC_TGA, "%ux%u RGB Targa image") +JMESSAGE(JTRC_TGA_GRAY, "%ux%u grayscale Targa image") +JMESSAGE(JTRC_TGA_MAPPED, "%ux%u colormapped Targa image") +#else +JMESSAGE(JERR_TGA_NOTCOMP, "Targa support was not compiled") +#endif /* TARGA_SUPPORTED */ + +JMESSAGE(JERR_BAD_CMAP_FILE, + "Color map file is invalid or of unsupported format") +JMESSAGE(JERR_TOO_MANY_COLORS, + "Output file format cannot handle %d colormap entries") +JMESSAGE(JERR_UNGETC_FAILED, "ungetc failed") +#ifdef TARGA_SUPPORTED +JMESSAGE(JERR_UNKNOWN_FORMAT, + "Unrecognized input file format --- perhaps you need -targa") +#else +JMESSAGE(JERR_UNKNOWN_FORMAT, "Unrecognized input file format") +#endif +JMESSAGE(JERR_UNSUPPORTED_FORMAT, "Unsupported output file format") + +#ifdef JMAKE_ENUM_LIST + + JMSG_LASTADDONCODE +} ADDON_MESSAGE_CODE; + +#undef JMAKE_ENUM_LIST +#endif /* JMAKE_ENUM_LIST */ + +/* Zap JMESSAGE macro so that future re-inclusions do nothing by default */ +#undef JMESSAGE From leavengood at gmail.com Fri Nov 7 21:40:29 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Fri, 7 Nov 2008 15:40:29 -0500 Subject: [Haiku-commits] r28547 - haiku/trunk/build/jam In-Reply-To: <200811070925.mA79PgFu022973@sheep.berlios.de> References: <200811070925.mA79PgFu022973@sheep.berlios.de> Message-ID: On Fri, Nov 7, 2008 at 4:25 AM, axeld at BerliOS wrote: > Log: > * Removed jpegtran from the image - this fixes the build (missing header). > * While I was at it, I also removed the extra screen savers until Ryan fixed > the issue (bug #2339). Thanks. I added the needed header now. I will add jpegtran back to the image when I make the future changes to ShowImage. Same with the screen savers. Regards, Ryan From leavengood at gmail.com Fri Nov 7 22:09:15 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Fri, 7 Nov 2008 16:09:15 -0500 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: <6886109405-BeMail@zon> References: <20081107104015.931.1@stippis2.1226050004.fake> <6886109405-BeMail@zon> Message-ID: On Fri, Nov 7, 2008 at 5:17 AM, Axel D?rfler wrote: > > True enough, but I would always vote for the faster method, and > changing the EXIF rotation is instantaneously. We could add lossless > JPEG rotation, and we could even make it the default if you insist on > it, but I wouldn't like this to be the only option. I think it might be possible to rotate the JPEG inside ShowImage in memory (lossy, like it is done now) and then use a thread to actually modify the file in the background with jpegtran (if that option is set.) That is what I am thinking of doing. This will allow someone to navigate away from an image even while it is being rotated in the background. The only "locking" operation which might slow loading would be when the new rotated image (which would have a new filename) is copied in to replace the original file. But that is just a file rename so it should be pretty quick. My only concern is how to add this special JPEG support to ShowImage cleanly. Regards, Ryan From stippi at mail.berlios.de Fri Nov 7 22:17:16 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Fri, 7 Nov 2008 22:17:16 +0100 Subject: [Haiku-commits] r28555 - in haiku/trunk/docs/userguide: . prefs-images Message-ID: <200811072117.mA7LHG8r009002@sheep.berlios.de> Author: stippi Date: 2008-11-07 22:16:24 +0100 (Fri, 07 Nov 2008) New Revision: 28555 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28555&view=rev Added: haiku/trunk/docs/userguide/prefs-appearance.html haiku/trunk/docs/userguide/prefs-backgrounds.html haiku/trunk/docs/userguide/prefs-datatranslations.html haiku/trunk/docs/userguide/prefs-e-mail.html haiku/trunk/docs/userguide/prefs-filetypes.html haiku/trunk/docs/userguide/prefs-fonts.html haiku/trunk/docs/userguide/prefs-images/ haiku/trunk/docs/userguide/prefs-images/appearance-antialiasing.png haiku/trunk/docs/userguide/prefs-images/appearance-colors.png haiku/trunk/docs/userguide/prefs-images/appearance-glyph-off.png haiku/trunk/docs/userguide/prefs-images/appearance-glyph-on.png haiku/trunk/docs/userguide/prefs-images/appearance-subpixel.png haiku/trunk/docs/userguide/prefs-images/backgrounds.png haiku/trunk/docs/userguide/prefs-images/datatranslations.png haiku/trunk/docs/userguide/prefs-images/e-mail-filter-header.png haiku/trunk/docs/userguide/prefs-images/e-mail-filter-spam.png haiku/trunk/docs/userguide/prefs-images/e-mail-in.png haiku/trunk/docs/userguide/prefs-images/e-mail-mailbox.png haiku/trunk/docs/userguide/prefs-images/e-mail-out.png haiku/trunk/docs/userguide/prefs-images/e-mail-settings.png haiku/trunk/docs/userguide/prefs-images/fonts.png haiku/trunk/docs/userguide/prefs-images/keyboard.png haiku/trunk/docs/userguide/prefs-images/keymap.png haiku/trunk/docs/userguide/prefs-images/menu.png haiku/trunk/docs/userguide/prefs-images/mouse.png haiku/trunk/docs/userguide/prefs-images/network.png haiku/trunk/docs/userguide/prefs-images/screen.png haiku/trunk/docs/userguide/prefs-images/screensaver-fade.png haiku/trunk/docs/userguide/prefs-images/screensaver-modules.png haiku/trunk/docs/userguide/prefs-images/sounds.png haiku/trunk/docs/userguide/prefs-images/time-time.png haiku/trunk/docs/userguide/prefs-images/time-timezone.png haiku/trunk/docs/userguide/prefs-images/virtualmemory.png haiku/trunk/docs/userguide/prefs-keyboard.html haiku/trunk/docs/userguide/prefs-keymap.html haiku/trunk/docs/userguide/prefs-menu.html haiku/trunk/docs/userguide/prefs-mouse.html haiku/trunk/docs/userguide/prefs-network.html haiku/trunk/docs/userguide/prefs-screen.html haiku/trunk/docs/userguide/prefs-screensaver.html haiku/trunk/docs/userguide/prefs-sounds.html haiku/trunk/docs/userguide/prefs-time.html haiku/trunk/docs/userguide/prefs-virtualmemory.html Modified: haiku/trunk/docs/userguide/applications.html haiku/trunk/docs/userguide/contents.html haiku/trunk/docs/userguide/demos.html haiku/trunk/docs/userguide/deskbar.html haiku/trunk/docs/userguide/desktop-applets.html haiku/trunk/docs/userguide/filetypes.html haiku/trunk/docs/userguide/keyboard-shortcuts.html haiku/trunk/docs/userguide/preferences.html haiku/trunk/docs/userguide/queries.html haiku/trunk/docs/userguide/tracker-add-ons.html haiku/trunk/docs/userguide/workshop-filetypes+attributes.html haiku/trunk/docs/userguide/workspaces.html Log: Patch by Humdinger: * Added docs and screenshots for preference panels: Appearance, Backgrounds, DataTranslations, E-mail, Filetypes, Fonts, Keyboard, Keymap, Menu, Mouse, Network, Screen, Screensaver, Sounds, Time, VirtualMemory Adapted some contents for E-mail preferences from src/documentation/haiku_user_guide/HaikuUserGuide.txt As I haven't succeeded to get email running in vmware, I'd appreciate if someone can proof read what's written in E-mail preferences. * Added preferences to the user guide contents. * Various formatting details and inter-documents-links Wow! Thanks a lot! Modified: haiku/trunk/docs/userguide/applications.html =================================================================== --- haiku/trunk/docs/userguide/applications.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/applications.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -49,55 +49,65 @@

Haiku's applications

-

Haiku comes with a set of mostly small but essential applications: -

- +

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

ActivityMonitor
+ - + - + - + - + - + - + - + - + + + - + - + + + - + - + - + - + + + - + - + - + + + - + - + - + + + - + - + - +
ActivityMonitor  A tool to track system resources like CPU and memory usage.
BePDF
BePDF  A PDF viewer
CDPlayer
CDPlayer  A player for audio CDs.
CodyCam
CodyCam  A tool to regularly upload images from a webcam to a server.
DeskCalc
DeskCalc  A calculator.
DiskProbe
DiskProbe  A HEX editor for files and volumes.
DiskUsage
DiskUsage  A tool to visualize a disk's memory usage.
DriveSetup
DriveSetup  A harddisk partitioning tool.
Firefox
Expander A tool to unpack common archives.
Firefox  Mozilla's famous browser.
Icon-O-Matic
Icon-O-Matic  An app to create Haiku's vector icons.
Magnify
Installer The tool to install Haiku to a partition.
Magnify  A magnified view of the area around your mouse pointer.
Mail
Mail  An email client.
MediaPlayer
MediaPlayer  A player for all supported audio/video files.
MidiPlayer
MidiPlayer  A player for MIDI files.
pe
PackageInstaller Installer for BeOS packages in PKG format.
Pe  A texteditor with syntax coloring and much more.
People
People  A contact manager.
Screenshot
Screenshot  A tool to take screenshots.
SoundRecorder
ShowImage A simple image viewer.
SoundRecorder  A tool to record audio from line-in or a microphone.
StyledEdit
StyledEdit  A text editor.
Terminal
Terminal  Access to the bash.
TV
TextSearch A search tool for text files.
TV  A viewer for analog TV.
Vision
Vision  An IRC client.
VLC
VLC  The VideoLAN movie player.
WonderBrush
WonderBrush  Yellowbite's vector graphics programm.

Modified: haiku/trunk/docs/userguide/contents.html =================================================================== --- haiku/trunk/docs/userguide/contents.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/contents.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -93,12 +93,12 @@
  • Haiku's applications
  • Learn how to un/install applications in general and how work with the ones that come with Haiku. - Preferences Configuring and setting up your system. - + Modified: haiku/trunk/docs/userguide/demos.html =================================================================== --- haiku/trunk/docs/userguide/demos.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/demos.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -22,32 +22,32 @@

    There are some nice little games and demo applications for your entertainment. Most of the demos are targeted to developers who are interested in learning from the code, which is of course open source as is everything Haiku. -

    - +

    BSnow
    + - + - + - + - + - + - + - + - + - + - + - + - +
    BSnow  Let it snow.
    Chart
    Chart  Moving through stars and galaxies.
    Clock
    Clock  An analog clock.
    Cortex
    Cortex  See the media_server in action.
    FontDemo
    FontDemo  A slideshow through all your fonts.
    GLDirectMode
    GLDirectMode  A demonstration of OpenGL.
    GLTeapot
    GLTeapot  The rotating OpenGL rendered teapot.
    Gradients
    Gradients  A demonstration of the gradient API .
    Mandelbrot
    Mandelbrot  Computing fractals.
    Pairs
    Pairs  A game to find pairs of matching icons.
    Playground
    Playground  Test the drawing API .
    Pulse
    Pulse  See your CPU's workload.
    Sudoku
    Sudoku  This century's "Solitair".

    Modified: haiku/trunk/docs/userguide/deskbar.html =================================================================== --- haiku/trunk/docs/userguide/deskbar.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/deskbar.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -65,13 +65,13 @@ configure.png

    In this panel you set how many recent documents, folders and applications are shown in the Deskbar, or if you show them at all.

    Here, you also configure folders and their contents, which are by default Applications, Demos, Deskbar Applets, and Preferences. You can add your own entries and edit or remove items.
    -This part of the panel is just a representation of the folder /boot/home/config/be. You can just as well link or copy files and folders directly in Tracker to configure your Deskbar.
    +This part of the panel is just a representation of the folder /boot/home/config/be/. You can just as well link or copy files and folders directly in Tracker to configure your Deskbar.
    Another method is to simply drag a file or folder and drop it where you want it into the Deskbar.

    The Tray

    calendar.png -

    Among other things, the tray's housing the clock. Left-click it to toggle between date and time. Right-click it to hide/show it or launch the Time preferences to set it. +

    Among other things, the tray's housing the clock. Left-click it to toggle between date and time. Right-click it to hide/show it or launch the Time preferences to set it. Here you can also launch a calendar that also appears, when you hold down the left mouse button on the clock for a little time.

    Any program can install an icon in the tray to provide an interface to the user. The email system, for instance, shows a different symbol when there's unread mail and offers a context menu to e.g. create or check for new mail. ProcessController is another example that uses its icon in the tray to provide information (CPU/memory usage) and to offer a context menu.

    Modified: haiku/trunk/docs/userguide/desktop-applets.html =================================================================== --- haiku/trunk/docs/userguide/desktop-applets.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/desktop-applets.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -24,14 +24,14 @@

    Haiku provides a few useful tools that can be installed on the Desktop or the Deskbar via its Replicant. -

    - +

    LaunchBox
    + - + - + - +
    LaunchBox  Shortcuts to your favorite applications.
    NetworkStatus
    NetworkStatus  Is your connection up?.
    ProcessController
    ProcessController  See and control every running app and service.
    Workspaces
    Workspaces  A miniature version of all workspaces.

    Modified: haiku/trunk/docs/userguide/filetypes.html =================================================================== --- haiku/trunk/docs/userguide/filetypes.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/filetypes.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -45,7 +45,7 @@

    Global settings with the Filetypes Preferences

    The Filetypes preferences don't deal with individual files but with global settings of filetypes. You can change default icons and preferred applications or add, remove, or alter attributes of whole filetypes. You can even create your own filetype from scratch.

    -

    All filetypes and their configurations are stored in /boot/home/config/settings/beos_mime. Before you start experimenting, it may be prudent to make a backup of that folder...

    +

    All filetypes and their configurations are stored in /boot/home/config/settings/beos_mime/. Before you start experimenting, it may be prudent to make a backup of that folder...

    To learn more about the Filetypes preferences see the workshop: Filetypes, Attributes, Index and Queries.

    Special settings for applications

    Modified: haiku/trunk/docs/userguide/keyboard-shortcuts.html =================================================================== --- haiku/trunk/docs/userguide/keyboard-shortcuts.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/keyboard-shortcuts.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -22,42 +22,42 @@
    -

    By default, Haiku's option key, to invoke commands from menus for example, is not the usual CTRL key, but ALT instead. This has historical reasons, because the BeOS was inspired somewhat by MacOS. After you get used to it, it actually feels better as e.g. ALT+C and ALT+V is reached more conveniently on the keyboard and these commands seemlessly integrate into the bash shell of the Terminal. -

    In any case, you can switch to the maybe more familiar CTRL key in the Menu preferences. The user guide will always describes the default configuration with the option key being ALT. +

    By default, Haiku's option key, to invoke commands from menus for example, is not the usual CTRL key, but ALT instead. This has historical reasons, because the BeOS was inspired somewhat by MacOS. After you get used to it, it actually feels better as e.g. ALT+C and ALT+V is reached more conveniently on the keyboard and these commands seamlessly integrate into the bash shell of the Terminal, where CTRL+C quits the running process. +

    In any case, you can switch to the maybe more familiar CTRL key in the Menu preferences. The user guide will always describes the default configuration with option key being ALT.

    General shortcuts

    -

    Here's a table of many of the most commonly used shortcuts that are always awailable, even if there isn't a corresponding menu: +

    Here's a table of many of the most commonly used shortcuts that are always available, even if there isn't a corresponding menu:

    - - - - - - - - - + + + + + + + + +
    ALT+Fx Switch to Workspace X (Fx is the function key corresponding to that workspace).
    CTRL+TAB Hold it to brings up the Twitcher.
    CTRL+ALT+DEL Open the Team Monitor.
    ALT+ESC Enter the menu bar (leave with ESC).
    ALT+C Copy selection to clipboard.
    ALT+X Cut selection to clipboard.
    ALT+V Paste the clipboard's contents.
    ALT+W Close the current window.
    ALT+Q Close the whole application.
    ALT+FxSwitches to Workspace X (Fx is the function key corresponding to that workspace).
    CTRL+TABHold down to bring up the Twitcher.
    CTRL+ALT+DELOpens the Team Monitor.
    ALT+ESCEnters the menu bar (leave with ESC).
    ALT+CCopies selection to clipboard.
    ALT+XCuts selection to clipboard.
    ALT+VPastes the clipboard's contents.
    ALT+WCloses the current window.
    ALT+QCloses the whole application.

    Shortcuts for Tracker navigation

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

    - - - - - - + + + + + +
    ALT+CURSOR-UP Open parent folder.
    ALT+CURSOR-DOWN or RETURN Open selected folder.
    WIN-KEY Holding it while opening a folder will automatically close the parent folder. This also works when navigating with the mouse.
    right MENU-KEY Open the Deskbar menu (leave with ESC)
    ALT+Z Undo the last action. The undo history is only limited by the available memory. Note, that this only works for actions on the file itself, changed attributes and permission settings can't be undone. Also, once a file is removed from Trash it's gone for good.
    ALT+SHIFT+Z Redo the action you just reverted with ALT+Z
    ALT+CURSOR-UPOpens the parent folder.
    ALT+CURSOR-DOWN or RETURNOpens the selected folder.
    WIN-KEYHolding it while opening a folder will automatically close the parent folder. This also works when navigating with the mouse.
    right MENU-KEYOpens the Deskbar menu (leave with ESC)
    ALT+ZUndo last action. The undo history is only limited by the available memory. Note, that this only works for actions on the file itself, changed attributes and permission settings can't be undone. Also, once a file is removed from Trash it's gone for good.
    ALT+SHIFT+ZRedo the action you just reverted with ALT+Z

    Other key combinations

    You can add or remove items to/from a selection by holding down a modifier key while clicking on a entry (or file in case of Tracker).

    - - + +
    SHIFT This will select everything between the first selected item and the one you click on.
    ALT Adds or removes the item you're clicking on from the selection.
    SHIFTThis will select everything between the first selected item and the one you click on.
    ALTAdds or removes the item you're clicking on from the selection.

    In a Tracker window, if you just start typing, Tracker scrolls to and selects the file that best fits your incremental search. If there's no file starting with your typed letters, files that contain the search string anywhere in their name or other displayed attributes are selected. This search is not case-sensitive.
    The letters you type appear at the bottom-left, where normally the number of items are listed. After a second it reverts back and you could start a new incremental search. Modified: haiku/trunk/docs/userguide/preferences.html =================================================================== --- haiku/trunk/docs/userguide/preferences.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/preferences.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -15,66 +15,77 @@

    Contents     - Previous: Desktop Applets -     + Previous: Workshop +

    -

    While a key philosophy of Haiku is to cut down on options and have sensible defaults instead, there are some things that have to be configured or can be set to individual preference. -

    - +

    While a key philosophy of Haiku is to cut down on options and have sensible defaults instead, there are some things that have to be configured or can be set to individual preference. You find all panels in Deskbar's Preferences menu. +

    Appearance
    + - + - + - + - + - + - + - + - + + + + + - + - + - + + + + + - + - + - + - +
    Appearance  Configure certain aspects of the graphical interface.
    Backgrounds
    Backgrounds  Set a color or image as background of the Desktop or any other folder.
    DataTranslations
    DataTranslations  Settings for all supported file formats.
    E-mail
    E-mail  Configure your email accounts.
    FileTypes
    FileTypes  Add, remove and configure filetypes.
    Fonts
    Fonts  Set your system fonts.
    Keyboard
    Keyboard  Configure repeat delay and rate.
    Keymap
    Keymap  Set the mapping of your keyboard.
    Media
    Media Audio and video settings like volume and in/output devices.
    Menu  Configure the behaviour of menus and the command key (CTRL/ALT.
    Mouse
    Mouse  Configure your mouse.
    Network
    Network  Configure your network.
    Printers
    Printers Add, remove and configure printers.
    Screen  Configure resolution, depth and refresh rate.
    ScreenSaver
    ScreenSaver  Add, remove and configure a screen saver.
    Sounds
    Sounds  Assign a sound to different system events.
    Time
    Time  Set time, date and timezone.
    VirtualMemory
    VirtualMemory  Set the amount of swap space.

    - + Added: haiku/trunk/docs/userguide/prefs-appearance.html =================================================================== --- haiku/trunk/docs/userguide/prefs-appearance.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/prefs-appearance.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -0,0 +1,68 @@ + + + + + Appearance + + + + + +
    +

    + Preferences +     + Next: Backgrounds +

    +
    + +
    + +

    The Appearance preferences lets you change some aspects of Haiku's visuals. +

    + +

    Colors

    +appearance-colors.png +
    +

    In the first tab, Colors, you can change the colors of different parts of the user interface. The color well accepts drag&drops from other programs, letting you drag colors over from e.g. WonderBrush, Icon-O-Matic or the Backgrounds panel. +

    + +

    Antialiasing

    +appearance-antialiasing.png +
    +

    The second tab, Antialiasing, provides different settings for how things are rendered on screen.
    +An activated Glyph hinting aligns all letters in such a way that their vertical and horizontal edges rest exactly between two pixels. The result is a perfect contrast, especially when dealing with black on white. Text appears crisper. +

    See the difference of the two settings with these magnified screenshots: +

    +appearance-glyph-off.png appearance-glyph-on.png +
    +

    Another technique to improve rendering is Antialiasing, which supports all vector graphics as well as text. It smoothes lines by changing the color of certain pixels. There are two methods for that:

    +

    Greyscale changes the intensity of pixels at the edge.
    +LCD subpixel does an even better job, especially with (high resolution) LCD monitors. Instead of the intensity of a pixel, it changes its color which moves an edge by a fraction of a pixel, because LCD displays produce every pixel with a red, green and blue component. +

    Again, the two different methods with magnified screenshots: +

    +appearance-glyph-off.png appearance-subpixel.png +
    +

    Subpixel based antialiasing adds a slight colored shine to objects. Something not everyone tolerates. In Haiku you can mix the two antialiasing methods and find the right setting for you by using a slider. +

    Note: The subpixel based antialiasing in combination with the glyph hinting is subject of a software patent and is therefore not available by default. Depending on where in the world you live, you may get an unlocked version. Sorry about that. Talk with your representative. +


    +

    + + +
    Defaults resets everything to default values.
    Revert brings back the settings that were active when you started the Appearance preferences.
    +

    +
    + +
    +

    + Preferences +     + Next: Backgrounds +

    +
    + + + Added: haiku/trunk/docs/userguide/prefs-backgrounds.html =================================================================== --- haiku/trunk/docs/userguide/prefs-backgrounds.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/prefs-backgrounds.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -0,0 +1,61 @@ + + + + + Backgrounds + + + + + +
    +

    + Preferences +     + Previous: Appearance +     + Next: DataTranslations +

    +
    + +
    + +

    You can set a color or an image as background for every folder and the Desktop for every workspace. +

    +backgrounds.png +

    +

    The top drop-down menu specifies if your changes are applied to the current workspace, all workspaces, a specific folder or as default for every new folder. +

    Below that you can assign an image or select None if you want simply a colored background. +

    If you are using an image, you have to decide on the placement: +

    + + + + +
    Manual lets you specify the coordinates. You can drag the picture around in the preview to the left or enter X and Y manually.
    Center centers the picture in the middle of the screen.
    Scale to fit enlarges the picture with no regard to its aspect ratio until it fills the screen.
    Tile fills the screen by repeating the picture.
    +

    If you are using an image you can activate Icon label outline which will put an thin contour around an icon's label. +

    If an icon label's actual text is black or white depends on setting of the color picker. A dark color sets the text to white, a light color to black. So, if you assign a very bright image to the background, you should also set the color picker to a bright color in order to have icon labels readable in black. (Or use the outline option above.)
    +The selected color is also reflected in the Workspaces applet, which ignores images as backgrounds. +

    + + +
    Revert brings back the settings that were active when you started the Backgrounds preferences.
    Apply sets your changes.
    +

    + +
    + +
    +

    + Preferences +     + Previous: Appearance +     + Next: DataTranslations +

    +
    + + + Added: haiku/trunk/docs/userguide/prefs-datatranslations.html =================================================================== --- haiku/trunk/docs/userguide/prefs-datatranslations.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/prefs-datatranslations.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -0,0 +1,70 @@ + + + + + DataTranslations + + + + + +
    +

    + Preferences +     + Previous: Backgrounds +     + Next: E-mail +

    +
    + +
    + +

    Every application has the ability to open and save every file format for which there's a Translator installed. The settings for these Translators are configured in the DataTranslations preferences. +

    +datatranslations.png +

    +

    Depending on its capabilities, each Translator offers different settings. At least you'll get an Info... button that opens a window with the credits and the installation path.
    +The following table gives an overview of the default Translators and their most useful options. +

    + + + + + + + + + + + + + + + +
    BMP Images24bit, uncompressed, no transparency
    EXR ImagesILM's high dynamic-range (HDR) format
    GIF Images8bit, lossless compression, transparency
    +You can reduce the filesize by limiting the number of used colors and the palette.
    +You can write images with transparency, either by automatically using the alpha channel or by setting the RGB value that will be transparent by hand.
    JPEG2000 Images24bit, compressed, no transparency
    +Here, you normally only care about the output quality.
    JPEG Images24bit, compressed, no transparency
    +Besides the output quality you can also set a smoothing that will lessen compression artefacts but can blur the picture a little.
    PCX Images24bit, uncompressed, no transparency, PC Paintbrush Exchange format
    PNG Images32bit, lossless compression, transparency
    PPM Images24bit, uncompressed, no transparency, Portable PixMap format
    RAW Imagesup to 48bit, uncompressed, no transparency
    RTF Text FilesFormatted text
    SGI Images24bit, optional lossless compression, transparency
    StyledEdit FilesFormatted text
    TGA Images32bit, optional lossless compression, transparency
    TIFF Images24bit, optional lossless compression, layers, transparency
    WonderBrush Images32bit, layers, transparency, vector/pixel data
    +


    +

    Note: Screenshots, charts, black&white drawings and other images with few used colors, as well as small pictures are best saved as GIF (up to 256 colors) or PNG (millions of colors). JPEG, for example, introduces compression artefacts without gain in smaller filesize. +

    + +
    + +
    +

    + Preferences +     + Previous: Backgrounds +     + Next: E-mail +

    +
    + + + Added: haiku/trunk/docs/userguide/prefs-e-mail.html =================================================================== --- haiku/trunk/docs/userguide/prefs-e-mail.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/prefs-e-mail.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -0,0 +1,143 @@ + + + + + E-mail + + + + + +
    +

    + Preferences +     + Previous: DataTranslations +     + Next: FileTypes +

    +
    + +
    + +

    Haiku provides a system that retrieves e-mail regularly via a mail_daemon and saves each mail as a single text file. It parses the mail and fills its attributes with all necessary header information, like from, to, subject and its unread status. Now it can be queried by you or any application. This system also makes switching e-mail clients easy as all the data and your configuration stays the same.
    +The configuration is done in the E-Mail preference panel. +

    + +

    Creating a new e-mail account

    +

    Let's go through the process of setting up an e-mail account.
    +You start by clicking the Add button to create a new, unnamed account. Then you declare the Account Type which is either Receive Mail Only, Send Mail Only, or the most usual type, Send and Receive Mail. +

    Now you enter an Account Name, your Real Name and the Return Address where replies will be sent to. +

    + +

    Setting up incoming e-mail

    +

    Click on Incoming under your account's name to set up how e-mails are received. +

    +

    e-mail-in.png +

    +

    From the drop-down menu you choose the protocol used by your provider. IMAP and POP3 are supported. +

    Next is the Mail Server address for incoming mails. If your provider needs you to log into a specific port, you add that to the address, separated by a colon. For example, pop.your-provider.org:1400. +

    Then you enter your login information, Username and Password, and if necessary change the Login Type from the default Plain Text to APOP for authentication. +

    If you retrieve mails of this account from different computers, you may want to activate the option to Leave mail on server and only Remove mail from server when deleted locally. +

    The New Mail Notification offers different methods to announce the arrival of new mail. Try different settings to see what works best for you. +

    You can change the Location of your inbox (default: /boot/home/mail/in/), which is useful if you'd like to separate the mails from different accounts into their own folders. However, queries let you sort things out just as well. +

    Last on this page, you can opt to only Partially download messages that are larger than a certain size. This will only get the header and you can decide if you want to download the rest of the message plus possible attachments after seeing the subject and who sent it. Useful if you have a slow connection. +

    + +

    Setting up outgoing e-mail

    +

    Click on Outgoing under your account's name to set up how e-mails are sent. +

    +

    e-mail-out.png +

    +

    As with incoming mail, you can also change the Location of your outbox (default: /boot/home/mail/out/). +

    Next is the SMTP Server address for outgoing mails. As with the incoming server before, you can use a specific port if needed, e.g. mail.your-provider.org:1200. +

    If you need to login, you change the Login Type to ESMTP and enter username and password above. The other type is used for providers that need you to check for mail with POP3 before SMTP for identification. + +

    Setting up e-mail filters

    +

    If you want to filter your incoming email, you click on E-Mail Filters under your account's name to set up automatic sorting. You can add any number of filters that are applied one after the other. You can rearrange them by drag&dropping them to their new position.
    +Besides the R5 Daemon Filter that's used for backward compatibility, there are two other Incoming Mail Filters you can add. +

    + +

    Spam Filter

    +

    e-mail-filter-spam.png +

    +

    The spam filter uses statistical methods to classify a mail as unwanted spam. It assigns a value between 0 and 1 to it and you can decide what are the limits for a genuine mail and what will be considered spam.
    +You can have that spam rating added to the start of the subject.
    +Also, the spam filter can learn from all incoming e-mail. Of course, you'll have to teach it by sorting out the false positives, mails that were mistakenly marked as spam. You'll find more on that when we discuss the application Mail. +

    Together with the following Match Header filter, you're able to automatically sort out detected spam mails. + +

    Match Header

    +

    e-mail-filter-header.png +

    +

    This filter compares a header to a search pattern and performs some action when it matches.
    +With the first text field you specify which header to check against. These are available: +

    + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Name the name of the sender
    From the e-mail address of the sender
    To your e-mail address (different for each e-mail account)
    Reply To the e-mail address replies are sent to
    When the date and time the mail was received
    Subject the subject line
    Cc addresses of anyone receiving a carbon copy (Cc)
    Account the name of the e-mail's account
    Status The current status of the e-mail. Normally, this can be "Read", "Replied", "Sent", "Forwarded", "New", or anything you have designated yourself. However, unless you change it yourself in a filter, it will always be "New" when the mail_daemon fetched the mail.
    Priority is set by the sender's e-mail program (e.g. "urgent")
    Thread essentially the same as "Subject", but without things like Re: or Fwd:
    Classification Group depending on what the spam filter classified it as, this will either be empty (if uncertain) or contain the word "Genuine" or "Spam"
    Spam/Genuine Estimate this is a numerical estimate that the spam filter assigned to the e-mail. They are shown in scientific notation, where 1.065e-12 translates to 1.065 divided by 10 to the 12th power, which in this case translates to 0.000000000001065.
    +

    +

    The second text field holds your search pattern. It accepts regular expressions which gives it great flexibility, while unfortunately complicating things a bit. Read up on it a bit, it's well worth it and simple search patterns aren't that complicated at all. +

    With the drop-down menu below it, you assign an action when the pattern matches. You can move or delete a mail, set the status to "Read" or anything else or set the e-mail account you'll reply with. +

    +

    Outgoing Mail Filters

    +

    At this moment, there's only one filter that deals with outgoing mail: Fortune. +
    It will attach a randomly chosen funny or wise "fortune cookie" to the end of every mail before it's sent out. You can do a dry run by issuing the command fortune in a Terminal. +

    + +

    Setting up the mail_daemon

    +

    Now that your incoming and outgoing mail servers (and maybe some filters, too), are configured, you have to tell the mail_server that does all the actual mail checking and fetching how to do its job. +

    +

    e-mail-settings.png +

    +

    Under Mail Checking you configure the interval at which the account's mail server is probed for new mail.
    +If you're on a dial-up connection, you may want to do that Only When Dial-Up is Connected and also Schedule Outgoing Mail When Dial-Up is Disconnected to avoid dialing automatically in regularly only to check for mail. +

    The mail_daemon has a status window which you can set to show up Never, While Sending, While Sending and Receiving or Always. +

    Make sure to Start Mail Services on Startup or there will be no mail_daemon running to do your bidding... +

    +

    e-mail-mailbox.png +

    +

    Edit Mailbox Menu... will open the folder /boot/home/config/Mail/Menu Links/. All folders or queries (!) or their links put into this folder will appear in the context menu of the mailbox icon of the Mail Services in the Deskbar tray. +

    From that menu, you can also Create New Message...s, Check For Mail Now or Edit Preferences.... +

    The mailbox icon itself shows if there are unread messages (status "New") when there are envelopes inside. +

    +
    + +
    +

    + Preferences +     + Previous: DataTranslations +     + Next: FileTypes +

    +
    + + + Added: haiku/trunk/docs/userguide/prefs-filetypes.html =================================================================== --- haiku/trunk/docs/userguide/prefs-filetypes.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/prefs-filetypes.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -0,0 +1,43 @@ + + + + + FileTypes + + + + + +
    +

    + Preferences +     + Previous: E-mail +     + Next: Fonts +

    +
    + +
    + +

    Please refer to topic Filetypes and the workshop Filetypes, Attributes, Index and Queries that explains most of this preference panel. +

    + +
    + + + + Added: haiku/trunk/docs/userguide/prefs-fonts.html =================================================================== --- haiku/trunk/docs/userguide/prefs-fonts.html 2008-11-07 20:39:18 UTC (rev 28554) +++ haiku/trunk/docs/userguide/prefs-fonts.html 2008-11-07 21:16:24 UTC (rev 28555) @@ -0,0 +1,53 @@ + + + + + Fonts + + + + + +
    +

    + Preferences +     + Previous: FileTypes +     + Next: Keyboard +

    +
    + +
    + +

    +fonts.png +

    +

    Haiku defines three standard fonts for different purposes. You set plain, bold and fixed font types and sizes that will be used throughout the system. +

    + + +
    Defaults resets everything to default values.
    Revert brings back the settings that were active when you started the Fonts preferences.
    + +

    Installing new fonts

    +

    You install new fonts by copying them into their respective user folder, i.e. /boot/common/fonts/ or /boot/home/config/fonts/ (see topic Filesystem layout). +

    +
    + + + + + Added: haiku/trunk/docs/userguide/prefs-images/appearance-antialiasing.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/appearance-antialiasing.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/appearance-colors.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/appearance-colors.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/appearance-glyph-off.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/appearance-glyph-off.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/appearance-glyph-on.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/appearance-glyph-on.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/appearance-subpixel.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/appearance-subpixel.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/backgrounds.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/backgrounds.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/datatranslations.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/datatranslations.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/e-mail-filter-header.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/e-mail-filter-header.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/e-mail-filter-spam.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/e-mail-filter-spam.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/e-mail-in.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/e-mail-in.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/e-mail-mailbox.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/e-mail-mailbox.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: haiku/trunk/docs/userguide/prefs-images/e-mail-out.png =================================================================== (Binary files differ) Property changes on: haiku/trunk/docs/userguide/prefs-images/e-mail-out.png ___________________________________________________________________ Name: svn:mime-type + application/octet-stream [... truncated: 815 lines follow ...] From revol at free.fr Fri Nov 7 22:49:54 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Fri, 07 Nov 2008 22:49:54 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28555_-_in_haiku/trunk/docs/use?= =?windows-1252?q?rguide=3A_=2E_prefs-images?= In-Reply-To: <200811072117.mA7LHG8r009002@sheep.berlios.de> Message-ID: <37328211573-BeMail@laptop> > * Added docs and screenshots for preference panels: Wow, amazing :) Btw, you can also have a look at spicing up the README.html that goes on the boot ISO... It would use real text and the same css... http://dev.haiku-os.org/browser/haiku/trunk/data/boot_cd/README.html Fran?ois. From bonefish at mail.berlios.de Sat Nov 8 03:04:53 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 8 Nov 2008 03:04:53 +0100 Subject: [Haiku-commits] r28556 - in haiku/trunk/src/tests/system: . runtime_loader runtime_loader/test_suite Message-ID: <200811080204.mA824rxG025078@sheep.berlios.de> Author: bonefish Date: 2008-11-08 03:04:53 +0100 (Sat, 08 Nov 2008) New Revision: 28556 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28556&view=rev Added: haiku/trunk/src/tests/system/runtime_loader/ haiku/trunk/src/tests/system/runtime_loader/test_suite/ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order5 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order6 haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order7 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_basic1 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order1 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order2 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order3 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_resolve_order4 haiku/trunk/src/tests/system/runtime_loader/test_suite/test_setup haiku/trunk/src/tests/system/runtime_loader/test_suite/test_suite Log: Added a small test suite for the runtime loader. The tests are designed to succeed on Linux. FreeBSD fails some tests since it seems to have a different load order (depth-first instead of breadth-first). Haiku fails a lot of tests due to its POSIX non-compliant dlopen(). Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,90 @@ +#!/bin/sh + +# program +# +# dlopen(): +# liba.so +# libb.so +# <- libb_dependency.so +# +# Expected: Global lookup: symbol in liba.so superseeds symbol in +# libb_dependency.so. + + +. test_setup + + +# create liba.so +cat > liba.c << EOI +int a() { return 1; } +EOI + +# build +gcc -shared -o liba.so liba.c + + +# create libb_dependency.so +cat > libb_dependency.c << EOI +int a() { return 2; } +EOI + +# build +gcc -shared -o libb_dependency.so libb_dependency.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c ./libb_dependency.so + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + void* libb; + void* self; + int (*a)(); + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + libb = dlopen("./libb.so", RTLD_NOW | RTLD_GLOBAL); + if (libb == NULL) { + fprintf(stderr, "Error opening libb.so: %s\n", dlerror()); + exit(117); + } + + self = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); + if (self == NULL) { + fprintf(stderr, "Error opening self: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(self, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 1 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order1 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,90 @@ +#!/bin/sh + +# program +# +# dlopen(): +# libb.so +# <- libb_dependency.so +# liba.so +# +# Expected: Global lookup: Symbol in libb_dependency.so superseeds symbol in +# liba.so. + + +. test_setup + + +# create liba.so +cat > liba.c << EOI +int a() { return 1; } +EOI + +# build +gcc -shared -o liba.so liba.c + + +# create libb_dependency.so +cat > libb_dependency.c << EOI +int a() { return 2; } +EOI + +# build +gcc -shared -o libb_dependency.so libb_dependency.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c ./libb_dependency.so + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + void* libb; + void* self; + int (*a)(); + + libb = dlopen("./libb.so", RTLD_NOW | RTLD_GLOBAL); + if (libb == NULL) { + fprintf(stderr, "Error opening libb.so: %s\n", dlerror()); + exit(117); + } + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + self = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); + if (self == NULL) { + fprintf(stderr, "Error opening self: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(self, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 2 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order2 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,85 @@ +#!/bin/sh + +# program +# +# dlopen(): +# liba.so +# <- libb.so +# <- libb_dependency.so +# <- libd.so +# +# Expected: liba.so lookup: Symbol in libd.so superseeds symbol in +# libb_dependency.so. + + +. test_setup + + +# create libb_dependency.so +cat > libb_dependency.c << EOI +int a() { return 1; } +EOI + +# build +gcc -shared -o libb_dependency.so libb_dependency.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c ./libb_dependency.so + + +# create liba.so +cat > libd.c << EOI +int a() { return 2; } +EOI + +# build +gcc -shared -o libd.so libd.c + + +# create liba.so +cat > liba.c << EOI +int c() { return 1; } +EOI + +# build +gcc -shared -o liba.so liba.c ./libb.so ./libd.so + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + int (*a)(); + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(liba, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 2 Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order3 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,90 @@ +#!/bin/sh + +# program +# +# dlopen(): +# libb.so (local) +# <- libb_dependency.so +# liba.so +# +# Expected: Global lookup: Symbol in libb_dependency.so does not superseeds +# symbol in liba.so, since libb.so is loaded RTLD_LOCAL. + + +. test_setup + + +# create liba.so +cat > liba.c << EOI +int a() { return 1; } +EOI + +# build +gcc -shared -o liba.so liba.c + + +# create libb_dependency.so +cat > libb_dependency.c << EOI +int a() { return 2; } +EOI + +# build +gcc -shared -o libb_dependency.so libb_dependency.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c ./libb_dependency.so + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + void* libb; + void* self; + int (*a)(); + + libb = dlopen("./libb.so", RTLD_NOW | RTLD_LOCAL); + if (libb == NULL) { + fprintf(stderr, "Error opening libb.so: %s\n", dlerror()); + exit(117); + } + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + self = dlopen(NULL, RTLD_NOW | RTLD_GLOBAL); + if (self == NULL) { + fprintf(stderr, "Error opening self: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(self, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 1 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_order4 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,60 @@ +#!/bin/sh + +# program +# +# dlopen(): +# liba.so +# +# Expected: Undefined symbol in liba.so might resolve to symbol in program, but +# the program image is ignored, so dlopen() on liba.so fails. + + +. test_setup + + +# create liba.so +cat > liba.c << EOI +extern int b(); +int a() { return b(); } +EOI + +# build +gcc -shared -o liba.so liba.c + + +# create program +cat > program.c << EOI +#include +#include +#include + +int b() { return 1; } + +int +main() +{ + void* liba; + int (*a)(); + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + /* Fails expectedly. */ + /* fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); */ + exit(117); + } + + a = (int (*)())dlsym(liba, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 117 Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic1 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,67 @@ +#!/bin/sh + +# program +# <- libb.so +# +# dlopen(): +# liba.so +# +# Expected: Undefined symbol in liba.so resolves to symbol in libb.so. + + +. test_setup + + +# create liba.so +cat > liba.c << EOI +extern int b(); +int a() { return b(); } +EOI + +# build +gcc -shared -o liba.so liba.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c + + +# create program +cat > program.c << EOI +#include +#include +#include + +int +main() +{ + void* liba; + int (*a)(); + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(liba, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c ./libb.so $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 1 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic2 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,77 @@ +#!/bin/sh + +# program +# +# dlopen(): +# liba.so +# <- libb.so +# <- libb_dependency.so +# +# Expected: Undefined symbol in liba.so resolves to symbol in +# libb_dependency.so. + + +. test_setup + + +# create libb_dependency.so +cat > libb_dependency.c << EOI +int c() { return 1; } +EOI + +# build +gcc -shared -o libb_dependency.so libb_dependency.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c ./libb_dependency.so + + +# create liba.so +cat > liba.c << EOI +extern int c(); +int a() { return c(); } +EOI + +# build +gcc -shared -o liba.so liba.c ./libb.so + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + int (*a)(); + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(liba, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 1 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_basic3 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,77 @@ +#!/bin/sh + +# program +# +# dlopen(): +# libb.so +# liba.so +# +# Expected: Undefined symbol in liba.so resolves to symbol in libb.so, not +# to symbol in program, since program image is ignored. + + +. test_setup + + +# create liba.so +cat > liba.c << EOI +extern int b(); +int a() { return b(); } +EOI + +# build +gcc -shared -o liba.so liba.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 2; } +EOI + +# build +gcc -shared -o libb.so libb.c + + +# create program +cat > program.c << EOI +#include +#include +#include + +int b() { return 1; } + +int +main() +{ + void* liba; + void* libb; + int (*a)(); + + libb = dlopen("./libb.so", RTLD_NOW | RTLD_GLOBAL); + if (libb == NULL) { + fprintf(stderr, "Error opening libb.so: %s\n", dlerror()); + exit(117); + } + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(liba, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 2 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order1 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,87 @@ +#!/bin/sh + +# program +# +# dlopen(): +# liba.so +# <- libb.so +# <- libb_dependency.so +# <- libd.so +# +# Expected: Undefined symbol in liba.so resolves to symbol in +# libd.so, not to symbol in libb_dependency.so. + + +. test_setup + + +# create libb_dependency.so +cat > libb_dependency.c << EOI +int c() { return 1; } +EOI + +# build +gcc -shared -o libb_dependency.so libb_dependency.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c ./libb_dependency.so + + +# create libd.so +cat > libd.c << EOI +int c() { return 2; } +EOI + +# build +gcc -shared -o libd.so libd.c + + +# create liba.so +cat > liba.c << EOI +extern int c(); +int a() { return c(); } +EOI + +# build +gcc -shared -o liba.so liba.c ./libb.so ./libd.so + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + int (*a)(); + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(liba, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 2 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order2 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,83 @@ +#!/bin/sh + +# program +# +# dlopen(): +# libd.so +# liba.so +# <- libb.so +# +# Expected: Undefined symbol in liba.so resolves to symbol in libd.so, +# not to symbol in libb.so. + + +. test_setup + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c + + +# create liba.so +cat > liba.c << EOI +extern int b(); +int a() { return b(); } +EOI + +# build +gcc -shared -o liba.so liba.c ./libb.so + + +# create libd.so +cat > libd.c << EOI +int b() { return 2; } +EOI + +# build +gcc -shared -o libd.so libd.c + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + void* libd; + int (*a)(); + + libd = dlopen("./libd.so", RTLD_NOW | RTLD_GLOBAL); + if (libd == NULL) { + fprintf(stderr, "Error opening libd.so: %s\n", dlerror()); + exit(117); + } + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + + a = (int (*)())dlsym(liba, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } + + return a(); +} +EOI + +# build +gcc -o program program.c $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 2 Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order3 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 2008-11-07 21:16:24 UTC (rev 28555) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_resolve_order4 2008-11-08 02:04:53 UTC (rev 28556) @@ -0,0 +1,94 @@ +#!/bin/sh + +# program +# +# dlopen(): +# libd.so +# liba.so +# <- libb.so +# <- libb_dependency.so +# +# Expected: Undefined symbol in liba.so resolves to symbol in libd.so, +# not to symbol in libb_dependency.so. + + +. test_setup + + +# create libb_dependency.so +cat > libb_dependency.c << EOI +int c() { return 1; } +EOI + +# build +gcc -shared -o libb_dependency.so libb_dependency.c + + +# create libb.so +cat > libb.c << EOI +int b() { return 1; } +EOI + +# build +gcc -shared -o libb.so libb.c ./libb_dependency.so + + +# create liba.so +cat > liba.c << EOI +extern int c(); +int a() { return c(); } +EOI + +# build +gcc -shared -o liba.so liba.c ./libb.so + + +# create libd.so +cat > libd.c << EOI +int c() { return 2; } +EOI + +# build +gcc -shared -o libd.so libd.c + + +# create program +cat > program.c << EOI +#include +#include +#include +int +main() +{ + void* liba; + void* libd; + int (*a)(); + + libd = dlopen("./libd.so", RTLD_NOW | RTLD_GLOBAL); + if (libd == NULL) { + fprintf(stderr, "Error opening libd.so: %s\n", dlerror()); [... truncated: 776 lines follow ...] From revol at free.fr Sat Nov 8 04:11:16 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 08 Nov 2008 04:11:16 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28556_-_in_haiku/trunk/src/test?= =?windows-1252?q?s/system=3A_=2E_runtime=5Floader_runtime=5Floader/test?= =?windows-1252?q?=5Fsuite?= In-Reply-To: <200811080204.mA824rxG025078@sheep.berlios.de> Message-ID: <406308595-BeMail@laptop> > Added a small test suite for the runtime loader. The tests are > designed > to succeed on Linux. FreeBSD fails some tests since it seems to have > a > different load order (depth-first instead of breadth-first). Haiku > fails > a lot of tests due to its POSIX non-compliant dlopen(). Btw, I recall needing some LIBRARY_PATH hack in ZETA for zsh, because dlopen() was actually calling load_add_on()... I hope we don't copy this bug :) It should probably just need a check for libnetwork to fully work in Haiku btw: http://revolf.free.fr/beos/patches/zsh-beos.diff.001.txt Fran?ois. From stippi at mail.berlios.de Sat Nov 8 11:31:53 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 8 Nov 2008 11:31:53 +0100 Subject: [Haiku-commits] r28557 - haiku/trunk/src/apps/aboutsystem Message-ID: <200811081031.mA8AVrD3020720@sheep.berlios.de> Author: stippi Date: 2008-11-08 11:31:52 +0100 (Sat, 08 Nov 2008) New Revision: 28557 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28557&view=rev Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp Log: That the core system code of Haiku is distributed under the terms of the MIT license was nowhere mentioned. I added an explaination to the copyrights section and also mentioned that clicking a license name will open the respective license for reading. Modified: haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp =================================================================== --- haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-08 02:04:53 UTC (rev 28556) +++ haiku/trunk/src/apps/aboutsystem/AboutSystem.cpp 2008-11-08 10:31:52 UTC (rev 28557) @@ -559,6 +559,21 @@ fCreditsView->SetFontAndColor(&font, B_FONT_ALL, &kHaikuGreen); fCreditsView->Insert("\nCopyrights\n\n"); + fCreditsView->SetFontAndColor(be_plain_font, B_FONT_ALL, &kDarkGrey); + fCreditsView->Insert("[Click a license name to read the respective " + "license.]\n\n"); + + // Haiku license + fCreditsView->Insert("The code that is unique to Haiku, especially the " + "kernel and all code that applications may link against, is " + "distributed under the terms of the "); + fCreditsView->InsertHyperText("MIT license", + new OpenFileAction("/etc/licenses/MIT")); + fCreditsView->Insert(". Some system libraries contain third party code " + "distributed under the LGPL license. You can find the copyrights " + "to third party code below.\n\n"); + + // GNU copyrights AddCopyrightEntry("The GNU Project", "Contains software from the GNU Project, " From stippi at mail.berlios.de Sat Nov 8 12:02:16 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 8 Nov 2008 12:02:16 +0100 Subject: [Haiku-commits] r28558 - haiku/trunk/build/jam Message-ID: <200811081102.mA8B2GZv023539@sheep.berlios.de> Author: stippi Date: 2008-11-08 12:02:14 +0100 (Sat, 08 Nov 2008) New Revision: 28558 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28558&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: * I fixed the Pe package and therefor bumped the version number to trigger redownloading the package. * Added link "vlc" to "VLC media player" in /boot/common/bin to make it easier on people launching VLC from the command line. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-08 10:31:52 UTC (rev 28557) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-08 11:02:14 UTC (rev 28558) @@ -389,7 +389,7 @@ } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { Echo "No optional package Pe available for gcc4" ; } else { - InstallOptionalHaikuImagePackage pe-2.4.1-x86-rc2 + InstallOptionalHaikuImagePackage pe-2.4.1-x86-rc3 : http://www.yellowbites.com/downloads/pe-2.4.1-x86.zip : apps ; @@ -469,6 +469,8 @@ ; AddSymlinkToHaikuImage home config be Applications : "/boot/apps/vlc-0.8.6c/VLC media player" ; + AddSymlinkToHaikuImage common bin + : "/boot/apps/vlc-0.8.6c/VLC media player" : vlc ; } } From axeld at pinc-software.de Sat Nov 8 12:06:42 2008 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sat, 08 Nov 2008 12:06:42 +0100 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: References: <200811070353.mA73rJqC001947@sheep.berlios.de> Message-ID: <491572C2.1050906@pinc-software.de> Ryan Leavengood wrote: > On Fri, Nov 7, 2008 at 6:55 AM, J?r?me Duval wrote: >> This shouldn't live in src/add-ons but in src/bin [...] > If other people agree with J?r?me please speak up and I can probably > be convinced to move it. Since it's part of libjpeg, I don't really care that much. However, I would prefer if ShowImage used the functions directly (as part of the library or via a dedicated translator interface) instead of just using the jpegtran executable. Bye, Axel. From axeld at pinc-software.de Sat Nov 8 12:07:53 2008 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sat, 08 Nov 2008 12:07:53 +0100 Subject: [Haiku-commits] r28547 - haiku/trunk/build/jam In-Reply-To: References: <200811070925.mA79PgFu022973@sheep.berlios.de> Message-ID: <49157309.4@pinc-software.de> Ryan Leavengood wrote: > On Fri, Nov 7, 2008 at 4:25 AM, axeld at BerliOS wrote: >> Log: >> * Removed jpegtran from the image - this fixes the build (missing header). >> * While I was at it, I also removed the extra screen savers until Ryan fixed >> the issue (bug #2339). > Thanks. I added the needed header now. I will add jpegtran back to the > image when I make the future changes to ShowImage. > > Same with the screen savers. Alright, great. Bye, Axel. From axeld at pinc-software.de Sat Nov 8 12:11:17 2008 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Sat, 08 Nov 2008 12:11:17 +0100 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: References: <20081107104015.931.1@stippis2.1226050004.fake> <6886109405-BeMail@zon> Message-ID: <491573D5.5070504@pinc-software.de> Ryan Leavengood wrote: > On Fri, Nov 7, 2008 at 5:17 AM, Axel D?rfler wrote: >> True enough, but I would always vote for the faster method, and >> changing the EXIF rotation is instantaneously. We could add lossless >> JPEG rotation, and we could even make it the default if you insist on >> it, but I wouldn't like this to be the only option. > I think it might be possible to rotate the JPEG inside ShowImage in > memory (lossy, like it is done now) and then use a thread to actually > modify the file in the background with jpegtran (if that option is > set.) That is what I am thinking of doing. This will allow someone to > navigate away from an image even while it is being rotated in the > background. The only "locking" operation which might slow loading > would be when the new rotated image (which would have a new filename) > is copied in to replace the original file. But that is just a file > rename so it should be pretty quick. > > My only concern is how to add this special JPEG support to ShowImage cleanly. I haven't looked at the jpegtran implementation, but I would add a special translator protocol that only the JPEG translator supports; ShowImage would then see if that protocol is supported, and if it is, use it. This could also be used to support the EXIF rotation, theoretically (which would then make this a translator option in the DataTranslators preferences app, that sounds nice to me, at least). If the translator does not support this protocol, it would just set the ShowImage:Orientation attribute as before. Bye, Axel. From superstippi at gmx.de Sat Nov 8 12:16:14 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 08 Nov 2008 12:16:14 +0100 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: <491573D5.5070504@pinc-software.de> References: <20081107104015.931.1@stippis2.1226050004.fake> <6886109405-BeMail@zon> <491573D5.5070504@pinc-software.de> Message-ID: <20081108121614.1648.2@stippis2.1226134096.fake> Axel D?rfler wrote: > Ryan Leavengood wrote: > > On Fri, Nov 7, 2008 at 5:17 AM, Axel D?rfler > > wrote: > >> True enough, but I would always vote for the faster method, and > >> changing the EXIF rotation is instantaneously. We could add lossless > >> JPEG rotation, and we could even make it the default if you insist on > >> it, but I wouldn't like this to be the only option. > > I think it might be possible to rotate the JPEG inside ShowImage in > > memory (lossy, like it is done now) and then use a thread to actually > > modify the file in the background with jpegtran (if that option is > > set.) That is what I am thinking of doing. This will allow someone to > > navigate away from an image even while it is being rotated in the > > background. The only "locking" operation which might slow loading would > > be when the new rotated image (which would have a new filename) is > > copied in to replace the original file. But that is just a file rename > > so it should be pretty quick. > > > > My only concern is how to add this special JPEG support to ShowImage > > cleanly. > > I haven't looked at the jpegtran implementation, but I would add a > special translator protocol that only the JPEG translator supports; > ShowImage would then see if that protocol is supported, and if it is, use > it. > This could also be used to support the EXIF rotation, theoretically > (which would then make this a translator option in the DataTranslators > preferences app, that sounds nice to me, at least). If the translator > does not support this protocol, it would just set the > ShowImage:Orientation attribute as before. Sounds very good. This way all the code stays where it belongs best and everyone can configure the rotation feature such that it works best for him. Best regards, -Stephan From korli at mail.berlios.de Sat Nov 8 12:52:02 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 8 Nov 2008 12:52:02 +0100 Subject: [Haiku-commits] r28559 - haiku/trunk/src/add-ons/translators/exr/openexr Message-ID: <200811081152.mA8Bq2Zq020388@sheep.berlios.de> Author: korli Date: 2008-11-08 12:52:00 +0100 (Sat, 08 Nov 2008) New Revision: 28559 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28559&view=rev Modified: haiku/trunk/src/add-ons/translators/exr/openexr/Jamfile Log: no need for this tool Modified: haiku/trunk/src/add-ons/translators/exr/openexr/Jamfile =================================================================== --- haiku/trunk/src/add-ons/translators/exr/openexr/Jamfile 2008-11-08 11:02:14 UTC (rev 28558) +++ haiku/trunk/src/add-ons/translators/exr/openexr/Jamfile 2008-11-08 11:52:00 UTC (rev 28559) @@ -1,17 +1,5 @@ SubDir HAIKU_TOP src add-ons translators exr openexr ; -SubDirSysHdrs [ FDirName $(SUBDIR) half ] ; -SubDirSysHdrs [ FDirName $(SUBDIR) iex ] ; -SubDirSysHdrs [ FDirName $(SUBDIR) ilmimf ] ; -SubDirSysHdrs [ FDirName $(SUBDIR) ilmthread ] ; -SubDirSysHdrs [ FDirName $(SUBDIR) imath ] ; -SubDirHdrs [ FDirName $(SUBDIR) config ] ; - -BinCommand exrheader : - exrheader.cpp - : libilmimf.so $(TARGET_LIBSTDC++) -; - SubInclude HAIKU_TOP src add-ons translators exr openexr half ; SubInclude HAIKU_TOP src add-ons translators exr openexr iex ; SubInclude HAIKU_TOP src add-ons translators exr openexr ilmimf ; From stippi at mail.berlios.de Sat Nov 8 12:58:59 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 8 Nov 2008 12:58:59 +0100 Subject: [Haiku-commits] r28560 - haiku/trunk/headers/os/interface Message-ID: <200811081158.mA8Bwx6b030330@sheep.berlios.de> Author: stippi Date: 2008-11-08 12:58:54 +0100 (Sat, 08 Nov 2008) New Revision: 28560 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28560&view=rev Modified: haiku/trunk/headers/os/interface/Gradient.h Log: System headers need to have "_" prepended in their header guards. Modified: haiku/trunk/headers/os/interface/Gradient.h =================================================================== --- haiku/trunk/headers/os/interface/Gradient.h 2008-11-08 11:52:00 UTC (rev 28559) +++ haiku/trunk/headers/os/interface/Gradient.h 2008-11-08 11:58:54 UTC (rev 28560) @@ -7,8 +7,8 @@ * Artur Wyszynski */ -#ifndef GRADIENT_H -#define GRADIENT_H +#ifndef _GRADIENT_H +#define _GRADIENT_H #include #include @@ -107,4 +107,4 @@ gradient_type fType; }; -#endif // GRADIENT_H +#endif // _GRADIENT_H From stippi at mail.berlios.de Sat Nov 8 13:01:02 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 8 Nov 2008 13:01:02 +0100 Subject: [Haiku-commits] r28561 - haiku/trunk/headers/os/interface Message-ID: <200811081201.mA8C12Sr032318@sheep.berlios.de> Author: stippi Date: 2008-11-08 13:00:57 +0100 (Sat, 08 Nov 2008) New Revision: 28561 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28561&view=rev Modified: haiku/trunk/headers/os/interface/GradientConic.h haiku/trunk/headers/os/interface/GradientDiamond.h haiku/trunk/headers/os/interface/GradientLinear.h haiku/trunk/headers/os/interface/GradientRadial.h haiku/trunk/headers/os/interface/GradientRadialFocus.h Log: Prepend header guard with underscore. Modified: haiku/trunk/headers/os/interface/GradientConic.h =================================================================== --- haiku/trunk/headers/os/interface/GradientConic.h 2008-11-08 11:58:54 UTC (rev 28560) +++ haiku/trunk/headers/os/interface/GradientConic.h 2008-11-08 12:00:57 UTC (rev 28561) @@ -6,8 +6,8 @@ * Artur Wyszynski */ -#ifndef GRADIENT_CONIC_H -#define GRADIENT_CONIC_H +#ifndef _GRADIENT_CONIC_H +#define _GRADIENT_CONIC_H #include @@ -27,4 +27,4 @@ void SetAngle(float angle); }; -#endif // GRADIENT_CONIC_H +#endif // _GRADIENT_CONIC_H Modified: haiku/trunk/headers/os/interface/GradientDiamond.h =================================================================== --- haiku/trunk/headers/os/interface/GradientDiamond.h 2008-11-08 11:58:54 UTC (rev 28560) +++ haiku/trunk/headers/os/interface/GradientDiamond.h 2008-11-08 12:00:57 UTC (rev 28561) @@ -6,8 +6,8 @@ * Artur Wyszynski */ -#ifndef GRADIENT_DIAMOND_H -#define GRADIENT_DIAMOND_H +#ifndef _GRADIENT_DIAMOND_H +#define _GRADIENT_DIAMOND_H #include @@ -24,4 +24,4 @@ void SetCenter(float cx, float cy); }; -#endif // GRADIENT_DIAMOND_H +#endif // _GRADIENT_DIAMOND_H Modified: haiku/trunk/headers/os/interface/GradientLinear.h =================================================================== --- haiku/trunk/headers/os/interface/GradientLinear.h 2008-11-08 11:58:54 UTC (rev 28560) +++ haiku/trunk/headers/os/interface/GradientLinear.h 2008-11-08 12:00:57 UTC (rev 28561) @@ -6,8 +6,8 @@ * Artur Wyszynski */ -#ifndef GRADIENT_LINEAR_H -#define GRADIENT_LINEAR_H +#ifndef _GRADIENT_LINEAR_H +#define _GRADIENT_LINEAR_H #include @@ -28,4 +28,4 @@ void SetEnd(float x2, float y2); }; -#endif // GRADIENT_LINEAR_H +#endif // _GRADIENT_LINEAR_H Modified: haiku/trunk/headers/os/interface/GradientRadial.h =================================================================== --- haiku/trunk/headers/os/interface/GradientRadial.h 2008-11-08 11:58:54 UTC (rev 28560) +++ haiku/trunk/headers/os/interface/GradientRadial.h 2008-11-08 12:00:57 UTC (rev 28561) @@ -6,8 +6,8 @@ * Artur Wyszynski */ -#ifndef GRADIENT_RADIAL_H -#define GRADIENT_RADIAL_H +#ifndef _GRADIENT_RADIAL_H +#define _GRADIENT_RADIAL_H #include @@ -27,4 +27,4 @@ void SetRadius(float radius); }; -#endif // GRADIENT_RADIAL_H +#endif // _GRADIENT_RADIAL_H Modified: haiku/trunk/headers/os/interface/GradientRadialFocus.h =================================================================== --- haiku/trunk/headers/os/interface/GradientRadialFocus.h 2008-11-08 11:58:54 UTC (rev 28560) +++ haiku/trunk/headers/os/interface/GradientRadialFocus.h 2008-11-08 12:00:57 UTC (rev 28561) @@ -6,8 +6,8 @@ * Artur Wyszynski */ -#ifndef GRADIENT_RADIAL_FOCUS_H -#define GRADIENT_RADIAL_FOCUS_H +#ifndef _GRADIENT_RADIAL_FOCUS_H +#define _GRADIENT_RADIAL_FOCUS_H #include @@ -32,4 +32,4 @@ void SetRadius(float radius); }; -#endif // GRADIENT_RADIAL_FOCUS_H +#endif // _GRADIENT_RADIAL_FOCUS_H From korli at users.berlios.de Sat Nov 8 13:02:42 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Sat, 8 Nov 2008 13:02:42 +0100 Subject: [Haiku-commits] r28544 - in haiku/trunk/src/add-ons/translators/jpeg: . libjpeg In-Reply-To: References: <200811070353.mA73rJqC001947@sheep.berlios.de> Message-ID: 2008/11/7 Ryan Leavengood : > I suppose, but that is probably up for debate. This is intimately > related to the libjpeg code, and may one day be integrated into the > translator, so I don't think it is that bad to put it here. Not all > the commands put in the bin directory are in src/bin. I couldn't find any. Some commands live in src/tests and src/tools but are not put in the bin directory. Bye, J?r?me From revol at free.fr Sat Nov 8 13:17:35 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 08 Nov 2008 13:17:35 +0100 CET Subject: [Haiku-commits] r28558 - haiku/trunk/build/jam In-Reply-To: <200811081102.mA8B2GZv023539@sheep.berlios.de> Message-ID: <338540066-BeMail@laptop> > * Added link "vlc" to "VLC media player" in /boot/common/bin to make > it > easier on people launching VLC from the command line. While it's ok to name it this way in the Leaf Menu, I'm not sure it's good to not name the executable as vlc... Fran?ois. From revol at free.fr Sat Nov 8 13:18:34 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 08 Nov 2008 13:18:34 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28544_-_in_haiku/trunk/src/add-?= =?windows-1252?q?ons/translators/jpeg=3A_=2E_libjpeg?= In-Reply-To: <491572C2.1050906@pinc-software.de> Message-ID: <397603331-BeMail@laptop> > Ryan Leavengood wrote: > > On Fri, Nov 7, 2008 at 6:55 AM, J?r?me Duval < > > korli at users.berlios.de> wrote: > >> This shouldn't live in src/add-ons but in src/bin > [...] > > If other people agree with J?r?me please speak up and I can > > probably > > be convinced to move it. > > Since it's part of libjpeg, I don't really care that much. > However, I would prefer if ShowImage used the functions directly (as > part of the library or via a dedicated translator interface) instead > of > just using the jpegtran executable. Can't the translator be extended to perform this operation ? That would make it easier to support the same on other formats too later. Fran?ois. From revol at free.fr Sat Nov 8 13:21:47 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 08 Nov 2008 13:21:47 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28544_-_in_haiku/trunk/src/add-?= =?windows-1252?q?ons/translators/jpeg=3A_=2E_libjpeg?= In-Reply-To: <491573D5.5070504@pinc-software.de> Message-ID: <590069047-BeMail@laptop> > I haven't looked at the jpegtran implementation, but I would add a > special translator protocol that only the JPEG translator supports; > ShowImage would then see if that protocol is supported, and if it is, > use it. > This could also be used to support the EXIF rotation, theoretically > (which would then make this a translator option in the > DataTranslators > preferences app, that sounds nice to me, at least). > If the translator does not support this protocol, it would just set > the > ShowImage:Orientation attribute as before. +1 Fran?ois. From superstippi at gmx.de Sat Nov 8 13:55:54 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sat, 08 Nov 2008 13:55:54 +0100 Subject: [Haiku-commits] r28558 - haiku/trunk/build/jam In-Reply-To: <338540066-BeMail@laptop> References: <338540066-BeMail@laptop> Message-ID: <20081108135554.2570.3@stippis2.1226134096.fake> Fran?ois Revol wrote: > > * Added link "vlc" to "VLC media player" in /boot/common/bin to make > > it > > easier on people launching VLC from the command line. > > While it's ok to name it this way in the Leaf Menu, I'm not sure it's > good to not name the executable as vlc... Could you give a reason? My reason for naming the executable "VLC media player" is consistency and aesthetics because the Deskbar entry is not a lowercase, alien looking "vlc". I'd probably be ok with "VLC" as a Deskbar and ProcessController entry, but according to the VLC team, that's simply not the correct name. "VLC media player" is. Best regards, -Stephan From stippi at mail.berlios.de Sat Nov 8 14:15:05 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 8 Nov 2008 14:15:05 +0100 Subject: [Haiku-commits] r28562 - haiku/trunk/src/kits/game Message-ID: <200811081315.mA8DF535027809@sheep.berlios.de> Author: stippi Date: 2008-11-08 14:15:02 +0100 (Sat, 08 Nov 2008) New Revision: 28562 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28562&view=rev Modified: haiku/trunk/src/kits/game/WindowScreen.cpp Log: Do no export unsupported accelerant hooks. Hopefully fixes #3088. Modified: haiku/trunk/src/kits/game/WindowScreen.cpp =================================================================== --- haiku/trunk/src/kits/game/WindowScreen.cpp 2008-11-08 12:00:57 UTC (rev 28561) +++ haiku/trunk/src/kits/game/WindowScreen.cpp 2008-11-08 13:15:02 UTC (rev 28562) @@ -189,7 +189,8 @@ status_t *error, bool debug_enable) : BWindow(BScreen().Frame(), title, B_TITLED_WINDOW, kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE - | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE) + | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, + B_CURRENT_WORKSPACE) { CALLED(); uint32 attributes = 0; @@ -206,7 +207,8 @@ uint32 attributes, status_t *error) : BWindow(BScreen().Frame(), title, B_TITLED_WINDOW, kWindowScreenFlag | B_NOT_MINIMIZABLE | B_NOT_CLOSABLE - | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, B_CURRENT_WORKSPACE) + | B_NOT_ZOOMABLE | B_NOT_MOVABLE | B_NOT_RESIZABLE, + B_CURRENT_WORKSPACE) { CALLED(); status_t status = _InitData(space, attributes); @@ -341,9 +343,12 @@ if (fAddonImage >= 0) { set_indexed_colors setIndexedColors = - (set_indexed_colors)fGetAccelerantHook(B_SET_INDEXED_COLORS, NULL); - if (setIndexedColors != NULL) - setIndexedColors(lastIndex - firstIndex + 1, firstIndex, colors, 0); + (set_indexed_colors)fGetAccelerantHook(B_SET_INDEXED_COLORS, + NULL); + if (setIndexedColors != NULL) { + setIndexedColors(lastIndex - firstIndex + 1, firstIndex, + colors, 0); + } } // TODO: Tell the app_server about our changes @@ -404,7 +409,8 @@ BWindowScreen::MoveDisplayArea(int32 x, int32 y) { CALLED(); - move_display_area moveDisplayArea = (move_display_area)fGetAccelerantHook(B_MOVE_DISPLAY, NULL); + move_display_area moveDisplayArea + = (move_display_area)fGetAccelerantHook(B_MOVE_DISPLAY, NULL); if (moveDisplayArea && moveDisplayArea((int16)x, (int16)y) == B_OK) { fFrameBufferInfo.display_x = x; fFrameBufferInfo.display_y = y; @@ -453,22 +459,28 @@ switch (index) { case 5: // 8 bit fill rect - hook = (graphics_card_hook)draw_rect_8; + if (sFillRectHook) + hook = (graphics_card_hook)draw_rect_8; break; case 6: // 32 bit fill rect - hook = (graphics_card_hook)draw_rect_32; + if (sFillRectHook) + hook = (graphics_card_hook)draw_rect_32; break; case 7: // screen to screen blit - hook = (graphics_card_hook)blit; + if (sBlitRectHook) + hook = (graphics_card_hook)blit; break; case 8: // screen to screen scaled filtered blit - hook = (graphics_card_hook)scaled_filtered_blit; + if (sScaledFilteredBlitHook) + hook = (graphics_card_hook)scaled_filtered_blit; break; case 10: // sync aka wait for graphics card idle - hook = (graphics_card_hook)card_sync; + if (sWaitIdleHook) + hook = (graphics_card_hook)card_sync; break; case 13: // 16 bit fill rect - hook = (graphics_card_hook)draw_rect_16; + if (sFillRectHook) + hook = (graphics_card_hook)draw_rect_16; break; default: break; From stippi at mail.berlios.de Sat Nov 8 14:22:34 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 8 Nov 2008 14:22:34 +0100 Subject: [Haiku-commits] r28563 - haiku/trunk/src/apps/icon-o-matic/import_export/styled_text Message-ID: <200811081322.mA8DMYx9028555@sheep.berlios.de> Author: stippi Date: 2008-11-08 14:22:33 +0100 (Sat, 08 Nov 2008) New Revision: 28563 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28563&view=rev Modified: haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp Log: * Fixed a warning. * fStyleMap could be deleted more than once in certain situations. Modified: haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp 2008-11-08 13:15:02 UTC (rev 28562) +++ haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp 2008-11-08 13:22:33 UTC (rev 28563) @@ -254,17 +254,15 @@ return B_CANCELED; } - StyleContainer* styles = icon->Styles(); // import run colors as styles if (runs) { + delete[] fStyleMap; fStyleMap = new struct style_map[runs->count]; for (int32 i = 0; runs && i < runs->count; i++) { _AddStyle(icon, &runs->runs[i]); } } - - int32 currentRun = 0; text_run *run = NULL; if (runs) @@ -344,6 +342,7 @@ } delete[] fStyleMap; + fStyleMap = NULL; return B_OK; } From stippi at mail.berlios.de Sat Nov 8 15:56:58 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sat, 8 Nov 2008 15:56:58 +0100 Subject: [Haiku-commits] r28564 - in haiku/trunk: headers/os/interface src/apps/gradients src/apps/icon-o-matic/gui src/apps/icon-o-matic/import_export/flat_icon src/apps/icon-o-matic/import_export/svg src/kits/app src/kits/interface src/libs/icon/style src/servers/app src/servers/app/drawing/Painter Message-ID: <200811081456.mA8EuwXN005483@sheep.berlios.de> Author: stippi Date: 2008-11-08 15:56:56 +0100 (Sat, 08 Nov 2008) New Revision: 28564 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28564&view=rev Modified: haiku/trunk/headers/os/interface/Gradient.h haiku/trunk/src/apps/gradients/Gradients.cpp haiku/trunk/src/apps/icon-o-matic/gui/GradientControl.cpp haiku/trunk/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp haiku/trunk/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp haiku/trunk/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp haiku/trunk/src/kits/app/LinkReceiver.cpp haiku/trunk/src/kits/app/ServerLink.cpp haiku/trunk/src/kits/interface/Gradient.cpp haiku/trunk/src/kits/interface/GradientConic.cpp haiku/trunk/src/kits/interface/GradientDiamond.cpp haiku/trunk/src/kits/interface/GradientLinear.cpp haiku/trunk/src/kits/interface/GradientRadial.cpp haiku/trunk/src/kits/interface/GradientRadialFocus.cpp haiku/trunk/src/libs/icon/style/GradientTransformable.cpp haiku/trunk/src/libs/icon/style/GradientTransformable.h haiku/trunk/src/libs/icon/style/Style.cpp haiku/trunk/src/servers/app/View.cpp haiku/trunk/src/servers/app/drawing/Painter/Painter.cpp Log: Moved the gradient_type and color_step structs into the BGradient class/namespace. Renamed the B_GRADIENT_* types to TYPE_* as the context is already given. Modified: haiku/trunk/headers/os/interface/Gradient.h =================================================================== --- haiku/trunk/headers/os/interface/Gradient.h 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/headers/os/interface/Gradient.h 2008-11-08 14:56:56 UTC (rev 28564) @@ -19,30 +19,29 @@ class BRect; -enum gradient_type { - B_GRADIENT_LINEAR = 0, - B_GRADIENT_RADIAL, - B_GRADIENT_RADIAL_FOCUS, - B_GRADIENT_DIAMOND, - B_GRADIENT_CONIC, - B_GRADIENT_NONE -}; +class BGradient : public BArchivable { +public: + enum gradient_type { + TYPE_LINEAR = 0, + TYPE_RADIAL, + TYPE_RADIAL_FOCUS, + TYPE_DIAMOND, + TYPE_CONIC, + TYPE_NONE + }; + struct color_step { + color_step(const rgb_color c, float o); + color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o); + color_step(const color_step& other); + color_step(); + + bool operator!=(const color_step& other) const; + + rgb_color color; + float offset; + }; -struct color_step { - color_step(const rgb_color c, float o); - color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o); - color_step(const color_step& other); - color_step(); - - bool operator!=(const color_step& other) const; - - rgb_color color; - float offset; -}; - - -class BGradient : public BArchivable { public: BGradient(); BGradient(BMessage* archive); Modified: haiku/trunk/src/apps/gradients/Gradients.cpp =================================================================== --- haiku/trunk/src/apps/gradients/Gradients.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/apps/gradients/Gradients.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -43,10 +43,10 @@ void DrawRadialFocus(BRect update); void DrawDiamond(BRect update); void DrawConic(BRect update); - void SetType(gradient_type type); + void SetType(BGradient::gradient_type type); private: - gradient_type fType; + BGradient::gradient_type fType; }; @@ -134,19 +134,19 @@ { switch (msg->what) { case MSG_LINEAR: - fGradientsView->SetType(B_GRADIENT_LINEAR); + fGradientsView->SetType(BGradient::TYPE_LINEAR); break; case MSG_RADIAL: - fGradientsView->SetType(B_GRADIENT_RADIAL); + fGradientsView->SetType(BGradient::TYPE_RADIAL); break; case MSG_RADIAL_FOCUS: - fGradientsView->SetType(B_GRADIENT_RADIAL_FOCUS); + fGradientsView->SetType(BGradient::TYPE_RADIAL_FOCUS); break; case MSG_DIAMOND: - fGradientsView->SetType(B_GRADIENT_DIAMOND); + fGradientsView->SetType(BGradient::TYPE_DIAMOND); break; case MSG_CONIC: - fGradientsView->SetType(B_GRADIENT_CONIC); + fGradientsView->SetType(BGradient::TYPE_CONIC); break; default: BWindow::MessageReceived(msg); @@ -160,7 +160,7 @@ GradientsView::GradientsView(const BRect &rect) : BView(rect, "gradientsview", B_FOLLOW_ALL, B_WILL_DRAW | B_PULSE_NEEDED), - fType(B_GRADIENT_LINEAR) + fType(BGradient::TYPE_LINEAR) { } @@ -174,27 +174,27 @@ GradientsView::Draw(BRect update) { switch (fType) { - case B_GRADIENT_LINEAR: { + case BGradient::TYPE_LINEAR: { DrawLinear(update); break; } - case B_GRADIENT_RADIAL: { + case BGradient::TYPE_RADIAL: { DrawRadial(update); break; } - case B_GRADIENT_RADIAL_FOCUS: { + case BGradient::TYPE_RADIAL_FOCUS: { DrawRadialFocus(update); break; } - case B_GRADIENT_DIAMOND: { + case BGradient::TYPE_DIAMOND: { DrawDiamond(update); break; } - case B_GRADIENT_CONIC: { + case BGradient::TYPE_CONIC: { DrawConic(update); break; } - case B_GRADIENT_NONE: + case BGradient::TYPE_NONE: default: { break; } @@ -426,7 +426,7 @@ void -GradientsView::SetType(gradient_type type) +GradientsView::SetType(BGradient::gradient_type type) { fType = type; Invalidate(); Modified: haiku/trunk/src/apps/icon-o-matic/gui/GradientControl.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/gui/GradientControl.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/apps/icon-o-matic/gui/GradientControl.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -164,7 +164,7 @@ float offset = _OffsetFor(where); if (fDraggingStepIndex >= 0) { - color_step* step = fGradient->ColorAt(fDraggingStepIndex); + BGradient::color_step* step = fGradient->ColorAt(fDraggingStepIndex); if (step) { if (fGradient->SetOffset(fDraggingStepIndex, offset)) { _UpdateColors(); @@ -201,7 +201,8 @@ if (restore_color_from_message(message, color, 0) >= B_OK) { bool update = false; if (fDropIndex >= 0) { - if (color_step* step = fGradient->ColorAt(fDropIndex)) { + if (BGradient::color_step* step + = fGradient->ColorAt(fDropIndex)) { color.alpha = step->color.alpha; } fGradient->SetColor(fDropIndex, color); @@ -209,7 +210,8 @@ fDropIndex = -1; update = true; } else if (fDropOffset >= 0.0) { - fCurrentStepIndex = fGradient->AddColor(color, fDropOffset); + fCurrentStepIndex = fGradient->AddColor(color, + fDropOffset); fDropOffset = -1.0; update = true; } @@ -253,7 +255,8 @@ case B_END: case B_LEFT_ARROW: case B_RIGHT_ARROW: { - if (color_step* step = fGradient->ColorAt(fCurrentStepIndex)) { + if (BGradient::color_step* step + = fGradient->ColorAt(fCurrentStepIndex)) { BRect r = _GradientBitmapRect(); float x = r.left + r.Width() * step->offset; switch (bytes[0]) { @@ -274,7 +277,8 @@ x = r.right; break; } - update = fGradient->SetOffset(fCurrentStepIndex, (x - r.left) / r.Width()); + update = fGradient->SetOffset(fCurrentStepIndex, + (x - r.left) / r.Width()); } break; } @@ -377,14 +381,15 @@ markerPos.y = b.bottom + 4.0; BPoint leftBottom(-6.0, 6.0); BPoint rightBottom(6.0, 6.0); - for (int32 i = 0; color_step* step = fGradient->ColorAt(i); i++) { + for (int32 i = 0; BGradient::color_step* step = fGradient->ColorAt(i); + i++) { markerPos.x = b.left + (b.Width() * step->offset); if (i == fCurrentStepIndex) { SetLowColor(focus); if (isFocus) { StrokeLine(markerPos + leftBottom + BPoint(1.0, 4.0), - markerPos + rightBottom + BPoint(-1.0, 4.0), B_SOLID_LOW); + markerPos + rightBottom + BPoint(-1.0, 4.0), B_SOLID_LOW); } } else { SetLowColor(black); @@ -394,9 +399,8 @@ if (i == fDropIndex) SetLowColor(255, 0, 0, 255); - StrokeTriangle(markerPos, - markerPos + leftBottom, - markerPos + rightBottom, B_SOLID_LOW); + StrokeTriangle(markerPos, markerPos + leftBottom, + markerPos + rightBottom, B_SOLID_LOW); if (fEnabled) { SetHighColor(step->color); } else { @@ -459,7 +463,8 @@ bool GradientControl::GetCurrentStop(rgb_color* color) const { - color_step* stop = fGradient->ColorAt(fCurrentStepIndex); + BGradient::color_step* stop + = fGradient->ColorAt(fCurrentStepIndex); if (stop && color) { *color = stop->color; return true; @@ -612,8 +617,10 @@ int32 index = -1; BRect r = _GradientBitmapRect(); BRect markerFrame(Bounds()); - for (int32 i = 0; color_step* step = fGradient->ColorAt(i); i++) { - markerFrame.left = markerFrame.right = r.left + (r.Width() * step->offset); + for (int32 i = 0; BGradient::color_step* step + = fGradient->ColorAt(i); i++) { + markerFrame.left = markerFrame.right = r.left + + (r.Width() * step->offset); markerFrame.InsetBy(-6.0, 0.0); if (markerFrame.Contains(where)) { index = i; @@ -641,7 +648,7 @@ if (!fMessage || !fTarget || !fTarget->Looper()) return; // set the CanvasView current color - if (color_step* step = fGradient->ColorAt(fCurrentStepIndex)) { + if (BGradient::color_step* step = fGradient->ColorAt(fCurrentStepIndex)) { BMessage message(*fMessage); store_color_in_message(&message, step->color); fTarget->Looper()->PostMessage(&message, fTarget); Modified: haiku/trunk/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/apps/icon-o-matic/import_export/flat_icon/FlatIconExporter.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -606,7 +606,7 @@ bool alpha = false; bool gray = true; for (int32 i = 0; i < gradientStopCount; i++) { - color_step* step = gradient->ColorAtFast(i); + BGradient::color_step* step = gradient->ColorAtFast(i); if (step->color.alpha < 255) alpha = true; if (step->color.red != step->color.green @@ -632,7 +632,7 @@ } for (int32 i = 0; i < gradientStopCount; i++) { - color_step* step = gradient->ColorAtFast(i); + BGradient::color_step* step = gradient->ColorAtFast(i); uint8 stopOffset = (uint8)(step->offset * 255.0); uint32 color = (uint32&)step->color; if (!buffer.Write(stopOffset)) Modified: haiku/trunk/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/apps/icon-o-matic/import_export/svg/DocumentBuilder.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -803,7 +803,7 @@ rgb_color color; - color_step* step; + BGradient::color_step* step; if (gradient && (step = gradient->ColorAt(0))) { color.red = step->color.red; color.green = step->color.green; Modified: haiku/trunk/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/apps/icon-o-matic/import_export/svg/SVGExporter.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -408,7 +408,7 @@ // write stop tags char color[16]; - for (int32 i = 0; color_step* stop = gradient->ColorAt(i); i++) { + for (int32 i = 0; BGradient::color_step* stop = gradient->ColorAt(i); i++) { sprintf(color, "%.2x%.2x%.2x", stop->color.red, stop->color.green, Modified: haiku/trunk/src/kits/app/LinkReceiver.cpp =================================================================== --- haiku/trunk/src/kits/app/LinkReceiver.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/app/LinkReceiver.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -471,20 +471,20 @@ static BGradient* -gradient_for_type(gradient_type type) +gradient_for_type(BGradient::gradient_type type) { switch (type) { - case B_GRADIENT_LINEAR: + case BGradient::TYPE_LINEAR: return new (std::nothrow) BGradientLinear(); - case B_GRADIENT_RADIAL: + case BGradient::TYPE_RADIAL: return new (std::nothrow) BGradientRadial(); - case B_GRADIENT_RADIAL_FOCUS: + case BGradient::TYPE_RADIAL_FOCUS: return new (std::nothrow) BGradientRadialFocus(); - case B_GRADIENT_DIAMOND: + case BGradient::TYPE_DIAMOND: return new (std::nothrow) BGradientDiamond(); - case B_GRADIENT_CONIC: + case BGradient::TYPE_CONIC: return new (std::nothrow) BGradientConic(); - case B_GRADIENT_NONE: + case BGradient::TYPE_NONE: return new (std::nothrow) BGradient(); } return NULL; @@ -495,10 +495,10 @@ LinkReceiver::ReadGradient(BGradient** _gradient) { GTRACE(("LinkReceiver::ReadGradient\n")); - gradient_type gradientType; + BGradient::gradient_type gradientType; int32 colorsCount; status_t ret; - if ((ret = Read(&gradientType, sizeof(gradient_type))) != B_OK) + if ((ret = Read(&gradientType, sizeof(BGradient::gradient_type))) != B_OK) return ret; if ((ret = Read(&colorsCount, sizeof(int32))) != B_OK) return ret; @@ -509,9 +509,9 @@ *_gradient = gradient; if (colorsCount > 0) { - color_step step; + BGradient::color_step step; for (int i = 0; i < colorsCount; i++) { - if ((ret = Read(&step, sizeof(color_step))) != B_OK) + if ((ret = Read(&step, sizeof(BGradient::color_step))) != B_OK) return ret; if (!gradient->AddColor(step, i)) return B_NO_MEMORY; @@ -519,8 +519,8 @@ } switch(gradientType) { - case B_GRADIENT_LINEAR: { - GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_LINEAR\n")); + case BGradient::TYPE_LINEAR: { + GTRACE(("LinkReceiver::ReadGradient> type == TYPE_LINEAR\n")); BGradientLinear* linear = (BGradientLinear*)gradient; BPoint start; BPoint end; @@ -532,8 +532,8 @@ linear->SetEnd(end); return B_OK; } - case B_GRADIENT_RADIAL: { - GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_RADIAL\n")); + case BGradient::TYPE_RADIAL: { + GTRACE(("LinkReceiver::ReadGradient> type == TYPE_RADIAL\n")); BGradientRadial* radial = (BGradientRadial*)gradient; BPoint center; float radius; @@ -545,8 +545,8 @@ radial->SetRadius(radius); return B_OK; } - case B_GRADIENT_RADIAL_FOCUS: { - GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_RADIAL_FOCUS\n")); + case BGradient::TYPE_RADIAL_FOCUS: { + GTRACE(("LinkReceiver::ReadGradient> type == TYPE_RADIAL_FOCUS\n")); BGradientRadialFocus* radialFocus = (BGradientRadialFocus*)gradient; BPoint center; @@ -563,8 +563,8 @@ radialFocus->SetRadius(radius); return B_OK; } - case B_GRADIENT_DIAMOND: { - GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_DIAMOND\n")); + case BGradient::TYPE_DIAMOND: { + GTRACE(("LinkReceiver::ReadGradient> type == TYPE_DIAMOND\n")); BGradientDiamond* diamond = (BGradientDiamond*)gradient; BPoint center; if ((ret = Read(¢er, sizeof(BPoint))) != B_OK) @@ -572,8 +572,8 @@ diamond->SetCenter(center); return B_OK; } - case B_GRADIENT_CONIC: { - GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_CONIC\n")); + case BGradient::TYPE_CONIC: { + GTRACE(("LinkReceiver::ReadGradient> type == TYPE_CONIC\n")); BGradientConic* conic = (BGradientConic*)gradient; BPoint center; float angle; @@ -585,8 +585,8 @@ conic->SetAngle(angle); return B_OK; } - case B_GRADIENT_NONE: { - GTRACE(("LinkReceiver::ReadGradient> type == B_GRADIENT_NONE\n")); + case BGradient::TYPE_NONE: { + GTRACE(("LinkReceiver::ReadGradient> type == TYPE_NONE\n")); break; } } Modified: haiku/trunk/src/kits/app/ServerLink.cpp =================================================================== --- haiku/trunk/src/kits/app/ServerLink.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/app/ServerLink.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -126,21 +126,21 @@ ServerLink::AttachGradient(const BGradient &gradient) { GTRACE(("ServerLink::AttachGradient\n")); - gradient_type gradientType = gradient.Type(); + BGradient::gradient_type gradientType = gradient.Type(); int32 colorsCount = gradient.CountColors(); GTRACE(("ServerLink::AttachGradient> colors count == %d\n", (int)colorsCount)); - fSender->Attach(&gradientType, sizeof(gradient_type)); + fSender->Attach(&gradientType, sizeof(BGradient::gradient_type)); fSender->Attach(&colorsCount, sizeof(int32)); if (colorsCount > 0) { for (int i = 0; i < colorsCount; i++) { - fSender->Attach((color_step*) gradient.ColorAtFast(i), - sizeof(color_step)); + fSender->Attach(gradient.ColorAtFast(i), + sizeof(BGradient::color_step)); } } switch(gradientType) { - case B_GRADIENT_LINEAR: { - GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_LINEAR\n")); + case BGradient::TYPE_LINEAR: { + GTRACE(("ServerLink::AttachGradient> type == TYPE_LINEAR\n")); const BGradientLinear* linear = (BGradientLinear*) &gradient; BPoint start = linear->Start(); BPoint end = linear->End(); @@ -148,8 +148,8 @@ fSender->Attach(&end, sizeof(BPoint)); break; } - case B_GRADIENT_RADIAL: { - GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_RADIAL\n")); + case BGradient::TYPE_RADIAL: { + GTRACE(("ServerLink::AttachGradient> type == TYPE_RADIAL\n")); const BGradientRadial* radial = (BGradientRadial*) &gradient; BPoint center = radial->Center(); float radius = radial->Radius(); @@ -157,8 +157,8 @@ fSender->Attach(&radius, sizeof(float)); break; } - case B_GRADIENT_RADIAL_FOCUS: { - GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_RADIAL_FOCUS\n")); + case BGradient::TYPE_RADIAL_FOCUS: { + GTRACE(("ServerLink::AttachGradient> type == TYPE_RADIAL_FOCUS\n")); const BGradientRadialFocus* radialFocus = (BGradientRadialFocus*) &gradient; BPoint center = radialFocus->Center(); @@ -169,15 +169,15 @@ fSender->Attach(&radius, sizeof(float)); break; } - case B_GRADIENT_DIAMOND: { - GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_DIAMOND\n")); + case BGradient::TYPE_DIAMOND: { + GTRACE(("ServerLink::AttachGradient> type == TYPE_DIAMOND\n")); const BGradientDiamond* diamond = (BGradientDiamond*) &gradient; BPoint center = diamond->Center(); fSender->Attach(¢er, sizeof(BPoint)); break; } - case B_GRADIENT_CONIC: { - GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_CONIC\n")); + case BGradient::TYPE_CONIC: { + GTRACE(("ServerLink::AttachGradient> type == TYPE_CONIC\n")); const BGradientConic* conic = (BGradientConic*) &gradient; BPoint center = conic->Center(); float angle = conic->Angle(); @@ -185,8 +185,8 @@ fSender->Attach(&angle, sizeof(float)); break; } - case B_GRADIENT_NONE: { - GTRACE(("ServerLink::AttachGradient> type == B_GRADIENT_NONE\n")); + case BGradient::TYPE_NONE: { + GTRACE(("ServerLink::AttachGradient> type == TYPE_NONE\n")); break; } } Modified: haiku/trunk/src/kits/interface/Gradient.cpp =================================================================== --- haiku/trunk/src/kits/interface/Gradient.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/interface/Gradient.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -16,7 +16,7 @@ // constructor -color_step::color_step(const rgb_color c, float o) +BGradient::color_step::color_step(const rgb_color c, float o) { color.red = c.red; color.green = c.green; @@ -27,7 +27,7 @@ // constructor -color_step::color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o) +BGradient::color_step::color_step(uint8 r, uint8 g, uint8 b, uint8 a, float o) { color.red = r; color.green = g; @@ -38,7 +38,7 @@ // constructor -color_step::color_step(const color_step& other) +BGradient::color_step::color_step(const color_step& other) { color.red = other.color.red; color.green = other.color.green; @@ -49,7 +49,7 @@ // constructor -color_step::color_step() +BGradient::color_step::color_step() { color.red = 0; color.green = 0; @@ -61,7 +61,7 @@ // operator!= bool -color_step::operator!=(const color_step& other) const +BGradient::color_step::operator!=(const color_step& other) const { return color.red != other.color.red || color.green != other.color.green || @@ -72,19 +72,15 @@ static int -sort_color_steps_by_offset(const void* left, const void* right) +sort_color_steps_by_offset(const void* _left, const void* _right) { - const color_step **firstStep((const color_step**) left), - **secondStep((const color_step**) right); - int ret = 0; - if ((*firstStep)->offset > (*secondStep)->offset) { - ret = 1; - } if ((*firstStep)->offset < (*secondStep)->offset) { - ret = -1; - } if ((*firstStep)->offset == (*secondStep)->offset) { - ret = 0; - } - return ret; + const BGradient::color_step** left = (const BGradient::color_step**)_left; + const BGradient::color_step** right = (const BGradient::color_step**)_right; + if ((*left)->offset > (*right)->offset) + return 1; + else if ((*left)->offset < (*right)->offset) + return -1; + return 0; } @@ -95,7 +91,7 @@ BGradient::BGradient() : BArchivable(), fColors(4), - fType(B_GRADIENT_NONE) + fType(TYPE_NONE) { } @@ -104,7 +100,7 @@ BGradient::BGradient(BMessage* archive) : BArchivable(archive), fColors(4), - fType(B_GRADIENT_NONE) + fType(TYPE_NONE) { if (!archive) return; @@ -118,7 +114,7 @@ break; } if (archive->FindInt32("type", (int32*)&fType) < B_OK) - fType = B_GRADIENT_LINEAR; + fType = TYPE_LINEAR; // linear if (archive->FindFloat("linear_x1", (float*)&fData.linear.x1) < B_OK) @@ -403,7 +399,7 @@ // ColorAt -color_step* +BGradient::color_step* BGradient::ColorAt(int32 index) const { return (color_step*)fColors.ItemAt(index); @@ -411,7 +407,7 @@ // ColorAtFast -color_step* +BGradient::color_step* BGradient::ColorAtFast(int32 index) const { return (color_step*)fColors.ItemAtFast(index); @@ -419,7 +415,7 @@ // Colors -color_step* +BGradient::color_step* BGradient::Colors() const { if (CountColors() > 0) { Modified: haiku/trunk/src/kits/interface/GradientConic.cpp =================================================================== --- haiku/trunk/src/kits/interface/GradientConic.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/interface/GradientConic.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -17,7 +17,7 @@ fData.conic.cx = 0.0f; fData.conic.cy = 0.0f; fData.conic.angle = 0.0f; - fType = B_GRADIENT_CONIC; + fType = TYPE_CONIC; } @@ -27,7 +27,7 @@ fData.conic.cx = center.x; fData.conic.cy = center.y; fData.conic.angle = angle; - fType = B_GRADIENT_CONIC; + fType = TYPE_CONIC; } @@ -37,7 +37,7 @@ fData.conic.cx = cx; fData.conic.cy = cy; fData.conic.angle = angle; - fType = B_GRADIENT_CONIC; + fType = TYPE_CONIC; } Modified: haiku/trunk/src/kits/interface/GradientDiamond.cpp =================================================================== --- haiku/trunk/src/kits/interface/GradientDiamond.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/interface/GradientDiamond.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -16,7 +16,7 @@ { fData.diamond.cx = 0.0f; fData.diamond.cy = 0.0f; - fType = B_GRADIENT_DIAMOND; + fType = TYPE_DIAMOND; } @@ -25,7 +25,7 @@ { fData.diamond.cx = center.x; fData.diamond.cy = center.y; - fType = B_GRADIENT_DIAMOND; + fType = TYPE_DIAMOND; } @@ -34,7 +34,7 @@ { fData.diamond.cx = cx; fData.diamond.cy = cy; - fType = B_GRADIENT_DIAMOND; + fType = TYPE_DIAMOND; } Modified: haiku/trunk/src/kits/interface/GradientLinear.cpp =================================================================== --- haiku/trunk/src/kits/interface/GradientLinear.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/interface/GradientLinear.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -18,7 +18,7 @@ fData.linear.y1 = 0.0f; fData.linear.x2 = 0.0f; fData.linear.y2 = 0.0f; - fType = B_GRADIENT_LINEAR; + fType = TYPE_LINEAR; } @@ -29,7 +29,7 @@ fData.linear.y1 = start.y; fData.linear.x2 = end.x; fData.linear.y2 = end.y; - fType = B_GRADIENT_LINEAR; + fType = TYPE_LINEAR; } @@ -40,7 +40,7 @@ fData.linear.y1 = y1; fData.linear.x2 = x2; fData.linear.y2 = y2; - fType = B_GRADIENT_LINEAR; + fType = TYPE_LINEAR; } Modified: haiku/trunk/src/kits/interface/GradientRadial.cpp =================================================================== --- haiku/trunk/src/kits/interface/GradientRadial.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/interface/GradientRadial.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -17,7 +17,7 @@ fData.radial.cx = 0.0f; fData.radial.cy = 0.0f; fData.radial.radius = 0.0f; - fType = B_GRADIENT_RADIAL; + fType = TYPE_RADIAL; } @@ -27,7 +27,7 @@ fData.radial.cx = center.x; fData.radial.cy = center.y; fData.radial.radius = radius; - fType = B_GRADIENT_RADIAL; + fType = TYPE_RADIAL; } @@ -37,7 +37,7 @@ fData.radial.cx = cx; fData.radial.cy = cy; fData.radial.radius = radius; - fType = B_GRADIENT_RADIAL; + fType = TYPE_RADIAL; } Modified: haiku/trunk/src/kits/interface/GradientRadialFocus.cpp =================================================================== --- haiku/trunk/src/kits/interface/GradientRadialFocus.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/kits/interface/GradientRadialFocus.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -19,7 +19,7 @@ fData.radial_focus.fx = 0.0f; fData.radial_focus.fy = 0.0f; fData.radial_focus.radius = 0.0f; - fType = B_GRADIENT_RADIAL_FOCUS; + fType = TYPE_RADIAL_FOCUS; } @@ -32,7 +32,7 @@ fData.radial_focus.fx = focal.x; fData.radial_focus.fy = focal.y; fData.radial_focus.radius = radius; - fType = B_GRADIENT_RADIAL_FOCUS; + fType = TYPE_RADIAL_FOCUS; } @@ -45,7 +45,7 @@ fData.radial_focus.fx = fx; fData.radial_focus.fy = fy; fData.radial_focus.radius = radius; - fType = B_GRADIENT_RADIAL_FOCUS; + fType = TYPE_RADIAL_FOCUS; } Modified: haiku/trunk/src/libs/icon/style/GradientTransformable.cpp =================================================================== --- haiku/trunk/src/libs/icon/style/GradientTransformable.cpp 2008-11-08 13:22:33 UTC (rev 28563) +++ haiku/trunk/src/libs/icon/style/GradientTransformable.cpp 2008-11-08 14:56:56 UTC (rev 28564) @@ -33,8 +33,8 @@ fInheritTransformation(true) { if (!empty) { - AddColor(color_step(0, 0, 0, 255, 0.0), 0); - AddColor(color_step(255, 255, 255, 255, 1.0), 1); + AddColor(BGradient::color_step(0, 0, 0, 255, 0.0), 0); + AddColor(BGradient::color_step(255, 255, 255, 255, 1.0), 1); } } @@ -63,7 +63,7 @@ LoadFrom((const double*)matrix); // color steps - color_step step; + BGradient::color_step step; for (int32 i = 0; archive->FindFloat("offset", i, &step.offset) >= B_OK; i++) { if (archive->FindInt32("color", i, (int32*)&step.color) >= B_OK) AddColor(step, i); @@ -97,7 +97,7 @@ fInterpolation(other.fInterpolation), fInheritTransformation(other.fInheritTransformation) { - for (int32 i = 0; color_step* step = other.ColorAt(i); i++) { + for (int32 i = 0; BGradient::color_step* step = other.ColorAt(i); i++) { AddColor(*step, i); } } @@ -126,7 +126,7 @@ // color steps if (ret >= B_OK) { - for (int32 i = 0; color_step* step = ColorAt(i); i++) { + for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) { ret = into->AddInt32("color", (const uint32&)step->color); if (ret < B_OK) break; @@ -198,8 +198,8 @@ bool equal = true; for (int32 i = 0; i < count; i++) { - color_step* ourStep = ColorAtFast(i); - color_step* otherStep = other.ColorAtFast(i); + BGradient::color_step* ourStep = ColorAtFast(i); + BGradient::color_step* otherStep = other.ColorAtFast(i); if (*ourStep != *otherStep) { equal = false; break; @@ -219,7 +219,7 @@ #endif _MakeEmpty(); - for (int32 i = 0; color_step* step = other.ColorAt(i); i++) + for (int32 i = 0; BGradient::color_step* step = other.ColorAt(i); i++) AddColor(*step, i); Notify(); @@ -232,11 +232,11 @@ Gradient::AddColor(const rgb_color& color, float offset) { // find the correct index (sorted by offset) - color_step* step = new color_step(color, offset); + BGradient::color_step* step = new BGradient::color_step(color, offset); int32 index = 0; int32 count = CountColors(); for (; index < count; index++) { - color_step* s = ColorAtFast(index); + BGradient::color_step* s = ColorAtFast(index); if (s->offset > step->offset) break; } @@ -250,9 +250,9 @@ // AddColor bool -Gradient::AddColor(const color_step& color, int32 index) +Gradient::AddColor(const BGradient::color_step& color, int32 index) { - color_step* step = new color_step(color); + BGradient::color_step* step = new BGradient::color_step(color); if (!fColors.AddItem((void*)step, index)) { delete step; return false; @@ -265,7 +265,8 @@ bool Gradient::RemoveColor(int32 index) { - color_step* step = (color_step*)fColors.RemoveItem(index); + BGradient::color_step* step + = (BGradient::color_step*)fColors.RemoveItem(index); if (!step) { return false; } @@ -278,9 +279,9 @@ // SetColor bool -Gradient::SetColor(int32 index, const color_step& color) +Gradient::SetColor(int32 index, const BGradient::color_step& color) { - if (color_step* step = ColorAt(index)) { + if (BGradient::color_step* step = ColorAt(index)) { if (*step != color) { step->color = color.color; step->offset = color.offset; @@ -295,7 +296,7 @@ bool Gradient::SetColor(int32 index, const rgb_color& color) { - if (color_step* step = ColorAt(index)) { + if (BGradient::color_step* step = ColorAt(index)) { if ((uint32&)step->color != (uint32&)color) { step->color = color; Notify(); @@ -309,7 +310,7 @@ bool Gradient::SetOffset(int32 index, float offset) { - color_step* step = ColorAt(index); + BGradient::color_step* step = ColorAt(index); if (step && step->offset != offset) { step->offset = offset; Notify(); @@ -328,17 +329,17 @@ } // ColorAt -color_step* +BGradient::color_step* Gradient::ColorAt(int32 index) const { - return (color_step*)fColors.ItemAt(index); + return (BGradient::color_step*)fColors.ItemAt(index); } // ColorAtFast -color_step* +BGradient::color_step* Gradient::ColorAtFast(int32 index) const { - return (color_step*)fColors.ItemAtFast(index); + return (BGradient::color_step*)fColors.ItemAtFast(index); } // #pragma mark - @@ -394,13 +395,13 @@ void Gradient::MakeGradient(uint32* colors, int32 count) const { - color_step* from = ColorAt(0); + BGradient::color_step* from = ColorAt(0); if (!from) return; // find the step with the lowest offset - for (int32 i = 0; color_step* step = ColorAt(i); i++) { + for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) { if (step->offset < from->offset) from = step; } @@ -425,7 +426,7 @@ // put all steps that we need to interpolate to into a list BList nextSteps(fColors.CountItems() - 1); - for (int32 i = 0; color_step* step = ColorAt(i); i++) { + for (int32 i = 0; BGradient::color_step* step = ColorAt(i); i++) { if (step != from) nextSteps.AddItem((void*)step); } @@ -434,9 +435,10 @@ while (!nextSteps.IsEmpty()) { // find the step with the next offset [... truncated: 220 lines follow ...] From korli at mail.berlios.de Sat Nov 8 16:58:07 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 8 Nov 2008 16:58:07 +0100 Subject: [Haiku-commits] r28565 - haiku/trunk/src/apps/stylededit Message-ID: <200811081558.mA8Fw7NE009968@sheep.berlios.de> Author: korli Date: 2008-11-08 16:58:06 +0100 (Sat, 08 Nov 2008) New Revision: 28565 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28565&view=rev Modified: haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp Log: StyledEdit now alerts with "unsupported format" instead of "Bad argument type passed to function" (bug #3071) OpenFile() now returns early when the format is unsupported (don't add the document to recent documents, don't allow to save the document) (bug #3072) Modified: haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp =================================================================== --- haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp 2008-11-08 14:56:56 UTC (rev 28564) +++ haiku/trunk/src/apps/stylededit/StyledEditWindow.cpp 2008-11-08 15:58:06 UTC (rev 28565) @@ -892,7 +892,11 @@ strcpy(name, "???"); BString text("Error loading \""); - text << name << "\":\n\t" << strerror(status); + text << name << "\":\n\t"; + if (status == B_BAD_TYPE) + text << "Unsupported format"; + else + text << strerror(status); _ShowAlert(text, "OK", "", "", B_STOP_ALERT); return status; @@ -924,6 +928,7 @@ if (_LoadFile(ref) != B_OK) { fSaveItem->SetEnabled(true); // allow saving new files + return; } be_roster->AddToRecentDocuments(ref, APP_SIGNATURE); From ingo_weinhold at gmx.de Sat Nov 8 18:01:31 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sat, 08 Nov 2008 18:01:31 +0100 Subject: [Haiku-commits] r28556 - in haiku/trunk/src/tests/system: . runtime_loader runtime_loader/test_suite In-Reply-To: <406308595-BeMail@laptop> References: <406308595-BeMail@laptop> Message-ID: <20081108180131.440.1@knochen-vm.localdomain> On 2008-11-08 at 04:11:16 [+0100], Fran?ois Revol wrote: > > Added a small test suite for the runtime loader. The tests are > > designed > > to succeed on Linux. FreeBSD fails some tests since it seems to have > > a > > different load order (depth-first instead of breadth-first). Haiku > > fails > > a lot of tests due to its POSIX non-compliant dlopen(). > > Btw, I recall needing some LIBRARY_PATH hack in ZETA for zsh, because > dlopen() was actually calling load_add_on()... I hope we don't copy > this bug :) ATM we do, but not for much longer. CU, Ingo From bonefish at mail.berlios.de Sat Nov 8 22:58:07 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 8 Nov 2008 22:58:07 +0100 Subject: [Haiku-commits] r28566 - haiku/trunk/src/tests/system/runtime_loader/test_suite Message-ID: <200811082158.mA8Lw7gV028096@sheep.berlios.de> Author: bonefish Date: 2008-11-08 22:58:06 +0100 (Sat, 08 Nov 2008) New Revision: 28566 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28566&view=rev Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/test_suite Log: Added tests for RTLD_NEXT. Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 2008-11-08 15:58:06 UTC (rev 28565) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 2008-11-08 21:58:06 UTC (rev 28566) @@ -0,0 +1,126 @@ +#!/bin/sh + +# program +# +# dlopen(): +# libe.so +# liba.so +# <- libb.so +# <- libd.so +# +# Expected: dlsym(RTLD_NEXT) finds symbol in order libe.so, liba.so, libb.so, +# libd.so + + +. test_setup + + +# create libd.so +cat > libd.c << EOI +int a() { return 1; } +EOI + +# build +gcc -shared -o libd.so libd.c + + +# create libb.so +cat > libb.c << EOI +#define __USE_GNU +#include +int +a() +{ + int (*nextA)(); + *(void**)&nextA = dlsym(RTLD_NEXT, "a"); + return (nextA != 0 ? nextA() : 0) + 2; +} +EOI + +# build +gcc -shared -o libb.so libb.c -D_GNU_SOURCE ./libd.so $libdl + + +# create liba.so +cat > liba.c << EOI +#include +int +a() +{ + int (*nextA)(); + *(void**)&nextA = dlsym(RTLD_NEXT, "a"); + return (nextA != 0 ? nextA() : 0) + 4; +} +EOI + +# build +gcc -shared -o liba.so liba.c -D_GNU_SOURCE ./libb.so $libdl + + +# create libe.so +cat > libe.c << EOI +#include +int +a() +{ + int (*nextA)(); + *(void**)&nextA = dlsym(RTLD_NEXT, "a"); + return (nextA != 0 ? nextA() : 0) + 8; +} +EOI + +# build +gcc -shared -o libe.so libe.c -D_GNU_SOURCE $libdl + + +# create program +cat > program.c << EOI +#include +#include +#include + +int +a() +{ + int (*nextA)(); + *(void**)&nextA = dlsym(RTLD_NEXT, "a"); + return (nextA != 0 ? nextA() : 0) + 16; +} + +int +main() +{ + void* liba; + void* libe; + void* self; +// int (*a)(); + + libe = dlopen("./libe.so", RTLD_NOW | RTLD_GLOBAL); + if (libe == NULL) { + fprintf(stderr, "Error opening libe.so: %s\n", dlerror()); + exit(117); + } + + liba = dlopen("./liba.so", RTLD_NOW | RTLD_GLOBAL); + if (liba == NULL) { + fprintf(stderr, "Error opening liba.so: %s\n", dlerror()); + exit(117); + } + +/* + a = (int (*)())dlsym(libe, "a"); + if (a == NULL) { + fprintf(stderr, "Error getting symbol a: %s\n", dlerror()); + exit(116); + } +*/ + + return a(); +} +EOI + +# build +gcc -o program program.c -D_GNU_SOURCE $libdl -Xlinker -rpath -Xlinker . + +# run +test_run_ok ./program 31 Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/dlopen_lookup_next1 ___________________________________________________________________ Name: svn:executable + * Added: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 2008-11-08 15:58:06 UTC (rev 28565) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 2008-11-08 21:58:06 UTC (rev 28566) @@ -0,0 +1,81 @@ +#!/bin/sh + +# program +# <- liba.so +# <- libb.so +# <- libd.so +# +# Expected: dlsym(RTLD_NEXT) finds symbol in order liba.so, libb.so, libd.so + + +. test_setup + + +# create libd.so +cat > libd.c << EOI +int a() { return 1; } +EOI + +# build +gcc -shared -o libd.so libd.c + + +# create libb.so +cat > libb.c << EOI +#define __USE_GNU +#include +int +a() +{ + int (*nextA)(); + *(void**)&nextA = dlsym(RTLD_NEXT, "a"); + return (nextA != 0 ? nextA() : 0) + 2; +} +EOI + +# build +gcc -shared -o libb.so libb.c -D_GNU_SOURCE ./libd.so $libdl + + +# create liba.so +cat > liba.c << EOI +#include +int +a() +{ + int (*nextA)(); + *(void**)&nextA = dlsym(RTLD_NEXT, "a"); + return (nextA != 0 ? nextA() : 0) + 4; +} +EOI + +# build +gcc -shared -o liba.so liba.c -D_GNU_SOURCE ./libb.so $libdl + + +# create program +cat > program.c << EOI + +#include +int +a() +{ + int (*nextA)(); + *(void**)&nextA = dlsym(RTLD_NEXT, "a"); + return (nextA != 0 ? nextA() : 0) + 8; +} + +int +main() +{ + return a(); +} +EOI + +# build +gcc -o program program.c -D_GNU_SOURCE ./liba.so $libdl -Xlinker -rpath \ + -Xlinker . + +# run +test_run_ok ./program 15 + Property changes on: haiku/trunk/src/tests/system/runtime_loader/test_suite/load_lookup_next1 ___________________________________________________________________ Name: svn:executable + * Modified: haiku/trunk/src/tests/system/runtime_loader/test_suite/test_suite =================================================================== --- haiku/trunk/src/tests/system/runtime_loader/test_suite/test_suite 2008-11-08 15:58:06 UTC (rev 28565) +++ haiku/trunk/src/tests/system/runtime_loader/test_suite/test_suite 2008-11-08 21:58:06 UTC (rev 28566) @@ -2,6 +2,7 @@ for test in \ load_resolve_basic1 \ + load_lookup_next1 \ load_resolve_order1 \ load_resolve_order2 \ load_resolve_order3 \ @@ -9,6 +10,7 @@ dlopen_resolve_basic1 \ dlopen_resolve_basic2 \ dlopen_resolve_basic3 \ + dlopen_lookup_next1 \ dlopen_lookup_order1 \ dlopen_lookup_order2 \ dlopen_lookup_order3 \ From bonefish at mail.berlios.de Sat Nov 8 23:09:29 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 8 Nov 2008 23:09:29 +0100 Subject: [Haiku-commits] r28567 - in haiku/trunk: headers/private/libroot src/system/libroot/os/arch/m68k src/system/libroot/os/arch/ppc src/system/libroot/os/arch/x86 Message-ID: <200811082209.mA8M9T9p029110@sheep.berlios.de> Author: bonefish Date: 2008-11-08 23:09:28 +0100 (Sat, 08 Nov 2008) New Revision: 28567 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28567&view=rev Added: haiku/trunk/src/system/libroot/os/arch/m68k/stack_frame.c haiku/trunk/src/system/libroot/os/arch/ppc/stack_frame.c Modified: haiku/trunk/headers/private/libroot/libroot_private.h haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile haiku/trunk/src/system/libroot/os/arch/ppc/Jamfile haiku/trunk/src/system/libroot/os/arch/x86/get_stack_frame.S Log: Added __arch_get_caller(). Correctly implemented for x86 only. Modified: haiku/trunk/headers/private/libroot/libroot_private.h =================================================================== --- haiku/trunk/headers/private/libroot/libroot_private.h 2008-11-08 21:58:06 UTC (rev 28566) +++ haiku/trunk/headers/private/libroot/libroot_private.h 2008-11-08 22:09:28 UTC (rev 28567) @@ -37,6 +37,7 @@ bigtime_t __arch_get_system_time_offset(struct real_time_data *data); void __init_pwd_backend(void); void __reinit_pwd_backend_after_fork(void); +void* __arch_get_caller(void); #ifdef __cplusplus Modified: haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile 2008-11-08 21:58:06 UTC (rev 28566) +++ haiku/trunk/src/system/libroot/os/arch/m68k/Jamfile 2008-11-08 22:09:28 UTC (rev 28567) @@ -8,6 +8,7 @@ byteorder.S compatibility.c # only here until the places where those functions are used # are fixed + stack_frame.c # systeminfo.c system_time.c system_time_asm.S Added: haiku/trunk/src/system/libroot/os/arch/m68k/stack_frame.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/m68k/stack_frame.c 2008-11-08 21:58:06 UTC (rev 28566) +++ haiku/trunk/src/system/libroot/os/arch/m68k/stack_frame.c 2008-11-08 22:09:28 UTC (rev 28567) @@ -0,0 +1,24 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. +*/ + +#include + +#include + + +void* +get_stack_frame(void) +{ + // TODO: Implement! + return NULL; +} + + +void* +__arch_get_caller(void) +{ + // TODO: Implement! + return NULL; +} Modified: haiku/trunk/src/system/libroot/os/arch/ppc/Jamfile =================================================================== --- haiku/trunk/src/system/libroot/os/arch/ppc/Jamfile 2008-11-08 21:58:06 UTC (rev 28566) +++ haiku/trunk/src/system/libroot/os/arch/ppc/Jamfile 2008-11-08 22:09:28 UTC (rev 28567) @@ -10,6 +10,7 @@ byteorder.S compatibility.c # only here until the places where those functions are used # are fixed + stack_frame.c # systeminfo.c system_time.c system_time_asm.S Added: haiku/trunk/src/system/libroot/os/arch/ppc/stack_frame.c =================================================================== --- haiku/trunk/src/system/libroot/os/arch/ppc/stack_frame.c 2008-11-08 21:58:06 UTC (rev 28566) +++ haiku/trunk/src/system/libroot/os/arch/ppc/stack_frame.c 2008-11-08 22:09:28 UTC (rev 28567) @@ -0,0 +1,24 @@ +/* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. + * Distributed under the terms of the MIT License. +*/ + +#include + +#include + + +void* +get_stack_frame(void) +{ + // TODO: Implement! + return NULL; +} + + +void* +__arch_get_caller(void) +{ + // TODO: Implement! + return NULL; +} Modified: haiku/trunk/src/system/libroot/os/arch/x86/get_stack_frame.S =================================================================== --- haiku/trunk/src/system/libroot/os/arch/x86/get_stack_frame.S 2008-11-08 21:58:06 UTC (rev 28566) +++ haiku/trunk/src/system/libroot/os/arch/x86/get_stack_frame.S 2008-11-08 22:09:28 UTC (rev 28567) @@ -1,13 +1,21 @@ /* - * Copyright 2005, Ingo Weinhold, bonefish at users.sf.net. All rights reserved. + * Copyright 2005-2008, Ingo Weinhold, ingo_weinhold at gmx.de. * Distributed under the terms of the MIT License. */ #include -/* void *get_stack_frame() */ +/* void* get_stack_frame(void) */ FUNCTION(get_stack_frame): mov %ebp, %eax ret FUNCTION_END(get_stack_frame) + + +/* void* __arch_get_caller(void); */ +FUNCTION(__arch_get_caller): + mov 4(%ebp), %eax + ret +FUNCTION_END(__arch_get_caller) + From anevilyak at gmail.com Sat Nov 8 23:24:32 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sat, 8 Nov 2008 16:24:32 -0600 Subject: [Haiku-commits] r28556 - in haiku/trunk/src/tests/system: . runtime_loader runtime_loader/test_suite In-Reply-To: <200811080204.mA824rxG025078@sheep.berlios.de> References: <200811080204.mA824rxG025078@sheep.berlios.de> Message-ID: On Fri, Nov 7, 2008 at 8:04 PM, bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-11-08 03:04:53 +0100 (Sat, 08 Nov 2008) > New Revision: 28556 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28556&view=rev > > Log: > Added a small test suite for the runtime loader. The tests are designed > to succeed on Linux. FreeBSD fails some tests since it seems to have a > different load order (depth-first instead of breadth-first). Haiku fails > a lot of tests due to its POSIX non-compliant dlopen(). > Pardon if this is a somewhat ignorant question, but what difference does depth-first vs breadth-first make in this context? Is it with respect to symbol searching / overriding in the case of things like weak aliases or.. ? Regards, Rene Rene From revol at free.fr Sat Nov 8 23:29:55 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 08 Nov 2008 23:29:55 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28567_-_in_haiku/trunk=3A_heade?= =?windows-1252?q?rs/private/libroot_src/system/libroot/os/arch/m68k_src/s?= =?windows-1252?q?ystem/libroot/os/arch/ppc__src/system/libroot/os/arch/x8?= =?windows-1252?q?6?= In-Reply-To: <200811082209.mA8M9T9p029110@sheep.berlios.de> Message-ID: <16341950098-BeMail@laptop> > Added __arch_get_caller(). Correctly implemented for x86 only. Hmm I definitely won't get ppc booting for next week when I meet those amigaists... > Added: haiku/trunk/src/system/libroot/os/arch/m68k/stack_frame.c > +void* > +get_stack_frame(void) > +{ > + // TODO: Implement! return __builtin_frame_address (1); > +} > + > + > +void* > +__arch_get_caller(void) > +{ return __builtin_return_address (1); > +} > > Modified: haiku/trunk/src/system/libroot/os/arch/ppc/Jamfile > =================================================================== > Added: haiku/trunk/src/system/libroot/os/arch/ppc/stack_frame.c > +void* > +get_stack_frame(void) > +{ return __builtin_frame_address (1); > +} > + > + > +void* > +__arch_get_caller(void) > +{ return __builtin_return_address (1); > +} cf. http://developer.apple.com/DOCUMENTATION/DeveloperTools/gcc-4.0.1/gcc/Return-Address.html Fran?ois. From revol at free.fr Sat Nov 8 23:44:40 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sat, 08 Nov 2008 23:44:40 +0100 CET Subject: [Haiku-commits] r28567 - in haiku/trunk: headers/private/libroot src/system/libroot/os/arch/m68k src/system/libroot/os/arch/ppc src/system/libroot/os/arch/x86 In-Reply-To: <16341950098-BeMail@laptop> Message-ID: <17226656689-BeMail@laptop> > > Added: haiku/trunk/src/system/libroot/os/arch/m68k/stack_frame.c > > +void* > > +get_stack_frame(void) > > +{ > > + // TODO: Implement! > > return __builtin_frame_address (1); Actually I'm pretty sure I used those already, didn't you dup code somewhere ? Fran?ois. From bonefish at mail.berlios.de Sat Nov 8 23:40:59 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sat, 8 Nov 2008 23:40:59 +0100 Subject: [Haiku-commits] r28568 - in haiku/trunk: headers/posix headers/private/runtime_loader src/system/libroot/os src/system/libroot/posix src/system/runtime_loader Message-ID: <200811082240.mA8Mexau031031@sheep.berlios.de> Author: bonefish Date: 2008-11-08 23:40:56 +0100 (Sat, 08 Nov 2008) New Revision: 28568 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28568&view=rev Modified: haiku/trunk/headers/posix/dlfcn.h haiku/trunk/headers/private/runtime_loader/runtime_loader.h haiku/trunk/src/system/libroot/os/image.cpp haiku/trunk/src/system/libroot/posix/dlfcn.c haiku/trunk/src/system/runtime_loader/elf.cpp haiku/trunk/src/system/runtime_loader/export.c haiku/trunk/src/system/runtime_loader/runtime_loader.c haiku/trunk/src/system/runtime_loader/runtime_loader_private.h Log: * Reworked undefined symbol resolution in the runtime loader. Got rid of the per-root-image breadth-first sorted image array. Instead we have a per-image hook function to resolve the symbols. The default function uses the sLoadedImages list directly, which is breadth-first sorted anyway. There's also a BeOS function for old-style symbol resolution and one for add-ons, which lacks a proper implementation yet (just uses old-style ATM). * Made the dl*() functions POSIX compliant: - dlopen() does no longer use load_add_on(), but loads the object as a library. It also properly supports a NULL name, now -- the previous "_APP_" work-around did only work, if this soname was set on the program (unlikely for programs using this API). - Implemented RTLD_{GLOBAL,LOCAL}. - dlsym() looks up symbols properly now, i.e. not just in the given image, but breadth-first for an actual image or in load order for the global scope. It also supports the not-quite POSIX RTLD_DEFAULT and RTLD_NEXT extensions. Our RTLD_NEXT finds more symbols than in Linux (also in later dlopen()ed libraries), but that should be fine. Modified: haiku/trunk/headers/posix/dlfcn.h =================================================================== --- haiku/trunk/headers/posix/dlfcn.h 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/headers/posix/dlfcn.h 2008-11-08 22:40:56 UTC (rev 28568) @@ -14,6 +14,11 @@ #define RTLD_LOCAL 0 /* symbols are not available for relocating any other object */ #define RTLD_GLOBAL 2 /* all symbols are available */ +/* not-yet-POSIX extensions (dlsym() handles) */ +#define RTLD_DEFAULT ((void*)0) + /* find the symbol in the global scope */ +#define RTLD_NEXT ((void*)-1L) + /* find the next definition of the symbol */ #ifdef __cplusplus extern "C" { Modified: haiku/trunk/headers/private/runtime_loader/runtime_loader.h =================================================================== --- haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/headers/private/runtime_loader/runtime_loader.h 2008-11-08 22:40:56 UTC (rev 28568) @@ -25,8 +25,12 @@ // runtime loader API export image_id (*load_add_on)(char const *path, uint32 flags); status_t (*unload_add_on)(image_id imageID); + image_id (*load_library)(char const *path, uint32 flags, void **_handle); + status_t (*unload_library)(void* handle); status_t (*get_image_symbol)(image_id imageID, char const *symbolName, int32 symbolType, void **_location); + status_t (*get_library_symbol)(void* handle, void* caller, + const char* symbolName, void **_location); status_t (*get_nth_image_symbol)(image_id imageID, int32 num, char *symbolName, int32 *nameLength, int32 *symbolType, void **_location); status_t (*test_executable)(const char *path, char *interpreter); @@ -100,10 +104,9 @@ uint32 num_needed; struct image_t **needed; - // For "root" images (the program, add-ons): Symbols are searched in the - // images in array order. - uint32 symbol_resolution_image_count; - struct image_t **symbol_resolution_images; + struct Elf32_Sym* (*find_undefined_symbol)(struct image_t* rootImage, + struct image_t* image, const char* name, + struct image_t** foundInImage); // Singly-linked list of symbol patchers for symbols defined respectively // referenced by this image. @@ -123,7 +126,6 @@ // image_t::flags #define IMAGE_FLAG_RTLD_MASK 0x03 // RTLD_{LAZY,NOW} | RTLD_{LOCAL,GLOBAL} -#define IMAGE_FLAG_R5_SYMBOL_RESOLUTION 0x04 #define STRING(image, offset) ((char *)(&(image)->strtab[(offset)])) #define SYMNAME(image, sym) STRING(image, (sym)->st_name) Modified: haiku/trunk/src/system/libroot/os/image.cpp =================================================================== --- haiku/trunk/src/system/libroot/os/image.cpp 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/src/system/libroot/os/image.cpp 2008-11-08 22:40:56 UTC (rev 28568) @@ -66,6 +66,9 @@ image_id load_add_on(char const *name) { + if (name == NULL) + return B_BAD_VALUE; + return __gRuntimeLoader->load_add_on(name, 0); } Modified: haiku/trunk/src/system/libroot/posix/dlfcn.c =================================================================== --- haiku/trunk/src/system/libroot/posix/dlfcn.c 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/src/system/libroot/posix/dlfcn.c 2008-11-08 22:40:56 UTC (rev 28568) @@ -1,4 +1,5 @@ /* + * Copyright 2008, Ingo Weinhold, ingo_weinhold at gmx.de. * Copyright 2003-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. * @@ -23,31 +24,27 @@ void * dlopen(char const *name, int mode) { -// TODO: According to the standard multiple dlopen() invocations for the same -// file will cause the object to be loaded once only. That is we should load -// the object as a library, not an add-on. - status_t status; + void* handle; + image_id imageID = __gRuntimeLoader->load_library(name, mode, &handle); - if (name == NULL) - name = MAGIC_APP_NAME; + sStatus = imageID >= 0 ? B_OK : imageID; - status = __gRuntimeLoader->load_add_on(name, mode); - sStatus = status; - - if (status < B_OK) - return NULL; - - return (void *)status; + return imageID >= 0 ? handle : NULL; } void * dlsym(void *handle, char const *name) { + void* location; status_t status; - void *location; + void* caller = NULL; - status = get_image_symbol((image_id)handle, name, B_SYMBOL_TYPE_ANY, &location); + if (handle == RTLD_NEXT) + caller = __arch_get_caller(); + + status = __gRuntimeLoader->get_library_symbol(handle, caller, name, + &location); sStatus = status; if (status < B_OK) @@ -60,7 +57,7 @@ int dlclose(void *handle) { - return unload_add_on((image_id)handle); + return __gRuntimeLoader->unload_library(handle); } @@ -77,6 +74,8 @@ int dladdr(void *addr, Dl_info *info) { +// TODO: This can be implemented more efficiently in the runtime loader. +// get_library_symbol() already has the code doing that. char curSymName[NAME_MAX]; static char symName[NAME_MAX]; static char imageName[MAXPATHLEN]; Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-08 22:40:56 UTC (rev 28568) @@ -11,6 +11,7 @@ #include "runtime_loader_private.h" #include +#include #include #include #include @@ -49,10 +50,15 @@ #define RLD_PROGRAM_BASE 0x00200000 /* keep in sync with app ldscript */ +// a handle returned by load_library() (dlopen()) +#define RLD_GLOBAL_SCOPE ((void*)-2l) + enum { - RFLAG_RW = 0x0001, - RFLAG_ANON = 0x0002, + // the lower two bits are reserved for RTLD_NOW and RTLD_GLOBAL + RFLAG_RW = 0x0010, + RFLAG_ANON = 0x0020, + RFLAG_TERMINATED = 0x0200, RFLAG_INITIALIZED = 0x0400, RFLAG_SYMBOLIC = 0x0800, @@ -61,7 +67,8 @@ RFLAG_DEPENDENCIES_LOADED = 0x4000, RFLAG_REMAPPED = 0x8000, - RFLAG_VISITED = 0x10000 + RFLAG_VISITED = 0x10000, + RFLAG_USE_FOR_RESOLVING = 0x20000 // temporarily set in the symbol resolution code }; @@ -501,7 +508,6 @@ memset(image->needed, 0xa5, sizeof(image->needed[0]) * image->num_needed); #endif free(image->needed); - free(image->symbol_resolution_images); while (RuntimeLoaderSymbolPatcher* patcher = image->defined_symbol_patchers) { @@ -535,6 +541,52 @@ } +static void +update_image_flags_recursively(image_t* image, uint32 flagsToSet, + uint32 flagsToClear) +{ + image_t* queue[sLoadedImageCount]; + uint32 count = 0; + uint32 index = 0; + queue[count++] = image; + image->flags |= RFLAG_VISITED; + + while (index < count) { + // pop next image + image = queue[index++]; + + // push dependencies + for (uint32 i = 0; i < image->num_needed; i++) { + image_t* needed = image->needed[i]; + if ((needed->flags & RFLAG_VISITED) == 0) { + queue[count++] = needed; + needed->flags |= RFLAG_VISITED; + } + } + } + + // update flags + for (uint32 i = 0; i < count; i++) { + queue[i]->flags = (queue[i]->flags | flagsToSet) + & ~(flagsToClear | RFLAG_VISITED); + } +} + + +static void +set_image_flags_recursively(image_t* image, uint32 flags) +{ + update_image_flags_recursively(image, flags, 0); +} + + +static void +clear_image_flags_recursively(image_t* image, uint32 flags) +{ + update_image_flags_recursively(image, 0, flags); +} + + static status_t parse_program_headers(image_t *image, char *buff, int phnum, int phentsize) { @@ -1183,36 +1235,48 @@ } -static struct Elf32_Sym* -find_symbol_in_root_image_list(image_t* rootImage, const char* name, - image_t** foundInImage) +static status_t +find_symbol_breadth_first(image_t* image, const char* name, int32 type, + image_t** _foundInImage, void** _location) { - int32 count = rootImage->symbol_resolution_image_count; - image_t** images = rootImage->symbol_resolution_images; - for (int32 i = 0; i < count; i++) { - image_t* image = images[i]; - if (image->dynamic_ptr) { - Elf32_Sym* symbol = find_symbol(image, name, B_SYMBOL_TYPE_ANY); - if (symbol) { - *foundInImage = image; - return symbol; + image_t* queue[sLoadedImageCount]; + uint32 count = 0; + uint32 index = 0; + queue[count++] = image; + image->flags |= RFLAG_VISITED; + + bool found = false; + while (index < count) { + // pop next image + image = queue[index++]; + + if (find_symbol(image, name, type, _location) == B_OK) { + found = true; + break; + } + + // push needed images + for (uint32 i = 0; i < image->num_needed; i++) { + image_t* needed = image->needed[i]; + if ((needed->flags & RFLAG_VISITED) == 0) { + queue[count++] = needed; + needed->flags |= RFLAG_VISITED; } } } - return NULL; + // clear visited flags + for (uint32 i = 0; i < count; i++) + queue[i]->flags &= ~RFLAG_VISITED; + + return found ? B_OK : B_ENTRY_NOT_FOUND; } static struct Elf32_Sym* -find_undefined_symbol(image_t* rootImage, image_t* image, const char* name, +find_undefined_symbol_beos(image_t* rootImage, image_t* image, const char* name, image_t** foundInImage) { - // If not simulating BeOS style symbol resolution, undefined symbols are - // searched recursively starting from the root image. - if ((rootImage->flags & IMAGE_FLAG_R5_SYMBOL_RESOLUTION) == 0) - return find_symbol_in_root_image_list(rootImage, name, foundInImage); - // BeOS style symbol resolution: It is sufficient to check the direct // dependencies. The linker would have complained, if the symbol wasn't // there. @@ -1231,6 +1295,48 @@ } +static struct Elf32_Sym* +find_undefined_symbol_global(image_t* rootImage, image_t* image, + const char* name, image_t** foundInImage) +{ + // Global load order symbol resolution: All loaded images are searched for + // the symbol in the order they have been loaded. We skip add-on images and + // RTLD_LOCAL images though. + image_t* otherImage = sLoadedImages.head; + while (otherImage != NULL) { + if (otherImage == rootImage + || otherImage->type != B_ADD_ON_IMAGE + && (otherImage->flags + & (RTLD_GLOBAL | RFLAG_USE_FOR_RESOLVING)) != 0) { + struct Elf32_Sym *symbol = find_symbol(otherImage, name, + B_SYMBOL_TYPE_ANY); + if (symbol) { + *foundInImage = otherImage; + return symbol; + } + } + otherImage = otherImage->next; + } + + return NULL; +} + + +static struct Elf32_Sym* +find_undefined_symbol_add_on(image_t* rootImage, image_t* image, + const char* name, image_t** foundInImage) +{ +// TODO: How do we want to implement this one? Using global scope resolution +// might be undesired as it is now, since libraries could refer to symbols in +// the add-on, which would result in add-on symbols implicitely becoming used +// outside of the add-on. So the options would be to use the global scope but +// skip the add-on, or to do breadth-first resolution in the add-on dependency +// scope, also skipping the add-on itself. BeOS style resolution is safe, too, +// but we miss out features like undefined symbols and preloading. + return find_undefined_symbol_beos(rootImage, image, name, foundInImage); +} + + /*! This function is called when we run BeOS images on Haiku. It allows us to redirect functions to ensure compatibility. */ @@ -1289,8 +1395,8 @@ type = B_SYMBOL_TYPE_DATA; // it's undefined, must be outside this image, try the other images - sharedSym = find_undefined_symbol(rootImage, image, symName, - &sharedImage); + sharedSym = rootImage->find_undefined_symbol(rootImage, image, + symName, &sharedImage); void* location = NULL; enum { @@ -1447,7 +1553,8 @@ static status_t -load_container(char const *name, image_type type, const char *rpath, image_t **_image) +load_container(char const *name, image_type type, const char *rpath, + image_t **_image) { int32 pheaderSize, sheaderSize; char path[PATH_MAX]; @@ -1593,7 +1700,7 @@ // unavailable) if (image->gcc_version.major == 0 || image->gcc_version.major == 2 && image->gcc_version.middle < 95) { - image->flags |= IMAGE_FLAG_R5_SYMBOL_RESOLUTION; + image->find_undefined_symbol = find_undefined_symbol_beos; } status = map_image(fd, path, image, type == B_APP_IMAGE); @@ -1659,7 +1766,7 @@ static status_t -load_dependencies(image_t *image) +load_immediate_dependencies(image_t *image) { struct Elf32_Dyn *d = (struct Elf32_Dyn *)image->dynamic_ptr; bool reportErrors = report_errors(); @@ -1748,6 +1855,20 @@ } +static status_t +load_dependencies(image_t* image) +{ + for (image_t* otherImage = image; otherImage != NULL; + otherImage = otherImage->next) { + status_t status = load_immediate_dependencies(otherImage); + if (status != B_OK) + return status; + } + + return B_OK; +} + + static uint32 topological_sort(image_t *image, uint32 slot, image_t **initList, uint32 sortFlag) @@ -1766,36 +1887,6 @@ } -static uint32 -topological_sort_breadth_first(image_t* image, image_t** list, uint32 sortFlag) -{ - if ((image->flags & sortFlag) != 0) - return 0; - - // We directly use the result list as queue for the breadth first search. - list[0] = image; - image->flags |= sortFlag; - - int32 index = 0; - int32 count = 1; - - while (index < count) { - image = list[index++]; - - for (uint32 i = 0; i < image->num_needed; i++) { - image_t* neededImage = image->needed[i]; - if ((neededImage->flags & sortFlag) == 0) { - // dependency not yet visited -- add to queue - list[count++] = neededImage; - neededImage->flags |= sortFlag; - } - } - } - - return count; -} - - static ssize_t get_sorted_image_list(image_t *image, image_t ***_list, uint32 sortFlag) { @@ -1815,84 +1906,22 @@ } -static ssize_t -get_sorted_image_list_breadth_first(image_t* image, image_t*** _list, - uint32 sortFlag) -{ - image_t** list = (image_t**)malloc(sLoadedImageCount * sizeof(image_t*)); - if (list == NULL) { - FATAL("memory shortage in get_sorted_image_list()"); - *_list = NULL; - return B_NO_MEMORY; - } - - memset(list, 0, sLoadedImageCount * sizeof(image_t *)); - - *_list = list; - - return topological_sort_breadth_first(image, list, sortFlag); -} - - static status_t relocate_dependencies(image_t *image) { - // build an array of images in the order we want to lookup symbols - image_t** lookupList; - ssize_t lookupCount = get_sorted_image_list_breadth_first(image, - &lookupList, RFLAG_VISITED); - if (lookupCount < 0) - return lookupCount; - - // If the image is not the program image, add it and its dependencies, too. - if (sProgramImage != NULL && image != sProgramImage) { - lookupCount += topological_sort_breadth_first(sProgramImage, - lookupList + lookupCount, RFLAG_VISITED); - } - - // If we have pre-loaded images, prepend them. - if (sPreloadedImageCount > 0) { - // Count the ones that have to be added -- normally all, but one never - // knows. - uint32 preloadedCount = 0; - for (uint32 i = 0; i < sPreloadedImageCount; i++) { - image_t* preloadedImage = sPreloadedImages[i]; - if ((preloadedImage->flags & RFLAG_VISITED) == 0) - preloadedCount++; - } - - // add them - if (preloadedCount > 0) { - memmove(lookupList + preloadedCount, lookupList, - lookupCount * sizeof(image_t*)); - lookupCount += preloadedCount; - - preloadedCount = 0; - for (uint32 i = 0; i < sPreloadedImageCount; i++) { - image_t* preloadedImage = sPreloadedImages[i]; - if ((preloadedImage->flags & RFLAG_VISITED) == 0) - lookupList[preloadedCount++] = preloadedImage; - } - } - } - - // clear the "visited" flag - for (int32 i = 0; i < lookupCount; i++) - lookupList[i]->flags &= ~RFLAG_VISITED; - - image->symbol_resolution_images = lookupList; - image->symbol_resolution_image_count = lookupCount; - // get the images that still have to be relocated image_t **list; ssize_t count = get_sorted_image_list(image, &list, RFLAG_RELOCATED); if (count < B_OK) return count; + // relocate for (ssize_t i = 0; i < count; i++) { status_t status = relocate_image(image, list[i]); - if (status < B_OK) + if (status < B_OK) { + free(list); return status; + } } free(list); @@ -1959,12 +1988,10 @@ // We patch any exported __gRuntimeLoader symbols to point to our private // API. image_t* image; - Elf32_Sym* symbol = find_symbol_in_root_image_list(rootImage, - "__gRuntimeLoader", &image); - - if (symbol != NULL) { - void** _export = (void**)(symbol->st_value + image->regions[0].delta); - *_export = &gRuntimeLoader; + void* _export; + if (find_symbol_breadth_first(rootImage, "__gRuntimeLoader", + B_SYMBOL_TYPE_DATA, &image, &_export) == B_OK) { + *(void**)_export = &gRuntimeLoader; } } @@ -2003,13 +2030,15 @@ return status; } - for (image_t* otherImage = sLoadedImages.head; otherImage != NULL; - otherImage = otherImage->next) { - status = load_dependencies(otherImage); - if (status < B_OK) - goto err; - } + if (image->find_undefined_symbol == NULL) + image->find_undefined_symbol = find_undefined_symbol_global; + status = load_dependencies(image); + if (status < B_OK) + goto err; + + set_image_flags_recursively(image, RTLD_GLOBAL); + status = relocate_dependencies(image); if (status < B_OK) goto err; @@ -2105,12 +2134,18 @@ if (status < B_OK) goto err; - for (image = sLoadedImages.head; image != NULL; image = image->next) { - status = load_dependencies(image); - if (status < B_OK) - goto err; - } + if (sProgramImage->find_undefined_symbol == NULL) + sProgramImage->find_undefined_symbol = find_undefined_symbol_global; + status = load_dependencies(sProgramImage); + if (status < B_OK) + goto err; + + // Set RTLD_GLOBAL on all libraries, but clear it on the program image. + // This results in the desired symbol resolution for dlopen()ed libraries. + set_image_flags_recursively(sProgramImage, RTLD_GLOBAL); + sProgramImage->flags &= ~RTLD_GLOBAL; + status = relocate_dependencies(sProgramImage); if (status < B_OK) goto err; @@ -2122,15 +2157,9 @@ // Since the images are initialized now, we no longer should use our // getenv(), but use the one from libroot.so - { - struct Elf32_Sym *symbol = find_symbol_in_root_image_list(sProgramImage, - "getenv", &image); + find_symbol_breadth_first(sProgramImage, "getenv", B_SYMBOL_TYPE_TEXT, + &image, (void**)&gGetEnv); - if (symbol != NULL) - gGetEnv = (char* (*)(const char*)) - (symbol->st_value + image->regions[0].delta); - } - if (sProgramImage->entry_point == 0) { status = B_NOT_AN_EXECUTABLE; goto err; @@ -2169,19 +2198,15 @@ image_id -load_library(char const *path, uint32 flags, bool addOn) +load_library(char const *path, uint32 flags, bool addOn, void** _handle) { image_t *image = NULL; - image_t *iter; image_type type = (addOn ? B_ADD_ON_IMAGE : B_LIBRARY_IMAGE); status_t status; - if (path == NULL) + if (path == NULL && addOn) return B_BAD_VALUE; - // ToDo: implement flags - (void)flags; - KTRACE("rld: load_library(\"%s\", 0x%lx, %d)", path, flags, addOn); rld_lock(); @@ -2190,12 +2215,23 @@ // have we already loaded this library? // Checking it at this stage saves loading its dependencies again if (!addOn) { + // a NULL path is fine -- it means the global scope shall be opened + if (path == NULL) { + *_handle = RLD_GLOBAL_SCOPE; + rld_unlock(); + return 0; + } + image = find_image(path, APP_OR_LIBRARY_TYPE); + if (image != NULL && (flags & RTLD_GLOBAL) != 0) + set_image_flags_recursively(image, RTLD_GLOBAL); + if (image) { atomic_add(&image->ref_count, 1); rld_unlock(); KTRACE("rld: load_library(\"%s\"): already loaded: %ld", path, image->id); + *_handle = image; return image->id; } } @@ -2208,16 +2244,33 @@ return status; } - for (iter = sLoadedImages.head; iter; iter = iter->next) { - status = load_dependencies(iter); - if (status < B_OK) - goto err; + if (image->find_undefined_symbol == NULL) { + if (addOn) + image->find_undefined_symbol = find_undefined_symbol_add_on; + else + image->find_undefined_symbol = find_undefined_symbol_global; } + status = load_dependencies(image); + if (status < B_OK) + goto err; + + // If specified, set the RTLD_GLOBAL flag recursively on this image and all + // dependencies. If not specified, we temporarily set + // RFLAG_USE_FOR_RESOLVING so that the dependencies will correctly be used + // for undefined symbol resolution. + if ((flags & RTLD_GLOBAL) != 0) + set_image_flags_recursively(image, RTLD_GLOBAL); + else + set_image_flags_recursively(image, RFLAG_USE_FOR_RESOLVING); + status = relocate_dependencies(image); if (status < B_OK) goto err; + if ((flags & RTLD_GLOBAL) == 0) + clear_image_flags_recursively(image, RFLAG_USE_FOR_RESOLVING); + remap_images(); init_dependencies(image, true); @@ -2225,6 +2278,7 @@ KTRACE("rld: load_library(\"%s\") done: id: %ld", path, image->id); + *_handle = image; return image->id; err: @@ -2239,15 +2293,18 @@ status_t -unload_library(image_id imageID, bool addOn) +unload_library(void* handle, image_id imageID, bool addOn) { status_t status = B_BAD_IMAGE_ID; image_t *image; image_type type = addOn ? B_ADD_ON_IMAGE : B_LIBRARY_IMAGE; - if (imageID < B_OK) + if (handle == NULL && imageID < 0) return B_BAD_IMAGE_ID; + if (handle == RLD_GLOBAL_SCOPE) + return B_OK; + rld_lock(); // for now, just do stupid simple global locking @@ -2258,15 +2315,20 @@ // we only check images that have been already initialized - for (image = sLoadedImages.head; image; image = image->next) { - if (image->id == imageID) { - // unload image - if (type == image->type) { - put_image(image); - status = B_OK; - } else - status = B_BAD_VALUE; - break; + if (handle != NULL) { + image = (image_t*)handle; + put_image(image); + } else { + for (image = sLoadedImages.head; image; image = image->next) { + if (image->id == imageID) { + // unload image + if (type == image->type) { + put_image(image); + status = B_OK; + } else + status = B_BAD_VALUE; + break; + } } } @@ -2384,6 +2446,115 @@ status_t +get_library_symbol(void* handle, void* caller, const char* symbolName, + void **_location) +{ + status_t status = B_ENTRY_NOT_FOUND; + + if (symbolName == NULL) + return B_BAD_VALUE; + + rld_lock(); + // for now, just do stupid simple global locking + + if (handle == RTLD_DEFAULT || handle == RLD_GLOBAL_SCOPE) { + // look in the default scope + image_t* image; + Elf32_Sym* symbol = find_undefined_symbol_global(sProgramImage, + sProgramImage, symbolName, &image); + if (symbol != NULL) { + *_location = (void*)(symbol->st_value + image->regions[0].delta); + int32 symbolType = ELF32_ST_TYPE(symbol->st_info) == STT_FUNC + ? B_SYMBOL_TYPE_TEXT : B_SYMBOL_TYPE_DATA; + patch_defined_symbol(image, symbolName, _location, &symbolType); + status = B_OK; + } + } else if (handle == RTLD_NEXT) { + // Look in the default scope, but also in the dependencies of the + // calling image. Return the next after the caller symbol. + + // First of all, find the caller symbol and its image. + Elf32_Sym* callerSymbol = NULL; + image_t* callerImage = sLoadedImages.head; + for (; callerImage != NULL; callerImage = callerImage->next) { + elf_region_t& text = callerImage->regions[0]; + if ((addr_t)caller < text.vmstart + || (addr_t)caller >= text.vmstart + text.vmsize) { + continue; + } + + // found the image -- now find the symbol + for (uint32 i = 0; i < callerImage->symhash[1]; i++) { + Elf32_Sym& symbol = callerImage->syms[i]; + if ((ELF32_ST_TYPE(symbol.st_info) != STT_FUNC) + || symbol.st_value == 0) { + continue; + } + + addr_t address = symbol.st_value + + callerImage->regions[0].delta; + if ((addr_t)caller >= address + && (addr_t)caller < address + symbol.st_size) { + callerSymbol = &symbol; + break; + } + } + + break; + } + + if (callerSymbol != NULL) { + // found the caller -- now search the global scope until we find + // the next symbol + set_image_flags_recursively(callerImage, RFLAG_USE_FOR_RESOLVING); + + image_t* image = sLoadedImages.head; + for (; image != NULL; image = image->next) { + if (image != callerImage + && (image->type == B_ADD_ON_IMAGE + || (image->flags + & (RTLD_GLOBAL | RFLAG_USE_FOR_RESOLVING)) == 0)) { + continue; + } + + struct Elf32_Sym *symbol = find_symbol(image, symbolName, + B_SYMBOL_TYPE_TEXT); + if (symbol == NULL) + continue; + + if (callerSymbol == NULL) { + // already skipped the caller symbol -- so this is + // the one we're looking for + *_location = (void*)(symbol->st_value + + image->regions[0].delta); + int32 symbolType = B_SYMBOL_TYPE_TEXT; + patch_defined_symbol(image, symbolName, _location, + &symbolType); + status = B_OK; + break; + } + if (symbol == callerSymbol) { + // found the caller symbol + callerSymbol = NULL; + } + } + + clear_image_flags_recursively(callerImage, RFLAG_USE_FOR_RESOLVING); + } + + } else { + // breadth-first search in the given image and its dependencies + image_t* inImage; + status = find_symbol_breadth_first((image_t*)handle, symbolName, + B_SYMBOL_TYPE_ANY, &inImage, _location); + } + + rld_unlock(); + return status; +} + + +status_t get_next_image_dependency(image_id id, uint32 *cookie, const char **_name) { uint32 i, j, searchIndex = *cookie; Modified: haiku/trunk/src/system/runtime_loader/export.c =================================================================== --- haiku/trunk/src/system/runtime_loader/export.c 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/src/system/runtime_loader/export.c 2008-11-08 22:40:56 UTC (rev 28568) @@ -16,22 +16,40 @@ static image_id export_load_add_on(char const *name, uint32 flags) { - return load_library(name, flags, true); + void* handle; + return load_library(name, flags, true, &handle); } static status_t export_unload_add_on(image_id id) { - return unload_library(id, true); + return unload_library(NULL, id, true); } +static image_id +export_load_library(char const *name, uint32 flags, void **_handle) +{ + return load_library(name, flags, false, _handle); +} + + +static status_t +export_unload_library(void* handle) +{ + return unload_library(handle, -1, false); +} + + struct rld_export gRuntimeLoader = { // dynamic loading support API export_load_add_on, export_unload_add_on, + export_load_library, + export_unload_library, get_symbol, + get_library_symbol, get_nth_symbol, test_executable, get_next_image_dependency, Modified: haiku/trunk/src/system/runtime_loader/runtime_loader.c =================================================================== --- haiku/trunk/src/system/runtime_loader/runtime_loader.c 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/src/system/runtime_loader/runtime_loader.c 2008-11-08 22:40:56 UTC (rev 28568) @@ -240,8 +240,22 @@ memmove(name, paths, strlen(paths) + 1); } - // first try rpath (DT_RPATH) - if (rpath) { + // let's evaluate the system path variables to find the container + paths = search_path_for_type(type); + if (paths) { + fd = search_executable_in_path_list(name, paths, strlen(paths), + programPath, compatibilitySubDir, buffer, sizeof(buffer)); + + // If not found and a compatibility sub directory has been + // specified, look again in the standard search paths. + if (fd == B_ENTRY_NOT_FOUND && compatibilitySubDir != NULL) { + fd = search_executable_in_path_list(name, paths, strlen(paths), + programPath, NULL, buffer, sizeof(buffer)); + } + } + + // try rpath (DT_RPATH), if not found yet + if (fd < 0 && rpath != NULL) { // It consists of a colon-separated search path list. Optionally it // follows a second search path list, separated from the first by a // semicolon. @@ -260,22 +274,6 @@ } } - // let's evaluate the system path variables to find the container - if (fd < 0) { - paths = search_path_for_type(type); - if (paths) { - fd = search_executable_in_path_list(name, paths, strlen(paths), - programPath, compatibilitySubDir, buffer, sizeof(buffer)); - - // If not found and a compatibility sub directory has been - // specified, look again in the standard search paths. - if (fd == B_ENTRY_NOT_FOUND && compatibilitySubDir != NULL) { - fd = search_executable_in_path_list(name, paths, strlen(paths), - programPath, NULL, buffer, sizeof(buffer)); - } - } - } - if (fd >= 0) { // we found it, copy path! TRACE(("runtime_loader: open_executable(%s): found at %s\n", name, buffer)); Modified: haiku/trunk/src/system/runtime_loader/runtime_loader_private.h =================================================================== --- haiku/trunk/src/system/runtime_loader/runtime_loader_private.h 2008-11-08 22:09:28 UTC (rev 28567) +++ haiku/trunk/src/system/runtime_loader/runtime_loader_private.h 2008-11-08 22:40:56 UTC (rev 28568) @@ -29,12 +29,15 @@ void terminate_program(void); image_id load_program(char const *path, void **entry); -status_t unload_library(image_id imageID, bool addOn); -image_id load_library(char const *path, uint32 flags, bool addOn); [... truncated: 13 lines follow ...] From korli at mail.berlios.de Sat Nov 8 23:41:21 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 8 Nov 2008 23:41:21 +0100 Subject: [Haiku-commits] r28569 - haiku/trunk/src/apps/soundrecorder Message-ID: <200811082241.mA8MfLLs031073@sheep.berlios.de> Author: korli Date: 2008-11-08 23:41:20 +0100 (Sat, 08 Nov 2008) New Revision: 28569 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28569&view=rev Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp Log: resets fPlayFile once deleted Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-08 22:40:56 UTC (rev 28568) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-08 22:41:20 UTC (rev 28569) @@ -1009,12 +1009,14 @@ return; } - if (fPlayTrack && fPlayFile) + if (fPlayTrack && fPlayFile) { fPlayFile->ReleaseTrack(fPlayTrack); - if (fPlayFile) + fPlayTrack = NULL; + } + if (fPlayFile) { delete fPlayFile; - fPlayTrack = NULL; - fPlayFile = NULL; + fPlayFile = NULL; + } status_t err; BEntry& entry = pItem->Entry(); @@ -1024,6 +1026,7 @@ if ((err = fPlayFile->InitCheck()) < B_OK) { ErrorAlert("get the file to play", err); delete fPlayFile; + fPlayFile = NULL; return; } From stippi at mail.berlios.de Sat Nov 8 23:47:55 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 8 Nov 2008 23:47:55 +0100 Subject: [Haiku-commits] r28570 - haiku/trunk/build/jam Message-ID: <200811082247.mA8MltVS031468@sheep.berlios.de> Author: stippi Date: 2008-11-08 23:47:53 +0100 (Sat, 08 Nov 2008) New Revision: 28570 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28570&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: * Copy the FreeType headers to the 3rdparty headers. (Tested with WonderBrush source and it works fine.) * Updated WonderBrush package. The new version is compiled on Haiku and improves the installation of the document mimetype (finally a more reliable sniffer rule, thanks to Francois for helping me with this). The About window is fixed to no longer use a hardcoded font file path. This version only runs on Haiku, but it is fully unlocked! Next version with new features won't be. Also comes with a new vector icon for the native document type. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-08 22:41:20 UTC (rev 28569) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-08 22:47:53 UTC (rev 28570) @@ -171,8 +171,7 @@ # Development -if [ IsOptionalHaikuImagePackageAdded Development ] - && $(TARGET_ARCH) = x86 { +if [ IsOptionalHaikuImagePackageAdded Development ] && $(TARGET_ARCH) = x86 { # glue code AddFilesToHaikuImage develop lib x86 : crti.o crtn.o @@ -213,6 +212,7 @@ # TODO: Change BEINCLUDES and gcc to refer to 3rdparty rather than gnu. # third party libs headers + AddHeaderDirectoryToHaikuImage libs freetype2 : 3rdparty ; AddHeaderDirectoryToHaikuImage libs ncurses : 3rdparty ; AddHeaderDirectoryToHaikuImage libs png : 3rdparty ; AddHeaderDirectoryToHaikuImage libs zlib : 3rdparty ; @@ -493,8 +493,9 @@ } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { Echo "No optional package WonderBrush available for gcc4" ; } else { - InstallOptionalHaikuImagePackage WonderBrush - : http://www.yellowbites.com/downloads/WonderBrush-2.1.1-demo-x86-R5.zip + local baseURL = ttp://www.yellowbites.com/downloads ; + InstallOptionalHaikuImagePackage WonderBrush-2.1.2-Haiku + : $(baseURL)/WonderBrush-2.1.2-gcc2-x86-Haiku.zip : apps ; AddSymlinkToHaikuImage home config be Applications From anevilyak at mail.berlios.de Sat Nov 8 23:59:22 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 8 Nov 2008 23:59:22 +0100 Subject: [Haiku-commits] r28571 - haiku/trunk/src/kits/interface Message-ID: <200811082259.mA8MxM8Y032032@sheep.berlios.de> Author: anevilyak Date: 2008-11-08 23:59:22 +0100 (Sat, 08 Nov 2008) New Revision: 28571 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28571&view=rev Modified: haiku/trunk/src/kits/interface/Shelf.cpp Log: When previously fixing shelf scripting for BSnow, I accidentally broke nested specifiers (i.e. Get ID of Replicant). This should fix ticket #3087. Modified: haiku/trunk/src/kits/interface/Shelf.cpp =================================================================== --- haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-08 22:47:53 UTC (rev 28570) +++ haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-08 22:59:22 UTC (rev 28571) @@ -575,17 +575,17 @@ if (err == B_OK ) repMessage = ReplicantAt(i, &replicant, &ID, &err); if (err == B_OK && replicant) { + msg->PopSpecifier(); BMessage archive; err = replicant->Archive(&archive); - if (err == B_OK) + if (err == B_OK && msg->GetCurrentSpecifier(&index, &specifier, &what, &prop) != B_OK) { err = replyMsg.AddMessage("result", &archive); - break; + break; + } // now handles the replicant suite err = B_BAD_SCRIPT_SYNTAX; if (msg->what != B_GET_PROPERTY) break; - if (msg->GetCurrentSpecifier(&index, &specifier, &what, &prop) != B_OK) - break; if (strcmp(prop, "ID") == 0) { err = replyMsg.AddInt32("result", ID); } else if (strcmp(prop, "Name") == 0) { From ingo_weinhold at gmx.de Sun Nov 9 00:00:12 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 09 Nov 2008 00:00:12 +0100 Subject: [Haiku-commits] r28556 - in haiku/trunk/src/tests/system: . runtime_loader runtime_loader/test_suite In-Reply-To: References: <200811080204.mA824rxG025078@sheep.berlios.de> Message-ID: <20081109000012.659.3@knochen-vm.localdomain> On 2008-11-08 at 23:24:32 [+0100], Rene Gollent wrote: > On Fri, Nov 7, 2008 at 8:04 PM, bonefish at BerliOS > wrote: > > Author: bonefish > > Date: 2008-11-08 03:04:53 +0100 (Sat, 08 Nov 2008) > > New Revision: 28556 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28556&view=rev > > > > Log: > > Added a small test suite for the runtime loader. The tests are designed > > to succeed on Linux. FreeBSD fails some tests since it seems to have a > > different load order (depth-first instead of breadth-first). Haiku fails > > a lot of tests due to its POSIX non-compliant dlopen(). > > > > Pardon if this is a somewhat ignorant question, but what difference > does depth-first vs breadth-first make in this context? Is it with > respect to symbol searching / overriding in the case of things like > weak aliases or.. ? Yep, the load order is mainly relevant for resolving undefined symbols or looking symbols up in the global scope (dlsym(dlopen(NULL, 0), "symbolName")), and pretty much only when several images define the same symbol. I might have been mistaken with FreeBSD using a depth-first load order. It looks more like they just don't implement dlopen(NULL, 0) correctly. CU, Ingo From ingo_weinhold at gmx.de Sun Nov 9 00:06:29 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 09 Nov 2008 00:06:29 +0100 Subject: [Haiku-commits] r28567 - in haiku/trunk: headers/private/libroot src/system/libroot/os/arch/m68k src/system/libroot/os/arch/ppc src/system/libroot/os/arch/x86 In-Reply-To: <17226656689-BeMail@laptop> References: <17226656689-BeMail@laptop> Message-ID: <20081109000629.692.4@knochen-vm.localdomain> On 2008-11-08 at 23:44:40 [+0100], Fran?ois Revol wrote: > > > Added: haiku/trunk/src/system/libroot/os/arch/m68k/stack_frame.c > > > +void* > > > +get_stack_frame(void) > > > +{ > > > + // TODO: Implement! > > > > return __builtin_frame_address (1); Nice, didn't know those. > Actually I'm pretty sure I used those already, didn't you dup code > somewhere ? There's an arch_debug_get_caller() in the kernel. The PPC function is unimplemented and the m68k function looks like you tried different __builtin_frame_address() invocations and then implemented it differently altogether. So I rather left the libroot functions unimplemented. CU, Ingo From stippi at mail.berlios.de Sun Nov 9 00:07:17 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 9 Nov 2008 00:07:17 +0100 Subject: [Haiku-commits] r28572 - haiku/trunk/build/jam Message-ID: <200811082307.mA8N7H9m032505@sheep.berlios.de> Author: stippi Date: 2008-11-09 00:07:16 +0100 (Sun, 09 Nov 2008) New Revision: 28572 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28572&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Ugh! Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-08 22:59:22 UTC (rev 28571) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-08 23:07:16 UTC (rev 28572) @@ -493,7 +493,7 @@ } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { Echo "No optional package WonderBrush available for gcc4" ; } else { - local baseURL = ttp://www.yellowbites.com/downloads ; + local baseURL = http://www.yellowbites.com/downloads ; InstallOptionalHaikuImagePackage WonderBrush-2.1.2-Haiku : $(baseURL)/WonderBrush-2.1.2-gcc2-x86-Haiku.zip : apps From revol at free.fr Sun Nov 9 00:11:56 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sun, 09 Nov 2008 00:11:56 +0100 CET Subject: [Haiku-commits] r28570 - haiku/trunk/build/jam In-Reply-To: <200811082247.mA8MltVS031468@sheep.berlios.de> Message-ID: <18862199681-BeMail@laptop> > * Updated WonderBrush package. The new version is compiled on Haiku > and > improves the installation of the document mimetype (finally a more > reliable > sniffer rule, thanks to Francois for helping me with this). The > About window > is fixed to no longer use a hardcoded font file path. This version > only runs > on Haiku, but it is fully unlocked! Next version with new features > won't be. > Also comes with a new vector icon for the native document type. Hmm where is text import as shapes ? ;) Fran?ois. From revol at free.fr Sun Nov 9 00:24:09 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sun, 09 Nov 2008 00:24:09 +0100 CET Subject: [Haiku-commits] r28567 - in haiku/trunk: headers/private/libroot src/system/libroot/os/arch/m68k src/system/libroot/os/arch/ppc src/system/libroot/os/arch/x86 In-Reply-To: <20081109000629.692.4@knochen-vm.localdomain> Message-ID: <19595866955-BeMail@laptop> > > Actually I'm pretty sure I used those already, didn't you dup code > > somewhere ? > > There's an arch_debug_get_caller() in the kernel. The PPC function is > unimplemented and the m68k function looks like you tried different > __builtin_frame_address() invocations and then implemented it > differently > altogether. So I rather left the libroot functions unimplemented. IIRC I didn't get it the function had its own frame so 0 wouldn't help... And At the time it didn't boot far enough to test. I'll check it again later. Fran?ois. From revol at free.fr Sun Nov 9 00:25:24 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sun, 09 Nov 2008 00:25:24 +0100 CET Subject: [Haiku-commits] r28572 - haiku/trunk/build/jam In-Reply-To: <200811082307.mA8N7H9m032505@sheep.berlios.de> Message-ID: <19670139791-BeMail@laptop> > Modified: haiku/trunk/build/jam/OptionalPackages > =================================================================== > --- haiku/trunk/build/jam/OptionalPackages 2008-11-08 22:59:22 UTC > (rev 28571) > +++ haiku/trunk/build/jam/OptionalPackages 2008-11-08 23:07:16 UTC > (rev 28572) > @@ -493,7 +493,7 @@ > } else if $(HAIKU_GCC_VERSION[1]) >= 4 && $(isHybridBuild) = 0 { > Echo "No optional package WonderBrush available for gcc4" ; > } else { > - local baseURL = ttp://www.yellowbites.com/downloads ; > + local baseURL = http://www.yellowbites.com/downloads ; Ugh, TTP is a CAN based field network protocol... but doesn't have an uri scheme yet. :D Fran?ois. From superstippi at gmx.de Sun Nov 9 00:35:37 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 09 Nov 2008 00:35:37 +0100 Subject: [Haiku-commits] r28570 - haiku/trunk/build/jam In-Reply-To: <18862199681-BeMail@laptop> References: <18862199681-BeMail@laptop> Message-ID: <20081109003537.14985.15@stippis2.1226134096.fake> Fran?ois Revol wrote: > > * Updated WonderBrush package. The new version is compiled on Haiku > > and > > improves the installation of the document mimetype (finally a more > > reliable > > sniffer rule, thanks to Francois for helping me with this). The > > About window > > is fixed to no longer use a hardcoded font file path. This version > > only runs > > on Haiku, but it is fully unlocked! Next version with new features > > won't be. > > Also comes with a new vector icon for the native document type. > > Hmm where is text import as shapes ? ;) WonderBrush doesn't really need that, because it supports text directly. :-) But you can use "Object->Special->Text to Shape" on a Text object to convert it. Best regards, -Stephan From stippi at mail.berlios.de Sun Nov 9 12:08:21 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sun, 9 Nov 2008 12:08:21 +0100 Subject: [Haiku-commits] r28573 - haiku/trunk/src/apps/icon-o-matic/import_export/styled_text Message-ID: <200811091108.mA9B8LYG021827@sheep.berlios.de> Author: stippi Date: 2008-11-09 12:08:19 +0100 (Sun, 09 Nov 2008) New Revision: 28573 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28573&view=rev Modified: haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp Log: More realistic file size restriction. UINT32_MAX is not defined on some target platforms, too. Modified: haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp =================================================================== --- haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp 2008-11-08 23:07:16 UTC (rev 28572) +++ haiku/trunk/src/apps/icon-o-matic/import_export/styled_text/StyledTextImporter.cpp 2008-11-09 11:08:19 UTC (rev 28573) @@ -221,7 +221,7 @@ err = file.GetSize(&size); if (err < B_OK) return err; - if (size > UINT32_MAX - 1) + if (size > 1 * 1024 * 1024) // Don't load files that big return E2BIG; BMallocIO mio; From korli at mail.berlios.de Sun Nov 9 15:37:19 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 9 Nov 2008 15:37:19 +0100 Subject: [Haiku-commits] r28574 - haiku/trunk/src/apps/soundrecorder Message-ID: <200811091437.mA9EbJAA030895@sheep.berlios.de> Author: korli Date: 2008-11-09 15:37:18 +0100 (Sun, 09 Nov 2008) New Revision: 28574 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28574&view=rev Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp haiku/trunk/src/apps/soundrecorder/RecorderWindow.h haiku/trunk/src/apps/soundrecorder/ScopeView.cpp haiku/trunk/src/apps/soundrecorder/ScopeView.h haiku/trunk/src/apps/soundrecorder/TrackSlider.cpp Log: * cancel rendering if selection changed * update track slider borders if selection changed * added drag'n drop from ScopeView Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-09 11:08:19 UTC (rev 28573) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-09 14:37:18 UTC (rev 28574) @@ -39,6 +39,7 @@ #include #include +#include #include "RecorderWindow.h" #include "SoundConsumer.h" @@ -589,6 +590,9 @@ RefsReceived(message); break; } + case B_COPY_TARGET: + CopyTarget(message); + break; default: BWindow::MessageReceived(message); break; @@ -681,7 +685,7 @@ return; } - fPlayLimit = MIN(fPlayFrames, (off_t)(fTrackSlider->RightTime()*fPlayFormat.u.raw_audio.frame_rate/1000000LL)); + fPlayLimit = MIN(fPlayFrames, (off_t)(fTrackSlider->RightTime() * fPlayFormat.u.raw_audio.frame_rate / 1000000LL)); fPlayTrack->SeekToTime(fTrackSlider->MainTime()); fPlayFrame = fPlayTrack->CurrentFrame(); @@ -1002,6 +1006,10 @@ void RecorderWindow::UpdatePlayFile() { + fScopeView->CancelRendering(); + StopPlaying(); + StopRecording(); + // Get selection. int32 selIdx = fSoundList->CurrentSelection(); SoundListItem* pItem = dynamic_cast(fSoundList->ItemAt(selIdx)); @@ -1027,6 +1035,7 @@ ErrorAlert("get the file to play", err); delete fPlayFile; fPlayFile = NULL; + RemoveCurrentSoundItem(); return; } @@ -1049,6 +1058,8 @@ if (!fPlayTrack) { ErrorAlert("get the file to play", err); delete fPlayFile; + fPlayFile = NULL; + RemoveCurrentSoundItem(); return; } @@ -1086,10 +1097,7 @@ fDuration->SetText(durationString.String()); fTrackSlider->SetTotalTime(duration, true); - fScopeView->SetMainTime(fTrackSlider->LeftTime()); - fScopeView->SetTotalTime(duration); - fScopeView->SetRightTime(fTrackSlider->RightTime()); - fScopeView->SetLeftTime(fTrackSlider->LeftTime()); + fScopeView->SetTotalTime(duration, true); fScopeView->RenderTrack(fPlayTrack, fPlayFormat); fPlayFrames = fPlayTrack->CountFrames(); @@ -1150,7 +1158,15 @@ fSoundList->Select(fSoundList->IndexOf(listItem)); } + void +RecorderWindow::RemoveCurrentSoundItem() { + BListItem *item = fSoundList->RemoveItem(fSoundList->CurrentSelection()); + delete item; +} + + +void RecorderWindow::RecordFile(void * cookie, bigtime_t timestamp, void * data, size_t size, const media_raw_audio_format & format) { @@ -1236,3 +1252,69 @@ } } } + + +void +RecorderWindow::CopyTarget(BMessage *msg) +{ + const char *type = NULL; + if (msg->FindString("be:types", &type) == B_OK) { + if (!strcasecmp(type, B_FILE_MIME_TYPE)) { + const char *name; + entry_ref dir; + if (msg->FindString("be:filetypes") == B_OK + && msg->FindString("name", &name) == B_OK + && msg->FindRef("directory", &dir) == B_OK) { + BDirectory directory(&dir); + BFile file(&directory, name, O_RDWR | O_TRUNC); + + // seek time + bigtime_t start = fTrackSlider->LeftTime(); + fPlayTrack->SeekToTime(&start); + + // write data + bigtime_t diffTime = fTrackSlider->RightTime() - fTrackSlider->LeftTime(); + int64 framesToWrite = (int64) (diffTime * fPlayFormat.u.raw_audio.frame_rate / 1000000LL); + int32 frameSize = (fPlayFormat.u.raw_audio.format & 0xf) + * fPlayFormat.u.raw_audio.channel_count; + + wave_struct header; + header.riff.riff_id = FOURCC('R','I','F','F'); + header.riff.len = (frameSize * framesToWrite) + 36; + header.riff.wave_id = FOURCC('W','A','V','E'); + header.format_chunk.fourcc = FOURCC('f','m','t',' '); + header.format_chunk.len = sizeof(header.format); + header.format.format_tag = 1; + header.format.channels = fPlayFormat.u.raw_audio.channel_count; + header.format.samples_per_sec = (uint32)fPlayFormat.u.raw_audio.frame_rate; + header.format.avg_bytes_per_sec = (uint32)(fPlayFormat.u.raw_audio.frame_rate + * fPlayFormat.u.raw_audio.channel_count + * (fPlayFormat.u.raw_audio.format & 0xf)); + header.format.bits_per_sample = (fPlayFormat.u.raw_audio.format & 0xf) * 8; + header.format.block_align = frameSize; + header.data_chunk.fourcc = FOURCC('d','a','t','a'); + header.data_chunk.len = frameSize * framesToWrite; + file.Seek(0, SEEK_SET); + file.Write(&header, sizeof(header)); + + char *data = (char *)malloc(fPlayFormat.u.raw_audio.buffer_size); + + while (framesToWrite > 0) { + int64 frames = 0; + status_t err = fPlayTrack->ReadFrames(data, &frames); + if (frames <= 0 || err != B_OK) + break; + file.Write(data, frames * frameSize); + framesToWrite -= frames; + } + + file.Sync(); + free(data); + BNodeInfo nodeInfo(&file); + // set type + } + } else { + + } + } +} Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.h =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.h 2008-11-09 11:08:19 UTC (rev 28573) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.h 2008-11-09 14:37:18 UTC (rev 28574) @@ -67,6 +67,7 @@ }; void AddSoundItem(const BEntry& entry, bool temp = false); + void RemoveCurrentSoundItem(); private: BMediaRoster * fRoster; @@ -164,6 +165,7 @@ static void NotifyPlayFile(void * cookie, BSoundPlayer::sound_player_notification code, ...); void RefsReceived(BMessage *msg); + void CopyTarget(BMessage *msg); }; #endif /* RECORDERWINDOW_H */ Modified: haiku/trunk/src/apps/soundrecorder/ScopeView.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/ScopeView.cpp 2008-11-09 11:08:19 UTC (rev 28573) +++ haiku/trunk/src/apps/soundrecorder/ScopeView.cpp 2008-11-09 14:37:18 UTC (rev 28574) @@ -7,6 +7,7 @@ #include #include +#include #include #include #include "DrawingTidbits.h" @@ -132,7 +133,7 @@ int32 previewIndex = 0; - while (fMediaTrack->ReadFrames(samples, &frames) == B_OK) { + while (fIsRendering && fMediaTrack->ReadFrames(samples, &frames) == B_OK) { //TRACE("reading block\n"); framesIndex = 0; @@ -153,8 +154,6 @@ sum = 0; } } - - } TRACE("finished computing, rendering\n"); @@ -187,9 +186,14 @@ void -ScopeView::SetTotalTime(bigtime_t timestamp) +ScopeView::SetTotalTime(bigtime_t timestamp, bool reset) { fTotalTime = timestamp; + if (reset) { + fMainTime = 0; + fLeftTime = 0; + fRightTime = fTotalTime; + } Invalidate(); TRACE("invalidate done\n"); } @@ -223,6 +227,13 @@ void +ScopeView::CancelRendering() +{ + fIsRendering = false; +} + + +void ScopeView::FrameResized(float width, float height) { InitBitmap(); @@ -233,6 +244,28 @@ void +ScopeView::MouseDown(BPoint position) +{ + if (!fMediaTrack) + return; + + uint32 buttons; + BPoint point; + GetMouse(&point, &buttons); + + if (buttons & B_PRIMARY_MOUSE_BUTTON) { + // fill the drag message + BMessage drag(B_SIMPLE_DATA); + drag.AddInt32("be:actions", B_COPY_TARGET); + drag.AddString("be:clip_name", "Audio Clip"); + drag.AddString("be:types", B_FILE_MIME_TYPE); + + DragMessage(&drag, Bounds()); + } +} + + +void ScopeView::InitBitmap() { if (fBitmapView) { Modified: haiku/trunk/src/apps/soundrecorder/ScopeView.h =================================================================== --- haiku/trunk/src/apps/soundrecorder/ScopeView.h 2008-11-09 11:08:19 UTC (rev 28573) +++ haiku/trunk/src/apps/soundrecorder/ScopeView.h 2008-11-09 14:37:18 UTC (rev 28574) @@ -24,9 +24,11 @@ void SetMainTime(bigtime_t timestamp); void SetLeftTime(bigtime_t timestamp); void SetRightTime(bigtime_t timestamp); - void SetTotalTime(bigtime_t timestamp); + void SetTotalTime(bigtime_t timestamp, bool reset); void RenderTrack(BMediaTrack *track, media_format format); + void CancelRendering(); virtual void FrameResized(float width, float height); + virtual void MouseDown(BPoint position); private: void Run(); void Quit(); Modified: haiku/trunk/src/apps/soundrecorder/TrackSlider.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/TrackSlider.cpp 2008-11-09 11:08:19 UTC (rev 28573) +++ haiku/trunk/src/apps/soundrecorder/TrackSlider.cpp 2008-11-09 14:37:18 UTC (rev 28574) @@ -364,6 +364,7 @@ fLeftTime = 0; fBitmapView->fLeftX = 14 + (fBitmapView->fRight - 15) * ((double)fLeftTime / fTotalTime); fBitmapView->fRightX = 15 + (fBitmapView->fRight - 16) * ((double)fRightTime / fTotalTime); + RenderBitmap(); } Invalidate(); } @@ -380,6 +381,7 @@ fBitmapView->fPositionX = 15 + (fBitmapView->fRight - 14) * ((double)fMainTime / fTotalTime); fBitmapView->fLeftX = 14 + (fBitmapView->fRight - 15) * ((double)fLeftTime / fTotalTime); fBitmapView->fRightX = 15 + (fBitmapView->fRight - 16) * ((double)fRightTime / fTotalTime); + RenderBitmap(); Invalidate(); } From axeld at pinc-software.de Sun Nov 9 16:00:32 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 09 Nov 2008 16:00:32 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28573_-_haiku/trunk/src/apps/icon-o-ma?= =?utf-8?q?tic/import=5Fexport/styled=5Ftext?= In-Reply-To: <200811091108.mA9B8LYG021827@sheep.berlios.de> Message-ID: <2692431898-BeMail@zon> stippi at mail.berlios.de wrote: > - if (size > UINT32_MAX - 1) > + if (size > 1 * 1024 * 1024) // Don't load files that big > return E2BIG; Isn't that a bit too restrictive? I know StyledEdit isn't that fast, but 1 MB is pretty easily filled up with log files and the like. Bye, Axel. From superstippi at gmx.de Sun Nov 9 17:10:03 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Sun, 09 Nov 2008 17:10:03 +0100 Subject: [Haiku-commits] r28573 - haiku/trunk/src/apps/icon-o-matic/import_export/styled_text In-Reply-To: <2692431898-BeMail@zon> References: <2692431898-BeMail@zon> Message-ID: <20081109161003.217000@gmx.net> Hi, > stippi at mail.berlios.de wrote: > > - if (size > UINT32_MAX - 1) > > + if (size > 1 * 1024 * 1024) // Don't load files that big > > return E2BIG; > > Isn't that a bit too restrictive? I know StyledEdit isn't that fast, > but 1 MB is pretty easily filled up with log files and the like. Huh? Why would you go through the trouble and import more than one MB of text as shapes into an icon? I don't think Icon-O-Matic scales that well and this limit is still insane considering it would be rendered on 64 by 64 pixels. :-) Best regards, -Stephan From korli at mail.berlios.de Sun Nov 9 17:13:41 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 9 Nov 2008 17:13:41 +0100 Subject: [Haiku-commits] r28575 - haiku/trunk/src/bin/desklink Message-ID: <200811091613.mA9GDfcn005158@sheep.berlios.de> Author: korli Date: 2008-11-09 17:13:41 +0100 (Sun, 09 Nov 2008) New Revision: 28575 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28575&view=rev Modified: haiku/trunk/src/bin/desklink/VolumeSlider.cpp haiku/trunk/src/bin/desklink/VolumeSlider.h haiku/trunk/src/bin/desklink/desklink.cpp Log: Scrolling up/down above Volume Control in deskbar's shelf now changes volume (bug #2323). Modified: haiku/trunk/src/bin/desklink/VolumeSlider.cpp =================================================================== --- haiku/trunk/src/bin/desklink/VolumeSlider.cpp 2008-11-09 14:37:18 UTC (rev 28574) +++ haiku/trunk/src/bin/desklink/VolumeSlider.cpp 2008-11-09 16:13:41 UTC (rev 28575) @@ -27,30 +27,17 @@ #define REDZONESTART 151 -VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich) - : BWindow(frame, "VolumeSlider", B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, - B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK, 0), + +MixerControl::MixerControl(int32 volumeWhich, float *value, const char **error) + : fAudioMixerNode(NULL), fParamWeb(NULL), - fMixerParam(NULL) -{ - // Make sure it's not outside the screen. - const int32 kMargin = 3; - BRect windowRect = ConvertToScreen(Bounds()); - BRect screenFrame(BScreen(B_MAIN_SCREEN_ID).Frame()); - if (screenFrame.right < windowRect.right + kMargin) - MoveBy(- kMargin - windowRect.right + screenFrame.right, 0); - if (screenFrame.bottom < windowRect.bottom + kMargin) - MoveBy(0, - kMargin - windowRect.bottom + screenFrame.bottom); - if (screenFrame.left > windowRect.left - kMargin) - MoveBy(kMargin + screenFrame.left - windowRect.left, 0); - if (screenFrame.top > windowRect.top - kMargin) - MoveBy(0, kMargin + screenFrame.top - windowRect.top); - - float value = 0.0; + fMixerParam(NULL), + fMin(0.0), + fMax(0.0), + fStep(0.0) + { bool retrying = false; - fDontBeep = dontBeep; - fAudioMixerNode = new media_node(); status_t err = B_OK; /* BMediaRoster::Roster() doesn't set it if all is ok */ @@ -149,7 +136,8 @@ fMixerParam->GetValue(&chanData, &size, &lastChange); - value = (chanData[0] - fMin) * 100 / ((fMax - fMin) ? (fMax - fMin) : 1); + if (value) + *value = (chanData[0] - fMin) * 100 / ((fMax - fMin) ? (fMax - fMin) : 1); } } else { errString = "No parameter web"; @@ -173,32 +161,116 @@ delete fAudioMixerNode; fAudioMixerNode = NULL; } - if (errString) - fprintf(stderr, "VolumeSlider: %s.\n", errString); + if (errString) { + fprintf(stderr, "MixerControl: %s.\n", errString); + if (error) + *error = errString; + } + if (fMixerParam == NULL) + *value = -1; +} + +MixerControl::~MixerControl() +{ + delete fParamWeb; + BMediaRoster* roster = BMediaRoster::CurrentRoster(); + if (roster && fAudioMixerNode) + roster->ReleaseNode(*fAudioMixerNode); +} + + +void +MixerControl::UpdateVolume(int32 value) +{ + if (!fMixerParam) + return; + + float chanData[2]; + bigtime_t lastChange; + size_t size = sizeof(chanData); + + fMixerParam->GetValue(&chanData, &size, &lastChange); + + for (int i = 0; i < 2; i++) { + chanData[i] = (value * (fMax - fMin) / 100) / fStep * fStep + fMin; + } + + PRINT(("Min value: %f Max Value: %f\nData: %f %f\n", + fMixerParam->MinValue(), fMixerParam->MaxValue(), chanData[0], chanData[1])); + fMixerParam->SetValue(&chanData, sizeof(chanData), system_time()+1000); +} + + +void +MixerControl::ChangeVolumeBy(int32 value) +{ + if (!fMixerParam) + return; + + float chanData[2]; + bigtime_t lastChange; + size_t size = sizeof(chanData); + + fMixerParam->GetValue(&chanData, &size, &lastChange); + + for (int i = 0; i < 2; i++) { + chanData[i] += fStep * value; + if (chanData[i] < fMin) + chanData[i] = fMin; + else if (chanData[i] > fMax) + chanData[i] = fMax; + } + + PRINT(("Min value: %f Max Value: %f\nData: %f %f\n", + fMixerParam->MinValue(), fMixerParam->MaxValue(), chanData[0], chanData[1])); + fMixerParam->SetValue(&chanData, sizeof(chanData), system_time()+1000); +} + + +// #pragma mark - + + +VolumeSlider::VolumeSlider(BRect frame, bool dontBeep, int32 volumeWhich) + : BWindow(frame, "VolumeSlider", B_BORDERED_WINDOW_LOOK, B_FLOATING_ALL_WINDOW_FEEL, + B_ASYNCHRONOUS_CONTROLS | B_WILL_ACCEPT_FIRST_CLICK, 0) +{ + // Make sure it's not outside the screen. + const int32 kMargin = 3; + BRect windowRect = ConvertToScreen(Bounds()); + BRect screenFrame(BScreen(B_MAIN_SCREEN_ID).Frame()); + if (screenFrame.right < windowRect.right + kMargin) + MoveBy(- kMargin - windowRect.right + screenFrame.right, 0); + if (screenFrame.bottom < windowRect.bottom + kMargin) + MoveBy(0, - kMargin - windowRect.bottom + screenFrame.bottom); + if (screenFrame.left > windowRect.left - kMargin) + MoveBy(kMargin + screenFrame.left - windowRect.left, 0); + if (screenFrame.top > windowRect.top - kMargin) + MoveBy(0, kMargin + screenFrame.top - windowRect.top); + + float value = 0.0; + fDontBeep = dontBeep; + const char *errString; + fMixerControl = new MixerControl(volumeWhich, &value, &errString); + BBox *box = new BBox(Bounds(), "sliderbox", B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW | B_FRAME_EVENTS, B_PLAIN_BORDER); AddChild(box); fHasChanged = false; /* make sure we don't beep if we don't change anything */ - if (fMixerParam == NULL) - value = -1; fSlider = new SliderView(box->Bounds().InsetByCopy(1, 1), new BMessage(VOLUME_CHANGED), errString == NULL ? "Volume" : errString, B_FOLLOW_LEFT | B_FOLLOW_TOP, (int32)value); box->AddChild(fSlider); fSlider->SetTarget(this); - SetPulseRate(100); + SetPulseRate(100); } VolumeSlider::~VolumeSlider() { - delete fParamWeb; - BMediaRoster* roster = BMediaRoster::CurrentRoster(); - if (roster && fAudioMixerNode) - roster->ReleaseNode(*fAudioMixerNode); + delete fMixerControl; } @@ -215,14 +287,14 @@ switch (msg->what) { case VOLUME_UPDATED: PRINT(("VOLUME_UPDATED\n")); - UpdateVolume(fMixerParam); + fMixerControl->UpdateVolume(fSlider->Value()); fHasChanged = true; break; case VOLUME_CHANGED: if (fHasChanged) { PRINT(("VOLUME_CHANGED\n")); - UpdateVolume(fMixerParam); + fMixerControl->UpdateVolume(fSlider->Value()); if (!fDontBeep) beep(); } @@ -235,28 +307,6 @@ } -void -VolumeSlider::UpdateVolume(BContinuousParameter* param) -{ - if (!param) - return; - - float chanData[2]; - bigtime_t lastChange; - size_t size = sizeof(chanData); - - fMixerParam->GetValue( &chanData, &size, &lastChange ); - - for (int i = 0; i < 2; i++) { - chanData[i] = (fSlider->Value() * (fMax - fMin) / 100) / fStep * fStep + fMin; - } - - PRINT(("Min value: %f Max Value: %f\nData: %f %f\n", - fMixerParam->MinValue(), fMixerParam->MaxValue(), chanData[0], chanData[1])); - fMixerParam->SetValue(&chanData, sizeof(chanData), system_time()+1000); -} - - // #pragma mark - Modified: haiku/trunk/src/bin/desklink/VolumeSlider.h =================================================================== --- haiku/trunk/src/bin/desklink/VolumeSlider.h 2008-11-09 14:37:18 UTC (rev 28574) +++ haiku/trunk/src/bin/desklink/VolumeSlider.h 2008-11-09 16:13:41 UTC (rev 28575) @@ -18,6 +18,21 @@ #define VOLUME_USE_PHYS_OUTPUT 1 +class MixerControl { + public: + MixerControl(int32 volumeWhich, float *value = NULL, const char **error = NULL); + ~MixerControl(); + + void UpdateVolume(int32 value); + void ChangeVolumeBy(int32 incr); + private: + media_node *fAudioMixerNode; + BParameterWeb* fParamWeb; + BContinuousParameter* fMixerParam; + float fMin, fMax, fStep; +}; + + class SliderView : public BControl { public: SliderView(BRect rect, BMessage *msg, const char* title, uint32 resizeFlags, @@ -43,12 +58,7 @@ void WindowActivated(bool active); private: - void UpdateVolume(BContinuousParameter* param); - - media_node *fAudioMixerNode; - BParameterWeb* fParamWeb; - BContinuousParameter* fMixerParam; - float fMin, fMax, fStep; + MixerControl *fMixerControl; bool fHasChanged; bool fDontBeep; SliderView *fSlider; Modified: haiku/trunk/src/bin/desklink/desklink.cpp =================================================================== --- haiku/trunk/src/bin/desklink/desklink.cpp 2008-11-09 14:37:18 UTC (rev 28574) +++ haiku/trunk/src/bin/desklink/desklink.cpp 2008-11-09 16:13:41 UTC (rev 28575) @@ -233,7 +233,17 @@ case SET_VOLUME_WHICH: message->FindInt32("volwhich", &fVolumeWhich); break; - + + case B_MOUSE_WHEEL_CHANGED: + { + float dy; + if (message->FindFloat("be:wheel_delta_y", &dy) == B_OK + && dy != 0.0) { + MixerControl mixerControl(fVolumeWhich); + mixerControl.ChangeVolumeBy(dy < 0 ? 20 : -20); + } + break; + } default: BView::MessageReceived(message); break; From korli at mail.berlios.de Sun Nov 9 17:37:20 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 9 Nov 2008 17:37:20 +0100 Subject: [Haiku-commits] r28576 - haiku/trunk/src/apps/soundrecorder Message-ID: <200811091637.mA9GbKRI007081@sheep.berlios.de> Author: korli Date: 2008-11-09 17:37:19 +0100 (Sun, 09 Nov 2008) New Revision: 28576 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28576&view=rev Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp Log: clearer error messages Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-09 16:13:41 UTC (rev 28575) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-09 16:37:19 UTC (rev 28576) @@ -1032,7 +1032,7 @@ entry.GetRef(&ref); fPlayFile = new BMediaFile(&ref); //, B_MEDIA_FILE_UNBUFFERED); if ((err = fPlayFile->InitCheck()) < B_OK) { - ErrorAlert("get the file to play", err); + ErrorAlert("recognize this file as a media file", err); delete fPlayFile; fPlayFile = NULL; RemoveCurrentSoundItem(); @@ -1056,7 +1056,7 @@ } if (!fPlayTrack) { - ErrorAlert("get the file to play", err); + ErrorAlert("find an audio track", err); delete fPlayFile; fPlayFile = NULL; RemoveCurrentSoundItem(); From ingo_weinhold at gmx.de Sun Nov 9 18:32:41 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 09 Nov 2008 18:32:41 +0100 Subject: [Haiku-commits] r28573 - haiku/trunk/src/apps/icon-o-matic/import_export/styled_text In-Reply-To: <20081109161003.217000@gmx.net> References: <2692431898-BeMail@zon> <20081109161003.217000@gmx.net> Message-ID: <20081109183241.385.1@knochen-vm.localdomain> On 2008-11-09 at 17:10:03 [+0100], Stephan Assmus wrote: > > stippi at mail.berlios.de wrote: > > > - if (size > UINT32_MAX - 1) > > > + if (size > 1 * 1024 * 1024) // Don't load files that big > > > return E2BIG; > > > > Isn't that a bit too restrictive? I know StyledEdit isn't that fast, > > but 1 MB is pretty easily filled up with log files and the like. > > Huh? Why would you go through the trouble and import more than one MB of > text as shapes into an icon? I don't think Icon-O-Matic scales that well > and this limit is still insane considering it would be rendered on 64 by 64 > pixels. :-) This reminds me of those spook movies in which sensitive information is transported on a microfilm dot hidden in plain sight. I guess Axel plans to hide his "log files" in HVIF icons. Brilliant idea! :-) CU, Ingo From leavengood at gmail.com Sun Nov 9 18:33:41 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Sun, 9 Nov 2008 12:33:41 -0500 Subject: [Haiku-commits] r28573 - haiku/trunk/src/apps/icon-o-matic/import_export/styled_text In-Reply-To: <20081109183241.385.1@knochen-vm.localdomain> References: <2692431898-BeMail@zon> <20081109161003.217000@gmx.net> <20081109183241.385.1@knochen-vm.localdomain> Message-ID: On Sun, Nov 9, 2008 at 12:32 PM, Ingo Weinhold wrote: > > This reminds me of those spook movies in which sensitive information is > transported on a microfilm dot hidden in plain sight. I guess Axel plans to > hide his "log files" in HVIF icons. Brilliant idea! :-) Hehehe. I suppose we can assume that Axel saw the "styled_text" part of the Modified path but missed the "icon-o-matic" part... Ryan From mmu_man at mail.berlios.de Sun Nov 9 18:36:40 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 9 Nov 2008 18:36:40 +0100 Subject: [Haiku-commits] r28577 - haiku/trunk/3rdparty/mmu_man/themes Message-ID: <200811091736.mA9Haeam019620@sheep.berlios.de> Author: mmu_man Date: 2008-11-09 18:36:38 +0100 (Sun, 09 Nov 2008) New Revision: 28577 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28577&view=rev Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp Log: Fix incorrect flag and resizing mode order. Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-11-09 16:37:19 UTC (rev 28576) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeInterfaceView.cpp 2008-11-09 17:36:38 UTC (rev 28577) @@ -269,7 +269,7 @@ fScreenshotPane->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); #endif - fScreenshotNone = new BStringView(BRect(), "sshotnone", _T("No Theme selected"), (uint32) 0, B_FOLLOW_ALL); + fScreenshotNone = new BStringView(BRect(), "sshotnone", _T("No Theme selected"), B_FOLLOW_ALL); fScreenshotNone->SetFontSize(20.0); fScreenshotNone->SetAlignment(B_ALIGN_CENTER); fBox->AddChild(fScreenshotNone); From bonefish at mail.berlios.de Sun Nov 9 19:18:53 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 9 Nov 2008 19:18:53 +0100 Subject: [Haiku-commits] r28578 - haiku/trunk/src/system/runtime_loader Message-ID: <200811091818.mA9IIrSv006283@sheep.berlios.de> Author: bonefish Date: 2008-11-09 19:18:51 +0100 (Sun, 09 Nov 2008) New Revision: 28578 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28578&view=rev Modified: haiku/trunk/src/system/runtime_loader/elf.cpp Log: unload_library() invoked from dlclose() might not have deleted images correctly and it returned an error on success. Modified: haiku/trunk/src/system/runtime_loader/elf.cpp =================================================================== --- haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-09 17:36:38 UTC (rev 28577) +++ haiku/trunk/src/system/runtime_loader/elf.cpp 2008-11-09 18:18:51 UTC (rev 28578) @@ -2295,7 +2295,6 @@ status_t unload_library(void* handle, image_id imageID, bool addOn) { - status_t status = B_BAD_IMAGE_ID; image_t *image; image_type type = addOn ? B_ADD_ON_IMAGE : B_LIBRARY_IMAGE; @@ -2315,9 +2314,12 @@ // we only check images that have been already initialized + status_t status = B_BAD_IMAGE_ID; + if (handle != NULL) { image = (image_t*)handle; put_image(image); + status = B_OK; } else { for (image = sLoadedImages.head; image; image = image->next) { if (image->id == imageID) { From bonefish at mail.berlios.de Sun Nov 9 19:19:47 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 9 Nov 2008 19:19:47 +0100 Subject: [Haiku-commits] r28579 - haiku/trunk/src/system/libroot/posix Message-ID: <200811091819.mA9IJlDu008789@sheep.berlios.de> Author: bonefish Date: 2008-11-09 19:19:46 +0100 (Sun, 09 Nov 2008) New Revision: 28579 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28579&view=rev Modified: haiku/trunk/src/system/libroot/posix/dlfcn.c Log: dlclose() also set the static error variable. Modified: haiku/trunk/src/system/libroot/posix/dlfcn.c =================================================================== --- haiku/trunk/src/system/libroot/posix/dlfcn.c 2008-11-09 18:18:51 UTC (rev 28578) +++ haiku/trunk/src/system/libroot/posix/dlfcn.c 2008-11-09 18:19:46 UTC (rev 28579) @@ -57,7 +57,7 @@ int dlclose(void *handle) { - return __gRuntimeLoader->unload_library(handle); + return sStatus = __gRuntimeLoader->unload_library(handle); } From anevilyak at mail.berlios.de Sun Nov 9 19:20:02 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 9 Nov 2008 19:20:02 +0100 Subject: [Haiku-commits] r28580 - haiku/trunk/src/kits/interface Message-ID: <200811091820.mA9IK24m009328@sheep.berlios.de> Author: anevilyak Date: 2008-11-09 19:20:01 +0100 (Sun, 09 Nov 2008) New Revision: 28580 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28580&view=rev Modified: haiku/trunk/src/kits/interface/ListView.cpp Log: Alter the order in which we updated our cached items. This fixes things like mmu_man's Themes app which has somewhat unusual list items that embed BViews. Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2008-11-09 18:19:46 UTC (rev 28579) +++ haiku/trunk/src/kits/interface/ListView.cpp 2008-11-09 18:20:01 UTC (rev 28580) @@ -486,11 +486,9 @@ if (Window()) { BFont font; GetFont(&font); - - item->Update(this, &font); - _RecalcItemTops(index); - + item->Update(this, &font); + _FixupScrollBar(); _InvalidateFrom(index); } @@ -510,10 +508,9 @@ if (Window()) { BFont font; GetFont(&font); - + _RecalcItemTops(CountItems() - 1); item->Update(this, &font); - _RecalcItemTops(CountItems() - 1); _FixupScrollBar(); InvalidateItem(CountItems() - 1); From bonefish at mail.berlios.de Sun Nov 9 19:21:32 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 9 Nov 2008 19:21:32 +0100 Subject: [Haiku-commits] r28581 - haiku/trunk/src/bin/debug/ltrace Message-ID: <200811091821.mA9ILW5E011973@sheep.berlios.de> Author: bonefish Date: 2008-11-09 19:21:31 +0100 (Sun, 09 Nov 2008) New Revision: 28581 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28581&view=rev Modified: haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp Log: * Use a temporary buffer to create the output for function invocation. * Replaced debug_printf() invocations by a macro, which is set to ktrace_printf() by default. Modified: haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp =================================================================== --- haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp 2008-11-09 18:20:01 UTC (rev 28580) +++ haiku/trunk/src/bin/debug/ltrace/ltrace_stub.cpp 2008-11-09 18:21:31 UTC (rev 28581) @@ -16,6 +16,10 @@ #include "arch/ltrace_stub.h" +//#define TRACE_PRINTF debug_printf +#define TRACE_PRINTF ktrace_printf + + static void* function_call_callback(const void* stub, const void* args); @@ -113,15 +117,23 @@ PatchEntry* entry = sPatchedTable.Lookup(stub); if (entry == NULL) { -debug_printf("function_call_callback(): CALLED FOR UNKNOWN FUNCTION!\n"); +TRACE_PRINTF("function_call_callback(): CALLED FOR UNKNOWN FUNCTION!\n"); return NULL; } + char buffer[1024]; + size_t bufferSize = sizeof(buffer); + size_t written = 0; + const uint32* args = (const uint32*)_args; - debug_printf("ltrace: %s(", entry->functionName); - for (int32 i = 0; i < 5; i++) - debug_printf("%s%#lx", i == 0 ? "" : ", ", args[i]); - debug_printf(")\n"); + written += snprintf(buffer, bufferSize, "ltrace: %s(", + entry->functionName); + for (int32 i = 0; i < 5; i++) { + written += snprintf(buffer + written, bufferSize - written, "%s%#lx", + i == 0 ? "" : ", ", args[i]); + } + written += snprintf(buffer + written, bufferSize - written, ")"); + TRACE_PRINTF("%s\n", buffer); return entry->originalFunction; } @@ -131,7 +143,7 @@ symbol_patcher(void* cookie, image_t* rootImage, image_t* image, const char* name, image_t** foundInImage, void** symbol, int32* type) { - debug_printf("symbol_patcher(%p, %p, %p, \"%s\", %p, %p, %ld)\n", + TRACE_PRINTF("symbol_patcher(%p, %p, %p, \"%s\", %p, %p, %ld)\n", cookie, rootImage, image, name, *foundInImage, *symbol, *type); // patch functions only @@ -153,7 +165,7 @@ sOriginalTable.Insert(entry); sPatchedTable.Insert(entry); - debug_printf(" -> patching to %p\n", entry->patchedFunction); + TRACE_PRINTF(" -> patching to %p\n", entry->patchedFunction); *foundInImage = NULL; *symbol = entry->patchedFunction; @@ -164,7 +176,7 @@ ltrace_stub_init(rld_export* standardInterface, runtime_loader_add_on_export* addOnInterface) { - debug_printf("ltrace_stub_init(%p, %p)\n", standardInterface, addOnInterface); + TRACE_PRINTF("ltrace_stub_init(%p, %p)\n", standardInterface, addOnInterface); sRuntimeLoaderInterface = standardInterface; sRuntimeLoaderAddOnInterface = addOnInterface; @@ -176,12 +188,12 @@ static void ltrace_stub_image_loaded(image_t* image) { - debug_printf("ltrace_stub_image_loaded(%p): \"%s\" (%ld)\n", image, image->path, + TRACE_PRINTF("ltrace_stub_image_loaded(%p): \"%s\" (%ld)\n", image, image->path, image->id); if (sRuntimeLoaderAddOnInterface->register_undefined_symbol_patcher(image, symbol_patcher, (void*)(addr_t)0xc0011eaf) != B_OK) { - debug_printf(" failed to install symbol patcher\n"); + TRACE_PRINTF(" failed to install symbol patcher\n"); } } @@ -189,7 +201,7 @@ static void ltrace_stub_image_relocated(image_t* image) { - debug_printf("ltrace_stub_image_relocated(%p): \"%s\" (%ld)\n", image, + TRACE_PRINTF("ltrace_stub_image_relocated(%p): \"%s\" (%ld)\n", image, image->path, image->id); } @@ -197,7 +209,7 @@ static void ltrace_stub_image_initialized(image_t* image) { - debug_printf("ltrace_stub_image_initialized(%p): \"%s\" (%ld)\n", image, + TRACE_PRINTF("ltrace_stub_image_initialized(%p): \"%s\" (%ld)\n", image, image->path, image->id); } @@ -205,7 +217,7 @@ static void ltrace_stub_image_uninitializing(image_t* image) { - debug_printf("ltrace_stub_image_uninitializing(%p): \"%s\" (%ld)\n", image, + TRACE_PRINTF("ltrace_stub_image_uninitializing(%p): \"%s\" (%ld)\n", image, image->path, image->id); } @@ -213,7 +225,7 @@ static void ltrace_stub_image_unloading(image_t* image) { - debug_printf("ltrace_stub_image_unloading(%p): \"%s\" (%ld)\n", image, + TRACE_PRINTF("ltrace_stub_image_unloading(%p): \"%s\" (%ld)\n", image, image->path, image->id); } From bonefish at mail.berlios.de Sun Nov 9 19:26:04 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Sun, 9 Nov 2008 19:26:04 +0100 Subject: [Haiku-commits] r28582 - haiku/trunk/build/jam Message-ID: <200811091826.mA9IQ4Gx023047@sheep.berlios.de> Author: bonefish Date: 2008-11-09 19:26:03 +0100 (Sun, 09 Nov 2008) New Revision: 28582 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28582&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: * Removed the /boot/develop/headers/gnu symlink. * Updated autoconf, automake, libtool, texinfo, flex, and bison to their respectively current version. They are installed in /boot/common now. * Removed the /boot/home/config/bin/perl and /bin/m4 symlinks again. Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-09 18:21:31 UTC (rev 28581) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-09 18:26:03 UTC (rev 28582) @@ -207,10 +207,6 @@ # BSD compatibility headers AddHeaderDirectoryToHaikuImage compatibility bsd : bsd ; - # create gnu -> 3rdparty symlink - AddSymlinkToHaikuImage develop headers : 3rdparty : gnu ; - # TODO: Change BEINCLUDES and gcc to refer to 3rdparty rather than gnu. - # third party libs headers AddHeaderDirectoryToHaikuImage libs freetype2 : 3rdparty ; AddHeaderDirectoryToHaikuImage libs ncurses : 3rdparty ; @@ -237,39 +233,37 @@ : ; # other tools - InstallOptionalHaikuImagePackage m4-1.4.12-gcc2-2008-11-04 - : $(baseURL)/m4-1.4.12-gcc2-2008-11-04.zip + InstallOptionalHaikuImagePackage autoconf-2.63-gcc2-2008-11-05 + : $(baseURL)/autoconf-2.63-gcc2-2008-11-05.zip : ; - AddSymlinkToHaikuImage beos bin : /boot/common/bin/m4 : m4 ; - - InstallOptionalHaikuImagePackage autoconf-2.61-gcc2-2008-03-24 - : $(baseURL)/autoconf-2.61-gcc2-2008-03-24.zip - : home + InstallOptionalHaikuImagePackage automake-1.10.1-gcc2-2008-11-06 + : $(baseURL)/automake-1.10.1-gcc2-2008-11-06.zip + : ; - InstallOptionalHaikuImagePackage automake-1.10.1-gcc2-2008-03-24-1 - : $(baseURL)/automake-1.10.1-gcc2-2008-03-24-1.zip - : home + InstallOptionalHaikuImagePackage bison-2.4-gcc2-2008-11-09 + : $(baseURL)/bison-2.4-gcc2-2008-11-09.zip + : ; - InstallOptionalHaikuImagePackage bison-2.3-gcc2-2008-03-28 - : $(baseURL)/bison-2.3-gcc2-2008-03-28.zip - : home + InstallOptionalHaikuImagePackage flex-2.5.35-gcc2-2008-11-09 + : $(baseURL)/flex-2.5.35-gcc2-2008-11-09.zip + : ; - InstallOptionalHaikuImagePackage flex-2.5.35-gcc2-2008-03-28 - : $(baseURL)/flex-2.5.35-gcc2-2008-03-28.zip - : home + InstallOptionalHaikuImagePackage jam-haiku-gcc2-2008-03-27-2 + : $(baseURL)/jam-haiku-gcc2-2008-03-27-2.zip + : ; - InstallOptionalHaikuImagePackage jam-haiku-gcc2-2008-03-27-1 - : $(baseURL)/jam-haiku-gcc2-2008-03-27-1.zip - : . + InstallOptionalHaikuImagePackage libtool-2.2.6a-gcc2-2008-11-09 + : $(baseURL)/libtool-2.2.6a-gcc2-2008-11-09.zip + : ; - InstallOptionalHaikuImagePackage libtool-1.5.26-gcc2-2008-04-07 - : $(baseURL)/libtool-1.5.26-gcc2-2008-04-07.zip - : home + InstallOptionalHaikuImagePackage m4-1.4.12-gcc2-2008-11-04 + : $(baseURL)/m4-1.4.12-gcc2-2008-11-04.zip + : ; - InstallOptionalHaikuImagePackage texinfo-4.11-gcc2-2008-03-24 - : $(baseURL)/texinfo-4.11-gcc2-2008-03-24.zip - : home + InstallOptionalHaikuImagePackage texinfo-4.13a-gcc2-2008-11-09 + : $(baseURL)/texinfo-4.13a-gcc2-2008-11-09.zip + : ; } } @@ -414,8 +408,6 @@ : $(baseURL)/perl-5.10.0-gcc2-2008-10-29.zip : ; - AddSymlinkToHaikuImage home config bin : /boot/common/bin/perl : perl ; - } } From anevilyak at gmail.com Sun Nov 9 19:40:33 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 9 Nov 2008 12:40:33 -0600 Subject: [Haiku-commits] r28582 - haiku/trunk/build/jam In-Reply-To: <200811091826.mA9IQ4Gx023047@sheep.berlios.de> References: <200811091826.mA9IQ4Gx023047@sheep.berlios.de> Message-ID: Hi, On Sun, Nov 9, 2008 at 12:26 PM, bonefish at BerliOS wrote: > Modified: > haiku/trunk/build/jam/OptionalPackages > Log: > * Removed the /boot/develop/headers/gnu symlink. > * Updated autoconf, automake, libtool, texinfo, flex, and bison to > their respectively current version. They are installed in /boot/common > now. > * Removed the /boot/home/config/bin/perl and /bin/m4 symlinks again. > The automake package that this points to doesn't appear to exist on haiku-files, though all the others do. Regards, Rene From axeld at pinc-software.de Sun Nov 9 19:51:40 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sun, 09 Nov 2008 19:51:40 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28573_-_haiku/trunk/src/apps/icon-o-ma?= =?utf-8?q?tic/import=5Fexport/styled=5Ftext?= In-Reply-To: Message-ID: <16560917790-BeMail@zon> "Ryan Leavengood" wrote: > On Sun, Nov 9, 2008 at 12:32 PM, Ingo Weinhold > wrote: > > This reminds me of those spook movies in which sensitive > > information is > > transported on a microfilm dot hidden in plain sight. I guess Axel > > plans to > > hide his "log files" in HVIF icons. Brilliant idea! :-) > Hehehe. I suppose we can assume that Axel saw the "styled_text" part > of the Modified path but missed the "icon-o-matic" part... Indeed, sometimes explanations are that simple :-)) I thought it would be the styled text translator... Bye, Axel. From mmu_man at mail.berlios.de Sun Nov 9 22:36:08 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 9 Nov 2008 22:36:08 +0100 Subject: [Haiku-commits] r28583 - in haiku/trunk: build/jam data/boot_cd Message-ID: <200811092136.mA9La8hU023102@sheep.berlios.de> Author: mmu_man Date: 2008-11-09 22:36:07 +0100 (Sun, 09 Nov 2008) New Revision: 28583 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28583&view=rev Modified: haiku/trunk/build/jam/CDBootPPCImage haiku/trunk/build/jam/ImageRules haiku/trunk/data/boot_cd/hfs.map Log: Finally found a hack to get the iso bootable in QEMU SVN (with some patching to get OpenHackware happy)... Modified: haiku/trunk/build/jam/CDBootPPCImage =================================================================== --- haiku/trunk/build/jam/CDBootPPCImage 2008-11-09 18:26:03 UTC (rev 28582) +++ haiku/trunk/build/jam/CDBootPPCImage 2008-11-09 21:36:07 UTC (rev 28583) @@ -12,16 +12,19 @@ NotFile $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) ; # extra files to put on the boot iso -local extras = ofboot.b README.html ; +local extras = README.html ; SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; +local chrpboot = ofboot.b ; +SEARCH on $(chrpboot) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; + local hfsmaps = hfs.map ; SEARCH on $(hfsmaps) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; -BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : $(hfsmaps) : boot_loader_openfirmware : $(extras) ; +BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : $(hfsmaps) : boot_loader_openfirmware : $(chrpboot) : $(extras) ; NotFile haiku-boot-cd-ppc ; Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-09 18:26:03 UTC (rev 28582) +++ haiku/trunk/build/jam/ImageRules 2008-11-09 21:36:07 UTC (rev 28583) @@ -1068,22 +1068,33 @@ #pragma mark - CD Boot PPC Image rules -rule BuildCDBootPPCImage image : hfsmaps : bootloader : extrafiles +rule BuildCDBootPPCImage image : hfsmaps : bootloader : chrpscript : extrafiles { Depends $(image) : $(bootloader) ; + Depends $(image) : $(chrpscript) ; Depends $(image) : $(extrafiles) ; Depends $(image) : $(hfsmaps) ; MAPS on $(image) = $(hfsmaps) ; - BuildCDBootPPCImage1 $(image) : $(bootloader) $(extrafiles) ; + BuildCDBootPPCImage1 $(image) : $(bootloader) $(chrpscript) $(extrafiles) ; } actions BuildCDBootPPCImage1 bind MAPS { $(RM) $(<) + mkdir -p $(HAIKU_OUTPUT_DIR)/cd/ppc + cp $(>) $(HAIKU_OUTPUT_DIR)/cd/ppc/ + cp $(>[2]) $(HAIKU_OUTPUT_DIR)/cd/ppc/bootinfo.txt + cp $(>[1]) $(HAIKU_OUTPUT_DIR)/cd/ofwboot.elf #mkisofs -r -U -chrp-boot -V bootimg -o $(<) $(>[1]) $(>[2-]) - mkisofs -hfs -r -U -chrp-boot -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) + #mkisofs -hfs -r -U -chrp-boot -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) + #mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -r -o $(<) $(>[1]) $(>[2-]) $(HAIKU_OUTPUT_DIR)/cd + #mkisofs -r -U -chrp-boot -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) + #mkisofs -r -U -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) + # $(HAIKU_OUTPUT_DIR)/cd # -hfs -hfs-bless . + mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot ppc/$(>[1]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd + #$(RM) -R $(HAIKU_OUTPUT_DIR)/cd } Modified: haiku/trunk/data/boot_cd/hfs.map =================================================================== --- haiku/trunk/data/boot_cd/hfs.map 2008-11-09 18:26:03 UTC (rev 28582) +++ haiku/trunk/data/boot_cd/hfs.map 2008-11-09 21:36:07 UTC (rev 28583) @@ -2,5 +2,7 @@ # from treating everything like a text file (ugly!) # # EXTN XLate CREATOR TYPE Comment -.b Raw 'UNIX' 'tbxi' "bootstrap" -boot_loader_openfirmware Raw 'UNIX' 'boot' "bootstrap" +#.b Raw 'UNIX' 'tbxi' "bootstrap" +#boot_loader_openfirmware Raw 'UNIX' 'boot' "bootstrap" +boot_loader_openfirmware Raw 'UNIX' 'tbxi' "bootstrap" +* Raw 'UNIX' 'UNIX' "unix" From axeld at mail.berlios.de Sun Nov 9 22:49:33 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 9 Nov 2008 22:49:33 +0100 Subject: [Haiku-commits] r28584 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200811092149.mA9LnXFc024198@sheep.berlios.de> Author: axeld Date: 2008-11-09 22:49:33 +0100 (Sun, 09 Nov 2008) New Revision: 28584 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28584&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp Log: * The large page mapper did not invalidate the TLBs of the other CPUs for the generic page mapping mechanism. This should fix #2902 (will test in a minute). Modified: haiku/trunk/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp 2008-11-09 21:36:07 UTC (rev 28583) +++ haiku/trunk/src/system/kernel/arch/x86/x86_physical_page_mapper_large_memory.cpp 2008-11-09 21:49:33 UTC (rev 28584) @@ -595,6 +595,9 @@ *handle = slot; *virtualAddress = slot->address + physicalAddress % B_PAGE_SIZE; + smp_send_broadcast_ici(SMP_MSG_INVALIDATE_PAGE_RANGE, *virtualAddress, + *virtualAddress, 0, NULL, SMP_MSG_FLAG_SYNC); + return B_OK; } From anevilyak at mail.berlios.de Sun Nov 9 23:04:52 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sun, 9 Nov 2008 23:04:52 +0100 Subject: [Haiku-commits] r28585 - haiku/trunk/src/servers/app Message-ID: <200811092204.mA9M4qok025307@sheep.berlios.de> Author: anevilyak Date: 2008-11-09 23:04:51 +0100 (Sun, 09 Nov 2008) New Revision: 28585 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28585&view=rev Modified: haiku/trunk/src/servers/app/WorkspacesView.cpp Log: Reset the drawing state to that of the client view after we finish drawing the workspaces replicant. This fixes artifacts like fonts occasionally appearing tiny when selecting/deselecting items on the Desktop if the Workspaces replicant was also embedded. Modified: haiku/trunk/src/servers/app/WorkspacesView.cpp =================================================================== --- haiku/trunk/src/servers/app/WorkspacesView.cpp 2008-11-09 21:49:33 UTC (rev 28584) +++ haiku/trunk/src/servers/app/WorkspacesView.cpp 2008-11-09 22:04:51 UTC (rev 28585) @@ -394,6 +394,7 @@ for (int32 i = rows * columns; i-- > 0;) { _DrawWorkspace(drawingEngine, redraw, i); } + fWindow->ServerWindow()->ResyncDrawState(); } From ingo_weinhold at gmx.de Sun Nov 9 23:37:00 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 09 Nov 2008 23:37:00 +0100 Subject: [Haiku-commits] r28582 - haiku/trunk/build/jam In-Reply-To: References: <200811091826.mA9IQ4Gx023047@sheep.berlios.de> Message-ID: <20081109233700.361.1@knochen-vm.localdomain> On 2008-11-09 at 19:40:33 [+0100], Rene Gollent wrote: > On Sun, Nov 9, 2008 at 12:26 PM, bonefish at BerliOS > wrote: > > Modified: > > haiku/trunk/build/jam/OptionalPackages > > Log: > > * Removed the /boot/develop/headers/gnu symlink. > > * Updated autoconf, automake, libtool, texinfo, flex, and bison to > > their respectively current version. They are installed in /boot/common > > now. > > * Removed the /boot/home/config/bin/perl and /bin/m4 symlinks again. > > > > The automake package that this points to doesn't appear to exist on > haiku-files, though all the others do. Sorry, forgot to upload it. CU, Ingo From ingo_weinhold at gmx.de Sun Nov 9 23:47:23 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Sun, 09 Nov 2008 23:47:23 +0100 Subject: [Haiku-commits] r28584 - haiku/trunk/src/system/kernel/arch/x86 In-Reply-To: <200811092149.mA9LnXFc024198@sheep.berlios.de> References: <200811092149.mA9LnXFc024198@sheep.berlios.de> Message-ID: <20081109234723.429.2@knochen-vm.localdomain> On 2008-11-09 at 22:49:33 [+0100], axeld at BerliOS wrote: > Author: axeld > Date: 2008-11-09 22:49:33 +0100 (Sun, 09 Nov 2008) > New Revision: 28584 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28584&view=rev > > Modified: > haiku/trunk/src/system/kernel/arch/x86/x86_physical_page_mapper_large_mem > ory.cpp > Log: > * The large page mapper did not invalidate the TLBs of the other CPUs for > the > generic page mapping mechanism. This should fix #2902 (will test in a > minute). Cool, thanks! Anyway, it would be a good idea, performance-wise, to implement the io() hook in the usb_disk driver. Only if missing the fallback code that does synchronous page-wise I/O (and maps the pages on all CPUs) is executed. The same goes for file systems using the file cache. CU, Ingo From leavengood at mail.berlios.de Sun Nov 9 23:50:26 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Sun, 9 Nov 2008 23:50:26 +0100 Subject: [Haiku-commits] r28586 - haiku/trunk/src/add-ons/screen_savers/message Message-ID: <200811092250.mA9MoQ8q028656@sheep.berlios.de> Author: leavengood Date: 2008-11-09 23:50:26 +0100 (Sun, 09 Nov 2008) New Revision: 28586 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28586&view=rev Modified: haiku/trunk/src/add-ons/screen_savers/message/Jamfile haiku/trunk/src/add-ons/screen_savers/message/Message.cpp Log: Use BObjectList instead of BList. Modified: haiku/trunk/src/add-ons/screen_savers/message/Jamfile =================================================================== --- haiku/trunk/src/add-ons/screen_savers/message/Jamfile 2008-11-09 22:04:51 UTC (rev 28585) +++ haiku/trunk/src/add-ons/screen_savers/message/Jamfile 2008-11-09 22:50:26 UTC (rev 28586) @@ -1,5 +1,8 @@ SubDir HAIKU_TOP src add-ons screen_savers message ; +UsePrivateHeaders shared ; + # For ObjectList + SetSubDirSupportedPlatformsBeOSCompatible ; ScreenSaver Message : Modified: haiku/trunk/src/add-ons/screen_savers/message/Message.cpp =================================================================== --- haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2008-11-09 22:04:51 UTC (rev 28585) +++ haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2008-11-09 22:50:26 UTC (rev 28586) @@ -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. * * Authors: @@ -9,7 +9,7 @@ #include #include -#include +#include #include #include #include @@ -97,9 +97,9 @@ status_t StartSaver(BView *view, bool preview); private: - BList *fFontFamilies; - float fScaleFactor; - bool fPreview; + BObjectList *fFontFamilies; + float fScaleFactor; + bool fPreview; }; @@ -121,7 +121,7 @@ if (fFontFamilies) { for (int32 i = 0; i < fFontFamilies->CountItems(); i++) { if (fFontFamilies->ItemAt(i)) - delete ((font_family) fFontFamilies->ItemAt(i)); + delete fFontFamilies->ItemAt(i); } delete fFontFamilies; } @@ -146,14 +146,14 @@ // Get font families int numFamilies = count_font_families(); - fFontFamilies = new BList(); + fFontFamilies = new BObjectList(); for (int32 i = 0; i < numFamilies; i++) { font_family *family = new font_family[1]; uint32 flags; if (get_font_family(i, family, &flags) == B_OK) { // Do not add fixed fonts if (!(flags & B_IS_FIXED)) - fFontFamilies->AddItem(*family); + fFontFamilies->AddItem(family); } } @@ -199,7 +199,7 @@ BFont font; offscreen.GetFont(&font); font.SetFace(B_BOLD_FACE); - font.SetFamilyAndStyle((font_family) fFontFamilies->ItemAt(rand() % fFontFamilies->CountItems()), NULL); + font.SetFamilyAndStyle(*(fFontFamilies->ItemAt(rand() % fFontFamilies->CountItems())), NULL); offscreen.SetFont(&font); // Get the message @@ -252,7 +252,7 @@ // Now draw the full message in a nice translucent box, but only // if this isn't preview mode if (!fPreview) { - BFont font(be_fixed_font); + BFont font(be_fixed_font); font.SetSize(14.0); offscreen.SetFont(&font); font_height fontHeight; From anevilyak at gmail.com Mon Nov 10 01:36:03 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 9 Nov 2008 18:36:03 -0600 Subject: [Haiku-commits] r28582 - haiku/trunk/build/jam In-Reply-To: <20081109233700.361.1@knochen-vm.localdomain> References: <200811091826.mA9IQ4Gx023047@sheep.berlios.de> <20081109233700.361.1@knochen-vm.localdomain> Message-ID: On Sun, Nov 9, 2008 at 4:37 PM, Ingo Weinhold wrote: > Sorry, forgot to upload it. Figured, thanks for fixing :) Regards, Rene From mmu_man at mail.berlios.de Mon Nov 10 03:03:59 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Mon, 10 Nov 2008 03:03:59 +0100 Subject: [Haiku-commits] r28587 - haiku/trunk/src/system/boot/platform/openfirmware/arch/ppc Message-ID: <200811100203.mAA23xgA012802@sheep.berlios.de> Author: mmu_man Date: 2008-11-10 03:03:58 +0100 (Mon, 10 Nov 2008) New Revision: 28587 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28587&view=rev Modified: haiku/trunk/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp Log: This gets the bootloader further on, but it still breaks... OpenHackware seems worse than Pegasos OF :^) Modified: haiku/trunk/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp 2008-11-09 22:50:26 UTC (rev 28586) +++ haiku/trunk/src/system/boot/platform/openfirmware/arch/ppc/mmu.cpp 2008-11-10 02:03:58 UTC (rev 28587) @@ -24,6 +24,9 @@ #define PAGE_READ_ONLY 0x01 #define PAGE_READ_WRITE 0x02 +// NULL is actually a possible physical address... +//#define PHYSINVAL ((void *)-1) +#define PHYSINVAL NULL segment_descriptor sSegments[16]; page_table_entry_group *sPageTable; @@ -216,16 +219,20 @@ static status_t find_physical_memory_ranges(size_t &total) { - int memory; + int memory, package; + printf("checking for memory...\n"); if (of_getprop(gChosen, "memory", &memory, sizeof(int)) == OF_FAILED) return B_ERROR; - memory = of_instance_to_package(memory); + package = of_instance_to_package(memory); total = 0; struct of_region regions[64]; - int count = of_getprop(memory, "reg", regions, sizeof(regions)); + int count; + count = of_getprop(package, "reg", regions, sizeof(regions)); if (count == OF_FAILED) + count = of_getprop(memory, "reg", regions, sizeof(regions)); + if (count == OF_FAILED) return B_ERROR; count /= sizeof(of_region); @@ -523,7 +530,7 @@ if (gKernelArgs.physical_memory_range[i].size > size) return (void *)gKernelArgs.physical_memory_range[i].start; } - return NULL; + return PHYSINVAL; } @@ -534,7 +541,7 @@ // ranges (dumb memory allocation) if (gKernelArgs.num_physical_allocated_ranges == 0) { if (gKernelArgs.num_physical_memory_ranges == 0) - return NULL; + return PHYSINVAL; return find_physical_memory_range(size); } @@ -544,7 +551,7 @@ if (!is_physical_allocated(address, size) && is_physical_memory(address, size)) return address; } - return NULL; + return PHYSINVAL; } @@ -612,7 +619,7 @@ // so that we don't have to optimize for these cases :) void *physicalAddress = find_free_physical_range(size); - if (physicalAddress == NULL) { + if (physicalAddress == PHYSINVAL) { dprintf("arch_mmu_allocate(base: %p, size: %lu) no free physical " "address\n", virtualAddress, size); return NULL; @@ -889,9 +896,10 @@ printf("MSR: %p\n", (void *)get_msr()); -// block_address_translation bat; +#if 0 + block_address_translation bat; -/* bat.length = BAT_LENGTH_256MB; + bat.length = BAT_LENGTH_256MB; bat.kernel_valid = true; bat.memory_coherent = true; bat.protection = BAT_READ_WRITE; @@ -899,7 +907,8 @@ set_ibat0(&bat); set_dbat0(&bat); isync(); -puts("2");*/ +puts("2"); +#endif // initialize segment descriptors, but don't set the registers // until we're about to take over the page table - we're mapping @@ -916,7 +925,7 @@ if (find_allocated_ranges(oldTable, table, &physicalTable, &exceptionHandlers) < B_OK) { puts("find_allocated_ranges() failed!"); - return B_ERROR; + //return B_ERROR; } #if 0 @@ -942,6 +951,10 @@ insert_physical_allocated_range((void *)table, tableSize); insert_virtual_allocated_range((void *)table, tableSize); + // QEMU OpenHackware work-around + insert_physical_allocated_range((void *)0x05800000, 0x06000000 - 0x05800000); + insert_virtual_allocated_range((void *)0x05800000, 0x06000000 - 0x05800000); + physicalTable = table; } From anevilyak at mail.berlios.de Mon Nov 10 05:54:48 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 10 Nov 2008 05:54:48 +0100 Subject: [Haiku-commits] r28588 - haiku/trunk/src/kits/interface Message-ID: <200811100454.mAA4smIh003299@sheep.berlios.de> Author: anevilyak Date: 2008-11-10 05:54:47 +0100 (Mon, 10 Nov 2008) New Revision: 28588 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28588&view=rev Modified: haiku/trunk/src/kits/interface/Shelf.cpp Log: Resolved some more misunderstandings in how this is supposed to work. Ticket #3087 should finally be fixed now. Modified: haiku/trunk/src/kits/interface/Shelf.cpp =================================================================== --- haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 02:03:58 UTC (rev 28587) +++ haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 04:54:47 UTC (rev 28588) @@ -675,6 +675,7 @@ BPropertyInfo shelfPropInfo(sShelfPropertyList); BHandler *target = NULL; BView *replicant = NULL; + switch (shelfPropInfo.FindMatch(msg, 0, specifier, form, property)) { case 0: if (msg->what == B_COUNT_PROPERTIES) { @@ -682,12 +683,11 @@ break; } case 1: - if (msg->PopSpecifier() != B_OK ) { + if (msg->PopSpecifier() != B_OK) { target = this; break; } msg->SetCurrentSpecifier(index); - // fall through case 2: { BMessage reply; status_t err = _GetProperty(specifier, &reply); @@ -699,7 +699,8 @@ ReplicantAt(i, &replicant, &ID, &err); if (err == B_OK && replicant != NULL) { - return this; + if (index == 0) + return this; } else { BMessage replyMsg(B_MESSAGE_NOT_UNDERSTOOD); replyMsg.AddInt32("error", B_BAD_INDEX); @@ -707,6 +708,7 @@ msg->SendReply(&replyMsg); } } + msg->PopSpecifier(); break; } From anevilyak at mail.berlios.de Mon Nov 10 06:52:45 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 10 Nov 2008 06:52:45 +0100 Subject: [Haiku-commits] r28589 - haiku/trunk/src/kits/interface Message-ID: <200811100552.mAA5qjxM014416@sheep.berlios.de> Author: anevilyak Date: 2008-11-10 06:52:43 +0100 (Mon, 10 Nov 2008) New Revision: 28589 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28589&view=rev Modified: haiku/trunk/src/kits/interface/Shelf.cpp Log: Implement missing B_CREATE_PROPERTY. Modified: haiku/trunk/src/kits/interface/Shelf.cpp =================================================================== --- haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 04:54:47 UTC (rev 28588) +++ haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 05:52:43 UTC (rev 28589) @@ -613,6 +613,17 @@ break; } return BHandler::MessageReceived(msg); + + case B_CREATE_PROPERTY: + { + BMessage replicantMsg; + BPoint pos; + if (msg->FindMessage("data", &replicantMsg) == B_OK + && msg->FindPoint("location", &pos) == B_OK) { + err = AddReplicant(&replicantMsg, pos); + } + } + break; } if (err < B_OK) { @@ -678,10 +689,8 @@ switch (shelfPropInfo.FindMatch(msg, 0, specifier, form, property)) { case 0: - if (msg->what == B_COUNT_PROPERTIES) { - target = this; - break; - } + target = this; + break; case 1: if (msg->PopSpecifier() != B_OK) { target = this; From axeld at pinc-software.de Mon Nov 10 11:24:55 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 10 Nov 2008 11:24:55 +0100 CET Subject: [Haiku-commits] r28588 - haiku/trunk/src/kits/interface In-Reply-To: <200811100454.mAA4smIh003299@sheep.berlios.de> Message-ID: <6142188347-BeMail@zon> anevilyak at BerliOS wrote: > msg->SetCurrentSpecifier(index); > - // fall through > case 2: { Comments like this should definitely stay in the code, so that no one wonders if that's really intended when looking at the code. Bye, Axel. From axeld at pinc-software.de Mon Nov 10 11:26:05 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 10 Nov 2008 11:26:05 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28586_-_haiku/trunk/src/add-ons/screen?= =?utf-8?q?=5Fsavers/message?= In-Reply-To: <200811092250.mA9MoQ8q028656@sheep.berlios.de> Message-ID: <6212784263-BeMail@zon> leavengood at BerliOS wrote: > + BObjectList *fFontFamilies; Why a pointer to a list anyway? Bye, Axel. From stippi at mail.berlios.de Mon Nov 10 12:16:10 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Mon, 10 Nov 2008 12:16:10 +0100 Subject: [Haiku-commits] r28590 - in haiku/trunk/src/add-ons/input_server/devices: keyboard mouse touchpad Message-ID: <200811101116.mAABGA7W013596@sheep.berlios.de> Author: stippi Date: 2008-11-10 12:16:02 +0100 (Mon, 10 Nov 2008) New Revision: 28590 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28590&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.h haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.h Log: * Cleanup and refactoring, made several Mouse-/Keyboard-/TouchpadDevice functions private and moved them accordingly in the file. * I forgot to initialize the BObjectList to own the items in TouchpadInputDevice. * Changed the methods that read and apply settings in all three addons to be executed from the control threads only, which fixes race conditions. * The success of opening a device is no longer checked in the Start() method of the *Devices. Instead, the control thread checks the device before it enters the polling loop and cleans up if there was an error. This fixes non-running devices in the input_server because the PS/2 driver publishes devices which is has not checked yet for other reasons. It is important, however, to open() the devices in the Start() hook and not the control thread, otherwise there are unwanted race conditions in case node monitoring events are received more than once for the same device. That's the case for some reason on one of my computers for the AT 0 keyboard. TODO: * Combine the Touchpad and Mouse device addon into one, it's almost the same code except the Touchpad knows more settings and one more control message. * Refactor a common base class for Keyboard and Mouse device addon. * Fix the mouse speed/acceleration. If the speed is lowered from the default in the preflet, the mouse becomes almost unusable. To fix this, the same trick should be used as I used in the touchpad kernel driver, which is to sum up previous mouse moved fractional offsets. Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-10 05:52:43 UTC (rev 28589) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-10 11:16:02 UTC (rev 28590) @@ -26,18 +26,62 @@ #include "kb_mouse_driver.h" -//#define TRACE_KEYBOARD_DEVICE +#undef TRACE +#define TRACE_KEYBOARD_DEVICE #ifdef TRACE_KEYBOARD_DEVICE -# define LOG(text...) debug_printf(text) -# define LOG_ERR(text...) LOG(text) + + class FunctionTracer { + public: + FunctionTracer(const void* pointer, const char* className, + const char* functionName, + int32& depth) + : fFunctionName(), + fPrepend(), + fFunctionDepth(depth), + fPointer(pointer) + { + fFunctionDepth++; + fPrepend.Append(' ', fFunctionDepth * 2); + fFunctionName << className << "::" << functionName << "()"; + + debug_printf("%p -> %s%s {\n", fPointer, fPrepend.String(), + fFunctionName.String()); + } + + ~FunctionTracer() + { + debug_printf("%p -> %s}\n", fPointer, fPrepend.String()); + fFunctionDepth--; + } + + private: + BString fFunctionName; + BString fPrepend; + int32& fFunctionDepth; + const void* fPointer; + }; + + + static int32 sFunctionDepth = -1; +# define KD_CALLED(x...) FunctionTracer _ft(this, "KeyboardDevice", \ + __FUNCTION__, sFunctionDepth) +# define KID_CALLED(x...) FunctionTracer _ft(this, "KeyboardInputDevice", \ + __FUNCTION__, sFunctionDepth) +# define TRACE(x...) { BString _to; \ + _to.Append(' ', (sFunctionDepth + 1) * 2); \ + debug_printf("%p -> %s", this, _to.String()); \ + debug_printf(x); } +# define LOG_EVENT(text...) do {} while (0) +# define LOG_ERR(text...) TRACE(text) #else -# define LOG(text...) do {} while (0) +# define TRACE(x...) do {} while (0) +# define KD_CALLED(x...) TRACE(x) +# define KID_CALLED(x...) TRACE(x) # define LOG_ERR(text...) debug_printf(text) +# define LOG_EVENT(text...) TRACE(x) #endif -#define CALLED() LOG("%s\n", __PRETTY_FUNCTION__) - const static uint32 kKeyboardThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; const static char* kKeyboardDevicesDirectory = "/dev/input/keyboard"; @@ -346,7 +390,6 @@ static char* get_short_name(const char* longName) { - CALLED(); BString string(longName); BString name; @@ -379,8 +422,12 @@ fThread(-1), fActive(false), fInputMethodStarted(false), + fUpdateSettings(false), + fSettingsCommand(0), fKeymapLock("keymap lock") { + KD_CALLED(); + strcpy(fPath, path); fDeviceRef.name = get_short_name(path); fDeviceRef.type = B_KEYBOARD_DEVICE; @@ -397,6 +444,9 @@ KeyboardDevice::~KeyboardDevice() { + KD_CALLED(); + TRACE("delete\n"); + if (fActive) Stop(); @@ -409,37 +459,11 @@ } -status_t -KeyboardDevice::EnqueueInlineInputMethod(int32 opcode, - const char* string, bool confirmed, BMessage* keyDown) -{ - BMessage* message = new BMessage(B_INPUT_METHOD_EVENT); - if (message == NULL) - return B_NO_MEMORY; - - message->AddInt32("be:opcode", opcode); - message->AddBool("be:inline_only", true); - - if (string != NULL) - message->AddString("be:string", string); - if (confirmed) - message->AddBool("be:confirmed", true); - if (keyDown) - message->AddMessage("be:translated", keyDown); - if (opcode == B_INPUT_METHOD_STARTED) - message->AddMessenger("be:reply_to", this); - - status_t status = fOwner->EnqueueMessage(message); - if (status != B_OK) - delete message; - - return status; -} - - void KeyboardDevice::MessageReceived(BMessage* message) { + KD_CALLED(); + if (message->what != B_INPUT_METHOD_EVENT) { BHandler::MessageReceived(message); return; @@ -457,22 +481,21 @@ status_t KeyboardDevice::Start() { - if ((fFD = open(fPath, O_RDWR)) < B_OK) { - fprintf(stderr, "error when opening %s: %s\n", fPath, strerror(errno)); - return B_ERROR; - } + KD_CALLED(); + TRACE("name: %s\n", fDeviceRef.name); - InitFromSettings(); + fFD = open(fPath, O_RDWR); + // let the control thread handle any error on opening the device char threadName[B_OS_NAME_LENGTH]; snprintf(threadName, B_OS_NAME_LENGTH, "%s watcher", fDeviceRef.name); - fActive = true; - fThread = spawn_thread(_ThreadEntry, threadName, + fThread = spawn_thread(_ControlThreadEntry, threadName, kKeyboardThreadPriority, this); if (fThread < B_OK) return fThread; + fActive = true; resume_thread(fThread); return B_OK; } @@ -480,6 +503,9 @@ void KeyboardDevice::Stop() { + KD_CALLED(); + TRACE("name: %s\n", fDeviceRef.name); + fActive = false; close(fFD); @@ -495,70 +521,48 @@ status_t -KeyboardDevice::InitFromSettings(uint32 opcode) +KeyboardDevice::UpdateSettings(uint32 opcode) { - CALLED(); + KD_CALLED(); - if (opcode == 0 || opcode == B_KEY_REPEAT_RATE_CHANGED) { - if (get_key_repeat_rate(&fSettings.key_repeat_rate) != B_OK) - LOG_ERR("error when get_key_repeat_rate\n"); - else if (ioctl(fFD, KB_SET_KEY_REPEAT_RATE, - &fSettings.key_repeat_rate) != B_OK) - LOG_ERR("error when KB_SET_KEY_REPEAT_RATE, fd:%d\n", fFD); - } + if (fThread < 0) + return B_ERROR; - if (opcode == 0 || opcode == B_KEY_REPEAT_DELAY_CHANGED) { - if (get_key_repeat_delay(&fSettings.key_repeat_delay) != B_OK) - LOG_ERR("error when get_key_repeat_delay\n"); - else if (ioctl(fFD, KB_SET_KEY_REPEAT_DELAY, - &fSettings.key_repeat_delay) != B_OK) - LOG_ERR("error when KB_SET_KEY_REPEAT_DELAY, fd:%d\n", fFD); - } + // schedule updating the settings from within the control thread + fSettingsCommand = opcode; + fUpdateSettings = true; - if (opcode == 0 || opcode == B_KEY_MAP_CHANGED - || opcode == B_KEY_LOCKS_CHANGED) { - BAutolock lock(fKeymapLock); - fKeymap.LoadCurrent(); - fModifiers = fKeymap.Locks(); - UpdateLEDs(); - } - return B_OK; } -void -KeyboardDevice::UpdateLEDs() -{ - if (fFD < 0) - return; +// #pragma mark - control thread - uint32 locks = fModifiers; - char lockIO[3]; - memset(lockIO, 0, sizeof(lockIO)); - if (locks & B_NUM_LOCK) - lockIO[0] = 1; - if (locks & B_CAPS_LOCK) - lockIO[1] = 1; - if (locks & B_SCROLL_LOCK) - lockIO[2] = 1; - ioctl(fFD, KB_SET_LEDS, &lockIO); -} - - /*static*/ int32 -KeyboardDevice::_ThreadEntry(void* arg) +KeyboardDevice::_ControlThreadEntry(void* arg) { KeyboardDevice* device = (KeyboardDevice*)arg; - return device->_Thread(); + return device->_ControlThread(); } int32 -KeyboardDevice::_Thread() +KeyboardDevice::_ControlThread() { - CALLED(); + KD_CALLED(); + TRACE("fPath: %s\n", fPath); + + if (fFD < B_OK) { + LOG_ERR("KeyboardDevice: error when opening %s: %s\n", + fPath, strerror(errno)); + _ControlThreadCleanup(); + // TOAST! + return B_ERROR; + } + + _UpdateSettings(0); + uint8 buffer[16]; uint8 activeDeadKey = 0; uint32 lastKeyCode = 0; @@ -568,29 +572,24 @@ memset(states, 0, sizeof(states)); - LOG("%s\n", __PRETTY_FUNCTION__); - while (fActive) { if (ioctl(fFD, KB_READ, &buffer) != B_OK) { - if (fActive) { - fThread = -1; - fOwner->_RemoveDevice(fPath); - } else { - // In case fActive is already false, another thread - // waits for this thread to quit, and may already hold - // locks that _RemoveDevice() wants to acquire. In another - // words, the device is already being removed, so we simply - // quit here. - } + _ControlThreadCleanup(); // TOAST! return 0; } + // Update the settings from this thread if necessary + if (fUpdateSettings) { + _UpdateSettings(fSettingsCommand); + fUpdateSettings = false; + } + uint32 keycode = 0; bool isKeyDown = false; bigtime_t timestamp = 0; - LOG("KB_READ :"); + LOG_EVENT("KB_READ :"); if (fIsAT) { at_kbd_io* atKeyboard = (at_kbd_io*)buffer; @@ -598,7 +597,7 @@ keycode = kATKeycodeMap[atKeyboard->scancode - 1]; isKeyDown = atKeyboard->is_keydown; timestamp = atKeyboard->timestamp; - LOG(" %02x", atKeyboard->scancode); + LOG_EVENT(" %02x", atKeyboard->scancode); } else { raw_key_info* rawKeyInfo= (raw_key_info*)buffer; isKeyDown = rawKeyInfo->is_keydown; @@ -609,7 +608,7 @@ if (keycode == 0) continue; - LOG(" %Ld, %02x, %02lx\n", timestamp, isKeyDown, keycode); + LOG_EVENT(" %Ld, %02x, %02lx\n", timestamp, isKeyDown, keycode); if (isKeyDown && keycode == 0x68) { // MENU KEY for Tracker @@ -638,7 +637,7 @@ if (isKeyDown && keycode == 0x34 // DELETE KEY && (states[0x5c >> 3] & (1 << (7 - (0x5c & 0x7)))) && (states[0x5d >> 3] & (1 << (7 - (0x5d & 0x7))))) { - LOG("TeamMonitor called\n"); + LOG_EVENT("TeamMonitor called\n"); // show the team monitor if (fOwner->fTeamMonitorWindow == NULL) @@ -686,7 +685,7 @@ delete msg; if (modifiers & (B_CAPS_LOCK | B_NUM_LOCK | B_SCROLL_LOCK)) - UpdateLEDs(); + _UpdateLEDs(); } uint8 newDeadKey = 0; @@ -745,25 +744,25 @@ if (isKeyDown && !modifiers && activeDeadKey != 0 && fInputMethodStarted) { // a dead key was completed - EnqueueInlineInputMethod(B_INPUT_METHOD_CHANGED, + _EnqueueInlineInputMethod(B_INPUT_METHOD_CHANGED, string, true, msg); } else if (fOwner->EnqueueMessage(msg) != B_OK) delete msg; } else if (isKeyDown) { // start of a dead key - if (EnqueueInlineInputMethod(B_INPUT_METHOD_STARTED) == B_OK) { + if (_EnqueueInlineInputMethod(B_INPUT_METHOD_STARTED) == B_OK) { char* string = NULL; int32 numBytes = 0; fKeymap.GetChars(keycode, fModifiers, 0, &string, &numBytes); - if (EnqueueInlineInputMethod(B_INPUT_METHOD_CHANGED, string) == B_OK) + if (_EnqueueInlineInputMethod(B_INPUT_METHOD_CHANGED, string) == B_OK) fInputMethodStarted = true; } } if (!isKeyDown && !modifiers) { if (activeDeadKey != 0) { - EnqueueInlineInputMethod(B_INPUT_METHOD_STOPPED); + _EnqueueInlineInputMethod(B_INPUT_METHOD_STOPPED); fInputMethodStarted = false; } @@ -777,15 +776,116 @@ } +void +KeyboardDevice::_ControlThreadCleanup() +{ + // NOTE: Only executed when the control thread detected an error + // and from within the control thread! + + if (fActive) { + fThread = -1; + fOwner->_RemoveDevice(fPath); + } else { + // In case active is already false, another thread + // waits for this thread to quit, and may already hold + // locks that _RemoveDevice() wants to acquire. In another + // words, the device is already being removed, so we simply + // quit here. + } +} + + +void +KeyboardDevice::_UpdateSettings(uint32 opcode) +{ + KD_CALLED(); + + if (opcode == 0 || opcode == B_KEY_REPEAT_RATE_CHANGED) { + if (get_key_repeat_rate(&fSettings.key_repeat_rate) != B_OK) { + LOG_ERR("error when get_key_repeat_rate\n"); + } else if (ioctl(fFD, KB_SET_KEY_REPEAT_RATE, + &fSettings.key_repeat_rate) != B_OK) { + LOG_ERR("error when KB_SET_KEY_REPEAT_RATE, fd:%d\n", fFD); + } + } + + if (opcode == 0 || opcode == B_KEY_REPEAT_DELAY_CHANGED) { + if (get_key_repeat_delay(&fSettings.key_repeat_delay) != B_OK) { + LOG_ERR("error when get_key_repeat_delay\n"); + } else if (ioctl(fFD, KB_SET_KEY_REPEAT_DELAY, + &fSettings.key_repeat_delay) != B_OK) { + LOG_ERR("error when KB_SET_KEY_REPEAT_DELAY, fd:%d\n", fFD); + } + } + + if (opcode == 0 || opcode == B_KEY_MAP_CHANGED + || opcode == B_KEY_LOCKS_CHANGED) { + BAutolock lock(fKeymapLock); + fKeymap.LoadCurrent(); + fModifiers = fKeymap.Locks(); + _UpdateLEDs(); + } +} + + +void +KeyboardDevice::_UpdateLEDs() +{ + if (fFD < 0) + return; + + uint32 locks = fModifiers; + char lockIO[3]; + memset(lockIO, 0, sizeof(lockIO)); + if (locks & B_NUM_LOCK) + lockIO[0] = 1; + if (locks & B_CAPS_LOCK) + lockIO[1] = 1; + if (locks & B_SCROLL_LOCK) + lockIO[2] = 1; + + ioctl(fFD, KB_SET_LEDS, &lockIO); +} + + +status_t +KeyboardDevice::_EnqueueInlineInputMethod(int32 opcode, + const char* string, bool confirmed, BMessage* keyDown) +{ + BMessage* message = new BMessage(B_INPUT_METHOD_EVENT); + if (message == NULL) + return B_NO_MEMORY; + + message->AddInt32("be:opcode", opcode); + message->AddBool("be:inline_only", true); + + if (string != NULL) + message->AddString("be:string", string); + if (confirmed) + message->AddBool("be:confirmed", true); + if (keyDown) + message->AddMessage("be:translated", keyDown); + if (opcode == B_INPUT_METHOD_STARTED) + message->AddMessenger("be:reply_to", this); + + status_t status = fOwner->EnqueueMessage(message); + if (status != B_OK) + delete message; + + return status; +} + + // #pragma mark - KeyboardInputDevice::KeyboardInputDevice() : fDevices(2, true), + fDeviceListLock("KeyboardInputDevice list"), fTeamMonitorWindow(NULL) { - CALLED(); + KID_CALLED(); StartMonitoringDevice(kKeyboardDevicesDirectory); _RecursiveScan(kKeyboardDevicesDirectory); @@ -794,7 +894,7 @@ KeyboardInputDevice::~KeyboardInputDevice() { - CALLED(); + KID_CALLED(); if (fTeamMonitorWindow) { fTeamMonitorWindow->PostMessage(B_QUIT_REQUESTED); @@ -809,7 +909,7 @@ status_t KeyboardInputDevice::SystemShuttingDown() { - CALLED(); + KID_CALLED(); if (fTeamMonitorWindow) fTeamMonitorWindow->PostMessage(SYSTEM_SHUTTING_DOWN); @@ -820,7 +920,7 @@ status_t KeyboardInputDevice::InitCheck() { - CALLED(); + KID_CALLED(); return BInputServerDevice::InitCheck(); } @@ -828,7 +928,9 @@ status_t KeyboardInputDevice::Start(const char* name, void* cookie) { - CALLED(); + KID_CALLED(); + TRACE("name %s\n", name); + KeyboardDevice* device = (KeyboardDevice*)cookie; return device->Start(); @@ -838,11 +940,11 @@ status_t KeyboardInputDevice::Stop(const char* name, void* cookie) { - CALLED(); + KID_CALLED(); + TRACE("name %s\n", name); + KeyboardDevice* device = (KeyboardDevice*)cookie; - LOG("Stop(%s)\n", name); - device->Stop(); return B_OK; } @@ -852,15 +954,15 @@ KeyboardInputDevice::Control(const char* name, void* cookie, uint32 command, BMessage* message) { - CALLED(); - LOG("Control(%s, code: %lu)\n", name, command); + KID_CALLED(); + TRACE("KeyboardInputDevice::Control(%s, code: %lu)\n", name, command); if (command == B_NODE_MONITOR) _HandleMonitor(message); else if (command >= B_KEY_MAP_CHANGED && command <= B_KEY_REPEAT_RATE_CHANGED) { KeyboardDevice* device = (KeyboardDevice*)cookie; - device->InitFromSettings(command); + device->UpdateSettings(command); } return B_OK; } @@ -869,7 +971,7 @@ status_t KeyboardInputDevice::_HandleMonitor(BMessage* message) { - CALLED(); + KID_CALLED(); const char* path; int32 opcode; @@ -906,8 +1008,11 @@ status_t KeyboardInputDevice::_AddDevice(const char* path) { - CALLED(); + KID_CALLED(); + TRACE("path: %s\n", path); + BAutolock _(fDeviceListLock); + _RemoveDevice(path); KeyboardDevice* device = new(std::nothrow) KeyboardDevice(this, path); @@ -927,12 +1032,15 @@ status_t KeyboardInputDevice::_RemoveDevice(const char* path) { - CALLED(); + BAutolock _(fDeviceListLock); KeyboardDevice* device = _FindDevice(path); if (device == NULL) return B_ENTRY_NOT_FOUND; + KID_CALLED(); + TRACE("path: %s\n", path); + input_device_ref* devices[2]; devices[0] = device->DeviceRef(); devices[1] = NULL; @@ -948,7 +1056,9 @@ void KeyboardInputDevice::_RecursiveScan(const char* directory) { - CALLED(); + KID_CALLED(); + TRACE("directory: %s\n", directory); + BEntry entry; BDirectory dir(directory); while (dir.GetNextEntry(&entry) == B_OK) { Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h 2008-11-10 05:52:43 UTC (rev 28589) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.h 2008-11-10 11:16:02 UTC (rev 28590) @@ -10,7 +10,6 @@ #include #include #include -#include #include #include @@ -29,23 +28,24 @@ virtual ~KeyboardDevice(); virtual void MessageReceived(BMessage* message); - status_t EnqueueInlineInputMethod(int32 opcode, - const char* string = NULL, - bool confirmed = false, - BMessage* keyDown = NULL); - status_t Start(); void Stop(); - status_t InitFromSettings(uint32 opcode = 0); - void UpdateLEDs(); + status_t UpdateSettings(uint32 opcode = 0); const char* Path() const { return fPath; } input_device_ref* DeviceRef() { return &fDeviceRef; } private: - static int32 _ThreadEntry(void* arg); - int32 _Thread(); + static int32 _ControlThreadEntry(void* arg); + int32 _ControlThread(); + void _ControlThreadCleanup(); + void _UpdateSettings(uint32 opcode); + void _UpdateLEDs(); + status_t _EnqueueInlineInputMethod(int32 opcode, + const char* string = NULL, + bool confirmed = false, + BMessage* keyDown = NULL); private: KeyboardInputDevice* fOwner; @@ -59,6 +59,9 @@ volatile bool fInputMethodStarted; uint32 fModifiers; + volatile bool fUpdateSettings; + volatile uint32 fSettingsCommand; + Keymap fKeymap; BLocker fKeymapLock; }; @@ -92,6 +95,7 @@ status_t _RemoveDevice(const char* path); BObjectList fDevices; + BLocker fDeviceListLock; TeamMonitorWindow* fTeamMonitorWindow; }; Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-10 05:52:43 UTC (rev 28589) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-10 11:16:02 UTC (rev 28590) @@ -18,6 +18,7 @@ #include #include +#include #include #include #include @@ -31,7 +32,6 @@ #undef TRACE -#undef CALLED //#define TRACE_MOUSE_DEVICE #ifdef TRACE_MOUSE_DEVICE @@ -76,64 +76,63 @@ _to.Append(' ', (sFunctionDepth + 1) * 2); \ debug_printf("%p -> %s", this, _to.String()); \ debug_printf(x); } -# define LOG(text...) debug_printf(text) # define LOG_EVENT(text...) do {} while (0) -# define LOG_ERR(text...) LOG(text) +# define LOG_ERR(text...) TRACE(text) #else # define TRACE(x...) do {} while (0) # define MD_CALLED(x...) TRACE(x) # define MID_CALLED(x...) TRACE(x) -# define LOG(text...) TRACE(x) # define LOG_ERR(text...) debug_printf(text) # define LOG_EVENT(text...) TRACE(x) #endif -//#define LOG_DEVICES(text...) debug_printf(text) -#define LOG_DEVICES(text...) LOG(text) - - - const static uint32 kMouseThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; const static char* kMouseDevicesDirectory = "/dev/input/mouse"; class MouseDevice { - public: - MouseDevice(MouseInputDevice& target, const char* path); - ~MouseDevice(); +public: + MouseDevice(MouseInputDevice& target, + const char* path); + ~MouseDevice(); - status_t Start(); - void Stop(); + status_t Start(); + void Stop(); - status_t UpdateSettings(); + status_t UpdateSettings(); - const char* Path() const { return fPath.String(); } - input_device_ref* DeviceRef() { return &fDeviceRef; } + const char* Path() const { return fPath.String(); } + input_device_ref* DeviceRef() { return &fDeviceRef; } - private: - void _Run(); - static status_t _ThreadFunction(void* arg); +private: + char* _BuildShortName() const; - BMessage* _BuildMouseMessage(uint32 what, uint64 when, uint32 buttons, - int32 deltaX, int32 deltaY) const; - void _ComputeAcceleration(const mouse_movement& movements, - int32& deltaX, int32& deltaY) const; - uint32 _RemapButtons(uint32 buttons) const; + static status_t _ControlThreadEntry(void* arg); + void _ControlThread(); + void _ControlThreadCleanup(); + void _UpdateSettings(); - char* _BuildShortName() const; + BMessage* _BuildMouseMessage(uint32 what, + uint64 when, uint32 buttons, + int32 deltaX, int32 deltaY) const; + void _ComputeAcceleration( + const mouse_movement& movements, + int32& deltaX, int32& deltaY) const; + uint32 _RemapButtons(uint32 buttons) const; - private: - MouseInputDevice& fTarget; - BString fPath; - int fDevice; +private: + MouseInputDevice& fTarget; + BString fPath; + int fDevice; - input_device_ref fDeviceRef; - mouse_settings fSettings; - bool fDeviceRemapsButtons; + input_device_ref fDeviceRef; + mouse_settings fSettings; + bool fDeviceRemapsButtons; - thread_id fThread; - volatile bool fActive; + thread_id fThread; + volatile bool fActive; + volatile bool fUpdateSettings; }; @@ -154,7 +153,8 @@ fDevice(-1), fDeviceRemapsButtons(false), fThread(-1), - fActive(false) + fActive(false), + fUpdateSettings(false) { MD_CALLED(); @@ -175,9 +175,6 @@ MD_CALLED(); TRACE("delete\n"); - if (fTarget._HasDevice(this)) - TRACE("still in the list!\n"); - if (fActive) Stop(); @@ -191,15 +188,12 @@ MD_CALLED(); fDevice = open(fPath.String(), O_RDWR); - if (fDevice < 0) - return errno; + // let the control thread handle any error on opening the device - UpdateSettings(); - char threadName[B_OS_NAME_LENGTH]; snprintf(threadName, B_OS_NAME_LENGTH, "%s watcher", fDeviceRef.name); - fThread = spawn_thread(_ThreadFunction, threadName, + fThread = spawn_thread(_ControlThreadEntry, threadName, kMouseThreadPriority, (void*)this); status_t status; @@ -213,7 +207,6 @@ if (status < B_OK) { LOG_ERR("%s: can't spawn/resume watching thread: %s\n", fDeviceRef.name, strerror(status)); - close(fDevice); return status; } @@ -248,45 +241,63 @@ { MD_CALLED(); - // retrieve current values + if (fThread < 0) + return B_ERROR; - if (get_mouse_map(&fSettings.map) != B_OK) - LOG_ERR("error when get_mouse_map\n"); - else - fDeviceRemapsButtons = ioctl(fDevice, MS_SET_MAP, &fSettings.map) == B_OK; + fUpdateSettings = true; + // This will provoke the control thread to update the settings. - if (get_click_speed(&fSettings.click_speed) != B_OK) - LOG_ERR("error when get_click_speed\n"); - else - ioctl(fDevice, MS_SET_CLICKSPEED, &fSettings.click_speed); + return B_OK; +} - if (get_mouse_speed(&fSettings.accel.speed) != B_OK) - LOG_ERR("error when get_mouse_speed\n"); - else { - if (get_mouse_acceleration(&fSettings.accel.accel_factor) != B_OK) - LOG_ERR("error when get_mouse_acceleration\n"); - else { - mouse_accel accel; - ioctl(fDevice, MS_GET_ACCEL, &accel); - accel.speed = fSettings.accel.speed; - accel.accel_factor = fSettings.accel.accel_factor; - ioctl(fDevice, MS_SET_ACCEL, &fSettings.accel); - } - } - if (get_mouse_type(&fSettings.type) != B_OK) - LOG_ERR("error when get_mouse_type\n"); +char* +MouseDevice::_BuildShortName() const +{ + BString string(fPath); + BString name; + + int32 slash = string.FindLast("/"); + string.CopyInto(name, slash + 1, string.Length() - slash); + int32 index = atoi(name.String()) + 1; + + int32 previousSlash = string.FindLast("/", slash); + string.CopyInto(name, previousSlash + 1, slash - previousSlash - 1); + + if (name == "ps2") + name = "PS/2"; else - ioctl(fDevice, MS_SET_TYPE, &fSettings.type); + name.Capitalize(); - return B_OK; + name << " Mouse " << index; + return strdup(name.String()); } +// #pragma mark - control thread + + +status_t +MouseDevice::_ControlThreadEntry(void* arg) +{ + MouseDevice* device = (MouseDevice*)arg; + device->_ControlThread(); + return B_OK; +} + + void -MouseDevice::_Run() +MouseDevice::_ControlThread() { + if (fDevice < 0) { + _ControlThreadCleanup(); + // TOAST! + return; + } + + _UpdateSettings(); + uint32 lastButtons = 0; while (fActive) { @@ -294,20 +305,17 @@ memset(&movements, 0, sizeof(movements)); if (ioctl(fDevice, MS_READ, &movements) != B_OK) { - if (fActive) { - fThread = -1; - fTarget._RemoveDevice(fPath.String()); - } else { - // In case active is already false, another thread - // waits for this thread to quit, and may already hold - // locks that _RemoveDevice() wants to acquire. In another - // words, the device is already being removed, so we simply - // quit here. - } + _ControlThreadCleanup(); // TOAST! return; } + // take care of updating the settings first, if necessary + if (fUpdateSettings) { + _UpdateSettings(); + fUpdateSettings = false; + } + uint32 buttons = lastButtons ^ movements.buttons; uint32 remappedButtons = _RemapButtons(movements.buttons); @@ -361,15 +369,65 @@ } -status_t -MouseDevice::_ThreadFunction(void* arg) +void +MouseDevice::_ControlThreadCleanup() { - MouseDevice* device = (MouseDevice*)arg; - device->_Run(); - return B_OK; + // NOTE: Only executed when the control thread detected an error + // and from within the control thread! + + if (fActive) { + fThread = -1; + fTarget._RemoveDevice(fPath.String()); + } else { + // In case active is already false, another thread + // waits for this thread to quit, and may already hold + // locks that _RemoveDevice() wants to acquire. In another + // words, the device is already being removed, so we simply + // quit here. + } } +void [... truncated: 731 lines follow ...] From stippi at mail.berlios.de Mon Nov 10 13:33:16 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Mon, 10 Nov 2008 13:33:16 +0100 Subject: [Haiku-commits] r28591 - haiku/trunk/src/add-ons/input_server/devices/mouse Message-ID: <200811101233.mAACXGag016704@sheep.berlios.de> Author: stippi Date: 2008-11-10 13:33:16 +0100 (Mon, 10 Nov 2008) New Revision: 28591 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28591&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp Log: Prepend the mouse name with "Extended " if the device path contains "intelli". This makes sure that you can have an old style mouse without scroll wheel and one with attached at the same time. For example, when I hot-plug my PS/2 mouse with wheel, the IBM trackpoint will otherwise already use up the "PS/2 Mouse 1" name. Unfortunately, hot-plugging the PS/2 mouse on my T60 docking station still does not work quite right. The PS/2 driver detects everything correctly, the node monitoring works and I end up with the correct device threads in the input_server. (The notebook is automatically removing the touchpad and trackpoint devices in this event, which cannot be turned off in the BIOS.) However, the mouse does not move. In the syslog, I see one message "ps2: strange mouse data, x/y overflow, trying resync" after the the output from the add-on manager in the input_server that it has added the new device. When I restart the input_server, it works fine, even though the same devices are detected and polling threads are running. Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-10 11:16:02 UTC (rev 28590) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-10 12:33:16 UTC (rev 28591) @@ -269,6 +269,9 @@ else name.Capitalize(); + if (string.FindFirst("intelli") >= 0) + name.Prepend("Extended "); + name << " Mouse " << index; return strdup(name.String()); From anevilyak at mail.berlios.de Mon Nov 10 14:45:21 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 10 Nov 2008 14:45:21 +0100 Subject: [Haiku-commits] r28592 - haiku/trunk/src/kits/interface Message-ID: <200811101345.mAADjLi1023951@sheep.berlios.de> Author: anevilyak Date: 2008-11-10 14:45:21 +0100 (Mon, 10 Nov 2008) New Revision: 28592 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28592&view=rev Modified: haiku/trunk/src/kits/interface/Shelf.cpp Log: Restore accidentally removed comment. Modified: haiku/trunk/src/kits/interface/Shelf.cpp =================================================================== --- haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 12:33:16 UTC (rev 28591) +++ haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 13:45:21 UTC (rev 28592) @@ -620,7 +620,7 @@ BPoint pos; if (msg->FindMessage("data", &replicantMsg) == B_OK && msg->FindPoint("location", &pos) == B_OK) { - err = AddReplicant(&replicantMsg, pos); + err = AddReplicant(&replicantMsg, pos);: } } break; @@ -697,6 +697,7 @@ break; } msg->SetCurrentSpecifier(index); + // fall through case 2: { BMessage reply; status_t err = _GetProperty(specifier, &reply); From anevilyak at gmail.com Mon Nov 10 14:45:39 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 10 Nov 2008 07:45:39 -0600 Subject: [Haiku-commits] r28588 - haiku/trunk/src/kits/interface In-Reply-To: <6142188347-BeMail@zon> References: <200811100454.mAA4smIh003299@sheep.berlios.de> <6142188347-BeMail@zon> Message-ID: On Mon, Nov 10, 2008 at 4:24 AM, Axel D?rfler wrote: > anevilyak at BerliOS wrote: >> msg->SetCurrentSpecifier(index); >> - // fall through >> case 2: { > > Comments like this should definitely stay in the code, so that no one > wonders if that's really intended when looking at the code. > Indeed, that was most definitely not intentional. Had quite a bit of debugging code in that function while tracking problems down and must have removed one line too many. Thanks for keeping an eye out! Regards, Rene From anevilyak at mail.berlios.de Mon Nov 10 14:47:58 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 10 Nov 2008 14:47:58 +0100 Subject: [Haiku-commits] r28593 - haiku/trunk/src/kits/interface Message-ID: <200811101347.mAADlwZ1024141@sheep.berlios.de> Author: anevilyak Date: 2008-11-10 14:47:58 +0100 (Mon, 10 Nov 2008) New Revision: 28593 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28593&view=rev Modified: haiku/trunk/src/kits/interface/Shelf.cpp Log: Remove. Modified: haiku/trunk/src/kits/interface/Shelf.cpp =================================================================== --- haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 13:45:21 UTC (rev 28592) +++ haiku/trunk/src/kits/interface/Shelf.cpp 2008-11-10 13:47:58 UTC (rev 28593) @@ -620,7 +620,7 @@ BPoint pos; if (msg->FindMessage("data", &replicantMsg) == B_OK && msg->FindPoint("location", &pos) == B_OK) { - err = AddReplicant(&replicantMsg, pos);: + err = AddReplicant(&replicantMsg, pos); } } break; From anevilyak at gmail.com Mon Nov 10 15:30:08 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 10 Nov 2008 08:30:08 -0600 Subject: [Haiku-commits] r28593 - haiku/trunk/src/kits/interface In-Reply-To: <200811101347.mAADlwZ1024141@sheep.berlios.de> References: <200811101347.mAADlwZ1024141@sheep.berlios.de> Message-ID: Hi, On Mon, Nov 10, 2008 at 7:47 AM, anevilyak at BerliOS wrote: > - err = AddReplicant(&replicantMsg, pos);: > + err = AddReplicant(&replicantMsg, pos); This actually happened because of a pet annoyance of Pe: if you hit cmd+f to bring up the find panel, there's a small delay between you hitting the key and it coming up. During this delay, the edit window still takes keystrokes. In more or less every other editor I use, this delay doesn't exist. Can this be fixed? Regards, Rene From korli at users.berlios.de Mon Nov 10 15:52:25 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Mon, 10 Nov 2008 15:52:25 +0100 Subject: [Haiku-commits] r28592 - haiku/trunk/src/kits/interface In-Reply-To: <200811101345.mAADjLi1023951@sheep.berlios.de> References: <200811101345.mAADjLi1023951@sheep.berlios.de> Message-ID: 2008/11/10 anevilyak at BerliOS : > - err = AddReplicant(&replicantMsg, pos); > + err = AddReplicant(&replicantMsg, pos);: Ooops... Bye, J?r?me From anevilyak at gmail.com Mon Nov 10 15:59:14 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 10 Nov 2008 08:59:14 -0600 Subject: [Haiku-commits] r28592 - haiku/trunk/src/kits/interface In-Reply-To: References: <200811101345.mAADjLi1023951@sheep.berlios.de> Message-ID: On Mon, Nov 10, 2008 at 8:52 AM, J?r?me Duval wrote: > 2008/11/10 anevilyak at BerliOS : >> - err = AddReplicant(&replicantMsg, pos); >> + err = AddReplicant(&replicantMsg, pos);: > > > Ooops... > Already fixed and explained :) Regards, Rene From bonefish at mail.berlios.de Mon Nov 10 16:27:22 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Mon, 10 Nov 2008 16:27:22 +0100 Subject: [Haiku-commits] r28594 - haiku/trunk/data/system/boot Message-ID: <200811101527.mAAFRMqR000487@sheep.berlios.de> Author: bonefish Date: 2008-11-10 16:27:21 +0100 (Mon, 10 Nov 2008) New Revision: 28594 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28594&view=rev Modified: haiku/trunk/data/system/boot/SetupEnvironment Log: * All platforms will use gcc and there's no reason not to put it in the same place. * Added /boot/common/lib to BELIBRARIES. Modified: haiku/trunk/data/system/boot/SetupEnvironment =================================================================== --- haiku/trunk/data/system/boot/SetupEnvironment 2008-11-10 13:47:58 UTC (rev 28593) +++ haiku/trunk/data/system/boot/SetupEnvironment 2008-11-10 15:27:21 UTC (rev 28594) @@ -9,22 +9,20 @@ export GROUP=users BUILDHOME=/boot/develop +BETOOLS="$BUILDHOME/tools/gnupro/bin" case `uname -m` in BePC|Intel|unknown) BE_HOST_CPU=x86 - BETOOLS="$BUILDHOME/tools/gnupro/bin" ;; BeMac|BeBox) BE_HOST_CPU=ppc - BETOOLS="$BUILDHOME/bin" ;; *) BE_HOST_CPU=unknown - BETOOLS="$BUILDHOME/bin" esac -BELIBRARIES="$BUILDHOME/lib/$BE_HOST_CPU" +BELIBRARIES="/boot/common/lib:$BUILDHOME/lib/$BE_HOST_CPU" BH=$BUILDHOME/headers BEINCLUDES="$BH;$BH/be;$BH/be/precompiled;$BH/be/bone;$BH/posix;$BH/cpp;$BH/be/app;$BH/be/device;$BH/be/interface;$BH/be/media;$BH/be/midi;$BH/be/midi2;$BH/be/net;$BH/be/kernel;$BH/be/storage;$BH/be/support;$BH/be/game;$BH/be/opengl;$BH/be/drivers;$BH/gnu;$BH/be/mail;$BH/be/translation;$BH/be/devel;$BH/be/add-ons/graphics;$BH/be/be_apps/Deskbar;$BH/be/be_apps/NetPositive;$BH/be/be_apps/Tracker" @@ -66,4 +64,3 @@ . $HOME/config/boot/UserSetupEnvironment fi fi - From axeld at pinc-software.de Mon Nov 10 15:57:15 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 10 Nov 2008 15:57:15 +0100 CET Subject: [Haiku-commits] r28593 - haiku/trunk/src/kits/interface In-Reply-To: Message-ID: <22482069626-BeMail@zon> "Rene Gollent" wrote: > On Mon, Nov 10, 2008 at 7:47 AM, anevilyak at BerliOS > wrote: > > - err = AddReplicant(& > > replicantMsg, pos);: > > + err = AddReplicant(& > > replicantMsg, pos); > This actually happened because of a pet annoyance of Pe: if you hit > cmd+f to bring up the find panel, there's a small delay between you > hitting the key and it coming up. During this delay, the edit window > still takes keystrokes. In more or less every other editor I use, > this > delay doesn't exist. Can this be fixed? It's pretty much instant over here, at least I didn't manage to insert another character between cmd-f and the window opening. Bye, Axel. From axeld at mail.berlios.de Mon Nov 10 17:01:37 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Mon, 10 Nov 2008 17:01:37 +0100 Subject: [Haiku-commits] r28595 - haiku/trunk/src/bin/coreutils/src Message-ID: <200811101601.mAAG1b1i006352@sheep.berlios.de> Author: axeld Date: 2008-11-10 17:01:37 +0100 (Mon, 10 Nov 2008) New Revision: 28595 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28595&view=rev Modified: haiku/trunk/src/bin/coreutils/src/copy.c Log: * Removed marge artifacts as found by kaliber in ticket #3114, thanks! Modified: haiku/trunk/src/bin/coreutils/src/copy.c =================================================================== --- haiku/trunk/src/bin/coreutils/src/copy.c 2008-11-10 15:27:21 UTC (rev 28594) +++ haiku/trunk/src/bin/coreutils/src/copy.c 2008-11-10 16:01:37 UTC (rev 28595) @@ -1490,20 +1490,15 @@ quote_n (0, dst_name), quote_n (1, earlier_file)); goto un_backup; } + else + { + if (x->ignore_attributes == 0 + && copy_attributes_by_name (earlier_file, dst_name, + false) != 0) + error (0, errno, "cannot copy attributes from %s\n", + earlier_file); + } - if (link_failed) - { - error (0, errno, _("cannot create hard link %s to %s"), - quote_n (0, dst_name), quote_n (1, earlier_file)); - goto un_backup; - } - else - { - if (x->ignore_attributes == 0 - && copy_attributes_by_name(earlier_file, dst_name, false) != 0) - fprintf(stderr, "%s: could not copy attributes\n", earlier_file); - } - return true; } } From anevilyak at gmail.com Mon Nov 10 17:17:07 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 10 Nov 2008 10:17:07 -0600 Subject: [Haiku-commits] r28593 - haiku/trunk/src/kits/interface In-Reply-To: <22482069626-BeMail@zon> References: <22482069626-BeMail@zon> Message-ID: On Mon, Nov 10, 2008 at 8:57 AM, Axel D?rfler wrote: > > It's pretty much instant over here, at least I didn't manage to insert > another character between cmd-f and the window opening. Odd, I wonder what the difference is... I don't encounter that problem with Eddie on the same hardware at least. Regards, Rene From revol at free.fr Mon Nov 10 17:25:10 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 10 Nov 2008 17:25:10 +0100 CET Subject: [Haiku-commits] r28594 - haiku/trunk/data/system/boot In-Reply-To: <200811101527.mAAFRMqR000487@sheep.berlios.de> Message-ID: <1597104643-BeMail@laptop> > BUILDHOME=/boot/develop > +BETOOLS="$BUILDHOME/tools/gnupro/bin" Btw "gnupro" refers to the redhat commercial version usually, it's a bit misleading... maybe we should change that someday. Fran?ois. From leavengood at gmail.com Mon Nov 10 17:31:56 2008 From: leavengood at gmail.com (Ryan Leavengood) Date: Mon, 10 Nov 2008 11:31:56 -0500 Subject: [Haiku-commits] r28586 - haiku/trunk/src/add-ons/screen_savers/message In-Reply-To: <6212784263-BeMail@zon> References: <200811092250.mA9MoQ8q028656@sheep.berlios.de> <6212784263-BeMail@zon> Message-ID: On Mon, Nov 10, 2008 at 5:26 AM, Axel D?rfler wrote: > leavengood at BerliOS wrote: >> + BObjectList *fFontFamilies; > > Why a pointer to a list anyway? No reason. I will make it a non-pointer. I am no C++ expert so could you (or anyone else) give me an idea of when you would use a pointer and when you would use a non-pointer when dealing with non-primitive class members? If there is a rule I wouldn't mind learning it. Regards, Ryan From leavengood at mail.berlios.de Mon Nov 10 18:07:47 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Mon, 10 Nov 2008 18:07:47 +0100 Subject: [Haiku-commits] r28596 - haiku/trunk/src/add-ons/screen_savers/message Message-ID: <200811101707.mAAH7lR9014716@sheep.berlios.de> Author: leavengood Date: 2008-11-10 18:07:47 +0100 (Mon, 10 Nov 2008) New Revision: 28596 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28596&view=rev Modified: haiku/trunk/src/add-ons/screen_savers/message/Message.cpp Log: Make the BObjectList member for font families a non-pointer. Modified: haiku/trunk/src/add-ons/screen_savers/message/Message.cpp =================================================================== --- haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2008-11-10 16:01:37 UTC (rev 28595) +++ haiku/trunk/src/add-ons/screen_savers/message/Message.cpp 2008-11-10 17:07:47 UTC (rev 28596) @@ -97,7 +97,7 @@ status_t StartSaver(BView *view, bool preview); private: - BObjectList *fFontFamilies; + BObjectList fFontFamilies; float fScaleFactor; bool fPreview; }; @@ -111,19 +111,15 @@ Message::Message(BMessage *archive, image_id id) : BScreenSaver(archive, id) - , fFontFamilies(NULL) { } Message::~Message() { - if (fFontFamilies) { - for (int32 i = 0; i < fFontFamilies->CountItems(); i++) { - if (fFontFamilies->ItemAt(i)) - delete fFontFamilies->ItemAt(i); - } - delete fFontFamilies; + for (int32 i = 0; i < fFontFamilies.CountItems(); i++) { + if (fFontFamilies.ItemAt(i)) + delete fFontFamilies.ItemAt(i); } } @@ -146,14 +142,13 @@ // Get font families int numFamilies = count_font_families(); - fFontFamilies = new BObjectList(); for (int32 i = 0; i < numFamilies; i++) { font_family *family = new font_family[1]; uint32 flags; if (get_font_family(i, family, &flags) == B_OK) { // Do not add fixed fonts if (!(flags & B_IS_FIXED)) - fFontFamilies->AddItem(family); + fFontFamilies.AddItem(family); } } @@ -199,7 +194,7 @@ BFont font; offscreen.GetFont(&font); font.SetFace(B_BOLD_FACE); - font.SetFamilyAndStyle(*(fFontFamilies->ItemAt(rand() % fFontFamilies->CountItems())), NULL); + font.SetFamilyAndStyle(*(fFontFamilies.ItemAt(rand() % fFontFamilies.CountItems())), NULL); offscreen.SetFont(&font); // Get the message From axeld at pinc-software.de Mon Nov 10 18:20:10 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 10 Nov 2008 18:20:10 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28586_-_haiku/trunk/src/add-ons/screen?= =?utf-8?q?=5Fsavers/message?= In-Reply-To: Message-ID: <31057981053-BeMail@zon> "Ryan Leavengood" wrote: > On Mon, Nov 10, 2008 at 5:26 AM, Axel D?rfler > wrote: > > leavengood at BerliOS wrote: > >> + BObjectList *fFontFamilies; > > Why a pointer to a list anyway? > No reason. I will make it a non-pointer. > > I am no C++ expert so could you (or anyone else) give me an idea of > when you would use a pointer and when you would use a non-pointer > when > dealing with non-primitive class members? If there is a rule I > wouldn't mind learning it. I don't think I can come up with a rule, but if you have a private class, and an object that always exists, there is no reason in having an extra pointer. Bye, Axel. From anevilyak at gmail.com Mon Nov 10 18:42:16 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 10 Nov 2008 11:42:16 -0600 Subject: [Haiku-commits] r28586 - haiku/trunk/src/add-ons/screen_savers/message In-Reply-To: <31057981053-BeMail@zon> References: <31057981053-BeMail@zon> Message-ID: On Mon, Nov 10, 2008 at 11:20 AM, Axel D?rfler wrote: > I don't think I can come up with a rule, but if you have a private > class, and an object that always exists, there is no reason in having > an extra pointer. The only thing I can think of offhand is it does potentially make FBC issues slightly easier to use a pointer, since the pointer size will always stay the same on the same arch, regardless of what you do to the object it points to. Apart from that, no real reason offhand. From superstippi at gmx.de Mon Nov 10 22:21:40 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 10 Nov 2008 22:21:40 +0100 Subject: [Haiku-commits] r28586 - haiku/trunk/src/add-ons/screen_savers/message In-Reply-To: <31057981053-BeMail@zon> References: <31057981053-BeMail@zon> Message-ID: <20081110212140.307230@gmx.net> Hi, > "Ryan Leavengood" wrote: > > On Mon, Nov 10, 2008 at 5:26 AM, Axel D?rfler > > wrote: > > > leavengood at BerliOS wrote: > > >> + BObjectList *fFontFamilies; > > > Why a pointer to a list anyway? > > No reason. I will make it a non-pointer. > > > > I am no C++ expert so could you (or anyone else) give me an idea of > > when you would use a pointer and when you would use a non-pointer > > when > > dealing with non-primitive class members? If there is a rule I > > wouldn't mind learning it. > > I don't think I can come up with a rule, but if you have a private > class, and an object that always exists, there is no reason in having > an extra pointer. If you embed a member object into a class, you save a few possible points of failure. For example, the memory allocation for the parent object would only fail as a whole (at least at this point...). You may or may not want to encode information in the fact that a pointer to a member object is NULL. You may save checks if something cannot be NULL (embedded object) or is never supposed to be NULL. If you use the Composition design pattern (I hope I get this right), ie when functionality is delegated from a parent object to a child object, but the behavior is supposed to be changeable at runtime, then you need to use pointers. Best regards, -Stephan From axeld at pinc-software.de Mon Nov 10 22:25:28 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Mon, 10 Nov 2008 22:25:28 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28586_-_haiku/trunk/src/add-ons/screen?= =?utf-8?q?=5Fsavers/message?= In-Reply-To: Message-ID: <45775839382-BeMail@zon> "Rene Gollent" wrote: > On Mon, Nov 10, 2008 at 11:20 AM, Axel D?rfler > > wrote: > > I don't think I can come up with a rule, but if you have a private > > class, and an object that always exists, there is no reason in > > having > > an extra pointer. > The only thing I can think of offhand is it does potentially make FBC > issues slightly easier to use a pointer, since the pointer size will > always stay the same on the same arch, regardless of what you do to > the object it points to. Apart from that, no real reason offhand. That's why I wrote *private* class :-) Bye, Axel. From korli at mail.berlios.de Tue Nov 11 00:03:19 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 00:03:19 +0100 Subject: [Haiku-commits] r28597 - in haiku/trunk/src/add-ons/kernel/drivers/network: . broadcom440x broadcom440x/dev broadcom440x/dev/bfe broadcom440x/dev/mii Message-ID: <200811102303.mAAN3JiZ008691@sheep.berlios.de> Author: korli Date: 2008-11-11 00:03:18 +0100 (Tue, 11 Nov 2008) New Revision: 28597 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28597&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/glue.c haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfereg.h haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/bmtphy.c haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/bmtphyreg.h haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/miidevs.h Modified: haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile Log: Added Broadcom BCM440x from FreeBSD (bfe). Compiles and even works. I just added a check in bmtphy_probe() as ENXIO is negative on Haiku. Modified: haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile 2008-11-10 17:07:47 UTC (rev 28596) +++ haiku/trunk/src/add-ons/kernel/drivers/network/Jamfile 2008-11-10 23:03:18 UTC (rev 28597) @@ -14,6 +14,7 @@ # FreeBSD 7 drivers SubInclude HAIKU_TOP src add-ons kernel drivers network 3com ; +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom440x ; SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom570x ; SubInclude HAIKU_TOP src add-ons kernel drivers network ipro100 ; #SubInclude HAIKU_TOP src add-ons kernel drivers network jmicron ; Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/Jamfile 2008-11-10 17:07:47 UTC (rev 28596) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/Jamfile 2008-11-10 23:03:18 UTC (rev 28597) @@ -0,0 +1,3 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network broadcom440x ; + +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom440x dev ; Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/Jamfile 2008-11-10 17:07:47 UTC (rev 28596) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/Jamfile 2008-11-10 23:03:18 UTC (rev 28597) @@ -0,0 +1,4 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network broadcom440x dev ; + +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom440x dev bfe ; +SubInclude HAIKU_TOP src add-ons kernel drivers network broadcom440x dev mii ; Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/Jamfile 2008-11-10 17:07:47 UTC (rev 28596) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/Jamfile 2008-11-10 23:03:18 UTC (rev 28597) @@ -0,0 +1,18 @@ +SubDir HAIKU_TOP src add-ons kernel drivers network broadcom440x dev bfe ; + +SubDirCcFlags -Wall ; + +UsePrivateHeaders kernel net ; + +UseHeaders [ FDirName $(SUBDIR) .. .. ] : true ; +UseHeaders [ FDirName $(SUBDIR) .. mii ] : true ; +UseHeaders [ FDirName $(HAIKU_TOP) src libs compat freebsd_network compat ] : true ; + +SubDirCcFlags [ FDefines _KERNEL=1 FBSD_DRIVER=1 ] ; + +KernelAddon broadcom440x : + if_bfe.c + glue.c + : libfreebsd_network.a broadcom440x_mii.a + ; + Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/glue.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/glue.c 2008-11-10 17:07:47 UTC (rev 28596) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/glue.c 2008-11-10 23:03:18 UTC (rev 28597) @@ -0,0 +1,62 @@ +/* + * Copyright 2008, J?r?me Duval. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ + + +#include +#include + +#include "if_bfereg.h" + +HAIKU_FBSD_DRIVER_GLUE(broadcom440x, bfe, pci); + +extern driver_t *DRIVER_MODULE_NAME(bmtphy, miibus); + +HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE); +//HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_FAST_TASKQUEUE | FBSD_SWI_TASKQUEUE); + +driver_t * +__haiku_select_miibus_driver(device_t dev) +{ + driver_t *drivers[] = { + DRIVER_MODULE_NAME(bmtphy, miibus), + NULL + }; + + return __haiku_probe_miibus(dev, drivers); +} + + +int +__haiku_disable_interrupts(device_t dev) +{ + struct bfe_softc *sc = device_get_softc(dev); + uint32 istat; + HAIKU_INTR_REGISTER_STATE; + + HAIKU_INTR_REGISTER_ENTER(); + + istat = CSR_READ_4(sc, BFE_ISTAT); + if (istat == 0 || (sc->bfe_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0) { + HAIKU_INTR_REGISTER_LEAVE(); + return 0; + } + + CSR_WRITE_4(sc, BFE_IMASK, 0); + CSR_READ_4(sc, BFE_IMASK); + + HAIKU_INTR_REGISTER_LEAVE(); + return 1; +} + + +void +__haiku_reenable_interrupts(device_t dev) +{ + struct bfe_softc *sc = device_get_softc(dev); + CSR_WRITE_4(sc, BFE_IMASK, BFE_IMASK_DEF); + CSR_READ_4(sc, BFE_IMASK); +} + + Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c 2008-11-10 17:07:47 UTC (rev 28596) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/bfe/if_bfe.c 2008-11-10 23:03:18 UTC (rev 28597) @@ -0,0 +1,1974 @@ +/*- + * Copyright (c) 2003 Stuart Walsh + * and Duncan Barclay + * + * 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. + * + * 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. + */ + + +#include +__FBSDID("$FreeBSD: src/sys/dev/bfe/if_bfe.c,v 1.54 2008/08/22 06:46:55 yongari Exp $"); + +#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 + +MODULE_DEPEND(bfe, pci, 1, 1, 1); +MODULE_DEPEND(bfe, ether, 1, 1, 1); +MODULE_DEPEND(bfe, miibus, 1, 1, 1); + +/* "device miibus" required. See GENERIC if you get errors here. */ +#include "miibus_if.h" + +#define BFE_DEVDESC_MAX 64 /* Maximum device description length */ + +static struct bfe_type bfe_devs[] = { + { BCOM_VENDORID, BCOM_DEVICEID_BCM4401, + "Broadcom BCM4401 Fast Ethernet" }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM4401B0, + "Broadcom BCM4401-B0 Fast Ethernet" }, + { 0, 0, NULL } +}; + +static int bfe_probe (device_t); +static int bfe_attach (device_t); +static int bfe_detach (device_t); +static int bfe_suspend (device_t); +static int bfe_resume (device_t); +static void bfe_release_resources (struct bfe_softc *); +static void bfe_intr (void *); +static int bfe_encap (struct bfe_softc *, struct mbuf **); +static void bfe_start (struct ifnet *); +static void bfe_start_locked (struct ifnet *); +static int bfe_ioctl (struct ifnet *, u_long, caddr_t); +static void bfe_init (void *); +static void bfe_init_locked (void *); +static void bfe_stop (struct bfe_softc *); +static void bfe_watchdog (struct bfe_softc *); +static int bfe_shutdown (device_t); +static void bfe_tick (void *); +static void bfe_txeof (struct bfe_softc *); +static void bfe_rxeof (struct bfe_softc *); +static void bfe_set_rx_mode (struct bfe_softc *); +static int bfe_list_rx_init (struct bfe_softc *); +static void bfe_list_tx_init (struct bfe_softc *); +static void bfe_discard_buf (struct bfe_softc *, int); +static int bfe_list_newbuf (struct bfe_softc *, int); +static void bfe_rx_ring_free (struct bfe_softc *); + +static void bfe_pci_setup (struct bfe_softc *, u_int32_t); +static int bfe_ifmedia_upd (struct ifnet *); +static void bfe_ifmedia_sts (struct ifnet *, struct ifmediareq *); +static int bfe_miibus_readreg (device_t, int, int); +static int bfe_miibus_writereg (device_t, int, int, int); +static void bfe_miibus_statchg (device_t); +static int bfe_wait_bit (struct bfe_softc *, u_int32_t, u_int32_t, + u_long, const int); +static void bfe_get_config (struct bfe_softc *sc); +static void bfe_read_eeprom (struct bfe_softc *, u_int8_t *); +static void bfe_stats_update (struct bfe_softc *); +static void bfe_clear_stats (struct bfe_softc *); +static int bfe_readphy (struct bfe_softc *, u_int32_t, u_int32_t*); +static int bfe_writephy (struct bfe_softc *, u_int32_t, u_int32_t); +static int bfe_resetphy (struct bfe_softc *); +static int bfe_setupphy (struct bfe_softc *); +static void bfe_chip_reset (struct bfe_softc *); +static void bfe_chip_halt (struct bfe_softc *); +static void bfe_core_reset (struct bfe_softc *); +static void bfe_core_disable (struct bfe_softc *); +static int bfe_dma_alloc (struct bfe_softc *); +static void bfe_dma_free (struct bfe_softc *sc); +static void bfe_dma_map (void *, bus_dma_segment_t *, int, int); +static void bfe_cam_write (struct bfe_softc *, u_char *, int); +static int sysctl_bfe_stats (SYSCTL_HANDLER_ARGS); + +static device_method_t bfe_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bfe_probe), + DEVMETHOD(device_attach, bfe_attach), + DEVMETHOD(device_detach, bfe_detach), + DEVMETHOD(device_shutdown, bfe_shutdown), + DEVMETHOD(device_suspend, bfe_suspend), + DEVMETHOD(device_resume, bfe_resume), + + /* bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_driver_added, bus_generic_driver_added), + + /* MII interface */ + DEVMETHOD(miibus_readreg, bfe_miibus_readreg), + DEVMETHOD(miibus_writereg, bfe_miibus_writereg), + DEVMETHOD(miibus_statchg, bfe_miibus_statchg), + + { 0, 0 } +}; + +static driver_t bfe_driver = { + "bfe", + bfe_methods, + sizeof(struct bfe_softc) +}; + +static devclass_t bfe_devclass; + +DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0); +DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0); + +/* + * Probe for a Broadcom 4401 chip. + */ +static int +bfe_probe(device_t dev) +{ + struct bfe_type *t; + + t = bfe_devs; + + while (t->bfe_name != NULL) { + if (pci_get_vendor(dev) == t->bfe_vid && + pci_get_device(dev) == t->bfe_did) { + device_set_desc(dev, t->bfe_name); + return (BUS_PROBE_DEFAULT); + } + t++; + } + + return (ENXIO); +} + +struct bfe_dmamap_arg { + bus_addr_t bfe_busaddr; +}; + +static int +bfe_dma_alloc(struct bfe_softc *sc) +{ + struct bfe_dmamap_arg ctx; + struct bfe_rx_data *rd; + struct bfe_tx_data *td; + int error, i; + + /* + * parent tag. Apparently the chip cannot handle any DMA address + * greater than 1GB. + */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->bfe_dev), /* parent */ + 1, 0, /* alignment, boundary */ + BFE_DMA_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_parent_tag); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create parent DMA tag.\n"); + goto fail; + } + + /* Create tag for Tx ring. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + BFE_TX_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BFE_TX_LIST_SIZE, /* maxsize */ + 1, /* nsegments */ + BFE_TX_LIST_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_tx_tag); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create Tx ring DMA tag.\n"); + goto fail; + } + + /* Create tag for Rx ring. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + BFE_RX_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BFE_RX_LIST_SIZE, /* maxsize */ + 1, /* nsegments */ + BFE_RX_LIST_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_rx_tag); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create Rx ring DMA tag.\n"); + goto fail; + } + + /* Create tag for Tx buffers. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES * BFE_MAXTXSEGS, /* maxsize */ + BFE_MAXTXSEGS, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_txmbuf_tag); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create Tx buffer DMA tag.\n"); + goto fail; + } + + /* Create tag for Rx buffers. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, /* maxsize */ + 1, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_rxmbuf_tag); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create Rx buffer DMA tag.\n"); + goto fail; + } + + /* Allocate DMA'able memory and load DMA map. */ + error = bus_dmamem_alloc(sc->bfe_tx_tag, (void *)&sc->bfe_tx_list, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, &sc->bfe_tx_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot allocate DMA'able memory for Tx ring.\n"); + goto fail; + } + ctx.bfe_busaddr = 0; + error = bus_dmamap_load(sc->bfe_tx_tag, sc->bfe_tx_map, + sc->bfe_tx_list, BFE_TX_LIST_SIZE, bfe_dma_map, &ctx, + BUS_DMA_NOWAIT); + if (error != 0 || ctx.bfe_busaddr == 0) { + device_printf(sc->bfe_dev, + "cannot load DMA'able memory for Tx ring.\n"); + goto fail; + } + sc->bfe_tx_dma = BFE_ADDR_LO(ctx.bfe_busaddr); + + error = bus_dmamem_alloc(sc->bfe_rx_tag, (void *)&sc->bfe_rx_list, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, &sc->bfe_rx_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot allocate DMA'able memory for Rx ring.\n"); + goto fail; + } + ctx.bfe_busaddr = 0; + error = bus_dmamap_load(sc->bfe_rx_tag, sc->bfe_rx_map, + sc->bfe_rx_list, BFE_RX_LIST_SIZE, bfe_dma_map, &ctx, + BUS_DMA_NOWAIT); + if (error != 0 || ctx.bfe_busaddr == 0) { + device_printf(sc->bfe_dev, + "cannot load DMA'able memory for Rx ring.\n"); + goto fail; + } + sc->bfe_rx_dma = BFE_ADDR_LO(ctx.bfe_busaddr); + + /* Create DMA maps for Tx buffers. */ + for (i = 0; i < BFE_TX_LIST_CNT; i++) { + td = &sc->bfe_tx_ring[i]; + td->bfe_mbuf = NULL; + td->bfe_map = NULL; + error = bus_dmamap_create(sc->bfe_txmbuf_tag, 0, &td->bfe_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create DMA map for Tx.\n"); + goto fail; + } + } + + /* Create spare DMA map for Rx buffers. */ + error = bus_dmamap_create(sc->bfe_rxmbuf_tag, 0, &sc->bfe_rx_sparemap); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create spare DMA map for Rx.\n"); + goto fail; + } + /* Create DMA maps for Rx buffers. */ + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + rd = &sc->bfe_rx_ring[i]; + rd->bfe_mbuf = NULL; + rd->bfe_map = NULL; + rd->bfe_ctrl = 0; + error = bus_dmamap_create(sc->bfe_rxmbuf_tag, 0, &rd->bfe_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create DMA map for Rx.\n"); + goto fail; + } + } + +fail: + return (error); +} + +static void +bfe_dma_free(struct bfe_softc *sc) +{ + struct bfe_tx_data *td; + struct bfe_rx_data *rd; + int i; + + /* Tx ring. */ + if (sc->bfe_tx_tag != NULL) { + if (sc->bfe_tx_map != NULL) + bus_dmamap_unload(sc->bfe_tx_tag, sc->bfe_tx_map); + if (sc->bfe_tx_map != NULL && sc->bfe_tx_list != NULL) + bus_dmamem_free(sc->bfe_tx_tag, sc->bfe_tx_list, + sc->bfe_tx_map); + sc->bfe_tx_map = NULL; + sc->bfe_tx_list = NULL; + bus_dma_tag_destroy(sc->bfe_tx_tag); + sc->bfe_tx_tag = NULL; + } + + /* Rx ring. */ + if (sc->bfe_rx_tag != NULL) { + if (sc->bfe_rx_map != NULL) + bus_dmamap_unload(sc->bfe_rx_tag, sc->bfe_rx_map); + if (sc->bfe_rx_map != NULL && sc->bfe_rx_list != NULL) + bus_dmamem_free(sc->bfe_rx_tag, sc->bfe_rx_list, + sc->bfe_rx_map); + sc->bfe_rx_map = NULL; + sc->bfe_rx_list = NULL; + bus_dma_tag_destroy(sc->bfe_rx_tag); + sc->bfe_rx_tag = NULL; + } + + /* Tx buffers. */ + if (sc->bfe_txmbuf_tag != NULL) { + for (i = 0; i < BFE_TX_LIST_CNT; i++) { + td = &sc->bfe_tx_ring[i]; + if (td->bfe_map != NULL) { + bus_dmamap_destroy(sc->bfe_txmbuf_tag, + td->bfe_map); + td->bfe_map = NULL; + } + } + bus_dma_tag_destroy(sc->bfe_txmbuf_tag); + sc->bfe_txmbuf_tag = NULL; + } + + /* Rx buffers. */ + if (sc->bfe_rxmbuf_tag != NULL) { + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + rd = &sc->bfe_rx_ring[i]; + if (rd->bfe_map != NULL) { + bus_dmamap_destroy(sc->bfe_rxmbuf_tag, + rd->bfe_map); + rd->bfe_map = NULL; + } + } + if (sc->bfe_rx_sparemap != NULL) { + bus_dmamap_destroy(sc->bfe_rxmbuf_tag, + sc->bfe_rx_sparemap); + sc->bfe_rx_sparemap = NULL; + } + bus_dma_tag_destroy(sc->bfe_rxmbuf_tag); + sc->bfe_rxmbuf_tag = NULL; + } + + if (sc->bfe_parent_tag != NULL) { + bus_dma_tag_destroy(sc->bfe_parent_tag); + sc->bfe_parent_tag = NULL; + } +} + +static int +bfe_attach(device_t dev) +{ + struct ifnet *ifp = NULL; + struct bfe_softc *sc; + int error = 0, rid; + + sc = device_get_softc(dev); + mtx_init(&sc->bfe_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->bfe_stat_co, &sc->bfe_mtx, 0); + + sc->bfe_dev = dev; + + /* + * Map control/status registers. + */ + pci_enable_busmaster(dev); + + rid = PCIR_BAR(0); + sc->bfe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->bfe_res == NULL) { + device_printf(dev, "couldn't map memory\n"); + error = ENXIO; + goto fail; + } + + /* Allocate interrupt */ + rid = 0; + + sc->bfe_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->bfe_irq == NULL) { + device_printf(dev, "couldn't map interrupt\n"); + error = ENXIO; + goto fail; + } + + if (bfe_dma_alloc(sc) != 0) { + device_printf(dev, "failed to allocate DMA resources\n"); + error = ENXIO; + goto fail; + } + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_bfe_stats, + "I", "Statistics"); + + /* Set up ifnet structure */ + ifp = sc->bfe_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "failed to if_alloc()\n"); + error = ENOSPC; + goto fail; + } + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = bfe_ioctl; + ifp->if_start = bfe_start; + ifp->if_init = bfe_init; + ifp->if_mtu = ETHERMTU; + IFQ_SET_MAXLEN(&ifp->if_snd, BFE_TX_QLEN); + ifp->if_snd.ifq_drv_maxlen = BFE_TX_QLEN; + IFQ_SET_READY(&ifp->if_snd); + + bfe_get_config(sc); + + /* Reset the chip and turn on the PHY */ + BFE_LOCK(sc); + bfe_chip_reset(sc); + BFE_UNLOCK(sc); + + if (mii_phy_probe(dev, &sc->bfe_miibus, + bfe_ifmedia_upd, bfe_ifmedia_sts)) { + device_printf(dev, "MII without any PHY!\n"); + error = ENXIO; + goto fail; + } + + ether_ifattach(ifp, sc->bfe_enaddr); + + /* + * Tell the upper layer(s) we support long frames. + */ + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capenable |= IFCAP_VLAN_MTU; + + /* + * Hook interrupt last to avoid having to lock softc + */ + error = bus_setup_intr(dev, sc->bfe_irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, bfe_intr, sc, &sc->bfe_intrhand); + + if (error) { + device_printf(dev, "couldn't set up irq\n"); + goto fail; + } +fail: + if (error != 0) + bfe_detach(dev); + return (error); +} + +static int +bfe_detach(device_t dev) +{ + struct bfe_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + + ifp = sc->bfe_ifp; + + if (device_is_attached(dev)) { + BFE_LOCK(sc); + sc->bfe_flags |= BFE_FLAG_DETACH; + bfe_stop(sc); + BFE_UNLOCK(sc); + callout_drain(&sc->bfe_stat_co); + if (ifp != NULL) + ether_ifdetach(ifp); + } + + BFE_LOCK(sc); + bfe_chip_reset(sc); + BFE_UNLOCK(sc); + + bus_generic_detach(dev); + if (sc->bfe_miibus != NULL) + device_delete_child(dev, sc->bfe_miibus); + + bfe_release_resources(sc); + bfe_dma_free(sc); + mtx_destroy(&sc->bfe_mtx); + + return (0); +} + +/* + * Stop all chip I/O so that the kernel's probe routines don't + * get confused by errant DMAs when rebooting. + */ +static int +bfe_shutdown(device_t dev) +{ + struct bfe_softc *sc; + + sc = device_get_softc(dev); + BFE_LOCK(sc); + bfe_stop(sc); + + BFE_UNLOCK(sc); + + return (0); +} + +static int +bfe_suspend(device_t dev) +{ + struct bfe_softc *sc; + + sc = device_get_softc(dev); + BFE_LOCK(sc); + bfe_stop(sc); + BFE_UNLOCK(sc); + + return (0); +} + +static int +bfe_resume(device_t dev) +{ + struct bfe_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + ifp = sc->bfe_ifp; + BFE_LOCK(sc); + bfe_chip_reset(sc); + if (ifp->if_flags & IFF_UP) { + bfe_init_locked(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + bfe_start_locked(ifp); + } + BFE_UNLOCK(sc); + + return (0); +} + +static int +bfe_miibus_readreg(device_t dev, int phy, int reg) +{ + struct bfe_softc *sc; + u_int32_t ret; + + sc = device_get_softc(dev); + if (phy != sc->bfe_phyaddr) + return (0); + bfe_readphy(sc, reg, &ret); + + return (ret); +} + +static int +bfe_miibus_writereg(device_t dev, int phy, int reg, int val) +{ + struct bfe_softc *sc; + + sc = device_get_softc(dev); + if (phy != sc->bfe_phyaddr) + return (0); + bfe_writephy(sc, reg, val); + + return (0); +} + +static void +bfe_miibus_statchg(device_t dev) +{ + struct bfe_softc *sc; + struct mii_data *mii; + u_int32_t val, flow; + + sc = device_get_softc(dev); + mii = device_get_softc(sc->bfe_miibus); + + sc->bfe_flags &= ~BFE_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->bfe_flags |= BFE_FLAG_LINK; + break; + default: + break; + } + } + + /* XXX Should stop Rx/Tx engine prior to touching MAC. */ + val = CSR_READ_4(sc, BFE_TX_CTRL); + val &= ~BFE_TX_DUPLEX; + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { + val |= BFE_TX_DUPLEX; + flow = 0; +#ifdef notyet + flow = CSR_READ_4(sc, BFE_RXCONF); + flow &= ~BFE_RXCONF_FLOW; + if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & + IFM_ETH_RXPAUSE) != 0) + flow |= BFE_RXCONF_FLOW; + CSR_WRITE_4(sc, BFE_RXCONF, flow); + /* + * It seems that the hardware has Tx pause issues + * so enable only Rx pause. + */ + flow = CSR_READ_4(sc, BFE_MAC_FLOW); + flow &= ~BFE_FLOW_PAUSE_ENAB; + CSR_WRITE_4(sc, BFE_MAC_FLOW, flow); +#endif + } + CSR_WRITE_4(sc, BFE_TX_CTRL, val); +} + +static void +bfe_tx_ring_free(struct bfe_softc *sc) +{ + int i; + + for(i = 0; i < BFE_TX_LIST_CNT; i++) { + if (sc->bfe_tx_ring[i].bfe_mbuf != NULL) { + bus_dmamap_sync(sc->bfe_txmbuf_tag, + sc->bfe_tx_ring[i].bfe_map, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->bfe_txmbuf_tag, + sc->bfe_tx_ring[i].bfe_map); + m_freem(sc->bfe_tx_ring[i].bfe_mbuf); + sc->bfe_tx_ring[i].bfe_mbuf = NULL; + } + } + bzero(sc->bfe_tx_list, BFE_TX_LIST_SIZE); + bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); +} + +static void +bfe_rx_ring_free(struct bfe_softc *sc) +{ + int i; + + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + if (sc->bfe_rx_ring[i].bfe_mbuf != NULL) { + bus_dmamap_sync(sc->bfe_rxmbuf_tag, + sc->bfe_rx_ring[i].bfe_map, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->bfe_rxmbuf_tag, + sc->bfe_rx_ring[i].bfe_map); + m_freem(sc->bfe_rx_ring[i].bfe_mbuf); + sc->bfe_rx_ring[i].bfe_mbuf = NULL; + } + } + bzero(sc->bfe_rx_list, BFE_RX_LIST_SIZE); + bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); +} + +static int +bfe_list_rx_init(struct bfe_softc *sc) +{ + struct bfe_rx_data *rd; + int i; + + sc->bfe_rx_prod = sc->bfe_rx_cons = 0; + bzero(sc->bfe_rx_list, BFE_RX_LIST_SIZE); + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + rd = &sc->bfe_rx_ring[i]; + rd->bfe_mbuf = NULL; + rd->bfe_ctrl = 0; + if (bfe_list_newbuf(sc, i) != 0) + return (ENOBUFS); + } + + bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, BFE_DMARX_PTR, (i * sizeof(struct bfe_desc))); + + return (0); +} + +static void +bfe_list_tx_init(struct bfe_softc *sc) +{ + int i; + + sc->bfe_tx_cnt = sc->bfe_tx_prod = sc->bfe_tx_cons = 0; + bzero(sc->bfe_tx_list, BFE_TX_LIST_SIZE); + for (i = 0; i < BFE_TX_LIST_CNT; i++) + sc->bfe_tx_ring[i].bfe_mbuf = NULL; + + bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); +} + +static void +bfe_discard_buf(struct bfe_softc *sc, int c) +{ + struct bfe_rx_data *r; + struct bfe_desc *d; + + r = &sc->bfe_rx_ring[c]; + d = &sc->bfe_rx_list[c]; + d->bfe_ctrl = htole32(r->bfe_ctrl); +} + +static int +bfe_list_newbuf(struct bfe_softc *sc, int c) +{ + struct bfe_rxheader *rx_header; + struct bfe_desc *d; + struct bfe_rx_data *r; + struct mbuf *m; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; + u_int32_t ctrl; + int nsegs; + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m->m_len = m->m_pkthdr.len = MCLBYTES; + + if (bus_dmamap_load_mbuf_sg(sc->bfe_rxmbuf_tag, sc->bfe_rx_sparemap, + m, segs, &nsegs, 0) != 0) { + m_freem(m); + return (ENOBUFS); + } + + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + r = &sc->bfe_rx_ring[c]; + if (r->bfe_mbuf != NULL) { + bus_dmamap_sync(sc->bfe_rxmbuf_tag, r->bfe_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->bfe_rxmbuf_tag, r->bfe_map); + } + map = r->bfe_map; + r->bfe_map = sc->bfe_rx_sparemap; + sc->bfe_rx_sparemap = map; + r->bfe_mbuf = m; + + rx_header = mtod(m, struct bfe_rxheader *); + rx_header->len = 0; + rx_header->flags = 0; + bus_dmamap_sync(sc->bfe_rxmbuf_tag, r->bfe_map, BUS_DMASYNC_PREREAD); + + ctrl = segs[0].ds_len & BFE_DESC_LEN; + KASSERT(ctrl > ETHER_MAX_LEN + 32, ("%s: buffer size too small(%d)!", + __func__, ctrl)); + if (c == BFE_RX_LIST_CNT - 1) + ctrl |= BFE_DESC_EOT; + r->bfe_ctrl = ctrl; + + d = &sc->bfe_rx_list[c]; + d->bfe_ctrl = htole32(ctrl); + /* The chip needs all addresses to be added to BFE_PCI_DMA. */ + d->bfe_addr = htole32(BFE_ADDR_LO(segs[0].ds_addr) + BFE_PCI_DMA); + + return (0); +} + +static void +bfe_get_config(struct bfe_softc *sc) +{ + u_int8_t eeprom[128]; + + bfe_read_eeprom(sc, eeprom); + + sc->bfe_enaddr[0] = eeprom[79]; + sc->bfe_enaddr[1] = eeprom[78]; + sc->bfe_enaddr[2] = eeprom[81]; + sc->bfe_enaddr[3] = eeprom[80]; + sc->bfe_enaddr[4] = eeprom[83]; + sc->bfe_enaddr[5] = eeprom[82]; + + sc->bfe_phyaddr = eeprom[90] & 0x1f; + sc->bfe_mdc_port = (eeprom[90] >> 14) & 0x1; + + sc->bfe_core_unit = 0; + sc->bfe_dma_offset = BFE_PCI_DMA; +} + +static void +bfe_pci_setup(struct bfe_softc *sc, u_int32_t cores) +{ + u_int32_t bar_orig, pci_rev, val; + + bar_orig = pci_read_config(sc->bfe_dev, BFE_BAR0_WIN, 4); + pci_write_config(sc->bfe_dev, BFE_BAR0_WIN, BFE_REG_PCI, 4); + pci_rev = CSR_READ_4(sc, BFE_SBIDHIGH) & BFE_RC_MASK; [... truncated: 2260 lines follow ...] From stippi at mail.berlios.de Tue Nov 11 00:50:43 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Tue, 11 Nov 2008 00:50:43 +0100 Subject: [Haiku-commits] r28598 - in haiku/trunk/headers/os: kernel storage support Message-ID: <200811102350.mAANohVG002141@sheep.berlios.de> Author: stippi Date: 2008-11-11 00:50:42 +0100 (Tue, 11 Nov 2008) New Revision: 28598 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28598&view=rev Modified: haiku/trunk/headers/os/kernel/OS.h haiku/trunk/headers/os/storage/FindDirectory.h haiku/trunk/headers/os/storage/Mime.h haiku/trunk/headers/os/support/ByteOrder.h haiku/trunk/headers/os/support/SupportDefs.h Log: Patch by Scott: Make sure the comments are C style in headers that are included by POSIX headers. Thanks! Should fix #2870. Modified: haiku/trunk/headers/os/kernel/OS.h =================================================================== --- haiku/trunk/headers/os/kernel/OS.h 2008-11-10 23:03:18 UTC (rev 28597) +++ haiku/trunk/headers/os/kernel/OS.h 2008-11-10 23:50:42 UTC (rev 28598) @@ -110,9 +110,9 @@ port_id port; team_id team; char name[B_OS_NAME_LENGTH]; - int32 capacity; // queue depth - int32 queue_count; // # msgs waiting to be read - int32 total_count; // total # msgs read so far + int32 capacity; /* queue depth */ + int32 queue_count; /* # msgs waiting to be read */ + int32 total_count; /* total # msgs read so far */ } port_info; extern port_id create_port(int32 capacity, const char *name); @@ -142,8 +142,8 @@ _get_next_port_info((team), (cookie), (info), sizeof(*(info))) -// WARNING: The following is Haiku experimental API. It might be removed or -// changed in the future. +/* WARNING: The following is Haiku experimental API. It might be removed or + changed in the future. */ typedef struct port_message_info { size_t size; @@ -152,7 +152,7 @@ team_id sender_team; } port_message_info; -// similar to port_buffer_size_etc(), but returns (more) info +/* similar to port_buffer_size_etc(), but returns (more) info */ extern status_t _get_port_message_info_etc(port_id port, port_message_info *info, size_t infoSize, uint32 flags, bigtime_t timeout); @@ -174,21 +174,21 @@ /* semaphore flags */ enum { - B_CAN_INTERRUPT = 0x01, // acquisition of the semaphore can be - // interrupted (system use only) - B_CHECK_PERMISSION = 0x04, // ownership will be checked (system use - // only) - B_KILL_CAN_INTERRUPT = 0x20, // acquisition of the semaphore can be - // interrupted by SIGKILL[THR], even - // if not B_CAN_INTERRUPT (system use - // only) + B_CAN_INTERRUPT = 0x01, /* acquisition of the semaphore can be + interrupted (system use only) */ + B_CHECK_PERMISSION = 0x04, /* ownership will be checked (system use + only) */ + B_KILL_CAN_INTERRUPT = 0x20, /* acquisition of the semaphore can be + interrupted by SIGKILL[THR], even + if not B_CAN_INTERRUPT (system use + only) */ /* release_sem_etc() only flags */ - B_DO_NOT_RESCHEDULE = 0x02, // thread is not rescheduled - B_RELEASE_ALL = 0x08, // all waiting threads will be woken up, - // count will be zeroed - B_RELEASE_IF_WAITING_ONLY = 0x10 // release count only if there are any - // threads waiting + B_DO_NOT_RESCHEDULE = 0x02, /* thread is not rescheduled */ + B_RELEASE_ALL = 0x08, /* all waiting threads will be woken up, + count will be zeroed */ + B_RELEASE_IF_WAITING_ONLY = 0x10 /* release count only if there are any + threads waiting */ }; extern sem_id create_sem(int32 count, const char *name); @@ -197,8 +197,8 @@ extern status_t acquire_sem_etc(sem_id id, int32 count, uint32 flags, bigtime_t timeout); extern status_t release_sem(sem_id id); extern status_t release_sem_etc(sem_id id, int32 count, uint32 flags); -// ToDo: the following two calls are not part of the BeOS API, and might be -// changed or even removed for the final release of Haiku R1 +/* ToDo: the following two calls are not part of the BeOS API, and might be + changed or even removed for the final release of Haiku R1 */ extern status_t switch_sem(sem_id semToBeReleased, sem_id id); extern status_t switch_sem_etc(sem_id semToBeReleased, sem_id id, int32 count, uint32 flags, bigtime_t timeout); @@ -382,7 +382,7 @@ */ extern int disable_debugger(int state); -// TODO: Remove. Temporary debug helper. +/* TODO: Remove. Temporary debug helper. */ extern void debug_printf(const char *format, ...) __attribute__ ((format (__printf__, 1, 2))); extern void debug_vprintf(const char *format, va_list args); @@ -410,7 +410,7 @@ #define OBOS_CPU_TYPES typedef enum cpu_types { - // ToDo: add latest models + /* ToDo: add latest models */ /* Motorola/IBM */ B_CPU_PPC_UNKNOWN = 0, @@ -708,7 +708,7 @@ extern double is_computer_on_fire(void); -// WARNING: Experimental API! +/* WARNING: Experimental API! */ enum { B_OBJECT_TYPE_FD = 0, @@ -718,35 +718,35 @@ }; enum { - B_EVENT_READ = 0x0001, // FD/port readable - B_EVENT_WRITE = 0x0002, // FD/port writable - B_EVENT_ERROR = 0x0004, // FD error - B_EVENT_PRIORITY_READ = 0x0008, // FD priority readable - B_EVENT_PRIORITY_WRITE = 0x0010, // FD priority writable - B_EVENT_HIGH_PRIORITY_READ = 0x0020, // FD high priority readable - B_EVENT_HIGH_PRIORITY_WRITE = 0x0040, // FD high priority writable - B_EVENT_DISCONNECTED = 0x0080, // FD disconnected + B_EVENT_READ = 0x0001, /* FD/port readable */ + B_EVENT_WRITE = 0x0002, /* FD/port writable */ + B_EVENT_ERROR = 0x0004, /* FD error */ + B_EVENT_PRIORITY_READ = 0x0008, /* FD priority readable */ + B_EVENT_PRIORITY_WRITE = 0x0010, /* FD priority writable */ + B_EVENT_HIGH_PRIORITY_READ = 0x0020, /* FD high priority readable */ + B_EVENT_HIGH_PRIORITY_WRITE = 0x0040, /* FD high priority writable */ + B_EVENT_DISCONNECTED = 0x0080, /* FD disconnected */ - B_EVENT_ACQUIRE_SEMAPHORE = 0x0001, // semaphore can be acquired + B_EVENT_ACQUIRE_SEMAPHORE = 0x0001, /* semaphore can be acquired */ - B_EVENT_INVALID = 0x1000 // FD/port/sem/thread ID not or - // no longer valid (e.g. has been - // close/deleted) + B_EVENT_INVALID = 0x1000 /* FD/port/sem/thread ID not or + no longer valid (e.g. has been + close/deleted) */ }; typedef struct object_wait_info { - int32 object; // ID of the object - uint16 type; // type of the object - uint16 events; // events mask + int32 object; /* ID of the object */ + uint16 type; /* type of the object */ + uint16 events; /* events mask */ } object_wait_info; -// wait_for_objects[_etc]() waits until at least one of the specified events or, -// if given, the timeout occurred. When entering the function the -// object_wait_info::events field specifies the events for each object the -// caller is interested in. When the function returns the fields reflect the -// events that actually occurred. The events B_EVENT_INVALID, B_EVENT_ERROR, -// and B_EVENT_DISCONNECTED don't need to be specified. They will always be -// reported, when they occur. +/* wait_for_objects[_etc]() waits until at least one of the specified events or, + if given, the timeout occurred. When entering the function the + object_wait_info::events field specifies the events for each object the + caller is interested in. When the function returns the fields reflect the + events that actually occurred. The events B_EVENT_INVALID, B_EVENT_ERROR, + and B_EVENT_DISCONNECTED don't need to be specified. They will always be + reported, when they occur. */ extern ssize_t wait_for_objects(object_wait_info* infos, int numInfos); extern ssize_t wait_for_objects_etc(object_wait_info* infos, int numInfos, Modified: haiku/trunk/headers/os/storage/FindDirectory.h =================================================================== --- haiku/trunk/headers/os/storage/FindDirectory.h 2008-11-10 23:03:18 UTC (rev 28597) +++ haiku/trunk/headers/os/storage/FindDirectory.h 2008-11-10 23:50:42 UTC (rev 28598) @@ -10,11 +10,11 @@ typedef enum { - // Per volume directories + /* Per volume directories */ B_DESKTOP_DIRECTORY = 0, B_TRASH_DIRECTORY, - // System directories + /* System directories */ B_BEOS_DIRECTORY = 1000, B_BEOS_SYSTEM_DIRECTORY, B_BEOS_ADDONS_DIRECTORY, @@ -32,7 +32,7 @@ B_BEOS_SOUNDS_DIRECTORY, B_BEOS_DATA_DIRECTORY, - // Common directories, shared among all users. + /* Common directories, shared among all users. */ B_COMMON_DIRECTORY = 2000, B_COMMON_SYSTEM_DIRECTORY, B_COMMON_ADDONS_DIRECTORY, @@ -55,8 +55,8 @@ B_COMMON_DATA_DIRECTORY, - // User directories. These are interpreted in the context - // of the user making the find_directory call. + /* User directories. These are interpreted in the context + of the user making the find_directory call. */ B_USER_DIRECTORY = 3000, B_USER_CONFIG_DIRECTORY, B_USER_ADDONS_DIRECTORY, @@ -72,7 +72,7 @@ B_USER_DATA_DIRECTORY, B_USER_CACHE_DIRECTORY, - // Global directories. + /* Global directories. */ B_APPS_DIRECTORY = 4000, B_PREFERENCES_DIRECTORY, B_UTILITIES_DIRECTORY @@ -83,7 +83,7 @@ extern "C" { #endif -// C interface +/* C interface */ status_t find_directory(directory_which which, dev_t volume, bool createIt, char* pathString, int32 length); @@ -91,7 +91,7 @@ #ifdef __cplusplus } -// C++ interface +/* C++ interface */ class BVolume; class BPath; @@ -99,6 +99,6 @@ status_t find_directory(directory_which which, BPath* path, bool createIt = false, BVolume* volume = NULL); -#endif // __cplusplus +#endif /* __cplusplus */ -#endif // _FIND_DIRECTORY_H +#endif /* _FIND_DIRECTORY_H */ Modified: haiku/trunk/headers/os/storage/Mime.h =================================================================== --- haiku/trunk/headers/os/storage/Mime.h 2008-11-10 23:03:18 UTC (rev 28597) +++ haiku/trunk/headers/os/storage/Mime.h 2008-11-10 23:50:42 UTC (rev 28598) @@ -19,7 +19,7 @@ B_MINI_ICON = 16 }; -// values for the "force" parameter of update_mime_info() (Haiku only) +/* values for the "force" parameter of update_mime_info() (Haiku only) */ enum { B_UPDATE_MIME_INFO_NO_FORCE = 0, B_UPDATE_MIME_INFO_FORCE_KEEP_TYPE = 1, @@ -27,7 +27,7 @@ }; -// C functions +/* C functions */ #ifdef __cplusplus extern "C" { @@ -42,7 +42,7 @@ #ifdef __cplusplus } -// C++ functions, Haiku only! +/* C++ functions, Haiku only! */ class BBitmap; @@ -54,8 +54,8 @@ status_t get_named_icon(const char* name, uint8** _data, size_t* _size, type_code* _type); -// include MimeType.h for convenience +/* include MimeType.h for convenience */ # include -#endif // __cplusplus +#endif /* __cplusplus */ -#endif // _MIME_H +#endif /* _MIME_H */ Modified: haiku/trunk/headers/os/support/ByteOrder.h =================================================================== --- haiku/trunk/headers/os/support/ByteOrder.h 2008-11-10 23:03:18 UTC (rev 28597) +++ haiku/trunk/headers/os/support/ByteOrder.h 2008-11-10 23:50:42 UTC (rev 28598) @@ -10,10 +10,10 @@ #include #include #include - // for convenience + /* for convenience */ -// swap directions +/* swap directions */ typedef enum { B_SWAP_HOST_TO_LENDIAN, B_SWAP_HOST_TO_BENDIAN, @@ -23,7 +23,7 @@ } swap_action; -// BSD/networking macros +/* BSD/networking macros */ #ifndef htonl # define htonl(x) B_HOST_TO_BENDIAN_INT32(x) # define ntohl(x) B_BENDIAN_TO_HOST_INT32(x) @@ -31,7 +31,7 @@ # define ntohs(x) B_BENDIAN_TO_HOST_INT16(x) #endif -// always swap macros +/* always swap macros */ #define B_SWAP_DOUBLE(arg) __swap_double(arg) #define B_SWAP_FLOAT(arg) __swap_float(arg) #define B_SWAP_INT64(arg) __swap_int64(arg) @@ -39,74 +39,74 @@ #define B_SWAP_INT16(arg) __swap_int16(arg) #if BYTE_ORDER == __LITTLE_ENDIAN -// Host is little endian +/* Host is little endian */ #define B_HOST_IS_LENDIAN 1 #define B_HOST_IS_BENDIAN 0 -// Host native to little endian +/* Host native to little endian */ #define B_HOST_TO_LENDIAN_DOUBLE(arg) (double)(arg) #define B_HOST_TO_LENDIAN_FLOAT(arg) (float)(arg) #define B_HOST_TO_LENDIAN_INT64(arg) (uint64)(arg) #define B_HOST_TO_LENDIAN_INT32(arg) (uint32)(arg) #define B_HOST_TO_LENDIAN_INT16(arg) (uint16)(arg) -// Little endian to host native +/* Little endian to host native */ #define B_LENDIAN_TO_HOST_DOUBLE(arg) (double)(arg) #define B_LENDIAN_TO_HOST_FLOAT(arg) (float)(arg) #define B_LENDIAN_TO_HOST_INT64(arg) (uint64)(arg) #define B_LENDIAN_TO_HOST_INT32(arg) (uint32)(arg) #define B_LENDIAN_TO_HOST_INT16(arg) (uint16)(arg) -// Host native to big endian +/* Host native to big endian */ #define B_HOST_TO_BENDIAN_DOUBLE(arg) __swap_double(arg) #define B_HOST_TO_BENDIAN_FLOAT(arg) __swap_float(arg) #define B_HOST_TO_BENDIAN_INT64(arg) __swap_int64(arg) #define B_HOST_TO_BENDIAN_INT32(arg) __swap_int32(arg) #define B_HOST_TO_BENDIAN_INT16(arg) __swap_int16(arg) -// Big endian to host native +/* Big endian to host native */ #define B_BENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg) #define B_BENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg) #define B_BENDIAN_TO_HOST_INT64(arg) __swap_int64(arg) #define B_BENDIAN_TO_HOST_INT32(arg) __swap_int32(arg) #define B_BENDIAN_TO_HOST_INT16(arg) __swap_int16(arg) -#else // BYTE_ORDER -// Host is big endian +#else /* BYTE_ORDER */ +/* Host is big endian */ #define B_HOST_IS_LENDIAN 0 #define B_HOST_IS_BENDIAN 1 -// Host native to little endian +/* Host native to little endian */ #define B_HOST_TO_LENDIAN_DOUBLE(arg) __swap_double(arg) #define B_HOST_TO_LENDIAN_FLOAT(arg) __swap_float(arg) #define B_HOST_TO_LENDIAN_INT64(arg) __swap_int64(arg) #define B_HOST_TO_LENDIAN_INT32(arg) __swap_int32(arg) #define B_HOST_TO_LENDIAN_INT16(arg) __swap_int16(arg) -// Little endian to host native +/* Little endian to host native */ #define B_LENDIAN_TO_HOST_DOUBLE(arg) __swap_double(arg) #define B_LENDIAN_TO_HOST_FLOAT(arg) __swap_float(arg) #define B_LENDIAN_TO_HOST_INT64(arg) __swap_int64(arg) #define B_LENDIAN_TO_HOST_INT32(arg) __swap_int32(arg) #define B_LENDIAN_TO_HOST_INT16(arg) __swap_int16(arg) -// Host native to big endian +/* Host native to big endian */ #define B_HOST_TO_BENDIAN_DOUBLE(arg) (double)(arg) #define B_HOST_TO_BENDIAN_FLOAT(arg) (float)(arg) #define B_HOST_TO_BENDIAN_INT64(arg) (uint64)(arg) #define B_HOST_TO_BENDIAN_INT32(arg) (uint32)(arg) #define B_HOST_TO_BENDIAN_INT16(arg) (uint16)(arg) -// Big endian to host native +/* Big endian to host native */ #define B_BENDIAN_TO_HOST_DOUBLE(arg) (double)(arg) #define B_BENDIAN_TO_HOST_FLOAT(arg) (float)(arg) #define B_BENDIAN_TO_HOST_INT64(arg) (uint64)(arg) #define B_BENDIAN_TO_HOST_INT32(arg) (uint32)(arg) #define B_BENDIAN_TO_HOST_INT16(arg) (uint16)(arg) -#endif // BYTE_ORDER +#endif /* BYTE_ORDER */ #ifdef __cplusplus @@ -118,7 +118,7 @@ extern bool is_type_swapped(type_code type); -// Private implementations +/* Private implementations */ extern double __swap_double(double arg); extern float __swap_float(float arg); extern uint64 __swap_int64(uint64 arg); @@ -129,4 +129,4 @@ } #endif -#endif // _BYTEORDER_H +#endif /* _BYTEORDER_H */ Modified: haiku/trunk/headers/os/support/SupportDefs.h =================================================================== --- haiku/trunk/headers/os/support/SupportDefs.h 2008-11-10 23:03:18 UTC (rev 28597) +++ haiku/trunk/headers/os/support/SupportDefs.h 2008-11-10 23:50:42 UTC (rev 28598) @@ -22,7 +22,7 @@ #include -// Shorthand type formats +/* Shorthand type formats */ typedef signed char int8; typedef unsigned char uint8; typedef volatile signed char vint8; @@ -57,20 +57,20 @@ typedef unsigned short unichar; -// Descriptive formats +/* Descriptive formats */ typedef int32 status_t; typedef int64 bigtime_t; typedef uint32 type_code; typedef uint32 perform_code; -// Empty string ("") +/* Empty string ("") */ #ifdef __cplusplus extern const char *B_EMPTY_STRING; #endif -// min and max comparisons +/* min and max comparisons */ #ifndef __cplusplus # ifndef min # define min(a,b) ((a)>(b)?(b):(a)) @@ -80,12 +80,12 @@ # endif #endif -// min() and max() won't work in C++ +/* min() and max() won't work in C++ */ #define min_c(a,b) ((a)>(b)?(b):(a)) #define max_c(a,b) ((a)>(b)?(a):(b)) -// Grandfathering +/* Grandfathering */ #ifndef __cplusplus # include #endif @@ -99,7 +99,7 @@ extern "C" { #endif -// Atomic functions; previous value is returned +/* Atomic functions; previous value is returned */ extern int32 atomic_set(vint32 *value, int32 newValue); extern int32 atomic_test_and_set(vint32 *value, int32 newValue, int32 testAgainst); extern int32 atomic_add(vint32 *value, int32 addValue); @@ -114,16 +114,16 @@ extern int64 atomic_or64(vint64 *value, int64 orValue); extern int64 atomic_get64(vint64 *value); -// Other stuff +/* Other stuff */ extern void* get_stack_frame(void); #ifdef __cplusplus } #endif -// Obsolete or discouraged API +/* Obsolete or discouraged API */ -// use 'true' and 'false' +/* use 'true' and 'false' */ #ifndef FALSE # define FALSE 0 #endif @@ -131,4 +131,4 @@ # define TRUE 1 #endif -#endif // _SUPPORT_DEFS_H +#endif /* _SUPPORT_DEFS_H */ From axeld at pinc-software.de Tue Nov 11 09:53:51 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 11 Nov 2008 09:53:51 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28598_-_in_haiku/trunk/headers/os=3A_k?= =?utf-8?q?ernel_storage_support?= In-Reply-To: <200811102350.mAANohVG002141@sheep.berlios.de> Message-ID: <968615199-BeMail@zon> stippi at BerliOS wrote: > Modified: > haiku/trunk/headers/os/kernel/OS.h > haiku/trunk/headers/os/storage/FindDirectory.h > haiku/trunk/headers/os/storage/Mime.h > haiku/trunk/headers/os/support/ByteOrder.h > haiku/trunk/headers/os/support/SupportDefs.h > Log: > Patch by Scott: > Make sure the comments are C style in headers that are included by > POSIX > headers. I wonder why those should be included by POSIX headers at all, though. Bye, Axel. From axeld at pinc-software.de Tue Nov 11 09:55:41 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Tue, 11 Nov 2008 09:55:41 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28597_-_in_haiku/trunk/src/add-ons/ker?= =?utf-8?q?nel/drivers/network=3A_=2E_broadcom440x_broadcom440x/dev_broadc?= =?utf-8?q?om440x/dev/bfe_broadcom440x/dev/mii?= In-Reply-To: <200811102303.mAAN3JiZ008691@sheep.berlios.de> Message-ID: <1078867419-BeMail@zon> korli at BerliOS wrote: > Log: > Added Broadcom BCM440x from FreeBSD (bfe). Compiles and even works. > I just added a check in bmtphy_probe() as ENXIO is negative on Haiku. Can you put the unchanged version in the vendor branch (vendor/freebsd/ )? Thanks! Bye, Axel. From axeld at mail.berlios.de Tue Nov 11 10:10:45 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 11 Nov 2008 10:10:45 +0100 Subject: [Haiku-commits] r28599 - haiku/trunk/src/libs/compat/freebsd_network Message-ID: <200811110910.mAB9AjTF018527@sheep.berlios.de> Author: axeld Date: 2008-11-11 10:10:45 +0100 (Tue, 11 Nov 2008) New Revision: 28599 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28599&view=rev Modified: haiku/trunk/src/libs/compat/freebsd_network/device.c haiku/trunk/src/libs/compat/freebsd_network/fbsd_busdma_x86.c Log: * Applied patch by Adrian: compat_read() was broken as it only considered the first chunk of a possibly multi-buffer mbuf. This fixes #2840, thanks a lot! * Fixed warning in _bus_dmamap_load_buffer(). Modified: haiku/trunk/src/libs/compat/freebsd_network/device.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/device.c 2008-11-10 23:50:42 UTC (rev 28598) +++ haiku/trunk/src/libs/compat/freebsd_network/device.c 2008-11-11 09:10:45 UTC (rev 28599) @@ -125,7 +125,7 @@ IF_DEQUEUE(&ifp->receive_queue, mb); } while (mb == NULL); - length = min_c(max_c((size_t)mb->m_len, 0), *numBytes); + length = min_c(max_c((size_t)mb->m_pkthdr.len, 0), *numBytes); #if 0 mb = m_defrag(mb, 0); @@ -135,7 +135,7 @@ } #endif - memcpy(buffer, mtod(mb, const void *), length); + m_copydata(mb, 0, length, buffer); *numBytes = length; m_freem(mb); Modified: haiku/trunk/src/libs/compat/freebsd_network/fbsd_busdma_x86.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/fbsd_busdma_x86.c 2008-11-10 23:50:42 UTC (rev 28598) +++ haiku/trunk/src/libs/compat/freebsd_network/fbsd_busdma_x86.c 2008-11-11 09:10:45 UTC (rev 28599) @@ -641,7 +641,7 @@ * Get the physical address for this segment. */ if (pmap) - curaddr = pmap_extract(pmap, vaddr); + curaddr = (bus_addr_t)pmap_extract(pmap, vaddr); else curaddr = pmap_kextract(vaddr); From korli at mail.berlios.de Tue Nov 11 11:35:37 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 11:35:37 +0100 Subject: [Haiku-commits] r28600 - in haiku/vendor/freebsd/current/dev: . bfe Message-ID: <200811111035.mABAZbdU031272@sheep.berlios.de> Author: korli Date: 2008-11-11 11:35:36 +0100 (Tue, 11 Nov 2008) New Revision: 28600 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28600&view=rev Added: haiku/vendor/freebsd/current/dev/bfe/ haiku/vendor/freebsd/current/dev/bfe/if_bfe.c haiku/vendor/freebsd/current/dev/bfe/if_bfereg.h Log: Added the bfe driver to the FreeBSD vendor branch (used as is in Haiku). Added: haiku/vendor/freebsd/current/dev/bfe/if_bfe.c =================================================================== --- haiku/vendor/freebsd/current/dev/bfe/if_bfe.c 2008-11-11 09:10:45 UTC (rev 28599) +++ haiku/vendor/freebsd/current/dev/bfe/if_bfe.c 2008-11-11 10:35:36 UTC (rev 28600) @@ -0,0 +1,1974 @@ +/*- + * Copyright (c) 2003 Stuart Walsh + * and Duncan Barclay + * + * 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. + * + * 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. + */ + + +#include +__FBSDID("$FreeBSD: src/sys/dev/bfe/if_bfe.c,v 1.54 2008/08/22 06:46:55 yongari Exp $"); + +#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 + +MODULE_DEPEND(bfe, pci, 1, 1, 1); +MODULE_DEPEND(bfe, ether, 1, 1, 1); +MODULE_DEPEND(bfe, miibus, 1, 1, 1); + +/* "device miibus" required. See GENERIC if you get errors here. */ +#include "miibus_if.h" + +#define BFE_DEVDESC_MAX 64 /* Maximum device description length */ + +static struct bfe_type bfe_devs[] = { + { BCOM_VENDORID, BCOM_DEVICEID_BCM4401, + "Broadcom BCM4401 Fast Ethernet" }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM4401B0, + "Broadcom BCM4401-B0 Fast Ethernet" }, + { 0, 0, NULL } +}; + +static int bfe_probe (device_t); +static int bfe_attach (device_t); +static int bfe_detach (device_t); +static int bfe_suspend (device_t); +static int bfe_resume (device_t); +static void bfe_release_resources (struct bfe_softc *); +static void bfe_intr (void *); +static int bfe_encap (struct bfe_softc *, struct mbuf **); +static void bfe_start (struct ifnet *); +static void bfe_start_locked (struct ifnet *); +static int bfe_ioctl (struct ifnet *, u_long, caddr_t); +static void bfe_init (void *); +static void bfe_init_locked (void *); +static void bfe_stop (struct bfe_softc *); +static void bfe_watchdog (struct bfe_softc *); +static int bfe_shutdown (device_t); +static void bfe_tick (void *); +static void bfe_txeof (struct bfe_softc *); +static void bfe_rxeof (struct bfe_softc *); +static void bfe_set_rx_mode (struct bfe_softc *); +static int bfe_list_rx_init (struct bfe_softc *); +static void bfe_list_tx_init (struct bfe_softc *); +static void bfe_discard_buf (struct bfe_softc *, int); +static int bfe_list_newbuf (struct bfe_softc *, int); +static void bfe_rx_ring_free (struct bfe_softc *); + +static void bfe_pci_setup (struct bfe_softc *, u_int32_t); +static int bfe_ifmedia_upd (struct ifnet *); +static void bfe_ifmedia_sts (struct ifnet *, struct ifmediareq *); +static int bfe_miibus_readreg (device_t, int, int); +static int bfe_miibus_writereg (device_t, int, int, int); +static void bfe_miibus_statchg (device_t); +static int bfe_wait_bit (struct bfe_softc *, u_int32_t, u_int32_t, + u_long, const int); +static void bfe_get_config (struct bfe_softc *sc); +static void bfe_read_eeprom (struct bfe_softc *, u_int8_t *); +static void bfe_stats_update (struct bfe_softc *); +static void bfe_clear_stats (struct bfe_softc *); +static int bfe_readphy (struct bfe_softc *, u_int32_t, u_int32_t*); +static int bfe_writephy (struct bfe_softc *, u_int32_t, u_int32_t); +static int bfe_resetphy (struct bfe_softc *); +static int bfe_setupphy (struct bfe_softc *); +static void bfe_chip_reset (struct bfe_softc *); +static void bfe_chip_halt (struct bfe_softc *); +static void bfe_core_reset (struct bfe_softc *); +static void bfe_core_disable (struct bfe_softc *); +static int bfe_dma_alloc (struct bfe_softc *); +static void bfe_dma_free (struct bfe_softc *sc); +static void bfe_dma_map (void *, bus_dma_segment_t *, int, int); +static void bfe_cam_write (struct bfe_softc *, u_char *, int); +static int sysctl_bfe_stats (SYSCTL_HANDLER_ARGS); + +static device_method_t bfe_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, bfe_probe), + DEVMETHOD(device_attach, bfe_attach), + DEVMETHOD(device_detach, bfe_detach), + DEVMETHOD(device_shutdown, bfe_shutdown), + DEVMETHOD(device_suspend, bfe_suspend), + DEVMETHOD(device_resume, bfe_resume), + + /* bus interface */ + DEVMETHOD(bus_print_child, bus_generic_print_child), + DEVMETHOD(bus_driver_added, bus_generic_driver_added), + + /* MII interface */ + DEVMETHOD(miibus_readreg, bfe_miibus_readreg), + DEVMETHOD(miibus_writereg, bfe_miibus_writereg), + DEVMETHOD(miibus_statchg, bfe_miibus_statchg), + + { 0, 0 } +}; + +static driver_t bfe_driver = { + "bfe", + bfe_methods, + sizeof(struct bfe_softc) +}; + +static devclass_t bfe_devclass; + +DRIVER_MODULE(bfe, pci, bfe_driver, bfe_devclass, 0, 0); +DRIVER_MODULE(miibus, bfe, miibus_driver, miibus_devclass, 0, 0); + +/* + * Probe for a Broadcom 4401 chip. + */ +static int +bfe_probe(device_t dev) +{ + struct bfe_type *t; + + t = bfe_devs; + + while (t->bfe_name != NULL) { + if (pci_get_vendor(dev) == t->bfe_vid && + pci_get_device(dev) == t->bfe_did) { + device_set_desc(dev, t->bfe_name); + return (BUS_PROBE_DEFAULT); + } + t++; + } + + return (ENXIO); +} + +struct bfe_dmamap_arg { + bus_addr_t bfe_busaddr; +}; + +static int +bfe_dma_alloc(struct bfe_softc *sc) +{ + struct bfe_dmamap_arg ctx; + struct bfe_rx_data *rd; + struct bfe_tx_data *td; + int error, i; + + /* + * parent tag. Apparently the chip cannot handle any DMA address + * greater than 1GB. + */ + error = bus_dma_tag_create(bus_get_dma_tag(sc->bfe_dev), /* parent */ + 1, 0, /* alignment, boundary */ + BFE_DMA_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsize */ + 0, /* nsegments */ + BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_parent_tag); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create parent DMA tag.\n"); + goto fail; + } + + /* Create tag for Tx ring. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + BFE_TX_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BFE_TX_LIST_SIZE, /* maxsize */ + 1, /* nsegments */ + BFE_TX_LIST_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_tx_tag); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create Tx ring DMA tag.\n"); + goto fail; + } + + /* Create tag for Rx ring. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + BFE_RX_RING_ALIGN, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BFE_RX_LIST_SIZE, /* maxsize */ + 1, /* nsegments */ + BFE_RX_LIST_SIZE, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_rx_tag); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create Rx ring DMA tag.\n"); + goto fail; + } + + /* Create tag for Tx buffers. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES * BFE_MAXTXSEGS, /* maxsize */ + BFE_MAXTXSEGS, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_txmbuf_tag); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create Tx buffer DMA tag.\n"); + goto fail; + } + + /* Create tag for Rx buffers. */ + error = bus_dma_tag_create(sc->bfe_parent_tag, /* parent */ + 1, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + MCLBYTES, /* maxsize */ + 1, /* nsegments */ + MCLBYTES, /* maxsegsize */ + 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->bfe_rxmbuf_tag); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create Rx buffer DMA tag.\n"); + goto fail; + } + + /* Allocate DMA'able memory and load DMA map. */ + error = bus_dmamem_alloc(sc->bfe_tx_tag, (void *)&sc->bfe_tx_list, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, &sc->bfe_tx_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot allocate DMA'able memory for Tx ring.\n"); + goto fail; + } + ctx.bfe_busaddr = 0; + error = bus_dmamap_load(sc->bfe_tx_tag, sc->bfe_tx_map, + sc->bfe_tx_list, BFE_TX_LIST_SIZE, bfe_dma_map, &ctx, + BUS_DMA_NOWAIT); + if (error != 0 || ctx.bfe_busaddr == 0) { + device_printf(sc->bfe_dev, + "cannot load DMA'able memory for Tx ring.\n"); + goto fail; + } + sc->bfe_tx_dma = BFE_ADDR_LO(ctx.bfe_busaddr); + + error = bus_dmamem_alloc(sc->bfe_rx_tag, (void *)&sc->bfe_rx_list, + BUS_DMA_WAITOK | BUS_DMA_ZERO | BUS_DMA_COHERENT, &sc->bfe_rx_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot allocate DMA'able memory for Rx ring.\n"); + goto fail; + } + ctx.bfe_busaddr = 0; + error = bus_dmamap_load(sc->bfe_rx_tag, sc->bfe_rx_map, + sc->bfe_rx_list, BFE_RX_LIST_SIZE, bfe_dma_map, &ctx, + BUS_DMA_NOWAIT); + if (error != 0 || ctx.bfe_busaddr == 0) { + device_printf(sc->bfe_dev, + "cannot load DMA'able memory for Rx ring.\n"); + goto fail; + } + sc->bfe_rx_dma = BFE_ADDR_LO(ctx.bfe_busaddr); + + /* Create DMA maps for Tx buffers. */ + for (i = 0; i < BFE_TX_LIST_CNT; i++) { + td = &sc->bfe_tx_ring[i]; + td->bfe_mbuf = NULL; + td->bfe_map = NULL; + error = bus_dmamap_create(sc->bfe_txmbuf_tag, 0, &td->bfe_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create DMA map for Tx.\n"); + goto fail; + } + } + + /* Create spare DMA map for Rx buffers. */ + error = bus_dmamap_create(sc->bfe_rxmbuf_tag, 0, &sc->bfe_rx_sparemap); + if (error != 0) { + device_printf(sc->bfe_dev, "cannot create spare DMA map for Rx.\n"); + goto fail; + } + /* Create DMA maps for Rx buffers. */ + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + rd = &sc->bfe_rx_ring[i]; + rd->bfe_mbuf = NULL; + rd->bfe_map = NULL; + rd->bfe_ctrl = 0; + error = bus_dmamap_create(sc->bfe_rxmbuf_tag, 0, &rd->bfe_map); + if (error != 0) { + device_printf(sc->bfe_dev, + "cannot create DMA map for Rx.\n"); + goto fail; + } + } + +fail: + return (error); +} + +static void +bfe_dma_free(struct bfe_softc *sc) +{ + struct bfe_tx_data *td; + struct bfe_rx_data *rd; + int i; + + /* Tx ring. */ + if (sc->bfe_tx_tag != NULL) { + if (sc->bfe_tx_map != NULL) + bus_dmamap_unload(sc->bfe_tx_tag, sc->bfe_tx_map); + if (sc->bfe_tx_map != NULL && sc->bfe_tx_list != NULL) + bus_dmamem_free(sc->bfe_tx_tag, sc->bfe_tx_list, + sc->bfe_tx_map); + sc->bfe_tx_map = NULL; + sc->bfe_tx_list = NULL; + bus_dma_tag_destroy(sc->bfe_tx_tag); + sc->bfe_tx_tag = NULL; + } + + /* Rx ring. */ + if (sc->bfe_rx_tag != NULL) { + if (sc->bfe_rx_map != NULL) + bus_dmamap_unload(sc->bfe_rx_tag, sc->bfe_rx_map); + if (sc->bfe_rx_map != NULL && sc->bfe_rx_list != NULL) + bus_dmamem_free(sc->bfe_rx_tag, sc->bfe_rx_list, + sc->bfe_rx_map); + sc->bfe_rx_map = NULL; + sc->bfe_rx_list = NULL; + bus_dma_tag_destroy(sc->bfe_rx_tag); + sc->bfe_rx_tag = NULL; + } + + /* Tx buffers. */ + if (sc->bfe_txmbuf_tag != NULL) { + for (i = 0; i < BFE_TX_LIST_CNT; i++) { + td = &sc->bfe_tx_ring[i]; + if (td->bfe_map != NULL) { + bus_dmamap_destroy(sc->bfe_txmbuf_tag, + td->bfe_map); + td->bfe_map = NULL; + } + } + bus_dma_tag_destroy(sc->bfe_txmbuf_tag); + sc->bfe_txmbuf_tag = NULL; + } + + /* Rx buffers. */ + if (sc->bfe_rxmbuf_tag != NULL) { + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + rd = &sc->bfe_rx_ring[i]; + if (rd->bfe_map != NULL) { + bus_dmamap_destroy(sc->bfe_rxmbuf_tag, + rd->bfe_map); + rd->bfe_map = NULL; + } + } + if (sc->bfe_rx_sparemap != NULL) { + bus_dmamap_destroy(sc->bfe_rxmbuf_tag, + sc->bfe_rx_sparemap); + sc->bfe_rx_sparemap = NULL; + } + bus_dma_tag_destroy(sc->bfe_rxmbuf_tag); + sc->bfe_rxmbuf_tag = NULL; + } + + if (sc->bfe_parent_tag != NULL) { + bus_dma_tag_destroy(sc->bfe_parent_tag); + sc->bfe_parent_tag = NULL; + } +} + +static int +bfe_attach(device_t dev) +{ + struct ifnet *ifp = NULL; + struct bfe_softc *sc; + int error = 0, rid; + + sc = device_get_softc(dev); + mtx_init(&sc->bfe_mtx, device_get_nameunit(dev), MTX_NETWORK_LOCK, + MTX_DEF); + callout_init_mtx(&sc->bfe_stat_co, &sc->bfe_mtx, 0); + + sc->bfe_dev = dev; + + /* + * Map control/status registers. + */ + pci_enable_busmaster(dev); + + rid = PCIR_BAR(0); + sc->bfe_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->bfe_res == NULL) { + device_printf(dev, "couldn't map memory\n"); + error = ENXIO; + goto fail; + } + + /* Allocate interrupt */ + rid = 0; + + sc->bfe_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_SHAREABLE | RF_ACTIVE); + if (sc->bfe_irq == NULL) { + device_printf(dev, "couldn't map interrupt\n"); + error = ENXIO; + goto fail; + } + + if (bfe_dma_alloc(sc) != 0) { + device_printf(dev, "failed to allocate DMA resources\n"); + error = ENXIO; + goto fail; + } + + SYSCTL_ADD_PROC(device_get_sysctl_ctx(dev), + SYSCTL_CHILDREN(device_get_sysctl_tree(dev)), OID_AUTO, + "stats", CTLTYPE_INT | CTLFLAG_RW, sc, 0, sysctl_bfe_stats, + "I", "Statistics"); + + /* Set up ifnet structure */ + ifp = sc->bfe_ifp = if_alloc(IFT_ETHER); + if (ifp == NULL) { + device_printf(dev, "failed to if_alloc()\n"); + error = ENOSPC; + goto fail; + } + ifp->if_softc = sc; + if_initname(ifp, device_get_name(dev), device_get_unit(dev)); + ifp->if_flags = IFF_BROADCAST | IFF_SIMPLEX | IFF_MULTICAST; + ifp->if_ioctl = bfe_ioctl; + ifp->if_start = bfe_start; + ifp->if_init = bfe_init; + ifp->if_mtu = ETHERMTU; + IFQ_SET_MAXLEN(&ifp->if_snd, BFE_TX_QLEN); + ifp->if_snd.ifq_drv_maxlen = BFE_TX_QLEN; + IFQ_SET_READY(&ifp->if_snd); + + bfe_get_config(sc); + + /* Reset the chip and turn on the PHY */ + BFE_LOCK(sc); + bfe_chip_reset(sc); + BFE_UNLOCK(sc); + + if (mii_phy_probe(dev, &sc->bfe_miibus, + bfe_ifmedia_upd, bfe_ifmedia_sts)) { + device_printf(dev, "MII without any PHY!\n"); + error = ENXIO; + goto fail; + } + + ether_ifattach(ifp, sc->bfe_enaddr); + + /* + * Tell the upper layer(s) we support long frames. + */ + ifp->if_data.ifi_hdrlen = sizeof(struct ether_vlan_header); + ifp->if_capabilities |= IFCAP_VLAN_MTU; + ifp->if_capenable |= IFCAP_VLAN_MTU; + + /* + * Hook interrupt last to avoid having to lock softc + */ + error = bus_setup_intr(dev, sc->bfe_irq, INTR_TYPE_NET | INTR_MPSAFE, + NULL, bfe_intr, sc, &sc->bfe_intrhand); + + if (error) { + device_printf(dev, "couldn't set up irq\n"); + goto fail; + } +fail: + if (error != 0) + bfe_detach(dev); + return (error); +} + +static int +bfe_detach(device_t dev) +{ + struct bfe_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + + ifp = sc->bfe_ifp; + + if (device_is_attached(dev)) { + BFE_LOCK(sc); + sc->bfe_flags |= BFE_FLAG_DETACH; + bfe_stop(sc); + BFE_UNLOCK(sc); + callout_drain(&sc->bfe_stat_co); + if (ifp != NULL) + ether_ifdetach(ifp); + } + + BFE_LOCK(sc); + bfe_chip_reset(sc); + BFE_UNLOCK(sc); + + bus_generic_detach(dev); + if (sc->bfe_miibus != NULL) + device_delete_child(dev, sc->bfe_miibus); + + bfe_release_resources(sc); + bfe_dma_free(sc); + mtx_destroy(&sc->bfe_mtx); + + return (0); +} + +/* + * Stop all chip I/O so that the kernel's probe routines don't + * get confused by errant DMAs when rebooting. + */ +static int +bfe_shutdown(device_t dev) +{ + struct bfe_softc *sc; + + sc = device_get_softc(dev); + BFE_LOCK(sc); + bfe_stop(sc); + + BFE_UNLOCK(sc); + + return (0); +} + +static int +bfe_suspend(device_t dev) +{ + struct bfe_softc *sc; + + sc = device_get_softc(dev); + BFE_LOCK(sc); + bfe_stop(sc); + BFE_UNLOCK(sc); + + return (0); +} + +static int +bfe_resume(device_t dev) +{ + struct bfe_softc *sc; + struct ifnet *ifp; + + sc = device_get_softc(dev); + ifp = sc->bfe_ifp; + BFE_LOCK(sc); + bfe_chip_reset(sc); + if (ifp->if_flags & IFF_UP) { + bfe_init_locked(sc); + if (ifp->if_drv_flags & IFF_DRV_RUNNING && + !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) + bfe_start_locked(ifp); + } + BFE_UNLOCK(sc); + + return (0); +} + +static int +bfe_miibus_readreg(device_t dev, int phy, int reg) +{ + struct bfe_softc *sc; + u_int32_t ret; + + sc = device_get_softc(dev); + if (phy != sc->bfe_phyaddr) + return (0); + bfe_readphy(sc, reg, &ret); + + return (ret); +} + +static int +bfe_miibus_writereg(device_t dev, int phy, int reg, int val) +{ + struct bfe_softc *sc; + + sc = device_get_softc(dev); + if (phy != sc->bfe_phyaddr) + return (0); + bfe_writephy(sc, reg, val); + + return (0); +} + +static void +bfe_miibus_statchg(device_t dev) +{ + struct bfe_softc *sc; + struct mii_data *mii; + u_int32_t val, flow; + + sc = device_get_softc(dev); + mii = device_get_softc(sc->bfe_miibus); + + sc->bfe_flags &= ~BFE_FLAG_LINK; + if ((mii->mii_media_status & (IFM_ACTIVE | IFM_AVALID)) == + (IFM_ACTIVE | IFM_AVALID)) { + switch (IFM_SUBTYPE(mii->mii_media_active)) { + case IFM_10_T: + case IFM_100_TX: + sc->bfe_flags |= BFE_FLAG_LINK; + break; + default: + break; + } + } + + /* XXX Should stop Rx/Tx engine prior to touching MAC. */ + val = CSR_READ_4(sc, BFE_TX_CTRL); + val &= ~BFE_TX_DUPLEX; + if ((IFM_OPTIONS(mii->mii_media_active) & IFM_FDX) != 0) { + val |= BFE_TX_DUPLEX; + flow = 0; +#ifdef notyet + flow = CSR_READ_4(sc, BFE_RXCONF); + flow &= ~BFE_RXCONF_FLOW; + if ((IFM_OPTIONS(sc->sc_mii->mii_media_active) & + IFM_ETH_RXPAUSE) != 0) + flow |= BFE_RXCONF_FLOW; + CSR_WRITE_4(sc, BFE_RXCONF, flow); + /* + * It seems that the hardware has Tx pause issues + * so enable only Rx pause. + */ + flow = CSR_READ_4(sc, BFE_MAC_FLOW); + flow &= ~BFE_FLOW_PAUSE_ENAB; + CSR_WRITE_4(sc, BFE_MAC_FLOW, flow); +#endif + } + CSR_WRITE_4(sc, BFE_TX_CTRL, val); +} + +static void +bfe_tx_ring_free(struct bfe_softc *sc) +{ + int i; + + for(i = 0; i < BFE_TX_LIST_CNT; i++) { + if (sc->bfe_tx_ring[i].bfe_mbuf != NULL) { + bus_dmamap_sync(sc->bfe_txmbuf_tag, + sc->bfe_tx_ring[i].bfe_map, BUS_DMASYNC_POSTWRITE); + bus_dmamap_unload(sc->bfe_txmbuf_tag, + sc->bfe_tx_ring[i].bfe_map); + m_freem(sc->bfe_tx_ring[i].bfe_mbuf); + sc->bfe_tx_ring[i].bfe_mbuf = NULL; + } + } + bzero(sc->bfe_tx_list, BFE_TX_LIST_SIZE); + bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); +} + +static void +bfe_rx_ring_free(struct bfe_softc *sc) +{ + int i; + + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + if (sc->bfe_rx_ring[i].bfe_mbuf != NULL) { + bus_dmamap_sync(sc->bfe_rxmbuf_tag, + sc->bfe_rx_ring[i].bfe_map, BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->bfe_rxmbuf_tag, + sc->bfe_rx_ring[i].bfe_map); + m_freem(sc->bfe_rx_ring[i].bfe_mbuf); + sc->bfe_rx_ring[i].bfe_mbuf = NULL; + } + } + bzero(sc->bfe_rx_list, BFE_RX_LIST_SIZE); + bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); +} + +static int +bfe_list_rx_init(struct bfe_softc *sc) +{ + struct bfe_rx_data *rd; + int i; + + sc->bfe_rx_prod = sc->bfe_rx_cons = 0; + bzero(sc->bfe_rx_list, BFE_RX_LIST_SIZE); + for (i = 0; i < BFE_RX_LIST_CNT; i++) { + rd = &sc->bfe_rx_ring[i]; + rd->bfe_mbuf = NULL; + rd->bfe_ctrl = 0; + if (bfe_list_newbuf(sc, i) != 0) + return (ENOBUFS); + } + + bus_dmamap_sync(sc->bfe_rx_tag, sc->bfe_rx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + CSR_WRITE_4(sc, BFE_DMARX_PTR, (i * sizeof(struct bfe_desc))); + + return (0); +} + +static void +bfe_list_tx_init(struct bfe_softc *sc) +{ + int i; + + sc->bfe_tx_cnt = sc->bfe_tx_prod = sc->bfe_tx_cons = 0; + bzero(sc->bfe_tx_list, BFE_TX_LIST_SIZE); + for (i = 0; i < BFE_TX_LIST_CNT; i++) + sc->bfe_tx_ring[i].bfe_mbuf = NULL; + + bus_dmamap_sync(sc->bfe_tx_tag, sc->bfe_tx_map, + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); +} + +static void +bfe_discard_buf(struct bfe_softc *sc, int c) +{ + struct bfe_rx_data *r; + struct bfe_desc *d; + + r = &sc->bfe_rx_ring[c]; + d = &sc->bfe_rx_list[c]; + d->bfe_ctrl = htole32(r->bfe_ctrl); +} + +static int +bfe_list_newbuf(struct bfe_softc *sc, int c) +{ + struct bfe_rxheader *rx_header; + struct bfe_desc *d; + struct bfe_rx_data *r; + struct mbuf *m; + bus_dma_segment_t segs[1]; + bus_dmamap_t map; + u_int32_t ctrl; + int nsegs; + + m = m_getcl(M_DONTWAIT, MT_DATA, M_PKTHDR); + m->m_len = m->m_pkthdr.len = MCLBYTES; + + if (bus_dmamap_load_mbuf_sg(sc->bfe_rxmbuf_tag, sc->bfe_rx_sparemap, + m, segs, &nsegs, 0) != 0) { + m_freem(m); + return (ENOBUFS); + } + + KASSERT(nsegs == 1, ("%s: %d segments returned!", __func__, nsegs)); + r = &sc->bfe_rx_ring[c]; + if (r->bfe_mbuf != NULL) { + bus_dmamap_sync(sc->bfe_rxmbuf_tag, r->bfe_map, + BUS_DMASYNC_POSTREAD); + bus_dmamap_unload(sc->bfe_rxmbuf_tag, r->bfe_map); + } + map = r->bfe_map; + r->bfe_map = sc->bfe_rx_sparemap; + sc->bfe_rx_sparemap = map; + r->bfe_mbuf = m; + + rx_header = mtod(m, struct bfe_rxheader *); + rx_header->len = 0; + rx_header->flags = 0; + bus_dmamap_sync(sc->bfe_rxmbuf_tag, r->bfe_map, BUS_DMASYNC_PREREAD); + + ctrl = segs[0].ds_len & BFE_DESC_LEN; + KASSERT(ctrl > ETHER_MAX_LEN + 32, ("%s: buffer size too small(%d)!", + __func__, ctrl)); + if (c == BFE_RX_LIST_CNT - 1) + ctrl |= BFE_DESC_EOT; + r->bfe_ctrl = ctrl; + + d = &sc->bfe_rx_list[c]; + d->bfe_ctrl = htole32(ctrl); + /* The chip needs all addresses to be added to BFE_PCI_DMA. */ + d->bfe_addr = htole32(BFE_ADDR_LO(segs[0].ds_addr) + BFE_PCI_DMA); + + return (0); +} + +static void +bfe_get_config(struct bfe_softc *sc) +{ + u_int8_t eeprom[128]; + + bfe_read_eeprom(sc, eeprom); + + sc->bfe_enaddr[0] = eeprom[79]; + sc->bfe_enaddr[1] = eeprom[78]; + sc->bfe_enaddr[2] = eeprom[81]; + sc->bfe_enaddr[3] = eeprom[80]; + sc->bfe_enaddr[4] = eeprom[83]; + sc->bfe_enaddr[5] = eeprom[82]; + + sc->bfe_phyaddr = eeprom[90] & 0x1f; + sc->bfe_mdc_port = (eeprom[90] >> 14) & 0x1; + + sc->bfe_core_unit = 0; + sc->bfe_dma_offset = BFE_PCI_DMA; +} + +static void +bfe_pci_setup(struct bfe_softc *sc, u_int32_t cores) +{ + u_int32_t bar_orig, pci_rev, val; + + bar_orig = pci_read_config(sc->bfe_dev, BFE_BAR0_WIN, 4); + pci_write_config(sc->bfe_dev, BFE_BAR0_WIN, BFE_REG_PCI, 4); + pci_rev = CSR_READ_4(sc, BFE_SBIDHIGH) & BFE_RC_MASK; + + val = CSR_READ_4(sc, BFE_SBINTVEC); + val |= cores; + CSR_WRITE_4(sc, BFE_SBINTVEC, val); + + val = CSR_READ_4(sc, BFE_SSB_PCI_TRANS_2); + val |= BFE_SSB_PCI_PREF | BFE_SSB_PCI_BURST; + CSR_WRITE_4(sc, BFE_SSB_PCI_TRANS_2, val); + + pci_write_config(sc->bfe_dev, BFE_BAR0_WIN, bar_orig, 4); +} + +static void +bfe_clear_stats(struct bfe_softc *sc) +{ + uint32_t reg; + + BFE_LOCK_ASSERT(sc); + + CSR_WRITE_4(sc, BFE_MIB_CTRL, BFE_MIB_CLR_ON_READ); + for (reg = BFE_TX_GOOD_O; reg <= BFE_TX_PAUSE; reg += 4) + CSR_READ_4(sc, reg); + for (reg = BFE_RX_GOOD_O; reg <= BFE_RX_NPAUSE; reg += 4) + CSR_READ_4(sc, reg); +} + +static int +bfe_resetphy(struct bfe_softc *sc) +{ + u_int32_t val; + + bfe_writephy(sc, 0, BMCR_RESET); + DELAY(100); + bfe_readphy(sc, 0, &val); + if (val & BMCR_RESET) { + device_printf(sc->bfe_dev, "PHY Reset would not complete.\n"); + return (ENXIO); + } + return (0); +} + +static void +bfe_chip_halt(struct bfe_softc *sc) +{ + BFE_LOCK_ASSERT(sc); + /* disable interrupts - not that it actually does..*/ + CSR_WRITE_4(sc, BFE_IMASK, 0); + CSR_READ_4(sc, BFE_IMASK); + + CSR_WRITE_4(sc, BFE_ENET_CTRL, BFE_ENET_DISABLE); + bfe_wait_bit(sc, BFE_ENET_CTRL, BFE_ENET_DISABLE, 200, 1); + + CSR_WRITE_4(sc, BFE_DMARX_CTRL, 0); + CSR_WRITE_4(sc, BFE_DMATX_CTRL, 0); + DELAY(10); +} + +static void +bfe_chip_reset(struct bfe_softc *sc) +{ + u_int32_t val; + + BFE_LOCK_ASSERT(sc); + + /* Set the interrupt vector for the enet core */ + bfe_pci_setup(sc, BFE_INTVEC_ENET0); + + /* is core up? */ + val = CSR_READ_4(sc, BFE_SBTMSLOW) & + (BFE_RESET | BFE_REJECT | BFE_CLOCK); + if (val == BFE_CLOCK) { + /* It is, so shut it down */ + CSR_WRITE_4(sc, BFE_RCV_LAZY, 0); + CSR_WRITE_4(sc, BFE_ENET_CTRL, BFE_ENET_DISABLE); + bfe_wait_bit(sc, BFE_ENET_CTRL, BFE_ENET_DISABLE, 100, 1); + CSR_WRITE_4(sc, BFE_DMATX_CTRL, 0); + if (CSR_READ_4(sc, BFE_DMARX_STAT) & BFE_STAT_EMASK) + bfe_wait_bit(sc, BFE_DMARX_STAT, BFE_STAT_SIDLE, + 100, 0); + CSR_WRITE_4(sc, BFE_DMARX_CTRL, 0); + } + + bfe_core_reset(sc); + bfe_clear_stats(sc); + + /* + * We want the phy registers to be accessible even when + * the driver is "downed" so initialize MDC preamble, frequency, + * and whether internal or external phy here. + */ + + /* 4402 has 62.5Mhz SB clock and internal phy */ + CSR_WRITE_4(sc, BFE_MDIO_CTRL, 0x8d); + + /* Internal or external PHY? */ + val = CSR_READ_4(sc, BFE_DEVCTRL); + if (!(val & BFE_IPP)) + CSR_WRITE_4(sc, BFE_ENET_CTRL, BFE_ENET_EPSEL); + else if (CSR_READ_4(sc, BFE_DEVCTRL) & BFE_EPR) { + BFE_AND(sc, BFE_DEVCTRL, ~BFE_EPR); + DELAY(100); + } + + /* Enable CRC32 generation and set proper LED modes */ + BFE_OR(sc, BFE_MAC_CTRL, BFE_CTRL_CRC32_ENAB | BFE_CTRL_LED); + + /* Reset or clear powerdown control bit */ + BFE_AND(sc, BFE_MAC_CTRL, ~BFE_CTRL_PDOWN); + + CSR_WRITE_4(sc, BFE_RCV_LAZY, ((1 << BFE_LAZY_FC_SHIFT) & + BFE_LAZY_FC_MASK)); + + /* + * We don't want lazy interrupts, so just send them at + * the end of a frame, please + */ + BFE_OR(sc, BFE_RCV_LAZY, 0); + + /* Set max lengths, accounting for VLAN tags */ + CSR_WRITE_4(sc, BFE_RXMAXLEN, ETHER_MAX_LEN+32); + CSR_WRITE_4(sc, BFE_TXMAXLEN, ETHER_MAX_LEN+32); + + /* Set watermark XXX - magic */ + CSR_WRITE_4(sc, BFE_TX_WMARK, 56); [... truncated: 1612 lines follow ...] From korli at users.berlios.de Tue Nov 11 11:40:50 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 11 Nov 2008 11:40:50 +0100 Subject: [Haiku-commits] r28598 - in haiku/trunk/headers/os: kernel storage support In-Reply-To: <968615199-BeMail@zon> References: <200811102350.mAANohVG002141@sheep.berlios.de> <968615199-BeMail@zon> Message-ID: 2008/11/11 Axel D?rfler : > stippi at BerliOS wrote: >> Modified: >> haiku/trunk/headers/os/kernel/OS.h >> haiku/trunk/headers/os/storage/FindDirectory.h >> haiku/trunk/headers/os/storage/Mime.h >> haiku/trunk/headers/os/support/ByteOrder.h >> haiku/trunk/headers/os/support/SupportDefs.h >> Log: >> Patch by Scott: >> Make sure the comments are C style in headers that are included by >> POSIX >> headers. > > I wonder why those should be included by POSIX headers at all, though. Only Errors.h and BeBuild.h are included by POSIX headers. Bye, J?r?me From korli at users.berlios.de Tue Nov 11 11:42:49 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 11 Nov 2008 11:42:49 +0100 Subject: [Haiku-commits] r28597 - in haiku/trunk/src/add-ons/kernel/drivers/network: . broadcom440x broadcom440x/dev broadcom440x/dev/bfe broadcom440x/dev/mii In-Reply-To: <1078867419-BeMail@zon> References: <200811102303.mAAN3JiZ008691@sheep.berlios.de> <1078867419-BeMail@zon> Message-ID: 2008/11/11 Axel D?rfler : > korli at BerliOS wrote: >> Log: >> Added Broadcom BCM440x from FreeBSD (bfe). Compiles and even works. >> I just added a check in bmtphy_probe() as ENXIO is negative on Haiku. > > Can you put the unchanged version in the vendor branch (vendor/freebsd/ > )? > Thanks! > Done. Bye, J?r?me From korli at mail.berlios.de Tue Nov 11 13:19:13 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 13:19:13 +0100 Subject: [Haiku-commits] r28601 - in haiku/vendor/freebsd/current/dev: bge mii Message-ID: <200811111219.mABCJDfx003772@sheep.berlios.de> Author: korli Date: 2008-11-11 13:19:12 +0100 (Tue, 11 Nov 2008) New Revision: 28601 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28601&view=rev Modified: haiku/vendor/freebsd/current/dev/bge/if_bge.c haiku/vendor/freebsd/current/dev/bge/if_bgereg.h haiku/vendor/freebsd/current/dev/mii/brgphyreg.h Log: updated bge to current Modified: haiku/vendor/freebsd/current/dev/bge/if_bge.c =================================================================== --- haiku/vendor/freebsd/current/dev/bge/if_bge.c 2008-11-11 10:35:36 UTC (rev 28600) +++ haiku/vendor/freebsd/current/dev/bge/if_bge.c 2008-11-11 12:19:12 UTC (rev 28601) @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.198 2007/09/30 11:05:14 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.215 2008/10/27 22:10:01 marius Exp $"); /* * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. @@ -134,7 +134,7 @@ * ID burned into it, though it will always be overriden by the vendor * ID in the EEPROM. Just to be safe, we cover all possibilities. */ -static struct bge_type { +static const struct bge_type { uint16_t bge_vid; uint16_t bge_did; } bge_devs[] = { @@ -169,6 +169,7 @@ { BCOM_VENDORID, BCOM_DEVICEID_BCM5715S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5751 }, @@ -195,6 +196,8 @@ { BCOM_VENDORID, BCOM_DEVICEID_BCM5901 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5901A2 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5903M }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5906 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5906M }, { SK_VENDORID, SK_DEVICEID_ALTIMA }, @@ -267,10 +270,13 @@ { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, + { BGE_CHIPID_BCM5722_A0, "BCM5722 A0" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_CHIPID_BCM5787_A0, "BCM5754/5787 A0" }, { BGE_CHIPID_BCM5787_A1, "BCM5754/5787 A1" }, { BGE_CHIPID_BCM5787_A2, "BCM5754/5787 A2" }, + { BGE_CHIPID_BCM5906_A1, "BCM5906 A1" }, + { BGE_CHIPID_BCM5906_A2, "BCM5906 A2" }, { 0, NULL } }; @@ -293,6 +299,7 @@ { BGE_ASICREV_BCM5755, "unknown BCM5755" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, + { BGE_ASICREV_BCM5906, "unknown BCM5906" }, { 0, NULL } }; @@ -305,6 +312,9 @@ const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); + +typedef int (*bge_eaddr_fcn_t)(struct bge_softc *, uint8_t[]); + static int bge_probe(device_t); static int bge_attach(device_t); static int bge_detach(device_t); @@ -315,6 +325,12 @@ static int bge_dma_alloc(device_t); static void bge_dma_free(struct bge_softc *); +static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]); +static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]); +static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]); +static int bge_get_eaddr_eeprom(struct bge_softc *, uint8_t[]); +static int bge_get_eaddr(struct bge_softc *, uint8_t[]); + static void bge_txeof(struct bge_softc *); static void bge_rxeof(struct bge_softc *); @@ -337,6 +353,9 @@ static int bge_ifmedia_upd(struct ifnet *); static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static uint8_t bge_nvram_getbyte(struct bge_softc *, int, uint8_t *); +static int bge_read_nvram(struct bge_softc *, caddr_t, int, int); + static uint8_t bge_eeprom_getbyte(struct bge_softc *, int, uint8_t *); static int bge_read_eeprom(struct bge_softc *, caddr_t, int, int); @@ -356,9 +375,10 @@ static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); -static int bge_has_eeprom(struct bge_softc *); +static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); static void bge_writemem_ind(struct bge_softc *, int, int); +static void bge_writembx(struct bge_softc *, int, int); #ifdef notdef static uint32_t bge_readreg_ind(struct bge_softc *, int); #endif @@ -440,7 +460,7 @@ #define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id" static int -bge_has_eeprom(struct bge_softc *sc) +bge_has_eaddr(struct bge_softc *sc) { #ifdef __sparc64__ char buf[sizeof(SPARC64_BLADE_1500_PATH_BGE)]; @@ -452,7 +472,7 @@ /* * The on-board BGEs found in sun4u machines aren't fitted with * an EEPROM which means that we have to obtain the MAC address - * via OFW and that some tests will always fail. We distinguish + * via OFW and that some tests will always fail. We distinguish * such BGEs by the subvendor ID, which also has to be obtained * from OFW instead of the PCI configuration space as the latter * indicates Broadcom as the subvendor of the netboot interface. @@ -533,6 +553,15 @@ CSR_WRITE_4(sc, off, val); } +static void +bge_writembx(struct bge_softc *sc, int off, int val) +{ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI; + + CSR_WRITE_4(sc, off, val); +} + /* * Map a single buffer address. */ @@ -555,7 +584,79 @@ ctx->bge_busaddr = segs->ds_addr; } +static uint8_t +bge_nvram_getbyte(struct bge_softc *sc, int addr, uint8_t *dest) +{ + uint32_t access, byte = 0; + int i; + + /* Lock. */ + CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1); + for (i = 0; i < 8000; i++) { + if (CSR_READ_4(sc, BGE_NVRAM_SWARB) & BGE_NVRAMSWARB_GNT1) + break; + DELAY(20); + } + if (i == 8000) + return (1); + + /* Enable access. */ + access = CSR_READ_4(sc, BGE_NVRAM_ACCESS); + CSR_WRITE_4(sc, BGE_NVRAM_ACCESS, access | BGE_NVRAMACC_ENABLE); + + CSR_WRITE_4(sc, BGE_NVRAM_ADDR, addr & 0xfffffffc); + CSR_WRITE_4(sc, BGE_NVRAM_CMD, BGE_NVRAM_READCMD); + for (i = 0; i < BGE_TIMEOUT * 10; i++) { + DELAY(10); + if (CSR_READ_4(sc, BGE_NVRAM_CMD) & BGE_NVRAMCMD_DONE) { + DELAY(10); + break; + } + } + + if (i == BGE_TIMEOUT * 10) { + if_printf(sc->bge_ifp, "nvram read timed out\n"); + return (1); + } + + /* Get result. */ + byte = CSR_READ_4(sc, BGE_NVRAM_RDDATA); + + *dest = (bswap32(byte) >> ((addr % 4) * 8)) & 0xFF; + + /* Disable access. */ + CSR_WRITE_4(sc, BGE_NVRAM_ACCESS, access); + + /* Unlock. */ + CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_CLR1); + CSR_READ_4(sc, BGE_NVRAM_SWARB); + + return (0); +} + /* + * Read a sequence of bytes from NVRAM. + */ +static int +bge_read_nvram(struct bge_softc *sc, caddr_t dest, int off, int cnt) +{ + int err = 0, i; + uint8_t byte = 0; + + if (sc->bge_asicrev != BGE_ASICREV_BCM5906) + return (1); + + for (i = 0; i < cnt; i++) { + err = bge_nvram_getbyte(sc, off + i, &byte); + if (err) + break; + *(dest + i) = byte; + } + + return (err ? 1 : 0); +} + +/* * Read a byte of data stored in the EEPROM at address 'addr.' The * BCM570x supports both the traditional bitbang interface and an * auto access interface for reading the EEPROM. We use the auto @@ -659,11 +760,14 @@ } if (i == BGE_TIMEOUT) { - device_printf(sc->bge_dev, "PHY read timed out\n"); + device_printf(sc->bge_dev, + "PHY read timed out (phy %d, reg %d, val 0x%08x)\n", + phy, reg, val); val = 0; goto done; } + DELAY(5); val = CSR_READ_4(sc, BGE_MI_COMM); done: @@ -687,6 +791,10 @@ sc = device_get_softc(dev); + if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && + (reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL)) + return(0); + /* Reading with autopolling on may trigger PCI errors */ autopoll = CSR_READ_4(sc, BGE_MI_MODE); if (autopoll & BGE_MIMODE_AUTOPOLL) { @@ -699,12 +807,17 @@ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); - if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) + if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) { + DELAY(5); + CSR_READ_4(sc, BGE_MI_COMM); /* dummy read */ break; + } } if (i == BGE_TIMEOUT) { - device_printf(sc->bge_dev, "PHY write timed out\n"); + device_printf(sc->bge_dev, + "PHY write timed out (phy %d, reg %d, val %d)\n", + phy, reg, val); return (0); } @@ -887,7 +1000,7 @@ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); sc->bge_std = i - 1; - CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); return (0); } @@ -934,7 +1047,7 @@ BGE_RCB_FLAG_USE_EXT_RX_BD); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); - CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); return (0); } @@ -990,17 +1103,17 @@ /* Initialize transmit producer index for host-memory send ring. */ sc->bge_tx_prodidx = 0; - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); /* NIC-memory send ring not used; initialize to zero. */ - CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); + bge_writembx(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) - CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); + bge_writembx(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); return (0); } @@ -1168,10 +1281,10 @@ /* * Check the 'ROM failed' bit on the RX CPU to see if * self-tests passed. Skip this check when there's no - * EEPROM fitted, since in that case it will always - * fail. + * chip containing the Ethernet address fitted, since + * in that case it will always fail. */ - if ((sc->bge_flags & BGE_FLAG_EEPROM) && + if ((sc->bge_flags & BGE_FLAG_EADDR) && CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) { device_printf(sc->bge_dev, "RX CPU self-diagnostics failed!\n"); return (ENODEV); @@ -1271,6 +1384,16 @@ /* Set the timer prescaler (always 66Mhz) */ CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ); + /* XXX: The Linux tg3 driver does this at the start of brgphy_reset. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + DELAY(40); /* XXX */ + + /* Put PHY into ready state */ + BGE_CLRBIT(sc, BGE_MISC_CFG, BGE_MISCCFG_EPHY_IDDQ); + CSR_READ_4(sc, BGE_MISC_CFG); /* Flush */ + DELAY(40); + } + return (0); } @@ -1308,14 +1431,19 @@ } /* Configure mbuf pool watermarks */ - if (!(BGE_IS_5705_PLUS(sc))) { + if (!BGE_IS_5705_PLUS(sc)) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); + } else if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x04); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x10); + } else { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10); - } else { - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); } - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); /* Configure DMA resource watermarks */ CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_LOWAT, 5); @@ -1421,6 +1549,9 @@ * requirement of all 575x family chips. The Linux driver sets * the lower threshold for all 5705 family chips as well, but there * are reports that it might not need to be so strict. + * + * XXX Linux does some extra fiddling here for the 5906 parts as + * well. */ if (BGE_IS_5705_PLUS(sc)) val = 8; @@ -1462,15 +1593,15 @@ BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt, BGE_RCB_FLAG_RING_DISABLED)); RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); - CSR_WRITE_4(sc, BGE_MBX_RX_CONS0_LO + + bge_writembx(sc, BGE_MBX_RX_CONS0_LO + (i * (sizeof(uint64_t))), 0); vrcb += sizeof(struct bge_rcb); } /* Initialize RX ring indexes */ - CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, 0); - CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); - CSR_WRITE_4(sc, BGE_MBX_RX_MINI_PROD_LO, 0); + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, 0); + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); + bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); /* * Set up RX return ring 0 @@ -1720,7 +1851,7 @@ static int bge_probe(device_t dev) { - struct bge_type *t = bge_devs; + const struct bge_type *t = bge_devs; struct bge_softc *sc = device_get_softc(dev); uint16_t vid, did; @@ -1742,7 +1873,8 @@ #if __FreeBSD_version > 700024 const char *pname; - if (pci_get_vpd_ident(dev, &pname) == 0) + if (bge_has_eaddr(sc) && + pci_get_vpd_ident(dev, &pname) == 0) snprintf(model, 64, "%s", pname); else #endif @@ -1892,16 +2024,10 @@ /* * Allocate the parent bus DMA tag appropriate for PCI. */ - error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MAXBSIZE, BGE_NSEG_NEW, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->bge_cdata.bge_parent_tag); + error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), + 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, + 0, NULL, NULL, &sc->bge_cdata.bge_parent_tag); if (error != 0) { device_printf(sc->bge_dev, @@ -1910,7 +2036,7 @@ } /* - * Create tag for RX mbufs. + * Create tag for mbufs. */ error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, @@ -2202,10 +2328,11 @@ int can_use_msi = 0; switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5714_A0: case BGE_ASICREV_BCM5714: /* - * Apparently, MSI doesn't work when this chip is configured - * in single-port mode. + * Apparently, MSI doesn't work when these chips are + * configured in single-port mode. */ if (bge_has_multiple_ports(sc)) can_use_msi = 1; @@ -2215,10 +2342,9 @@ sc->bge_chiprev != BGE_CHIPREV_5750_BX) can_use_msi = 1; break; - case BGE_ASICREV_BCM5752: - case BGE_ASICREV_BCM5780: - can_use_msi = 1; - break; + default: + if (BGE_IS_575X_PLUS(sc)) + can_use_msi = 1; } return (can_use_msi); } @@ -2229,8 +2355,7 @@ { struct ifnet *ifp; struct bge_softc *sc; - uint32_t hwcfg = 0; - uint32_t mac_tmp = 0; + uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; int error, reg, rid, trys; @@ -2244,7 +2369,7 @@ rid = BGE_PCI_BAR0; sc->bge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE | PCI_RF_DENSE); + RF_ACTIVE); if (sc->bge_res == NULL) { device_printf (sc->bge_dev, "couldn't map memory\n"); @@ -2252,20 +2377,26 @@ goto fail; } - sc->bge_btag = rman_get_bustag(sc->bge_res); - sc->bge_bhandle = rman_get_bushandle(sc->bge_res); - /* Save ASIC rev. */ - sc->bge_chipid = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & BGE_PCIMISCCTL_ASICREV; sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); - if (bge_has_eeprom(sc)) - sc->bge_flags |= BGE_FLAG_EEPROM; + /* + * Don't enable Ethernet at WireSpeed for the 5700, 5906, or the + * 5705 A0 and A1 chips. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && + sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && + sc->bge_chipid != BGE_CHIPID_BCM5705_A1) + sc->bge_flags |= BGE_FLAG_WIRESPEED; + if (bge_has_eaddr(sc)) + sc->bge_flags |= BGE_FLAG_EADDR; + /* Save chipset family. */ switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5700: @@ -2283,6 +2414,7 @@ case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5755: case BGE_ASICREV_BCM5787: + case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; /* FALLTHRU */ case BGE_ASICREV_BCM5705: @@ -2302,12 +2434,23 @@ if (BGE_IS_5705_PLUS(sc) && !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || - sc->bge_asicrev == BGE_ASICREV_BCM5787) - sc->bge_flags |= BGE_FLAG_JITTER_BUG; - else + sc->bge_asicrev == BGE_ASICREV_BCM5787) { + if (sc->bge_chipid != BGE_CHIPID_BCM5722_A0) + sc->bge_flags |= BGE_FLAG_JITTER_BUG; + } else if (sc->bge_asicrev != BGE_ASICREV_BCM5906) sc->bge_flags |= BGE_FLAG_BER_BUG; } + + /* + * We could possibly check for BCOM_DEVICEID_BCM5788 in bge_probe() + * but I do not know the DEVICEID for the 5788M. + */ + misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; + if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || + misccfg == BGE_MISCCFG_BOARD_ID_5788M) + sc->bge_flags |= BGE_FLAG_5788; + /* * Check if this is a PCI-X or PCI Express device. */ @@ -2414,28 +2557,12 @@ goto fail; } -#ifdef __sparc64__ - if ((sc->bge_flags & BGE_FLAG_EEPROM) == 0) - OF_getetheraddr(dev, eaddr); - else -#endif - { - mac_tmp = bge_readmem_ind(sc, 0x0C14); - if ((mac_tmp >> 16) == 0x484B) { - eaddr[0] = (u_char)(mac_tmp >> 8); - eaddr[1] = (u_char)mac_tmp; - mac_tmp = bge_readmem_ind(sc, 0x0C18); - eaddr[2] = (u_char)(mac_tmp >> 24); - eaddr[3] = (u_char)(mac_tmp >> 16); - eaddr[4] = (u_char)(mac_tmp >> 8); - eaddr[5] = (u_char)mac_tmp; - } else if (bge_read_eeprom(sc, eaddr, - BGE_EE_MAC_OFFSET + 2, ETHER_ADDR_LEN)) { - device_printf(sc->bge_dev, - "failed to read station address\n"); - error = ENXIO; - goto fail; - } + error = bge_get_eaddr(sc, eaddr); + if (error) { + device_printf(sc->bge_dev, + "failed to read station address\n"); + error = ENXIO; + goto fail; } /* 5705 limits RX return ring to 512 entries. */ @@ -2507,7 +2634,8 @@ */ if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); - else if (sc->bge_flags & BGE_FLAG_EEPROM) { + else if ((sc->bge_flags & BGE_FLAG_EADDR) && + (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, sizeof(hwcfg))) { device_printf(sc->bge_dev, "failed to read EEPROM\n"); @@ -2682,13 +2810,14 @@ bge_reset(struct bge_softc *sc) { device_t dev; - uint32_t cachesize, command, pcistate, reset; + uint32_t cachesize, command, pcistate, reset, val; void (*write_op)(struct bge_softc *, int, int); - int i, val = 0; + int i; dev = sc->bge_dev; - if (BGE_IS_575X_PLUS(sc) && !BGE_IS_5714_FAMILY(sc)) { + if (BGE_IS_575X_PLUS(sc) && !BGE_IS_5714_FAMILY(sc) && + (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (sc->bge_flags & BGE_FLAG_PCIE) write_op = bge_writemem_direct; else @@ -2744,16 +2873,23 @@ /* Issue global reset */ write_op(sc, BGE_MISC_CFG, reset); + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + val = CSR_READ_4(sc, BGE_VCPU_STATUS); + CSR_WRITE_4(sc, BGE_VCPU_STATUS, + val | BGE_VCPU_STATUS_DRV_RESET); + val = CSR_READ_4(sc, BGE_VCPU_EXT_CTRL); + CSR_WRITE_4(sc, BGE_VCPU_EXT_CTRL, + val & ~BGE_VCPU_EXT_CTRL_HALT_CPU); + } + DELAY(1000); /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE) { if (sc->bge_chipid == BGE_CHIPID_BCM5750_A0) { - uint32_t v; - DELAY(500000); /* wait for link training to complete */ - v = pci_read_config(dev, 0xC4, 4); - pci_write_config(dev, 0xC4, v | (1 << 15), 4); + val = pci_read_config(dev, 0xC4, 4); + pci_write_config(dev, 0xC4, val | (1 << 15), 4); } /* * Set PCIE max payload size to 128 bytes and clear error @@ -2772,8 +2908,6 @@ /* Re-enable MSI, if neccesary, and enable the memory arbiter. */ if (BGE_IS_5714_FAMILY(sc)) { - uint32_t val; - /* This chip disables MSI on reset. */ if (sc->bge_flags & BGE_FLAG_MSI) { val = pci_read_config(dev, BGE_PCI_MSI_CTL, 2); @@ -2788,22 +2922,36 @@ } else CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); - /* - * Poll until we see the 1's complement of the magic number. - * This indicates that the firmware initialization is complete. - * We expect this to fail if no EEPROM is fitted though. - */ - for (i = 0; i < BGE_TIMEOUT; i++) { - DELAY(10); - val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); - if (val == ~BGE_MAGIC_NUMBER) - break; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + for (i = 0; i < BGE_TIMEOUT; i++) { + val = CSR_READ_4(sc, BGE_VCPU_STATUS); + if (val & BGE_VCPU_STATUS_INIT_DONE) + break; + DELAY(100); + } + if (i == BGE_TIMEOUT) { + device_printf(sc->bge_dev, "reset timed out\n"); + return (1); + } + } else { + /* + * Poll until we see the 1's complement of the magic number. + * This indicates that the firmware initialization is complete. + * We expect this to fail if no chip containing the Ethernet + * address is fitted though. + */ + for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); + val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); + if (val == ~BGE_MAGIC_NUMBER) + break; + } + + if ((sc->bge_flags & BGE_FLAG_EADDR) && i == BGE_TIMEOUT) + device_printf(sc->bge_dev, "firmware handshake timed out, " + "found 0x%08x\n", val); } - if ((sc->bge_flags & BGE_FLAG_EEPROM) && i == BGE_TIMEOUT) - device_printf(sc->bge_dev, "firmware handshake timed out, " - "found 0x%08x\n", val); - /* * XXX Wait for the value of the PCISTATE register to * return to its original pre-reset state. This is a @@ -2840,20 +2988,16 @@ */ if (sc->bge_asicrev == BGE_ASICREV_BCM5704 && sc->bge_flags & BGE_FLAG_TBI) { - uint32_t serdescfg; - - serdescfg = CSR_READ_4(sc, BGE_SERDES_CFG); - serdescfg = (serdescfg & ~0xFFF) | 0x880; - CSR_WRITE_4(sc, BGE_SERDES_CFG, serdescfg); + val = CSR_READ_4(sc, BGE_SERDES_CFG); + val = (val & ~0xFFF) | 0x880; + CSR_WRITE_4(sc, BGE_SERDES_CFG, val); } /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE && sc->bge_chipid != BGE_CHIPID_BCM5750_A0) { - uint32_t v; - - v = CSR_READ_4(sc, 0x7C00); - CSR_WRITE_4(sc, 0x7C00, v | (1 << 25)); + val = CSR_READ_4(sc, 0x7C00); + CSR_WRITE_4(sc, 0x7C00, val | (1 << 25)); } DELAY(10000); @@ -3022,11 +3166,11 @@ bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); - CSR_WRITE_4(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx); + bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx); if (stdcnt) - CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); if (jumbocnt) - CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); #ifdef notyet /* * This register wraps very quickly under heavy packet drops. @@ -3168,7 +3312,7 @@ * the status check). So toggling would probably be a pessimization * even with MSI. It would only be needed for using a task queue. */ - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); /* * Do the mandatory PCI flush as well as get the link status. @@ -3240,8 +3384,12 @@ if ((sc->bge_flags & BGE_FLAG_TBI) == 0) { mii = device_get_softc(sc->bge_miibus); - /* Don't mess with the PHY in IPMI/ASF mode */ - if (!((sc->bge_asf_mode & ASF_STACKUP) && (sc->bge_link))) + /* + * Do not touch PHY if we have link up. This could break + * IPMI/ASF mode or produce extra input errors + * (extra errors was reported for bcm5701 & bcm5704). + */ + if (!sc->bge_link) mii_tick(mii); } else { /* @@ -3255,7 +3403,11 @@ #endif { sc->bge_link_evt++; - BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 || + sc->bge_flags & BGE_FLAG_5788) + BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + else + BGE_SETBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_COAL_NOW); } } @@ -3390,7 +3542,7 @@ error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag, map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { - m = m_defrag(m, M_DONTWAIT); + m = m_collapse(m, M_DONTWAIT, BGE_NSEG_NEW); if (m == NULL) { m_freem(*m_head); *m_head = NULL; @@ -3545,10 +3697,10 @@ return; /* Transmit. */ - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); sc->bge_tx_prodidx = prodidx; @@ -3675,7 +3827,7 @@ if (ifp->if_capenable & IFCAP_POLLING) { BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); } else #endif @@ -3683,7 +3835,7 @@ { BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA); BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); } bge_ifmedia_upd_locked(ifp); @@ -3783,6 +3935,24 @@ } mii_mediachg(mii); + /* + * Force an interrupt so that we will call bge_link_upd + * if needed and clear any pending link state attention. + * Without this we are not getting any further interrupts + * for link state changes and thus will not UP the link and + * not be able to send in bge_start_locked. The only + * way to get things working was to receive a packet and + * get an RX intr. + * bge_tick should help for fiber cards and we might not + * need to do this here if BGE_FLAG_TBI is set but as + * we poll for fiber anyway it should not harm. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 || + sc->bge_flags & BGE_FLAG_5788) + BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + else + BGE_SETBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_COAL_NOW); + return (0); } @@ -3906,7 +4076,7 @@ BGE_LOCK(sc); BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); ifp->if_capenable |= IFCAP_POLLING; BGE_UNLOCK(sc); } else { @@ -3915,7 +4085,7 @@ BGE_LOCK(sc); BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); ifp->if_capenable &= ~IFCAP_POLLING; BGE_UNLOCK(sc); } @@ -4040,7 +4210,7 @@ /* Disable host interrupts. */ BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); /* * Tell firmware we're shutting down. @@ -4295,6 +4465,9 @@ #endif + if (BGE_IS_5705_PLUS(sc)) + return; + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, NULL, "BGE Statistics"); schildren = children = SYSCTL_CHILDREN(tree); @@ -4417,16 +4590,12 @@ { struct bge_softc *sc; uint32_t result; - int base, offset; + int offset; sc = (struct bge_softc *)arg1; offset = arg2; - if (BGE_IS_5705_PLUS(sc)) - base = BGE_MAC_STATS; - else - base = BGE_MEMWIN_START + BGE_STATS_BLOCK; - result = CSR_READ_4(sc, base + offset + offsetof(bge_hostaddr, - bge_addr_lo)); + result = CSR_READ_4(sc, BGE_MEMWIN_START + BGE_STATS_BLOCK + offset + + offsetof(bge_hostaddr, bge_addr_lo)); return (sysctl_handle_int(oidp, &result, 0, req)); } @@ -4537,3 +4706,79 @@ return (error); } #endif + +static int +bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]) +{ + + if (sc->bge_flags & BGE_FLAG_EADDR) + return (1); + +#ifdef __sparc64__ + OF_getetheraddr(sc->bge_dev, ether_addr); + return (0); +#endif + return (1); +} + +static int +bge_get_eaddr_mem(struct bge_softc *sc, uint8_t ether_addr[]) +{ + uint32_t mac_addr; + + mac_addr = bge_readmem_ind(sc, 0x0c14); + if ((mac_addr >> 16) == 0x484b) { + ether_addr[0] = (uint8_t)(mac_addr >> 8); + ether_addr[1] = (uint8_t)mac_addr; + mac_addr = bge_readmem_ind(sc, 0x0c18); + ether_addr[2] = (uint8_t)(mac_addr >> 24); + ether_addr[3] = (uint8_t)(mac_addr >> 16); + ether_addr[4] = (uint8_t)(mac_addr >> 8); + ether_addr[5] = (uint8_t)mac_addr; + return (0); + } + return (1); +} + +static int +bge_get_eaddr_nvram(struct bge_softc *sc, uint8_t ether_addr[]) +{ + int mac_offset = BGE_EE_MAC_OFFSET; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + mac_offset = BGE_EE_MAC_OFFSET_5906; + + return (bge_read_nvram(sc, ether_addr, mac_offset + 2, + ETHER_ADDR_LEN)); +} + +static int +bge_get_eaddr_eeprom(struct bge_softc *sc, uint8_t ether_addr[]) +{ + + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + return (1); + + return (bge_read_eeprom(sc, ether_addr, BGE_EE_MAC_OFFSET + 2, + ETHER_ADDR_LEN)); +} + +static int +bge_get_eaddr(struct bge_softc *sc, uint8_t eaddr[]) +{ + static const bge_eaddr_fcn_t bge_eaddr_funcs[] = { + /* NOTE: Order is critical */ + bge_get_eaddr_fw, + bge_get_eaddr_mem, + bge_get_eaddr_nvram, + bge_get_eaddr_eeprom, + NULL + }; + const bge_eaddr_fcn_t *func; + + for (func = bge_eaddr_funcs; *func != NULL; ++func) { + if ((*func)(sc, eaddr) == 0) + break; + } + return (*func == NULL ? ENXIO : 0); +} Modified: haiku/vendor/freebsd/current/dev/bge/if_bgereg.h =================================================================== --- haiku/vendor/freebsd/current/dev/bge/if_bgereg.h 2008-11-11 10:35:36 UTC (rev 28600) +++ haiku/vendor/freebsd/current/dev/bge/if_bgereg.h 2008-11-11 12:19:12 UTC (rev 28601) @@ -30,7 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.73 2007/05/22 19:22:58 jkim Exp $ + * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.81 2008/10/14 20:28:42 marius Exp $ */ [... truncated: 211 lines follow ...] From korli at mail.berlios.de Tue Nov 11 13:20:22 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 13:20:22 +0100 Subject: [Haiku-commits] r28602 - in haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev: bge mii Message-ID: <200811111220.mABCKMHC004442@sheep.berlios.de> Author: korli Date: 2008-11-11 13:20:21 +0100 (Tue, 11 Nov 2008) New Revision: 28602 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28602&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/brgphyreg.h Log: updated bge to current Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c 2008-11-11 12:19:12 UTC (rev 28601) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c 2008-11-11 12:20:21 UTC (rev 28602) @@ -32,7 +32,7 @@ */ #include -__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.198 2007/09/30 11:05:14 marius Exp $"); +__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.215 2008/10/27 22:10:01 marius Exp $"); /* * Broadcom BCM570x family gigabit ethernet driver for FreeBSD. @@ -134,7 +134,7 @@ * ID burned into it, though it will always be overriden by the vendor * ID in the EEPROM. Just to be safe, we cover all possibilities. */ -static struct bge_type { +static const struct bge_type { uint16_t bge_vid; uint16_t bge_did; } bge_devs[] = { @@ -169,6 +169,7 @@ { BCOM_VENDORID, BCOM_DEVICEID_BCM5715S }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5720 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5721 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5722 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5750M }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5751 }, @@ -195,6 +196,8 @@ { BCOM_VENDORID, BCOM_DEVICEID_BCM5901 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5901A2 }, { BCOM_VENDORID, BCOM_DEVICEID_BCM5903M }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5906 }, + { BCOM_VENDORID, BCOM_DEVICEID_BCM5906M }, { SK_VENDORID, SK_DEVICEID_ALTIMA }, @@ -267,10 +270,13 @@ { BGE_CHIPID_BCM5755_A0, "BCM5755 A0" }, { BGE_CHIPID_BCM5755_A1, "BCM5755 A1" }, { BGE_CHIPID_BCM5755_A2, "BCM5755 A2" }, + { BGE_CHIPID_BCM5722_A0, "BCM5722 A0" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_CHIPID_BCM5787_A0, "BCM5754/5787 A0" }, { BGE_CHIPID_BCM5787_A1, "BCM5754/5787 A1" }, { BGE_CHIPID_BCM5787_A2, "BCM5754/5787 A2" }, + { BGE_CHIPID_BCM5906_A1, "BCM5906 A1" }, + { BGE_CHIPID_BCM5906_A2, "BCM5906 A2" }, { 0, NULL } }; @@ -293,6 +299,7 @@ { BGE_ASICREV_BCM5755, "unknown BCM5755" }, /* 5754 and 5787 share the same ASIC ID */ { BGE_ASICREV_BCM5787, "unknown BCM5754/5787" }, + { BGE_ASICREV_BCM5906, "unknown BCM5906" }, { 0, NULL } }; @@ -305,6 +312,9 @@ const struct bge_revision * bge_lookup_rev(uint32_t); const struct bge_vendor * bge_lookup_vendor(uint16_t); + +typedef int (*bge_eaddr_fcn_t)(struct bge_softc *, uint8_t[]); + static int bge_probe(device_t); static int bge_attach(device_t); static int bge_detach(device_t); @@ -315,6 +325,12 @@ static int bge_dma_alloc(device_t); static void bge_dma_free(struct bge_softc *); +static int bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]); +static int bge_get_eaddr_mem(struct bge_softc *, uint8_t[]); +static int bge_get_eaddr_nvram(struct bge_softc *, uint8_t[]); +static int bge_get_eaddr_eeprom(struct bge_softc *, uint8_t[]); +static int bge_get_eaddr(struct bge_softc *, uint8_t[]); + static void bge_txeof(struct bge_softc *); static void bge_rxeof(struct bge_softc *); @@ -337,6 +353,9 @@ static int bge_ifmedia_upd(struct ifnet *); static void bge_ifmedia_sts(struct ifnet *, struct ifmediareq *); +static uint8_t bge_nvram_getbyte(struct bge_softc *, int, uint8_t *); +static int bge_read_nvram(struct bge_softc *, caddr_t, int, int); + static uint8_t bge_eeprom_getbyte(struct bge_softc *, int, uint8_t *); static int bge_read_eeprom(struct bge_softc *, caddr_t, int, int); @@ -356,9 +375,10 @@ static int bge_chipinit(struct bge_softc *); static int bge_blockinit(struct bge_softc *); -static int bge_has_eeprom(struct bge_softc *); +static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); static void bge_writemem_ind(struct bge_softc *, int, int); +static void bge_writembx(struct bge_softc *, int, int); #ifdef notdef static uint32_t bge_readreg_ind(struct bge_softc *, int); #endif @@ -440,7 +460,7 @@ #define SPARC64_OFW_SUBVENDOR "subsystem-vendor-id" static int -bge_has_eeprom(struct bge_softc *sc) +bge_has_eaddr(struct bge_softc *sc) { #ifdef __sparc64__ char buf[sizeof(SPARC64_BLADE_1500_PATH_BGE)]; @@ -452,7 +472,7 @@ /* * The on-board BGEs found in sun4u machines aren't fitted with * an EEPROM which means that we have to obtain the MAC address - * via OFW and that some tests will always fail. We distinguish + * via OFW and that some tests will always fail. We distinguish * such BGEs by the subvendor ID, which also has to be obtained * from OFW instead of the PCI configuration space as the latter * indicates Broadcom as the subvendor of the netboot interface. @@ -533,6 +553,15 @@ CSR_WRITE_4(sc, off, val); } +static void +bge_writembx(struct bge_softc *sc, int off, int val) +{ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI; + + CSR_WRITE_4(sc, off, val); +} + /* * Map a single buffer address. */ @@ -555,7 +584,79 @@ ctx->bge_busaddr = segs->ds_addr; } +static uint8_t +bge_nvram_getbyte(struct bge_softc *sc, int addr, uint8_t *dest) +{ + uint32_t access, byte = 0; + int i; + + /* Lock. */ + CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_SET1); + for (i = 0; i < 8000; i++) { + if (CSR_READ_4(sc, BGE_NVRAM_SWARB) & BGE_NVRAMSWARB_GNT1) + break; + DELAY(20); + } + if (i == 8000) + return (1); + + /* Enable access. */ + access = CSR_READ_4(sc, BGE_NVRAM_ACCESS); + CSR_WRITE_4(sc, BGE_NVRAM_ACCESS, access | BGE_NVRAMACC_ENABLE); + + CSR_WRITE_4(sc, BGE_NVRAM_ADDR, addr & 0xfffffffc); + CSR_WRITE_4(sc, BGE_NVRAM_CMD, BGE_NVRAM_READCMD); + for (i = 0; i < BGE_TIMEOUT * 10; i++) { + DELAY(10); + if (CSR_READ_4(sc, BGE_NVRAM_CMD) & BGE_NVRAMCMD_DONE) { + DELAY(10); + break; + } + } + + if (i == BGE_TIMEOUT * 10) { + if_printf(sc->bge_ifp, "nvram read timed out\n"); + return (1); + } + + /* Get result. */ + byte = CSR_READ_4(sc, BGE_NVRAM_RDDATA); + + *dest = (bswap32(byte) >> ((addr % 4) * 8)) & 0xFF; + + /* Disable access. */ + CSR_WRITE_4(sc, BGE_NVRAM_ACCESS, access); + + /* Unlock. */ + CSR_WRITE_4(sc, BGE_NVRAM_SWARB, BGE_NVRAMSWARB_CLR1); + CSR_READ_4(sc, BGE_NVRAM_SWARB); + + return (0); +} + /* + * Read a sequence of bytes from NVRAM. + */ +static int +bge_read_nvram(struct bge_softc *sc, caddr_t dest, int off, int cnt) +{ + int err = 0, i; + uint8_t byte = 0; + + if (sc->bge_asicrev != BGE_ASICREV_BCM5906) + return (1); + + for (i = 0; i < cnt; i++) { + err = bge_nvram_getbyte(sc, off + i, &byte); + if (err) + break; + *(dest + i) = byte; + } + + return (err ? 1 : 0); +} + +/* * Read a byte of data stored in the EEPROM at address 'addr.' The * BCM570x supports both the traditional bitbang interface and an * auto access interface for reading the EEPROM. We use the auto @@ -659,11 +760,14 @@ } if (i == BGE_TIMEOUT) { - device_printf(sc->bge_dev, "PHY read timed out\n"); + device_printf(sc->bge_dev, + "PHY read timed out (phy %d, reg %d, val 0x%08x)\n", + phy, reg, val); val = 0; goto done; } + DELAY(5); val = CSR_READ_4(sc, BGE_MI_COMM); done: @@ -687,6 +791,10 @@ sc = device_get_softc(dev); + if (sc->bge_asicrev == BGE_ASICREV_BCM5906 && + (reg == BRGPHY_MII_1000CTL || reg == BRGPHY_MII_AUXCTL)) + return(0); + /* Reading with autopolling on may trigger PCI errors */ autopoll = CSR_READ_4(sc, BGE_MI_MODE); if (autopoll & BGE_MIMODE_AUTOPOLL) { @@ -699,12 +807,17 @@ for (i = 0; i < BGE_TIMEOUT; i++) { DELAY(10); - if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) + if (!(CSR_READ_4(sc, BGE_MI_COMM) & BGE_MICOMM_BUSY)) { + DELAY(5); + CSR_READ_4(sc, BGE_MI_COMM); /* dummy read */ break; + } } if (i == BGE_TIMEOUT) { - device_printf(sc->bge_dev, "PHY write timed out\n"); + device_printf(sc->bge_dev, + "PHY write timed out (phy %d, reg %d, val %d)\n", + phy, reg, val); return (0); } @@ -887,7 +1000,7 @@ BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); sc->bge_std = i - 1; - CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); return (0); } @@ -934,7 +1047,7 @@ BGE_RCB_FLAG_USE_EXT_RX_BD); CSR_WRITE_4(sc, BGE_RX_JUMBO_RCB_MAXLEN_FLAGS, rcb->bge_maxlen_flags); - CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); return (0); } @@ -990,17 +1103,17 @@ /* Initialize transmit producer index for host-memory send ring. */ sc->bge_tx_prodidx = 0; - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, sc->bge_tx_prodidx); /* NIC-memory send ring not used; initialize to zero. */ - CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); + bge_writembx(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) - CSR_WRITE_4(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); + bge_writembx(sc, BGE_MBX_TX_NIC_PROD0_LO, 0); return (0); } @@ -1168,10 +1281,10 @@ /* * Check the 'ROM failed' bit on the RX CPU to see if * self-tests passed. Skip this check when there's no - * EEPROM fitted, since in that case it will always - * fail. + * chip containing the Ethernet address fitted, since + * in that case it will always fail. */ - if ((sc->bge_flags & BGE_FLAG_EEPROM) && + if ((sc->bge_flags & BGE_FLAG_EADDR) && CSR_READ_4(sc, BGE_RXCPU_MODE) & BGE_RXCPUMODE_ROMFAIL) { device_printf(sc->bge_dev, "RX CPU self-diagnostics failed!\n"); return (ENODEV); @@ -1271,6 +1384,16 @@ /* Set the timer prescaler (always 66Mhz) */ CSR_WRITE_4(sc, BGE_MISC_CFG, BGE_32BITTIME_66MHZ); + /* XXX: The Linux tg3 driver does this at the start of brgphy_reset. */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + DELAY(40); /* XXX */ + + /* Put PHY into ready state */ + BGE_CLRBIT(sc, BGE_MISC_CFG, BGE_MISCCFG_EPHY_IDDQ); + CSR_READ_4(sc, BGE_MISC_CFG); /* Flush */ + DELAY(40); + } + return (0); } @@ -1308,14 +1431,19 @@ } /* Configure mbuf pool watermarks */ - if (!(BGE_IS_5705_PLUS(sc))) { + if (!BGE_IS_5705_PLUS(sc)) { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); + } else if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x04); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x10); + } else { + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x0); CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x10); - } else { - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_READDMA_LOWAT, 0x50); - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_MACRX_LOWAT, 0x20); + CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); } - CSR_WRITE_4(sc, BGE_BMAN_MBUFPOOL_HIWAT, 0x60); /* Configure DMA resource watermarks */ CSR_WRITE_4(sc, BGE_BMAN_DMA_DESCPOOL_LOWAT, 5); @@ -1421,6 +1549,9 @@ * requirement of all 575x family chips. The Linux driver sets * the lower threshold for all 5705 family chips as well, but there * are reports that it might not need to be so strict. + * + * XXX Linux does some extra fiddling here for the 5906 parts as + * well. */ if (BGE_IS_5705_PLUS(sc)) val = 8; @@ -1462,15 +1593,15 @@ BGE_RCB_MAXLEN_FLAGS(sc->bge_return_ring_cnt, BGE_RCB_FLAG_RING_DISABLED)); RCB_WRITE_4(sc, vrcb, bge_nicaddr, 0); - CSR_WRITE_4(sc, BGE_MBX_RX_CONS0_LO + + bge_writembx(sc, BGE_MBX_RX_CONS0_LO + (i * (sizeof(uint64_t))), 0); vrcb += sizeof(struct bge_rcb); } /* Initialize RX ring indexes */ - CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, 0); - CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); - CSR_WRITE_4(sc, BGE_MBX_RX_MINI_PROD_LO, 0); + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, 0); + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, 0); + bge_writembx(sc, BGE_MBX_RX_MINI_PROD_LO, 0); /* * Set up RX return ring 0 @@ -1720,7 +1851,7 @@ static int bge_probe(device_t dev) { - struct bge_type *t = bge_devs; + const struct bge_type *t = bge_devs; struct bge_softc *sc = device_get_softc(dev); uint16_t vid, did; @@ -1742,7 +1873,8 @@ #if __FreeBSD_version > 700024 const char *pname; - if (pci_get_vpd_ident(dev, &pname) == 0) + if (bge_has_eaddr(sc) && + pci_get_vpd_ident(dev, &pname) == 0) snprintf(model, 64, "%s", pname); else #endif @@ -1892,16 +2024,10 @@ /* * Allocate the parent bus DMA tag appropriate for PCI. */ - error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), /* parent */ - 1, 0, /* alignment, boundary */ - BUS_SPACE_MAXADDR, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - MAXBSIZE, BGE_NSEG_NEW, /* maxsize, nsegments */ - BUS_SPACE_MAXSIZE_32BIT, /* maxsegsize */ - 0, /* flags */ - NULL, NULL, /* lockfunc, lockarg */ - &sc->bge_cdata.bge_parent_tag); + error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev), + 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, + NULL, BUS_SPACE_MAXSIZE_32BIT, 0, BUS_SPACE_MAXSIZE_32BIT, + 0, NULL, NULL, &sc->bge_cdata.bge_parent_tag); if (error != 0) { device_printf(sc->bge_dev, @@ -1910,7 +2036,7 @@ } /* - * Create tag for RX mbufs. + * Create tag for mbufs. */ error = bus_dma_tag_create(sc->bge_cdata.bge_parent_tag, 1, 0, BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, NULL, @@ -2202,10 +2328,11 @@ int can_use_msi = 0; switch (sc->bge_asicrev) { + case BGE_ASICREV_BCM5714_A0: case BGE_ASICREV_BCM5714: /* - * Apparently, MSI doesn't work when this chip is configured - * in single-port mode. + * Apparently, MSI doesn't work when these chips are + * configured in single-port mode. */ if (bge_has_multiple_ports(sc)) can_use_msi = 1; @@ -2215,10 +2342,9 @@ sc->bge_chiprev != BGE_CHIPREV_5750_BX) can_use_msi = 1; break; - case BGE_ASICREV_BCM5752: - case BGE_ASICREV_BCM5780: - can_use_msi = 1; - break; + default: + if (BGE_IS_575X_PLUS(sc)) + can_use_msi = 1; } return (can_use_msi); } @@ -2229,8 +2355,7 @@ { struct ifnet *ifp; struct bge_softc *sc; - uint32_t hwcfg = 0; - uint32_t mac_tmp = 0; + uint32_t hwcfg = 0, misccfg; u_char eaddr[ETHER_ADDR_LEN]; int error, reg, rid, trys; @@ -2244,7 +2369,7 @@ rid = BGE_PCI_BAR0; sc->bge_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, - RF_ACTIVE | PCI_RF_DENSE); + RF_ACTIVE); if (sc->bge_res == NULL) { device_printf (sc->bge_dev, "couldn't map memory\n"); @@ -2252,20 +2377,26 @@ goto fail; } - sc->bge_btag = rman_get_bustag(sc->bge_res); - sc->bge_bhandle = rman_get_bushandle(sc->bge_res); - /* Save ASIC rev. */ - sc->bge_chipid = pci_read_config(dev, BGE_PCI_MISC_CTL, 4) & BGE_PCIMISCCTL_ASICREV; sc->bge_asicrev = BGE_ASICREV(sc->bge_chipid); sc->bge_chiprev = BGE_CHIPREV(sc->bge_chipid); - if (bge_has_eeprom(sc)) - sc->bge_flags |= BGE_FLAG_EEPROM; + /* + * Don't enable Ethernet at WireSpeed for the 5700, 5906, or the + * 5705 A0 and A1 chips. + */ + if (sc->bge_asicrev != BGE_ASICREV_BCM5700 && + sc->bge_asicrev != BGE_ASICREV_BCM5906 && + sc->bge_chipid != BGE_CHIPID_BCM5705_A0 && + sc->bge_chipid != BGE_CHIPID_BCM5705_A1) + sc->bge_flags |= BGE_FLAG_WIRESPEED; + if (bge_has_eaddr(sc)) + sc->bge_flags |= BGE_FLAG_EADDR; + /* Save chipset family. */ switch (sc->bge_asicrev) { case BGE_ASICREV_BCM5700: @@ -2283,6 +2414,7 @@ case BGE_ASICREV_BCM5752: case BGE_ASICREV_BCM5755: case BGE_ASICREV_BCM5787: + case BGE_ASICREV_BCM5906: sc->bge_flags |= BGE_FLAG_575X_PLUS; /* FALLTHRU */ case BGE_ASICREV_BCM5705: @@ -2302,12 +2434,23 @@ if (BGE_IS_5705_PLUS(sc) && !(sc->bge_flags & BGE_FLAG_ADJUST_TRIM)) { if (sc->bge_asicrev == BGE_ASICREV_BCM5755 || - sc->bge_asicrev == BGE_ASICREV_BCM5787) - sc->bge_flags |= BGE_FLAG_JITTER_BUG; - else + sc->bge_asicrev == BGE_ASICREV_BCM5787) { + if (sc->bge_chipid != BGE_CHIPID_BCM5722_A0) + sc->bge_flags |= BGE_FLAG_JITTER_BUG; + } else if (sc->bge_asicrev != BGE_ASICREV_BCM5906) sc->bge_flags |= BGE_FLAG_BER_BUG; } + + /* + * We could possibly check for BCOM_DEVICEID_BCM5788 in bge_probe() + * but I do not know the DEVICEID for the 5788M. + */ + misccfg = CSR_READ_4(sc, BGE_MISC_CFG) & BGE_MISCCFG_BOARD_ID; + if (misccfg == BGE_MISCCFG_BOARD_ID_5788 || + misccfg == BGE_MISCCFG_BOARD_ID_5788M) + sc->bge_flags |= BGE_FLAG_5788; + /* * Check if this is a PCI-X or PCI Express device. */ @@ -2414,28 +2557,12 @@ goto fail; } -#ifdef __sparc64__ - if ((sc->bge_flags & BGE_FLAG_EEPROM) == 0) - OF_getetheraddr(dev, eaddr); - else -#endif - { - mac_tmp = bge_readmem_ind(sc, 0x0C14); - if ((mac_tmp >> 16) == 0x484B) { - eaddr[0] = (u_char)(mac_tmp >> 8); - eaddr[1] = (u_char)mac_tmp; - mac_tmp = bge_readmem_ind(sc, 0x0C18); - eaddr[2] = (u_char)(mac_tmp >> 24); - eaddr[3] = (u_char)(mac_tmp >> 16); - eaddr[4] = (u_char)(mac_tmp >> 8); - eaddr[5] = (u_char)mac_tmp; - } else if (bge_read_eeprom(sc, eaddr, - BGE_EE_MAC_OFFSET + 2, ETHER_ADDR_LEN)) { - device_printf(sc->bge_dev, - "failed to read station address\n"); - error = ENXIO; - goto fail; - } + error = bge_get_eaddr(sc, eaddr); + if (error) { + device_printf(sc->bge_dev, + "failed to read station address\n"); + error = ENXIO; + goto fail; } /* 5705 limits RX return ring to 512 entries. */ @@ -2507,7 +2634,8 @@ */ if (bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_SIG) == BGE_MAGIC_NUMBER) hwcfg = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM_NICCFG); - else if (sc->bge_flags & BGE_FLAG_EEPROM) { + else if ((sc->bge_flags & BGE_FLAG_EADDR) && + (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (bge_read_eeprom(sc, (caddr_t)&hwcfg, BGE_EE_HWCFG_OFFSET, sizeof(hwcfg))) { device_printf(sc->bge_dev, "failed to read EEPROM\n"); @@ -2682,13 +2810,14 @@ bge_reset(struct bge_softc *sc) { device_t dev; - uint32_t cachesize, command, pcistate, reset; + uint32_t cachesize, command, pcistate, reset, val; void (*write_op)(struct bge_softc *, int, int); - int i, val = 0; + int i; dev = sc->bge_dev; - if (BGE_IS_575X_PLUS(sc) && !BGE_IS_5714_FAMILY(sc)) { + if (BGE_IS_575X_PLUS(sc) && !BGE_IS_5714_FAMILY(sc) && + (sc->bge_asicrev != BGE_ASICREV_BCM5906)) { if (sc->bge_flags & BGE_FLAG_PCIE) write_op = bge_writemem_direct; else @@ -2744,16 +2873,23 @@ /* Issue global reset */ write_op(sc, BGE_MISC_CFG, reset); + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + val = CSR_READ_4(sc, BGE_VCPU_STATUS); + CSR_WRITE_4(sc, BGE_VCPU_STATUS, + val | BGE_VCPU_STATUS_DRV_RESET); + val = CSR_READ_4(sc, BGE_VCPU_EXT_CTRL); + CSR_WRITE_4(sc, BGE_VCPU_EXT_CTRL, + val & ~BGE_VCPU_EXT_CTRL_HALT_CPU); + } + DELAY(1000); /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE) { if (sc->bge_chipid == BGE_CHIPID_BCM5750_A0) { - uint32_t v; - DELAY(500000); /* wait for link training to complete */ - v = pci_read_config(dev, 0xC4, 4); - pci_write_config(dev, 0xC4, v | (1 << 15), 4); + val = pci_read_config(dev, 0xC4, 4); + pci_write_config(dev, 0xC4, val | (1 << 15), 4); } /* * Set PCIE max payload size to 128 bytes and clear error @@ -2772,8 +2908,6 @@ /* Re-enable MSI, if neccesary, and enable the memory arbiter. */ if (BGE_IS_5714_FAMILY(sc)) { - uint32_t val; - /* This chip disables MSI on reset. */ if (sc->bge_flags & BGE_FLAG_MSI) { val = pci_read_config(dev, BGE_PCI_MSI_CTL, 2); @@ -2788,22 +2922,36 @@ } else CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE); - /* - * Poll until we see the 1's complement of the magic number. - * This indicates that the firmware initialization is complete. - * We expect this to fail if no EEPROM is fitted though. - */ - for (i = 0; i < BGE_TIMEOUT; i++) { - DELAY(10); - val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); - if (val == ~BGE_MAGIC_NUMBER) - break; + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) { + for (i = 0; i < BGE_TIMEOUT; i++) { + val = CSR_READ_4(sc, BGE_VCPU_STATUS); + if (val & BGE_VCPU_STATUS_INIT_DONE) + break; + DELAY(100); + } + if (i == BGE_TIMEOUT) { + device_printf(sc->bge_dev, "reset timed out\n"); + return (1); + } + } else { + /* + * Poll until we see the 1's complement of the magic number. + * This indicates that the firmware initialization is complete. + * We expect this to fail if no chip containing the Ethernet + * address is fitted though. + */ + for (i = 0; i < BGE_TIMEOUT; i++) { + DELAY(10); + val = bge_readmem_ind(sc, BGE_SOFTWARE_GENCOMM); + if (val == ~BGE_MAGIC_NUMBER) + break; + } + + if ((sc->bge_flags & BGE_FLAG_EADDR) && i == BGE_TIMEOUT) + device_printf(sc->bge_dev, "firmware handshake timed out, " + "found 0x%08x\n", val); } - if ((sc->bge_flags & BGE_FLAG_EEPROM) && i == BGE_TIMEOUT) - device_printf(sc->bge_dev, "firmware handshake timed out, " - "found 0x%08x\n", val); - /* * XXX Wait for the value of the PCISTATE register to * return to its original pre-reset state. This is a @@ -2840,20 +2988,16 @@ */ if (sc->bge_asicrev == BGE_ASICREV_BCM5704 && sc->bge_flags & BGE_FLAG_TBI) { - uint32_t serdescfg; - - serdescfg = CSR_READ_4(sc, BGE_SERDES_CFG); - serdescfg = (serdescfg & ~0xFFF) | 0x880; - CSR_WRITE_4(sc, BGE_SERDES_CFG, serdescfg); + val = CSR_READ_4(sc, BGE_SERDES_CFG); + val = (val & ~0xFFF) | 0x880; + CSR_WRITE_4(sc, BGE_SERDES_CFG, val); } /* XXX: Broadcom Linux driver. */ if (sc->bge_flags & BGE_FLAG_PCIE && sc->bge_chipid != BGE_CHIPID_BCM5750_A0) { - uint32_t v; - - v = CSR_READ_4(sc, 0x7C00); - CSR_WRITE_4(sc, 0x7C00, v | (1 << 25)); + val = CSR_READ_4(sc, 0x7C00); + CSR_WRITE_4(sc, 0x7C00, val | (1 << 25)); } DELAY(10000); @@ -3022,11 +3166,11 @@ bus_dmamap_sync(sc->bge_cdata.bge_rx_jumbo_ring_tag, sc->bge_cdata.bge_rx_jumbo_ring_map, BUS_DMASYNC_PREWRITE); - CSR_WRITE_4(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx); + bge_writembx(sc, BGE_MBX_RX_CONS0_LO, sc->bge_rx_saved_considx); if (stdcnt) - CSR_WRITE_4(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); + bge_writembx(sc, BGE_MBX_RX_STD_PROD_LO, sc->bge_std); if (jumbocnt) - CSR_WRITE_4(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); + bge_writembx(sc, BGE_MBX_RX_JUMBO_PROD_LO, sc->bge_jumbo); #ifdef notyet /* * This register wraps very quickly under heavy packet drops. @@ -3168,7 +3312,7 @@ * the status check). So toggling would probably be a pessimization * even with MSI. It would only be needed for using a task queue. */ - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); /* * Do the mandatory PCI flush as well as get the link status. @@ -3240,8 +3384,12 @@ if ((sc->bge_flags & BGE_FLAG_TBI) == 0) { mii = device_get_softc(sc->bge_miibus); - /* Don't mess with the PHY in IPMI/ASF mode */ - if (!((sc->bge_asf_mode & ASF_STACKUP) && (sc->bge_link))) + /* + * Do not touch PHY if we have link up. This could break + * IPMI/ASF mode or produce extra input errors + * (extra errors was reported for bcm5701 & bcm5704). + */ + if (!sc->bge_link) mii_tick(mii); } else { /* @@ -3255,7 +3403,11 @@ #endif { sc->bge_link_evt++; - BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 || + sc->bge_flags & BGE_FLAG_5788) + BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + else + BGE_SETBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_COAL_NOW); } } @@ -3390,7 +3542,7 @@ error = bus_dmamap_load_mbuf_sg(sc->bge_cdata.bge_mtag, map, m, segs, &nsegs, BUS_DMA_NOWAIT); if (error == EFBIG) { - m = m_defrag(m, M_DONTWAIT); + m = m_collapse(m, M_DONTWAIT, BGE_NSEG_NEW); if (m == NULL) { m_freem(*m_head); *m_head = NULL; @@ -3545,10 +3697,10 @@ return; /* Transmit. */ - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); /* 5700 b2 errata */ if (sc->bge_chiprev == BGE_CHIPREV_5700_BX) - CSR_WRITE_4(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); + bge_writembx(sc, BGE_MBX_TX_HOST_PROD0_LO, prodidx); sc->bge_tx_prodidx = prodidx; @@ -3675,7 +3827,7 @@ if (ifp->if_capenable & IFCAP_POLLING) { BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); } else #endif @@ -3683,7 +3835,7 @@ { BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA); BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); } bge_ifmedia_upd_locked(ifp); @@ -3783,6 +3935,24 @@ } mii_mediachg(mii); + /* + * Force an interrupt so that we will call bge_link_upd + * if needed and clear any pending link state attention. + * Without this we are not getting any further interrupts + * for link state changes and thus will not UP the link and + * not be able to send in bge_start_locked. The only + * way to get things working was to receive a packet and + * get an RX intr. + * bge_tick should help for fiber cards and we might not + * need to do this here if BGE_FLAG_TBI is set but as + * we poll for fiber anyway it should not harm. + */ + if (sc->bge_asicrev == BGE_ASICREV_BCM5700 || + sc->bge_flags & BGE_FLAG_5788) + BGE_SETBIT(sc, BGE_MISC_LOCAL_CTL, BGE_MLC_INTR_SET); + else + BGE_SETBIT(sc, BGE_HCC_MODE, BGE_HCCMODE_COAL_NOW); + return (0); } @@ -3906,7 +4076,7 @@ BGE_LOCK(sc); BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); ifp->if_capenable |= IFCAP_POLLING; BGE_UNLOCK(sc); } else { @@ -3915,7 +4085,7 @@ BGE_LOCK(sc); BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 0); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); ifp->if_capenable &= ~IFCAP_POLLING; BGE_UNLOCK(sc); } @@ -4040,7 +4210,7 @@ /* Disable host interrupts. */ BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); - CSR_WRITE_4(sc, BGE_MBX_IRQ0_LO, 1); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); /* * Tell firmware we're shutting down. @@ -4295,6 +4465,9 @@ #endif + if (BGE_IS_5705_PLUS(sc)) + return; + tree = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "stats", CTLFLAG_RD, NULL, "BGE Statistics"); schildren = children = SYSCTL_CHILDREN(tree); @@ -4417,16 +4590,12 @@ { struct bge_softc *sc; uint32_t result; - int base, offset; + int offset; sc = (struct bge_softc *)arg1; offset = arg2; - if (BGE_IS_5705_PLUS(sc)) - base = BGE_MAC_STATS; - else - base = BGE_MEMWIN_START + BGE_STATS_BLOCK; - result = CSR_READ_4(sc, base + offset + offsetof(bge_hostaddr, - bge_addr_lo)); + result = CSR_READ_4(sc, BGE_MEMWIN_START + BGE_STATS_BLOCK + offset + + offsetof(bge_hostaddr, bge_addr_lo)); return (sysctl_handle_int(oidp, &result, 0, req)); } @@ -4537,3 +4706,79 @@ return (error); } #endif + +static int +bge_get_eaddr_fw(struct bge_softc *sc, uint8_t ether_addr[]) +{ + + if (sc->bge_flags & BGE_FLAG_EADDR) + return (1); + +#ifdef __sparc64__ + OF_getetheraddr(sc->bge_dev, ether_addr); + return (0); +#endif + return (1); +} + +static int +bge_get_eaddr_mem(struct bge_softc *sc, uint8_t ether_addr[]) +{ + uint32_t mac_addr; + + mac_addr = bge_readmem_ind(sc, 0x0c14); + if ((mac_addr >> 16) == 0x484b) { + ether_addr[0] = (uint8_t)(mac_addr >> 8); + ether_addr[1] = (uint8_t)mac_addr; + mac_addr = bge_readmem_ind(sc, 0x0c18); + ether_addr[2] = (uint8_t)(mac_addr >> 24); + ether_addr[3] = (uint8_t)(mac_addr >> 16); + ether_addr[4] = (uint8_t)(mac_addr >> 8); + ether_addr[5] = (uint8_t)mac_addr; + return (0); + } + return (1); +} + +static int +bge_get_eaddr_nvram(struct bge_softc *sc, uint8_t ether_addr[]) +{ + int mac_offset = BGE_EE_MAC_OFFSET; + + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + mac_offset = BGE_EE_MAC_OFFSET_5906; + + return (bge_read_nvram(sc, ether_addr, mac_offset + 2, + ETHER_ADDR_LEN)); +} + +static int +bge_get_eaddr_eeprom(struct bge_softc *sc, uint8_t ether_addr[]) +{ + + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + return (1); + + return (bge_read_eeprom(sc, ether_addr, BGE_EE_MAC_OFFSET + 2, + ETHER_ADDR_LEN)); +} + +static int +bge_get_eaddr(struct bge_softc *sc, uint8_t eaddr[]) +{ + static const bge_eaddr_fcn_t bge_eaddr_funcs[] = { + /* NOTE: Order is critical */ + bge_get_eaddr_fw, + bge_get_eaddr_mem, + bge_get_eaddr_nvram, + bge_get_eaddr_eeprom, + NULL + }; + const bge_eaddr_fcn_t *func; + + for (func = bge_eaddr_funcs; *func != NULL; ++func) { + if ((*func)(sc, eaddr) == 0) + break; + } + return (*func == NULL ? ENXIO : 0); +} Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h 2008-11-11 12:19:12 UTC (rev 28601) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h 2008-11-11 12:20:21 UTC (rev 28602) @@ -30,7 +30,7 @@ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF * THE POSSIBILITY OF SUCH DAMAGE. * - * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.73 2007/05/22 19:22:58 jkim Exp $ + * $FreeBSD: src/sys/dev/bge/if_bgereg.h,v 1.81 2008/10/14 20:28:42 marius Exp $ */ [... truncated: 211 lines follow ...] From korli at mail.berlios.de Tue Nov 11 13:26:08 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 13:26:08 +0100 Subject: [Haiku-commits] r28603 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/sys Message-ID: <200811111226.mABCQ8gE012335@sheep.berlios.de> Author: korli Date: 2008-11-11 13:26:07 +0100 (Tue, 11 Nov 2008) New Revision: 28603 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28603&view=rev Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h haiku/trunk/src/libs/compat/freebsd_network/mbuf.c Log: added m_cljget() with support for jumbo9 size: it should help with broadcom570x Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h 2008-11-11 12:20:21 UTC (rev 28602) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/sys/mbuf.h 2008-11-11 12:26:07 UTC (rev 28603) @@ -78,10 +78,14 @@ #define EXT_CLUSTER 1 #define EXT_PACKET 3 +#define EXT_JUMBO9 4 #define EXT_NET_DRV 100 #define M_BCAST 0x00000200 #define M_MCAST 0x00000400 +#define M_FRAG 0x00000800 +#define M_FIRSTFRAG 0x00001000 +#define M_LASTFRAG 0x00002000 #define M_VLANTAG 0x00010000 #define CSUM_IP 0x0001 @@ -125,6 +129,7 @@ struct mbuf *m_get(int how, short type); struct mbuf *m_gethdr(int how, short type); void m_clget(struct mbuf *m, int how); +void *m_cljget(struct mbuf *m, int how, int size); void m_extadd(struct mbuf *m, caddr_t buffer, u_int size, void (*freeHook)(void *, void *), void *args, int flags, int type); Modified: haiku/trunk/src/libs/compat/freebsd_network/mbuf.c =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/mbuf.c 2008-11-11 12:20:21 UTC (rev 28602) +++ haiku/trunk/src/libs/compat/freebsd_network/mbuf.c 2008-11-11 12:26:07 UTC (rev 28603) @@ -21,6 +21,7 @@ static object_cache *sMBufCache; static object_cache *sChunkCache; +static object_cache *sJumbo9ChunkCache; int max_linkhdr = 16; int max_protohdr = 40 + 20; /* ip6 + tcp */ @@ -60,31 +61,50 @@ static int -construct_ext_mbuf(struct mbuf *mb, int how) +construct_ext_sized_mbuf(struct mbuf *mb, int how, int size) { - mb->m_ext.ext_buf = object_cache_alloc(sChunkCache, m_to_oc_flags(how)); + object_cache *cache; + int ext_type; + if (size != MCLBYTES && size != MJUM9BYTES) + panic("unsupported size"); + + if (size == MCLBYTES) { + cache = sChunkCache; + ext_type = EXT_CLUSTER; + } else { + cache = sJumbo9ChunkCache; + ext_type = EXT_JUMBO9; + } + mb->m_ext.ext_buf = object_cache_alloc(cache, m_to_oc_flags(how)); if (mb->m_ext.ext_buf == NULL) return B_NO_MEMORY; - + mb->m_data = mb->m_ext.ext_buf; mb->m_flags |= M_EXT; /* mb->m_ext.ext_free = NULL; */ /* mb->m_ext.ext_args = NULL; */ - mb->m_ext.ext_size = MCLBYTES; - mb->m_ext.ext_type = EXT_CLUSTER; + mb->m_ext.ext_size = size; + mb->m_ext.ext_type = ext_type; /* mb->m_ext.ref_cnt = NULL; */ - return 0; + return 0; } +static inline int +construct_ext_mbuf(struct mbuf *mb, int how) +{ + return construct_ext_sized_mbuf(mb, how, MCLBYTES); +} + + static int construct_pkt_mbuf(int how, struct mbuf *mb, short type, int flags) { construct_mbuf(mb, type, flags); if (construct_ext_mbuf(mb, how) < 0) return -1; - mb->m_ext.ext_type = EXT_PACKET; + mb->m_ext.ext_type |= EXT_PACKET; return 0; } @@ -92,7 +112,14 @@ static void destruct_pkt_mbuf(struct mbuf *mb) { - object_cache_free(sChunkCache, mb->m_ext.ext_buf); + object_cache *cache; + if (mb->m_ext.ext_type & EXT_CLUSTER) + cache = sChunkCache; + else if (mb->m_ext.ext_type & EXT_JUMBO9) + cache = sJumbo9ChunkCache; + else + panic("unknown cache"); + object_cache_free(cache, mb->m_ext.ext_buf); mb->m_ext.ext_buf = NULL; } @@ -151,6 +178,18 @@ } +void * +m_cljget(struct mbuf *m, int how, int size) +{ + if (m == NULL) + panic("m_cljget doesn't support allocate mbuf"); + m->m_ext.ext_buf = NULL; + construct_ext_sized_mbuf(m, how, size); + /* shouldn't be used */ + return NULL; +} + + void m_freem(struct mbuf *mb) { @@ -172,6 +211,9 @@ else if (m->m_ext.ext_type == EXT_CLUSTER) { object_cache_free(sChunkCache, m->m_ext.ext_buf); m->m_ext.ext_buf = NULL; + } else if (m->m_ext.ext_type == EXT_JUMBO9) { + object_cache_free(sJumbo9ChunkCache, m->m_ext.ext_buf); + m->m_ext.ext_buf = NULL; } else panic("unknown type"); @@ -207,16 +249,23 @@ { sMBufCache = create_object_cache("mbufs", MSIZE, 8, NULL, NULL, NULL); if (sMBufCache == NULL) - return B_NO_MEMORY; - + goto clean; sChunkCache = create_object_cache("mbuf chunks", MCLBYTES, 0, NULL, NULL, NULL); - if (sChunkCache == NULL) { + if (sChunkCache == NULL) + goto clean; + sJumbo9ChunkCache = create_object_cache("mbuf jumbo9 chunks", MJUM9BYTES, 0, NULL, NULL, + NULL); + if (sJumbo9ChunkCache == NULL) + goto clean; + return B_OK; + +clean: + if (sChunkCache != NULL) + delete_object_cache(sChunkCache); + if (sMBufCache != NULL) delete_object_cache(sMBufCache); - return B_NO_MEMORY; - } - - return B_OK; + return B_NO_MEMORY; } @@ -225,5 +274,6 @@ { delete_object_cache(sMBufCache); delete_object_cache(sChunkCache); + delete_object_cache(sJumbo9ChunkCache); } From korli at mail.berlios.de Tue Nov 11 14:31:29 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 14:31:29 +0100 Subject: [Haiku-commits] r28604 - haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge Message-ID: <200811111331.mABDVTW8016194@sheep.berlios.de> Author: korli Date: 2008-11-11 14:31:28 +0100 (Tue, 11 Nov 2008) New Revision: 28604 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28604&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c Log: filled glue holes to have broadcom570x compiles, reusing part of patches posted on bug #1590. Obviously untested. Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c 2008-11-11 12:26:07 UTC (rev 28603) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c 2008-11-11 13:31:28 UTC (rev 28604) @@ -4,8 +4,11 @@ */ +#include #include +#include +#include "if_bgereg.h" HAIKU_FBSD_DRIVER_GLUE(broadcom570x, bge, pci); HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE); @@ -25,3 +28,41 @@ return __haiku_probe_miibus(dev, drivers); } + +// copied from if_bge.c +static void +bge_writembx(struct bge_softc *sc, int off, int val) +{ + if (sc->bge_asicrev == BGE_ASICREV_BCM5906) + off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI; + + CSR_WRITE_4(sc, off, val); +} + + +int +__haiku_disable_interrupts(device_t dev) +{ + struct bge_softc *sc = device_get_softc(dev); + + uint32 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; + + if ((sc->bge_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 && !statusword + && (pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE,4) & BGE_PCISTATE_INTR_STATE)) + return 0; + + BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 1); + + return 1; +} + + +void +__haiku_reenable_interrupts(device_t dev) +{ + struct bge_softc *sc = device_get_softc(dev); + BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_CLEAR_INTA); + BGE_CLRBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); + bge_writembx(sc, BGE_MBX_IRQ0_LO, 0); +} From jackburton at mail.berlios.de Tue Nov 11 15:17:10 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 11 Nov 2008 15:17:10 +0100 Subject: [Haiku-commits] r28605 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811111417.mABEHAVr023316@sheep.berlios.de> Author: jackburton Date: 2008-11-11 15:17:09 +0100 (Tue, 11 Nov 2008) New Revision: 28605 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28605&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c Log: fix typo Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-11-11 13:31:28 UTC (rev 28604) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c 2008-11-11 14:17:09 UTC (rev 28605) @@ -111,8 +111,10 @@ get_device_hid(result, hid); - if (gDeviceManager->register_node(node, ACPI_DEVICE_MODULE_NAME, attrs, NULL, &deviceNode) == B_OK) - acpi_enumerate_child_devices(deviceNode, result); + if (gDeviceManager->register_node(node, ACPI_DEVICE_MODULE_NAME, attrs, + NULL, &deviceNode) == B_OK) + acpi_enumerate_child_devices(deviceNode, result); + break; } case ACPI_TYPE_POWER: @@ -180,7 +182,7 @@ static int32 -apci_module_std_ops(int32 op, ...) +acpi_module_std_ops(int32 op, ...) { switch (op) { case B_MODULE_INIT: @@ -203,7 +205,7 @@ { ACPI_ROOT_MODULE_NAME, 0, - apci_module_std_ops + acpi_module_std_ops }, acpi_module_supports_device, From korli at users.berlios.de Tue Nov 11 15:37:43 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 11 Nov 2008 15:37:43 +0100 Subject: [Haiku-commits] r28605 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: <200811111417.mABEHAVr023316@sheep.berlios.de> References: <200811111417.mABEHAVr023316@sheep.berlios.de> Message-ID: Hello Stefano, 2008/11/11 : > Author: jackburton > Date: 2008-11-11 15:17:09 +0100 (Tue, 11 Nov 2008) > New Revision: 28605 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28605&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c > Log: > fix typo > Could you also have a look at acpi_ns_dump.cpp ? it seems to be in Windows format. Bye, J?r?me From stefano.ceccherini at gmail.com Tue Nov 11 15:47:47 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 11 Nov 2008 15:47:47 +0100 Subject: [Haiku-commits] r28605 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: References: <200811111417.mABEHAVr023316@sheep.berlios.de> Message-ID: <894b9700811110647j46b01bb5i7cae39dd425e07e9@mail.gmail.com> 2008/11/11 J?r?me Duval : > Hello Stefano, > > 2008/11/11 : >> Author: jackburton >> Date: 2008-11-11 15:17:09 +0100 (Tue, 11 Nov 2008) >> New Revision: 28605 >> ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28605&view=rev >> >> Modified: >> haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_module.c >> Log: >> fix typo >> > > Could you also have a look at acpi_ns_dump.cpp ? it seems to be in > Windows format. You mean the endlines ? From jackburton at mail.berlios.de Tue Nov 11 16:28:49 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 11 Nov 2008 16:28:49 +0100 Subject: [Haiku-commits] r28606 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811111528.mABFSn6Q004531@sheep.berlios.de> Author: jackburton Date: 2008-11-11 16:28:46 +0100 (Tue, 11 Nov 2008) New Revision: 28606 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28606&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp Log: fix dos endlines Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-11 14:17:09 UTC (rev 28605) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-11 15:28:46 UTC (rev 28606) @@ -1,448 +1,448 @@ -/* ++++++++++ - ACPI namespace dump. - Nothing special here, just tree enumeration and type identification. -+++++ */ - -#include -#include -#include -#include -#include - -#include "acpi_priv.h" - -#include -#include - -class RingBuffer { -public: - RingBuffer(size_t size = 1024); - ~RingBuffer(); - ssize_t Read(void *buffer, size_t length); - ssize_t Write(const void *buffer, size_t length); - size_t WritableAmount() const; - size_t ReadableAmount() const; - - bool Lock(); - void Unlock(); -private: - ring_buffer *fBuffer; - sem_id fLock; -}; - - -typedef struct acpi_ns_device_info { - device_node *node; - acpi_root_info *acpi; - void *acpi_cookie; - thread_id thread; - sem_id read_sem; - RingBuffer *buffer; -} acpi_ns_device_info; - - - -// called with the buffer lock held -static bool -make_space(acpi_ns_device_info *device, size_t space) -{ - size_t available = device->buffer->WritableAmount(); - if (space <= available) - return true; - bool released = false; - do { - device->buffer->Unlock(); - - if (!released) { - if (release_sem_etc(device->read_sem, 1, B_RELEASE_IF_WAITING_ONLY) == B_OK) - released = true; - } - snooze(10000); - - if (!device->buffer->Lock()) - return false; - - } while (device->buffer->WritableAmount() < space); - - return true; -} - - - -static void -dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) -{ - char result[255]; - char output[320]; - char tabs[255]; - char hid[16]; - int i; - size_t written = 0; - hid[0] = '\0'; - tabs[0] = '\0'; - for (i = 0; i < indenting; i++) - strlcat(tabs, "| ", sizeof(tabs)); - - strlcat(tabs, "|--- ", sizeof(tabs)); - - int depth = sizeof(char) * 5 * indenting + sizeof(char); // index into result where the device name will be. - - void *counter = NULL; - while (device->acpi->get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) { - uint32 type = device->acpi->get_object_type(result); - snprintf(output, sizeof(output), "%s%s", tabs, result + depth); - switch(type) { - case ACPI_TYPE_INTEGER: - snprintf(output, sizeof(output), "%s INTEGER", output); - break; - case ACPI_TYPE_STRING: - snprintf(output, sizeof(output), "%s STRING", output); - break; - case ACPI_TYPE_BUFFER: - snprintf(output, sizeof(output), "%s BUFFER", output); - break; - case ACPI_TYPE_PACKAGE: - snprintf(output, sizeof(output), "%s PACKAGE", output); - break; - case ACPI_TYPE_FIELD_UNIT: - snprintf(output, sizeof(output), "%s FIELD UNIT", output); - break; - case ACPI_TYPE_DEVICE: - device->acpi->get_device_hid(result, hid); - snprintf(output, sizeof(output), "%s DEVICE (%s)", output, hid); - break; - case ACPI_TYPE_EVENT: - snprintf(output, sizeof(output), "%s EVENT", output); - break; - case ACPI_TYPE_METHOD: - snprintf(output, sizeof(output), "%s METHOD", output); - break; - case ACPI_TYPE_MUTEX: - snprintf(output, sizeof(output), "%s MUTEX", output); - break; - case ACPI_TYPE_REGION: - snprintf(output, sizeof(output), "%s REGION", output); - break; - case ACPI_TYPE_POWER: - snprintf(output, sizeof(output), "%s POWER", output); - break; - case ACPI_TYPE_PROCESSOR: - snprintf(output, sizeof(output), "%s PROCESSOR", output); - break; - case ACPI_TYPE_THERMAL: - snprintf(output, sizeof(output), "%s THERMAL", output); - break; - case ACPI_TYPE_BUFFER_FIELD: - snprintf(output, sizeof(output), "%s BUFFER_FIELD", output); - break; - case ACPI_TYPE_ANY: - default: - break; - } - written = 0; - RingBuffer &ringBuffer = *device->buffer; - size_t toWrite = strlen(output); - if (toWrite > 0) { - strlcat(output, "\n", sizeof(output)); - toWrite++; - if (ringBuffer.Lock()) { - if (ringBuffer.WritableAmount() < toWrite) { - //dprintf("not enough space\n"); - if (!make_space(device, toWrite)) { - panic("couldn't make space"); - exit_thread(0); - } - } - - written = ringBuffer.Write(output, toWrite); - //dprintf("written %ld bytes\n", written); - ringBuffer.Unlock(); - } - - dump_acpi_namespace(device, result, indenting + 1); - } - } -} - - -static int32 -acpi_namespace_dump(void *arg) -{ - acpi_ns_device_info *device = (acpi_ns_device_info*)(arg); - dump_acpi_namespace(device, NULL, 0); - - delete_sem(device->read_sem); - device->read_sem = -1; - - return 0; -} - -extern "C" { -/* ---------- - acpi_namespace_open - handle open() calls ------ */ - -static status_t -acpi_namespace_open(void *_cookie, const char* path, int flags, void** cookie) -{ - acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; - - dprintf("\nacpi_ns_dump: device_open\n"); - - *cookie = device; - - RingBuffer *ringBuffer = new RingBuffer(1024); - if (ringBuffer == NULL) - return B_NO_MEMORY; - - device->read_sem = create_sem(0, "read_sem"); - if (device->read_sem < B_OK) { - delete ringBuffer; - return device->read_sem; - } - - device->thread = spawn_kernel_thread(acpi_namespace_dump, "acpi dumper", - B_NORMAL_PRIORITY, device); - if (device->thread < 0) { - delete ringBuffer; - delete_sem(device->read_sem); - return device->thread; - } - - device->buffer = ringBuffer; - - resume_thread(device->thread); - - return B_OK; -} - - -/* ---------- - acpi_namespace_read - handle read() calls ------ */ -static status_t -acpi_namespace_read(void *_cookie, off_t position, void *buf, size_t* num_bytes) -{ - acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; - size_t bytesRead = 0; - size_t readable = 0; - //dprintf("acpi_namespace_read(cookie: %p, position: %lld, buffer: %p, size: %ld)\n", - // _cookie, position, buf, *num_bytes); - - RingBuffer &ringBuffer = *device->buffer; - - if (ringBuffer.Lock()) { - readable = ringBuffer.ReadableAmount(); - - //dprintf("%ld bytes readable\n", readable); - if (readable <= 0) { - //dprintf("acquiring read sem...\n"); - ringBuffer.Unlock(); - status_t status = acquire_sem_etc(device->read_sem, 1, B_CAN_INTERRUPT, 0); - if (status == B_INTERRUPTED) { - //dprintf("read: acquire_sem returned %s\n", strerror(status)); - *num_bytes = 0; - return status; - } - //dprintf("read sem acquired\n"); - if (!ringBuffer.Lock()) { - dprintf("read: couldn't acquire lock. bailing\n"); - *num_bytes = 0; - return B_ERROR; - } - } - - //dprintf("readable %ld\n", ringBuffer.ReadableAmount()); - bytesRead = ringBuffer.Read(buf, *num_bytes); - ringBuffer.Unlock(); - } - - //dprintf("read: read %ld bytes\n", bytesRead); - if (bytesRead < 0) { - *num_bytes = 0; - return bytesRead; - } - - *num_bytes = bytesRead; - - return B_OK; -} - - -/* ---------- - acpi_namespace_write - handle write() calls ------ */ - -static status_t -acpi_namespace_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes) -{ - dprintf("acpi_ns_dump: device_write\n"); - *num_bytes = 0; /* tell caller nothing was written */ - return B_IO_ERROR; -} - - -/* ---------- - acpi_namespace_control - handle ioctl calls ------ */ - -static status_t -acpi_namespace_control(void* cookie, uint32 op, void* arg, size_t len) -{ - dprintf("acpi_ns_dump: device_control\n"); - return B_BAD_VALUE; -} - - -/* ---------- - acpi_namespace_close - handle close() calls ------ */ - -static status_t -acpi_namespace_close(void* cookie) -{ - acpi_ns_device_info *device = (acpi_ns_device_info *)cookie; - dprintf("acpi_ns_dump: device_close\n"); - - if (device->read_sem >= 0) - delete_sem(device->read_sem); - - kill_thread(device->thread); - - delete device->buffer; - - return B_OK; -} - - -/* ----- - acpi_namespace_free - called after the last device is closed, and after - all i/o is complete. ------ */ -static status_t -acpi_namespace_free(void* cookie) -{ - dprintf("acpi_ns_dump: device_free\n"); - - return B_OK; -} - - -// #pragma mark - device module API - - -static status_t -acpi_namespace_init_device(void *_cookie, void **cookie) -{ - device_node *node = (device_node *)_cookie; - status_t err; - - acpi_ns_device_info *device = (acpi_ns_device_info *)calloc(1, sizeof(*device)); - if (device == NULL) - return B_NO_MEMORY; - - device->node = node; - err = gDeviceManager->get_driver(node, (driver_module_info **)&device->acpi, - (void **)&device->acpi_cookie); - if (err != B_OK) { - free(device); - return err; - } - - *cookie = device; - return B_OK; -} - - -static void -acpi_namespace_uninit_device(void *_cookie) -{ - acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; - free(device); -} - -} - -struct device_module_info acpi_ns_dump_module = { - { - ACPI_NS_DUMP_DEVICE_MODULE_NAME, - 0, - NULL - }, - - acpi_namespace_init_device, - acpi_namespace_uninit_device, - NULL, - - acpi_namespace_open, - acpi_namespace_close, - acpi_namespace_free, - acpi_namespace_read, - acpi_namespace_write, - NULL, - acpi_namespace_control, - - NULL, - NULL -}; - - -RingBuffer::RingBuffer(size_t size) -{ - fBuffer = create_ring_buffer(size); - fLock = create_sem(1, "ring buffer lock"); -} - - -RingBuffer::~RingBuffer() -{ - delete_sem(fLock); - delete_ring_buffer(fBuffer); -} - - -ssize_t -RingBuffer::Read(void *buffer, size_t size) -{ - return ring_buffer_read(fBuffer, (uint8*)buffer, size); -} - - -ssize_t -RingBuffer::Write(const void *buffer, size_t size) -{ - return ring_buffer_write(fBuffer, (uint8*)buffer, size); -} - - -size_t -RingBuffer::ReadableAmount() const -{ - return ring_buffer_readable(fBuffer); -} - - -size_t -RingBuffer::WritableAmount() const -{ - return ring_buffer_writable(fBuffer); -} - - -bool -RingBuffer::Lock() -{ - //status_t status = acquire_sem_etc(fLock, 1, B_CAN_INTERRUPT, 0); - status_t status = acquire_sem(fLock); - return status == B_OK; -} - - -void -RingBuffer::Unlock() -{ - release_sem(fLock); -} - - - +/* ++++++++++ + ACPI namespace dump. + Nothing special here, just tree enumeration and type identification. ++++++ */ + +#include +#include +#include +#include +#include + +#include "acpi_priv.h" + +#include +#include + +class RingBuffer { +public: + RingBuffer(size_t size = 1024); + ~RingBuffer(); + ssize_t Read(void *buffer, size_t length); + ssize_t Write(const void *buffer, size_t length); + size_t WritableAmount() const; + size_t ReadableAmount() const; + + bool Lock(); + void Unlock(); +private: + ring_buffer *fBuffer; + sem_id fLock; +}; + + +typedef struct acpi_ns_device_info { + device_node *node; + acpi_root_info *acpi; + void *acpi_cookie; + thread_id thread; + sem_id read_sem; + RingBuffer *buffer; +} acpi_ns_device_info; + + + +// called with the buffer lock held +static bool +make_space(acpi_ns_device_info *device, size_t space) +{ + size_t available = device->buffer->WritableAmount(); + if (space <= available) + return true; + bool released = false; + do { + device->buffer->Unlock(); + + if (!released) { + if (release_sem_etc(device->read_sem, 1, B_RELEASE_IF_WAITING_ONLY) == B_OK) + released = true; + } + snooze(10000); + + if (!device->buffer->Lock()) + return false; + + } while (device->buffer->WritableAmount() < space); + + return true; +} + + + +static void +dump_acpi_namespace(acpi_ns_device_info *device, char *root, int indenting) +{ + char result[255]; + char output[320]; + char tabs[255]; + char hid[16]; + int i; + size_t written = 0; + hid[0] = '\0'; + tabs[0] = '\0'; + for (i = 0; i < indenting; i++) + strlcat(tabs, "| ", sizeof(tabs)); + + strlcat(tabs, "|--- ", sizeof(tabs)); + + int depth = sizeof(char) * 5 * indenting + sizeof(char); // index into result where the device name will be. + + void *counter = NULL; + while (device->acpi->get_next_entry(ACPI_TYPE_ANY, root, result, 255, &counter) == B_OK) { + uint32 type = device->acpi->get_object_type(result); + snprintf(output, sizeof(output), "%s%s", tabs, result + depth); + switch(type) { + case ACPI_TYPE_INTEGER: + snprintf(output, sizeof(output), "%s INTEGER", output); + break; + case ACPI_TYPE_STRING: + snprintf(output, sizeof(output), "%s STRING", output); + break; + case ACPI_TYPE_BUFFER: + snprintf(output, sizeof(output), "%s BUFFER", output); + break; + case ACPI_TYPE_PACKAGE: + snprintf(output, sizeof(output), "%s PACKAGE", output); + break; + case ACPI_TYPE_FIELD_UNIT: + snprintf(output, sizeof(output), "%s FIELD UNIT", output); + break; + case ACPI_TYPE_DEVICE: + device->acpi->get_device_hid(result, hid); + snprintf(output, sizeof(output), "%s DEVICE (%s)", output, hid); + break; + case ACPI_TYPE_EVENT: + snprintf(output, sizeof(output), "%s EVENT", output); + break; + case ACPI_TYPE_METHOD: + snprintf(output, sizeof(output), "%s METHOD", output); + break; + case ACPI_TYPE_MUTEX: + snprintf(output, sizeof(output), "%s MUTEX", output); + break; + case ACPI_TYPE_REGION: + snprintf(output, sizeof(output), "%s REGION", output); + break; + case ACPI_TYPE_POWER: + snprintf(output, sizeof(output), "%s POWER", output); + break; + case ACPI_TYPE_PROCESSOR: + snprintf(output, sizeof(output), "%s PROCESSOR", output); + break; + case ACPI_TYPE_THERMAL: + snprintf(output, sizeof(output), "%s THERMAL", output); + break; + case ACPI_TYPE_BUFFER_FIELD: + snprintf(output, sizeof(output), "%s BUFFER_FIELD", output); + break; + case ACPI_TYPE_ANY: + default: + break; + } + written = 0; + RingBuffer &ringBuffer = *device->buffer; + size_t toWrite = strlen(output); + if (toWrite > 0) { + strlcat(output, "\n", sizeof(output)); + toWrite++; + if (ringBuffer.Lock()) { + if (ringBuffer.WritableAmount() < toWrite) { + //dprintf("not enough space\n"); + if (!make_space(device, toWrite)) { + panic("couldn't make space"); + exit_thread(0); + } + } + + written = ringBuffer.Write(output, toWrite); + //dprintf("written %ld bytes\n", written); + ringBuffer.Unlock(); + } + + dump_acpi_namespace(device, result, indenting + 1); + } + } +} + + +static int32 +acpi_namespace_dump(void *arg) +{ + acpi_ns_device_info *device = (acpi_ns_device_info*)(arg); + dump_acpi_namespace(device, NULL, 0); + + delete_sem(device->read_sem); + device->read_sem = -1; + + return 0; +} + +extern "C" { +/* ---------- + acpi_namespace_open - handle open() calls +----- */ + +static status_t +acpi_namespace_open(void *_cookie, const char* path, int flags, void** cookie) +{ + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; + + dprintf("\nacpi_ns_dump: device_open\n"); + + *cookie = device; + + RingBuffer *ringBuffer = new RingBuffer(1024); + if (ringBuffer == NULL) + return B_NO_MEMORY; + + device->read_sem = create_sem(0, "read_sem"); + if (device->read_sem < B_OK) { + delete ringBuffer; + return device->read_sem; + } + + device->thread = spawn_kernel_thread(acpi_namespace_dump, "acpi dumper", + B_NORMAL_PRIORITY, device); + if (device->thread < 0) { + delete ringBuffer; + delete_sem(device->read_sem); + return device->thread; + } + + device->buffer = ringBuffer; + + resume_thread(device->thread); + + return B_OK; +} + + +/* ---------- + acpi_namespace_read - handle read() calls +----- */ +static status_t +acpi_namespace_read(void *_cookie, off_t position, void *buf, size_t* num_bytes) +{ + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; + size_t bytesRead = 0; + size_t readable = 0; + //dprintf("acpi_namespace_read(cookie: %p, position: %lld, buffer: %p, size: %ld)\n", + // _cookie, position, buf, *num_bytes); + + RingBuffer &ringBuffer = *device->buffer; + + if (ringBuffer.Lock()) { + readable = ringBuffer.ReadableAmount(); + + //dprintf("%ld bytes readable\n", readable); + if (readable <= 0) { + //dprintf("acquiring read sem...\n"); + ringBuffer.Unlock(); + status_t status = acquire_sem_etc(device->read_sem, 1, B_CAN_INTERRUPT, 0); + if (status == B_INTERRUPTED) { + //dprintf("read: acquire_sem returned %s\n", strerror(status)); + *num_bytes = 0; + return status; + } + //dprintf("read sem acquired\n"); + if (!ringBuffer.Lock()) { + dprintf("read: couldn't acquire lock. bailing\n"); + *num_bytes = 0; + return B_ERROR; + } + } + + //dprintf("readable %ld\n", ringBuffer.ReadableAmount()); + bytesRead = ringBuffer.Read(buf, *num_bytes); + ringBuffer.Unlock(); + } + + //dprintf("read: read %ld bytes\n", bytesRead); + if (bytesRead < 0) { + *num_bytes = 0; + return bytesRead; + } + + *num_bytes = bytesRead; + + return B_OK; +} + + +/* ---------- + acpi_namespace_write - handle write() calls +----- */ + +static status_t +acpi_namespace_write(void* cookie, off_t position, const void* buffer, size_t* num_bytes) +{ + dprintf("acpi_ns_dump: device_write\n"); + *num_bytes = 0; /* tell caller nothing was written */ + return B_IO_ERROR; +} + + +/* ---------- + acpi_namespace_control - handle ioctl calls +----- */ + +static status_t +acpi_namespace_control(void* cookie, uint32 op, void* arg, size_t len) +{ + dprintf("acpi_ns_dump: device_control\n"); + return B_BAD_VALUE; +} + + +/* ---------- + acpi_namespace_close - handle close() calls +----- */ + +static status_t +acpi_namespace_close(void* cookie) +{ + acpi_ns_device_info *device = (acpi_ns_device_info *)cookie; + dprintf("acpi_ns_dump: device_close\n"); + + if (device->read_sem >= 0) + delete_sem(device->read_sem); + + kill_thread(device->thread); + + delete device->buffer; + + return B_OK; +} + + +/* ----- + acpi_namespace_free - called after the last device is closed, and after + all i/o is complete. +----- */ +static status_t +acpi_namespace_free(void* cookie) +{ + dprintf("acpi_ns_dump: device_free\n"); + + return B_OK; +} + + +// #pragma mark - device module API + + +static status_t +acpi_namespace_init_device(void *_cookie, void **cookie) +{ + device_node *node = (device_node *)_cookie; + status_t err; + + acpi_ns_device_info *device = (acpi_ns_device_info *)calloc(1, sizeof(*device)); + if (device == NULL) + return B_NO_MEMORY; + + device->node = node; + err = gDeviceManager->get_driver(node, (driver_module_info **)&device->acpi, + (void **)&device->acpi_cookie); + if (err != B_OK) { + free(device); + return err; + } + + *cookie = device; + return B_OK; +} + + +static void +acpi_namespace_uninit_device(void *_cookie) +{ + acpi_ns_device_info *device = (acpi_ns_device_info *)_cookie; + free(device); +} + +} + +struct device_module_info acpi_ns_dump_module = { + { + ACPI_NS_DUMP_DEVICE_MODULE_NAME, + 0, + NULL + }, + + acpi_namespace_init_device, + acpi_namespace_uninit_device, + NULL, + + acpi_namespace_open, + acpi_namespace_close, + acpi_namespace_free, + acpi_namespace_read, + acpi_namespace_write, + NULL, + acpi_namespace_control, + + NULL, + NULL +}; + + +RingBuffer::RingBuffer(size_t size) +{ + fBuffer = create_ring_buffer(size); + fLock = create_sem(1, "ring buffer lock"); +} + + +RingBuffer::~RingBuffer() +{ + delete_sem(fLock); + delete_ring_buffer(fBuffer); +} + + +ssize_t +RingBuffer::Read(void *buffer, size_t size) +{ + return ring_buffer_read(fBuffer, (uint8*)buffer, size); +} + + +ssize_t +RingBuffer::Write(const void *buffer, size_t size) +{ + return ring_buffer_write(fBuffer, (uint8*)buffer, size); +} + + +size_t +RingBuffer::ReadableAmount() const +{ + return ring_buffer_readable(fBuffer); +} + + +size_t +RingBuffer::WritableAmount() const +{ + return ring_buffer_writable(fBuffer); +} + + +bool +RingBuffer::Lock() +{ + //status_t status = acquire_sem_etc(fLock, 1, B_CAN_INTERRUPT, 0); + status_t status = acquire_sem(fLock); + return status == B_OK; +} + + +void +RingBuffer::Unlock() +{ + release_sem(fLock); +} + + + From korli at mail.berlios.de Tue Nov 11 16:32:44 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 16:32:44 +0100 Subject: [Haiku-commits] r28607 - haiku/trunk/build/jam Message-ID: <200811111532.mABFWiZw005195@sheep.berlios.de> Author: korli Date: 2008-11-11 16:32:43 +0100 (Tue, 11 Nov 2008) New Revision: 28607 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28607&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: added broadcom440x and pegasus drivers. They work fine on my machine. Removed bcm440x. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-11 15:28:46 UTC (rev 28606) +++ haiku/trunk/build/jam/HaikuImage 2008-11-11 15:32:43 UTC (rev 28607) @@ -137,12 +137,12 @@ $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware ; BEOS_ADD_ONS_DRIVERS_MIDI = emuxki ; -BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com etherpci $(X86_ONLY)ipro1000 - $(X86_ONLY)rtl8139 rtl8169 $(X86_ONLY)rtl81xx sis900 +BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)broadcom440x etherpci $(X86_ONLY)ipro1000 + pegasus $(X86_ONLY)rtl8139 rtl8169 $(X86_ONLY)rtl81xx sis900 $(X86_ONLY)via_rhine wb840 $(X86_ONLY)ipro100 $(X86_ONLY)nforce #vlance $(X86_ONLY)marvell_yukon $(X86_ONLY)syskonnect usb_ecm - $(GPL_ONLY)bcm440x $(GPL_ONLY)bcm570x + $(GPL_ONLY)bcm570x ; #BEOS_ADD_ONS_DRIVERS_ACPI = $(X86_ONLY)acpi_button ; BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi From jackburton at mail.berlios.de Tue Nov 11 16:33:44 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Tue, 11 Nov 2008 16:33:44 +0100 Subject: [Haiku-commits] r28608 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811111533.mABFXixG005286@sheep.berlios.de> Author: jackburton Date: 2008-11-11 16:33:42 +0100 (Tue, 11 Nov 2008) New Revision: 28608 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28608&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp Log: use '=""' to initialize the empty strings Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-11 15:32:43 UTC (rev 28607) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_ns_dump.cpp 2008-11-11 15:33:42 UTC (rev 28608) @@ -74,12 +74,10 @@ { char result[255]; char output[320]; - char tabs[255]; - char hid[16]; + char tabs[255] = ""; + char hid[16] = ""; int i; size_t written = 0; - hid[0] = '\0'; - tabs[0] = '\0'; for (i = 0; i < indenting; i++) strlcat(tabs, "| ", sizeof(tabs)); From korli at users.berlios.de Tue Nov 11 16:17:20 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 11 Nov 2008 16:17:20 +0100 Subject: [Haiku-commits] r28605 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: <894b9700811110647j46b01bb5i7cae39dd425e07e9@mail.gmail.com> References: <200811111417.mABEHAVr023316@sheep.berlios.de> <894b9700811110647j46b01bb5i7cae39dd425e07e9@mail.gmail.com> Message-ID: 2008/11/11 Stefano Ceccherini : > You mean the endlines ? Yes. From stefano.ceccherini at gmail.com Tue Nov 11 16:45:27 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Tue, 11 Nov 2008 16:45:27 +0100 Subject: [Haiku-commits] r28605 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi In-Reply-To: References: <200811111417.mABEHAVr023316@sheep.berlios.de> <894b9700811110647j46b01bb5i7cae39dd425e07e9@mail.gmail.com> Message-ID: <894b9700811110745qb26d319wdbc97528a878a8a5@mail.gmail.com> 2008/11/11 J?r?me Duval : > 2008/11/11 Stefano Ceccherini : >> You mean the endlines ? > > Yes. Ok should be fixed in r28607 From mmu_man at mail.berlios.de Tue Nov 11 20:05:03 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 11 Nov 2008 20:05:03 +0100 Subject: [Haiku-commits] r28609 - buildtools/trunk/binutils/bfd Message-ID: <200811111905.mABJ531K020636@sheep.berlios.de> Author: mmu_man Date: 2008-11-11 20:05:01 +0100 (Tue, 11 Nov 2008) New Revision: 28609 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28609&view=rev Modified: buildtools/trunk/binutils/bfd/config.bfd Log: Add some more BFD formats for ppc, copied from the BSD target, most notably coff support to allow creating loader for OpenFirmware < 3.0. Modified: buildtools/trunk/binutils/bfd/config.bfd =================================================================== --- buildtools/trunk/binutils/bfd/config.bfd 2008-11-11 15:33:42 UTC (rev 28608) +++ buildtools/trunk/binutils/bfd/config.bfd 2008-11-11 19:05:01 UTC (rev 28609) @@ -1063,6 +1063,7 @@ ;; powerpc-*-haiku*) targ_defvec=bfd_elf32_powerpc_vec + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" targ_cflags=-D__HAIKU_TARGET__ ;; powerpc-*-macos*) From mmu_man at mail.berlios.de Tue Nov 11 20:06:34 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 11 Nov 2008 20:06:34 +0100 Subject: [Haiku-commits] r28610 - haiku/trunk/data/boot_cd Message-ID: <200811111906.mABJ6Y5S020945@sheep.berlios.de> Author: mmu_man Date: 2008-11-11 20:06:34 +0100 (Tue, 11 Nov 2008) New Revision: 28610 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28610&view=rev Modified: haiku/trunk/data/boot_cd/ofboot.b Log: update chrp script. Modified: haiku/trunk/data/boot_cd/ofboot.b =================================================================== --- haiku/trunk/data/boot_cd/ofboot.b 2008-11-11 19:05:01 UTC (rev 28609) +++ haiku/trunk/data/boot_cd/ofboot.b 2008-11-11 19:06:34 UTC (rev 28610) @@ -6,6 +6,6 @@ Haiku -boot cd:\boot_loader_openfirmware +boot cd:,\ppc\boot_loader_openfirmware From mmu_man at mail.berlios.de Tue Nov 11 20:08:51 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 11 Nov 2008 20:08:51 +0100 Subject: [Haiku-commits] r28611 - haiku/trunk/src/system/boot Message-ID: <200811111908.mABJ8put021264@sheep.berlios.de> Author: mmu_man Date: 2008-11-11 20:08:51 +0100 (Tue, 11 Nov 2008) New Revision: 28611 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28611&view=rev Modified: haiku/trunk/src/system/boot/Jamfile Log: Support creating a COFF bootloader from the ELF one, at least for ppc. Modified: haiku/trunk/src/system/boot/Jamfile =================================================================== --- haiku/trunk/src/system/boot/Jamfile 2008-11-11 19:06:34 UTC (rev 28610) +++ haiku/trunk/src/system/boot/Jamfile 2008-11-11 19:08:51 UTC (rev 28611) @@ -47,6 +47,23 @@ : -Bstatic ; +rule BuildCoffLoader { + local coffLoader = $(1) ; + local bootLoader = $(2) ; + # XXX: eventually switch on arch + COFF_FORMAT on $(coffLoader) = aixcoff-rs6000 ; + + Depends $(coffLoader) : $(bootLoader) ; + MakeLocateDebug $(coffLoader) ; +} + +actions BuildCoffLoader { + rm -f $(1) + $(TARGET_OBJCOPY) -O $(COFF_FORMAT) $(2) $(1) +} + +BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ; + rule BuildZbeos { local zbeos = $(1) ; local bootLoader = $(2) ; From mmu_man at mail.berlios.de Tue Nov 11 20:22:17 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 11 Nov 2008 20:22:17 +0100 Subject: [Haiku-commits] r28612 - haiku/trunk/build/jam Message-ID: <200811111922.mABJMHXJ022744@sheep.berlios.de> Author: mmu_man Date: 2008-11-11 20:22:16 +0100 (Tue, 11 Nov 2008) New Revision: 28612 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28612&view=rev Modified: haiku/trunk/build/jam/CDBootPPCImage haiku/trunk/build/jam/ImageRules Log: Add COFF loader to ppc ISO. Modified: haiku/trunk/build/jam/CDBootPPCImage =================================================================== --- haiku/trunk/build/jam/CDBootPPCImage 2008-11-11 19:08:51 UTC (rev 28611) +++ haiku/trunk/build/jam/CDBootPPCImage 2008-11-11 19:22:16 UTC (rev 28612) @@ -11,22 +11,27 @@ # the pseudo target all archive contents is attached to NotFile $(HAIKU_CD_BOOT_PPC_IMAGE_CONTAINER_NAME) ; -# extra files to put on the boot iso -local extras = README.html ; -SEARCH on $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; +local elfloader = boot_loader_openfirmware ; +local coffloader = boot_loader_openfirmware_coff ; +# OpenFirmware / Mac boot support files: + +# CHRP script local chrpboot = ofboot.b ; -SEARCH on $(chrpboot) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; +# HFS creator and application type mapping for mkisofs local hfsmaps = hfs.map ; -SEARCH on $(hfsmaps) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; +# extra files to put on the boot iso +local extras = README.html ; +SEARCH on $(chrpboot) $(hfsmaps) $(extras) = [ FDirName $(HAIKU_TOP) data boot_cd ] ; -BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : $(hfsmaps) : boot_loader_openfirmware : $(chrpboot) : $(extras) ; +BuildCDBootPPCImage $(HAIKU_CD_BOOT_PPC_IMAGE) : $(hfsmaps) : $(elfloader) : $(coffloader) : $(chrpboot) : $(extras) ; + NotFile haiku-boot-cd-ppc ; Depends haiku-boot-cd-ppc : $(HAIKU_CD_BOOT_PPC_IMAGE) ; Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-11 19:08:51 UTC (rev 28611) +++ haiku/trunk/build/jam/ImageRules 2008-11-11 19:22:16 UTC (rev 28612) @@ -1068,15 +1068,16 @@ #pragma mark - CD Boot PPC Image rules -rule BuildCDBootPPCImage image : hfsmaps : bootloader : chrpscript : extrafiles +rule BuildCDBootPPCImage image : hfsmaps : elfloader : coffloader : chrpscript : extrafiles { - Depends $(image) : $(bootloader) ; + Depends $(image) : $(elfloader) ; + Depends $(image) : $(coffloader) ; Depends $(image) : $(chrpscript) ; Depends $(image) : $(extrafiles) ; Depends $(image) : $(hfsmaps) ; MAPS on $(image) = $(hfsmaps) ; - BuildCDBootPPCImage1 $(image) : $(bootloader) $(chrpscript) $(extrafiles) ; + BuildCDBootPPCImage1 $(image) : $(elfloaders) $(coffloader) $(chrpscript) $(extrafiles) ; } actions BuildCDBootPPCImage1 bind MAPS @@ -1084,8 +1085,9 @@ $(RM) $(<) mkdir -p $(HAIKU_OUTPUT_DIR)/cd/ppc cp $(>) $(HAIKU_OUTPUT_DIR)/cd/ppc/ - cp $(>[2]) $(HAIKU_OUTPUT_DIR)/cd/ppc/bootinfo.txt + cp $(>[3]) $(HAIKU_OUTPUT_DIR)/cd/ppc/bootinfo.txt cp $(>[1]) $(HAIKU_OUTPUT_DIR)/cd/ofwboot.elf + cp $(>[2]) $(HAIKU_OUTPUT_DIR)/cd/ofwboot.xcf #mkisofs -r -U -chrp-boot -V bootimg -o $(<) $(>[1]) $(>[2-]) #mkisofs -hfs -r -U -chrp-boot -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) #mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -r -o $(<) $(>[1]) $(>[2-]) $(HAIKU_OUTPUT_DIR)/cd @@ -1093,7 +1095,7 @@ #mkisofs -r -U -V bootimg -prep-boot $(>[1]:D=) -o $(<) $(>[1]) $(>[2-]) # $(HAIKU_OUTPUT_DIR)/cd # -hfs -hfs-bless . - mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot ppc/$(>[1]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd + mkisofs -v -hfs -part -map $(MAPS) -no-desktop -hfs-volid bootimg -V bootimg -hfs-bless $(HAIKU_OUTPUT_DIR)/cd/ppc -prep-boot ppc/$(>[2]:D=) -r -o $(<) $(HAIKU_OUTPUT_DIR)/cd #$(RM) -R $(HAIKU_OUTPUT_DIR)/cd } From korli at mail.berlios.de Tue Nov 11 20:24:34 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Tue, 11 Nov 2008 20:24:34 +0100 Subject: [Haiku-commits] r28613 - haiku/trunk/src/apps/soundrecorder Message-ID: <200811111924.mABJOYfX022966@sheep.berlios.de> Author: korli Date: 2008-11-11 20:24:33 +0100 (Tue, 11 Nov 2008) New Revision: 28613 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28613&view=rev Modified: haiku/trunk/src/apps/soundrecorder/Jamfile haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp haiku/trunk/src/apps/soundrecorder/RecorderWindow.h haiku/trunk/src/apps/soundrecorder/ScopeView.cpp Log: * better handling of dropped files * dragging now uses the mime type icon Modified: haiku/trunk/src/apps/soundrecorder/Jamfile =================================================================== --- haiku/trunk/src/apps/soundrecorder/Jamfile 2008-11-11 19:22:16 UTC (rev 28612) +++ haiku/trunk/src/apps/soundrecorder/Jamfile 2008-11-11 19:24:33 UTC (rev 28613) @@ -3,6 +3,7 @@ SetSubDirSupportedPlatformsBeOSCompatible ; UsePrivateHeaders shared ; +UseLibraryHeaders icon ; Application SoundRecorder : DrawButton.cpp Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-11 19:22:16 UTC (rev 28612) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.cpp 2008-11-11 19:24:33 UTC (rev 28613) @@ -43,7 +43,6 @@ #include "RecorderWindow.h" #include "SoundConsumer.h" -#include "SoundListView.h" #include "FileUtils.h" #if ! NDEBUG @@ -807,7 +806,15 @@ RecorderWindow::Selected(BMessage * message) { // User selected a sound in list view - UpdatePlayFile(); + int32 selIdx = fSoundList->CurrentSelection(); + SoundListItem* pItem = dynamic_cast(fSoundList->ItemAt(selIdx)); + if (!pItem) + return; + status_t err = UpdatePlayFile(pItem, true); + if (err != B_OK) { + ErrorAlert("recognize this file as a media file", err == B_MEDIA_NO_HANDLER ? B_OK : err); + RemoveCurrentSoundItem(); + } UpdateButtons(); } @@ -1003,20 +1010,13 @@ extern "C" status_t DecodedFormat__11BMediaTrackP12media_format(BMediaTrack *self, media_format *inout_format); #endif -void -RecorderWindow::UpdatePlayFile() +status_t +RecorderWindow::UpdatePlayFile(SoundListItem* item, bool updateDisplay) { fScopeView->CancelRendering(); StopPlaying(); StopRecording(); - // Get selection. - int32 selIdx = fSoundList->CurrentSelection(); - SoundListItem* pItem = dynamic_cast(fSoundList->ItemAt(selIdx)); - if (! pItem) { - return; - } - if (fPlayTrack && fPlayFile) { fPlayFile->ReleaseTrack(fPlayTrack); fPlayTrack = NULL; @@ -1027,16 +1027,14 @@ } status_t err; - BEntry& entry = pItem->Entry(); + BEntry& entry = item->Entry(); entry_ref ref; entry.GetRef(&ref); fPlayFile = new BMediaFile(&ref); //, B_MEDIA_FILE_UNBUFFERED); if ((err = fPlayFile->InitCheck()) < B_OK) { - ErrorAlert("recognize this file as a media file", err); delete fPlayFile; fPlayFile = NULL; - RemoveCurrentSoundItem(); - return; + return err; } for (int ix=0; ixCountTracks(); ix++) { @@ -1056,13 +1054,14 @@ } if (!fPlayTrack) { - ErrorAlert("find an audio track", err); delete fPlayFile; fPlayFile = NULL; - RemoveCurrentSoundItem(); - return; + return B_STREAM_NOT_FOUND; } + if (!updateDisplay) + return B_OK; + BString filename = "File Name: "; filename << ref.name; fFilename->SetText(filename.String()); @@ -1101,6 +1100,7 @@ fScopeView->RenderTrack(fPlayTrack, fPlayFormat); fPlayFrames = fPlayTrack->CountFrames(); + return B_OK; } @@ -1108,7 +1108,10 @@ RecorderWindow::ErrorAlert(const char * action, status_t err) { char msg[300]; - sprintf(msg, "Cannot %s: %s. [%lx]", action, strerror(err), (int32) err); + if (err != B_OK) + sprintf(msg, "Cannot %s: %s. [%lx]", action, strerror(err), (int32) err); + else + sprintf(msg, "Cannot %s.", action); (new BAlert("", msg, "Stop"))->Go(); } @@ -1161,8 +1164,12 @@ void RecorderWindow::RemoveCurrentSoundItem() { - BListItem *item = fSoundList->RemoveItem(fSoundList->CurrentSelection()); + int32 index = fSoundList->CurrentSelection(); + BListItem *item = fSoundList->RemoveItem(index); delete item; + if (index >= fSoundList->CountItems()) + index = fSoundList->CountItems() - 1; + fSoundList->Select(index); } @@ -1171,7 +1178,6 @@ void * data, size_t size, const media_raw_audio_format & format) { // Callback called from the SoundConsumer when receiving buffers. - assert((format.format & 0x02) && format.channel_count); RecorderWindow * window = (RecorderWindow *)cookie; if (window->fRecording) { @@ -1238,6 +1244,8 @@ { entry_ref ref; int32 i = 0; + int32 countGood = 0; + int32 countBad = 0; while (msg->FindRef("refs", i++, &ref) == B_OK) { @@ -1246,11 +1254,29 @@ BNode node(&entry); if (node.IsFile()) { - AddSoundItem(entry, false); + SoundListItem * listItem = new SoundListItem(entry, false); + if (UpdatePlayFile(listItem) == B_OK) { + fSoundList->AddItem(listItem); + countGood++; + continue; + } + delete listItem; } else if(node.IsDirectory()) { } + countBad++; } + + if (countBad > 0 && countGood == 0) + (new BAlert("Nothing to Play", "None of the files appear to be " + "audio files", "OK", NULL, NULL, B_WIDTH_AS_USUAL, B_STOP_ALERT))->Go(); + else if (countGood > 0) { + if (countBad > 0) + (new BAlert("Invalid audio files", "Some of the files " + "don't appear to be audio files", "OK", NULL, NULL, + B_WIDTH_AS_USUAL, B_WARNING_ALERT))->Go(); + fSoundList->Select(fSoundList->CountItems() - 1); + } } @@ -1270,7 +1296,6 @@ // seek time bigtime_t start = fTrackSlider->LeftTime(); - fPlayTrack->SeekToTime(&start); // write data bigtime_t diffTime = fTrackSlider->RightTime() - fTrackSlider->LeftTime(); @@ -1299,11 +1324,16 @@ char *data = (char *)malloc(fPlayFormat.u.raw_audio.buffer_size); + fPlayTrack->SeekToTime(&start); + fPlayFrame = fPlayTrack->CurrentFrame(); while (framesToWrite > 0) { int64 frames = 0; status_t err = fPlayTrack->ReadFrames(data, &frames); - if (frames <= 0 || err != B_OK) + if (frames <= 0 || err != B_OK) { + if (err != B_OK) + fprintf(stderr, "CopyTarget: ReadFrames failed\n"); break; + } file.Write(data, frames * frameSize); framesToWrite -= frames; } Modified: haiku/trunk/src/apps/soundrecorder/RecorderWindow.h =================================================================== --- haiku/trunk/src/apps/soundrecorder/RecorderWindow.h 2008-11-11 19:22:16 UTC (rev 28612) +++ haiku/trunk/src/apps/soundrecorder/RecorderWindow.h 2008-11-11 19:24:33 UTC (rev 28613) @@ -20,6 +20,7 @@ #include "DrawButton.h" #include "ScopeView.h" +#include "SoundListView.h" #include "TransportButton.h" #include "TrackSlider.h" #include "UpDownButton.h" @@ -155,7 +156,7 @@ void CalcSizes(float min_width, float min_height); void SetButtonState(BtnState state); void UpdateButtons(); - void UpdatePlayFile(); + status_t UpdatePlayFile(SoundListItem *item, bool updateDisplay = false); void ErrorAlert(const char * action, status_t err); static void RecordFile(void * cookie, bigtime_t timestamp, void * data, size_t size, const media_raw_audio_format & format); Modified: haiku/trunk/src/apps/soundrecorder/ScopeView.cpp =================================================================== --- haiku/trunk/src/apps/soundrecorder/ScopeView.cpp 2008-11-11 19:22:16 UTC (rev 28612) +++ haiku/trunk/src/apps/soundrecorder/ScopeView.cpp 2008-11-11 19:24:33 UTC (rev 28613) @@ -7,6 +7,7 @@ #include #include +#include #include #include #include @@ -260,7 +261,28 @@ drag.AddString("be:clip_name", "Audio Clip"); drag.AddString("be:types", B_FILE_MIME_TYPE); - DragMessage(&drag, Bounds()); + uint8* data; + size_t size; + + BMimeType wavType("audio/x-wav"); + if (wavType.InitCheck() < B_OK + || wavType.GetIcon(&data, &size) < B_OK) { + wavType.SetTo("audio"); + if (wavType.InitCheck() < B_OK + || wavType.GetIcon(&data, &size) < B_OK) { + return; + } + } + + BBitmap* bitmap = new BBitmap( + BRect(0, 0, 31, 31), 0, B_RGBA32); + if (BIconUtils::GetVectorIcon(data, size, bitmap) < B_OK) { + delete[] data; + delete bitmap; + return; + } + delete[] data; + DragMessage(&drag, bitmap, B_OP_ALPHA, BPoint(0,0)); } } From mmu_man at mail.berlios.de Tue Nov 11 20:26:58 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 11 Nov 2008 20:26:58 +0100 Subject: [Haiku-commits] r28614 - haiku/trunk/build/jam Message-ID: <200811111926.mABJQwSl023150@sheep.berlios.de> Author: mmu_man Date: 2008-11-11 20:26:58 +0100 (Tue, 11 Nov 2008) New Revision: 28614 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28614&view=rev Modified: haiku/trunk/build/jam/ImageRules Log: Fix typo. Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-11 19:24:33 UTC (rev 28613) +++ haiku/trunk/build/jam/ImageRules 2008-11-11 19:26:58 UTC (rev 28614) @@ -1077,7 +1077,7 @@ Depends $(image) : $(hfsmaps) ; MAPS on $(image) = $(hfsmaps) ; - BuildCDBootPPCImage1 $(image) : $(elfloaders) $(coffloader) $(chrpscript) $(extrafiles) ; + BuildCDBootPPCImage1 $(image) : $(elfloader) $(coffloader) $(chrpscript) $(extrafiles) ; } actions BuildCDBootPPCImage1 bind MAPS From axeld at mail.berlios.de Tue Nov 11 22:24:09 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 11 Nov 2008 22:24:09 +0100 Subject: [Haiku-commits] r28615 - haiku/trunk/src/system/kernel Message-ID: <200811112124.mABLO94x004921@sheep.berlios.de> Author: axeld Date: 2008-11-11 22:24:09 +0100 (Tue, 11 Nov 2008) New Revision: 28615 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28615&view=rev Modified: haiku/trunk/src/system/kernel/elf.cpp Log: * elf_find_symbol() now checks if the hashtable section is greater than 0. * Whatever is the cause of #2733, this should at least not make it crash. Modified: haiku/trunk/src/system/kernel/elf.cpp =================================================================== --- haiku/trunk/src/system/kernel/elf.cpp 2008-11-11 19:26:58 UTC (rev 28614) +++ haiku/trunk/src/system/kernel/elf.cpp 2008-11-11 21:24:09 UTC (rev 28615) @@ -523,14 +523,11 @@ static struct Elf32_Sym * elf_find_symbol(struct elf_image_info *image, const char *name) { - uint32 hash; - uint32 i; - - if (!image->dynamic_section) + if (image->dynamic_section == 0 || HASHTABSIZE(image) == 0) return NULL; - hash = elf_hash(name) % HASHTABSIZE(image); - for (i = HASHBUCKETS(image)[hash]; i != STN_UNDEF; + uint32 hash = elf_hash(name) % HASHTABSIZE(image); + for (uint32 i = HASHBUCKETS(image)[hash]; i != STN_UNDEF; i = HASHCHAINS(image)[i]) { if (!strcmp(SYMNAME(image, &image->syms[i]), name)) return &image->syms[i]; From bonefish at mail.berlios.de Tue Nov 11 22:47:12 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Tue, 11 Nov 2008 22:47:12 +0100 Subject: [Haiku-commits] r28616 - haiku/trunk/build/jam Message-ID: <200811112147.mABLlCrA006927@sheep.berlios.de> Author: bonefish Date: 2008-11-11 22:47:12 +0100 (Tue, 11 Nov 2008) New Revision: 28616 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28616&view=rev Modified: haiku/trunk/build/jam/OptionalPackages Log: Added missing blank lines. Please leave these facilities like you found them. Thanks! Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-11 21:24:09 UTC (rev 28615) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-11 21:47:12 UTC (rev 28616) @@ -10,6 +10,7 @@ isHybridBuild = 1 ; } + # Available Optional Packages: # APR # APR-util @@ -106,6 +107,7 @@ : /boot/beos/documentation/bebook/index.html : BeBook ; } + # BeHappy if [ IsOptionalHaikuImagePackageAdded BeHappy ] { if $(TARGET_ARCH) != x86 { @@ -448,6 +450,7 @@ } } + # VLC media player if [ IsOptionalHaikuImagePackageAdded VLC ] { if $(TARGET_ARCH) != x86 { @@ -466,6 +469,7 @@ } } + # Welcome if [ IsOptionalHaikuImagePackageAdded Welcome ] { CopyDirectoryToHaikuImage beos documentation @@ -478,6 +482,7 @@ : /boot/beos/documentation/welcome/welcome.html : Welcome ; } + # WonderBrush if [ IsOptionalHaikuImagePackageAdded WonderBrush ] { if $(TARGET_ARCH) != x86 { @@ -495,6 +500,7 @@ } } + # Yasm if [ IsOptionalHaikuImagePackageAdded Yasm ] { if $(TARGET_ARCH) != x86 { From axeld at mail.berlios.de Tue Nov 11 23:19:46 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 11 Nov 2008 23:19:46 +0100 Subject: [Haiku-commits] r28617 - in haiku/trunk/src: system/kernel/cache tools/fs_shell Message-ID: <200811112219.mABMJko3009078@sheep.berlios.de> Author: axeld Date: 2008-11-11 23:19:46 +0100 (Tue, 11 Nov 2008) New Revision: 28617 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28617&view=rev Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp haiku/trunk/src/tools/fs_shell/block_cache.cpp Log: * Brought the fs_shell block_cache implementation up to date, and incorporate the fixes applied to the kernel version of it (most notably a correctly working block_cache_discard(), and cache_detach_sub_transaction()). Also switched to the new notification functions, even though it still works synchronously in the fs_shell. * Minor cleanup. Modified: haiku/trunk/src/system/kernel/cache/block_cache.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-11 21:47:12 UTC (rev 28616) +++ haiku/trunk/src/system/kernel/cache/block_cache.cpp 2008-11-11 22:19:46 UTC (rev 28617) @@ -471,6 +471,61 @@ } +static void +flush_pending_notifications(block_cache* cache) +{ + ASSERT_LOCKED_MUTEX(&sCachesLock); + + while (true) { + MutexLocker locker(sNotificationsLock); + + cache_notification* notification = cache->pending_notifications.Head(); + if (notification == NULL) + return; + + bool deleteAfterEvent = false; + int32 event = -1; + if (!get_next_pending_event(notification, &event)) { + // remove the notification if this was the last pending event + cache->pending_notifications.Remove(notification); + deleteAfterEvent = notification->delete_after_event; + } + + if (event >= 0) { + // Notify listener, we need to copy the notification, as it might + // be removed when we unlock the list. + cache_notification copy = *notification; + locker.Unlock(); + + copy.hook(copy.transaction_id, event, copy.data); + + locker.Lock(); + } + + if (deleteAfterEvent) + delete notification; + } +} + + +/*! Flushes all pending notifications by calling the appropriate hook + functions. + Must not be called with a cache lock held. +*/ +static void +flush_pending_notifications() +{ + MutexLocker _(sCachesLock); + + DoublyLinkedList::Iterator iterator = sCaches.GetIterator(); + while (iterator.HasNext()) { + block_cache* cache = iterator.Next(); + + flush_pending_notifications(cache); + } +} + + /*! Initializes the \a notification as specified. */ static void set_notification(cache_transaction* transaction, @@ -563,61 +618,6 @@ } -static void -flush_pending_notifications(block_cache* cache) -{ - ASSERT_LOCKED_MUTEX(&sCachesLock); - - while (true) { - MutexLocker locker(sNotificationsLock); - - cache_notification* notification = cache->pending_notifications.Head(); - if (notification == NULL) - return; - - bool deleteAfterEvent = false; - int32 event = -1; - if (!get_next_pending_event(notification, &event)) { - // remove the notification if this was the last pending event - cache->pending_notifications.Remove(notification); - deleteAfterEvent = notification->delete_after_event; - } - - if (event >= 0) { - // Notify listener, we need to copy the notification, as it might - // be removed when we unlock the list. - cache_notification copy = *notification; - locker.Unlock(); - - copy.hook(copy.transaction_id, event, copy.data); - - locker.Lock(); - } - - if (deleteAfterEvent) - delete notification; - } -} - - -/*! Flushes all pending notifications by calling the appropriate hook - functions. - Must not be called with a cache lock held. -*/ -static void -flush_pending_notifications() -{ - MutexLocker _(sCachesLock); - - DoublyLinkedList::Iterator iterator = sCaches.GetIterator(); - while (iterator.HasNext()) { - block_cache* cache = iterator.Next(); - - flush_pending_notifications(cache); - } -} - - /*! Removes and deletes all listeners that are still monitoring this transaction. */ @@ -1218,7 +1218,7 @@ cache_transaction* transaction = block->transaction; if (transaction != NULL && transaction->id != transactionID) { - // ToDo: we have to wait here until the other transaction is done. + // TODO: we have to wait here until the other transaction is done. // Maybe we should even panic, since we can't prevent any deadlocks. panic("get_writable_cached_block(): asked to get busy writable block (transaction %ld)\n", block->transaction->id); put_cached_block(cache, block); @@ -2594,7 +2594,7 @@ if (cache->read_only) panic("tried to make block writable on a read-only cache!"); - // ToDo: this can be done better! + // TODO: this can be done better! void* block = get_writable_cached_block(cache, blockNumber, blockNumber, 1, transaction, false); if (block != NULL) { Modified: haiku/trunk/src/tools/fs_shell/block_cache.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-11-11 21:47:12 UTC (rev 28616) +++ haiku/trunk/src/tools/fs_shell/block_cache.cpp 2008-11-11 22:19:46 UTC (rev 28617) @@ -1,5 +1,5 @@ /* - * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2004-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -23,7 +23,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. @@ -40,6 +39,10 @@ // system, like out of memory situations - should only panic for debugging. #define FATAL(x) fssh_panic x +#undef offsetof +#define offsetof(struct, member) 0 + // TODO: I don't know why the offsetof() macro doesn't work in this context, + // but (0) is okay here... namespace FSShell { @@ -56,15 +59,14 @@ struct block_cache; typedef DoublyLinkedListLink block_link; - struct cached_block { - cached_block *next; // next in hash - cached_block *transaction_next; + cached_block* next; // next in hash + cached_block* transaction_next; block_link link; fssh_off_t block_number; - void *current_data; - void *original_data; - void *parent_data; + void* current_data; + void* original_data; + void* parent_data; #ifdef DEBUG_CHANGED void *compare; #endif @@ -75,77 +77,306 @@ bool is_dirty : 1; bool unused : 1; bool discard : 1; - cache_transaction *transaction; - cache_transaction *previous_transaction; + cache_transaction* transaction; + cache_transaction* previous_transaction; - static int Compare(void *_cacheEntry, const void *_block); - static uint32_t Hash(void *_cacheEntry, const void *_block, uint32_t range); + static int Compare(void* _cacheEntry, const void* _block); + static uint32_t Hash(void* _cacheEntry, const void* _block, uint32_t range); }; typedef DoublyLinkedList > block_list; +struct cache_notification : DoublyLinkedListLinkImpl { + int32_t transaction_id; + int32_t events_pending; + int32_t events; + fssh_transaction_notification_hook hook; + void* data; + bool delete_after_event; +}; + +typedef DoublyLinkedList NotificationList; + struct block_cache { - hash_table *hash; - fssh_mutex lock; - int fd; - fssh_off_t max_blocks; - fssh_size_t block_size; - int32_t allocated_block_count; - int32_t next_transaction_id; - cache_transaction *last_transaction; - hash_table *transaction_hash; + hash_table* hash; + fssh_mutex lock; + int fd; + fssh_off_t max_blocks; + fssh_size_t block_size; + int32_t allocated_block_count; + int32_t next_transaction_id; + cache_transaction* last_transaction; + hash_table* transaction_hash; - block_list unused_blocks; + block_list unused_blocks; - bool read_only; + bool read_only; - block_cache(int fd, fssh_off_t numBlocks, fssh_size_t blockSize, bool readOnly); - ~block_cache(); + NotificationList pending_notifications; - fssh_status_t InitCheck(); + block_cache(int fd, fssh_off_t numBlocks, + fssh_size_t blockSize, bool readOnly); + ~block_cache(); - void RemoveUnusedBlocks(int32_t maxAccessed = LONG_MAX, int32_t count = LONG_MAX); - void RemoveBlock(cached_block* block); - void FreeBlock(cached_block *block); - cached_block *NewBlock(fssh_off_t blockNumber); - void Free(void *address); - void *Allocate(); + fssh_status_t Init(); - static void LowMemoryHandler(void *data, int32_t level); + void Free(void* buffer); + void* Allocate(); + void RemoveUnusedBlocks(int32_t maxAccessed = LONG_MAX, + int32_t count = LONG_MAX); + void RemoveBlock(cached_block* block); + void DiscardBlock(cached_block* block); + void FreeBlock(cached_block* block); + cached_block* NewBlock(fssh_off_t blockNumber); }; static const int32_t kMaxBlockCount = 1024; -struct cache_hook : DoublyLinkedListLinkImpl { - fssh_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(); - cache_transaction *next; + cache_transaction* next; int32_t id; int32_t num_blocks; int32_t main_num_blocks; int32_t sub_num_blocks; - cached_block *first_block; + cached_block* first_block; block_list blocks; fssh_transaction_notification_hook notification_hook; - void *notification_data; - HookList listeners; + void* notification_data; + ListenerList listeners; bool open; bool has_sub_transaction; }; -static fssh_status_t write_cached_block(block_cache *cache, cached_block *block, + +static fssh_status_t write_cached_block(block_cache* cache, cached_block* block, bool deleteTransaction = true); +static fssh_mutex sNotificationsLock; + + +// #pragma mark - notifications/listener + + +/*! Checks wether or not this is an event that closes a transaction. */ +static inline bool +is_closing_event(int32_t event) +{ + return (event & (FSSH_TRANSACTION_ABORTED | FSSH_TRANSACTION_ENDED)) != 0; +} + + +static inline bool +is_written_event(int32_t event) +{ + return (event & FSSH_TRANSACTION_WRITTEN) != 0; +} + + +/*! From the specified \a notification, it will remove the lowest pending + event, and return that one in \a _event. + If there is no pending event anymore, it will return \c false. +*/ +static bool +get_next_pending_event(cache_notification* notification, int32_t* _event) +{ + for (int32_t eventMask = 1; eventMask <= FSSH_TRANSACTION_IDLE; eventMask <<= 1) { + int32_t pending = fssh_atomic_and(¬ification->events_pending, + ~eventMask); + + bool more = (pending & ~eventMask) != 0; + + if ((pending & eventMask) != 0) { + *_event = eventMask; + return more; + } + } + + return false; +} + + +static void +flush_pending_notifications(block_cache* cache) +{ + while (true) { + MutexLocker locker(sNotificationsLock); + + cache_notification* notification = cache->pending_notifications.Head(); + if (notification == NULL) + return; + + bool deleteAfterEvent = false; + int32_t 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; + } +} + + +/*! Initializes the \a notification as specified. */ +static void +set_notification(cache_transaction* transaction, + cache_notification ¬ification, int32_t events, + fssh_transaction_notification_hook hook, void* data) +{ + notification.transaction_id = transaction != NULL ? transaction->id : -1; + notification.events_pending = 0; + notification.events = events; + notification.hook = hook; + notification.data = data; + notification.delete_after_event = false; +} + + +/*! Makes sure the notification is deleted. It either deletes it directly, + when possible, or marks it for deletion if the notification is pending. +*/ +static void +delete_notification(cache_notification* notification) +{ + MutexLocker locker(sNotificationsLock); + + if (notification->events_pending != 0) + notification->delete_after_event = true; + else + delete notification; +} + + +/*! Adds the notification to the pending notifications list, or, if it's + already part of it, updates its events_pending field. + Also marks the notification to be deleted if \a deleteNotification + is \c true. + Triggers the notifier thread to run. +*/ +static void +add_notification(block_cache* cache, cache_notification* notification, + int32_t event, bool deleteNotification) +{ + if (notification->hook == NULL) + return; + + int32_t pending = fssh_atomic_or(¬ification->events_pending, event); + if (pending == 0) { + // not yet part of the notification list + MutexLocker locker(sNotificationsLock); + if (deleteNotification) + notification->delete_after_event = true; + cache->pending_notifications.Add(notification); + } else if (deleteNotification) { + // we might need to delete it ourselves if we're late + delete_notification(notification); + } +} + + +/*! Notifies all interested listeners of this transaction about the \a event. + If \a event is a closing event (ie. TRANSACTION_ENDED, and + TRANSACTION_ABORTED), all listeners except those listening to + TRANSACTION_WRITTEN will be removed. +*/ +static void +notify_transaction_listeners(block_cache* cache, cache_transaction* transaction, + int32_t event) +{ + bool isClosing = is_closing_event(event); + bool isWritten = is_written_event(event); + + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + + bool remove = isClosing && !is_written_event(listener->events) + || isWritten && is_written_event(listener->events); + if (remove) + iterator.Remove(); + + if ((listener->events & event) != 0) + add_notification(cache, listener, event, remove); + else if (remove) + delete_notification(listener); + } + + // This must work asynchronously in the kernel, but since we're not using + // most transaction events, we can do it here. + flush_pending_notifications(cache); +} + + +/*! Removes and deletes all listeners that are still monitoring this + transaction. +*/ +static void +remove_transaction_listeners(block_cache* cache, cache_transaction* transaction) +{ + ListenerList::Iterator iterator = transaction->listeners.GetIterator(); + while (iterator.HasNext()) { + cache_listener* listener = iterator.Next(); + iterator.Remove(); + + delete_notification(listener); + } +} + + +static fssh_status_t +add_transaction_listener(block_cache* cache, cache_transaction* transaction, + int32_t events, fssh_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 FSSH_B_OK; + } + } + + cache_listener* listener = new(std::nothrow) cache_listener; + if (listener == NULL) + return FSSH_B_NO_MEMORY; + + set_notification(transaction, *listener, events, hookFunction, data); + transaction->listeners.Add(listener); + return FSSH_B_OK; +} + + // #pragma mark - private transaction @@ -162,20 +393,20 @@ static int -transaction_compare(void *_transaction, const void *_id) +transaction_compare(void* _transaction, const void* _id) { - cache_transaction *transaction = (cache_transaction *)_transaction; - const int32_t *id = (const int32_t *)_id; + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32_t* id = (const int32_t*)_id; return transaction->id - *id; } static uint32_t -transaction_hash(void *_transaction, const void *_id, uint32_t range) +transaction_hash(void* _transaction, const void* _id, uint32_t range) { - cache_transaction *transaction = (cache_transaction *)_transaction; - const int32_t *id = (const int32_t *)_id; + cache_transaction* transaction = (cache_transaction*)_transaction; + const int32_t* id = (const int32_t*)_id; if (transaction != NULL) return transaction->id % range; @@ -184,62 +415,47 @@ } -/*! Notifies all listeners of this transaction, and removes them - afterwards. -*/ static void -notify_transaction_listeners(cache_transaction *transaction, int32_t event) +delete_transaction(block_cache* cache, cache_transaction* transaction) { - HookList::Iterator iterator = transaction->listeners.GetIterator(); - while (iterator.HasNext()) { - cache_hook *hook = iterator.Next(); - - hook->hook(transaction->id, event, hook->data); - - iterator.Remove(); - delete hook; - } -} - - -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_t id) +static cache_transaction* +lookup_transaction(block_cache* cache, int32_t id) { - return (cache_transaction *)hash_lookup(cache->transaction_hash, &id); + return (cache_transaction*)hash_lookup(cache->transaction_hash, &id); } // #pragma mark - cached_block -/* static */ -int -cached_block::Compare(void *_cacheEntry, const void *_block) +/*static*/ int +cached_block::Compare(void* _cacheEntry, const void* _block) { - cached_block *cacheEntry = (cached_block *)_cacheEntry; - const fssh_off_t *block = (const fssh_off_t *)_block; + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const fssh_off_t* block = (const fssh_off_t*)_block; - return cacheEntry->block_number - *block; + fssh_off_t diff = cacheEntry->block_number - *block; + if (diff > 0) + return 1; + + return diff < 0 ? -1 : 0; } -/* static */ -uint32_t -cached_block::Hash(void *_cacheEntry, const void *_block, uint32_t range) +/*static*/ uint32_t +cached_block::Hash(void* _cacheEntry, const void* _block, uint32_t range) { - cached_block *cacheEntry = (cached_block *)_cacheEntry; - const fssh_off_t *block = (const fssh_off_t *)_block; + cached_block* cacheEntry = (cached_block*)_cacheEntry; + const fssh_off_t* block = (const fssh_off_t*)_block; if (cacheEntry != NULL) return cacheEntry->block_number % range; @@ -264,52 +480,50 @@ transaction_hash(NULL), read_only(readOnly) { - hash = hash_init(32, 0, &cached_block::Compare, &cached_block::Hash); - if (hash == NULL) - return; - - transaction_hash = hash_init(16, 0, &transaction_compare, - &FSShell::transaction_hash); - if (transaction_hash == NULL) - return; - - fssh_mutex_init(&lock, "block cache"); } block_cache::~block_cache() { - fssh_mutex_destroy(&lock); - hash_uninit(transaction_hash); hash_uninit(hash); + + fssh_mutex_destroy(&lock); } fssh_status_t -block_cache::InitCheck() +block_cache::Init() { + fssh_mutex_init(&lock, "block cache"); if (lock.sem < FSSH_B_OK) return lock.sem; - if (hash == NULL || transaction_hash == NULL) + hash = hash_init(128, offsetof(cached_block, next), &cached_block::Compare, + &cached_block::Hash); + if (hash == NULL) return FSSH_B_NO_MEMORY; + transaction_hash = hash_init(16, offsetof(cache_transaction, next), + &transaction_compare, &FSShell::transaction_hash); + if (transaction_hash == NULL) + return FSSH_B_NO_MEMORY; + return FSSH_B_OK; } void -block_cache::Free(void *address) +block_cache::Free(void* buffer) { - if (address == NULL) + if (buffer == NULL) return; - free(address); + free(buffer); } -void * +void* block_cache::Allocate() { return malloc(block_size); @@ -317,7 +531,7 @@ void -block_cache::FreeBlock(cached_block *block) +block_cache::FreeBlock(cached_block* block) { Free(block->current_data); @@ -335,10 +549,10 @@ /*! Allocates a new block for \a blockNumber, ready for use */ -cached_block * +cached_block* block_cache::NewBlock(fssh_off_t blockNumber) { - cached_block *block = new(nothrow) cached_block; + cached_block* block = new(nothrow) cached_block; if (block == NULL) { FATAL(("could not allocate block!\n")); return NULL; @@ -351,7 +565,7 @@ } block->current_data = Allocate(); - if (!block->current_data) { + if (block->current_data == NULL) { FATAL(("could not allocate block data!\n")); delete block; return NULL; @@ -378,14 +592,6 @@ void -block_cache::RemoveBlock(cached_block* block) -{ - hash_remove(hash, block); - FreeBlock(block); -} - - -void block_cache::RemoveUnusedBlocks(int32_t maxAccessed, int32_t count) { TRACE(("block_cache: remove up to %ld unused blocks\n", count)); @@ -399,7 +605,7 @@ block->block_number, block->accessed)); // this can only happen if no transactions are used - if (block->is_dirty) + if (block->is_dirty && !block->discard) write_cached_block(this, block, false); // remove block from lists @@ -412,19 +618,52 @@ } +void +block_cache::RemoveBlock(cached_block* block) +{ + hash_remove(hash, block); + FreeBlock(block); +} + + +/*! Discards the block from a transaction (this method must not be called + for blocks not part of a transaction). +*/ +void +block_cache::DiscardBlock(cached_block* block) +{ + if (block->parent_data != NULL && block->parent_data != block->current_data) + Free(block->parent_data); + + block->parent_data = NULL; + + if (block->original_data != NULL) { + Free(block->original_data); + block->original_data = NULL; + } + + RemoveBlock(block); +} + + // #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) +put_cached_block(block_cache* cache, cached_block* block) { #ifdef DEBUG_CHANGED if (!block->is_dirty && block->compare != NULL && memcmp(block->current_data, block->compare, cache->block_size)) { fssh_dprintf("new block:\n"); - fssh_dump_block((const char *)block->current_data, 256, " "); + fssh_dump_block((const char*)block->current_data, 256, " "); fssh_dprintf("unchanged block:\n"); - fssh_dump_block((const char *)block->compare, 256, " "); + fssh_dump_block((const char*)block->compare, 256, " "); write_cached_block(cache, block); fssh_panic("block_cache: supposed to be clean block was changed!\n"); @@ -453,21 +692,20 @@ static void -put_cached_block(block_cache *cache, fssh_off_t blockNumber) +put_cached_block(block_cache* cache, fssh_off_t blockNumber) { if (blockNumber < 0 || blockNumber >= cache->max_blocks) { 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); + cached_block* block = (cached_block*)hash_lookup(cache->hash, &blockNumber); if (block != NULL) put_cached_block(cache, block); } -/*! - 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 @@ -476,8 +714,8 @@ not already in the cache. The block you retrieve may contain random data. */ -static cached_block * -get_cached_block(block_cache *cache, fssh_off_t blockNumber, bool *_allocated, +static cached_block* +get_cached_block(block_cache* cache, fssh_off_t blockNumber, bool* _allocated, bool readBlock = true) { if (blockNumber < 0 || blockNumber >= cache->max_blocks) { @@ -486,7 +724,7 @@ return NULL; } - cached_block *block = (cached_block *)hash_lookup(cache->hash, + cached_block* block = (cached_block*)hash_lookup(cache->hash, &blockNumber); *_allocated = false; @@ -505,8 +743,7 @@ if (fssh_read_pos(cache->fd, blockNumber * blockSize, block->current_data, blockSize) < blockSize) { - hash_remove(cache->hash, block); - cache->FreeBlock(block); + cache->RemoveBlock(block); FATAL(("could not read block %Ld\n", blockNumber)); return NULL; } @@ -525,16 +762,15 @@ } -/*! - 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. This is the only method to insert a block into a transaction. It makes sure that the previous block contents are preserved in that case. */ -static void * -get_writable_cached_block(block_cache *cache, fssh_off_t blockNumber, fssh_off_t base, +static void* +get_writable_cached_block(block_cache* cache, fssh_off_t blockNumber, fssh_off_t base, fssh_off_t length, int32_t transactionID, bool cleared) { TRACE(("get_writable_cached_block(blockNumber = %Ld, transaction = %d)\n", @@ -546,7 +782,7 @@ } bool allocated; - cached_block *block = get_cached_block(cache, blockNumber, &allocated, + cached_block* block = get_cached_block(cache, blockNumber, &allocated, !cleared); if (block == NULL) return NULL; @@ -564,10 +800,10 @@ return block->current_data; } - cache_transaction *transaction = block->transaction; + cache_transaction* transaction = block->transaction; if (transaction != NULL && transaction->id != transactionID) { - // ToDo: we have to wait here until the other transaction is done. + // TODO: we have to wait here until the other transaction is done. // Maybe we should even panic, since we can't prevent any deadlocks. fssh_panic("get_writable_cached_block(): asked to get busy writable block (transaction %d)\n", (int)transaction->id); put_cached_block(cache, block); @@ -635,14 +871,20 @@ } +/*! 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 fssh_status_t -write_cached_block(block_cache *cache, cached_block *block, +write_cached_block(block_cache* cache, cached_block* block, bool deleteTransaction) { - cache_transaction *previous = block->previous_transaction; + cache_transaction* previous = block->previous_transaction; int32_t blockSize = cache->block_size; - void *data = previous && block->original_data + void* data = previous && block->original_data ? block->original_data : block->current_data; // we first need to write back changes from previous transactions @@ -675,10 +917,7 @@ if (--previous->num_blocks == 0) { TRACE(("cache transaction %ld finished!\n", previous->id)); - if (previous->notification_hook != NULL) { - previous->notification_hook(previous->id, - FSSH_TRANSACTION_WRITTEN, previous->notification_data); - } + notify_transaction_listeners(cache, previous, FSSH_TRANSACTION_WRITTEN); if (deleteTransaction) { hash_remove(cache->transaction_hash, previous); @@ -686,14 +925,31 @@ } } } + if (block->transaction == NULL && block->ref_count == 0) { + // the block is no longer used + block->unused = true; + cache->unused_blocks.Add(block); + } return FSSH_B_OK; } +/*! 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) +{ +// TODO: nothing to wait for here. +} + + fssh_status_t block_cache_init() { + fssh_mutex_init(&sNotificationsLock, "block cache notifications"); return FSSH_B_OK; } @@ -708,9 +964,9 @@ int32_t -fssh_cache_start_transaction(void *_cache) +fssh_cache_start_transaction(void* _cache) { - block_cache *cache = (block_cache *)_cache; [... truncated: 725 lines follow ...] From mmu_man at mail.berlios.de Wed Nov 12 00:54:00 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 12 Nov 2008 00:54:00 +0100 Subject: [Haiku-commits] r28618 - in haiku/trunk/src/tools: . hack_coff Message-ID: <200811112354.mABNs0c7018740@sheep.berlios.de> Author: mmu_man Date: 2008-11-12 00:53:59 +0100 (Wed, 12 Nov 2008) New Revision: 28618 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28618&view=rev Added: haiku/trunk/src/tools/hack_coff/ haiku/trunk/src/tools/hack_coff/hack-coff.c Log: A little tool to hack COFF image to make them edible by oldworld OF (seems BFD forgets to set some fields...), that was mentionned on some NetBSD mailing lists, let's see if it works... Taken from ftp://mir1.ovh.net/lv0/ftp.kernel.org/pub/scm/linux/kernel/git/jejb/merge-tree/arch/powerpc/boot/hack-coff.c Added: haiku/trunk/src/tools/hack_coff/hack-coff.c =================================================================== --- haiku/trunk/src/tools/hack_coff/hack-coff.c 2008-11-11 22:19:46 UTC (rev 28617) +++ haiku/trunk/src/tools/hack_coff/hack-coff.c 2008-11-11 23:53:59 UTC (rev 28618) @@ -0,0 +1,84 @@ +/* + * hack-coff.c - hack the header of an xcoff file to fill in + * a few fields needed by the Open Firmware xcoff loader on + * Power Macs but not initialized by objcopy. + * + * Copyright (C) Paul Mackerras 1997. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version + * 2 of the License, or (at your option) any later version. + */ +#include +#include +#include +#include +#include +#include "rs6000.h" + +#define AOUT_MAGIC 0x010b + +#define get_16be(x) ((((unsigned char *)(x))[0] << 8) \ + + ((unsigned char *)(x))[1]) +#define put_16be(x, v) (((unsigned char *)(x))[0] = (v) >> 8, \ + ((unsigned char *)(x))[1] = (v) & 0xff) +#define get_32be(x) ((((unsigned char *)(x))[0] << 24) \ + + (((unsigned char *)(x))[1] << 16) \ + + (((unsigned char *)(x))[2] << 8) \ + + ((unsigned char *)(x))[3]) + +int +main(int ac, char **av) +{ + int fd; + int i, nsect; + int aoutsz; + struct external_filehdr fhdr; + AOUTHDR aout; + struct external_scnhdr shdr; + + if (ac != 2) { + fprintf(stderr, "Usage: hack-coff coff-file\n"); + exit(1); + } + if ((fd = open(av[1], 2)) == -1) { + perror(av[2]); + exit(1); + } + if (read(fd, &fhdr, sizeof(fhdr)) != sizeof(fhdr)) + goto readerr; + i = get_16be(fhdr.f_magic); + if (i != U802TOCMAGIC && i != U802WRMAGIC && i != U802ROMAGIC) { + fprintf(stderr, "%s: not an xcoff file\n", av[1]); + exit(1); + } + aoutsz = get_16be(fhdr.f_opthdr); + if (read(fd, &aout, aoutsz) != aoutsz) + goto readerr; + nsect = get_16be(fhdr.f_nscns); + for (i = 0; i < nsect; ++i) { + if (read(fd, &shdr, sizeof(shdr)) != sizeof(shdr)) + goto readerr; + if (strcmp(shdr.s_name, ".text") == 0) { + put_16be(aout.o_snentry, i+1); + put_16be(aout.o_sntext, i+1); + } else if (strcmp(shdr.s_name, ".data") == 0) { + put_16be(aout.o_sndata, i+1); + } else if (strcmp(shdr.s_name, ".bss") == 0) { + put_16be(aout.o_snbss, i+1); + } + } + put_16be(aout.magic, AOUT_MAGIC); + if (lseek(fd, (long) sizeof(struct external_filehdr), 0) == -1 + || write(fd, &aout, aoutsz) != aoutsz) { + fprintf(stderr, "%s: write error\n", av[1]); + exit(1); + } + close(fd); + exit(0); + +readerr: + fprintf(stderr, "%s: read error or file too short\n", av[1]); + exit(1); +} From mmu_man at mail.berlios.de Wed Nov 12 01:14:09 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 12 Nov 2008 01:14:09 +0100 Subject: [Haiku-commits] r28619 - haiku/trunk/src/system/ldscripts/ppc Message-ID: <200811120014.mAC0E9iD014602@sheep.berlios.de> Author: mmu_man Date: 2008-11-12 01:14:07 +0100 (Wed, 12 Nov 2008) New Revision: 28619 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28619&view=rev Modified: haiku/trunk/src/system/ldscripts/ppc/boot_loader_openfirmware.ld Log: Merge in all .text.Z* sections back to .text... Modified: haiku/trunk/src/system/ldscripts/ppc/boot_loader_openfirmware.ld =================================================================== --- haiku/trunk/src/system/ldscripts/ppc/boot_loader_openfirmware.ld 2008-11-11 23:53:59 UTC (rev 28618) +++ haiku/trunk/src/system/ldscripts/ppc/boot_loader_openfirmware.ld 2008-11-12 00:14:07 UTC (rev 28619) @@ -10,7 +10,7 @@ __text_begin = .; /* text/read-only data */ - .text : { *(.text .gnu.linkonce.t.*) } + .text : { *(.text .text.* .gnu.linkonce.t.*) } .rodata : { *(.rodata .rodata.* .gnu.linkonce.r.*) } .sdata2 : { *(.sdata2) } From mmu_man at mail.berlios.de Wed Nov 12 01:15:51 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 12 Nov 2008 01:15:51 +0100 Subject: [Haiku-commits] r28620 - in haiku/trunk/src/tools: . hack_coff Message-ID: <200811120015.mAC0FpSE017431@sheep.berlios.de> Author: mmu_man Date: 2008-11-12 01:15:50 +0100 (Wed, 12 Nov 2008) New Revision: 28620 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28620&view=rev Added: haiku/trunk/src/tools/hack_coff/Jamfile Modified: haiku/trunk/src/tools/Jamfile Log: Add to the build Modified: haiku/trunk/src/tools/Jamfile =================================================================== --- haiku/trunk/src/tools/Jamfile 2008-11-12 00:14:07 UTC (rev 28619) +++ haiku/trunk/src/tools/Jamfile 2008-11-12 00:15:50 UTC (rev 28620) @@ -104,6 +104,7 @@ SubInclude HAIKU_TOP src tools elfsymbolpatcher ; SubInclude HAIKU_TOP src tools fs_shell ; SubInclude HAIKU_TOP src tools gensyscalls ; +SubInclude HAIKU_TOP src tools hack_coff ; SubInclude HAIKU_TOP src tools keymap ; SubInclude HAIKU_TOP src tools makebootable ; SubInclude HAIKU_TOP src tools rc ; Added: haiku/trunk/src/tools/hack_coff/Jamfile =================================================================== --- haiku/trunk/src/tools/hack_coff/Jamfile 2008-11-12 00:14:07 UTC (rev 28619) +++ haiku/trunk/src/tools/hack_coff/Jamfile 2008-11-12 00:15:50 UTC (rev 28620) @@ -0,0 +1,12 @@ +SubDir HAIKU_TOP src tools hack_coff ; + +#UsePrivateHeaders kernel ; +UseHeaders [ FDirName $(HAIKU_TOP) src bin gdb include coff ] : true ; + +# avoid #includeing other stuff in the source +SubDirCcFlags -Dbfd_byte=char -DSYMNMLEN=8 ; + +BuildPlatformMain hack-coff + : hack-coff.c + : +; From mmu_man at mail.berlios.de Wed Nov 12 01:19:39 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 12 Nov 2008 01:19:39 +0100 Subject: [Haiku-commits] r28621 - buildtools/trunk/binutils/bfd Message-ID: <200811120019.mAC0Jd2Z024112@sheep.berlios.de> Author: mmu_man Date: 2008-11-12 01:19:39 +0100 (Wed, 12 Nov 2008) New Revision: 28621 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28621&view=rev Modified: buildtools/trunk/binutils/bfd/config.bfd Log: Add xcoff-pmac to the extra bfs formats, seems it's the one needed for old OF... Modified: buildtools/trunk/binutils/bfd/config.bfd =================================================================== --- buildtools/trunk/binutils/bfd/config.bfd 2008-11-12 00:15:50 UTC (rev 28620) +++ buildtools/trunk/binutils/bfd/config.bfd 2008-11-12 00:19:39 UTC (rev 28621) @@ -1063,7 +1063,7 @@ ;; powerpc-*-haiku*) targ_defvec=bfd_elf32_powerpc_vec - targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec" + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec pmac_xcoff_vec" targ_cflags=-D__HAIKU_TARGET__ ;; powerpc-*-macos*) From mmu_man at mail.berlios.de Wed Nov 12 03:14:09 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 12 Nov 2008 03:14:09 +0100 Subject: [Haiku-commits] r28622 - buildtools/trunk/binutils/bfd Message-ID: <200811120214.mAC2E9uY001321@sheep.berlios.de> Author: mmu_man Date: 2008-11-12 03:14:08 +0100 (Wed, 12 Nov 2008) New Revision: 28622 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28622&view=rev Modified: buildtools/trunk/binutils/bfd/config.bfd Log: Add PEF as extra BFD target, in case someone really feels like writing a BeBox bootloader... cf. http://www.bebox.nu/os.php?s=os/linux/belinux/status http://mail-index.netbsd.org/port-bebox/2000/02/03/0000.html Modified: buildtools/trunk/binutils/bfd/config.bfd =================================================================== --- buildtools/trunk/binutils/bfd/config.bfd 2008-11-12 00:19:39 UTC (rev 28621) +++ buildtools/trunk/binutils/bfd/config.bfd 2008-11-12 02:14:08 UTC (rev 28622) @@ -1063,7 +1063,7 @@ ;; powerpc-*-haiku*) targ_defvec=bfd_elf32_powerpc_vec - targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec ppcboot_vec pmac_xcoff_vec" + targ_selvecs="rs6000coff_vec bfd_elf32_powerpcle_vec pef_vec pef_xlib_vec pmac_xcoff_vec ppcboot_vec" targ_cflags=-D__HAIKU_TARGET__ ;; powerpc-*-macos*) From mmu_man at mail.berlios.de Wed Nov 12 03:36:04 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Wed, 12 Nov 2008 03:36:04 +0100 Subject: [Haiku-commits] r28623 - haiku/trunk/src/system/boot Message-ID: <200811120236.mAC2a4cl002971@sheep.berlios.de> Author: mmu_man Date: 2008-11-12 03:36:03 +0100 (Wed, 12 Nov 2008) New Revision: 28623 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28623&view=rev Modified: haiku/trunk/src/system/boot/Jamfile Log: Make use of hack-coff. Modified: haiku/trunk/src/system/boot/Jamfile =================================================================== --- haiku/trunk/src/system/boot/Jamfile 2008-11-12 02:14:08 UTC (rev 28622) +++ haiku/trunk/src/system/boot/Jamfile 2008-11-12 02:36:03 UTC (rev 28623) @@ -51,15 +51,18 @@ local coffLoader = $(1) ; local bootLoader = $(2) ; # XXX: eventually switch on arch - COFF_FORMAT on $(coffLoader) = aixcoff-rs6000 ; + COFF_FORMAT on $(coffLoader) = xcoff-powermac ; + HACK_COFF on $(coffLoader) = hack-coff ; Depends $(coffLoader) : $(bootLoader) ; MakeLocateDebug $(coffLoader) ; } -actions BuildCoffLoader { +actions BuildCoffLoader bind HACK_COFF { rm -f $(1) $(TARGET_OBJCOPY) -O $(COFF_FORMAT) $(2) $(1) + #$(CP) $(2) $(1) + $(HACK_COFF) $(1) } BuildCoffLoader boot_loader_$(TARGET_BOOT_PLATFORM)_coff : boot_loader_$(TARGET_BOOT_PLATFORM) ; From axeld at mail.berlios.de Wed Nov 12 13:03:59 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 12 Nov 2008 13:03:59 +0100 Subject: [Haiku-commits] r28624 - haiku/trunk/src/tools/fs_shell Message-ID: <200811121203.mACC3xkP029765@sheep.berlios.de> Author: axeld Date: 2008-11-12 13:03:58 +0100 (Wed, 12 Nov 2008) New Revision: 28624 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28624&view=rev Modified: haiku/trunk/src/tools/fs_shell/fssh.cpp Log: * Added "info" command that prints the information of the fs_info structure. * Shuffled functions around to separate command functions from their support functions. Modified: haiku/trunk/src/tools/fs_shell/fssh.cpp =================================================================== --- haiku/trunk/src/tools/fs_shell/fssh.cpp 2008-11-12 02:36:03 UTC (rev 28623) +++ haiku/trunk/src/tools/fs_shell/fssh.cpp 2008-11-12 12:03:58 UTC (rev 28624) @@ -23,6 +23,7 @@ #include "fssh_dirent.h" #include "fssh_errno.h" #include "fssh_errors.h" +#include "fssh_fs_info.h" #include "fssh_module.h" #include "fssh_node_monitor.h" #include "fssh_stat.h" @@ -253,6 +254,328 @@ CommandManager* CommandManager::sManager = NULL; +// #pragma mark - Command support functions + + +static bool +get_permissions(const char* modeString, fssh_mode_t& _permissions) +{ + // currently only octal mode is supported + if (strlen(modeString) != 3) + return false; + + fssh_mode_t permissions = 0; + for (int i = 0; i < 3; i++) { + char c = modeString[i]; + if (c < '0' || c > '7') + return false; + permissions = (permissions << 3) | (c - '0'); + } + + _permissions = permissions; + return true; +} + + +static fssh_dev_t +get_volume_id() +{ + struct fssh_stat st; + fssh_status_t error = _kern_read_stat(-1, kMountPoint, false, &st, + sizeof(st)); + if (error != FSSH_B_OK) { + fprintf(stderr, "Error: Failed to stat() mount point: %s\n", + fssh_strerror(error)); + return error; + } + + return st.fssh_st_dev; +} + + +static const char * +byte_string(int64_t numBlocks, int64_t blockSize) +{ + double blocks = 1. * numBlocks * blockSize; + static char string[64]; + + if (blocks < 1024) + sprintf(string, "%Ld", numBlocks * blockSize); + else { + const char* units[] = {"K", "M", "G", NULL}; + int i = -1; + + do { + blocks /= 1024.0; + i++; + } while (blocks >= 1024 && units[i + 1]); + + sprintf(string, "%.1f%s", blocks, units[i]); + } + + return string; +} + + +void +print_flag(uint32_t deviceFlags, uint32_t testFlag, const char *yes, + const char *no) +{ + printf((deviceFlags & testFlag) != 0 ? yes : no); +} + + +static void +list_entry(const char* file, const char* name = NULL) +{ + // construct path, if a leaf name is given + std::string path; + if (name) { + path = file; + path += '/'; + path += name; + file = path.c_str(); + } else + name = file; + + // stat the file + struct fssh_stat st; + fssh_status_t error = _kern_read_stat(-1, file, false, &st, sizeof(st)); + if (error != FSSH_B_OK) { + fprintf(stderr, "Error: Failed to stat() \"%s\": %s\n", file, + fssh_strerror(error)); + return; + } + + // get time + struct tm time; + time_t fileTime = st.fssh_st_mtime; + localtime_r(&fileTime, &time); + + // get permissions + std::string permissions; + fssh_mode_t mode = st.fssh_st_mode; + // user + permissions += ((mode & FSSH_S_IRUSR) ? 'r' : '-'); + permissions += ((mode & FSSH_S_IWUSR) ? 'w' : '-'); + if (mode & FSSH_S_ISUID) + permissions += 's'; + else + permissions += ((mode & FSSH_S_IXUSR) ? 'x' : '-'); + // group + permissions += ((mode & FSSH_S_IRGRP) ? 'r' : '-'); + permissions += ((mode & FSSH_S_IWGRP) ? 'w' : '-'); + if (mode & FSSH_S_ISGID) + permissions += 's'; + else + permissions += ((mode & FSSH_S_IXGRP) ? 'x' : '-'); + // others + permissions += ((mode & FSSH_S_IROTH) ? 'r' : '-'); + permissions += ((mode & FSSH_S_IWOTH) ? 'w' : '-'); + permissions += ((mode & FSSH_S_IXOTH) ? 'x' : '-'); + + // get file type + char fileType = '?'; + if (FSSH_S_ISREG(mode)) { + fileType = '-'; + } else if (FSSH_S_ISLNK(mode)) { + fileType = 'l'; + } else if (FSSH_S_ISBLK(mode)) { + fileType = 'b'; + } else if (FSSH_S_ISDIR(mode)) { + fileType = 'd'; + } else if (FSSH_S_ISCHR(mode)) { + fileType = 'c'; + } else if (FSSH_S_ISFIFO(mode)) { + fileType = 'f'; + } else if (FSSH_S_ISINDEX(mode)) { + fileType = 'i'; + } + + // get link target + std::string nameSuffix; + if (FSSH_S_ISLNK(mode)) { + char buffer[FSSH_B_PATH_NAME_LENGTH]; + fssh_size_t size = sizeof(buffer) - 1; + error = _kern_read_link(-1, file, buffer, &size); + if (error != FSSH_B_OK) + snprintf(buffer, sizeof(buffer), "(%s)", fssh_strerror(error)); + + buffer[size] = '\0'; + nameSuffix += " -> "; + nameSuffix += buffer; + } + + printf("%c%s %2d %2d %10lld %d-%02d-%02d %02d:%02d:%02d %s%s\n", + fileType, permissions.c_str(), (int)st.fssh_st_uid, (int)st.fssh_st_gid, + st.fssh_st_size, + 1900 + time.tm_year, 1 + time.tm_mon, time.tm_mday, + time.tm_hour, time.tm_min, time.tm_sec, + name, nameSuffix.c_str()); +} + + +static fssh_status_t +create_dir(const char *path, bool createParents) +{ + // stat the entry + struct fssh_stat st; + fssh_status_t error = _kern_read_stat(-1, path, false, &st, sizeof(st)); + if (error == FSSH_B_OK) { + if (createParents && FSSH_S_ISDIR(st.fssh_st_mode)) + return FSSH_B_OK; + + fprintf(stderr, "Error: Cannot make dir, entry \"%s\" is in the way.\n", + path); + return FSSH_B_FILE_EXISTS; + } + + // the dir doesn't exist yet + // if we shall create all parents, do that first + if (createParents) { + // create the parent dir path + // eat the trailing '/'s + int len = strlen(path); + while (len > 0 && path[len - 1] == '/') + len--; + + // eat the last path component + while (len > 0 && path[len - 1] != '/') + len--; + + // eat the trailing '/'s + while (len > 0 && path[len - 1] == '/') + len--; + + // Now either nothing remains, which means we had a single component, + // a root subdir -- in those cases we can just fall through (we should + // actually never be here in case of the root dir, but anyway) -- or + // there is something left, which we can call a parent directory and + // try to create it. + if (len > 0) { + char *parentPath = (char*)malloc(len + 1); + if (!parentPath) { + fprintf(stderr, "Error: Failed to allocate memory for parent " + "path.\n"); + return FSSH_B_NO_MEMORY; + } + memcpy(parentPath, path, len); + parentPath[len] = '\0'; + + error = create_dir(parentPath, createParents); + + free(parentPath); + + if (error != FSSH_B_OK) + return error; + } + } + + // make the directory + 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)); + return error; + } + + return FSSH_B_OK; +} + + +static fssh_status_t remove_entry(int dir, const char *entry, bool recursive, + bool force); + + +static fssh_status_t +remove_dir_contents(int parentDir, const char *name, bool force) +{ + // open the dir + int dir = _kern_open_dir(parentDir, name); + if (dir < 0) { + fprintf(stderr, "Error: Failed to open dir \"%s\": %s\n", name, + fssh_strerror(dir)); + return dir; + } + + fssh_status_t error = FSSH_B_OK; + + // iterate through the entries + fssh_ssize_t numRead; + char buffer[sizeof(fssh_dirent) + FSSH_B_FILE_NAME_LENGTH]; + fssh_dirent *entry = (fssh_dirent*)buffer; + while ((numRead = _kern_read_dir(dir, entry, sizeof(buffer), 1)) > 0) { + // skip "." and ".." + if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) + continue; + + error = remove_entry(dir, entry->d_name, true, force); + if (error != FSSH_B_OK) + break; + } + + if (numRead < 0) { + fprintf(stderr, "Error: Failed to read directory \"%s\": %s\n", name, + fssh_strerror(numRead)); + error = numRead; + } + + // close + _kern_close(dir); + + return error; +} + + +static fssh_status_t +remove_entry(int dir, const char *entry, bool recursive, bool force) +{ + // stat the file + struct fssh_stat st; + fssh_status_t error = _kern_read_stat(dir, entry, false, &st, sizeof(st)); + if (error != FSSH_B_OK) { + if (force && error == FSSH_B_ENTRY_NOT_FOUND) + return FSSH_B_OK; + + fprintf(stderr, "Error: Failed to remove \"%s\": %s\n", entry, + fssh_strerror(error)); + return error; + } + + if (FSSH_S_ISDIR(st.fssh_st_mode)) { + if (!recursive) { + fprintf(stderr, "Error: \"%s\" is a directory.\n", entry); + // TODO: get the full path + return FSSH_EISDIR; + } + + // remove the contents + error = remove_dir_contents(dir, entry, force); + if (error != FSSH_B_OK) + return error; + + // remove the directory + error = _kern_remove_dir(dir, entry); + if (error != FSSH_B_OK) { + fprintf(stderr, "Error: Failed to remove directory \"%s\": %s\n", + entry, fssh_strerror(error)); + return error; + } + } else { + // remove the entry + error = _kern_unlink(dir, entry); + if (error != FSSH_B_OK) { + fprintf(stderr, "Error: Failed to remove entry \"%s\": %s\n", entry, + fssh_strerror(error)); + return error; + } + } + + return FSSH_B_OK; +} + + // #pragma mark - Commands @@ -281,26 +604,6 @@ } -static bool -get_permissions(const char* modeString, fssh_mode_t& _permissions) -{ - // currently only octal mode is supported - if (strlen(modeString) != 3) - return false; - - fssh_mode_t permissions = 0; - for (int i = 0; i < 3; i++) { - char c = modeString[i]; - if (c < '0' || c > '7') - return false; - permissions = (permissions << 3) | (c - '0'); - } - - _permissions = permissions; - return true; -} - - static fssh_status_t command_chmod(int argc, const char* const* argv) { @@ -372,6 +675,43 @@ static fssh_status_t +command_info(int argc, const char* const* argv) +{ + fssh_dev_t volumeID = get_volume_id(); + if (volumeID < 0) + return volumeID; + + fssh_fs_info info; + fssh_status_t status = _kern_read_fs_info(volumeID, &info); + if (status != FSSH_B_OK) + return status; + + printf("root inode: %lld\n", info.root); + printf("flags: "); + print_flag(info.flags, FSSH_B_FS_HAS_QUERY, "Q", "-"); + print_flag(info.flags, FSSH_B_FS_HAS_ATTR, "A", "-"); + print_flag(info.flags, FSSH_B_FS_HAS_MIME, "M", "-"); + print_flag(info.flags, FSSH_B_FS_IS_SHARED, "S", "-"); + print_flag(info.flags, FSSH_B_FS_IS_PERSISTENT, "P", "-"); + print_flag(info.flags, FSSH_B_FS_IS_REMOVABLE, "R", "-"); + print_flag(info.flags, FSSH_B_FS_IS_READONLY, "-", "W"); + + printf("\nblock size: %lld\n", info.block_size); + printf("I/O size: %lld\n", info.io_size); + printf("total size: %s (%lld blocks)\n", + byte_string(info.total_blocks, info.block_size), info.total_blocks); + printf("free size: %s (%lld blocks)\n", + byte_string(info.free_blocks, info.block_size), info.free_blocks); + printf("total nodes: %lld\n", info.total_nodes); + printf("free nodes: %lld\n", info.free_nodes); + printf("volume name: %s\n", info.volume_name); + printf("fs name: %s\n", info.fsh_name); + + return FSSH_B_OK; +} + + +static fssh_status_t command_ln(int argc, const char* const* argv) { bool force = false; @@ -480,96 +820,6 @@ } -static void -list_entry(const char* file, const char* name = NULL) -{ - // construct path, if a leaf name is given - std::string path; - if (name) { - path = file; - path += '/'; - path += name; - file = path.c_str(); - } else - name = file; - - // stat the file - struct fssh_stat st; - fssh_status_t error = _kern_read_stat(-1, file, false, &st, sizeof(st)); - if (error != FSSH_B_OK) { - fprintf(stderr, "Error: Failed to stat() \"%s\": %s\n", file, - fssh_strerror(error)); - return; - } - - // get time - struct tm time; - time_t fileTime = st.fssh_st_mtime; - localtime_r(&fileTime, &time); - - // get permissions - std::string permissions; - fssh_mode_t mode = st.fssh_st_mode; - // user - permissions += ((mode & FSSH_S_IRUSR) ? 'r' : '-'); - permissions += ((mode & FSSH_S_IWUSR) ? 'w' : '-'); - if (mode & FSSH_S_ISUID) - permissions += 's'; - else - permissions += ((mode & FSSH_S_IXUSR) ? 'x' : '-'); - // group - permissions += ((mode & FSSH_S_IRGRP) ? 'r' : '-'); - permissions += ((mode & FSSH_S_IWGRP) ? 'w' : '-'); - if (mode & FSSH_S_ISGID) - permissions += 's'; - else - permissions += ((mode & FSSH_S_IXGRP) ? 'x' : '-'); - // others - permissions += ((mode & FSSH_S_IROTH) ? 'r' : '-'); - permissions += ((mode & FSSH_S_IWOTH) ? 'w' : '-'); - permissions += ((mode & FSSH_S_IXOTH) ? 'x' : '-'); - - // get file type - char fileType = '?'; - if (FSSH_S_ISREG(mode)) { - fileType = '-'; - } else if (FSSH_S_ISLNK(mode)) { - fileType = 'l'; - } else if (FSSH_S_ISBLK(mode)) { - fileType = 'b'; - } else if (FSSH_S_ISDIR(mode)) { - fileType = 'd'; - } else if (FSSH_S_ISCHR(mode)) { - fileType = 'c'; - } else if (FSSH_S_ISFIFO(mode)) { - fileType = 'f'; - } else if (FSSH_S_ISINDEX(mode)) { - fileType = 'i'; - } - - // get link target - std::string nameSuffix; - if (FSSH_S_ISLNK(mode)) { - char buffer[FSSH_B_PATH_NAME_LENGTH]; - fssh_size_t size = sizeof(buffer) - 1; - error = _kern_read_link(-1, file, buffer, &size); - if (error != FSSH_B_OK) - snprintf(buffer, sizeof(buffer), "(%s)", fssh_strerror(error)); - - buffer[size] = '\0'; - nameSuffix += " -> "; - nameSuffix += buffer; - } - - printf("%c%s %2d %2d %10lld %d-%02d-%02d %02d:%02d:%02d %s%s\n", - fileType, permissions.c_str(), (int)st.fssh_st_uid, (int)st.fssh_st_gid, - st.fssh_st_size, - 1900 + time.tm_year, 1 + time.tm_mon, time.tm_mday, - time.tm_hour, time.tm_min, time.tm_sec, - name, nameSuffix.c_str()); -} - - static fssh_status_t command_ls(int argc, const char* const* argv) { @@ -633,75 +883,6 @@ static fssh_status_t -create_dir(const char *path, bool createParents) -{ - // stat the entry - struct fssh_stat st; - fssh_status_t error = _kern_read_stat(-1, path, false, &st, sizeof(st)); - if (error == FSSH_B_OK) { - if (createParents && FSSH_S_ISDIR(st.fssh_st_mode)) - return FSSH_B_OK; - - fprintf(stderr, "Error: Cannot make dir, entry \"%s\" is in the way.\n", - path); - return FSSH_B_FILE_EXISTS; - } - - // the dir doesn't exist yet - // if we shall create all parents, do that first - if (createParents) { - // create the parent dir path - // eat the trailing '/'s - int len = strlen(path); - while (len > 0 && path[len - 1] == '/') - len--; - - // eat the last path component - while (len > 0 && path[len - 1] != '/') - len--; - - // eat the trailing '/'s - while (len > 0 && path[len - 1] == '/') - len--; - - // Now either nothing remains, which means we had a single component, - // a root subdir -- in those cases we can just fall through (we should - // actually never be here in case of the root dir, but anyway) -- or - // there is something left, which we can call a parent directory and - // try to create it. - if (len > 0) { - char *parentPath = (char*)malloc(len + 1); - if (!parentPath) { - fprintf(stderr, "Error: Failed to allocate memory for parent " - "path.\n"); - return FSSH_B_NO_MEMORY; - } - memcpy(parentPath, path, len); - parentPath[len] = '\0'; - - error = create_dir(parentPath, createParents); - - free(parentPath); - - if (error != FSSH_B_OK) - return error; - } - } - - // make the directory - 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)); - return error; - } - - return FSSH_B_OK; -} - - -static fssh_status_t command_mkdir(int argc, const char* const* argv) { bool createParents = false; @@ -752,22 +933,6 @@ } -static fssh_dev_t -get_volume_id() -{ - struct fssh_stat st; - fssh_status_t error = _kern_read_stat(-1, kMountPoint, false, &st, - sizeof(st)); - if (error != FSSH_B_OK) { - fprintf(stderr, "Error: Failed to stat() mount point: %s\n", - fssh_strerror(error)); - return error; - } - - return st.fssh_st_dev; -} - - static fssh_status_t command_mkindex(int argc, const char* const* argv) { @@ -858,99 +1023,7 @@ } -static fssh_status_t remove_entry(int dir, const char *entry, bool recursive, - bool force); - - static fssh_status_t -remove_dir_contents(int parentDir, const char *name, bool force) -{ - // open the dir - int dir = _kern_open_dir(parentDir, name); - if (dir < 0) { - fprintf(stderr, "Error: Failed to open dir \"%s\": %s\n", name, - fssh_strerror(dir)); - return dir; - } - - fssh_status_t error = FSSH_B_OK; - - // iterate through the entries - fssh_ssize_t numRead; - char buffer[sizeof(fssh_dirent) + FSSH_B_FILE_NAME_LENGTH]; - fssh_dirent *entry = (fssh_dirent*)buffer; - while ((numRead = _kern_read_dir(dir, entry, sizeof(buffer), 1)) > 0) { - // skip "." and ".." - if (strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) - continue; - - error = remove_entry(dir, entry->d_name, true, force); - if (error != FSSH_B_OK) - break; - } - - if (numRead < 0) { - fprintf(stderr, "Error: Failed to read directory \"%s\": %s\n", name, - fssh_strerror(numRead)); - error = numRead; - } - - // close - _kern_close(dir); - - return error; -} - - -static fssh_status_t -remove_entry(int dir, const char *entry, bool recursive, bool force) -{ - // stat the file - struct fssh_stat st; - fssh_status_t error = _kern_read_stat(dir, entry, false, &st, sizeof(st)); - if (error != FSSH_B_OK) { - if (force && error == FSSH_B_ENTRY_NOT_FOUND) - return FSSH_B_OK; - - fprintf(stderr, "Error: Failed to remove \"%s\": %s\n", entry, - fssh_strerror(error)); - return error; - } - - if (FSSH_S_ISDIR(st.fssh_st_mode)) { - if (!recursive) { - fprintf(stderr, "Error: \"%s\" is a directory.\n", entry); - // TODO: get the full path - return FSSH_EISDIR; - } - - // remove the contents - error = remove_dir_contents(dir, entry, force); - if (error != FSSH_B_OK) - return error; - - // remove the directory - error = _kern_remove_dir(dir, entry); - if (error != FSSH_B_OK) { - fprintf(stderr, "Error: Failed to remove directory \"%s\": %s\n", - entry, fssh_strerror(error)); - return error; - } - } else { - // remove the entry - error = _kern_unlink(dir, entry); - if (error != FSSH_B_OK) { - fprintf(stderr, "Error: Failed to remove entry \"%s\": %s\n", entry, - fssh_strerror(error)); - return error; - } - } - - return FSSH_B_OK; -} - - -static fssh_status_t command_rm(int argc, char **argv) { bool recursive = false; @@ -1021,6 +1094,7 @@ command_chmod, "chmod", "change file permissions", command_cp, "cp", "copy files and directories", command_help, "help", "list supported commands", + command_info, "info", "prints volume informations", command_ln, "ln", "create a hard or symbolic link", command_ls, "ls", "list files or directories", command_mkdir, "mkdir", "create directories", @@ -1420,7 +1494,6 @@ if (startOffset != 0 || endOffset != -1) add_file_restriction(device, startOffset, endOffset); - // start the action int result; if (initialize) { From axeld at mail.berlios.de Wed Nov 12 13:36:33 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Wed, 12 Nov 2008 13:36:33 +0100 Subject: [Haiku-commits] r28625 - haiku/trunk/headers/posix/netinet Message-ID: <200811121236.mACCaXYF021088@sheep.berlios.de> Author: axeld Date: 2008-11-12 13:36:32 +0100 (Wed, 12 Nov 2008) New Revision: 28625 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28625&view=rev Modified: haiku/trunk/headers/posix/netinet/in.h Log: * Replaced INADDR_ANY, INADDR_BROADCAST, and INADDR_NONE with constants, as the endian doesn't matter for them. While I consider code that relies on this as broken (as they don't follow the standard), it doesn't hurt, anyway; this closes ticket #3121. * Header cleanup, added license. Modified: haiku/trunk/headers/posix/netinet/in.h =================================================================== --- haiku/trunk/headers/posix/netinet/in.h 2008-11-12 12:03:58 UTC (rev 28624) +++ haiku/trunk/headers/posix/netinet/in.h 2008-11-12 12:36:32 UTC (rev 28625) @@ -1,16 +1,20 @@ -/* in.h */ - +/* + * Copyright 2002-2008, Haiku, Inc. All Rights Reserved. + * Distributed under the terms of the MIT License. + */ #ifndef _NETINET_IN_H_ #define _NETINET_IN_H_ -#include + #include #include #include +#include /* RFC 2553 states that these must be available through */ #include + #ifdef __cplusplus extern "C" { #endif @@ -41,40 +45,36 @@ #endif -/* Protocol definitions - add to as required... */ -#define IPPROTO_IP 0 /* 0, IPv4 */ -#define IPPROTO_ICMP 1 /* 1, ICMP (v4) */ -#define IPPROTO_IGMP 2 /* 2, IGMP (group management) */ -#define IPPROTO_TCP 6 /* 6, tcp */ -#define IPPROTO_UDP 17 /* 17, UDP */ -#define IPPROTO_IPV6 41 /* 41, IPv6 in IPv6 */ -#define IPPROTO_ROUTING 43 /* 43, Routing */ -#define IPPROTO_ICMPV6 58 /* 58, IPv6 ICMP */ -#define IPPROTO_ETHERIP 97 /* 97, Ethernet in IPv4 */ -#define IPPROTO_RAW 255 /* 255 */ +/* Protocol definitions */ +#define IPPROTO_IP 0 /* 0, IPv4 */ +#define IPPROTO_ICMP 1 /* 1, ICMP (v4) */ +#define IPPROTO_IGMP 2 /* 2, IGMP (group management) */ +#define IPPROTO_TCP 6 /* 6, tcp */ +#define IPPROTO_UDP 17 /* 17, UDP */ +#define IPPROTO_IPV6 41 /* 41, IPv6 in IPv6 */ +#define IPPROTO_ROUTING 43 /* 43, Routing */ +#define IPPROTO_ICMPV6 58 /* 58, IPv6 ICMP */ +#define IPPROTO_ETHERIP 97 /* 97, Ethernet in IPv4 */ +#define IPPROTO_RAW 255 /* 255 */ -#define IPPROTO_MAX 256 +#define IPPROTO_MAX 256 -/* Port numbers... - * < IPPORT_RESERVED are privileged and should be - * accessible only by root - * > IPPORT_USERRESERVED are reserved for servers, though - * not requiring privileged status - */ -#define IPPORT_RESERVED 1024 -#define IPPORT_USERRESERVED 49151 +/* Port numbers */ -/* This is an IPv4 address structure. Why is it a structure? - * Historical reasons. - */ +#define IPPORT_RESERVED 1024 + /* < IPPORT_RESERVED are privileged and should be accessible only by root */ +#define IPPORT_USERRESERVED 49151 + /* > IPPORT_USERRESERVED are reserved for servers, though not requiring + * privileged status + */ + +/* IP Version 4 address */ struct in_addr { in_addr_t s_addr; }; -/* - * IP Version 4 socket address. - */ +/* IP Version 4 socket address */ struct sockaddr_in { uint8_t sin_len; uint8_t sin_family; @@ -82,8 +82,8 @@ struct in_addr sin_addr; int8_t sin_zero[24]; }; -/* the address is therefore at sin_addr.s_addr */ + /* RFC 3678 - Socket Interface Extensions for Multicast Source Filters */ struct ip_mreq { @@ -112,94 +112,98 @@ * Options for use with [gs]etsockopt at the IP level. * First word of comment is data type; bool is stored in int. */ -#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ -#define IP_HDRINCL 2 /* int; header is included with data */ -#define IP_TOS 3 /* int; IP type of service and preced. */ -#define IP_TTL 4 /* int; IP time to live */ -#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ -#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ -#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ -#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ -#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */ -#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ -#define IP_MULTICAST_LOOP 11 /* u_char; set/get IP multicast loopback */ -#define IP_ADD_MEMBERSHIP 12 /* ip_mreq; add an IP group membership */ -#define IP_DROP_MEMBERSHIP 13 /* ip_mreq; drop an IP group membership */ -#define IP_BLOCK_SOURCE 14 /* ip_mreq_source */ -#define IP_UNBLOCK_SOURCE 15 /* ip_mreq_source */ -#define IP_ADD_SOURCE_MEMBERSHIP 16 /* ip_mreq_source */ -#define IP_DROP_SOURCE_MEMBERSHIP 17 /* ip_mreq_source */ -#define MCAST_JOIN_GROUP 18 /* group_req */ -#define MCAST_BLOCK_SOURCE 19 /* group_source_req */ -#define MCAST_UNBLOCK_SOURCE 20 /* group_source_req */ -#define MCAST_LEAVE_GROUP 21 /* group_req */ -#define MCAST_JOIN_SOURCE_GROUP 22 /* group_source_req */ -#define MCAST_LEAVE_SOURCE_GROUP 23 /* group_source_req */ +#define IP_OPTIONS 1 /* buf/ip_opts; set/get IP options */ +#define IP_HDRINCL 2 /* int; header is included with data */ +#define IP_TOS 3 + /* int; IP type of service and preced. */ +#define IP_TTL 4 /* int; IP time to live */ +#define IP_RECVOPTS 5 /* bool; receive all IP opts w/dgram */ +#define IP_RECVRETOPTS 6 /* bool; receive IP opts for response */ +#define IP_RECVDSTADDR 7 /* bool; receive IP dst addr w/dgram */ +#define IP_RETOPTS 8 /* ip_opts; set/get IP options */ +#define IP_MULTICAST_IF 9 /* in_addr; set/get IP multicast i/f */ +#define IP_MULTICAST_TTL 10 /* u_char; set/get IP multicast ttl */ +#define IP_MULTICAST_LOOP 11 + /* u_char; set/get IP multicast loopback */ +#define IP_ADD_MEMBERSHIP 12 + /* ip_mreq; add an IP group membership */ +#define IP_DROP_MEMBERSHIP 13 + /* ip_mreq; drop an IP group membership */ +#define IP_BLOCK_SOURCE 14 /* ip_mreq_source */ +#define IP_UNBLOCK_SOURCE 15 /* ip_mreq_source */ +#define IP_ADD_SOURCE_MEMBERSHIP 16 /* ip_mreq_source */ +#define IP_DROP_SOURCE_MEMBERSHIP 17 /* ip_mreq_source */ +#define MCAST_JOIN_GROUP 18 /* group_req */ +#define MCAST_BLOCK_SOURCE 19 /* group_source_req */ +#define MCAST_UNBLOCK_SOURCE 20 /* group_source_req */ +#define MCAST_LEAVE_GROUP 21 /* group_req */ +#define MCAST_JOIN_SOURCE_GROUP 22 /* group_source_req */ +#define MCAST_LEAVE_SOURCE_GROUP 23 /* group_source_req */ -#define IPV6_MULTICAST_IF 24 /* int */ -#define IPV6_MULTICAST_HOPS 25 /* int */ -#define IPV6_MULTICAST_LOOP 26 /* int */ +#define IPV6_MULTICAST_IF 24 /* int */ +#define IPV6_MULTICAST_HOPS 25 /* int */ +#define IPV6_MULTICAST_LOOP 26 /* int */ -#define __IPADDR(x) ((uint32_t)htonl((uint32_t)(x))) +#define __IPADDR(x) ((uint32_t)htonl((uint32_t)(x))) -#define INADDR_ANY __IPADDR(0x00000000) -#define INADDR_LOOPBACK __IPADDR(0x7f000001) -#define INADDR_BROADCAST __IPADDR(0xffffffff) /* must be masked */ +#define INADDR_ANY 0x00000000 +#define INADDR_LOOPBACK __IPADDR(0x7f000001) +#define INADDR_BROADCAST 0xffffffff /* must be masked */ -#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */ -#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */ -#define INADDR_ALLROUTERS_GROUP __IPADDR(0xe0000002) /* 224.0.0.2 */ -#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */ +#define INADDR_UNSPEC_GROUP __IPADDR(0xe0000000) /* 224.0.0.0 */ +#define INADDR_ALLHOSTS_GROUP __IPADDR(0xe0000001) /* 224.0.0.1 */ +#define INADDR_ALLROUTERS_GROUP __IPADDR(0xe0000002) /* 224.0.0.2 */ +#define INADDR_MAX_LOCAL_GROUP __IPADDR(0xe00000ff) /* 224.0.0.255 */ -#define IN_LOOPBACKNET 127 /* official! */ +#define IN_LOOPBACKNET 127 /* official! */ -#define INADDR_NONE __IPADDR(0xffffffff) +#define INADDR_NONE 0xffffffff -#define IN_CLASSA(i) (((uint32_t)(i) & __IPADDR(0x80000000)) == \ - __IPADDR(0x00000000)) -#define IN_CLASSA_NET __IPADDR(0xff000000) -#define IN_CLASSA_NSHIFT 24 -#define IN_CLASSA_HOST __IPADDR(0x00ffffff) -#define IN_CLASSA_MAX 128 +#define IN_CLASSA(i) (((uint32_t)(i) & __IPADDR(0x80000000)) == \ + __IPADDR(0x00000000)) +#define IN_CLASSA_NET __IPADDR(0xff000000) +#define IN_CLASSA_NSHIFT 24 +#define IN_CLASSA_HOST __IPADDR(0x00ffffff) +#define IN_CLASSA_MAX 128 -#define IN_CLASSB(i) (((uint32_t)(i) & __IPADDR(0xc0000000)) == \ - __IPADDR(0x80000000)) -#define IN_CLASSB_NET __IPADDR(0xffff0000) -#define IN_CLASSB_NSHIFT 16 -#define IN_CLASSB_HOST __IPADDR(0x0000ffff) -#define IN_CLASSB_MAX 65536 +#define IN_CLASSB(i) (((uint32_t)(i) & __IPADDR(0xc0000000)) == \ + __IPADDR(0x80000000)) +#define IN_CLASSB_NET __IPADDR(0xffff0000) +#define IN_CLASSB_NSHIFT 16 +#define IN_CLASSB_HOST __IPADDR(0x0000ffff) +#define IN_CLASSB_MAX 65536 -#define IN_CLASSC(i) (((uint32_t)(i) & __IPADDR(0xe0000000)) == \ - __IPADDR(0xc0000000)) -#define IN_CLASSC_NET __IPADDR(0xffffff00) -#define IN_CLASSC_NSHIFT 8 -#define IN_CLASSC_HOST __IPADDR(0x000000ff) +#define IN_CLASSC(i) (((uint32_t)(i) & __IPADDR(0xe0000000)) == \ + __IPADDR(0xc0000000)) +#define IN_CLASSC_NET __IPADDR(0xffffff00) +#define IN_CLASSC_NSHIFT 8 +#define IN_CLASSC_HOST __IPADDR(0x000000ff) -#define IN_CLASSD(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \ - __IPADDR(0xe0000000)) +#define IN_CLASSD(i) (((uint32_t)(i) & __IPADDR(0xf0000000)) == \ + __IPADDR(0xe0000000)) /* These ones aren't really net and host fields, but routing needn't know. */ -#define IN_CLASSD_NET __IPADDR(0xf0000000) -#define IN_CLASSD_NSHIFT 28 -#define IN_CLASSD_HOST __IPADDR(0x0fffffff) +#define IN_CLASSD_NET __IPADDR(0xf0000000) +#define IN_CLASSD_NSHIFT 28 +#define IN_CLASSD_HOST __IPADDR(0x0fffffff) -#define IN_MULTICAST(i) IN_CLASSD(i) +#define IN_MULTICAST(i) IN_CLASSD(i) -#define IN_EXPERIMENTAL(i) (((uint32_t)(i) & 0xf0000000) == 0xf0000000) -#define IN_BADCLASS(i) (((uint32_t)(i) & 0xf0000000) == 0xf0000000) +#define IN_EXPERIMENTAL(i) (((uint32_t)(i) & 0xf0000000) == 0xf0000000) +#define IN_BADCLASS(i) (((uint32_t)(i) & 0xf0000000) == 0xf0000000) -#define IP_MAX_MEMBERSHIPS 20 +#define IP_MAX_MEMBERSHIPS 20 /* maximal length of the string representation of an IPv4 address */ #define INET_ADDRSTRLEN 16 /* some helpful macro's :) */ -#define in_hosteq(s,t) ((s).s_addr == (t).s_addr) -#define in_nullhost(x) ((x).s_addr == INADDR_ANY) -#define satosin(sa) ((struct sockaddr_in *)(sa)) -#define sintosa(sin) ((struct sockaddr *)(sin)) +#define in_hosteq(s, t) ((s).s_addr == (t).s_addr) +#define in_nullhost(x) ((x).s_addr == INADDR_ANY) +#define satosin(sa) ((struct sockaddr_in *)(sa)) +#define sintosa(sin) ((struct sockaddr *)(sin)) #ifdef __cplusplus } #endif -#endif /* NETINET_IN_H */ +#endif /* _NETINET_IN_H_ */ From zooey at mail.berlios.de Wed Nov 12 17:49:15 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 12 Nov 2008 17:49:15 +0100 Subject: [Haiku-commits] r28626 - in haiku/vendor: . libiconv libiconv/current libiconv/current/build-aux libiconv/current/djgpp libiconv/current/doc libiconv/current/extras libiconv/current/gnulib-local libiconv/current/gnulib-local/lib libiconv/current/gnulib-local/m4 libiconv/current/gnulib-local/modules libiconv/current/include libiconv/current/lib libiconv/current/libcharset libiconv/current/libcharset/autoconf libiconv/current/libcharset/build-aux libiconv/current/libcharset/djgpp libiconv/current/libcharset/include libiconv/current/libcharset/lib libiconv/current/libcharset/m4 libiconv/current/libcharset/tools libiconv/current/m4 libiconv/current/man libiconv/current/os2 libiconv/current/po libiconv/current/src libiconv/current/srclib libiconv/current/srclib/uniwidth libiconv/current/srcm4 libiconv/current/tests libiconv/current/tools libiconv/current/windows libiconv/current/woe32dll Message-ID: <200811121649.mACGnF4Z018401@sheep.berlios.de> Author: zooey Date: 2008-11-12 17:47:47 +0100 (Wed, 12 Nov 2008) New Revision: 28626 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28626&view=rev Added: haiku/vendor/libiconv/ haiku/vendor/libiconv/current/ haiku/vendor/libiconv/current/ABOUT-NLS haiku/vendor/libiconv/current/AUTHORS haiku/vendor/libiconv/current/COPYING haiku/vendor/libiconv/current/COPYING.LIB haiku/vendor/libiconv/current/ChangeLog haiku/vendor/libiconv/current/DEPENDENCIES haiku/vendor/libiconv/current/DESIGN haiku/vendor/libiconv/current/HACKING haiku/vendor/libiconv/current/INSTALL.generic haiku/vendor/libiconv/current/Makefile.devel haiku/vendor/libiconv/current/Makefile.in haiku/vendor/libiconv/current/NEWS haiku/vendor/libiconv/current/NOTES haiku/vendor/libiconv/current/PORTS haiku/vendor/libiconv/current/README haiku/vendor/libiconv/current/README.djgpp haiku/vendor/libiconv/current/README.woe32 haiku/vendor/libiconv/current/THANKS haiku/vendor/libiconv/current/aclocal.m4 haiku/vendor/libiconv/current/autogen.sh haiku/vendor/libiconv/current/build-aux/ haiku/vendor/libiconv/current/build-aux/config.guess haiku/vendor/libiconv/current/build-aux/config.libpath haiku/vendor/libiconv/current/build-aux/config.rpath haiku/vendor/libiconv/current/build-aux/config.sub haiku/vendor/libiconv/current/build-aux/install-reloc haiku/vendor/libiconv/current/build-aux/install-sh haiku/vendor/libiconv/current/build-aux/link-warning.h haiku/vendor/libiconv/current/build-aux/ltmain.sh haiku/vendor/libiconv/current/build-aux/missing haiku/vendor/libiconv/current/build-aux/mkinstalldirs haiku/vendor/libiconv/current/build-aux/reloc-ldflags haiku/vendor/libiconv/current/config.h.in haiku/vendor/libiconv/current/configure haiku/vendor/libiconv/current/configure.ac haiku/vendor/libiconv/current/djgpp/ haiku/vendor/libiconv/current/djgpp/Makefile.maint haiku/vendor/libiconv/current/djgpp/README haiku/vendor/libiconv/current/djgpp/README.in haiku/vendor/libiconv/current/djgpp/config.bat haiku/vendor/libiconv/current/djgpp/config.sed haiku/vendor/libiconv/current/djgpp/config.site haiku/vendor/libiconv/current/djgpp/edtest.bat haiku/vendor/libiconv/current/djgpp/fnchange.in haiku/vendor/libiconv/current/djgpp/fnchange.lst haiku/vendor/libiconv/current/djgpp/makefile.sed haiku/vendor/libiconv/current/djgpp/sources.sed haiku/vendor/libiconv/current/djgpp/stateful-check.sed haiku/vendor/libiconv/current/djgpp/stateless-check.sed haiku/vendor/libiconv/current/djgpp/translit-check.sed haiku/vendor/libiconv/current/doc/ haiku/vendor/libiconv/current/doc/relocatable.texi haiku/vendor/libiconv/current/extras/ haiku/vendor/libiconv/current/extras/ChangeLog haiku/vendor/libiconv/current/extras/iconv_string.c haiku/vendor/libiconv/current/extras/iconv_string.h haiku/vendor/libiconv/current/gnulib-local/ haiku/vendor/libiconv/current/gnulib-local/lib/ haiku/vendor/libiconv/current/gnulib-local/lib/alloca.in.h haiku/vendor/libiconv/current/gnulib-local/lib/error.h.diff haiku/vendor/libiconv/current/gnulib-local/lib/progname.h.diff haiku/vendor/libiconv/current/gnulib-local/lib/xalloc.h haiku/vendor/libiconv/current/gnulib-local/lib/xmalloc.c haiku/vendor/libiconv/current/gnulib-local/lib/xstrdup.c haiku/vendor/libiconv/current/gnulib-local/m4/ haiku/vendor/libiconv/current/gnulib-local/m4/alloca.m4 haiku/vendor/libiconv/current/gnulib-local/modules/ haiku/vendor/libiconv/current/gnulib-local/modules/libiconv-misc haiku/vendor/libiconv/current/gnulib-local/modules/mbstate haiku/vendor/libiconv/current/gnulib-local/modules/xalloc haiku/vendor/libiconv/current/include/ haiku/vendor/libiconv/current/include/export.h haiku/vendor/libiconv/current/include/iconv.h.build.in haiku/vendor/libiconv/current/include/iconv.h.in haiku/vendor/libiconv/current/lib/ haiku/vendor/libiconv/current/lib/Makefile.in haiku/vendor/libiconv/current/lib/aliases.gperf haiku/vendor/libiconv/current/lib/aliases.h haiku/vendor/libiconv/current/lib/aliases2.h haiku/vendor/libiconv/current/lib/aliases_aix.h haiku/vendor/libiconv/current/lib/aliases_dos.h haiku/vendor/libiconv/current/lib/aliases_extra.h haiku/vendor/libiconv/current/lib/aliases_osf1.h haiku/vendor/libiconv/current/lib/armscii_8.h haiku/vendor/libiconv/current/lib/ascii.h haiku/vendor/libiconv/current/lib/atarist.h haiku/vendor/libiconv/current/lib/big5.h haiku/vendor/libiconv/current/lib/big5_2003.h haiku/vendor/libiconv/current/lib/big5hkscs1999.h haiku/vendor/libiconv/current/lib/big5hkscs2001.h haiku/vendor/libiconv/current/lib/big5hkscs2004.h haiku/vendor/libiconv/current/lib/c99.h haiku/vendor/libiconv/current/lib/canonical.h haiku/vendor/libiconv/current/lib/canonical_aix.h haiku/vendor/libiconv/current/lib/canonical_dos.h haiku/vendor/libiconv/current/lib/canonical_extra.h haiku/vendor/libiconv/current/lib/canonical_local.h haiku/vendor/libiconv/current/lib/canonical_osf1.h haiku/vendor/libiconv/current/lib/ces_big5.h haiku/vendor/libiconv/current/lib/ces_gbk.h haiku/vendor/libiconv/current/lib/cjk_variants.h haiku/vendor/libiconv/current/lib/cns11643.h haiku/vendor/libiconv/current/lib/cns11643_1.h haiku/vendor/libiconv/current/lib/cns11643_15.h haiku/vendor/libiconv/current/lib/cns11643_2.h haiku/vendor/libiconv/current/lib/cns11643_3.h haiku/vendor/libiconv/current/lib/cns11643_4.h haiku/vendor/libiconv/current/lib/cns11643_4a.h haiku/vendor/libiconv/current/lib/cns11643_4b.h haiku/vendor/libiconv/current/lib/cns11643_5.h haiku/vendor/libiconv/current/lib/cns11643_6.h haiku/vendor/libiconv/current/lib/cns11643_7.h haiku/vendor/libiconv/current/lib/cns11643_inv.h haiku/vendor/libiconv/current/lib/config.h.in haiku/vendor/libiconv/current/lib/converters.h haiku/vendor/libiconv/current/lib/cp1046.h haiku/vendor/libiconv/current/lib/cp1124.h haiku/vendor/libiconv/current/lib/cp1125.h haiku/vendor/libiconv/current/lib/cp1129.h haiku/vendor/libiconv/current/lib/cp1133.h haiku/vendor/libiconv/current/lib/cp1161.h haiku/vendor/libiconv/current/lib/cp1162.h haiku/vendor/libiconv/current/lib/cp1163.h haiku/vendor/libiconv/current/lib/cp1250.h haiku/vendor/libiconv/current/lib/cp1251.h haiku/vendor/libiconv/current/lib/cp1252.h haiku/vendor/libiconv/current/lib/cp1253.h haiku/vendor/libiconv/current/lib/cp1254.h haiku/vendor/libiconv/current/lib/cp1255.h haiku/vendor/libiconv/current/lib/cp1256.h haiku/vendor/libiconv/current/lib/cp1257.h haiku/vendor/libiconv/current/lib/cp1258.h haiku/vendor/libiconv/current/lib/cp437.h haiku/vendor/libiconv/current/lib/cp737.h haiku/vendor/libiconv/current/lib/cp775.h haiku/vendor/libiconv/current/lib/cp850.h haiku/vendor/libiconv/current/lib/cp852.h haiku/vendor/libiconv/current/lib/cp853.h haiku/vendor/libiconv/current/lib/cp855.h haiku/vendor/libiconv/current/lib/cp856.h haiku/vendor/libiconv/current/lib/cp857.h haiku/vendor/libiconv/current/lib/cp858.h haiku/vendor/libiconv/current/lib/cp860.h haiku/vendor/libiconv/current/lib/cp861.h haiku/vendor/libiconv/current/lib/cp862.h haiku/vendor/libiconv/current/lib/cp863.h haiku/vendor/libiconv/current/lib/cp864.h haiku/vendor/libiconv/current/lib/cp865.h haiku/vendor/libiconv/current/lib/cp866.h haiku/vendor/libiconv/current/lib/cp869.h haiku/vendor/libiconv/current/lib/cp874.h haiku/vendor/libiconv/current/lib/cp922.h haiku/vendor/libiconv/current/lib/cp932.h haiku/vendor/libiconv/current/lib/cp932ext.h haiku/vendor/libiconv/current/lib/cp936.h haiku/vendor/libiconv/current/lib/cp936ext.h haiku/vendor/libiconv/current/lib/cp943.h haiku/vendor/libiconv/current/lib/cp949.h haiku/vendor/libiconv/current/lib/cp950.h haiku/vendor/libiconv/current/lib/cp950ext.h haiku/vendor/libiconv/current/lib/dec_hanyu.h haiku/vendor/libiconv/current/lib/dec_kanji.h haiku/vendor/libiconv/current/lib/encodings.def haiku/vendor/libiconv/current/lib/encodings_aix.def haiku/vendor/libiconv/current/lib/encodings_dos.def haiku/vendor/libiconv/current/lib/encodings_extra.def haiku/vendor/libiconv/current/lib/encodings_local.def haiku/vendor/libiconv/current/lib/encodings_osf1.def haiku/vendor/libiconv/current/lib/euc_cn.h haiku/vendor/libiconv/current/lib/euc_jisx0213.h haiku/vendor/libiconv/current/lib/euc_jp.h haiku/vendor/libiconv/current/lib/euc_kr.h haiku/vendor/libiconv/current/lib/euc_tw.h haiku/vendor/libiconv/current/lib/flags.h haiku/vendor/libiconv/current/lib/flushwc.h haiku/vendor/libiconv/current/lib/gb12345.h haiku/vendor/libiconv/current/lib/gb12345ext.h haiku/vendor/libiconv/current/lib/gb18030.h haiku/vendor/libiconv/current/lib/gb18030ext.h haiku/vendor/libiconv/current/lib/gb18030uni.h haiku/vendor/libiconv/current/lib/gb2312.h haiku/vendor/libiconv/current/lib/gbk.h haiku/vendor/libiconv/current/lib/gbkext1.h haiku/vendor/libiconv/current/lib/gbkext2.h haiku/vendor/libiconv/current/lib/gbkext_inv.h haiku/vendor/libiconv/current/lib/genaliases.c haiku/vendor/libiconv/current/lib/genaliases2.c haiku/vendor/libiconv/current/lib/genflags.c haiku/vendor/libiconv/current/lib/gentranslit.c haiku/vendor/libiconv/current/lib/georgian_academy.h haiku/vendor/libiconv/current/lib/georgian_ps.h haiku/vendor/libiconv/current/lib/hkscs1999.h haiku/vendor/libiconv/current/lib/hkscs2001.h haiku/vendor/libiconv/current/lib/hkscs2004.h haiku/vendor/libiconv/current/lib/hp_roman8.h haiku/vendor/libiconv/current/lib/hz.h haiku/vendor/libiconv/current/lib/iconv.c haiku/vendor/libiconv/current/lib/iso2022_cn.h haiku/vendor/libiconv/current/lib/iso2022_cnext.h haiku/vendor/libiconv/current/lib/iso2022_jp.h haiku/vendor/libiconv/current/lib/iso2022_jp1.h haiku/vendor/libiconv/current/lib/iso2022_jp2.h haiku/vendor/libiconv/current/lib/iso2022_jp3.h haiku/vendor/libiconv/current/lib/iso2022_kr.h haiku/vendor/libiconv/current/lib/iso646_cn.h haiku/vendor/libiconv/current/lib/iso646_jp.h haiku/vendor/libiconv/current/lib/iso8859_1.h haiku/vendor/libiconv/current/lib/iso8859_10.h haiku/vendor/libiconv/current/lib/iso8859_11.h haiku/vendor/libiconv/current/lib/iso8859_13.h haiku/vendor/libiconv/current/lib/iso8859_14.h haiku/vendor/libiconv/current/lib/iso8859_15.h haiku/vendor/libiconv/current/lib/iso8859_16.h haiku/vendor/libiconv/current/lib/iso8859_2.h haiku/vendor/libiconv/current/lib/iso8859_3.h haiku/vendor/libiconv/current/lib/iso8859_4.h haiku/vendor/libiconv/current/lib/iso8859_5.h haiku/vendor/libiconv/current/lib/iso8859_6.h haiku/vendor/libiconv/current/lib/iso8859_7.h haiku/vendor/libiconv/current/lib/iso8859_8.h haiku/vendor/libiconv/current/lib/iso8859_9.h haiku/vendor/libiconv/current/lib/isoir165.h haiku/vendor/libiconv/current/lib/isoir165ext.h haiku/vendor/libiconv/current/lib/java.h haiku/vendor/libiconv/current/lib/jisx0201.h haiku/vendor/libiconv/current/lib/jisx0208.h haiku/vendor/libiconv/current/lib/jisx0212.h haiku/vendor/libiconv/current/lib/jisx0213.h haiku/vendor/libiconv/current/lib/johab.h haiku/vendor/libiconv/current/lib/johab_hangul.h haiku/vendor/libiconv/current/lib/koi8_r.h haiku/vendor/libiconv/current/lib/koi8_ru.h haiku/vendor/libiconv/current/lib/koi8_t.h haiku/vendor/libiconv/current/lib/koi8_u.h haiku/vendor/libiconv/current/lib/ksc5601.h haiku/vendor/libiconv/current/lib/loop_unicode.h haiku/vendor/libiconv/current/lib/loop_wchar.h haiku/vendor/libiconv/current/lib/loops.h haiku/vendor/libiconv/current/lib/mac_arabic.h haiku/vendor/libiconv/current/lib/mac_centraleurope.h haiku/vendor/libiconv/current/lib/mac_croatian.h haiku/vendor/libiconv/current/lib/mac_cyrillic.h haiku/vendor/libiconv/current/lib/mac_greek.h haiku/vendor/libiconv/current/lib/mac_hebrew.h haiku/vendor/libiconv/current/lib/mac_iceland.h haiku/vendor/libiconv/current/lib/mac_roman.h haiku/vendor/libiconv/current/lib/mac_romania.h haiku/vendor/libiconv/current/lib/mac_thai.h haiku/vendor/libiconv/current/lib/mac_turkish.h haiku/vendor/libiconv/current/lib/mac_ukraine.h haiku/vendor/libiconv/current/lib/mulelao.h haiku/vendor/libiconv/current/lib/nextstep.h haiku/vendor/libiconv/current/lib/pt154.h haiku/vendor/libiconv/current/lib/relocatable.c haiku/vendor/libiconv/current/lib/relocatable.h haiku/vendor/libiconv/current/lib/riscos1.h haiku/vendor/libiconv/current/lib/rk1048.h haiku/vendor/libiconv/current/lib/shift_jisx0213.h haiku/vendor/libiconv/current/lib/sjis.h haiku/vendor/libiconv/current/lib/tcvn.h haiku/vendor/libiconv/current/lib/tds565.h haiku/vendor/libiconv/current/lib/tis620.h haiku/vendor/libiconv/current/lib/translit.def haiku/vendor/libiconv/current/lib/translit.h haiku/vendor/libiconv/current/lib/ucs2.h haiku/vendor/libiconv/current/lib/ucs2be.h haiku/vendor/libiconv/current/lib/ucs2internal.h haiku/vendor/libiconv/current/lib/ucs2le.h haiku/vendor/libiconv/current/lib/ucs2swapped.h haiku/vendor/libiconv/current/lib/ucs4.h haiku/vendor/libiconv/current/lib/ucs4be.h haiku/vendor/libiconv/current/lib/ucs4internal.h haiku/vendor/libiconv/current/lib/ucs4le.h haiku/vendor/libiconv/current/lib/ucs4swapped.h haiku/vendor/libiconv/current/lib/uhc_1.h haiku/vendor/libiconv/current/lib/uhc_2.h haiku/vendor/libiconv/current/lib/utf16.h haiku/vendor/libiconv/current/lib/utf16be.h haiku/vendor/libiconv/current/lib/utf16le.h haiku/vendor/libiconv/current/lib/utf32.h haiku/vendor/libiconv/current/lib/utf32be.h haiku/vendor/libiconv/current/lib/utf32le.h haiku/vendor/libiconv/current/lib/utf7.h haiku/vendor/libiconv/current/lib/utf8.h haiku/vendor/libiconv/current/lib/vietcomb.h haiku/vendor/libiconv/current/lib/viscii.h haiku/vendor/libiconv/current/libcharset/ haiku/vendor/libiconv/current/libcharset/AUTHORS haiku/vendor/libiconv/current/libcharset/COPYING.LIB haiku/vendor/libiconv/current/libcharset/ChangeLog haiku/vendor/libiconv/current/libcharset/DEPENDENCIES haiku/vendor/libiconv/current/libcharset/HACKING haiku/vendor/libiconv/current/libcharset/INSTALL.generic haiku/vendor/libiconv/current/libcharset/INTEGRATE haiku/vendor/libiconv/current/libcharset/Makefile.devel haiku/vendor/libiconv/current/libcharset/Makefile.in haiku/vendor/libiconv/current/libcharset/NEWS haiku/vendor/libiconv/current/libcharset/README haiku/vendor/libiconv/current/libcharset/README.djgpp haiku/vendor/libiconv/current/libcharset/README.woe32 haiku/vendor/libiconv/current/libcharset/autoconf/ haiku/vendor/libiconv/current/libcharset/autoconf/aclocal.m4 haiku/vendor/libiconv/current/libcharset/autogen.sh haiku/vendor/libiconv/current/libcharset/build-aux/ haiku/vendor/libiconv/current/libcharset/build-aux/config.guess haiku/vendor/libiconv/current/libcharset/build-aux/config.libpath haiku/vendor/libiconv/current/libcharset/build-aux/config.sub haiku/vendor/libiconv/current/libcharset/build-aux/install-sh haiku/vendor/libiconv/current/libcharset/build-aux/ltmain.sh haiku/vendor/libiconv/current/libcharset/build-aux/mkinstalldirs haiku/vendor/libiconv/current/libcharset/config.h.in haiku/vendor/libiconv/current/libcharset/configure haiku/vendor/libiconv/current/libcharset/configure.ac haiku/vendor/libiconv/current/libcharset/djgpp/ haiku/vendor/libiconv/current/libcharset/djgpp/Makefile.maint haiku/vendor/libiconv/current/libcharset/djgpp/README haiku/vendor/libiconv/current/libcharset/djgpp/README.in haiku/vendor/libiconv/current/libcharset/djgpp/config.bat haiku/vendor/libiconv/current/libcharset/djgpp/config.sed haiku/vendor/libiconv/current/libcharset/djgpp/config.site haiku/vendor/libiconv/current/libcharset/djgpp/fnchange.in haiku/vendor/libiconv/current/libcharset/djgpp/fnchange.lst haiku/vendor/libiconv/current/libcharset/include/ haiku/vendor/libiconv/current/libcharset/include/export.h haiku/vendor/libiconv/current/libcharset/include/libcharset.h.in haiku/vendor/libiconv/current/libcharset/include/localcharset.h.build.in haiku/vendor/libiconv/current/libcharset/include/localcharset.h.in haiku/vendor/libiconv/current/libcharset/lib/ haiku/vendor/libiconv/current/libcharset/lib/ChangeLog haiku/vendor/libiconv/current/libcharset/lib/Makefile.in haiku/vendor/libiconv/current/libcharset/lib/config.charset haiku/vendor/libiconv/current/libcharset/lib/localcharset.c haiku/vendor/libiconv/current/libcharset/lib/ref-add.sin haiku/vendor/libiconv/current/libcharset/lib/ref-del.sin haiku/vendor/libiconv/current/libcharset/lib/relocatable.c haiku/vendor/libiconv/current/libcharset/lib/relocatable.h haiku/vendor/libiconv/current/libcharset/m4/ haiku/vendor/libiconv/current/libcharset/m4/codeset.m4 haiku/vendor/libiconv/current/libcharset/m4/glibc21.m4 haiku/vendor/libiconv/current/libcharset/m4/libtool.m4 haiku/vendor/libiconv/current/libcharset/m4/relocatable-lib.m4 haiku/vendor/libiconv/current/libcharset/m4/visibility.m4 haiku/vendor/libiconv/current/libcharset/tools/ haiku/vendor/libiconv/current/libcharset/tools/README haiku/vendor/libiconv/current/libcharset/tools/aix-3.2.5 haiku/vendor/libiconv/current/libcharset/tools/aix-4.1.5 haiku/vendor/libiconv/current/libcharset/tools/aix-4.2.0 haiku/vendor/libiconv/current/libcharset/tools/aix-4.3.2 haiku/vendor/libiconv/current/libcharset/tools/all-charsets haiku/vendor/libiconv/current/libcharset/tools/all-charsets-X11 haiku/vendor/libiconv/current/libcharset/tools/all-locales haiku/vendor/libiconv/current/libcharset/tools/beos-5 haiku/vendor/libiconv/current/libcharset/tools/darwin-6.8 haiku/vendor/libiconv/current/libcharset/tools/darwin-7.5 haiku/vendor/libiconv/current/libcharset/tools/freebsd-3.3 haiku/vendor/libiconv/current/libcharset/tools/glibc-2.1.3 haiku/vendor/libiconv/current/libcharset/tools/glibc-2.1.90 haiku/vendor/libiconv/current/libcharset/tools/glibc-2.2 haiku/vendor/libiconv/current/libcharset/tools/glibc-2.2-XF86-3.3.6 haiku/vendor/libiconv/current/libcharset/tools/glibc-2.2-XF86-4.0.1f haiku/vendor/libiconv/current/libcharset/tools/hpux-10.01 haiku/vendor/libiconv/current/libcharset/tools/hpux-10.20 haiku/vendor/libiconv/current/libcharset/tools/hpux-11.00 haiku/vendor/libiconv/current/libcharset/tools/irix-6.5 haiku/vendor/libiconv/current/libcharset/tools/locale_charmap haiku/vendor/libiconv/current/libcharset/tools/locale_charset.c haiku/vendor/libiconv/current/libcharset/tools/locale_codeset.c haiku/vendor/libiconv/current/libcharset/tools/locale_x11encoding.c haiku/vendor/libiconv/current/libcharset/tools/netbsd-3.0 haiku/vendor/libiconv/current/libcharset/tools/osf1-4.0a haiku/vendor/libiconv/current/libcharset/tools/osf1-4.0d haiku/vendor/libiconv/current/libcharset/tools/osf1-5.1 haiku/vendor/libiconv/current/libcharset/tools/solaris-2.4 haiku/vendor/libiconv/current/libcharset/tools/solaris-2.5.1 haiku/vendor/libiconv/current/libcharset/tools/solaris-2.6 haiku/vendor/libiconv/current/libcharset/tools/solaris-2.6-cjk haiku/vendor/libiconv/current/libcharset/tools/solaris-2.7 haiku/vendor/libiconv/current/libcharset/tools/sunos-4.1.4 haiku/vendor/libiconv/current/libcharset/tools/win32 haiku/vendor/libiconv/current/m4/ haiku/vendor/libiconv/current/m4/cp.m4 haiku/vendor/libiconv/current/m4/eilseq.m4 haiku/vendor/libiconv/current/m4/endian.m4 haiku/vendor/libiconv/current/m4/general.m4 haiku/vendor/libiconv/current/m4/libtool.m4 haiku/vendor/libiconv/current/m4/ln.m4 haiku/vendor/libiconv/current/m4/proto.m4 haiku/vendor/libiconv/current/man/ haiku/vendor/libiconv/current/man/Makefile.in haiku/vendor/libiconv/current/man/iconv.1 haiku/vendor/libiconv/current/man/iconv.1.html haiku/vendor/libiconv/current/man/iconv.3 haiku/vendor/libiconv/current/man/iconv.3.html haiku/vendor/libiconv/current/man/iconv_close.3 haiku/vendor/libiconv/current/man/iconv_close.3.html haiku/vendor/libiconv/current/man/iconv_open.3 haiku/vendor/libiconv/current/man/iconv_open.3.html haiku/vendor/libiconv/current/man/iconvctl.3 haiku/vendor/libiconv/current/man/iconvctl.3.html haiku/vendor/libiconv/current/os2/ haiku/vendor/libiconv/current/os2/iconv.def haiku/vendor/libiconv/current/po/ haiku/vendor/libiconv/current/po/ChangeLog haiku/vendor/libiconv/current/po/LINGUAS haiku/vendor/libiconv/current/po/Makefile.in.in haiku/vendor/libiconv/current/po/Makevars haiku/vendor/libiconv/current/po/POTFILES.in haiku/vendor/libiconv/current/po/Rules-quot haiku/vendor/libiconv/current/po/af.gmo haiku/vendor/libiconv/current/po/af.po haiku/vendor/libiconv/current/po/boldquot.sed haiku/vendor/libiconv/current/po/ca.gmo haiku/vendor/libiconv/current/po/ca.po haiku/vendor/libiconv/current/po/da.gmo haiku/vendor/libiconv/current/po/da.po haiku/vendor/libiconv/current/po/de.gmo haiku/vendor/libiconv/current/po/de.po haiku/vendor/libiconv/current/po/el.gmo haiku/vendor/libiconv/current/po/el.po haiku/vendor/libiconv/current/po/en at boldquot.header haiku/vendor/libiconv/current/po/en at quot.header haiku/vendor/libiconv/current/po/eo.gmo haiku/vendor/libiconv/current/po/eo.po haiku/vendor/libiconv/current/po/es.gmo haiku/vendor/libiconv/current/po/es.po haiku/vendor/libiconv/current/po/et.gmo haiku/vendor/libiconv/current/po/et.po haiku/vendor/libiconv/current/po/fi.gmo haiku/vendor/libiconv/current/po/fi.po haiku/vendor/libiconv/current/po/fr.gmo haiku/vendor/libiconv/current/po/fr.po haiku/vendor/libiconv/current/po/ga.gmo haiku/vendor/libiconv/current/po/ga.po haiku/vendor/libiconv/current/po/gl.gmo haiku/vendor/libiconv/current/po/gl.po haiku/vendor/libiconv/current/po/hr.gmo haiku/vendor/libiconv/current/po/hr.po haiku/vendor/libiconv/current/po/hu.gmo haiku/vendor/libiconv/current/po/hu.po haiku/vendor/libiconv/current/po/id.gmo haiku/vendor/libiconv/current/po/id.po haiku/vendor/libiconv/current/po/insert-header.sin haiku/vendor/libiconv/current/po/it.gmo haiku/vendor/libiconv/current/po/it.po haiku/vendor/libiconv/current/po/libiconv.pot haiku/vendor/libiconv/current/po/nl.gmo haiku/vendor/libiconv/current/po/nl.po haiku/vendor/libiconv/current/po/pl.gmo haiku/vendor/libiconv/current/po/pl.po haiku/vendor/libiconv/current/po/pt_BR.gmo haiku/vendor/libiconv/current/po/pt_BR.po haiku/vendor/libiconv/current/po/quot.sed haiku/vendor/libiconv/current/po/remove-potcdate.sin haiku/vendor/libiconv/current/po/rm.gmo haiku/vendor/libiconv/current/po/rm.po haiku/vendor/libiconv/current/po/ro.gmo haiku/vendor/libiconv/current/po/ro.po haiku/vendor/libiconv/current/po/ru.gmo haiku/vendor/libiconv/current/po/ru.po haiku/vendor/libiconv/current/po/sk.gmo haiku/vendor/libiconv/current/po/sk.po haiku/vendor/libiconv/current/po/sl.gmo haiku/vendor/libiconv/current/po/sl.po haiku/vendor/libiconv/current/po/sq.gmo haiku/vendor/libiconv/current/po/sq.po haiku/vendor/libiconv/current/po/sr.gmo haiku/vendor/libiconv/current/po/sr.po haiku/vendor/libiconv/current/po/stamp-po haiku/vendor/libiconv/current/po/sv.gmo haiku/vendor/libiconv/current/po/sv.po haiku/vendor/libiconv/current/po/tr.gmo haiku/vendor/libiconv/current/po/tr.po haiku/vendor/libiconv/current/po/uk.gmo haiku/vendor/libiconv/current/po/uk.po haiku/vendor/libiconv/current/po/vi.gmo haiku/vendor/libiconv/current/po/vi.po haiku/vendor/libiconv/current/po/wa.gmo haiku/vendor/libiconv/current/po/wa.po haiku/vendor/libiconv/current/po/zh_CN.gmo haiku/vendor/libiconv/current/po/zh_CN.po haiku/vendor/libiconv/current/po/zh_TW.gmo haiku/vendor/libiconv/current/po/zh_TW.po haiku/vendor/libiconv/current/src/ haiku/vendor/libiconv/current/src/Makefile.in haiku/vendor/libiconv/current/src/iconv.c haiku/vendor/libiconv/current/src/iconv_no_i18n.c haiku/vendor/libiconv/current/srclib/ haiku/vendor/libiconv/current/srclib/Makefile.am haiku/vendor/libiconv/current/srclib/Makefile.gnulib haiku/vendor/libiconv/current/srclib/Makefile.in haiku/vendor/libiconv/current/srclib/alloca.in.h haiku/vendor/libiconv/current/srclib/areadlink.c haiku/vendor/libiconv/current/srclib/areadlink.h haiku/vendor/libiconv/current/srclib/binary-io.h haiku/vendor/libiconv/current/srclib/c-ctype.c haiku/vendor/libiconv/current/srclib/c-ctype.h haiku/vendor/libiconv/current/srclib/canonicalize-lgpl.c haiku/vendor/libiconv/current/srclib/canonicalize.h haiku/vendor/libiconv/current/srclib/error.c haiku/vendor/libiconv/current/srclib/error.h haiku/vendor/libiconv/current/srclib/gettext.h haiku/vendor/libiconv/current/srclib/intprops.h haiku/vendor/libiconv/current/srclib/localcharset.h haiku/vendor/libiconv/current/srclib/malloc.c haiku/vendor/libiconv/current/srclib/malloca.c haiku/vendor/libiconv/current/srclib/malloca.h haiku/vendor/libiconv/current/srclib/malloca.valgrind haiku/vendor/libiconv/current/srclib/memmove.c haiku/vendor/libiconv/current/srclib/pathmax.h haiku/vendor/libiconv/current/srclib/progname.c haiku/vendor/libiconv/current/srclib/progname.h haiku/vendor/libiconv/current/srclib/progreloc.c haiku/vendor/libiconv/current/srclib/readlink.c haiku/vendor/libiconv/current/srclib/relocatable.c haiku/vendor/libiconv/current/srclib/relocatable.h haiku/vendor/libiconv/current/srclib/relocwrapper.c haiku/vendor/libiconv/current/srclib/setenv.c haiku/vendor/libiconv/current/srclib/setenv.h haiku/vendor/libiconv/current/srclib/stdbool.in.h haiku/vendor/libiconv/current/srclib/stdint.in.h haiku/vendor/libiconv/current/srclib/stdlib.in.h haiku/vendor/libiconv/current/srclib/streq.h haiku/vendor/libiconv/current/srclib/strerror.c haiku/vendor/libiconv/current/srclib/string.in.h haiku/vendor/libiconv/current/srclib/unistd.in.h haiku/vendor/libiconv/current/srclib/unitypes.h haiku/vendor/libiconv/current/srclib/uniwidth.h haiku/vendor/libiconv/current/srclib/uniwidth/ haiku/vendor/libiconv/current/srclib/uniwidth/cjk.h haiku/vendor/libiconv/current/srclib/uniwidth/width.c haiku/vendor/libiconv/current/srclib/unlocked-io.h haiku/vendor/libiconv/current/srclib/unsetenv.c haiku/vendor/libiconv/current/srclib/wchar.in.h haiku/vendor/libiconv/current/srclib/xalloc.h haiku/vendor/libiconv/current/srclib/xmalloc.c haiku/vendor/libiconv/current/srclib/xreadlink.c haiku/vendor/libiconv/current/srclib/xreadlink.h haiku/vendor/libiconv/current/srclib/xstrdup.c haiku/vendor/libiconv/current/srcm4/ haiku/vendor/libiconv/current/srcm4/absolute-header.m4 haiku/vendor/libiconv/current/srcm4/alloca.m4 haiku/vendor/libiconv/current/srcm4/canonicalize-lgpl.m4 haiku/vendor/libiconv/current/srcm4/codeset.m4 haiku/vendor/libiconv/current/srcm4/eealloc.m4 haiku/vendor/libiconv/current/srcm4/error.m4 haiku/vendor/libiconv/current/srcm4/extensions.m4 haiku/vendor/libiconv/current/srcm4/gettext.m4 haiku/vendor/libiconv/current/srcm4/glibc2.m4 haiku/vendor/libiconv/current/srcm4/glibc21.m4 haiku/vendor/libiconv/current/srcm4/gnulib-cache.m4 haiku/vendor/libiconv/current/srcm4/gnulib-common.m4 haiku/vendor/libiconv/current/srcm4/gnulib-comp.m4 haiku/vendor/libiconv/current/srcm4/gnulib-tool.m4 haiku/vendor/libiconv/current/srcm4/iconv.m4 haiku/vendor/libiconv/current/srcm4/include_next.m4 haiku/vendor/libiconv/current/srcm4/intdiv0.m4 haiku/vendor/libiconv/current/srcm4/intl.m4 haiku/vendor/libiconv/current/srcm4/intldir.m4 haiku/vendor/libiconv/current/srcm4/intlmacosx.m4 haiku/vendor/libiconv/current/srcm4/intmax.m4 haiku/vendor/libiconv/current/srcm4/inttypes-pri.m4 haiku/vendor/libiconv/current/srcm4/inttypes_h.m4 haiku/vendor/libiconv/current/srcm4/lcmessage.m4 haiku/vendor/libiconv/current/srcm4/lib-ld.m4 haiku/vendor/libiconv/current/srcm4/lib-link.m4 haiku/vendor/libiconv/current/srcm4/lib-prefix.m4 haiku/vendor/libiconv/current/srcm4/lock.m4 haiku/vendor/libiconv/current/srcm4/longlong.m4 haiku/vendor/libiconv/current/srcm4/malloc.m4 haiku/vendor/libiconv/current/srcm4/malloca.m4 haiku/vendor/libiconv/current/srcm4/mbstate_t.m4 haiku/vendor/libiconv/current/srcm4/memmove.m4 haiku/vendor/libiconv/current/srcm4/nls.m4 haiku/vendor/libiconv/current/srcm4/pathmax.m4 haiku/vendor/libiconv/current/srcm4/po.m4 haiku/vendor/libiconv/current/srcm4/printf-posix.m4 haiku/vendor/libiconv/current/srcm4/progtest.m4 haiku/vendor/libiconv/current/srcm4/readlink.m4 haiku/vendor/libiconv/current/srcm4/relocatable-lib.m4 haiku/vendor/libiconv/current/srcm4/relocatable.m4 haiku/vendor/libiconv/current/srcm4/setenv.m4 haiku/vendor/libiconv/current/srcm4/size_max.m4 haiku/vendor/libiconv/current/srcm4/ssize_t.m4 haiku/vendor/libiconv/current/srcm4/stdbool.m4 haiku/vendor/libiconv/current/srcm4/stdint.m4 haiku/vendor/libiconv/current/srcm4/stdint_h.m4 haiku/vendor/libiconv/current/srcm4/stdlib_h.m4 haiku/vendor/libiconv/current/srcm4/strerror.m4 haiku/vendor/libiconv/current/srcm4/string_h.m4 haiku/vendor/libiconv/current/srcm4/uintmax_t.m4 haiku/vendor/libiconv/current/srcm4/ulonglong.m4 haiku/vendor/libiconv/current/srcm4/unistd_h.m4 haiku/vendor/libiconv/current/srcm4/unlocked-io.m4 haiku/vendor/libiconv/current/srcm4/visibility.m4 haiku/vendor/libiconv/current/srcm4/wchar.m4 haiku/vendor/libiconv/current/srcm4/wchar_t.m4 haiku/vendor/libiconv/current/srcm4/wint_t.m4 haiku/vendor/libiconv/current/srcm4/xsize.m4 haiku/vendor/libiconv/current/tests/ haiku/vendor/libiconv/current/tests/ARMSCII-8.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/ARMSCII-8.TXT haiku/vendor/libiconv/current/tests/ASCII.TXT haiku/vendor/libiconv/current/tests/ATARIST.TXT haiku/vendor/libiconv/current/tests/BIG5-2003.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/BIG5-2003.TXT haiku/vendor/libiconv/current/tests/BIG5-HKSCS-1999-snippet haiku/vendor/libiconv/current/tests/BIG5-HKSCS-1999-snippet.UTF-8 haiku/vendor/libiconv/current/tests/BIG5-HKSCS-1999.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/BIG5-HKSCS-1999.TXT haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2001-snippet haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2001-snippet.UTF-8 haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2001.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2001.TXT haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2004-snippet haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2004-snippet.UTF-8 haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2004.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/BIG5-HKSCS-2004.TXT haiku/vendor/libiconv/current/tests/BIG5.TXT haiku/vendor/libiconv/current/tests/CP1046.TXT haiku/vendor/libiconv/current/tests/CP1124.TXT haiku/vendor/libiconv/current/tests/CP1125.TXT haiku/vendor/libiconv/current/tests/CP1129.TXT haiku/vendor/libiconv/current/tests/CP1133.TXT haiku/vendor/libiconv/current/tests/CP1161.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/CP1161.TXT haiku/vendor/libiconv/current/tests/CP1162.TXT haiku/vendor/libiconv/current/tests/CP1163.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/CP1163.TXT haiku/vendor/libiconv/current/tests/CP1250.TXT haiku/vendor/libiconv/current/tests/CP1251.TXT haiku/vendor/libiconv/current/tests/CP1252.TXT haiku/vendor/libiconv/current/tests/CP1253.TXT haiku/vendor/libiconv/current/tests/CP1254.TXT haiku/vendor/libiconv/current/tests/CP1255-snippet haiku/vendor/libiconv/current/tests/CP1255-snippet.UTF-8 haiku/vendor/libiconv/current/tests/CP1255.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/CP1255.TXT haiku/vendor/libiconv/current/tests/CP1256.TXT haiku/vendor/libiconv/current/tests/CP1257.TXT haiku/vendor/libiconv/current/tests/CP1258-snippet haiku/vendor/libiconv/current/tests/CP1258-snippet.UTF-8 haiku/vendor/libiconv/current/tests/CP1258.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/CP1258.TXT haiku/vendor/libiconv/current/tests/CP437.TXT haiku/vendor/libiconv/current/tests/CP737.TXT haiku/vendor/libiconv/current/tests/CP775.TXT haiku/vendor/libiconv/current/tests/CP850.TXT haiku/vendor/libiconv/current/tests/CP852.TXT haiku/vendor/libiconv/current/tests/CP853.TXT haiku/vendor/libiconv/current/tests/CP855.TXT haiku/vendor/libiconv/current/tests/CP856.TXT haiku/vendor/libiconv/current/tests/CP857.TXT haiku/vendor/libiconv/current/tests/CP858.TXT haiku/vendor/libiconv/current/tests/CP860.TXT haiku/vendor/libiconv/current/tests/CP861.TXT haiku/vendor/libiconv/current/tests/CP862.TXT haiku/vendor/libiconv/current/tests/CP863.TXT haiku/vendor/libiconv/current/tests/CP864.TXT haiku/vendor/libiconv/current/tests/CP865.TXT haiku/vendor/libiconv/current/tests/CP866.TXT haiku/vendor/libiconv/current/tests/CP869.TXT haiku/vendor/libiconv/current/tests/CP874.TXT haiku/vendor/libiconv/current/tests/CP922.TXT haiku/vendor/libiconv/current/tests/CP932.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/CP932.TXT haiku/vendor/libiconv/current/tests/CP936.TXT haiku/vendor/libiconv/current/tests/CP949.TXT haiku/vendor/libiconv/current/tests/CP950.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/CP950.TXT haiku/vendor/libiconv/current/tests/DEC-HANYU.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/DEC-HANYU.TXT haiku/vendor/libiconv/current/tests/DEC-KANJI.TXT haiku/vendor/libiconv/current/tests/EUC-CN.TXT haiku/vendor/libiconv/current/tests/EUC-JISX0213.TXT haiku/vendor/libiconv/current/tests/EUC-JP.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/EUC-JP.TXT haiku/vendor/libiconv/current/tests/EUC-KR.TXT haiku/vendor/libiconv/current/tests/EUC-TW.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/EUC-TW.TXT haiku/vendor/libiconv/current/tests/GB18030-BMP.TXT haiku/vendor/libiconv/current/tests/GBK.TXT haiku/vendor/libiconv/current/tests/Georgian-Academy.TXT haiku/vendor/libiconv/current/tests/Georgian-PS.TXT haiku/vendor/libiconv/current/tests/HP-ROMAN8.TXT haiku/vendor/libiconv/current/tests/HZ-snippet haiku/vendor/libiconv/current/tests/HZ-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-2022-CN-EXT-snippet haiku/vendor/libiconv/current/tests/ISO-2022-CN-EXT-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-2022-CN-snippet haiku/vendor/libiconv/current/tests/ISO-2022-CN-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-2022-JP-1-snippet haiku/vendor/libiconv/current/tests/ISO-2022-JP-1-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-2022-JP-2-snippet haiku/vendor/libiconv/current/tests/ISO-2022-JP-2-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-2022-JP-3-snippet haiku/vendor/libiconv/current/tests/ISO-2022-JP-3-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-2022-JP-snippet haiku/vendor/libiconv/current/tests/ISO-2022-JP-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-2022-KR-snippet haiku/vendor/libiconv/current/tests/ISO-2022-KR-snippet.UTF-8 haiku/vendor/libiconv/current/tests/ISO-8859-1.TXT haiku/vendor/libiconv/current/tests/ISO-8859-10.TXT haiku/vendor/libiconv/current/tests/ISO-8859-11.TXT haiku/vendor/libiconv/current/tests/ISO-8859-13.TXT haiku/vendor/libiconv/current/tests/ISO-8859-14.TXT haiku/vendor/libiconv/current/tests/ISO-8859-15.TXT haiku/vendor/libiconv/current/tests/ISO-8859-16.TXT haiku/vendor/libiconv/current/tests/ISO-8859-2.TXT haiku/vendor/libiconv/current/tests/ISO-8859-3.TXT haiku/vendor/libiconv/current/tests/ISO-8859-4.TXT haiku/vendor/libiconv/current/tests/ISO-8859-5.TXT haiku/vendor/libiconv/current/tests/ISO-8859-6.TXT haiku/vendor/libiconv/current/tests/ISO-8859-7.TXT haiku/vendor/libiconv/current/tests/ISO-8859-8.TXT haiku/vendor/libiconv/current/tests/ISO-8859-9.TXT haiku/vendor/libiconv/current/tests/ISO-IR-165.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/ISO-IR-165.TXT haiku/vendor/libiconv/current/tests/ISO646-CN.TXT haiku/vendor/libiconv/current/tests/ISO646-JP.TXT haiku/vendor/libiconv/current/tests/JIS_X0201.TXT haiku/vendor/libiconv/current/tests/JOHAB.TXT haiku/vendor/libiconv/current/tests/KOI8-R.TXT haiku/vendor/libiconv/current/tests/KOI8-RU.TXT haiku/vendor/libiconv/current/tests/KOI8-T.TXT haiku/vendor/libiconv/current/tests/KOI8-U.TXT haiku/vendor/libiconv/current/tests/MacArabic.TXT haiku/vendor/libiconv/current/tests/MacCentralEurope.TXT haiku/vendor/libiconv/current/tests/MacCroatian.TXT haiku/vendor/libiconv/current/tests/MacCyrillic.TXT haiku/vendor/libiconv/current/tests/MacGreek.TXT haiku/vendor/libiconv/current/tests/MacHebrew.TXT haiku/vendor/libiconv/current/tests/MacIceland.TXT haiku/vendor/libiconv/current/tests/MacRoman.TXT haiku/vendor/libiconv/current/tests/MacRomania.TXT haiku/vendor/libiconv/current/tests/MacThai.TXT haiku/vendor/libiconv/current/tests/MacTurkish.TXT haiku/vendor/libiconv/current/tests/MacUkraine.TXT haiku/vendor/libiconv/current/tests/Makefile.in haiku/vendor/libiconv/current/tests/MuleLao-1.TXT haiku/vendor/libiconv/current/tests/NEXTSTEP.TXT haiku/vendor/libiconv/current/tests/PT154.TXT haiku/vendor/libiconv/current/tests/Quotes.ASCII haiku/vendor/libiconv/current/tests/Quotes.ISO-8859-1 haiku/vendor/libiconv/current/tests/Quotes.UTF-8 haiku/vendor/libiconv/current/tests/RISCOS-LATIN1.TXT haiku/vendor/libiconv/current/tests/RK1048.TXT haiku/vendor/libiconv/current/tests/SHIFT_JIS.TXT haiku/vendor/libiconv/current/tests/SHIFT_JISX0213.TXT haiku/vendor/libiconv/current/tests/TCVN-snippet haiku/vendor/libiconv/current/tests/TCVN-snippet.UTF-8 haiku/vendor/libiconv/current/tests/TCVN.IRREVERSIBLE.TXT haiku/vendor/libiconv/current/tests/TCVN.TXT haiku/vendor/libiconv/current/tests/TDS565.TXT haiku/vendor/libiconv/current/tests/TIS-620.TXT haiku/vendor/libiconv/current/tests/Translit1.ASCII haiku/vendor/libiconv/current/tests/Translit1.ISO-8859-1 haiku/vendor/libiconv/current/tests/TranslitFail1.ISO-8859-1 haiku/vendor/libiconv/current/tests/UCS-2BE-snippet haiku/vendor/libiconv/current/tests/UCS-2BE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UCS-2LE-snippet haiku/vendor/libiconv/current/tests/UCS-2LE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UCS-4BE-snippet haiku/vendor/libiconv/current/tests/UCS-4BE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UCS-4LE-snippet haiku/vendor/libiconv/current/tests/UCS-4LE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UTF-16-snippet haiku/vendor/libiconv/current/tests/UTF-16-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UTF-16BE-snippet haiku/vendor/libiconv/current/tests/UTF-16BE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UTF-16LE-snippet haiku/vendor/libiconv/current/tests/UTF-16LE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UTF-32-snippet haiku/vendor/libiconv/current/tests/UTF-32-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UTF-32BE-snippet haiku/vendor/libiconv/current/tests/UTF-32BE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UTF-32LE-snippet haiku/vendor/libiconv/current/tests/UTF-32LE-snippet.UTF-8 haiku/vendor/libiconv/current/tests/UTF-7-snippet haiku/vendor/libiconv/current/tests/UTF-7-snippet.UTF-8 haiku/vendor/libiconv/current/tests/VISCII.TXT haiku/vendor/libiconv/current/tests/check-stateful haiku/vendor/libiconv/current/tests/check-stateful.bat haiku/vendor/libiconv/current/tests/check-stateless haiku/vendor/libiconv/current/tests/check-stateless.bat haiku/vendor/libiconv/current/tests/check-subst haiku/vendor/libiconv/current/tests/check-translit haiku/vendor/libiconv/current/tests/check-translit.bat haiku/vendor/libiconv/current/tests/check-translitfailure haiku/vendor/libiconv/current/tests/gengb18030z.c haiku/vendor/libiconv/current/tests/genutf8.c haiku/vendor/libiconv/current/tests/table-from.c haiku/vendor/libiconv/current/tests/table-to.c haiku/vendor/libiconv/current/tests/uniq-u.c haiku/vendor/libiconv/current/tools/ haiku/vendor/libiconv/current/tools/8bit_tab_to_h.c haiku/vendor/libiconv/current/tools/JISX0213.TXT haiku/vendor/libiconv/current/tools/Makefile haiku/vendor/libiconv/current/tools/cjk_tab_to_h.c haiku/vendor/libiconv/current/tools/cjk_variants.c haiku/vendor/libiconv/current/windows/ haiku/vendor/libiconv/current/windows/iconv.rc haiku/vendor/libiconv/current/windows/libiconv.rc haiku/vendor/libiconv/current/windows/windres-options haiku/vendor/libiconv/current/woe32dll/ haiku/vendor/libiconv/current/woe32dll/export.h haiku/vendor/libiconv/current/woe32dll/iconv-exports.c Log: importing libiconv-1.12 Added: haiku/vendor/libiconv/current/ABOUT-NLS =================================================================== --- haiku/vendor/libiconv/current/ABOUT-NLS 2008-11-12 12:36:32 UTC (rev 28625) +++ haiku/vendor/libiconv/current/ABOUT-NLS 2008-11-12 16:47:47 UTC (rev 28626) @@ -0,0 +1,1068 @@ +1 Notes on the Free Translation Project +*************************************** + +Free software is going international! The Free Translation Project is +a way to get maintainers of free software, translators, and users all +together, so that free software will gradually become able to speak many +languages. A few packages already provide translations for their +messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work on translations can contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +1.1 Quick configuration advice +============================== + +If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +1.2 INSTALL Matters +=================== + +Some packages are "localizable" when properly installed; the programs +they contain can be made to speak your own native language. Most such +packages use GNU `gettext'. Other packages have their own ways to +internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the included GNU +`gettext' library will be used. This library is wholly contained +within this package, usually in the `intl/' subdirectory, so prior +installation of the GNU `gettext' package is _not_ required. +Installers may use special options at configuration time for changing +the default behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will, respectively, bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might not be desirable. You should use +the more recent version of the GNU `gettext' library. I.e. if the file +`intl/VERSION' shows that the library which comes with this package is +more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages usually have many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +1.3 Using This Package +====================== + +As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. If you happen to have the `LC_ALL' or some other +`LC_xxx' environment variables set, you should unset them before +setting `LANG', otherwise the setting of `LANG' will not have the +desired effect. Here `LL' is an ISO 639 two-letter language code, and +`CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your language by running the +command `locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + Special advice for Norwegian users: The language code for Norwegian +bokma*l changed from `no' to `nb' recently (in 2003). During the +transition period, while some message catalogs for this language are +installed under `nb' and some older ones under `no', it's recommended +for Norwegian users to set `LANGUAGE' to `nb:no' so that both newer and +older translations are used. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +1.4 Translating Teams +===================== + +For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://translationproject.org/', in the "Teams" area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request at li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `coordinator at translationproject.org' to +reach the coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skills are praised more than +programming skills, here. + +1.5 Available Packages +====================== + +Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of November +2007. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files af am ar az be bg bs ca cs cy da de el en en_GB eo + +----------------------------------------------------+ + Compendium | [] [] [] [] | + a2ps | [] [] [] [] [] | + aegis | () | + ant-phone | () | + anubis | [] | + ap-utils | | + aspell | [] [] [] [] [] | + bash | [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] | + bison-runtime | [] | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] [] | + console-tools | [] [] | + coreutils | [] [] [] [] | + cpio | | + cpplib | [] [] [] | + cryptonit | [] | + dialog | | + diffutils | [] [] [] [] [] [] | + doodle | [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] | + fetchmail | [] [] () [] [] | + findutils | [] | + findutils_stable | [] [] [] | + flex | [] [] [] | + fslint | | + gas | | + gawk | [] [] [] | + gcal | [] | + gcc | [] | + gettext-examples | [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] | + gettext-tools | [] [] | + gip | [] | + gliv | [] [] | + glunarclock | [] | + gmult | [] [] | + gnubiff | () | + gnucash | [] [] () () [] | + gnuedu | | + gnulib | [] | + gnunet | | + gnunet-gtk | | + gnutls | [] | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | | + gpe-clock | [] [] | + gpe-conf | [] [] | + gpe-contacts | | + gpe-edit | [] | + gpe-filemanager | | + gpe-go | [] | + gpe-login | [] [] | + gpe-ownerinfo | [] [] | + gpe-package | | + gpe-sketchbook | [] [] | + gpe-su | [] [] | + gpe-taskmanager | [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | | + gphoto2 | [] [] [] [] | + gprof | [] [] | + gpsdrive | | + gramadoir | [] [] | + grep | [] [] | + gretl | () | + gsasl | | + gss | | + gst-plugins-bad | [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] [] | + gst-plugins-ugly | [] [] | + gstreamer | [] [] [] [] [] [] [] | + gtick | () | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] | + herrie | [] | + hylafax | | + idutils | [] [] | + indent | [] [] [] [] | + iso_15924 | | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] [] [] | + iso_639 | [] [] [] [] | + jpilot | [] | + jtag | | + jwhois | | + kbd | [] [] [] [] | + keytouch | [] [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | () | + ld | [] | + leafpad | [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] | + libgphoto2_port | [] [] | + libgsasl | | + libiconv | [] [] | + libidn | [] [] [] | + lifelines | [] () | + lilypond | [] | + lingoteach | | + lprng | | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + mailfromd | | + mailutils | [] | + make | [] [] | + man-db | [] [] [] | + minicom | [] [] [] | + nano | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + popt | [] [] [] | + psmisc | [] | + pwdutils | | + qof | | + radius | [] | + recode | [] [] [] [] [] [] | + rpm | [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] [] | + sed | [] [] [] | + shared-mime-info | [] [] [] [] () [] [] [] | + sharutils | [] [] [] [] [] [] | + shishi | | + skencil | [] () | + solfege | | + soundtracker | [] [] | + sp | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] | + texinfo | [] [] [] | + tin | () () | + tuxpaint | [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + util-linux-ng | [] [] [] [] | + vorbis-tools | [] | + wastesedge | () | + wdiff | [] [] [] [] | + wget | [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] | + xpad | [] [] [] | + +----------------------------------------------------+ + af am ar az be bg bs ca cs cy da de el en en_GB eo + 6 0 2 1 8 26 2 40 48 2 56 88 15 1 15 18 + + es et eu fa fi fr ga gl gu he hi hr hu id is it + +--------------------------------------------------+ + Compendium | [] [] [] [] [] | + a2ps | [] [] [] () | + aegis | | + ant-phone | [] | + anubis | [] | + ap-utils | [] [] | + aspell | [] [] [] | + bash | [] | + bfd | [] [] | + bibshelf | [] [] [] | + binutils | [] [] [] | + bison | [] [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] | + cflow | [] | + clisp | [] [] | + console-tools | | + coreutils | [] [] [] [] [] [] | + cpio | [] [] [] | + cpplib | [] [] | + cryptonit | [] | + dialog | [] [] [] | + diffutils | [] [] [] [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] [] | + enscript | [] [] [] | + fetchmail | [] | + findutils | [] [] [] | + findutils_stable | [] [] [] [] | + flex | [] [] [] | + fslint | | + gas | [] [] | + gawk | [] [] [] [] () | + gcal | [] [] | + gcc | [] | + gettext-examples | [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] | + gettext-tools | [] [] [] [] | + gip | [] [] [] [] | + gliv | () | + glunarclock | [] [] [] | + gmult | [] [] [] | + gnubiff | () () | + gnucash | () () () | + gnuedu | [] | + gnulib | [] [] [] | + gnunet | | + gnunet-gtk | | + gnutls | | + gpe-aerial | [] [] | + gpe-beam | [] [] | + gpe-calendar | | + gpe-clock | [] [] [] [] | + gpe-conf | [] | + gpe-contacts | [] [] | + gpe-edit | [] [] [] [] | + gpe-filemanager | [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] [] [] [] | + gpe-package | [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] [] | + gpe-taskmanager | [] [] [] | + gpe-timesheet | [] [] [] [] | + gpe-today | [] [] [] [] | + gpe-todo | [] | + gphoto2 | [] [] [] [] [] | + gprof | [] [] [] [] [] | + gpsdrive | [] | + gramadoir | [] [] | + grep | [] [] [] | + gretl | [] [] [] () | + gsasl | [] [] | + gss | [] [] | + gst-plugins-bad | [] [] [] [] | + gst-plugins-base | [] [] [] [] | + gst-plugins-good | [] [] [] [] [] | + gst-plugins-ugly | [] [] [] [] | + gstreamer | [] [] [] | + gtick | [] [] [] | + gtkam | [] [] [] [] | + gtkorphan | [] [] | + gtkspell | [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] [] [] [] [] [] | + herrie | [] | + hylafax | | + idutils | [] [] [] [] [] | + indent | [] [] [] [] [] [] [] [] [] [] | + iso_15924 | [] | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_4217 | [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] | + jpilot | [] [] | + jtag | [] | + jwhois | [] [] [] [] [] | + kbd | [] [] | + keytouch | [] [] [] | + keytouch-editor | [] | + keytouch-keyboa... | [] [] | + latrine | [] [] | + ld | [] [] [] [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] [] | + libexif | [] | + libextractor | [] | + libgpewidget | [] [] [] [] [] | + libgpg-error | [] | + libgphoto2 | [] [] [] | + libgphoto2_port | [] [] | + libgsasl | [] [] | + libiconv | [] [] [] | + libidn | [] [] | + lifelines | () | + lilypond | [] [] [] | + lingoteach | [] [] [] | + lprng | | + lynx | [] [] [] | + m4 | [] [] [] [] | + mailfromd | | + mailutils | [] [] | + make | [] [] [] [] [] [] [] [] | + man-db | [] | + minicom | [] [] [] [] | + nano | [] [] [] [] [] [] [] | + opcodes | [] [] [] [] | + parted | [] [] [] | + pilot-qof | | + popt | [] [] [] [] | + psmisc | [] [] | + pwdutils | | + qof | [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] [] | + rpm | [] [] | + screem | | + scrollkeeper | [] [] [] | + sed | [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] [] [] [] [] | + shishi | [] | + skencil | [] [] | + solfege | [] | + soundtracker | [] [] [] | + sp | [] | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + tin | [] () | + tuxpaint | [] [] | + unicode-han-tra... | | + unicode-transla... | [] [] | + util-linux | [] [] [] [] [] [] [] | + util-linux-ng | [] [] [] [] [] [] [] | + vorbis-tools | | + wastesedge | () | + wdiff | [] [] [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + es et eu fa fi fr ga gl gu he hi hr hu id is it + 85 22 14 2 48 101 61 12 2 8 2 6 53 29 1 52 + + ja ka ko ku ky lg lt lv mk mn ms mt nb ne nl nn + +--------------------------------------------------+ + Compendium | [] | + a2ps | () [] [] | + aegis | () | + ant-phone | [] | + anubis | [] [] [] | + ap-utils | [] | + aspell | [] [] | + bash | [] | + bfd | | + bibshelf | [] | + binutils | | + bison | [] [] [] | + bison-runtime | [] [] [] | + bluez-pin | [] [] [] | + cflow | | + clisp | [] | + console-tools | | + coreutils | [] | + cpio | [] | + cpplib | [] | + cryptonit | [] | + dialog | [] [] | + diffutils | [] [] [] | + doodle | | + e2fsprogs | [] | + enscript | [] | + fetchmail | [] [] | + findutils | [] | + findutils_stable | [] | + flex | [] [] | + fslint | | + gas | | + gawk | [] [] | + gcal | | + gcc | | + gettext-examples | [] [] [] | + gettext-runtime | [] [] [] | + gettext-tools | [] [] | + gip | [] [] | + gliv | [] | + glunarclock | [] [] | + gmult | [] [] [] | + gnubiff | | + gnucash | () () () | + gnuedu | | + gnulib | [] [] | + gnunet | | + gnunet-gtk | | + gnutls | [] | + gpe-aerial | [] | + gpe-beam | [] | + gpe-calendar | [] | + gpe-clock | [] [] [] | + gpe-conf | [] [] [] | + gpe-contacts | [] | + gpe-edit | [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] | + gpe-login | [] [] [] | + gpe-ownerinfo | [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] | + gpe-su | [] [] [] | + gpe-taskmanager | [] [] [] [] | + gpe-timesheet | [] | + gpe-today | [] [] | + gpe-todo | [] | + gphoto2 | [] [] | + gprof | [] | + gpsdrive | [] | + gramadoir | () | + grep | [] [] | + gretl | | + gsasl | [] | + gss | | + gst-plugins-bad | [] | + gst-plugins-base | [] | + gst-plugins-good | [] | + gst-plugins-ugly | [] | + gstreamer | [] | + gtick | [] | + gtkam | [] [] | + gtkorphan | [] | + gtkspell | [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] | + herrie | [] | + hylafax | | + idutils | [] | + indent | [] [] | + iso_15924 | [] | + iso_3166 | [] [] [] [] [] [] [] [] | + iso_3166_2 | [] | + iso_4217 | [] [] [] | + iso_639 | [] [] [] [] | + jpilot | () () | + jtag | | + jwhois | [] | + kbd | [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | | + latrine | [] | + ld | | + leafpad | [] [] | + libc | [] [] [] | + libexif | | + libextractor | | + libgpewidget | [] | + libgpg-error | | + libgphoto2 | [] | + libgphoto2_port | [] | + libgsasl | [] | + libiconv | [] | + libidn | [] [] | + lifelines | [] | + lilypond | [] | + lingoteach | [] | + lprng | | + lynx | [] [] | + m4 | [] [] | + mailfromd | | + mailutils | | + make | [] [] [] | + man-db | | + minicom | [] | + nano | [] [] [] | + opcodes | [] | + parted | [] [] | + pilot-qof | | + popt | [] [] [] | + psmisc | [] [] [] | + pwdutils | | + qof | | + radius | | + recode | [] | + rpm | [] [] | + screem | [] | + scrollkeeper | [] [] [] [] | + sed | [] [] | + shared-mime-info | [] [] [] [] [] [] [] | + sharutils | [] [] | + shishi | | + skencil | | + solfege | () () | + soundtracker | | + sp | () | + system-tools-ba... | [] [] [] [] | + tar | [] [] [] | + texinfo | [] [] | + tin | | + tuxpaint | () [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] | + util-linux-ng | [] [] | + vorbis-tools | | + wastesedge | [] | + wdiff | [] [] | + wget | [] [] | + xchat | [] [] [] [] | + xkeyboard-config | [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + ja ka ko ku ky lg lt lv mk mn ms mt nb ne nl nn + 51 2 25 3 2 0 6 0 2 2 20 0 11 1 103 6 + + or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + +--------------------------------------------------+ + Compendium | [] [] [] [] [] | + a2ps | () [] [] [] [] [] [] | + aegis | () () | + ant-phone | [] [] | + anubis | [] [] [] | + ap-utils | () | + aspell | [] [] [] | + bash | [] [] | + bfd | | + bibshelf | [] | + binutils | [] [] | + bison | [] [] [] [] [] | + bison-runtime | [] [] [] [] [] | + bluez-pin | [] [] [] [] [] [] [] [] [] | + cflow | [] | + clisp | [] | + console-tools | [] | + coreutils | [] [] [] [] | + cpio | [] [] [] | + cpplib | [] | + cryptonit | [] [] | + dialog | [] | + diffutils | [] [] [] [] [] [] | + doodle | [] [] | + e2fsprogs | [] [] | + enscript | [] [] [] [] [] | + fetchmail | [] [] [] | + findutils | [] [] [] | + findutils_stable | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + fslint | [] | + gas | | + gawk | [] [] [] [] | + gcal | [] | + gcc | [] [] | + gettext-examples | [] [] [] [] [] [] [] [] | + gettext-runtime | [] [] [] [] [] [] [] [] | + gettext-tools | [] [] [] [] [] [] [] | + gip | [] [] [] [] | + gliv | [] [] [] [] [] [] | + glunarclock | [] [] [] [] [] [] | + gmult | [] [] [] [] | + gnubiff | () [] | + gnucash | () [] | + gnuedu | | + gnulib | [] [] [] | + gnunet | | + gnunet-gtk | [] | + gnutls | [] [] | + gpe-aerial | [] [] [] [] [] [] [] | + gpe-beam | [] [] [] [] [] [] [] | + gpe-calendar | [] [] [] [] | + gpe-clock | [] [] [] [] [] [] [] [] | + gpe-conf | [] [] [] [] [] [] [] | + gpe-contacts | [] [] [] [] [] | + gpe-edit | [] [] [] [] [] [] [] [] [] | + gpe-filemanager | [] [] | + gpe-go | [] [] [] [] [] [] [] [] | + gpe-login | [] [] [] [] [] [] [] [] | + gpe-ownerinfo | [] [] [] [] [] [] [] [] | + gpe-package | [] [] | + gpe-sketchbook | [] [] [] [] [] [] [] [] | + gpe-su | [] [] [] [] [] [] [] [] | + gpe-taskmanager | [] [] [] [] [] [] [] [] | + gpe-timesheet | [] [] [] [] [] [] [] [] | + gpe-today | [] [] [] [] [] [] [] [] | + gpe-todo | [] [] [] [] | + gphoto2 | [] [] [] [] [] [] | + gprof | [] [] [] | + gpsdrive | [] [] | + gramadoir | [] [] | + grep | [] [] [] [] | + gretl | [] [] [] | + gsasl | [] [] [] | + gss | [] [] [] [] | + gst-plugins-bad | [] [] [] | + gst-plugins-base | [] [] | + gst-plugins-good | [] [] | + gst-plugins-ugly | [] [] [] | + gstreamer | [] [] [] [] | + gtick | [] | + gtkam | [] [] [] [] [] | + gtkorphan | [] | + gtkspell | [] [] [] [] [] [] [] [] | + gutenprint | [] | + hello | [] [] [] [] [] [] [] [] | + herrie | [] [] [] | + hylafax | | + idutils | [] [] [] [] [] | + indent | [] [] [] [] [] [] [] | + iso_15924 | | + iso_3166 | [] [] [] [] [] [] [] [] [] [] [] [] [] | + iso_3166_2 | | + iso_4217 | [] [] [] [] [] [] [] | + iso_639 | [] [] [] [] [] [] [] | + jpilot | | + jtag | [] | + jwhois | [] [] [] [] | + kbd | [] [] [] | + keytouch | [] | + keytouch-editor | [] | + keytouch-keyboa... | [] | + latrine | | + ld | [] | + leafpad | [] [] [] [] [] [] | + libc | [] [] [] [] | + libexif | [] [] | + libextractor | [] [] | + libgpewidget | [] [] [] [] [] [] [] [] | + libgpg-error | [] [] [] | + libgphoto2 | [] | + libgphoto2_port | [] [] [] | + libgsasl | [] [] [] [] | + libiconv | [] [] [] | + libidn | [] [] () | + lifelines | [] [] | + lilypond | | + lingoteach | [] | + lprng | [] | + lynx | [] [] [] | + m4 | [] [] [] [] [] | + mailfromd | [] | + mailutils | [] [] [] | + make | [] [] [] [] | + man-db | [] [] [] [] | + minicom | [] [] [] [] [] | + nano | [] [] [] [] | + opcodes | [] [] | + parted | [] | + pilot-qof | | + popt | [] [] [] [] | + psmisc | [] [] | + pwdutils | [] [] | + qof | [] [] | + radius | [] [] | + recode | [] [] [] [] [] [] [] | + rpm | [] [] [] [] | + screem | | + scrollkeeper | [] [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + shared-mime-info | [] [] [] [] [] [] | + sharutils | [] [] [] [] | + shishi | [] | + skencil | [] [] [] | + solfege | [] | + soundtracker | [] [] | + sp | | + system-tools-ba... | [] [] [] [] [] [] [] [] [] | + tar | [] [] [] [] | + texinfo | [] [] [] [] | + tin | () | + tuxpaint | [] [] [] [] [] [] | + unicode-han-tra... | | + unicode-transla... | | + util-linux | [] [] [] [] | + util-linux-ng | [] [] [] [] | + vorbis-tools | [] | + wastesedge | | + wdiff | [] [] [] [] [] [] [] | + wget | [] [] [] [] | + xchat | [] [] [] [] [] [] [] | + xkeyboard-config | [] [] [] | + xpad | [] [] [] | + +--------------------------------------------------+ + or pa pl pt pt_BR rm ro ru rw sk sl sq sr sv ta + 0 5 77 31 53 4 58 72 3 45 46 9 45 122 3 + + tg th tk tr uk ven vi wa xh zh_CN zh_HK zh_TW zu + +---------------------------------------------------+ + Compendium | [] [] [] [] | 19 + a2ps | [] [] [] | 19 + aegis | [] | 1 + ant-phone | [] [] | 6 + anubis | [] [] [] | 11 + ap-utils | () [] | 4 + aspell | [] [] [] | 16 + bash | [] | 6 + bfd | | 2 + bibshelf | [] | 7 + binutils | [] [] [] [] | 9 + bison | [] [] [] [] | 20 + bison-runtime | [] [] [] [] | 18 + bluez-pin | [] [] [] [] [] [] | 28 + cflow | [] [] | 5 + clisp | | 9 + console-tools | [] [] | 5 + coreutils | [] [] [] | 18 + cpio | [] [] [] [] | 11 + cpplib | [] [] [] [] [] | 12 + cryptonit | [] | 6 + dialog | [] [] [] | 9 + diffutils | [] [] [] [] [] | 29 + doodle | [] | 6 + e2fsprogs | [] [] | 10 + enscript | [] [] [] | 16 + fetchmail | [] [] | 12 + findutils | [] [] [] | 11 + findutils_stable | [] [] [] [] | 18 + flex | [] [] | 15 + fslint | [] | 2 + gas | [] | 3 + gawk | [] [] [] | 16 + gcal | [] | 5 + gcc | [] [] [] | 7 + gettext-examples | [] [] [] [] [] [] | 29 + gettext-runtime | [] [] [] [] [] [] | 28 + gettext-tools | [] [] [] [] [] | 20 + gip | [] [] | 13 + gliv | [] [] | 11 + glunarclock | [] [] [] | 15 + gmult | [] [] [] [] | 16 + gnubiff | [] | 2 + gnucash | () [] | 5 + gnuedu | [] | 2 + gnulib | [] | 10 + gnunet | | 0 + gnunet-gtk | [] [] | 3 + gnutls | | 4 + gpe-aerial | [] [] | 14 + gpe-beam | [] [] | 14 + gpe-calendar | [] [] | 7 + gpe-clock | [] [] [] [] | 21 + gpe-conf | [] [] [] | 16 + gpe-contacts | [] [] | 10 + gpe-edit | [] [] [] [] [] | 22 + gpe-filemanager | [] [] | 7 + gpe-go | [] [] [] [] | 19 + gpe-login | [] [] [] [] [] | 21 + gpe-ownerinfo | [] [] [] [] | 21 + gpe-package | [] | 6 + gpe-sketchbook | [] [] | 16 + gpe-su | [] [] [] [] | 21 + gpe-taskmanager | [] [] [] [] | 21 + gpe-timesheet | [] [] [] [] | 18 + gpe-today | [] [] [] [] [] | 21 + gpe-todo | [] [] | 8 + gphoto2 | [] [] [] [] | 21 + gprof | [] [] | 13 + gpsdrive | [] | 5 + gramadoir | [] | 7 + grep | [] | 12 + gretl | | 6 + gsasl | [] [] [] | 9 + gss | [] | 7 + gst-plugins-bad | [] [] [] | 13 + gst-plugins-base | [] [] | 11 + gst-plugins-good | [] [] [] [] [] | 16 + gst-plugins-ugly | [] [] [] | 13 + gstreamer | [] [] [] | 18 + gtick | [] [] | 7 + gtkam | [] | 16 + gtkorphan | [] | 7 + gtkspell | [] [] [] [] [] [] | 27 + gutenprint | | 4 + hello | [] [] [] [] [] | 38 + herrie | [] [] | 8 + hylafax | | 0 + idutils | [] [] | 15 + indent | [] [] [] [] [] | 28 + iso_15924 | [] [] | 4 + iso_3166 | [] [] [] [] [] [] [] [] [] | 54 + iso_3166_2 | [] [] | 4 + iso_4217 | [] [] [] [] [] | 24 + iso_639 | [] [] [] [] [] | 26 + jpilot | [] [] [] [] | 7 + jtag | [] | 3 + jwhois | [] [] [] | 13 + kbd | [] [] [] | 13 + keytouch | [] | 8 + keytouch-editor | [] | 5 + keytouch-keyboa... | [] | 5 + latrine | [] [] | 5 + ld | [] [] [] [] | 10 + leafpad | [] [] [] [] [] | 24 + libc | [] [] [] | 19 + libexif | [] | 5 + libextractor | [] | 5 + libgpewidget | [] [] [] | 20 + libgpg-error | [] | 6 + libgphoto2 | [] [] | 9 + libgphoto2_port | [] [] [] | 11 + libgsasl | [] | 8 + libiconv | [] [] | 11 + libidn | [] [] | 11 + lifelines | | 4 + lilypond | [] | 6 + lingoteach | [] | 6 + lprng | [] | 2 + lynx | [] [] [] | 15 + m4 | [] [] [] | 18 + mailfromd | [] [] | 3 + mailutils | [] [] | 8 + make | [] [] [] | 20 + man-db | [] | 9 + minicom | [] | 14 + nano | [] [] [] | 20 + opcodes | [] [] | 10 + parted | [] [] [] | 11 [... truncated: 711509 lines follow ...] From zooey at mail.berlios.de Wed Nov 12 17:50:19 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 12 Nov 2008 17:50:19 +0100 Subject: [Haiku-commits] r28627 - haiku/vendor/libiconv Message-ID: <200811121650.mACGoJiH018601@sheep.berlios.de> Author: zooey Date: 2008-11-12 17:50:19 +0100 (Wed, 12 Nov 2008) New Revision: 28627 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28627&view=rev Added: haiku/vendor/libiconv/1.12/ Log: tagging libiconv-1.12 Copied: haiku/vendor/libiconv/1.12 (from rev 28626, haiku/vendor/libiconv/current) From zooey at mail.berlios.de Wed Nov 12 18:02:50 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 12 Nov 2008 18:02:50 +0100 Subject: [Haiku-commits] r28628 - haiku/trunk/src/libs Message-ID: <200811121702.mACH2oUt020193@sheep.berlios.de> Author: zooey Date: 2008-11-12 18:02:49 +0100 (Wed, 12 Nov 2008) New Revision: 28628 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28628&view=rev Added: haiku/trunk/src/libs/iconv/ Log: creating new home for libiconv From zooey at mail.berlios.de Wed Nov 12 18:35:13 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 12 Nov 2008 18:35:13 +0100 Subject: [Haiku-commits] r28629 - haiku/trunk/src/libs/iconv Message-ID: <200811121735.mACHZDwH030014@sheep.berlios.de> Author: zooey Date: 2008-11-12 18:34:47 +0100 (Wed, 12 Nov 2008) New Revision: 28629 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28629&view=rev Added: haiku/trunk/src/libs/iconv/AUTHORS haiku/trunk/src/libs/iconv/ChangeLog haiku/trunk/src/libs/iconv/Makefile.in haiku/trunk/src/libs/iconv/NEWS haiku/trunk/src/libs/iconv/README haiku/trunk/src/libs/iconv/aliases.gperf haiku/trunk/src/libs/iconv/aliases.h haiku/trunk/src/libs/iconv/aliases2.h haiku/trunk/src/libs/iconv/aliases_aix.h haiku/trunk/src/libs/iconv/aliases_dos.h haiku/trunk/src/libs/iconv/aliases_extra.h haiku/trunk/src/libs/iconv/aliases_osf1.h haiku/trunk/src/libs/iconv/armscii_8.h haiku/trunk/src/libs/iconv/ascii.h haiku/trunk/src/libs/iconv/atarist.h haiku/trunk/src/libs/iconv/big5.h haiku/trunk/src/libs/iconv/big5_2003.h haiku/trunk/src/libs/iconv/big5hkscs1999.h haiku/trunk/src/libs/iconv/big5hkscs2001.h haiku/trunk/src/libs/iconv/big5hkscs2004.h haiku/trunk/src/libs/iconv/c99.h haiku/trunk/src/libs/iconv/canonical.h haiku/trunk/src/libs/iconv/canonical_aix.h haiku/trunk/src/libs/iconv/canonical_dos.h haiku/trunk/src/libs/iconv/canonical_extra.h haiku/trunk/src/libs/iconv/canonical_local.h haiku/trunk/src/libs/iconv/canonical_osf1.h haiku/trunk/src/libs/iconv/ces_big5.h haiku/trunk/src/libs/iconv/ces_gbk.h haiku/trunk/src/libs/iconv/cjk_variants.h haiku/trunk/src/libs/iconv/cns11643.h haiku/trunk/src/libs/iconv/cns11643_1.h haiku/trunk/src/libs/iconv/cns11643_15.h haiku/trunk/src/libs/iconv/cns11643_2.h haiku/trunk/src/libs/iconv/cns11643_3.h haiku/trunk/src/libs/iconv/cns11643_4.h haiku/trunk/src/libs/iconv/cns11643_4a.h haiku/trunk/src/libs/iconv/cns11643_4b.h haiku/trunk/src/libs/iconv/cns11643_5.h haiku/trunk/src/libs/iconv/cns11643_6.h haiku/trunk/src/libs/iconv/cns11643_7.h haiku/trunk/src/libs/iconv/cns11643_inv.h haiku/trunk/src/libs/iconv/config.h haiku/trunk/src/libs/iconv/converters.h haiku/trunk/src/libs/iconv/cp1046.h haiku/trunk/src/libs/iconv/cp1124.h haiku/trunk/src/libs/iconv/cp1125.h haiku/trunk/src/libs/iconv/cp1129.h haiku/trunk/src/libs/iconv/cp1133.h haiku/trunk/src/libs/iconv/cp1161.h haiku/trunk/src/libs/iconv/cp1162.h haiku/trunk/src/libs/iconv/cp1163.h haiku/trunk/src/libs/iconv/cp1250.h haiku/trunk/src/libs/iconv/cp1251.h haiku/trunk/src/libs/iconv/cp1252.h haiku/trunk/src/libs/iconv/cp1253.h haiku/trunk/src/libs/iconv/cp1254.h haiku/trunk/src/libs/iconv/cp1255.h haiku/trunk/src/libs/iconv/cp1256.h haiku/trunk/src/libs/iconv/cp1257.h haiku/trunk/src/libs/iconv/cp1258.h haiku/trunk/src/libs/iconv/cp437.h haiku/trunk/src/libs/iconv/cp737.h haiku/trunk/src/libs/iconv/cp775.h haiku/trunk/src/libs/iconv/cp850.h haiku/trunk/src/libs/iconv/cp852.h haiku/trunk/src/libs/iconv/cp853.h haiku/trunk/src/libs/iconv/cp855.h haiku/trunk/src/libs/iconv/cp856.h haiku/trunk/src/libs/iconv/cp857.h haiku/trunk/src/libs/iconv/cp858.h haiku/trunk/src/libs/iconv/cp860.h haiku/trunk/src/libs/iconv/cp861.h haiku/trunk/src/libs/iconv/cp862.h haiku/trunk/src/libs/iconv/cp863.h haiku/trunk/src/libs/iconv/cp864.h haiku/trunk/src/libs/iconv/cp865.h haiku/trunk/src/libs/iconv/cp866.h haiku/trunk/src/libs/iconv/cp869.h haiku/trunk/src/libs/iconv/cp874.h haiku/trunk/src/libs/iconv/cp922.h haiku/trunk/src/libs/iconv/cp932.h haiku/trunk/src/libs/iconv/cp932ext.h haiku/trunk/src/libs/iconv/cp936.h haiku/trunk/src/libs/iconv/cp936ext.h haiku/trunk/src/libs/iconv/cp943.h haiku/trunk/src/libs/iconv/cp949.h haiku/trunk/src/libs/iconv/cp950.h haiku/trunk/src/libs/iconv/cp950ext.h haiku/trunk/src/libs/iconv/dec_hanyu.h haiku/trunk/src/libs/iconv/dec_kanji.h haiku/trunk/src/libs/iconv/encodings.def haiku/trunk/src/libs/iconv/encodings_aix.def haiku/trunk/src/libs/iconv/encodings_dos.def haiku/trunk/src/libs/iconv/encodings_extra.def haiku/trunk/src/libs/iconv/encodings_local.def haiku/trunk/src/libs/iconv/encodings_osf1.def haiku/trunk/src/libs/iconv/euc_cn.h haiku/trunk/src/libs/iconv/euc_jisx0213.h haiku/trunk/src/libs/iconv/euc_jp.h haiku/trunk/src/libs/iconv/euc_kr.h haiku/trunk/src/libs/iconv/euc_tw.h haiku/trunk/src/libs/iconv/flags.h haiku/trunk/src/libs/iconv/flushwc.h haiku/trunk/src/libs/iconv/gb12345.h haiku/trunk/src/libs/iconv/gb12345ext.h haiku/trunk/src/libs/iconv/gb18030.h haiku/trunk/src/libs/iconv/gb18030ext.h haiku/trunk/src/libs/iconv/gb18030uni.h haiku/trunk/src/libs/iconv/gb2312.h haiku/trunk/src/libs/iconv/gbk.h haiku/trunk/src/libs/iconv/gbkext1.h haiku/trunk/src/libs/iconv/gbkext2.h haiku/trunk/src/libs/iconv/gbkext_inv.h haiku/trunk/src/libs/iconv/georgian_academy.h haiku/trunk/src/libs/iconv/georgian_ps.h haiku/trunk/src/libs/iconv/hkscs1999.h haiku/trunk/src/libs/iconv/hkscs2001.h haiku/trunk/src/libs/iconv/hkscs2004.h haiku/trunk/src/libs/iconv/hp_roman8.h haiku/trunk/src/libs/iconv/hz.h haiku/trunk/src/libs/iconv/iconv.c haiku/trunk/src/libs/iconv/iconv.h haiku/trunk/src/libs/iconv/iso2022_cn.h haiku/trunk/src/libs/iconv/iso2022_cnext.h haiku/trunk/src/libs/iconv/iso2022_jp.h haiku/trunk/src/libs/iconv/iso2022_jp1.h haiku/trunk/src/libs/iconv/iso2022_jp2.h haiku/trunk/src/libs/iconv/iso2022_jp3.h haiku/trunk/src/libs/iconv/iso2022_kr.h haiku/trunk/src/libs/iconv/iso646_cn.h haiku/trunk/src/libs/iconv/iso646_jp.h haiku/trunk/src/libs/iconv/iso8859_1.h haiku/trunk/src/libs/iconv/iso8859_10.h haiku/trunk/src/libs/iconv/iso8859_11.h haiku/trunk/src/libs/iconv/iso8859_13.h haiku/trunk/src/libs/iconv/iso8859_14.h haiku/trunk/src/libs/iconv/iso8859_15.h haiku/trunk/src/libs/iconv/iso8859_16.h haiku/trunk/src/libs/iconv/iso8859_2.h haiku/trunk/src/libs/iconv/iso8859_3.h haiku/trunk/src/libs/iconv/iso8859_4.h haiku/trunk/src/libs/iconv/iso8859_5.h haiku/trunk/src/libs/iconv/iso8859_6.h haiku/trunk/src/libs/iconv/iso8859_7.h haiku/trunk/src/libs/iconv/iso8859_8.h haiku/trunk/src/libs/iconv/iso8859_9.h haiku/trunk/src/libs/iconv/isoir165.h haiku/trunk/src/libs/iconv/isoir165ext.h haiku/trunk/src/libs/iconv/java.h haiku/trunk/src/libs/iconv/jisx0201.h haiku/trunk/src/libs/iconv/jisx0208.h haiku/trunk/src/libs/iconv/jisx0212.h haiku/trunk/src/libs/iconv/jisx0213.h haiku/trunk/src/libs/iconv/johab.h haiku/trunk/src/libs/iconv/johab_hangul.h haiku/trunk/src/libs/iconv/koi8_r.h haiku/trunk/src/libs/iconv/koi8_ru.h haiku/trunk/src/libs/iconv/koi8_t.h haiku/trunk/src/libs/iconv/koi8_u.h haiku/trunk/src/libs/iconv/ksc5601.h haiku/trunk/src/libs/iconv/localcharset.c haiku/trunk/src/libs/iconv/localcharset.h haiku/trunk/src/libs/iconv/loop_unicode.h haiku/trunk/src/libs/iconv/loop_wchar.h haiku/trunk/src/libs/iconv/loops.h haiku/trunk/src/libs/iconv/mac_arabic.h haiku/trunk/src/libs/iconv/mac_centraleurope.h haiku/trunk/src/libs/iconv/mac_croatian.h haiku/trunk/src/libs/iconv/mac_cyrillic.h haiku/trunk/src/libs/iconv/mac_greek.h haiku/trunk/src/libs/iconv/mac_hebrew.h haiku/trunk/src/libs/iconv/mac_iceland.h haiku/trunk/src/libs/iconv/mac_roman.h haiku/trunk/src/libs/iconv/mac_romania.h haiku/trunk/src/libs/iconv/mac_thai.h haiku/trunk/src/libs/iconv/mac_turkish.h haiku/trunk/src/libs/iconv/mac_ukraine.h haiku/trunk/src/libs/iconv/mulelao.h haiku/trunk/src/libs/iconv/nextstep.h haiku/trunk/src/libs/iconv/pt154.h haiku/trunk/src/libs/iconv/riscos1.h haiku/trunk/src/libs/iconv/rk1048.h haiku/trunk/src/libs/iconv/shift_jisx0213.h haiku/trunk/src/libs/iconv/sjis.h haiku/trunk/src/libs/iconv/tcvn.h haiku/trunk/src/libs/iconv/tds565.h haiku/trunk/src/libs/iconv/tis620.h haiku/trunk/src/libs/iconv/translit.def haiku/trunk/src/libs/iconv/translit.h haiku/trunk/src/libs/iconv/ucs2.h haiku/trunk/src/libs/iconv/ucs2be.h haiku/trunk/src/libs/iconv/ucs2internal.h haiku/trunk/src/libs/iconv/ucs2le.h haiku/trunk/src/libs/iconv/ucs2swapped.h haiku/trunk/src/libs/iconv/ucs4.h haiku/trunk/src/libs/iconv/ucs4be.h haiku/trunk/src/libs/iconv/ucs4internal.h haiku/trunk/src/libs/iconv/ucs4le.h haiku/trunk/src/libs/iconv/ucs4swapped.h haiku/trunk/src/libs/iconv/uhc_1.h haiku/trunk/src/libs/iconv/uhc_2.h haiku/trunk/src/libs/iconv/utf16.h haiku/trunk/src/libs/iconv/utf16be.h haiku/trunk/src/libs/iconv/utf16le.h haiku/trunk/src/libs/iconv/utf32.h haiku/trunk/src/libs/iconv/utf32be.h haiku/trunk/src/libs/iconv/utf32le.h haiku/trunk/src/libs/iconv/utf7.h haiku/trunk/src/libs/iconv/utf8.h haiku/trunk/src/libs/iconv/vietcomb.h haiku/trunk/src/libs/iconv/viscii.h Log: * bring in relevant parts of libiconv from vendor branch (config.h, iconv.h and localcharset.h were created by running 'configure' on haiku) Added: haiku/trunk/src/libs/iconv/AUTHORS =================================================================== --- haiku/trunk/src/libs/iconv/AUTHORS 2008-11-12 17:02:49 UTC (rev 28628) +++ haiku/trunk/src/libs/iconv/AUTHORS 2008-11-12 17:34:47 UTC (rev 28629) @@ -0,0 +1 @@ +Bruno Haible Added: haiku/trunk/src/libs/iconv/ChangeLog =================================================================== --- haiku/trunk/src/libs/iconv/ChangeLog 2008-11-12 17:02:49 UTC (rev 28628) +++ haiku/trunk/src/libs/iconv/ChangeLog 2008-11-12 17:34:47 UTC (rev 28629) @@ -0,0 +1,4278 @@ +2007-11-11 Bruno Haible + + * Makefile.devel (AUTOCONF, AUTOHEADER): Require version 2.61. + (AUTOMAKE, ACLOCAL): Require version 1.10. + (srclib/Makefile.in): Avoid error from automake. + +2007-10-26 Bruno Haible + + * m4/libtool.m4: Update, based on libtool-1.5.24. + * build-aux/ltmain.sh: Update, based on libtool-1.5.24. + +2007-10-23 Bruno Haible + + * build-aux/config.guess: Update to GNU version 2007-07-22. + * build-aux/config.sub: Likewise. + +2007-10-23 Bruno Haible + + * configure.ac: Bump version number to 1.12. + * README: Likewise. + +2007-10-23 Bruno Haible + + Move relocatability infrastructure to gnulib. + * gnulib-local/lib/relocatable.h: Remove file. + * gnulib-local/lib/relocatable.c: Remove file. + +2007-10-23 Bruno Haible + + Update from GNU gettext. + 2006-11-26 Bruno Haible + * gnulib-local/lib/xalloc.h (xmemdup): Add a typesafe C++ + template variant. + Based on a patch from Paul Eggert in gnulib. + 2006-11-06 Bruno Haible + * gnulib-local/lib/xalloc.h (xcharalloc): New macro. + (xmemdup): New declaration. + * gnulib-local/lib/xstrdup.c (xmemdup): New function. + 2006-11-03 Bruno Haible + * gnulib-local/lib/xalloc.h (XMALLOC, XNMALLOC, XZALLOC, + XCALLOC): New macros. + (xnboundedmalloc): New inline function. + * gnulib-local/lib/xstrdup.c (xstrdup): Use XNMALLOC instead of + xmalloc. + 2006-11-02 Bruno Haible + * lib/xalloc.h (xnmalloc): New declaration. From gnulib + xalloc.h. + * lib/xmalloc.c (fixup_null_alloc): Write NULL, not 0. + (xnmalloc): New function. + +2007-10-23 Bruno Haible + + Moved module xreadlink to gnulib. + * gnulib-local/modules/xreadlink: Remove file. + * gnulib-local/lib/xreadlink.h: Remove file. + * gnulib-local/lib/xreadlink.c: Remove file. + * gnulib-local/m4/xreadlink.m4: Remove file. + +2007-10-07 Bruno Haible + + Update program license to GPLv3. + * COPYING: Replace with GPL 3. + * windows/iconv.rc (Comments): Update. + +2007-10-07 Bruno Haible + + * gnulib-local/lib/alloca.in.h: Renamed from gnulib-local/lib/alloca_.h. + +2007-03-30 Bruno Haible + + * gnulib-local/lib/alloca_.h: Change prefix of double-inclusion guard + macro to _GL_. + +2006-06-19 Paul Eggert + + * gnulib-local/lib/alloca_.h (alloca) [defined alloca]: Don't define or + declare. + +2007-09-29 Bruno Haible + + * autogen.sh (GNULIB_CVS_ROOT): Change to read-only git mirror + valid since 2007-09-19. + +2007-07-07 Bruno Haible + + * autogen.sh: Add an option --skip-gnulib. + +2007-07-07 Bruno Haible + + * gnulib-local/lib/uniwidth.h: Remove file, moved to gnulib. + * gnulib-local/lib/width.c: Remove file, moved to gnulib. + * gnulib-local/lib/cjk.h: Remove file, moved to gnulib. + * gnulib-local/modules/uniwidth: Remove file. + * Makefile.devel (GNULIB_MODULES): Remove uniwidth, add uniwidth/width. + * src/iconv.c: Include uniwidth/cjk.h instead of cjk.h. + +2007-06-30 Bruno Haible + + * src/iconv.c (print_version): Use the standard --version output, see + . + +2007-06-30 Bruno Haible + + * autogen.sh: New file. + * DEPENDENCIES: New file. + * HACKING: New file. + +2007-06-30 Bruno Haible + + * src/iconv.c: Provide translator comments for many messages. + (conversion_error_EILSEQ, conversion_error_EINVAL, + conversion_error_other): New functions, extracted from convert. + (convert): Use them. + Reported by Tim Van Holder . + +2007-06-09 Bruno Haible + + * gnulib-local/lib/relocwrapper.c: Remove file. + +2007-05-27 Bruno Haible + + * windows/libiconv.rc: New file. + * windows/iconv.rc: New file. + * windows/windres-options: New file. + * configure.ac (WOE32): New variable. + (WINDRES) [WOE32]: New variable. + * lib/Makefile.in (WINDRES): New variable. + (PACKAGE_VERSION): New variable. + (OBJECTS_EXP_yes): Renamed from OBJECTS_yes. + (OBJECTS_EXP_no): Renamed from OBJECTS_no. + (OBJECTS_RES_yes, OBJECTS_RES_no): New variables. + (OBJECTS): Add one of them. + (libiconv.res): New rule. + (clean): Remove also libiconv.res. + * src/Makefile.in (WINDRES): New variable. + (PACKAGE_VERSION): New variable. + (OBJECTS_RES_yes, OBJECTS_RES_no): New variables. + (all, iconv_no_i18n, install): Use them. + (iconv.res): New rule. + (clean): Remove also iconv.res. + Suggested and inspired by work by Perry Rapp. + +2007-05-27 Bruno Haible + + Follow broken iconv() prototype in POSIX. + * configure.ac (ICONV_CONST): Set to empty if the system has no iconv. + * lib/config.h.in (ICONV_CONST): Change default value to an empty + comment. + * src/iconv.c (ICONV_CONST): Change default value to empty. + Reported by Andreas Krennmair . + +2007-05-25 Bruno Haible + + * tools/Makefile (ALL): Add rk1048.h. + (rk1048.h): New rule. + * lib/encodings.def: Add RK1048. + * lib/rk1048.h: New file. + * lib/converters.h: Include it. + * README, man/iconv_open.3: Add RK1048. + * NOTES: Mention RK1048. + * tests/RK1048.TXT: New file. + * tests/Makefile.in (check): Also test RK1048. + Suggested by Timur Birsh . + +2007-04-24 Bruno Haible + + * man/iconv_open.3: Tweak explanation of TRANSLIT. + Reported by Perry Rapp. + +2007-04-23 Bruno Haible + + * tests/check-subst: Use the output of 'printf' only if it didn't + crash. Needed to work around a buffer overflow in Solaris /bin/printf. + Reported by Arto C. Nirkko . + +2007-04-23 Bruno Haible + + * lib/iconv.c (iconv_open, iconv_canonicalize): Treat native Woe32 + systems like those which define __STDC_ISO_10646__. + Reported by Keith Marshall . + +2007-03-31 Bruno Haible + + * man/iconv.1: Use HYPHEN-MINUS signs instead of HYPHENs where + appropriate. + * man/iconv_open.3: Likewise. + * man/iconv.3: Likewise. + * man/iconv_close.3: Likewise. + * man/iconvctl.3: Likewise. + +2007-03-31 Bruno Haible + + * man/iconv.1: Mark as POSIX compliant. + * man/iconv_open.3: Likewise. + * man/iconv.3: Likewise. + * man/iconv_close.3: Likewise. + + * man/*.[13]: Syntactic simplifications. + +2007-03-19 Bruno Haible + + Assume that mkinstalldirs also creates the necessary parent directories. + * Makefile.in (install, installdirs): Don't explicitly create the + parent directories. + * lib/Makefile.in (install, installdirs): Likewise. + * src/Makefile.in (install, installdirs): Likewise. + * man/Makefile.in (install, installdirs): Likewise. + Reported by Thomas Klausner . + +2007-03-04 Bruno Haible + + * Makefile.devel (GNULIB_MODULES): Add relocatable-prog. Remove + relocatable, relocwrapper. + * configure.ac: Invoke gl_RELOCATABLE instead of AC_RELOCATABLE. + * gnulib-local/modules/progreloc: Remove file. + * gnulib-local/modules/relocatable: Remove file. + * gnulib-local/modules/relocwrapper: Remove file. + * gnulib-local/m4/relocatable.m4: Remove file. + * gnulib-local/lib/strerror.c.diff: Remove file. + * src/Makefile.in: Remove SET_RELOCATABLE invocation. Instead get + RELOCATABLE_LDFLAGS and INSTALL_PROGRAM_ENV. + +2007-02-19 Bruno Haible + + * gnulib-local/lib/xmalloc.c: Don't include exit.h. + * src/iconv.c: Likewise. + +2007-02-16 Juan Manuel Guerrero + + * djgpp/*: Update. + +2007-02-03 Bruno Haible + + * tools/Makefile (ksc5601.h): Add one extra character. + * lib/ksc5601.h: Regenerated. + * lib/cp949.h (cp949_mbtowc, cp949_wctomb): Exclude the new character. + * tests/EUC-KR.TXT: Add CIRCLED HANGUL IEUNG U. + * tests/JOHAB.TXT: Likewise. + Reported by Jungshik Shin (???, ???) . + + * lib/euc_kr.h: Update comments. + * lib/johab.h: Likewise. + +2007-02-03 Bruno Haible + + * tools/cjk_tab_to_h.c (output_title): Bump copyright year. + +2007-01-26 Bruno Haible + + Moved streq.h to gnulib. + * gnulib-local/lib/streq.h: Remove file. + * gnulib-local/modules/uniwidth (Files): Remove lib/streq.h. + (Depends-on): Add streq. + (lib_SOURCES): Remove streq.h. + +2007-01-26 Bruno Haible + + Moved unitypes.h to gnulib. + * gnulib-local/lib/unitypes.h: Remove file. + * gnulib-local/modules/uniwidth (Files): Remove lib/unitypes.h. + (Depends-on): Add unitypes. + (lib_SOURCES): Remove unitypes.h. + +2007-01-26 Bruno Haible + + Moved canonicalize to gnulib. + * gnulib-local/modules/canonicalize: Remove file. + * gnulib-local/lib/canonicalize.h: Remove file. + * gnulib-local/lib/canonicalize.c: Remove file. + * gnulib-local/m4/canonicalize.m4: Remove file. + * gnulib-local/modules/progreloc (Depends-on): Replace 'canonicalize' + with 'canonicalize-lgpl'. + +2006-12-20 Bruno Haible + + * lib/Makefile.in (install): On AIX, add the contents of + /lib/libiconv.a to libiconv.a. + +2006-12-20 Bruno Haible + + * Makefile.devel (all): Depend on srclib/Makefile.gnulib, not + srclib/Makefile.am. + (aclocal.m4): Likewise. Touch the resulting file, since aclocal not + always does it. + (srclib/Makefile.gnulib): Renamed from srclib/Makefile.am. Pass + option --makefile-name. + (srclib/Makefile.in): Depend on srclib/Makefile.gnulib too. + * srclib/Makefile.am: New file that includes srclib/Makefile.gnulib. + +2006-10-31 Bruno Haible + + Update from GNU gettext. + 2006-10-29 Bruno Haible + Make it compile in C++ mode. + * gnulib-local/lib/xalloc.h (xrealloc): Define as template + with appropriate return type. + * gnulib-local/lib/xstrdup.c (xstrdup): Cast xmalloc result. + 2006-10-26 Bruno Haible + * gnulib-local/modules/canonicalize (Makefile.am): Remove + EXTRA_DIST. Now done by gnulib-tool. + * gnulib-local/modules/relocatable (Makefile.am): Likewise. + * gnulib-local/modules/relocwrapper (Makefile.am): Likewise. + 2006-10-25 Bruno Haible + * gnulib-local/m4/relocatable.m4 (AC_RELOCATABLE_BODY): + Renamed from AC_RELOCATABLE, without the AC_LIBOBJ invocation. + (AC_RELOCATABLE): New macro. Invoke AC_LIBOBJ here. + * gnulib-local/modules/relocwrapper (configure.ac): Invoke + AC_RELOCATABLE instead of requiring it. + 2006-10-12 Bruno Haible + * gnulib-local/modules/canonicalize (Makefile.am): Distribute + all files in lib/ through EXTRA_DIST. + * gnulib-local/modules/relocatable (Makefile.am): Likewise. + 2006-09-14 Bruno Haible + * gnulib-local/lib/canonicalize.c: Include + unconditionally. + * gnulib-local/lib/relocatable.c: Likewise. + * lib/relocatable.c: Likewise. + * gnulib-local/lib/relocwrapper.c: Likewise. + * gnulib-local/lib/xmalloc.c: Likewise. + * gnulib-local/lib/xreadlink.c: Likewise. + * gnulib-local/lib/xstrdup.c: Likewise. + 2006-08-02 Bruno Haible + * gnulib-local/modules/canonicalize: Put under LGPL. + * gnulib-local/modules/relocatable: Likewise. + 2006-07-18 Bruno Haible + * gnulib-local/xalloc.h (xzalloc): New declaration. + * gnulib-local/xmalloc.c (xzalloc): New function. + +2006-10-24 Bruno Haible + + * man/Makefile.in (PACKAGE): New variable. Needed for docdir. + Reported by Charles Wilson . + +2006-10-14 Bruno Haible + + * COPYING: New file. + * README: Clarify copyright of the iconv program. + Reported by Charles Wilson . + +2006-08-08 Bruno Haible + + * INSTALL.generic: Add a recommendation for Tru64. + Reported by Gary V. Vaughan . + +2006-07-29 Bruno Haible + + * tests/check-subst: Set CHARSETALIASDIR. + Needed so that "make check" works before "make install" on systems + such as NetBSD. + +2006-07-29 Bruno Haible + + * Makefile.devel (aclocal.m4): Depend on srclib/Makefile.am. + (AUTOCONF_FILES): Add the existing *.m4 files. + +2006-07-29 Bruno Haible + + * gnulib-local/lib/xreadlink.c: Assume exists. + * src/iconv.c: Assume exists. + * configure.ac: Remove tests for , , , + . + +2006-07-29 Bruno Haible + + * configure.ac: Remove obsolete calls AC_PROG_GCC_TRADITIONAL, + AC_ISC_POSIX, AC_HEADER_STDC. + +2006-07-29 Bruno Haible + + * configure.ac: Remove macro invocations that are redundant through + gl_EARLY and gl_INIT. + +2006-07-29 Bruno Haible + + * gnulib-local/m4/alloca.m4 (gl_PREREQ_ALLOCA): Add a dummy statement. + Avoids a sh syntax error. + +2006-07-29 Bruno Haible + + * gnulib-local/m4/relocatable.m4: Add comments. + +2006-07-29 Bruno Haible + + * gnulib-local/modules/libiconv-misc: New file. + * Makefile.devel (GNULIB_MODULES): Add libiconv-misc. + + * Makefile.devel (srclib/Makefile.am): Pass --no-libtool. + +2006-07-29 Bruno Haible + + Note: gnulib macros no longer invoke AC_TYPE_SIZE_T nor + AC_CHECK_TYPE([ptrdiff_t], , [AC_DEFINE([ptrdiff_t], [long], ...)]) + because we now assume that the system defines size_t and ptrdiff_t. + +2006-07-29 Bruno Haible + + Switch to using gnulib. + * configure.ac (AC_PREREQ): Require autoconf-2.60. + Invoke gl_EARLY and gl_INIT. + * Makefile.devel (all): Depend on srclib/Makefile.am. + (aclocal.m4): Pass -I srcm4 to aclocal. Simplify dependencies, assuming + GNU make. + (GNULIB_MODULES): New variable. + (srclib/Makefile.am): New rule. + * gnulib-local: New directory. + * gnulib-local/m4/alloca.m4: Moved here from m4/alloca.m4. + * gnulib-local/m4/canonicalize.m4: Moved here from m4/canonicalize.m4. + * gnulib-local/m4/relocatable.m4: Moved here from m4/relocatable.m4. + * gnulib-local/m4/xreadlink.m4: Moved here from m4/xreadlink.m4. + * gnulib-local/lib/alloca_.h: Moved here from srclib/alloca_.h. + * gnulib-local/lib/canonicalize.h: Moved here from srclib/canonicalize.h. + * gnulib-local/lib/canonicalize.c: Moved here from srclib/canonicalize.c. + * gnulib-local/lib/cjk.h: Moved here from srclib/cjk.h. + * gnulib-local/lib/error.h.diff: New file. + * gnulib-local/lib/progname.h.diff: New file. + * gnulib-local/lib/relocatable.h: Moved here from srclib/relocatable.h. + * gnulib-local/lib/relocatable.c: Moved here from srclib/relocatable.c. + * gnulib-local/lib/relocwrapper.c: Moved here from srclib/relocwrapper.c. + * gnulib-local/lib/streq.h: Moved here from srclib/streq.h. + * gnulib-local/lib/strerror.c.diff: New file. + * gnulib-local/lib/unitypes.h: Moved here from srclib/unitypes.h. + * gnulib-local/lib/uniwidth.h: Moved here from srclib/uniwidth.h. + * gnulib-local/lib/width.c: Moved here from srclib/width.c. + * gnulib-local/lib/xalloc.h: Moved here from srclib/xalloc.h. + * gnulib-local/lib/xmalloc.c: Moved here from srclib/xmalloc.c. + * gnulib-local/lib/xstrdup.c: Moved here from srclib/xstrdup.c. + * gnulib-local/lib/xreadlink.h: Moved here from srclib/xreadlink.h. + * gnulib-local/lib/xreadlink.c: Moved here from srclib/xreadlink.c. + * gnulib-local/modules/canonicalize: New file. + * gnulib-local/modules/progreloc: New file. + * gnulib-local/modules/relocatable: New file. + * gnulib-local/modules/relocwrapper: New file. + * gnulib-local/modules/uniwidth: New file. + * gnulib-local/modules/xalloc: New file. + * gnulib-local/modules/xreadlink: New file. + + * m4/allocsa.m4: Remove file. Now taken from gnulib. + * m4/codeset.m4: Likewise. + * m4/eealloc.m4: Likewise. + * m4/error.m4: Likewise. + * m4/extensions.m4: Likewise. + * m4/full-header-path.m4: Likewise. + * m4/gettext.m4: Likewise. + * m4/glibc21.m4: Likewise. + * m4/iconv.m4: Likewise. + * m4/intmax.m4: Likewise. + * m4/inttypes-h.m4: Likewise. + * m4/inttypes_h.m4: Likewise. + * m4/isc-posix.m4: Likewise. + * m4/lcmessage.m4: Likewise. + * m4/lib-ld.m4: Likewise. + * m4/lib-link.m4: Likewise. + * m4/lib-prefix.m4: Likewise. + * m4/longdouble.m4: Likewise. + * m4/longlong.m4: Likewise. + * m4/mbstate_t.m4: Likewise. + * m4/nls.m4: Likewise. + * m4/onceonly.m4: Likewise. + * m4/pathmax.m4: Likewise. + * m4/po.m4: Likewise. + * m4/printf-posix.m4: Likewise. + * m4/progtest.m4: Likewise. + * m4/readlink.m4: Likewise. + * m4/setenv.m4: Likewise. + * m4/signed.m4: Likewise. + * m4/size_max.m4: Likewise. + * m4/ssize_t.m4: Likewise. + * m4/stdbool.m4: Likewise. + * m4/stdint.m4: Likewise. + * m4/stdint_h.m4: Likewise. + * m4/strerror.m4: Likewise. + * m4/strerror_r.m4: Likewise. + * m4/unistd_h.m4: Likewise. + * m4/unlocked-io.m4: Likewise. + * m4/visibility.m4: Likewise. + * m4/wchar_t.m4: Likewise. + * m4/wint_t.m4: Likewise. + + * srclib/allocsa.h: Remove file. Now taken from gnulib. + * srclib/allocsa.c: Likewise. + * srclib/binary-io.h: Likewise. + * srclib/error.h: Likewise. + * srclib/error.c: Likewise. + * srclib/exit.h: Likewise. + * srclib/gettext.h: Likewise. + * srclib/memmove.c: Likewise. + * srclib/pathmax.h: Likewise. + * srclib/progname.h: Likewise. + * srclib/progname.c: Likewise. + * srclib/progreloc.c: Likewise. + * srclib/readlink.c: Likewise. + * srclib/setenv.h: Likewise. + * srclib/setenv.c: Likewise. + * srclib/stdbool_.h: Likewise. + * srclib/stdint_.h: Likewise. + * srclib/strerror.c: Likewise. + * srclib/unlocked-io.h: Likewise. + * srclib/unsetenv.c: Likewise. + * srclib/Makefile.am: Remove file. + +2006-07-27 Bruno Haible + + Remove OS/2 build support that doesn't assume GNU make and GNU bash. + * README.os2: Remove file. + * Makefile.os2: Remove file. + * lib/Makefile.os2: Remove file. + * src/Makefile.os2: Remove file. + * man/Makefile.os2: Remove file. + * tests/Makefile.os2: Remove file. + * tests/check-stateful.cmd: Remove file. + * tests/check-stateless.cmd: Remove file. + * tests/check-translit.cmd: Remove file. + +2006-07-25 Bruno Haible + + Remove MSVC/nmake build support. + * windows: Remove directory. + * Makefile.msvc: Remove file. + * lib/Makefile.msvc: Remove file. + * srclib/Makefile.msvc: Remove file. + * src/Makefile.msvc: Remove file. + * tests/Makefile.msvc: Remove file. + * man/Makefile.msvc: Remove file. + * po/Rules-msvc: Remove file. + * po/Makefile.msvc.sh: Remove file. + * Makefile.devel (config.h.msvc, lib/config.h.msvc): Remove rules. + (include/iconv.h.msvc-static, include/iconv.h.msvc-shared): Remove + rules. + (po/Makefile.msvc): Remove rule. + (all): Update. + +2006-07-25 Bruno Haible + + Remove VMS support. + * vms: Remove directory. + * Makefile.vms: Remove file. + * lib/Makefile.vms: Remove file. + * srclib/Makefile.vms: Remove file. + * src/Makefile.vms: Remove file. + * tests/Makefile.vms: Remove file. + * man/Makefile.vms: Remove file. + * Makefile.devel (config.h_vms, lib/config.h_vms): Remove rules. + (include/iconv.h_vms): Remove rule. + (all): Update. + +2006-07-23 Bruno Haible + + * lib/Makefile.in (libiconv.la): Use the CFLAGS during linking. + * src/Makefile.in (iconv_no_i18n): Likewise. + (install): Likewise. + * tests/Makefile.in (table-from, table-to): Likewise. + Needed because the CFLAGS can e.g. trigger profiling. + Reported by Russell Aspinwall . + +2006-07-19 Bruno Haible + + * Version 1.11 released. + +2006-07-19 Bruno Haible + + * srclib/Makefile.am (libicrt_a_SOURCES): Remove error.h, error.c. + (LIBADD_SOURCE): Add them here. + +2006-07-19 Bruno Haible + + * build-aux/config.guess: Update to GNU version 2006-07-02. + * build-aux/config.sub: Likewise. + +2006-07-14 Bruno Haible + + * lib/Makefile.in (clean): Remove also *.stackdump. + * src/Makefile.in (clean): Likewise. + * tests/Makefile.in (clean): Likewise. + +2006-07-14 Bruno Haible + + * src/Makefile.in (clean): Remove also iconv_no_i18n. Needed for + cygwin or mingw. + * tests/Makefile.in (clean): Remove also the programs, without + EXEEXT. Needed for cygwin or mingw. + * Makefile.in (mostlyclean, clean, distclean, maintainer-clean): + Remove also bin directory. Needed for cygwin and mingw. + +2006-07-03 Bruno Haible + + * src/iconv.c (check_subst_formatstring): Use ngettext. + (subst_wc_to_mb_fallback, subst_mb_to_mb_fallback): Fix error messages + after 2006-01-22 change. + * configure.ac: Require a gettext version with ngettext. + +2006-06-28 Bruno Haible + + * m4/gettext.m4: Update from GNU gettext. + * m4/po.m4: Update from GNU gettext. + +2006-06-27 Bruno Haible + + * Makefile.devel (AUTOCONF, AUTOHEADER): Use autoconf-2.60. + * Makefile.in (datarootdir): New variable. + (install, installdirs, uninstall): Also pass datarootdir. + * configure.ac (mandir): Remove customization. + * man/Makefile.in (datarootdir): New variable. + (docdir, htmldir): Use autoconf-substituted value. + * src/Makefile.in (datarootdir): New variable. + (localedir): Use autoconf-substituted value. + +2006-06-27 Bruno Haible + + * m4/stdint.m4: Update from gnulib. + * srclib/stdint_.h: Update from gnulib. + * srclib/Makefile.am: Update. + +2006-06-17 Bruno Haible + + * srclib/unsetenv.c: Update from GNU gettext. + * srclib/xreadlink.c: Likewise. + +2006-06-16 Bruno Haible + + * m4/full-header-path.m4: New file, from gnulib. + * m4/size_max.m4: New file, from gnulib. + * m4/stdint.m4: Update from gnulib. + * srclib/stdint_.h: Update from gnulib. + * srclib/Makefile.am (stdint.h): Likewise. + * Makefile.devel (aclocal.m4): Update dependencies. + +2006-06-16 Bruno Haible + + * m4/ssize_t.m4: Update from GNU gettext. + +2006-06-12 Bruno Haible + + * m4/gettext.m4: Update from GNU gettext. + * m4/inttypes-h.m4: New file, from GNU gettext. + * m4/inttypes.m4: Remove file. + * m4/stdint.m4 (gl_STDINT_H): Update. + * Makefile.devel (aclocal.m4): Update dependencies. + +2006-06-10 Bruno Haible + + * src/iconv.c (error) [NO_I18N]: Define here instead of including + error.h. Fixes link failure introduced on 2006-01-22. + +2006-03-28 Ralf Wildenhues + + * m4/libtool.m4 (_LT_SYS_DYNAMIC_LINKER) [ linux ]: Avoid warning when + "parsing" /etc/ld.so.conf and empty /etc/ld.so.conf.d. + +2006-05-20 Bruno Haible + + * tests/BIG5-HKSCS-1999-snippet: New file. + * tests/BIG5-HKSCS-1999-snippet.UTF-8: New file. + * tests/BIG5-HKSCS-2001-snippet: New file. + * tests/BIG5-HKSCS-2001-snippet.UTF-8: New file. + * tests/BIG5-HKSCS-2004-snippet: New file. + * tests/BIG5-HKSCS-2004-snippet.UTF-8: New file. + * tests/Makefile.in (check): Test also the stateful parts of + BIG5-HKSCS:1999, BIG5-HKSCS:2001, BIG5-HKSCS:2004. + +2006-05-17 Bruno Haible + + Implement newer releases of BIG5-HKSCS. + * tools/Makefile (ALL): Remove hkscs.h, add hkscs1999.h, hkscs2001.h, + hkscs2004.h. + (hkscs.h): Remove rule. + (hkscs1999.h, hkscs2001.h, hkscs2004.h): New rules. + * tools/cjk_tab_to_h.c (output_title): Update year. + (main): Recognize hkscs1999, hkscs2001, hkscs2004. + * lib/encodings.def: Rename BIG5-HKSCS to BIG5-HKSCS:1999. Add + BIG5-HKSCS:2001, BIG5-HKSCS:2004. Make all three stateful. + * lib/hkscs.h: Remove file. + * lib/hkscs1999.h: New file. + * lib/hkscs2001.h: New file. + * lib/hkscs2004.h: New file. + * lib/big5hkscs.h: Remove file. + * lib/big5hkscs1999.h: New file. + * lib/big5hkscs2001.h: New file. + * lib/big5hkscs2004.h: New file. + * lib/converters.h: Include the new files. + * README, man/iconv_open.3: Add BIG5-HKSCS:1999, BIG5-HKSCS:2001. + * tests/BIG5-HKSCS.TXT: Remove file. + * tests/BIG5-HKSCS.IRREVERSIBLE.TXT: Remove file. + * tests/BIG5-HKSCS-1999.TXT: New file. + * tests/BIG5-HKSCS-1999.IRREVERSIBLE.TXT: New file. + * tests/BIG5-HKSCS-2001.TXT: New file. + * tests/BIG5-HKSCS-2001.IRREVERSIBLE.TXT: New file. + * tests/BIG5-HKSCS-2004.TXT: New file. + * tests/BIG5-HKSCS-2004.IRREVERSIBLE.TXT: New file. + * tests/check-stateless: Convert colon in the charset name to a dash in + the file name. + * tests/Makefile.in (check): Check BIG5-HKSCS:1999, BIG5-HKSCS:2001, + BIG5-HKSCS:2004 instead of just BIG5-HKSCS. + * tests/Makefile.msvc (check): Don't check BIG5-HKSCS. + * tests/Makefile.os2 (check): Likewise. + +2006-05-17 Bruno Haible + + * srclib/progreloc.c: Update from GNU gettext. + +2006-05-16 Bruno Haible + + * src/Makefile.in (clean): Use EXEEXT. + * tests/Makefile.in (check, clean): Likewise. + +2006-05-15 Bruno Haible + + * configure.ac: Move some checks before AC_RELOCATABLE. + +2006-05-15 Bruno Haible + + Support for building shared libraries on mingw and Cygwin. + * configure.ac (WOE32DLL, DLL_VARIABLE): New variables. + * include/iconv.h.in (_libiconv_version): Mark as DLL_VARIABLE. + * woe32dll/export.h: New file, from GNU gettext. + * woe32dll/iconv-exports.h: New file. + * Makefile.devel (include/iconv.h_vms, include/iconv.h.msvc-static, + include/iconv.h.msvc-shared): Remove the DLL_VARIABLE annotation. + * lib/Makefile.in (INCLUDES): Add -I for parent directory. + (LDFLAGS): Add WOE32DLL dependent flags. + (LDFLAGS_yes, LDFLAGS_no): New variables. + (OBJECTS): Add WOE32DLL dependent objects. + (OBJECTS_yes, OBJECTS_no): New variables. + (iconv-exports.lo): New rule. + +2006-05-15 Bruno Haible + + * srclib/gettext.h: Update from GNU gettext. + * srclib/pathmax.h: Update from GNU gettext. + * srclib/progreloc.c: Update from GNU gettext. + * srclib/unsetenv.c: Update from GNU gettext. + * srclib/Makefile.am: Add snippet for creation of unistd.h. + * m4/extensions.m4: Update from GNU gettext. + * m4/gettext.m4: Update from GNU gettext. + * m4/lib-ld.m4: Update from GNU gettext. + * m4/lib-link.m4: Update from GNU gettext. + * m4/lib-prefix.m4: Update from GNU gettext. + * m4/longdouble.m4: Update from GNU gettext. + * m4/nls.m4: Update from GNU gettext. + * m4/onceonly.m4: Update from GNU gettext. + * m4/po.m4: Update from GNU gettext. + * m4/relocatable.m4: Update from GNU gettext. + * m4/unistd_h.m4: New file, from GNU gettext. + * Makefile.devel (aclocal.m4): Depend on it. + * configure.ac: Invoke gl_HEADER_UNISTD. + +2006-05-14 Bruno Haible , + Ralf Wildenhues + + * m4/libtool.m4 [ linux ] (AC_LIBTOOL_LANG_CXX_CONFIG) + (AC_LIBTOOL_POSTDEP_PREDEP, AC_LIBTOOL_PROG_COMPILER_PIC) + (AC_LIBTOOL_PROG_LD_SHLIBS): Add support for Sun C 5.9, + Sun C++ 5.9, and Sun Fortran 8.3 on Linux. + +2006-05-06 Charles Wilson + + * m4/libtool.m4: On Cygwin, like on mingw, define DLL_EXPORT when + compiling a shared library object. + +2006-05-15 Bruno Haible + + * build-aux/config.rpath: Add support for Sun C 5.9 on Linux. + +2006-03-31 Juan Manuel Guerrero + + * djgpp/*: Update. + +2006-01-23 Bruno Haible + + * configure.ac: Invoke gl_ALLOCSA. + + * Makefile.devel (aclocal.m4): Depend on $(CONFIGURES_IN). + +2006-01-22 Bruno Haible + + * src/iconv.c (xmalloc, xalloc_die) [NO_I18N]: Define to avoid using + gettext(). + +2006-01-22 Bruno Haible + + * lib/Makefile.in (LIBICONV_VERSION_INFO): Bump to 6:0:4. + +2006-01-22 Bruno Haible + + * src/iconv.c: Include error.h, exit.h. + (print_version): Use EXIT_SUCCESS. + (check_subst_formatstring, subst_mb_to_uc_fallback, + subst_uc_to_mb_fallback, subst_mb_to_wc_fallback, + subst_wc_to_mb_fallback, subst_mb_to_mb_fallback, convert, main): Use + error() instead of fprintf to stderr. + +2006-01-22 Bruno Haible + + New feature: character-dependent substitutions. + * include/iconv.h.in (iconv_unicode_mb_to_uc_fallback, + iconv_unicode_uc_to_mb_fallback, iconv_wchar_mb_to_wc_fallback, + iconv_wchar_wc_to_mb_fallback): New types. + (struct iconv_fallbacks): New structure type. + (ICONV_SET_FALLBACKS): New macro. + * configure.ac: Invoke gt_TYPE_WCHAR_T and substitute HAVE_WCHAR_T. + * Makefile.os2 (all): Also substitute @HAVE_WCHAR_T@ in build/iconv.h. + * Makefile.devel (include/iconv.h_vms, include/iconv.h.msvc-static, + include/iconv.h.msvc-shared): Also substitute @HAVE_WCHAR_T at . + * lib/converters.h (struct conv_struct): Add field 'fallbacks'. + * lib/loop_unicode.h (struct uc_to_mb_fallback_locals): New type. + (uc_to_mb_write_replacement): New function. + (struct mb_to_uc_fallback_locals): New type. + (mb_to_uc_write_replacement): New function. + (unicode_loop_convert): Call mb_to_uc_fallback and uc_to_mb_fallback. + (unicode_loop_reset): Call uc_to_mb_fallback. + * lib/loop_wchar.h (struct wc_to_mb_fallback_locals): New type. + (wc_to_mb_write_replacement): New function. + (wchar_from_loop_convert): Call wc_to_mb_fallback. + (struct mb_to_wc_fallback_locals): New type. + (mb_to_wc_write_replacement): New function. + (wchar_to_loop_convert): Call mb_to_wc_fallback. + * lib/iconv.c (iconv_open): Initialize the 'fallbacks' field. + (iconvctl): Handle ICONV_SET_FALLBACKS. + * lib/genflags.c (struct iconv_fallbacks): New dummy definition. + * src/iconv.c: Include limits.h. + (isdigit, c_isprint): New macros. + (usage): Document long options and new options. + (check_subst_formatstring): New function. + (ilseq_byte_subst, ilseq_wchar_subst, ilseq_unicode_subst): New + variables. + (ilseq_byte_subst_size, ilseq_wchar_subst_size, + ilseq_unicode_subst_size): New variables. + (ilseq_byte_subst_buffer, ilseq_wchar_subst_buffer, + ilseq_unicode_subst_buffer): New variables. + (subst_mb_to_uc_cd, subst_mb_to_uc_temp_buffer): New variables. + (subst_mb_to_uc_fallback): New function. + (subst_uc_to_mb_cd, subst_uc_to_mb_temp_buffer): New variables. + (subst_uc_to_mb_fallback): New function. + (subst_mb_to_wc_cd, subst_mb_to_wc_temp_buffer): New variables. + (subst_mb_to_wc_fallback): New function. + (subst_wc_to_mb_cd, subst_wc_to_mb_temp_buffer): New variables. + (subst_wc_to_mb_fallback): New function. + (subst_mb_to_mb_cd, subst_mb_to_mb_temp_buffer): New variables. + (subst_mb_to_mb_fallback): New function. + (convert): Enlarge the outbuf when the conversion failed with E2BIG. + (main): Handle new options --byte-subst, --widechar-subst, + --unicode-subst. + * man/iconv.1: Document --unicode-subst, --byte-subst, --widechar-subst + options. + * tests/check-subst: New file. + * tests/Makefile.in (check): Also invoke check-subst. + Suggested by James Taylor . + +2006-01-21 Bruno Haible + + * src/iconv.c (print_version): Bump copyright year. + (main): Accept long options --from-code, --to-code, --list, --silent. + Accept abbreviated long options, like getopt() does. + * man/iconv.1: Document long options. + +2005-12-29 Bruno Haible + + * src/iconv.c (print_version): Update copyright year. + +2005-12-29 Bruno Haible + + * configure.ac: Renamed from configure.in. + * Makefile.devel (CONFIGURES_IN, configure, config.h.in): Update. + +2005-12-29 Bruno Haible + + * configure.in: Bump version number. + * include/iconv.h.in (_LIBICONV_VERSION): Likewise. + * windows/iconv.rc: Likewise. + * lib/Makefile.in (LIBICONV_VERSION_INFO): Bump to 5:1:3. + +2005-12-29 Bruno Haible + + * build-aux/config.guess: Update to GNU version 2005-12-23. + * build-aux/config.sub: Likewise. + * build-aux/config.libpath: Update from GNU gettext. + * build-aux/install-sh: Upgrade to automake-1.9.5. + * build-aux/missing: Upgrade to automake-1.9.5. + * build-aux/mkinstalldirs: Upgrade to automake-1.9.5. + +2005-12-29 Bruno Haible + + * m4/alloca.m4: Update from GNU gettext. + * m4/allocsa.m4: Update from GNU gettext. + * m4/canonicalize.m4: Update from GNU gettext. + * m4/codeset.m4: Update from GNU gettext. + * m4/eealloc.m4: Update from GNU gettext. + * m4/error.m4: Update from GNU gettext. + * m4/extensions.m4: Update from GNU gettext. + * m4/gettext.m4: Update from GNU gettext. + * m4/glibc21.m4: Update from GNU gettext. + * m4/iconv.m4: Update from GNU gettext. + * m4/intmax.m4: Update from GNU gettext. + * m4/inttypes_h.m4: New file, from GNU gettext. + * m4/isc-posix.m4: Update from GNU gettext. + * m4/lcmessage.m4: Update from GNU gettext. + * m4/longdouble.m4: Update from GNU gettext. + * m4/longlong.m4: Update from GNU gettext. + * m4/mbstate_t.m4: Update from GNU gettext. + * m4/nls.m4: Update from GNU gettext. + * m4/onceonly.m4: Update from GNU gettext. + * m4/pathmax.m4: Update from GNU gettext. + * m4/po.m4: Update from GNU gettext. + * m4/printf-posix.m4: Update from GNU gettext. + * m4/progtest.m4: Update from GNU gettext. + * m4/readlink.m4: Update from GNU gettext. + * m4/relocatable.m4: Update from GNU gettext. + * m4/setenv.m4: Update from GNU gettext. + * m4/signed.m4: Update from GNU gettext. + * m4/ssize_t.m4: Update from GNU gettext. + * m4/stdbool.m4: Update from GNU gettext. + * m4/stdint_h.m4: New file, from GNU gettext. + * m4/strerror.m4: Update from GNU gettext. + * m4/strerror_r.m4: Update from GNU gettext. + * m4/unlocked-io.m4: Update from GNU gettext. + * m4/wchar_t.m4: Update from GNU gettext. + * m4/wint_t.m4: Update from GNU gettext. + * m4/xreadlink.m4: Update from GNU gettext. + * Makefile.devel (aclocal.m4): Depend on m4/inttypes_h.m4 and + m4/stdint_h.m4 as well. + * configure.in: Invoke AC_TYPE_MBSTATE_T instead of AC_MBSTATE_T. + Invoke gl_FUNC_GLIBC_UNLOCKED_IO instead of jm_FUNC_GLIBC_UNLOCKED_IO. + Invoke gl_ERROR instead of gt_FUNC_ERROR_AT_LINE. + Don't invoke AC_AIX and AC_MINIX, done by gl_USE_SYSTEM_EXTENSIONS. + Temporarily redefine AC_LIBOBJ and AC_REPLACE_FUNCS, so as to fill + SRCLIBOBJS instead of LIBOBJS. + * srclib/alloca_.h: Update from GNU gettext. + * srclib/allocsa.h: Update from GNU gettext. + * srclib/canonicalize.c: Update from GNU gettext. + * srclib/error.h: Update from GNU gettext. + * srclib/error.c: Update from GNU gettext. + * srclib/gettext.h: Update from GNU gettext. + * srclib/memmove.c: Update from GNU gettext. + * srclib/progname.h: Update from GNU gettext. + * srclib/progname.c: Update from GNU gettext. + * srclib/progreloc.c: Update from GNU gettext. + * srclib/readlink.c: Update from GNU gettext. + * srclib/relocatable.c: Update from GNU gettext. + * srclib/relocwrapper.c: Update from GNU gettext. + * srclib/setenv.h: Update from GNU gettext. + * srclib/setenv.c: Update from GNU gettext. + * srclib/stdbool_.h: Update from GNU gettext. + * srclib/stdint_.h: Update from gnulib. + * srclib/strerror.c: Update from GNU gettext. + * srclib/unlocked-io.h: Update from GNU gettext. + * srclib/unsetenv.c: Update from GNU gettext. + * srclib/xalloc.h: Update from GNU gettext. + * srclib/xmalloc.c: Update from GNU gettext. + * srclib/xreadlink.c: Update from GNU gettext. + * srclib/xstrdup.c: Update from GNU gettext. + * srclib/Makefile.am (DEFS): Also define EXEEXT. + (libicrt_a_LIBADD): Use SRCLIBOBJS instead of LIBOBJS. + (libicrt_a_DEPENDENCIES): New variable. + * src/Makefile.in (EXEEXT): New variable. + * build-aux/install-reloc: Update from GNU gettext. + * build-aux/reloc-ldflags: Update from GNU gettext. + * build-aux/config.rpath: Update from GNU gettext. + +2005-12-29 Bruno Haible + + * m4/libtool.m4: Update, based on libtool-1.5.22. + * build-aux/ltmain.sh: Update, based on libtool-1.5.22. + +2005-12-24 Bruno Haible + + Check the whole range of GB18030. + * tests/GB18030-BMP.TXT: Renamed from tests/GB18030.TXT. + * tests/gengb18030z.c: New file. + * tests/table-from.c (main): For GB18030, don't stop at U+10000. + * tests/table-to.c (main): Likewise. + * tests/Makefile.in (check): Generate GB18030.TXT on the fly from + GB18030-BMP.TXT. + (clean): Remove also gengb18030z and GB18030.TXT. + * tests/Makefile.msvc (check): Generate GB18030.TXT on the fly from + GB18030-BMP.TXT. + (clean): Remove also GB18030Z.TXT, GB18030TMP.TXT, GB18030.TXT. + * tests/Makefile.os2 (check): Depend on gengb18030z.exe. Generate + GB18030.TXT on the fly from GB18030-BMP.TXT. + (clean): Remove also GB18030Z.TXT, GB18030TMP.TXT, GB18030.TXT. + +2005-12-20 Bruno Haible + + * tests/table-to.c (main): Test the mappings up to U+10FFFF, not only + up to U+2FFFF. Tolerate that Unicode language tags are silently mapped + to nothing. + +2005-12-22 Bruno Haible + + Extend GB18030 converter to cover the entire Unicode PUA. [... truncated: 105144 lines follow ...] From grzegorz.dabrowski at gmail.com Wed Nov 12 18:40:29 2008 From: grzegorz.dabrowski at gmail.com (Grzegorz =?UTF-8?B?RMSFYnJvd3NraQ==?=) Date: Wed, 12 Nov 2008 18:40:29 +0100 Subject: [Haiku-commits] r28628 - haiku/trunk/src/libs In-Reply-To: <200811121702.mACH2oUt020193@sheep.berlios.de> References: <200811121702.mACH2oUt020193@sheep.berlios.de> Message-ID: <20081112184029.38028759@kaliber> On Wed, 12 Nov 2008 18:02:50 +0100 zooey at BerliOS wrote: > Author: zooey > Date: 2008-11-12 18:02:49 +0100 (Wed, 12 Nov 2008) > New Revision: 28628 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28628&view=rev > > Added: > haiku/trunk/src/libs/iconv/ > Log: > creating new home for libiconv I belive you know that libiconv already exists in src/kits/textencoding/libiconv -- Grzegorz D?browski From zooey at mail.berlios.de Wed Nov 12 20:34:35 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 12 Nov 2008 20:34:35 +0100 Subject: [Haiku-commits] r28630 - in haiku/trunk: headers/libs headers/libs/iconv src/libs/iconv Message-ID: <200811121934.mACJYZiB006489@sheep.berlios.de> Author: zooey Date: 2008-11-12 20:34:35 +0100 (Wed, 12 Nov 2008) New Revision: 28630 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28630&view=rev Added: haiku/trunk/headers/libs/iconv/ haiku/trunk/headers/libs/iconv/iconv.h haiku/trunk/headers/libs/iconv/localcharset.h haiku/trunk/src/libs/iconv/Jamfile haiku/trunk/src/libs/iconv/libiconv_config.h Removed: haiku/trunk/src/libs/iconv/Makefile.in haiku/trunk/src/libs/iconv/config.h haiku/trunk/src/libs/iconv/iconv.h haiku/trunk/src/libs/iconv/localcharset.h Modified: haiku/trunk/src/libs/iconv/iconv.c haiku/trunk/src/libs/iconv/localcharset.c Log: worked standalone libiconv into a working state that is compatible with the libiconv that was available for R5 * cleaned up iconv.h * moved public libiconv headers (iconv.h and localcharset.h) into a specific folder in headers/libs * renamed config.h to libiconv_config.h in order to circumvent strange problems with regex.c from glibc picking it up Copied: haiku/trunk/headers/libs/iconv/iconv.h (from rev 28629, haiku/trunk/src/libs/iconv/iconv.h) =================================================================== --- haiku/trunk/src/libs/iconv/iconv.h 2008-11-12 17:34:47 UTC (rev 28629) +++ haiku/trunk/headers/libs/iconv/iconv.h 2008-11-12 19:34:35 UTC (rev 28630) @@ -0,0 +1,179 @@ +/* Copyright (C) 1999-2003, 2005-2006 Free Software Foundation, Inc. + This file is part of the GNU LIBICONV Library. + + The GNU LIBICONV Library is free software; you can redistribute it + and/or modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either version 2 + of the License, or (at your option) any later version. + + The GNU LIBICONV Library is distributed in the hope that it will be + useful, but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with the GNU LIBICONV Library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, Inc., 51 Franklin Street, + Fifth Floor, Boston, MA 02110-1301, USA. */ + +/* When installed, this file is called "iconv.h". */ + +#ifndef _LIBICONV_H +#define _LIBICONV_H + +#define _LIBICONV_VERSION 0x010B /* version number: (major<<8) + minor */ +extern int _libiconv_version; /* Likewise */ + +/* Define iconv_t ourselves. */ +#undef iconv_t +#define iconv_t libiconv_t +typedef void* iconv_t; + +/* Get size_t declaration. + Get wchar_t declaration if it exists. */ +#include + +/* Get errno declaration and values. */ +#include +/* Some systems, like SunOS 4, don't have EILSEQ. Some systems, like BSD/OS, + have EILSEQ in a different header. On these systems, define EILSEQ + ourselves. */ +#ifndef EILSEQ +#define EILSEQ +#endif + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Allocates descriptor for code conversion from encoding `fromcode' to + encoding `tocode'. */ +#ifndef LIBICONV_PLUG +#define iconv_open libiconv_open +#endif +extern iconv_t iconv_open(const char* tocode, const char* fromcode); + +/* Converts, using conversion descriptor `cd', at most `*inbytesleft' bytes + starting at `*inbuf', writing at most `*outbytesleft' bytes starting at + `*outbuf'. + Decrements `*inbytesleft' and increments `*inbuf' by the same amount. + Decrements `*outbytesleft' and increments `*outbuf' by the same amount. */ +#ifndef LIBICONV_PLUG +#define iconv libiconv +#endif +extern size_t iconv(iconv_t cd, char* * inbuf, size_t *inbytesleft, + char* * outbuf, size_t *outbytesleft); + +/* Frees resources allocated for conversion descriptor `cd'. */ +#ifndef LIBICONV_PLUG +#define iconv_close libiconv_close +#endif +extern int iconv_close(iconv_t cd); + + +#ifndef LIBICONV_PLUG + +/* Nonstandard extensions. */ + +/* Control of attributes. */ +#define iconvctl libiconvctl +extern int iconvctl(iconv_t cd, int request, void* argument); + +/* Hook performed after every successful conversion of a Unicode character. */ +typedef void (*iconv_unicode_char_hook) (unsigned int uc, void* data); +/* Hook performed after every successful conversion of a wide character. */ +typedef void (*iconv_wide_char_hook) (wchar_t wc, void* data); +/* Set of hooks. */ +struct iconv_hooks { + iconv_unicode_char_hook uc_hook; + iconv_wide_char_hook wc_hook; + void* data; +}; + +/* Fallback function. Invoked when a small number of bytes could not be + converted to a Unicode character. This function should process all + bytes from inbuf and may produce replacement Unicode characters by calling + the write_replacement callback repeatedly. */ +typedef void (*iconv_unicode_mb_to_uc_fallback) + (const char* inbuf, size_t inbufsize, + void (*write_replacement) (const unsigned int *buf, size_t buflen, + void* callback_arg), + void* callback_arg, + void* data); +/* Fallback function. Invoked when a Unicode character could not be converted + to the target encoding. This function should process the character and + may produce replacement bytes (in the target encoding) by calling the + write_replacement callback repeatedly. */ +typedef void (*iconv_unicode_uc_to_mb_fallback) + (unsigned int code, + void (*write_replacement) (const char *buf, size_t buflen, + void* callback_arg), + void* callback_arg, + void* data); +#if HAVE_WCHAR_T +/* Fallback function. Invoked when a number of bytes could not be converted to + a wide character. This function should process all bytes from inbuf and may + produce replacement wide characters by calling the write_replacement + callback repeatedly. */ +typedef void (*iconv_wchar_mb_to_wc_fallback) + (const char* inbuf, size_t inbufsize, + void (*write_replacement) (const wchar_t *buf, size_t buflen, + void* callback_arg), + void* callback_arg, + void* data); +/* Fallback function. Invoked when a wide character could not be converted to + the target encoding. This function should process the character and may + produce replacement bytes (in the target encoding) by calling the + write_replacement callback repeatedly. */ +typedef void (*iconv_wchar_wc_to_mb_fallback) + (wchar_t code, + void (*write_replacement) (const char *buf, size_t buflen, + void* callback_arg), + void* callback_arg, + void* data); +#else +/* If the wchar_t type does not exist, these two fallback functions are never + invoked. Their argument list therefore does not matter. */ +typedef void (*iconv_wchar_mb_to_wc_fallback) (); +typedef void (*iconv_wchar_wc_to_mb_fallback) (); +#endif +/* Set of fallbacks. */ +struct iconv_fallbacks { + iconv_unicode_mb_to_uc_fallback mb_to_uc_fallback; + iconv_unicode_uc_to_mb_fallback uc_to_mb_fallback; + iconv_wchar_mb_to_wc_fallback mb_to_wc_fallback; + iconv_wchar_wc_to_mb_fallback wc_to_mb_fallback; + void* data; +}; + +/* Requests for iconvctl. */ +#define ICONV_TRIVIALP 0 /* int *argument */ +#define ICONV_GET_TRANSLITERATE 1 /* int *argument */ +#define ICONV_SET_TRANSLITERATE 2 /* const int *argument */ +#define ICONV_GET_DISCARD_ILSEQ 3 /* int *argument */ +#define ICONV_SET_DISCARD_ILSEQ 4 /* const int *argument */ +#define ICONV_SET_HOOKS 5 /* const struct iconv_hooks *argument */ +#define ICONV_SET_FALLBACKS 6 /* const struct iconv_fallbacks *argument */ + +/* Listing of locale independent encodings. */ +#define iconvlist libiconvlist +extern void iconvlist(int (*do_one)(unsigned int namescount, + const char * const * names, + void* data), + void* data); + +/* Canonicalize an encoding name. + The result is either a canonical encoding name, or name itself. */ +extern const char * iconv_canonicalize(const char * name); + +#endif + + +#ifdef __cplusplus +} +#endif + + +#endif /* _LIBICONV_H */ Property changes on: haiku/trunk/headers/libs/iconv/iconv.h ___________________________________________________________________ Name: svn:mergeinfo + Copied: haiku/trunk/headers/libs/iconv/localcharset.h (from rev 28629, haiku/trunk/src/libs/iconv/localcharset.h) =================================================================== --- haiku/trunk/src/libs/iconv/localcharset.h 2008-11-12 17:34:47 UTC (rev 28629) +++ haiku/trunk/headers/libs/iconv/localcharset.h 2008-11-12 19:34:35 UTC (rev 28630) @@ -0,0 +1,42 @@ +/* Determine a canonical name for the current locale's character encoding. + Copyright (C) 2000-2003 Free Software Foundation, Inc. + This file is part of the GNU CHARSET Library. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library 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. */ + +#ifndef _LOCALCHARSET_H +#define _LOCALCHARSET_H + + +#ifdef __cplusplus +extern "C" { +#endif + + +/* Determine the current locale's character encoding, and canonicalize it + into one of the canonical names listed in config.charset. + The result must not be freed; it is statically allocated. + If the canonical name cannot be determined, the result is a non-canonical + name. */ +extern const char* locale_charset(void); + + +#ifdef __cplusplus +} +#endif + + +#endif /* _LOCALCHARSET_H */ Property changes on: haiku/trunk/headers/libs/iconv/localcharset.h ___________________________________________________________________ Name: svn:mergeinfo + Added: haiku/trunk/src/libs/iconv/Jamfile =================================================================== --- haiku/trunk/src/libs/iconv/Jamfile 2008-11-12 17:34:47 UTC (rev 28629) +++ haiku/trunk/src/libs/iconv/Jamfile 2008-11-12 19:34:35 UTC (rev 28630) @@ -0,0 +1,20 @@ +SubDir HAIKU_TOP src libs iconv ; + +SetSubDirSupportedPlatformsBeOSCompatible ; +AddSubDirSupportedPlatforms libbe_test ; + +UseLibraryHeaders iconv ; + +# disable warnings we don't want here +TARGET_WARNING_CCFLAGS = [ FFilter $(TARGET_WARNING_CCFLAGS) + : -Wmissing-prototypes -Wsign-compare ] ; + +SubDirCcFlags + -DLIBDIR="\\\"/boot/beos/system/lib\\\"" + -DICONV_CONST="" + ; + +SharedLibrary libiconv.so : + iconv.c + localcharset.c + ; Deleted: haiku/trunk/src/libs/iconv/Makefile.in Deleted: haiku/trunk/src/libs/iconv/config.h Modified: haiku/trunk/src/libs/iconv/iconv.c =================================================================== --- haiku/trunk/src/libs/iconv/iconv.c 2008-11-12 17:34:47 UTC (rev 28629) +++ haiku/trunk/src/libs/iconv/iconv.c 2008-11-12 19:34:35 UTC (rev 28630) @@ -18,11 +18,11 @@ * Fifth Floor, Boston, MA 02110-1301, USA. */ -#include +#include "iconv.h" #include #include -#include "config.h" +#include "libiconv_config.h" #include "localcharset.h" #if ENABLE_EXTRA Deleted: haiku/trunk/src/libs/iconv/iconv.h Copied: haiku/trunk/src/libs/iconv/libiconv_config.h (from rev 28629, haiku/trunk/src/libs/iconv/config.h) =================================================================== --- haiku/trunk/src/libs/iconv/config.h 2008-11-12 17:34:47 UTC (rev 28629) +++ haiku/trunk/src/libs/iconv/libiconv_config.h 2008-11-12 19:34:35 UTC (rev 28630) @@ -0,0 +1,403 @@ +/* config.h. Generated from config.h.in by configure. */ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to the number of bits in type 'ptrdiff_t'. */ +#define BITSIZEOF_PTRDIFF_T 32 + +/* Define to the number of bits in type 'sig_atomic_t'. */ +#define BITSIZEOF_SIG_ATOMIC_T 32 + +/* Define to the number of bits in type 'size_t'. */ +#define BITSIZEOF_SIZE_T 32 + +/* Define to the number of bits in type 'wchar_t'. */ +#define BITSIZEOF_WCHAR_T 16 + +/* Define to the number of bits in type 'wint_t'. */ +#define BITSIZEOF_WINT_T 32 + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +/* #undef CRAY_STACKSEG_END */ + +/* Define to 1 if using `alloca.c'. */ +/* #undef C_ALLOCA */ + +/* Define as good substitute value for EILSEQ. */ +/* #undef EILSEQ */ + +/* Define to 1 to enable a few rarely used encodings. */ +#define ENABLE_EXTRA 1 + +/* Define to 1 if translation of program messages to the user's native + language is requested. */ +/* #undef ENABLE_NLS */ + +/* Define to 1 if the package shall run at any location in the filesystem. */ +/* #undef ENABLE_RELOCATABLE */ + +/* Define to 1 if you have `alloca', as a function or macro. */ +#define HAVE_ALLOCA 1 + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#define HAVE_ALLOCA_H 1 + +/* Define to 1 if you have the `canonicalize_file_name' function. */ +/* #undef HAVE_CANONICALIZE_FILE_NAME */ + +/* Define to 1 if you have the MacOS X function CFLocaleCopyCurrent in the + CoreFoundation framework. */ +/* #undef HAVE_CFLOCALECOPYCURRENT */ + +/* Define to 1 if you have the MacOS X function CFPreferencesCopyAppValue in + the CoreFoundation framework. */ +/* #undef HAVE_CFPREFERENCESCOPYAPPVALUE */ + +/* Define if the GNU dcgettext() function is already present or preinstalled. + */ +/* #undef HAVE_DCGETTEXT */ + +/* Define to 1 if you have the declaration of `canonicalize_file_name', and to + 0 if you don't. */ +#define HAVE_DECL_CANONICALIZE_FILE_NAME 0 + +/* Define to 1 if you have the declaration of `clearerr_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_CLEARERR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `feof_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_FEOF_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `ferror_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FERROR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fflush_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FFLUSH_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fgets_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FGETS_UNLOCKED 0 + +/* Define to 1 if you have the declaration of `fputc_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FPUTC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `fputs_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FPUTS_UNLOCKED 0 + +/* Define to 1 if you have the declaration of `fread_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FREAD_UNLOCKED 0 + +/* Define to 1 if you have the declaration of `fwrite_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_FWRITE_UNLOCKED 0 + +/* Define to 1 if you have the declaration of `getchar_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_GETCHAR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `getc_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_GETC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `putchar_unlocked', and to 0 if + you don't. */ +#define HAVE_DECL_PUTCHAR_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `putc_unlocked', and to 0 if you + don't. */ +#define HAVE_DECL_PUTC_UNLOCKED 1 + +/* Define to 1 if you have the declaration of `strerror', and to 0 if you + don't. */ +/* #undef HAVE_DECL_STRERROR */ + +/* Define to 1 if you have the declaration of `strerror_r', and to 0 if you + don't. */ +#define HAVE_DECL_STRERROR_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_DLFCN_H 1 + +/* Define if you have the declaration of environ. */ +#define HAVE_ENVIRON_DECL 1 + +/* Define to 1 if you have the `getcwd' function. */ +#define HAVE_GETCWD 1 + +/* Define to 1 if you have the `getc_unlocked' function. */ +#define HAVE_GETC_UNLOCKED 1 + +/* Define if the GNU gettext() function is already present or preinstalled. */ +/* #undef HAVE_GETTEXT */ + +/* Define if you have the iconv() function and it works. */ +/* #undef HAVE_ICONV */ + +/* Define if your compiler supports the #include_next directive. */ +#define HAVE_INCLUDE_NEXT 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define if you have and nl_langinfo(CODESET). */ +/* #undef HAVE_LANGINFO_CODESET */ + +/* Define to 1 if the system has the type `long long int'. */ +#define HAVE_LONG_LONG_INT 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_MACH_O_DYLD_H */ + +/* Define if the 'malloc' function is POSIX compliant. */ +#define HAVE_MALLOC_POSIX 1 + +/* Define to 1 if you have the `mbrtowc' function. */ +#define HAVE_MBRTOWC 1 + +/* Define to 1 if you have the `mbsinit' function. */ +#define HAVE_MBSINIT 1 + +/* Define to 1 if declares mbstate_t. */ +#define HAVE_MBSTATE_T 1 + +/* Define to 1 if you have the `memmove' function. */ +#define HAVE_MEMMOVE 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the `readlink' function. */ +#define HAVE_READLINK 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SEARCH_H 1 + +/* Define to 1 if you have the `setenv' function. */ +#define HAVE_SETENV 1 + +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +#define HAVE_SIGNED_SIG_ATOMIC_T 1 + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WCHAR_T */ + +/* Define to 1 if 'wint_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WINT_T */ + +/* Define to 1 if stdbool.h conforms to C99. */ +/* #undef HAVE_STDBOOL_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#define HAVE_STRERROR_R 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BITYPES_H */ + +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INTTYPES_H */ + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the `tsearch' function. */ +#define HAVE_TSEARCH 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to 1 if the system has the type `unsigned long long int'. */ +#define HAVE_UNSIGNED_LONG_LONG_INT 1 + +/* Define to 1 or 0, depending whether the compiler supports simple visibility + declarations. */ +#define HAVE_VISIBILITY 0 + +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + +/* Define if you have the 'wchar_t' type. */ +#define HAVE_WCHAR_T 1 + +/* Define to 1 if you have the `wcrtomb' function. */ +#define HAVE_WCRTOMB 1 + +/* Define to 1 if the system has the type `_Bool'. */ +/* #undef HAVE__BOOL */ + +/* Define to 1 if you have the `_NSGetExecutablePath' function. */ +/* #undef HAVE__NSGETEXECUTABLEPATH */ + +/* Define as const if the declaration of iconv() needs const. */ +/* #undef ICONV_CONST */ + +/* Define to the value of ${prefix}, as a string. */ +#define INSTALLPREFIX "/boot/common" + +/* If malloc(0) is != NULL, define this to 1. Otherwise define this to 0. */ +#define MALLOC_0_IS_NONNULL 1 + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +/* #undef NO_MINUS_C_MINUS_O */ + +/* Name of package */ +#define PACKAGE "libiconv" + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "" + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION "" + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +#define PTRDIFF_T_SUFFIX l + +/* Define this to 1 if strerror is broken. */ +/* #undef REPLACE_STRERROR */ + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +#define SIG_ATOMIC_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +#define SIZE_T_SUFFIX ul + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +/* #undef STACK_DIRECTION */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define to 1 if strerror_r returns char *. */ +/* #undef STRERROR_R_CHAR_P */ + +/* Define to 1 if you want getc etc. to use unlocked I/O if available. + Unlocked I/O can improve performance in unithreaded apps, but it is not + safe for multithreaded apps. */ +/* #undef USE_UNLOCKED_IO */ + +/* Version number of package */ +#define VERSION "1.12" + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +#define WCHAR_T_SUFFIX + +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +#define WINT_T_SUFFIX u + +/* Define if the machine's byte ordering is little endian. */ +#define WORDS_LITTLEENDIAN 1 + +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Define to a type if does not define. */ +/* #undef mbstate_t */ + +/* Define to a replacement function name for realpath(). */ +#define realpath rpl_realpath + +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#define restrict __restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif + +/* Define as a signed type of the same size as size_t. */ +/* #undef ssize_t */ + + +/* On Windows, variables that may be in a DLL must be marked specially. */ +#if defined _MSC_VER && defined _DLL +# define DLL_VARIABLE __declspec (dllimport) +#else +# define DLL_VARIABLE +#endif + Property changes on: haiku/trunk/src/libs/iconv/libiconv_config.h ___________________________________________________________________ Name: svn:mergeinfo + Modified: haiku/trunk/src/libs/iconv/localcharset.c =================================================================== --- haiku/trunk/src/libs/iconv/localcharset.c 2008-11-12 17:34:47 UTC (rev 28629) +++ haiku/trunk/src/libs/iconv/localcharset.c 2008-11-12 19:34:35 UTC (rev 28630) @@ -19,7 +19,7 @@ /* Written by Bruno Haible . */ -#include +#include "libiconv_config.h" /* Specification. */ #include "localcharset.h" Deleted: haiku/trunk/src/libs/iconv/localcharset.h From zooey at mail.berlios.de Wed Nov 12 20:40:06 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 12 Nov 2008 20:40:06 +0100 Subject: [Haiku-commits] r28631 - in haiku/trunk: build/jam src/kits/textencoding src/libs Message-ID: <200811121940.mACJe6Wt007606@sheep.berlios.de> Author: zooey Date: 2008-11-12 20:40:03 +0100 (Wed, 12 Nov 2008) New Revision: 28631 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28631&view=rev Removed: haiku/trunk/src/kits/textencoding/libiconv/ Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/build/jam/OptionalPackages haiku/trunk/src/kits/textencoding/Jamfile haiku/trunk/src/libs/Jamfile Log: switched libtextencoding to use the new standalone libiconv: * adjusted libtextencoding's Jamfile * added libiconv.so to image * added iconv headers to optional package Development (under 3rdparty) * removed old private version of libiconv from textencoding Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-12 19:34:35 UTC (rev 28630) +++ haiku/trunk/build/jam/HaikuImage 2008-11-12 19:40:03 UTC (rev 28631) @@ -79,7 +79,7 @@ libmail.so libtextencoding.so libz.so libfreetype.so libpng.so libmidi.so libmidi2.so libdevice.so libgame.so libscreensaver.so libroot.so $(X86_ONLY)libGL.so libfluidsynth.so liblpsolve55.so liblinprog.so libalm.so - libilmimf.so + libilmimf.so libiconv.so ; BEOS_SYSTEM_SERVERS = registrar debug_server syslog_daemon media_server net_server media_addon_server input_server app_server fake_app_server Modified: haiku/trunk/build/jam/OptionalPackages =================================================================== --- haiku/trunk/build/jam/OptionalPackages 2008-11-12 19:34:35 UTC (rev 28630) +++ haiku/trunk/build/jam/OptionalPackages 2008-11-12 19:40:03 UTC (rev 28631) @@ -211,6 +211,7 @@ # third party libs headers AddHeaderDirectoryToHaikuImage libs freetype2 : 3rdparty ; + AddHeaderDirectoryToHaikuImage libs iconv : 3rdparty ; AddHeaderDirectoryToHaikuImage libs ncurses : 3rdparty ; AddHeaderDirectoryToHaikuImage libs png : 3rdparty ; AddHeaderDirectoryToHaikuImage libs zlib : 3rdparty ; Modified: haiku/trunk/src/kits/textencoding/Jamfile =================================================================== --- haiku/trunk/src/kits/textencoding/Jamfile 2008-11-12 19:34:35 UTC (rev 28630) +++ haiku/trunk/src/kits/textencoding/Jamfile 2008-11-12 19:40:03 UTC (rev 28631) @@ -4,22 +4,15 @@ AddSubDirSupportedPlatforms libbe_test ; UsePrivateHeaders textencoding ; -SubDirSysHdrs [ FDirName $(SUBDIR) libiconv ] ; +SubDirSysHdrs [ FDirName $(HAIKU_TOP) src libs iconv ] ; -if ! $(TARGET_PLATFORM_HAIKU_COMPATIBLE) { - # Argh! Just for . - UseHeaders [ FDirName $(HAIKU_TOP) headers posix ] : true ; -} - SharedLibrary libtextencoding.so : CharacterSet.cpp CharacterSetRoster.cpp character_sets.cpp utf8_conversions.cpp - : libiconv.a be ; + : be libiconv.so ; Package haiku-maildaemon-cvs : libtextencoding.so : boot beos system lib ; - -SubInclude HAIKU_TOP src kits textencoding libiconv ; Modified: haiku/trunk/src/libs/Jamfile =================================================================== --- haiku/trunk/src/libs/Jamfile 2008-11-12 19:34:35 UTC (rev 28630) +++ haiku/trunk/src/libs/Jamfile 2008-11-12 19:40:03 UTC (rev 28631) @@ -10,6 +10,7 @@ SubInclude HAIKU_TOP src libs fluidsynth ; SubInclude HAIKU_TOP src libs freetype2 ; SubInclude HAIKU_TOP src libs icon ; +SubInclude HAIKU_TOP src libs iconv ; SubInclude HAIKU_TOP src libs libtelnet ; SubInclude HAIKU_TOP src libs linprog ; SubInclude HAIKU_TOP src libs lp_solve ; From zooey at hirschkaefer.de Wed Nov 12 20:45:26 2008 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Wed, 12 Nov 2008 20:45:26 +0100 Subject: [Haiku-commits] r28628 - haiku/trunk/src/libs In-Reply-To: <20081112184029.38028759@kaliber> References: <200811121702.mACH2oUt020193@sheep.berlios.de> <20081112184029.38028759@kaliber> Message-ID: <20081112204526.5081.13@bee.hirschkaefer.site> Hi Grzegorz, On 2008-11-12 at 18:40:29 [+0100], Grzegorz D?browski wrote: > On Wed, 12 Nov 2008 18:02:50 +0100 > zooey at BerliOS wrote: > > > Author: zooey > > Date: 2008-11-12 18:02:49 +0100 (Wed, 12 Nov 2008) > > New Revision: 28628 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28628&view=rev > > > > Added: > > haiku/trunk/src/libs/iconv/ > > Log: > > creating new home for libiconv > > I belive you know that libiconv already exists in > src/kits/textencoding/libiconv Yep, I knew ;-) With r28631, libtextencoding no longer has a private libiconv, but simply wraps the new, standalone version of libiconv which gets installed as /system/lib/libiconv.so. cheers, Oliver From korli at mail.berlios.de Wed Nov 12 21:11:21 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 12 Nov 2008 21:11:21 +0100 Subject: [Haiku-commits] r28632 - haiku/trunk/src/kits/textencoding Message-ID: <200811122011.mACKBLdq010086@sheep.berlios.de> Author: korli Date: 2008-11-12 21:11:21 +0100 (Wed, 12 Nov 2008) New Revision: 28632 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28632&view=rev Modified: haiku/trunk/src/kits/textencoding/Jamfile Log: iconv lib headers are needed Modified: haiku/trunk/src/kits/textencoding/Jamfile =================================================================== --- haiku/trunk/src/kits/textencoding/Jamfile 2008-11-12 19:40:03 UTC (rev 28631) +++ haiku/trunk/src/kits/textencoding/Jamfile 2008-11-12 20:11:21 UTC (rev 28632) @@ -4,6 +4,7 @@ AddSubDirSupportedPlatforms libbe_test ; UsePrivateHeaders textencoding ; +UseLibraryHeaders iconv ; SubDirSysHdrs [ FDirName $(HAIKU_TOP) src libs iconv ] ; SharedLibrary libtextencoding.so : From zooey at mail.berlios.de Wed Nov 12 21:49:12 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Wed, 12 Nov 2008 21:49:12 +0100 Subject: [Haiku-commits] r28633 - haiku/trunk/src/kits/textencoding Message-ID: <200811122049.mACKnCcs012205@sheep.berlios.de> Author: zooey Date: 2008-11-12 21:49:12 +0100 (Wed, 12 Nov 2008) New Revision: 28633 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28633&view=rev Modified: haiku/trunk/src/kits/textencoding/Jamfile Log: * small cleanup after Jerome has already fixed the build broken by my last commit - thanks! Modified: haiku/trunk/src/kits/textencoding/Jamfile =================================================================== --- haiku/trunk/src/kits/textencoding/Jamfile 2008-11-12 20:11:21 UTC (rev 28632) +++ haiku/trunk/src/kits/textencoding/Jamfile 2008-11-12 20:49:12 UTC (rev 28633) @@ -5,7 +5,6 @@ UsePrivateHeaders textencoding ; UseLibraryHeaders iconv ; -SubDirSysHdrs [ FDirName $(HAIKU_TOP) src libs iconv ] ; SharedLibrary libtextencoding.so : CharacterSet.cpp From korli at mail.berlios.de Wed Nov 12 23:08:57 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 12 Nov 2008 23:08:57 +0100 Subject: [Haiku-commits] r28634 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/dev/mii compat/net Message-ID: <200811122208.mACM8vWS022110@sheep.berlios.de> Author: korli Date: 2008-11-12 23:08:56 +0100 (Wed, 12 Nov 2008) New Revision: 28634 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28634&view=rev Added: haiku/trunk/src/libs/compat/freebsd_network/compat/dev/mii/miidevs haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk Modified: haiku/trunk/src/libs/compat/freebsd_network/Jamfile haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h Log: * generates miidevs.h with the freebsd awk script * update net/if_media.h Modified: haiku/trunk/src/libs/compat/freebsd_network/Jamfile =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/Jamfile 2008-11-12 20:49:12 UTC (rev 28633) +++ haiku/trunk/src/libs/compat/freebsd_network/Jamfile 2008-11-12 22:08:56 UTC (rev 28634) @@ -26,3 +26,22 @@ mutex.c taskqueue.c ; + +rule MIIHeaderGen +{ + SEARCH on $(2) = [ FDirName $(SUBDIR) compat dev mii ] ; + SEARCH on $(3) = $(SEARCH_SOURCE) ; + + Depends $(1) : $(2) $(3) ; + MakeLocateArch $(<) ; + MIIHeaderGen1 $(1) : $(2) $(3) ; + LocalClean clean : $(<) ; +} + +actions MIIHeaderGen1 +{ + gawk -v HEADERFILE=$(1) -f $(2[2]) $(2[1]) +} + +MIIHeaderGen [ FGristFiles miidevs.h ] : miidevs : miidevs2h.awk ; + Added: haiku/trunk/src/libs/compat/freebsd_network/compat/dev/mii/miidevs =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/dev/mii/miidevs 2008-11-12 20:49:12 UTC (rev 28633) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/dev/mii/miidevs 2008-11-12 22:08:56 UTC (rev 28634) @@ -0,0 +1,250 @@ +$FreeBSD: src/sys/dev/mii/miidevs,v 1.62 2008/10/23 01:27:15 yongari Exp $ +/*$NetBSD: miidevs,v 1.6 1999/05/14 11:37:30 drochner Exp $*/ + +/*- + * Copyright (c) 1998, 1999 The NetBSD Foundation, Inc. + * All rights reserved. + * + * This code is derived from software contributed to The NetBSD Foundation + * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility, + * NASA Ames Research Center. + * + * 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 the NetBSD + * Foundation, Inc. and its contributors. + * 4. Neither the name of The NetBSD Foundation nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +/* + * List of known MII OUIs. + * For a complete list see http://standards.ieee.org/regauth/oui/ + * + * XXX Vendors do obviously not agree how OUIs (18 bit) are mapped + * to the 16 bits available in the id registers. The MII_OUI() macro + * in "mii.h" reflects the most obvious way. If a vendor uses a + * different mapping, an "xx" prefixed OUI is defined here which is + * mangled accordingly to compensate. + */ + +oui AGERE 0x00a0bc Agere Systems +oui ALTIMA 0x0010a9 Altima Communications +oui AMD 0x00001a Advanced Micro Devices +oui ATHEROS 0x001374 Atheros Communications +oui BROADCOM 0x001018 Broadcom Corporation +oui BROADCOM2 0x000af7 Broadcom Corporation +oui CICADA 0x0003F1 Cicada Semiconductor +oui DAVICOM 0x00606e Davicom Semiconductor +oui ICPLUS 0x0090c3 IC Plus Corp. +oui ICS 0x00a0be Integrated Circuit Systems +oui INTEL 0x00aa00 Intel +oui JATO 0x00e083 Jato Technologies +oui JMICRON 0x001b8c JMicron Technologies +oui LEVEL1 0x00207b Level 1 +oui NATSEMI 0x080017 National Semiconductor +oui QUALSEMI 0x006051 Quality Semiconductor +oui REALTEK 0x000020 RealTek Semicondctor +oui SEEQ 0x00a07d Seeq +oui SIS 0x00e006 Silicon Integrated Systems +oui SMSC 0x0005be SMSC +oui TDK 0x00c039 TDK +oui TI 0x080028 Texas Instruments +oui VITESSE 0x0001c1 Vitesse Semiconductor +oui XAQTI 0x00e0ae XaQti Corp. +oui MARVELL 0x005043 Marvell Semiconductor +oui xxMARVELL 0x000ac2 Marvell Semiconductor + +/* in the 79c873, AMD uses another OUI (which matches Davicom!) */ +oui xxAMD 0x00606e Advanced Micro Devices + +/* Intel 82553 A/B steppings */ +oui xxINTEL 0x00f800 Intel + +/* some vendors have the bits swapped within bytes + (ie, ordered as on the wire) */ +oui xxALTIMA 0x000895 Altima Communications +oui xxBROADCOM 0x000818 Broadcom Corporation +oui xxBROADCOM_ALT1 0x0050ef Broadcom Corporation +oui xxICS 0x00057d Integrated Circuit Systems +oui xxSEEQ 0x0005be Seeq +oui xxSIS 0x000760 Silicon Integrated Systems +oui xxTI 0x100014 Texas Instruments +oui xxXAQTI 0x350700 XaQti Corp. + +/* Level 1 is completely different - from right to left. + (Two bits get lost in the third OUI byte.) */ +oui xxLEVEL1 0x1e0400 Level 1 + +/* Don't know what's going on here. */ +oui xxDAVICOM 0x006040 Davicom Semiconductor + +/* This is the OUI of the gigE PHY in the RealTek 8169S/8110S/8211B chips */ +oui xxREALTEK 0x000732 + +/* + * List of known models. Grouped by oui. + */ + +/* Agere Systems PHYs */ +model AGERE ET1011C 0x0004 ET1011C 10/100/1000baseT PHY + +/* Altima Communications PHYs */ +model xxALTIMA AC101 0x0021 AC101 10/100 media interface +model xxALTIMA AC101L 0x0012 AC101L 10/100 media interface +model xxALTIMA ACXXX 0x0001 ACXXX 10/100 media interface + +/* Advanced Micro Devices PHYs */ +model AMD 79c973phy 0x0036 Am79c973 internal PHY +model AMD 79c978 0x0039 Am79c978 HomePNA PHY +model xxAMD 79C873 0x0000 Am79C873/DM9101 10/100 media interface + +/* Atheros Communications/Attansic PHYs. */ +model ATHEROS F1 0x0001 Atheros F1 10/100/1000 PHY +model ATHEROS F2 0x0002 Atheros F2 10/100 PHY + +/* Broadcom Corp. PHYs. */ +model BROADCOM 3C905B 0x0012 3c905B 10/100 internal PHY +model BROADCOM 3C905C 0x0017 3c905C 10/100 internal PHY +model BROADCOM BCM5201 0x0021 BCM5201 10/100baseTX PHY +model BROADCOM BCM5221 0x001e BCM5221 10/100baseTX PHY +model BROADCOM BCM4401 0x0036 BCM4401 10/100baseTX PHY +model xxBROADCOM BCM5400 0x0004 Broadcom 1000baseTX PHY +model xxBROADCOM BCM5401 0x0005 BCM5401 10/100/1000baseTX PHY +model xxBROADCOM BCM5411 0x0007 BCM5411 10/100/1000baseTX PHY +model xxBROADCOM BCM5754 0x000e BCM5754 10/100/1000baseTX PHY +model xxBROADCOM BCM5752 0x0010 BCM5752 10/100/1000baseTX PHY +model xxBROADCOM BCM5701 0x0011 BCM5701 10/100/1000baseTX PHY +model xxBROADCOM BCM5706 0x0015 BCM5706 10/100/1000baseTX/SX PHY +model xxBROADCOM BCM5703 0x0016 BCM5703 10/100/1000baseTX PHY +model xxBROADCOM BCM5704 0x0019 BCM5704 10/100/1000baseTX PHY +model xxBROADCOM BCM5705 0x001a BCM5705 10/100/1000baseTX PHY +model xxBROADCOM BCM5750 0x0018 BCM5750 10/100/1000baseTX PHY +model xxBROADCOM BCM5714 0x0034 BCM5714 10/100/1000baseTX PHY +model xxBROADCOM BCM5780 0x0035 BCM5780 10/100/1000baseTX PHY +model xxBROADCOM BCM5708C 0x0036 BCM5708C 10/100/1000baseTX PHY +model xxBROADCOM_ALT1 BCM5755 0x000c BCM5755 10/100/1000baseTX PHY +model xxBROADCOM_ALT1 BCM5787 0x000e BCM5787 10/100/1000baseTX PHY +model xxBROADCOM_ALT1 BCM5708S 0x0015 BCM5708S 1000/2500BaseSX PHY +model xxBROADCOM_ALT1 BCM5709CAX 0x002c BCM5709C(AX) 10/100/1000baseTX PHY +model xxBROADCOM_ALT1 BCM5722 0x002d BCM5722 10/100/1000baseTX PHY +model xxBROADCOM_ALT1 BCM5709C 0x003c BCM5709C 10/100/1000baseTX PHY +model BROADCOM2 BCM5906 0x0004 BCM5906 10/100baseTX PHY + +/* Cicada Semiconductor PHYs (now owned by Vitesse?) */ +model CICADA CS8201 0x0001 Cicada CS8201 10/100/1000TX PHY +model CICADA CS8204 0x0004 Cicada CS8204 10/100/1000TX PHY +model CICADA VSC8211 0x000b Cicada VSC8211 10/100/1000TX PHY +model CICADA CS8201A 0x0020 Cicada CS8201 10/100/1000TX PHY +model CICADA CS8201B 0x0021 Cicada CS8201 10/100/1000TX PHY +model CICADA CS8244 0x002c Cicada CS8244 10/100/1000TX PHY +model VITESSE VSC8601 0x0002 Vitesse VSC8601 10/100/1000TX PHY + +/* Davicom Semiconductor PHYs */ +model DAVICOM DM9102 0x0004 DM9102 10/100 media interface +model xxDAVICOM DM9101 0x0000 DM9101 10/100 media interface + +/* Integrated Circuit Systems PHYs */ +model xxICS 1889 0x0001 ICS1889 10/100 media interface +model xxICS 1890 0x0002 ICS1890 10/100 media interface +model xxICS 1892 0x0003 ICS1892 10/100 media interface +model xxICS 1893 0x0004 ICS1893 10/100 media interface + +/* IC Plus Corp. PHYs */ +model ICPLUS IP101 0x0005 IC Plus 10/100 PHY +model ICPLUS IP1000A 0x0008 IC Plus 10/100/1000 media interface +model ICPLUS IP1001 0x0019 IC Plus IP1001 10/100/1000 media interface + +/* Intel PHYs */ +model xxINTEL I82553AB 0x0000 i83553 10/100 media interface +model INTEL I82555 0x0015 i82555 10/100 media interface +model INTEL I82562EM 0x0032 i82562EM 10/100 media interface +model INTEL I82562ET 0x0033 i82562ET 10/100 media interface +model INTEL I82553C 0x0035 i82553 10/100 media interface + +/* Jato Technologies PHYs */ +model JATO BASEX 0x0000 Jato 1000baseX media interface + +/* JMicron Technologies PHYs */ +model JMICRON JMP211 0x0021 JMP211 10/100/1000 media interface +model JMICRON JMP202 0x0022 JMP202 10/100 media interface + +/* Level 1 PHYs */ +model xxLEVEL1 LXT970 0x0000 LXT970 10/100 media interface + +/* National Semiconductor PHYs */ +model NATSEMI DP83840 0x0000 DP83840 10/100 media interface +model NATSEMI DP83843 0x0001 DP83843 10/100 media interface +model NATSEMI DP83815 0x0002 DP83815 10/100 media interface +model NATSEMI DP83847 0x0003 DP83847 10/100 media interface +model NATSEMI DP83891 0x0005 DP83891 10/100/1000 media interface +model NATSEMI DP83861 0x0006 DP83861 10/100/1000 media interface + +/* Quality Semiconductor PHYs */ +model QUALSEMI QS6612 0x0000 QS6612 10/100 media interface + +/* RealTek Semiconductor PHYs */ +model REALTEK RTL8201L 0x0020 RTL8201L 10/100 media interface +model xxREALTEK RTL8305SC 0x0005 RTL8305SC 10/100 802.1q switch +model xxREALTEK RTL8169S 0x0011 RTL8169S/8110S/8211B media interface + +/* Seeq PHYs */ +model xxSEEQ 80220 0x0003 Seeq 80220 10/100 media interface +model xxSEEQ 84220 0x0004 Seeq 84220 10/100 media interface + +/* Silicon Integrated Systems PHYs */ +model xxSIS 900 0x0000 SiS 900 10/100 media interface + +/* SMSC PHYs */ +model SMSC LAN83C183 0x0004 SMSC LAN83C183 10/100 media interface + +/* TDK */ +model TDK 78Q2120 0x0014 TDK 78Q2120 media interface + +/* Texas Instruments PHYs */ +model xxTI TLAN10T 0x0001 ThunderLAN 10baseT media interface +model xxTI 100VGPMI 0x0002 ThunderLAN 100VG-AnyLan media interface + +/* XaQti Corp. PHYs. */ +model XAQTI XMACII 0x0000 XaQti Corp. XMAC II gigabit interface + +/* Marvell Semiconductor PHYs */ +model MARVELL E1000 0x0000 Marvell 88E1000 Gigabit PHY +model MARVELL E1011 0x0002 Marvell 88E1011 Gigabit PHY +model MARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY +model MARVELL E1000S 0x0004 Marvell 88E1000S Gigabit PHY +model MARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY +model MARVELL E1000_6 0x0006 Marvell 88E1000 Gigabit PHY +model MARVELL E3082 0x0008 Marvell 88E3082 10/100 Fast Ethernet PHY +model MARVELL E1112 0x0009 Marvell 88E1112 Gigabit PHY +model MARVELL E1149 0x000b Marvell 88E1149 Gigabit PHY +model MARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY +model MARVELL E1116 0x0021 Marvell 88E1116 Gigabit PHY +model MARVELL E1116R 0x0024 Marvell 88E1116R Gigabit PHY +model MARVELL E1118 0x0022 Marvell 88E1118 Gigabit PHY +model xxMARVELL E1000 0x0005 Marvell 88E1000 Gigabit PHY +model xxMARVELL E1011 0x0002 Marvell 88E1011 Gigabit PHY +model xxMARVELL E1000_3 0x0003 Marvell 88E1000 Gigabit PHY +model xxMARVELL E1000_5 0x0005 Marvell 88E1000 Gigabit PHY +model xxMARVELL E1111 0x000c Marvell 88E1111 Gigabit PHY Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h 2008-11-12 20:49:12 UTC (rev 28633) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h 2008-11-12 22:08:56 UTC (rev 28634) @@ -1,5 +1,5 @@ /* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ -/* $FreeBSD: src/sys/net/if_media.h,v 1.30.2.3 2006/08/10 10:21:00 glebius Exp $ */ +/* $FreeBSD: src/sys/net/if_media.h,v 1.43 2008/08/01 22:13:39 antoine Exp $ */ /*- * Copyright (c) 1997 @@ -144,6 +144,7 @@ #define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */ #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */ #define IFM_10G_CX4 20 /* 10GBase CX4 copper */ +#define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */ /* note 31 is the max! */ @@ -198,11 +199,16 @@ #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */ #define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */ #define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */ +#define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */ +#define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */ +#define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */ +/* NB: not enough bits to express MCS fully */ +#define IFM_IEEE80211_MCS 24 /* HT MCS rate */ #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ #define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ -#define IFM_IEEE80211_IBSSMASTER 0x00000800 /* Operate as an IBSS master */ +#define IFM_IEEE80211_WDS 0x00000800 /* Operate in WDS mode */ #define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */ #define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */ @@ -211,6 +217,8 @@ #define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */ #define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */ #define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */ +#define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */ +#define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */ /* * ATM @@ -267,8 +275,8 @@ /* * Status bits */ -#define IFM_AVALID 0x10000000 /* Active bit valid */ -#define IFM_ACTIVE 0x00800000 /* same as Haiku's */ +#define IFM_AVALID 0x00000001 /* Active bit valid */ +#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ /* Mask of "status valid" bits, for ifconfig(8). */ #define IFM_STATUS_VALID IFM_AVALID @@ -335,12 +343,12 @@ { IFM_1000_SX, "1000baseSX" }, \ { IFM_1000_LX, "1000baseLX" }, \ { IFM_1000_CX, "1000baseCX" }, \ - { IFM_1000_T, "1000baseTX" }, \ { IFM_1000_T, "1000baseT" }, \ { IFM_HPNA_1, "homePNA" }, \ { IFM_10G_LR, "10Gbase-LR" }, \ { IFM_10G_SR, "10Gbase-SR" }, \ { IFM_10G_CX4, "10Gbase-CX4" }, \ + { IFM_2500_SX, "2500BaseSX" }, \ { 0, NULL }, \ } @@ -360,8 +368,10 @@ { IFM_1000_SX, "1000SX" }, \ { IFM_1000_LX, "1000LX" }, \ { IFM_1000_CX, "1000CX" }, \ + { IFM_1000_T, "1000baseTX" }, \ { IFM_1000_T, "1000TX" }, \ { IFM_1000_T, "1000T" }, \ + { IFM_2500_SX, "2500SX" }, \ { 0, NULL }, \ } @@ -437,6 +447,9 @@ { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \ { IFM_IEEE80211_DS354k, "DS/354Kbps" }, \ { IFM_IEEE80211_DS512k, "DS/512Kbps" }, \ + { IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \ + { IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \ + { IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \ { 0, NULL }, \ } @@ -472,6 +485,9 @@ { IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \ { IFM_IEEE80211_DS512k, "DS512K" }, \ { IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \ + { IFM_IEEE80211_OFDM3, "OFDM3" }, \ + { IFM_IEEE80211_OFDM4, "OFDM4.5" }, \ + { IFM_IEEE80211_OFDM27, "OFDM27" }, \ { 0, NULL }, \ } @@ -479,7 +495,7 @@ { IFM_IEEE80211_ADHOC, "adhoc" }, \ { IFM_IEEE80211_HOSTAP, "hostap" }, \ { IFM_IEEE80211_IBSS, "ibss" }, \ - { IFM_IEEE80211_IBSSMASTER, "ibss-master" }, \ + { IFM_IEEE80211_WDS, "wds" }, \ { IFM_IEEE80211_TURBO, "turbo" }, \ { IFM_IEEE80211_MONITOR, "monitor" }, \ { 0, NULL }, \ @@ -491,6 +507,8 @@ { IFM_IEEE80211_11B, "11b" }, \ { IFM_IEEE80211_11G, "11g" }, \ { IFM_IEEE80211_FH, "fh" }, \ + { IFM_IEEE80211_11NA, "11na" }, \ + { IFM_IEEE80211_11NG, "11ng" }, \ { 0, NULL }, \ } @@ -584,6 +602,7 @@ { IFM_ETHER | IFM_10G_LR, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_10G_SR, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_10G_CX4, IF_Gbps(10ULL) }, \ + { IFM_ETHER | IFM_2500_SX, IF_Mbps(2500ULL) }, \ \ { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \ Added: haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk 2008-11-12 20:49:12 UTC (rev 28633) +++ haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk 2008-11-12 22:08:56 UTC (rev 28634) @@ -0,0 +1,148 @@ +#! /usr/bin/awk -f +# $NetBSD: devlist2h.awk,v 1.2 1998/09/05 14:42:06 christos Exp $ + +#- +# Copyright (c) 1998 The NetBSD Foundation, Inc. +# All rights reserved. +# +# This code is derived from software contributed to The NetBSD Foundation +# by Christos Zoulas. +# +# 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 the NetBSD +# Foundation, Inc. and its contributors. +# 4. Neither the name of The NetBSD Foundation nor the names of its +# contributors may be used to endorse or promote products derived +# from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. 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 FOUNDATION 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. +# +# Copyright (c) 1995, 1996 Christopher G. Demetriou +# 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 model includes software developed by Christopher G. Demetriou. +# This model includes software developed by Christos Zoulas +# 4. The name of the author(s) may not be used to endorse or promote models +# derived from this software without specific prior written permission +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 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/tools/miidevs2h.awk,v 1.6 2005/01/07 02:29:25 imp Exp $ +# +function collectline(f, line) { + oparen = 0 + line = "" + while (f <= NF) { + if ($f == "#") { + line = line "(" + oparen = 1 + f++ + continue + } + if (oparen) { + line = line $f + if (f < NF) + line = line " " + f++ + continue + } + line = line $f + if (f < NF) + line = line " " + f++ + } + if (oparen) + line = line ")" + return line +} +BEGIN { + nmodels = nouis = 0 + hfile=HEADERFILE +} +NR == 1 { + VERSION = $0 + gsub("\\$", "", VERSION) + + printf("/* \$FreeBSD\$ */\n\n") > hfile + printf("/*\n") > hfile + printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ + > hfile + printf(" *\n") > hfile + printf(" * generated from:\n") > hfile + printf(" *\t%s\n", VERSION) > hfile + printf(" */\n") > hfile + + next +} +$1 == "oui" { + nuios++ + + ouiindex[$2] = nouis; # record index for this name, for later. + + ouis[nouis, 1] = $2; # name + ouis[nouis, 2] = $3; # id + printf("#define\tMII_OUI_%s\t%s\t", ouis[nouis, 1], + ouis[nouis, 2]) > hfile + ouis[nouis, 3] = collectline(4, line) + printf("/* %s */\n", ouis[nouis, 3]) > hfile + next +} +$1 == "model" { + nmodels++ + + models[nmodels, 1] = $2; # oui name + models[nmodels, 2] = $3; # model id + models[nmodels, 3] = $4; # id + + printf("#define\tMII_MODEL_%s_%s\t%s\n", models[nmodels, 1], + models[nmodels, 2], models[nmodels, 3]) > hfile + + models[nmodels, 4] = collectline(5, line) + + printf("#define\tMII_STR_%s_%s\t\"%s\"\n", + models[nmodels, 1], models[nmodels, 2], + models[nmodels, 4]) > hfile + + next +} +{ + print $0 > hfile +} From korli at mail.berlios.de Wed Nov 12 23:17:04 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 12 Nov 2008 23:17:04 +0100 Subject: [Haiku-commits] r28635 - haiku/vendor/freebsd/current/dev/mii Message-ID: <200811122217.mACMH4O4022716@sheep.berlios.de> Author: korli Date: 2008-11-12 23:17:04 +0100 (Wed, 12 Nov 2008) New Revision: 28635 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28635&view=rev Added: haiku/vendor/freebsd/current/dev/mii/brgphy.c haiku/vendor/freebsd/current/dev/mii/miidevs Log: added files from freebsd Added: haiku/vendor/freebsd/current/dev/mii/brgphy.c =================================================================== --- haiku/vendor/freebsd/current/dev/mii/brgphy.c 2008-11-12 22:08:56 UTC (rev 28634) +++ haiku/vendor/freebsd/current/dev/mii/brgphy.c 2008-11-12 22:17:04 UTC (rev 28635) @@ -0,0 +1,1046 @@ +/*- + * 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. + */ + +#include +__FBSDID("$FreeBSD: src/sys/dev/mii/brgphy.c,v 1.78 2008/08/12 00:57:39 yongari Exp $"); + +/* + * Driver for the Broadcom BCM54xx/57xx 1000baseTX PHY. + */ + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include "miidevs.h" + +#include +#include +#include +#include +#include + +#include +#include + +#include "miibus_if.h" + +static int brgphy_probe(device_t); +static int brgphy_attach(device_t); + +struct brgphy_softc { + struct mii_softc mii_sc; + int mii_oui; + int mii_model; + int mii_rev; + int serdes_flags; /* Keeps track of the serdes type used */ +#define BRGPHY_5706S 0x0001 +#define BRGPHY_5708S 0x0002 + int bce_phy_flags; /* PHY flags transferred from the MAC driver */ +}; + +static device_method_t brgphy_methods[] = { + /* device interface */ + DEVMETHOD(device_probe, brgphy_probe), + DEVMETHOD(device_attach, brgphy_attach), + DEVMETHOD(device_detach, mii_phy_detach), + DEVMETHOD(device_shutdown, bus_generic_shutdown), + { 0, 0 } +}; + +static devclass_t brgphy_devclass; + +static driver_t brgphy_driver = { + "brgphy", + brgphy_methods, + sizeof(struct brgphy_softc) +}; + +DRIVER_MODULE(brgphy, miibus, brgphy_driver, brgphy_devclass, 0, 0); + +static int brgphy_service(struct mii_softc *, struct mii_data *, int); +static void brgphy_setmedia(struct mii_softc *, int, int); +static void brgphy_status(struct mii_softc *); +static void brgphy_mii_phy_auto(struct mii_softc *); +static void brgphy_reset(struct mii_softc *); +static void brgphy_enable_loopback(struct mii_softc *); +static void bcm5401_load_dspcode(struct mii_softc *); +static void bcm5411_load_dspcode(struct mii_softc *); +static void brgphy_fixup_5704_a0_bug(struct mii_softc *); +static void brgphy_fixup_adc_bug(struct mii_softc *); +static void brgphy_fixup_adjust_trim(struct mii_softc *); +static void brgphy_fixup_ber_bug(struct mii_softc *); +static void brgphy_fixup_crc_bug(struct mii_softc *); +static void brgphy_fixup_jitter_bug(struct mii_softc *); +static void brgphy_ethernet_wirespeed(struct mii_softc *); +static void brgphy_jumbo_settings(struct mii_softc *, u_long); + +static const struct mii_phydesc brgphys[] = { + MII_PHY_DESC(xxBROADCOM, BCM5400), + MII_PHY_DESC(xxBROADCOM, BCM5401), + MII_PHY_DESC(xxBROADCOM, BCM5411), + MII_PHY_DESC(xxBROADCOM, BCM5701), + MII_PHY_DESC(xxBROADCOM, BCM5703), + MII_PHY_DESC(xxBROADCOM, BCM5704), + MII_PHY_DESC(xxBROADCOM, BCM5705), + MII_PHY_DESC(xxBROADCOM, BCM5706), + MII_PHY_DESC(xxBROADCOM, BCM5714), + MII_PHY_DESC(xxBROADCOM, BCM5750), + MII_PHY_DESC(xxBROADCOM, BCM5752), + MII_PHY_DESC(xxBROADCOM, BCM5754), + MII_PHY_DESC(xxBROADCOM, BCM5780), + MII_PHY_DESC(xxBROADCOM, BCM5708C), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5755), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5787), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5708S), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709CAX), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5722), + MII_PHY_DESC(xxBROADCOM_ALT1, BCM5709C), + MII_PHY_DESC(BROADCOM2, BCM5906), + MII_PHY_END +}; + + +/* Search for our PHY in the list of known PHYs */ +static int +brgphy_probe(device_t dev) +{ + return (mii_phy_dev_probe(dev, brgphys, BUS_PROBE_DEFAULT)); +} + +/* Attach the PHY to the MII bus */ +static int +brgphy_attach(device_t dev) +{ + struct brgphy_softc *bsc; + struct bge_softc *bge_sc = NULL; + struct bce_softc *bce_sc = NULL; + struct mii_softc *sc; + struct mii_attach_args *ma; + struct mii_data *mii; + struct ifnet *ifp; + int fast_ether; + + bsc = device_get_softc(dev); + sc = &bsc->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); + + /* Initialize mii_softc structure */ + sc->mii_inst = mii->mii_instance; + sc->mii_phy = ma->mii_phyno; + sc->mii_service = brgphy_service; + sc->mii_pdata = mii; + sc->mii_anegticks = MII_ANEGTICKS_GIGE; + sc->mii_flags |= MIIF_NOISOLATE | MIIF_NOLOOP; + mii->mii_instance++; + + /* Initialize brgphy_softc structure */ + bsc->mii_oui = MII_OUI(ma->mii_id1, ma->mii_id2); + bsc->mii_model = MII_MODEL(ma->mii_id2); + bsc->mii_rev = MII_REV(ma->mii_id2); + bsc->serdes_flags = 0; + + fast_ether = 0; + + if (bootverbose) + device_printf(dev, "OUI 0x%06x, model 0x%04x, rev. %d\n", + bsc->mii_oui, bsc->mii_model, bsc->mii_rev); + + /* Handle any special cases based on the PHY ID */ + switch (bsc->mii_oui) { + case MII_OUI_BROADCOM: + case MII_OUI_BROADCOM2: + break; + case MII_OUI_xxBROADCOM: + switch (bsc->mii_model) { + case MII_MODEL_xxBROADCOM_BCM5706: + /* + * The 5464 PHY used in the 5706 supports both copper + * and fiber interfaces over GMII. Need to check the + * shadow registers to see which mode is actually + * in effect, and therefore whether we have 5706C or + * 5706S. + */ + PHY_WRITE(sc, BRGPHY_MII_SHADOW_1C, + BRGPHY_SHADOW_1C_MODE_CTRL); + if (PHY_READ(sc, BRGPHY_MII_SHADOW_1C) & + BRGPHY_SHADOW_1C_ENA_1000X) { + bsc->serdes_flags |= BRGPHY_5706S; + sc->mii_flags |= MIIF_HAVEFIBER; + } + break; + } break; + case MII_OUI_xxBROADCOM_ALT1: + switch (bsc->mii_model) { + case MII_MODEL_xxBROADCOM_ALT1_BCM5708S: + bsc->serdes_flags |= BRGPHY_5708S; + sc->mii_flags |= MIIF_HAVEFIBER; + break; + } break; + default: + device_printf(dev, "Unrecognized OUI for PHY!\n"); + } + + ifp = sc->mii_pdata->mii_ifp; + + /* Find the MAC driver associated with this PHY. */ + if (strcmp(ifp->if_dname, "bge") == 0) { + bge_sc = ifp->if_softc; + } else if (strcmp(ifp->if_dname, "bce") == 0) { + bce_sc = ifp->if_softc; + } + + /* Todo: Need to add additional controllers such as 5906 & 5787F */ + /* The 590x chips are 10/100 only. */ + if (bge_sc && + pci_get_vendor(bge_sc->bge_dev) == BCOM_VENDORID && + (pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901 || + pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5901A2 || + pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906 || + pci_get_device(bge_sc->bge_dev) == BCOM_DEVICEID_BCM5906M)) { + fast_ether = 1; + sc->mii_anegticks = MII_ANEGTICKS; + } + + brgphy_reset(sc); + + /* Read the PHY's capabilities. */ + sc->mii_capabilities = PHY_READ(sc, MII_BMSR) & ma->mii_capmask; + if (sc->mii_capabilities & BMSR_EXTSTAT) + sc->mii_extcapabilities = PHY_READ(sc, MII_EXTSR); + device_printf(dev, " "); + +#define ADD(m, c) ifmedia_add(&mii->mii_media, (m), (c), NULL) + + /* Create an instance of Ethernet media. */ + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_NONE, 0, sc->mii_inst), BMCR_ISO); + + /* Add the supported media types */ + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, 0, sc->mii_inst), + BRGPHY_S10); + printf("10baseT, "); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_10_T, IFM_FDX, sc->mii_inst), + BRGPHY_S10 | BRGPHY_BMCR_FDX); + printf("10baseT-FDX, "); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, 0, sc->mii_inst), + BRGPHY_S100); + printf("100baseTX, "); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_100_TX, IFM_FDX, sc->mii_inst), + BRGPHY_S100 | BRGPHY_BMCR_FDX); + printf("100baseTX-FDX, "); + if (fast_ether == 0) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, 0, sc->mii_inst), + BRGPHY_S1000); + printf("1000baseT, "); + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_T, IFM_FDX, sc->mii_inst), + BRGPHY_S1000 | BRGPHY_BMCR_FDX); + printf("1000baseT-FDX, "); + } + } else { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_1000_SX, IFM_FDX, sc->mii_inst), + BRGPHY_S1000 | BRGPHY_BMCR_FDX); + printf("1000baseSX-FDX, "); + /* 2.5G support is a software enabled feature on the 5708S and 5709S. */ + if (bce_sc && (bce_sc->bce_phy_flags & BCE_PHY_2_5G_CAPABLE_FLAG)) { + ADD(IFM_MAKEWORD(IFM_ETHER, IFM_2500_SX, IFM_FDX, sc->mii_inst), 0); + printf("2500baseSX-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 int +brgphy_service(struct mii_softc *sc, struct mii_data *mii, int cmd) +{ + struct brgphy_softc *bsc = (struct brgphy_softc *)sc; + struct ifmedia_entry *ife = mii->mii_media.ifm_cur; + int error = 0; + int val; + + switch (cmd) { + case MII_POLLSTAT: + /* If we're not polling our PHY instance, just return. */ + if (IFM_INST(ife->ifm_media) != sc->mii_inst) + goto brgphy_service_exit; + break; + case MII_MEDIACHG: + /* + * If the media indicates a different PHY instance, + * isolate ourselves. + */ + if (IFM_INST(ife->ifm_media) != sc->mii_inst) { + PHY_WRITE(sc, MII_BMCR, + PHY_READ(sc, MII_BMCR) | BMCR_ISO); + goto brgphy_service_exit; + } + + /* If the interface is not up, don't do anything. */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + break; + + /* Todo: Why is this here? Is it really needed? */ + brgphy_reset(sc); /* XXX hardware bug work-around */ + + switch (IFM_SUBTYPE(ife->ifm_media)) { + case IFM_AUTO: + brgphy_mii_phy_auto(sc); + break; + case IFM_2500_SX: + case IFM_1000_SX: + case IFM_1000_T: + case IFM_100_TX: + case IFM_10_T: + brgphy_setmedia(sc, ife->ifm_media, + mii->mii_ifp->if_flags & IFF_LINK0); + break; + default: + error = EINVAL; + goto brgphy_service_exit; + } + break; + case MII_TICK: + /* Bail if we're not currently selected. */ + if (IFM_INST(ife->ifm_media) != sc->mii_inst) + goto brgphy_service_exit; + + /* Bail if the interface isn't up. */ + if ((mii->mii_ifp->if_flags & IFF_UP) == 0) + goto brgphy_service_exit; + + + /* Bail if autoneg isn't in process. */ + if (IFM_SUBTYPE(ife->ifm_media) != IFM_AUTO) { + sc->mii_ticks = 0; + break; + } + + /* + * Check to see if we have link. If we do, we don't + * need to restart the autonegotiation process. + */ + val = PHY_READ(sc, MII_BMSR) | PHY_READ(sc, MII_BMSR); + if (val & BMSR_LINK) { + sc->mii_ticks = 0; /* Reset autoneg timer. */ + break; + } + + /* Announce link loss right after it happens. */ + if (sc->mii_ticks++ == 0) + break; + + /* Only retry autonegotiation every mii_anegticks seconds. */ + if (sc->mii_ticks <= sc->mii_anegticks) + break; + + + /* Retry autonegotiation */ + sc->mii_ticks = 0; + brgphy_mii_phy_auto(sc); + break; + } + + /* Update the media status. */ + brgphy_status(sc); + + /* + * Callback if something changed. Note that we need to poke + * the DSP on the Broadcom PHYs if the media changes. + */ + if (sc->mii_media_active != mii->mii_media_active || + sc->mii_media_status != mii->mii_media_status || + cmd == MII_MEDIACHG) { + switch (bsc->mii_oui) { + case MII_OUI_BROADCOM: + break; + case MII_OUI_xxBROADCOM: + switch (bsc->mii_model) { + case MII_MODEL_xxBROADCOM_BCM5400: + bcm5401_load_dspcode(sc); + break; + case MII_MODEL_xxBROADCOM_BCM5401: + if (bsc->mii_rev == 1 || bsc->mii_rev == 3) + bcm5401_load_dspcode(sc); + break; + case MII_MODEL_xxBROADCOM_BCM5411: + bcm5411_load_dspcode(sc); + break; + } + break; + case MII_OUI_xxBROADCOM_ALT1: + break; + } + } + mii_phy_update(sc, cmd); +brgphy_service_exit: + return (error); +} + + +/****************************************************************************/ +/* Sets the PHY link speed. */ +/* */ +/* Returns: */ +/* None */ +/****************************************************************************/ +static void +brgphy_setmedia(struct mii_softc *sc, int media, int master) +{ + struct brgphy_softc *bsc = (struct brgphy_softc *)sc; + int bmcr = 0, gig; + + /* Calculate the value for the BMCR register. */ + switch (IFM_SUBTYPE(media)) { + case IFM_2500_SX: + break; + case IFM_1000_SX: + case IFM_1000_T: + bmcr = BRGPHY_S1000; + break; + case IFM_100_TX: + bmcr = BRGPHY_S100; + break; + case IFM_10_T: + default: + bmcr = BRGPHY_S10; + break; + } + + /* Calculate duplex settings for 1000BasetT/1000BaseX. */ + if ((media & IFM_GMASK) == IFM_FDX) { + bmcr |= BRGPHY_BMCR_FDX; + gig = BRGPHY_1000CTL_AFD; + } else { + gig = BRGPHY_1000CTL_AHD; + } + + /* Force loopback to disconnect PHY for Ethernet medium. */ + brgphy_enable_loopback(sc); + + /* Disable 1000BaseT advertisements. */ + PHY_WRITE(sc, BRGPHY_MII_1000CTL, 0); + /* Disable 10/100 advertisements. */ + PHY_WRITE(sc, BRGPHY_MII_ANAR, BRGPHY_SEL_TYPE); + /* Write forced link speed. */ + PHY_WRITE(sc, BRGPHY_MII_BMCR, bmcr); + + /* If 10/100 only then configuration is complete. */ + if ((IFM_SUBTYPE(media) != IFM_1000_T) && (IFM_SUBTYPE(media) != IFM_1000_SX)) + goto brgphy_setmedia_exit; + + /* Set duplex speed advertisement for 1000BaseT/1000BaseX. */ + PHY_WRITE(sc, BRGPHY_MII_1000CTL, gig); + /* Restart auto-negotiation for 1000BaseT/1000BaseX. */ + PHY_WRITE(sc, BRGPHY_MII_BMCR, + bmcr | BRGPHY_BMCR_AUTOEN | BRGPHY_BMCR_STARTNEG); + + /* If not 5701 PHY then configuration is complete. */ + if (bsc->mii_model != MII_MODEL_xxBROADCOM_BCM5701) + goto brgphy_setmedia_exit; + + /* + * 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 (master) { + PHY_WRITE(sc, BRGPHY_MII_1000CTL, + gig | BRGPHY_1000CTL_MSE | BRGPHY_1000CTL_MSC); + } else { + PHY_WRITE(sc, BRGPHY_MII_1000CTL, + gig | BRGPHY_1000CTL_MSE); + } + +brgphy_setmedia_exit: + return; +} + +/****************************************************************************/ +/* Set the media status based on the PHY settings. */ +/* IFM_FLAG0 = 0 (RX flow control disabled) | 1 (enabled) */ +/* IFM_FLAG1 = 0 (TX flow control disabled) | 1 (enabled) */ +/* */ +/* Returns: */ +/* None */ +/****************************************************************************/ +static void +brgphy_status(struct mii_softc *sc) +{ + struct brgphy_softc *bsc = (struct brgphy_softc *)sc; + struct mii_data *mii = sc->mii_pdata; + int aux, bmcr, bmsr, anar, anlpar, xstat, val; + + + mii->mii_media_status = IFM_AVALID; + mii->mii_media_active = IFM_ETHER; + + bmsr = PHY_READ(sc, BRGPHY_MII_BMSR) | PHY_READ(sc, BRGPHY_MII_BMSR); + bmcr = PHY_READ(sc, BRGPHY_MII_BMCR); + anar = PHY_READ(sc, BRGPHY_MII_ANAR); + anlpar = PHY_READ(sc, BRGPHY_MII_ANLPAR); + + /* Loopback is enabled. */ + if (bmcr & BRGPHY_BMCR_LOOP) { + + mii->mii_media_active |= IFM_LOOP; + } + + /* Autoneg is still in progress. */ + if ((bmcr & BRGPHY_BMCR_AUTOEN) && + (bmsr & BRGPHY_BMSR_ACOMP) == 0) { + /* Erg, still trying, I guess... */ + mii->mii_media_active |= IFM_NONE; + goto brgphy_status_exit; + } + + /* Autoneg is enabled and complete, link should be up. */ + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + aux = PHY_READ(sc, BRGPHY_MII_AUXSTS); + + /* If copper link is up, get the negotiated speed/duplex. */ + if (aux & BRGPHY_AUXSTS_LINK) { + mii->mii_media_status |= IFM_ACTIVE; + switch (aux & BRGPHY_AUXSTS_AN_RES) { + case BRGPHY_RES_1000FD: + mii->mii_media_active |= IFM_1000_T | IFM_FDX; break; + case BRGPHY_RES_1000HD: + mii->mii_media_active |= IFM_1000_T | IFM_HDX; break; + case BRGPHY_RES_100FD: + mii->mii_media_active |= IFM_100_TX | IFM_FDX; break; + case BRGPHY_RES_100T4: + mii->mii_media_active |= IFM_100_T4; break; + case BRGPHY_RES_100HD: + mii->mii_media_active |= IFM_100_TX | IFM_HDX; break; + case BRGPHY_RES_10FD: + mii->mii_media_active |= IFM_10_T | IFM_FDX; break; + case BRGPHY_RES_10HD: + mii->mii_media_active |= IFM_10_T | IFM_HDX; break; + default: + mii->mii_media_active |= IFM_NONE; break; + } + } + } else { + /* If serdes link is up, get the negotiated speed/duplex. */ + if (bmsr & BRGPHY_BMSR_LINK) { + mii->mii_media_status |= IFM_ACTIVE; + } + + /* Check the link speed/duplex based on the PHY type. */ + if (bsc->serdes_flags & BRGPHY_5706S) { + mii->mii_media_active |= IFM_1000_SX; + + /* If autoneg enabled, read negotiated duplex settings */ + if (bmcr & BRGPHY_BMCR_AUTOEN) { + val = PHY_READ(sc, BRGPHY_SERDES_ANAR) & PHY_READ(sc, BRGPHY_SERDES_ANLPAR); + if (val & BRGPHY_SERDES_ANAR_FDX) + mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; + } + + } else if (bsc->serdes_flags & BRGPHY_5708S) { + PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, BRGPHY_5708S_DIG_PG0); + xstat = PHY_READ(sc, BRGPHY_5708S_PG0_1000X_STAT1); + + switch (xstat & BRGPHY_5708S_PG0_1000X_STAT1_SPEED_MASK) { + case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_10: + mii->mii_media_active |= IFM_10_FL; break; + case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_100: + mii->mii_media_active |= IFM_100_FX; break; + case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_1G: + mii->mii_media_active |= IFM_1000_SX; break; + case BRGPHY_5708S_PG0_1000X_STAT1_SPEED_25G: + mii->mii_media_active |= IFM_2500_SX; break; + } + + if (xstat & BRGPHY_5708S_PG0_1000X_STAT1_FDX) + mii->mii_media_active |= IFM_FDX; + else + mii->mii_media_active |= IFM_HDX; + } + } + +#if 0 + /* Todo: Change bge/bce to use these settings. */ + + /* Fetch flow control settings from the PHY */ + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + /* Set FLAG0 is RX is enabled and FLAG1 if TX is enabled */ + if ((anar & BRGPHY_ANAR_PC) && (anlpar & BRGPHY_ANLPAR_PC)) { + mii->mii_media_active |= IFM_FLAG0 | IFM_FLAG1; + } else if (!(anar & BRGPHY_ANAR_PC) && (anlpar & BRGPHY_ANAR_ASP) && + (anlpar & BRPHY_ANLPAR_PC) && (anlpar & BRGPHY_ANLPAR_ASP)) { + mii->mii_media_active |= IFM_FLAG1; + } else if ((anar & BRGPHY_ANAR_PC) && (anar & BRGPHY_ANAR_ASP) && + !(anlpar & BRGPHY_ANLPAR_PC) && (anlpar & BRGPHY_ANLPAR_ASP)) { + mii->mii_media_active |= IFM_FLAG0; + } + } + + /* Todo: Add support for fiber settings too. */ +#endif + + +brgphy_status_exit: + return; +} + +static void +brgphy_mii_phy_auto(struct mii_softc *sc) +{ + struct brgphy_softc *bsc = (struct brgphy_softc *)sc; + int ktcr = 0; + + brgphy_reset(sc); + + /* Enable flow control in the advertisement register. */ + if ((sc->mii_flags & MIIF_HAVEFIBER) == 0) { + /* Pause capability advertisement (pause capable & asymmetric) */ + PHY_WRITE(sc, BRGPHY_MII_ANAR, + BMSR_MEDIA_TO_ANAR(sc->mii_capabilities) | ANAR_CSMA | + BRGPHY_ANAR_ASP | BRGPHY_ANAR_PC); + } else { + PHY_WRITE(sc, BRGPHY_SERDES_ANAR, BRGPHY_SERDES_ANAR_FDX | + BRGPHY_SERDES_ANAR_HDX | BRGPHY_SERDES_ANAR_BOTH_PAUSE); + } + + /* Enable speed in the 1000baseT control register */ + ktcr = BRGPHY_1000CTL_AFD | BRGPHY_1000CTL_AHD; + if (bsc->mii_model == MII_MODEL_xxBROADCOM_BCM5701) + ktcr |= BRGPHY_1000CTL_MSE | BRGPHY_1000CTL_MSC; + PHY_WRITE(sc, BRGPHY_MII_1000CTL, ktcr); + ktcr = PHY_READ(sc, BRGPHY_MII_1000CTL); + + /* Start autonegotiation */ + PHY_WRITE(sc, BRGPHY_MII_BMCR,BRGPHY_BMCR_AUTOEN | BRGPHY_BMCR_STARTNEG); + PHY_WRITE(sc, BRGPHY_MII_IMR, 0xFF00); + +} + + +/* Enable loopback to force the link down. */ +static void +brgphy_enable_loopback(struct mii_softc *sc) +{ + int i; + + PHY_WRITE(sc, BRGPHY_MII_BMCR, BRGPHY_BMCR_LOOP); + for (i = 0; i < 15000; i++) { + if (!(PHY_READ(sc, BRGPHY_MII_BMSR) & BRGPHY_BMSR_LINK)) + break; + DELAY(10); + } +} + +/* Turn off tap power management on 5401. */ +static void +bcm5401_load_dspcode(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { BRGPHY_MII_AUXCTL, 0x0c20 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x0012 }, + { BRGPHY_MII_DSP_RW_PORT, 0x1804 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x0013 }, + { BRGPHY_MII_DSP_RW_PORT, 0x1204 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x8006 }, + { BRGPHY_MII_DSP_RW_PORT, 0x0132 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x8006 }, + { BRGPHY_MII_DSP_RW_PORT, 0x0232 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x201f }, + { BRGPHY_MII_DSP_RW_PORT, 0x0a20 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); + DELAY(40); +} + +static void +bcm5411_load_dspcode(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { 0x1c, 0x8c23 }, + { 0x1c, 0x8ca3 }, + { 0x1c, 0x8c23 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); +} + +static void +brgphy_fixup_5704_a0_bug(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { 0x1c, 0x8d68 }, + { 0x1c, 0x8d68 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); +} + +static void +brgphy_fixup_adc_bug(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { BRGPHY_MII_AUXCTL, 0x0c00 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x201f }, + { BRGPHY_MII_DSP_RW_PORT, 0x2aaa }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); +} + +static void +brgphy_fixup_adjust_trim(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { BRGPHY_MII_AUXCTL, 0x0c00 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x000a }, + { BRGPHY_MII_DSP_RW_PORT, 0x110b }, + { BRGPHY_MII_TEST1, 0x0014 }, + { BRGPHY_MII_AUXCTL, 0x0400 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); +} + +static void +brgphy_fixup_ber_bug(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { BRGPHY_MII_AUXCTL, 0x0c00 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x000a }, + { BRGPHY_MII_DSP_RW_PORT, 0x310b }, + { BRGPHY_MII_DSP_ADDR_REG, 0x201f }, + { BRGPHY_MII_DSP_RW_PORT, 0x9506 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x401f }, + { BRGPHY_MII_DSP_RW_PORT, 0x14e2 }, + { BRGPHY_MII_AUXCTL, 0x0400 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); +} + +static void +brgphy_fixup_crc_bug(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { BRGPHY_MII_DSP_RW_PORT, 0x0a75 }, + { 0x1c, 0x8c68 }, + { 0x1c, 0x8d68 }, + { 0x1c, 0x8c68 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); +} + +static void +brgphy_fixup_jitter_bug(struct mii_softc *sc) +{ + static const struct { + int reg; + uint16_t val; + } dspcode[] = { + { BRGPHY_MII_AUXCTL, 0x0c00 }, + { BRGPHY_MII_DSP_ADDR_REG, 0x000a }, + { BRGPHY_MII_DSP_RW_PORT, 0x010b }, + { BRGPHY_MII_AUXCTL, 0x0400 }, + { 0, 0 }, + }; + int i; + + for (i = 0; dspcode[i].reg != 0; i++) + PHY_WRITE(sc, dspcode[i].reg, dspcode[i].val); +} + + +static void +brgphy_fixup_disable_early_dac(struct mii_softc *sc) +{ + uint32_t val; + + PHY_WRITE(sc, BRGPHY_MII_DSP_ADDR_REG, 0x0f08); + val = PHY_READ(sc, BRGPHY_MII_DSP_RW_PORT); + val &= ~(1 << 8); + PHY_WRITE(sc, BRGPHY_MII_DSP_RW_PORT, val); + +} + + +static void +brgphy_ethernet_wirespeed(struct mii_softc *sc) +{ + uint32_t val; + + /* Enable Ethernet at WireSpeed. */ + PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7007); + val = PHY_READ(sc, BRGPHY_MII_AUXCTL); + PHY_WRITE(sc, BRGPHY_MII_AUXCTL, val | (1 << 15) | (1 << 4)); +} + + +static void +brgphy_jumbo_settings(struct mii_softc *sc, u_long mtu) +{ + struct brgphy_softc *bsc = (struct brgphy_softc *)sc; + uint32_t val; + + /* Set or clear jumbo frame settings in the PHY. */ + if (mtu > ETHER_MAX_LEN) { + if (bsc->mii_model == MII_MODEL_xxBROADCOM_BCM5401) { + /* BCM5401 PHY cannot read-modify-write. */ + PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x4c20); + } else { + PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7); + val = PHY_READ(sc, BRGPHY_MII_AUXCTL); + PHY_WRITE(sc, BRGPHY_MII_AUXCTL, + val | BRGPHY_AUXCTL_LONG_PKT); + } + + val = PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL); + PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, + val | BRGPHY_PHY_EXTCTL_HIGH_LA); + } else { + PHY_WRITE(sc, BRGPHY_MII_AUXCTL, 0x7); + val = PHY_READ(sc, BRGPHY_MII_AUXCTL); + PHY_WRITE(sc, BRGPHY_MII_AUXCTL, + val & ~(BRGPHY_AUXCTL_LONG_PKT | 0x7)); + + val = PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL); + PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, + val & ~BRGPHY_PHY_EXTCTL_HIGH_LA); + } +} + +static void +brgphy_reset(struct mii_softc *sc) +{ + struct brgphy_softc *bsc = (struct brgphy_softc *)sc; + struct bge_softc *bge_sc = NULL; + struct bce_softc *bce_sc = NULL; + struct ifnet *ifp; + + /* Perform a standard PHY reset. */ + mii_phy_reset(sc); + + /* Handle any PHY specific procedures following the reset. */ + switch (bsc->mii_oui) { + case MII_OUI_BROADCOM: + break; + case MII_OUI_xxBROADCOM: + switch (bsc->mii_model) { + case MII_MODEL_xxBROADCOM_BCM5400: + bcm5401_load_dspcode(sc); + break; + case MII_MODEL_xxBROADCOM_BCM5401: + if (bsc->mii_rev == 1 || bsc->mii_rev == 3) + bcm5401_load_dspcode(sc); + break; + case MII_MODEL_xxBROADCOM_BCM5411: + bcm5411_load_dspcode(sc); + break; + } + break; + case MII_OUI_xxBROADCOM_ALT1: + break; + } + + ifp = sc->mii_pdata->mii_ifp; + + /* Find the driver associated with this PHY. */ + if (strcmp(ifp->if_dname, "bge") == 0) { + bge_sc = ifp->if_softc; + } else if (strcmp(ifp->if_dname, "bce") == 0) { + bce_sc = ifp->if_softc; + } + + /* Handle any bge (NetXtreme/NetLink) workarounds. */ + if (bge_sc) { + /* Fix up various bugs */ + if (bge_sc->bge_flags & BGE_FLAG_5704_A0_BUG) + brgphy_fixup_5704_a0_bug(sc); + if (bge_sc->bge_flags & BGE_FLAG_ADC_BUG) + brgphy_fixup_adc_bug(sc); + if (bge_sc->bge_flags & BGE_FLAG_ADJUST_TRIM) + brgphy_fixup_adjust_trim(sc); + if (bge_sc->bge_flags & BGE_FLAG_BER_BUG) + brgphy_fixup_ber_bug(sc); + if (bge_sc->bge_flags & BGE_FLAG_CRC_BUG) + brgphy_fixup_crc_bug(sc); + if (bge_sc->bge_flags & BGE_FLAG_JITTER_BUG) + brgphy_fixup_jitter_bug(sc); + + brgphy_jumbo_settings(sc, ifp->if_mtu); + + if (bge_sc->bge_flags & BGE_FLAG_WIRESPEED) + brgphy_ethernet_wirespeed(sc); + + /* Enable Link LED on Dell boxes */ + if (bge_sc->bge_flags & BGE_FLAG_NO_3LED) { + PHY_WRITE(sc, BRGPHY_MII_PHY_EXTCTL, + PHY_READ(sc, BRGPHY_MII_PHY_EXTCTL) & + ~BRGPHY_PHY_EXTCTL_3_LED); + } + + /* Adjust output voltage (From Linux driver) */ + if (bge_sc->bge_asicrev == BGE_ASICREV_BCM5906) + PHY_WRITE(sc, BRGPHY_MII_EPHY_PTEST, 0x12); + + /* Handle any bce (NetXtreme II) workarounds. */ + } else if (bce_sc) { + + if (BCE_CHIP_NUM(bce_sc) == BCE_CHIP_NUM_5708 && + (bce_sc->bce_phy_flags & BCE_PHY_SERDES_FLAG)) { + + /* Store autoneg capabilities/results in digital block (Page 0) */ + PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, BRGPHY_5708S_DIG3_PG2); + PHY_WRITE(sc, BRGPHY_5708S_PG2_DIGCTL_3_0, + BRGPHY_5708S_PG2_DIGCTL_3_0_USE_IEEE); + PHY_WRITE(sc, BRGPHY_5708S_BLOCK_ADDR, BRGPHY_5708S_DIG_PG0); + + /* Enable fiber mode and autodetection */ + PHY_WRITE(sc, BRGPHY_5708S_PG0_1000X_CTL1, + PHY_READ(sc, BRGPHY_5708S_PG0_1000X_CTL1) | + BRGPHY_5708S_PG0_1000X_CTL1_AUTODET_EN | + BRGPHY_5708S_PG0_1000X_CTL1_FIBER_MODE); [... truncated: 308 lines follow ...] From korli at mail.berlios.de Wed Nov 12 23:21:14 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 12 Nov 2008 23:21:14 +0100 Subject: [Haiku-commits] r28636 - in haiku/trunk/src/add-ons/kernel/drivers/network: broadcom440x/dev/mii broadcom570x/dev broadcom570x/dev/bce broadcom570x/dev/mii Message-ID: <200811122221.mACMLE2u023316@sheep.berlios.de> Author: korli Date: 2008-11-12 23:21:13 +0100 (Wed, 12 Nov 2008) New Revision: 28636 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28636&view=rev Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/brgphy.c Removed: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/miidevs.h haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/miidevs.h Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/mii/Jamfile Log: * removed miidevs.h as it's now generated * added brgphy.c it seems to be useful for bcm570x Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/Jamfile 2008-11-12 22:17:04 UTC (rev 28635) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/Jamfile 2008-11-12 22:21:13 UTC (rev 28636) @@ -12,3 +12,6 @@ bmtphy.c ; +ObjectHdrs [ FGristFiles bmtphy$(SUFOBJ) ] + : [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR) libs compat freebsd_network ] ; +Includes [ FGristFiles bmtphy.c ] : miidevs.h ; \ No newline at end of file Deleted: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom440x/dev/mii/miidevs.h Added: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h 2008-11-12 22:17:04 UTC (rev 28635) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bce/if_bcereg.h 2008-11-12 22:21:13 UTC (rev 28636) @@ -0,0 +1,6694 @@ +/*- + * Copyright (c) 2006-2008 Broadcom Corporation + * David Christensen . 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 Broadcom Corporation nor the name of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written consent. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS' + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGE. + * + * $FreeBSD: src/sys/dev/bce/if_bcereg.h,v 1.21 2008/08/27 18:47:24 davidch Exp $ + */ + +#ifndef _BCE_H_DEFINED +#define _BCE_H_DEFINED + +#ifdef HAVE_KERNEL_OPTION_HEADERS +#include "opt_device_polling.h" +#endif + +#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 +#include + +#include +#include +#include "miidevs.h" +#include + +#include +#include + +#include "miibus_if.h" + +/****************************************************************************/ +/* Conversion to FreeBSD type definitions. */ +/****************************************************************************/ +#define u64 uint64_t +#define u32 uint32_t +#define u16 uint16_t +#define u8 uint8_t + +#if BYTE_ORDER == BIG_ENDIAN +#define __BIG_ENDIAN 1 +#undef __LITTLE_ENDIAN +#else +#undef __BIG_ENDIAN +#define __LITTLE_ENDIAN 1 +#endif + +#define BCE_DWORD_PRINTFB \ + "\020" \ + "\40b31" \ + "\37b30" \ + "\36b29" \ + "\35b28" \ + "\34b27" \ + "\33b26" \ + "\32b25" \ + "\31b24" \ + "\30b23" \ + "\27b22" \ + "\26b21" \ + "\25b20" \ + "\24b19" \ + "\23b18" \ + "\22b17" \ + "\21b16" \ + "\20b15" \ + "\17b14" \ + "\16b13" \ + "\15b12" \ + "\14b11" \ + "\13b10" \ + "\12b9" \ + "\11b8" \ + "\10b7" \ + "\07b6" \ + "\06b5" \ + "\05b4" \ + "\04b3" \ + "\03b2" \ + "\02b1" \ + "\01b0" + +/* MII Control Register 0x0 */ +#define BCE_BMCR_PRINTFB \ + "\020" \ + "\20Reset" \ + "\17Loopback" \ + "\16Spd0" \ + "\15AnegEna" \ + "\14PwrDn" \ + "\13Isolate" \ + "\12RstrtAneg" \ + "\11FD" \ + "\10CollTst" \ + "\07Spd1" \ + "\06Rsrvd" \ + "\05Rsrvd" \ + "\04Rsrvd" \ + "\03Rsrvd" \ + "\02Rsrvd" \ + "\01Rsrvd" + +/* MII Status Register 0x1 */ +#define BCE_BMSR_PRINTFB \ + "\020" \ + "\20Cap100T4" \ + "\17Cap100XFD" \ + "\16Cap100XHD" \ + "\15Cap10FD" \ + "\14Cap10HD" \ + "\13Cap100T2FD" \ + "\12Cap100T2HD" \ + "\11ExtStsPrsnt" \ + "\10Rsrvd" \ + "\07PrmblSupp" \ + "\06AnegCmpl" \ + "\05RemFaultDet" \ + "\04AnegCap" \ + "\03LnkUp" \ + "\02JabberDet" \ + "\01ExtCapSupp" + +/* MII Autoneg Advertisement Register 0x4 */ +#define BCE_ANAR_PRINTFB \ + "\020" \ + "\20AdvNxtPg" \ + "\17Rsrvd" \ + "\16AdvRemFault" \ + "\15Rsrvd" \ + "\14AdvAsymPause" \ + "\13AdvPause" \ + "\12Adv100T4" \ + "\11Adv100FD" \ + "\10Adv100HD" \ + "\07Adv10FD" \ + "\06Adv10HD" \ + "\05Rsrvd" \ + "\04Rsrvd" \ + "\03Rsrvd" \ + "\02Rsrvd" \ + "\01Adv802.3" + +/* MII Autoneg Link Partner Ability Register 0x5 */ +#define BCE_ANLPAR_PRINTFB \ + "\020" \ + "\20CapNxtPg" \ + "\17Ack" \ + "\16CapRemFault" \ + "\15Rsrvd" \ + "\14CapAsymPause" \ + "\13CapPause" \ + "\12Cap100T4" \ + "\11Cap100FD" \ + "\10Cap100HD" \ + "\07Cap10FD" \ + "\06Cap10HD" \ + "\05Rsrvd" \ + "\04Rsrvd" \ + "\03Rsrvd" \ + "\02Rsrvd" \ + "\01Cap802.3" + +/* 1000Base-T Control Register 0x09 */ +#define BCE_1000CTL_PRINTFB \ + "\020" \ + "\20Test3" \ + "\17Test2" \ + "\16Test1" \ + "\15MasterSlave" \ + "\14ForceMaster" \ + "\13SwitchDev" \ + "\12Adv1000TFD" \ + "\11Adv1000THD" \ + "\10Rsrvd" \ + "\07Rsrvd" \ + "\06Rsrvd" \ + "\05Rsrvd" \ + "\04Rsrvd" \ + "\03Rsrvd" \ + "\02Rsrvd" \ + "\01Rsrvd" + +/* MII 1000Base-T Status Register 0x0a */ +#define BCE_1000STS_PRINTFB \ + "\020" \ + "\20MstrSlvFault" \ + "\17Master" \ + "\16LclRcvrOk" \ + "\15RemRcvrOk" \ + "\14Cap1000FD" \ + "\13Cpa1000HD" \ + "\12Rsrvd" \ + "\11Rsrvd" + +/* MII Extended Status Register 0x0f */ +#define BCE_EXTSTS_PRINTFB \ + "\020" \ + "\20b15" \ + "\17b14" \ + "\16b13" \ + "\15b12" \ + "\14Rsrvd" \ + "\13Rsrvd" \ + "\12Rsrvd" \ + "\11Rsrvd" \ + "\10Rsrvd" \ + "\07Rsrvd" \ + "\06Rsrvd" \ + "\05Rsrvd" \ + "\04Rsrvd" \ + "\03Rsrvd" \ + "\02Rsrvd" \ + "\01Rsrvd" + +/* MII Autoneg Link Partner Ability Register 0x19 */ +#define BCE_AUXSTS_PRINTFB \ + "\020" \ + "\20AnegCmpl" \ + "\17AnegCmplAck" \ + "\16AnegAckDet" \ + "\15AnegAblDet" \ + "\14AnegNextPgWait" \ + "\13HCD" \ + "\12HCD" \ + "\11HCD" \ + "\10PrlDetFault" \ + "\07RemFault" \ + "\06PgRcvd" \ + "\05LnkPrtnrAnegAbl" \ + "\04LnkPrtnrNPAbl" \ + "\03LnkUp" \ + "\02EnaPauseRcv" \ + "\01EnaPausXmit" + +/* Remove before release. */ +/* #define BCE_DEBUG 1 */ +/* #define BCE_NVRAM_WRITE_SUPPORT */ + +/****************************************************************************/ +/* Debugging macros and definitions. */ +/****************************************************************************/ + +#define BCE_CP_LOAD 0x00000001 +#define BCE_CP_SEND 0x00000002 +#define BCE_CP_RECV 0x00000004 +#define BCE_CP_INTR 0x00000008 +#define BCE_CP_UNLOAD 0x00000010 +#define BCE_CP_RESET 0x00000020 +#define BCE_CP_PHY 0x00000040 +#define BCE_CP_NVRAM 0x00000080 +#define BCE_CP_FIRMWARE 0x00000100 +#define BCE_CP_CTX 0x00000200 +#define BCE_CP_REG 0x00000400 +#define BCE_CP_MISC 0x00400000 +#define BCE_CP_SPECIAL 0x00800000 +#define BCE_CP_ALL 0x00FFFFFF + +#define BCE_CP_MASK 0x00FFFFFF + +#define BCE_LEVEL_FATAL 0x00000000 +#define BCE_LEVEL_WARN 0x01000000 +#define BCE_LEVEL_INFO 0x02000000 +#define BCE_LEVEL_VERBOSE 0x03000000 +#define BCE_LEVEL_EXTREME 0x04000000 +#define BCE_LEVEL_INSANE 0x05000000 + +#define BCE_LEVEL_MASK 0xFF000000 + +#define BCE_WARN_LOAD (BCE_CP_LOAD | BCE_LEVEL_WARN) +#define BCE_INFO_LOAD (BCE_CP_LOAD | BCE_LEVEL_INFO) +#define BCE_VERBOSE_LOAD (BCE_CP_LOAD | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_LOAD (BCE_CP_LOAD | BCE_LEVEL_EXTREME) +#define BCE_INSANE_LOAD (BCE_CP_LOAD | BCE_LEVEL_INSANE) + +#define BCE_WARN_SEND (BCE_CP_SEND | BCE_LEVEL_WARN) +#define BCE_INFO_SEND (BCE_CP_SEND | BCE_LEVEL_INFO) +#define BCE_VERBOSE_SEND (BCE_CP_SEND | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_SEND (BCE_CP_SEND | BCE_LEVEL_EXTREME) +#define BCE_INSANE_SEND (BCE_CP_SEND | BCE_LEVEL_INSANE) + +#define BCE_WARN_RECV (BCE_CP_RECV | BCE_LEVEL_WARN) +#define BCE_INFO_RECV (BCE_CP_RECV | BCE_LEVEL_INFO) +#define BCE_VERBOSE_RECV (BCE_CP_RECV | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_RECV (BCE_CP_RECV | BCE_LEVEL_EXTREME) +#define BCE_INSANE_RECV (BCE_CP_RECV | BCE_LEVEL_INSANE) + +#define BCE_WARN_INTR (BCE_CP_INTR | BCE_LEVEL_WARN) +#define BCE_INFO_INTR (BCE_CP_INTR | BCE_LEVEL_INFO) +#define BCE_VERBOSE_INTR (BCE_CP_INTR | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_INTR (BCE_CP_INTR | BCE_LEVEL_EXTREME) +#define BCE_INSANE_INTR (BCE_CP_INTR | BCE_LEVEL_INSANE) + +#define BCE_WARN_UNLOAD (BCE_CP_UNLOAD | BCE_LEVEL_WARN) +#define BCE_INFO_UNLOAD (BCE_CP_UNLOAD | BCE_LEVEL_INFO) +#define BCE_VERBOSE_UNLOAD (BCE_CP_UNLOAD | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_UNLOAD (BCE_CP_UNLOAD | BCE_LEVEL_EXTREME) +#define BCE_INSANE_UNLOAD (BCE_CP_UNLOAD | BCE_LEVEL_INSANE) + +#define BCE_WARN_RESET (BCE_CP_RESET | BCE_LEVEL_WARN) +#define BCE_INFO_RESET (BCE_CP_RESET | BCE_LEVEL_INFO) +#define BCE_VERBOSE_RESET (BCE_CP_RESET | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_RESET (BCE_CP_RESET | BCE_LEVEL_EXTREME) +#define BCE_INSANE_RESET (BCE_CP_RESET | BCE_LEVEL_INSANE) + +#define BCE_WARN_PHY (BCE_CP_PHY | BCE_LEVEL_WARN) +#define BCE_INFO_PHY (BCE_CP_PHY | BCE_LEVEL_INFO) +#define BCE_VERBOSE_PHY (BCE_CP_PHY | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_PHY (BCE_CP_PHY | BCE_LEVEL_EXTREME) +#define BCE_INSANE_PHY (BCE_CP_PHY | BCE_LEVEL_INSANE) + +#define BCE_WARN_NVRAM (BCE_CP_NVRAM | BCE_LEVEL_WARN) +#define BCE_INFO_NVRAM (BCE_CP_NVRAM | BCE_LEVEL_INFO) +#define BCE_VERBOSE_NVRAM (BCE_CP_NVRAM | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_NVRAM (BCE_CP_NVRAM | BCE_LEVEL_EXTREME) +#define BCE_INSANE_NVRAM (BCE_CP_NVRAM | BCE_LEVEL_INSANE) + +#define BCE_WARN_FIRMWARE (BCE_CP_FIRMWARE | BCE_LEVEL_WARN) +#define BCE_INFO_FIRMWARE (BCE_CP_FIRMWARE | BCE_LEVEL_INFO) +#define BCE_VERBOSE_FIRMWARE (BCE_CP_FIRMWARE | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_FIRMWARE (BCE_CP_FIRMWARE | BCE_LEVEL_EXTREME) +#define BCE_INSANE_FIRMWARE (BCE_CP_FIRMWARE | BCE_LEVEL_INSANE) + +#define BCE_WARN_CTX (BCE_CP_CTX | BCE_LEVEL_WARN) +#define BCE_INFO_CTX (BCE_CP_CTX | BCE_LEVEL_INFO) +#define BCE_VERBOSE_CTX (BCE_CP_CTX | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_CTX (BCE_CP_CTX | BCE_LEVEL_EXTREME) +#define BCE_INSANE_CTX (BCE_CP_CTX | BCE_LEVEL_INSANE) + +#define BCE_WARN_REG (BCE_CP_REG | BCE_LEVEL_WARN) +#define BCE_INFO_REG (BCE_CP_REG | BCE_LEVEL_INFO) +#define BCE_VERBOSE_REG (BCE_CP_REG | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_REG (BCE_CP_REG | BCE_LEVEL_EXTREME) +#define BCE_INSANE_REG (BCE_CP_REG | BCE_LEVEL_INSANE) + +#define BCE_WARN_MISC (BCE_CP_MISC | BCE_LEVEL_WARN) +#define BCE_INFO_MISC (BCE_CP_MISC | BCE_LEVEL_INFO) +#define BCE_VERBOSE_MISC (BCE_CP_MISC | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_MISC (BCE_CP_MISC | BCE_LEVEL_EXTREME) +#define BCE_INSANE_MISC (BCE_CP_MISC | BCE_LEVEL_INSANE) + +#define BCE_WARN_SPECIAL (BCE_CP_SPECIAL | BCE_LEVEL_WARN) +#define BCE_INFO_SPECIAL (BCE_CP_SPECIAL | BCE_LEVEL_INFO) +#define BCE_VERBOSE_SPECIAL (BCE_CP_SPECIAL | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME_SPECIAL (BCE_CP_SPECIAL | BCE_LEVEL_EXTREME) +#define BCE_INSANE_SPECIAL (BCE_CP_SPECIAL | BCE_LEVEL_INSANE) + +#define BCE_FATAL (BCE_CP_ALL | BCE_LEVEL_FATAL) +#define BCE_WARN (BCE_CP_ALL | BCE_LEVEL_WARN) +#define BCE_INFO (BCE_CP_ALL | BCE_LEVEL_INFO) +#define BCE_VERBOSE (BCE_CP_ALL | BCE_LEVEL_VERBOSE) +#define BCE_EXTREME (BCE_CP_ALL | BCE_LEVEL_EXTREME) +#define BCE_INSANE (BCE_CP_ALL | BCE_LEVEL_INSANE) + +#define BCE_CODE_PATH(cp) ((cp & BCE_CP_MASK) & bce_debug) +#define BCE_MSG_LEVEL(lv) ((lv & BCE_LEVEL_MASK) <= (bce_debug & BCE_LEVEL_MASK)) +#define BCE_LOG_MSG(m) (BCE_CODE_PATH(m) && BCE_MSG_LEVEL(m)) + +#ifdef BCE_DEBUG + +/* + * Calculate the time delta between two reads + * of the 25MHz free running clock. + */ +#define BCE_TIME_DELTA(start, end) (start > end ? (start - end) : \ + (~start + end + 1)) + +/* Print a message based on the logging level and code path. */ +#define DBPRINT(sc, level, format, args...) \ + if (BCE_LOG_MSG(level)) { \ + device_printf(sc->bce_dev, format, ## args); \ + } + +/* Runs a particular command when debugging is enabled. */ +#define DBRUN(args...) \ + do { \ + args; \ + } while (0) + +/* Runs a particular command based on the logging level and code path. */ +#define DBRUNMSG(msg, args...) \ + if (BCE_LOG_MSG(msg)) { \ + args; \ + } + +/* Runs a particular command based on the logging level. */ +#define DBRUNLV(level, args...) \ + if (BCE_MSG_LEVEL(level)) { \ + args; \ + } + +/* Runs a particular command based on the code path. */ +#define DBRUNCP(cp, args...) \ + if (BCE_CODE_PATH(cp)) { \ + args; \ + } + +/* Runs a particular command based on a condition. */ +#define DBRUNIF(cond, args...) \ + if (cond) { \ + args; \ + } + +/* Announces function entry. */ +#if 0 +#define DBENTER(cond) \ + u32 start_time = REG_RD(sc, BCE_TIMER_25MHZ_FREE_RUN); \ + u32 end_time; \ + DBPRINT(sc, (cond), "%s(enter)\n", __FUNCTION__); +#endif + +#define DBENTER(cond) \ + DBPRINT(sc, (cond), "%s(enter)\n", __FUNCTION__) + +/* Announces function exit. */ +#if 0 +#define DBEXIT(cond, val) \ + end_time = REG_RD(sc, BCE_TIMER_25MHZ_FREE_RUN); \ + val += (u64) BCE_TIME_DELTA(start_time, end_time); \ + DBPRINT(sc, (cond), "%s(exit)\n", __FUNCTION__); +#endif + +#define DBEXIT(cond) \ + DBPRINT(sc, (cond), "%s(exit)\n", __FUNCTION__) + +/* Temporarily override the debug level. */ +#define DBPUSH(cond) \ + u32 bce_debug_temp = bce_debug; \ + bce_debug |= cond; + +/* Restore the previously overriden debug level. */ +#define DBPOP() \ + bce_debug = bce_debug_temp; + +/* Needed for random() function which is only used in debugging. */ +#include + +/* Returns FALSE in "defects" per 2^31 - 1 calls, otherwise returns TRUE. */ +#define DB_RANDOMFALSE(defects) (random() > defects) +#define DB_OR_RANDOMFALSE(defects) || (random() > defects) +#define DB_AND_RANDOMFALSE(defects) && (random() > ddfects) + +/* Returns TRUE in "defects" per 2^31 - 1 calls, otherwise returns FALSE. */ +#define DB_RANDOMTRUE(defects) (random() < defects) +#define DB_OR_RANDOMTRUE(defects) || (random() < defects) +#define DB_AND_RANDOMTRUE(defects) && (random() < defects) + +#define DB_PRINT_PHY_REG(reg, val) \ + switch(reg) { \ + case 0x00: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (BMCR ), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_BMCR_PRINTFB); break; \ + case 0x01: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (BMSR ), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_BMSR_PRINTFB); break; \ + case 0x04: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (ANAR ), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_ANAR_PRINTFB); break; \ + case 0x05: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (ANLPAR ), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_ANLPAR_PRINTFB); break; \ + case 0x09: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (1000CTL), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_1000CTL_PRINTFB); break; \ + case 0x0a: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (1000STS), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_1000STS_PRINTFB); break; \ + case 0x0f: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (EXTSTS ), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_EXTSTS_PRINTFB); break; \ + case 0x19: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X (AUXSTS ), val = 0x%b\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff, \ + BCE_AUXSTS_PRINTFB); break; \ + default: DBPRINT(sc, BCE_INSANE_PHY, \ + "%s(): phy = %d, reg = 0x%04X, val = 0x%04X\n", \ + __FUNCTION__, phy, (u16) reg & 0xffff, (u16) val & 0xffff); \ + } + +#else + +#define DBPRINT(level, format, args...) +#define DBRUN(args...) +#define DBRUNMSG(msg, args...) +#define DBRUNLV(level, args...) +#define DBRUNCP(cp, args...) +#define DBRUNIF(cond, args...) +#define DBENTER(cond) +#define DBEXIT(cond) +#define DBPUSH(cond) +#define DBPOP() +#define DB_RANDOMFALSE(defects) +#define DB_OR_RANDOMFALSE(percent) +#define DB_AND_RANDOMFALSE(percent) +#define DB_RANDOMTRUE(defects) +#define DB_OR_RANDOMTRUE(percent) +#define DB_AND_RANDOMTRUE(percent) +#define DB_PRINT_PHY_REG(reg, val) + +#endif /* BCE_DEBUG */ + +#if defined(__i386__) || defined(__amd64__) +#define mb() __asm volatile("mfence" ::: "memory") +#define wmb() __asm volatile("sfence" ::: "memory") +#define rmb() __asm volatile("lfence" ::: "memory") +#else +#define mb() +#define rmb() +#define wmb() +#endif + +/****************************************************************************/ +/* Device identification definitions. */ +/****************************************************************************/ +#define BRCM_VENDORID 0x14E4 +#define BRCM_DEVICEID_BCM5706 0x164A +#define BRCM_DEVICEID_BCM5706S 0x16AA +#define BRCM_DEVICEID_BCM5708 0x164C +#define BRCM_DEVICEID_BCM5708S 0x16AC +#define BRCM_DEVICEID_BCM5709 0x1639 +#define BRCM_DEVICEID_BCM5709S 0x163A +#define BRCM_DEVICEID_BCM5716 0x163B + +#define HP_VENDORID 0x103C + +#define PCI_ANY_ID (u_int16_t) (~0U) + +/* chip num:16-31, rev:12-15, metal:4-11, bond_id:0-3 */ + +#define BCE_CHIP_NUM(sc) (((sc)->bce_chipid) & 0xffff0000) +#define BCE_CHIP_NUM_5706 0x57060000 +#define BCE_CHIP_NUM_5708 0x57080000 +#define BCE_CHIP_NUM_5709 0x57090000 +#define BCE_CHIP_NUM_5716 0x57160000 + +#define BCE_CHIP_REV(sc) (((sc)->bce_chipid) & 0x0000f000) +#define BCE_CHIP_REV_Ax 0x00000000 +#define BCE_CHIP_REV_Bx 0x00001000 +#define BCE_CHIP_REV_Cx 0x00002000 + +#define BCE_CHIP_METAL(sc) (((sc)->bce_chipid) & 0x00000ff0) +#define BCE_CHIP_BOND(bp) (((sc)->bce_chipid) & 0x0000000f) + +#define BCE_CHIP_ID(sc) (((sc)->bce_chipid) & 0xfffffff0) +#define BCE_CHIP_ID_5706_A0 0x57060000 +#define BCE_CHIP_ID_5706_A1 0x57060010 +#define BCE_CHIP_ID_5706_A2 0x57060020 +#define BCE_CHIP_ID_5706_A3 0x57060030 +#define BCE_CHIP_ID_5708_A0 0x57080000 +#define BCE_CHIP_ID_5708_B0 0x57081000 +#define BCE_CHIP_ID_5708_B1 0x57081010 +#define BCE_CHIP_ID_5708_B2 0x57081020 +#define BCE_CHIP_ID_5709_A0 0x57090000 +#define BCE_CHIP_ID_5709_A1 0x57090010 +#define BCE_CHIP_ID_5709_B0 0x57091000 +#define BCE_CHIP_ID_5709_B1 0x57091010 +#define BCE_CHIP_ID_5709_B2 0x57091020 +#define BCE_CHIP_ID_5709_C0 0x57092000 +#define BCE_CHIP_ID_5716_C0 0x57162000 + +#define BCE_CHIP_BOND_ID(sc) (((sc)->bce_chipid) & 0xf) + +/* A serdes chip will have the first bit of the bond id set. */ +#define BCE_CHIP_BOND_ID_SERDES_BIT 0x01 + + +/* shorthand one */ +#define BCE_ASICREV(x) ((x) >> 28) +#define BCE_ASICREV_BCM5700 0x06 + +/* chip revisions */ +#define BCE_CHIPREV(x) ((x) >> 24) +#define BCE_CHIPREV_5700_AX 0x70 +#define BCE_CHIPREV_5700_BX 0x71 +#define BCE_CHIPREV_5700_CX 0x72 +#define BCE_CHIPREV_5701_AX 0x00 + +struct bce_type { + u_int16_t bce_vid; + u_int16_t bce_did; + u_int16_t bce_svid; + u_int16_t bce_sdid; + char *bce_name; +}; + +/****************************************************************************/ +/* Byte order conversions. */ +/****************************************************************************/ +#if __FreeBSD_version >= 500000 +#define bce_htobe16(x) htobe16(x) +#define bce_htobe32(x) htobe32(x) +#define bce_htobe64(x) htobe64(x) +#define bce_htole16(x) htole16(x) +#define bce_htole32(x) htole32(x) +#define bce_htole64(x) htole64(x) + +#define bce_be16toh(x) be16toh(x) +#define bce_be32toh(x) be32toh(x) +#define bce_be64toh(x) be64toh(x) +#define bce_le16toh(x) le16toh(x) +#define bce_le32toh(x) le32toh(x) +#define bce_le64toh(x) le64toh(x) +#else +#define bce_htobe16(x) (x) +#define bce_htobe32(x) (x) +#define bce_htobe64(x) (x) +#define bce_htole16(x) (x) +#define bce_htole32(x) (x) +#define bce_htole64(x) (x) + +#define bce_be16toh(x) (x) +#define bce_be32toh(x) (x) +#define bce_be64toh(x) (x) +#define bce_le16toh(x) (x) +#define bce_le32toh(x) (x) +#define bce_le64toh(x) (x) +#endif + + +/****************************************************************************/ +/* NVRAM Access */ +/****************************************************************************/ + +/* Buffered flash (Atmel: AT45DB011B) specific information */ +#define SEEPROM_PAGE_BITS 2 +#define SEEPROM_PHY_PAGE_SIZE (1 << SEEPROM_PAGE_BITS) +#define SEEPROM_BYTE_ADDR_MASK (SEEPROM_PHY_PAGE_SIZE-1) +#define SEEPROM_PAGE_SIZE 4 +#define SEEPROM_TOTAL_SIZE 65536 + +#define BUFFERED_FLASH_PAGE_BITS 9 +#define BUFFERED_FLASH_PHY_PAGE_SIZE (1 << BUFFERED_FLASH_PAGE_BITS) +#define BUFFERED_FLASH_BYTE_ADDR_MASK (BUFFERED_FLASH_PHY_PAGE_SIZE-1) +#define BUFFERED_FLASH_PAGE_SIZE 264 +#define BUFFERED_FLASH_TOTAL_SIZE 0x21000 + +#define SAIFUN_FLASH_PAGE_BITS 8 +#define SAIFUN_FLASH_PHY_PAGE_SIZE (1 << SAIFUN_FLASH_PAGE_BITS) +#define SAIFUN_FLASH_BYTE_ADDR_MASK (SAIFUN_FLASH_PHY_PAGE_SIZE-1) +#define SAIFUN_FLASH_PAGE_SIZE 256 +#define SAIFUN_FLASH_BASE_TOTAL_SIZE 65536 + +#define ST_MICRO_FLASH_PAGE_BITS 8 +#define ST_MICRO_FLASH_PHY_PAGE_SIZE (1 << ST_MICRO_FLASH_PAGE_BITS) +#define ST_MICRO_FLASH_BYTE_ADDR_MASK (ST_MICRO_FLASH_PHY_PAGE_SIZE-1) +#define ST_MICRO_FLASH_PAGE_SIZE 256 +#define ST_MICRO_FLASH_BASE_TOTAL_SIZE 65536 + +#define BCM5709_FLASH_PAGE_BITS 8 +#define BCM5709_FLASH_PHY_PAGE_SIZE (1 << BCM5709_FLASH_PAGE_BITS) +#define BCM5709_FLASH_BYTE_ADDR_MASK (BCM5709_FLASH_PHY_PAGE_SIZE-1) +#define BCM5709_FLASH_PAGE_SIZE 256 + +#define NVRAM_TIMEOUT_COUNT 30000 +#define BCE_FLASHDESC_MAX 64 + +#define FLASH_STRAP_MASK (BCE_NVM_CFG1_FLASH_MODE | \ + BCE_NVM_CFG1_BUFFER_MODE | \ + BCE_NVM_CFG1_PROTECT_MODE | \ + BCE_NVM_CFG1_FLASH_SIZE) + +#define FLASH_BACKUP_STRAP_MASK (0xf << 26) + +struct flash_spec { + u32 strapping; + u32 config1; + u32 config2; + u32 config3; + u32 write1; +#define BCE_NV_BUFFERED 0x00000001 +#define BCE_NV_TRANSLATE 0x00000002 +#define BCE_NV_WREN 0x00000004 + u32 flags; + u32 page_bits; + u32 page_size; + u32 addr_mask; + u32 total_size; + u8 *name; +}; + + +/****************************************************************************/ +/* Shared Memory layout */ +/* The BCE bootcode will initialize this data area with port configurtion */ +/* information which can be accessed by the driver. */ +/****************************************************************************/ + +/* + * This value (in milliseconds) determines the frequency of the driver + * issuing the PULSE message code. The firmware monitors this periodic + * pulse to determine when to switch to an OS-absent mode. + */ +#define DRV_PULSE_PERIOD_MS 250 + +/* + * This value (in milliseconds) determines how long the driver should + * wait for an acknowledgement from the firmware before timing out. Once + * the firmware has timed out, the driver will assume there is no firmware + * running and there won't be any firmware-driver synchronization during a + * driver reset. + */ +#define FW_ACK_TIME_OUT_MS 1000 + + +#define BCE_DRV_RESET_SIGNATURE 0x00000000 +#define BCE_DRV_RESET_SIGNATURE_MAGIC 0x4841564b /* HAVK */ + +#define BCE_DRV_MB 0x00000004 +#define BCE_DRV_MSG_CODE 0xff000000 +#define BCE_DRV_MSG_CODE_RESET 0x01000000 +#define BCE_DRV_MSG_CODE_UNLOAD 0x02000000 +#define BCE_DRV_MSG_CODE_SHUTDOWN 0x03000000 +#define BCE_DRV_MSG_CODE_SUSPEND_WOL 0x04000000 +#define BCE_DRV_MSG_CODE_FW_TIMEOUT 0x05000000 +#define BCE_DRV_MSG_CODE_PULSE 0x06000000 +#define BCE_DRV_MSG_CODE_DIAG 0x07000000 +#define BCE_DRV_MSG_CODE_SUSPEND_NO_WOL 0x09000000 +#define BCE_DRV_MSG_CODE_UNLOAD_LNK_DN 0x0b000000 +#define BCE_DRV_MSG_CODE_CMD_SET_LINK 0x10000000 + +#define BCE_DRV_MSG_DATA 0x00ff0000 +#define BCE_DRV_MSG_DATA_WAIT0 0x00010000 +#define BCE_DRV_MSG_DATA_WAIT1 0x00020000 +#define BCE_DRV_MSG_DATA_WAIT2 0x00030000 +#define BCE_DRV_MSG_DATA_WAIT3 0x00040000 + +#define BCE_DRV_MSG_SEQ 0x0000ffff + +#define BCE_FW_MB 0x00000008 +#define BCE_FW_MSG_ACK 0x0000ffff +#define BCE_FW_MSG_STATUS_MASK 0x00ff0000 +#define BCE_FW_MSG_STATUS_OK 0x00000000 +#define BCE_FW_MSG_STATUS_FAILURE 0x00ff0000 + +#define BCE_LINK_STATUS 0x0000000c +#define BCE_LINK_STATUS_INIT_VALUE 0xffffffff +#define BCE_LINK_STATUS_LINK_UP 0x1 +#define BCE_LINK_STATUS_LINK_DOWN 0x0 +#define BCE_LINK_STATUS_SPEED_MASK 0x1e +#define BCE_LINK_STATUS_AN_INCOMPLETE (0<<1) +#define BCE_LINK_STATUS_10HALF (1<<1) +#define BCE_LINK_STATUS_10FULL (2<<1) +#define BCE_LINK_STATUS_100HALF (3<<1) +#define BCE_LINK_STATUS_100BASE_T4 (4<<1) +#define BCE_LINK_STATUS_100FULL (5<<1) +#define BCE_LINK_STATUS_1000HALF (6<<1) +#define BCE_LINK_STATUS_1000FULL (7<<1) +#define BCE_LINK_STATUS_2500HALF (8<<1) +#define BCE_LINK_STATUS_2500FULL (9<<1) +#define BCE_LINK_STATUS_AN_ENABLED (1<<5) +#define BCE_LINK_STATUS_AN_COMPLETE (1<<6) +#define BCE_LINK_STATUS_PARALLEL_DET (1<<7) +#define BCE_LINK_STATUS_RESERVED (1<<8) +#define BCE_LINK_STATUS_PARTNER_AD_1000FULL (1<<9) +#define BCE_LINK_STATUS_PARTNER_AD_1000HALF (1<<10) +#define BCE_LINK_STATUS_PARTNER_AD_100BT4 (1<<11) +#define BCE_LINK_STATUS_PARTNER_AD_100FULL (1<<12) +#define BCE_LINK_STATUS_PARTNER_AD_100HALF (1<<13) +#define BCE_LINK_STATUS_PARTNER_AD_10FULL (1<<14) +#define BCE_LINK_STATUS_PARTNER_AD_10HALF (1<<15) +#define BCE_LINK_STATUS_TX_FC_ENABLED (1<<16) +#define BCE_LINK_STATUS_RX_FC_ENABLED (1<<17) +#define BCE_LINK_STATUS_PARTNER_SYM_PAUSE_CAP (1<<18) +#define BCE_LINK_STATUS_PARTNER_ASYM_PAUSE_CAP (1<<19) +#define BCE_LINK_STATUS_SERDES_LINK (1<<20) +#define BCE_LINK_STATUS_PARTNER_AD_2500FULL (1<<21) +#define BCE_LINK_STATUS_PARTNER_AD_2500HALF (1<<22) + +#define BCE_DRV_PULSE_MB 0x00000010 +#define BCE_DRV_PULSE_SEQ_MASK 0x00007fff + +#define BCE_MB_ARGS_0 0x00000014 +#define BCE_MB_ARGS_1 0x00000018 + +/* Indicate to the firmware not to go into the + * OS absent when it is not getting driver pulse. + * This is used for debugging. */ +#define BCE_DRV_MSG_DATA_PULSE_CODE_ALWAYS_ALIVE 0x00080000 + +#define BCE_DEV_INFO_SIGNATURE 0x00000020 +#define BCE_DEV_INFO_SIGNATURE_MAGIC 0x44564900 +#define BCE_DEV_INFO_SIGNATURE_MAGIC_MASK 0xffffff00 +#define BCE_DEV_INFO_FEATURE_CFG_VALID 0x01 +#define BCE_DEV_INFO_SECONDARY_PORT 0x80 +#define BCE_DEV_INFO_DRV_ALWAYS_ALIVE 0x40 + +#define BCE_SHARED_HW_CFG_PART_NUM 0x00000024 + +#define BCE_SHARED_HW_CFG_POWER_DISSIPATED 0x00000034 +#define BCE_SHARED_HW_CFG_POWER_STATE_D3_MASK 0xff000000 +#define BCE_SHARED_HW_CFG_POWER_STATE_D2_MASK 0xff0000 +#define BCE_SHARED_HW_CFG_POWER_STATE_D1_MASK 0xff00 +#define BCE_SHARED_HW_CFG_POWER_STATE_D0_MASK 0xff + +#define BCE_SHARED_HW_CFG_POWER_CONSUMED 0x00000038 +#define BCE_SHARED_HW_CFG_CONFIG 0x0000003c +#define BCE_SHARED_HW_CFG_DESIGN_NIC 0 +#define BCE_SHARED_HW_CFG_DESIGN_LOM 0x1 +#define BCE_SHARED_HW_CFG_PHY_COPPER 0 +#define BCE_SHARED_HW_CFG_PHY_FIBER 0x2 +#define BCE_SHARED_HW_CFG_PHY_2_5G 0x20 +#define BCE_SHARED_HW_CFG_PHY_BACKPLANE 0x40 +#define BCE_SHARED_HW_CFG_LED_MODE_SHIFT_BITS 8 +#define BCE_SHARED_HW_CFG_LED_MODE_MASK 0x300 +#define BCE_SHARED_HW_CFG_LED_MODE_MAC 0 +#define BCE_SHARED_HW_CFG_LED_MODE_GPHY1 0x100 +#define BCE_SHARED_HW_CFG_LED_MODE_GPHY2 0x200 + +#define BCE_SHARED_HW_CFG_CONFIG2 0x00000040 +#define BCE_SHARED_HW_CFG2_NVM_SIZE_MASK 0x00fff000 + +#define BCE_DEV_INFO_BC_REV 0x0000004c + +#define BCE_PORT_HW_CFG_MAC_UPPER 0x00000050 +#define BCE_PORT_HW_CFG_UPPERMAC_MASK 0xffff + +#define BCE_PORT_HW_CFG_MAC_LOWER 0x00000054 +#define BCE_PORT_HW_CFG_CONFIG 0x00000058 +#define BCE_PORT_HW_CFG_CFG_TXCTL3_MASK 0x0000ffff +#define BCE_PORT_HW_CFG_CFG_DFLT_LINK_MASK 0x001f0000 +#define BCE_PORT_HW_CFG_CFG_DFLT_LINK_AN 0x00000000 +#define BCE_PORT_HW_CFG_CFG_DFLT_LINK_1G 0x00030000 +#define BCE_PORT_HW_CFG_CFG_DFLT_LINK_2_5G 0x00040000 + +#define BCE_PORT_HW_CFG_IMD_MAC_A_UPPER 0x00000068 +#define BCE_PORT_HW_CFG_IMD_MAC_A_LOWER 0x0000006c +#define BCE_PORT_HW_CFG_IMD_MAC_B_UPPER 0x00000070 +#define BCE_PORT_HW_CFG_IMD_MAC_B_LOWER 0x00000074 +#define BCE_PORT_HW_CFG_ISCSI_MAC_UPPER 0x00000078 +#define BCE_PORT_HW_CFG_ISCSI_MAC_LOWER 0x0000007c + +#define BCE_DEV_INFO_PER_PORT_HW_CONFIG2 0x000000b4 + +#define BCE_DEV_INFO_FORMAT_REV 0x000000c4 +#define BCE_DEV_INFO_FORMAT_REV_MASK 0xff000000 +#define BCE_DEV_INFO_FORMAT_REV_ID ('A' << 24) + +#define BCE_SHARED_FEATURE 0x000000c8 +#define BCE_SHARED_FEATURE_MASK 0xffffffff + +#define BCE_PORT_FEATURE 0x000000d8 +#define BCE_PORT2_FEATURE 0x00000014c +#define BCE_PORT_FEATURE_WOL_ENABLED 0x01000000 +#define BCE_PORT_FEATURE_MBA_ENABLED 0x02000000 +#define BCE_PORT_FEATURE_ASF_ENABLED 0x04000000 +#define BCE_PORT_FEATURE_IMD_ENABLED 0x08000000 +#define BCE_PORT_FEATURE_BAR1_SIZE_MASK 0xf +#define BCE_PORT_FEATURE_BAR1_SIZE_DISABLED 0x0 +#define BCE_PORT_FEATURE_BAR1_SIZE_64K 0x1 +#define BCE_PORT_FEATURE_BAR1_SIZE_128K 0x2 +#define BCE_PORT_FEATURE_BAR1_SIZE_256K 0x3 +#define BCE_PORT_FEATURE_BAR1_SIZE_512K 0x4 +#define BCE_PORT_FEATURE_BAR1_SIZE_1M 0x5 +#define BCE_PORT_FEATURE_BAR1_SIZE_2M 0x6 +#define BCE_PORT_FEATURE_BAR1_SIZE_4M 0x7 +#define BCE_PORT_FEATURE_BAR1_SIZE_8M 0x8 +#define BCE_PORT_FEATURE_BAR1_SIZE_16M 0x9 +#define BCE_PORT_FEATURE_BAR1_SIZE_32M 0xa +#define BCE_PORT_FEATURE_BAR1_SIZE_64M 0xb +#define BCE_PORT_FEATURE_BAR1_SIZE_128M 0xc +#define BCE_PORT_FEATURE_BAR1_SIZE_256M 0xd +#define BCE_PORT_FEATURE_BAR1_SIZE_512M 0xe +#define BCE_PORT_FEATURE_BAR1_SIZE_1G 0xf + +#define BCE_PORT_FEATURE_WOL 0xdc +#define BCE_PORT2_FEATURE_WOL 0x150 +#define BCE_PORT_FEATURE_WOL_DEFAULT_SHIFT_BITS 4 +#define BCE_PORT_FEATURE_WOL_DEFAULT_MASK 0x30 +#define BCE_PORT_FEATURE_WOL_DEFAULT_DISABLE 0 +#define BCE_PORT_FEATURE_WOL_DEFAULT_MAGIC 0x10 +#define BCE_PORT_FEATURE_WOL_DEFAULT_ACPI 0x20 +#define BCE_PORT_FEATURE_WOL_DEFAULT_MAGIC_AND_ACPI 0x30 +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_MASK 0xf +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_AUTONEG 0 +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_10HALF 1 +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_10FULL 2 +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_100HALF 3 +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_100FULL 4 +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_1000HALF 5 +#define BCE_PORT_FEATURE_WOL_LINK_SPEED_1000FULL 6 +#define BCE_PORT_FEATURE_WOL_AUTONEG_ADVERTISE_1000 0x40 +#define BCE_PORT_FEATURE_WOL_RESERVED_PAUSE_CAP 0x400 +#define BCE_PORT_FEATURE_WOL_RESERVED_ASYM_PAUSE_CAP 0x800 + +#define BCE_PORT_FEATURE_MBA 0xe0 +#define BCE_PORT2_FEATURE_MBA 0x154 +#define BCE_PORT_FEATURE_MBA_BOOT_AGENT_TYPE_SHIFT_BITS 0 +#define BCE_PORT_FEATURE_MBA_BOOT_AGENT_TYPE_MASK 0x3 +#define BCE_PORT_FEATURE_MBA_BOOT_AGENT_TYPE_PXE 0 +#define BCE_PORT_FEATURE_MBA_BOOT_AGENT_TYPE_RPL 1 +#define BCE_PORT_FEATURE_MBA_BOOT_AGENT_TYPE_BOOTP 2 +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_SHIFT_BITS 2 +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_MASK 0x3c +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_AUTONEG 0 +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_10HALF 0x4 +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_10FULL 0x8 +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_100HALF 0xc +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_100FULL 0x10 +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_1000HALF 0x14 +#define BCE_PORT_FEATURE_MBA_LINK_SPEED_1000FULL 0x18 +#define BCE_PORT_FEATURE_MBA_SETUP_PROMPT_ENABLE 0x40 +#define BCE_PORT_FEATURE_MBA_HOTKEY_CTRL_S 0 +#define BCE_PORT_FEATURE_MBA_HOTKEY_CTRL_B 0x80 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_SHIFT_BITS 8 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_MASK 0xff00 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_DISABLED 0 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_1K 0x100 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_2K 0x200 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_4K 0x300 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_8K 0x400 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_16K 0x500 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_32K 0x600 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_64K 0x700 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_128K 0x800 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_256K 0x900 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_512K 0xa00 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_1M 0xb00 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_2M 0xc00 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_4M 0xd00 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_8M 0xe00 +#define BCE_PORT_FEATURE_MBA_EXP_ROM_SIZE_16M 0xf00 +#define BCE_PORT_FEATURE_MBA_MSG_TIMEOUT_SHIFT_BITS 16 [... truncated: 6786 lines follow ...] From korli at mail.berlios.de Wed Nov 12 23:36:49 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 12 Nov 2008 23:36:49 +0100 Subject: [Haiku-commits] r28637 - haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge Message-ID: <200811122236.mACManbg024443@sheep.berlios.de> Author: korli Date: 2008-11-12 23:36:48 +0100 (Wed, 12 Nov 2008) New Revision: 28637 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28637&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/Jamfile haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c Log: fix the build and added a dependency on brgphy Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/Jamfile =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/Jamfile 2008-11-12 22:21:13 UTC (rev 28636) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/Jamfile 2008-11-12 22:36:48 UTC (rev 28637) @@ -16,3 +16,6 @@ : libfreebsd_network.a broadcom570x_mii.a ; +ObjectHdrs [ FGristFiles if_bge$(SUFOBJ) ] + : [ FDirName $(TARGET_COMMON_DEBUG_OBJECT_DIR) libs compat freebsd_network ] ; +Includes [ FGristFiles if_bge.c ] : miidevs.h ; Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c 2008-11-12 22:21:13 UTC (rev 28636) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c 2008-11-12 22:36:48 UTC (rev 28637) @@ -14,6 +14,7 @@ HAIKU_DRIVER_REQUIREMENTS(FBSD_TASKQUEUES | FBSD_SWI_TASKQUEUE); +extern driver_t *DRIVER_MODULE_NAME(brgphy, miibus); extern driver_t *DRIVER_MODULE_NAME(ukphy, miibus); @@ -21,6 +22,7 @@ __haiku_select_miibus_driver(device_t dev) { driver_t *drivers[] = { + DRIVER_MODULE_NAME(brgphy, miibus), DRIVER_MODULE_NAME(ukphy, miibus), NULL }; From ingo_weinhold at gmx.de Wed Nov 12 23:58:00 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Wed, 12 Nov 2008 23:58:00 +0100 Subject: [Haiku-commits] r28630 - in haiku/trunk: headers/libs headers/libs/iconv src/libs/iconv In-Reply-To: <200811121934.mACJYZiB006489@sheep.berlios.de> References: <200811121934.mACJYZiB006489@sheep.berlios.de> Message-ID: <20081112235800.518.1@knochen-vm.localdomain> On 2008-11-12 at 20:34:35 [+0100], zooey at BerliOS wrote: > Author: zooey > Date: 2008-11-12 20:34:35 +0100 (Wed, 12 Nov 2008) > New Revision: 28630 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28630&view=rev > > Added: > haiku/trunk/headers/libs/iconv/ > haiku/trunk/headers/libs/iconv/iconv.h > haiku/trunk/headers/libs/iconv/localcharset.h > haiku/trunk/src/libs/iconv/Jamfile > haiku/trunk/src/libs/iconv/libiconv_config.h > Removed: > haiku/trunk/src/libs/iconv/Makefile.in > haiku/trunk/src/libs/iconv/config.h > haiku/trunk/src/libs/iconv/iconv.h > haiku/trunk/src/libs/iconv/localcharset.h > Modified: > haiku/trunk/src/libs/iconv/iconv.c > haiku/trunk/src/libs/iconv/localcharset.c > Log: [...] > * renamed config.h to libiconv_config.h in order to circumvent strange > problems with regex.c from glibc picking it up That's weird. Why would totally unrelated code search headers in that directory? If it does, that's definitely a build system problem that needs to be fixed. CU, Ingo From zooey at hirschkaefer.de Thu Nov 13 09:22:33 2008 From: zooey at hirschkaefer.de (Oliver Tappe) Date: Thu, 13 Nov 2008 09:22:33 +0100 Subject: [Haiku-commits] r28630 - in haiku/trunk: headers/libs headers/libs/iconv src/libs/iconv In-Reply-To: <20081112235800.518.1@knochen-vm.localdomain> References: <200811121934.mACJYZiB006489@sheep.berlios.de> <20081112235800.518.1@knochen-vm.localdomain> Message-ID: <20081113092233.438.2@bee.hirschkaefer.site> On 2008-11-12 at 23:58:00 [+0100], Ingo Weinhold wrote: > > On 2008-11-12 at 20:34:35 [+0100], zooey at BerliOS > wrote: [...] > > * renamed config.h to libiconv_config.h in order to circumvent strange > > problems with regex.c from glibc picking it up > > That's weird. Why would totally unrelated code search headers in that > directory? If it does, that's definitely a build system problem that needs to > be fixed. Yeah, I thought you would say that ;-) To be precise: what happened is the following: as long as the header was named config.h, whenever you touch it, the file src/system/libroot/posix/glibc/regex/regex.c gets recompiled. I have no idea if that really picks up the config.h from iconv, but it seeing that it depends on that header was frightening enough for me to rename it. I will dig some more later today. cheers, Oliver From ingo_weinhold at gmx.de Thu Nov 13 16:53:12 2008 From: ingo_weinhold at gmx.de (Ingo Weinhold) Date: Thu, 13 Nov 2008 16:53:12 +0100 Subject: [Haiku-commits] r28630 - in haiku/trunk: headers/libs headers/libs/iconv src/libs/iconv In-Reply-To: <20081113092233.438.2@bee.hirschkaefer.site> References: <200811121934.mACJYZiB006489@sheep.berlios.de> <20081112235800.518.1@knochen-vm.localdomain> <20081113092233.438.2@bee.hirschkaefer.site> Message-ID: <20081113165312.505.1@knochen-vm.localdomain> On 2008-11-13 at 09:22:33 [+0100], Oliver Tappe wrote: > On 2008-11-12 at 23:58:00 [+0100], Ingo Weinhold > wrote: > > > > On 2008-11-12 at 20:34:35 [+0100], zooey at BerliOS > > > > wrote: > [...] > > > * renamed config.h to libiconv_config.h in order to circumvent strange > > > problems with regex.c from glibc picking it up > > > > That's weird. Why would totally unrelated code search headers in that > > directory? If it does, that's definitely a build system problem that > > needs to > > be fixed. > > Yeah, I thought you would say that ;-) > > To be precise: what happened is the following: as long as the header was > named > config.h, whenever you touch it, the file > src/system/libroot/posix/glibc/regex/regex.c gets recompiled. I have no idea > if that really picks up the config.h from iconv, but it seeing that it > depends > on that header was frightening enough for me to rename it. Jam can indeed find additional header dependencies, but only those that are in the search path, too, which in this case really shouldn't happen. Jam searches headers in the directories specified by the per object variable HDRSEARCH (cf. the Object rule in build/jam/OverriddenJamRules), but those should be identical to the search paths passed to the compiler. > I will dig some more later today. Great! CU, Ingo From zooey at mail.berlios.de Thu Nov 13 17:23:04 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Thu, 13 Nov 2008 17:23:04 +0100 Subject: [Haiku-commits] r28639 - haiku/trunk/src/system/libroot/posix/glibc/regex Message-ID: <200811131623.mADGN4vl015691@sheep.berlios.de> Author: zooey Date: 2008-11-13 17:23:04 +0100 (Thu, 13 Nov 2008) New Revision: 28639 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28639&view=rev Modified: haiku/trunk/src/system/libroot/posix/glibc/regex/regex.c Log: solved build dependency puzzle in regex.c: * removed superfluous #include which was protected by an #ifdef that evaluated to false - so the file never got included, but jam tried to locate it and usually failed, unless there happens to be a config.h in the current working directory. This fixes a spurious dependency from regex.c to the config.h in src/libs/iconv.h if you invoked jam from there. * fixed two warnings by always including stdlib.h Modified: haiku/trunk/src/system/libroot/posix/glibc/regex/regex.c =================================================================== --- haiku/trunk/src/system/libroot/posix/glibc/regex/regex.c 2008-11-13 15:40:38 UTC (rev 28638) +++ haiku/trunk/src/system/libroot/posix/glibc/regex/regex.c 2008-11-13 16:23:04 UTC (rev 28639) @@ -27,10 +27,6 @@ #undef _GNU_SOURCE #define _GNU_SOURCE -#ifdef HAVE_CONFIG_H -# include -#endif - #ifndef PARAMS # if defined __GNUC__ || (defined __STDC__ && __STDC__) # define PARAMS(args) args @@ -143,12 +139,7 @@ even if config.h says that we can. */ # undef REL_ALLOC -# if defined STDC_HEADERS || defined _LIBC -# include -# else -char *malloc (); -char *realloc (); -# endif +#include /* When used in Emacs's lib-src, we need to get bzero and bcopy somehow. If nothing else has been done, use the method below. */ From zooey at mail.berlios.de Thu Nov 13 17:24:33 2008 From: zooey at mail.berlios.de (zooey at BerliOS) Date: Thu, 13 Nov 2008 17:24:33 +0100 Subject: [Haiku-commits] r28640 - haiku/trunk/src/libs/iconv Message-ID: <200811131624.mADGOXSN015957@sheep.berlios.de> Author: zooey Date: 2008-11-13 17:24:33 +0100 (Thu, 13 Nov 2008) New Revision: 28640 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28640&view=rev Added: haiku/trunk/src/libs/iconv/config.h Removed: haiku/trunk/src/libs/iconv/libiconv_config.h Modified: haiku/trunk/src/libs/iconv/iconv.c haiku/trunk/src/libs/iconv/localcharset.c Log: * renamed libiconv_config.h back to config.h - now that it no longer triggers building of regex.c Copied: haiku/trunk/src/libs/iconv/config.h (from rev 28632, haiku/trunk/src/libs/iconv/libiconv_config.h) Modified: haiku/trunk/src/libs/iconv/iconv.c =================================================================== --- haiku/trunk/src/libs/iconv/iconv.c 2008-11-13 16:23:04 UTC (rev 28639) +++ haiku/trunk/src/libs/iconv/iconv.c 2008-11-13 16:24:33 UTC (rev 28640) @@ -22,7 +22,7 @@ #include #include -#include "libiconv_config.h" +#include "config.h" #include "localcharset.h" #if ENABLE_EXTRA Deleted: haiku/trunk/src/libs/iconv/libiconv_config.h Modified: haiku/trunk/src/libs/iconv/localcharset.c =================================================================== --- haiku/trunk/src/libs/iconv/localcharset.c 2008-11-13 16:23:04 UTC (rev 28639) +++ haiku/trunk/src/libs/iconv/localcharset.c 2008-11-13 16:24:33 UTC (rev 28640) @@ -19,7 +19,7 @@ /* Written by Bruno Haible . */ -#include "libiconv_config.h" +#include "config.h" /* Specification. */ #include "localcharset.h" From jackburton at mail.berlios.de Thu Nov 13 16:40:57 2008 From: jackburton at mail.berlios.de (jackburton at mail.berlios.de) Date: Thu, 13 Nov 2008 16:40:57 +0100 Subject: [Haiku-commits] r28638 - haiku/trunk/src/add-ons/kernel/bus_managers/acpi Message-ID: <200811131540.mADFevpT032210@sheep.berlios.de> Author: jackburton Date: 2008-11-13 16:40:38 +0100 (Thu, 13 Nov 2008) New Revision: 28638 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28638&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c Log: log an error in case the passed buffer is too small. This happens with the acpi_thermal driver and also with the acpi_battery driver by Francesco Piccinno (not yet committed), but it's a design flaw of the api Modified: haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c 2008-11-12 22:36:48 UTC (rev 28637) +++ haiku/trunk/src/add-ons/kernel/bus_managers/acpi/acpi_busman.c 2008-11-13 15:40:38 UTC (rev 28638) @@ -380,6 +380,9 @@ status = AcpiEvaluateObject(NULL, (ACPI_STRING)object, NULL, returnValue != NULL ? &buffer : NULL); + if (status == AE_BUFFER_OVERFLOW) + dprintf("evaluate_object: the passed buffer is too small!\n"); + return status == AE_OK ? B_OK : B_ERROR; } @@ -405,6 +408,9 @@ status = AcpiEvaluateObject(handle, (ACPI_STRING)method, args != NULL ? &acpiArgs : NULL, returnValue != NULL ? &buffer : NULL); + if (status == AE_BUFFER_OVERFLOW) + dprintf("evaluate_method: the passed buffer is too small!\n"); + return status == AE_OK ? B_OK : B_ERROR; } From stippi at mail.berlios.de Thu Nov 13 21:07:33 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Thu, 13 Nov 2008 21:07:33 +0100 Subject: [Haiku-commits] r28641 - haiku/trunk/src/apps/mail Message-ID: <200811132007.mADK7X7u027783@sheep.berlios.de> Author: stippi Date: 2008-11-13 21:07:32 +0100 (Thu, 13 Nov 2008) New Revision: 28641 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28641&view=rev Modified: haiku/trunk/src/apps/mail/MailWindow.cpp Log: Do not set fSent to true in SaveAsDraft() already, since it is correctly set in Send(), which uses SaveAsDraft(). This fixes #1020. Thanks to kaoutsis and ksmith for their investigation! Modified: haiku/trunk/src/apps/mail/MailWindow.cpp =================================================================== --- haiku/trunk/src/apps/mail/MailWindow.cpp 2008-11-13 16:24:33 UTC (rev 28640) +++ haiku/trunk/src/apps/mail/MailWindow.cpp 2008-11-13 20:07:32 UTC (rev 28641) @@ -2173,9 +2173,8 @@ mail_encoding encodingForHeaders = quoted_printable; if (!now) { - status_t status; - - if ((status = SaveAsDraft()) != B_OK) { + status_t status = SaveAsDraft(); + if (status != B_OK) { beep(); (new BAlert("", MDR_DIALECT_CHOICE ("E-mail draft could not be saved!","????????????????"), @@ -2552,7 +2551,6 @@ BNodeInfo info(&draft); info.SetType(kDraftType); - fSent = true; fDraft = true; fChanged = false; From stippi at mail.berlios.de Thu Nov 13 23:14:44 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 13 Nov 2008 23:14:44 +0100 Subject: [Haiku-commits] r28642 - in haiku/trunk/src/add-ons/input_server/devices: keyboard mouse touchpad Message-ID: <200811132214.mADMEinJ011088@sheep.berlios.de> Author: stippi Date: 2008-11-13 23:14:40 +0100 (Thu, 13 Nov 2008) New Revision: 28642 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28642&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp Log: * Don't return B_OK from Start() if opening the device failed. Then Stop() won't be called, the control thread will remove the device anyways. * Turned off the debug output I left on accidentally in KeyboardInputDevice. Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-13 20:07:32 UTC (rev 28641) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-13 22:14:40 UTC (rev 28642) @@ -27,7 +27,7 @@ #undef TRACE -#define TRACE_KEYBOARD_DEVICE +//#define TRACE_KEYBOARD_DEVICE #ifdef TRACE_KEYBOARD_DEVICE class FunctionTracer { @@ -497,7 +497,8 @@ fActive = true; resume_thread(fThread); - return B_OK; + + return fFD >= 0 ? B_OK : B_ERROR; } void Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-13 20:07:32 UTC (rev 28641) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-13 22:14:40 UTC (rev 28642) @@ -210,7 +210,7 @@ return status; } - return B_OK; + return fDevice >= 0 ? B_OK : B_ERROR; } Modified: haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-13 20:07:32 UTC (rev 28641) +++ haiku/trunk/src/add-ons/input_server/devices/touchpad/TouchpadInputDevice.cpp 2008-11-13 22:14:40 UTC (rev 28642) @@ -180,7 +180,7 @@ return status; } - return B_OK; + return fDevice >= 0 ? B_OK : B_ERROR; } From stippi at mail.berlios.de Fri Nov 14 00:37:10 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 14 Nov 2008 00:37:10 +0100 Subject: [Haiku-commits] r28643 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811132337.mADNbAkn032758@sheep.berlios.de> Author: stippi Date: 2008-11-14 00:37:03 +0100 (Fri, 14 Nov 2008) New Revision: 28643 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28643&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h Log: * Implemented setting the "click count" correctly in the Synaptics driver. * I feel the Synaptics driver is now good enough to give it more exposure and turned it on again. If it gives you trouble for some reason, you can turn it off again in ps2_dev.c, line 105. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-13 22:14:40 UTC (rev 28642) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-13 23:37:03 UTC (rev 28643) @@ -102,7 +102,7 @@ // probe devices // the probe function has to set the dev name and the dev packet size -#if 0 +#if 1 status = probe_trackpoint(dev); if (status == B_OK) { *hooks = &gStandardMouseDeviceHooks; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-13 22:14:40 UTC (rev 28642) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.c 2008-11-13 23:37:03 UTC (rev 28643) @@ -191,6 +191,7 @@ float sens = 0; bigtime_t currentTime = system_time(); touchpad_settings * settings = &(cookie->settings); + uint32 buttons = event->buttons; if (!movement) return B_ERROR; @@ -241,8 +242,8 @@ isSideScrollingH = true; } if (isSideScrollingV || isSideScrollingH - ||(event->wValue == 0 && settings->scroll_twofinger) - ||(event->wValue == 1 && settings->scroll_multifinger)) { + || (event->wValue == 0 && settings->scroll_twofinger) + || (event->wValue == 1 && settings->scroll_multifinger)) { goto scrolling; } else { cookie->scrolling_started = false; @@ -266,8 +267,8 @@ movement->ydelta = cookie->movement_maker.yDelta; // tap gesture - cookie->tap_delta_x+= cookie->movement_maker.xDelta; - cookie->tap_delta_y+= cookie->movement_maker.yDelta; + cookie->tap_delta_x += cookie->movement_maker.xDelta; + cookie->tap_delta_y += cookie->movement_maker.yDelta; if (cookie->tapdrag_started) { movement->buttons = 0x01; // left button @@ -295,6 +296,8 @@ cookie->tap_delta_y = 0; } + cookie->buttons_state = movement->buttons; + return B_OK; scrolling: @@ -316,23 +319,22 @@ movement->wheel_xdelta = 0; else if (isSideScrollingH && !isSideScrollingV) movement->wheel_ydelta = 0; + + cookie->buttons_state = movement->buttons; + return B_OK; notouch: TRACE("SYNAPTICS: no touch event\n"); cookie->scrolling_started = false; cookie->movement_started = false; - movement->buttons = event->buttons; - if (event->buttons) - movement->clicks = 1; if (cookie->tapdrag_started && (currentTime - cookie->tap_time) < SYN_TAP_TIMEOUT) { - movement->buttons = 0x01; - movement->clicks = 0; + buttons = 0x01; } - // if the movement stopped switch off the dap trag when timeout is expired + // if the movement stopped switch off the tap drag when timeout is expired if ((currentTime - cookie->tap_time) > SYN_TAP_TIMEOUT) { cookie->tapdrag_started = false; cookie->valid_edge_motion = false; @@ -350,19 +352,32 @@ if (cookie->tap_clicks > 1) { TRACE("SYNAPTICS: empty click\n"); - movement->buttons = 0x00; - movement->clicks = 0; + buttons = 0x00; cookie->tap_clicks = 0; cookie->double_click = true; } else { - movement->buttons = 0x01; - movement->clicks = 1; + buttons = 0x01; cookie->tap_started = false; cookie->tapdrag_started = true; cookie->double_click = false; } } + // set click count correctly according to double click timeout + if (buttons != 0 && cookie->buttons_state == 0) { + if (cookie->click_last_time + cookie->click_speed > currentTime) + cookie->click_count++; + else + cookie->click_count = 1; + + cookie->click_last_time = currentTime; + } + + movement->buttons = buttons; + cookie->buttons_state = buttons; + if (buttons) + movement->clicks = cookie->click_count; + return B_OK; } @@ -671,9 +686,11 @@ if ((status = get_synaptics_movment(cookie, &movement)) != B_OK) return status; return user_memcpy(buffer, &movement, sizeof(movement)); + case MS_IS_TOUCHPAD: TRACE("SYNAPTICS: MS_IS_TOUCHPAD\n"); return B_OK; + case MS_SET_TOUCHPAD_SETTINGS: TRACE("SYNAPTICS: MS_SET_TOUCHPAD_SETTINGS"); user_memcpy(&(cookie->settings), buffer, sizeof(touchpad_settings)); @@ -684,6 +701,11 @@ cookie->movement_maker.scroll_acceleration = cookie->settings.scroll_acceleration; return B_OK; + + case MS_SET_CLICKSPEED: + TRACE("SYNAPTICS: ioctl MS_SETCLICK (set click speed)\n"); + return user_memcpy(&cookie->click_speed, buffer, sizeof(bigtime_t)); + default: TRACE("SYNAPTICS: unknown opcode: %ld\n", op); return B_BAD_VALUE; Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2008-11-13 22:14:40 UTC (rev 28642) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_synaptics.h 2008-11-13 23:37:03 UTC (rev 28643) @@ -72,12 +72,11 @@ } touch_event; -typedef struct -{ - ps2_dev * dev; +typedef struct { + ps2_dev* dev; sem_id synaptics_sem; - packet_buffer * synaptics_ring_buffer; + packet_buffer* synaptics_ring_buffer; size_t packet_index; uint8 packet_buffer[PS2_PACKET_SYNAPTICS]; uint8 mode; @@ -94,6 +93,11 @@ bool valid_edge_motion; bool double_click; + bigtime_t click_last_time; + bigtime_t click_speed; + int32 click_count; + uint32 buttons_state; + touchpad_settings settings; } synaptics_cookie; From bonefish at mail.berlios.de Fri Nov 14 02:50:14 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 14 Nov 2008 02:50:14 +0100 Subject: [Haiku-commits] r28644 - haiku/trunk/src/system/kernel Message-ID: <200811140150.mAE1oEAc000879@sheep.berlios.de> Author: bonefish Date: 2008-11-14 02:50:13 +0100 (Fri, 14 Nov 2008) New Revision: 28644 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28644&view=rev Modified: haiku/trunk/src/system/kernel/heap.cpp Log: * The deferred_deleter() kernel daemon dropped out, if the list with memory to free was empty, but didn't check the list with objects to delete. So those were queued until someone used deferred_free(). Should fix #3128. * Run the daemon once a second instead of every five seconds, so memory is recycled a little quicker. Modified: haiku/trunk/src/system/kernel/heap.cpp =================================================================== --- haiku/trunk/src/system/kernel/heap.cpp 2008-11-13 23:37:03 UTC (rev 28643) +++ haiku/trunk/src/system/kernel/heap.cpp 2008-11-14 01:50:13 UTC (rev 28644) @@ -1614,7 +1614,7 @@ { // move entries and deletables to on-stack lists InterruptsSpinLocker locker(sDeferredFreeListLock); - if (sDeferredFreeList.IsEmpty()) + if (sDeferredFreeList.IsEmpty() && sDeferredDeletableList.IsEmpty()) return; DeferredFreeList entries; @@ -1786,7 +1786,8 @@ return sHeapGrowThread; } - if (register_kernel_daemon(deferred_deleter, NULL, 50) != B_OK) + // run the deferred deleter roughly once a second + if (register_kernel_daemon(deferred_deleter, NULL, 10) != B_OK) panic("heap_init_post_thread(): failed to init deferred deleter"); send_signal_etc(sHeapGrowThread, SIGCONT, B_DO_NOT_RESCHEDULE); From axeld at mail.berlios.de Fri Nov 14 10:58:19 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 14 Nov 2008 10:58:19 +0100 Subject: [Haiku-commits] r28645 - haiku/trunk/src/kits/textencoding Message-ID: <200811140958.mAE9wJxa003579@sheep.berlios.de> Author: axeld Date: 2008-11-14 10:58:18 +0100 (Fri, 14 Nov 2008) New Revision: 28645 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28645&view=rev Modified: haiku/trunk/src/kits/textencoding/utf8_conversions.cpp Log: * Removed a superfluous allocation (even without nothrow!), and a superfluous const_cast. Modified: haiku/trunk/src/kits/textencoding/utf8_conversions.cpp =================================================================== --- haiku/trunk/src/kits/textencoding/utf8_conversions.cpp 2008-11-14 01:50:13 UTC (rev 28644) +++ haiku/trunk/src/kits/textencoding/utf8_conversions.cpp 2008-11-14 09:58:18 UTC (rev 28645) @@ -1,5 +1,5 @@ /* - * Copyright 2003-2007, Haiku, Inc. All Rights Reserved. + * Copyright 2003-2008, Haiku, Inc. All Rights Reserved. * Distributed under the terms of the MIT License. * * Authors: @@ -78,10 +78,9 @@ iconvctl(conversion, ICONV_SET_DISCARD_ILSEQ, (void*)&zero); // prepare to convert the substitute character to target encoding - char* original = new char[1]; - original[0] = substitute; + char original = substitute; size_t len = 1; - char* copy = original; + char* copy = &original; // Perform the conversion // We ignore any errors during this as part of robustness/best-effort @@ -91,11 +90,9 @@ iconv_t iso8859_1to = iconv_open(to,"ISO-8859-1"); if (iso8859_1to != (iconv_t)-1) { iconv(iso8859_1to, 0, 0, 0, 0); - iconv(iso8859_1to, const_cast(©), &len, &dst, - &outputLeft); + iconv(iso8859_1to, ©, &len, &dst, &outputLeft); iconv_close(iso8859_1to); } - delete[] original; break; } From axeld at mail.berlios.de Fri Nov 14 11:23:42 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 14 Nov 2008 11:23:42 +0100 Subject: [Haiku-commits] r28646 - haiku/trunk/src/kits/interface Message-ID: <200811141023.mAEANg1X006626@sheep.berlios.de> Author: axeld Date: 2008-11-14 11:23:38 +0100 (Fri, 14 Nov 2008) New Revision: 28646 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28646&view=rev Modified: haiku/trunk/src/kits/interface/Alert.cpp haiku/trunk/src/kits/interface/Button.cpp haiku/trunk/src/kits/interface/View.cpp haiku/trunk/src/kits/interface/Window.cpp Log: * Replaced some "new" with new(std::nothrow) where appropriate in our base classes (BView, BWindow, BAlert, BButton - BTextView should be part of this, too, to make BAlerts work). * However, it's not that simple, because there is often no way to return an error. Most of that code obviously assumes to be able to throw exceptions (it's just not communicated to the caller). Maybe we should just start documenting exceptions for R1 (and properly use exceptions later on). * Automatic white space cleanup. Modified: haiku/trunk/src/kits/interface/Alert.cpp =================================================================== --- haiku/trunk/src/kits/interface/Alert.cpp 2008-11-14 09:58:18 UTC (rev 28645) +++ haiku/trunk/src/kits/interface/Alert.cpp 2008-11-14 10:23:38 UTC (rev 28646) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2006, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -73,7 +73,7 @@ #ifdef __HAIKU__ return max_c(1, ((int32)be_plain_font->Size() + 15) / 16); #endif - return 1; + return 1; } @@ -182,7 +182,7 @@ if (data->FindInt32("_but_width", &temp) == B_OK) fButtonWidth = (button_width)temp; - AddCommonFilter(new _BAlertFilter_(this)); + AddCommonFilter(new(std::nothrow) _BAlertFilter_(this)); } @@ -192,7 +192,7 @@ if (!validate_instantiation(data, "BAlert")) return NULL; - return new BAlert(data); + return new(std::nothrow) BAlert(data); } @@ -440,7 +440,7 @@ void BAlert::_ReservedAlert3() {} -void +void BAlert::_InitObject(const char* text, const char* button0, const char* button1, const char* button2, button_width buttonWidth, button_spacing spacing, alert_type type) @@ -455,7 +455,10 @@ fButtonWidth = buttonWidth; // Set up the "_master_" view - TAlertView* view = new TAlertView(Bounds()); + TAlertView* view = new(std::nothrow) TAlertView(Bounds()); + if (view == NULL) + return; + AddChild(view); view->SetBitmap(_InitIcon()); @@ -541,9 +544,12 @@ textViewRect.left = (kWindowIconOffset + kIconStripeWidth) * iconLayoutScale - 2; - fTextView = new BTextView(textViewRect, "_tv_", + fTextView = new(std::nothrow) BTextView(textViewRect, "_tv_", textViewRect.OffsetByCopy(B_ORIGIN), B_FOLLOW_LEFT | B_FOLLOW_TOP, B_WILL_DRAW); + if (fTextView == NULL) + return; + fTextView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); rgb_color textColor = ui_color(B_PANEL_TEXT_COLOR); fTextView->SetFontAndColor(be_plain_font, B_FONT_ALL, &textColor); @@ -562,7 +568,7 @@ textViewRect.bottom += textHeight; fTextView->SetTextRect(textViewRect); - AddCommonFilter(new _BAlertFilter_(this)); + AddCommonFilter(new(std::nothrow) _BAlertFilter_(this)); MoveTo(AlertPosition(Frame().Width(), Frame().Height())); } @@ -602,7 +608,7 @@ strerror(status))); return NULL; } - + // Which icon are we trying to load? const char* iconName = ""; // Don't want any seg faults switch (alertType) { @@ -627,7 +633,7 @@ int32 iconSize = 32 * icon_layout_scale(); // Allocate the icon bitmap - icon = new (std::nothrow) BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), + icon = new(std::nothrow) BBitmap(BRect(0, 0, iconSize - 1, iconSize - 1), 0, B_RGBA32); if (icon == NULL || icon->InitCheck() < B_OK) { FTRACE((stderr, "BAlert::_InitIcon() - No memory for bitmap\n")); @@ -693,7 +699,7 @@ char name[32]; snprintf(name, sizeof(name), "_b%ld_", which); - BButton* button = new (std::nothrow) BButton(rect, name, label, message, + BButton* button = new(std::nothrow) BButton(rect, name, label, message, B_FOLLOW_RIGHT | B_FOLLOW_BOTTOM); if (button == NULL) return NULL; @@ -742,7 +748,7 @@ if (!validate_instantiation(archive, "TAlertView")) return NULL; - return new TAlertView(archive); + return new(std::nothrow) TAlertView(archive); } Modified: haiku/trunk/src/kits/interface/Button.cpp =================================================================== --- haiku/trunk/src/kits/interface/Button.cpp 2008-11-14 09:58:18 UTC (rev 28645) +++ haiku/trunk/src/kits/interface/Button.cpp 2008-11-14 10:23:38 UTC (rev 28646) @@ -1,5 +1,5 @@ /* - * Copyright 2001-2005, Haiku. + * Copyright 2001-2008, Haiku. * Distributed under the terms of the MIT License. * * Authors: @@ -13,6 +13,8 @@ #include +#include + #include #include #include @@ -21,12 +23,12 @@ #include -BButton::BButton(BRect frame, const char *name, const char *label, BMessage *message, - uint32 resizingMode, uint32 flags) - : BControl(frame, name, label, message, resizingMode, +BButton::BButton(BRect frame, const char* name, const char* label, + BMessage* message, uint32 resizingMode, uint32 flags) + : BControl(frame, name, label, message, resizingMode, flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), - fPreferredSize(-1, -1), - fDrawAsDefault(false) + fPreferredSize(-1, -1), + fDrawAsDefault(false) { // Resize to minimum height if needed font_height fh; @@ -37,21 +39,21 @@ } -BButton::BButton(const char* name, const char* label, BMessage *message, - uint32 flags) - : BControl(name, label, message, +BButton::BButton(const char* name, const char* label, BMessage* message, + uint32 flags) + : BControl(name, label, message, flags | B_WILL_DRAW | B_FULL_UPDATE_ON_RESIZE), - fPreferredSize(-1, -1), - fDrawAsDefault(false) + fPreferredSize(-1, -1), + fDrawAsDefault(false) { } -BButton::BButton(const char* label, BMessage *message) - : BControl(NULL, label, message, +BButton::BButton(const char* label, BMessage* message) + : BControl(NULL, label, message, B_WILL_DRAW | B_NAVIGABLE | B_FULL_UPDATE_ON_RESIZE), - fPreferredSize(-1, -1), - fDrawAsDefault(false) + fPreferredSize(-1, -1), + fDrawAsDefault(false) { } @@ -61,9 +63,9 @@ } -BButton::BButton(BMessage *archive) - : BControl(archive), - fPreferredSize(-1, -1) +BButton::BButton(BMessage* archive) + : BControl(archive), + fPreferredSize(-1, -1) { if (archive->FindBool("_default", &fDrawAsDefault) != B_OK) fDrawAsDefault = false; @@ -72,11 +74,11 @@ } -BArchivable * -BButton::Instantiate(BMessage *archive) +BArchivable* +BButton::Instantiate(BMessage* archive) { if (validate_instantiation(archive, "BButton")) - return new BButton(archive); + return new(std::nothrow) BButton(archive); return NULL; } @@ -89,7 +91,7 @@ if (err != B_OK) return err; - + if (IsDefault()) err = archive->AddBool("_default", true); @@ -102,10 +104,10 @@ { font_height fh; GetFontHeight(&fh); - + const BRect bounds = Bounds(); BRect rect = bounds; - + const bool enabled = IsEnabled(); const bool pushed = Value() == B_CONTROL_ON; #if 0 @@ -119,49 +121,49 @@ fillArea.InsetBy(3.0f, 3.0f); BString text = Label(); - + #if 1 - // Label truncation + // Label truncation BFont font; GetFont(&font); font.TruncateString(&text, B_TRUNCATE_END, fillArea.Width()); #endif // Label position - const float stringWidth = StringWidth(text.String()); + const float stringWidth = StringWidth(text.String()); const float x = (bounds.right - stringWidth) / 2.0f; - const float labelY = bounds.top - + ((bounds.Height() - fh.ascent - fh.descent) / 2.0f) - + fh.ascent + 1.0f; + const float labelY = bounds.top + + ((bounds.Height() - fh.ascent - fh.descent) / 2.0f) + + fh.ascent + 1.0f; const float focusLineY = labelY + fh.descent; /* speed trick: if the focus changes but the button is not pressed then we can - redraw only the focus line, - if the focus changes and the button is pressed invert the internal rect - this block takes care of all the focus changes + redraw only the focus line, + if the focus changes and the button is pressed invert the internal rect + this block takes care of all the focus changes */ - if (IsFocusChanging()) { + if (IsFocusChanging()) { if (pushed) { rect.InsetBy(2.0, 2.0); InvertRect(rect); - } else + } else DrawFocusLine(x, focusLineY, stringWidth, IsFocus() && Window()->IsActive()); - + return; } - // Colors + // Colors const rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); - const rgb_color buttonBgColor=tint_color(panelBgColor, B_LIGHTEN_1_TINT); - const rgb_color maxLightColor=tint_color(panelBgColor, B_LIGHTEN_MAX_TINT); - const rgb_color maxShadowColor=tint_color(panelBgColor, B_DARKEN_MAX_TINT); - const rgb_color darkBorderColor = tint_color(panelBgColor, + const rgb_color buttonBgColor=tint_color(panelBgColor, B_LIGHTEN_1_TINT); + const rgb_color maxLightColor=tint_color(panelBgColor, B_LIGHTEN_MAX_TINT); + const rgb_color maxShadowColor=tint_color(panelBgColor, B_DARKEN_MAX_TINT); + const rgb_color darkBorderColor = tint_color(panelBgColor, enabled ? B_DARKEN_4_TINT : B_DARKEN_2_TINT); - const rgb_color firstBevelColor = enabled ? tint_color(panelBgColor, B_DARKEN_2_TINT) + const rgb_color firstBevelColor = enabled ? tint_color(panelBgColor, B_DARKEN_2_TINT) : panelBgColor; const rgb_color cornerColor = IsDefault() ? firstBevelColor : panelBgColor; - + // Fill the button area SetHighColor(buttonBgColor); FillRect(fillArea); @@ -169,7 +171,7 @@ // external border SetHighColor(darkBorderColor); StrokeRect(rect); - + BeginLineArray(14); // Corners @@ -179,31 +181,31 @@ AddLine(rect.RightBottom(), rect.RightBottom(), cornerColor); rect.InsetBy(1.0f,1.0f); - + // Shadow AddLine(rect.LeftBottom(), rect.RightBottom(), firstBevelColor); AddLine(rect.RightBottom(), rect.RightTop(), firstBevelColor); // Light AddLine(rect.LeftTop(), rect.LeftBottom(),buttonBgColor); - AddLine(rect.LeftTop(), rect.RightTop(), buttonBgColor); - + AddLine(rect.LeftTop(), rect.RightTop(), buttonBgColor); + rect.InsetBy(1.0f, 1.0f); - + // Shadow AddLine(rect.LeftBottom(), rect.RightBottom(), panelBgColor); AddLine(rect.RightBottom(), rect.RightTop(), panelBgColor); // Light AddLine(rect.LeftTop(), rect.LeftBottom(),maxLightColor); - AddLine(rect.LeftTop(), rect.RightTop(), maxLightColor); - + AddLine(rect.LeftTop(), rect.RightTop(), maxLightColor); + rect.InsetBy(1.0f,1.0f); - + // Light AddLine(rect.LeftTop(), rect.LeftBottom(),maxLightColor); - AddLine(rect.LeftTop(), rect.RightTop(), maxLightColor); - - EndLineArray(); + AddLine(rect.LeftTop(), rect.RightTop(), maxLightColor); + EndLineArray(); + // Invert if clicked if (enabled && pushed) { rect.InsetBy(-2.0f, -2.0f); @@ -216,12 +218,12 @@ SetHighColor(maxLightColor); SetLowColor(maxShadowColor); } else { - SetHighColor(maxShadowColor); + SetHighColor(maxShadowColor); SetLowColor(tint_color(panelBgColor, B_LIGHTEN_2_TINT)); } } else { SetHighColor(tint_color(panelBgColor, B_DISABLED_LABEL_TINT)); - SetLowColor(tint_color(panelBgColor, B_LIGHTEN_2_TINT)); + SetLowColor(tint_color(panelBgColor, B_LIGHTEN_2_TINT)); } // Draw the label @@ -239,16 +241,16 @@ fillArea.InsetBy(3.0, 3.0); BString text = Label(); - + #if 1 - // Label truncation + // Label truncation BFont font; GetFont(&font); font.TruncateString(&text, B_TRUNCATE_END, fillArea.Width() - 4); #endif // Label position - const float stringWidth = StringWidth(text.String()); + const float stringWidth = StringWidth(text.String()); const float x = (rect.right - stringWidth) / 2.0; const float labelY = bounds.top + ((bounds.Height() - fh.ascent - fh.descent) / 2.0) @@ -257,11 +259,11 @@ /* speed trick: if the focus changes but the button is not pressed then we can - redraw only the focus line, - if the focus changes and the button is pressed invert the internal rect - this block takes care of all the focus changes + redraw only the focus line, + if the focus changes and the button is pressed invert the internal rect + this block takes care of all the focus changes */ - if (IsFocusChanging()) { + if (IsFocusChanging()) { if (pushed) { rect.InsetBy(2.0, 2.0); InvertRect(rect); @@ -269,16 +271,16 @@ DrawFocusLine(x, focusLineY, stringWidth, IsFocus() && Window()->IsActive()); } - + return; } - // colors + // colors rgb_color panelBgColor = ui_color(B_PANEL_BACKGROUND_COLOR); - rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); + rgb_color buttonBgColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); rgb_color lightColor; - rgb_color maxLightColor; - rgb_color maxShadowColor = tint_color(panelBgColor, B_DARKEN_MAX_TINT); + rgb_color maxLightColor; + rgb_color maxShadowColor = tint_color(panelBgColor, B_DARKEN_MAX_TINT); rgb_color dark1BorderColor; rgb_color dark2BorderColor; @@ -292,11 +294,11 @@ if (enabled) { lightColor = tint_color(panelBgColor, B_LIGHTEN_2_TINT); - maxLightColor = tint_color(panelBgColor, B_LIGHTEN_MAX_TINT); - + maxLightColor = tint_color(panelBgColor, B_LIGHTEN_MAX_TINT); + dark1BorderColor = tint_color(panelBgColor, B_DARKEN_3_TINT); dark2BorderColor = tint_color(panelBgColor, B_DARKEN_4_TINT); - + bevelColor1 = tint_color(panelBgColor, B_DARKEN_2_TINT); bevelColor2 = panelBgColor; @@ -311,7 +313,7 @@ + panelBgColor.green) / 2; borderBevelLight.blue = (borderBevelLight.blue + panelBgColor.blue) / 2; - + dark1BorderColor = tint_color(dark1BorderColor, B_DARKEN_3_TINT); dark2BorderColor = tint_color(dark1BorderColor, B_DARKEN_4_TINT); @@ -325,11 +327,11 @@ } } else { lightColor = tint_color(panelBgColor, B_LIGHTEN_2_TINT); - maxLightColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); - + maxLightColor = tint_color(panelBgColor, B_LIGHTEN_1_TINT); + dark1BorderColor = tint_color(panelBgColor, B_DARKEN_1_TINT); dark2BorderColor = tint_color(panelBgColor, B_DARKEN_2_TINT); - + bevelColor1 = panelBgColor; bevelColor2 = buttonBgColor; @@ -376,7 +378,7 @@ BPoint(rect.left + 1, rect.bottom), dark2BorderColor); rect.InsetBy(1.0, 1.0); - + // Light AddLine(BPoint(rect.left, rect.top), BPoint(rect.left, rect.top), buttonBgColor); @@ -385,9 +387,9 @@ AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.bottom), bevelColor2); AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right - 1, rect.top), lightColor); + BPoint(rect.right - 1, rect.top), lightColor); AddLine(BPoint(rect.right, rect.top), - BPoint(rect.right, rect.top), bevelColor2); + BPoint(rect.right, rect.top), bevelColor2); // Shadow AddLine(BPoint(rect.left + 1, rect.bottom), BPoint(rect.right - 1, rect.bottom), bevelColor1); @@ -395,28 +397,28 @@ BPoint(rect.right, rect.bottom), bevelColorRBCorner); AddLine(BPoint(rect.right, rect.bottom - 1), BPoint(rect.right, rect.top + 1), bevelColor1); - + rect.InsetBy(1.0, 1.0); - + // Light AddLine(BPoint(rect.left, rect.top), BPoint(rect.left, rect.bottom - 1), maxLightColor); AddLine(BPoint(rect.left, rect.bottom), BPoint(rect.left, rect.bottom), buttonBgColor); AddLine(BPoint(rect.left + 1, rect.top), - BPoint(rect.right - 1, rect.top), maxLightColor); + BPoint(rect.right - 1, rect.top), maxLightColor); AddLine(BPoint(rect.right, rect.top), - BPoint(rect.right, rect.top), buttonBgColor); + BPoint(rect.right, rect.top), buttonBgColor); // Shadow AddLine(BPoint(rect.left + 1, rect.bottom), BPoint(rect.right, rect.bottom), bevelColor2); AddLine(BPoint(rect.right, rect.bottom - 1), BPoint(rect.right, rect.top + 1), bevelColor2); - + rect.InsetBy(1.0,1.0); - - EndLineArray(); + EndLineArray(); + // Invert if clicked if (enabled && pushed) { rect.InsetBy(-2.0, -2.0); @@ -436,7 +438,7 @@ } } else { SetHighColor(tint_color(panelBgColor, B_DISABLED_LABEL_TINT)); - SetLowColor(buttonBgColor); + SetLowColor(buttonBgColor); } // Draw the label @@ -445,7 +447,7 @@ // Focus line if (enabled && IsFocus() && Window()->IsActive() && !pushed) DrawFocusLine(x, focusLineY, stringWidth, true); -#endif +#endif } @@ -520,7 +522,7 @@ { BButton *oldDefault = NULL; BWindow *window = Window(); - + if (window) oldDefault = window->DefaultButton(); @@ -601,7 +603,7 @@ if (Bounds().Contains(point)) Invoke(); - + SetTracking(false); } @@ -646,7 +648,7 @@ { Sync(); snooze(50000); - + status_t err = BControl::Invoke(message); SetValue(B_CONTROL_OFF); @@ -815,7 +817,7 @@ rgb_color no_tint = ui_color(B_PANEL_BACKGROUND_COLOR), lighten1 = tint_color(no_tint, B_LIGHTEN_1_TINT), darken1 = tint_color(no_tint, B_DARKEN_1_TINT); - + rgb_color borderColor; if (enabled) borderColor = tint_color(no_tint, B_DARKEN_4_TINT); @@ -847,9 +849,9 @@ float inset = enabled? 2.0f : 3.0f; SetHighColor(lighten1); - FillRect(BRect(bounds.left, bounds.top, + FillRect(BRect(bounds.left, bounds.top, bounds.right, bounds.top+inset-1.0f)); - FillRect(BRect(bounds.left, bounds.bottom-inset+1.0f, + FillRect(BRect(bounds.left, bounds.bottom-inset+1.0f, bounds.right, bounds.bottom)); FillRect(BRect(bounds.left, bounds.top+inset-1.0f, bounds.left+inset-1.0f, bounds.bottom-inset+1.0f)); @@ -902,7 +904,7 @@ // Blue Line StrokeLine(BPoint(x, y), BPoint(x + width, y)); - if (visible) + if (visible) SetHighColor(255, 255, 255); // White Line StrokeLine(BPoint(x, y + 1.0f), BPoint(x + width, y + 1.0f)); @@ -926,7 +928,7 @@ // height font_height fontHeight; GetFontHeight(&fontHeight); - + fPreferredSize.height = ceilf((fontHeight.ascent + fontHeight.descent) * 1.8) + (fDrawAsDefault ? 6.0f : 0); Modified: haiku/trunk/src/kits/interface/View.cpp =================================================================== --- haiku/trunk/src/kits/interface/View.cpp 2008-11-14 09:58:18 UTC (rev 28645) +++ haiku/trunk/src/kits/interface/View.cpp 2008-11-14 10:23:38 UTC (rev 28646) @@ -482,7 +482,7 @@ if (!validate_instantiation(data , "BView")) return NULL; - return new BView(data); + return new(std::nothrow) BView(data); } @@ -1265,11 +1265,14 @@ return; } - // TODO: that's not really what should happen - the app_server should take the chance - // *NOT* to need to drag a whole bitmap around but just a frame. + // TODO: that's not really what should happen - the app_server should take + // the chance *NOT* to need to drag a whole bitmap around but just a frame. // create a drag bitmap for the rect - BBitmap *bitmap = new BBitmap(dragRect, B_RGBA32); + BBitmap *bitmap = new(std::nothrow) BBitmap(dragRect, B_RGBA32); + if (bitmap == NULL) + return; + uint32 *bits = (uint32*)bitmap->Bits(); uint32 bytesPerRow = bitmap->BytesPerRow(); uint32 width = dragRect.IntegerWidth() + 1; @@ -1316,7 +1319,7 @@ if (image == NULL) { // TODO: workaround for drags without a bitmap - should not be necessary if // we move the rectangle dragging into the app_server - image = new (nothrow) BBitmap(BRect(0, 0, 0, 0), B_RGBA32); + image = new(std::nothrow) BBitmap(BRect(0, 0, 0, 0), B_RGBA32); if (image == NULL) return; } @@ -1348,8 +1351,8 @@ // TODO: create area and flatten message into that area! // send area info over port, not the actual message! int32 bufferSize = privateMessage.NativeFlattenedSize(); - char* buffer = new (nothrow) char[bufferSize]; - if (buffer) { + char* buffer = new(std::nothrow) char[bufferSize]; + if (buffer != NULL) { privateMessage.NativeFlatten(buffer, bufferSize); fOwner->fLink->StartMessage(AS_VIEW_DRAG_IMAGE); @@ -3373,12 +3376,14 @@ // not fatal, but it helps during // development of your app and is in // line with R5... - delete [] fCommArray->array; + delete[] fCommArray->array; delete fCommArray; } + // TODO: since this method cannot return failure, and further AddLine() + // calls with a NULL fCommArray would drop into the debugger anyway, + // we allow the possible std::bad_alloc exceptions here... fCommArray = new _array_data_; - fCommArray->maxCount = count; fCommArray->count = 0; fCommArray->array = new _array_hdr_[count]; @@ -4631,7 +4636,7 @@ // BView constructor. This does not cause problems under BeOS as it just // ors the two fields to one 32bit flag. // For now we do the same but print the above warning message. - // ToDo: this should be removed at some point and the original + // TODO: this should be removed at some point and the original // version restored: // fFlags = (resizingMode & _RESIZE_MASK_) | (flags & ~_RESIZE_MASK_); fFlags = resizingMode | flags; @@ -4662,6 +4667,8 @@ fIsPrinting = false; fAttached = false; + // TODO: Since we cannot communicate failure, we don't use std::nothrow here + // TODO: Maybe we could auto-delete those views on AddChild() instead? fState = new BPrivate::ViewState; fBounds = frame.OffsetToCopy(B_ORIGIN); @@ -4744,19 +4751,22 @@ bounds.right = bounds.left + ((bounds.IntegerWidth() + 1) / 32 + 1) * 32 - 1; // TODO: I used a RGBA32 bitmap because drawing on a GRAY8 doesn't work. - BBitmap *bitmap = new BBitmap(bounds, B_RGBA32, true); - if (bitmap && bitmap->InitCheck() == B_OK && bitmap->Lock()) { - BView *view = new BView(bounds, "drawing view", B_FOLLOW_NONE, 0); - bitmap->AddChild(view); - view->DrawPicture(picture, where); - view->Sync(); + BBitmap *bitmap = new(std::nothrow) BBitmap(bounds, B_RGBA32, true); + if (bitmap != NULL && bitmap->InitCheck() == B_OK && bitmap->Lock()) { + BView *view = new(std::nothrow) BView(bounds, "drawing view", + B_FOLLOW_NONE, 0); + if (view != NULL) { + bitmap->AddChild(view); + view->DrawPicture(picture, where); + view->Sync(); + } bitmap->Unlock(); } BRegion region; int32 width = bounds.IntegerWidth() + 1; int32 height = bounds.IntegerHeight() + 1; - if (bitmap->LockBits() == B_OK) { + if (bitmap != NULL && bitmap->LockBits() == B_OK) { uint32 bit = 0; uint32 *bits = (uint32 *)bitmap->Bits(); clipping_rect rect; Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-11-14 09:58:18 UTC (rev 28645) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-11-14 10:23:38 UTC (rev 28646) @@ -424,7 +424,7 @@ if (!validate_instantiation(data , "BWindow")) return NULL; - return new BWindow(data); + return new(std::nothrow) BWindow(data); } @@ -1225,7 +1225,7 @@ status_t error = fLink->Read(&token); if (error < B_OK || token == B_NULL_TOKEN) break; - ViewUpdateInfo* info = new (std::nothrow) ViewUpdateInfo; + ViewUpdateInfo* info = new(std::nothrow) ViewUpdateInfo; if (info == NULL || !infos.AddItem(info)) { delete info; break; @@ -1596,7 +1596,7 @@ if (rate > 0) { if (fPulseRunner == NULL) { BMessage message(B_PULSE); - fPulseRunner = new BMessageRunner(BMessenger(this), + fPulseRunner = new(std::nothrow) BMessageRunner(BMessenger(this), &message, rate); } else { fPulseRunner->SetInterval(rate); @@ -1619,7 +1619,9 @@ void BWindow::AddShortcut(uint32 key, uint32 modifiers, BMenuItem *item) { - Shortcut* shortcut = new Shortcut(key, modifiers, item); + Shortcut* shortcut = new(std::nothrow) Shortcut(key, modifiers, item); + if (shortcut == NULL) + return; // removes the shortcut if it already exists! RemoveShortcut(key, modifiers); @@ -1636,12 +1638,16 @@ void -BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage *message, BHandler *target) +BWindow::AddShortcut(uint32 key, uint32 modifiers, BMessage* message, + BHandler* target) { if (message == NULL) return; - Shortcut* shortcut = new Shortcut(key, modifiers, message, target); + Shortcut* shortcut = new(std::nothrow) Shortcut(key, modifiers, message, + target); + if (shortcut == NULL) + return; // removes the shortcut if it already exists! RemoveShortcut(key, modifiers); @@ -2569,8 +2575,12 @@ STRACE(("BWindow::InitData(): contacting app_server...\n")); // let app_server know that a window has been created. - fLink = new BPrivate::PortLink( + fLink = new(std::nothrow) BPrivate::PortLink( BApplication::Private::ServerLink()->SenderPort(), receivePort); + if (fLink == NULL) { + // Zombie! + return; + } { BPrivate::AppServerLink lockLink; @@ -2873,6 +2883,7 @@ STRACE(("_CreateTopView(): enter\n")); BRect frame = fFrame.OffsetToCopy(B_ORIGIN); + // TODO: what to do here about std::nothrow? fTopView = new BView(frame, "fTopView", B_FOLLOW_ALL, B_WILL_DRAW); fTopView->fTopLevelView = true; @@ -3505,7 +3516,7 @@ BWindow::_FindView(BView* view, BPoint point) const { // point is assumed to be already in view's coordinates - if (!view->IsHidden() && view->Bounds().Contains(point)) { + if (!view->IsHidden() && view->Bounds().Contains(point)) { if (!view->fFirstChild) return view; else { From stippi at mail.berlios.de Fri Nov 14 11:41:24 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Fri, 14 Nov 2008 11:41:24 +0100 Subject: [Haiku-commits] r28647 - in haiku/trunk: build/jam src/add-ons/input_server/devices src/add-ons/input_server/devices/mouse Message-ID: <200811141041.mAEAfOoo009313@sheep.berlios.de> Author: stippi Date: 2008-11-14 11:41:22 +0100 (Fri, 14 Nov 2008) New Revision: 28647 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28647&view=rev Removed: haiku/trunk/src/add-ons/input_server/devices/touchpad/ Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/input_server/devices/Jamfile haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp Log: Merged touchpad input_server device into mouse. This gets rid of a lot of code duplication and will make maintaining it much easier. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-14 10:23:38 UTC (rev 28646) +++ haiku/trunk/build/jam/HaikuImage 2008-11-14 10:41:22 UTC (rev 28647) @@ -415,7 +415,7 @@ AddSymlinkToHaikuImage beos system add-ons Tracker : /boot/beos/apps/DiskUsage : DiskUsage-I ; AddFilesToHaikuImage beos system add-ons input_server devices - : keyboard mouse touchpad wacom ; + : keyboard mouse wacom ; AddFilesToHaikuImage beos system add-ons input_server filters : screen_saver ; AddFilesToHaikuImage beos system add-ons kernel network : stack ; AddFilesToHaikuImage beos system add-ons kernel network devices Modified: haiku/trunk/src/add-ons/input_server/devices/Jamfile =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/Jamfile 2008-11-14 10:23:38 UTC (rev 28646) +++ haiku/trunk/src/add-ons/input_server/devices/Jamfile 2008-11-14 10:41:22 UTC (rev 28647) @@ -5,6 +5,5 @@ SubInclude HAIKU_TOP src add-ons input_server devices mouse ; #SubInclude HAIKU_TOP src add-ons input_server devices serial_mouse ; #SubInclude HAIKU_TOP src add-ons input_server devices tablet ; -SubInclude HAIKU_TOP src add-ons input_server devices touchpad ; SubInclude HAIKU_TOP src add-ons input_server devices wacom ; Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-14 10:23:38 UTC (rev 28646) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-14 10:41:22 UTC (rev 28647) @@ -6,6 +6,7 @@ * Stefano Ceccherini (stefano.ceccherini at gmail.com) * J?r?me Duval * Axel D?rfler, axeld at pinc-software.de + * Clemens Zeidler, haiku at clemens-zeidler.de * Stephan A?mus, superstippi at gmx.de */ @@ -22,6 +23,8 @@ #include #include #include +#include +#include #include #include #include @@ -29,6 +32,7 @@ #include "kb_mouse_settings.h" #include "kb_mouse_driver.h" +#include "touchpad_settings.h" #undef TRACE @@ -89,6 +93,7 @@ const static uint32 kMouseThreadPriority = B_FIRST_REAL_TIME_PRIORITY + 4; const static char* kMouseDevicesDirectory = "/dev/input/mouse"; +const static char* kTouchpadDevicesDirectory = "/dev/input/touchpad"; class MouseDevice { @@ -101,6 +106,7 @@ void Stop(); status_t UpdateSettings(); + status_t UpdateTouchpadSettings(const BMessage* message); const char* Path() const { return fPath.String(); } input_device_ref* DeviceRef() { return &fDeviceRef; } @@ -113,6 +119,10 @@ void _ControlThreadCleanup(); void _UpdateSettings(); + status_t _GetTouchpadSettingsPath(BPath& path); + status_t _ReadTouchpadSettingsMsg(BMessage* message); + status_t _UpdateTouchpadSettings(); + BMessage* _BuildMouseMessage(uint32 what, uint64 when, uint32 buttons, int32 deltaX, int32 deltaY) const; @@ -133,6 +143,11 @@ thread_id fThread; volatile bool fActive; volatile bool fUpdateSettings; + + bool fIsTouchpad; + touchpad_settings fTouchpadSettings; + BMessage* fTouchpadSettingsMessage; + BLocker fTouchpadSettingsLock; }; @@ -154,7 +169,10 @@ fDeviceRemapsButtons(false), fThread(-1), fActive(false), - fUpdateSettings(false) + fUpdateSettings(false), + fIsTouchpad(false), + fTouchpadSettingsMessage(NULL), + fTouchpadSettingsLock("Touchpad settings lock") { MD_CALLED(); @@ -179,6 +197,7 @@ Stop(); free(fDeviceRef.name); + delete fTouchpadSettingsMessage; } @@ -207,6 +226,7 @@ if (status < B_OK) { LOG_ERR("%s: can't spawn/resume watching thread: %s\n", fDeviceRef.name, strerror(status)); + close(fDevice); return status; } @@ -244,13 +264,33 @@ if (fThread < 0) return B_ERROR; + // trigger updating the settings in the control thread fUpdateSettings = true; - // This will provoke the control thread to update the settings. return B_OK; } +status_t +MouseDevice::UpdateTouchpadSettings(const BMessage* message) +{ + if (!fIsTouchpad) + return B_BAD_TYPE; + if (fThread < 0) + return B_ERROR; + + BAutolock _(fTouchpadSettingsLock); + + // trigger updating the settings in the control thread + fUpdateSettings = true; + + delete fTouchpadSettingsMessage; + fTouchpadSettingsMessage = new BMessage(*message); + + return B_OK; +} + + char* MouseDevice::_BuildShortName() const { @@ -269,11 +309,16 @@ else name.Capitalize(); - if (string.FindFirst("intelli") >= 0) - name.Prepend("Extended "); + if (string.FindFirst("touchpad") >= 0) { + name << " Touchpad "; + } else { + if (string.FindFirst("intelli") >= 0) + name.Prepend("Extended "); + + name << " Mouse "; + } + name << index; - name << " Mouse " << index; - return strdup(name.String()); } @@ -293,12 +338,33 @@ void MouseDevice::_ControlThread() { + MD_CALLED(); + if (fDevice < 0) { _ControlThreadCleanup(); // TOAST! return; } + // touchpad settings + if (ioctl(fDevice, MS_IS_TOUCHPAD, NULL) == B_OK) { + TRACE("is touchpad %s\n", fPath.String()); + fIsTouchpad = true; + + fTouchpadSettings = kDefaultTouchpadSettings; + + BPath path; + status_t status = _GetTouchpadSettingsPath(path); + BFile settingsFile(path.Path(), B_READ_ONLY); + if (status == B_OK && settingsFile.InitCheck() == B_OK) { + if (settingsFile.Read(&fTouchpadSettings, sizeof(touchpad_settings)) + != sizeof(touchpad_settings)) { + TRACE("failed to load settings\n"); + } + } + _UpdateTouchpadSettings(); + } + _UpdateSettings(); uint32 lastButtons = 0; @@ -315,8 +381,18 @@ // take care of updating the settings first, if necessary if (fUpdateSettings) { - _UpdateSettings(); fUpdateSettings = false; + if (fIsTouchpad) { + BAutolock _(fTouchpadSettingsLock); + if (fTouchpadSettingsMessage) { + _ReadTouchpadSettingsMsg(fTouchpadSettingsMessage); + _UpdateTouchpadSettings(); + delete fTouchpadSettingsMessage; + fTouchpadSettingsMessage = NULL; + } else + _UpdateSettings(); + } else + _UpdateSettings(); } uint32 buttons = lastButtons ^ movements.buttons; @@ -431,6 +507,51 @@ } +status_t +MouseDevice::_GetTouchpadSettingsPath(BPath& path) +{ + status_t status = find_directory(B_USER_SETTINGS_DIRECTORY, &path); + if (status < B_OK) + return status; + return path.Append(TOUCHPAD_SETTINGS_FILE); +} + + +status_t +MouseDevice::_ReadTouchpadSettingsMsg(BMessage* message) +{ + message->FindBool("scroll_twofinger", + &(fTouchpadSettings.scroll_twofinger)); + message->FindBool("scroll_multifinger", + &(fTouchpadSettings.scroll_multifinger)); + message->FindFloat("scroll_rightrange", + &(fTouchpadSettings.scroll_rightrange)); + message->FindFloat("scroll_bottomrange", + &(fTouchpadSettings.scroll_bottomrange)); + message->FindInt16("scroll_xstepsize", + (int16*)&(fTouchpadSettings.scroll_xstepsize)); + message->FindInt16("scroll_ystepsize", + (int16*)&(fTouchpadSettings.scroll_ystepsize)); + message->FindInt8("scroll_acceleration", + (int8*)&(fTouchpadSettings.scroll_acceleration)); + message->FindInt8("tapgesture_sensibility", + (int8*)&(fTouchpadSettings.tapgesture_sensibility)); + + return B_OK; +} + + +status_t +MouseDevice::_UpdateTouchpadSettings() +{ + if (fIsTouchpad) { + ioctl(fDevice, MS_SET_TOUCHPAD_SETTINGS, &fTouchpadSettings); + return B_OK; + } + return B_ERROR; +} + + BMessage* MouseDevice::_BuildMouseMessage(uint32 what, uint64 when, uint32 buttons, int32 deltaX, int32 deltaY) const @@ -517,7 +638,9 @@ MID_CALLED(); StartMonitoringDevice(kMouseDevicesDirectory); + StartMonitoringDevice(kTouchpadDevicesDirectory); _RecursiveScan(kMouseDevicesDirectory); + _RecursiveScan(kTouchpadDevicesDirectory); } @@ -525,6 +648,7 @@ { MID_CALLED(); + StopMonitoringDevice(kTouchpadDevicesDirectory); StopMonitoringDevice(kMouseDevicesDirectory); fDevices.MakeEmpty(); } @@ -573,6 +697,9 @@ if (command == B_NODE_MONITOR) return _HandleMonitor(message); + if (command == MS_SET_TOUCHPAD_SETTINGS) + return device->UpdateTouchpadSettings(message); + if (command >= B_MOUSE_TYPE_CHANGED && command <= B_MOUSE_ACCELERATION_CHANGED) return device->UpdateSettings(); From axeld at mail.berlios.de Fri Nov 14 13:06:47 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 14 Nov 2008 13:06:47 +0100 Subject: [Haiku-commits] r28648 - in haiku/trunk/src: add-ons/kernel/file_systems/ext2 system/kernel/cache system/kernel/fs Message-ID: <200811141206.mAEC6loP020031@sheep.berlios.de> Author: axeld Date: 2008-11-14 13:06:44 +0100 (Fri, 14 Nov 2008) New Revision: 28648 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28648&view=rev Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp haiku/trunk/src/system/kernel/cache/file_map.cpp haiku/trunk/src/system/kernel/fs/vfs.cpp Log: * When a file system reports -1 offsets in its fs_get_file_map() function, this will now accepted and regarded as sparse file data. FileMap::_Add() also correctly joins multiple vecs with that offset together, FileMap::Translate() will always report offset -1 even for offsets into that extent. * read_file_io_vec_pages() (or rather, its backend common_file_io_vec_pages()) now supports sparse files, and will just clear the memory it should read from offset -1 instead of passing a request to the vnode. * ext2 now correctly reports sparse files. This should close bug #2889, as well as #975. Modified: haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp 2008-11-14 10:41:22 UTC (rev 28647) +++ haiku/trunk/src/add-ons/kernel/file_systems/ext2/kernel_interface.cpp 2008-11-14 12:06:44 UTC (rev 28648) @@ -258,7 +258,8 @@ off_t blockOffset = (off_t)block << volume->BlockShift(); uint32 blockLength = volume->BlockSize(); - if (index > 0 && vecs[index - 1].offset == blockOffset - blockLength) { + if (index > 0 && (vecs[index - 1].offset == blockOffset - blockLength + || (vecs[index - 1].offset == -1 && block == 0))) { vecs[index - 1].length += blockLength; } else { if (index >= max) { @@ -267,7 +268,12 @@ return B_BUFFER_OVERFLOW; } - vecs[index].offset = blockOffset; + // 'block' is 0 for sparse blocks + if (block != 0) + vecs[index].offset = blockOffset; + else + vecs[index].offset = -1; + vecs[index].length = blockLength; index++; } Modified: haiku/trunk/src/system/kernel/cache/file_map.cpp =================================================================== --- haiku/trunk/src/system/kernel/cache/file_map.cpp 2008-11-14 10:41:22 UTC (rev 28647) +++ haiku/trunk/src/system/kernel/cache/file_map.cpp 2008-11-14 12:06:44 UTC (rev 28648) @@ -26,9 +26,9 @@ //#define TRACE_FILE_MAP #ifdef TRACE_FILE_MAP -# define TRACE(x) dprintf x +# define TRACE(x...) dprintf_no_syslog(x) #else -# define TRACE(x) ; +# define TRACE(x...) ; #endif // TODO: use a sparse array - eventually, the unused BlockMap would be something @@ -223,7 +223,7 @@ status_t FileMap::_Add(file_io_vec* vecs, size_t vecCount, off_t& lastOffset) { - TRACE(("FileMap@%p::Add(vecCount = %ld)\n", this, vecCount)); + TRACE("FileMap@%p::Add(vecCount = %ld)\n", this, vecCount); uint32 start = fCount; off_t offset = 0; @@ -241,7 +241,8 @@ for (uint32 i = 0; i < vecCount; i++) { if (lastExtent != NULL) { if (lastExtent->disk.offset + lastExtent->disk.length - == vecs[i].offset) { + == vecs[i].offset + || lastExtent->disk.offset == -1 && vecs[i].offset == -1) { lastExtent->disk.length += vecs[i].length; offset += vecs[i].length; start--; @@ -261,7 +262,7 @@ #ifdef TRACE_FILE_MAP for (uint32 i = 0; i < fCount; i++) { file_extent* extent = ExtentAt(i); - dprintf("[%ld] extent offset %Ld, disk offset %Ld, length %Ld\n", + TRACE("[%ld] extent offset %Ld, disk offset %Ld, length %Ld\n", i, extent->offset, extent->disk.offset, extent->disk.length); } #endif @@ -420,7 +421,10 @@ file_extent* fileExtent = _FindExtent(offset, &index); offset -= fileExtent->offset; - vecs[0].offset = fileExtent->disk.offset + offset; + if (fileExtent->disk.offset != -1) + vecs[0].offset = fileExtent->disk.offset + offset; + else + vecs[0].offset = -1; vecs[0].length = fileExtent->disk.length - offset; if (vecs[0].length >= size) { @@ -575,8 +579,8 @@ extern "C" void* file_map_create(dev_t mountID, ino_t vnodeID, off_t size) { - TRACE(("file_map_create(mountID = %ld, vnodeID = %Ld, size = %Ld)\n", - mountID, vnodeID, size)); + TRACE("file_map_create(mountID = %ld, vnodeID = %Ld, size = %Ld)\n", + mountID, vnodeID, size); // Get the vnode for the object // (note, this does not grab a reference to the node) @@ -595,7 +599,7 @@ if (map == NULL) return; - TRACE(("file_map_delete(map = %p)\n", map)); + TRACE("file_map_delete(map = %p)\n", map); delete map; } @@ -637,8 +641,8 @@ file_map_translate(void* _map, off_t offset, size_t size, file_io_vec* vecs, size_t* _count, size_t align) { - TRACE(("file_map_translate(map %p, offset %Ld, size %ld)\n", - _map, offset, size)); + TRACE("file_map_translate(map %p, offset %Ld, size %ld)\n", + _map, offset, size); FileMap* map = (FileMap*)_map; if (map == NULL) Modified: haiku/trunk/src/system/kernel/fs/vfs.cpp =================================================================== --- haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-11-14 10:41:22 UTC (rev 28647) +++ haiku/trunk/src/system/kernel/fs/vfs.cpp 2008-11-14 12:06:44 UTC (rev 28648) @@ -3266,6 +3266,31 @@ #endif // ADD_DEBUGGER_COMMANDS +//! Clears an iovec array of physical pages. +static status_t +zero_pages(const iovec* vecs, size_t vecCount, size_t* _bytes) +{ + size_t bytes = *_bytes; + size_t index = 0; + + while (bytes > 0) { + size_t length = min_c(vecs[index].iov_len, bytes); + + status_t status = vm_memset_physical((addr_t)vecs[index].iov_base, 0, + length); + if (status != B_OK) { + *_bytes = bytes; + return status; + } + + bytes -= length; + } + + *_bytes = bytes; + return B_OK; +} + + /*! Does the dirty work of combining the file_io_vecs with the iovecs and calls the file system hooks to read/write the request to disk. */ @@ -3296,8 +3321,13 @@ if (size > numBytes) size = numBytes; - status = FS_CALL(vnode, read_pages, cookie, fileVecs[0].offset, - &vecs[vecIndex], vecCount - vecIndex, &size); + if (fileVecs[0].offset >= 0) { + status = FS_CALL(vnode, read_pages, cookie, fileVecs[0].offset, + &vecs[vecIndex], vecCount - vecIndex, &size); + } else { + // sparse read + status = zero_pages(&vecs[vecIndex], vecCount - vecIndex, &size); + } if (status < B_OK) return status; @@ -3390,7 +3420,16 @@ } size_t bytes = size; - if (doWrite) { + + if (fileOffset == -1) { + if (doWrite) { + panic("sparse write attempt: vnode %p", vnode); + status = B_IO_ERROR; + } else { + // sparse read + status = zero_pages(tempVecs, tempCount, &bytes); + } + } else if (doWrite) { status = FS_CALL(vnode, write_pages, cookie, fileOffset, tempVecs, tempCount, &bytes); } else { @@ -3402,7 +3441,8 @@ totalSize += bytes; bytesLeft -= size; - fileOffset += size; + if (fileOffset >= 0) + fileOffset += size; fileLeft -= size; //dprintf("-> file left = %Lu\n", fileLeft); From axeld at mail.berlios.de Fri Nov 14 14:37:28 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 14 Nov 2008 14:37:28 +0100 Subject: [Haiku-commits] r28649 - haiku/trunk/src/servers/app Message-ID: <200811141337.mAEDbSN8017454@sheep.berlios.de> Author: axeld Date: 2008-11-14 14:37:27 +0100 (Fri, 14 Nov 2008) New Revision: 28649 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28649&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp haiku/trunk/src/servers/app/Desktop.h haiku/trunk/src/servers/app/Window.cpp Log: * Added a method Desktop::_LastFocusSubsetWindow() which returns the last window being the focus window that is a subset of the specified window. * This is now used to bring the window to front belonging to a floating or modal window (if on another workspace), ie. Desktop::ActivateWindow() should now work with modal and floating windows. * Fixed typo (in Window.cpp). Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-11-14 12:06:44 UTC (rev 28648) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-11-14 13:37:27 UTC (rev 28649) @@ -1532,8 +1532,26 @@ } -/*! - \brief Tries to move the specified window to the front of the screen, +/*! Returns the last focussed non-hidden subset window belonging to the + specified \a window. +*/ +Window* +Desktop::_LastFocusSubsetWindow(Window* window) +{ + if (window == NULL) + return NULL; + + for (Window* front = fFocusList.LastWindow(); front != NULL; + front = front->PreviousWindow(kFocusList)) { + if (front != window && !front->IsHidden() && window->HasInSubset(front)) + return front; + } + + return NULL; +} + + +/*! \brief Tries to move the specified window to the front of the screen, and make it the focus window. If there are any modal windows on this screen, it might not actually @@ -1550,14 +1568,12 @@ fFront = NULL; return; } - if (window->Workspaces() == 0) + if (window->Workspaces() == 0 + && !window->IsFloating() && !window->IsModal()) return; - // TODO: take care about floating windows + AutoWriteLocker _(fWindowLock); - if (!LockAllWindows()) - return; - bool windowOnOtherWorkspace = !window->InWorkspace(fCurrentWorkspace); if (windowOnOtherWorkspace && (window->Flags() & B_NOT_ANCHORED_ON_ACTIVATE) == 0) { @@ -1573,17 +1589,26 @@ break; } } - } else { - UnlockAllWindows(); + } else return; - } } if (windowOnOtherWorkspace) { - // Bring the window to the current workspace - // TODO: what if this window is on multiple workspaces?!? - uint32 workspaces = workspace_to_workspaces(fCurrentWorkspace); - SetWindowWorkspaces(window, workspaces); + if (window->IsFloating() || window->IsModal()) { + // Bring a window to front that this floating window belongs to + Window* front = _LastFocusSubsetWindow(window); + if (front == NULL) { + // We can't do anything about those. + return; + } + + ActivateWindow(front); + } else { + // Bring the window to the current workspace + // TODO: what if this window is on multiple workspaces?!? + uint32 workspaces = workspace_to_workspaces(fCurrentWorkspace); + SetWindowWorkspaces(window, workspaces); + } } if (window->IsMinimized()) { @@ -1602,11 +1627,10 @@ } if (avoidsFront == NULL) { - // we're already the frontmost window, we might just not have focus yet + // we're already the frontmost window, we might just not have focus + // yet if ((window->Flags() & B_AVOID_FOCUS) == 0) SetFocusWindow(window); - - UnlockAllWindows(); return; } } @@ -1642,10 +1666,9 @@ } _BringWindowsToFront(windows, kWorkingList, true); + if ((window->Flags() & B_AVOID_FOCUS) == 0) SetFocusWindow(window); - - UnlockAllWindows(); } @@ -1706,19 +1729,19 @@ if (!window->IsHidden()) return; - LockAllWindows(); + AutoWriteLocker locker(fWindowLock); window->SetHidden(false); fFocusList.AddWindow(window); - if (window->InWorkspace(fCurrentWorkspace)) { + if (window->InWorkspace(fCurrentWorkspace) + || (window->IsFloating() && _LastFocusSubsetWindow(window) != NULL)) { _ShowWindow(window, true); _UpdateSubsetWorkspaces(window); ActivateWindow(window); } else { // then we don't need to send the fake mouse event either _WindowChanged(window); - UnlockAllWindows(); return; } @@ -1728,8 +1751,6 @@ window->FindWorkspacesViews(fWorkspacesViews); } - UnlockAllWindows(); - // If the mouse cursor is directly over the newly visible window, // we'll send a fake mouse moved message to the window, so that // it knows the mouse is over it. Modified: haiku/trunk/src/servers/app/Desktop.h =================================================================== --- haiku/trunk/src/servers/app/Desktop.h 2008-11-14 12:06:44 UTC (rev 28648) +++ haiku/trunk/src/servers/app/Desktop.h 2008-11-14 13:37:27 UTC (rev 28649) @@ -231,6 +231,7 @@ uint32 oldWorkspaces, uint32 newWorkspaces); void _BringWindowsToFront(WindowList& windows, int32 list, bool wereVisible); + Window* _LastFocusSubsetWindow(Window* window); status_t _ActivateApp(team_id team); void _SendFakeMouseMoved(Window* window = NULL); Modified: haiku/trunk/src/servers/app/Window.cpp =================================================================== --- haiku/trunk/src/servers/app/Window.cpp 2008-11-14 12:06:44 UTC (rev 28648) +++ haiku/trunk/src/servers/app/Window.cpp 2008-11-14 13:37:27 UTC (rev 28649) @@ -1571,7 +1571,7 @@ /*! \brief Returns on which workspaces the window should be visible. - A modal or floating window may be visible on a workscreen if one + A modal or floating window may be visible on a workspace if one of its subset windows is visible there. Floating windows also need to have a subset as front window to be visible. */ From axeld at mail.berlios.de Fri Nov 14 14:44:25 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Fri, 14 Nov 2008 14:44:25 +0100 Subject: [Haiku-commits] r28650 - haiku/trunk/src/servers/app Message-ID: <200811141344.mAEDiPfp017823@sheep.berlios.de> Author: axeld Date: 2008-11-14 14:44:25 +0100 (Fri, 14 Nov 2008) New Revision: 28650 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28650&view=rev Modified: haiku/trunk/src/servers/app/Desktop.cpp Log: * Minor simplification and clarification. Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-11-14 13:37:27 UTC (rev 28649) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-11-14 13:44:25 UTC (rev 28650) @@ -1568,8 +1568,7 @@ fFront = NULL; return; } - if (window->Workspaces() == 0 - && !window->IsFloating() && !window->IsModal()) + if (window->Workspaces() == 0 && window->IsNormal()) return; AutoWriteLocker _(fWindowLock); @@ -1594,7 +1593,7 @@ } if (windowOnOtherWorkspace) { - if (window->IsFloating() || window->IsModal()) { + if (!window->IsNormal()) { // Bring a window to front that this floating window belongs to Window* front = _LastFocusSubsetWindow(window); if (front == NULL) { @@ -1734,6 +1733,9 @@ window->SetHidden(false); fFocusList.AddWindow(window); + // If the window is on the current workspace, we'll show it. Special + // handling for floating windows, as they can only be shown if their + // subset is. if (window->InWorkspace(fCurrentWorkspace) || (window->IsFloating() && _LastFocusSubsetWindow(window) != NULL)) { _ShowWindow(window, true); From bonefish at mail.berlios.de Fri Nov 14 17:29:41 2008 From: bonefish at mail.berlios.de (bonefish at BerliOS) Date: Fri, 14 Nov 2008 17:29:41 +0100 Subject: [Haiku-commits] r28651 - haiku/trunk/src/add-ons/kernel/drivers/tty Message-ID: <200811141629.mAEGTfMO005507@sheep.berlios.de> Author: bonefish Date: 2008-11-14 17:29:40 +0100 (Fri, 14 Nov 2008) New Revision: 28651 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28651&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/driver.cpp haiku/trunk/src/add-ons/kernel/drivers/tty/master.cpp haiku/trunk/src/add-ons/kernel/drivers/tty/slave.cpp haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp haiku/trunk/src/add-ons/kernel/drivers/tty/tty_private.h Log: * Already set tty::lock() in init_driver(). This makes it always safe to be used. * Added tty::ref_count. Each cookie keeps a reference. Only when a cookie is freed the reference is surrendered. A tty is considered used as long as it is still referenced. This allows to access a tty through the cookie, even if it already has been closed. * Fixed tty_deselect(). It was keeping registered select events when called after the cookie has been closed. The referenced select_sync structure would become invalid and later attempts to send select notifications for the tty could crash. Fixes #3126. Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/driver.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/tty/driver.cpp 2008-11-14 13:44:25 UTC (rev 28650) +++ haiku/trunk/src/add-ons/kernel/drivers/tty/driver.cpp 2008-11-14 16:29:40 UTC (rev 28651) @@ -1,4 +1,4 @@ -/* +/* * Copyright 2004, Axel D?rfler, axeld at pinc-software.de. All rights reserved. * Distributed under the terms of the Haiku License. */ @@ -31,6 +31,8 @@ // reserve space for "pt/" and "tt/" entries, "ptmx", "tty", and the // terminating NULL +static mutex sTTYLocks[kNumTTYs]; + struct mutex gGlobalTTYLock; struct mutex gTTYCookieLock; struct recursive_lock gTTYRequestLock; @@ -84,8 +86,9 @@ if (++digit > 15) digit = 0, letter++; - reset_tty(&gMasterTTYs[i], i, true); - reset_tty(&gSlaveTTYs[i], i, false); + mutex_init(&sTTYLocks[i], "tty lock"); + reset_tty(&gMasterTTYs[i], i, &sTTYLocks[i], true); + reset_tty(&gSlaveTTYs[i], i, &sTTYLocks[i], false); reset_tty_settings(&gTTYSettings[i], i); if (!gDeviceNames[i] || !gDeviceNames[i + kNumTTYs]) { @@ -113,6 +116,9 @@ for (int32 i = 0; i < (int32)kNumTTYs * 2; i++) free(gDeviceNames[i]); + for (int32 i = 0; i < (int32)kNumTTYs; i++) + mutex_destroy(&sTTYLocks[i]); + recursive_lock_destroy(&gTTYRequestLock); mutex_destroy(&gTTYCookieLock); mutex_destroy(&gGlobalTTYLock); Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/master.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/tty/master.cpp 2008-11-14 13:44:25 UTC (rev 28650) +++ haiku/trunk/src/add-ons/kernel/drivers/tty/master.cpp 2008-11-14 16:29:40 UTC (rev 28651) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2004, Axel D?rfler, axeld at pinc-software.de. All rights reserved. ** Distributed under the terms of the Haiku License. */ @@ -20,7 +20,6 @@ struct master_cookie : tty_cookie { - struct mutex lock; }; @@ -43,11 +42,8 @@ if (cookie == NULL) return B_NO_MEMORY; - mutex_init(&cookie->lock, "tty lock"); - status_t error = init_tty_cookie(cookie, master, slave, openMode); if (error != B_OK) { - mutex_destroy(&cookie->lock); free(cookie); return error; } @@ -77,12 +73,12 @@ if (findUnusedTTY) { for (index = 0; index < (int32)kNumTTYs; index++) { - if (gMasterTTYs[index].open_count == 0) + if (gMasterTTYs[index].ref_count == 0) break; } if (index >= (int32)kNumTTYs) return ENOENT; - } else if (gMasterTTYs[index].open_count > 0) { + } else if (gMasterTTYs[index].ref_count > 0) { // we're already open! return B_BUSY; } @@ -101,11 +97,8 @@ return status; } - gMasterTTYs[index].lock = &cookie->lock; - add_tty_cookie(cookie); - *_cookie = cookie; return B_OK; @@ -138,8 +131,10 @@ // The TTY is already closed. We only have to free the cookie. master_cookie *cookie = (master_cookie *)_cookie; + MutexLocker globalLocker(gGlobalTTYLock); uninit_tty_cookie(cookie); - mutex_destroy(&cookie->lock); + globalLocker.Unlock(); + free(cookie); return B_OK; @@ -153,7 +148,7 @@ TRACE(("master_ioctl: cookie %p, op %lu, buffer %p, length %lu\n", _cookie, op, buffer, length)); - return tty_ioctl(cookie, op, buffer, length); + return tty_ioctl(cookie, op, buffer, length); } Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/slave.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/tty/slave.cpp 2008-11-14 13:44:25 UTC (rev 28650) +++ haiku/trunk/src/add-ons/kernel/drivers/tty/slave.cpp 2008-11-14 16:29:40 UTC (rev 28651) @@ -1,4 +1,4 @@ -/* +/* ** Copyright 2004, Axel D?rfler, axeld at pinc-software.de. All rights reserved. ** Distributed under the terms of the Haiku License. */ @@ -146,7 +146,10 @@ TRACE(("slave_free_cookie: cookie %p\n", _cookie)); + MutexLocker globalLocker(gGlobalTTYLock); uninit_tty_cookie(cookie); + globalLocker.Unlock(); + free(cookie); return B_OK; @@ -160,7 +163,7 @@ TRACE(("slave_ioctl: cookie %p, op %lu, buffer %p, length %lu\n", _cookie, op, buffer, length)); - return tty_ioctl(cookie, op, buffer, length); + return tty_ioctl(cookie, op, buffer, length); } Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp 2008-11-14 13:44:25 UTC (rev 28650) +++ haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp 2008-11-14 16:29:40 UTC (rev 28651) @@ -44,8 +44,8 @@ gGlobalTTYLock: Guards open/close operations. When held, tty_open(), tty_close(), tty_close_cookie() etc. won't be invoked by other threads, - cookies won't be added to/removed from TTYs, and tty::open_count, - tty_cookie::closed won't change. + cookies won't be added to/removed from TTYs, and tty::ref_count, + tty::open_count, tty_cookie::closed won't change. gTTYCookieLock: Guards the access to the fields tty_cookie::{thread_count,closed}, or more precisely makes access to them @@ -59,10 +59,7 @@ window_size,pgrp_id}}. Moreover when held guarantees that tty::open_count won't drop to zero (both gGlobalTTYLock and tty::lock must be held to decrement it). A tty and the tty connected to it (master and slave) share - the same lock. tty::lock is only valid when tty::open_count is > 0. So - before accessing tty::lock, it must be made sure that it is still valid. - Given a tty_cookie, TTYReference can be used to do that, or otherwise - gGlobalTTYLock can be acquired and tty::open_count be checked. + the same lock. gTTYRequestLock: Guards access to tty::{reader,writer}_queue (most RequestQueue methods do the locking themselves (the lock is a @@ -336,7 +333,7 @@ * The caller must already hold the request lock. */ void -RequestOwner::Enqueue(tty_cookie *cookie, RequestQueue *queue1, +RequestOwner::Enqueue(tty_cookie *cookie, RequestQueue *queue1, RequestQueue *queue2) { TRACE(("%p->RequestOwner::Enqueue(%p, %p, %p)\n", this, cookie, queue1, @@ -403,7 +400,7 @@ RecursiveLocker locker(gTTYRequestLock); // check, if already done - if (fError == B_OK + if (fError == B_OK && (!fRequests[0].WasNotified() || !fRequests[1].WasNotified())) { // not yet done @@ -563,7 +560,7 @@ } -status_t +status_t WriterLocker::AcquireWriter(bool dontBlock, size_t bytesNeeded) { if (!fTarget) @@ -679,7 +676,7 @@ } -status_t +status_t ReaderLocker::AcquireReader(bigtime_t timeout, size_t minBytes) { if (fCookie->closed) @@ -716,7 +713,7 @@ } -status_t +status_t ReaderLocker::AcquireReader(bool dontBlock) { return AcquireReader(dontBlock ? 0 : B_INFINITE_TIMEOUT, 0); @@ -788,7 +785,7 @@ termios.c_ispeed = B19200; termios.c_ospeed = B19200; - // control characters + // control characters termios.c_cc[VINTR] = CTRL('C'); termios.c_cc[VQUIT] = CTRL('\\'); termios.c_cc[VERASE] = 0x7f; @@ -820,11 +817,12 @@ void -reset_tty(struct tty *tty, int32 index, bool isMaster) +reset_tty(struct tty *tty, int32 index, mutex* lock, bool isMaster) { + tty->ref_count = 0; tty->open_count = 0; tty->index = index; - tty->lock = NULL; + tty->lock = lock; tty->settings = &gTTYSettings[index]; tty->select_pool = NULL; tty->is_master = isMaster; @@ -946,9 +944,8 @@ #endif // 0 -/** - * The global lock must be held. - */ +/*! The global lock must be held. +*/ status_t init_tty_cookie(tty_cookie *cookie, struct tty *tty, struct tty *otherTTY, uint32 openMode) @@ -963,13 +960,19 @@ cookie->thread_count = 0; cookie->closed = false; + tty->ref_count++; + return B_OK; } +/*! The global lock must be held. +*/ void uninit_tty_cookie(tty_cookie *cookie) { + cookie->tty->ref_count--; + if (cookie->blocking_semaphore >= 0) { delete_sem(cookie->blocking_semaphore); cookie->blocking_semaphore = -1; @@ -1081,8 +1084,8 @@ requestOwner.Wait(false); // re-lock - ttyLocker.SetTo(cookie->tty->lock, false); - requestLocker.SetTo(gTTYRequestLock, false); + ttyLocker.Lock(); + requestLocker.Lock(); // dequeue our request requestOwner.Dequeue(); @@ -1094,6 +1097,8 @@ tty_close(cookie->tty); } + // notify pending select()s and cleanup the select sync pool + // notify a select write event on the other tty, if we've closed this tty if (cookie->tty->open_count == 0 && cookie->other_tty->open_count > 0) tty_notify_select_event(cookie->other_tty, B_SELECT_WRITE); @@ -1151,7 +1156,7 @@ if (!tty->writer_queue.IsEmpty()) { tty->writer_queue.NotifyFirst(writable); } else if (notifySelect) { - if (otherTTY && otherTTY->open_count > 0) + if (otherTTY && otherTTY->open_count > 0) tty_notify_select_event(otherTTY, B_SELECT_WRITE); } } @@ -1306,7 +1311,6 @@ if (init_line_buffer(tty->input_buffer, TTY_BUFFER_SIZE) < B_OK) return B_NO_MEMORY; - tty->lock = NULL; tty->service_func = func; // construct the queues @@ -1371,7 +1375,7 @@ { TRACE(("tty: set pgrp_id\n")); pid_t groupID; - + if (user_memcpy(&groupID, buffer, sizeof(pid_t)) != B_OK) return B_BAD_ADDRESS; @@ -1943,14 +1947,6 @@ if (event < B_SELECT_READ || event > B_SELECT_ERROR) return B_BAD_VALUE; - // If the TTY is already closed, we're done. Note that we don't use a - // TTYReference here, but acquire the global lock, since we don't want - // return before tty_close_cookie() is done (it sends out the select - // events on close and our select() could miss one, if we don't wait). - MutexLocker globalLocker(gGlobalTTYLock); - if (cookie->closed) - return B_OK; - // lock the TTY (guards the select sync pool, among other things) MutexLocker ttyLocker(tty->lock); @@ -1975,8 +1971,8 @@ for (int i = 0; i < NCCS; i++) kprintf(" c_cc[%02d]: %d\n", i, settings.termios.c_cc[i]); - kprintf(" wsize: %u x %u c, %u x %u pxl\n", - settings.window_size.ws_row, settings.window_size.ws_col, + kprintf(" wsize: %u x %u c, %u x %u pxl\n", + settings.window_size.ws_row, settings.window_size.ws_col, settings.window_size.ws_xpixel, settings.window_size.ws_ypixel); } Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/tty_private.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/tty/tty_private.h 2008-11-14 13:44:25 UTC (rev 28650) +++ haiku/trunk/src/add-ons/kernel/drivers/tty/tty_private.h 2008-11-14 16:29:40 UTC (rev 28651) @@ -84,7 +84,7 @@ public: RequestOwner(); - void Enqueue(tty_cookie *cookie, RequestQueue *queue1, + void Enqueue(tty_cookie *cookie, RequestQueue *queue1, RequestQueue *queue2 = NULL); void Dequeue(); @@ -129,6 +129,7 @@ }; struct tty { + int32 ref_count; // referenced by cookies int32 open_count; int32 index; struct mutex* lock; @@ -162,7 +163,7 @@ // functions available for master/slave TTYs extern int32 get_tty_index(const char *name); -extern void reset_tty(struct tty *tty, int32 index, bool isMaster); +extern void reset_tty(struct tty *tty, int32 index, mutex* lock, bool isMaster); extern void reset_tty_settings(tty_settings *settings, int32 index); //extern status_t tty_input_putc(struct tty *tty, int c); extern status_t tty_input_read(tty_cookie *cookie, void *buffer, From grzegorz.dabrowski at gmail.com Fri Nov 14 17:58:48 2008 From: grzegorz.dabrowski at gmail.com (Grzegorz =?UTF-8?B?RMSFYnJvd3NraQ==?=) Date: Fri, 14 Nov 2008 17:58:48 +0100 Subject: [Haiku-commits] r28651 - haiku/trunk/src/add-ons/kernel/drivers/tty In-Reply-To: <200811141629.mAEGTfMO005507@sheep.berlios.de> References: <200811141629.mAEGTfMO005507@sheep.berlios.de> Message-ID: <20081114175848.146bc5cb@kaliber> On Fri, 14 Nov 2008 17:29:41 +0100 bonefish at BerliOS wrote: > Author: bonefish > Date: 2008-11-14 17:29:40 +0100 (Fri, 14 Nov 2008) > New Revision: 28651 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28651&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/drivers/tty/driver.cpp > haiku/trunk/src/add-ons/kernel/drivers/tty/master.cpp > haiku/trunk/src/add-ons/kernel/drivers/tty/slave.cpp > haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp > haiku/trunk/src/add-ons/kernel/drivers/tty/tty_private.h > Log: > * Already set tty::lock() in init_driver(). This makes it always safe > to be used. > * Added tty::ref_count. Each cookie keeps a reference. Only when a > cookie is freed the reference is surrendered. A tty is considered > used as long as it is still referenced. This allows to access a tty > through the cookie, even if it already has been closed. > * Fixed tty_deselect(). It was keeping registered select events when > called after the cookie has been closed. The referenced select_sync > structure would become invalid and later attempts to send select > notifications for the tty could crash. Fixes #3126. Maybe it also fixes ticket #2223? -- Grzegorz D?browski From axeld at pinc-software.de Fri Nov 14 18:38:47 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 14 Nov 2008 18:38:47 +0100 CET Subject: [Haiku-commits] r28651 - haiku/trunk/src/add-ons/kernel/drivers/tty In-Reply-To: <20081114175848.146bc5cb@kaliber> Message-ID: <31090431491-BeMail@zon> Grzegorz D?browski wrote: > > notifications for the tty could crash. Fixes #3126. > Maybe it also fixes ticket #2223? I would guess #3126 was indeed a duplicate of this one. Bye, Axel. From mmu_man at mail.berlios.de Fri Nov 14 21:26:18 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 14 Nov 2008 21:26:18 +0100 Subject: [Haiku-commits] r28653 - haiku/trunk/build/jam Message-ID: <200811142026.mAEKQI7P017846@sheep.berlios.de> Author: mmu_man Date: 2008-11-14 21:26:17 +0100 (Fri, 14 Nov 2008) New Revision: 28653 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28653&view=rev Modified: haiku/trunk/build/jam/ImageRules Log: Add missing rules for floppy images... Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-14 19:41:20 UTC (rev 28652) +++ haiku/trunk/build/jam/ImageRules 2008-11-14 20:26:17 UTC (rev 28653) @@ -897,6 +897,14 @@ : $(relativeDirectoryTokens) : $(targets) ; } +rule AddNewDriversToNetBootArchive relativeDirectoryTokens : targets +{ + # AddNewDriversToNetBootArchive : ; + + AddNewDriversToContainer $(HAIKU_NET_BOOT_ARCHIVE_CONTAINER_NAME) + : $(relativeDirectoryTokens) : $(targets) ; +} + rule AddDriverRegistrationToNetBootArchive relativeDirectoryTokens : target : links { @@ -978,6 +986,14 @@ : $(relativeDirectoryTokens) : $(targets) ; } +rule AddNewDriversToFloppyBootArchive relativeDirectoryTokens : targets +{ + # AddNewDriversToFloppyBootArchive : ; + + AddNewDriversToContainer $(HAIKU_FLOPPY_BOOT_IMAGE_CONTAINER_NAME) + : $(relativeDirectoryTokens) : $(targets) ; +} + rule AddDriverRegistrationToFloppyBootArchive relativeDirectoryTokens : target : links { From mmu_man at mail.berlios.de Fri Nov 14 20:41:21 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 14 Nov 2008 20:41:21 +0100 Subject: [Haiku-commits] r28652 - in haiku/trunk/3rdparty/mmu_man/themes: . addons Message-ID: <200811141941.mAEJfLq7014864@sheep.berlios.de> Author: mmu_man Date: 2008-11-14 20:41:20 +0100 (Fri, 14 Nov 2008) New Revision: 28652 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28652&view=rev Modified: haiku/trunk/3rdparty/mmu_man/themes/MSThemeImporter.cpp haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp haiku/trunk/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp Log: Fix unused var warnings Modified: haiku/trunk/3rdparty/mmu_man/themes/MSThemeImporter.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/MSThemeImporter.cpp 2008-11-14 16:29:40 UTC (rev 28651) +++ haiku/trunk/3rdparty/mmu_man/themes/MSThemeImporter.cpp 2008-11-14 19:41:20 UTC (rev 28652) @@ -258,7 +258,6 @@ { FENTRY; status_t err; - int i, j; BEntry *entry = (BEntry *)fEntryList.RemoveItem(0L); // no more Modified: haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp 2008-11-14 16:29:40 UTC (rev 28651) +++ haiku/trunk/3rdparty/mmu_man/themes/ThemeManager.cpp 2008-11-14 19:41:20 UTC (rev 28652) @@ -1065,9 +1065,7 @@ { FENTRY; status_t err; - int32 count; BString m; - int32 i; ThemeImporter *importer; BMessage msg; BMessage *theme; Modified: haiku/trunk/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp =================================================================== --- haiku/trunk/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp 2008-11-14 16:29:40 UTC (rev 28651) +++ haiku/trunk/3rdparty/mmu_man/themes/addons/TerminalAddon.cpp 2008-11-14 19:41:20 UTC (rev 28652) @@ -557,10 +557,6 @@ BMessage lines; status_t err; BPath pTermPref; - char buffer[1024]; - char key[B_FIELD_NAME_LENGTH], data[512]; - int n; - FILE *file; (void)flags; err = MyMessage(theme, termpref); @@ -572,6 +568,10 @@ //XXX: WRITEME /* + char buffer[1024]; + char key[B_FIELD_NAME_LENGTH], data[512]; + int n; + FILE *file; while (fgets(buffer, sizeof(buffer), file) != NULL) { if (*buffer == '#') continue; @@ -631,7 +631,6 @@ status_t TerminalThemesAddon::LoadHaikuTerminalSettings(BMessage &into) { - status_t err; BPath pTermPref; char buffer[1024]; char key[B_FIELD_NAME_LENGTH], data[512]; From mmu_man at mail.berlios.de Fri Nov 14 21:34:52 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Fri, 14 Nov 2008 21:34:52 +0100 Subject: [Haiku-commits] r28654 - haiku/trunk/build/jam Message-ID: <200811142034.mAEKYqZ4018707@sheep.berlios.de> Author: mmu_man Date: 2008-11-14 21:34:52 +0100 (Fri, 14 Nov 2008) New Revision: 28654 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28654&view=rev Modified: haiku/trunk/build/jam/FloppyBootImage haiku/trunk/build/jam/NetBootArchive Log: Hopefully fixed floppy and netboot images, please test. It's getting annoying having to maintain so many identical driver lists... maybe those should be factored out in some way... Modified: haiku/trunk/build/jam/FloppyBootImage =================================================================== --- haiku/trunk/build/jam/FloppyBootImage 2008-11-14 20:26:17 UTC (rev 28653) +++ haiku/trunk/build/jam/FloppyBootImage 2008-11-14 20:34:52 UTC (rev 28654) @@ -43,7 +43,9 @@ AddFilesToFloppyBootArchive beos system add-ons kernel busses agp_gart : $(X86_ONLY)intel ; AddFilesToFloppyBootArchive beos system add-ons kernel busses ide - : ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata it8211 ; + : generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 legacy_sata it8211 ; +AddFilesToFloppyBootArchive beos system add-ons kernel busses scsi + : ahci ; AddFilesToFloppyBootArchive beos system add-ons kernel console : vga_text ; AddFilesToFloppyBootArchive beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; @@ -61,7 +63,7 @@ } # drivers -AddDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk ; +AddNewDriversToFloppyBootArchive disk scsi : scsi_cd scsi_disk ; AddDriversToFloppyBootArchive disk usb : usb_disk ; if $(NET_BOOT) = 1 { #AddDriversToFloppyBootArchive disk virtual : nbd ; Modified: haiku/trunk/build/jam/NetBootArchive =================================================================== --- haiku/trunk/build/jam/NetBootArchive 2008-11-14 20:26:17 UTC (rev 28653) +++ haiku/trunk/build/jam/NetBootArchive 2008-11-14 20:34:52 UTC (rev 28654) @@ -37,7 +37,9 @@ AddFilesToNetBootArchive beos system add-ons kernel busses agp_gart : $(X86_ONLY)intel ; AddFilesToNetBootArchive beos system add-ons kernel busses ide - : ahci generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 ; + : generic_ide_pci $(X86_ONLY)ide_isa silicon_image_3112 ; +AddFilesToNetBootArchive beos system add-ons kernel busses scsi + : ahci ; AddFilesToNetBootArchive beos system add-ons kernel console : vga_text ; AddFilesToNetBootArchive beos system add-ons kernel file_systems : $(BEOS_ADD_ONS_FILE_SYSTEMS) ; @@ -53,7 +55,7 @@ } # drivers -AddDriversToNetBootArchive disk scsi : scsi_cd scsi_disk ; +AddNewDriversToNetBootArchive disk scsi : scsi_cd scsi_disk ; #AddDriversToNetBootArchive disk virtual : nbd ; AddDriversToNetBootArchive disk virtual : remote_disk ; AddDriversToNetBootArchive net : $(BEOS_ADD_ONS_DRIVERS_NET) ; From mmu_man at mail.berlios.de Sat Nov 15 00:18:50 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 15 Nov 2008 00:18:50 +0100 Subject: [Haiku-commits] r28655 - haiku/trunk/src/libs/compat/freebsd_network Message-ID: <200811142318.mAENIoYU003752@sheep.berlios.de> Author: mmu_man Date: 2008-11-15 00:18:50 +0100 (Sat, 15 Nov 2008) New Revision: 28655 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28655&view=rev Modified: haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk Log: Fix build with old gawk versions (BeOS & Haiku). this version didn't like passing an undefined variable as reference to a function... Also fixed warning on $. Modified: haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk 2008-11-14 20:34:52 UTC (rev 28654) +++ haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk 2008-11-14 23:18:50 UTC (rev 28655) @@ -96,12 +96,13 @@ BEGIN { nmodels = nouis = 0 hfile=HEADERFILE + line = ""; } NR == 1 { VERSION = $0 gsub("\\$", "", VERSION) - printf("/* \$FreeBSD\$ */\n\n") > hfile + printf("/* $FreeBSD$ */\n\n") > hfile printf("/*\n") > hfile printf(" * THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.\n") \ > hfile From anevilyak at mail.berlios.de Sat Nov 15 03:42:57 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 15 Nov 2008 03:42:57 +0100 Subject: [Haiku-commits] r28656 - in haiku/trunk/src/add-ons/input_server/devices: keyboard mouse Message-ID: <200811150242.mAF2gvUG032201@sheep.berlios.de> Author: anevilyak Date: 2008-11-15 03:42:56 +0100 (Sat, 15 Nov 2008) New Revision: 28656 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28656&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp Log: Patch by Adrian Panasiuk: fix broken TRACE macro definitions (ticket #3133). Thanks! Modified: haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-14 23:18:50 UTC (rev 28655) +++ haiku/trunk/src/add-ons/input_server/devices/keyboard/KeyboardInputDevice.cpp 2008-11-15 02:42:56 UTC (rev 28656) @@ -67,10 +67,10 @@ __FUNCTION__, sFunctionDepth) # define KID_CALLED(x...) FunctionTracer _ft(this, "KeyboardInputDevice", \ __FUNCTION__, sFunctionDepth) -# define TRACE(x...) { BString _to; \ +# define TRACE(x...) do { BString _to; \ _to.Append(' ', (sFunctionDepth + 1) * 2); \ debug_printf("%p -> %s", this, _to.String()); \ - debug_printf(x); } + debug_printf(x); } while (0) # define LOG_EVENT(text...) do {} while (0) # define LOG_ERR(text...) TRACE(text) #else Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-14 23:18:50 UTC (rev 28655) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-15 02:42:56 UTC (rev 28656) @@ -76,10 +76,10 @@ __FUNCTION__, sFunctionDepth) # define MID_CALLED(x...) FunctionTracer _ft(this, "MouseInputDevice", \ __FUNCTION__, sFunctionDepth) -# define TRACE(x...) { BString _to; \ +# define TRACE(x...) do { BString _to; \ _to.Append(' ', (sFunctionDepth + 1) * 2); \ debug_printf("%p -> %s", this, _to.String()); \ - debug_printf(x); } + debug_printf(x); } while (0) # define LOG_EVENT(text...) do {} while (0) # define LOG_ERR(text...) TRACE(text) #else From mmu_man at mail.berlios.de Sat Nov 15 04:30:03 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sat, 15 Nov 2008 04:30:03 +0100 Subject: [Haiku-commits] r28657 - in haiku/trunk: build/jam src/system/boot/platform/bios_ia32 Message-ID: <200811150330.mAF3U3sO007313@sheep.berlios.de> Author: mmu_man Date: 2008-11-15 04:30:00 +0100 (Sat, 15 Nov 2008) New Revision: 28657 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28657&view=rev Modified: haiku/trunk/build/jam/BuildSetup haiku/trunk/build/jam/ImageRules haiku/trunk/src/system/boot/platform/bios_ia32/shell.S Log: Make the tgz archive offset in floppy image settable. Set it to 270k for now, until zbeos gets some diet. Modified: haiku/trunk/build/jam/BuildSetup =================================================================== --- haiku/trunk/build/jam/BuildSetup 2008-11-15 02:42:56 UTC (rev 28656) +++ haiku/trunk/build/jam/BuildSetup 2008-11-15 03:30:00 UTC (rev 28657) @@ -216,16 +216,22 @@ { HAIKU_DEFINES += __POWERPC__ ; HAIKU_BOOT_PLATFORM = openfirmware ; + # offset in floppy image (>= sizeof(zbeos)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 192 ; # in kB - unused yet } case x86 : { HAIKU_DEFINES += __INTEL__ ; HAIKU_BOOT_PLATFORM = bios_ia32 ; + # offset in floppy image (>= sizeof(zbeos)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 270 ; # in kB } case m68k : { HAIKU_DEFINES += __M68K__ ; HAIKU_BOOT_PLATFORM = atari_m68k ; + # offset in floppy image (>= sizeof(zbeos)) + HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET = 130 ; # in kB } case * : Exit "Currently unsupported target CPU:" $(HAIKU_CPU) ; @@ -233,6 +239,7 @@ HAIKU_ARCH ?= $(HAIKU_CPU) ; HAIKU_ARCH_MACRO_DEFINE = ARCH_$(HAIKU_ARCH) ; HAIKU_DEFINES += $(HAIKU_ARCH_MACRO_DEFINE) ; +HAIKU_DEFINES += BOOT_ARCHIVE_IMAGE_OFFSET=$(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; # directories HAIKU_OBJECT_BASE_DIR = [ FDirName $(HAIKU_OBJECT_DIR) haiku ] ; Modified: haiku/trunk/build/jam/ImageRules =================================================================== --- haiku/trunk/build/jam/ImageRules 2008-11-15 02:42:56 UTC (rev 28656) +++ haiku/trunk/build/jam/ImageRules 2008-11-15 03:30:00 UTC (rev 28657) @@ -1047,6 +1047,7 @@ Depends $(image) : $(zbeos) ; Depends $(image) : $(archive) ; #MakeLocateDebug $(image) ; + ARCHIVE_IMAGE_OFFSET on $(image) = $(HAIKU_BOOT_ARCHIVE_IMAGE_OFFSET) ; BuildFloppyBootImage1 $(image) : $(zbeos) $(archive) ; } @@ -1060,7 +1061,7 @@ # add the boot drivers tgz archive # keep the offset in sync with # src/system/boot/loader/file_systems/tarfs/tarfs.cpp:kFloppyArchiveOffset - dd if=$(>[2]) of=$(<) bs=192k seek=1 conv=notrunc + dd if=$(>[2]) of=$(<) bs=$(ARCHIVE_IMAGE_OFFSET)k seek=1 conv=notrunc } Modified: haiku/trunk/src/system/boot/platform/bios_ia32/shell.S =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/shell.S 2008-11-15 02:42:56 UTC (rev 28656) +++ haiku/trunk/src/system/boot/platform/bios_ia32/shell.S 2008-11-15 03:30:00 UTC (rev 28657) @@ -37,7 +37,7 @@ // written by the "makeflop" command in 512 byte blocks // 0x180 is the allowed maximum, as the zipped TAR with the // kernel and the boot module might start at offset 192 kB - .word 0x0180 + .word BOOT_ARCHIVE_IMAGE_OFFSET*2 floppy_start: cli From axeld at pinc-software.de Sat Nov 15 10:00:53 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Sat, 15 Nov 2008 10:00:53 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28657_-_in_haiku/trunk=3A_build/jam_sr?= =?utf-8?q?c/system/boot/platform/bios=5Fia32?= In-Reply-To: <200811150330.mAF3U3sO007313@sheep.berlios.de> Message-ID: <328914782-BeMail@zon> mmu_man at BerliOS wrote: > // written by the "makeflop" command in 512 byte blocks > // 0x180 is the allowed maximum, as the zipped TAR with the > // kernel and the boot module might start at offset 192 kB > - .word 0x0180 > + .word BOOT_ARCHIVE_IMAGE_OFFSET*2 Please adapt the comment as well. Bye, Axel. From anevilyak at mail.berlios.de Sat Nov 15 17:38:55 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Sat, 15 Nov 2008 17:38:55 +0100 Subject: [Haiku-commits] r28658 - haiku/trunk/src/preferences/sounds Message-ID: <200811151638.mAFGctdN015039@sheep.berlios.de> Author: anevilyak Date: 2008-11-15 17:38:54 +0100 (Sat, 15 Nov 2008) New Revision: 28658 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28658&view=rev Modified: haiku/trunk/src/preferences/sounds/HEventList.cpp haiku/trunk/src/preferences/sounds/HWindow.cpp Log: Fix a few minor problems that resulted in the sound column not being drawn until clicked. Also changed CLV to use B_PLAIN_BORDER. This fixes the redraw issues in ticket #2980. Modified: haiku/trunk/src/preferences/sounds/HEventList.cpp =================================================================== --- haiku/trunk/src/preferences/sounds/HEventList.cpp 2008-11-15 03:30:00 UTC (rev 28657) +++ haiku/trunk/src/preferences/sounds/HEventList.cpp 2008-11-15 16:38:54 UTC (rev 28658) @@ -21,8 +21,8 @@ : BRow(), fName(name) { + SetField(new BStringField(name), kEventColumn); SetPath(path); - SetField(new BStringField(name), kEventColumn); } @@ -48,7 +48,7 @@ HEventList::HEventList(BRect rect, const char* name) - : BColumnListView(rect, name, B_FOLLOW_ALL, 0, B_NO_BORDER, true), + : BColumnListView(rect, name, B_FOLLOW_ALL, 0, B_PLAIN_BORDER, true), fType(NULL) { AddColumn(new BStringColumn("Event", 150, 50, 500, B_TRUNCATE_MIDDLE), kEventColumn); @@ -76,10 +76,10 @@ entry_ref ref; while (mfiles.GetNextRef(&name,&ref) == B_OK) { BPath path(&ref); - if ((path.InitCheck() == B_OK) || (ref.name == NULL) || (strcmp(ref.name, "") == 0)) + if ((path.InitCheck() != B_OK) || (ref.name == NULL) || (strcmp(ref.name, "") == 0)) + AddRow(new HEventRow(name.String(), NULL)); + else AddRow(new HEventRow(name.String(), path.Path())); - else - AddRow(new HEventRow(name.String(), NULL)); } } Modified: haiku/trunk/src/preferences/sounds/HWindow.cpp =================================================================== --- haiku/trunk/src/preferences/sounds/HWindow.cpp 2008-11-15 03:30:00 UTC (rev 28657) +++ haiku/trunk/src/preferences/sounds/HWindow.cpp 2008-11-15 16:38:54 UTC (rev 28658) @@ -73,8 +73,8 @@ rect.top += 28; rect.bottom -= 7; fEventList = new HEventList(rect); + listView->AddChild(fEventList); fEventList->SetType(BMediaFiles::B_SOUNDS); - listView->AddChild(fEventList); rect = Bounds(); rect.top = rect.bottom - 105; From mmu_man at mail.berlios.de Sun Nov 16 01:24:48 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Sun, 16 Nov 2008 01:24:48 +0100 Subject: [Haiku-commits] r28659 - haiku/trunk/src/system/kernel/arch/x86 Message-ID: <200811160024.mAG0OmDn014556@sheep.berlios.de> Author: mmu_man Date: 2008-11-16 01:24:47 +0100 (Sun, 16 Nov 2008) New Revision: 28659 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28659&view=rev Modified: haiku/trunk/src/system/kernel/arch/x86/arch_int.c Log: Fix typo. Modified: haiku/trunk/src/system/kernel/arch/x86/arch_int.c =================================================================== --- haiku/trunk/src/system/kernel/arch/x86/arch_int.c 2008-11-15 16:38:54 UTC (rev 28658) +++ haiku/trunk/src/system/kernel/arch/x86/arch_int.c 2008-11-16 00:24:47 UTC (rev 28659) @@ -528,7 +528,7 @@ }; if (args->arch_args.apic == NULL) { - dprintf("no local apic availabe\n"); + dprintf("no local apic available\n"); return; } From korli at mail.berlios.de Sun Nov 16 15:09:03 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sun, 16 Nov 2008 15:09:03 +0100 Subject: [Haiku-commits] r28660 - haiku/trunk/src/add-ons/media/plugins/mp3_reader Message-ID: <200811161409.mAGE93N9003967@sheep.berlios.de> Author: korli Date: 2008-11-16 15:09:02 +0100 (Sun, 16 Nov 2008) New Revision: 28660 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28660&view=rev Modified: haiku/trunk/src/add-ons/media/plugins/mp3_reader/MP3ReaderPlugin.cpp Log: check one more frame as we were detecting ActivityMonitor as an MP3 file Modified: haiku/trunk/src/add-ons/media/plugins/mp3_reader/MP3ReaderPlugin.cpp =================================================================== --- haiku/trunk/src/add-ons/media/plugins/mp3_reader/MP3ReaderPlugin.cpp 2008-11-16 00:24:47 UTC (rev 28659) +++ haiku/trunk/src/add-ons/media/plugins/mp3_reader/MP3ReaderPlugin.cpp 2008-11-16 14:09:02 UTC (rev 28660) @@ -216,7 +216,7 @@ strcpy(mff->short_name, name_table[mpeg_version_index][layer_index]); strcpy(mff->pretty_name, name_table[mpeg_version_index][layer_index]); - printf("mp3Reader: %s\n", name_table[mpeg_version_index][layer_index]); + TRACE("mp3Reader: %s\n", name_table[mpeg_version_index][layer_index]); } @@ -521,7 +521,7 @@ *chunkSize = size + 4; if (*chunkSize > MAX_CHUNK_SIZE) { - printf("mp3Reader: chunk buffer overrun, read %ld bytes into %ld bytes buffer\n", *chunkSize, MAX_CHUNK_SIZE); + fprintf(stderr, "mp3Reader: chunk buffer overrun, read %ld bytes into %ld bytes buffer\n", *chunkSize, MAX_CHUNK_SIZE); exit(1); } @@ -966,7 +966,7 @@ bool mp3Reader::IsValidStream(uint8 *buffer, int size) { - // check 3 consecutive frame headers to make sure + // check 4 consecutive frame headers to make sure // that the length encoded in the header is correct, // and also that mpeg version and layer do not change int length1 = GetFrameLength(buffer); @@ -988,6 +988,13 @@ int layer_index3 = (buffer[length1 + length2 + 1] >> 1) & 0x03; if (version_index2 != version_index3 || layer_index2 != layer_index3) return false; + int length4 = GetFrameLength(buffer + length1 + length2 + length3); + if (length4 < 0) + return false; + int version_index4 = (buffer[length1 + length2 + length3 + 1] >> 3) & 0x03; + int layer_index4 = (buffer[length1 + length2 + length3 + 1] >> 1) & 0x03; + if (version_index3 != version_index4 || layer_index3 != layer_index4) + return false; return true; } From revol at free.fr Sun Nov 16 16:06:29 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Sun, 16 Nov 2008 16:06:29 +0100 CET Subject: [Haiku-commits] =?windows-1252?q?r28660_-_haiku/trunk/src/add-ons?= =?windows-1252?q?/media/plugins/mp3=5Freader?= In-Reply-To: <200811161409.mAGE93N9003967@sheep.berlios.de> Message-ID: <489034539-BeMail@laptop> > Modified: > haiku/trunk/src/add-ons/media/plugins/mp3_reader/ > MP3ReaderPlugin.cpp > Log: > check one more frame as we were detecting ActivityMonitor as an MP3 > file Oh... and how did it sound ? :) Fran?ois. From axeld at mail.berlios.de Sun Nov 16 22:19:58 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 16 Nov 2008 22:19:58 +0100 Subject: [Haiku-commits] r28661 - haiku/trunk/src/apps/sudoku Message-ID: <200811162119.mAGLJwkS023923@sheep.berlios.de> Author: axeld Date: 2008-11-16 22:19:58 +0100 (Sun, 16 Nov 2008) New Revision: 28661 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28661&view=rev Modified: haiku/trunk/src/apps/sudoku/Jamfile haiku/trunk/src/apps/sudoku/SudokuWindow.cpp Log: * Renamed settings file (removed the "pinc" part of it). * Removed BeOS compatible flag from the subdir. Modified: haiku/trunk/src/apps/sudoku/Jamfile =================================================================== --- haiku/trunk/src/apps/sudoku/Jamfile 2008-11-16 14:09:02 UTC (rev 28660) +++ haiku/trunk/src/apps/sudoku/Jamfile 2008-11-16 21:19:58 UTC (rev 28661) @@ -1,7 +1,5 @@ SubDir HAIKU_TOP src apps sudoku ; -SetSubDirSupportedPlatformsBeOSCompatible ; - UsePrivateHeaders shared ; Application Sudoku : Modified: haiku/trunk/src/apps/sudoku/SudokuWindow.cpp =================================================================== --- haiku/trunk/src/apps/sudoku/SudokuWindow.cpp 2008-11-16 14:09:02 UTC (rev 28660) +++ haiku/trunk/src/apps/sudoku/SudokuWindow.cpp 2008-11-16 21:19:58 UTC (rev 28661) @@ -296,7 +296,7 @@ if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) != B_OK) return B_ERROR; - path.Append("pinc.Sudoku settings"); + path.Append("Sudoku settings"); return file.SetTo(path.Path(), mode); } From axeld at mail.berlios.de Sun Nov 16 22:23:46 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 16 Nov 2008 22:23:46 +0100 Subject: [Haiku-commits] r28662 - in haiku/trunk: headers/os/support src/kits/support Message-ID: <200811162123.mAGLNkH8024333@sheep.berlios.de> Author: axeld Date: 2008-11-16 22:23:45 +0100 (Sun, 16 Nov 2008) New Revision: 28662 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28662&view=rev Modified: haiku/trunk/headers/os/support/BufferIO.h haiku/trunk/src/kits/support/BufferIO.cpp Log: * BBufferIO did not implement Seek() and Position() correctly; it just passed it to the stream. This caused Read()/Write() to need two syscalls for nothing (this only caused the actual stream to share the same position with the BBufferIO, something you just cannot rely on when using buffered I/O). * Anyway, this reduces the time VirtualBox needs to open some RAW test images from over 4 minutes to less than 15 seconds... Modified: haiku/trunk/headers/os/support/BufferIO.h =================================================================== --- haiku/trunk/headers/os/support/BufferIO.h 2008-11-16 21:19:58 UTC (rev 28661) +++ haiku/trunk/headers/os/support/BufferIO.h 2008-11-16 21:23:45 UTC (rev 28662) @@ -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 _BUFFER_IO_H @@ -40,7 +40,8 @@ char* fBuffer; size_t fBufferSize; size_t fBufferUsed; - uint32 _reserved_ints[6]; + off_t fPosition; + uint32 _reserved_ints[4]; bool fBufferIsDirty; bool fOwnsStream; bool _reserved_bools[6]; Modified: haiku/trunk/src/kits/support/BufferIO.cpp =================================================================== --- haiku/trunk/src/kits/support/BufferIO.cpp 2008-11-16 21:19:58 UTC (rev 28661) +++ haiku/trunk/src/kits/support/BufferIO.cpp 2008-11-16 21:23:45 UTC (rev 28662) @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001-2007, Haiku + * Copyright (c) 2001-2008, Haiku * Distributed under the terms of the MIT license * * Authors: @@ -14,7 +14,7 @@ #include -BBufferIO::BBufferIO(BPositionIO *stream, size_t bufferSize, bool ownsStream) +BBufferIO::BBufferIO(BPositionIO* stream, size_t bufferSize, bool ownsStream) : fBufferStart(0), fStream(stream), @@ -22,18 +22,16 @@ fBufferUsed(0), fBufferIsDirty(false), fOwnsStream(ownsStream) - + { - if (bufferSize < 512) - bufferSize = 512; - - fBufferSize = bufferSize; - + fBufferSize = max_c(bufferSize, 512); + fPosition = stream->Position(); + // What can we do if this malloc fails ? // I think R5 uses new, but doesn't catch the thrown exception // (if you specify a very big buffer, the application just // terminates with abort). - fBuffer = (char *)malloc(fBufferSize); + fBuffer = (char*)malloc(fBufferSize); } @@ -52,27 +50,26 @@ ssize_t -BBufferIO::ReadAt(off_t pos, void *buffer, size_t size) +BBufferIO::ReadAt(off_t pos, void* buffer, size_t size) { // We refuse to crash, even if // you were lazy and didn't give a valid // stream on construction. - if (fStream == NULL) - return B_NO_INIT; - + if (fStream == NULL) + return B_NO_INIT; if (buffer == NULL) return B_BAD_VALUE; // If the amount of data we want doesn't fit in the buffer, just // read it directly from the disk (and don't touch the buffer). - if (size > fBufferSize) { + if (size > fBufferSize || fBuffer == NULL) { if (fBufferIsDirty) Flush(); return fStream->ReadAt(pos, buffer, size); } - // If the data we are looking for is not in the buffer... - if (size > fBufferUsed + // If the data we are looking for is not in the buffer... + if (size > fBufferUsed || pos < fBufferStart || pos > fBufferStart + fBufferUsed || pos + size > fBufferStart + fBufferUsed) { @@ -86,7 +83,7 @@ fBufferStart = pos; // The data is buffered starting from this offset } - size = min_c(size, fBufferUsed); + size = min_c(size, fBufferUsed); // copy data from the cache to the given buffer memcpy(buffer, fBuffer + pos - fBufferStart, size); @@ -96,16 +93,15 @@ ssize_t -BBufferIO::WriteAt(off_t pos, const void *buffer, size_t size) +BBufferIO::WriteAt(off_t pos, const void* buffer, size_t size) { if (fStream == NULL) return B_NO_INIT; - if (buffer == NULL) return B_BAD_VALUE; - // If data doesn't fit into the buffer, write it directly to the stream - if (size > fBufferSize) + // If data doesn't fit into the buffer, write it directly to the stream + if (size > fBufferSize || fBuffer == NULL) return fStream->WriteAt(pos, buffer, size); // If we have cached data in the buffer, whose offset into the stream @@ -113,7 +109,7 @@ if (!fBufferIsDirty && fBufferStart > pos) { fBufferStart = 0; fBufferUsed = 0; - } + } // If we want to write beyond the cached data... if (pos > fBufferStart + fBufferUsed @@ -132,7 +128,7 @@ } } - memcpy(fBuffer + pos - fBufferStart, buffer, size); + memcpy(fBuffer + pos - fBufferStart, buffer, size); fBufferIsDirty = true; fBufferUsed = max_c((size + pos), fBufferUsed); @@ -147,17 +143,40 @@ if (fStream == NULL) return B_NO_INIT; - return fStream->Seek(position, seekMode); + switch (seekMode) { + case SEEK_CUR: + fPosition += position; + if (fPosition < 0) + fPosition = 0; + break; + case SEEK_SET: + if (position < 0) + return B_BAD_VALUE; + + fPosition = position; + break; + case SEEK_END: + { + off_t size; + status_t status = fStream->GetSize(&size); + if (status != B_OK) + return status; + + fPosition = size - position; + if (fPosition < 0) + fPosition = 0; + break; + } + } + + return fPosition; } off_t BBufferIO::Position() const { - if (fStream == NULL) - return B_NO_INIT; - - return fStream->Position(); + return fPosition; } @@ -186,7 +205,7 @@ } -BPositionIO * +BPositionIO* BBufferIO::Stream() const { return fStream; @@ -208,9 +227,9 @@ void -BBufferIO::SetOwnsStream(bool owns_stream) +BBufferIO::SetOwnsStream(bool ownsStream) { - fOwnsStream = owns_stream; + fOwnsStream = ownsStream; } @@ -231,9 +250,9 @@ // These functions are here to maintain future binary -// compatibility. -status_t BBufferIO::_Reserved_BufferIO_0(void *) { return B_ERROR; } -status_t BBufferIO::_Reserved_BufferIO_1(void *) { return B_ERROR; } -status_t BBufferIO::_Reserved_BufferIO_2(void *) { return B_ERROR; } -status_t BBufferIO::_Reserved_BufferIO_3(void *) { return B_ERROR; } -status_t BBufferIO::_Reserved_BufferIO_4(void *) { return B_ERROR; } +// compatibility. +status_t BBufferIO::_Reserved_BufferIO_0(void*) { return B_ERROR; } +status_t BBufferIO::_Reserved_BufferIO_1(void*) { return B_ERROR; } +status_t BBufferIO::_Reserved_BufferIO_2(void*) { return B_ERROR; } +status_t BBufferIO::_Reserved_BufferIO_3(void*) { return B_ERROR; } +status_t BBufferIO::_Reserved_BufferIO_4(void*) { return B_ERROR; } From axeld at mail.berlios.de Sun Nov 16 22:25:07 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 16 Nov 2008 22:25:07 +0100 Subject: [Haiku-commits] r28663 - haiku/trunk/src/add-ons/translators/raw Message-ID: <200811162125.mAGLP7af024450@sheep.berlios.de> Author: axeld Date: 2008-11-16 22:25:07 +0100 (Sun, 16 Nov 2008) New Revision: 28663 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28663&view=rev Modified: haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp Log: * Use buffered I/O instead of stream directly since you cannot know the caller does it for you (ShowImage apparently does). Modified: haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp 2008-11-16 21:23:45 UTC (rev 28662) +++ haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp 2008-11-16 21:25:07 UTC (rev 28663) @@ -1,5 +1,5 @@ /* - * Copyright 2007, Axel D?rfler, axeld at pinc-software.de. All rights reserved. + * Copyright 2007-2008, Axel D?rfler, axeld at pinc-software.de. * Distributed under the terms of the MIT License. */ @@ -8,6 +8,7 @@ #include "ConfigView.h" #include "RAW.h" +#include #include #include @@ -117,7 +118,8 @@ if (outType != B_TRANSLATOR_BITMAP) return B_NO_TRANSLATOR; - DCRaw raw(*stream); + BBufferIO io(stream, 128 * 1024, false); + DCRaw raw(io); status_t status; try { @@ -177,7 +179,7 @@ status_t -RAWTranslator::DerivedTranslate(BPositionIO* source, +RAWTranslator::DerivedTranslate(BPositionIO* stream, const translator_info* info, BMessage* settings, uint32 outType, BPositionIO* target, int32 baseType) { @@ -186,16 +188,17 @@ if (outType != B_TRANSLATOR_BITMAP || baseType != 0) return B_NO_TRANSLATOR; - DCRaw raw(*source); + BBufferIO io(stream, 1024 * 1024, false); + DCRaw raw(io); bool headerOnly = false; - progress_data progressData; + progress_data progressData; BMessenger monitor; if (settings != NULL) { settings->FindBool(B_TRANSLATOR_EXT_HEADER_ONLY, &headerOnly); - + bool half; if (settings->FindBool("raw:half_size", &half) == B_OK && half) raw.SetHalfSize(true); @@ -218,7 +221,7 @@ status = raw.Identify(); if (status == B_OK && settings) { - // Check if a document index has been specified + // Check if a document index has been specified if (settings->FindInt32(kDocumentIndex, &imageIndex) == B_OK) imageIndex--; else @@ -280,7 +283,7 @@ header.null = 0; memcpy(exifBuffer, &header, sizeof(header)); - if (source->ReadAt(exifOffset, exifBuffer + 16, exifLength) + if (io.ReadAt(exifOffset, exifBuffer + 16, exifLength) == (ssize_t)exifLength) settings->AddData("exif", B_RAW_TYPE, exifBuffer, exifLength + 16); From marcusoverhagen at arcor.de Sun Nov 16 22:33:09 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Sun, 16 Nov 2008 22:33:09 +0100 Subject: [Haiku-commits] r28663 - haiku/trunk/src/add-ons/translators/raw In-Reply-To: <200811162125.mAGLP7af024450@sheep.berlios.de> References: <200811162125.mAGLP7af024450@sheep.berlios.de> Message-ID: <49209195.7060702@arcor.de> axeld at BerliOS schrieb: > Author: axeld > Date: 2008-11-16 22:25:07 +0100 (Sun, 16 Nov 2008) > New Revision: 28663 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28663&view=rev > > Modified: > haiku/trunk/src/add-ons/translators/raw/RAWTranslator.cpp > Log: > * Use buffered I/O instead of stream directly since you cannot know the > caller does it for you (ShowImage apparently does). You can try dynamic_cast<> to find out. regards Marcus From axeld at mail.berlios.de Sun Nov 16 22:59:07 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Sun, 16 Nov 2008 22:59:07 +0100 Subject: [Haiku-commits] r28664 - in haiku/trunk: headers/private/app src/servers/app Message-ID: <200811162159.mAGLx7EN015252@sheep.berlios.de> Author: axeld Date: 2008-11-16 22:59:05 +0100 (Sun, 16 Nov 2008) New Revision: 28664 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28664&view=rev Modified: haiku/trunk/headers/private/app/ServerProtocol.h haiku/trunk/src/servers/app/Decorator.cpp haiku/trunk/src/servers/app/Decorator.h haiku/trunk/src/servers/app/DefaultDecorator.cpp haiku/trunk/src/servers/app/DefaultDecorator.h haiku/trunk/src/servers/app/Desktop.cpp haiku/trunk/src/servers/app/Desktop.h haiku/trunk/src/servers/app/DesktopSettings.cpp haiku/trunk/src/servers/app/ServerWindow.cpp haiku/trunk/src/servers/app/Window.cpp haiku/trunk/src/servers/app/Window.h Log: * Added a Desktop::BroadcastToAllWindows() method that sends all ServerWindows a message. * The DesktopSettings class is now using that to send the new AS_SYSTEM_FONT_CHANGED message to all windows. * The ServerWindow now propagates font changes to its decorator, causing it to update its drawing. That means changing the bold font in the "Fonts" preferences application will instantly change all window titles. * Factored out a _RebuildAndRedrawAfterWindowChange() out of several Desktop methods, simplifying some code. * The DefaultDecorator no longer calls _DoLayout() twice (through SetLook()), but instead calls the new _UpdateFont() method now also called by FontsChanged(), and SetLook(). * BWindow::GetDecoratorSettings() now also includes "tab frame" BRect with the exact footprint of the tab, allowing apps to know the size of the tab to position itself accordingly. * Automatic white space cleanup. Modified: haiku/trunk/headers/private/app/ServerProtocol.h =================================================================== --- haiku/trunk/headers/private/app/ServerProtocol.h 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/headers/private/app/ServerProtocol.h 2008-11-16 21:59:05 UTC (rev 28664) @@ -110,6 +110,7 @@ AS_SET_SYSTEM_FONT, AS_GET_SYSTEM_FONTS, AS_GET_SYSTEM_DEFAULT_FONT, + AS_SYSTEM_FONT_CHANGED, AS_GET_FONT_LIST_REVISION, AS_GET_FAMILY_AND_STYLES, Modified: haiku/trunk/src/servers/app/Decorator.cpp =================================================================== --- haiku/trunk/src/servers/app/Decorator.cpp 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/Decorator.cpp 2008-11-16 21:59:05 UTC (rev 28664) @@ -21,7 +21,7 @@ /*! \brief Constructor Does general initialization of internal data members and creates a colorset - object. + object. \param rect Size of client area \param wlook style of window look. See Window.h @@ -56,7 +56,7 @@ /*! \brief Destructor - + Frees the color set and the title string */ Decorator::~Decorator() @@ -100,14 +100,11 @@ } -/*! \brief Sets the decorator's font - \param font The new font object to copy from +/*! \brief Called whenever the system fonts are changed. */ void -Decorator::SetFont(ServerFont *font) +Decorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion) { - if (font) - fDrawState.SetFont(*font); } @@ -123,7 +120,7 @@ /*! \brief Sets the close button's value. - + Note that this does not update the button's look - it just updates the internal button value @@ -139,7 +136,7 @@ } /*! \brief Sets the minimize button's value. - + Note that this does not update the button's look - it just updates the internal button value @@ -155,7 +152,7 @@ } /*! \brief Sets the zoom button's value. - + Note that this does not update the button's look - it just updates the internal button value @@ -271,7 +268,7 @@ /*! \brief Changes the focus value of the decorator - + While this call will not update the screen, it will affect how future updates work. @@ -343,7 +340,7 @@ /*! \brief Moves the decorator frame and all default rectangles - + If a subclass implements this method, be sure to call Decorator::MoveBy to ensure that internal members are also updated. All members of the Decorator class are automatically moved in this method @@ -359,7 +356,7 @@ /*! \brief Moves the decorator frame and all default rectangles - + If a subclass implements this method, be sure to call Decorator::MoveBy to ensure that internal members are also updated. All members of the Decorator class are automatically moved in this method @@ -381,11 +378,11 @@ /*! \brief Resizes the decorator frame - + This is a required function for subclasses to implement - the default does nothing. Note that window resize flags should be followed and fFrame should be resized accordingly. It would also be a wise idea to ensure that the - window's rectangles are not inverted. + window's rectangles are not inverted. \param x x offset \param y y offset @@ -512,7 +509,7 @@ /*! \brief Actually draws the tab - + This function is called when the tab itself needs drawn. Other items, like the window title or buttons, should not be drawn here. @@ -553,7 +550,7 @@ /*! \brief Actually draws the zoom button - + Unless a subclass has a particularly large button, it is probably unnecessary to check the update rectangle. @@ -566,7 +563,7 @@ /*! \brief Actually draws the minimize button - + Unless a subclass has a particularly large button, it is probably unnecessary to check the update rectangle. Modified: haiku/trunk/src/servers/app/Decorator.h =================================================================== --- haiku/trunk/src/servers/app/Decorator.h 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/Decorator.h 2008-11-16 21:59:05 UTC (rev 28664) @@ -32,14 +32,14 @@ DEC_DRAG, DEC_MOVETOBACK, DEC_SLIDETAB, - + DEC_RESIZE, CLICK_RESIZE_L, - CLICK_RESIZE_T, + CLICK_RESIZE_T, CLICK_RESIZE_R, CLICK_RESIZE_B, CLICK_RESIZE_LT, - CLICK_RESIZE_RT, + CLICK_RESIZE_RT, CLICK_RESIZE_LB, CLICK_RESIZE_RB }; @@ -53,8 +53,9 @@ void SetDrawingEngine(DrawingEngine *driver); inline DrawingEngine* GetDrawingEngine() const { return fDrawingEngine; } - void SetFont(ServerFont *font); + virtual void FontsChanged(DesktopSettings& settings, + BRegion* updateRegion = NULL); virtual void SetLook(DesktopSettings& settings, window_look look, BRegion* updateRegion = NULL); virtual void SetFlags(uint32 flags, @@ -74,7 +75,7 @@ BRect BorderRect() const; BRect TabRect() const; - + bool GetClose(); bool GetMinimize(); bool GetZoom(); @@ -97,7 +98,7 @@ virtual void ResizeBy(BPoint offset, BRegion* dirty) = 0; /*! \return true if tab location updated, false if out of bounds - or unsupported + or unsupported */ virtual bool SetTabLocation(float location, BRegion* /*updateRegion*/ = NULL) Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-11-16 21:59:05 UTC (rev 28664) @@ -90,7 +90,7 @@ fTabLocation(0.0), fLastClicked(0) { - DefaultDecorator::SetLook(settings, look); + _UpdateFont(settings); // common colors to both focus and non focus state fFrameColors[0] = (rgb_color){ 152, 152, 152, 255 }; @@ -160,6 +160,27 @@ void +DefaultDecorator::FontsChanged(DesktopSettings& settings, BRegion* updateRegion) +{ + // get previous extent + if (updateRegion != NULL) { + BRegion extent; + GetFootprint(&extent); + updateRegion->Include(&extent); + } + + _UpdateFont(settings); + _DoLayout(); + + if (updateRegion != NULL) { + BRegion extent; + GetFootprint(&extent); + updateRegion->Include(&extent); + } +} + + +void DefaultDecorator::SetLook(DesktopSettings& settings, window_look look, BRegion* updateRegion) { @@ -172,19 +193,9 @@ updateRegion->Include(&extent); } - ServerFont font; - if (look == B_FLOATING_WINDOW_LOOK || look == kLeftTitledWindowLook) { - settings.GetDefaultPlainFont(font); - if (look == kLeftTitledWindowLook) - font.SetRotation(90.0f); - } else - settings.GetDefaultBoldFont(font); + fLook = look; - font.SetFlags(B_FORCE_ANTIALIASING); - font.SetSpacing(B_STRING_SPACING); - SetFont(&font); - - Decorator::SetLook(settings, look, updateRegion); + _UpdateFont(settings); _DoLayout(); if (updateRegion != NULL) { @@ -435,6 +446,9 @@ if (!fTabRect.IsValid()) return false; + if (settings->AddRect("tab frame", fTabRect) != B_OK) + return false; + return settings->AddFloat("tab location", (float)fTabOffset) == B_OK; } @@ -669,8 +683,8 @@ fMinTabSize += offset + size; // fMaxTabSize contains fMinWidth + the width required for the title - fMaxTabSize = fDrawingEngine ? - ceilf(fDrawingEngine->StringWidth(Title(), strlen(Title()), + fMaxTabSize = fDrawingEngine + ? ceilf(fDrawingEngine->StringWidth(Title(), strlen(Title()), fDrawState.Font())) : 0.0; if (fMaxTabSize > 0.0) fMaxTabSize += fTextOffset; @@ -1099,6 +1113,23 @@ void +DefaultDecorator::_UpdateFont(DesktopSettings& settings) +{ + ServerFont font; + if (fLook == B_FLOATING_WINDOW_LOOK || fLook == kLeftTitledWindowLook) { + settings.GetDefaultPlainFont(font); + if (fLook == kLeftTitledWindowLook) + font.SetRotation(90.0f); + } else + settings.GetDefaultBoldFont(font); + + font.SetFlags(B_FORCE_ANTIALIASING); + font.SetSpacing(B_STRING_SPACING); + fDrawState.SetFont(font); +} + + +void DefaultDecorator::_DrawButtonBitmap(ServerBitmap* bitmap, BRect rect) { if (bitmap == NULL) Modified: haiku/trunk/src/servers/app/DefaultDecorator.h =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.h 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/DefaultDecorator.h 2008-11-16 21:59:05 UTC (rev 28664) @@ -25,6 +25,8 @@ virtual void SetTitle(const char* string, BRegion* updateRegion = NULL); + virtual void FontsChanged(DesktopSettings& settings, + BRegion* updateRegion); virtual void SetLook(DesktopSettings& settings, window_look look, BRegion* updateRegion = NULL); @@ -68,6 +70,7 @@ virtual void _SetColors(); private: + void _UpdateFont(DesktopSettings& settings); void _DrawButtonBitmap(ServerBitmap* bitmap, BRect rect); void _DrawBlendedRect(DrawingEngine *engine, Modified: haiku/trunk/src/servers/app/Desktop.cpp =================================================================== --- haiku/trunk/src/servers/app/Desktop.cpp 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/Desktop.cpp 2008-11-16 21:59:05 UTC (rev 28664) @@ -709,8 +709,7 @@ } -/*! - \brief Send a quick (no attachments) message to all applications +/*! \brief Send a quick (no attachments) message to all applications. Quite useful for notification for things like server shutdown, system color changes, etc. @@ -726,6 +725,20 @@ } +/*! \brief Send a quick (no attachments) message to all windows. +*/ +void +Desktop::BroadcastToAllWindows(int32 code) +{ + AutoWriteLocker _(fWindowLock); + + for (Window* window = fAllWindows.FirstWindow(); window != NULL; + window = window->NextWindow(kAllWindowList)) { + window->ServerWindow()->PostMessage(code); + } +} + + // #pragma mark - @@ -1967,23 +1980,13 @@ bool Desktop::SetWindowTabLocation(Window* window, float location) { - if (!LockAllWindows()) - return false; + AutoWriteLocker _(fWindowLock); BRegion dirty; bool changed = window->SetTabLocation(location, dirty); + if (changed) + _RebuildAndRedrawAfterWindowChange(window, dirty); - if (changed && window->IsVisible() && dirty.CountRects() > 0) { - BRegion stillAvailableOnScreen; - _RebuildClippingForAllWindows(stillAvailableOnScreen); - _SetBackground(stillAvailableOnScreen); - - _WindowChanged(window); - _TriggerWindowRedrawing(dirty); - } - - UnlockAllWindows(); - return changed; } @@ -1991,24 +1994,13 @@ bool Desktop::SetWindowDecoratorSettings(Window* window, const BMessage& settings) { - // TODO: almost exact code duplication to above function... + AutoWriteLocker _(fWindowLock); - if (!LockAllWindows()) - return false; - BRegion dirty; bool changed = window->SetDecoratorSettings(settings, dirty); + if (changed) + _RebuildAndRedrawAfterWindowChange(window, dirty); - if (changed && window->IsVisible() && dirty.CountRects() > 0) { - BRegion stillAvailableOnScreen; - _RebuildClippingForAllWindows(stillAvailableOnScreen); - _SetBackground(stillAvailableOnScreen); - - _TriggerWindowRedrawing(dirty); - } - - UnlockAllWindows(); - return changed; } @@ -2211,32 +2203,36 @@ void -Desktop::SetWindowLook(Window *window, window_look newLook) +Desktop::FontsChanged(Window* window) { + AutoWriteLocker _(fWindowLock); + + BRegion dirty; + window->FontsChanged(&dirty); + + _RebuildAndRedrawAfterWindowChange(window, dirty); +} + + +void +Desktop::SetWindowLook(Window* window, window_look newLook) +{ if (window->Look() == newLook) return; - if (!LockAllWindows()) - return; + AutoWriteLocker _(fWindowLock); BRegion dirty; window->SetLook(newLook, &dirty); // TODO: test what happens when the window // finds out it needs to resize itself... - BRegion stillAvailableOnScreen; - _RebuildClippingForAllWindows(stillAvailableOnScreen); - _SetBackground(stillAvailableOnScreen); - _WindowChanged(window); - - _TriggerWindowRedrawing(dirty); - - UnlockAllWindows(); + _RebuildAndRedrawAfterWindowChange(window, dirty); } void -Desktop::SetWindowFeel(Window *window, window_feel newFeel) +Desktop::SetWindowFeel(Window* window, window_feel newFeel) { if (window->Feel() == newFeel) return; @@ -2340,43 +2336,26 @@ if (window->Flags() == newFlags) return; - if (!LockAllWindows()) - return; + AutoWriteLocker _(fWindowLock); BRegion dirty; window->SetFlags(newFlags, &dirty); // TODO: test what happens when the window // finds out it needs to resize itself... - BRegion stillAvailableOnScreen; - _RebuildClippingForAllWindows(stillAvailableOnScreen); - _SetBackground(stillAvailableOnScreen); - _WindowChanged(window); - - _TriggerWindowRedrawing(dirty); - - UnlockAllWindows(); + _RebuildAndRedrawAfterWindowChange(window, dirty); } void Desktop::SetWindowTitle(Window *window, const char* title) { - if (!LockAllWindows()) - return; + AutoWriteLocker _(fWindowLock); BRegion dirty; window->SetTitle(title, dirty); - if (window->IsVisible() && dirty.CountRects() > 0) { - BRegion stillAvailableOnScreen; - _RebuildClippingForAllWindows(stillAvailableOnScreen); - _SetBackground(stillAvailableOnScreen); - - _TriggerWindowRedrawing(dirty); - } - - UnlockAllWindows(); + _RebuildAndRedrawAfterWindowChange(window, dirty); } @@ -2755,3 +2734,20 @@ } } } + + +//! The all window lock must be held when calling this function. +void +Desktop::_RebuildAndRedrawAfterWindowChange(Window* window, BRegion& dirty) +{ + if (!window->IsVisible() || dirty.CountRects() == 0) + return; + + BRegion stillAvailableOnScreen; + _RebuildClippingForAllWindows(stillAvailableOnScreen); + _SetBackground(stillAvailableOnScreen); + _WindowChanged(window); + + _TriggerWindowRedrawing(dirty); +} + Modified: haiku/trunk/src/servers/app/Desktop.h =================================================================== --- haiku/trunk/src/servers/app/Desktop.h 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/Desktop.h 2008-11-16 21:59:05 UTC (rev 28664) @@ -69,6 +69,7 @@ ::EventDispatcher& EventDispatcher() { return fEventDispatcher; } void BroadcastToAllApps(int32 code); + void BroadcastToAllWindows(int32 code); // Screen and drawing related methods @@ -142,6 +143,8 @@ void RemoveWindowFromSubset(Window* subset, Window* window); + void FontsChanged(Window* window); + void SetWindowLook(Window* window, window_look look); void SetWindowFeel(Window* window, window_feel feel); void SetWindowFlags(Window* window, uint32 flags); @@ -240,6 +243,8 @@ void _TriggerWindowRedrawing( BRegion& newDirtyRegion); void _SetBackground(BRegion& background); + void _RebuildAndRedrawAfterWindowChange( + Window* window, BRegion& dirty); void _UpdateFloating(int32 previousWorkspace = -1, int32 nextWorkspace = -1, Modified: haiku/trunk/src/servers/app/DesktopSettings.cpp =================================================================== --- haiku/trunk/src/servers/app/DesktopSettings.cpp 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/DesktopSettings.cpp 2008-11-16 21:59:05 UTC (rev 28664) @@ -235,13 +235,13 @@ bool subpix; if (settings.FindBool("subpixel antialiasing", &subpix) == B_OK) gSubpixelAntialiasing = subpix; - + int8 averageWeight; if (settings.FindInt8("subpixel average weight", &averageWeight) == B_OK) { gSubpixelAverageWeight = averageWeight; } - + bool subpixelOrdering; if (settings.FindBool("subpixel ordering", &subpixelOrdering) == B_OK) { @@ -778,6 +778,7 @@ LockedDesktopSettings::SetDefaultBoldFont(const ServerFont &font) { fSettings->SetDefaultBoldFont(font); + fDesktop->BroadcastToAllWindows(AS_SYSTEM_FONT_CHANGED); } Modified: haiku/trunk/src/servers/app/ServerWindow.cpp =================================================================== --- haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/ServerWindow.cpp 2008-11-16 21:59:05 UTC (rev 28664) @@ -1082,6 +1082,13 @@ break; } + case AS_SYSTEM_FONT_CHANGED: + { + fDesktop->FontsChanged(fWindow); + // TODO: tell client about this, too, and relayout... + break; + } + case AS_REDRAW: // Nothing to do here - the redraws are actually handled by looking // at the fRedrawRequested member variable in _MessageLooper(). @@ -3692,6 +3699,7 @@ case AS_WINDOW_MOVE: case AS_WINDOW_RESIZE: case AS_SET_SIZE_LIMITS: + case AS_SYSTEM_FONT_CHANGED: case AS_SET_DECORATOR_SETTINGS: case AS_GET_MOUSE: case AS_DIRECT_WINDOW_SET_FULLSCREEN: Modified: haiku/trunk/src/servers/app/Window.cpp =================================================================== --- haiku/trunk/src/servers/app/Window.cpp 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/Window.cpp 2008-11-16 21:59:05 UTC (rev 28664) @@ -1288,6 +1288,17 @@ void +Window::FontsChanged(BRegion* updateRegion) +{ + if (fDecorator != NULL) { + DesktopSettings settings(fDesktop); + fDecorator->FontsChanged(settings, updateRegion); + fBorderRegionValid = false; + } +} + + +void Window::SetLook(window_look look, BRegion* updateRegion) { if (fDecorator == NULL && look != B_NO_BORDER_WINDOW_LOOK) { Modified: haiku/trunk/src/servers/app/Window.h =================================================================== --- haiku/trunk/src/servers/app/Window.h 2008-11-16 21:25:07 UTC (rev 28663) +++ haiku/trunk/src/servers/app/Window.h 2008-11-16 21:59:05 UTC (rev 28664) @@ -177,6 +177,8 @@ void HighlightDecorator(bool active); + void FontsChanged(BRegion* updateRegion); + void SetLook(window_look look, BRegion* updateRegion); void SetFeel(window_feel feel); void SetFlags(uint32 flags, BRegion* updateRegion); From stippi at mail.berlios.de Sun Nov 16 23:12:29 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:12:29 +0100 Subject: [Haiku-commits] r28665 - haiku/trunk/src/preferences/datatranslations Message-ID: <200811162212.mAGMCTfh022941@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:12:29 +0100 (Sun, 16 Nov 2008) New Revision: 28665 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28665&view=rev Modified: haiku/trunk/src/preferences/datatranslations/TranslatorListView.cpp Log: There is a bug report about Home/End and Page Up/Down not working in the DataTranslations list view. This should fix it. MessageReceived() was not forwarding to the immediate inherited class. Modified: haiku/trunk/src/preferences/datatranslations/TranslatorListView.cpp =================================================================== --- haiku/trunk/src/preferences/datatranslations/TranslatorListView.cpp 2008-11-16 21:59:05 UTC (rev 28664) +++ haiku/trunk/src/preferences/datatranslations/TranslatorListView.cpp 2008-11-16 22:12:29 UTC (rev 28665) @@ -75,7 +75,7 @@ break; default: - BView::MessageReceived(message); + BListView::MessageReceived(message); break; } } From stippi at mail.berlios.de Sun Nov 16 23:13:22 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:13:22 +0100 Subject: [Haiku-commits] r28666 - haiku/trunk/src/apps/launchbox Message-ID: <200811162213.mAGMDMGa023449@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:13:21 +0100 (Sun, 16 Nov 2008) New Revision: 28666 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28666&view=rev Modified: haiku/trunk/src/apps/launchbox/IconButton.h Log: Small style cleanup. Modified: haiku/trunk/src/apps/launchbox/IconButton.h =================================================================== --- haiku/trunk/src/apps/launchbox/IconButton.h 2008-11-16 22:12:29 UTC (rev 28665) +++ haiku/trunk/src/apps/launchbox/IconButton.h 2008-11-16 22:13:21 UTC (rev 28666) @@ -25,7 +25,7 @@ class BMimeType; class IconButton : public BView, public BInvoker { - public: +public: IconButton(const char* name, uint32 id, const char* label = NULL, @@ -91,7 +91,7 @@ rgb_color lightShadow, rgb_color light); - protected: +protected: enum { STATE_NONE = 0x0000, STATE_TRACKING = 0x0001, From stippi at mail.berlios.de Sun Nov 16 23:14:10 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:14:10 +0100 Subject: [Haiku-commits] r28667 - haiku/trunk/src/apps/launchbox Message-ID: <200811162214.mAGMEAKp024492@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:14:10 +0100 (Sun, 16 Nov 2008) New Revision: 28667 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28667&view=rev Modified: haiku/trunk/src/apps/launchbox/LaunchButton.cpp haiku/trunk/src/apps/launchbox/LaunchButton.h Log: Fixed the problem that icon buttons are too small when creating new ones. Modified: haiku/trunk/src/apps/launchbox/LaunchButton.cpp =================================================================== --- haiku/trunk/src/apps/launchbox/LaunchButton.cpp 2008-11-16 22:13:21 UTC (rev 28666) +++ haiku/trunk/src/apps/launchbox/LaunchButton.cpp 2008-11-16 22:14:10 UTC (rev 28667) @@ -239,6 +239,44 @@ IconButton::MouseMoved(where, transit, dragMessage); } + +BSize +LaunchButton::MinSize() +{ + return PreferredSize(); +} + + +BSize +LaunchButton::PreferredSize() +{ + float minWidth = fIconSize; + float minHeight = fIconSize; + + float hPadding = max_c(4.0, ceilf(minHeight / 4.0)); + float vPadding = max_c(4.0, ceilf(minWidth / 4.0)); + + if (fLabel.CountChars() > 0) { + font_height fh; + GetFontHeight(&fh); + minHeight += ceilf(fh.ascent + fh.descent) + vPadding; + minWidth += StringWidth(fLabel.String()) + vPadding; + } + + return BSize(minWidth + hPadding, minHeight + vPadding); +} + + +BSize +LaunchButton::MaxSize() +{ + return PreferredSize(); +} + + +// #pragma mark - + + // SetTo void LaunchButton::SetTo(const entry_ref* ref) Modified: haiku/trunk/src/apps/launchbox/LaunchButton.h =================================================================== --- haiku/trunk/src/apps/launchbox/LaunchButton.h 2008-11-16 22:13:21 UTC (rev 28666) +++ haiku/trunk/src/apps/launchbox/LaunchButton.h 2008-11-16 22:14:10 UTC (rev 28667) @@ -40,6 +40,10 @@ virtual void MouseMoved(BPoint where, uint32 transit, const BMessage* dragMessage); + virtual BSize MinSize(); + virtual BSize PreferredSize(); + virtual BSize MaxSize(); + // LaunchButton void SetTo(const entry_ref* ref); entry_ref* Ref() const; From stippi at mail.berlios.de Sun Nov 16 23:15:13 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:15:13 +0100 Subject: [Haiku-commits] r28668 - haiku/trunk/src/apps/deskcalc Message-ID: <200811162215.mAGMFDTB025091@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:15:13 +0100 (Sun, 16 Nov 2008) New Revision: 28668 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28668&view=rev Modified: haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp Log: Fixed the "power" operator (^). Modified: haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp =================================================================== --- haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp 2008-11-16 22:14:10 UTC (rev 28667) +++ haiku/trunk/src/apps/deskcalc/ExpressionParser.cpp 2008-11-16 22:15:13 UTC (rev 28668) @@ -359,7 +359,7 @@ fTokenizer->RewindToken(); return value; } - value.pow(_ParseUnary()); + value = value.pow(_ParseUnary()); } } From stippi at mail.berlios.de Sun Nov 16 23:21:34 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:21:34 +0100 Subject: [Haiku-commits] r28669 - haiku/trunk/src/add-ons/input_server/devices/mouse Message-ID: <200811162221.mAGMLY2H027053@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:21:34 +0100 (Sun, 16 Nov 2008) New Revision: 28669 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28669&view=rev Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp Log: * Fixed the mouse movement when speed or acceleration where below default values. The implementation needs to sum up fractional movement, not truncate to zero. Before this change, the mouse would be pretty much unusable at lower speeds/acceleration. Now it is guaranteed to move. * No need to memset() before ioctl(), the driver does that anyways. Modified: haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp =================================================================== --- haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-16 22:15:13 UTC (rev 28668) +++ haiku/trunk/src/add-ons/input_server/devices/mouse/MouseInputDevice.cpp 2008-11-16 22:21:34 UTC (rev 28669) @@ -86,8 +86,8 @@ # define TRACE(x...) do {} while (0) # define MD_CALLED(x...) TRACE(x) # define MID_CALLED(x...) TRACE(x) -# define LOG_ERR(text...) debug_printf(text) -# define LOG_EVENT(text...) TRACE(x) +# define LOG_ERR(x...) debug_printf(x) +# define LOG_EVENT(x...) TRACE(x) #endif @@ -128,7 +128,9 @@ int32 deltaX, int32 deltaY) const; void _ComputeAcceleration( const mouse_movement& movements, - int32& deltaX, int32& deltaY) const; + int32& deltaX, int32& deltaY, + float& historyDeltaX, + float& historyDeltaY) const; uint32 _RemapButtons(uint32 buttons) const; private: @@ -368,11 +370,11 @@ _UpdateSettings(); uint32 lastButtons = 0; + float historyDeltaX = 0.0; + float historyDeltaY = 0.0; while (fActive) { mouse_movement movements; - memset(&movements, 0, sizeof(movements)); - if (ioctl(fDevice, MS_READ, &movements) != B_OK) { _ControlThreadCleanup(); // TOAST! @@ -399,12 +401,16 @@ uint32 remappedButtons = _RemapButtons(movements.buttons); int32 deltaX, deltaY; - _ComputeAcceleration(movements, deltaX, deltaY); + _ComputeAcceleration(movements, deltaX, deltaY, historyDeltaX, + historyDeltaY); - LOG_EVENT("%s: buttons: 0x%lx, x: %ld, y: %ld, clicks:%ld, wheel_x:%ld, wheel_y:%ld\n", - fDeviceRef.name, movements.buttons, movements.xdelta, movements.ydelta, - movements.clicks, movements.wheel_xdelta, movements.wheel_ydelta); - LOG_EVENT("%s: x: %ld, y: %ld\n", fDeviceRef.name, deltaX, deltaY); + LOG_EVENT("%s: buttons: 0x%lx, x: %ld, y: %ld, clicks:%ld, " + "wheel_x:%ld, wheel_y:%ld\n", + fDeviceRef.name, movements.buttons, + movements.xdelta, movements.ydelta, movements.clicks, + movements.wheel_xdelta, movements.wheel_ydelta); + LOG_EVENT("%s: x: %ld, y: %ld (%.4f, %.4f)\n", fDeviceRef.name, + deltaX, deltaY, historyDeltaX, historyDeltaY); // Send single messages for each event @@ -574,11 +580,14 @@ void MouseDevice::_ComputeAcceleration(const mouse_movement& movements, - int32& deltaX, int32& deltaY) const + int32& _deltaX, int32& _deltaY, float& historyDeltaX, + float& historyDeltaY) const { // basic mouse speed - deltaX = movements.xdelta * fSettings.accel.speed >> 16; - deltaY = movements.ydelta * fSettings.accel.speed >> 16; + float deltaX = (float)movements.xdelta * fSettings.accel.speed / 65536.0 + + historyDeltaX; + float deltaY = (float)movements.ydelta * fSettings.accel.speed / 65536.0 + + historyDeltaY; // acceleration double acceleration = 1; @@ -587,16 +596,21 @@ * fSettings.accel.accel_factor / 524288.0; } - // make sure that we move at least one pixel (if there was a movement) - if (deltaX > 0) - deltaX = (int32)floor(deltaX * acceleration); + deltaX *= acceleration; + deltaY *= acceleration; + + if (deltaX >= 0) + _deltaX = (int32)floorf(deltaX); else - deltaX = (int32)ceil(deltaX * acceleration); + _deltaX = (int32)ceilf(deltaX); - if (deltaY > 0) - deltaY = (int32)floor(deltaY * acceleration); + if (deltaY >= 0) + _deltaY = (int32)floorf(deltaY); else - deltaY = (int32)ceil(deltaY * acceleration); + _deltaY = (int32)ceilf(deltaY); + + historyDeltaX = deltaX - _deltaX; + historyDeltaY = deltaY - _deltaY; } From stippi at mail.berlios.de Sun Nov 16 23:23:15 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:23:15 +0100 Subject: [Haiku-commits] r28670 - haiku/trunk/src/servers/app Message-ID: <200811162223.mAGMNFwI027468@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:23:15 +0100 (Sun, 16 Nov 2008) New Revision: 28670 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28670&view=rev Modified: haiku/trunk/src/servers/app/DesktopSettings.cpp Log: Actually restore the "dragger" settings. So the system remember your "Show Replicants" setting after reboot. Modified: haiku/trunk/src/servers/app/DesktopSettings.cpp =================================================================== --- haiku/trunk/src/servers/app/DesktopSettings.cpp 2008-11-16 22:21:34 UTC (rev 28669) +++ haiku/trunk/src/servers/app/DesktopSettings.cpp 2008-11-16 22:23:15 UTC (rev 28670) @@ -258,6 +258,21 @@ } } + // read dragger settings + + path = basePath; + path.Append("dragger"); + + status = file.SetTo(path.Path(), B_READ_ONLY); + if (status == B_OK) { + BMessage settings; + status = settings.Unflatten(&file); + if (status == B_OK) { + if (settings.FindBool("show", &fShowAllDraggers) != B_OK) + fShowAllDraggers = true; + } + } + return B_OK; } From stippi at mail.berlios.de Sun Nov 16 23:34:12 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:34:12 +0100 Subject: [Haiku-commits] r28671 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200811162234.mAGMYCPf030837@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:34:11 +0100 (Sun, 16 Nov 2008) New Revision: 28671 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28671&view=rev Modified: haiku/trunk/headers/os/interface/ListView.h haiku/trunk/src/kits/interface/ListView.cpp Log: * The previous change to reorder item->Update() and _RecalcItemTops() obviously broke everything. If the added item has no chance to calculate it's height, _RecalcItemTops() won't work of course. Whatever this was supposed to fix, there has to be a correct way. * Override BView::SetFont() to update all the items. I remember wanting to implement this, that's why I refactored a _FontChanged() method, but I obviousy never did... * Moved the AttachedToWindow() and FrameMoved() implementations to a more logical position in the file. * Implement B_PAGE_UP/DOWN key presses. Don't know if that's what the BeOS implementation did, will check later. Modified: haiku/trunk/headers/os/interface/ListView.h =================================================================== --- haiku/trunk/headers/os/interface/ListView.h 2008-11-16 22:23:15 UTC (rev 28670) +++ haiku/trunk/headers/os/interface/ListView.h 2008-11-16 22:34:11 UTC (rev 28671) @@ -41,7 +41,11 @@ virtual void MouseDown(BPoint where); virtual void KeyDown(const char* bytes, int32 numBytes); virtual void MakeFocus(bool state = true); + virtual void AttachedToWindow(); virtual void FrameResized(float newWidth, float newHeight); + virtual void FrameMoved(BPoint newPosition); + virtual void SetFont(const BFont* font, + uint32 mask = B_FONT_ALL); virtual void TargetedByScrollView(BScrollView* scroller); virtual void ScrollTo(BPoint where); inline void ScrollTo(float x, float y); @@ -98,9 +102,6 @@ bool MoveItem(int32 from, int32 to); bool ReplaceItem(int32 index, BListItem* item); - virtual void AttachedToWindow(); - virtual void FrameMoved(BPoint newPosition); - BRect ItemFrame(int32 index); virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2008-11-16 22:23:15 UTC (rev 28670) +++ haiku/trunk/src/kits/interface/ListView.cpp 2008-11-16 22:34:11 UTC (rev 28671) @@ -427,6 +427,25 @@ ScrollToSelection(); break; + case B_PAGE_UP: + { + BPoint scrollOffset(LeftTop()); + scrollOffset.y = max_c(0, scrollOffset.y - Bounds().Height()); + ScrollTo(scrollOffset); + break; + } + case B_PAGE_DOWN: + { + BPoint scrollOffset(LeftTop()); + if (BListItem* item = LastItem()) { + scrollOffset.y += Bounds().Height(); + scrollOffset.y = min_c(item->Bottom() - Bounds().Height(), + scrollOffset.y); + } + ScrollTo(scrollOffset); + break; + } + case B_RETURN: case B_SPACE: Invoke(); @@ -450,6 +469,19 @@ fScrollView->SetBorderHighlighted(focused); } +// AttachedToWindow +void +BListView::AttachedToWindow() +{ + BView::AttachedToWindow(); + _FontChanged(); + + if (!Messenger().IsValid()) + SetTarget(Window(), NULL); + + _FixupScrollBar(); +} + // FrameResized void BListView::FrameResized(float width, float height) @@ -457,6 +489,21 @@ _FixupScrollBar(); } +// FrameMoved +void +BListView::FrameMoved(BPoint new_position) +{ + BView::FrameMoved(new_position); +} + +// SetFont +void +BListView::SetFont(const BFont* font, uint32 mask) +{ + BView::SetFont(font, mask); + _FontChanged(); +} + // TargetedByScrollView void BListView::TargetedByScrollView(BScrollView *view) @@ -486,9 +533,9 @@ if (Window()) { BFont font; GetFont(&font); + item->Update(this, &font); _RecalcItemTops(index); - item->Update(this, &font); - + _FixupScrollBar(); _InvalidateFrom(index); } @@ -508,10 +555,9 @@ if (Window()) { BFont font; GetFont(&font); + item->Update(this, &font); _RecalcItemTops(CountItems() - 1); - item->Update(this, &font); - _FixupScrollBar(); InvalidateItem(CountItems() - 1); } @@ -992,26 +1038,6 @@ return DoMiscellaneous(B_REPLACE_OP, &data); } -// AttachedToWindow -void -BListView::AttachedToWindow() -{ - BView::AttachedToWindow(); - _FontChanged(); - - if (!Messenger().IsValid()) - SetTarget(Window(), NULL); - - _FixupScrollBar(); -} - -// FrameMoved -void -BListView::FrameMoved(BPoint new_position) -{ - BView::FrameMoved(new_position); -} - // ItemFrame BRect BListView::ItemFrame(int32 index) From stippi at mail.berlios.de Sun Nov 16 23:36:43 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:36:43 +0100 Subject: [Haiku-commits] r28672 - haiku/trunk/src/kits/interface Message-ID: <200811162236.mAGMahrP031831@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:36:42 +0100 (Sun, 16 Nov 2008) New Revision: 28672 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28672&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp Log: Minor style fix. Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-11-16 22:34:11 UTC (rev 28671) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-11-16 22:36:42 UTC (rev 28672) @@ -3156,7 +3156,8 @@ view->ConvertFromScreen(where)); if (message->what == B_MOUSE_MOVED) { - // is there a token of the view that is currently under the mouse? + // is there a token of the view that is currently under + // the mouse? BView* viewUnderMouse = NULL; int32 token; if (message->FindInt32("_view_token", &token) == B_OK) From stippi at mail.berlios.de Sun Nov 16 23:40:44 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:40:44 +0100 Subject: [Haiku-commits] r28673 - haiku/trunk/src/add-ons/translators/bmp Message-ID: <200811162240.mAGMeibM000168@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:40:43 +0100 (Sun, 16 Nov 2008) New Revision: 28673 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28673&view=rev Modified: haiku/trunk/src/add-ons/translators/bmp/BMPTranslator.cpp Log: This should be the correct MIME type. Modified: haiku/trunk/src/add-ons/translators/bmp/BMPTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/bmp/BMPTranslator.cpp 2008-11-16 22:36:42 UTC (rev 28672) +++ haiku/trunk/src/add-ons/translators/bmp/BMPTranslator.cpp 2008-11-16 22:40:43 UTC (rev 28673) @@ -37,7 +37,7 @@ B_TRANSLATOR_BITMAP, BMP_IN_QUALITY, BMP_IN_CAPABILITY, - "image/x-bmp", + "image/bmp", "BMP image" } }; @@ -57,7 +57,7 @@ B_TRANSLATOR_BITMAP, BMP_OUT_QUALITY, BMP_OUT_CAPABILITY, - "image/x-bmp", + "image/bmp", "BMP image" } }; From stippi at mail.berlios.de Sun Nov 16 23:41:55 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:41:55 +0100 Subject: [Haiku-commits] r28674 - haiku/trunk/src/add-ons/translators/shared Message-ID: <200811162241.mAGMftDq000621@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:41:54 +0100 (Sun, 16 Nov 2008) New Revision: 28674 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28674&view=rev Modified: haiku/trunk/src/add-ons/translators/shared/BaseTranslator.cpp Log: Simplified the code, style improvement (brackets for multi-line if/else). Modified: haiku/trunk/src/add-ons/translators/shared/BaseTranslator.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/shared/BaseTranslator.cpp 2008-11-16 22:40:43 UTC (rev 28673) +++ haiku/trunk/src/add-ons/translators/shared/BaseTranslator.cpp 2008-11-16 22:41:54 UTC (rev 28674) @@ -543,17 +543,15 @@ const translator_info *inInfo, BMessage *ioExtension, uint32 outType, BPositionIO *outDestination) { - status_t result; - - result = BitsCheck(inSource, ioExtension, outType); - if (result == B_OK && outType == B_TRANSLATOR_BITMAP) + status_t result = BitsCheck(inSource, ioExtension, outType); + if (result == B_OK && outType == B_TRANSLATOR_BITMAP) { result = translate_from_bits_to_bits(inSource, outType, outDestination); - else if (result >= B_OK) + } else if (result >= B_OK) { // If NOT B_TRANSLATOR_BITMAP type it could be the derived format result = DerivedTranslate(inSource, inInfo, ioExtension, outType, outDestination, (result == B_OK)); - + } return result; } From stippi at mail.berlios.de Sun Nov 16 23:42:47 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:42:47 +0100 Subject: [Haiku-commits] r28675 - haiku/trunk/src/add-ons/translators/sgi Message-ID: <200811162242.mAGMglbk001023@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:42:47 +0100 (Sun, 16 Nov 2008) New Revision: 28675 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28675&view=rev Modified: haiku/trunk/src/add-ons/translators/sgi/SGIImage.cpp Log: Embed "Haiku" instead of "OpenBeOS" in created images. Modified: haiku/trunk/src/add-ons/translators/sgi/SGIImage.cpp =================================================================== --- haiku/trunk/src/add-ons/translators/sgi/SGIImage.cpp 2008-11-16 22:41:54 UTC (rev 28674) +++ haiku/trunk/src/add-ons/translators/sgi/SGIImage.cpp 2008-11-16 22:42:47 UTC (rev 28675) @@ -181,7 +181,7 @@ char name[80]; // Name of file in image header memset(name, 0, sizeof(name)); - sprintf(name, "OpenBeOS SGITranslator"); + sprintf(name, "Haiku SGITranslator"); fStream->Write(name, sizeof(name)); // fill the rest of the image header with zeros From stippi at mail.berlios.de Sun Nov 16 23:52:23 2008 From: stippi at mail.berlios.de (stippi at BerliOS) Date: Sun, 16 Nov 2008 23:52:23 +0100 Subject: [Haiku-commits] r28676 - haiku/trunk/src/kits/translation Message-ID: <200811162252.mAGMqNjQ002049@sheep.berlios.de> Author: stippi Date: 2008-11-16 23:52:22 +0100 (Sun, 16 Nov 2008) New Revision: 28676 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28676&view=rev Modified: haiku/trunk/src/kits/translation/TranslatorRoster.cpp Log: * Fixed wrong usage of Seek(). The return type is off_t, not status_t. It only worked because (status_t)B_OK == (off_t)0. * The translator_id version of Translate() does a (probably unnecessary?) Identify(), but then forgets to seek the source BPositionIO back to 0 before calling translator's Translate(). This was the reason for none of the WonderBrush Translation Kit export formats to work. Modified: haiku/trunk/src/kits/translation/TranslatorRoster.cpp =================================================================== --- haiku/trunk/src/kits/translation/TranslatorRoster.cpp 2008-11-16 22:42:47 UTC (rev 28675) +++ haiku/trunk/src/kits/translation/TranslatorRoster.cpp 2008-11-16 22:52:22 UTC (rev 28676) @@ -682,9 +682,9 @@ while (iterator != fTranslators.end()) { BTranslator& translator = *iterator->second.translator; - status_t status = source->Seek(0, SEEK_SET); - if (status != B_OK) - return status; + off_t pos = source->Seek(0, SEEK_SET); + if (pos != 0) + return pos < 0 ? (status_t)pos : B_IO_ERROR; int32 formatsCount = 0; const translation_format* formats = translator.InputFormats(&formatsCount); @@ -735,10 +735,10 @@ while (iterator != fTranslators.end()) { BTranslator& translator = *iterator->second.translator; - status_t status = source->Seek(0, SEEK_SET); - if (status < B_OK) { + off_t pos = source->Seek(0, SEEK_SET); + if (pos != 0) { delete[] array; - return status; + return pos < 0 ? status_t(pos) : B_IO_ERROR; } int32 formatsCount = 0; @@ -1516,7 +1516,10 @@ if (translator == NULL) return B_NO_TRANSLATOR; - status_t status = source->Seek(0, SEEK_SET); + status_t status = B_OK; + off_t pos = source->Seek(0, SEEK_SET); + if (pos != 0) + status = pos < 0 ? (status_t)pos : B_IO_ERROR; if (status == B_OK) { status = translator->Translate(source, info, ioExtension, wantOutType, destination); @@ -1565,15 +1568,22 @@ if (translator == NULL) return B_NO_TRANSLATOR; - status_t status = source->Seek(0, SEEK_SET); - if (status == B_OK) { + status_t status; + off_t pos = source->Seek(0, SEEK_SET); + if (pos == 0) { translator_info info; status = translator->Identify(source, NULL, ioExtension, &info, wantOutType); if (status >= B_OK) { - status = translator->Translate(source, &info, ioExtension, wantOutType, - destination); + off_t pos = source->Seek(0, SEEK_SET); + if (pos != 0) + status = pos < 0 ? (status_t)pos : B_IO_ERROR; + else { + status = translator->Translate(source, &info, ioExtension, wantOutType, + destination); + } } - } + } else + status = pos < 0 ? (status_t)pos : B_IO_ERROR; translator->Release(); return status; From anevilyak at gmail.com Sun Nov 16 23:56:37 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 16 Nov 2008 16:56:37 -0600 Subject: [Haiku-commits] r28671 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <200811162234.mAGMYCPf030837@sheep.berlios.de> References: <200811162234.mAGMYCPf030837@sheep.berlios.de> Message-ID: On Sun, Nov 16, 2008 at 4:34 PM, stippi at BerliOS wrote: > Author: stippi > Date: 2008-11-16 23:34:11 +0100 (Sun, 16 Nov 2008) > New Revision: 28671 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28671&view=rev > > Modified: > haiku/trunk/headers/os/interface/ListView.h > haiku/trunk/src/kits/interface/ListView.cpp > Log: > * The previous change to reorder item->Update() and _RecalcItemTops() obviously > broke everything. If the added item has no chance to calculate it's height, What regressions were you seeing specifically? I've been using that change for days and noticed absolutely no difference in listview behavior in any app I tried. And it was specifically intended to fix the listview in Themes that has all its items laid on top of each other. Regards, Rene From korli at mail.berlios.de Mon Nov 17 00:41:16 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 17 Nov 2008 00:41:16 +0100 Subject: [Haiku-commits] r28677 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200811162341.mAGNfG08021223@sheep.berlios.de> Author: korli Date: 2008-11-17 00:41:14 +0100 (Mon, 17 Nov 2008) New Revision: 28677 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28677&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp Log: added a mixer interface Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-11-16 22:52:22 UTC (rev 28676) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-11-16 23:41:14 UTC (rev 28677) @@ -40,8 +40,10 @@ #define MAX_CODEC_RESPONSES 10 #define MAX_INPUTS 32 #define MAX_IO_WIDGETS 8 +#define MAX_ASSOCIATIONS 16 +#define MAX_ASSOCIATION_PINS 16 -#define DEFAULT_FRAMES_PER_BUFFER 512 +#define DEFAULT_FRAMES_PER_BUFFER 2048 #define STREAM_MAX_BUFFERS 10 #define STREAM_MIN_BUFFERS 2 @@ -53,6 +55,7 @@ struct hda_codec; struct hda_stream; +struct hda_multi; /*! This structure describes a single HDA compliant controller. It contains a list of available streams @@ -215,13 +218,21 @@ struct { uint32 output; uint32 input; - pin_dev_type device; + uint32 config; } pin; } d; }; +struct hda_association { + uint32 index; + bool enabled; + uint32 pin_count; + uint32 pins[MAX_ASSOCIATION_PINS]; +}; + #define WIDGET_FLAG_OUTPUT_PATH 0x01 #define WIDGET_FLAG_INPUT_PATH 0x02 +#define WIDGET_FLAG_WIDGET_PATH 0x04 /*! This structure describes a single Audio Function Group. An AFG is a group of audio widgets which can be used to configure multiple @@ -246,7 +257,12 @@ uint32 input_amplifier_capabilities; uint32 output_amplifier_capabilities; + uint32 association_count; + hda_widget* widgets; + hda_association associations[MAX_ASSOCIATIONS]; + + hda_multi* multi; }; /*! This structure describes a single codec module in the @@ -274,6 +290,38 @@ }; +#define MULTI_CONTROL_FIRSTID 1024 +#define MULTI_CONTROL_MASTERID 0 +#define MULTI_MAX_CONTROLS 128 +#define MULTI_MAX_CHANNELS 128 + +struct hda_multi_mixer_control { + hda_multi *multi; + int32 nid; + int32 type; + bool input; + uint32 mute; + uint32 gain; + uint32 capabilities; + int32 index; + multi_mix_control mix_control; +}; + + +struct hda_multi { + hda_audio_group *group; + hda_multi_mixer_control controls[MULTI_MAX_CONTROLS]; + uint32 control_count; + + multi_channel_info chans[MULTI_MAX_CHANNELS]; + uint32 output_channel_count; + uint32 input_channel_count; + uint32 output_bus_channel_count; + uint32 input_bus_channel_count; + uint32 aux_bus_channel_count; +}; + + /* driver.c */ extern device_hooks gDriverHooks; extern pci_module_info* gPci; @@ -281,6 +329,8 @@ extern uint32 gNumCards; /* hda_codec.c */ +hda_widget* hda_audio_group_get_widget(hda_audio_group* audioGroup, uint32 nodeID); + status_t hda_audio_group_get_widgets(hda_audio_group* audioGroup, hda_stream* stream); hda_codec* hda_codec_new(hda_controller* controller, uint32 cad); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-16 22:52:22 UTC (rev 28676) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-16 23:41:14 UTC (rev 28677) @@ -65,7 +65,7 @@ static void dump_widget_audio_capabilities(uint32 capabilities) { - const struct { + static const struct { uint32 flag; const char* name; } kFlags[] = { @@ -114,7 +114,7 @@ } if (offset != 0) - dprintf("\tConnections: %s\n", buffer); + dprintf("\tInputs: %s\n", buffer); } @@ -264,9 +264,10 @@ } if ((resp[0] & STREAM_FLOAT) != 0) *formats |= B_FMT_FLOAT; + if ((resp[0] & STREAM_AC3) != 0) { + *formats |= B_FMT_BITSTREAM; + } -//FIXME: if (resp[0] & (1 << 2)) /* Sort out how to handle AC3 */; - return B_OK; } @@ -342,7 +343,7 @@ } -static hda_widget* +hda_widget* hda_audio_group_get_widget(hda_audio_group* audioGroup, uint32 nodeID) { if (audioGroup->widget_start > nodeID @@ -434,6 +435,40 @@ } +static status_t +hda_widget_get_associations(hda_audio_group* audioGroup) +{ + uint32 index = 0; + for (uint32 i = 0; i < MAX_ASSOCIATIONS; i++) { + for (uint32 j = 0; j < audioGroup->widget_count; j++) { + hda_widget& widget = audioGroup->widgets[j]; + + if (widget.type != WT_PIN_COMPLEX) + continue; + if (CONF_DEFAULT_ASSOCIATION(widget.d.pin.config) != i) + continue; + if (audioGroup->associations[index].pin_count == 0) { + audioGroup->associations[index].index = index; + audioGroup->associations[index].enabled = true; + } + uint32 sequence = CONF_DEFAULT_SEQUENCE(widget.d.pin.config); + if (audioGroup->associations[index].pins[sequence] != 0) { + audioGroup->associations[index].enabled = false; + } + audioGroup->associations[index].pins[sequence] = widget.node_id; + audioGroup->associations[index].pin_count++; + if (i == 15) + index++; + } + if (i != 15 && audioGroup->associations[index].pin_count != 0) + index++; + } + audioGroup->association_count = index; + + return B_OK; +} + + // #pragma mark - audio group functions @@ -534,13 +569,13 @@ verbs[0] = MAKE_VERB(audioGroup->codec->addr, nodeID, VID_GET_CONFIGURATION_DEFAULT, 0); if (hda_send_verbs(audioGroup->codec, verbs, resp, 1) == B_OK) { - widget.d.pin.device = (pin_dev_type) - ((resp[0] >> 20) & 0xf); - dprintf("\t%s, %s, %s, %s\n", - kPortConnector[resp[0] >> 30], - kDefaultDevice[widget.d.pin.device], - kConnectionType[(resp[0] >> 16) & 0xF], - kJackColor[(resp[0] >> 12) & 0xF]); + widget.d.pin.config = resp[0]; + dprintf("\t%s, %s, %s, %s, Association:%ld\n", + kPortConnector[CONF_DEFAULT_CONNECTIVITY(resp[0])], + kDefaultDevice[CONF_DEFAULT_DEVICE(resp[0])], + kConnectionType[CONF_DEFAULT_CONNTYPE(resp[0])], + kJackColor[CONF_DEFAULT_COLOR(resp[0])], + CONF_DEFAULT_ASSOCIATION(resp[0])); } break; @@ -558,6 +593,8 @@ dump_widget_inputs(widget); } + hda_widget_get_associations(audioGroup); + return B_OK; } @@ -619,13 +656,20 @@ switch (widget->type) { case WT_PIN_COMPLEX: - if (widget->d.pin.input - && (widget->d.pin.device == PIN_DEV_CD - || widget->d.pin.device == PIN_DEV_LINE_IN - || widget->d.pin.device == PIN_DEV_MIC_IN)) { - widget->flags |= WIDGET_FLAG_INPUT_PATH; + // already used + if (widget->flags & WIDGET_FLAG_INPUT_PATH) + return false; + + if (widget->d.pin.input) { + switch (CONF_DEFAULT_DEVICE(widget->d.pin.config)) { + case PIN_DEV_CD: + case PIN_DEV_LINE_IN: + case PIN_DEV_MIC_IN: + widget->flags |= WIDGET_FLAG_INPUT_PATH; dprintf(" %*sinput: added input widget %ld\n", (int)depth * 2, "", widget->node_id); - return true; + return true; + break; + } } return false; case WT_AUDIO_INPUT: @@ -670,12 +714,15 @@ for (uint32 i = 0; i < audioGroup->widget_count; i++) { hda_widget& widget = audioGroup->widgets[i]; - if (widget.type != WT_PIN_COMPLEX || !widget.d.pin.output - || (widget.d.pin.device != PIN_DEV_HEAD_PHONE_OUT - && widget.d.pin.device != PIN_DEV_SPEAKER - && widget.d.pin.device != PIN_DEV_LINE_OUT)) + if (widget.type != WT_PIN_COMPLEX || !widget.d.pin.output) continue; + int device = CONF_DEFAULT_DEVICE(widget.d.pin.config); + if (device != PIN_DEV_HEAD_PHONE_OUT + && device != PIN_DEV_SPEAKER + && device != PIN_DEV_LINE_OUT) + continue; + dprintf(" look at pin widget %ld (%ld inputs)\n", widget.node_id, widget.num_inputs); for (uint32 j = 0; j < widget.num_inputs; j++) { hda_widget* inputWidget = hda_audio_group_get_widget(audioGroup, @@ -792,7 +839,7 @@ if (audioGroup->record_stream != NULL) hda_stream_delete(audioGroup->record_stream); - + free(audioGroup->multi); free(audioGroup->widgets); free(audioGroup); } @@ -809,6 +856,11 @@ /* Setup minimal info needed by hda_codec_parse_afg */ audioGroup->root_node_id = audioGroupNodeID; audioGroup->codec = codec; + audioGroup->multi = (hda_multi*)calloc(1, + sizeof(hda_multi)); + if (audioGroup->multi == NULL) + return B_NO_MEMORY; + audioGroup->multi->group = audioGroup; /* Parse all widgets in Audio Function Group */ status_t status = hda_codec_parse_audio_group(audioGroup); @@ -878,8 +930,9 @@ hda_send_verbs(audioGroup->codec, &verb, NULL, 1); } - if (widget.capabilities.output_amplifier != 0) { -dprintf("UNMUTE/SET GAIN widget %ld (offset %ld)\n", widget.node_id, + if (widget.capabilities.output_amplifier != 0 + && widget.flags & WIDGET_FLAG_OUTPUT_PATH) { +dprintf("UNMUTE/SET OUTPUT GAIN widget %ld (offset %ld)\n", widget.node_id, widget.capabilities.output_amplifier & AMP_CAP_OFFSET_MASK); uint32 verb = MAKE_VERB(audioGroup->codec->addr, widget.node_id, @@ -890,6 +943,19 @@ & AMP_CAP_OFFSET_MASK)); hda_send_verbs(audioGroup->codec, &verb, NULL, 1); } + if (widget.capabilities.input_amplifier != 0 + && widget.flags & WIDGET_FLAG_INPUT_PATH) { +dprintf("UNMUTE/SET INPUT GAIN widget %ld (offset %ld)\n", widget.node_id, + widget.capabilities.output_amplifier & AMP_CAP_OFFSET_MASK); + uint32 verb = MAKE_VERB(audioGroup->codec->addr, + widget.node_id, + VID_SET_AMPLIFIER_GAIN_MUTE, + AMP_SET_INPUT | AMP_SET_LEFT_CHANNEL + | AMP_SET_RIGHT_CHANNEL + | (widget.capabilities.input_amplifier + & AMP_CAP_OFFSET_MASK)); + hda_send_verbs(audioGroup->codec, &verb, NULL, 1); + } } if (widget.type != type || (widget.flags & flags) == 0 Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h 2008-11-16 22:52:22 UTC (rev 28676) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h 2008-11-16 23:41:14 UTC (rev 28677) @@ -21,6 +21,12 @@ WT_VENDOR_DEFINED = 15 }; +enum pin_connectivity_type { + PIN_CONN_JACK, + PIN_CONN_NONE, + PIN_CONN_FIXED, + PIN_CONN_BOTH +}; enum pin_dev_type { PIN_DEV_LINE_OUT = 0, @@ -163,6 +169,12 @@ #define AMP_CAP_NUM_STEPS_SHIFT 8 #define AMP_CAP_OFFSET_MASK 0x0000007f +#define AMP_CAP_STEP_SIZE(c) ((((c & AMP_CAP_STEP_SIZE_MASK) \ + >> AMP_CAP_STEP_SIZE_SHIFT) + 1) / 4.0) +#define AMP_CAP_NUM_STEPS(c) ((c & AMP_CAP_NUM_STEPS_MASK) \ + >> AMP_CAP_NUM_STEPS_SHIFT) +#define AMP_CAP_OFFSET(c) (c & AMP_CAP_OFFSET_MASK) + /* Pin capabilities */ #define PIN_CAP_IMP_SENSE (1L << 0) #define PIN_CAP_TRIGGER_REQ (1L << 1) @@ -171,6 +183,12 @@ #define PIN_CAP_OUT (1L << 4) #define PIN_CAP_IN (1L << 5) #define PIN_CAP_BALANCE (1L << 6) +#define PIN_CAP_VREF_CTRL_HIZ (1L << 8) +#define PIN_CAP_VREF_CTRL_50 (1L << 9) +#define PIN_CAP_VREF_CTRL_GROUND (1L << 10) +#define PIN_CAP_VREF_CTRL_80 (1L << 12) +#define PIN_CAP_VREF_CTRL_100 (1L << 13) +#define PIN_CAP_EAPD_CAP (1L << 16) /* PCM support */ #define PCM_8_BIT (1L << 16) @@ -192,6 +210,8 @@ #define AMP_GET_INPUT_INDEX_MASK 0x0000000f #define AMP_GET_INPUT_INDEX_SHIFT 0 +#define AMP_GET_INPUT_INDEX(x) ((x << AMP_GET_INPUT_INDEX_SHIFT) & AMP_GET_INPUT_INDEX_MASK) + #define AMP_SET_OUTPUT (1L << 15) #define AMP_SET_INPUT (1L << 14) #define AMP_SET_LEFT_CHANNEL (1L << 13) @@ -199,8 +219,10 @@ #define AMP_SET_INPUT_INDEX_MASK 0x00000f00 #define AMP_SET_INPUT_INDEX_SHIFT 8 +#define AMP_SET_INPUT_INDEX(x) ((x << AMP_SET_INPUT_INDEX_SHIFT) & AMP_SET_INPUT_INDEX_MASK) + #define AMP_GAIN_MASK 0x0000007f -#define AMP_MUTE (1L << 8) +#define AMP_MUTE (1L << 7) /* Pin Widget Control */ #define PIN_ENABLE_HEAD_PHONE (1L << 7) @@ -214,4 +236,31 @@ #define POWER_STATE_D2 (1L << 2) #define POWER_STATE_D3 (1L << 3) +/* Configuration default */ +#define CONF_DEFAULT_SEQUENCE_MASK 0x0000000f +#define CONF_DEFAULT_SEQUENCE_SHIFT 0 +#define CONF_DEFAULT_ASSOCIATION_MASK 0x000000f0 +#define CONF_DEFAULT_ASSOCIATION_SHIFT 4 +#define CONF_DEFAULT_MISC_MASK 0x00000f00 +#define CONF_DEFAULT_MISC_SHIFT 8 +#define CONF_DEFAULT_COLOR_MASK 0x0000f000 +#define CONF_DEFAULT_COLOR_SHIFT 12 +#define CONF_DEFAULT_CONNTYPE_MASK 0x000f0000 +#define CONF_DEFAULT_CONNTYPE_SHIFT 16 +#define CONF_DEFAULT_DEVICE_MASK 0x00f00000 +#define CONF_DEFAULT_DEVICE_SHIFT 20 +#define CONF_DEFAULT_LOCATION_MASK 0x3f000000 +#define CONF_DEFAULT_LOCATION_SHIFT 24 +#define CONF_DEFAULT_CONNECTIVITY_MASK 0xc0000000 +#define CONF_DEFAULT_CONNECTIVITY_SHIFT 30 + +#define CONF_DEFAULT_SEQUENCE(c) ((c & CONF_DEFAULT_SEQUENCE_MASK) >> CONF_DEFAULT_SEQUENCE_SHIFT) +#define CONF_DEFAULT_ASSOCIATION(c) ((c & CONF_DEFAULT_ASSOCIATION_MASK) >> CONF_DEFAULT_ASSOCIATION_SHIFT) +#define CONF_DEFAULT_MISC(c) ((c & CONF_DEFAULT_MISC_MASK) >> CONF_DEFAULT_MISC_SHIFT) +#define CONF_DEFAULT_COLOR(c) ((c & CONF_DEFAULT_COLOR_MASK) >> CONF_DEFAULT_COLOR_SHIFT) +#define CONF_DEFAULT_CONNTYPE(c) ((c & CONF_DEFAULT_CONNTYPE_MASK) >> CONF_DEFAULT_CONNTYPE_SHIFT) +#define CONF_DEFAULT_DEVICE(c) ((c & CONF_DEFAULT_DEVICE_MASK) >> CONF_DEFAULT_DEVICE_SHIFT) +#define CONF_DEFAULT_LOCATION(c) ((c & CONF_DEFAULT_LOCATION_MASK) >> CONF_DEFAULT_LOCATION_SHIFT) +#define CONF_DEFAULT_CONNECTIVITY(c) ((c & CONF_DEFAULT_CONNECTIVITY_MASK) >> CONF_DEFAULT_CONNECTIVITY_SHIFT) + #endif /* HDA_CODEC_H */ Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2008-11-16 22:52:22 UTC (rev 28676) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2008-11-16 23:41:14 UTC (rev 28677) @@ -438,7 +438,8 @@ return stream; } - dprintf("hda: hda_audio_group_get_widgets failed\n"); + dprintf("hda: hda_audio_group_get_widgets failed for %s stream\n", + type == STREAM_PLAYBACK ? " playback" : "record"); free(stream); return NULL; @@ -607,8 +608,8 @@ } } - dprintf("IRA: %s: setup stream %ld: SR=%ld, SF=%ld\n", __func__, stream->id, - stream->rate, stream->bps); + dprintf("IRA: %s: setup stream %ld: SR=%ld, SF=%ld F=0x%x\n", __func__, stream->id, + stream->rate, stream->bps, format); stream->Write16(HDAC_STREAM_FORMAT, format); stream->Write32(HDAC_STREAM_BUFFERS_BASE_LOWER, @@ -633,12 +634,10 @@ verb[0] = MAKE_VERB(codec->addr, stream->io_widgets[i], VID_SET_CONVERTER_FORMAT, format); uint32 val = stream->id << 4; - if (stream->type == STREAM_RECORD) { - if (channelNum < stream->num_channels) - val |= channelNum; - else - val = 0; - } + if (channelNum < stream->num_channels) + val |= channelNum; + else + val = 0; verb[1] = MAKE_VERB(codec->addr, stream->io_widgets[i], VID_SET_CONVERTER_STREAM_CHANNEL, val); hda_send_verbs(codec, verb, response, 2); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2008-11-16 22:52:22 UTC (rev 28676) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2008-11-16 23:41:14 UTC (rev 28677) @@ -8,7 +8,7 @@ */ -#include "multi_audio.h" +#include "hmulti_audio.h" #include "driver.h" @@ -16,13 +16,19 @@ # undef TRACE #endif +//#define TRACE_MULTI_AUDIO #ifdef TRACE_MULTI_AUDIO # define TRACE(a...) dprintf("\33[34mhda:\33[0m " a) #else # define TRACE(a...) ; #endif +typedef enum { + B_MIX_GAIN = 1 << 0, + B_MIX_MUTE = 1 << 1 +} mixer_type; + static multi_channel_info sChannels[] = { { 0, B_MULTI_OUTPUT_CHANNEL, B_CHANNEL_LEFT | B_CHANNEL_STEREO_BUS, 0 }, { 1, B_MULTI_OUTPUT_CHANNEL, B_CHANNEL_RIGHT | B_CHANNEL_STEREO_BUS, 0 }, @@ -185,10 +191,278 @@ } +static int32 +hda_create_group_control(hda_multi *multi, uint32 *index, int32 parent, + enum strind_id string, const char* name) { + uint32 i = *index; + (*index)++; + multi->controls[i].mix_control.id = MULTI_CONTROL_FIRSTID + i; + multi->controls[i].mix_control.parent = parent; + multi->controls[i].mix_control.flags = B_MULTI_MIX_GROUP; + multi->controls[i].mix_control.master = MULTI_CONTROL_MASTERID; + multi->controls[i].mix_control.string = string; + if (name) + strcpy(multi->controls[i].mix_control.name, name); + + return multi->controls[i].mix_control.id; +} + + +static void +hda_create_channel_control(hda_multi *multi, uint32 *index, int32 parent, int32 string, + hda_widget& widget, bool input, uint32 capabilities, int32 inputIndex) { + uint32 i = *index, id; + hda_multi_mixer_control control; + + control.nid = widget.node_id; + control.input = input; + control.mute = 0; + control.gain = 0; + control.capabilities = capabilities; + control.index = inputIndex; + control.mix_control.master = MULTI_CONTROL_MASTERID; + control.mix_control.parent = parent; + + if (AMP_CAP_NUM_STEPS(capabilities) >= 1) { + control.mix_control.gain.granularity = AMP_CAP_STEP_SIZE(capabilities); + control.mix_control.gain.min_gain = (0.0 - AMP_CAP_OFFSET(capabilities)) + * control.mix_control.gain.granularity; + control.mix_control.gain.max_gain = (AMP_CAP_NUM_STEPS(capabilities) - AMP_CAP_OFFSET(capabilities)) + * control.mix_control.gain.granularity; + + control.mix_control.id = MULTI_CONTROL_FIRSTID + i; + control.mix_control.flags = B_MULTI_MIX_GAIN; + control.mix_control.string = S_null; + control.type = B_MIX_GAIN; + strcpy(control.mix_control.name, "Gain"); + multi->controls[i++] = control; + id = control.mix_control.id; + + // second channel + control.mix_control.id = MULTI_CONTROL_FIRSTID + i; + control.mix_control.master = id; + multi->controls[i++] = control; + TRACE("control nid %ld %f min %f max %f\n", control.nid, control.mix_control.gain.granularity, + control.mix_control.gain.min_gain, control.mix_control.gain.max_gain); + + } + + if (capabilities & AMP_CAP_MUTE) { + control.mix_control.id = MULTI_CONTROL_FIRSTID + i; + control.mix_control.flags = B_MULTI_MIX_ENABLE; + control.mix_control.string = S_MUTE; + control.type = B_MIX_MUTE; + multi->controls[i++] = control; + TRACE("control nid %ld mute\n", control.nid); + } + + *index = i; +} + + +static enum strind_id +hda_find_multi_string(hda_widget& widget) +{ + switch (CONF_DEFAULT_DEVICE(widget.d.pin.config)) { + case PIN_DEV_CD: + return S_CD; + case PIN_DEV_LINE_IN: + case PIN_DEV_LINE_OUT: + return S_LINE; + case PIN_DEV_MIC_IN: + return S_MIC; + case PIN_DEV_AUX: + return S_AUX; + case PIN_DEV_SPDIF_IN: + case PIN_DEV_SPDIF_OUT: + return S_SPDIF; + case PIN_DEV_HEAD_PHONE_OUT: + return S_HEADPHONE; + } + return S_null; +} + +static const char * +hda_find_multi_custom_string(hda_widget& widget) +{ + switch (CONF_DEFAULT_DEVICE(widget.d.pin.config)) { + case PIN_DEV_LINE_IN: + case PIN_DEV_LINE_OUT: + switch (CONF_DEFAULT_COLOR(widget.d.pin.config)) { + case 1: + return "Analog Rear"; + case 2: + return "Analog Side"; + case 3: + return "Line In"; + case 4: + return "Analog Front"; + case 6: + return "Digital SPDIF"; + case 9: + return "Mic in"; + } + break; + case PIN_DEV_SPDIF_IN: + return "SPDIF In"; + case PIN_DEV_SPDIF_OUT: + return "SPDIF Out"; + case PIN_DEV_CD: + return "CD"; + case PIN_DEV_HEAD_PHONE_OUT: + return "Headphones"; + } + return NULL; +} + + static status_t -list_mix_controls(hda_audio_group* audioGroup, multi_mix_control_info* data) +hda_create_controls_list(hda_multi *multi) +{ + uint32 index = 0, parent, parent2; + hda_audio_group *audioGroup = multi->group; + + parent = hda_create_group_control(multi, &index, 0, S_OUTPUT, NULL); + + for (uint32 i = 0; i < audioGroup->widget_count; i++) { + hda_widget& complex = audioGroup->widgets[i]; + + if (complex.type != WT_PIN_COMPLEX) + continue; + if (!complex.d.pin.output) + continue; + + TRACE("create complex nid %lu\n", complex.node_id); + + hda_widget &widget = * hda_audio_group_get_widget(audioGroup, complex.inputs[complex.active_input]); + + if (widget.type != WT_AUDIO_MIXER) + continue; + if (widget.flags & WIDGET_FLAG_WIDGET_PATH) + continue; + + TRACE(" create widget nid %lu\n", widget.node_id); + + uint32 capabilities = widget.capabilities.output_amplifier; + if (AMP_CAP_NUM_STEPS(capabilities) >= 1) { + + parent2 = hda_create_group_control(multi, &index, + parent, S_null, hda_find_multi_custom_string(complex)); + hda_create_channel_control(multi, &index, parent2, 0, + widget, false, capabilities, 0); + + if ((widget.capabilities.input_amplifier & AMP_CAP_MUTE) + && (AMP_CAP_NUM_STEPS(widget.capabilities.input_amplifier) < 1) + && ((capabilities & AMP_CAP_MUTE) == 0)) { + hda_create_channel_control(multi, &index, parent2, 0, + widget, true, widget.capabilities.input_amplifier, 0); + widget.flags |= WIDGET_FLAG_WIDGET_PATH; + continue; + } + } + + if (AMP_CAP_NUM_STEPS(widget.capabilities.input_amplifier) >= 1) { + + for (uint32 j = 0; j < widget.num_inputs; j++) { + TRACE(" create widget input nid %lu\n", widget.inputs[j]); + parent2 = hda_create_group_control(multi, &index, + parent, hda_find_multi_string(widget), "Output"); + hda_create_channel_control(multi, &index, parent2, 0, + widget, true, widget.capabilities.input_amplifier, j); + } + } + + widget.flags |= WIDGET_FLAG_WIDGET_PATH; + } + + for (uint32 i = 0; i < audioGroup->widget_count; i++) { + hda_widget& widget = audioGroup->widgets[i]; + + if (widget.type != WT_AUDIO_MIXER) + continue; + if (widget.flags & WIDGET_FLAG_WIDGET_PATH) + continue; + + TRACE("create widget nid %lu\n", widget.node_id); + + uint32 capabilities = widget.capabilities.output_amplifier; + if (AMP_CAP_NUM_STEPS(capabilities) >= 1) { + + parent2 = hda_create_group_control(multi, &index, + parent, hda_find_multi_string(widget), "Output"); + hda_create_channel_control(multi, &index, parent2, 0, + widget, false, capabilities, 0); + + if ((widget.capabilities.input_amplifier & AMP_CAP_MUTE) + && (AMP_CAP_NUM_STEPS(widget.capabilities.input_amplifier) < 1) + && ((capabilities & AMP_CAP_MUTE) == 0)) { + hda_create_channel_control(multi, &index, parent2, 0, + widget, true, widget.capabilities.input_amplifier, 0); + widget.flags |= WIDGET_FLAG_WIDGET_PATH; + continue; + } + } + + if (AMP_CAP_NUM_STEPS(widget.capabilities.input_amplifier) >= 1) { + + for (uint32 j = 0; j < widget.num_inputs; j++) { + hda_widget *complex = hda_audio_group_get_widget(audioGroup, widget.inputs[j]); + if (complex->type != WT_PIN_COMPLEX) + continue; + if (!complex->d.pin.output) + continue; + TRACE(" create widget input nid %lu\n", widget.inputs[j]); + parent2 = hda_create_group_control(multi, &index, + parent, S_null, hda_find_multi_custom_string(*complex)); + hda_create_channel_control(multi, &index, parent2, 0, + widget, true, widget.capabilities.input_amplifier, j); + } + } + + widget.flags |= WIDGET_FLAG_WIDGET_PATH; + } + + parent = hda_create_group_control(multi, &index, 0, S_INPUT, NULL); + + for (uint32 i = 0; i < audioGroup->widget_count; i++) { + hda_widget& widget = audioGroup->widgets[i]; + + if (widget.type != WT_AUDIO_INPUT) + continue; + + uint32 capabilities = widget.capabilities.input_amplifier; + if (AMP_CAP_NUM_STEPS(capabilities) < 1) + continue; + + parent2 = hda_create_group_control(multi, &index, + parent, hda_find_multi_string(widget), "Input"); + hda_create_channel_control(multi, &index, parent2, 0, + widget, true, capabilities, 0); + } + + multi->control_count = index; + TRACE("multi->control_count %lu\n", multi->control_count); + return B_OK; +} + + +static status_t +list_mix_controls(hda_audio_group* audioGroup, multi_mix_control_info* MMCI) { - data->control_count = 0; + multi_mix_control *MMC; + uint32 i; + + MMC = MMCI->controls; + if (MMCI->control_count < 24) + return B_ERROR; + + if (hda_create_controls_list(audioGroup->multi) < B_OK) + return B_ERROR; + for (i=0; imulti->control_count; i++) { + MMC[i] = audioGroup->multi->controls[i].mix_control; + } + + MMCI->control_count = audioGroup->multi->control_count; return B_OK; } @@ -209,6 +483,188 @@ } +static void +get_control_gain_mute(hda_audio_group* audioGroup, hda_multi_mixer_control *control, uint32 *resp) +{ + uint32 verb[2]; + verb[0] = MAKE_VERB(audioGroup->codec->addr, + control->nid, + VID_GET_AMPLIFIER_GAIN_MUTE, + (control->input ? AMP_GET_INPUT : AMP_GET_OUTPUT) + | AMP_GET_LEFT_CHANNEL | AMP_GET_INPUT_INDEX(control->index)); + verb[1] = MAKE_VERB(audioGroup->codec->addr, + control->nid, + VID_GET_AMPLIFIER_GAIN_MUTE, + (control->input ? AMP_GET_INPUT : AMP_GET_OUTPUT) + | AMP_GET_RIGHT_CHANNEL | AMP_GET_INPUT_INDEX(control->index)); + hda_send_verbs(audioGroup->codec, verb, resp, 2); +} + + +static status_t +get_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI) +{ + int32 i; + uint32 id; + hda_multi_mixer_control *control = NULL; + for (i=0; i < MMVI->item_count; i++) { + id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; + if (id < 0 || id >= audioGroup->multi->control_count) { + dprintf("hda: get_mix : invalid control id requested : %li\n", id); + continue; + } + control = &audioGroup->multi->controls[id]; + + if (control->mix_control.flags & (B_MULTI_MIX_GAIN | B_MULTI_MIX_ENABLE)) { + uint32 resp[2]; + get_control_gain_mute(audioGroup, control, resp); + if (control->mix_control.flags & B_MULTI_MIX_ENABLE) { + MMVI->values[i].enable = (resp[0] & AMP_MUTE) != 0; + TRACE("get_mix: %ld mute: %d\n", control->nid, MMVI->values[i].enable); + } else if (control->mix_control.flags & B_MULTI_MIX_GAIN) { + uint32 value; + if (control->mix_control.master == MULTI_CONTROL_MASTERID) + value = resp[0] & AMP_GAIN_MASK; + else + value = resp[1] & AMP_GAIN_MASK; + MMVI->values[i].gain = (value - AMP_CAP_OFFSET(control->capabilities)) + * AMP_CAP_STEP_SIZE(control->capabilities); + TRACE("get_mix: %ld gain: %f (%ld)\n", control->nid, MMVI->values[i].gain, value); + } + + + } + + /*if (control->mix_control.flags & B_MULTI_MIX_MUX && control->get) { + float values[1]; + control->get(audioGroup, control, values); + MMVI->values[i].mux = (int32)values[0]; + }*/ + } + return B_OK; +} + + +static status_t +set_mix(hda_audio_group* audioGroup, multi_mix_value_info * MMVI) +{ + int32 i; + uint32 id; + hda_multi_mixer_control *control = NULL; + for (i=0; i < MMVI->item_count; i++) { + id = MMVI->values[i].id - MULTI_CONTROL_FIRSTID; + if (id < 0 || id >= audioGroup->multi->control_count) { + dprintf("set_mix : invalid control id requested : %li\n", id); + continue; + } + control = &audioGroup->multi->controls[id]; + + if (control->mix_control.flags & B_MULTI_MIX_ENABLE) { + control->mute = (MMVI->values[i].enable ? AMP_MUTE : 0); + TRACE("set_mix: %ld mute: %lx\n", control->nid, control->mute); + uint32 resp[2]; + get_control_gain_mute(audioGroup, control, resp); + + uint32 verb[2]; + verb[0] = MAKE_VERB(audioGroup->codec->addr, + control->nid, + VID_SET_AMPLIFIER_GAIN_MUTE, + (control->input ? AMP_SET_INPUT : AMP_SET_OUTPUT) + | AMP_SET_LEFT_CHANNEL + | AMP_SET_INPUT_INDEX(control->index) + | control->mute + | resp[0] & AMP_GAIN_MASK); + TRACE("set_mix: sending verb to %ld: %lx %lx %x %lx\n", control->nid, + control->mute, resp[0] & AMP_GAIN_MASK, control->input, + (control->input ? AMP_SET_INPUT : AMP_SET_OUTPUT) + | AMP_SET_LEFT_CHANNEL + | AMP_SET_INPUT_INDEX(control->index) + | control->mute + | resp[0] & AMP_GAIN_MASK); + verb[1] = MAKE_VERB(audioGroup->codec->addr, + control->nid, + VID_SET_AMPLIFIER_GAIN_MUTE, + (control->input ? AMP_SET_INPUT : AMP_SET_OUTPUT) + | AMP_SET_RIGHT_CHANNEL + | AMP_SET_INPUT_INDEX(control->index) + | control->mute + | resp[1] & AMP_GAIN_MASK); + TRACE("set_mix: ctrl2 sending verb to %ld: %lx %lx %x\n", control->nid, + control->mute, resp[1] & AMP_GAIN_MASK, control->input); + hda_send_verbs(audioGroup->codec, verb, NULL, 2); + } else if (control->mix_control.flags & B_MULTI_MIX_GAIN) { + hda_multi_mixer_control *control2 = NULL; + if (i+1item_count) { + id = MMVI->values[i + 1].id - MULTI_CONTROL_FIRSTID; + if (id < 0 || id >= audioGroup->multi->control_count) { + dprintf("set_mix : invalid control id requested : %li\n", id); + } else { + control2 = &audioGroup->multi->controls[id]; + if (control2->mix_control.master != control->mix_control.id) + control2 = NULL; + } + } + + if (control->mix_control.master == MULTI_CONTROL_MASTERID) + control->gain = (uint32)(MMVI->values[i].gain / AMP_CAP_STEP_SIZE(control->capabilities) + + AMP_CAP_OFFSET(control->capabilities)); + + if (control2 && control2->mix_control.master != MULTI_CONTROL_MASTERID) + control2->gain = (uint32)(MMVI->values[i+1].gain / AMP_CAP_STEP_SIZE(control2->capabilities) + + AMP_CAP_OFFSET(control2->capabilities)); + TRACE("set_mix: %ld gain: %lx and %ld gain: %lx\n", + control->nid, control->gain, control2->nid, control2->gain); + uint32 resp[2]; + get_control_gain_mute(audioGroup, control, resp); + control->mute = resp[0] & AMP_MUTE; + if (control2) + control2->mute = resp[1] & AMP_MUTE; + + uint32 verb[2]; + verb[0] = MAKE_VERB(audioGroup->codec->addr, + control->nid, + VID_SET_AMPLIFIER_GAIN_MUTE, + (control->input ? AMP_SET_INPUT : AMP_SET_OUTPUT) + | AMP_SET_LEFT_CHANNEL + | AMP_SET_INPUT_INDEX(control->index) + | (control->mute & AMP_MUTE) + | (control->gain & AMP_GAIN_MASK)); + TRACE("set_mix: sending verb to %ld: %lx %lx %x %lx\n", control->nid, + control->mute, control->gain, control->input, + (control->input ? AMP_SET_INPUT : AMP_SET_OUTPUT) + | AMP_SET_LEFT_CHANNEL + | AMP_SET_INPUT_INDEX(control->index) + | (control->mute & AMP_MUTE) + | (control->gain & AMP_GAIN_MASK)); + if (control2) { + verb[1] = MAKE_VERB(audioGroup->codec->addr, + control2->nid, + VID_SET_AMPLIFIER_GAIN_MUTE, + (control->input ? AMP_SET_INPUT : AMP_SET_OUTPUT) + | AMP_SET_RIGHT_CHANNEL + | AMP_SET_INPUT_INDEX(control->index) + | (control2->mute & AMP_MUTE) + | (control2->gain & AMP_GAIN_MASK)); + TRACE("set_mix: ctrl2 sending verb to %ld: %lx %lx %x\n", control2->nid, + control2->mute, control2->gain, control2->input); + } + hda_send_verbs(audioGroup->codec, verb, NULL, control2 ? 2 : 1); + + if (control2) + i++; + } + + /*if (control->mix_control.flags & B_MULTI_MIX_MUX && control->set) { + float values[1]; + + values[0] = (float)MMVI->values[i].mux; + control->set(card, control->channel, control->type, values); + }*/ + } + return B_OK; +} + + static status_t get_buffers(hda_audio_group* audioGroup, multi_buffer_list* data) { @@ -455,6 +911,11 @@ case B_MULTI_LIST_MIX_CONNECTIONS: return list_mix_connections(audioGroup, (multi_mix_connection_info*)arg); + case B_MULTI_GET_MIX: + return get_mix(audioGroup, (multi_mix_value_info *)arg); + case B_MULTI_SET_MIX: + return set_mix(audioGroup, (multi_mix_value_info *)arg); + case B_MULTI_GET_BUFFERS: return get_buffers(audioGroup, (multi_buffer_list*)arg); @@ -468,8 +929,6 @@ case B_MULTI_GET_EVENT: case B_MULTI_GET_CHANNEL_FORMATS: case B_MULTI_SET_CHANNEL_FORMATS: - case B_MULTI_GET_MIX: - case B_MULTI_SET_MIX: case B_MULTI_SET_BUFFERS: case B_MULTI_SET_START_TIME: return B_ERROR; From anevilyak at mail.berlios.de Mon Nov 17 01:47:24 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 17 Nov 2008 01:47:24 +0100 Subject: [Haiku-commits] r28678 - haiku/trunk/src/kits/interface Message-ID: <200811170047.mAH0lOXZ009651@sheep.berlios.de> Author: anevilyak Date: 2008-11-17 01:47:23 +0100 (Mon, 17 Nov 2008) New Revision: 28678 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28678&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp Log: Resolved a small todo thanks to r28664: We now ask the app_server for the window tab's height instead of hardcoding it. Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-11-16 23:41:14 UTC (rev 28677) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-11-17 00:47:23 UTC (rev 28678) @@ -1530,12 +1530,17 @@ The dimensions that non-virtual Zoom() passes to hook Zoom() are deduced from the smallest of three rectangles: */ - - // TODO: make more elaborate (figure out this window's - // tab height and border width... maybe ask app_server) + + // fallback in case retrieving the decorator settings fails (highly unlikely) float borderWidth = 5.0; float tabHeight = 26.0; - + BMessage settings; + if (GetDecoratorSettings(&settings) == B_OK) { + BRect tabRect; + if (settings.FindRect("tab frame", &tabRect) == B_OK) + tabHeight = tabRect.Height(); + } + // 1) the rectangle defined by SetZoomLimits(), float zoomedWidth = fMaxZoomWidth; float zoomedHeight = fMaxZoomHeight; From anevilyak at gmail.com Mon Nov 17 01:41:26 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Sun, 16 Nov 2008 18:41:26 -0600 Subject: [Haiku-commits] r28664 - in haiku/trunk: headers/private/app src/servers/app In-Reply-To: <200811162159.mAGLx7EN015252@sheep.berlios.de> References: <200811162159.mAGLx7EN015252@sheep.berlios.de> Message-ID: On Sun, Nov 16, 2008 at 3:59 PM, axeld at BerliOS wrote: > * Added a Desktop::BroadcastToAllWindows() method that sends all ServerWindows > a message. > * The DesktopSettings class is now using that to send the new > AS_SYSTEM_FONT_CHANGED message to all windows. > * The ServerWindow now propagates font changes to its decorator, causing it > to update its drawing. That means changing the bold font in the "Fonts" > preferences application will instantly change all window titles. Would it be feasible to do something similar to broadcast such changes client-side? That'd make it possible to implement something similar to Dano's UISettingsChanged() hook to allow controls and apps to react dynamically to sys color and font changes. Nice change in any case! Regards, Rene From anevilyak at mail.berlios.de Mon Nov 17 05:15:55 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Mon, 17 Nov 2008 05:15:55 +0100 Subject: [Haiku-commits] r28679 - in haiku/trunk/src: kits/interface servers/app Message-ID: <200811170415.mAH4FtQ4003789@sheep.berlios.de> Author: anevilyak Date: 2008-11-17 05:15:51 +0100 (Mon, 17 Nov 2008) New Revision: 28679 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28679&view=rev Modified: haiku/trunk/src/kits/interface/Window.cpp haiku/trunk/src/servers/app/DefaultDecorator.cpp Log: The previous commit exposed another bug: BWindow::Zoom() incorrectly calculated the max height of the window by only including the border width once. This was previously masked by the fact that the (by default 5) extra pixels were included in its hardcoded default for the height of the tab. Also add the border width to the message returned by GetDecoratorSettings() so Zoom can use the actual value instead of hardcoding it. Modified: haiku/trunk/src/kits/interface/Window.cpp =================================================================== --- haiku/trunk/src/kits/interface/Window.cpp 2008-11-17 00:47:23 UTC (rev 28678) +++ haiku/trunk/src/kits/interface/Window.cpp 2008-11-17 04:15:51 UTC (rev 28679) @@ -1533,12 +1533,13 @@ // fallback in case retrieving the decorator settings fails (highly unlikely) float borderWidth = 5.0; - float tabHeight = 26.0; + float tabHeight = 21.0; BMessage settings; if (GetDecoratorSettings(&settings) == B_OK) { BRect tabRect; if (settings.FindRect("tab frame", &tabRect) == B_OK) tabHeight = tabRect.Height(); + settings.FindFloat("border width", &borderWidth); } // 1) the rectangle defined by SetZoomLimits(), @@ -1554,13 +1555,13 @@ // 3) the screen rectangle BScreen screen(this); float screenWidth = screen.Frame().Width() - 2 * borderWidth; - float screenHeight = screen.Frame().Height() - (borderWidth + tabHeight); + float screenHeight = screen.Frame().Height() - (2 * borderWidth + tabHeight); if (screenWidth < zoomedWidth) zoomedWidth = screenWidth; if (screenHeight < zoomedHeight) zoomedHeight = screenHeight; - BPoint zoomedLeftTop = screen.Frame().LeftTop() + BPoint(borderWidth, tabHeight); + BPoint zoomedLeftTop = screen.Frame().LeftTop() + BPoint(borderWidth, tabHeight + borderWidth); // UN-ZOOM: if (fPreviousFrame.IsValid() Modified: haiku/trunk/src/servers/app/DefaultDecorator.cpp =================================================================== --- haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-11-17 00:47:23 UTC (rev 28678) +++ haiku/trunk/src/servers/app/DefaultDecorator.cpp 2008-11-17 04:15:51 UTC (rev 28679) @@ -449,6 +449,9 @@ if (settings->AddRect("tab frame", fTabRect) != B_OK) return false; + if (settings->AddFloat("border width", fBorderWidth) != B_OK) + return false; + return settings->AddFloat("tab location", (float)fTabOffset) == B_OK; } From leavengood at mail.berlios.de Mon Nov 17 06:09:09 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Mon, 17 Nov 2008 06:09:09 +0100 Subject: [Haiku-commits] r28680 - haiku/trunk/src/data/beos_mime/image Message-ID: <200811170509.mAH599pD018927@sheep.berlios.de> Author: leavengood Date: 2008-11-17 06:09:07 +0100 (Mon, 17 Nov 2008) New Revision: 28680 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28680&view=rev Added: haiku/trunk/src/data/beos_mime/image/sgi haiku/trunk/src/data/beos_mime/image/x-portable-pixmap Log: Bug #3045: Added MIME types for SGI and PPM images, which we have translators for. This allows snippets from ShowImage made in these formats to be opened. Added: haiku/trunk/src/data/beos_mime/image/sgi =================================================================== --- haiku/trunk/src/data/beos_mime/image/sgi 2008-11-17 04:15:51 UTC (rev 28679) +++ haiku/trunk/src/data/beos_mime/image/sgi 2008-11-17 05:09:07 UTC (rev 28680) @@ -0,0 +1,13 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "image/sgi"; + +resource(2, "META:SNIFF_RULE") "0.50 (\"\\001\\332")"; + +resource(3, "META:S:DESC") #'MSDC' "SGI Image"; + +resource(4, "META:EXTENS") message(234) { + "extensions" = "sgi", + "type" = "image/sgi" +}; Added: haiku/trunk/src/data/beos_mime/image/x-portable-pixmap =================================================================== --- haiku/trunk/src/data/beos_mime/image/x-portable-pixmap 2008-11-17 04:15:51 UTC (rev 28679) +++ haiku/trunk/src/data/beos_mime/image/x-portable-pixmap 2008-11-17 05:09:07 UTC (rev 28680) @@ -0,0 +1,13 @@ + +resource(0, "BEOS:TYPE") #'MIMS' "application/x-vnd.Be-meta-mime"; + +resource(1, "META:TYPE") "image/x-portable-pixmap"; + +resource(2, "META:SNIFF_RULE") "0.50 (\"P6\")"; + +resource(3, "META:S:DESC") #'MSDC' "PPM Image"; + +resource(4, "META:EXTENS") message(234) { + "extensions" = "ppm", + "type" = "image/x-portable-pixmap" +}; From superstippi at gmx.de Mon Nov 17 16:02:41 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Mon, 17 Nov 2008 16:02:41 +0100 Subject: [Haiku-commits] r28671 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: References: <200811162234.mAGMYCPf030837@sheep.berlios.de> Message-ID: <20081117150241.307220@gmx.net> -------- Original-Nachricht -------- > Datum: Sun, 16 Nov 2008 16:56:37 -0600 > Von: "Rene Gollent" > An: "SVN commits to the Haiku source repository" > Betreff: Re: [Haiku-commits] r28671 - in haiku/trunk: headers/os/interface src/kits/interface > On Sun, Nov 16, 2008 at 4:34 PM, stippi at BerliOS > wrote: > > Author: stippi > > Date: 2008-11-16 23:34:11 +0100 (Sun, 16 Nov 2008) > > New Revision: 28671 > > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28671&view=rev > > > > Modified: > > haiku/trunk/headers/os/interface/ListView.h > > haiku/trunk/src/kits/interface/ListView.cpp > > Log: > > * The previous change to reorder item->Update() and _RecalcItemTops() > obviously > > broke everything. If the added item has no chance to calculate it's > height, > > What regressions were you seeing specifically? I've been using that > change for days and noticed absolutely no difference in listview > behavior in any app I tried. And it was specifically intended to fix > the listview in Themes that has all its items laid on top of each > other. ListViews were broken in all apps I tried with so far: WonderBrush and TeamMonitor. Really, the code was correct at this place. The height of the added item needs to be initialized first, before the new positions of the following items can be recalculated. It doesn't make sense any other way. Maybe AddList() was not correct, I didn't look too close there, but AddItem() was definitely broken by your change. Best regards, -Stephan From anevilyak at gmail.com Mon Nov 17 16:05:24 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Mon, 17 Nov 2008 09:05:24 -0600 Subject: [Haiku-commits] r28671 - in haiku/trunk: headers/os/interface src/kits/interface In-Reply-To: <20081117150241.307220@gmx.net> References: <200811162234.mAGMYCPf030837@sheep.berlios.de> <20081117150241.307220@gmx.net> Message-ID: On Mon, Nov 17, 2008 at 9:02 AM, Stephan Assmus wrote: > ListViews were broken in all apps I tried with so far: WonderBrush and TeamMonitor. Really, the code was correct at this place. The height of the added item needs to be initialized first, before the new positions of the following items can be recalculated. It doesn't make sense any other way. Maybe AddList() was not correct, I didn't look too close there, but AddItem() was definitely broken by your change. > Hmm...ok, will dig around further. There's definitely something different in terms of order of operations between us and R5 though, what the themes listview does is actually create a BView for each list item in order to hold the checkbox controls. Somehow the timing it does this with results in it getting a 0 position for every item, with the net result that all items wind up on top of each other. Will see what I can find. Regards, Rene From leavengood at mail.berlios.de Mon Nov 17 16:54:18 2008 From: leavengood at mail.berlios.de (leavengood at BerliOS) Date: Mon, 17 Nov 2008 16:54:18 +0100 Subject: [Haiku-commits] r28681 - haiku/trunk/src/data/beos_mime/image Message-ID: <200811171554.mAHFsI9Z011262@sheep.berlios.de> Author: leavengood Date: 2008-11-17 16:54:17 +0100 (Mon, 17 Nov 2008) New Revision: 28681 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28681&view=rev Modified: haiku/trunk/src/data/beos_mime/image/sgi Log: Missing backslash, thanks to Joseph Prostko for pointing this out. I'm not sure how this affects the build as I still got a valid image and only saw the MIME error after Joseph pointed it out. In fact I am quite sure the SGI MIME type was still in the build. I assume that only the broken sniffer rule was missing. Modified: haiku/trunk/src/data/beos_mime/image/sgi =================================================================== --- haiku/trunk/src/data/beos_mime/image/sgi 2008-11-17 05:09:07 UTC (rev 28680) +++ haiku/trunk/src/data/beos_mime/image/sgi 2008-11-17 15:54:17 UTC (rev 28681) @@ -3,7 +3,7 @@ resource(1, "META:TYPE") "image/sgi"; -resource(2, "META:SNIFF_RULE") "0.50 (\"\\001\\332")"; +resource(2, "META:SNIFF_RULE") "0.50 (\"\\001\\332\")"; resource(3, "META:S:DESC") #'MSDC' "SGI Image"; From revol at free.fr Mon Nov 17 17:18:44 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Mon, 17 Nov 2008 17:18:44 +0100 CET Subject: [Haiku-commits] r28661 - haiku/trunk/src/apps/sudoku In-Reply-To: <200811162119.mAGLJwkS023923@sheep.berlios.de> Message-ID: <4871854977-BeMail@laptop> > * Renamed settings file (removed the "pinc" part of it). > * Removed BeOS compatible flag from the subdir. It was working fine last time I tried (=the day before)... :D Fran?ois. From stefano.ceccherini at gmail.com Mon Nov 17 17:15:50 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Mon, 17 Nov 2008 17:15:50 +0100 Subject: [Haiku-commits] r28662 - in haiku/trunk: headers/os/support src/kits/support In-Reply-To: <200811162123.mAGLNkH8024333@sheep.berlios.de> References: <200811162123.mAGLNkH8024333@sheep.berlios.de> Message-ID: <894b9700811170815r31da8e68j787191a74f699f58@mail.gmail.com> 2008/11/16 axeld at BerliOS : > Author: axeld > Date: 2008-11-16 22:23:45 +0100 (Sun, 16 Nov 2008) > New Revision: 28662 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28662&view=rev > > Modified: > haiku/trunk/headers/os/support/BufferIO.h > haiku/trunk/src/kits/support/BufferIO.cpp > Log: > * BBufferIO did not implement Seek() and Position() correctly; it just passed > it to the stream. This caused Read()/Write() to need two syscalls for nothing > (this only caused the actual stream to share the same position with the > BBufferIO, something you just cannot rely on when using buffered I/O). > * Anyway, this reduces the time VirtualBox needs to open some RAW test images > from over 4 minutes to less than 15 seconds... Nice, but... > + switch (seekMode) { > + case SEEK_CUR: > + fPosition += position; > + if (fPosition < 0) > + fPosition = 0; > + break; > + case SEEK_SET: > + if (position < 0) > + return B_BAD_VALUE; > + > + fPosition = position; > + break; > + case SEEK_END: > + { > + off_t size; > + status_t status = fStream->GetSize(&size); > + if (status != B_OK) > + return status; > + > + fPosition = size - position; > + if (fPosition < 0) > + fPosition = 0; are you sure about these ? AFAIR it's possible to seek beyond the end of the buffer and before 0. From korli at mail.berlios.de Mon Nov 17 20:44:36 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 17 Nov 2008 20:44:36 +0100 Subject: [Haiku-commits] r28682 - in haiku/trunk: headers/private/media src/add-ons/media/media-add-ons/multi_audio Message-ID: <200811171944.mAHJia9c005605@sheep.berlios.de> Author: korli Date: 2008-11-17 20:44:36 +0100 (Mon, 17 Nov 2008) New Revision: 28682 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28682&view=rev Modified: haiku/trunk/headers/private/media/hmulti_audio.h haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp Log: added Headphones and SPDIF string constants Modified: haiku/trunk/headers/private/media/hmulti_audio.h =================================================================== --- haiku/trunk/headers/private/media/hmulti_audio.h 2008-11-17 15:54:17 UTC (rev 28681) +++ haiku/trunk/headers/private/media/hmulti_audio.h 2008-11-17 19:44:36 UTC (rev 28682) @@ -466,6 +466,7 @@ S_AUX, S_WAVE, S_GAIN, S_LEVEL, S_VOLUME, S_MUTE, S_ENABLE, S_STEREO_MIX, S_MONO_MIX, S_OUTPUT_STEREO_MIX, S_OUTPUT_MONO_MIX, S_OUTPUT_BASS, S_OUTPUT_TREBLE, S_OUTPUT_3D_CENTER, S_OUTPUT_3D_DEPTH, + S_HEADPHONE, S_SPDIF, S_USERID = 1000000 }; Modified: haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp =================================================================== --- haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp 2008-11-17 15:54:17 UTC (rev 28681) +++ haiku/trunk/src/add-ons/media/media-add-ons/multi_audio/MultiAudioNode.cpp 2008-11-17 19:44:36 UTC (rev 28682) @@ -57,7 +57,7 @@ "Output", "Input", "Setup", "Tone Control", "Extended Setup", "Enhanced Setup", "Master", "Beep", "Phone", "Mic", "Line", "CD", "Video", "Aux", "Wave", "Gain", "Level", "Volume", "Mute", "Enable", "Stereo Mix", "Mono Mix", "Output Stereo Mix", "Output Mono Mix", "Output Bass", - "Output Treble", "Output 3D Center", "Output 3D Depth" + "Output Treble", "Output 3D Center", "Output 3D Depth", "Headphones", "SPDIF" }; From korli at mail.berlios.de Mon Nov 17 23:45:04 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Mon, 17 Nov 2008 23:45:04 +0100 Subject: [Haiku-commits] r28683 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200811172245.mAHMj4OU019045@sheep.berlios.de> Author: korli Date: 2008-11-17 23:45:04 +0100 (Mon, 17 Nov 2008) New Revision: 28683 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28683&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp Log: * store vendor, revision, stepping, revision, minor, major in the codec struct * check specific node ids for nodes declared as inputs which are really beepers * when unmuting/setting amp on the input amplifier, iterate on each input instead of only the first one * also unmute/set amp on the output and input amplifiers for the input and output paths, respectively Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-11-17 19:44:36 UTC (rev 28682) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-11-17 22:45:04 UTC (rev 28683) @@ -275,8 +275,10 @@ struct hda_codec { uint16 vendor_id; uint16 product_id; + uint8 major; + uint8 minor; uint8 revision; - uint16 stepping; + uint8 stepping; uint8 addr; sem_id response_sem; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-17 19:44:36 UTC (rev 28682) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-17 22:45:04 UTC (rev 28683) @@ -528,6 +528,25 @@ widget.type = (hda_widget_type)((capabilities & AUDIO_CAP_TYPE_MASK) >> AUDIO_CAP_TYPE_SHIFT); + + /* Check specific node ids declared as inputs as beepers */ + switch ((audioGroup->codec->vendor_id << 16) | audioGroup->codec->product_id) { + case 0x10ec0260: + if (nodeID == 23) + widget.type = WT_BEEP_GENERATOR; + break; + case 0x10ec0262: + case 0x10ec0268: + case 0x10ec0880: + case 0x10ec0882: + case 0x10ec0883: + case 0x10ec0885: + case 0x10ec0888: + case 0x10ec0889: + if (nodeID == 29) + widget.type = WT_BEEP_GENERATOR; + break; + } widget.active_input = -1; widget.capabilities.audio = capabilities; widget.node_id = nodeID; @@ -930,8 +949,7 @@ hda_send_verbs(audioGroup->codec, &verb, NULL, 1); } - if (widget.capabilities.output_amplifier != 0 - && widget.flags & WIDGET_FLAG_OUTPUT_PATH) { + if (widget.capabilities.output_amplifier != 0) { dprintf("UNMUTE/SET OUTPUT GAIN widget %ld (offset %ld)\n", widget.node_id, widget.capabilities.output_amplifier & AMP_CAP_OFFSET_MASK); uint32 verb = MAKE_VERB(audioGroup->codec->addr, @@ -943,18 +961,20 @@ & AMP_CAP_OFFSET_MASK)); hda_send_verbs(audioGroup->codec, &verb, NULL, 1); } - if (widget.capabilities.input_amplifier != 0 - && widget.flags & WIDGET_FLAG_INPUT_PATH) { + if (widget.capabilities.input_amplifier != 0) { dprintf("UNMUTE/SET INPUT GAIN widget %ld (offset %ld)\n", widget.node_id, - widget.capabilities.output_amplifier & AMP_CAP_OFFSET_MASK); - uint32 verb = MAKE_VERB(audioGroup->codec->addr, - widget.node_id, - VID_SET_AMPLIFIER_GAIN_MUTE, - AMP_SET_INPUT | AMP_SET_LEFT_CHANNEL - | AMP_SET_RIGHT_CHANNEL - | (widget.capabilities.input_amplifier - & AMP_CAP_OFFSET_MASK)); - hda_send_verbs(audioGroup->codec, &verb, NULL, 1); + widget.capabilities.input_amplifier & AMP_CAP_OFFSET_MASK); + for (uint32 i = 0; i < widget.num_inputs; i++) { + uint32 verb = MAKE_VERB(audioGroup->codec->addr, + widget.node_id, + VID_SET_AMPLIFIER_GAIN_MUTE, + AMP_SET_INPUT | AMP_SET_LEFT_CHANNEL + | AMP_SET_RIGHT_CHANNEL + | AMP_SET_INPUT_INDEX(i) + | (widget.capabilities.input_amplifier + & AMP_CAP_OFFSET_MASK)); + hda_send_verbs(audioGroup->codec, &verb, NULL, 1); + } } } @@ -1038,6 +1058,13 @@ if (hda_send_verbs(codec, verbs, (uint32*)&response, 3) != B_OK) goto err; + codec->vendor_id = response.vendor; + codec->product_id = response.device; + codec->stepping = response.stepping; + codec->revision = response.revision; + codec->minor = response.minor; + codec->major = response.major; + dprintf("Codec %ld Vendor: %04lx Product: %04lx, Revision: " "%lu.%lu.%lu.%lu\n", codecAddress, response.vendor, response.device, response.major, response.minor, response.revision, response.stepping); From mmu_man at mail.berlios.de Tue Nov 18 00:26:47 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 18 Nov 2008 00:26:47 +0100 Subject: [Haiku-commits] r28684 - haiku/trunk/build/jam Message-ID: <200811172326.mAHNQlGB027436@sheep.berlios.de> Author: mmu_man Date: 2008-11-18 00:26:46 +0100 (Tue, 18 Nov 2008) New Revision: 28684 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28684&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Add the legacy media_addon and the few drivers we have that still use the old/ API. While the legacy addon seems unfinished it doesn't prevent booting, hopefully someone will be motivated enough to finish it. Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-17 22:45:04 UTC (rev 28683) +++ haiku/trunk/build/jam/HaikuImage 2008-11-17 23:26:46 UTC (rev 28684) @@ -113,7 +113,7 @@ video_producer_demo.media_addon video_window_demo.media_addon firewire_dv.media_addon - #legacy.media_addon + legacy.media_addon ; BEOS_ADD_ONS_MEDIA_PLUGINS = $(GPL_ONLY)ac3_decoder aiff_reader au_reader $(X86_ONLY)avcodec avi_reader @@ -132,6 +132,7 @@ ; BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider ; BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki ; #hda +BEOS_ADD_ONS_DRIVERS_AUDIO_OLD = cmedia sis7018 usb_audio ; BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware @@ -191,6 +192,7 @@ AddDriversToHaikuImage : console dprintf $(X86_ONLY)keyboard null random tty zero ; AddDriversToHaikuImage audio hmulti : $(BEOS_ADD_ONS_DRIVERS_AUDIO) ; +AddDriversToHaikuImage audio old : $(BEOS_ADD_ONS_DRIVERS_AUDIO_OLD) ; AddDriversToHaikuImage midi : $(BEOS_ADD_ONS_DRIVERS_MIDI) ; AddDriversToHaikuImage bus : usb_raw fw_raw ; AddDriversToHaikuImage disk floppy : $(X86_ONLY)pc_floppy ; From bga at bug-br.org.br Mon Nov 17 23:40:32 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Mon, 17 Nov 2008 23:40:32 Subject: [Haiku-commits] =?utf-8?q?r28683_-_haiku/trunk/src/add-ons/kernel?= =?utf-8?q?/drivers/audio/hda?= In-Reply-To: <200811172245.mAHMj4OU019045@sheep.berlios.de> Message-ID: <743669174-BeMail@Gaspode> On Mon, 17 Nov 2008 23:45:04 +0100, korli at BerliOS said: > Author: korli > Date: 2008-11-17 23:45:04 +0100 (Mon, 17 Nov 2008) > New Revision: 28683 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28683&view=rev > > Modified: > haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h > haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp > Log: > * store vendor, revision, stepping, revision, minor, major in the > codec struct > * check specific node ids for nodes declared as inputs which are > really beepers > * when unmuting/setting amp on the input amplifier, iterate on each > input instead of only the first one > * also unmute/set amp on the output and input amplifiers for the > input and output paths, respectively Hi Korli. Thanks for your wokr on this. As OSS has an annoying bug where it only starts working some seconds after booting and also stops working after some time (hours?), seeing progress in the HDA driver is great. That said, I have an ICH9 audio controller: device Multimedia controller (Audio device) [4|3|0] vendor 8086: Intel Corporation device 293e: 82801I (ICH9 Family) HD Audio Controller This is recognized by the HDA driver but, for some reason, the input/ output tabs are completelly empty (no controls show up at all). Is this expected at this time (I tested before this specific change you did now) or is it failing to work with this specific audio device? -Bruno From mmu_man at mail.berlios.de Tue Nov 18 00:49:16 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 18 Nov 2008 00:49:16 +0100 Subject: [Haiku-commits] r28685 - haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia Message-ID: <200811172349.mAHNnGAq017790@sheep.berlios.de> Author: mmu_man Date: 2008-11-18 00:49:14 +0100 (Tue, 18 Nov 2008) New Revision: 28685 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28685&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm_private.h Log: Fix m68k build. Please always have a fallback case in arch dependant code! Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm_private.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm_private.h 2008-11-17 23:26:46 UTC (rev 28684) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/cmedia/cm_private.h 2008-11-17 23:49:14 UTC (rev 28685) @@ -25,10 +25,10 @@ #define EXPORT __declspec(dllexport) -#if defined(__INTEL__) +#if defined(__POWERPC__) +#define EIEIO() __eieio() +#else #define EIEIO() -#elif defined(__POWERPC__) -#define EIEIO() __eieio() #endif #if DEBUG From revol at free.fr Tue Nov 18 00:57:50 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 18 Nov 2008 00:57:50 +0100 CET Subject: [Haiku-commits] r28683 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda In-Reply-To: <743669174-BeMail@Gaspode> Message-ID: <16053948062-BeMail@laptop> > Thanks for your wokr on this. As OSS has an annoying bug where it > only > starts working some seconds after booting and also stops working > after > some time (hours?), seeing progress in the HDA driver is great. While the first bug seems to be Haiku only (running osstest before media_server works, and it just works fine in ZETA), the 2nd one does happen in ZETA as well... I'll have a look when I get time, but it's obviously hard to trace :D Fran?ois. From superstippi at gmx.de Tue Nov 18 09:32:17 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Tue, 18 Nov 2008 09:32:17 +0100 Subject: [Haiku-commits] r28684 - haiku/trunk/build/jam In-Reply-To: <200811172326.mAHNQlGB027436@sheep.berlios.de> References: <200811172326.mAHNQlGB027436@sheep.berlios.de> Message-ID: <20081118083217.194260@gmx.net> -------- Original-Nachricht -------- > Datum: Tue, 18 Nov 2008 00:26:47 +0100 > Von: mmu_man at BerliOS > An: haiku-commits at lists.berlios.de > Betreff: [Haiku-commits] r28684 - haiku/trunk/build/jam > Author: mmu_man > Date: 2008-11-18 00:26:46 +0100 (Tue, 18 Nov 2008) > New Revision: 28684 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28684&view=rev > > Modified: > haiku/trunk/build/jam/HaikuImage > Log: > Add the legacy media_addon and the few drivers we have that still use the > old/ API. While the legacy addon seems unfinished it doesn't prevent > booting, hopefully someone will be motivated enough to finish it. I don't know. This adds possible points of failure for no benefit, more not so heavily tested drivers on the default image. If someone was indeed motivated and completed the work on the legacy media addon, then we could think about adding it to the image. Whoever would pick up the work, would have no trouble adding the components onto his personal image while he works on it. So I'd vote for reverting this patch. Best regards, -Stephan From korli at users.berlios.de Tue Nov 18 11:53:32 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 18 Nov 2008 11:53:32 +0100 Subject: [Haiku-commits] r28684 - haiku/trunk/build/jam In-Reply-To: <20081118083217.194260@gmx.net> References: <200811172326.mAHNQlGB027436@sheep.berlios.de> <20081118083217.194260@gmx.net> Message-ID: 2008/11/18 Stephan Assmus : > I don't know. This adds possible points of failure for no benefit, more not so heavily tested drivers on the default image. If someone was indeed motivated and completed the work on the legacy media addon, then we could think about adding it to the image. Whoever would pick up the work, would have no trouble adding the components onto his personal image while he works on it. So I'd vote for reverting this patch. +1 From korli at users.berlios.de Tue Nov 18 13:14:11 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Tue, 18 Nov 2008 13:14:11 +0100 Subject: [Haiku-commits] r28683 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda In-Reply-To: <743669174-BeMail@Gaspode> References: <200811172245.mAHMj4OU019045@sheep.berlios.de> <743669174-BeMail@Gaspode> Message-ID: Hi Bruno, 2008/11/18 Bruno Albuquerque : > That said, I have an ICH9 audio controller: > > device Multimedia controller (Audio device) [4|3|0] > vendor 8086: Intel Corporation > device 293e: 82801I (ICH9 Family) HD Audio Controller > > This is recognized by the HDA driver but, for some reason, the input/ > output tabs are completelly empty (no controls show up at all). Is this > expected at this time (I tested before this specific change you did > now) or is it failing to work with this specific audio device? I would be interested in a syslog. Hopefully this would help to debug the peculiarities of your codec/device. Bye, J?r?me From marcusoverhagen at arcor.de Tue Nov 18 13:36:08 2008 From: marcusoverhagen at arcor.de (Marcus Overhagen) Date: Tue, 18 Nov 2008 13:36:08 +0100 (CET) Subject: [Haiku-commits] r28684 - haiku/trunk/build/jam In-Reply-To: References: <200811172326.mAHNQlGB027436@sheep.berlios.de> <20081118083217.194260@gmx.net> Message-ID: <9475255.1227011768445.JavaMail.ngmail@webmail13.arcor-online.net> J?r?me Duval wrote: > 2008/11/18 Stephan Assmus : > > I don't know. This adds possible points of failure for no benefit, more > not so heavily tested drivers on the default image. If someone was indeed > motivated and completed the work on the legacy media addon, then we could > think about adding it to the image. Whoever would pick up the work, would > have no trouble adding the components onto his personal image while he works > on it. So I'd vote for reverting this patch. > > +1 +1 for reverting. regards 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 spannende Dokus in der Arcor-Videothek. Infos unter www.arcor.de/tv From bga at bug-br.org.br Tue Nov 18 14:13:20 2008 From: bga at bug-br.org.br (Bruno Albuquerque) Date: Tue, 18 Nov 2008 11:13:20 -0200 Subject: [Haiku-commits] r28683 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda In-Reply-To: References: <200811172245.mAHMj4OU019045@sheep.berlios.de> <743669174-BeMail@Gaspode> Message-ID: <4922BF70.6010107@bug-br.org.br> J?r?me Duval wrote: >> device Multimedia controller (Audio device) [4|3|0] >> vendor 8086: Intel Corporation >> device 293e: 82801I (ICH9 Family) HD Audio Controller >> >> This is recognized by the HDA driver but, for some reason, the input/ >> output tabs are completelly empty (no controls show up at all). Is this >> expected at this time (I tested before this specific change you did >> now) or is it failing to work with this specific audio device? > > I would be interested in a syslog. Hopefully this would help to debug > the peculiarities of your codec/device. Hi Jerome. I can provide you with this when I am back at home later today. Do I need to compiled the driver/add-on with debug or will it dump wherever you need by default? If you think this could help, you can send me a patch that adds any debugging information you need and I can apply it before sending you the information. -Bruno From mmu_man at mail.berlios.de Tue Nov 18 15:40:40 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 18 Nov 2008 15:40:40 +0100 Subject: [Haiku-commits] r28686 - haiku/trunk/src/system/boot/platform/bios_ia32 Message-ID: <200811181440.mAIEeeYS014246@sheep.berlios.de> Author: mmu_man Date: 2008-11-18 15:40:40 +0100 (Tue, 18 Nov 2008) New Revision: 28686 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28686&view=rev Modified: haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp Log: Add a boot menu option to disable using the IO APIC for IRQ handling and fallback to PIC. Modified: haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp =================================================================== --- haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp 2008-11-17 23:49:14 UTC (rev 28685) +++ haiku/trunk/src/system/boot/platform/bios_ia32/menu.cpp 2008-11-18 14:40:40 UTC (rev 28686) @@ -47,6 +47,12 @@ item->SetHelpText("Disables Advanced Configuration and Power " "Interface hardware support, overriding the ACPI setting " "in the kernel settings file."); + + menu->AddItem(item = new(nothrow) MenuItem("Disable IO-APIC")); + item->SetType(MENU_ITEM_MARKABLE); + item->SetData(B_SAFEMODE_DISABLE_IOAPIC); + item->SetHelpText("Disables using the IO APIC for interrupt handling, " + "forcing instead the use of the PIC."); break; default: break; From revol at free.fr Tue Nov 18 15:56:18 2008 From: revol at free.fr (=?windows-1252?q?Fran=E7ois?= Revol) Date: Tue, 18 Nov 2008 15:56:18 +0100 CET Subject: [Haiku-commits] r28684 - haiku/trunk/build/jam In-Reply-To: Message-ID: <2103860130-BeMail@laptop> > 2008/11/18 Stephan Assmus : > > I don't know. This adds possible points of failure for no benefit, > > more not so heavily tested drivers on the default image. If someone was indeed motivated and completed the work on the legacy media addon, then we could think about adding it to the image. Whoever would pick up the work, would have no trouble adding the components onto his personal image while he works on it. So I'd vote for reverting this patch. > > +1 You lazy ;-) I guess I'll just comment them out to make it an obvious hint. Fran?ois. From axeld at mail.berlios.de Tue Nov 18 22:07:19 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 18 Nov 2008 22:07:19 +0100 Subject: [Haiku-commits] r28687 - haiku/trunk/src/add-ons/kernel/drivers/tty Message-ID: <200811182107.mAIL7Jir021132@sheep.berlios.de> Author: axeld Date: 2008-11-18 22:07:18 +0100 (Tue, 18 Nov 2008) New Revision: 28687 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28687&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp Log: * tty_select() did not check for ICANON and therefore notified the select listeners immediately if there was already something in the queue. Factored out a tty_readable() out of tty_notify_if_available() that tty_select() now uses. * This fixes bug #3148. Modified: haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp 2008-11-18 14:40:40 UTC (rev 28686) +++ haiku/trunk/src/add-ons/kernel/drivers/tty/tty.cpp 2008-11-18 21:07:18 UTC (rev 28687) @@ -1105,6 +1105,19 @@ } +static int32 +tty_readable(struct tty* tty) +{ + if (!tty->is_master && (tty->settings->termios.c_lflag & ICANON) != 0) { + return line_buffer_readable_line(tty->input_buffer, + tty->settings->termios.c_cc[VEOL], + tty->settings->termios.c_cc[VEOF]); + } + + return line_buffer_readable(tty->input_buffer); +} + + static void tty_notify_select_event(struct tty *tty, uint8 event) { @@ -1134,14 +1147,7 @@ // Check, if something is readable (depending on whether canonical input // processing is enabled). - int32 readable; - if (!tty->is_master && (tty->settings->termios.c_lflag & ICANON) != 0) { - readable = line_buffer_readable_line(tty->input_buffer, - tty->settings->termios.c_cc[VEOL], - tty->settings->termios.c_cc[VEOF]); - } else - readable = line_buffer_readable(tty->input_buffer); - + int32 readable = tty_readable(tty); if (readable > 0) { // if nobody is waiting send select events, otherwise notify the waiter if (!tty->reader_queue.IsEmpty()) @@ -1895,10 +1901,8 @@ // check, if the event is already present switch (event) { case B_SELECT_READ: - if (tty->reader_queue.IsEmpty() - && line_buffer_readable(tty->input_buffer) > 0) { + if (tty->reader_queue.IsEmpty() && tty_readable(tty) > 0) notify_select_event(sync, event); - } break; case B_SELECT_WRITE: @@ -1922,7 +1926,6 @@ notify_select_event(sync, event); } } - break; } From axeld at mail.berlios.de Tue Nov 18 22:29:04 2008 From: axeld at mail.berlios.de (axeld at BerliOS) Date: Tue, 18 Nov 2008 22:29:04 +0100 Subject: [Haiku-commits] r28688 - haiku/trunk/src/kits/support Message-ID: <200811182129.mAILT44d027567@sheep.berlios.de> Author: axeld Date: 2008-11-18 22:29:04 +0100 (Tue, 18 Nov 2008) New Revision: 28688 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28688&view=rev Modified: haiku/trunk/src/kits/support/BufferIO.cpp Log: * Seek() must always fail when the resulting offset would be smaller than 0 - "correcting" the offset to 0 is not what should happen. Modified: haiku/trunk/src/kits/support/BufferIO.cpp =================================================================== --- haiku/trunk/src/kits/support/BufferIO.cpp 2008-11-18 21:07:18 UTC (rev 28687) +++ haiku/trunk/src/kits/support/BufferIO.cpp 2008-11-18 21:29:04 UTC (rev 28688) @@ -143,17 +143,14 @@ if (fStream == NULL) return B_NO_INIT; + off_t newPosition = fPosition; + switch (seekMode) { case SEEK_CUR: - fPosition += position; - if (fPosition < 0) - fPosition = 0; + newPosition += position; break; case SEEK_SET: - if (position < 0) - return B_BAD_VALUE; - - fPosition = position; + newPosition = position; break; case SEEK_END: { @@ -162,14 +159,16 @@ if (status != B_OK) return status; - fPosition = size - position; - if (fPosition < 0) - fPosition = 0; + newPosition = size - position; break; } } - return fPosition; + if (newPosition < 0) + return B_BAD_VALUE; + + fPosition = newPosition; + return newPosition; } From axeld at pinc-software.de Tue Nov 18 22:32:35 2008 From: axeld at pinc-software.de (=?ISO-8859-1?Q?Axel_D=F6rfler?=) Date: Tue, 18 Nov 2008 22:32:35 +0100 Subject: [Haiku-commits] r28662 - in haiku/trunk: headers/os/support src/kits/support In-Reply-To: <894b9700811170815r31da8e68j787191a74f699f58@mail.gmail.com> References: <200811162123.mAGLNkH8024333@sheep.berlios.de> <894b9700811170815r31da8e68j787191a74f699f58@mail.gmail.com> Message-ID: <49233473.1020202@pinc-software.de> Stefano Ceccherini wrote: >> + case SEEK_CUR: >> + fPosition += position; >> + if (fPosition < 0) >> + fPosition = 0; [...] > are you sure about these ? Apparently not ;-) > AFAIR it's possible to seek beyond the end of the buffer and before 0. Seeking beyond was still possible, I just incorrectly "clamped" the value to zero when it would go below - we have to fail in that case. Thanks for proof-reading! Bye, Axel. From mmu_man at mail.berlios.de Tue Nov 18 23:58:20 2008 From: mmu_man at mail.berlios.de (mmu_man at BerliOS) Date: Tue, 18 Nov 2008 23:58:20 +0100 Subject: [Haiku-commits] r28689 - haiku/trunk/build/jam Message-ID: <200811182258.mAIMwK2I008709@sheep.berlios.de> Author: mmu_man Date: 2008-11-18 23:58:20 +0100 (Tue, 18 Nov 2008) New Revision: 28689 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28689&view=rev Modified: haiku/trunk/build/jam/HaikuImage Log: Disable old API sound drivers and addon for now, anyone feel free to finish it :) Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-18 21:29:04 UTC (rev 28688) +++ haiku/trunk/build/jam/HaikuImage 2008-11-18 22:58:20 UTC (rev 28689) @@ -113,7 +113,7 @@ video_producer_demo.media_addon video_window_demo.media_addon firewire_dv.media_addon - legacy.media_addon + #legacy.media_addon ; BEOS_ADD_ONS_MEDIA_PLUGINS = $(GPL_ONLY)ac3_decoder aiff_reader au_reader $(X86_ONLY)avcodec avi_reader @@ -132,7 +132,7 @@ ; BEOS_ADD_ONS_SCREENSAVERS = Haiku IFS Spider ; BEOS_ADD_ONS_DRIVERS_AUDIO = auich auvia echo3g emuxki ; #hda -BEOS_ADD_ONS_DRIVERS_AUDIO_OLD = cmedia sis7018 usb_audio ; +BEOS_ADD_ONS_DRIVERS_AUDIO_OLD = ; #cmedia sis7018 usb_audio ; BEOS_ADD_ONS_DRIVERS_GRAPHICS = $(X86_ONLY)radeon $(X86_ONLY)nvidia $(X86_ONLY)neomagic $(X86_ONLY)matrox $(X86_ONLY)intel_extreme $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware From colacoder at mail.berlios.de Wed Nov 19 02:04:30 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Wed, 19 Nov 2008 02:04:30 +0100 Subject: [Haiku-commits] r28690 - buildtools/trunk/binutils/ld Message-ID: <200811190104.mAJ14U3K018396@sheep.berlios.de> Author: colacoder Date: 2008-11-19 02:04:30 +0100 (Wed, 19 Nov 2008) New Revision: 28690 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28690&view=rev Modified: buildtools/trunk/binutils/ld/Makefile.am Log: Fix makefile so binutils will fully build for ARM architecture. Modified: buildtools/trunk/binutils/ld/Makefile.am =================================================================== --- buildtools/trunk/binutils/ld/Makefile.am 2008-11-18 22:58:20 UTC (rev 28689) +++ buildtools/trunk/binutils/ld/Makefile.am 2008-11-19 01:04:30 UTC (rev 28690) @@ -117,6 +117,7 @@ earmelf.o \ earmelfb.o \ earmelf_fbsd.o \ + earmelf_haiku.o \ earmelf_linux.o \ earmelf_linux_eabi.o \ earmelfb_linux.o \ @@ -513,6 +514,10 @@ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} armelf_fbsd "$(tdir_armelf_fbsd)" +earmelf_haiku.c: $(srcdir)/emulparams/armelf_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} armelf_haiku "$(tdir_armelf_haiku)" earmelf_linux.c: $(srcdir)/emulparams/armelf_linux.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} From colacoder at mail.berlios.de Wed Nov 19 02:41:31 2008 From: colacoder at mail.berlios.de (colacoder at BerliOS) Date: Wed, 19 Nov 2008 02:41:31 +0100 Subject: [Haiku-commits] r28691 - buildtools/trunk/binutils/ld Message-ID: <200811190141.mAJ1fVtP024389@sheep.berlios.de> Author: colacoder Date: 2008-11-19 02:41:30 +0100 (Wed, 19 Nov 2008) New Revision: 28691 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28691&view=rev Modified: buildtools/trunk/binutils/ld/Makefile.in Log: Forgot that these generated files were in svn too ;) Modified: buildtools/trunk/binutils/ld/Makefile.in =================================================================== --- buildtools/trunk/binutils/ld/Makefile.in 2008-11-19 01:04:30 UTC (rev 28690) +++ buildtools/trunk/binutils/ld/Makefile.in 2008-11-19 01:41:30 UTC (rev 28691) @@ -341,6 +341,7 @@ earmelf.o \ earmelfb.o \ earmelf_fbsd.o \ + earmelf_haiku.o \ earmelf_linux.o \ earmelf_linux_eabi.o \ earmelfb_linux.o \ @@ -1324,6 +1325,10 @@ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} ${GENSCRIPTS} armelf_fbsd "$(tdir_armelf_fbsd)" +earmelf_haiku.c: $(srcdir)/emulparams/armelf_haiku.sh \ + $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \ + $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} + ${GENSCRIPTS} armelf_haiku "$(tdir_armelf_haiku)" earmelf_linux.c: $(srcdir)/emulparams/armelf_linux.sh \ $(srcdir)/emultempl/elf32.em $(srcdir)/emultempl/armelf.em \ $(srcdir)/scripttempl/elf.sc ${GEN_DEPENDS} From anevilyak at mail.berlios.de Wed Nov 19 04:55:03 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 19 Nov 2008 04:55:03 +0100 Subject: [Haiku-commits] r28692 - haiku/trunk/src/kits/interface Message-ID: <200811190355.mAJ3t3Tq006517@sheep.berlios.de> Author: anevilyak Date: 2008-11-19 04:54:59 +0100 (Wed, 19 Nov 2008) New Revision: 28692 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28692&view=rev Modified: haiku/trunk/src/kits/interface/ListView.cpp Log: When an item is added to the list, we must immediately set its top, otherwise if it tries to make use of any positional information in the subsequent call to Update() (i.e. calls to ItemFrame(), or Top(), it will get back bogus coordinates. This should correctly fix the problems seen with Themes, possibly amongst others. Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 01:41:30 UTC (rev 28691) +++ haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 03:54:59 UTC (rev 28692) @@ -533,8 +533,10 @@ if (Window()) { BFont font; GetFont(&font); + item->SetTop((index > 0) ? ItemAt(index - 1)->Bottom() + 1.0 : 0.0); + item->Update(this, &font); - _RecalcItemTops(index); + _RecalcItemTops(index + 1); _FixupScrollBar(); _InvalidateFrom(index); @@ -549,15 +551,16 @@ { if (!fList.AddItem(item)) return false; - // No need to adapt selection, as this item is the last in the list if (Window()) { BFont font; GetFont(&font); + int32 index = CountItems() - 1; + item->SetTop((index > 0) ? ItemAt(index - 1)->Bottom() + 1.0 : 0.0); + item->Update(this, &font); - _RecalcItemTops(CountItems() - 1); - + _FixupScrollBar(); InvalidateItem(CountItems() - 1); } @@ -584,11 +587,13 @@ BFont font; GetFont(&font); - for (int32 i = index; i <= (index + list->CountItems() - 1); i++) + for (int32 i = index; i <= (index + list->CountItems() - 1); i++) { + ItemAt(i)->SetTop((i > 0) ? ItemAt(i - 1)->Bottom() + 1.0 : 0.0); ItemAt(i)->Update(this, &font); + } + + _RecalcItemTops(index + list->CountItems() - 1); - _RecalcItemTops(index); - _FixupScrollBar(); Invalidate(); // TODO } From anevilyak at mail.berlios.de Wed Nov 19 05:01:05 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 19 Nov 2008 05:01:05 +0100 Subject: [Haiku-commits] r28693 - haiku/trunk/src/kits/interface Message-ID: <200811190401.mAJ415cS008068@sheep.berlios.de> Author: anevilyak Date: 2008-11-19 05:01:05 +0100 (Wed, 19 Nov 2008) New Revision: 28693 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28693&view=rev Modified: haiku/trunk/src/kits/interface/PopUpMenu.cpp Log: Fix a potential race condition in BPopUpMenu: if Go() is called on an async popup menu that hasn't yet been completely dismissed, it's possible to hit a debugger call because the menu's view tries to add itself to the menu window before the previous menu instance has removed it. This was quite easy to hit with things like BColumnListView's column title context menu, since there is no notification for when the menu was dismissed without invoking an item, and thus double right clicking quickly enough would hit the debugger. Go() now checks if the menu's tracking thread is still up, and if it is, waits for it to go away before trying to start another instance. Fixes ticket #3146. Modified: haiku/trunk/src/kits/interface/PopUpMenu.cpp =================================================================== --- haiku/trunk/src/kits/interface/PopUpMenu.cpp 2008-11-19 03:54:59 UTC (rev 28692) +++ haiku/trunk/src/kits/interface/PopUpMenu.cpp 2008-11-19 04:01:05 UTC (rev 28693) @@ -317,6 +317,13 @@ BPopUpMenu::_Go(BPoint where, bool autoInvoke, bool startOpened, BRect *_specialRect, bool async) { + if (fTrackThread >= B_OK) { + // we already have an active menu, wait for it to go away before + // spawning another + status_t unused; + while (wait_for_thread(fTrackThread, &unused) == B_INTERRUPTED) + ; + } popup_menu_data *data = new (std::nothrow) popup_menu_data; if (!data) return NULL; From anevilyak at mail.berlios.de Wed Nov 19 05:41:53 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 19 Nov 2008 05:41:53 +0100 Subject: [Haiku-commits] r28694 - haiku/trunk/src/kits/interface Message-ID: <200811190441.mAJ4frUn016871@sheep.berlios.de> Author: anevilyak Date: 2008-11-19 05:41:51 +0100 (Wed, 19 Nov 2008) New Revision: 28694 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28694&view=rev Modified: haiku/trunk/src/kits/interface/ListView.cpp Log: Minor optimization: since our list items cache their position information, take advantage of this fact to make use of binary search in IndexOf(BListItem *), rather than using BList's linear search. Also use this mechanism to speed up HasItem(BListItem *). Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 04:01:05 UTC (rev 28693) +++ haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 04:41:51 UTC (rev 28694) @@ -733,7 +733,13 @@ int32 BListView::IndexOf(BListItem *item) const { - return fList.IndexOf(item); + if (item != NULL) { + BPoint point(0.0, item->Top()); + int32 index = IndexOf(point); + if (index >= 0 && fList.ItemAt(index) == item) + return index; + } + return -1; } // IndexOf @@ -779,7 +785,7 @@ bool BListView::HasItem(BListItem *item) const { - return fList.HasItem(item); + return IndexOf(item) != -1; } // CountItems From anevilyak at mail.berlios.de Wed Nov 19 06:11:38 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 19 Nov 2008 06:11:38 +0100 Subject: [Haiku-commits] r28695 - haiku/trunk/src/kits/interface Message-ID: <200811190511.mAJ5BcJF022363@sheep.berlios.de> Author: anevilyak Date: 2008-11-19 06:11:37 +0100 (Wed, 19 Nov 2008) New Revision: 28695 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28695&view=rev Modified: haiku/trunk/src/kits/interface/ListView.cpp Log: Temporarily revert that last change since it breaks the IM Kit's preflet for reasons I don't yet understand. Investigating. Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 04:41:51 UTC (rev 28694) +++ haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 05:11:37 UTC (rev 28695) @@ -733,13 +733,7 @@ int32 BListView::IndexOf(BListItem *item) const { - if (item != NULL) { - BPoint point(0.0, item->Top()); - int32 index = IndexOf(point); - if (index >= 0 && fList.ItemAt(index) == item) - return index; - } - return -1; + return fList.IndexOf(item); } // IndexOf @@ -785,7 +779,7 @@ bool BListView::HasItem(BListItem *item) const { - return IndexOf(item) != -1; + return fList.HasItem(item); } // CountItems @@ -1350,9 +1344,10 @@ { BFont font; GetFont(&font); - for (int32 i = 0; i < CountItems(); i++) + for (int32 i = 0; i < CountItems(); i++) { + ItemAt(i)->SetTop((i > 0) ? ItemAt(i - 1)->Bottom() + 1.0 : 0.0); ItemAt(i)->Update(this, &font); - _RecalcItemTops(0); + } } From anevilyak at mail.berlios.de Wed Nov 19 07:04:55 2008 From: anevilyak at mail.berlios.de (anevilyak at BerliOS) Date: Wed, 19 Nov 2008 07:04:55 +0100 Subject: [Haiku-commits] r28696 - haiku/trunk/src/kits/interface Message-ID: <200811190604.mAJ64tH6030467@sheep.berlios.de> Author: anevilyak Date: 2008-11-19 07:04:53 +0100 (Wed, 19 Nov 2008) New Revision: 28696 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28696&view=rev Modified: haiku/trunk/src/kits/interface/ListView.cpp Log: Position-based binary searching can only be used if the view has been attached to a window already. If not, we fall back to using the BList-based search. Modified: haiku/trunk/src/kits/interface/ListView.cpp =================================================================== --- haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 05:11:37 UTC (rev 28695) +++ haiku/trunk/src/kits/interface/ListView.cpp 2008-11-19 06:04:53 UTC (rev 28696) @@ -733,6 +733,14 @@ int32 BListView::IndexOf(BListItem *item) const { + if (Window()) { + if (item != NULL) { + int32 index = IndexOf(BPoint(0.0, item->Top())); + if (index >= 0 && fList.ItemAt(index) == item) + return index; + return -1; + } + } return fList.IndexOf(item); } @@ -779,7 +787,7 @@ bool BListView::HasItem(BListItem *item) const { - return fList.HasItem(item); + return IndexOf(item) != -1; } // CountItems From stefano.ceccherini at gmail.com Wed Nov 19 08:53:46 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Wed, 19 Nov 2008 08:53:46 +0100 Subject: [Haiku-commits] r28693 - haiku/trunk/src/kits/interface In-Reply-To: <200811190401.mAJ415cS008068@sheep.berlios.de> References: <200811190401.mAJ415cS008068@sheep.berlios.de> Message-ID: <894b9700811182353m6740b3d9u97e7f51f41c75aec@mail.gmail.com> 2008/11/19 anevilyak at BerliOS : > Author: anevilyak > Date: 2008-11-19 05:01:05 +0100 (Wed, 19 Nov 2008) > New Revision: 28693 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28693&view=rev > > Modified: > haiku/trunk/src/kits/interface/PopUpMenu.cpp > Log: > Fix a potential race condition in BPopUpMenu: if Go() is called on an async > popup menu that hasn't yet been completely dismissed, it's possible to hit a > debugger call because the menu's view tries to add itself to the menu window > before the previous menu instance has removed it. This was quite easy to > hit with things like BColumnListView's column title context menu, since there > is no notification for when the menu was dismissed without invoking an item, > and thus double right clicking quickly enough would hit the debugger. Go() > now checks if the menu's tracking thread is still up, and if it is, waits for > it to go away before trying to start another instance. Fixes ticket #3146. I did that once (r17136) , but I wonder if it's correct. I mean, maybe the caller should be aware of the fact that you cannot call Go() on an already opened popupmenu. From superstippi at gmx.de Wed Nov 19 10:54:44 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 19 Nov 2008 10:54:44 +0100 Subject: [Haiku-commits] r28694 - haiku/trunk/src/kits/interface In-Reply-To: <200811190441.mAJ4frUn016871@sheep.berlios.de> References: <200811190441.mAJ4frUn016871@sheep.berlios.de> Message-ID: <20081119105444.1141.3@stippis2.1227086322.fake> anevilyak at BerliOS wrote: > Author: anevilyak > Date: 2008-11-19 05:41:51 +0100 (Wed, 19 Nov 2008) New Revision: 28694 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28694&view=rev > > Modified: > haiku/trunk/src/kits/interface/ListView.cpp > Log: > Minor optimization: since our list items cache their position > information, take advantage of this fact to make use of binary search in > IndexOf(BListItem *), rather than using BList's linear search. Also use > this mechanism to speed up HasItem(BListItem *). Nice! The previous change to SetTop() before calling Update() is nice too, I was also thinking the fix should be along those lines. Best regards, -Stephan From axeld at pinc-software.de Wed Nov 19 11:58:49 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 19 Nov 2008 11:58:49 +0100 CET Subject: [Haiku-commits] r28661 - haiku/trunk/src/apps/sudoku In-Reply-To: <4871854977-BeMail@laptop> Message-ID: <5613903069-BeMail@zon> "Fran?ois Revol" wrote: > > * Renamed settings file (removed the "pinc" part of it). > > * Removed BeOS compatible flag from the subdir. > It was working fine last time I tried (=the day before)... > :D Right, I actually intended to remove it from ActivityMonitor instead (and remove those hacks to make it work under BeOS). Feel free to add that line back in if you have to :-) Bye, Axel. From anevilyak at gmail.com Wed Nov 19 15:00:47 2008 From: anevilyak at gmail.com (Rene Gollent) Date: Wed, 19 Nov 2008 08:00:47 -0600 Subject: [Haiku-commits] r28693 - haiku/trunk/src/kits/interface In-Reply-To: <894b9700811182353m6740b3d9u97e7f51f41c75aec@mail.gmail.com> References: <200811190401.mAJ415cS008068@sheep.berlios.de> <894b9700811182353m6740b3d9u97e7f51f41c75aec@mail.gmail.com> Message-ID: On Wed, Nov 19, 2008 at 1:53 AM, Stefano Ceccherini wrote: > I did that once (r17136) , but I wonder if it's correct. I mean, maybe > the caller should be aware of the fact that you cannot call Go() on an > already opened popupmenu. I thought about that also, but the problem is, there is no reasonable way I can see that the app can use to avoid getting into this situation. With a synchronous menu it's obviously no problem since you're blocked until the menu returns, but in the async case, you have no way of tracking what's happening to the menu except waiting for its item invocation messages, which of course don't happen if you just click outside the menu. You could also subclass the menu and override MenusEnded(), and introduce some synchronization primitive to block the second call to Go(), but that seems like an unreasonable burden on app writers for such a basic system component, and would more or less be admitting that async Go() is unusable "as is". If I overlooked something I'd love to know about it, but I really don't see this as solvable at the app level without reinventing the wheel every time with our current menu API. Regards, Rene From superstippi at gmx.de Wed Nov 19 15:20:26 2008 From: superstippi at gmx.de (Stephan Assmus) Date: Wed, 19 Nov 2008 15:20:26 +0100 Subject: [Haiku-commits] r28693 - haiku/trunk/src/kits/interface In-Reply-To: References: <200811190401.mAJ415cS008068@sheep.berlios.de> <894b9700811182353m6740b3d9u97e7f51f41c75aec@mail.gmail.com> Message-ID: <20081119152026.2221.8@stippis2.1227086322.fake> Rene Gollent wrote: > On Wed, Nov 19, 2008 at 1:53 AM, Stefano Ceccherini > wrote: > > I did that once (r17136) , but I wonder if it's correct. I mean, maybe > > the caller should be aware of the fact that you cannot call Go() on an > > already opened popupmenu. > > I thought about that also, but the problem is, there is no reasonable way > I can see that the app can use to avoid getting into this situation. With > a synchronous menu it's obviously no problem since you're blocked until > the menu returns, but in the async case, you have no way of tracking > what's happening to the menu except waiting for its item invocation > messages, which of course don't happen if you just click outside the > menu. You could also subclass the menu and override MenusEnded(), and > introduce some synchronization primitive to block the second call to > Go(), but that seems like an unreasonable burden on app writers for such > a basic system component, and would more or less be admitting that async > Go() is unusable "as is". If I overlooked something I'd love to know > about it, but I really don't see this as solvable at the app level > without reinventing the wheel every time with our current menu API. The reasoning is sound, I think. :-) Best regards, -Stephan From stefano.ceccherini at gmail.com Wed Nov 19 15:21:33 2008 From: stefano.ceccherini at gmail.com (Stefano Ceccherini) Date: Wed, 19 Nov 2008 15:21:33 +0100 Subject: [Haiku-commits] r28693 - haiku/trunk/src/kits/interface In-Reply-To: <20081119152026.2221.8@stippis2.1227086322.fake> References: <200811190401.mAJ415cS008068@sheep.berlios.de> <894b9700811182353m6740b3d9u97e7f51f41c75aec@mail.gmail.com> <20081119152026.2221.8@stippis2.1227086322.fake> Message-ID: <894b9700811190621i55b09ebfjb739d1e58353222f@mail.gmail.com> 2008/11/19 Stephan Assmus : > > The reasoning is sound, I think. :-) > > Best regards, > -Stephan Indeed :) From alex at zappotek.com Wed Nov 19 15:24:00 2008 From: alex at zappotek.com (Alexandre Deckner) Date: Wed, 19 Nov 2008 15:24:00 +0100 Subject: [Haiku-commits] r28693 - haiku/trunk/src/kits/interface In-Reply-To: References: <200811190401.mAJ415cS008068@sheep.berlios.de> <894b9700811182353m6740b3d9u97e7f51f41c75aec@mail.gmail.com> Message-ID: <49242180.3060207@zappotek.com> Rene Gollent wrote: > On Wed, Nov 19, 2008 at 1:53 AM, Stefano Ceccherini > wrote: > >> I did that once (r17136) , but I wonder if it's correct. I mean, maybe >> the caller should be aware of the fact that you cannot call Go() on an >> already opened popupmenu. >> > > I thought about that also, but the problem is, there is no reasonable > way I can see that the app can use to avoid getting into this > situation. With a synchronous menu it's obviously no problem since > you're blocked until the menu returns, but in the async case, you have > no way of tracking what's happening to the menu except waiting for its > item invocation messages, which of course don't happen if you just > click outside the menu. You could also subclass the menu and override > MenusEnded(), and introduce some synchronization primitive to block > the second call to Go(), but that seems like an unreasonable burden on > app writers for such a basic system component, and would more or less > be admitting that async Go() is unusable "as is". If I overlooked > something I'd love to know about it, but I really don't see this as > solvable at the app level without reinventing the wheel every time > with our current menu API. I quickly skimmed through your mails, so i'm not sure that would apply for your problem, but i remember solving a similar one with the Trash popupmenu, i ended checking if the menu has a window to see if it was already showing, and not calling Go in this case. See r28152 Best regards, Alex From axeld at pinc-software.de Wed Nov 19 16:23:20 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Wed, 19 Nov 2008 16:23:20 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28664_-_in_haiku/trunk=3A_headers/priv?= =?utf-8?q?ate/app_src/servers/app?= In-Reply-To: Message-ID: <21484567609-BeMail@zon> "Rene Gollent" wrote: > On Sun, Nov 16, 2008 at 3:59 PM, axeld at BerliOS < > axeld at mail.berlios.de> wrote: > > * Added a Desktop::BroadcastToAllWindows() method that sends all > > ServerWindows > > a message. > > * The DesktopSettings class is now using that to send the new > > AS_SYSTEM_FONT_CHANGED message to all windows. > > * The ServerWindow now propagates font changes to its decorator, > > causing it > > to update its drawing. That means changing the bold font in the > > "Fonts" > > preferences application will instantly change all window titles. > Would it be feasible to do something similar to broadcast such > changes > client-side? That'd make it possible to implement something similar > to > Dano's UISettingsChanged() hook to allow controls and apps to react > dynamically to sys color and font changes. Sure, that would just be the next step - we just have to forward it in the ServerWindow that gets the message. Our layout engine should listen to this and relayout the window then. Bye, Axel. From korli at mail.berlios.de Wed Nov 19 21:24:48 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 19 Nov 2008 21:24:48 +0100 Subject: [Haiku-commits] r28697 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200811192024.mAJKOmCD008896@sheep.berlios.de> Author: korli Date: 2008-11-19 21:24:47 +0100 (Wed, 19 Nov 2008) New Revision: 28697 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28697&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp Log: introduced a widget inside the audio function group to extract widget node attributes and reuse functions. Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-11-19 06:04:53 UTC (rev 28696) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/driver.h 2008-11-19 20:24:47 UTC (rev 28697) @@ -241,22 +241,15 @@ */ struct hda_audio_group { hda_codec* codec; + hda_widget widget; /* Multi Audio API data */ hda_stream* playback_stream; hda_stream* record_stream; - uint32 root_node_id; uint32 widget_start; uint32 widget_count; - uint32 supported_formats; - uint32 supported_rates; - uint32 supported_pm; - - uint32 input_amplifier_capabilities; - uint32 output_amplifier_capabilities; - uint32 association_count; hda_widget* widgets; Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-19 06:04:53 UTC (rev 28696) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-19 20:24:47 UTC (rev 28697) @@ -286,10 +286,11 @@ static status_t hda_widget_get_stream_support(hda_audio_group* audioGroup, hda_widget* widget) { - if ((widget->capabilities.audio & AUDIO_CAP_FORMAT_OVERRIDE) == 0) { + if (audioGroup->widget.node_id != widget->node_id + && (widget->capabilities.audio & AUDIO_CAP_FORMAT_OVERRIDE) == 0) { // adopt capabilities of the audio group - widget->d.io.formats = audioGroup->supported_formats; - widget->d.io.rates = audioGroup->supported_rates; + widget->d.io.formats = audioGroup->widget.d.io.formats; + widget->d.io.rates = audioGroup->widget.d.io.rates; return B_OK; } @@ -305,8 +306,10 @@ uint32 response; corb_t verb; - if ((widget->capabilities.audio & AUDIO_CAP_OUTPUT_AMPLIFIER) != 0) { - if ((widget->capabilities.audio & AUDIO_CAP_AMPLIFIER_OVERRIDE) != 0) { + if ((widget->capabilities.audio & AUDIO_CAP_OUTPUT_AMPLIFIER) != 0 + || audioGroup->widget.node_id == widget->node_id) { + if ((widget->capabilities.audio & AUDIO_CAP_AMPLIFIER_OVERRIDE) != 0 + || audioGroup->widget.node_id == widget->node_id) { verb = MAKE_VERB(audioGroup->codec->addr, widget->node_id, VID_GET_PARAMETER, PID_OUTPUT_AMPLIFIER_CAP); status_t status = hda_send_verbs(audioGroup->codec, &verb, @@ -318,12 +321,14 @@ } else { // adopt capabilities from the audio function group widget->capabilities.output_amplifier - = audioGroup->output_amplifier_capabilities; + = audioGroup->widget.capabilities.output_amplifier; } } - if ((widget->capabilities.audio & AUDIO_CAP_INPUT_AMPLIFIER) != 0) { - if ((widget->capabilities.audio & AUDIO_CAP_AMPLIFIER_OVERRIDE) != 0) { + if ((widget->capabilities.audio & AUDIO_CAP_INPUT_AMPLIFIER) != 0 + || audioGroup->widget.node_id == widget->node_id) { + if ((widget->capabilities.audio & AUDIO_CAP_AMPLIFIER_OVERRIDE + || audioGroup->widget.node_id == widget->node_id) != 0) { verb = MAKE_VERB(audioGroup->codec->addr, widget->node_id, VID_GET_PARAMETER, PID_INPUT_AMPLIFIER_CAP); status_t status = hda_send_verbs(audioGroup->codec, &verb, @@ -335,7 +340,7 @@ } else { // adopt capabilities from the audio function group widget->capabilities.input_amplifier - = audioGroup->input_amplifier_capabilities; + = audioGroup->widget.capabilities.input_amplifier; } } @@ -478,32 +483,32 @@ corb_t verbs[3]; uint32 resp[3]; - hda_get_stream_support(audioGroup->codec, audioGroup->root_node_id, - &audioGroup->supported_formats, &audioGroup->supported_rates); - hda_get_pm_support(audioGroup->codec, audioGroup->root_node_id, - &audioGroup->supported_pm); - - verbs[0] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id, + hda_widget_get_stream_support(audioGroup, &audioGroup->widget); + hda_widget_get_pm_support(audioGroup, &audioGroup->widget); + hda_widget_get_amplifier_capabilities(audioGroup, &audioGroup->widget); + + verbs[0] = MAKE_VERB(audioGroup->codec->addr, audioGroup->widget.node_id, VID_GET_PARAMETER, PID_AUDIO_GROUP_CAP); - verbs[1] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id, + verbs[1] = MAKE_VERB(audioGroup->codec->addr, audioGroup->widget.node_id, VID_GET_PARAMETER, PID_GPIO_COUNT); - verbs[2] = MAKE_VERB(audioGroup->codec->addr, audioGroup->root_node_id, + verbs[2] = MAKE_VERB(audioGroup->codec->addr, audioGroup->widget.node_id, VID_GET_PARAMETER, PID_SUB_NODE_COUNT); if (hda_send_verbs(audioGroup->codec, verbs, resp, 3) != B_OK) return B_ERROR; dprintf("hda: Audio Group: Output delay: %ld samples, Input delay: %ld " - "samples, Beep Generator: %s\n", resp[0] & 0xf, - (resp[0] >> 8) & 0xf, (resp[0] & (1 << 16)) ? "yes" : "no"); + "samples, Beep Generator: %s\n", AUDIO_GROUP_CAP_OUTPUT_DELAY(resp[0]), + AUDIO_GROUP_CAP_INPUT_DELAY(resp[0]), + AUDIO_GROUP_CAP_BEEPGEN(resp[0]) ? "yes" : "no"); dprintf("hda: #GPIO: %ld, #GPO: %ld, #GPI: %ld, unsol: %s, wake: %s\n", - resp[4] & 0xff, (resp[1] >> 8) & 0xff, - (resp[1] >> 16) & 0xff, (resp[1] & (1 << 30)) ? "yes" : "no", - (resp[1] & (1 << 31)) ? "yes" : "no"); + GPIO_COUNT_NUM_GPIO(resp[1]), GPIO_COUNT_NUM_GPO(resp[1]), + GPIO_COUNT_NUM_GPI(resp[1]), GPIO_COUNT_GPIUNSOL(resp[1]) ? "yes" : "no", + GPIO_COUNT_GPIWAKE(resp[1]) ? "yes" : "no"); - audioGroup->widget_start = resp[2] >> 16; - audioGroup->widget_count = resp[2] & 0xff; + audioGroup->widget_start = SUB_NODE_COUNT_START(resp[2]); + audioGroup->widget_count = SUB_NODE_COUNT_TOTAL(resp[2]); dprintf("hda: widget start %lu, count %lu\n", audioGroup->widget_start, audioGroup->widget_count); @@ -873,7 +878,7 @@ return B_NO_MEMORY; /* Setup minimal info needed by hda_codec_parse_afg */ - audioGroup->root_node_id = audioGroupNodeID; + audioGroup->widget.node_id = audioGroupNodeID; audioGroup->codec = codec; audioGroup->multi = (hda_multi*)calloc(1, sizeof(hda_multi)); @@ -1052,7 +1057,7 @@ verbs[0] = MAKE_VERB(codecAddress, 0, VID_GET_PARAMETER, PID_VENDOR_ID); verbs[1] = MAKE_VERB(codecAddress, 0, VID_GET_PARAMETER, PID_REVISION_ID); - verbs[2] = MAKE_VERB(codecAddress, 0, VID_GET_PARAMETER, + verbs[2] = MAKE_VERB(codecAddress, 0, VID_GET_PARAMETER, PID_SUB_NODE_COUNT); if (hda_send_verbs(codec, verbs, (uint32*)&response, 3) != B_OK) @@ -1078,7 +1083,7 @@ if (hda_send_verbs(codec, verbs, &groupType, 1) != B_OK) goto err; - if ((groupType & 0xff) == 1) { + if ((groupType & FUNCTION_GROUP_NODETYPE_MASK) == FUNCTION_GROUP_NODETYPE_AUDIO) { /* Found an Audio Function Group! */ status_t status = hda_codec_new_audio_group(codec, nodeID); if (status != B_OK) { Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h 2008-11-19 06:04:53 UTC (rev 28696) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec_defs.h 2008-11-19 20:24:47 UTC (rev 28697) @@ -142,6 +142,40 @@ #define PID_OUTPUT_AMPLIFIER_CAP 0x12 #define PID_VOLUME_KNOB_CAP 0x13 +/* Subordinate node count */ +#define SUB_NODE_COUNT_TOTAL_MASK 0x000000ff +#define SUB_NODE_COUNT_TOTAL_SHIFT 0 +#define SUB_NODE_COUNT_START_MASK 0x00ff0000 +#define SUB_NODE_COUNT_START_SHIFT 16 + +#define SUB_NODE_COUNT_TOTAL(c) ((c & SUB_NODE_COUNT_TOTAL_MASK) \ + >> SUB_NODE_COUNT_TOTAL_SHIFT) +#define SUB_NODE_COUNT_START(c) ((c & SUB_NODE_COUNT_START_MASK) \ + >> SUB_NODE_COUNT_START_SHIFT) + +/* Function group type */ +#define FUNCTION_GROUP_NODETYPE_MASK 0x000000ff +#define FUNCTION_GROUP_UNSOLCAPABLE_MASK 0x00000100 + +#define FUNCTION_GROUP_NODETYPE_AUDIO 0x00000001 +#define FUNCTION_GROUP_NODETYPE_MODEM 0x00000002 + +/* Audio Function group capabilities */ +#define AUDIO_GROUP_CAP_OUTPUT_DELAY_MASK 0x0000000f +#define AUDIO_GROUP_CAP_OUTPUT_DELAY_SHIFT 0 +#define AUDIO_GROUP_CAP_INPUT_DELAY_MASK 0x00000f00 +#define AUDIO_GROUP_CAP_INPUT_DELAY_SHIFT 8 +#define AUDIO_GROUP_CAP_BEEPGEN_MASK 0x00010000 +#define AUDIO_GROUP_CAP_BEEPGEN_SHIFT 16 + +#define AUDIO_GROUP_CAP_OUTPUT_DELAY(c) ((c & AUDIO_GROUP_CAP_OUTPUT_DELAY_MASK) \ + >> AUDIO_GROUP_CAP_OUTPUT_DELAY_SHIFT) +#define AUDIO_GROUP_CAP_INPUT_DELAY(c) ((c & AUDIO_GROUP_CAP_INPUT_DELAY_MASK) \ + >> AUDIO_GROUP_CAP_INPUT_DELAY_SHIFT) +#define AUDIO_GROUP_CAP_BEEPGEN(c) ((c & AUDIO_GROUP_CAP_BEEPGEN_MASK) \ + >> AUDIO_GROUP_CAP_BEEPGEN_SHIFT) + + /* Audio widget capabilities */ #define AUDIO_CAP_DELAY_MASK 0x000f0000 #define AUDIO_CAP_DELAY_SHIFT 16 @@ -263,4 +297,23 @@ #define CONF_DEFAULT_LOCATION(c) ((c & CONF_DEFAULT_LOCATION_MASK) >> CONF_DEFAULT_LOCATION_SHIFT) #define CONF_DEFAULT_CONNECTIVITY(c) ((c & CONF_DEFAULT_CONNECTIVITY_MASK) >> CONF_DEFAULT_CONNECTIVITY_SHIFT) +/* GP I/O count */ +#define GPIO_COUNT_NUM_GPIO_MASK 0x000000ff +#define GPIO_COUNT_NUM_GPIO_SHIFT 0 +#define GPIO_COUNT_NUM_GPO_MASK 0x0000ff00 +#define GPIO_COUNT_NUM_GPO_SHIFT 8 +#define GPIO_COUNT_NUM_GPI_MASK 0x00ff0000 +#define GPIO_COUNT_NUM_GPI_SHIFT 16 +#define GPIO_COUNT_GPIUNSOL_MASK 0x40000000 +#define GPIO_COUNT_GPIUNSOL_SHIFT 30 +#define GPIO_COUNT_GPIWAKE_MASK 0x80000000 +#define GPIO_COUNT_GPIWAKE_SHIFT 31 + +#define GPIO_COUNT_NUM_GPIO(c) ((c & GPIO_COUNT_NUM_GPIO_MASK) >> GPIO_COUNT_NUM_GPIO_SHIFT) +#define GPIO_COUNT_NUM_GPO(c) ((c & GPIO_COUNT_NUM_GPO_MASK) >> GPIO_COUNT_NUM_GPO_SHIFT) +#define GPIO_COUNT_NUM_GPI(c) ((c & GPIO_COUNT_NUM_GPI_MASK) >> GPIO_COUNT_NUM_GPI_SHIFT) +#define GPIO_COUNT_GPIUNSOL(c) ((c & GPIO_COUNT_GPIUNSOL_MASK) >> GPIO_COUNT_GPIUNSOL_SHIFT) +#define GPIO_COUNT_GPIWAKE(c) ((c & GPIO_COUNT_GPIWAKE_MASK) >> GPIO_COUNT_GPIWAKE_SHIFT) + + #endif /* HDA_CODEC_H */ Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2008-11-19 06:04:53 UTC (rev 28696) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2008-11-19 20:24:47 UTC (rev 28697) @@ -98,8 +98,8 @@ } /* determine output/input rates */ - data->output_rates = audioGroup->supported_rates; - data->input_rates = audioGroup->supported_rates; + data->output_rates = audioGroup->widget.d.io.rates; + data->input_rates = audioGroup->widget.d.io.rates; /* force existance of 48kHz if variable rates are not supported */ if (data->output_rates == 0) @@ -110,8 +110,8 @@ data->max_cvsr_rate = 0; data->min_cvsr_rate = 0; - data->output_formats = audioGroup->supported_formats; - data->input_formats = audioGroup->supported_formats; + data->output_formats = audioGroup->widget.d.io.formats; + data->input_formats = audioGroup->widget.d.io.formats; data->lock_sources = B_MULTI_LOCK_INTERNAL; data->timecode_sources = 0; data->interface_flags = B_MULTI_INTERFACE_PLAYBACK | B_MULTI_INTERFACE_RECORD; From korli at mail.berlios.de Wed Nov 19 23:48:32 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Wed, 19 Nov 2008 23:48:32 +0100 Subject: [Haiku-commits] r28698 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200811192248.mAJMmWIe021406@sheep.berlios.de> Author: korli Date: 2008-11-19 23:48:32 +0100 (Wed, 19 Nov 2008) New Revision: 28698 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28698&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp Log: correctly identify the beeper for AD1988 codecs Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-19 20:24:47 UTC (rev 28697) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_codec.cpp 2008-11-19 22:48:32 UTC (rev 28698) @@ -536,6 +536,11 @@ /* Check specific node ids declared as inputs as beepers */ switch ((audioGroup->codec->vendor_id << 16) | audioGroup->codec->product_id) { + case 0x11d41988: + case 0x11d4198b: + if (nodeID == 26) + widget.type = WT_BEEP_GENERATOR; + break; case 0x10ec0260: if (nodeID == 23) widget.type = WT_BEEP_GENERATOR; From korli at mail.berlios.de Thu Nov 20 00:14:55 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 20 Nov 2008 00:14:55 +0100 Subject: [Haiku-commits] r28699 - haiku/trunk/src/add-ons/kernel/drivers/audio/hda Message-ID: <200811192314.mAJNEtwq023107@sheep.berlios.de> Author: korli Date: 2008-11-20 00:14:54 +0100 (Thu, 20 Nov 2008) New Revision: 28699 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28699&view=rev Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp Log: * uses the default output stream on all audio outputs (and all output paths) * enable trace to debug mixer controls build Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2008-11-19 22:48:32 UTC (rev 28698) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_controller.cpp 2008-11-19 23:14:54 UTC (rev 28699) @@ -641,7 +641,7 @@ verb[1] = MAKE_VERB(codec->addr, stream->io_widgets[i], VID_SET_CONVERTER_STREAM_CHANNEL, val); hda_send_verbs(codec, verb, response, 2); - channelNum += 2; // TODO stereo widget ? + //channelNum += 2; // TODO stereo widget ? Every output gets the same stream for now dprintf("%ld ", stream->io_widgets[i]); } dprintf("\n"); Modified: haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2008-11-19 22:48:32 UTC (rev 28698) +++ haiku/trunk/src/add-ons/kernel/drivers/audio/hda/hda_multi_audio.cpp 2008-11-19 23:14:54 UTC (rev 28699) @@ -16,7 +16,7 @@ # undef TRACE #endif -//#define TRACE_MULTI_AUDIO +#define TRACE_MULTI_AUDIO #ifdef TRACE_MULTI_AUDIO # define TRACE(a...) dprintf("\33[34mhda:\33[0m " a) #else From stippi at mail.berlios.de Thu Nov 20 14:00:09 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 20 Nov 2008 14:00:09 +0100 Subject: [Haiku-commits] r28700 - haiku/trunk/src/add-ons/kernel/bus_managers/ps2 Message-ID: <200811201300.mAKD09lR009238@sheep.berlios.de> Author: stippi Date: 2008-11-20 14:00:06 +0100 (Thu, 20 Nov 2008) New Revision: 28700 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28700&view=rev Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c Log: Turned off the Synaptics driver again, as it seems to give some people problems still. Modified: haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c =================================================================== --- haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-19 23:14:54 UTC (rev 28699) +++ haiku/trunk/src/add-ons/kernel/bus_managers/ps2/ps2_dev.c 2008-11-20 13:00:06 UTC (rev 28700) @@ -102,7 +102,7 @@ // probe devices // the probe function has to set the dev name and the dev packet size -#if 1 +#if 0 status = probe_trackpoint(dev); if (status == B_OK) { *hooks = &gStandardMouseDeviceHooks; From stippi at mail.berlios.de Thu Nov 20 22:51:48 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Thu, 20 Nov 2008 22:51:48 +0100 Subject: [Haiku-commits] r28701 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200811202151.mAKLpmhp020024@sheep.berlios.de> Author: stippi Date: 2008-11-20 22:51:43 +0100 (Thu, 20 Nov 2008) New Revision: 28701 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28701&view=rev Modified: haiku/trunk/headers/os/interface/TabView.h haiku/trunk/src/kits/interface/TabView.cpp Log: Patch by Artur Wyszynski: * The BTabView can now be used with layout management. In this setup, children views are managed by a BCardLayout and are hidden/shown instead of removed/ added when (de)activated. Thanks a lot! Modified: haiku/trunk/headers/os/interface/TabView.h =================================================================== --- haiku/trunk/headers/os/interface/TabView.h 2008-11-20 13:00:06 UTC (rev 28700) +++ haiku/trunk/headers/os/interface/TabView.h 2008-11-20 21:51:43 UTC (rev 28701) @@ -106,6 +106,11 @@ class BTabView : public BView { public: + BTabView(const char *name, + button_width width = B_WIDTH_AS_USUAL, + uint32 flags = B_FULL_UPDATE_ON_RESIZE | + B_WILL_DRAW | B_NAVIGABLE_JUMP | + B_FRAME_EVENTS | B_NAVIGABLE); BTabView(BRect frame, const char *name, button_width width = B_WIDTH_AS_USUAL, uint32 resizingMode = B_FOLLOW_ALL, @@ -150,9 +155,13 @@ virtual void SetFlags(uint32 flags); virtual void SetResizingMode(uint32 mode); -virtual void GetPreferredSize(float *width, float *height); -virtual void ResizeToPreferred(); +virtual void ResizeToPreferred(); +virtual void GetPreferredSize(float* _width, float* _height); +virtual BSize MinSize(); +virtual BSize MaxSize(); +virtual BSize PreferredSize(); + virtual BHandler *ResolveSpecifier(BMessage *message, int32 index, BMessage *specifier, int32 what, const char *property); virtual status_t GetSupportedSuites(BMessage *message); @@ -174,7 +183,7 @@ BView *ViewForTab(int32 tabIndex) const; private: - void _InitObject(); + void _InitObject(bool layouted = false); virtual void _ReservedTabView1(); virtual void _ReservedTabView2(); Modified: haiku/trunk/src/kits/interface/TabView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TabView.cpp 2008-11-20 13:00:06 UTC (rev 28700) +++ haiku/trunk/src/kits/interface/TabView.cpp 2008-11-20 21:51:43 UTC (rev 28701) @@ -8,8 +8,11 @@ */ #include +#include #include +#include +#include #include #include #include @@ -127,12 +130,15 @@ void BTab::Select(BView *owner) -{ +{ + // TODO: Shouldn't we still maintain fSelected like in Deselect()? if (!owner || !View() || !owner->Window()) return; - owner->AddChild(fView); - //fView->Show(); + // NOTE: Views are not added/removed, if there is layout, + // they are made visible/invisible in that case. + if (!owner->GetLayout()) + owner->AddChild(fView); fSelected = true; } @@ -141,9 +147,18 @@ void BTab::Deselect() { - if (View()) - View()->RemoveSelf(); - + if (View()) { + // NOTE: Views are not added/removed, if there is layout, + // they are made visible/invisible in that case. + bool removeView = false; + BView* container = View()->Parent(); + if (container) + removeView = + dynamic_cast(container->GetLayout()) == NULL; + if (removeView) + View()->RemoveSelf(); + } + fSelected = false; } @@ -329,7 +344,17 @@ // #pragma mark - +BTabView::BTabView(const char *name, button_width width, uint32 flags) + : BView(name, flags) +{ + SetFont(be_bold_font); + + _InitObject(true); + + fTabWidthSetting = width; +} + BTabView::BTabView(BRect frame, const char *name, button_width width, uint32 resizingMode, uint32 flags) : BView(frame, name, resizingMode, flags) @@ -669,6 +694,7 @@ index = Selection(); BTab *tab = TabAt(Selection()); + if (tab) tab->Deselect(); @@ -678,6 +704,12 @@ fTabOffset = 0.0f; tab->Select(ContainerView()); fSelection = index; + + // make the view visible through the layout if there is one + BCardLayout* layout + = dynamic_cast(fContainerView->GetLayout()); + if (layout) + layout->SetVisibleItem(index); } Invalidate(); @@ -917,6 +949,36 @@ } +BSize +BTabView::MinSize() +{ + BSize size = fContainerView->MinSize(); + size.height += TabHeight() + 6.0f; + size.width += 6.0f; + return BLayoutUtils::ComposeSize(ExplicitMinSize(), size); +} + + +BSize +BTabView::MaxSize() +{ + BSize size = fContainerView->MaxSize(); + size.height += TabHeight() + 6.0f; + size.width += 6.0f; + return BLayoutUtils::ComposeSize(ExplicitMaxSize(), size); +} + + +BSize +BTabView::PreferredSize() +{ + BSize size = fContainerView->PreferredSize(); + size.height += TabHeight() + 6.0f; + size.width += 6.0f; + return BLayoutUtils::ComposeSize(ExplicitPreferredSize(), size); +} + + void BTabView::ResizeToPreferred() { @@ -957,6 +1019,9 @@ tab = new BTab(target); else tab->SetView(target); + + if (fContainerView->GetLayout()) + fContainerView->GetLayout()->AddView(CountTabs(), target); fTabList->AddItem(tab); } @@ -987,6 +1052,9 @@ else SetFocusTab(fFocus, true); + if (fContainerView->GetLayout()) + fContainerView->GetLayout()->RemoveItem(index); + return tab; } @@ -1062,7 +1130,7 @@ void -BTabView::_InitObject() +BTabView::_InitObject(bool layouted) { fTabList = new BList; @@ -1088,6 +1156,9 @@ fContainerView = new BView(bounds, "view container", B_FOLLOW_ALL, B_WILL_DRAW); + if (layouted) + fContainerView->SetLayout(new(std::nothrow) BCardLayout()); + fContainerView->SetViewColor(color); fContainerView->SetLowColor(color); From zharik at gmx.li Thu Nov 20 23:43:58 2008 From: zharik at gmx.li (Siarzhuk Zharski) Date: Thu, 20 Nov 2008 23:43:58 +0100 Subject: [Haiku-commits] r28634 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/dev/mii compat/net In-Reply-To: <200811122208.mACM8vWS022110@sheep.berlios.de> References: <200811122208.mACM8vWS022110@sheep.berlios.de> Message-ID: <4925E82E.7070800@gmx.li> Hi, Looks like some of this modifications broke synchronization with headers/posix/net/if_media.h header. Actual version of NetworkStatus Applet stopped to display correct link status of my rtl8139. this is observed starting from r28634. korli at BerliOS wrote: > Author: korli > Date: 2008-11-12 23:08:56 +0100 (Wed, 12 Nov 2008) > New Revision: 28634 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28634&view=rev > > Added: > haiku/trunk/src/libs/compat/freebsd_network/compat/dev/mii/miidevs > haiku/trunk/src/libs/compat/freebsd_network/miidevs2h.awk > Modified: > haiku/trunk/src/libs/compat/freebsd_network/Jamfile > haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h > Log: > * generates miidevs.h with the freebsd awk script > * update net/if_media.h > > Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h > =================================================================== > --- haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h 2008-11-12 20:49:12 UTC (rev 28633) > +++ haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h 2008-11-12 22:08:56 UTC (rev 28634) > > @@ -267,8 +275,8 @@ > /* > * Status bits > */ > -#define IFM_AVALID 0x10000000 /* Active bit valid */ > -#define IFM_ACTIVE 0x00800000 /* same as Haiku's */ > +#define IFM_AVALID 0x00000001 /* Active bit valid */ > +#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ > > /* Mask of "status valid" bits, for ifconfig(8). */ > #define IFM_STATUS_VALID IFM_AVALID > Below is a quote from actual revision of headers/posix/net/if_media.h. Note that bit mask of IFM_ACTIVE contains old value. 34 35 //* General options *// 36 37 #define IFM_FULL_DUPLEX 0x00100000 //* Full duplex *// 38 #define IFM_HALF_DUPLEX 0x00200000 //* Half duplex *// 39 #define IFM_LOOP 0x00400000 //* hardware in loopback *// 40 #define IFM_ACTIVE 0x00800000 //* Media link is active *// Fixing this IFM_ACTIVE value to 0x00000002 resolve my problem with NetworkStatus Applet. Looks like some synchronization is still required. :-) From korli at mail.berlios.de Thu Nov 20 23:54:48 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 20 Nov 2008 23:54:48 +0100 Subject: [Haiku-commits] r28702 - haiku/vendor/freebsd/current Message-ID: <200811202254.mAKMsm52024845@sheep.berlios.de> Author: korli Date: 2008-11-20 23:54:48 +0100 (Thu, 20 Nov 2008) New Revision: 28702 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28702&view=rev Added: haiku/vendor/freebsd/current/net/ Log: net directory From korli at mail.berlios.de Thu Nov 20 23:58:09 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 20 Nov 2008 23:58:09 +0100 Subject: [Haiku-commits] r28703 - haiku/vendor/freebsd/current/net Message-ID: <200811202258.mAKMw9bE025063@sheep.berlios.de> Author: korli Date: 2008-11-20 23:58:09 +0100 (Thu, 20 Nov 2008) New Revision: 28703 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28703&view=rev Added: haiku/vendor/freebsd/current/net/if_media.h Log: added original if_media.h Copied: haiku/vendor/freebsd/current/net/if_media.h (from rev 20985, haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h) From korli at mail.berlios.de Thu Nov 20 23:59:02 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Thu, 20 Nov 2008 23:59:02 +0100 Subject: [Haiku-commits] r28704 - haiku/vendor/freebsd/current/net Message-ID: <200811202259.mAKMx2OV025116@sheep.berlios.de> Author: korli Date: 2008-11-20 23:59:01 +0100 (Thu, 20 Nov 2008) New Revision: 28704 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28704&view=rev Modified: haiku/vendor/freebsd/current/net/if_media.h Log: updated if_media.h Modified: haiku/vendor/freebsd/current/net/if_media.h =================================================================== --- haiku/vendor/freebsd/current/net/if_media.h 2008-11-20 22:58:09 UTC (rev 28703) +++ haiku/vendor/freebsd/current/net/if_media.h 2008-11-20 22:59:01 UTC (rev 28704) @@ -1,5 +1,5 @@ /* $NetBSD: if_media.h,v 1.3 1997/03/26 01:19:27 thorpej Exp $ */ -/* $FreeBSD: src/sys/net/if_media.h,v 1.30.2.3 2006/08/10 10:21:00 glebius Exp $ */ +/* $FreeBSD: src/sys/net/if_media.h,v 1.43 2008/08/01 22:13:39 antoine Exp $ */ /*- * Copyright (c) 1997 @@ -144,6 +144,7 @@ #define IFM_10G_LR 18 /* 10GBase-LR 1310nm Single-mode */ #define IFM_10G_SR 19 /* 10GBase-SR 850nm Multi-mode */ #define IFM_10G_CX4 20 /* 10GBase CX4 copper */ +#define IFM_2500_SX 21 /* 2500BaseSX - multi-mode fiber */ /* note 31 is the max! */ @@ -198,11 +199,16 @@ #define IFM_IEEE80211_OFDM72 18 /* OFDM 72Mbps */ #define IFM_IEEE80211_DS354k 19 /* Direct Sequence 354Kbps */ #define IFM_IEEE80211_DS512k 20 /* Direct Sequence 512Kbps */ +#define IFM_IEEE80211_OFDM3 21 /* OFDM 3Mbps */ +#define IFM_IEEE80211_OFDM4 22 /* OFDM 4.5Mbps */ +#define IFM_IEEE80211_OFDM27 23 /* OFDM 27Mbps */ +/* NB: not enough bits to express MCS fully */ +#define IFM_IEEE80211_MCS 24 /* HT MCS rate */ #define IFM_IEEE80211_ADHOC 0x00000100 /* Operate in Adhoc mode */ #define IFM_IEEE80211_HOSTAP 0x00000200 /* Operate in Host AP mode */ #define IFM_IEEE80211_IBSS 0x00000400 /* Operate in IBSS mode */ -#define IFM_IEEE80211_IBSSMASTER 0x00000800 /* Operate as an IBSS master */ +#define IFM_IEEE80211_WDS 0x00000800 /* Operate in WDS mode */ #define IFM_IEEE80211_TURBO 0x00001000 /* Operate in turbo mode */ #define IFM_IEEE80211_MONITOR 0x00002000 /* Operate in monitor mode */ @@ -211,6 +217,8 @@ #define IFM_IEEE80211_11B 0x00020000 /* Direct Sequence mode */ #define IFM_IEEE80211_11G 0x00030000 /* 2Ghz, CCK mode */ #define IFM_IEEE80211_FH 0x00040000 /* 2Ghz, GFSK mode */ +#define IFM_IEEE80211_11NA 0x00050000 /* 5Ghz, HT mode */ +#define IFM_IEEE80211_11NG 0x00060000 /* 2Ghz, HT mode */ /* * ATM @@ -335,12 +343,12 @@ { IFM_1000_SX, "1000baseSX" }, \ { IFM_1000_LX, "1000baseLX" }, \ { IFM_1000_CX, "1000baseCX" }, \ - { IFM_1000_T, "1000baseTX" }, \ { IFM_1000_T, "1000baseT" }, \ { IFM_HPNA_1, "homePNA" }, \ { IFM_10G_LR, "10Gbase-LR" }, \ { IFM_10G_SR, "10Gbase-SR" }, \ { IFM_10G_CX4, "10Gbase-CX4" }, \ + { IFM_2500_SX, "2500BaseSX" }, \ { 0, NULL }, \ } @@ -360,8 +368,10 @@ { IFM_1000_SX, "1000SX" }, \ { IFM_1000_LX, "1000LX" }, \ { IFM_1000_CX, "1000CX" }, \ + { IFM_1000_T, "1000baseTX" }, \ { IFM_1000_T, "1000TX" }, \ { IFM_1000_T, "1000T" }, \ + { IFM_2500_SX, "2500SX" }, \ { 0, NULL }, \ } @@ -437,6 +447,9 @@ { IFM_IEEE80211_OFDM72, "OFDM/72Mbps" }, \ { IFM_IEEE80211_DS354k, "DS/354Kbps" }, \ { IFM_IEEE80211_DS512k, "DS/512Kbps" }, \ + { IFM_IEEE80211_OFDM3, "OFDM/3Mbps" }, \ + { IFM_IEEE80211_OFDM4, "OFDM/4.5Mbps" }, \ + { IFM_IEEE80211_OFDM27, "OFDM/27Mbps" }, \ { 0, NULL }, \ } @@ -472,6 +485,9 @@ { IFM_IEEE80211_DS354k, "DirectSequence/354Kbps" }, \ { IFM_IEEE80211_DS512k, "DS512K" }, \ { IFM_IEEE80211_DS512k, "DirectSequence/512Kbps" }, \ + { IFM_IEEE80211_OFDM3, "OFDM3" }, \ + { IFM_IEEE80211_OFDM4, "OFDM4.5" }, \ + { IFM_IEEE80211_OFDM27, "OFDM27" }, \ { 0, NULL }, \ } @@ -479,7 +495,7 @@ { IFM_IEEE80211_ADHOC, "adhoc" }, \ { IFM_IEEE80211_HOSTAP, "hostap" }, \ { IFM_IEEE80211_IBSS, "ibss" }, \ - { IFM_IEEE80211_IBSSMASTER, "ibss-master" }, \ + { IFM_IEEE80211_WDS, "wds" }, \ { IFM_IEEE80211_TURBO, "turbo" }, \ { IFM_IEEE80211_MONITOR, "monitor" }, \ { 0, NULL }, \ @@ -491,6 +507,8 @@ { IFM_IEEE80211_11B, "11b" }, \ { IFM_IEEE80211_11G, "11g" }, \ { IFM_IEEE80211_FH, "fh" }, \ + { IFM_IEEE80211_11NA, "11na" }, \ + { IFM_IEEE80211_11NG, "11ng" }, \ { 0, NULL }, \ } @@ -584,6 +602,7 @@ { IFM_ETHER | IFM_10G_LR, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_10G_SR, IF_Gbps(10ULL) }, \ { IFM_ETHER | IFM_10G_CX4, IF_Gbps(10ULL) }, \ + { IFM_ETHER | IFM_2500_SX, IF_Mbps(2500ULL) }, \ \ { IFM_TOKEN | IFM_TOK_STP4, IF_Mbps(4) }, \ { IFM_TOKEN | IFM_TOK_STP16, IF_Mbps(16) }, \ From korli at mail.berlios.de Fri Nov 21 00:07:41 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Fri, 21 Nov 2008 00:07:41 +0100 Subject: [Haiku-commits] r28705 - haiku/trunk/src/libs/compat/freebsd_network/compat/net Message-ID: <200811202307.mAKN7fel026396@sheep.berlios.de> Author: korli Date: 2008-11-21 00:07:41 +0100 (Fri, 21 Nov 2008) New Revision: 28705 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28705&view=rev Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h Log: merge correctly while keeping Haiku specifics. Thanks Siarzhuk! Modified: haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h =================================================================== --- haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h 2008-11-20 22:59:01 UTC (rev 28704) +++ haiku/trunk/src/libs/compat/freebsd_network/compat/net/if_media.h 2008-11-20 23:07:41 UTC (rev 28705) @@ -275,8 +275,8 @@ /* * Status bits */ -#define IFM_AVALID 0x00000001 /* Active bit valid */ -#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */ +#define IFM_AVALID 0x10000000 /* Active bit valid */ +#define IFM_ACTIVE 0x00800000 /* same as Haiku's */ /* Mask of "status valid" bits, for ifconfig(8). */ #define IFM_STATUS_VALID IFM_AVALID From korli at users.berlios.de Fri Nov 21 00:09:12 2008 From: korli at users.berlios.de (=?ISO-8859-1?Q?J=E9r=F4me_Duval?=) Date: Fri, 21 Nov 2008 00:09:12 +0100 Subject: [Haiku-commits] r28634 - in haiku/trunk/src/libs/compat/freebsd_network: . compat/dev/mii compat/net In-Reply-To: <4925E82E.7070800@gmx.li> References: <200811122208.mACM8vWS022110@sheep.berlios.de> <4925E82E.7070800@gmx.li> Message-ID: > Looks like some of this modifications broke synchronization with > headers/posix/net/if_media.h header. Actual version of NetworkStatus > Applet stopped to display correct link status of my rtl8139. this is > observed starting from r28634. Should be fixed in r28705. Thanks for investigating. I was mistaken by thinking the file was verbatim from FreeBSD. Bye, J?r?me From axeld at pinc-software.de Fri Nov 21 00:16:45 2008 From: axeld at pinc-software.de (Axel =?utf-8?q?D=C3=B6rfler?=) Date: Fri, 21 Nov 2008 00:16:45 +0100 CET Subject: [Haiku-commits] =?utf-8?q?r28701_-_in_haiku/trunk=3A_headers/os/i?= =?utf-8?q?nterface_src/kits/interface?= In-Reply-To: <200811202151.mAKLpmhp020024@sheep.berlios.de> Message-ID: <56872069094-BeMail@zon> stippi at mail.berlios.de wrote: > Patch by Artur Wyszynski: There are a couple of coding style problems, though: > class BTabView : public BView > { [...] > virtual void SetFlags(uint32 flags); That header obviously needs a cleanup. > public: > + BTabView(const char *name, > + button_width width = B_WIDTH_AS_USUAL, > + uint32 flags = B_FULL_UPDATE_ON_RESIZE | > + B_WILL_DRAW | B_NAVIGABLE_JUMP | > + B_FRAME_EVENTS | B_NAVIGABLE); Operator '|' goes to the next line. > @@ -141,9 +147,18 @@ [...] > + if (container) > + removeView = > + dynamic_cast(container->GetLayout()) == > NULL; '=' to the next line, and please use {} for multi-line statements. > @@ -329,7 +344,17 @@ > > // #pragma mark - > > +BTabView::BTabView(const char *name, button_width width, uint32 > flags) Two blanks here. Bye, Axel. From stippi at mail.berlios.de Fri Nov 21 01:14:25 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Fri, 21 Nov 2008 01:14:25 +0100 Subject: [Haiku-commits] r28706 - in haiku/trunk: headers/os/interface src/kits/interface Message-ID: <200811210014.mAL0EPT0020716@sheep.berlios.de> Author: stippi Date: 2008-11-21 01:14:05 +0100 (Fri, 21 Nov 2008) New Revision: 28706 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28706&view=rev Modified: haiku/trunk/headers/os/interface/TabView.h haiku/trunk/src/kits/interface/TabView.cpp Log: Properly integrate the BTabView into a layout tree. Ie, the content will now resize with the tab view. There is probably a more elegant way overriding DoLayout(), but this should do for the time being. Modified: haiku/trunk/headers/os/interface/TabView.h =================================================================== --- haiku/trunk/headers/os/interface/TabView.h 2008-11-20 23:07:41 UTC (rev 28705) +++ haiku/trunk/headers/os/interface/TabView.h 2008-11-21 00:14:05 UTC (rev 28706) @@ -183,7 +183,7 @@ BView *ViewForTab(int32 tabIndex) const; private: - void _InitObject(bool layouted = false); + void _InitObject(bool layouted, button_width width); virtual void _ReservedTabView1(); virtual void _ReservedTabView2(); Modified: haiku/trunk/src/kits/interface/TabView.cpp =================================================================== --- haiku/trunk/src/kits/interface/TabView.cpp 2008-11-20 23:07:41 UTC (rev 28705) +++ haiku/trunk/src/kits/interface/TabView.cpp 2008-11-21 00:14:05 UTC (rev 28706) @@ -5,6 +5,8 @@ * Authors: * Marc Flerackers (mflerackers at androme.be) * J?r?me Duval (korli at users.berlios.de) + * Stephan A?mus + * Artur Wyszynski */ #include @@ -12,6 +14,7 @@ #include #include +#include #include #include #include @@ -344,14 +347,11 @@ // #pragma mark - + BTabView::BTabView(const char *name, button_width width, uint32 flags) : BView(name, flags) { - SetFont(be_bold_font); - - _InitObject(true); - - fTabWidthSetting = width; + _InitObject(true, width); } @@ -359,11 +359,7 @@ uint32 resizingMode, uint32 flags) : BView(frame, name, resizingMode, flags) { - SetFont(be_bold_font); - - _InitObject(); - - fTabWidthSetting = width; + _InitObject(false, width); } @@ -1130,11 +1126,13 @@ void -BTabView::_InitObject(bool layouted) +BTabView::_InitObject(bool layouted, button_width width) { + SetFont(be_bold_font); + fTabList = new BList; - fTabWidthSetting = B_WIDTH_AS_USUAL; + fTabWidthSetting = width; fSelection = 0; fFocus = -1; fTabOffset = 0.0f; @@ -1148,17 +1146,25 @@ GetFontHeight(&fh); fTabHeight = fh.ascent + fh.descent + fh.leading + 8.0f; - BRect bounds = Bounds(); + if (layouted) { + BGroupLayout* layout = new(std::nothrow) BGroupLayout(B_HORIZONTAL); + if (layout) { + layout->SetInsets(3.0, 3.0 + TabHeight(), 3.0, 3.0); + SetLayout(layout); + } - bounds.top += TabHeight(); - bounds.InsetBy(3.0f, 3.0f); - - fContainerView = new BView(bounds, "view container", B_FOLLOW_ALL, - B_WILL_DRAW); - - if (layouted) + fContainerView = new BView("view container", B_WILL_DRAW); fContainerView->SetLayout(new(std::nothrow) BCardLayout()); + } else { + BRect bounds = Bounds(); + bounds.top += TabHeight(); + bounds.InsetBy(3.0f, 3.0f); + + fContainerView = new BView(bounds, "view container", B_FOLLOW_ALL, + B_WILL_DRAW); + } + fContainerView->SetViewColor(color); fContainerView->SetLowColor(color); From stippi at mail.berlios.de Fri Nov 21 01:15:26 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Fri, 21 Nov 2008 01:15:26 +0100 Subject: [Haiku-commits] r28707 - haiku/trunk/headers/os/interface Message-ID: <200811210015.mAL0FQcq022004@sheep.berlios.de> Author: stippi Date: 2008-11-21 01:15:22 +0100 (Fri, 21 Nov 2008) New Revision: 28707 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28707&view=rev Modified: haiku/trunk/headers/os/interface/ColorControl.h Log: Style update. Modified: haiku/trunk/headers/os/interface/ColorControl.h =================================================================== --- haiku/trunk/headers/os/interface/ColorControl.h 2008-11-21 00:14:05 UTC (rev 28706) +++ haiku/trunk/headers/os/interface/ColorControl.h 2008-11-21 00:15:22 UTC (rev 28707) @@ -23,100 +23,104 @@ class BColorControl : public BControl { - public: - BColorControl(BPoint start, color_control_layout layout, - float cellSize, const char* name, - BMessage* message = NULL, bool useOffscreen = false); - BColorControl(BMessage* archive); - virtual ~BColorControl(); +public: + BColorControl(BPoint start, + color_control_layout layout, + float cellSize, const char* name, + BMessage* message = NULL, + bool useOffscreen = false); + BColorControl(BMessage* archive); + virtual ~BColorControl(); - static BArchivable* Instantiate(BMessage* archive); - virtual status_t Archive(BMessage* archive, bool deep = true) const; + static BArchivable* Instantiate(BMessage* archive); + virtual status_t Archive(BMessage* archive, + bool deep = true) const; - virtual void SetLayout(BLayout* layout); + virtual void SetLayout(BLayout* layout); - virtual void SetValue(int32 color_value); - void SetValue(rgb_color color); - rgb_color ValueAsColor(); + virtual void SetValue(int32 color_value); + void SetValue(rgb_color color); + rgb_color ValueAsColor(); - virtual void SetEnabled(bool state); + virtual void SetEnabled(bool state); - virtual void AttachedToWindow(); - virtual void MessageReceived(BMessage* message); - virtual void Draw(BRect updateRect); - virtual void MouseDown(BPoint where); - virtual void KeyDown(const char* bytes, int32 numBytes); + virtual void AttachedToWindow(); + virtual void MessageReceived(BMessage* message); + virtual void Draw(BRect updateRect); + virtual void MouseDown(BPoint where); + virtual void KeyDown(const char* bytes, int32 numBytes); - virtual void SetCellSize(float size); - float CellSize() const; - virtual void SetLayout(color_control_layout layout); - color_control_layout Layout() const; + virtual void SetCellSize(float size); + float CellSize() const; + virtual void SetLayout(color_control_layout layout); + color_control_layout Layout() const; - virtual void WindowActivated(bool state); - virtual void MouseUp(BPoint point); - virtual void MouseMoved(BPoint point, uint32 code, - const BMessage* dragMessage); - virtual void DetachedFromWindow(); - virtual void GetPreferredSize(float* _width, float* _height); - virtual void ResizeToPreferred(); - virtual status_t Invoke(BMessage* message = NULL); - virtual void FrameMoved(BPoint newPosition); - virtual void FrameResized(float newWidth, float newHeight); + virtual void WindowActivated(bool state); + virtual void MouseUp(BPoint point); + virtual void MouseMoved(BPoint point, uint32 code, + const BMessage* dragMessage); + virtual void DetachedFromWindow(); + virtual void GetPreferredSize(float* _width, float* _height); + virtual void ResizeToPreferred(); + virtual status_t Invoke(BMessage* message = NULL); + virtual void FrameMoved(BPoint newPosition); + virtual void FrameResized(float newWidth, float newHeight); - virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, - BMessage* specifier, int32 what, - const char* property); - virtual status_t GetSupportedSuites(BMessage* data); + virtual BHandler* ResolveSpecifier(BMessage* message, int32 index, + BMessage* specifier, int32 what, + const char* property); + virtual status_t GetSupportedSuites(BMessage* data); - virtual void MakeFocus(bool state = true); - virtual void AllAttached(); - virtual void AllDetached(); + virtual void MakeFocus(bool state = true); + virtual void AllAttached(); + virtual void AllDetached(); - private: - virtual status_t Perform(perform_code d, void *arg); - // this can be made public again if needed +private: + virtual status_t Perform(perform_code d, void *arg); + // this can be made public again if needed - virtual void _ReservedColorControl1(); - virtual void _ReservedColorControl2(); - virtual void _ReservedColorControl3(); - virtual void _ReservedColorControl4(); + virtual void _ReservedColorControl1(); + virtual void _ReservedColorControl2(); + virtual void _ReservedColorControl3(); + virtual void _ReservedColorControl4(); - BColorControl& operator=(const BColorControl &other); + BColorControl& operator=(const BColorControl &other); - void _InitData(color_control_layout layout, - float size, bool useOffscreen, - BMessage* archive = NULL); - void _LayoutView(); - void _InitOffscreen(); - void _DrawColorArea(BView* target, BRect update); - void _DrawSelectors(BView* target); - void _ColorRamp(BRect rect, BView* target, - rgb_color baseColor, rgb_color compColor, - int16 flag, bool focused, BRect update); - BPoint _SelectorPosition(const BRect& rampRect, uint8 shade) const; - BRect _PaletteSelectorFrame(uint8 colorIndex) const; - BRect _RampFrame(uint8 rampIndex) const; + void _InitData(color_control_layout layout, + float size, bool useOffscreen, + BMessage* archive = NULL); + void _LayoutView(); + void _InitOffscreen(); + void _DrawColorArea(BView* target, BRect update); + void _DrawSelectors(BView* target); + void _ColorRamp(BRect rect, BView* target, + rgb_color baseColor, rgb_color compColor, + int16 flag, bool focused, BRect update); + BPoint _SelectorPosition(const BRect& rampRect, + uint8 shade) const; + BRect _PaletteSelectorFrame(uint8 colorIndex) const; + BRect _RampFrame(uint8 rampIndex) const; private: - BRect fPaletteFrame; - int16 fSelectedPaletteColorIndex; - int16 fPreviousSelectedPaletteColorIndex; - - float fCellSize; - int32 fRows; - int32 fColumns; - bool fPaletteMode; - bool _unused[3]; + BRect fPaletteFrame; + int16 fSelectedPaletteColorIndex; + int16 fPreviousSelectedPaletteColorIndex; - BTextControl* fRedText; - BTextControl* fGreenText; - BTextControl* fBlueText; + float fCellSize; + int32 fRows; + int32 fColumns; + bool fPaletteMode; + bool _unused[3]; - BBitmap* fBitmap; - BView* fOffscreenView; + BTextControl* fRedText; + BTextControl* fGreenText; + BTextControl* fBlueText; - int32 fFocusedComponent; - uint32 _reserved[2]; + BBitmap* fBitmap; + BView* fOffscreenView; + + int32 fFocusedComponent; + uint32 _reserved[2]; }; inline void From stippi at mail.berlios.de Fri Nov 21 01:18:03 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Fri, 21 Nov 2008 01:18:03 +0100 Subject: [Haiku-commits] r28708 - haiku/trunk/src/preferences/appearance Message-ID: <200811210018.mAL0I3j1024736@sheep.berlios.de> Author: stippi Date: 2008-11-21 01:17:59 +0100 (Fri, 21 Nov 2008) New Revision: 28708 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28708&view=rev Modified: haiku/trunk/src/preferences/appearance/APRView.cpp haiku/trunk/src/preferences/appearance/APRView.h haiku/trunk/src/preferences/appearance/APRWindow.cpp haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.h Log: Use layout management for all of the window. Can be improved by making the listview use all the available additional size. But works far better than before. Modified: haiku/trunk/src/preferences/appearance/APRView.cpp =================================================================== --- haiku/trunk/src/preferences/appearance/APRView.cpp 2008-11-21 00:15:22 UTC (rev 28707) +++ haiku/trunk/src/preferences/appearance/APRView.cpp 2008-11-21 00:17:59 UTC (rev 28708) @@ -6,18 +6,19 @@ * DarkWyrm (darkwyrm at earthlink.net) * Rene Gollent (rene at gollent.com) */ -#include -#include +#include "APRView.h" + #include -#include -#include +#include #include #include +#include +#include +#include +#include + #include -#include - -#include "APRView.h" #include "APRWindow.h" #include "defs.h" #include "ColorWell.h" @@ -37,17 +38,13 @@ status_t get_decorator_preview(const int32 &index, BBitmap *bitmap); } -APRView::APRView(const BRect &frame, const char *name, int32 resize, int32 flags) - : BView(frame,name,resize,flags), +APRView::APRView(const char *name, uint32 flags) + : BView(name, flags), fDefaultSet(ColorSet::DefaultColorSet()), fDecorMenu(NULL) { SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - BRect rect(Bounds().InsetByCopy(kBorderSpace,kBorderSpace)); - - #ifdef HAIKU_TARGET_PLATFORM_HAIKU - fDecorMenu = new BMenu("Window Style"); int32 decorCount = BPrivate::count_decorators(); if (decorCount > 1) { @@ -57,75 +54,58 @@ if (name.CountChars() < 1) continue; fDecorMenu->AddItem(new BMenuItem(name.String(), - new BMessage(DECORATOR_CHANGED))); + new BMessage(DECORATOR_CHANGED))); } - BMenuField *field = new BMenuField(rect, "menufield", "Window Style", - fDecorMenu, B_FOLLOW_RIGHT | - B_FOLLOW_TOP); - AddChild(field); - field->SetDivider(be_plain_font->StringWidth("Window style: ") + 5); - field->ResizeToPreferred(); - field->MoveTo(Bounds().right - field->Bounds().Width(), 10); - rect = Bounds().InsetByCopy(10,10); - rect.OffsetTo(10, field->Frame().bottom + 10); + BMenuField *field = new BMenuField("Window Style", fDecorMenu); + // TODO: use this menu field. } BMenuItem *marked = fDecorMenu->ItemAt(BPrivate::get_decorator()); if (marked) marked->SetMarked(true); - else - { + else { marked = fDecorMenu->FindItem("Default"); if (marked) marked->SetMarked(true); } - #endif + // Set up list of color attributes + fAttrList = new BListView("AttributeList", B_SINGLE_SELECTION_LIST); - // Set up list of color fAttributes - rect.right -= B_V_SCROLL_BAR_WIDTH; - rect.bottom = rect.top + 75; - fAttrList = new BListView(rect,"AttributeList", B_SINGLE_SELECTION_LIST, - B_FOLLOW_ALL_SIDES); - - fScrollView = new BScrollView("ScrollView",fAttrList, B_FOLLOW_ALL_SIDES, - 0, false, true); - AddChild(fScrollView); + fScrollView = new BScrollView("ScrollView", fAttrList, 0, false, true); fScrollView->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - fAttrList->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN)); - for (int32 i = 0; i < color_description_count(); i++) { const ColorDescription& description = *get_color_description(i); const char* text = description.text; color_which which = description.which; fAttrList->AddItem(new ColorWhichItem(text, which)); } - - rect = fScrollView->Frame(); + BRect wellrect(0, 0, 50, 50); - wellrect.OffsetBy(rect.left, rect.bottom + kBorderSpace); - fColorWell = new ColorWell(wellrect, new BMessage(COLOR_DROPPED), - B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); - AddChild(fColorWell); - - fPicker = new BColorControl(BPoint(wellrect.right + kBorderSpace, wellrect.top), - B_CELLS_32x8, 8.0, "fPicker", new BMessage(UPDATE_COLOR)); - fPicker->SetResizingMode(B_FOLLOW_LEFT | B_FOLLOW_BOTTOM); - AddChild(fPicker); - - // bottom align ColorWell and ColorPicker - float bottom = Bounds().bottom - kBorderSpace; - float colorWellBottom = fColorWell->Frame().bottom; - float pickerBottom = fPicker->Frame().bottom; - float delta = bottom - max_c(colorWellBottom, pickerBottom); - fColorWell->MoveBy(0, delta); - fPicker->MoveBy(0, delta); - fScrollView->ResizeBy(0, delta); - // since this view is not attached to a window yet, - // we have to resize the fScrollView children too - fScrollView->ScrollBar(B_VERTICAL)->ResizeBy(0, delta); - fAttrList->ResizeBy(0, delta); + fColorWell = new ColorWell(wellrect, new BMessage(COLOR_DROPPED), 0); + fColorWell->SetExplicitAlignment(BAlignment(B_ALIGN_HORIZONTAL_CENTER, + B_ALIGN_BOTTOM)); + + fPicker = new BColorControl(B_ORIGIN, B_CELLS_32x8, 8.0, + "picker", new BMessage(UPDATE_COLOR)); + + SetLayout(new BGroupLayout(B_VERTICAL)); + + // TODO: Make list view and scroller use all the additional height + // available! + AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) + .Add(fScrollView) + .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) + .Add(BGroupLayoutBuilder(B_HORIZONTAL) + .Add(fColorWell) + .Add(BSpaceLayoutItem::CreateHorizontalStrut(5)) + .Add(fPicker) + ) + .SetInsets(10, 10, 10, 10) + ); + + fAttrList->SetSelectionMessage(new BMessage(ATTRIBUTE_CHOSEN)); } APRView::~APRView(void) Modified: haiku/trunk/src/preferences/appearance/APRView.h =================================================================== --- haiku/trunk/src/preferences/appearance/APRView.h 2008-11-21 00:15:22 UTC (rev 28707) +++ haiku/trunk/src/preferences/appearance/APRView.h 2008-11-21 00:17:59 UTC (rev 28708) @@ -33,8 +33,7 @@ class APRView : public BView { public: - APRView(const BRect &frame, const char *name, int32 resize, - int32 flags); + APRView(const char *name, uint32 flags); ~APRView(void); void AttachedToWindow(void); void MessageReceived(BMessage *msg); Modified: haiku/trunk/src/preferences/appearance/APRWindow.cpp =================================================================== --- haiku/trunk/src/preferences/appearance/APRWindow.cpp 2008-11-21 00:15:22 UTC (rev 28707) +++ haiku/trunk/src/preferences/appearance/APRWindow.cpp 2008-11-21 00:17:59 UTC (rev 28708) @@ -5,11 +5,14 @@ * Authors: * DarkWyrm (darkwyrm at earthlink.net) */ +#include "APRWindow.h" #include +#include #include +#include #include -#include "APRWindow.h" + #include "APRView.h" #include "defs.h" @@ -17,56 +20,40 @@ static const uint32 kMsgRevert = 'rvrt'; APRWindow::APRWindow(BRect frame) - : BWindow(frame, "Appearance", B_TITLED_WINDOW, B_NOT_ZOOMABLE, - B_ALL_WORKSPACES) + : BWindow(frame, "Appearance", B_TITLED_WINDOW, + B_NOT_ZOOMABLE | B_AUTO_UPDATE_SIZE_LIMITS, + B_ALL_WORKSPACES) { - BRect rect = Bounds(); - BView* view = new BView(rect, "background", B_FOLLOW_ALL, B_WILL_DRAW); - view->SetViewColor(ui_color(B_PANEL_BACKGROUND_COLOR)); - AddChild(view); + SetLayout(new BGroupLayout(B_HORIZONTAL)); - rect.left = 10; - rect.top = rect.bottom - 10; - fDefaultsButton = new BButton(rect, "defaults", "Defaults", - new BMessage(kMsgSetDefaults), B_FOLLOW_LEFT - | B_FOLLOW_BOTTOM, B_WILL_DRAW); - fDefaultsButton->ResizeToPreferred(); - fDefaultsButton->SetEnabled(false); - float buttonHeight = fDefaultsButton->Bounds().Height(); - fDefaultsButton->MoveBy(0, -buttonHeight); - view->AddChild(fDefaultsButton); + fDefaultsButton = new BButton("defaults", "Defaults", + new BMessage(kMsgSetDefaults), B_WILL_DRAW); - rect = fDefaultsButton->Frame(); - rect.OffsetBy(fDefaultsButton->Bounds().Width() + 10, 0); + fRevertButton = new BButton("revert", "Revert", + new BMessage(kMsgRevert), B_WILL_DRAW); - fRevertButton = new BButton(rect, "revert", "Revert", - new BMessage(kMsgRevert), B_FOLLOW_LEFT | B_FOLLOW_BOTTOM, B_WILL_DRAW); - fRevertButton->ResizeToPreferred(); - fRevertButton->SetEnabled(false); - view->AddChild(fRevertButton); + BTabView* tabView = new BTabView("tabview", B_WIDTH_FROM_LABEL); - rect = Bounds(); - rect.top += 5; - rect.bottom -= 20 + buttonHeight; - rect.left += 5; - BTabView *tabView = new BTabView(rect, "tabview", B_WIDTH_FROM_LABEL); + fAntialiasingSettings = new AntialiasingSettingsView("Antialiasing"); + fColorsView = new APRView("Colors", B_WILL_DRAW); - rect = tabView->ContainerView()->Bounds().InsetByCopy(5, 8); - - fAntialiasingSettings = new AntialiasingSettingsView(rect, "Antialiasing"); - fColorsView = new APRView(rect, "Colors", B_FOLLOW_ALL, B_WILL_DRAW); - tabView->AddTab(fColorsView); tabView->AddTab(fAntialiasingSettings); - view->AddChild(tabView); - fColorsView->ResizeToPreferred(); - fAntialiasingSettings->ResizeToPreferred(); - fDefaultsButton->SetEnabled(fColorsView->IsDefaultable() || fAntialiasingSettings->IsDefaultable()); - fDefaultsButton->SetTarget(this); - fRevertButton->SetTarget(this); + fRevertButton->SetEnabled(false); + + AddChild(BGroupLayoutBuilder(B_VERTICAL, 0) + .Add(tabView) + .Add(BSpaceLayoutItem::CreateVerticalStrut(5)) + .Add(BGroupLayoutBuilder(B_HORIZONTAL) + .Add(fRevertButton) + .AddGlue() + .Add(fDefaultsButton) + ) + .SetInsets(5, 5, 5, 5) + ); } Modified: haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp 2008-11-21 00:15:22 UTC (rev 28707) +++ haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp 2008-11-21 00:17:59 UTC (rev 28708) @@ -53,8 +53,8 @@ // #pragma mark - -AntialiasingSettingsView::AntialiasingSettingsView(BRect rect, const char* name) - : BView(rect, name, B_FOLLOW_ALL, B_SUPPORTS_LAYOUT) +AntialiasingSettingsView::AntialiasingSettingsView(const char* name) + : BView(name, 0) { // collect the current system settings if (get_subpixel_antialiasing(&fCurrentSubpixelAntialiasing) != B_OK) @@ -141,11 +141,6 @@ _SetCurrentAntialiasing(); _SetCurrentHinting(); _SetCurrentAverageWeight(); - - // TODO: Remove once these two lines once the entire window uses - // layout management. - MoveTo(rect.LeftTop()); - ResizeTo(rect.Width(), rect.Height()); } Modified: haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.h =================================================================== --- haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.h 2008-11-21 00:15:22 UTC (rev 28707) +++ haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.h 2008-11-21 00:17:59 UTC (rev 28708) @@ -16,8 +16,7 @@ class AntialiasingSettingsView : public BView { public: - AntialiasingSettingsView(BRect rect, - const char* name); + AntialiasingSettingsView(const char* name); virtual ~AntialiasingSettingsView(); virtual void AttachedToWindow(); From fekdahl at gmail.com Fri Nov 21 18:41:09 2008 From: fekdahl at gmail.com (Fredrik Ekdahl) Date: Fri, 21 Nov 2008 18:41:09 +0100 Subject: [Haiku-commits] r28708 - haiku/trunk/src/preferences/appearance In-Reply-To: <200811210018.mAL0I3j1024736@sheep.berlios.de> References: <200811210018.mAL0I3j1024736@sheep.berlios.de> Message-ID: <4926F2B5.2000500@gmail.com> stippi at mail.berlios.de skrev: > Author: stippi > Date: 2008-11-21 01:17:59 +0100 (Fri, 21 Nov 2008) > New Revision: 28708 > ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28708&view=rev > > Modified: > haiku/trunk/src/preferences/appearance/APRView.cpp > haiku/trunk/src/preferences/appearance/APRView.h > haiku/trunk/src/preferences/appearance/APRWindow.cpp > haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp > haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.h > Log: > Use layout management for all of the window. Can be improved by making > the listview use all the available additional size. But works far better > than before. > > > Modified: haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp > =================================================================== > --- haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp 2008-11-21 00:15:22 UTC (rev 28707) > +++ haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp 2008-11-21 00:17:59 UTC (rev 28708) > @@ -53,8 +53,8 @@ > // #pragma mark - > > > -AntialiasingSettingsView::AntialiasingSettingsView(BRect rect, const char* name) > - : BView(rect, name, B_FOLLOW_ALL, B_SUPPORTS_LAYOUT) > +AntialiasingSettingsView::AntialiasingSettingsView(const char* name) > + : BView(name, 0) Hi! This breaks the build. rect is still used on line 104 in that file. -- /Fredrik Ekdahl From julun at mail.berlios.de Fri Nov 21 19:31:30 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Fri, 21 Nov 2008 19:31:30 +0100 Subject: [Haiku-commits] r28709 - haiku/trunk/src/preferences/appearance Message-ID: <200811211831.mALIVUFQ016988@sheep.berlios.de> Author: julun Date: 2008-11-21 19:31:29 +0100 (Fri, 21 Nov 2008) New Revision: 28709 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28709&view=rev Modified: haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp Log: * build fix Modified: haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp =================================================================== --- haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp 2008-11-21 00:17:59 UTC (rev 28708) +++ haiku/trunk/src/preferences/appearance/AntialiasingSettingsView.cpp 2008-11-21 18:31:29 UTC (rev 28709) @@ -101,7 +101,7 @@ rgb_color infoColor = tint_color(ui_color(B_PANEL_BACKGROUND_COLOR), B_DARKEN_4_TINT); // TODO: Replace with layout friendly constructor once available. - BRect textBounds = rect.InsetByCopy(10, 10).OffsetToSelf(B_ORIGIN); + BRect textBounds = Bounds(); BTextView* subpixelAntialiasingDisabledLabel = new BTextView( textBounds, "unavailable label", textBounds, &infoFont, &infoColor, B_FOLLOW_NONE, B_WILL_DRAW | B_SUPPORTS_LAYOUT); From julun at mail.berlios.de Fri Nov 21 20:05:15 2008 From: julun at mail.berlios.de (julun at BerliOS) Date: Fri, 21 Nov 2008 20:05:15 +0100 Subject: [Haiku-commits] r28710 - haiku/trunk/src/kits/interface Message-ID: <200811211905.mALJ5FKo003765@sheep.berlios.de> Author: julun Date: 2008-11-21 20:05:14 +0100 (Fri, 21 Nov 2008) New Revision: 28710 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28710&view=rev Modified: haiku/trunk/src/kits/interface/Slider.cpp Log: * use rgba32 bitmap to get rid of the anoying slider background while using a different panel background color Modified: haiku/trunk/src/kits/interface/Slider.cpp =================================================================== --- haiku/trunk/src/kits/interface/Slider.cpp 2008-11-21 18:31:29 UTC (rev 28709) +++ haiku/trunk/src/kits/interface/Slider.cpp 2008-11-21 19:05:14 UTC (rev 28710) @@ -368,7 +368,7 @@ } if (!fOffScreenBits) { - fOffScreenBits = new BBitmap(bounds, B_CMAP8, true, false); + fOffScreenBits = new BBitmap(bounds, B_RGBA32, true, false); if (fOffScreenBits && fOffScreenView) fOffScreenBits->AddChild(fOffScreenView); @@ -451,7 +451,7 @@ fOffScreenView->ResizeTo(bounds.Width(), bounds.Height()); - fOffScreenBits = new BBitmap(Bounds(), B_CMAP8, true, false); + fOffScreenBits = new BBitmap(Bounds(), B_RGBA32, true, false); fOffScreenBits->AddChild(fOffScreenView); } #endif From oruizdorantes at mail.berlios.de Fri Nov 21 21:10:37 2008 From: oruizdorantes at mail.berlios.de (oruizdorantes at BerliOS) Date: Fri, 21 Nov 2008 21:10:37 +0100 Subject: [Haiku-commits] r28711 - haiku/trunk/src/add-ons/kernel/network/protocols/l2cap Message-ID: <200811212010.mALKAbUf008756@sheep.berlios.de> Author: oruizdorantes Date: 2008-11-21 21:10:36 +0100 (Fri, 21 Nov 2008) New Revision: 28711 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28711&view=rev Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp Log: size does not need to be calculated. Merge configuration parameters only if specified. Modified: haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp =================================================================== --- haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp 2008-11-21 19:05:14 UTC (rev 28710) +++ haiku/trunk/src/add-ons/kernel/network/protocols/l2cap/l2cap_command.cpp 2008-11-21 20:10:36 UTC (rev 28711) @@ -130,8 +130,6 @@ bufferHeader->hdr.length += sizeof(bufferHeader->data.cid); } - _m->size = sizeof(bufferHeader->hdr) + bufferHeader->hdr.length; /* TODO: needed ?*/ - bufferHeader->hdr.length = htole16(bufferHeader->hdr.length); bufferHeader.Sync(); @@ -211,8 +209,6 @@ return NULL; } - (_m)->size = sizeof(struct _cfg_req); /* check if needed */ - NetBufferPrepend bufferHeader(_m); status_t status = bufferHeader.Status(); if (status < B_OK) { @@ -231,7 +227,8 @@ /* Add the given data */ // TODO: given data can be freed... merge does it? - gBufferModule->merge(_m, _data, true); + if (_data != NULL) + gBufferModule->merge(_m, _data, true); return _m; } @@ -264,9 +261,10 @@ bufferHeader->param.result = htole16((_result)); bufferHeader.Sync(); + + if (_data != NULL) + gBufferModule->merge(_m, _data, true); - gBufferModule->merge(_m, _data, true); - return _m; } @@ -414,8 +412,6 @@ } } - (_m)->size = sizeof(bufferHeader->hdr) + bufferHeader->hdr.length; - bufferHeader->hdr.length = htole16(bufferHeader->hdr.length); bufferHeader.Sync(); From korli at mail.berlios.de Sat Nov 22 00:43:16 2008 From: korli at mail.berlios.de (korli at BerliOS) Date: Sat, 22 Nov 2008 00:43:16 +0100 Subject: [Haiku-commits] r28712 - in haiku/trunk: build/jam src/add-ons/kernel/drivers/network/broadcom570x/dev/bge Message-ID: <200811212343.mALNhGKI008719@sheep.berlios.de> Author: korli Date: 2008-11-22 00:43:14 +0100 (Sat, 22 Nov 2008) New Revision: 28712 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28712&view=rev Modified: haiku/trunk/build/jam/HaikuImage haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h Log: applied patch from PieterPanman for broadcom570x network chipsets. Thanks! Modified: haiku/trunk/build/jam/HaikuImage =================================================================== --- haiku/trunk/build/jam/HaikuImage 2008-11-21 20:10:36 UTC (rev 28711) +++ haiku/trunk/build/jam/HaikuImage 2008-11-21 23:43:14 UTC (rev 28712) @@ -138,12 +138,12 @@ $(X86_ONLY)s3 $(X86_ONLY)vesa #$(X86_ONLY)via #$(X86_ONLY)vmware ; BEOS_ADD_ONS_DRIVERS_MIDI = emuxki ; -BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)broadcom440x etherpci $(X86_ONLY)ipro1000 +BEOS_ADD_ONS_DRIVERS_NET = $(X86_ONLY)3com $(X86_ONLY)broadcom440x + $(X86_ONLY)broadcom570x etherpci $(X86_ONLY)ipro1000 pegasus $(X86_ONLY)rtl8139 rtl8169 $(X86_ONLY)rtl81xx sis900 $(X86_ONLY)via_rhine wb840 $(X86_ONLY)ipro100 $(X86_ONLY)nforce #vlance $(X86_ONLY)marvell_yukon $(X86_ONLY)syskonnect usb_ecm - $(GPL_ONLY)bcm570x ; #BEOS_ADD_ONS_DRIVERS_ACPI = $(X86_ONLY)acpi_button ; BEOS_ADD_ONS_BUS_MANAGERS = pci $(X86_ONLY)ps2 $(X86_ONLY)isa ide scsi Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c 2008-11-21 20:10:36 UTC (rev 28711) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/glue.c 2008-11-21 23:43:14 UTC (rev 28712) @@ -31,26 +31,17 @@ } -// copied from if_bge.c -static void -bge_writembx(struct bge_softc *sc, int off, int val) -{ - if (sc->bge_asicrev == BGE_ASICREV_BCM5906) - off += BGE_LPMBX_IRQ0_HI - BGE_MBX_IRQ0_HI; - - CSR_WRITE_4(sc, off, val); -} - - int __haiku_disable_interrupts(device_t dev) { struct bge_softc *sc = device_get_softc(dev); - uint32 statusword = CSR_READ_4(sc, BGE_MAC_STS) & BGE_MACSTAT_LINK_CHANGED; + uint32 notInterrupted = pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE, 4) + & BGE_PCISTATE_INTR_STATE; + // bit of a strange register name. a nonzero actually means + // it is _not_ interrupted by the network chip - if ((sc->bge_ifp->if_drv_flags & IFF_DRV_RUNNING) == 0 && !statusword - && (pci_read_config(sc->bge_dev, BGE_PCI_PCISTATE,4) & BGE_PCISTATE_INTR_STATE)) + if (notInterrupted) return 0; BGE_SETBIT(sc, BGE_PCI_MISC_CTL, BGE_PCIMISCCTL_MASK_PCI_INTR); Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c 2008-11-21 20:10:36 UTC (rev 28711) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bge.c 2008-11-21 23:43:14 UTC (rev 28712) @@ -378,7 +378,9 @@ static int bge_has_eaddr(struct bge_softc *); static uint32_t bge_readmem_ind(struct bge_softc *, int); static void bge_writemem_ind(struct bge_softc *, int, int); +#ifndef __HAIKU__ static void bge_writembx(struct bge_softc *, int, int); +#endif #ifdef notdef static uint32_t bge_readreg_ind(struct bge_softc *, int); #endif @@ -553,7 +555,11 @@ CSR_WRITE_4(sc, off, val); } +#ifndef __HAIKU__ static void +#else +void +#endif bge_writembx(struct bge_softc *sc, int off, int val) { if (sc->bge_asicrev == BGE_ASICREV_BCM5906) Modified: haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h =================================================================== --- haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h 2008-11-21 20:10:36 UTC (rev 28711) +++ haiku/trunk/src/add-ons/kernel/drivers/network/broadcom570x/dev/bge/if_bgereg.h 2008-11-21 23:43:14 UTC (rev 28712) @@ -2586,3 +2586,8 @@ #define BGE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->bge_mtx, MA_OWNED) #define BGE_UNLOCK(_sc) mtx_unlock(&(_sc)->bge_mtx) #define BGE_LOCK_DESTROY(_sc) mtx_destroy(&(_sc)->bge_mtx) + +#ifdef __HAIKU__ +// this function declaration is placed here because it is used in glue.c +void bge_writembx(struct bge_softc *, int, int); +#endif From stippi at mail.berlios.de Sat Nov 22 01:23:58 2008 From: stippi at mail.berlios.de (stippi at mail.berlios.de) Date: Sat, 22 Nov 2008 01:23:58 +0100 Subject: [Haiku-commits] r28713 - haiku/trunk/src/preferences/time Message-ID: <200811220023.mAM0NwUl028137@sheep.berlios.de> Author: stippi Date: 2008-11-22 01:23:51 +0100 (Sat, 22 Nov 2008) New Revision: 28713 ViewCVS: http://svn.berlios.de/viewcvs/haiku?rev=28713&view=rev Modified: haiku/trunk/src/preferences/time/AnalogClock.cpp haiku/trunk/src/preferences/time/AnalogClock.h haiku/trunk/src/preferences/time/DateTimeEdit.cpp haiku/trunk/src/preferences/time/DateTimeEdit.h haiku/trunk/src/preferences/time/DateTimeView.cpp haiku/trunk/src/preferences/time/TimeMessages.h haiku/trunk/src/preferences/time/TimeWindow.cpp haiku/trunk/src/preferences/time/TimeWindow.h Log: patch by Clemens Zeidler: * Support dragging the clock hour and minute hands to set the time. * Improved keyboard support for the time and date controls. Thanks a lot! Modified: haiku/trunk/src/preferences/time/AnalogClock.cpp =================================================================== --- haiku/trunk/src/preferences/time/AnalogClock.cpp 2008-11-21 23:43:14 UTC (rev 28712) +++ haiku/trunk/src/preferences/time/AnalogClock.cpp 2008-11-22 00:23:51 UTC (rev 28713) @@ -6,33 +6,66 @@ * Mike Berg * Julun * Stephan A?mus + * Clemens */ #include "AnalogClock.h" #include "TimeMessages.h" - #include #include +#include +#include +#include +#define DRAG_DELTA_PHI 0.2 + + class OffscreenClock : public BView { public: OffscreenClock(BRect frame, const char *name); ~OffscreenClock(); void SetTime(int32 hour, int32 minute, int32 second); + void GetTime(int32 *hour, int32 *minute, int32 *second); bool IsDirty() const { return fDirty; } void DrawClock(); + bool InHourHand(BPoint point); + bool InMinuteHand(BPoint point); + + void SetHourHand(BPoint point); + void SetMinuteHand(BPoint point); + + void SetHourDragging(bool val) { + fHourDragging = val; + fDirty = true; + } + void SetMinuteDragging(bool val) { + fMinuteDragging = val; + fDirty = true; + } private: + float _GetPhi(BPoint point); + bool _InHand(BPoint point, int32 ticks, float radius); void _DrawHands(float x, float y, float radius, - rgb_color hourMinuteColor, rgb_color secondsColor); + rgb_color hourHourColor, + rgb_color hourMinuteColor, + rgb_color secondsColor, + rgb_color knobColor); int32 fHours; int32 fMinutes; int32 fSeconds; bool fDirty; + + float fCenterX; + float fCenterY; + float fRadius; + + bool fHourDragging; + bool fMinuteDragging; }; @@ -41,9 +74,20 @@ fHours(0), fMinutes(0), fSeconds(0), - fDirty(true) + fDirty(true), + fHourDragging(false), + fMinuteDragging(false) { SetFlags(Flags() | B_SUBPIXEL_PRECISE); + + BRect bounds = Bounds(); + fCenterX = floorf((bounds.left + bounds.right) / 2 + 0.5) + 0.5; + fCenterY = floorf((bounds.top + bounds.bottom) / 2 + 0.5) + 0.5; + // + 0.5 is for the offset to pixel centers + // (important when drawing with B_SUBPIXEL_PRECISE) + + fRadius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 2.5; + fRadius -= 3; } @@ -67,6 +111,15 @@ void +OffscreenClock::GetTime(int32 *hour, int32 *minute, int32 *second) +{ + *hour = fHours; + *minute = fMinutes; + *second = fSeconds; +} + + +void OffscreenClock::DrawClock() { if (!LockLooper()) @@ -78,14 +131,10 @@ SetHighColor(background); FillRect(bounds); - float radius = floorf((MIN(bounds.Width(), bounds.Height()) / 2.0)) - 2.5; - float x = floorf((bounds.left + bounds.right) / 2 + 0.5) + 0.5; - float y = floorf((bounds.top + bounds.bottom) / 2 + 0.5) + 0.5; - // + 0.5 is for the offset to pixel centers - // (important when drawing with B_SUBPIXEL_PRECISE) + + bounds.Set(fCenterX - fRadius, fCenterY - fRadius, + fCenterX + fRadius, fCenterY + fRadius); - bounds.Set(x - radius, y - radius, x + radius, y + radius); - SetPenSize(2.0); SetHighColor(tint_color(background, B_DARKEN_1_TINT)); @@ -99,8 +148,7 @@ SetLowColor(255, 255, 255); FillEllipse(bounds, B_SOLID_LOW); - radius -= 3; - + SetHighColor(tint_color(HighColor(), B_DARKEN_2_TINT)); // minutes @@ -109,10 +157,10 @@ for (int32 minute = 1; minute < 60; minute++) { if (minute % 5 == 0) continue; - float x1 = x + sinf(minute * PI / 30.0) * radius; - float y1 = y + cosf(minute * PI / 30.0) * radius; - float x2 = x + sinf(minute * PI / 30.0) * (radius * 0.95); - float y2 = y + cosf(minute * PI / 30.0) * (radius * 0.95); + float x1 = fCenterX + sinf(minute * PI / 30.0) * fRadius; + float y1 = fCenterY + cosf(minute * PI / 30.0) * fRadius; + float x2 = fCenterX + sinf(minute * PI / 30.0) * (fRadius * 0.95); + float y2 = fCenterY + cosf(minute * PI / 30.0) * (fRadius * 0.95); StrokeLine(BPoint(x1, y1), BPoint(x2, y2)); } @@ -122,20 +170,32 @@ SetPenSize(2.0); SetLineMode(B_ROUND_CAP, B_MITER_JOIN); for (int32 hour = 0; hour < 12; hour++) { - float x1 = x + sinf(hour * PI / 6.0) * radius; - float y1 = y + cosf(hour * PI / 6.0) * radius; - float x2 = x + sinf(hour * PI / 6.0) * (radius * 0.9); - float y2 = y + cosf(hour * PI / 6.0) * (radius * 0.9); + float x1 = fCenterX + sinf(hour * PI / 6.0) * fRadius; + float y1 = fCenterY + cosf(hour * PI / 6.0) * fRadius; + float x2 = fCenterX + sinf(hour * PI / 6.0) * (fRadius * 0.9); + float y2 = fCenterY + cosf(hour * PI / 6.0) * (fRadius * 0.9); StrokeLine(BPoint(x1, y1), BPoint(x2, y2)); } - rgb_color hourMinutColor = tint_color(HighColor(), B_DARKEN_2_TINT); + rgb_color knobColor = tint_color(HighColor(), B_DARKEN_2_TINT);; + rgb_color hourColor; + if (fHourDragging) + hourColor = (rgb_color){ 0, 0, 255, 255 }; + else + hourColor = tint_color(HighColor(), B_DARKEN_2_TINT); + rgb_color minuteColor; + if (fMinuteDragging) + minuteColor = (rgb_color){ 0, 0, 255, 255 }; + else + minuteColor = tint_color(HighColor(), B_DARKEN_2_TINT); rgb_color secondsColor = (rgb_color){ 255, 0, 0, 255 }; rgb_color shadowColor = tint_color(LowColor(), (B_DARKEN_1_TINT + B_DARKEN_2_TINT) / 2); - _DrawHands(x + 1.5, y + 1.5, radius, shadowColor, shadowColor); - _DrawHands(x, y, radius, hourMinutColor, secondsColor); + _DrawHands(fCenterX + 1.5, fCenterY + 1.5, fRadius, + shadowColor, shadowColor, shadowColor, knobColor); + _DrawHands(fCenterX, fCenterY, fRadius, + hourColor, minuteColor, secondsColor, knobColor); Sync(); @@ -143,16 +203,116 @@ } +bool +OffscreenClock::InHourHand(BPoint point) +{ + int32 ticks = fHours; + if (ticks > 12) + ticks -= 12; + ticks *= 5; + ticks += int32(5. * fMinutes / 60.0); + if (ticks > 60) + ticks -= 60; + return _InHand(point, ticks, fRadius * 0.7); +} + + +bool +OffscreenClock::InMinuteHand(BPoint point) +{ + return _InHand(point, fMinutes, fRadius * 0.9); +} + + void +OffscreenClock::SetHourHand(BPoint point) +{ + point.x -= fCenterX; + point.y -= fCenterY; + + float pointPhi = _GetPhi(point); + float hoursExact = 6.0 * pointPhi / PI; + if (fHours >= 12) + fHours = 12; + else + fHours = 0; + fHours += int32(hoursExact); + + SetTime(fHours, fMinutes, fSeconds); +} + + +void +OffscreenClock::SetMinuteHand(BPoint point) +{ + point.x -= fCenterX; + point.y -= fCenterY; + + float pointPhi = _GetPhi(point); + float minutesExact = 30.0 * pointPhi / PI; + fMinutes = int32(ceilf(minutesExact)); + + SetTime(fHours, fMinutes, fSeconds); +} + + +float +OffscreenClock::_GetPhi(BPoint point) +{ + if (point.x == 0 && point.y < 0) + return 2 * PI; + if (point.x == 0 && point.y > 0) + return PI; + if (point.y == 0 && point.x < 0) + return PI * 3 / 2; + if (point.y == 0 && point.x > 0) + return PI / 2; + + float pointPhi = atanf(-1. * point.y / point.x); + if (point.y < 0. && point.x > 0.) // right upper corner + pointPhi = PI / 2. - pointPhi; + if (point.y > 0. && point.x > 0.) // right lower corner + pointPhi = PI / 2 - pointPhi; + if (point.y > 0. && point.x < 0.) // left lower corner + pointPhi = (PI * 3. / 2. - pointPhi); + if (point.y < 0. && point.x < 0.) // left upper corner + pointPhi = 3. / 2. * PI - pointPhi; + return pointPhi; +} + +bool +OffscreenClock::_InHand(BPoint point, int32 ticks, float radius) +{ + point.x -= fCenterX; + point.y -= fCenterY; + + float pRadius = sqrt(pow(point.x, 2) + pow(point.y, 2)); + + if (radius < pRadius) + return false; + + float pointPhi = _GetPhi(point); + float handPhi = PI / 30.0 * ticks; + float delta = pointPhi - handPhi; + if (abs(delta) > DRAG_DELTA_PHI) + return false; + + return true; +} + + +void OffscreenClock::_DrawHands(float x, float y, float radius, - rgb_color hourMinuteColor, rgb_color secondsColor) + rgb_color hourColor, + rgb_color minuteColor, + rgb_color secondsColor, + rgb_color knobColor) { - SetHighColor(hourMinuteColor); - float offsetX; float offsetY; // calc, draw hour hand + SetHighColor(hourColor); SetPenSize(4.0); float hours = fHours + float(fMinutes) / 60.0; offsetX = (radius * 0.7) * sinf((hours * PI) / 6.0); @@ -160,22 +320,22 @@ StrokeLine(BPoint(x, y), BPoint(x + offsetX, y - offsetY)); // calc, draw minute hand + SetHighColor(minuteColor); SetPenSize(3.0); float minutes = fMinutes + float(fSeconds) / 60.0; offsetX = (radius * 0.9) * sinf((minutes * PI) / 30.0); offsetY = (radius * 0.9) * cosf((minutes * PI) / 30.0); StrokeLine(BPoint(x, y), BPoint(x + offsetX, y - offsetY)); + // calc, draw second hand SetHighColor(secondsColor); - - // calc, draw second hand SetPenSize(1.0); offsetX = (radius * 0.95) * sinf((fSeconds * PI) / 30.0); offsetY = (radius * 0.95) * cosf((fSeconds * PI) / 30.0); StrokeLine(BPoint(x, y), BPoint(x + offsetX, y - offsetY)); // draw the center knob - SetHighColor(hourMinuteColor); + SetHighColor(knobColor); FillEllipse(BPoint(x, y), radius * 0.06, radius * 0.06); } @@ -186,7 +346,10 @@ TAnalogClock::TAnalogClock(BRect frame, const char *name) : BView(frame, name, B_FOLLOW_NONE, B_WILL_DRAW | B_DRAW_ON_CHILDREN), fBitmap(NULL), - fClock(NULL) + fClock(NULL), + fDraggingHourHand(false), + fDraggingMinuteHand(false), + fTimeChangeIsOngoing(false) { _InitView(frame); } @@ -248,6 +411,58 @@ void +TAnalogClock::MouseDown(BPoint point) +{ + fDraggingMinuteHand = fClock->InMinuteHand(point); + if (fDraggingMinuteHand) { + fClock->SetMinuteDragging(true); + SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); + Invalidate(); + return; + } + fDraggingHourHand = fClock->InHourHand(point); + if (fDraggingHourHand) { + fClock->SetHourDragging(true); + SetMouseEventMask(B_POINTER_EVENTS, B_LOCK_WINDOW_FOCUS); + Invalidate(); + return; + } +} + +void +TAnalogClock::MouseUp(BPoint point) +{ + if (fDraggingHourHand || fDraggingMinuteHand) { + int32 hour, minute, second; + fClock->GetTime(&hour, &minute, &second); + BMessage message(H_USER_CHANGE); + message.AddBool("time", true); + message.AddInt32("hour", hour); + message.AddInt32("minute", minute); + Window()->PostMessage(&message); + fTimeChangeIsOngoing = true; + } + fDraggingHourHand = false; + fDraggingMinuteHand = false; + fClock->SetMinuteDragging(false); + fClock->SetHourDragging(false); +} + + +void +TAnalogClock::MouseMoved(BPoint point, uint32 transit, const BMessage *message) +{ + + if (fDraggingMinuteHand) + fClock->SetMinuteHand(point); + if (fDraggingHourHand) + fClock->SetHourHand(point); + + Invalidate(); +} + + +void TAnalogClock::Draw(BRect /*updateRect*/) { if (fBitmap) { @@ -261,9 +476,19 @@ void TAnalogClock::SetTime(int32 hour, int32 minute, int32 second) { + // don't set the time if the hands are in a drag action + if (fDraggingHourHand || fDraggingMinuteHand || fTimeChangeIsOngoing) + return; + if (fClock) fClock->SetTime(hour, minute, second); Invalidate(); } + +void +TAnalogClock::ChangeTimeFinished() +{ + fTimeChangeIsOngoing = false; +} Modified: haiku/trunk/src/preferences/time/AnalogClock.h =================================================================== --- haiku/trunk/src/preferences/time/AnalogClock.h 2008-11-21 23:43:14 UTC (rev 28712) +++ haiku/trunk/src/preferences/time/AnalogClock.h 2008-11-22 00:23:51 UTC (rev 28713) @@ -25,14 +25,24 @@ virtual void AttachedToWindow(); virtual void Draw(BRect updateRect); virtual void MessageReceived(BMessage *message); + virtual void MouseDown(BPoint point); + virtual void MouseUp(BPoint point); + virtual void MouseMoved(BPoint point, uint32 transit, const BMessage *message); void SetTime(int32 hour, int32 minute, int32 second); + bool IsChangingTime() { return fTimeChangeIsOngoing; } + void ChangeTimeFinished(); private: void _InitView(BRect frame); BBitmap *fBitmap; OffscreenClock *fClock; + + bool fDraggingHourHand; + bool fDraggingMinuteHand; + + bool fTimeChangeIsOngoing; }; #endif // ANALOG_CLOCK_H Modified: haiku/trunk/src/preferences/time/DateTimeEdit.cpp =================================================================== --- haiku/trunk/src/preferences/time/DateTimeEdit.cpp 2008-11-21 23:43:14 UTC (rev 28712) +++ haiku/trunk/src/preferences/time/DateTimeEdit.cpp 2008-11-22 00:23:51 UTC (rev 28713) @@ -6,6 +6,7 @@ * McCall * Mike Berg * Julun + * Clemens * */ @@ -14,13 +15,15 @@ #include #include +#include using BPrivate::B_LOCAL_TIME; TTimeEdit::TTimeEdit(BRect frame, const char *name, uint32 sections) - : TSectionEdit(frame, name, sections) + : TSectionEdit(frame, name, sections), + fLastKeyDownTime(0) { InitView(); fTime = BTime::CurrentTime(B_LOCAL_TIME); @@ -33,6 +36,42 @@ void +TTimeEdit::KeyDown(const char* bytes, int32 numBytes) +{ + TSectionEdit::KeyDown(bytes, numBytes); + + BMessage* keyDownMsg = Window()->CurrentMessage(); + int32 number; + keyDownMsg->FindInt32("raw_char", &number); + // only accept int + if (number < 48 || number > 57) + return; + number -= 48; + int32 section = FocusIndex(); + if (section < 0 || section > 2) + return; + + bigtime_t currentTime = system_time(); + if (currentTime - fLastKeyDownTime < 1000000) { + number += fLastKeyDownInt * 10; + fLastKeyDownTime = 0; + } + else { + fLastKeyDownTime = currentTime; + fLastKeyDownInt = number; + } + + // update display value + fHoldValue = number; + + _CheckRange(); + + // send message to change time + DispatchMessage(); +} + + +void TTimeEdit::InitView() { // make sure we call the base class method, as it @@ -173,6 +212,7 @@ void TTimeEdit::SectionFocus(uint32 index) { + fLastKeyDownTime = 0; fFocus = index; fHoldValue = _SectionValue(index); Draw(Bounds()); @@ -342,6 +382,45 @@ void +TDateEdit::KeyDown(const char* bytes, int32 numBytes) +{ + TSectionEdit::KeyDown(bytes, numBytes); + + BMessage*