Virtual machine Management Terminal User Interface
Revision | a08e482005bcc042c91e7022d6a0135778f2883e (tree) |
---|---|
Time | 2023-07-02 21:21:36 |
Author | Koine Yuusuke(koinec) <koinec@user...> |
Commiter | Koine Yuusuke(koinec) |
WorkBackup
@@ -52,7 +52,13 @@ int | ||
52 | 52 | mvwprintw( gp_cmd_win, 0, 0, "%s => ", pstr_prompt ); |
53 | 53 | |
54 | 54 | i_mode = TuiKey_GetMode(); |
55 | - if( TUIKEY_MODE_INPUTSTR == i_mode ) { | |
55 | + if( TUIKEY_MODE_INPUTPASSWD == i_mode ) { | |
56 | + pstr_input = TuiKey_GetInputStringAndPasswd( &i_len, NULL ); | |
57 | + str_pass[ i_len-- ] = '\0'; | |
58 | + for( ; 0 <= i_len; i_len-- ) { str_pass[ i_len ] = '*'; } | |
59 | + wprintw( gp_cmd_win, "%s", str_pass ); | |
60 | + } | |
61 | + else if( TUIKEY_MODE_INPUTSTR & i_mode ) { | |
56 | 62 | getyx( gp_cmd_win, i_row, i_start ); |
57 | 63 | |
58 | 64 | pstr_input = TuiKey_GetInputStringAndPasswd( NULL, &i_cursor ); |
@@ -60,12 +66,6 @@ int | ||
60 | 66 | |
61 | 67 | wmove( gp_cmd_win, i_row, i_start + i_cursor ); |
62 | 68 | } |
63 | - else if( TUIKEY_MODE_INPUTPASSWD == i_mode ) { | |
64 | - pstr_input = TuiKey_GetInputStringAndPasswd( &i_len, NULL ); | |
65 | - str_pass[ i_len-- ] = '\0'; | |
66 | - for( ; 0 <= i_len; i_len-- ) { str_pass[ i_len ] = '*'; } | |
67 | - wprintw( gp_cmd_win, "%s", str_pass ); | |
68 | - } | |
69 | 69 | |
70 | 70 | touchwin( gp_cmd_win ); |
71 | 71 | wnoutrefresh( gp_cmd_win ); |
@@ -74,6 +74,7 @@ int | ||
74 | 74 | TuiGuest_InputItem( |
75 | 75 | void ) |
76 | 76 | { |
77 | + int i_mode; | |
77 | 78 | Guest *p_guest; |
78 | 79 | KeyVal_Data t_val; |
79 | 80 | TuiGuest_LineAttr t_attr; |
@@ -81,7 +82,10 @@ int | ||
81 | 82 | TextBuf_GetLine( <_guest.t_textbuf, |
82 | 83 | lt_guest.i_now_line, (void *)&t_attr ); |
83 | 84 | |
84 | - if( '\0' == t_attr.str_key[0] ) { goto goto_TuiGuest_InputItem_post; } | |
85 | + if( TUIGUEST_LINE_EDITABLE != ( TUIGUEST_LINE_EDITABLE & t_attr.dw_option )) | |
86 | + { goto goto_TuiGuest_InputItem_post; } | |
87 | + | |
88 | + //if( '\0' == t_attr.str_key[0] ) { goto goto_TuiGuest_InputItem_post; } | |
85 | 89 | |
86 | 90 | p_guest = Guest_Ref( lt_guest.i_guest ); |
87 | 91 | if( NULL == p_guest ) { goto goto_TuiGuest_InputItem_post; } |
@@ -90,8 +94,19 @@ int | ||
90 | 94 | |
91 | 95 | Guest_Release( p_guest ); |
92 | 96 | |
97 | + if( TUIGUEST_LINE_PASSWORD == (TUIGUEST_LINE_PASSWORD & t_attr.dw_option) ) | |
98 | + { i_mode = TUIKEY_MODE_INPUTPASSWD; } | |
99 | + else if( TUIGUEST_LINE_IPADDR == (TUIGUEST_LINE_IPADDR & t_attr.dw_option) ) | |
100 | + { ErrInfo_DebugMsg( "ipaddr" );i_mode = TUIKEY_MODE_INPUTIPADDR; } | |
101 | + else if( TUIGUEST_LINE_DECIMAL == (TUIGUEST_LINE_DECIMAL & t_attr.dw_option) ) | |
102 | + { i_mode = TUIKEY_MODE_INPUTDECIMAL; } | |
103 | + else if( TUIGUEST_LINE_INTEGER == (TUIGUEST_LINE_INTEGER & t_attr.dw_option) ) | |
104 | + { i_mode = TUIKEY_MODE_INPUTINTEGER; } | |
105 | + else | |
106 | + { i_mode = TUIKEY_MODE_INPUTSTR; } | |
107 | + | |
93 | 108 | if( IS_KEYVAL_TYPE_STRING( t_val ) ) { |
94 | - TuiKey_ChangeMode( TUIKEY_MODE_INPUTSTR, REQUEST_CMD_NONE, | |
109 | + TuiKey_ChangeMode( i_mode, REQUEST_CMD_NONE, | |
95 | 110 | HVISOR_ID_NONE, lt_guest.i_guest, |
96 | 111 | TuiGuest_InputString, 0x00, TUIKEY_MODE_INFO, |
97 | 112 | "Input Value:", KEYVAL_DATA_STRING(t_val), KEYVAL_MAXLEN_STRVAL ); |
@@ -156,6 +171,32 @@ int | ||
156 | 171 | |
157 | 172 | /* ===========================================================================*/ |
158 | 173 | int |
174 | + TuiGuest_AppendLine( | |
175 | + char *pstr_line, | |
176 | + char *pstr_key, | |
177 | + int i_attr, | |
178 | + DWord dw_option, | |
179 | + ConfFile_SelectValue *pt_select, | |
180 | + ConfFile_CheckValue pf_check ) | |
181 | +{ | |
182 | + TuiGuest_LineAttr t_attr; | |
183 | + | |
184 | + t_attr.i_attr = i_attr; | |
185 | + t_attr.dw_option = dw_option; | |
186 | + t_attr.pt_select = pt_select; | |
187 | + t_attr.pf_check = pf_check; | |
188 | + if( NULL != pstr_key ) | |
189 | + { strncpy( t_attr.str_key, pstr_key, sizeof( t_attr.str_key ) ); } | |
190 | + else | |
191 | + { t_attr.str_key[0] = '\0'; } | |
192 | + | |
193 | + TextBuf_AppendLine( <_guest.t_textbuf, pstr_line, 0, (void *)&t_attr ); | |
194 | + | |
195 | + return 0x00; | |
196 | +} | |
197 | + | |
198 | +/* ===========================================================================*/ | |
199 | +int | |
159 | 200 | TuiGuest_OutputLine( |
160 | 201 | KeyVal_Info *pt_kvinfo, |
161 | 202 | char *pstr_title, |
@@ -163,23 +204,20 @@ int | ||
163 | 204 | Byte b_level, |
164 | 205 | char *pstr_unit, |
165 | 206 | int i_attr, |
166 | - DWord dw_option ) | |
207 | + DWord dw_option, | |
208 | + ConfFile_SelectValue *pt_select, | |
209 | + ConfFile_CheckValue pf_check ) | |
167 | 210 | { |
168 | 211 | int i_err; |
169 | 212 | char str_temp[128]; |
170 | 213 | char str_format[32]; |
171 | 214 | KeyVal_Data t_kval; |
172 | - TuiGuest_LineAttr t_attr; | |
173 | 215 | int i_len; |
174 | 216 | int i_fmt; |
175 | 217 | |
176 | 218 | i_len = sizeof( str_temp ); |
177 | 219 | i_fmt = sizeof( str_format ); |
178 | 220 | |
179 | - t_attr.i_attr = i_attr; | |
180 | - t_attr.dw_option = dw_option; | |
181 | - strncpy( t_attr.str_key, pstr_key, sizeof( t_attr.str_key ) ); | |
182 | - | |
183 | 221 | i_err = KeyVal_GetData( &t_kval, pt_kvinfo, pstr_key ); |
184 | 222 | if( 0x00 != i_err ) { |
185 | 223 | return -0x01; |
@@ -236,7 +274,7 @@ int | ||
236 | 274 | if( NULL != pstr_unit ) |
237 | 275 | { strncat( str_temp, pstr_unit, i_len ); } |
238 | 276 | |
239 | - TextBuf_AppendLine( <_guest.t_textbuf, str_temp, 0, (void *)&t_attr ); | |
277 | + TuiGuest_AppendLine( str_temp, pstr_key, i_attr, dw_option, pt_select, pf_check ); | |
240 | 278 | |
241 | 279 | return 0x00; |
242 | 280 | } |
@@ -249,6 +287,7 @@ int | ||
249 | 287 | int i_err; |
250 | 288 | int i_cnt; |
251 | 289 | int i_max; |
290 | + int i_attr; | |
252 | 291 | char str_temp[128]; |
253 | 292 | char str_key[KEYVAL_MAXLEN_KEY]; |
254 | 293 | KeyVal_Data t_kval; |
@@ -266,85 +305,77 @@ int | ||
266 | 305 | assert( NULL != p_guest ); |
267 | 306 | |
268 | 307 | // VM name --- |
269 | - t_attr.str_key[0] = '\0'; | |
270 | - t_attr.i_attr = A_BOLD; | |
271 | - t_attr.dw_option = TUIGUEST_LINEATTR_ONLYVALUE; | |
272 | 308 | snprintf( str_temp, sizeof( str_temp ), " %-22s: %-40s", "VM name", p_guest->str_vmname ); |
273 | - TextBuf_AppendLine( <_guest.t_textbuf, str_temp, 0, (void *)&t_attr ); | |
309 | + TuiGuest_AppendLine( str_temp, NULL, A_BOLD, TUIGUEST_LINEATTR_ONLYVALUE, NULL, NULL ); | |
274 | 310 | |
275 | - t_attr.i_attr = 0x00; | |
276 | - t_attr.dw_option = TUIGUEST_LINEATTR_NORMAL; | |
277 | - TextBuf_AppendLine( <_guest.t_textbuf, "", 0, NULL ); | |
311 | + TuiGuest_AppendLine( "", NULL, 0x00, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); // Empty line | |
278 | 312 | |
279 | 313 | // Status Section ---- |
280 | - t_attr.i_attr = COL_CYAN | A_BOLD; | |
281 | - t_attr.dw_option = TUIGUEST_LINEATTR_NORMAL; | |
282 | - TextBuf_AppendLine( <_guest.t_textbuf, "Running Information", 0, (void *)&t_attr ); | |
314 | + TuiGuest_AppendLine( "Running Information", NULL, COL_CYAN|A_BOLD, | |
315 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
283 | 316 | |
284 | - t_attr.i_attr = 0x00; | |
285 | - t_attr.dw_option = TUIGUEST_LINEATTR_NORMAL; | |
317 | + i_attr = 0x00; | |
286 | 318 | switch( p_guest->dw_status ) { |
287 | 319 | case GUEST_STATUS_STOP: |
288 | 320 | snprintf( str_temp, sizeof( str_temp ), " %-22s: %-40s", "Status", " Stop" ); |
289 | 321 | break; |
290 | 322 | case GUEST_STATUS_RUN: |
323 | + i_attr = COL_CYAN | A_BOLD; | |
291 | 324 | snprintf( str_temp, sizeof( str_temp ), " %-22s: %-40s", "Status", "* RUNNING" ); |
292 | - t_attr.i_attr = COL_CYAN | A_BOLD; | |
293 | - t_attr.dw_option = TUIGUEST_LINEATTR_ONLYVALUE; | |
294 | 325 | break; |
295 | 326 | case GUEST_STATUS_WAIT: |
327 | + i_attr = COL_YELLOW | A_BOLD; | |
296 | 328 | snprintf( str_temp, sizeof( str_temp ), " %-22s: %-40s", "Status", "- Waiting" ); |
297 | - t_attr.i_attr = COL_YELLOW | A_BOLD; | |
298 | - t_attr.dw_option = TUIGUEST_LINEATTR_ONLYVALUE; | |
299 | 329 | break; |
300 | 330 | case GUEST_STATUS_UNKNOWN: |
301 | - t_attr.i_attr = COL_MAGENTA | A_BOLD; | |
302 | - t_attr.dw_option = TUIGUEST_LINEATTR_ONLYVALUE; | |
331 | + i_attr = COL_MAGENTA | A_BOLD; | |
303 | 332 | snprintf( str_temp, sizeof( str_temp ), " %-22s: %-40s", "Status", "? Unknown" ); |
304 | 333 | break; |
305 | 334 | default: |
306 | - t_attr.i_attr = COL_RED | A_BOLD; | |
307 | - t_attr.dw_option = TUIGUEST_LINEATTR_ONLYVALUE; | |
335 | + i_attr = COL_RED | A_BOLD; | |
308 | 336 | snprintf( str_temp, sizeof( str_temp ), " %-22s: %-40s", "Status", "! BUG!!" ); |
309 | 337 | break; |
310 | 338 | } |
311 | - TextBuf_AppendLine( <_guest.t_textbuf, str_temp, 0, (void *)&t_attr ); | |
339 | + TuiGuest_AppendLine( str_temp, NULL, i_attr, TUIGUEST_LINEATTR_ONLYVALUE, NULL, NULL ); | |
312 | 340 | |
313 | - t_attr.i_attr = 0x00; | |
314 | - t_attr.dw_option = TUIGUEST_LINEATTR_NORMAL; | |
315 | - TextBuf_AppendLine( <_guest.t_textbuf, "", 0, NULL ); | |
341 | + TuiGuest_AppendLine( "", NULL, 0x00, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); // Empty line | |
316 | 342 | |
317 | 343 | // Configuration Section ---- |
318 | - t_attr.i_attr = COL_CYAN | A_BOLD; | |
319 | - TextBuf_AppendLine( <_guest.t_textbuf, "Configuration", 0, (void *)&t_attr ); | |
344 | + TuiGuest_AppendLine( "Configuration", NULL, COL_CYAN|A_BOLD, | |
345 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
320 | 346 | |
321 | 347 | // Loader -- |
322 | - t_attr.i_attr = A_BOLD; | |
323 | - TextBuf_AppendLine( <_guest.t_textbuf, " Loader:", 0, (void *)&t_attr ); | |
348 | + TuiGuest_AppendLine( " Loader:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
324 | 349 | |
325 | - TuiGuest_OutputLine( &(p_guest->t_info), "Loader", GUEST_LOADER_LOADER_KEY, 1, NULL, 0x00, 0x00 ); | |
326 | - TuiGuest_OutputLine( &(p_guest->t_info), "BhyveLoader", GUEST_LOADER_BHYVELOADER_KEY, 1, NULL, 0x00, 0x00 ); | |
327 | - TuiGuest_OutputLine( &(p_guest->t_info), "TimeOut", GUEST_LOADER_TIMEOUT_KEY, 1, "sec", 0x00, 0x00 ); | |
350 | + TuiGuest_OutputLine( &(p_guest->t_info), "Loader", GUEST_LOADER_LOADER_KEY, 1, | |
351 | + NULL, 0x00, 0x00, NULL, NULL ); | |
352 | + TuiGuest_OutputLine( &(p_guest->t_info), "BhyveLoader", GUEST_LOADER_BHYVELOADER_KEY, 1, | |
353 | + NULL, 0x00, 0x00, NULL, NULL ); | |
354 | + TuiGuest_OutputLine( &(p_guest->t_info), "TimeOut", GUEST_LOADER_TIMEOUT_KEY, 1, | |
355 | + "sec", 0x00, 0x00, NULL, NULL ); | |
328 | 356 | |
329 | 357 | // CPU -- |
330 | - t_attr.i_attr = A_BOLD; | |
331 | - TextBuf_AppendLine( <_guest.t_textbuf, " CPU:", 0, (void *)&t_attr ); | |
358 | + TuiGuest_AppendLine( " CPU:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
332 | 359 | |
333 | - TuiGuest_OutputLine( &(p_guest->t_info), "CPUs", GUEST_CPU_VCPUS_KEY, 1, "cpu", 0x00, 0x00 ); | |
334 | - TuiGuest_OutputLine( &(p_guest->t_info), "Sockets", GUEST_CPU_SOCKETS_KEY, 1, "socket", 0x00, 0x00 ); | |
335 | - TuiGuest_OutputLine( &(p_guest->t_info), "Cores", GUEST_CPU_CORES_KEY, 1, "core", 0x00, 0x00 ); | |
336 | - TuiGuest_OutputLine( &(p_guest->t_info), "Threads", GUEST_CPU_THREADS_KEY, 1, "thread", 0x00, 0x00 ); | |
360 | + TuiGuest_OutputLine( &(p_guest->t_info), "CPUs", GUEST_CPU_VCPUS_KEY, 1, | |
361 | + "cpu", 0x00, 0x00, NULL, NULL ); | |
362 | + TuiGuest_OutputLine( &(p_guest->t_info), "Sockets", GUEST_CPU_SOCKETS_KEY, 1, | |
363 | + "socket", 0x00, 0x00, NULL, NULL ); | |
364 | + TuiGuest_OutputLine( &(p_guest->t_info), "Cores", GUEST_CPU_CORES_KEY, 1, | |
365 | + "core", 0x00, 0x00, NULL, NULL ); | |
366 | + TuiGuest_OutputLine( &(p_guest->t_info), "Threads", GUEST_CPU_THREADS_KEY, 1, | |
367 | + "thread", 0x00, 0x00, NULL, NULL ); | |
337 | 368 | |
338 | 369 | // Memory -- |
339 | - t_attr.i_attr = A_BOLD; | |
340 | - TextBuf_AppendLine( <_guest.t_textbuf, " Memory:", 0, (void *)&t_attr ); | |
370 | + TuiGuest_AppendLine( " Memory:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
341 | 371 | |
342 | - TuiGuest_OutputLine( &(p_guest->t_info), "Size", GUEST_MEM_SIZE_KEY, 1, "KByte", 0x00, 0x00 ); | |
343 | - TuiGuest_OutputLine( &(p_guest->t_info), "Wired", GUEST_MEM_WIRED_KEY, 1, NULL, 0x00, 0x00 ); | |
372 | + TuiGuest_OutputLine( &(p_guest->t_info), "Size", GUEST_MEM_SIZE_KEY, 1, | |
373 | + "KByte", 0x00, 0x00, NULL, NULL ); | |
374 | + TuiGuest_OutputLine( &(p_guest->t_info), "Wired", GUEST_MEM_WIRED_KEY, 1, | |
375 | + NULL, 0x00, 0x00, NULL, NULL ); | |
344 | 376 | |
345 | 377 | // Network -- |
346 | - t_attr.i_attr = A_BOLD; | |
347 | - TextBuf_AppendLine( <_guest.t_textbuf, " Network:", 0, (void *)&t_attr ); | |
378 | + TuiGuest_AppendLine( " Network:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
348 | 379 | |
349 | 380 | i_err = KeyVal_GetData( &t_kval, &p_guest->t_info, GUEST_NETWORK_ITEMS_KEY ); |
350 | 381 | if( 0x00 != i_err ) { goto goto_TuiGuest_GeneratePageText_skipNetwork; } |
@@ -352,217 +383,275 @@ int | ||
352 | 383 | |
353 | 384 | i_max = KEYVAL_DATA_INT( t_kval ); |
354 | 385 | for( i_cnt = 0; i_cnt < i_max; i_cnt++ ) { |
355 | - t_attr.i_attr = 0x00; | |
356 | 386 | snprintf( str_temp, sizeof( str_temp ), " Network #%d:", i_cnt ); |
357 | - TextBuf_AppendLine( <_guest.t_textbuf, str_temp, 0, NULL ); | |
387 | + TuiGuest_AppendLine( str_temp, NULL, 0x00, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
358 | 388 | |
359 | 389 | snprintf( str_key, sizeof( str_key ), GUEST_NETWORK_BASEKEY"/%d/%s", |
360 | 390 | i_cnt, GUEST_NETWORK_TYPE_SUBKEY ); |
361 | - TuiGuest_OutputLine( &(p_guest->t_info), "Type", str_key, 2, NULL, 0x00, 0x00 ); | |
391 | + TuiGuest_OutputLine( &(p_guest->t_info), "Type", str_key, 2, | |
392 | + NULL, 0x00, 0x00, NULL, NULL ); | |
362 | 393 | |
363 | 394 | snprintf( str_key, sizeof( str_key ), GUEST_NETWORK_BASEKEY"/%d/%s", |
364 | 395 | i_cnt, GUEST_NETWORK_SWITCH_SUBKEY ); |
365 | - TuiGuest_OutputLine( &(p_guest->t_info), "Switch", str_key, 2, NULL, 0x00, 0x00 ); | |
396 | + TuiGuest_OutputLine( &(p_guest->t_info), "Switch", str_key, 2, | |
397 | + NULL, 0x00, 0x00, NULL, NULL ); | |
366 | 398 | |
367 | 399 | snprintf( str_key, sizeof( str_key ), GUEST_NETWORK_BASEKEY"/%d/%s", |
368 | 400 | i_cnt, GUEST_NETWORK_DEVICE_SUBKEY ); |
369 | - TuiGuest_OutputLine( &(p_guest->t_info), "Device", str_key, 2, NULL, 0x00, 0x00 ); | |
401 | + TuiGuest_OutputLine( &(p_guest->t_info), "Device", str_key, 2, | |
402 | + NULL, 0x00, 0x00, NULL, NULL ); | |
370 | 403 | |
371 | 404 | snprintf( str_key, sizeof( str_key ), GUEST_NETWORK_BASEKEY"/%d/%s", |
372 | 405 | i_cnt, GUEST_NETWORK_MAC_SUBKEY ); |
373 | - TuiGuest_OutputLine( &(p_guest->t_info), "MAC address", str_key, 2, NULL, 0x00, 0x00 ); | |
406 | + TuiGuest_OutputLine( &(p_guest->t_info), "MAC address", str_key, 2, | |
407 | + NULL, 0x00, 0x00, NULL, NULL ); | |
374 | 408 | |
375 | 409 | snprintf( str_key, sizeof( str_key ), GUEST_NETWORK_BASEKEY"/%d/%s", |
376 | 410 | i_cnt, GUEST_NETWORK_SPAN_SUBKEY ); |
377 | - TuiGuest_OutputLine( &(p_guest->t_info), "SPAN", str_key, 2, NULL, 0x00, 0x00 ); | |
411 | + TuiGuest_OutputLine( &(p_guest->t_info), "SPAN", str_key, 2, | |
412 | + NULL, 0x00, 0x00, NULL, NULL ); | |
378 | 413 | } |
379 | 414 | |
380 | 415 | goto_TuiGuest_GeneratePageText_skipNetwork: |
381 | 416 | |
382 | 417 | // Disk -- |
383 | - t_attr.i_attr = A_BOLD; | |
384 | - TextBuf_AppendLine( <_guest.t_textbuf, " Disk:", 0, (void *)&t_attr ); | |
418 | + TuiGuest_AppendLine( " Disk:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
385 | 419 | |
386 | 420 | i_err = KeyVal_GetData( &t_kval, &p_guest->t_info, GUEST_DISK_ITEMS_KEY ); |
387 | - if( 0x00 != i_err ) { goto goto_TuiGuest_GeneratePageText_skipDisk; } | |
388 | - if( 0 == KEYVAL_DATA_INT( t_kval ) ) { goto goto_TuiGuest_GeneratePageText_skipDisk; } | |
421 | + if( 0x00 != i_err ) | |
422 | + { goto goto_TuiGuest_GeneratePageText_skipDisk; } | |
423 | + if( 0 == KEYVAL_DATA_INT( t_kval ) ) | |
424 | + { goto goto_TuiGuest_GeneratePageText_skipDisk; } | |
389 | 425 | |
390 | 426 | i_max = KEYVAL_DATA_INT( t_kval ); |
391 | 427 | for( i_cnt = 0; i_cnt < i_max; i_cnt++ ) { |
392 | - t_attr.i_attr = 0x00; | |
393 | 428 | snprintf( str_temp, sizeof( str_temp ), " Disk #%d:", i_cnt ); |
394 | - TextBuf_AppendLine( <_guest.t_textbuf, str_temp, 0, NULL ); | |
429 | + TuiGuest_AppendLine( str_temp, NULL, 0x00, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
395 | 430 | |
396 | 431 | snprintf( str_key, sizeof( str_key ), GUEST_DISK_BASEKEY"/%d/%s", |
397 | 432 | i_cnt, GUEST_DISK_TYPE_SUBKEY ); |
398 | - TuiGuest_OutputLine( &(p_guest->t_info), "Type", str_key, 2, NULL, 0x00, 0x00 ); | |
433 | + TuiGuest_OutputLine( &(p_guest->t_info), "Type", str_key, 2, | |
434 | + NULL, 0x00, 0x00, NULL, NULL ); | |
399 | 435 | |
400 | 436 | snprintf( str_key, sizeof( str_key ), GUEST_DISK_BASEKEY"/%d/%s", |
401 | 437 | i_cnt, GUEST_DISK_NAME_SUBKEY ); |
402 | - TuiGuest_OutputLine( &(p_guest->t_info), "Name", str_key, 2, NULL, 0x00, 0x00 ); | |
438 | + TuiGuest_OutputLine( &(p_guest->t_info), "Name", str_key, 2, | |
439 | + NULL, 0x00, 0x00, NULL, NULL ); | |
403 | 440 | |
404 | 441 | snprintf( str_key, sizeof( str_key ), GUEST_DISK_BASEKEY"/%d/%s", |
405 | 442 | i_cnt, GUEST_DISK_DEVICE_SUBKEY ); |
406 | - TuiGuest_OutputLine( &(p_guest->t_info), "Device", str_key, 2, NULL, 0x00, 0x00 ); | |
443 | + TuiGuest_OutputLine( &(p_guest->t_info), "Device", str_key, 2, | |
444 | + NULL, 0x00, 0x00, NULL, NULL ); | |
407 | 445 | |
408 | 446 | snprintf( str_key, sizeof( str_key ), GUEST_DISK_BASEKEY"/%d/%s", |
409 | 447 | i_cnt, GUEST_DISK_OPTION_SUBKEY ); |
410 | - TuiGuest_OutputLine( &(p_guest->t_info), "Option", str_key, 2, NULL, 0x00, 0x00 ); | |
448 | + TuiGuest_OutputLine( &(p_guest->t_info), "Option", str_key, 2, | |
449 | + NULL, 0x00, 0x00, NULL, NULL ); | |
411 | 450 | |
412 | 451 | snprintf( str_key, sizeof( str_key ), GUEST_NETWORK_BASEKEY"/%d/%s", |
413 | 452 | i_cnt, GUEST_DISK_SIZE_SUBKEY ); |
414 | - TuiGuest_OutputLine( &(p_guest->t_info), "Size", str_key, 2, NULL, 0x00, 0x00 ); | |
453 | + TuiGuest_OutputLine( &(p_guest->t_info), "Size", str_key, 2, | |
454 | + NULL, 0x00, 0x00, NULL, NULL ); | |
415 | 455 | } |
416 | 456 | |
417 | 457 | goto_TuiGuest_GeneratePageText_skipDisk: |
418 | 458 | |
419 | 459 | // Graphics (VNC) -- |
420 | 460 | i_err = KeyVal_GetData( &t_kval, &p_guest->t_info, GUEST_VNC_ENABLE_KEY ); |
421 | - if( 0x00 != i_err ) { goto goto_TuiGuest_GeneratePageText_skipVNC; } | |
422 | - if( ! KEYVAL_DATA_ISBOOL( t_kval ) ) { goto goto_TuiGuest_GeneratePageText_skipVNC; } | |
423 | - | |
424 | - t_attr.i_attr = A_BOLD; | |
425 | - TextBuf_AppendLine( <_guest.t_textbuf, " Graphics (VNC):", 0, (void *)&t_attr ); | |
426 | - | |
427 | - TuiGuest_OutputLine( &(p_guest->t_info), "Enable", GUEST_VNC_ENABLE_KEY, 1, NULL, 0x00, 0x00 ); | |
428 | - TuiGuest_OutputLine( &(p_guest->t_info), "Host", GUEST_VNC_HOST_KEY, 1, NULL, 0x00, 0x00 ); | |
429 | - TuiGuest_OutputLine( &(p_guest->t_info), "Port", GUEST_VNC_PORT_KEY, 1, NULL, 0x00, 0x00 ); | |
430 | - TuiGuest_OutputLine( &(p_guest->t_info), "Reslution", GUEST_VNC_RESOLUTION_KEY, 1, NULL, 0x00, 0x00 ); | |
431 | - TuiGuest_OutputLine( &(p_guest->t_info), "Wait", GUEST_VNC_WAIT_KEY, 1, NULL, 0x00, 0x00 ); | |
432 | - TuiGuest_OutputLine( &(p_guest->t_info), "VGA", GUEST_VNC_VGA_KEY, 1, NULL, 0x00, 0x00 ); | |
461 | + if( 0x00 != i_err ) | |
462 | + { goto goto_TuiGuest_GeneratePageText_skipVNC; } | |
463 | + if( ! KEYVAL_DATA_ISBOOL( t_kval ) ) | |
464 | + { goto goto_TuiGuest_GeneratePageText_skipVNC; } | |
465 | + | |
466 | + TuiGuest_AppendLine( " Graphics (VNC):", NULL, A_BOLD, | |
467 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
468 | + | |
469 | + TuiGuest_OutputLine( &(p_guest->t_info), "Enable", GUEST_VNC_ENABLE_KEY, 1, | |
470 | + NULL, 0x00, 0x00, NULL, NULL ); | |
471 | + TuiGuest_OutputLine( &(p_guest->t_info), "Host", GUEST_VNC_HOST_KEY, 1, | |
472 | + NULL, 0x00, 0x00, NULL, NULL ); | |
473 | + TuiGuest_OutputLine( &(p_guest->t_info), "Port", GUEST_VNC_PORT_KEY, 1, | |
474 | + NULL, 0x00, 0x00, NULL, NULL ); | |
475 | + TuiGuest_OutputLine( &(p_guest->t_info), "Reslution", GUEST_VNC_RESOLUTION_KEY, 1, | |
476 | + NULL, 0x00, 0x00, NULL, NULL ); | |
477 | + TuiGuest_OutputLine( &(p_guest->t_info), "Wait", GUEST_VNC_WAIT_KEY, 1, | |
478 | + NULL, 0x00, 0x00, NULL, NULL ); | |
479 | + TuiGuest_OutputLine( &(p_guest->t_info), "VGA", GUEST_VNC_VGA_KEY, 1, | |
480 | + NULL, 0x00, 0x00, NULL, NULL ); | |
433 | 481 | |
434 | 482 | goto_TuiGuest_GeneratePageText_skipVNC: |
435 | 483 | |
436 | 484 | // SSH -- |
437 | 485 | i_err = KeyVal_GetData( &t_kval, &p_guest->t_info, GUEST_SSH_ENABLE_KEY ); |
438 | - if( 0x00 != i_err ) { goto goto_TuiGuest_GeneratePageText_skipSSH; } | |
439 | - if( ! KEYVAL_DATA_ISBOOL( t_kval ) ) { goto goto_TuiGuest_GeneratePageText_skipSSH; } | |
440 | - | |
441 | - t_attr.i_attr = A_BOLD; | |
442 | - TextBuf_AppendLine( <_guest.t_textbuf, " Secure Shell (SSH):", 0, (void *)&t_attr ); | |
443 | - | |
444 | - TuiGuest_OutputLine( &(p_guest->t_info), "Enable", GUEST_SSH_ENABLE_KEY, 1, NULL, 0x00, 0x00 ); | |
445 | - TuiGuest_OutputLine( &(p_guest->t_info), "IP Address", GUEST_SSH_IPADDR_KEY, 1, NULL, 0x00, 0x00 ); | |
446 | - TuiGuest_OutputLine( &(p_guest->t_info), "Use Step Server", GUEST_SSH_USE_STEPSERVER_KEY, 1, NULL, 0x00, 0x00 ); | |
447 | - TuiGuest_OutputLine( &(p_guest->t_info), "USER", GUEST_SSH_USER_KEY, 1, NULL, 0x00, 0x00 ); | |
448 | - TuiGuest_OutputLine( &(p_guest->t_info), "Password", GUEST_SSH_PASSWORD_KEY, 1, NULL, 0x00, 0x00 ); | |
449 | - TuiGuest_OutputLine( &(p_guest->t_info), "Connection Type", GUEST_SSH_CONTYPE_KEY, 1, NULL, 0x00, 0x00 ); | |
486 | + if( 0x00 != i_err ) | |
487 | + { goto goto_TuiGuest_GeneratePageText_skipSSH; } | |
488 | + if( ! KEYVAL_DATA_ISBOOL( t_kval ) ) | |
489 | + { goto goto_TuiGuest_GeneratePageText_skipSSH; } | |
490 | + | |
491 | + TuiGuest_AppendLine( " Secure Shell (SSH):", NULL, A_BOLD, | |
492 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
493 | + | |
494 | + TuiGuest_OutputLine( &(p_guest->t_info), "Enable", GUEST_SSH_ENABLE_KEY, 1, | |
495 | + NULL, 0x00, 0x00, NULL, NULL ); | |
496 | + TuiGuest_OutputLine( &(p_guest->t_info), "IP Address", GUEST_SSH_IPADDR_KEY, 1, | |
497 | + NULL, 0x00, TUIGUEST_LINE_DYNAMIC | TUIGUEST_LINE_IPADDR, | |
498 | + NULL, NULL ); | |
499 | + TuiGuest_OutputLine( &(p_guest->t_info), "Use Step Server", GUEST_SSH_USE_STEPSERVER_KEY, 1, | |
500 | + NULL, 0x00, 0x00, NULL, NULL ); | |
501 | + TuiGuest_OutputLine( &(p_guest->t_info), "USER", GUEST_SSH_USER_KEY, 1, | |
502 | + NULL, 0x00, TUIGUEST_LINE_DYNAMIC | TUIGUEST_LINE_STRING, | |
503 | + NULL, NULL ); | |
504 | + TuiGuest_OutputLine( &(p_guest->t_info), "Password", GUEST_SSH_PASSWORD_KEY, 1, | |
505 | + NULL, 0x00, TUIGUEST_LINE_DYNAMIC | TUIGUEST_LINE_PASSWORD, | |
506 | + NULL, NULL ); | |
507 | + TuiGuest_OutputLine( &(p_guest->t_info), "Connection Type", GUEST_SSH_CONTYPE_KEY, 1, | |
508 | + NULL, 0x00, 0x00, | |
509 | + NULL, NULL ); | |
450 | 510 | |
451 | 511 | goto_TuiGuest_GeneratePageText_skipSSH: |
452 | 512 | |
453 | 513 | // Grub -- |
454 | - t_attr.i_attr = A_BOLD; | |
455 | - TextBuf_AppendLine( <_guest.t_textbuf, " GRUB:", 0, (void *)&t_attr ); | |
514 | + TuiGuest_AppendLine( " GRUB:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
456 | 515 | |
457 | - TuiGuest_OutputLine( &(p_guest->t_info), "Run Partition", GUEST_GRUB_RUNPARTITION_KEY, 1, NULL, 0x00, 0x00 ); | |
458 | - TuiGuest_OutputLine( &(p_guest->t_info), "Run Directory", GUEST_GRUB_RUNDIR_KEY, 1, NULL, 0x00, 0x00 ); | |
459 | - TuiGuest_OutputLine( &(p_guest->t_info), "Run File", GUEST_GRUB_RUNFILE_KEY, 1, NULL, 0x00, 0x00 ); | |
516 | + TuiGuest_OutputLine( &(p_guest->t_info), "Run Partition", GUEST_GRUB_RUNPARTITION_KEY, 1, | |
517 | + NULL, 0x00, 0x00, NULL, NULL ); | |
518 | + TuiGuest_OutputLine( &(p_guest->t_info), "Run Directory", GUEST_GRUB_RUNDIR_KEY, 1, | |
519 | + NULL, 0x00, 0x00, NULL, NULL ); | |
520 | + TuiGuest_OutputLine( &(p_guest->t_info), "Run File", GUEST_GRUB_RUNFILE_KEY, 1, | |
521 | + NULL, 0x00, 0x00, NULL, NULL ); | |
460 | 522 | |
461 | 523 | i_err = KeyVal_GetData( &t_kval, &p_guest->t_info, GUEST_GRUB_INSTALL_ITEMS_KEY ); |
462 | - if( 0x00 != i_err ) { goto goto_TuiGuest_GeneratePageText_skipGRUB_Install; } | |
463 | - if( 0 == KEYVAL_DATA_INT( t_kval ) ) { goto goto_TuiGuest_GeneratePageText_skipGRUB_Install; } | |
524 | + if( 0x00 != i_err ) | |
525 | + { goto goto_TuiGuest_GeneratePageText_skipGRUB_Install; } | |
526 | + if( 0 == KEYVAL_DATA_INT( t_kval ) ) | |
527 | + { goto goto_TuiGuest_GeneratePageText_skipGRUB_Install; } | |
464 | 528 | |
465 | - TextBuf_AppendLine( <_guest.t_textbuf, " GRUB Install Command:", 0, NULL ); | |
529 | + TuiGuest_AppendLine( " GRUB Install Command:", NULL, 0x00, | |
530 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
466 | 531 | |
467 | 532 | i_max = KEYVAL_DATA_INT( t_kval ); |
468 | 533 | for( i_cnt = 0; i_cnt < i_max; i_cnt++ ) { |
469 | - t_attr.i_attr = 0x00; | |
470 | 534 | snprintf( str_temp, sizeof( str_temp ), " #%d:", i_cnt ); |
471 | - TextBuf_AppendLine( <_guest.t_textbuf, str_temp, 0, NULL ); | |
535 | + TuiGuest_AppendLine( str_temp, NULL, 0x00, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
472 | 536 | |
473 | 537 | snprintf( str_key, sizeof( str_key ), GUEST_GRUB_BASEKEY"/%d/%s", |
474 | 538 | i_cnt, GUEST_GRUB_INSTALL_SUBKEY ); |
475 | - TuiGuest_OutputLine( &(p_guest->t_info), str_temp, str_key, 2, NULL, 0x00, 0x00 ); | |
539 | + TuiGuest_OutputLine( &(p_guest->t_info), str_temp, str_key, 2, | |
540 | + NULL, 0x00, 0x00, NULL, NULL ); | |
476 | 541 | } |
477 | 542 | |
478 | 543 | goto_TuiGuest_GeneratePageText_skipGRUB_Install: |
479 | 544 | |
480 | 545 | i_err = KeyVal_GetData( &t_kval, &p_guest->t_info, GUEST_GRUB_RUN_ITEMS_KEY ); |
481 | - if( 0x00 != i_err ) { goto goto_TuiGuest_GeneratePageText_skipGRUB_Run; } | |
482 | - if( 0 == KEYVAL_DATA_INT( t_kval ) ) { goto goto_TuiGuest_GeneratePageText_skipGRUB_Run; } | |
546 | + if( 0x00 != i_err ) | |
547 | + { goto goto_TuiGuest_GeneratePageText_skipGRUB_Run; } | |
548 | + if( 0 == KEYVAL_DATA_INT( t_kval ) ) | |
549 | + { goto goto_TuiGuest_GeneratePageText_skipGRUB_Run; } | |
483 | 550 | |
484 | - TextBuf_AppendLine( <_guest.t_textbuf, " GRUB Run Command:", 0, NULL ); | |
551 | + TuiGuest_AppendLine( " GRUB Run Command:", NULL, 0x00, | |
552 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
485 | 553 | |
486 | 554 | i_max = KEYVAL_DATA_INT( t_kval ); |
487 | 555 | for( i_cnt = 0; i_cnt < i_max; i_cnt++ ) { |
488 | - t_attr.i_attr = 0x00; | |
489 | 556 | snprintf( str_temp, sizeof( str_temp ), " #%d:", i_cnt ); |
490 | - TextBuf_AppendLine( <_guest.t_textbuf, str_temp, 0, NULL ); | |
557 | + TuiGuest_AppendLine( str_temp, NULL, 0x00, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
491 | 558 | |
492 | 559 | snprintf( str_key, sizeof( str_key ), GUEST_GRUB_BASEKEY"/%d/%s", |
493 | 560 | i_cnt, GUEST_GRUB_RUN_SUBKEY ); |
494 | - TuiGuest_OutputLine( &(p_guest->t_info), str_temp, str_key, 2, NULL, 0x00, 0x00 ); | |
561 | + TuiGuest_OutputLine( &(p_guest->t_info), str_temp, str_key, 2, | |
562 | + NULL, 0x00, 0x00, NULL, NULL ); | |
495 | 563 | } |
496 | 564 | |
497 | 565 | goto_TuiGuest_GeneratePageText_skipGRUB_Run: |
498 | 566 | |
499 | 567 | // Other Settings -- |
500 | - t_attr.i_attr = A_BOLD; | |
501 | - TextBuf_AppendLine( <_guest.t_textbuf, " Other Settings:", 0, (void *)&t_attr ); | |
502 | - | |
503 | - TuiGuest_OutputLine( &(p_guest->t_info), "HostBridge", GUEST_HOSTBRIDGE_KEY, 1, NULL, 0x00, 0x00 ); | |
504 | - TuiGuest_OutputLine( &(p_guest->t_info), "Com Ports", GUEST_COMPORTS_KEY, 1, NULL, 0x00, 0x00 ); | |
505 | - TuiGuest_OutputLine( &(p_guest->t_info), "Use UTC time", GUEST_UTCTIME_KEY, 1, NULL, 0x00, 0x00 ); | |
506 | - TuiGuest_OutputLine( &(p_guest->t_info), "Enable DebugLog", GUEST_DEBUG_KEY, 1, NULL, 0x00, 0x00 ); | |
507 | - TuiGuest_OutputLine( &(p_guest->t_info), "UUID", GUEST_UUID_KEY, 1, NULL, 0x00, 0x00 ); | |
508 | - TuiGuest_OutputLine( &(p_guest->t_info), "Ignore Bad MSR", GUEST_IGNORE_BADMSR_KEY, 1, NULL, 0x00, 0x00 ); | |
509 | - TuiGuest_OutputLine( &(p_guest->t_info), "VirtIO Random", GUEST_VIRT_RANDOM_KEY, 1, NULL, 0x00, 0x00 ); | |
510 | - TuiGuest_OutputLine( &(p_guest->t_info), "Enable XHCI mouse", GUEST_XHCI_MOUSE_KEY, 1, NULL, 0x00, 0x00 ); | |
511 | - TuiGuest_OutputLine( &(p_guest->t_info), "AHCI Device Limits", GUEST_AHCI_DEVLIMIT_KEY, 1, NULL, 0x00, 0x00 ); | |
512 | - TuiGuest_OutputLine( &(p_guest->t_info), "Start Slot", GUEST_START_SLOT_KEY, 1, NULL, 0x00, 0x00 ); | |
513 | - TuiGuest_OutputLine( &(p_guest->t_info), "Install Slot", GUEST_INSTALL_SLOT_KEY, 1, NULL, 0x00, 0x00 ); | |
568 | + TuiGuest_AppendLine( " Other Settings:", NULL, A_BOLD, | |
569 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
570 | + | |
571 | + TuiGuest_OutputLine( &(p_guest->t_info), "HostBridge", GUEST_HOSTBRIDGE_KEY, 1, | |
572 | + NULL, 0x00, 0x00, NULL, NULL ); | |
573 | + TuiGuest_OutputLine( &(p_guest->t_info), "Com Ports", GUEST_COMPORTS_KEY, 1, | |
574 | + NULL, 0x00, 0x00, NULL, NULL ); | |
575 | + TuiGuest_OutputLine( &(p_guest->t_info), "Use UTC time", GUEST_UTCTIME_KEY, 1, | |
576 | + NULL, 0x00, 0x00, NULL, NULL ); | |
577 | + TuiGuest_OutputLine( &(p_guest->t_info), "Enable DebugLog", GUEST_DEBUG_KEY, 1, | |
578 | + NULL, 0x00, 0x00, NULL, NULL ); | |
579 | + TuiGuest_OutputLine( &(p_guest->t_info), "UUID", GUEST_UUID_KEY, 1, | |
580 | + NULL, 0x00, 0x00, NULL, NULL ); | |
581 | + TuiGuest_OutputLine( &(p_guest->t_info), "Ignore Bad MSR", GUEST_IGNORE_BADMSR_KEY, 1, | |
582 | + NULL, 0x00, 0x00, NULL, NULL ); | |
583 | + TuiGuest_OutputLine( &(p_guest->t_info), "VirtIO Random", GUEST_VIRT_RANDOM_KEY, 1, | |
584 | + NULL, 0x00, 0x00, NULL, NULL ); | |
585 | + TuiGuest_OutputLine( &(p_guest->t_info), "Enable XHCI mouse", GUEST_XHCI_MOUSE_KEY, 1, | |
586 | + NULL, 0x00, 0x00, NULL, NULL ); | |
587 | + TuiGuest_OutputLine( &(p_guest->t_info), "AHCI Device Limits", GUEST_AHCI_DEVLIMIT_KEY, 1, | |
588 | + NULL, 0x00, 0x00, NULL, NULL ); | |
589 | + TuiGuest_OutputLine( &(p_guest->t_info), "Start Slot", GUEST_START_SLOT_KEY, 1, | |
590 | + NULL, 0x00, 0x00, NULL, NULL ); | |
591 | + TuiGuest_OutputLine( &(p_guest->t_info), "Install Slot", GUEST_INSTALL_SLOT_KEY, 1, | |
592 | + NULL, 0x00, 0x00, NULL, NULL ); | |
514 | 593 | |
515 | 594 | // Bhyve Settings -- |
516 | - t_attr.i_attr = A_BOLD; | |
517 | - TextBuf_AppendLine( <_guest.t_textbuf, " BHYVE Settings:", 0, (void *)&t_attr ); | |
518 | - | |
519 | - TuiGuest_OutputLine( &(p_guest->t_info), "Priority", GUEST_BHYVE_PRIORITY_KEY, 1, NULL, 0x00, 0x00 ); | |
520 | - TuiGuest_OutputLine( &(p_guest->t_info), "Add Option", GUEST_BHYVE_OPTIONS_KEY, 1, NULL, 0x00, 0x00 ); | |
521 | - TuiGuest_OutputLine( &(p_guest->t_info), "Enable PreStart", GUEST_BHYVE_PRESTART_KEY, 1, NULL, 0x00, 0x00 ); | |
522 | - TuiGuest_OutputLine( &(p_guest->t_info), "Enable AutoStart", GUEST_BHYVE_AUTOSTART_KEY, 1, NULL, 0x00, 0x00 ); | |
595 | + TuiGuest_AppendLine( " BHYVE Settings:", NULL, A_BOLD, | |
596 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
597 | + | |
598 | + TuiGuest_OutputLine( &(p_guest->t_info), "Priority", GUEST_BHYVE_PRIORITY_KEY, 1, | |
599 | + NULL, 0x00, 0x00, NULL, NULL ); | |
600 | + TuiGuest_OutputLine( &(p_guest->t_info), "Add Option", GUEST_BHYVE_OPTIONS_KEY, 1, | |
601 | + NULL, 0x00, 0x00, NULL, NULL ); | |
602 | + TuiGuest_OutputLine( &(p_guest->t_info), "Enable PreStart", GUEST_BHYVE_PRESTART_KEY, 1, | |
603 | + NULL, 0x00, 0x00, NULL, NULL ); | |
604 | + TuiGuest_OutputLine( &(p_guest->t_info), "Enable AutoStart", GUEST_BHYVE_AUTOSTART_KEY, 1, | |
605 | + NULL, 0x00, 0x00, NULL, NULL ); | |
523 | 606 | |
524 | 607 | // Passthru -- |
525 | 608 | i_err = KeyVal_GetData( &t_kval, &p_guest->t_info, GUEST_PASSTHRU_ITEMS_KEY ); |
526 | 609 | if( 0x00 != i_err ) { goto goto_TuiGuest_GeneratePageText_skipPassThru; } |
527 | 610 | if( 0 == KEYVAL_DATA_INT( t_kval ) ) { goto goto_TuiGuest_GeneratePageText_skipPassThru; } |
528 | 611 | |
529 | - t_attr.i_attr = A_BOLD; | |
530 | - TextBuf_AppendLine( <_guest.t_textbuf, " PassThru:", 0, (void *)&t_attr ); | |
612 | + TuiGuest_AppendLine( " PassThru:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
531 | 613 | |
532 | 614 | i_max = KEYVAL_DATA_INT( t_kval ); |
533 | 615 | for( i_cnt = 0; i_cnt < i_max; i_cnt++ ) { |
534 | - t_attr.i_attr = 0x00; | |
535 | 616 | snprintf( str_temp, sizeof( str_temp ), "PassThru #%d:", i_cnt ); |
536 | 617 | snprintf( str_key, sizeof( str_key ), GUEST_PASSTHRU_BASEKEY"/%d/%s", |
537 | 618 | i_cnt, GUEST_PASSTHRU_SUBKEY ); |
538 | - TuiGuest_OutputLine( &(p_guest->t_info), str_temp, str_key, 2, NULL, 0x00, 0x00 ); | |
619 | + TuiGuest_OutputLine( &(p_guest->t_info), str_temp, str_key, 2, | |
620 | + NULL, 0x00, 0x00, NULL, NULL ); | |
539 | 621 | } |
540 | 622 | |
541 | 623 | goto_TuiGuest_GeneratePageText_skipPassThru: |
542 | 624 | |
543 | 625 | // DataStore -- |
544 | - t_attr.i_attr = A_BOLD; | |
545 | - TextBuf_AppendLine( <_guest.t_textbuf, " DataStore:", 0, (void *)&t_attr ); | |
626 | + TuiGuest_AppendLine( " DataStore:", NULL, A_BOLD, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
546 | 627 | |
547 | - TuiGuest_OutputLine( &(p_guest->t_info), "Name", GUEST_DATASTORE_NAME_KEY, 1, NULL, 0x00, 0x00 ); | |
548 | - TuiGuest_OutputLine( &(p_guest->t_info), "Path", GUEST_DATASTORE_PATH_KEY, 1, NULL, 0x00, 0x00 ); | |
628 | + TuiGuest_OutputLine( &(p_guest->t_info), "Name", GUEST_DATASTORE_NAME_KEY, 1, | |
629 | + NULL, 0x00, 0x00, NULL, NULL ); | |
630 | + TuiGuest_OutputLine( &(p_guest->t_info), "Path", GUEST_DATASTORE_PATH_KEY, 1, | |
631 | + NULL, 0x00, 0x00, NULL, NULL ); | |
549 | 632 | |
550 | 633 | // ZFS - |
551 | - t_attr.i_attr = 0x00; | |
552 | - TextBuf_AppendLine( <_guest.t_textbuf, " ZFS Option:", 0, (void *)&t_attr ); | |
634 | + TuiGuest_AppendLine( " ZFS Option:", NULL, 0x00, TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
553 | 635 | |
554 | - TuiGuest_OutputLine( &(p_guest->t_info), "Dataset Option", GUEST_ZFS_DATASETOPTS_KEY, 2, NULL, 0x00, 0x00 ); | |
555 | - TuiGuest_OutputLine( &(p_guest->t_info), "ZVolume Option", GUEST_ZFS_ZVOLOPTS_KEY, 2, NULL, 0x00, 0x00 ); | |
636 | + TuiGuest_OutputLine( &(p_guest->t_info), "Dataset Option", GUEST_ZFS_DATASETOPTS_KEY, 2, | |
637 | + NULL, 0x00, 0x00, NULL, NULL ); | |
638 | + TuiGuest_OutputLine( &(p_guest->t_info), "ZVolume Option", GUEST_ZFS_ZVOLOPTS_KEY, 2, | |
639 | + NULL, 0x00, 0x00, NULL, NULL ); | |
556 | 640 | |
557 | 641 | // Resource Limitter -- |
558 | - t_attr.i_attr = A_BOLD; | |
559 | - TextBuf_AppendLine( <_guest.t_textbuf, " Resource Limitter Settings:", 0, (void *)&t_attr ); | |
560 | - | |
561 | - TuiGuest_OutputLine( &(p_guest->t_info), "CPU usage", GUEST_LIMIT_CPU_PER_KEY, 1, "%", 0x00, 0x00 ); | |
562 | - TuiGuest_OutputLine( &(p_guest->t_info), "Disk Read bps", GUEST_LIMIT_DISK_READ_BPS_KEY, 1, "bps", 0x00, 0x00 ); | |
563 | - TuiGuest_OutputLine( &(p_guest->t_info), "Disk Read IOPS", GUEST_LIMIT_DISK_READ_IOPS_KEY, 1, "IOPS", 0x00, 0x00 ); | |
564 | - TuiGuest_OutputLine( &(p_guest->t_info), "Disk Write bps", GUEST_LIMIT_DISK_WRITE_BPS_KEY, 1, "bps", 0x00, 0x00 ); | |
565 | - TuiGuest_OutputLine( &(p_guest->t_info), "Disk Write IOPS", GUEST_LIMIT_DISK_WRITE_IOPS_KEY, 1, "IOPS", 0x00, 0x00 ); | |
642 | + TuiGuest_AppendLine( " Resource Limitter Settings:", NULL, A_BOLD, | |
643 | + TUIGUEST_LINEATTR_NORMAL, NULL, NULL ); | |
644 | + | |
645 | + TuiGuest_OutputLine( &(p_guest->t_info), "CPU usage", GUEST_LIMIT_CPU_PER_KEY, 1, | |
646 | + "%", 0x00, 0x00, NULL, NULL ); | |
647 | + TuiGuest_OutputLine( &(p_guest->t_info), "Disk Read bps", GUEST_LIMIT_DISK_READ_BPS_KEY, 1, | |
648 | + "bps", 0x00, 0x00, NULL, NULL ); | |
649 | + TuiGuest_OutputLine( &(p_guest->t_info), "Disk Read IOPS", GUEST_LIMIT_DISK_READ_IOPS_KEY, 1, | |
650 | + "IOPS", 0x00, 0x00, NULL, NULL ); | |
651 | + TuiGuest_OutputLine( &(p_guest->t_info), "Disk Write bps", GUEST_LIMIT_DISK_WRITE_BPS_KEY, 1, | |
652 | + "bps", 0x00, 0x00, NULL, NULL ); | |
653 | + TuiGuest_OutputLine( &(p_guest->t_info), "Disk Write IOPS", GUEST_LIMIT_DISK_WRITE_IOPS_KEY, 1, | |
654 | + "IOPS", 0x00, 0x00, NULL, NULL ); | |
566 | 655 | |
567 | 656 | Guest_Release( p_guest ); |
568 | 657 |
@@ -45,9 +45,22 @@ VMTUI_TUIGUEST_EXTERN int TuiGuest_Term( void ); | ||
45 | 45 | typedef struct { |
46 | 46 | int i_attr; |
47 | 47 | DWord dw_option; |
48 | - #define TUIGUEST_LINEATTR_NORMAL 0x00 | |
49 | - #define TUIGUEST_LINEATTR_ONLYVALUE 0x01 | |
50 | - char str_key[32]; | |
48 | + #define TUIGUEST_LINEATTR_NORMAL 0x00000000 | |
49 | + #define TUIGUEST_LINEATTR_ONLYVALUE 0x00000001 | |
50 | + #define TUIGUEST_LINE_EDITABLE 0x00000010 | |
51 | + #define TUIGUEST_LINE_DYNAMIC (0x00000000|TUIGUEST_LINE_EDITABLE) | |
52 | + #define TUIGUEST_LINE_STATIC (0x00000020|TUIGUEST_LINE_EDITABLE) | |
53 | + #define TUIGUEST_LINE_STRING 0x00000000 | |
54 | + #define TUIGUEST_LINE_INTEGER 0x00000100 | |
55 | + #define TUIGUEST_LINE_DECIMAL (0x00000200|TUIGUEST_LINE_INTEGER) | |
56 | + #define TUIGUEST_LINE_IPADDR (0x00000200|TUIGUEST_LINE_INTEGER) | |
57 | + #define TUIGUEST_LINE_SFXINT 0x00000400 | |
58 | + #define TUIGUEST_LINE_PASSWORD 0x00000800 | |
59 | + #define TUIGUEST_LINE_YESNO 0x00001000 | |
60 | + #define TUIGUEST_LINE_SELECT 0x00002000 | |
61 | + char str_key[KEYVAL_MAXLEN_KEY]; | |
62 | + ConfFile_SelectValue *pt_select; | |
63 | + ConfFile_CheckValue pf_check; | |
51 | 64 | } TuiGuest_LineAttr; |
52 | 65 | |
53 | 66 | static struct { |
@@ -139,9 +139,7 @@ char * | ||
139 | 139 | TuiKey_GetInputStringAndPasswd( |
140 | 140 | int *pi_len, int *pi_cursor ) |
141 | 141 | { |
142 | - if(( TUIKEY_MODE_INPUTSTR != gi_keymode ) && ( TUIKEY_MODE_INPUTPASSWD != gi_keymode )) { | |
143 | - return NULL; | |
144 | - } | |
142 | + if( ! (TUIKEY_MODE_INPUTSTR & gi_keymode )) { return NULL; } | |
145 | 143 | |
146 | 144 | if( NULL != pi_len ) |
147 | 145 | { *pi_len = gt_input.i_inputlen; } |
@@ -215,7 +213,7 @@ int | ||
215 | 213 | if( NULL != pstr_msg ) |
216 | 214 | { strncpy( gt_input.str_msg, pstr_msg, sizeof( gt_input.str_msg ) ); } |
217 | 215 | else { |
218 | - if( TUIKEY_MODE_INPUTINT == i_mode ) | |
216 | + if( TUIKEY_MODE_INPUTINTEGER == i_mode ) | |
219 | 217 | { strncpy( gt_input.str_msg, "Input Integer", sizeof( gt_input.str_msg ) ); } |
220 | 218 | else if( TUIKEY_MODE_INPUTDECIMAL == i_mode ) |
221 | 219 | { strncpy( gt_input.str_msg, "Input Floating Value", sizeof( gt_input.str_msg ) ); } |
@@ -406,7 +404,7 @@ int | ||
406 | 404 | { goto goto_TuiKey_Dispatch_Mode_InputStr_OK; } |
407 | 405 | else if( TUIKEY_MODE_INPUTPASSWD == gi_keymode ) |
408 | 406 | { goto goto_TuiKey_Dispatch_Mode_InputStr_OK; } |
409 | - else if( TUIKEY_MODE_INPUTINT == gi_keymode ) { | |
407 | + else if( TUIKEY_MODE_INPUTINTEGER == gi_keymode ) { | |
410 | 408 | if( isdigit( i_key ) ) { goto goto_TuiKey_Dispatch_Mode_InputStr_OK; } |
411 | 409 | } |
412 | 410 | else if(( TUIKEY_MODE_INPUTDECIMAL == gi_keymode ) |
@@ -512,6 +510,10 @@ int | ||
512 | 510 | i_exit = TuiConsole_Dispatch( i_key ); |
513 | 511 | break; |
514 | 512 | case TUIKEY_MODE_INPUTSTR: |
513 | + case TUIKEY_MODE_INPUTINTEGER: | |
514 | + case TUIKEY_MODE_INPUTDECIMAL: | |
515 | + //case TUIKEY_MODE_INPUTIPADDR: | |
516 | + case TUIKEY_MODE_INPUTSFXINT: | |
515 | 517 | case TUIKEY_MODE_INPUTPASSWD: |
516 | 518 | i_exit = TuiKey_Dispatch_Mode_InputStr( i_key ); |
517 | 519 | break; |
@@ -62,7 +62,7 @@ VMTUI_TUIKEY_EXTERN int TuiKey_Term( void ); | ||
62 | 62 | #define TUIKEY_MODE_CONSOLE (0x03+TUIKEY_MODE_INFO) |
63 | 63 | #define TUIKEY_MODE_ERRINFO (0x04+TUIKEY_MODE_INFO) |
64 | 64 | #define TUIKEY_MODE_INPUTSTR 0x20 |
65 | -#define TUIKEY_MODE_INPUTINT 0x21 // bit 1 : digit | |
65 | +#define TUIKEY_MODE_INPUTINTEGER 0x21 // bit 1 : digit | |
66 | 66 | #define TUIKEY_MODE_INPUTDECIMAL 0x23 // bit 2 : digit + '.' |
67 | 67 | #define TUIKEY_MODE_INPUTIPADDR 0x23 |
68 | 68 | #define TUIKEY_MODE_INPUTSFXINT 0x24 // bit 3 : suffix |