make all of the FuseChannel handler methods private

Summary:
Only the FuseChannel code should invoke the handler methods.  This makes them
all private.

This did require making handlerMap be a private static member variable of
FuseChannel so that it can access these methods during its initialization.

Reviewed By: wez

Differential Revision: D7126002

fbshipit-source-id: 28c421173cb6cf8b7a8e1ca085ad78ec9ea76b8f
This commit is contained in:
Adam Simpkins 2018-03-09 16:24:40 -08:00 committed by Facebook Github Bot
parent bbb0b0cc0e
commit 0ac8eda5c8
2 changed files with 19 additions and 13 deletions

View File

@ -128,12 +128,14 @@ StringPiece fuseOpcodeName(FuseOpcode opcode) {
using Handler = folly::Future<folly::Unit> (
FuseChannel::*)(const fuse_in_header* header, const uint8_t* arg);
struct HandlerEntry {
} // namespace
struct FuseChannel::HandlerEntry {
Handler handler;
EdenStats::HistogramPtr histogram;
};
const std::unordered_map<uint32_t, HandlerEntry> handlerMap = {
const FuseChannel::HandlerMap FuseChannel::handlerMap = {
{FUSE_READ, {&FuseChannel::fuseRead, &EdenStats::read}},
{FUSE_WRITE, {&FuseChannel::fuseWrite, &EdenStats::write}},
{FUSE_LOOKUP, {&FuseChannel::fuseLookup, &EdenStats::lookup}},
@ -168,7 +170,6 @@ const std::unordered_map<uint32_t, HandlerEntry> handlerMap = {
{FUSE_BATCH_FORGET,
{&FuseChannel::fuseBatchForget, &EdenStats::forgetmulti}},
};
} // namespace
static iovec inline make_iovec(const void* addr, size_t len) {
iovec iov;

View File

@ -187,6 +187,21 @@ class FuseChannel {
*/
void finishRequest(const fuse_in_header& header);
/**
* Returns a Future that will complete when all of the
* fuse threads have been joined and when all pending
* fuse requests initiated by the kernel have been
* responded to.
* Will throw if called more than once.
*/
folly::Future<folly::Unit> getSessionCompleteFuture();
private:
struct HandlerEntry;
using HandlerMap = std::unordered_map<uint32_t, HandlerEntry>;
static const HandlerMap handlerMap;
folly::Future<folly::Unit> fuseRead(
const fuse_in_header* header,
const uint8_t* arg);
@ -281,16 +296,6 @@ class FuseChannel {
const fuse_in_header* header,
const uint8_t* arg);
/**
* Returns a Future that will complete when all of the
* fuse threads have been joined and when all pending
* fuse requests initiated by the kernel have been
* responded to.
* Will throw if called more than once.
*/
folly::Future<folly::Unit> getSessionCompleteFuture();
private:
void fuseWorkerThread(size_t threadNumber);
void maybeDispatchSessionComplete();
void readInitPacket();