New upstream version 8.1.0

This commit is contained in:
geos_one
2025-08-10 01:34:16 +02:00
commit c891bb7105
4398 changed files with 838833 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
#include "BumpFileVersion.h"
static void BumpFileVersionMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
struct BumpFileVersionMsg* msg = container_of(this, struct BumpFileVersionMsg, netMessage);
EntryInfo_serialize(ctx, msg->entryInfo);
if (this->msgHeader.msgFeatureFlags & BUMPFILEVERSIONMSG_FLAG_HASEVENT)
FileEvent_serialize(ctx, msg->fileEvent);
}
const struct NetMessageOps BumpFileVersionMsg_Ops = {
.serializePayload = BumpFileVersionMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};

View File

@@ -0,0 +1,38 @@
#ifndef BUMPFILEVERSIONMSG_H_
#define BUMPFILEVERSIONMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
#include <common/storage/FileEvent.h>
#define BUMPFILEVERSIONMSG_FLAG_PERSISTENT 1 /* change persistent file version number too */
#define BUMPFILEVERSIONMSG_FLAG_HASEVENT 2 /* has a loggable event attached */
/**
* Note: This message supports only serialization, deserialization is not implemented.
*/
struct BumpFileVersionMsg
{
NetMessage netMessage;
const EntryInfo* entryInfo;
const struct FileEvent* fileEvent;
};
extern const struct NetMessageOps BumpFileVersionMsg_Ops;
static inline void BumpFileVersionMsg_init(struct BumpFileVersionMsg* this,
const EntryInfo* entryInfo, bool persistent, const struct FileEvent* fileEvent)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_BumpFileVersion, &BumpFileVersionMsg_Ops);
this->entryInfo = entryInfo;
this->fileEvent = fileEvent;
if (persistent)
this->netMessage.msgHeader.msgFeatureFlags |= BUMPFILEVERSIONMSG_FLAG_PERSISTENT;
if (fileEvent)
this->netMessage.msgHeader.msgFeatureFlags |= BUMPFILEVERSIONMSG_FLAG_HASEVENT;
}
#endif

View File

@@ -0,0 +1,19 @@
#ifndef BUMPFILEVERSIONRESPMSG_H_
#define BUMPFILEVERSIONRESPMSG_H_
#include "../SimpleIntMsg.h"
typedef struct BumpFileVersionRespMsg BumpFileVersionRespMsg;
struct BumpFileVersionRespMsg
{
SimpleIntMsg base;
};
static inline void BumpFileVersionRespMsg_init(struct BumpFileVersionRespMsg* this)
{
SimpleIntMsg_init(&this->base, NETMSGTYPE_BumpFileVersionResp);
}
#endif

View File

@@ -0,0 +1,23 @@
#include "FSyncLocalFileMsg.h"
const struct NetMessageOps FSyncLocalFileMsg_Ops = {
.serializePayload = FSyncLocalFileMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
void FSyncLocalFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
FSyncLocalFileMsg* thisCast = (FSyncLocalFileMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// targetID
Serialization_serializeUShort(ctx, thisCast->targetID);
}

View File

@@ -0,0 +1,60 @@
#ifndef FSYNCLOCALFILEMSG_H_
#define FSYNCLOCALFILEMSG_H_
#include <common/net/message/NetMessage.h>
#define FSYNCLOCALFILEMSG_FLAG_NO_SYNC 1 /* if a sync is not needed */
#define FSYNCLOCALFILEMSG_FLAG_SESSION_CHECK 2 /* if session check should be done */
#define FSYNCLOCALFILEMSG_FLAG_BUDDYMIRROR 4 /* given targetID is a buddymirrorgroup ID */
#define FSYNCLOCALFILEMSG_FLAG_BUDDYMIRROR_SECOND 8 /* secondary of group, otherwise primary */
struct FSyncLocalFileMsg;
typedef struct FSyncLocalFileMsg FSyncLocalFileMsg;
static inline void FSyncLocalFileMsg_init(FSyncLocalFileMsg* this);
static inline void FSyncLocalFileMsg_initFromSession(FSyncLocalFileMsg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID);
// virtual functions
extern void FSyncLocalFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
/**
* Note: This message supports only serialization, deserialization is not implemented.
*/
struct FSyncLocalFileMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
uint16_t targetID;
};
extern const struct NetMessageOps FSyncLocalFileMsg_Ops;
void FSyncLocalFileMsg_init(FSyncLocalFileMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_FSyncLocalFile, &FSyncLocalFileMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
*/
void FSyncLocalFileMsg_initFromSession(FSyncLocalFileMsg* this, NumNodeID clientNumID,
const char* fileHandleID, uint16_t targetID)
{
FSyncLocalFileMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->targetID = targetID;
}
#endif /*FSYNCLOCALFILEMSG_H_*/

View File

@@ -0,0 +1,33 @@
#ifndef FSYNCLOCALFILERESPMSG_H_
#define FSYNCLOCALFILERESPMSG_H_
#include "../SimpleInt64Msg.h"
struct FSyncLocalFileRespMsg;
typedef struct FSyncLocalFileRespMsg FSyncLocalFileRespMsg;
static inline void FSyncLocalFileRespMsg_init(FSyncLocalFileRespMsg* this);
// getters & setters
static inline int64_t FSyncLocalFileRespMsg_getValue(FSyncLocalFileRespMsg* this);
struct FSyncLocalFileRespMsg
{
SimpleInt64Msg simpleInt64Msg;
};
void FSyncLocalFileRespMsg_init(FSyncLocalFileRespMsg* this)
{
SimpleInt64Msg_init( (SimpleInt64Msg*)this, NETMSGTYPE_FSyncLocalFileResp);
}
int64_t FSyncLocalFileRespMsg_getValue(FSyncLocalFileRespMsg* this)
{
return SimpleInt64Msg_getValue( (SimpleInt64Msg*)this);
}
#endif /*FSYNCLOCALFILERESPMSG_H_*/

View File

@@ -0,0 +1,15 @@
#include "GetFileVersionMsg.h"
static void GetFileVersionMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
struct GetFileVersionMsg* msg = container_of(this, struct GetFileVersionMsg, netMessage);
EntryInfo_serialize(ctx, msg->entryInfo);
}
const struct NetMessageOps GetFileVersionMsg_Ops = {
.serializePayload = GetFileVersionMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};

View File

@@ -0,0 +1,26 @@
#ifndef GETFILEVERSIONMSG_H_
#define GETFILEVERSIONMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
/**
* Note: This message supports only serialization, deserialization is not implemented.
*/
struct GetFileVersionMsg
{
NetMessage netMessage;
const EntryInfo* entryInfo;
};
extern const struct NetMessageOps GetFileVersionMsg_Ops;
static inline void GetFileVersionMsg_init(struct GetFileVersionMsg* this,
const EntryInfo* entryInfo)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_GetFileVersion, &GetFileVersionMsg_Ops);
this->entryInfo = entryInfo;
}
#endif

View File

@@ -0,0 +1,22 @@
#include "GetFileVersionRespMsg.h"
static bool GetFileVersionRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
{
struct GetFileVersionRespMsg* msg = container_of(this, struct GetFileVersionRespMsg, base);
int result;
if (!Serialization_deserializeInt(ctx, &result) ||
!Serialization_deserializeUInt(ctx, &msg->version))
return false;
msg->result = result;
return true;
}
const struct NetMessageOps GetFileVersionRespMsg_Ops = {
.serializePayload = _NetMessage_serializeDummy,
.deserializePayload = GetFileVersionRespMsg_deserializePayload,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};

View File

@@ -0,0 +1,24 @@
#ifndef GETFILEVERSIONRESPMSG_H_
#define GETFILEVERSIONRESPMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/StorageErrors.h>
typedef struct GetFileVersionRespMsg GetFileVersionRespMsg;
struct GetFileVersionRespMsg
{
NetMessage base;
FhgfsOpsErr result;
uint32_t version;
};
extern const struct NetMessageOps GetFileVersionRespMsg_Ops;
static inline void GetFileVersionRespMsg_init(struct GetFileVersionRespMsg* this)
{
NetMessage_init(&this->base, NETMSGTYPE_GetFileVersionResp, &GetFileVersionRespMsg_Ops);
}
#endif

View File

@@ -0,0 +1,35 @@
#include "FLockAppendMsg.h"
const struct NetMessageOps FLockAppendMsg_Ops = {
.serializePayload = FLockAppendMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
void FLockAppendMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
FLockAppendMsg* thisCast = (FLockAppendMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// clientFD
Serialization_serializeInt64(ctx, thisCast->clientFD);
// ownerPID
Serialization_serializeInt(ctx, thisCast->ownerPID);
// lockTypeFlags
Serialization_serializeInt(ctx, thisCast->lockTypeFlags);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// lockAckID
Serialization_serializeStrAlign4(ctx, thisCast->lockAckIDLen, thisCast->lockAckID);
}

View File

@@ -0,0 +1,73 @@
#ifndef FLOCKAPPENDMSG_H_
#define FLOCKAPPENDMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
/**
* This message is for serialiazation (outgoing) only, deserialization is not implemented!!
*/
struct FLockAppendMsg;
typedef struct FLockAppendMsg FLockAppendMsg;
static inline void FLockAppendMsg_init(FLockAppendMsg* this);
static inline void FLockAppendMsg_initFromSession(FLockAppendMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID);
// virtual functions
extern void FLockAppendMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct FLockAppendMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
const EntryInfo* entryInfoPtr; // not owned by this object
int64_t clientFD; /* client-wide unique identifier (typically not really the fd number)
* corresponds to 'struct file_lock* fileLock->fl_file on the client side'
*/
int ownerPID; // pid on client (just informative, because shared on fork() )
int lockTypeFlags; // ENTRYLOCKTYPE_...
const char* lockAckID; // ID for ack message when log is granted
unsigned lockAckIDLen;
};
extern const struct NetMessageOps FLockAppendMsg_Ops;
void FLockAppendMsg_init(FLockAppendMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_FLockAppend, &FLockAppendMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param entryInfo just a reference, so do not free it as long as you use this object!
*/
void FLockAppendMsg_initFromSession(FLockAppendMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID)
{
FLockAppendMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->entryInfoPtr = entryInfo;
this->clientFD = clientFD;
this->ownerPID = ownerPID;
this->lockTypeFlags = lockTypeFlags;
this->lockAckID = lockAckID;
this->lockAckIDLen = strlen(lockAckID);
}
#endif /* FLOCKAPPENDMSG_H_ */

View File

@@ -0,0 +1,27 @@
#ifndef FLOCKAPPENDRESPMSG_H_
#define FLOCKAPPENDRESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
#include <common/storage/StorageErrors.h>
/**
* This message is for deserialiazation (incoming) only, serialization is not implemented!!
*/
struct FLockAppendRespMsg;
typedef struct FLockAppendRespMsg FLockAppendRespMsg;
static inline void FLockAppendRespMsg_init(FLockAppendRespMsg* this);
struct FLockAppendRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void FLockAppendRespMsg_init(FLockAppendRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_FLockAppendResp);
}
#endif /* FLOCKAPPENDRESPMSG_H_ */

View File

@@ -0,0 +1,36 @@
#include "FLockEntryMsg.h"
const struct NetMessageOps FLockEntryMsg_Ops = {
.serializePayload = FLockEntryMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};
void FLockEntryMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
FLockEntryMsg* thisCast = (FLockEntryMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// clientFD
Serialization_serializeInt64(ctx, thisCast->clientFD);
// ownerPID
Serialization_serializeInt(ctx, thisCast->ownerPID);
// lockTypeFlags
Serialization_serializeInt(ctx, thisCast->lockTypeFlags);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// lockAckID
Serialization_serializeStrAlign4(ctx, thisCast->lockAckIDLen, thisCast->lockAckID);
}

View File

@@ -0,0 +1,73 @@
#ifndef FLOCKENTRYMSG_H_
#define FLOCKENTRYMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
/**
* This message is for serialiazation (outgoing) only, deserialization is not implemented!!
*/
struct FLockEntryMsg;
typedef struct FLockEntryMsg FLockEntryMsg;
static inline void FLockEntryMsg_init(FLockEntryMsg* this);
static inline void FLockEntryMsg_initFromSession(FLockEntryMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID);
// virtual functions
extern void FLockEntryMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct FLockEntryMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
const EntryInfo* entryInfoPtr; // not owned by this object
int64_t clientFD; /* client-wide unique identifier (typically not really the fd number)
* corresponds to 'struct file_lock* fileLock->fl_file on the client side'
*/
int ownerPID; // pid on client (just informative, because shared on fork() )
int lockTypeFlags; // ENTRYLOCKTYPE_...
const char* lockAckID; // ID for ack message when log is granted
unsigned lockAckIDLen;
};
extern const struct NetMessageOps FLockEntryMsg_Ops;
void FLockEntryMsg_init(FLockEntryMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_FLockEntry, &FLockEntryMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param entryInfo just a reference, so do not free it as long as you use this object!
*/
void FLockEntryMsg_initFromSession(FLockEntryMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int64_t clientFD, int ownerPID,
int lockTypeFlags, const char* lockAckID)
{
FLockEntryMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->entryInfoPtr = entryInfo;
this->clientFD = clientFD;
this->ownerPID = ownerPID;
this->lockTypeFlags = lockTypeFlags;
this->lockAckID = lockAckID;
this->lockAckIDLen = strlen(lockAckID);
}
#endif /* FLOCKENTRYMSG_H_ */

View File

@@ -0,0 +1,27 @@
#ifndef FLOCKENTRYRESPMSG_H_
#define FLOCKENTRYRESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
#include <common/storage/StorageErrors.h>
/**
* This message is for deserialiazation (incoming) only, serialization is not implemented!!
*/
struct FLockEntryRespMsg;
typedef struct FLockEntryRespMsg FLockEntryRespMsg;
static inline void FLockEntryRespMsg_init(FLockEntryRespMsg* this);
struct FLockEntryRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void FLockEntryRespMsg_init(FLockEntryRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_FLockEntryResp);
}
#endif /* FLOCKENTRYRESPMSG_H_ */

View File

@@ -0,0 +1,39 @@
#include "FLockRangeMsg.h"
const struct NetMessageOps FLockRangeMsg_Ops = {
.serializePayload = FLockRangeMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};
void FLockRangeMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
FLockRangeMsg* thisCast = (FLockRangeMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// start
Serialization_serializeUInt64(ctx, thisCast->start);
// end
Serialization_serializeUInt64(ctx, thisCast->end);
// ownerPID
Serialization_serializeInt(ctx, thisCast->ownerPID);
// lockTypeFlags
Serialization_serializeInt(ctx, thisCast->lockTypeFlags);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// lockAckID
Serialization_serializeStrAlign4(ctx, thisCast->lockAckIDLen, thisCast->lockAckID);
}

View File

@@ -0,0 +1,73 @@
#ifndef FLOCKRANGEMSG_H_
#define FLOCKRANGEMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
/**
* This message is for serialiazation (outgoing) only, deserialization is not implemented!!
*/
struct FLockRangeMsg;
typedef struct FLockRangeMsg FLockRangeMsg;
static inline void FLockRangeMsg_init(FLockRangeMsg* this);
static inline void FLockRangeMsg_initFromSession(FLockRangeMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo,
int ownerPID, int lockTypeFlags, uint64_t start, uint64_t end, const char* lockAckID);
// virtual functions
extern void FLockRangeMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct FLockRangeMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
const EntryInfo* entryInfoPtr; // not owned by this object
int ownerPID; // pid on client (just informative, because shared on fork() )
int lockTypeFlags; // ENTRYLOCKTYPE_...
uint64_t start;
uint64_t end;
const char* lockAckID; // ID for ack message when log is granted
unsigned lockAckIDLen;
};
extern const struct NetMessageOps FLockRangeMsg_Ops;
void FLockRangeMsg_init(FLockRangeMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_FLockRange, &FLockRangeMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param entryInfo just a reference, so do not free it as long as you use this object!
*/
void FLockRangeMsg_initFromSession(FLockRangeMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo,
int ownerPID, int lockTypeFlags, uint64_t start, uint64_t end, const char* lockAckID)
{
FLockRangeMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->entryInfoPtr = entryInfo;
this->ownerPID = ownerPID;
this->lockTypeFlags = lockTypeFlags;
this->start = start;
this->end = end;
this->lockAckID = lockAckID;
this->lockAckIDLen = strlen(lockAckID);
}
#endif /* FLOCKRANGEMSG_H_ */

View File

@@ -0,0 +1,27 @@
#ifndef FLOCKRANGERESPMSG_H_
#define FLOCKRANGERESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
#include <common/storage/StorageErrors.h>
/**
* This message is for deserialiazation (incoming) only, serialization is not implemented!!
*/
struct FLockRangeRespMsg;
typedef struct FLockRangeRespMsg FLockRangeRespMsg;
static inline void FLockRangeRespMsg_init(FLockRangeRespMsg* this);
struct FLockRangeRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void FLockRangeRespMsg_init(FLockRangeRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_FLockRangeResp);
}
#endif /* FLOCKRANGERESPMSG_H_ */

View File

@@ -0,0 +1,79 @@
#include <app/App.h>
#include <components/AckManager.h>
#include <common/toolkit/ackstore/AcknowledgmentStore.h>
#include <common/toolkit/SocketTk.h>
#include <common/net/msghelpers/MsgHelperAck.h>
#include "LockGrantedMsgEx.h"
const struct NetMessageOps LockGrantedMsgEx_Ops = {
.serializePayload = _NetMessage_serializeDummy,
.deserializePayload = LockGrantedMsgEx_deserializePayload,
.processIncoming = __LockGrantedMsgEx_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
bool LockGrantedMsgEx_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
{
LockGrantedMsgEx* thisCast = (LockGrantedMsgEx*)this;
// lockAckID
if(!Serialization_deserializeStrAlign4(ctx,
&thisCast->lockAckIDLen, &thisCast->lockAckID) )
return false;
// ackID
if(!Serialization_deserializeStrAlign4(ctx, &thisCast->ackIDLen, &thisCast->ackID) )
return false;
// granterNodeID
if(!NumNodeID_deserialize(ctx, &thisCast->granterNodeID) )
return false;
return true;
}
bool __LockGrantedMsgEx_processIncoming(NetMessage* this, struct App* app,
fhgfs_sockaddr_in* fromAddr, struct Socket* sock, char* respBuf, size_t bufLen)
{
const char* logContext = "LockGranted incoming";
Logger* log = App_getLogger(app);
AcknowledgmentStore* ackStore = App_getAckStore(app);
AckManager* ackManager = App_getAckManager(app);
LockGrantedMsgEx* thisCast = (LockGrantedMsgEx*)this;
bool gotLockWaiter;
#ifdef LOG_DEBUG_MESSAGES
const char* peer;
peer = fromAddr ?
SocketTk_ipaddrToStr(fromAddr->addr) : StringTk_strDup(Socket_getPeername(sock) );
LOG_DEBUG_FORMATTED(log, Log_DEBUG, logContext, "Received a AckMsg from: %s", peer);
kfree(peer);
#endif // LOG_DEBUG_MESSAGES
IGNORE_UNUSED_VARIABLE(log);
IGNORE_UNUSED_VARIABLE(logContext);
gotLockWaiter = AcknowledgmentStore_receivedAck(
ackStore, LockGrantedMsgEx_getLockAckID(thisCast) );
/* note: other than for standard acks, we send a ack repsonse to lock-grants only if someone was
still registered to wait for the lock-grant. (we do this to make our handling of interrupts
during lock waits easier, because we don't need lock canceling now.) */
if(gotLockWaiter)
{ // lock waiter registered => send ack
const char* ackID = LockGrantedMsgEx_getAckID(thisCast);
NumNodeID granterNodeID = LockGrantedMsgEx_getGranterNodeID(thisCast);
MsgHelperAck_respondToAckRequest(app, LockGrantedMsgEx_getAckID(thisCast), fromAddr, sock,
respBuf, bufLen);
AckManager_addAckToQueue(ackManager, granterNodeID, ackID);
}
return true;
}

View File

@@ -0,0 +1,62 @@
#ifndef LOCKGRANTEDMSGEX_H_
#define LOCKGRANTEDMSGEX_H_
#include <common/net/message/NetMessage.h>
/**
* This message is for deserialization (incoming) only, serialization is not implemented!
*/
struct LockGrantedMsgEx;
typedef struct LockGrantedMsgEx LockGrantedMsgEx;
static inline void LockGrantedMsgEx_init(LockGrantedMsgEx* this);
// virtual functions
extern bool LockGrantedMsgEx_deserializePayload(NetMessage* this, DeserializeCtx* ctx);
extern bool __LockGrantedMsgEx_processIncoming(NetMessage* this, struct App* app,
fhgfs_sockaddr_in* fromAddr, struct Socket* sock, char* respBuf, size_t bufLen);
// getters & setters
static inline const char* LockGrantedMsgEx_getLockAckID(LockGrantedMsgEx* this);
static inline const char* LockGrantedMsgEx_getAckID(LockGrantedMsgEx* this);
static inline NumNodeID LockGrantedMsgEx_getGranterNodeID(LockGrantedMsgEx* this);
struct LockGrantedMsgEx
{
NetMessage netMessage;
unsigned lockAckIDLen;
const char* lockAckID;
unsigned ackIDLen;
const char* ackID;
NumNodeID granterNodeID;
};
extern const struct NetMessageOps LockGrantedMsgEx_Ops;
void LockGrantedMsgEx_init(LockGrantedMsgEx* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_LockGranted, &LockGrantedMsgEx_Ops);
}
const char* LockGrantedMsgEx_getLockAckID(LockGrantedMsgEx* this)
{
return this->lockAckID;
}
const char* LockGrantedMsgEx_getAckID(LockGrantedMsgEx* this)
{
return this->ackID;
}
NumNodeID LockGrantedMsgEx_getGranterNodeID(LockGrantedMsgEx* this)
{
return this->granterNodeID;
}
#endif /* LOCKGRANTEDMSGEX_H_ */

View File

@@ -0,0 +1,30 @@
#include "CloseFileMsg.h"
const struct NetMessageOps CloseFileMsg_Ops = {
.serializePayload = CloseFileMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};
void CloseFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
CloseFileMsg* thisCast = (CloseFileMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
// maxUsedNodeIndex
Serialization_serializeInt(ctx, thisCast->maxUsedNodeIndex);
if (this->msgHeader.msgFeatureFlags & CLOSEFILEMSG_FLAG_HAS_EVENT)
FileEvent_serialize(ctx, thisCast->fileEvent);
}

View File

@@ -0,0 +1,75 @@
#ifndef CLOSEFILEMSG_H_
#define CLOSEFILEMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/EntryInfo.h>
#include <common/storage/FileEvent.h>
#define CLOSEFILEMSG_FLAG_EARLYRESPONSE 1 /* send response before chunk files close */
#define CLOSEFILEMSG_FLAG_CANCELAPPENDLOCKS 2 /* cancel append locks of this file handle */
#define CLOSEFILEMSG_FLAG_HAS_EVENT 8 /* contains file event logging information */
/**
* This message supports sending (serialization) only, i.e. no deserialization implemented!!
*/
struct CloseFileMsg;
typedef struct CloseFileMsg CloseFileMsg;
static inline void CloseFileMsg_init(CloseFileMsg* this);
static inline void CloseFileMsg_initFromSession(CloseFileMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int maxUsedNodeIndex,
const struct FileEvent* fileEvent);
// virtual functions
extern void CloseFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct CloseFileMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
unsigned fileHandleIDLen;
const char* fileHandleID;
int maxUsedNodeIndex;
// for serialization
const EntryInfo* entryInfoPtr; // not owned by this object
const struct FileEvent* fileEvent;
};
extern const struct NetMessageOps CloseFileMsg_Ops;
void CloseFileMsg_init(CloseFileMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_CloseFile, &CloseFileMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param entryInfo just a reference, so do not free it as long as you use this object!
*/
void CloseFileMsg_initFromSession(CloseFileMsg* this, NumNodeID clientNumID,
const char* fileHandleID, const EntryInfo* entryInfo, int maxUsedNodeIndex,
const struct FileEvent* fileEvent)
{
CloseFileMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->entryInfoPtr = entryInfo;
this->maxUsedNodeIndex = maxUsedNodeIndex;
this->fileEvent = fileEvent;
if (fileEvent)
this->netMessage.msgHeader.msgFeatureFlags |= CLOSEFILEMSG_FLAG_HAS_EVENT;
}
#endif /*CLOSEFILEMSG_H_*/

View File

@@ -0,0 +1,32 @@
#ifndef CLOSEFILERESPMSG_H_
#define CLOSEFILERESPMSG_H_
#include <common/net/message/SimpleIntMsg.h>
struct CloseFileRespMsg;
typedef struct CloseFileRespMsg CloseFileRespMsg;
static inline void CloseFileRespMsg_init(CloseFileRespMsg* this);
// getters & setters
static inline int CloseFileRespMsg_getValue(CloseFileRespMsg* this);
struct CloseFileRespMsg
{
SimpleIntMsg simpleIntMsg;
};
void CloseFileRespMsg_init(CloseFileRespMsg* this)
{
SimpleIntMsg_init( (SimpleIntMsg*)this, NETMSGTYPE_CloseFileResp);
}
int CloseFileRespMsg_getValue(CloseFileRespMsg* this)
{
return SimpleIntMsg_getValue( (SimpleIntMsg*)this);
}
#endif /*CLOSEFILERESPMSG_H_*/

View File

@@ -0,0 +1,27 @@
#include "OpenFileMsg.h"
const struct NetMessageOps OpenFileMsg_Ops = {
.serializePayload = OpenFileMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
.supportsSequenceNumbers = true,
};
void OpenFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
OpenFileMsg* thisCast = (OpenFileMsg*)this;
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// accessFlags
Serialization_serializeUInt(ctx, thisCast->accessFlags);
// entryInfo
EntryInfo_serialize(ctx, thisCast->entryInfoPtr);
if (this->msgHeader.msgFeatureFlags & OPENFILEMSG_FLAG_HAS_EVENT)
FileEvent_serialize(ctx, thisCast->fileEvent);
}

View File

@@ -0,0 +1,65 @@
#ifndef OPENFILEMSG_H_
#define OPENFILEMSG_H_
#include <common/storage/EntryInfo.h>
#include <common/storage/FileEvent.h>
#include <common/net/message/NetMessage.h>
#define OPENFILEMSG_FLAG_USE_QUOTA 1 /* if the message contains quota informations */
#define OPENFILEMSG_FLAG_HAS_EVENT 2 /* contains file event logging information */
#define OPENFILEMSG_FLAG_BYPASS_ACCESS_CHECK 4 /* bypass file access checks on metadata server */
struct OpenFileMsg;
typedef struct OpenFileMsg OpenFileMsg;
static inline void OpenFileMsg_init(OpenFileMsg* this);
static inline void OpenFileMsg_initFromSession(OpenFileMsg* this,
NumNodeID clientNumID, const EntryInfo* entryInfo, unsigned accessFlags,
const struct FileEvent* fileEvent);
// virtual functions
extern void OpenFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct OpenFileMsg
{
NetMessage netMessage;
NumNodeID clientNumID;
unsigned sessionIDLen;
const EntryInfo* entryInfoPtr; // not owned by this object
unsigned accessFlags;
const struct FileEvent* fileEvent;
};
extern const struct NetMessageOps OpenFileMsg_Ops;
void OpenFileMsg_init(OpenFileMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_OpenFile, &OpenFileMsg_Ops);
}
/**
* @param sessionID just a reference, so do not free it as long as you use this object!
* @param entryInfoPtr just a reference, so do not free it as long as you use this object!
* @param accessFlags OPENFILE_ACCESS_... flags
*/
void OpenFileMsg_initFromSession(OpenFileMsg* this,
NumNodeID clientNumID, const EntryInfo* entryInfo, unsigned accessFlags,
const struct FileEvent* fileEvent)
{
OpenFileMsg_init(this);
this->clientNumID = clientNumID;
this->entryInfoPtr = entryInfo;
this->accessFlags = accessFlags;
this->fileEvent = fileEvent;
if (fileEvent)
this->netMessage.msgHeader.msgFeatureFlags |= OPENFILEMSG_FLAG_HAS_EVENT;
}
#endif /*OPENFILEMSG_H_*/

View File

@@ -0,0 +1,37 @@
#include "OpenFileRespMsg.h"
const struct NetMessageOps OpenFileRespMsg_Ops = {
.serializePayload = _NetMessage_serializeDummy,
.deserializePayload = OpenFileRespMsg_deserializePayload,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
bool OpenFileRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx)
{
OpenFileRespMsg* thisCast = (OpenFileRespMsg*)this;
// result
if(!Serialization_deserializeInt(ctx, &thisCast->result) )
return false;
// fileHandleID
if(!Serialization_deserializeStrAlign4(ctx, &thisCast->fileHandleIDLen,
&thisCast->fileHandleID) )
return false;
// pathInfo
if (!PathInfo_deserialize(ctx, &thisCast->pathInfo) )
return false;
// stripePattern
if(!StripePattern_deserializePatternPreprocess(ctx,
&thisCast->patternStart, &thisCast->patternLength) )
return false;
if (!Serialization_deserializeUInt(ctx, &thisCast->fileVersion))
return false;
return true;
}

View File

@@ -0,0 +1,76 @@
#ifndef OPENFILERESPMSG_H_
#define OPENFILERESPMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/PathInfo.h>
#include <common/storage/striping/StripePattern.h>
#include <common/Common.h>
struct OpenFileRespMsg;
typedef struct OpenFileRespMsg OpenFileRespMsg;
static inline void OpenFileRespMsg_init(OpenFileRespMsg* this);
// virtual functions
extern bool OpenFileRespMsg_deserializePayload(NetMessage* this, DeserializeCtx* ctx);
// inliners
static inline StripePattern* OpenFileRespMsg_createPattern(OpenFileRespMsg* this);
// getters & setters
static inline int OpenFileRespMsg_getResult(OpenFileRespMsg* this);
static inline const char* OpenFileRespMsg_getFileHandleID(OpenFileRespMsg* this);
static inline const PathInfo* OpenFileRespMsg_getPathInfo(OpenFileRespMsg* this);
struct OpenFileRespMsg
{
NetMessage netMessage;
int result;
unsigned fileHandleIDLen;
const char* fileHandleID;
PathInfo pathInfo;
uint32_t fileVersion;
// for serialization
StripePattern* pattern; // not owned by this object!
// for deserialization
const char* patternStart;
uint32_t patternLength;
};
extern const struct NetMessageOps OpenFileRespMsg_Ops;
void OpenFileRespMsg_init(OpenFileRespMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_OpenFileResp, &OpenFileRespMsg_Ops);
}
/**
* @return must be deleted by the caller; might be of type STRIPEPATTERN_Invalid
*/
StripePattern* OpenFileRespMsg_createPattern(OpenFileRespMsg* this)
{
return StripePattern_createFromBuf(this->patternStart, this->patternLength);
}
int OpenFileRespMsg_getResult(OpenFileRespMsg* this)
{
return this->result;
}
const char* OpenFileRespMsg_getFileHandleID(OpenFileRespMsg* this)
{
return this->fileHandleID;
}
const PathInfo* OpenFileRespMsg_getPathInfo(OpenFileRespMsg* this)
{
return &this->pathInfo;
}
#endif /*OPENFILERESPMSG_H_*/

View File

@@ -0,0 +1,39 @@
#ifdef BEEGFS_NVFS
#include "ReadLocalFileRDMAMsg.h"
const struct NetMessageOps ReadLocalFileRDMAMsg_Ops = {
.serializePayload = ReadLocalFileRDMAMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
void ReadLocalFileRDMAMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
ReadLocalFileRDMAMsg* thisCast = (ReadLocalFileRDMAMsg*)this;
// offset
Serialization_serializeInt64(ctx, thisCast->offset);
// count
Serialization_serializeInt64(ctx, thisCast->count);
// accessFlags
Serialization_serializeUInt(ctx, thisCast->accessFlags);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// pathInfo
PathInfo_serialize(ctx, thisCast->pathInfoPtr);
// targetID
Serialization_serializeUShort(ctx, thisCast->targetID);
// RDMA info
RdmaInfo_serialize(ctx, thisCast->rdmap);
}
#endif /* BEEGFS_NVFS */

View File

@@ -0,0 +1,71 @@
#ifndef READLOCALFILERDMAMSG_H_
#define READLOCALFILERDMAMSG_H_
#ifdef BEEGFS_NVFS
#include <common/net/message/NetMessage.h>
#include <common/storage/PathInfo.h>
#include <common/storage/RdmaInfo.h>
#include "ReadLocalFileV2Msg.h"
struct ReadLocalFileRDMAMsg;
typedef struct ReadLocalFileRDMAMsg ReadLocalFileRDMAMsg;
static inline void ReadLocalFileRDMAMsg_init(ReadLocalFileRDMAMsg* this);
static inline void ReadLocalFileRDMAMsg_initFromSession(ReadLocalFileRDMAMsg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfoPtr,
unsigned accessFlags, int64_t offset, int64_t count, RdmaInfo *rdmap);
// virtual functions
extern void ReadLocalFileRDMAMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct ReadLocalFileRDMAMsg
{
NetMessage netMessage;
int64_t offset;
int64_t count;
unsigned accessFlags;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
PathInfo* pathInfoPtr;
uint16_t targetID;
RdmaInfo *rdmap;
};
extern const struct NetMessageOps ReadLocalFileRDMAMsg_Ops;
void ReadLocalFileRDMAMsg_init(ReadLocalFileRDMAMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_ReadLocalFileRDMA, &ReadLocalFileRDMAMsg_Ops);
}
/**
* @param sessionID just a reference, so do not free it as long as you use this object!
*/
void ReadLocalFileRDMAMsg_initFromSession(ReadLocalFileRDMAMsg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfoPtr,
unsigned accessFlags, int64_t offset, int64_t count, RdmaInfo *rdmap)
{
ReadLocalFileRDMAMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->targetID = targetID;
this->pathInfoPtr = pathInfoPtr;
this->accessFlags = accessFlags;
this->offset = offset;
this->count = count;
this->rdmap = rdmap;
}
#endif /* BEEGFS_NVFS */
#endif /*READLOCALFILERDMAMSG_H_*/

View File

@@ -0,0 +1,35 @@
#include "ReadLocalFileV2Msg.h"
const struct NetMessageOps ReadLocalFileV2Msg_Ops = {
.serializePayload = ReadLocalFileV2Msg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
void ReadLocalFileV2Msg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
ReadLocalFileV2Msg* thisCast = (ReadLocalFileV2Msg*)this;
// offset
Serialization_serializeInt64(ctx, thisCast->offset);
// count
Serialization_serializeInt64(ctx, thisCast->count);
// accessFlags
Serialization_serializeUInt(ctx, thisCast->accessFlags);
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// pathInfo
PathInfo_serialize(ctx, thisCast->pathInfoPtr);
// targetID
Serialization_serializeUShort(ctx, thisCast->targetID);
}

View File

@@ -0,0 +1,71 @@
#ifndef READLOCALFILEV2MSG_H_
#define READLOCALFILEV2MSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/PathInfo.h>
#define READLOCALFILEMSG_FLAG_SESSION_CHECK 1 /* if session check infos should be done */
#define READLOCALFILEMSG_FLAG_DISABLE_IO 2 /* disable read syscall for net bench */
#define READLOCALFILEMSG_FLAG_BUDDYMIRROR 4 /* given targetID is a buddymirrorgroup ID */
#define READLOCALFILEMSG_FLAG_BUDDYMIRROR_SECOND 8 /* secondary of group, otherwise primary */
struct ReadLocalFileV2Msg;
typedef struct ReadLocalFileV2Msg ReadLocalFileV2Msg;
static inline void ReadLocalFileV2Msg_init(ReadLocalFileV2Msg* this);
static inline void ReadLocalFileV2Msg_initFromSession(ReadLocalFileV2Msg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfoPtr,
unsigned accessFlags, int64_t offset, int64_t count);
// virtual functions
extern void ReadLocalFileV2Msg_serializePayload(NetMessage* this, SerializeCtx* ctx);
struct ReadLocalFileV2Msg
{
NetMessage netMessage;
int64_t offset;
int64_t count;
unsigned accessFlags;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
PathInfo* pathInfoPtr;
uint16_t targetID;
};
extern const struct NetMessageOps ReadLocalFileV2Msg_Ops;
void ReadLocalFileV2Msg_init(ReadLocalFileV2Msg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_ReadLocalFileV2, &ReadLocalFileV2Msg_Ops);
}
/**
* @param sessionID just a reference, so do not free it as long as you use this object!
*/
void ReadLocalFileV2Msg_initFromSession(ReadLocalFileV2Msg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfoPtr,
unsigned accessFlags, int64_t offset, int64_t count)
{
ReadLocalFileV2Msg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->targetID = targetID;
this->pathInfoPtr = pathInfoPtr;
this->accessFlags = accessFlags;
this->offset = offset;
this->count = count;
}
#endif /*READLOCALFILEV2MSG_H_*/

View File

@@ -0,0 +1,44 @@
#include "WriteLocalFileMsg.h"
const struct NetMessageOps WriteLocalFileMsg_Ops = {
.serializePayload = WriteLocalFileMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
void WriteLocalFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
WriteLocalFileMsg* thisCast = (WriteLocalFileMsg*)this;
// offset
Serialization_serializeInt64(ctx, thisCast->offset);
// count
Serialization_serializeInt64(ctx, thisCast->count);
// accessFlags
Serialization_serializeUInt(ctx, thisCast->accessFlags);
if(NetMessage_isMsgHeaderFeatureFlagSet(this, WRITELOCALFILEMSG_FLAG_USE_QUOTA))
{
// userID
Serialization_serializeUInt(ctx, thisCast->userID);
// groupID
Serialization_serializeUInt(ctx, thisCast->groupID);
}
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// pathInfo
PathInfo_serialize(ctx, thisCast->pathInfo);
// targetID
Serialization_serializeUShort(ctx, thisCast->targetID);
}

View File

@@ -0,0 +1,99 @@
#ifndef WRITELOCALFILEMSG_H_
#define WRITELOCALFILEMSG_H_
#include <common/net/message/NetMessage.h>
#include <common/storage/StorageErrors.h>
#include <common/storage/PathInfo.h>
#include <app/log/Logger.h>
#include <app/App.h>
#include <os/iov_iter.h>
#define WRITELOCALFILEMSG_FLAG_SESSION_CHECK 1 /* if session check should be done */
#define WRITELOCALFILEMSG_FLAG_USE_QUOTA 2 /* if msg contains quota info */
#define WRITELOCALFILEMSG_FLAG_DISABLE_IO 4 /* disable write syscall for net bench mode */
#define WRITELOCALFILEMSG_FLAG_BUDDYMIRROR 8 /* given targetID is a buddymirrorgroup ID */
#define WRITELOCALFILEMSG_FLAG_BUDDYMIRROR_SECOND 16 /* secondary of group, otherwise primary */
#define WRITELOCALFILEMSG_FLAG_BUDDYMIRROR_FORWARD 32 /* forward msg to secondary */
struct WriteLocalFileMsg;
typedef struct WriteLocalFileMsg WriteLocalFileMsg;
static inline void WriteLocalFileMsg_init(WriteLocalFileMsg* this);
static inline void WriteLocalFileMsg_initFromSession(WriteLocalFileMsg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfo,
unsigned accessFlags, int64_t offset, int64_t count);
// virtual functions
extern void WriteLocalFileMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
// getters & setters
static inline void WriteLocalFileMsg_setUserdataForQuota(WriteLocalFileMsg* this, unsigned userID,
unsigned groupID);
/**
* Note: This message supports only serialization, deserialization is not implemented.
*/
struct WriteLocalFileMsg
{
NetMessage netMessage;
int64_t offset;
int64_t count;
unsigned accessFlags;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
uint16_t targetID;
PathInfo* pathInfo;
unsigned userID;
unsigned groupID;
};
extern const struct NetMessageOps WriteLocalFileMsg_Ops;
void WriteLocalFileMsg_init(WriteLocalFileMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_WriteLocalFile, &WriteLocalFileMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param pathInfo just a reference, so do not free it as long as you use this object!
*/
void WriteLocalFileMsg_initFromSession(WriteLocalFileMsg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfo,
unsigned accessFlags,
int64_t offset, int64_t count)
{
WriteLocalFileMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->targetID = targetID;
this->pathInfo = pathInfo;
this->accessFlags = accessFlags;
this->offset = offset;
this->count = count;
}
void WriteLocalFileMsg_setUserdataForQuota(WriteLocalFileMsg* this, unsigned userID,
unsigned groupID)
{
NetMessage* thisCast = (NetMessage*) this;
NetMessage_addMsgHeaderFeatureFlag(thisCast, WRITELOCALFILEMSG_FLAG_USE_QUOTA);
this->userID = userID;
this->groupID = groupID;
}
#endif /*WRITELOCALFILEMSG_H_*/

View File

@@ -0,0 +1,49 @@
#ifdef BEEGFS_NVFS
#include "WriteLocalFileRDMAMsg.h"
#include "WriteLocalFileMsg.h"
const struct NetMessageOps WriteLocalFileRDMAMsg_Ops = {
.serializePayload = WriteLocalFileRDMAMsg_serializePayload,
.deserializePayload = _NetMessage_deserializeDummy,
.processIncoming = NetMessage_processIncoming,
.getSupportedHeaderFeatureFlagsMask = NetMessage_getSupportedHeaderFeatureFlagsMask,
};
void WriteLocalFileRDMAMsg_serializePayload(NetMessage* this, SerializeCtx* ctx)
{
WriteLocalFileRDMAMsg* thisCast = (WriteLocalFileRDMAMsg*)this;
// offset
Serialization_serializeInt64(ctx, thisCast->offset);
// count
Serialization_serializeInt64(ctx, thisCast->count);
// accessFlags
Serialization_serializeUInt(ctx, thisCast->accessFlags);
if(NetMessage_isMsgHeaderFeatureFlagSet(this, WRITELOCALFILEMSG_FLAG_USE_QUOTA))
{
// userID
Serialization_serializeUInt(ctx, thisCast->userID);
// groupID
Serialization_serializeUInt(ctx, thisCast->groupID);
}
// fileHandleID
Serialization_serializeStrAlign4(ctx, thisCast->fileHandleIDLen, thisCast->fileHandleID);
// clientNumID
NumNodeID_serialize(ctx, &thisCast->clientNumID);
// pathInfo
PathInfo_serialize(ctx, thisCast->pathInfo);
// targetID
Serialization_serializeUShort(ctx, thisCast->targetID);
// RDMA info
RdmaInfo_serialize(ctx, thisCast->rdmap);
}
#endif /* BEEGFS_NVFS */

View File

@@ -0,0 +1,104 @@
#ifndef WRITELOCALFILERDMAMSG_H_
#define WRITELOCALFILERDMAMSG_H_
#ifdef BEEGFS_NVFS
#include <common/net/message/NetMessage.h>
#include <common/storage/StorageErrors.h>
#include <common/storage/PathInfo.h>
#include <common/storage/RdmaInfo.h>
#include <app/log/Logger.h>
#include <app/App.h>
#include <os/iov_iter.h>
#define WRITELOCALFILERDMAMSG_FLAG_SESSION_CHECK 1 /* if session check should be done */
#define WRITELOCALFILERDMAMSG_FLAG_USE_QUOTA 2 /* if msg contains quota info */
#define WRITELOCALFILERDMAMSG_FLAG_DISABLE_IO 4 /* disable write syscall for net bench mode */
#define WRITELOCALFILERDMAMSG_FLAG_BUDDYMIRROR 8 /* given targetID is a buddymirrorgroup ID */
#define WRITELOCALFILERDMAMSG_FLAG_BUDDYMIRROR_SECOND 16 /* secondary of group, otherwise primary */
#define WRITELOCALFILERDMAMSG_FLAG_BUDDYMIRROR_FORWARD 32 /* forward msg to secondary */
struct WriteLocalFileRDMAMsg;
typedef struct WriteLocalFileRDMAMsg WriteLocalFileRDMAMsg;
static inline void WriteLocalFileRDMAMsg_init(WriteLocalFileRDMAMsg* this);
static inline void WriteLocalFileRDMAMsg_initFromSession(WriteLocalFileRDMAMsg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfo,
unsigned accessFlags, int64_t offset, int64_t count, RdmaInfo *rdmap);
// virtual functions
extern void WriteLocalFileRDMAMsg_serializePayload(NetMessage* this, SerializeCtx* ctx);
// getters & setters
static inline void WriteLocalFileRDMAMsg_setUserdataForQuota(WriteLocalFileRDMAMsg* this, unsigned userID,
unsigned groupID);
/**
* Note: This message supports only serialization, deserialization is not implemented.
*/
struct WriteLocalFileRDMAMsg
{
NetMessage netMessage;
int64_t offset;
int64_t count;
unsigned accessFlags;
NumNodeID clientNumID;
const char* fileHandleID;
unsigned fileHandleIDLen;
uint16_t targetID;
PathInfo* pathInfo;
unsigned userID;
unsigned groupID;
RdmaInfo *rdmap;
};
extern const struct NetMessageOps WriteLocalFileRDMAMsg_Ops;
void WriteLocalFileRDMAMsg_init(WriteLocalFileRDMAMsg* this)
{
NetMessage_init(&this->netMessage, NETMSGTYPE_WriteLocalFileRDMA, &WriteLocalFileRDMAMsg_Ops);
}
/**
* @param fileHandleID just a reference, so do not free it as long as you use this object!
* @param pathInfo just a reference, so do not free it as long as you use this object!
*/
void WriteLocalFileRDMAMsg_initFromSession(WriteLocalFileRDMAMsg* this,
NumNodeID clientNumID, const char* fileHandleID, uint16_t targetID, PathInfo* pathInfo,
unsigned accessFlags, int64_t offset, int64_t count, RdmaInfo *rdmap)
{
WriteLocalFileRDMAMsg_init(this);
this->clientNumID = clientNumID;
this->fileHandleID = fileHandleID;
this->fileHandleIDLen = strlen(fileHandleID);
this->targetID = targetID;
this->pathInfo = pathInfo;
this->accessFlags = accessFlags;
this->offset = offset;
this->count = count;
this->rdmap = rdmap;
}
void WriteLocalFileRDMAMsg_setUserdataForQuota(WriteLocalFileRDMAMsg* this, unsigned userID,
unsigned groupID)
{
NetMessage* thisCast = (NetMessage*) this;
NetMessage_addMsgHeaderFeatureFlag(thisCast, WRITELOCALFILERDMAMSG_FLAG_USE_QUOTA);
this->userID = userID;
this->groupID = groupID;
}
#endif /* BEEGFS_NVFS */
#endif /*WRITELOCALFILERDMAMSG_H_*/

View File

@@ -0,0 +1,34 @@
#ifndef WRITELOCALFILERDMARESPMSG_H_
#define WRITELOCALFILERDMARESPMSG_H_
#ifdef BEEGFS_NVFS
#include <common/net/message/SimpleInt64Msg.h>
struct WriteLocalFileRDMARespMsg;
typedef struct WriteLocalFileRDMARespMsg WriteLocalFileRDMARespMsg;
static inline void WriteLocalFileRDMARespMsg_init(WriteLocalFileRDMARespMsg* this);
// getters & setters
static inline int64_t WriteLocalFileRDMARespMsg_getValue(WriteLocalFileRDMARespMsg* this);
struct WriteLocalFileRDMARespMsg
{
SimpleInt64Msg simpleInt64Msg;
};
void WriteLocalFileRDMARespMsg_init(WriteLocalFileRDMARespMsg* this)
{
SimpleInt64Msg_init( (SimpleInt64Msg*)this, NETMSGTYPE_WriteLocalFileRDMAResp);
}
int64_t WriteLocalFileRDMARespMsg_getValue(WriteLocalFileRDMARespMsg* this)
{
return SimpleInt64Msg_getValue( (SimpleInt64Msg*)this);
}
#endif /* BEEGFS_NVFS */
#endif /*WRITELOCALFILERDMARESPMSG_H_*/

View File

@@ -0,0 +1,32 @@
#ifndef WRITELOCALFILERESPMSG_H_
#define WRITELOCALFILERESPMSG_H_
#include <common/net/message/SimpleInt64Msg.h>
struct WriteLocalFileRespMsg;
typedef struct WriteLocalFileRespMsg WriteLocalFileRespMsg;
static inline void WriteLocalFileRespMsg_init(WriteLocalFileRespMsg* this);
// getters & setters
static inline int64_t WriteLocalFileRespMsg_getValue(WriteLocalFileRespMsg* this);
struct WriteLocalFileRespMsg
{
SimpleInt64Msg simpleInt64Msg;
};
void WriteLocalFileRespMsg_init(WriteLocalFileRespMsg* this)
{
SimpleInt64Msg_init( (SimpleInt64Msg*)this, NETMSGTYPE_WriteLocalFileResp);
}
int64_t WriteLocalFileRespMsg_getValue(WriteLocalFileRespMsg* this)
{
return SimpleInt64Msg_getValue( (SimpleInt64Msg*)this);
}
#endif /*WRITELOCALFILERESPMSG_H_*/