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
Kirill Smelkov
linux
Commits
8d3af7f3
Commit
8d3af7f3
authored
May 18, 2013
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[readdir] convert fuse
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
568f8f5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
20 deletions
+17
-20
fs/fuse/dir.c
fs/fuse/dir.c
+17
-20
No files found.
fs/fuse/dir.c
View file @
8d3af7f3
...
...
@@ -14,7 +14,7 @@
#include <linux/namei.h>
#include <linux/slab.h>
static
bool
fuse_use_readdirplus
(
struct
inode
*
dir
,
struct
file
*
filp
)
static
bool
fuse_use_readdirplus
(
struct
inode
*
dir
,
struct
dir_context
*
ctx
)
{
struct
fuse_conn
*
fc
=
get_fuse_conn
(
dir
);
struct
fuse_inode
*
fi
=
get_fuse_inode
(
dir
);
...
...
@@ -25,7 +25,7 @@ static bool fuse_use_readdirplus(struct inode *dir, struct file *filp)
return
true
;
if
(
test_and_clear_bit
(
FUSE_I_ADVISE_RDPLUS
,
&
fi
->
state
))
return
true
;
if
(
filp
->
f_
pos
==
0
)
if
(
ctx
->
pos
==
0
)
return
true
;
return
false
;
}
...
...
@@ -1165,25 +1165,23 @@ static int fuse_permission(struct inode *inode, int mask)
}
static
int
parse_dirfile
(
char
*
buf
,
size_t
nbytes
,
struct
file
*
file
,
void
*
dstbuf
,
filldir_t
filldir
)
struct
dir_context
*
ctx
)
{
while
(
nbytes
>=
FUSE_NAME_OFFSET
)
{
struct
fuse_dirent
*
dirent
=
(
struct
fuse_dirent
*
)
buf
;
size_t
reclen
=
FUSE_DIRENT_SIZE
(
dirent
);
int
over
;
if
(
!
dirent
->
namelen
||
dirent
->
namelen
>
FUSE_NAME_MAX
)
return
-
EIO
;
if
(
reclen
>
nbytes
)
break
;
over
=
filldir
(
dstbuf
,
dirent
->
name
,
dirent
->
namelen
,
file
->
f_pos
,
dirent
->
ino
,
dirent
->
type
);
if
(
over
)
if
(
!
dir_emit
(
ctx
,
dirent
->
name
,
dirent
->
namelen
,
dirent
->
ino
,
dirent
->
type
))
break
;
buf
+=
reclen
;
nbytes
-=
reclen
;
file
->
f_
pos
=
dirent
->
off
;
ctx
->
pos
=
dirent
->
off
;
}
return
0
;
...
...
@@ -1284,7 +1282,7 @@ static int fuse_direntplus_link(struct file *file,
}
static
int
parse_dirplusfile
(
char
*
buf
,
size_t
nbytes
,
struct
file
*
file
,
void
*
dstbuf
,
filldir_t
filldir
,
u64
attr_version
)
struct
dir_context
*
ctx
,
u64
attr_version
)
{
struct
fuse_direntplus
*
direntplus
;
struct
fuse_dirent
*
dirent
;
...
...
@@ -1309,10 +1307,9 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file,
we need to send a FORGET for each of those
which we did not link.
*/
over
=
filldir
(
dstbuf
,
dirent
->
name
,
dirent
->
namelen
,
file
->
f_pos
,
dirent
->
ino
,
dirent
->
type
);
file
->
f_pos
=
dirent
->
off
;
over
=
!
dir_emit
(
ctx
,
dirent
->
name
,
dirent
->
namelen
,
dirent
->
ino
,
dirent
->
type
);
ctx
->
pos
=
dirent
->
off
;
}
buf
+=
reclen
;
...
...
@@ -1326,7 +1323,7 @@ static int parse_dirplusfile(char *buf, size_t nbytes, struct file *file,
return
0
;
}
static
int
fuse_readdir
(
struct
file
*
file
,
void
*
dstbuf
,
filldir_t
filldir
)
static
int
fuse_readdir
(
struct
file
*
file
,
struct
dir_context
*
ctx
)
{
int
plus
,
err
;
size_t
nbytes
;
...
...
@@ -1349,17 +1346,17 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
return
-
ENOMEM
;
}
plus
=
fuse_use_readdirplus
(
inode
,
file
);
plus
=
fuse_use_readdirplus
(
inode
,
ctx
);
req
->
out
.
argpages
=
1
;
req
->
num_pages
=
1
;
req
->
pages
[
0
]
=
page
;
req
->
page_descs
[
0
].
length
=
PAGE_SIZE
;
if
(
plus
)
{
attr_version
=
fuse_get_attr_version
(
fc
);
fuse_read_fill
(
req
,
file
,
file
->
f_
pos
,
PAGE_SIZE
,
fuse_read_fill
(
req
,
file
,
ctx
->
pos
,
PAGE_SIZE
,
FUSE_READDIRPLUS
);
}
else
{
fuse_read_fill
(
req
,
file
,
file
->
f_
pos
,
PAGE_SIZE
,
fuse_read_fill
(
req
,
file
,
ctx
->
pos
,
PAGE_SIZE
,
FUSE_READDIR
);
}
fuse_request_send
(
fc
,
req
);
...
...
@@ -1369,11 +1366,11 @@ static int fuse_readdir(struct file *file, void *dstbuf, filldir_t filldir)
if
(
!
err
)
{
if
(
plus
)
{
err
=
parse_dirplusfile
(
page_address
(
page
),
nbytes
,
file
,
dstbuf
,
filldir
,
file
,
ctx
,
attr_version
);
}
else
{
err
=
parse_dirfile
(
page_address
(
page
),
nbytes
,
file
,
dstbuf
,
filldir
);
ctx
);
}
}
...
...
@@ -1886,7 +1883,7 @@ static const struct inode_operations fuse_dir_inode_operations = {
static
const
struct
file_operations
fuse_dir_operations
=
{
.
llseek
=
generic_file_llseek
,
.
read
=
generic_read_dir
,
.
readdir
=
fuse_readdir
,
.
iterate
=
fuse_readdir
,
.
open
=
fuse_dir_open
,
.
release
=
fuse_dir_release
,
.
fsync
=
fuse_dir_fsync
,
...
...
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