Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
ca062aae
Q
qemu
项目概览
openeuler
/
qemu
通知
10
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Q
qemu
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
ca062aae
编写于
11月 07, 2011
作者:
A
Anthony Liguori
浏览文件
操作
浏览文件
下载
差异文件
Merge remote-tracking branch 'stefanha/trivial-patches' into staging
上级
41bf234d
e7b48c97
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
92 addition
and
96 deletion
+92
-96
cmd.c
cmd.c
+82
-86
hw/xen_platform.c
hw/xen_platform.c
+9
-9
readline.c
readline.c
+1
-1
未找到文件。
cmd.c
浏览文件 @
ca062aae
...
...
@@ -45,13 +45,11 @@ compare(const void *a, const void *b)
((
const
cmdinfo_t
*
)
b
)
->
name
);
}
void
add_command
(
const
cmdinfo_t
*
ci
)
void
add_command
(
const
cmdinfo_t
*
ci
)
{
cmdtab
=
realloc
((
void
*
)
cmdtab
,
++
ncmds
*
sizeof
(
*
cmdtab
));
cmdtab
[
ncmds
-
1
]
=
*
ci
;
qsort
(
cmdtab
,
ncmds
,
sizeof
(
*
cmdtab
),
compare
);
cmdtab
=
g_
realloc
((
void
*
)
cmdtab
,
++
ncmds
*
sizeof
(
*
cmdtab
));
cmdtab
[
ncmds
-
1
]
=
*
ci
;
qsort
(
cmdtab
,
ncmds
,
sizeof
(
*
cmdtab
),
compare
);
}
static
int
...
...
@@ -122,16 +120,10 @@ find_command(
return
NULL
;
}
void
add_user_command
(
char
*
optarg
)
void
add_user_command
(
char
*
optarg
)
{
ncmdline
++
;
cmdline
=
realloc
(
cmdline
,
sizeof
(
char
*
)
*
(
ncmdline
));
if
(
!
cmdline
)
{
perror
(
"realloc"
);
exit
(
1
);
}
cmdline
[
ncmdline
-
1
]
=
optarg
;
cmdline
=
g_realloc
(
cmdline
,
++
ncmdline
*
sizeof
(
char
*
));
cmdline
[
ncmdline
-
1
]
=
optarg
;
}
static
int
...
...
@@ -160,45 +152,44 @@ static void prep_fetchline(void *opaque)
static
char
*
get_prompt
(
void
);
void
command_loop
(
void
)
void
command_loop
(
void
)
{
int
c
,
i
,
j
=
0
,
done
=
0
,
fetchable
=
0
,
prompted
=
0
;
char
*
input
;
char
**
v
;
const
cmdinfo_t
*
ct
;
for
(
i
=
0
;
!
done
&&
i
<
ncmdline
;
i
++
)
{
input
=
strdup
(
cmdline
[
i
]);
if
(
!
input
)
{
fprintf
(
stderr
,
_
(
"cannot strdup command '%s': %s
\n
"
),
cmdline
[
i
],
strerror
(
errno
));
exit
(
1
);
}
v
=
breakline
(
input
,
&
c
);
if
(
c
)
{
ct
=
find_command
(
v
[
0
]);
if
(
ct
)
{
if
(
ct
->
flags
&
CMD_FLAG_GLOBAL
)
done
=
command
(
ct
,
c
,
v
);
else
{
j
=
0
;
while
(
!
done
&&
(
j
=
args_command
(
j
)))
done
=
command
(
ct
,
c
,
v
);
}
}
else
fprintf
(
stderr
,
_
(
"command
\"
%s
\"
not found
\n
"
),
v
[
0
]);
}
doneline
(
input
,
v
);
}
if
(
cmdline
)
{
free
(
cmdline
);
return
;
int
c
,
i
,
j
=
0
,
done
=
0
,
fetchable
=
0
,
prompted
=
0
;
char
*
input
;
char
**
v
;
const
cmdinfo_t
*
ct
;
for
(
i
=
0
;
!
done
&&
i
<
ncmdline
;
i
++
)
{
input
=
strdup
(
cmdline
[
i
]);
if
(
!
input
)
{
fprintf
(
stderr
,
_
(
"cannot strdup command '%s': %s
\n
"
),
cmdline
[
i
],
strerror
(
errno
));
exit
(
1
);
}
v
=
breakline
(
input
,
&
c
);
if
(
c
)
{
ct
=
find_command
(
v
[
0
]);
if
(
ct
)
{
if
(
ct
->
flags
&
CMD_FLAG_GLOBAL
)
{
done
=
command
(
ct
,
c
,
v
);
}
else
{
j
=
0
;
while
(
!
done
&&
(
j
=
args_command
(
j
)))
{
done
=
command
(
ct
,
c
,
v
);
}
}
}
else
{
fprintf
(
stderr
,
_
(
"command
\"
%s
\"
not found
\n
"
),
v
[
0
]);
}
}
doneline
(
input
,
v
);
}
if
(
cmdline
)
{
g_free
(
cmdline
);
return
;
}
while
(
!
done
)
{
while
(
!
done
)
{
if
(
!
prompted
)
{
printf
(
"%s"
,
get_prompt
());
fflush
(
stdout
);
...
...
@@ -212,22 +203,24 @@ command_loop(void)
if
(
!
fetchable
)
{
continue
;
}
if
((
input
=
fetchline
())
==
NULL
)
break
;
v
=
breakline
(
input
,
&
c
);
if
(
c
)
{
ct
=
find_command
(
v
[
0
]);
if
(
ct
)
done
=
command
(
ct
,
c
,
v
);
else
fprintf
(
stderr
,
_
(
"command
\"
%s
\"
not found
\n
"
),
v
[
0
]);
}
doneline
(
input
,
v
);
input
=
fetchline
();
if
(
input
==
NULL
)
{
break
;
}
v
=
breakline
(
input
,
&
c
);
if
(
c
)
{
ct
=
find_command
(
v
[
0
]);
if
(
ct
)
{
done
=
command
(
ct
,
c
,
v
);
}
else
{
fprintf
(
stderr
,
_
(
"command
\"
%s
\"
not found
\n
"
),
v
[
0
]);
}
}
doneline
(
input
,
v
);
prompted
=
0
;
fetchable
=
0
;
}
}
qemu_aio_set_fd_handler
(
STDIN_FILENO
,
NULL
,
NULL
,
NULL
,
NULL
,
NULL
);
}
...
...
@@ -331,29 +324,32 @@ static char *qemu_strsep(char **input, const char *delim)
return
result
;
}
char
**
breakline
(
char
*
input
,
int
*
count
)
char
**
breakline
(
char
*
input
,
int
*
count
)
{
int
c
=
0
;
char
*
p
;
char
**
rval
=
calloc
(
sizeof
(
char
*
),
1
);
while
(
rval
&&
(
p
=
qemu_strsep
(
&
input
,
" "
))
!=
NULL
)
{
if
(
!*
p
)
continue
;
c
++
;
rval
=
realloc
(
rval
,
sizeof
(
*
rval
)
*
(
c
+
1
));
if
(
!
rval
)
{
c
=
0
;
break
;
}
rval
[
c
-
1
]
=
p
;
rval
[
c
]
=
NULL
;
}
*
count
=
c
;
return
rval
;
int
c
=
0
;
char
*
p
;
char
**
rval
=
calloc
(
sizeof
(
char
*
),
1
);
char
**
tmp
;
while
(
rval
&&
(
p
=
qemu_strsep
(
&
input
,
" "
))
!=
NULL
)
{
if
(
!*
p
)
{
continue
;
}
c
++
;
tmp
=
realloc
(
rval
,
sizeof
(
*
rval
)
*
(
c
+
1
));
if
(
!
tmp
)
{
free
(
rval
);
rval
=
NULL
;
c
=
0
;
break
;
}
else
{
rval
=
tmp
;
}
rval
[
c
-
1
]
=
p
;
rval
[
c
]
=
NULL
;
}
*
count
=
c
;
return
rval
;
}
void
...
...
hw/xen_platform.c
浏览文件 @
ca062aae
...
...
@@ -113,7 +113,7 @@ static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t v
{
PCIXenPlatformState
*
s
=
opaque
;
switch
(
addr
-
XEN_PLATFORM_IOPORT
)
{
switch
(
addr
)
{
case
0
:
/* Unplug devices. Value is a bitmask of which devices to
unplug, with bit 0 the IDE devices, bit 1 the network
...
...
@@ -152,7 +152,7 @@ static void platform_fixed_ioport_writew(void *opaque, uint32_t addr, uint32_t v
static
void
platform_fixed_ioport_writel
(
void
*
opaque
,
uint32_t
addr
,
uint32_t
val
)
{
switch
(
addr
-
XEN_PLATFORM_IOPORT
)
{
switch
(
addr
)
{
case
0
:
/* PV driver version */
break
;
...
...
@@ -163,7 +163,7 @@ static void platform_fixed_ioport_writeb(void *opaque, uint32_t addr, uint32_t v
{
PCIXenPlatformState
*
s
=
opaque
;
switch
(
addr
-
XEN_PLATFORM_IOPORT
)
{
switch
(
addr
)
{
case
0
:
/* Platform flags */
{
hvmmem_type_t
mem_type
=
(
val
&
PFFLAG_ROM_LOCK
)
?
HVMMEM_ram_ro
:
HVMMEM_ram_rw
;
...
...
@@ -186,7 +186,7 @@ static uint32_t platform_fixed_ioport_readw(void *opaque, uint32_t addr)
{
PCIXenPlatformState
*
s
=
opaque
;
switch
(
addr
-
XEN_PLATFORM_IOPORT
)
{
switch
(
addr
)
{
case
0
:
if
(
s
->
drivers_blacklisted
)
{
/* The drivers will recognise this magic number and refuse
...
...
@@ -205,7 +205,7 @@ static uint32_t platform_fixed_ioport_readb(void *opaque, uint32_t addr)
{
PCIXenPlatformState
*
s
=
opaque
;
switch
(
addr
-
XEN_PLATFORM_IOPORT
)
{
switch
(
addr
)
{
case
0
:
/* Platform flags */
return
s
->
flags
;
...
...
@@ -221,7 +221,7 @@ static void platform_fixed_ioport_reset(void *opaque)
{
PCIXenPlatformState
*
s
=
opaque
;
platform_fixed_ioport_writeb
(
s
,
XEN_PLATFORM_IOPORT
,
0
);
platform_fixed_ioport_writeb
(
s
,
0
,
0
);
}
const
MemoryRegionPortio
xen_platform_ioport
[]
=
{
...
...
@@ -251,7 +251,7 @@ static void platform_fixed_ioport_init(PCIXenPlatformState* s)
static
uint32_t
xen_platform_ioport_readb
(
void
*
opaque
,
uint32_t
addr
)
{
if
(
addr
==
0
)
{
return
platform_fixed_ioport_readb
(
opaque
,
XEN_PLATFORM_IOPORT
);
return
platform_fixed_ioport_readb
(
opaque
,
0
);
}
else
{
return
~
0u
;
}
...
...
@@ -263,7 +263,7 @@ static void xen_platform_ioport_writeb(void *opaque, uint32_t addr, uint32_t val
switch
(
addr
)
{
case
0
:
/* Platform flags */
platform_fixed_ioport_writeb
(
opaque
,
XEN_PLATFORM_IOPORT
,
val
);
platform_fixed_ioport_writeb
(
opaque
,
0
,
val
);
break
;
case
8
:
log_writeb
(
s
,
val
);
...
...
@@ -321,7 +321,7 @@ static int xen_platform_post_load(void *opaque, int version_id)
{
PCIXenPlatformState
*
s
=
opaque
;
platform_fixed_ioport_writeb
(
s
,
XEN_PLATFORM_IOPORT
,
s
->
flags
);
platform_fixed_ioport_writeb
(
s
,
0
,
s
->
flags
);
return
0
;
}
...
...
readline.c
浏览文件 @
ca062aae
...
...
@@ -236,7 +236,7 @@ static void readline_hist_add(ReadLineState *rs, const char *cmdline)
new_entry
=
hist_entry
;
/* Put this entry at the end of history */
memmove
(
&
rs
->
history
[
idx
],
&
rs
->
history
[
idx
+
1
],
(
READLINE_MAX_CMDS
-
idx
+
1
)
*
sizeof
(
char
*
));
(
READLINE_MAX_CMDS
-
(
idx
+
1
)
)
*
sizeof
(
char
*
));
rs
->
history
[
READLINE_MAX_CMDS
-
1
]
=
NULL
;
for
(;
idx
<
READLINE_MAX_CMDS
;
idx
++
)
{
if
(
rs
->
history
[
idx
]
==
NULL
)
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录