1
0
mirror of https://github.com/mariadb-corporation/mariadb-columnstore-engine.git synced 2025-07-30 19:23:07 +03:00

clang format apply

This commit is contained in:
Leonid Fedorov
2022-01-21 16:43:49 +00:00
parent 6b6411229f
commit 04752ec546
1376 changed files with 393460 additions and 412662 deletions

View File

@ -15,7 +15,6 @@
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
MA 02110-1301, USA. */
#include "StatTask.h"
#include "messageFormat.h"
#include "SMLogging.h"
@ -29,7 +28,6 @@ using namespace std;
namespace storagemanager
{
StatTask::StatTask(int sock, uint len) : PosixTask(sock, len)
{
}
@ -39,53 +37,54 @@ StatTask::~StatTask()
}
#define check_error(msg, ret) \
if (success<0) \
{ \
handleError(msg, errno); \
return ret; \
}
if (success < 0) \
{ \
handleError(msg, errno); \
return ret; \
}
bool StatTask::run()
{
SMLogging* logger = SMLogging::get();
int success;
uint8_t buf[1024] = {0};
if (getLength() > 1023) {
handleError("StatTask read", ENAMETOOLONG);
return true;
}
success = read(buf, getLength());
check_error("StatTask read", false);
stat_cmd *cmd = (stat_cmd *) buf;
sm_response *resp = (sm_response *) buf;
#ifdef SM_TRACE
logger->log(LOG_DEBUG,"stat %s.",cmd->filename);
#endif
int err;
try
{
err = ioc->stat(cmd->filename, (struct stat *) resp->payload);
}
catch (exception &e)
{
logger->log(LOG_ERR, "StatTask: caught '%s'", e.what());
errno = EIO;
err = -1;
}
resp->returnCode = err;
uint payloadLen;
if (!err)
payloadLen = sizeof(struct stat);
else {
payloadLen = 4;
*((int32_t *) resp->payload) = errno;
}
return write(*resp, payloadLen);
}
SMLogging* logger = SMLogging::get();
int success;
uint8_t buf[1024] = {0};
if (getLength() > 1023)
{
handleError("StatTask read", ENAMETOOLONG);
return true;
}
success = read(buf, getLength());
check_error("StatTask read", false);
stat_cmd* cmd = (stat_cmd*)buf;
sm_response* resp = (sm_response*)buf;
#ifdef SM_TRACE
logger->log(LOG_DEBUG, "stat %s.", cmd->filename);
#endif
int err;
try
{
err = ioc->stat(cmd->filename, (struct stat*)resp->payload);
}
catch (exception& e)
{
logger->log(LOG_ERR, "StatTask: caught '%s'", e.what());
errno = EIO;
err = -1;
}
resp->returnCode = err;
uint payloadLen;
if (!err)
payloadLen = sizeof(struct stat);
else
{
payloadLen = 4;
*((int32_t*)resp->payload) = errno;
}
return write(*resp, payloadLen);
}
} // namespace storagemanager