Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
07b50f6c
Commit
07b50f6c
authored
Oct 06, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/nfs/Connection: add methods {Open,Read,Close}Directory()
parent
61b3aaaa
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
0 deletions
+53
-0
Connection.cxx
src/lib/nfs/Connection.cxx
+43
-0
Connection.hxx
src/lib/nfs/Connection.hxx
+10
-0
No files found.
src/lib/nfs/Connection.cxx
View file @
07b50f6c
...
...
@@ -50,6 +50,21 @@ NfsConnection::CancellableCallback::Stat(nfs_context *ctx,
}
inline
bool
NfsConnection
::
CancellableCallback
::
OpenDirectory
(
nfs_context
*
ctx
,
const
char
*
path
,
Error
&
error
)
{
int
result
=
nfs_opendir_async
(
ctx
,
path
,
Callback
,
this
);
if
(
result
<
0
)
{
error
.
Format
(
nfs_domain
,
"nfs_opendir_async() failed: %s"
,
nfs_get_error
(
ctx
));
return
false
;
}
return
true
;
}
inline
bool
NfsConnection
::
CancellableCallback
::
Open
(
nfs_context
*
ctx
,
const
char
*
path
,
int
flags
,
Error
&
error
)
...
...
@@ -207,6 +222,34 @@ NfsConnection::Stat(const char *path, NfsCallback &callback, Error &error)
}
bool
NfsConnection
::
OpenDirectory
(
const
char
*
path
,
NfsCallback
&
callback
,
Error
&
error
)
{
assert
(
!
callbacks
.
Contains
(
callback
));
auto
&
c
=
callbacks
.
Add
(
callback
,
*
this
,
true
);
if
(
!
c
.
OpenDirectory
(
context
,
path
,
error
))
{
callbacks
.
Remove
(
c
);
return
false
;
}
ScheduleSocket
();
return
true
;
}
const
struct
nfsdirent
*
NfsConnection
::
ReadDirectory
(
struct
nfsdir
*
dir
)
{
return
nfs_readdir
(
context
,
dir
);
}
void
NfsConnection
::
CloseDirectory
(
struct
nfsdir
*
dir
)
{
return
nfs_closedir
(
context
,
dir
);
}
bool
NfsConnection
::
Open
(
const
char
*
path
,
int
flags
,
NfsCallback
&
callback
,
Error
&
error
)
{
...
...
src/lib/nfs/Connection.hxx
View file @
07b50f6c
...
...
@@ -33,6 +33,8 @@
#include <forward_list>
struct
nfs_context
;
struct
nfsdir
;
struct
nfsdirent
;
class
NfsCallback
;
/**
...
...
@@ -66,6 +68,8 @@ class NfsConnection : SocketMonitor, DeferredMonitor {
bool
Stat
(
nfs_context
*
context
,
const
char
*
path
,
Error
&
error
);
bool
OpenDirectory
(
nfs_context
*
context
,
const
char
*
path
,
Error
&
error
);
bool
Open
(
nfs_context
*
context
,
const
char
*
path
,
int
flags
,
Error
&
error
);
bool
Stat
(
nfs_context
*
context
,
struct
nfsfh
*
fh
,
...
...
@@ -158,6 +162,12 @@ public:
void
RemoveLease
(
NfsLease
&
lease
);
bool
Stat
(
const
char
*
path
,
NfsCallback
&
callback
,
Error
&
error
);
bool
OpenDirectory
(
const
char
*
path
,
NfsCallback
&
callback
,
Error
&
error
);
const
struct
nfsdirent
*
ReadDirectory
(
struct
nfsdir
*
dir
);
void
CloseDirectory
(
struct
nfsdir
*
dir
);
bool
Open
(
const
char
*
path
,
int
flags
,
NfsCallback
&
callback
,
Error
&
error
);
bool
Stat
(
struct
nfsfh
*
fh
,
NfsCallback
&
callback
,
Error
&
error
);
...
...
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