#ifdef CONFIG_MARU
#include "tizen/src/util/maru_err_table.h"
+#include "tizen/src/emul_state.h"
#endif
static uint32_t virtio_9p_get_features(VirtIODevice *vdev, uint32_t features)
error_setg(errp, "share path %s is not a directory", fse->path);
goto out;
}
+
+#ifdef CONFIG_MARU
+ set_emul_hds_attached(true);
+ set_emul_hds_path(fse->path);
+#endif
+
v9fs_path_free(&path);
return;
#define MSG_TYPE_GUEST "guest"
#define MSG_GROUP_STATUS 15
+#define MSG_GROUP_HDS 100
+
+#define HDS_ACTION_MOUNT 1
+#define HDS_ACTION_UMOUNT 2
enum message_action {
MSG_ACT_BATTERY_LEVEL = 100,
}
}
-static char hds_path[PATH_MAX];
-
static void msgproc_device_req_hds(ECS_Client* ccli, ECS__DeviceReq* msg, char * cmd)
{
char* data = NULL;
if (group == MSG_GROUP_STATUS) {
char hds_data_send[PATH_MAX + 3];
if (is_hds_attached()) {
- sprintf(hds_data_send, "1, %s", hds_path);
+ sprintf(hds_data_send, "1, %s", get_emul_hds_path());
} else {
sprintf(hds_data_send, "0, ");
}
make_send_device_ntf(cmd, group, 99, hds_data_send);
- } else if (group == 100 && action == 1) {
+ } else if (group == MSG_GROUP_HDS && action == HDS_ACTION_MOUNT) {
LOG_INFO("try attach with is_hds_attached : %d\n", is_hds_attached());
if (data != NULL && !is_hds_attached()) {
- LOG_INFO("do attach : %s\n", hds_path);
- memset(hds_path, 0, sizeof(hds_path));
- memcpy(hds_path, data, sizeof(hds_path) - 1);
- do_hotplug(ATTACH_HDS, hds_path, strlen(hds_path) + 1);
+ LOG_INFO("do attach : %s\n", data);
+ set_emul_hds_path(data);
+ do_hotplug(ATTACH_HDS, data, strlen(data) + 1);
LOG_INFO("send emuld to mount.\n");
send_msg_to_guest(ccli, cmd, group, action, data, strlen(data));
} else {
- make_send_device_ntf(cmd, 100, 2, NULL);
+ make_send_device_ntf(cmd, group, 2, NULL);
}
- } else if (group == 100 && action == 2) {
+ } else if (group == MSG_GROUP_HDS && action == HDS_ACTION_UMOUNT) {
LOG_INFO("try detach with is_hds_attached : %d\n", is_hds_attached());
if (is_hds_attached()) {
LOG_INFO("send emuld to umount.\n");
{
return _emul_info.http_proxy_port;
}
+
+void set_emul_hds_attached(bool attached)
+{
+ _emul_state.hds_attached = attached;
+}
+
+bool get_emul_hds_attached(void)
+{
+ return _emul_state.hds_attached;
+}
+
+void set_emul_hds_path(const char *path)
+{
+ strncpy(_emul_state.hds_path, path, sizeof(_emul_state.hds_path));
+ _emul_state.hds_path[sizeof(_emul_state.hds_path) -1] = 0;
+}
+
+char* get_emul_hds_path(void)
+{
+ return _emul_state.hds_path;
+}
#define MAX_ADDR_LEN 256
#define MAX_PORT_LEN 256
-#define MAX_ADDR_LEN 256
-#define MAX_PORT_LEN 256
-
+#define MAX_HDS_PATH 256
enum {
RESET = 0,
BOOT_COMPLETED = 1,
int qemu_caps_lock;
int qemu_num_lock;
/* add here */
+ bool hds_attached;
+ char hds_path[MAX_HDS_PATH];
} EmulatorConfigState;
/* misc */
void set_emul_vm_name(char *vm_name);
void set_emul_http_proxy_addr(char *addr);
void set_emul_http_proxy_port(char *port);
+void set_emul_hds_attached(bool attached);
+void set_emul_hds_path(const char *path);
/* getter */
bool get_emul_skin_enable(void);
char* get_emul_vm_name(void);
char* get_emul_http_proxy_addr(void);
char* get_emul_http_proxy_port(void);
+bool get_emul_hds_attached(void);
+char* get_emul_hds_path(void);
#endif /* __EMUL_STATE_H__ */
#include "qemu/event_notifier.h"
#include "emulator.h"
+#include "emul_state.h"
#include "maru_device_hotplug.h"
#define HOST_KEYBOARD_DRIVER "virtio-keyboard-pci"
// FIXME: Should we query device every time ??
bool host_keyboard_attached;
bool sdcard_attached;
- bool hds_attached;
};
static struct maru_device_hotplug *state;
QDECREF(qdict);
- state->hds_attached = true;
+ set_emul_hds_attached(true);
return true;
}
QDECREF(qdict);
- state->hds_attached = false;
+ set_emul_hds_attached(false);
return true;
}
bool is_hds_attached(void)
{
- return state->hds_attached;
+ return get_emul_hds_attached();
}
qemu_opt_set_bool(fsdev, "readonly",
qemu_opt_get_bool(opts, "readonly", 0));
+#ifdef CONFIG_MARU
+ device = qemu_opts_create(qemu_find_opts("device"), "fileshare", 0,
+ &error_abort);
+#else
device = qemu_opts_create(qemu_find_opts("device"), NULL, 0,
&error_abort);
+#endif
qemu_opt_set(device, "driver", "virtio-9p-pci");
qemu_opt_set(device, "fsdev",
qemu_opt_get(opts, "mount_tag"));