From e69dfe53ae531a478966a3e17991adeb05fd0758 Mon Sep 17 00:00:00 2001 From: Camila Ayres Date: Thu, 13 Jun 2024 19:57:27 +0200 Subject: [PATCH] Add new cfapi callbacks for logging. Signed-off-by: Camila Ayres --- src/libsync/vfs/cfapi/cfapiwrapper.cpp | 48 ++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index 57707af4cf1e5..6138146532a59 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -373,9 +373,57 @@ void CALLBACK cfApiCancelFetchData(const CF_CALLBACK_INFO *callbackInfo, const C } } +void CALLBACK cfApiNotifyFileOpenCompletion(const CF_CALLBACK_INFO *callbackInfo, const CF_CALLBACK_PARAMETERS * /*callbackParameters*/) +{ + const auto path = QString(QString::fromWCharArray(callbackInfo->VolumeDosName) + QString::fromWCharArray(callbackInfo->NormalizedPath)); + + auto vfs = reinterpret_cast(callbackInfo->CallbackContext); + Q_ASSERT(vfs->metaObject()->className() == QByteArrayLiteral("OCC::VfsCfApi")); + const auto requestId = QString::number(callbackInfo->TransferKey.QuadPart, 16); + + qCDebug(lcCfApiWrapper) << "Open file completion:" << path << requestId; +} + +void CALLBACK cfApiValidateData(const CF_CALLBACK_INFO *callbackInfo, const CF_CALLBACK_PARAMETERS * /*callbackParameters*/) +{ + const auto path = QString(QString::fromWCharArray(callbackInfo->VolumeDosName) + QString::fromWCharArray(callbackInfo->NormalizedPath)); + + auto vfs = reinterpret_cast(callbackInfo->CallbackContext); + Q_ASSERT(vfs->metaObject()->className() == QByteArrayLiteral("OCC::VfsCfApi")); + const auto requestId = QString::number(callbackInfo->TransferKey.QuadPart, 16); + + qCDebug(lcCfApiWrapper) << "Validate data:" << path << requestId; +} + +void CALLBACK cfApiCancelFetchPlaceHolders(const CF_CALLBACK_INFO *callbackInfo, const CF_CALLBACK_PARAMETERS * /*callbackParameters*/) +{ + const auto path = QString(QString::fromWCharArray(callbackInfo->VolumeDosName) + QString::fromWCharArray(callbackInfo->NormalizedPath)); + + auto vfs = reinterpret_cast(callbackInfo->CallbackContext); + Q_ASSERT(vfs->metaObject()->className() == QByteArrayLiteral("OCC::VfsCfApi")); + const auto requestId = QString::number(callbackInfo->TransferKey.QuadPart, 16); + + qCDebug(lcCfApiWrapper) << "Cancel fetch placeholder:" << path << requestId; +} + +void CALLBACK cfApiNotifyFileCloseCompletion(const CF_CALLBACK_INFO *callbackInfo, const CF_CALLBACK_PARAMETERS * /*callbackParameters*/) +{ + const auto path = QString(QString::fromWCharArray(callbackInfo->VolumeDosName) + QString::fromWCharArray(callbackInfo->NormalizedPath)); + + auto vfs = reinterpret_cast(callbackInfo->CallbackContext); + Q_ASSERT(vfs->metaObject()->className() == QByteArrayLiteral("OCC::VfsCfApi")); + const auto requestId = QString::number(callbackInfo->TransferKey.QuadPart, 16); + + qCDebug(lcCfApiWrapper) << "Close file completion:" << path << requestId; +} + CF_CALLBACK_REGISTRATION cfApiCallbacks[] = { { CF_CALLBACK_TYPE_FETCH_DATA, cfApiFetchDataCallback }, { CF_CALLBACK_TYPE_CANCEL_FETCH_DATA, cfApiCancelFetchData }, + { CF_CALLBACK_TYPE_NOTIFY_FILE_OPEN_COMPLETION, cfApiNotifyFileOpenCompletion }, + { CF_CALLBACK_TYPE_NOTIFY_FILE_CLOSE_COMPLETION, cfApiNotifyFileCloseCompletion }, + { CF_CALLBACK_TYPE_VALIDATE_DATA, cfApiValidateData }, + { CF_CALLBACK_TYPE_CANCEL_FETCH_PLACEHOLDERS, cfApiCancelFetchPlaceHolders }, CF_CALLBACK_REGISTRATION_END };