VirtualBox

儲存庫 vbox 的更動 56854


忽略:
時間撮記:
2015-7-8 上午09:58:45 (10 年 以前)
作者:
vboxsync
svn:sync-xref-src-repo-rev:
101513
訊息:

Main: Eliminate VBOX_USE_LIBHAL and dead code for FreeBSD, not used anymore

位置:
trunk/src/VBox/Main
檔案:
修改 2 筆資料

圖例:

未更動
新增
刪除
  • trunk/src/VBox/Main/Makefile.kmk

    r56824 r56854  
    306306# VBoxSVC_DEFS.linux += VBOX_USE_LIBHAL
    307307VBoxSVC_DEFS.solaris += VBOX_USE_LIBHAL
    308 VBoxSVC_DEFS.freebsd += VBOX_USE_LIBHAL
    309308
    310309VBoxSVC_CXXFLAGS = $(filter-out -Wno-unused,$(TEMPLATE_VBOXMAINEXE_CXXFLAGS))
  • trunk/src/VBox/Main/src-server/freebsd/HostHardwareFreeBSD.cpp

    r55095 r56854  
    381381    return rc;
    382382}
    383 
    384 #if 0
    385 int VBoxMainUSBDeviceInfo::UpdateDevices ()
    386 {
    387     LogFlowThisFunc(("entered\n"));
    388     int rc = VINF_SUCCESS;
    389     bool success = false;  /* Have we succeeded in finding anything yet? */
    390     try
    391     {
    392         bool halSuccess = false;
    393         mDeviceList.clear();
    394 #if defined(RT_OS_LINUX)
    395 #ifdef VBOX_WITH_DBUS
    396         if (   RT_SUCCESS(rc)
    397             && RT_SUCCESS(RTDBusLoadLib())
    398             && (!success || testing()))
    399             rc = getUSBDeviceInfoFromHal(&mDeviceList, &halSuccess);
    400         /* Try the old API if the new one *succeeded* as only one of them will
    401          * pick up devices anyway. */
    402         if (RT_SUCCESS(rc) && halSuccess && (!success || testing()))
    403             rc = getOldUSBDeviceInfoFromHal(&mDeviceList, &halSuccess);
    404         if (!success)
    405             success = halSuccess;
    406 #endif /* VBOX_WITH_DBUS defined */
    407 #endif /* RT_OS_LINUX */
    408     }
    409     catch(std::bad_alloc &e)
    410     {
    411         rc = VERR_NO_MEMORY;
    412     }
    413     LogFlowThisFunc(("rc=%Rrc\n", rc));
    414     return rc;
    415 }
    416 
    417 struct VBoxMainHotplugWaiter::Context
    418 {
    419 #if defined RT_OS_LINUX && defined VBOX_WITH_DBUS
    420     /** The connection to DBus */
    421     RTMemAutoPtr <DBusConnection, VBoxHalShutdownPrivate> mConnection;
    422     /** Semaphore which is set when a device is hotplugged and reset when
    423      * it is read. */
    424     volatile bool mTriggered;
    425     /** A flag to say that we wish to interrupt the current wait. */
    426     volatile bool mInterrupt;
    427     /** Constructor */
    428     Context() : mTriggered(false), mInterrupt(false) {}
    429 #endif  /* defined RT_OS_LINUX && defined VBOX_WITH_DBUS */
    430 };
    431 
    432 /* This constructor sets up a private connection to the DBus daemon, connects
    433  * to the hal service and installs a filter which sets the mTriggered flag in
    434  * the Context structure when a device (not necessarily USB) is added or
    435  * removed. */
    436 VBoxMainHotplugWaiter::VBoxMainHotplugWaiter ()
    437 {
    438 #if defined RT_OS_LINUX && defined VBOX_WITH_DBUS
    439     int rc = VINF_SUCCESS;
    440 
    441     mContext = new Context;
    442     if (RT_SUCCESS(RTDBusLoadLib()))
    443     {
    444         for (unsigned i = 0; RT_SUCCESS(rc) && i < 5 && !mContext->mConnection; ++i)
    445         {
    446             rc = halInitPrivate (&mContext->mConnection);
    447         }
    448         if (!mContext->mConnection)
    449             rc = VERR_NOT_SUPPORTED;
    450         DBusMessage *pMessage;
    451         while (   RT_SUCCESS(rc)
    452                && (pMessage = dbus_connection_pop_message (mContext->mConnection.get())) != NULL)
    453             dbus_message_unref (pMessage); /* empty the message queue. */
    454         if (   RT_SUCCESS(rc)
    455             && !dbus_connection_add_filter (mContext->mConnection.get(),
    456                                             dbusFilterFunction,
    457                                             (void *) &mContext->mTriggered, NULL))
    458             rc = VERR_NO_MEMORY;
    459         if (RT_FAILURE(rc))
    460             mContext->mConnection.reset();
    461     }
    462 #endif /* defined RT_OS_LINUX && defined VBOX_WITH_DBUS */
    463 }
    464 
    465 /* Destructor */
    466 VBoxMainHotplugWaiter::~VBoxMainHotplugWaiter ()
    467 {
    468 #if defined RT_OS_LINUX && defined VBOX_WITH_DBUS
    469     if (!!mContext->mConnection)
    470         dbus_connection_remove_filter (mContext->mConnection.get(), dbusFilterFunction,
    471                                        (void *) &mContext->mTriggered);
    472     delete mContext;
    473 #endif /* defined RT_OS_LINUX && defined VBOX_WITH_DBUS */
    474 }
    475 
    476 /* Currently this is implemented using a timed out wait on our private DBus
    477  * connection.  Because the connection is private we don't have to worry about
    478  * blocking other users. */
    479 int VBoxMainHotplugWaiter::Wait(RTMSINTERVAL cMillies)
    480 {
    481     int rc = VINF_SUCCESS;
    482 #if defined RT_OS_LINUX && defined VBOX_WITH_DBUS
    483     if (!mContext->mConnection)
    484         rc = VERR_NOT_SUPPORTED;
    485     bool connected = true;
    486     mContext->mTriggered = false;
    487     mContext->mInterrupt = false;
    488     unsigned cRealMillies;
    489     if (cMillies != RT_INDEFINITE_WAIT)
    490         cRealMillies = cMillies;
    491     else
    492         cRealMillies = DBUS_POLL_TIMEOUT;
    493     while (   RT_SUCCESS(rc) && connected && !mContext->mTriggered
    494            && !mContext->mInterrupt)
    495     {
    496         connected = dbus_connection_read_write_dispatch (mContext->mConnection.get(),
    497                                                          cRealMillies);
    498         if (mContext->mInterrupt)
    499             LogFlowFunc(("wait loop interrupted\n"));
    500         if (cMillies != RT_INDEFINITE_WAIT)
    501             mContext->mInterrupt = true;
    502     }
    503     if (!connected)
    504         rc = VERR_TRY_AGAIN;
    505 #else  /* !(defined RT_OS_LINUX && defined VBOX_WITH_DBUS) */
    506     rc = VERR_NOT_IMPLEMENTED;
    507 #endif  /* !(defined RT_OS_LINUX && defined VBOX_WITH_DBUS) */
    508     return rc;
    509 }
    510 
    511 /* Set a flag to tell the Wait not to resume next time it times out. */
    512 void VBoxMainHotplugWaiter::Interrupt()
    513 {
    514 #if defined RT_OS_LINUX && defined VBOX_WITH_DBUS
    515     LogFlowFunc(("\n"));
    516     mContext->mInterrupt = true;
    517 #endif  /* defined RT_OS_LINUX && defined VBOX_WITH_DBUS */
    518 }
    519 #endif
    520 
注意: 瀏覽 TracChangeset 來幫助您使用更動檢視器

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette