Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
1616abe8
Commit
1616abe8
authored
May 16, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[readdir] convert nilfs2
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
d55fea8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
30 deletions
+18
-30
fs/nilfs2/dir.c
fs/nilfs2/dir.c
+18
-30
No files found.
fs/nilfs2/dir.c
View file @
1616abe8
...
@@ -256,22 +256,18 @@ static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode *inode)
...
@@ -256,22 +256,18 @@ static void nilfs_set_de_type(struct nilfs_dir_entry *de, struct inode *inode)
de
->
file_type
=
nilfs_type_by_mode
[(
mode
&
S_IFMT
)
>>
S_SHIFT
];
de
->
file_type
=
nilfs_type_by_mode
[(
mode
&
S_IFMT
)
>>
S_SHIFT
];
}
}
static
int
nilfs_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
)
static
int
nilfs_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
)
{
{
loff_t
pos
=
filp
->
f_
pos
;
loff_t
pos
=
ctx
->
pos
;
struct
inode
*
inode
=
file_inode
(
fil
p
);
struct
inode
*
inode
=
file_inode
(
fil
e
);
struct
super_block
*
sb
=
inode
->
i_sb
;
struct
super_block
*
sb
=
inode
->
i_sb
;
unsigned
int
offset
=
pos
&
~
PAGE_CACHE_MASK
;
unsigned
int
offset
=
pos
&
~
PAGE_CACHE_MASK
;
unsigned
long
n
=
pos
>>
PAGE_CACHE_SHIFT
;
unsigned
long
n
=
pos
>>
PAGE_CACHE_SHIFT
;
unsigned
long
npages
=
dir_pages
(
inode
);
unsigned
long
npages
=
dir_pages
(
inode
);
/* unsigned chunk_mask = ~(nilfs_chunk_size(inode)-1); */
/* unsigned chunk_mask = ~(nilfs_chunk_size(inode)-1); */
unsigned
char
*
types
=
NULL
;
int
ret
;
if
(
pos
>
inode
->
i_size
-
NILFS_DIR_REC_LEN
(
1
))
if
(
pos
>
inode
->
i_size
-
NILFS_DIR_REC_LEN
(
1
))
goto
success
;
return
0
;
types
=
nilfs_filetype_table
;
for
(
;
n
<
npages
;
n
++
,
offset
=
0
)
{
for
(
;
n
<
npages
;
n
++
,
offset
=
0
)
{
char
*
kaddr
,
*
limit
;
char
*
kaddr
,
*
limit
;
...
@@ -281,9 +277,8 @@ static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -281,9 +277,8 @@ static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
IS_ERR
(
page
))
{
if
(
IS_ERR
(
page
))
{
nilfs_error
(
sb
,
__func__
,
"bad page in #%lu"
,
nilfs_error
(
sb
,
__func__
,
"bad page in #%lu"
,
inode
->
i_ino
);
inode
->
i_ino
);
filp
->
f_pos
+=
PAGE_CACHE_SIZE
-
offset
;
ctx
->
pos
+=
PAGE_CACHE_SIZE
-
offset
;
ret
=
-
EIO
;
return
-
EIO
;
goto
done
;
}
}
kaddr
=
page_address
(
page
);
kaddr
=
page_address
(
page
);
de
=
(
struct
nilfs_dir_entry
*
)(
kaddr
+
offset
);
de
=
(
struct
nilfs_dir_entry
*
)(
kaddr
+
offset
);
...
@@ -293,35 +288,28 @@ static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
...
@@ -293,35 +288,28 @@ static int nilfs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
de
->
rec_len
==
0
)
{
if
(
de
->
rec_len
==
0
)
{
nilfs_error
(
sb
,
__func__
,
nilfs_error
(
sb
,
__func__
,
"zero-length directory entry"
);
"zero-length directory entry"
);
ret
=
-
EIO
;
nilfs_put_page
(
page
);
nilfs_put_page
(
page
);
goto
done
;
return
-
EIO
;
}
}
if
(
de
->
inode
)
{
if
(
de
->
inode
)
{
int
over
;
unsigned
char
t
;
unsigned
char
d_type
=
DT_UNKNOWN
;
if
(
types
&&
de
->
file_type
<
NILFS_FT_MAX
)
if
(
de
->
file_type
<
NILFS_FT_MAX
)
d_type
=
types
[
de
->
file_type
];
t
=
nilfs_filetype_table
[
de
->
file_type
];
else
t
=
DT_UNKNOWN
;
offset
=
(
char
*
)
de
-
kaddr
;
if
(
!
dir_emit
(
ctx
,
de
->
name
,
de
->
name_len
,
over
=
filldir
(
dirent
,
de
->
name
,
de
->
name_len
,
le64_to_cpu
(
de
->
inode
),
t
))
{
(
n
<<
PAGE_CACHE_SHIFT
)
|
offset
,
le64_to_cpu
(
de
->
inode
),
d_type
);
if
(
over
)
{
nilfs_put_page
(
page
);
nilfs_put_page
(
page
);
goto
success
;
return
0
;
}
}
}
}
filp
->
f_
pos
+=
nilfs_rec_len_from_disk
(
de
->
rec_len
);
ctx
->
pos
+=
nilfs_rec_len_from_disk
(
de
->
rec_len
);
}
}
nilfs_put_page
(
page
);
nilfs_put_page
(
page
);
}
}
return
0
;
success:
ret
=
0
;
done:
return
ret
;
}
}
/*
/*
...
@@ -678,7 +666,7 @@ int nilfs_empty_dir(struct inode *inode)
...
@@ -678,7 +666,7 @@ int nilfs_empty_dir(struct inode *inode)
const
struct
file_operations
nilfs_dir_operations
=
{
const
struct
file_operations
nilfs_dir_operations
=
{
.
llseek
=
generic_file_llseek
,
.
llseek
=
generic_file_llseek
,
.
read
=
generic_read_dir
,
.
read
=
generic_read_dir
,
.
readdir
=
nilfs_readdir
,
.
iterate
=
nilfs_readdir
,
.
unlocked_ioctl
=
nilfs_ioctl
,
.
unlocked_ioctl
=
nilfs_ioctl
,
#ifdef CONFIG_COMPAT
#ifdef CONFIG_COMPAT
.
compat_ioctl
=
nilfs_compat_ioctl
,
.
compat_ioctl
=
nilfs_compat_ioctl
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment