mirror of
https://github.com/facebook/sapling.git
synced 2024-10-07 15:27:13 +03:00
refactor readdirplus dispatcher code
Summary: make changes mentioned in D32771629 (b984929850
) comments
Reviewed By: genevievehelsel
Differential Revision: D33146983
fbshipit-source-id: 10a3dc34317f525adf29cf902dd7037e4f80c396
This commit is contained in:
parent
e79d41cc77
commit
a742a22db7
@ -301,20 +301,11 @@ ImmediateFuture<NfsDispatcher::ReaddirRes> NfsDispatcherImpl::readdirplus(
|
||||
auto& dirListRef = dirList.getListRef();
|
||||
std::vector<ImmediateFuture<folly::Unit>> futuresVec{};
|
||||
for (auto& entry : dirListRef) {
|
||||
if (entry.name == ".") {
|
||||
if (entry.name == "." || entry.name == "..") {
|
||||
futuresVec.push_back(
|
||||
this->getattr(InodeNumber{entry.fileid}, context)
|
||||
.thenValue([&entry](struct stat st) {
|
||||
entry.name_attributes =
|
||||
statToPostOpAttr(folly::Try<struct stat>(st));
|
||||
return folly::unit;
|
||||
}));
|
||||
} else if (entry.name == "..") {
|
||||
futuresVec.push_back(
|
||||
this->getattr(InodeNumber{entry.fileid}, context)
|
||||
.thenValue([&entry](struct stat st) {
|
||||
entry.name_attributes =
|
||||
statToPostOpAttr(folly::Try<struct stat>(st));
|
||||
.thenTry([&entry](folly::Try<struct stat> st) {
|
||||
entry.name_attributes = statToPostOpAttr(st);
|
||||
return folly::unit;
|
||||
}));
|
||||
} else {
|
||||
@ -323,9 +314,8 @@ ImmediateFuture<NfsDispatcher::ReaddirRes> NfsDispatcherImpl::readdirplus(
|
||||
.thenValue([entry, &context](InodePtr&& inodep) {
|
||||
return inodep->stat(context);
|
||||
})
|
||||
.thenValue([&entry](struct stat st) {
|
||||
entry.name_attributes =
|
||||
statToPostOpAttr(folly::Try<struct stat>(st));
|
||||
.thenTry([&entry](folly::Try<struct stat> st) {
|
||||
entry.name_attributes = statToPostOpAttr(st);
|
||||
return folly::unit;
|
||||
}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user