summaryrefslogtreecommitdiff
path: root/include/dbus_singleton.hpp
AgeCommit message (Collapse)AuthorFilesLines
2024-01-09Fix spelling mistakesEd Tanous1-2/+2
These were found with: codespell -w $(git ls-files | grep "\.[hc]\(pp\)\?$") At some point in the future, we might want to get this enabled in CI. Change-Id: Iccb57b2adfd06a2e177e99db2923fe4e8e329118 Signed-off-by: Ed Tanous <ed@tanous.net>
2023-05-17Remove bad include from dbus singletonEd Tanous1-1/+0
Neither of these files make use of io_context, so they shouldn't be here Tested: Code compiles Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: I86c195a5881a50a275e977aa73b9d7144b53844b
2023-01-17Add check for globalsEd Tanous1-0/+1
We don't follow this cpp core guidelines rule well. This is something that we should aspire to cleaning up in the future, but for the moment, lets turn the rule on in clang-tidy to stop the bleeding, add ignores for the things that we know need some better abstractions, and work on these over time. Most of this commit is just adding NOLINTNEXTLINE exceptions for all of our globals. There was one case in the sensor code where clang correctly noted that those globals weren't actually const, which got missed because of the use of auto. Tested: CI should be good enough for this. Passes clang-tidy. Signed-off-by: Ed Tanous <edtanous@google.com> Change-Id: Ieda08fee69a3b209d4b3e9771809a6c41524f066
2022-07-07dbus_singleton: use stack variable and externNan Zhou1-1/+5
Currently, the |systemBus| connection is a static variable declared in headers. This has a problem that every translation unit will keep its own copy. It's not a problem today because there's only one translation unit "webserver_main.cpp.o". This issue was brounght up in https://gerrit.openbmc.org/c/openbmc/bmcweb/+/54758 Actually, the |systemBus| doesn't need to be a singleton. It can just be a stack variable, which is normally more efficient than heap variables. To keep minimum changes treeside, this commits keeps the existing |systemBus| variable as an external variable. It is defined in its own translation unit. It is initialized in the main translation unit. Reference: 1. Extern https://stackoverflow.com/questions/1433204/how-do-i-use-extern-to-share-variables-between-source-files Tested: 1. Romulus QEMU robot Redfish test passed; 2. Start and restart service on real hardware, no issues; 3. No new validator failures 4. Code compies Signed-off-by: Nan Zhou <nanzhoumails@gmail.com> Change-Id: I03b387bd5f218a86c9d1765415a46e3c2ad83ff9
2018-12-10Remove custom version of getPtrEd Tanous1-13/+0
Now that sdbusplus variant supports std::get_if, we can remove our custom, mapbox namespaced implementation that does the same thing. Change-Id: I854c473003e28e41dd45dba08ca683433f1c1774 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-10-19Fixup mapbox variant referencesWilliam A. Kennington III1-9/+5
This removes all dependencies on the mapbox specific variant api. The code is now compatible with the drop in std::variant api. Change-Id: Ie64be86ecae341def54f564eb282fb3b5356cc18 Signed-off-by: William A. Kennington III <wak@google.com>
2018-09-05Move to clang-format-6.0Ed Tanous1-13/+20
This commit moves the codebase to the lastest clang-format file from upstream, as well as clang-format-6.0. Change-Id: Ice8313468097c0c42317fbb9e10ddf036e8cff4c Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-07-27Move over to upstream c++ styleEd Tanous1-2/+2
This patchset moves bmcweb over to the upstream style naming conventions for variables, classes, and functions, as well as imposes the latest clang-format file. This changeset was mostly built automatically by the included .clang-tidy file, which has the ability to autoformat and auto rename variables. At some point in the future I would like to see this in greater use, but for now, we will impose it on bmcweb, and see how it goes. Tested: Code still compiles, and appears to run, although other issues are possible and likely. Change-Id: If422a2e36df924e897736b3feffa89f411d9dac1 Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2018-06-29Move bmcweb over to sdbusplusEd Tanous1-5/+16
This patchset moves bmcweb from using boost-dbus over entirely to sdbusplus. This has some nice improvements in performance (about 30% of CPU cycles saved in dbus transactions), as well as makes this project manuver closer to the upstream way of thinking. Changes to bmcweb are largely ceremonial, and fall into a few categories: 1. Moves async_method_call instances to the new format, and deletes any use of the "endpoint" object in leiu of the sdbusplus style interface 2. sdbus object_path object doesn't allow access to the string directly, so code that uses it moves to explicit casts. 3. The mapbox variant, while attempting to recreate boost::variant, misses a T* get<T*>() method implementation, which allows using variant without exceptions. Currently, there is an overload for mapbox::get_ptr implementation which replecates the functionality. Tested by: Booting the bmcweb on a target, iterating through redfish basic phosphor-webui usage, and websockets usage Change-Id: I2d95882908d6eb6dba00b9219a221dd96449ca7b Signed-off-by: Ed Tanous <ed.tanous@intel.com>
2017-10-11Large updates to webserverEd Tanous1-0/+10
Do not merge yet Change-Id: I38c56844c1b0e3e8e5493c2705e62e6db7ee2102