You've already forked mariadb-columnstore-engine
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:
@ -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
|
||||
|
Reference in New Issue
Block a user