rename DType to OsDType in preparation for creation of an enumeration

Summary:
enums and i16 are not serialization-compatible in Thrift, but we want
an enumeration with defined values for dtypes. Rename the existing
Dtype type to OsDtype in preparation for introducing the Dtype enum.

Reviewed By: simpkins

Differential Revision: D20974559

fbshipit-source-id: 5d9087a79e7fd59b99b257a99351a8287ba00b5f
This commit is contained in:
Chad Austin 2020-04-28 11:07:00 -07:00 committed by Facebook GitHub Bot
parent 51dde1bcef
commit 9e4446bbee
2 changed files with 28 additions and 7 deletions

View File

@ -759,7 +759,7 @@ EdenServiceHandler::semifuture_getEntryInformation(
result.set_error(newEdenError(item.exception()));
} else {
EntryInformation info;
info.set_dtype(static_cast<DType>(item.value()));
info.set_dtype(static_cast<OsDtype>(item.value()));
result.set_info(info);
}
out->emplace_back(std::move(result));
@ -902,7 +902,7 @@ folly::Future<std::unique_ptr<Glob>> EdenServiceHandler::future_globFiles(
entry.name.stringPiece().toString());
if (wantDtype) {
out->dtypes.emplace_back(static_cast<DType>(entry.dtype));
out->dtypes.emplace_back(static_cast<OsDtype>(entry.dtype));
}
}
}

View File

@ -196,7 +196,7 @@ struct TimeSpec {
* objects from source control.
*/
struct EntryInformation {
1: DType dtype
1: OsDtype dtype
}
union EntryInformationOrError {
@ -565,12 +565,33 @@ struct GetConfigParams {
eden_config.ConfigReloadBehavior.AutoReload
}
/** A representation of the system-dependent dirent::d_type field.
/**
* A representation of the system-dependent dirent::d_type field.
* The bits and their interpretation is system dependent.
* This value is u8 on all systems that implement it. We
* use i16 to pass this through thrift, which doesn't have unsigned
* numbers */
typedef i16 DType
* numbers
*/
typedef i16 OsDtype
/*
* These numbers match up with Linux and macOS.
* Windows doesn't have dtype_t, but a subset of these map to and from
* the GetFileType and dwFileAttributes equivalents.
*
* Dtype and OsDtype can be cast between each other on all platforms.
enum Dtype {
UNKNOWN = 0
FIFO = 1 // DT_FIFO
CHAR = 2 // DT_CHR
DIR = 4 // DT_DIR
BLOCK = 6 // DT_BLK
REGULAR = 8 // DT_REG
LINK = 10 // DT_LNK
SOCKET = 12 // DT_SOCK
WHITEOUT = 14 // DT_WHT
}
*/
/** Params for globFiles(). */
struct GlobParams {
@ -591,7 +612,7 @@ struct Glob {
* sorted.
*/
1: list<PathString> matchingFiles,
2: list<DType> dtypes,
2: list<OsDtype> dtypes,
}
struct AccessCounts {