Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
openeuler
Kernel
提交
956ce208
K
Kernel
项目概览
openeuler
/
Kernel
1 年多 前同步成功
通知
8
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
K
Kernel
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
956ce208
编写于
5月 17, 2013
作者:
A
Al Viro
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[readdir] convert ntfs
Signed-off-by:
N
Al Viro
<
viro@zeniv.linux.org.uk
>
上级
bfee7169
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
27 addition
and
57 deletion
+27
-57
fs/ntfs/dir.c
fs/ntfs/dir.c
+27
-57
未找到文件。
fs/ntfs/dir.c
浏览文件 @
956ce208
...
...
@@ -1004,13 +1004,11 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
/**
* ntfs_filldir - ntfs specific filldir method
* @vol: current ntfs volume
* @fpos: position in the directory
* @ndir: ntfs inode of current directory
* @ia_page: page in which the index allocation buffer @ie is in resides
* @ie: current index entry
* @name: buffer to use for the converted name
* @dirent: vfs filldir callback context
* @filldir: vfs filldir callback
* @actor: what to feed the entries to
*
* Convert the Unicode @name to the loaded NLS and pass it to the @filldir
* callback.
...
...
@@ -1024,12 +1022,12 @@ u64 ntfs_lookup_inode_by_name(ntfs_inode *dir_ni, const ntfschar *uname,
* retake the lock if we are returning a non-zero value as ntfs_readdir()
* would need to drop the lock immediately anyway.
*/
static
inline
int
ntfs_filldir
(
ntfs_volume
*
vol
,
loff_t
fpos
,
static
inline
int
ntfs_filldir
(
ntfs_volume
*
vol
,
ntfs_inode
*
ndir
,
struct
page
*
ia_page
,
INDEX_ENTRY
*
ie
,
u8
*
name
,
void
*
dirent
,
filldir_t
filldi
r
)
u8
*
name
,
struct
dir_context
*
acto
r
)
{
unsigned
long
mref
;
int
name_len
,
rc
;
int
name_len
;
unsigned
dt_type
;
FILE_NAME_TYPE_FLAGS
name_type
;
...
...
@@ -1068,13 +1066,14 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t fpos,
if
(
ia_page
)
unlock_page
(
ia_page
);
ntfs_debug
(
"Calling filldir for %s with len %i, fpos 0x%llx, inode "
"0x%lx, DT_%s."
,
name
,
name_len
,
f
pos
,
mref
,
"0x%lx, DT_%s."
,
name
,
name_len
,
actor
->
pos
,
mref
,
dt_type
==
DT_DIR
?
"DIR"
:
"REG"
);
rc
=
filldir
(
dirent
,
name
,
name_len
,
fpos
,
mref
,
dt_type
);
if
(
!
dir_emit
(
actor
,
name
,
name_len
,
mref
,
dt_type
))
return
1
;
/* Relock the page but not if we are aborting ->readdir. */
if
(
!
rc
&&
ia_page
)
if
(
ia_page
)
lock_page
(
ia_page
);
return
rc
;
return
0
;
}
/*
...
...
@@ -1097,11 +1096,11 @@ static inline int ntfs_filldir(ntfs_volume *vol, loff_t fpos,
* removes them again after the write is complete after which it
* unlocks the page.
*/
static
int
ntfs_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldi
r
)
static
int
ntfs_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
acto
r
)
{
s64
ia_pos
,
ia_start
,
prev_ia_pos
,
bmp_pos
;
loff_t
fpos
,
i_size
;
struct
inode
*
bmp_vi
,
*
vdir
=
file_inode
(
fil
p
);
loff_t
i_size
;
struct
inode
*
bmp_vi
,
*
vdir
=
file_inode
(
fil
e
);
struct
super_block
*
sb
=
vdir
->
i_sb
;
ntfs_inode
*
ndir
=
NTFS_I
(
vdir
);
ntfs_volume
*
vol
=
NTFS_SB
(
sb
);
...
...
@@ -1116,33 +1115,16 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
u8
*
kaddr
,
*
bmp
,
*
index_end
;
ntfs_attr_search_ctx
*
ctx
;
fpos
=
filp
->
f_pos
;
ntfs_debug
(
"Entering for inode 0x%lx, fpos 0x%llx."
,
vdir
->
i_ino
,
f
pos
);
vdir
->
i_ino
,
actor
->
pos
);
rc
=
err
=
0
;
/* Are we at end of dir yet? */
i_size
=
i_size_read
(
vdir
);
if
(
f
pos
>=
i_size
+
vol
->
mft_record_size
)
goto
done
;
if
(
actor
->
pos
>=
i_size
+
vol
->
mft_record_size
)
return
0
;
/* Emulate . and .. for all directories. */
if
(
!
fpos
)
{
ntfs_debug
(
"Calling filldir for . with len 1, fpos 0x0, "
"inode 0x%lx, DT_DIR."
,
vdir
->
i_ino
);
rc
=
filldir
(
dirent
,
"."
,
1
,
fpos
,
vdir
->
i_ino
,
DT_DIR
);
if
(
rc
)
goto
done
;
fpos
++
;
}
if
(
fpos
==
1
)
{
ntfs_debug
(
"Calling filldir for .. with len 2, fpos 0x1, "
"inode 0x%lx, DT_DIR."
,
(
unsigned
long
)
parent_ino
(
filp
->
f_path
.
dentry
));
rc
=
filldir
(
dirent
,
".."
,
2
,
fpos
,
parent_ino
(
filp
->
f_path
.
dentry
),
DT_DIR
);
if
(
rc
)
goto
done
;
fpos
++
;
}
if
(
!
dir_emit_dots
(
file
,
actor
))
return
0
;
m
=
NULL
;
ctx
=
NULL
;
/*
...
...
@@ -1155,7 +1137,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto
err_out
;
}
/* Are we jumping straight into the index allocation attribute? */
if
(
f
pos
>=
vol
->
mft_record_size
)
if
(
actor
->
pos
>=
vol
->
mft_record_size
)
goto
skip_index_root
;
/* Get hold of the mft record for the directory. */
m
=
map_mft_record
(
ndir
);
...
...
@@ -1170,7 +1152,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
goto
err_out
;
}
/* Get the offset into the index root attribute. */
ir_pos
=
(
s64
)
f
pos
;
ir_pos
=
(
s64
)
actor
->
pos
;
/* Find the index root attribute in the mft record. */
err
=
ntfs_attr_lookup
(
AT_INDEX_ROOT
,
I30
,
4
,
CASE_SENSITIVE
,
0
,
NULL
,
0
,
ctx
);
...
...
@@ -1226,10 +1208,9 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
ir_pos
>
(
u8
*
)
ie
-
(
u8
*
)
ir
)
continue
;
/* Advance the position even if going to skip the entry. */
f
pos
=
(
u8
*
)
ie
-
(
u8
*
)
ir
;
actor
->
pos
=
(
u8
*
)
ie
-
(
u8
*
)
ir
;
/* Submit the name to the filldir callback. */
rc
=
ntfs_filldir
(
vol
,
fpos
,
ndir
,
NULL
,
ie
,
name
,
dirent
,
filldir
);
rc
=
ntfs_filldir
(
vol
,
ndir
,
NULL
,
ie
,
name
,
actor
);
if
(
rc
)
{
kfree
(
ir
);
goto
abort
;
...
...
@@ -1242,12 +1223,12 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
!
NInoIndexAllocPresent
(
ndir
))
goto
EOD
;
/* Advance fpos to the beginning of the index allocation. */
f
pos
=
vol
->
mft_record_size
;
actor
->
pos
=
vol
->
mft_record_size
;
skip_index_root:
kaddr
=
NULL
;
prev_ia_pos
=
-
1LL
;
/* Get the offset into the index allocation attribute. */
ia_pos
=
(
s64
)
f
pos
-
vol
->
mft_record_size
;
ia_pos
=
(
s64
)
actor
->
pos
-
vol
->
mft_record_size
;
ia_mapping
=
vdir
->
i_mapping
;
ntfs_debug
(
"Inode 0x%lx, getting index bitmap."
,
vdir
->
i_ino
);
bmp_vi
=
ntfs_attr_iget
(
vdir
,
AT_BITMAP
,
I30
,
4
);
...
...
@@ -1409,7 +1390,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
ia_pos
-
ia_start
>
(
u8
*
)
ie
-
(
u8
*
)
ia
)
continue
;
/* Advance the position even if going to skip the entry. */
f
pos
=
(
u8
*
)
ie
-
(
u8
*
)
ia
+
actor
->
pos
=
(
u8
*
)
ie
-
(
u8
*
)
ia
+
(
sle64_to_cpu
(
ia
->
index_block_vcn
)
<<
ndir
->
itype
.
index
.
vcn_size_bits
)
+
vol
->
mft_record_size
;
...
...
@@ -1419,8 +1400,7 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
* before returning, unless a non-zero value is returned in
* which case the page is left unlocked.
*/
rc
=
ntfs_filldir
(
vol
,
fpos
,
ndir
,
ia_page
,
ie
,
name
,
dirent
,
filldir
);
rc
=
ntfs_filldir
(
vol
,
ndir
,
ia_page
,
ie
,
name
,
actor
);
if
(
rc
)
{
/* @ia_page is already unlocked in this case. */
ntfs_unmap_page
(
ia_page
);
...
...
@@ -1439,18 +1419,9 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
iput
(
bmp_vi
);
EOD:
/* We are finished, set fpos to EOD. */
f
pos
=
i_size
+
vol
->
mft_record_size
;
actor
->
pos
=
i_size
+
vol
->
mft_record_size
;
abort:
kfree
(
name
);
done:
#ifdef DEBUG
if
(
!
rc
)
ntfs_debug
(
"EOD, fpos 0x%llx, returning 0."
,
fpos
);
else
ntfs_debug
(
"filldir returned %i, fpos 0x%llx, returning 0."
,
rc
,
fpos
);
#endif
filp
->
f_pos
=
fpos
;
return
0
;
err_out:
if
(
bmp_page
)
{
...
...
@@ -1471,7 +1442,6 @@ static int ntfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
!
err
)
err
=
-
EIO
;
ntfs_debug
(
"Failed. Returning error code %i."
,
-
err
);
filp
->
f_pos
=
fpos
;
return
err
;
}
...
...
@@ -1571,7 +1541,7 @@ static int ntfs_dir_fsync(struct file *filp, loff_t start, loff_t end,
const
struct
file_operations
ntfs_dir_ops
=
{
.
llseek
=
generic_file_llseek
,
/* Seek inside directory. */
.
read
=
generic_read_dir
,
/* Return -EISDIR. */
.
readdir
=
ntfs_readdir
,
/* Read directory contents. */
.
iterate
=
ntfs_readdir
,
/* Read directory contents. */
#ifdef NTFS_RW
.
fsync
=
ntfs_dir_fsync
,
/* Sync a directory to disk. */
/*.aio_fsync = ,*/
/* Sync all outstanding async
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录