blob: 0ecc80093f3ba3d2ea4605077b26323814e7d0f7 [file] [log] [blame]
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
library fuchsia.device.fs;
using zx;
/// A protocol that lets a client connect to another protocol.
protocol Connector {
/// Connect to the underlying protocol.
Connect(resource struct {
server zx.handle:CHANNEL;
/// Protocol through which a driver can export services to devfs.
protocol Exporter {
/// Export a device in devfs.
/// * error `ZX_ERR_ALREADY_EXISTS` if `topological_path` already exists.
/// * error `ZX_ERR_NOT_FOUND` if `class_name` doesn't match a valid class name.
Export(resource struct {
/// This is the connector that will have Connect called on it when a client opens the
/// device. If the server end of this connection is dropped the export will automatically be
/// cleaned up.
open_client client_end:Connector;
/// If this is present, then the device will be exported at this topological path.
topological_path string:<, optional>;
/// If this is present, then the device will be exported into "/dev/class/{class_name}/".
class_name string:<, optional>;
}) -> () error zx.status;