}
+void
+command_mount_xsnapshots(DBus::Connection& conn, const string& config_name,
+ unsigned int num)
+{
+ DBus::MessageMethodCall call(SERVICE, OBJECT, INTERFACE, "MountSnapshot");
+
+ DBus::Hoho hoho(call);
+ hoho << config_name << num;
+
+ DBus::Message reply = conn.send_and_reply_and_block(call);
+}
+
+
+void
+command_umount_xsnapshots(DBus::Connection& conn, const string& config_name,
+ unsigned int num)
+{
+ DBus::MessageMethodCall call(SERVICE, OBJECT, INTERFACE, "UmountSnapshot");
+
+ DBus::Hoho hoho(call);
+ hoho << config_name << num;
+
+ DBus::Message reply = conn.send_and_reply_and_block(call);
+}
+
+
void
command_create_xcomparison(DBus::Connection& conn, const string& config_name, unsigned int number1,
unsigned int number2)
DBus::Message reply = conn.send_and_reply_and_block(call);
- DBus::Hihi hihi(reply);
list<XFile> files;
+
+ DBus::Hihi hihi(reply);
hihi >> files;
return files;
DBus::Message reply = conn.send_and_reply_and_block(call);
- DBus::Hihi hihi(reply);
vector<string> files;
+
+ DBus::Hihi hihi(reply);
hihi >> files;
return files;
{
while (getopts.hasArgs())
{
- Snapshots::iterator snapshot; // = read_num(getopts.popArg());
+ unsigned int num = read_num(getopts.popArg());
GetOpts::parsed_opts::const_iterator opt;
+ /*
if ((opt = opts.find("description")) != opts.end())
snapshot->setDescription(opt->second);
snapshot->setUserdata(read_userdata(opt->second, snapshot->getUserdata()));
snapshot->flushInfo();
+ */
}
}
catch (const IllegalSnapshotException& e)
{
while (getopts.hasArgs())
{
- Snapshots::iterator snapshot; // = read_num(getopts.popArg());
+ unsigned int num = read_num(getopts.popArg());
- snapshot->mountFilesystemSnapshot();
+ command_mount_xsnapshots(conn, config_name, num);
}
}
catch (const IllegalSnapshotException& e)
{
while (getopts.hasArgs())
{
- Snapshots::iterator snapshot; // = read_num(getopts.popArg());
+ unsigned int num = read_num(getopts.popArg());
- snapshot->umountFilesystemSnapshot();
+ command_umount_xsnapshots(conn, config_name, num);
}
}
catch (const IllegalSnapshotException& e)
" <arg name='numbers' type='au' direction='in'/>\n"
" </method>\n"
+ " <method name='MountSnapshot'>\n"
+ " <arg name='config-name' type='s' direction='in'/>\n"
+ " <arg name='number' type='u' direction='in'/>\n"
+ " </method>\n"
+
+ " <method name='UmountSnapshot'>\n"
+ " <arg name='config-name' type='s' direction='in'/>\n"
+ " <arg name='number' type='u' direction='in'/>\n"
+ " </method>\n"
+
" <method name='CreateComparison'>\n"
" <arg name='config-name' type='s' direction='in'/>\n"
" <arg name='number1' type='u' direction='in'/>\n"
}
+void
+reply_to_command_mount_snapshot(DBus::Connection& conn, DBus::Message& msg)
+{
+ string config_name;
+ dbus_uint32_t num;
+
+ DBus::Hihi hihi(msg);
+ hihi >> config_name >> num;
+
+ y2mil("MountSnapshot config_name:" << config_name << " num:" << num);
+
+ check_permission(conn, msg, config_name);
+
+ Snapper* snapper = getSnapper(config_name);
+
+ Snapshots& snapshots = snapper->getSnapshots();
+
+ Snapshots::iterator snap = snapshots.find(num);
+
+ snap->mountFilesystemSnapshot();
+
+ DBus::MessageMethodReturn reply(msg);
+
+ conn.send(reply);
+}
+
+
+void
+reply_to_command_umount_snapshot(DBus::Connection& conn, DBus::Message& msg)
+{
+ string config_name;
+ dbus_uint32_t num;
+
+ DBus::Hihi hihi(msg);
+ hihi >> config_name >> num;
+
+ y2mil("UmountSnapshot config_name:" << config_name << " num:" << num);
+
+ check_permission(conn, msg, config_name);
+
+ Snapper* snapper = getSnapper(config_name);
+
+ Snapshots& snapshots = snapper->getSnapshots();
+
+ Snapshots::iterator snap = snapshots.find(num);
+
+ snap->umountFilesystemSnapshot();
+
+ DBus::MessageMethodReturn reply(msg);
+
+ conn.send(reply);
+}
+
+
struct Comparing : public Job
{
DBus::Connection* conn;
reply_to_command_create_post_snapshot(conn, msg);
else if (msg.is_method_call(INTERFACE, "DeleteSnapshots"))
reply_to_command_delete_snapshots(conn, msg);
+ else if (msg.is_method_call(INTERFACE, "MountSnapshot"))
+ reply_to_command_mount_snapshot(conn, msg);
+ else if (msg.is_method_call(INTERFACE, "UmountSnapshot"))
+ reply_to_command_umount_snapshot(conn, msg);
else if (msg.is_method_call(INTERFACE, "CreateComparison"))
reply_to_command_create_comparison(conn, msg);
else if (msg.is_method_call(INTERFACE, "GetFiles"))
reply_to_command_debug(conn, msg);
else
{
- DBus::MessageError reply(msg, "error.unknown", DBUS_ERROR_FAILED);
+ DBus::MessageError reply(msg, "error.unknown_method", DBUS_ERROR_FAILED);
conn.send(reply);
}
}