@@ -147,6 +147,7 @@ func getMediaName(from diskOrMtp: String) -> String? {
147
147
148
148
return name
149
149
}
150
+
150
151
/// Get Media Name (kDADiskDescriptionDeviceProtocolKey).
151
152
func getDeviceProtocol( from diskOrMtp: String ) -> String {
152
153
var prot : String = kNotAvailable
@@ -343,6 +344,7 @@ func isMountPoint(path: String) -> Bool {
343
344
return ( mtp != nil )
344
345
}
345
346
347
+ /// mount the given disk object. The path for the mount point is optional.
346
348
func mount( disk bsdName: String , at path: String ? ) {
347
349
var disk : String = bsdName
348
350
if disk. hasPrefix ( " disk " ) || disk. hasPrefix ( " /dev/disk " ) {
@@ -401,6 +403,7 @@ func mount(disk bsdName: String, at path: String?) {
401
403
}
402
404
}
403
405
406
+ /// mount the given disk object. The path for the mount point is optional. Code executed in a closure that return a boolean value.
404
407
func mount( disk bsdName: String ,
405
408
at path: String ? ,
406
409
reply: @escaping ( Bool ) -> ( ) ) {
@@ -467,6 +470,7 @@ func mount(disk bsdName: String,
467
470
reply ( false )
468
471
}
469
472
473
+ /// unmount the given disk object or mount point. force used to kill any pid is using the disk.
470
474
func umount( disk diskOrMtp: String , force: Bool ) {
471
475
let disk : String = diskOrMtp
472
476
let mtp : String ? = getMountPoint ( from: diskOrMtp)
@@ -517,6 +521,7 @@ func umount(disk diskOrMtp: String, force: Bool) {
517
521
}
518
522
}
519
523
524
+ /// unmount the given disk object or mount point. force used to kill any pid is using the disk. Code executed in a closure that return a boolean value.
520
525
func umount( disk diskOrMtp: String ,
521
526
force: Bool ,
522
527
reply: @escaping ( Bool ) -> ( ) ) {
@@ -574,6 +579,7 @@ func umount(disk diskOrMtp: String,
574
579
reply ( false )
575
580
}
576
581
582
+ /// Helper function for the mount/umout call back
577
583
fileprivate func printDAReturn( r: DAReturn ) -> String {
578
584
switch Int ( r) {
579
585
case kDAReturnError:
@@ -603,5 +609,4 @@ fileprivate func printDAReturn(r: DAReturn) -> String {
603
609
default :
604
610
return " Unknown "
605
611
}
606
-
607
612
}
0 commit comments