Skip to content

Commit

Permalink
feat: working on midl
Browse files Browse the repository at this point in the history
  • Loading branch information
szkabaroli committed May 24, 2024
1 parent ec2da68 commit 064b218
Show file tree
Hide file tree
Showing 41 changed files with 1,229 additions and 419 deletions.
36 changes: 35 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"useDaemonProcess": true,
"useDaemonProcess": false,
"extends": "nx/presets/npm.json",
"plugins": ["@meshx-org/nx-midl"],
"pluginsConfig": {
Expand Down
36 changes: 36 additions & 0 deletions sdk/midl/fx/rights.midl
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
// Copyright 2019 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 zx;

// TODO(scottmg): (1 << 4) notation or something else for bits would be nice.
type Rights = strict bits : uint32 {
// TODO(scottmg): "bits members must be powers of two"
// NONE = 0x00000000;
DUPLICATE = 0x00000001;
TRANSFER = 0x00000002;
READ = 0x00000004;
WRITE = 0x00000008;
EXECUTE = 0x00000010;
MAP = 0x00000020;
GET_PROPERTY = 0x00000040;
SET_PROPERTY = 0x00000080;
ENUMERATE = 0x00000100;
DESTROY = 0x00000200;
SET_POLICY = 0x00000400;
GET_POLICY = 0x00000800;
SIGNAL = 0x00001000;
SIGNAL_PEER = 0x00002000;
WAIT = 0x00004000;
INSPECT = 0x00008000;
MANAGE_JOB = 0x00010000;
MANAGE_PROCESS = 0x00020000;
MANAGE_THREAD = 0x00040000;
APPLY_PROFILE = 0x00080000;
MANAGE_SOCKET = 0x00100000;
OP_CHILDREN = 0x00200000;
RESIZE = 0x00400000;
ATTACH_VMO = 0x00800000;
MANAGE_VMO = 0x01000000;
SAME_RIGHTS = 0x80000000;
};
7 changes: 7 additions & 0 deletions sdk/midl/meshx.fs/msx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "meshx.fs",
"bindings": [],
"include": ["*.midl"],
"exclude": [],
"references": []
}
1 change: 1 addition & 0 deletions sdk/midl/meshx.fs/overview.midl
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
library meshx.fs;
27 changes: 0 additions & 27 deletions sdk/midl/meshx.io/directory.midl
Original file line number Diff line number Diff line change
Expand Up @@ -181,33 +181,6 @@ closed protocol Directory {

// Extracted from Directory1 for composition with protocols in other libraries.
closed protocol Openable {
/// Opens a new object relative to this directory object.
///
/// `path` may contain multiple segments, separated by "/" characters, and should never be
/// empty; i.e. "" is an invalid path. A trailing slash implies OpenFlags.DIRECTORY. Components
/// must not be empty (i.e. "foo//bar" is invalid). ".." is disallowed anywhere in the path. "."
/// is only allowed if the path is exactly ".", but not otherwise. A leading '/' is allowed (and
/// is treated the same way as if not present, i.e. "/foo/bar' and "foo/bar" are the same).
///
/// If an unknown value is sent for flags the connection should be closed.
///
/// `OpenFlags.RIGHT_*` flags provided in `flags` will restrict access rights on
/// the `object` channel which will be connected to the opened entity.
///
/// Rights are never increased. When you open a nested entity within a directory, you may only
/// request the same rights as what the directory connection already has, or a subset of those.
/// Exceeding those rights causes an access denied error to be transmitted in the
/// `OnOpen` event if applicable, and the `object` connection closed.
///
/// `mode` is ignored.
@available(deprecated=11, replaced=12, note="Use the new signature of Open.")
@selector("meshx.io1/Directory.Open")
strict Open(resource struct {
flags OpenFlags;
mode ModeType;
path string:MAX_PATH;
object server_end:Node;
});

/// Opens a new object relative to this directory object.
///
Expand Down
5 changes: 0 additions & 5 deletions sdk/midl/meshx.io/directory2.midl
Original file line number Diff line number Diff line change
Expand Up @@ -229,11 +229,6 @@ closed protocol Directory2 {
6: create_attributes MutableNodeAttributes;
};
};

/// The server end of a channel created for the new connection. The
/// caller may proceed to send messages on the corresponding client end
/// right away.
object_request fx.Handle:CHANNEL;
});

/// Removes a child node from the this directory's list of entries.
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion sdk/midl/meshx.pkg/cache.midl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// found in the LICENSE file.
library meshx.pkg;

using meshx.fxfs;
using meshx.fs;
using meshx.io;
using fx;

Expand Down
4 changes: 3 additions & 1 deletion sdk/midl/meshx.pkg/msx.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"exclude": [],
"references": [
{ "path": "../fx" },
{ "path": "../meshx.io" }
{ "path": "../meshx.io" },
{ "path": "../meshx.url" },
{ "path": "../meshx.fs" }
]
}
16 changes: 8 additions & 8 deletions sdk/midl/meshx.pkg/repo.midl
Original file line number Diff line number Diff line change
Expand Up @@ -14,41 +14,41 @@ closed protocol RepositoryManager {
/// Adds a repository. This will overwrite the repository if it already exists.
///
/// + request `repo` a repository to add to the resolver.
/// * error a zx_status value indicating failure. One of the following:
/// * error a fx_status value indicating failure. One of the following:
/// * `FX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled.
/// * `ZX_ERR_ALREADY_EXISTS` if the repository already exists.
/// * `ZX_ERR_INVALID_ARGS` if the repository is malformed.
strict Add(struct {
repo RepositoryConfig;
}) -> () error zx.Status;
}) -> () error fx.Status;

/// Removes a repository.
///
/// Removing a repository will prevent future packages from being cached from this repository,
/// but in-flight downloads may not be interrupted.
///
/// + request `repo_url` the URL of the repository we want to remove.
/// * error a zx_status value indicating failure. One of the following:
/// * error a fx_status value indicating failure. One of the following:
/// * `FX_ERR_ACCESS_DENIED` if editing repositories is permanently disabled or the
/// `repo_url` matches a static repository.
/// * `ZX_ERR_INVALID_ARGS` if the `repo_url` is malformed.
/// * `ZX_ERR_NOT_FOUND` if the repository does not exist.
strict Remove(struct {
repo_url string;
}) -> () error zx.Status;
}) -> () error fx.Status;

/// Adds a mirror to a repository. This will overwrite the mirror if it already exists.
///
/// + request `repo_url` the URL of the repository to add the mirror to.
/// + request `mirror` the mirror config used to add the mirror.
/// * error a zx_status value indicating failure. One of the following:
/// * error a fx_status value indicating failure. One of the following:
/// * `FX_ERR_ALREADY_EXISTS` if the mirror for this repository already exists.
/// * `FX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror` is malformed.
/// * `FX_ERR_NOT_FOUND` if the repository does not exist.
strict AddMirror(struct {
repo_url string;
mirror MirrorConfig;
}) -> () error zx.Status;
}) -> () error fx.Status;

/// Removes a mirror from a repository.
///
Expand All @@ -57,13 +57,13 @@ closed protocol RepositoryManager {
///
/// + request `repo_url` the URL of the mirror's repository.
/// + request `mirror_url` the URL of the mirror we want to remove.
/// * error a zx_status value indicating failure. One of the following:
/// * error a fx_status value indicating failure. One of the following:
/// * `FX_ERR_INVALID_ARGS` if the `repo_url` or the `mirror_url` is malformed.
/// * `FX_ERR_NOT_FOUND` if the repository or mirror does not exist.
strict RemoveMirror(struct {
repo_url string;
mirror_url string;
}) -> () error zx.Status;
}) -> () error fx.Status;

/// Returns an iterator over all repositories.
///
Expand Down
7 changes: 0 additions & 7 deletions sdk/midl/meshx.url/midl.json

This file was deleted.

7 changes: 7 additions & 0 deletions sdk/midl/meshx.url/msx.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"name": "meshx.url",
"bindings": [],
"include": ["*.midl"],
"exclude": [],
"references": [{ "path": "../fx" }]
}
2 changes: 1 addition & 1 deletion sdk/midl/meshx.url/url.midl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Copyright 2020 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.url;
library meshx.url;

/// There is no maximum URL length defined by RFC 3986, but this length should
/// be long enough to accommodate most non-data: URLs.
Expand Down
3 changes: 2 additions & 1 deletion tools/midl/midlc/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@ thiserror = "1.0.38"
derivative="2.2"
anyhow="1.0"
num="0.4"
convert_case="0.6"
convert_case="0.6"
backtrace-on-stack-overflow="0.3"
Loading

0 comments on commit 064b218

Please sign in to comment.