• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Aucun tag

Frequently used words (click to add to your profile)

javac++androidlinuxc#objective-cqtwindows誰得cocoapythonphprubygameguibathyscaphec翻訳omegat計画中(planning stage)frameworktwittertestdomvb.netdirectxbtronarduinopreviewerゲームエンジン

Virtual machine Management Terminal User Interface


Commit MetaInfo

Révisionefde84b8706a60fa713d95503a4383e4c301242d (tree)
l'heure2022-07-27 20:47:08
AuteurKoine Yuusuke(koinec) <koinec@user...>
CommiterKoine Yuusuke(koinec)

Message de Log

Implement VmBhyve_ExecReq_VM_START() function.

Change Summary

Modification

--- a/src/hvisor.h
+++ b/src/hvisor.h
@@ -39,7 +39,7 @@
3939 #define HVCONNECT_CMD_BUFFER 65536
4040 #define HVCONNECT_ERR_BUFFER 512
4141
42-typedef int (* ExecRequestFunc)( Request *p_req, Guest *p_guest, void *pv_hvcon );
42+typedef int (* ExecRequestFunc)( Request *p_req, int i_guest, void *pv_hvcon );
4343 typedef int (* ExecCmdFunc)( void *pv_hvcnt, char *pstr_cmdline );
4444
4545 typedef struct {
--- a/src/hvthread.c
+++ b/src/hvthread.c
@@ -132,7 +132,8 @@ void *
132132 }
133133 else {
134134 if( HVISOR_STATUS_CONNECTED & p_hvcon->dw_status ) {
135- i_ret = p_hvcon->ExecRequest[p_request->b_reqcmd]( p_request, NULL, (void *)p_hvcon );
135+ i_ret = p_hvcon->ExecRequest[p_request->b_reqcmd](
136+ p_request, p_request->i_guest, (void *)p_hvcon );
136137 }
137138 }
138139 /*
--- a/src/reqctl.c
+++ b/src/reqctl.c
@@ -35,17 +35,13 @@ VMTUI_REQCTL_EXTERN
3535 int
3636 ReqCtl_Cmd_Default(
3737 Request *p_req,
38- Guest *p_guest,
38+ int i_guest,
3939 void *pv_hvcon )
4040 {
41- int i_guest = GUEST_ID_NONE;
4241 HvConnect *p_hvcon;
4342
4443 p_hvcon = (HvConnect *)pv_hvcon;
4544
46- if( NULL != p_guest )
47- { i_guest = p_guest->i_id; }
48-
4945 ErrInfo_Warn( "Exec. Illegal Command",
5046 p_hvcon->i_id, i_guest, p_req->i_id, 0x00,
5147 (int)p_req->b_reqcmd, p_req->dw_serial, p_req->str_cmdline );
--- a/src/reqctl.h
+++ b/src/reqctl.h
@@ -35,7 +35,7 @@
3535 #else
3636 #define VMTUI_REQCTL_EXTERN extern
3737 #endif
38-VMTUI_REQCTL_EXTERN int ReqCtl_Cmd_Default( Request *p_req, Guest *p_guest, void *pv_hvcon );
38+VMTUI_REQCTL_EXTERN int ReqCtl_Cmd_Default( Request *p_req, int i_guest, void *pv_hvcon );
3939 VMTUI_REQCTL_EXTERN int ReqCtl_CreateRequest( Byte b_reqcmd, int i_hvid, int i_guest, char *pstr_option );
4040
4141
--- a/src/vmbhyve.c
+++ b/src/vmbhyve.c
@@ -32,14 +32,51 @@
3232
3333 /* ===========================================================================*/
3434 int
35+ VmBhyve_ExecReq_VM_START(
36+ Request *p_req,
37+ int i_guest,
38+ void *pv_hvcon )
39+{
40+ int i_err;
41+ HvConnect *p_hvcon;
42+ Guest *p_guest;
43+
44+ p_hvcon = (HvConnect *)pv_hvcon;
45+
46+ // Genereate CmdLine ---
47+ if( HVISOR_OPTION_SUDO & p_hvcon->dw_option )
48+ { strncat( p_req->str_cmdline, "sudo ", REQUEST_MAXLEN_CMDLINE ); }
49+
50+ strncat( p_req->str_cmdline, "vm start ", REQUEST_MAXLEN_CMDLINE );
51+
52+ p_guest = Guest_Ref( i_guest );
53+ if( NULL == p_guest ) {
54+ return -0x02;
55+ }
56+ strncat( p_req->str_cmdline, p_guest->str_vmname, REQUEST_MAXLEN_CMDLINE );
57+ Guest_Release( p_guest );
58+
59+ // Exec. Cmd ---
60+ i_err = p_hvcon->ExecCmd( p_hvcon, p_req->str_cmdline );
61+
62+ // Analyze Cmd Result ---
63+ if( 0x00 != p_hvcon->i_exit ) {
64+ return -0x03;
65+ }
66+
67+ return 0x00;
68+}
69+
70+/* ===========================================================================*/
71+int
3572 VmBhyve_ExecReq_VMLIST(
3673 Request *p_req,
37- Guest *p_guest,
74+ int i_guest,
3875 void *pv_hvcon )
3976 {
4077 int i_err;
4178 int i_item;
42- int i_guest;
79+ int i_gnow;
4380 char *pstr_line;
4481 char *pstr_next;
4582 char *pstr_now;
@@ -78,9 +115,9 @@ int
78115 { pstr_item[i_item++] = pstr_now; }
79116 }
80117
81- i_guest = GuestCtl_ObtainGuest( p_hvcon->i_id, pstr_item[0] );
118+ i_gnow = GuestCtl_ObtainGuest( p_hvcon->i_id, pstr_item[0] );
82119
83- p_gnow = Guest_Use( i_guest );
120+ p_gnow = Guest_Use( i_gnow );
84121 if( NULL != p_gnow) {
85122 // Set Status ---
86123 if( 7 <= i_item ) {
@@ -97,15 +134,9 @@ int
97134
98135 Guest_Release( p_gnow );
99136 }
100-
101- //ErrInfo_Debug("Guest:", p_hvcon->i_id, i_guest, p_req->i_id, errno, i_item, 0x00, pstr_item[0] );
102137 }
103-
104- //
105138 }
106139
107-
108-
109140 return 0x00;
110141 }
111142
--- a/src/vmbhyve.h
+++ b/src/vmbhyve.h
@@ -37,7 +37,7 @@
3737 #endif
3838
3939 #ifdef VMTUI_SRC_VMBHYVE
40-int VmBhyve_ExecReq_VMLIST( Request *p_req, Guest *p_guest, void *pv_hvcon );
40+int VmBhyve_ExecReq_VMLIST( Request *p_req, int i_guest, void *pv_hvcon );
4141 #endif
4242
4343