Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party FreeBSD
提交
a6068434
T
Third Party FreeBSD
项目概览
OpenHarmony
/
Third Party FreeBSD
接近 2 年 前同步成功
通知
3
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party FreeBSD
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
提交
a6068434
编写于
6月 20, 2022
作者:
张
张文迪
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
modify newfs_msdos to format fat filesystem
Signed-off-by:
N
张文迪
<
zhangwendi3@huawei.com
>
上级
401f6e68
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
43 addition
and
8 deletion
+43
-8
sbin/newfs_msdos/BUILD.gn
sbin/newfs_msdos/BUILD.gn
+0
-1
sbin/newfs_msdos/mkfs_msdos.c
sbin/newfs_msdos/mkfs_msdos.c
+43
-7
未找到文件。
sbin/newfs_msdos/BUILD.gn
浏览文件 @
a6068434
...
...
@@ -34,7 +34,6 @@ config("vfat-defaults") {
"-DSIGINFO=SIGUSR2",
"-Dnitems(x)=(sizeof((x))/sizeof((x)[0]))",
"-Wno-implicit-function-declaration",
"-DMAKEFS",
"-D_MACHINE_IOCTL_FD_H_",
]
include_dirs = [ "//third_party/FreeBSD/sys" ]
...
...
sbin/newfs_msdos/mkfs_msdos.c
浏览文件 @
a6068434
...
...
@@ -33,12 +33,16 @@ static const char rcsid[] =
#include <sys/param.h>
#ifdef MAKEFS
/* In the makefs case we only want struct disklabel */
// #include <sys/disk/bsd.h>
#include <sys/disk/bsd.h>
#elif defined(__linux__)
#include <linux/fs.h>
#include <linux/hdreg.h>
#include <sys/ioctl.h>
#else
//
#include <sys/fdcio.h>
//
#include <sys/disk.h>
//
#include <sys/disklabel.h>
//
#include <sys/mount.h>
#include <sys/fdcio.h>
#include <sys/disk.h>
#include <sys/disklabel.h>
#include <sys/mount.h>
#endif
#include <sys/stat.h>
// #include <sys/sysctl.h>
...
...
@@ -807,7 +811,7 @@ check_mounted(const char *fname, mode_t mode)
* If getmntinfo() is not available (e.g. Linux) don't check. This should
* not be a problem since we will only be using makefs to create images.
*/
#if !defined(MAKEFS)
#if
0 &&
!defined(MAKEFS)
struct statfs *mp;
const char *s1, *s2;
size_t len;
...
...
@@ -895,6 +899,7 @@ getstdfmt(const char *fmt, struct bpb *bpb)
return
0
;
}
#if 0
static void
compute_geometry_from_file(int fd, const char *fname, struct disklabel *lp)
{
...
...
@@ -911,10 +916,41 @@ compute_geometry_from_file(int fd, const char *fname, struct disklabel *lp)
lp->d_ntracks = 255;
lp->d_secperunit = ms / lp->d_secsize;
}
#endif
/*
* Get disk slice, partition, and geometry information.
*/
#if defined(__linux__)
static
int
getdiskinfo
(
int
fd
,
const
char
*
fname
,
const
char
*
dtype
,
int
oflag
,
struct
bpb
*
bpb
)
{
if
(
ioctl
(
fd
,
BLKSSZGET
,
&
bpb
->
bpbBytesPerSec
))
{
err
(
1
,
"ioctl(BLKSSZGET) for bytes/sector failed"
);
}
if
(
ckgeom
(
fname
,
bpb
->
bpbBytesPerSec
,
"bytes/sector"
)
==
-
1
)
return
-
1
;
u_int64_t
device_size
;
if
(
ioctl
(
fd
,
BLKGETSIZE64
,
&
device_size
))
{
err
(
1
,
"ioctl(BLKGETSIZE64) failed"
);
}
u_int64_t
sectors
=
device_size
/
bpb
->
bpbBytesPerSec
;
if
(
sectors
>
UINT_MAX
)
{
err
(
1
,
"too many sectors: %"
PRIu64
" (%"
PRId64
" byte device, %u bytes/sector)"
,
sectors
,
device_size
,
bpb
->
bpbBytesPerSec
);
}
bpb
->
bpbHugeSectors
=
sectors
;
bpb
->
bpbSecPerTrack
=
63
;
if
(
ckgeom
(
fname
,
bpb
->
bpbSecPerTrack
,
"sectors/track"
)
==
-
1
)
return
-
1
;
bpb
->
bpbHeads
=
64
;
if
(
ckgeom
(
fname
,
bpb
->
bpbHeads
,
"drive heads"
)
==
-
1
)
return
-
1
;
return
0
;
}
#else
static
int
getdiskinfo
(
int
fd
,
const
char
*
fname
,
const
char
*
dtype
,
/* __unused */
int
oflag
,
struct
bpb
*
bpb
)
...
...
@@ -1003,7 +1039,7 @@ getdiskinfo(int fd, const char *fname, const char *dtype, /* __unused */ int ofl
bpb
->
bpbHiddenSecs
=
hs
;
return
0
;
}
#endif
/*
* Print out BPB values.
*/
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录