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
61b3aaaa
Commit
61b3aaaa
authored
Oct 06, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lib/nfs/Connection: add method Stat(path)
parent
b5119d79
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
Connection.cxx
src/lib/nfs/Connection.cxx
+30
-0
Connection.hxx
src/lib/nfs/Connection.hxx
+3
-0
No files found.
src/lib/nfs/Connection.cxx
View file @
61b3aaaa
...
...
@@ -35,6 +35,21 @@ extern "C" {
#include <poll.h>
/* for POLLIN, POLLOUT */
inline
bool
NfsConnection
::
CancellableCallback
::
Stat
(
nfs_context
*
ctx
,
const
char
*
path
,
Error
&
error
)
{
int
result
=
nfs_stat_async
(
ctx
,
path
,
Callback
,
this
);
if
(
result
<
0
)
{
error
.
Format
(
nfs_domain
,
"nfs_stat_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
)
...
...
@@ -177,6 +192,21 @@ NfsConnection::RemoveLease(NfsLease &lease)
}
bool
NfsConnection
::
Stat
(
const
char
*
path
,
NfsCallback
&
callback
,
Error
&
error
)
{
assert
(
!
callbacks
.
Contains
(
callback
));
auto
&
c
=
callbacks
.
Add
(
callback
,
*
this
,
false
);
if
(
!
c
.
Stat
(
context
,
path
,
error
))
{
callbacks
.
Remove
(
c
);
return
false
;
}
ScheduleSocket
();
return
true
;
}
bool
NfsConnection
::
Open
(
const
char
*
path
,
int
flags
,
NfsCallback
&
callback
,
Error
&
error
)
{
...
...
src/lib/nfs/Connection.hxx
View file @
61b3aaaa
...
...
@@ -64,6 +64,8 @@ class NfsConnection : SocketMonitor, DeferredMonitor {
connection
(
_connection
),
open
(
_open
),
close_fh
(
nullptr
)
{}
bool
Stat
(
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
,
...
...
@@ -155,6 +157,7 @@ public:
void
AddLease
(
NfsLease
&
lease
);
void
RemoveLease
(
NfsLease
&
lease
);
bool
Stat
(
const
char
*
path
,
NfsCallback
&
callback
,
Error
&
error
);
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