Skip to content

Commit

Permalink
Add the DiskArbitration framework
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Jan 12, 2025
1 parent 5328dff commit b5b1318
Show file tree
Hide file tree
Showing 11 changed files with 143 additions and 9 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/ci.yml

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crates/objc2/src/topics/about_generated/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- `CoreMIDI` / `objc2-core-midi`.
- `CoreText` / `objc2-core-text`.
- `CoreVideo` / `objc2-core-video`.
- `DiskArbitration` / `objc2-disk-arbitration`.
- `EventKitUI` / `objc2-event-kit-ui`.
- `IOSurface` / `objc2-io-surface`.
- `MetalPerformanceShaders` / `objc2-metal-performance-shaders`.
Expand Down
1 change: 1 addition & 0 deletions crates/objc2/src/topics/about_generated/list_data.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
| `CoreWLAN` | [![`objc2-core-wlan`](https://badgen.net/crates/v/objc2-core-wlan)](https://crates.io/crates/objc2-core-wlan) | [![docs.rs](https://docs.rs/objc2-core-wlan/badge.svg)](https://docs.rs/objc2-core-wlan/) |
| `DataDetection` | [![`objc2-data-detection`](https://badgen.net/crates/v/objc2-data-detection)](https://crates.io/crates/objc2-data-detection) | [![docs.rs](https://docs.rs/objc2-data-detection/badge.svg)](https://docs.rs/objc2-data-detection/) |
| `DeviceCheck` | [![`objc2-device-check`](https://badgen.net/crates/v/objc2-device-check)](https://crates.io/crates/objc2-device-check) | [![docs.rs](https://docs.rs/objc2-device-check/badge.svg)](https://docs.rs/objc2-device-check/) |
| `DiskArbitration` | [![`objc2-disk-arbitration`](https://badgen.net/crates/v/objc2-disk-arbitration)](https://crates.io/crates/objc2-disk-arbitration) | [![docs.rs](https://docs.rs/objc2-disk-arbitration/badge.svg)](https://docs.rs/objc2-disk-arbitration/) |
| `EventKit` | [![`objc2-event-kit`](https://badgen.net/crates/v/objc2-event-kit)](https://crates.io/crates/objc2-event-kit) | [![docs.rs](https://docs.rs/objc2-event-kit/badge.svg)](https://docs.rs/objc2-event-kit/) |
| `EventKitUI` | [![`objc2-event-kit-ui`](https://badgen.net/crates/v/objc2-event-kit-ui)](https://crates.io/crates/objc2-event-kit-ui) | [![docs.rs](https://docs.rs/objc2-event-kit-ui/badge.svg)](https://docs.rs/objc2-event-kit-ui/) |
| `ExceptionHandling` | [![`objc2-exception-handling`](https://badgen.net/crates/v/objc2-exception-handling)](https://crates.io/crates/objc2-exception-handling) | [![docs.rs](https://docs.rs/objc2-exception-handling/badge.svg)](https://docs.rs/objc2-exception-handling/) |
Expand Down
3 changes: 3 additions & 0 deletions crates/test-frameworks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ test-frameworks = [
"objc2-data-detection/all",
"dep:objc2-device-check",
"objc2-device-check/all",
"dep:objc2-disk-arbitration",
"objc2-disk-arbitration/all",
"dep:dispatch2",
"dispatch2/all",
"dep:objc2-event-kit",
Expand Down Expand Up @@ -272,6 +274,7 @@ objc2-ml-compute = { path = "../../framework-crates/objc2-ml-compute", optional
objc2-app-kit = { path = "../../framework-crates/objc2-app-kit", optional = true }
objc2-automator = { path = "../../framework-crates/objc2-automator", optional = true }
objc2-core-wlan = { path = "../../framework-crates/objc2-core-wlan", optional = true }
objc2-disk-arbitration = { path = "../../framework-crates/objc2-disk-arbitration", optional = true }
objc2-exception-handling = { path = "../../framework-crates/objc2-exception-handling", optional = true }
objc2-finder-sync = { path = "../../framework-crates/objc2-finder-sync", optional = true }
objc2-input-method-kit = { path = "../../framework-crates/objc2-input-method-kit", optional = true }
Expand Down
53 changes: 53 additions & 0 deletions framework-crates/objc2-disk-arbitration/Cargo.toml

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

14 changes: 14 additions & 0 deletions framework-crates/objc2-disk-arbitration/README.md

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

1 change: 1 addition & 0 deletions framework-crates/objc2-disk-arbitration/src/generated

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

24 changes: 24 additions & 0 deletions framework-crates/objc2-disk-arbitration/src/lib.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//! # Bindings to the `DiskArbitration` framework
//!
//! See [Apple's docs][apple-doc] and [the general docs on framework crates][framework-crates] for more information.
//!
//! [apple-doc]: https://developer.apple.com/documentation/diskarbitration/
//! [framework-crates]: https://docs.rs/objc2/latest/objc2/topics/about_generated/index.html
#![no_std]
#![cfg_attr(docsrs, feature(doc_auto_cfg))]
// Update in Cargo.toml as well.
#![doc(html_root_url = "https://docs.rs/objc2-disk-arbitration/0.2.2")]

#[cfg(feature = "alloc")]
extern crate alloc;

#[cfg(feature = "std")]
extern crate std;

mod generated;
#[allow(unused_imports, unreachable_pub)]
pub use self::generated::*;

// MacTypes.h
#[allow(dead_code)]
pub(crate) type Boolean = u8;
28 changes: 28 additions & 0 deletions framework-crates/objc2-disk-arbitration/translation-config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
framework = "DiskArbitration"
crate = "objc2-disk-arbitration"
required-crates = ["objc2-core-foundation"]
custom-lib-rs = true
macos = "10.4"
maccatalyst = "13.0"

# Needs io_service_t from IOKit
fn.DADiskCreateFromIOMedia.skipped = true
fn.DADiskCopyIOMedia.skipped = true

# Uses `err_local` and `err_local_diskarbitration`, which
# are not exposed by the `libc` crate.
enum.anonymous.constants.kDAReturnError.use-value = true
enum.anonymous.constants.kDAReturnBusy.use-value = true
enum.anonymous.constants.kDAReturnBadArgument.use-value = true
enum.anonymous.constants.kDAReturnExclusiveAccess.use-value = true
enum.anonymous.constants.kDAReturnNoResources.use-value = true
enum.anonymous.constants.kDAReturnNotFound.use-value = true
enum.anonymous.constants.kDAReturnNotMounted.use-value = true
enum.anonymous.constants.kDAReturnNotPermitted.use-value = true
enum.anonymous.constants.kDAReturnNotPrivileged.use-value = true
enum.anonymous.constants.kDAReturnNotReady.use-value = true
enum.anonymous.constants.kDAReturnNotWritable.use-value = true
enum.anonymous.constants.kDAReturnUnsupported.use-value = true

# Needs dispatch_queue_t from libdispatch
fn.DASessionSetDispatchQueue.skipped = true
2 changes: 1 addition & 1 deletion generated

0 comments on commit b5b1318

Please sign in to comment.