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
75811d4f
Commit
75811d4f
authored
May 16, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[readdir] convert exofs
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
81b9f66e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
22 deletions
+16
-22
fs/exofs/dir.c
fs/exofs/dir.c
+16
-22
No files found.
fs/exofs/dir.c
View file @
75811d4f
...
...
@@ -239,22 +239,19 @@ void exofs_set_de_type(struct exofs_dir_entry *de, struct inode *inode)
}
static
int
exofs_readdir
(
struct
file
*
fil
p
,
void
*
dirent
,
filldir_t
filldir
)
exofs_readdir
(
struct
file
*
fil
e
,
struct
dir_context
*
ctx
)
{
loff_t
pos
=
filp
->
f_
pos
;
struct
inode
*
inode
=
file_inode
(
fil
p
);
loff_t
pos
=
ctx
->
pos
;
struct
inode
*
inode
=
file_inode
(
fil
e
);
unsigned
int
offset
=
pos
&
~
PAGE_CACHE_MASK
;
unsigned
long
n
=
pos
>>
PAGE_CACHE_SHIFT
;
unsigned
long
npages
=
dir_pages
(
inode
);
unsigned
chunk_mask
=
~
(
exofs_chunk_size
(
inode
)
-
1
);
unsigned
char
*
types
=
NULL
;
int
need_revalidate
=
(
filp
->
f_version
!=
inode
->
i_version
);
int
need_revalidate
=
(
file
->
f_version
!=
inode
->
i_version
);
if
(
pos
>
inode
->
i_size
-
EXOFS_DIR_REC_LEN
(
1
))
return
0
;
types
=
exofs_filetype_table
;
for
(
;
n
<
npages
;
n
++
,
offset
=
0
)
{
char
*
kaddr
,
*
limit
;
struct
exofs_dir_entry
*
de
;
...
...
@@ -263,7 +260,7 @@ exofs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
IS_ERR
(
page
))
{
EXOFS_ERR
(
"ERROR: bad page in directory(0x%lx)
\n
"
,
inode
->
i_ino
);
filp
->
f_
pos
+=
PAGE_CACHE_SIZE
-
offset
;
ctx
->
pos
+=
PAGE_CACHE_SIZE
-
offset
;
return
PTR_ERR
(
page
);
}
kaddr
=
page_address
(
page
);
...
...
@@ -271,9 +268,9 @@ exofs_readdir(struct file *filp, void *dirent, filldir_t filldir)
if
(
offset
)
{
offset
=
exofs_validate_entry
(
kaddr
,
offset
,
chunk_mask
);
filp
->
f_
pos
=
(
n
<<
PAGE_CACHE_SHIFT
)
+
offset
;
ctx
->
pos
=
(
n
<<
PAGE_CACHE_SHIFT
)
+
offset
;
}
fil
p
->
f_version
=
inode
->
i_version
;
fil
e
->
f_version
=
inode
->
i_version
;
need_revalidate
=
0
;
}
de
=
(
struct
exofs_dir_entry
*
)(
kaddr
+
offset
);
...
...
@@ -288,27 +285,24 @@ exofs_readdir(struct file *filp, void *dirent, filldir_t filldir)
return
-
EIO
;
}
if
(
de
->
inode_no
)
{
int
over
;
unsigned
char
d_type
=
DT_UNKNOWN
;
unsigned
char
t
;
if
(
types
&&
de
->
file_type
<
EXOFS_FT_MAX
)
d_type
=
types
[
de
->
file_type
];
if
(
de
->
file_type
<
EXOFS_FT_MAX
)
t
=
exofs_filetype_table
[
de
->
file_type
];
else
t
=
DT_UNKNOWN
;
offset
=
(
char
*
)
de
-
kaddr
;
over
=
filldir
(
dirent
,
de
->
name
,
de
->
name_len
,
(
n
<<
PAGE_CACHE_SHIFT
)
|
offset
,
if
(
!
dir_emit
(
ctx
,
de
->
name
,
de
->
name_len
,
le64_to_cpu
(
de
->
inode_no
),
d_type
);
if
(
over
)
{
t
))
{
exofs_put_page
(
page
);
return
0
;
}
}
filp
->
f_
pos
+=
le16_to_cpu
(
de
->
rec_len
);
ctx
->
pos
+=
le16_to_cpu
(
de
->
rec_len
);
}
exofs_put_page
(
page
);
}
return
0
;
}
...
...
@@ -669,5 +663,5 @@ int exofs_empty_dir(struct inode *inode)
const
struct
file_operations
exofs_dir_operations
=
{
.
llseek
=
generic_file_llseek
,
.
read
=
generic_read_dir
,
.
readdir
=
exofs_readdir
,
.
iterate
=
exofs_readdir
,
};
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