Skip to content

Commit

Permalink
Revisions suggested in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
jbaublitz committed Aug 26, 2019
1 parent 7672257 commit 33d64e3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/dbus_api/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -99,8 +99,11 @@ fn destroy_pool(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
{
Some(uuid) => uuid,
None => {
let msg = return_message.append3(default_return, msg_code_ok(), msg_string_ok());
return Ok(vec![msg]);
return Ok(vec![return_message.append3(
default_return,
msg_code_ok(),
msg_string_ok(),
)]);
}
};

Expand Down
18 changes: 11 additions & 7 deletions src/dbus_api/filesystem.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ use dbus::{
Message,
};

use uuid::Uuid;

use crate::{
dbus_api::{
consts,
Expand All @@ -23,20 +21,26 @@ use crate::{
msg_code_ok, msg_string_ok,
},
},
engine::{filesystem_mount_path, Filesystem, MaybeDbusPath, Name, RenameAction},
engine::{
filesystem_mount_path, Filesystem, FilesystemUuid, MaybeDbusPath, Name, RenameAction,
},
};

pub fn create_dbus_filesystem<'a>(
dbus_context: &DbusContext,
parent: dbus::Path<'static>,
uuid: Uuid,
uuid: FilesystemUuid,
filesystem: &mut dyn Filesystem,
) -> dbus::Path<'a> {
let f = Factory::new_fn();

let rename_method = f
.method("SetName", (), rename_filesystem)
.in_arg(("name", "s"))
// b: true if UUID of changed resource has been returned
// s: UUID of changed resource
//
// Rust representation: (bool, String)
.out_arg(("result", "(bs)"))
.out_arg(("return_code", "q"))
.out_arg(("return_string", "s"));
Expand Down Expand Up @@ -108,7 +112,7 @@ fn rename_filesystem(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
let dbus_context = m.tree.get_data();
let object_path = m.path.get_name();
let return_message = message.method_return();
let default_return = (false, uuid_to_string!(Uuid::nil()));
let default_return = (false, uuid_to_string!(FilesystemUuid::nil()));

let filesystem_path = m
.tree
Expand All @@ -132,12 +136,12 @@ fn rename_filesystem(m: &MethodInfo<MTFn<TData>, TData>) -> MethodResult {
return_message.append3(default_return, rc, rs)
}
Ok(RenameAction::Identity) => return_message.append3(
(false, uuid_to_string!(Uuid::nil())),
(false, uuid_to_string!(FilesystemUuid::nil())),
msg_code_ok(),
msg_string_ok(),
),
Ok(RenameAction::Renamed(uuid)) => return_message.append3(
(true, true, uuid_to_string!(uuid)),
(true, uuid_to_string!(uuid)),
msg_code_ok(),
msg_string_ok(),
),
Expand Down

0 comments on commit 33d64e3

Please sign in to comment.