Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
qemu
提交
9d728e8c
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看板
提交
9d728e8c
编写于
9月 05, 2004
作者:
B
bellard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
smb support
git-svn-id:
svn://svn.savannah.nongnu.org/qemu/trunk@1059
c046a42c-6fe2-441c-8c8c-71466251a162
上级
36d54d15
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
81 addition
and
0 deletion
+81
-0
vl.c
vl.c
+81
-0
未找到文件。
vl.c
浏览文件 @
9d728e8c
...
...
@@ -38,6 +38,7 @@
#include <sys/mman.h>
#include <sys/ioctl.h>
#include <sys/socket.h>
#include <dirent.h>
#ifdef _BSD
#include <sys/stat.h>
#ifndef __APPLE__
...
...
@@ -1453,6 +1454,80 @@ static void net_slirp_redir(const char *redir_str)
fprintf
(
stderr
,
"qemu: syntax: -redir [tcp|udp]:host-port:[guest-host]:guest-port
\n
"
);
exit
(
1
);
}
char
smb_dir
[
1024
];
static
void
smb_exit
(
void
)
{
DIR
*
d
;
struct
dirent
*
de
;
char
filename
[
1024
];
/* erase all the files in the directory */
d
=
opendir
(
smb_dir
);
for
(;;)
{
de
=
readdir
(
d
);
if
(
!
de
)
break
;
if
(
strcmp
(
de
->
d_name
,
"."
)
!=
0
&&
strcmp
(
de
->
d_name
,
".."
)
!=
0
)
{
snprintf
(
filename
,
sizeof
(
filename
),
"%s/%s"
,
smb_dir
,
de
->
d_name
);
unlink
(
filename
);
}
}
rmdir
(
smb_dir
);
}
/* automatic user mode samba server configuration */
void
net_slirp_smb
(
const
char
*
exported_dir
)
{
char
smb_conf
[
1024
];
char
smb_cmdline
[
1024
];
FILE
*
f
;
if
(
!
slirp_inited
)
{
slirp_inited
=
1
;
slirp_init
();
}
/* XXX: better tmp dir construction */
snprintf
(
smb_dir
,
sizeof
(
smb_dir
),
"/tmp/qemu-smb.%d"
,
getpid
());
if
(
mkdir
(
smb_dir
,
0700
)
<
0
)
{
fprintf
(
stderr
,
"qemu: could not create samba server dir '%s'
\n
"
,
smb_dir
);
exit
(
1
);
}
snprintf
(
smb_conf
,
sizeof
(
smb_conf
),
"%s/%s"
,
smb_dir
,
"smb.conf"
);
f
=
fopen
(
smb_conf
,
"w"
);
if
(
!
f
)
{
fprintf
(
stderr
,
"qemu: could not create samba server configuration file '%s'
\n
"
,
smb_conf
);
exit
(
1
);
}
fprintf
(
f
,
"[global]
\n
"
"pid directory=%s
\n
"
"lock directory=%s
\n
"
"log file=%s/log.smbd
\n
"
"smb passwd file=%s/smbpasswd
\n
"
"[qemu]
\n
"
"path=%s
\n
"
"read only=no
\n
"
"guest ok=yes
\n
"
,
smb_dir
,
smb_dir
,
smb_dir
,
smb_dir
,
exported_dir
);
fclose
(
f
);
atexit
(
smb_exit
);
snprintf
(
smb_cmdline
,
sizeof
(
smb_cmdline
),
"/usr/sbin/smbd -s %s"
,
smb_conf
);
slirp_add_exec
(
0
,
smb_cmdline
,
4
,
139
);
}
#endif
/* CONFIG_SLIRP */
...
...
@@ -2407,6 +2482,7 @@ void help(void)
#ifdef CONFIG_SLIRP
"-user-net use user mode network stack [default if no tap/tun script]
\n
"
"-tftp prefix allow tftp access to files starting with prefix [-user-net]
\n
"
"-smb dir allow SMB access to files in 'dir' [-user-net]
\n
"
"-redir [tcp|udp]:host-port:[guest-host]:guest-port
\n
"
" redirect TCP or UDP connections from host to guest [-user-net]
\n
"
#endif
...
...
@@ -2484,6 +2560,7 @@ enum {
QEMU_OPTION_tun_fd
,
QEMU_OPTION_user_net
,
QEMU_OPTION_tftp
,
QEMU_OPTION_smb
,
QEMU_OPTION_redir
,
QEMU_OPTION_dummy_net
,
...
...
@@ -2538,6 +2615,7 @@ const QEMUOption qemu_options[] = {
#ifdef CONFIG_SLIRP
{
"user-net"
,
0
,
QEMU_OPTION_user_net
},
{
"tftp"
,
HAS_ARG
,
QEMU_OPTION_tftp
},
{
"smb"
,
HAS_ARG
,
QEMU_OPTION_smb
},
{
"redir"
,
HAS_ARG
,
QEMU_OPTION_redir
},
#endif
{
"dummy-net"
,
0
,
QEMU_OPTION_dummy_net
},
...
...
@@ -2834,6 +2912,9 @@ int main(int argc, char **argv)
case
QEMU_OPTION_tftp
:
tftp_prefix
=
optarg
;
break
;
case
QEMU_OPTION_smb
:
net_slirp_smb
(
optarg
);
break
;
case
QEMU_OPTION_user_net
:
net_if_type
=
NET_IF_USER
;
break
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录