Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
kernel_linux
提交
c4c99543
K
kernel_linux
项目概览
OpenHarmony
/
kernel_linux
上一次同步 3 年多
通知
13
Star
8
Fork
2
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
kernel_linux
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
c4c99543
编写于
4月 06, 2012
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
hpfs: get rid of bitfields in struct fnode
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
4085e155
变更
8
隐藏空白更改
内联
并排
Showing
8 changed file
with
32 addition
and
38 deletion
+32
-38
fs/hpfs/anode.c
fs/hpfs/anode.c
+2
-2
fs/hpfs/dir.c
fs/hpfs/dir.c
+1
-1
fs/hpfs/dnode.c
fs/hpfs/dnode.c
+1
-1
fs/hpfs/ea.c
fs/hpfs/ea.c
+12
-12
fs/hpfs/hpfs.h
fs/hpfs/hpfs.h
+13
-19
fs/hpfs/inode.c
fs/hpfs/inode.c
+1
-1
fs/hpfs/map.c
fs/hpfs/map.c
+1
-1
fs/hpfs/namei.c
fs/hpfs/namei.c
+1
-1
未找到文件。
fs/hpfs/anode.c
浏览文件 @
c4c99543
...
...
@@ -479,13 +479,13 @@ void hpfs_remove_fnode(struct super_block *s, fnode_secno fno)
struct
extended_attribute
*
ea
;
struct
extended_attribute
*
ea_end
;
if
(
!
(
fnode
=
hpfs_map_fnode
(
s
,
fno
,
&
bh
)))
return
;
if
(
!
fnode
->
dirflag
)
hpfs_remove_btree
(
s
,
&
fnode
->
btree
);
if
(
!
fnode
_is_dir
(
fnode
)
)
hpfs_remove_btree
(
s
,
&
fnode
->
btree
);
else
hpfs_remove_dtree
(
s
,
le32_to_cpu
(
fnode
->
u
.
external
[
0
].
disk_secno
));
ea_end
=
fnode_end_ea
(
fnode
);
for
(
ea
=
fnode_ea
(
fnode
);
ea
<
ea_end
;
ea
=
next_ea
(
ea
))
if
(
ea_indirect
(
ea
))
hpfs_ea_remove
(
s
,
ea_sec
(
ea
),
ea_in_anode
(
ea
),
ea_len
(
ea
));
hpfs_ea_ext_remove
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
->
ea_anode
,
le32_to_cpu
(
fnode
->
ea_size_l
));
hpfs_ea_ext_remove
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
_in_anode
(
fnode
)
,
le32_to_cpu
(
fnode
->
ea_size_l
));
brelse
(
bh
);
hpfs_free_sectors
(
s
,
fno
,
1
);
}
fs/hpfs/dir.c
浏览文件 @
c4c99543
...
...
@@ -87,7 +87,7 @@ static int hpfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
ret
=
-
EIOERROR
;
goto
out
;
}
if
(
!
fno
->
dirflag
)
{
if
(
!
fno
de_is_dir
(
fno
)
)
{
e
=
1
;
hpfs_error
(
inode
->
i_sb
,
"not a directory, fnode %08lx"
,
(
unsigned
long
)
inode
->
i_ino
);
...
...
fs/hpfs/dnode.c
浏览文件 @
c4c99543
...
...
@@ -1015,7 +1015,7 @@ struct hpfs_dirent *map_fnode_dirent(struct super_block *s, fnode_secno fno,
kfree
(
name2
);
return
NULL
;
}
if
(
!
upf
->
dirflag
)
{
if
(
!
fnode_is_dir
(
upf
)
)
{
brelse
(
bh
);
hpfs_error
(
s
,
"fnode %08x has non-directory parent %08x"
,
fno
,
le32_to_cpu
(
f
->
up
));
kfree
(
name2
);
...
...
fs/hpfs/ea.c
浏览文件 @
c4c99543
...
...
@@ -91,7 +91,7 @@ int hpfs_read_ea(struct super_block *s, struct fnode *fnode, char *key,
}
a
=
le32_to_cpu
(
fnode
->
ea_secno
);
len
=
le32_to_cpu
(
fnode
->
ea_size_l
);
ano
=
fnode
->
ea_anode
;
ano
=
fnode
_in_anode
(
fnode
)
;
pos
=
0
;
while
(
pos
<
len
)
{
ea
=
(
struct
extended_attribute
*
)
ex
;
...
...
@@ -148,7 +148,7 @@ char *hpfs_get_ea(struct super_block *s, struct fnode *fnode, char *key, int *si
}
a
=
le32_to_cpu
(
fnode
->
ea_secno
);
len
=
le32_to_cpu
(
fnode
->
ea_size_l
);
ano
=
fnode
->
ea_anode
;
ano
=
fnode
_in_anode
(
fnode
)
;
pos
=
0
;
while
(
pos
<
len
)
{
char
ex
[
4
+
255
+
1
+
8
];
...
...
@@ -209,7 +209,7 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
}
a
=
le32_to_cpu
(
fnode
->
ea_secno
);
len
=
le32_to_cpu
(
fnode
->
ea_size_l
);
ano
=
fnode
->
ea_anode
;
ano
=
fnode
_in_anode
(
fnode
)
;
pos
=
0
;
while
(
pos
<
len
)
{
char
ex
[
4
+
255
+
1
+
8
];
...
...
@@ -276,7 +276,7 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
fnode
->
ea_size_l
=
cpu_to_le32
(
le16_to_cpu
(
fnode
->
ea_size_s
));
fnode
->
ea_size_s
=
cpu_to_le16
(
0
);
fnode
->
ea_secno
=
cpu_to_le32
(
n
);
fnode
->
ea_anode
=
cpu_to_le32
(
0
)
;
fnode
->
flags
&=
~
FNODE_anode
;
mark_buffer_dirty
(
bh
);
brelse
(
bh
);
}
...
...
@@ -288,9 +288,9 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
secno
q
=
hpfs_alloc_sector
(
s
,
fno
,
1
,
0
);
if
(
!
q
)
goto
bail
;
fnode
->
ea_secno
=
cpu_to_le32
(
q
);
fnode
->
ea_anode
=
0
;
fnode
->
flags
&=
~
FNODE_anode
;
len
++
;
}
else
if
(
!
fnode
->
ea_anode
)
{
}
else
if
(
!
fnode
_in_anode
(
fnode
)
)
{
if
(
hpfs_alloc_if_possible
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
)
+
len
))
{
len
++
;
}
else
{
...
...
@@ -310,7 +310,7 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
anode->u.external[0].length = cpu_to_le32(len);
mark_buffer_dirty(bh);
brelse(bh);
fnode->
ea_anode = 1
;
fnode->
flags |= FNODE_anode
;
fnode->ea_secno = cpu_to_le32(a_s);*/
secno
new_sec
;
int
i
;
...
...
@@ -338,7 +338,7 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
len
=
(
pos
+
511
)
>>
9
;
}
}
if
(
fnode
->
ea_anode
)
{
if
(
fnode
_in_anode
(
fnode
)
)
{
if
(
hpfs_add_sector_to_btree
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
0
,
len
)
!=
-
1
)
{
len
++
;
...
...
@@ -351,16 +351,16 @@ void hpfs_set_ea(struct inode *inode, struct fnode *fnode, const char *key,
h
[
1
]
=
strlen
(
key
);
h
[
2
]
=
size
&
0xff
;
h
[
3
]
=
size
>>
8
;
if
(
hpfs_ea_write
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
->
ea_anode
,
le32_to_cpu
(
fnode
->
ea_size_l
),
4
,
h
))
goto
bail
;
if
(
hpfs_ea_write
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
->
ea_anode
,
le32_to_cpu
(
fnode
->
ea_size_l
)
+
4
,
h
[
1
]
+
1
,
key
))
goto
bail
;
if
(
hpfs_ea_write
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
->
ea_anode
,
le32_to_cpu
(
fnode
->
ea_size_l
)
+
5
+
h
[
1
],
size
,
data
))
goto
bail
;
if
(
hpfs_ea_write
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
_in_anode
(
fnode
)
,
le32_to_cpu
(
fnode
->
ea_size_l
),
4
,
h
))
goto
bail
;
if
(
hpfs_ea_write
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
_in_anode
(
fnode
)
,
le32_to_cpu
(
fnode
->
ea_size_l
)
+
4
,
h
[
1
]
+
1
,
key
))
goto
bail
;
if
(
hpfs_ea_write
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
fnode
_in_anode
(
fnode
)
,
le32_to_cpu
(
fnode
->
ea_size_l
)
+
5
+
h
[
1
],
size
,
data
))
goto
bail
;
fnode
->
ea_size_l
=
cpu_to_le32
(
pos
);
ret:
hpfs_i
(
inode
)
->
i_ea_size
+=
5
+
strlen
(
key
)
+
size
;
return
;
bail:
if
(
le32_to_cpu
(
fnode
->
ea_secno
))
if
(
fnode
->
ea_anode
)
hpfs_truncate_btree
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
1
,
(
le32_to_cpu
(
fnode
->
ea_size_l
)
+
511
)
>>
9
);
if
(
fnode
_in_anode
(
fnode
)
)
hpfs_truncate_btree
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
),
1
,
(
le32_to_cpu
(
fnode
->
ea_size_l
)
+
511
)
>>
9
);
else
hpfs_free_sectors
(
s
,
le32_to_cpu
(
fnode
->
ea_secno
)
+
((
le32_to_cpu
(
fnode
->
ea_size_l
)
+
511
)
>>
9
),
len
-
((
le32_to_cpu
(
fnode
->
ea_size_l
)
+
511
)
>>
9
));
else
fnode
->
ea_secno
=
fnode
->
ea_size_l
=
cpu_to_le32
(
0
);
}
...
...
fs/hpfs/hpfs.h
浏览文件 @
c4c99543
...
...
@@ -436,6 +436,7 @@ struct bplus_header
#define FNODE_MAGIC 0xf7e40aae
enum
{
FNODE_anode
=
cpu_to_le16
(
2
),
FNODE_dir
=
cpu_to_le16
(
256
)};
struct
fnode
{
u32
magic
;
/* f7e4 0aae */
...
...
@@ -451,26 +452,9 @@ struct fnode
secno
ea_secno
;
/* first sector of disk-resident ea's*/
u16
ea_size_s
;
/* length of fnode-resident ea's */
#ifdef __LITTLE_ENDIAN
u8
flag0
:
1
;
u8
ea_anode
:
1
;
/* 1 -> ea_secno is an anode */
u8
flag234567
:
6
;
#else
u8
flag234567
:
6
;
u8
ea_anode
:
1
;
/* 1 -> ea_secno is an anode */
u8
flag0
:
1
;
#endif
#ifdef __LITTLE_ENDIAN
u8
dirflag
:
1
;
/* 1 -> directory. first & only extent
points to dnode. */
u8
flag9012345
:
7
;
#else
u8
flag9012345
:
7
;
u8
dirflag
:
1
;
/* 1 -> directory. first & only extent
__le16
flags
;
/* bit 1 set -> ea_secno is an anode */
/* bit 8 set -> directory. first & only extent
points to dnode. */
#endif
struct
bplus_header
btree
;
/* b+ tree, 8 extents or 12 subtrees */
union
{
struct
bplus_leaf_node
external
[
8
];
...
...
@@ -492,6 +476,16 @@ struct fnode
via fnode + ea_offs. I think.) */
};
static
inline
bool
fnode_in_anode
(
struct
fnode
*
p
)
{
return
(
p
->
flags
&
FNODE_anode
)
!=
0
;
}
static
inline
bool
fnode_is_dir
(
struct
fnode
*
p
)
{
return
(
p
->
flags
&
FNODE_dir
)
!=
0
;
}
/* anode: 99.44% pure allocation tree */
...
...
fs/hpfs/inode.c
浏览文件 @
c4c99543
...
...
@@ -110,7 +110,7 @@ void hpfs_read_inode(struct inode *i)
}
}
}
if
(
fnode
->
dirflag
)
{
if
(
fnode
_is_dir
(
fnode
)
)
{
int
n_dnodes
,
n_subdirs
;
i
->
i_mode
|=
S_IFDIR
;
i
->
i_op
=
&
hpfs_dir_iops
;
...
...
fs/hpfs/map.c
浏览文件 @
c4c99543
...
...
@@ -130,7 +130,7 @@ struct fnode *hpfs_map_fnode(struct super_block *s, ino_t ino, struct buffer_hea
(
unsigned
long
)
ino
);
goto
bail
;
}
if
(
!
fnode
->
dirflag
)
{
if
(
!
fnode
_is_dir
(
fnode
)
)
{
if
((
unsigned
)
fnode
->
btree
.
n_used_nodes
+
(
unsigned
)
fnode
->
btree
.
n_free_nodes
!=
(
fnode
->
btree
.
internal
?
12
:
8
))
{
hpfs_error
(
s
,
...
...
fs/hpfs/namei.c
浏览文件 @
c4c99543
...
...
@@ -70,7 +70,7 @@ static int hpfs_mkdir(struct inode *dir, struct dentry *dentry, umode_t mode)
fnode
->
len
=
len
;
memcpy
(
fnode
->
name
,
name
,
len
>
15
?
15
:
len
);
fnode
->
up
=
cpu_to_le32
(
dir
->
i_ino
);
fnode
->
dirflag
=
1
;
fnode
->
flags
|=
FNODE_dir
;
fnode
->
btree
.
n_free_nodes
=
7
;
fnode
->
btree
.
n_used_nodes
=
1
;
fnode
->
btree
.
first_free
=
cpu_to_le16
(
0x14
);
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录