class Node

Defined at line 188 of file ../../src/devices/bin/driver_manager/node.h

Public Methods

bool HasDriverComponent ()

NodeShutdownBridge

Exposed for testing.

Defined at line 219 of file ../../src/devices/bin/driver_manager/node.h

bool HasDriverComponentController ()

Defined at line 228 of file ../../src/devices/bin/driver_manager/node.h

bool is_bound ()

Defined at line 230 of file ../../src/devices/bin/driver_manager/node.h

bool IsComposite ()

Defined at line 291 of file ../../src/devices/bin/driver_manager/node.h

void Node (std::string_view name, std::weak_ptr<Node> parent, NodeManager * node_manager, async_dispatcher_t * dispatcher)

Defined at line 309 of file ../../src/devices/bin/driver_manager/node.cc

Node * GetPrimaryParent ()

Exposed for testing.

Defined at line 319 of file ../../src/devices/bin/driver_manager/node.h

void Node (std::string_view name, std::vector<std::weak_ptr<Node>> parents, std::vector<std::string> parents_names, NodeManager * node_manager, async_dispatcher_t * dispatcher, uint32_t primary_index)

Defined at line 326 of file ../../src/devices/bin/driver_manager/node.cc

void SetupDevfsForRootNode (std::shared_ptr<Devfs> & devfs)

This should be used on the root node. Install the root node at the top of the devfs filesystem.

Defined at line 331 of file ../../src/devices/bin/driver_manager/node.h

void AddToDevfsForTesting (Devnode & parent)

This is exposed for testing. Setup this node's devfs nodes.

Defined at line 336 of file ../../src/devices/bin/driver_manager/node.h

NodeState GetNodeState ()

Defined at line 348 of file ../../src/devices/bin/driver_manager/node.h

zx::result<std::shared_ptr<Node>> CreateCompositeNode (std::string_view node_name, std::vector<std::weak_ptr<Node>> parents, std::vector<std::string> parents_names, const std::vector<fuchsia_driver_framework::NodePropertyEntry2> & parent_properties, NodeManager * driver_binder, async_dispatcher_t * dispatcher, std::string_view driver_host_name_for_colocation, uint32_t primary_index)

Defined at line 348 of file ../../src/devices/bin/driver_manager/node.cc

const std::string & name ()

Defined at line 350 of file ../../src/devices/bin/driver_manager/node.h

NodeType type ()

Defined at line 352 of file ../../src/devices/bin/driver_manager/node.h

const DriverHost * driver_host ()

Defined at line 356 of file ../../src/devices/bin/driver_manager/node.h

DriverHost * driver_host ()

Defined at line 364 of file ../../src/devices/bin/driver_manager/node.h

bool quarantined ()

Defined at line 374 of file ../../src/devices/bin/driver_manager/node.h

std::span<const std::weak_ptr<Node>> parents ()

Defined at line 376 of file ../../src/devices/bin/driver_manager/node.h

const std::list<std::shared_ptr<Node>> & children ()

Defined at line 386 of file ../../src/devices/bin/driver_manager/node.h

const std::vector<NodeOffer> & offers ()

Defined at line 388 of file ../../src/devices/bin/driver_manager/node.h

const std::vector<fuchsia_driver_framework::NodeSymbol> & symbols ()

Defined at line 390 of file ../../src/devices/bin/driver_manager/node.h

size_t properties_size ()

Returns the node properties of the node and its parents if the node is a composite node.

See `properties_` property for more info.

Defined at line 394 of file ../../src/devices/bin/driver_manager/node.h

void SetSubtreeDictionaryRef (std::optional<fuchsia_component_sandbox::CapabilityId> subtree_dictionary_ref)

Defined at line 407 of file ../../src/devices/bin/driver_manager/node.h

void MarkAsCompositeParent ()

Defined at line 415 of file ../../src/devices/bin/driver_manager/node.h

void UnmarkAsCompositeParent ()

Defined at line 417 of file ../../src/devices/bin/driver_manager/node.h

bool HasSubtreeDictionaryRef ()

Defined at line 419 of file ../../src/devices/bin/driver_manager/node.h

bool SkipInjectedOffers ()

Defined at line 421 of file ../../src/devices/bin/driver_manager/node.h

std::optional<fuchsia_component_sandbox::DictionaryRef> TakeDictionary ()

Defined at line 423 of file ../../src/devices/bin/driver_manager/node.h

const Collection & collection ()

Defined at line 429 of file ../../src/devices/bin/driver_manager/node.h

const fuchsia_driver_framework::DriverPackageType & driver_package_type ()

Defined at line 431 of file ../../src/devices/bin/driver_manager/node.h

DevfsDevice & devfs_device ()

Defined at line 435 of file ../../src/devices/bin/driver_manager/node.h

bool can_multibind_composites ()

Defined at line 437 of file ../../src/devices/bin/driver_manager/node.h

void ~Node ()

Defined at line 437 of file ../../src/devices/bin/driver_manager/node.cc

void set_collection (Collection collection)

Defined at line 439 of file ../../src/devices/bin/driver_manager/node.h

void set_driver_package_type (fuchsia_driver_framework::DriverPackageType driver_package_type)

Defined at line 441 of file ../../src/devices/bin/driver_manager/node.h

void set_symbols (std::vector<fuchsia_driver_framework::NodeSymbol> symbols)

Defined at line 445 of file ../../src/devices/bin/driver_manager/node.h

void set_can_multibind_composites (bool can_multibind_composites)

Defined at line 449 of file ../../src/devices/bin/driver_manager/node.h

std::optional<zx_koid_t> token_koid ()

Defined at line 453 of file ../../src/devices/bin/driver_manager/node.h

ShutdownIntent shutdown_intent ()

Defined at line 460 of file ../../src/devices/bin/driver_manager/node.h

void OnNodeServerUnbound (fidl::UnbindInfo info)

This is called when |node_ref_| is unbound from the dispatcher.

Defined at line 1381 of file ../../src/devices/bin/driver_manager/node.cc

void OnBind ()

Defined at line 543 of file ../../src/devices/bin/driver_manager/node.cc

void OnMatchError (zx_status_t status)

Defined at line 605 of file ../../src/devices/bin/driver_manager/node.cc

void OnStartError (zx_status_t status)

Defined at line 609 of file ../../src/devices/bin/driver_manager/node.cc

void Remove (RemovalSet removal_set, NodeRemovalTracker * removal_tracker)

Begin the removal process for a Node. This function ensures that a Node is

only removed after all of its children are removed. It also ensures that

a Node is only removed after the driver that is bound to it has been stopped.

This is safe to call multiple times.

There are multiple reasons a Node's removal will be started:

- The system is being stopped.

- The Node had an unexpected error or disconnect

During a system stop, Remove is expected to be called twice:

once with |removal_set| == kPackage, and once with |removal_set| == kAll.

Errors and disconnects that are unrecoverable should call Remove(kAll, nullptr).

Defined at line 834 of file ../../src/devices/bin/driver_manager/node.cc

void AddChild (fuchsia_driver_framework::NodeAddArgs args, fidl::ServerEnd<fuchsia_driver_framework::NodeController> controller, fidl::ServerEnd<fuchsia_driver_framework::Node> node, AddNodeResultCallback callback)

`callback` is invoked once the node has finished being added or an error

has occurred.

Defined at line 1336 of file ../../src/devices/bin/driver_manager/node.cc

void AddToParents ()

Add this Node to its parents. This should be called when the node is created. Exposed for

testing.

Defined at line 669 of file ../../src/devices/bin/driver_manager/node.cc

void RestartNode ()

Begins the process of restarting the node. Restarting a node includes stopping and removing

all children nodes, stopping the driver that is bound to the node, and asking the NodeManager

to bind the node again. The restart operation is very similar to the Remove operation, the

difference being once the children are removed, and the driver stopped, we don't remove the

node from the topology but instead bind the node again.

Defined at line 838 of file ../../src/devices/bin/driver_manager/node.cc

void QuarantineNode ()

Begins the process of quarantining the node. This is basically performing a Remove,

but instead of removing the node from the topology, we keep it in a stopped state so that it

can be orphaned if its driver is ever disabled. That way new drivers can be bound to the node.

Defined at line 843 of file ../../src/devices/bin/driver_manager/node.cc

void RemoveCompositeNodeForRebind (fit::callback<void (zx::result<>)> completer)

TODO(https://fxbug.dev/42082343): Handle the case in which this function is called during node

removal.

Defined at line 876 of file ../../src/devices/bin/driver_manager/node.cc

void RestartNodeWithRematch (std::optional<std::string> restart_driver_url_suffix, fit::callback<void (zx::result<>)> completer)

Restarting a node WithRematch, means that instead of re-using the currently bound driver,

another MatchDriver call will be made into the driver index to find a new driver to bind.

Defined at line 858 of file ../../src/devices/bin/driver_manager/node.cc

void RestartNodeWithRematch ()

Defined at line 870 of file ../../src/devices/bin/driver_manager/node.cc

void StartDriver (fuchsia_component_runner::wire::ComponentStartInfo start_info, fidl::ServerEnd<fuchsia_component_runner::ComponentController> component_controller, fit::callback<void (zx::result<>)> cb)

Defined at line 1635 of file ../../src/devices/bin/driver_manager/node.cc

void LeaseDriverPowerElement (fit::callback<void (zx::result<>)> cb)

Defined at line 1601 of file ../../src/devices/bin/driver_manager/node.cc

void SetController (fidl::ClientEnd<fuchsia_component::Controller> component_controller)

ComponentOwner

Defined at line 534 of file ../../src/devices/bin/driver_manager/node.cc

void OnComponentStarted (const std::weak_ptr<BootupTracker> & bootup_tracker, const std::string & moniker, zx::result<StartedComponent> component)

Defined at line 2002 of file ../../src/devices/bin/driver_manager/node.cc

void RequestStartComponent (fuchsia_process::wire::HandleInfo startup_handle, const std::string & moniker, const std::weak_ptr<BootupTracker> & bootup_tracker)

Defined at line 2030 of file ../../src/devices/bin/driver_manager/node.cc

void SetNonCompositeProperties (std::span<const fuchsia_driver_framework::NodeProperty2> properties)

Exposed for testing.

Set properties to non-composite node properties containing a clone of `properties`.

Defined at line 997 of file ../../src/devices/bin/driver_manager/node.cc

bool EvaluateRematchFlags (fuchsia_driver_development::RestartRematchFlags rematch_flags, std::string_view requested_url)

Evaluates the given rematch_flags against the node. Returns true if rematch should take place,

false otherwise. Rematching is done based on the node type and url both matching:

For node type, if the node is a composite, the rematch flags must contain the flag

for the composite variant that the node is. No validation for non-composites.

For the url, rematch takes place if either:

- the url matches the requested_url and the 'requested' flag is available.

- the url does not match and the 'non_requested' flag is available.

Defined at line 2320 of file ../../src/devices/bin/driver_manager/node.cc

std::string MakeTopologicalPath (bool deduplicate)

Creates the node's topological path by combining each primary parent's name together,

separated by '/'.

E.g: dev/sys/topo/path

Defined at line 495 of file ../../src/devices/bin/driver_manager/node.cc

std::string MakeComponentMoniker ()

Make the node's component moniker by making the topological path and then replacing

characters not allowed by the component framework.

E.g: dev.sys.topo.path

Defined at line 508 of file ../../src/devices/bin/driver_manager/node.cc

void SetShouldDestroy ()

Defined at line 539 of file ../../src/devices/bin/driver_manager/node.cc

void CompleteBind (zx::result<> result)

Invoked when a bind sequence has been completed. It allows us to reply to outstanding bind

requests that may have originated from the node.

Defined at line 630 of file ../../src/devices/bin/driver_manager/node.cc

NodeShutdownCoordinator & GetNodeShutdownCoordinator ()

Defined at line 680 of file ../../src/devices/bin/driver_manager/node.cc

const std::string & driver_url ()

Defined at line 471 of file ../../src/devices/bin/driver_manager/node.cc

std::optional<std::vector<fuchsia_driver_framework::NodeProperty2>> GetNodeProperties (std::string_view parent_name)

Returns the node properties of the node or the node's parent if the node is a composite node.

Returns std::nullopt if the node is a non-composite and `parent_name` is not "default".

Returns std::nullopt if the parent node cannot be found.

See `properties_` property for more info.

Defined at line 2492 of file ../../src/devices/bin/driver_manager/node.cc

fuchsia_driver_framework::NodePropertyDictionary2 GetNodePropertyDict ()

Defined at line 2502 of file ../../src/devices/bin/driver_manager/node.cc

void PrepareDictionary (fit::callback<void (zx::result<>)> callback)

Defined at line 2141 of file ../../src/devices/bin/driver_manager/node.cc

std::vector<fuchsia_driver_framework::BusInfo> GetBusTopology ()

Defined at line 1027 of file ../../src/devices/bin/driver_manager/node.cc

Friends

class ComponentControllerConnection
class DriverHostConnection