lib/nfs/Connection: add Lstat
This commit is contained in:
parent
b03f05f28a
commit
a04e01d5f5
|
@ -53,6 +53,18 @@ NfsConnection::CancellableCallback::Stat(nfs_context *ctx,
|
|||
nfs_get_error(ctx));
|
||||
}
|
||||
|
||||
inline void
|
||||
NfsConnection::CancellableCallback::Lstat(nfs_context *ctx,
|
||||
const char *path)
|
||||
{
|
||||
assert(connection.GetEventLoop().IsInside());
|
||||
|
||||
int result = nfs_lstat64_async(ctx, path, Callback, this);
|
||||
if (result < 0)
|
||||
throw FormatRuntimeError("nfs_lstat64_async() failed: %s",
|
||||
nfs_get_error(ctx));
|
||||
}
|
||||
|
||||
inline void
|
||||
NfsConnection::CancellableCallback::OpenDirectory(nfs_context *ctx,
|
||||
const char *path)
|
||||
|
@ -231,6 +243,23 @@ NfsConnection::Stat(const char *path, NfsCallback &callback)
|
|||
ScheduleSocket();
|
||||
}
|
||||
|
||||
void
|
||||
NfsConnection::Lstat(const char *path, NfsCallback &callback)
|
||||
{
|
||||
assert(GetEventLoop().IsInside());
|
||||
assert(!callbacks.Contains(callback));
|
||||
|
||||
auto &c = callbacks.Add(callback, *this, false);
|
||||
try {
|
||||
c.Lstat(context, path);
|
||||
} catch (...) {
|
||||
callbacks.Remove(c);
|
||||
throw;
|
||||
}
|
||||
|
||||
ScheduleSocket();
|
||||
}
|
||||
|
||||
void
|
||||
NfsConnection::OpenDirectory(const char *path, NfsCallback &callback)
|
||||
{
|
||||
|
|
|
@ -66,6 +66,7 @@ class NfsConnection : SocketMonitor {
|
|||
open(_open), close_fh(nullptr) {}
|
||||
|
||||
void Stat(nfs_context *context, const char *path);
|
||||
void Lstat(nfs_context *context, const char *path);
|
||||
void OpenDirectory(nfs_context *context, const char *path);
|
||||
void Open(nfs_context *context, const char *path, int flags);
|
||||
void Stat(nfs_context *context, struct nfsfh *fh);
|
||||
|
@ -175,6 +176,7 @@ public:
|
|||
void RemoveLease(NfsLease &lease) noexcept;
|
||||
|
||||
void Stat(const char *path, NfsCallback &callback);
|
||||
void Lstat(const char *path, NfsCallback &callback);
|
||||
|
||||
void OpenDirectory(const char *path, NfsCallback &callback);
|
||||
const struct nfsdirent *ReadDirectory(struct nfsdir *dir) noexcept;
|
||||
|
|
Loading…
Reference in New Issue