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

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,758 @@
#ifndef CONFIG_H_
#define CONFIG_H_
#include <common/Common.h>
#include <common/toolkit/list/StrCpyListIter.h>
#include <common/toolkit/list/UInt16ListIter.h>
#include <common/toolkit/tree/StrCpyMap.h>
#include <common/toolkit/tree/StrCpyMapIter.h>
#include <common/toolkit/StringTk.h>
#include <app/config/MountConfig.h>
struct Config;
typedef struct Config Config;
enum FileCacheType;
typedef enum FileCacheType FileCacheType;
enum InodeIDStyle;
typedef enum InodeIDStyle InodeIDStyle;
enum RDMAKeyType;
typedef enum RDMAKeyType RDMAKeyType;
enum CheckCapabilities;
typedef enum CheckCapabilities CheckCapabilities;
enum EventLogMask
{
EventLogMask_NONE = 0,
EventLogMask_FLUSH = 1,
EventLogMask_TRUNC = 2,
EventLogMask_SETATTR = 4,
EventLogMask_CLOSE = 8,
EventLogMask_LINK_OP = 16,
EventLogMask_OPEN_READ = 32,
EventLogMask_OPEN_WRITE = 64,
EventLogMask_OPEN_READ_WRITE = 128
};
extern __must_check bool Config_init(Config* this, MountConfig* mountConfig);
extern Config* Config_construct(MountConfig* mountConfig);
extern void Config_uninit(Config* this);
extern void Config_destruct(Config* this);
extern bool _Config_initConfig(Config* this, MountConfig* mountConfig);
extern StrCpyMapIter _Config_eraseFromConfigMap(Config* this, StrCpyMapIter* iter);
extern void _Config_loadDefaults(Config* this);
extern bool _Config_applyConfigMap(Config* this);
extern void _Config_configMapRedefine(Config* this, char* keyStr, const char* valueStr);
extern void __Config_addLineToConfigMap(Config* this, char* line);
extern void __Config_loadFromMountConfig(Config* this, MountConfig* mountConfig);
extern bool __Config_loadFromFile(struct Config* this, const char* filename);
extern bool Config_loadStringListFile(const char* filename,
StrCpyList* outList);
extern bool Config_loadUInt16ListFile(struct Config* this, const char* filename,
UInt16List* outList);
extern bool __Config_initImplicitVals(Config* this);
extern void __Config_initConnNumCommRetries(Config* this);
extern void __Config_initTuneFileCacheTypeNum(Config* this);
void __Config_initSysInodeIDStyleNum(Config* this);
bool __Config_initConnAuthHash(Config* this, char* connAuthFile, uint64_t* outConnAuthHash);
void __Config_initConnRDMAKeyTypeNum(Config* this);
// conversion
const char* Config_fileCacheTypeNumToStr(FileCacheType cacheType);
const char* Config_inodeIDStyleNumToStr(InodeIDStyle inodeIDStyle);
const char* Config_eventLogMaskToStr(enum EventLogMask mask);
const char* Config_rdmaKeyTypeNumToStr(RDMAKeyType keyType);
const char* Config_checkCapabilitiesTypeToStr(CheckCapabilities checkCapabilities);
// getters & setters
static inline char* Config_getCfgFile(Config* this);
static inline int Config_getLogLevel(Config* this);
static inline bool Config_getLogClientID(Config* this);
static inline bool Config_getConnUseRDMA(Config* this);
static inline bool Config_getConnTCPFallbackEnabled(Config* this);
static inline int Config_getConnClientPort(Config* this);
static inline int Config_getConnMgmtdPort(Config* this);
static inline int Config_getConnMgmtdGrpcPort(Config* this);
static inline void Config_setConnMgmtdGrpcPort(Config* this, int port);
static inline unsigned Config_getConnMaxInternodeNum(Config* this);
static inline char* Config_getConnInterfacesFile(Config* this);
static inline char* Config_getConnInterfacesList(Config* this);
static inline char* Config_getConnRDMAInterfacesFile(Config* this);
static inline unsigned Config_getConnFallbackExpirationSecs(Config* this);
static inline unsigned Config_getConnNumCommRetries(Config* this);
static inline unsigned Config_getConnCommRetrySecs(Config* this);
static inline bool Config_getConnUnmountRetries(Config* this);
static inline int Config_getConnTCPRcvBufSize(Config* this);
static inline int Config_getConnUDPRcvBufSize(Config* this);
static inline unsigned Config_getConnRDMABufSize(Config* this);
static inline unsigned Config_getConnRDMAFragmentSize(Config* this);
static inline unsigned Config_getConnRDMABufNum(Config* this);
static inline unsigned Config_getConnRDMAMetaBufSize(Config* this);
static inline unsigned Config_getConnRDMAMetaBufNum(Config* this);
static inline unsigned Config_getConnRDMAMetaFragmentSize(Config* this);
static inline char* Config_getConnRDMAKeyType(Config* this);
static inline RDMAKeyType Config_getConnRDMAKeyTypeNum(Config* this);
static inline int Config_getConnRDMATypeOfService(Config* this);
static inline unsigned Config_getRemapConnectionFailureStatus(Config* this);
static inline void Config_setRemapConnectionFailureStatus(Config* this, unsigned status);
static inline char* Config_getConnNetFilterFile(Config* this);
static inline unsigned Config_getConnMaxConcurrentAttempts(Config* this);
static inline char* Config_getConnAuthFile(Config* this);
static inline bool Config_getConnDisableAuthentication(Config* this);
static inline uint64_t Config_getConnAuthHash(Config* this);
static inline char* Config_getConnTcpOnlyFilterFile(Config* this);
static inline char* Config_getTunePreferredMetaFile(Config* this);
static inline char* Config_getTunePreferredStorageFile(Config* this);
static inline char* Config_getTuneFileCacheType(Config* this);
static inline FileCacheType Config_getTuneFileCacheTypeNum(Config* this);
static inline int Config_getTuneFileCacheBufSize(Config* this);
static inline int Config_getTuneFileCacheBufNum(Config* this);
static inline int Config_getTunePathBufSize(Config* this);
static inline int Config_getTunePathBufNum(Config* this);
static inline int Config_getTuneMsgBufSize(Config* this);
static inline int Config_getTuneMsgBufNum(Config* this);
static inline unsigned Config_getTunePageCacheValidityMS(Config* this);
static inline unsigned Config_getTuneDirSubentryCacheValidityMS(Config* this);
static inline unsigned Config_getTuneFileSubentryCacheValidityMS(Config* this);
static inline unsigned Config_getTuneENOENTCacheValidityMS(Config* this);
static inline bool Config_getTuneRemoteFSync(Config* this);
static inline bool Config_getTuneUseGlobalFileLocks(Config* this);
static inline bool Config_getTuneRefreshOnGetAttr(Config* this);
static inline void Config_setTuneRefreshOnGetAttr(Config* this);
static inline unsigned Config_getTuneInodeBlockBits(Config* this);
static inline unsigned Config_getTuneInodeBlockSize(Config* this);
static inline bool Config_getTuneEarlyCloseResponse(Config* this);
static inline bool Config_getTuneUseGlobalAppendLocks(Config* this);
static inline bool Config_getTuneUseBufferedAppend(Config* this);
static inline unsigned Config_getTuneStatFsCacheSecs(Config* this);
static inline bool Config_getTuneCoherentBuffers(Config* this);
static inline char* Config_getSysMgmtdHost(Config* this);
static inline char* Config_getSysInodeIDStyle(Config* this);
static inline InodeIDStyle Config_getSysInodeIDStyleNum(Config* this);
static inline bool Config_getSysCacheInvalidationVersion(Config* this);
static inline bool Config_getSysCreateHardlinksAsSymlinks(Config* this);
static inline unsigned Config_getSysMountSanityCheckMS(Config* this);
static inline bool Config_getSysSyncOnClose(Config* this);
static inline bool Config_getSysSessionCheckOnClose(Config* this);
static inline bool Config_getSysSessionChecksEnabled(Config* this);
static inline unsigned Config_getSysUpdateTargetStatesSecs(Config* this);
static inline unsigned Config_getSysTargetOfflineTimeoutSecs(Config* this);
static inline bool Config_getSysXAttrsEnabled(Config* this);
static inline CheckCapabilities Config_getSysXAttrsCheckCapabilities (Config* this);
static inline bool Config_getSysACLsEnabled(Config* this);
static inline bool Config_getSysXAttrsImplicitlyEnabled(Config* this);
static inline bool Config_getSysBypassFileAccessCheckOnMeta(Config* this);
static inline bool Config_getQuotaEnabled(Config* this);
static inline char* Config_getConnMessagingTimeouts(Config* this);
static inline char* Config_getConnRDMATimeouts(Config* this);
static inline int Config_getConnRDMATimeoutConnect(Config* this);
static inline int Config_getConnRDMATimeoutCompletion(Config* this);
static inline int Config_getConnRDMATimeoutFlowSend(Config* this);
static inline int Config_getConnRDMATimeoutFlowRecv(Config* this);
static inline int Config_getConnRDMATimeoutPoll(Config* this);
enum FileCacheType
{ FILECACHETYPE_None = 0, FILECACHETYPE_Buffered = 1, FILECACHETYPE_Paged = 2,
FILECACHETYPE_Native = 3};
#define INODEIDSTYLE_HASH32HSIEH_STR "hash32"
#define INODEIDSTYLE_HASH64HSIEH_STR "hash64"
#define INODEIDSTYLE_HASH32MD4_STR "md4hash32"
#define INODEIDSTYLE_HASH64MD4_STR "md4hash64"
#define INODEIDSTYLE_DEFAULT INODEIDSTYLE_HASH64MD4_STR
enum InodeIDStyle
{
INODEIDSTYLE_Hash32Hsieh = 0, // hsieh32
INODEIDSTYLE_Hash32MD4, // half-md4
INODEIDSTYLE_Hash64HSieh, // hsieh32
INODEIDSTYLE_Hash64MD4 // half-md4
};
#define INODEIDSTYLE_Default INODEIDSTYLE_Hash64MD4
#define RDMAKEYTYPE_UNSAFE_GLOBAL_STR "global"
#define RDMAKEYTYPE_UNSAFE_DMA_STR "dma"
#define RDMAKEYTYPE_REGISTER_STR "register"
enum RDMAKeyType
{
RDMAKEYTYPE_UnsafeGlobal = 0,
RDMAKEYTYPE_UnsafeDMA,
RDMAKEYTYPE_Register
};
#define CHECKCAPABILITIES_ALWAYS_STR "always"
#define CHECKCAPABILITIES_CACHE_STR "cache"
#define CHECKCAPABILITIES_NEVER_STR "never"
enum CheckCapabilities
{
CHECKCAPABILITIES_Always = 0,
CHECKCAPABILITIES_Cache,
CHECKCAPABILITIES_Never
};
struct Config
{
// configurables
char* cfgFile;
int logLevel;
bool logClientID;
int connPortShift; // shifts all UDP and TCP ports
int connClientPort;
int connMgmtdPort;
int connMgmtdGrpcPort; // pulled from mgmtd and not meant to be configured by the user
bool connUseRDMA;
bool connTCPFallbackEnabled;
unsigned connMaxInternodeNum;
char* connInterfacesFile;
char* connInterfacesList;
char* connRDMAInterfacesFile;
unsigned connFallbackExpirationSecs;
unsigned connNumCommRetries; // auto-computed from connCommRetrySecs
unsigned connCommRetrySecs;
bool connUnmountRetries;
int connTCPRcvBufSize;
int connUDPRcvBufSize;
int connRDMABufSize;
int connRDMAFragmentSize;
int connRDMABufNum;
int connRDMAMetaBufSize;
int connRDMAMetaFragmentSize;
int connRDMAMetaBufNum;
int connRDMATypeOfService;
char* connRDMAKeyType;
RDMAKeyType connRDMAKeyTypeNum;
char* connNetFilterFile; // allowed IP addresses (all IPs allowed, if empty)
unsigned connMaxConcurrentAttempts;
char* connAuthFile;
bool connDisableAuthentication;
uint64_t connAuthHash; // implicitly set based on hash of connAuthFile contents
char* connTcpOnlyFilterFile; // allow only plain TCP (no RDMA etc) to these IPs
char* connMessagingTimeouts;
int connMsgLongTimeout;
int connMsgMediumTimeout;
int connMsgShortTimeout; // connection (response) timeouts in ms
// note: be careful here, because servers not
// responding for >30secs under high load is nothing
// unusual, so never use connMsgShortTimeout for
// IO-related operations.
char* connRDMATimeouts;
int connRDMATimeoutConnect;
int connRDMATimeoutCompletion;
int connRDMATimeoutFlowSend;
int connRDMATimeoutFlowRecv;
int connRDMATimeoutPoll;
char* tunePreferredMetaFile;
char* tunePreferredStorageFile;
char* tuneFileCacheType;
FileCacheType tuneFileCacheTypeNum; // auto-generated based on tuneFileCacheType
int tuneFileCacheBufSize;
int tuneFileCacheBufNum; // 0 means automatic setting
unsigned tunePageCacheValidityMS;
unsigned tuneDirSubentryCacheValidityMS;
unsigned tuneFileSubentryCacheValidityMS;
unsigned tuneENOENTCacheValidityMS;
int tunePathBufSize;
int tunePathBufNum;
int tuneMsgBufSize;
int tuneMsgBufNum; // 0 means automatic setting
bool tuneRemoteFSync;
bool tuneUseGlobalFileLocks; // false means local flock/fcntl locks
bool tuneRefreshOnGetAttr; // false means don't refresh on getattr
unsigned tuneInodeBlockBits; // bitshift for optimal io size seen by stat() (2^n)
unsigned tuneInodeBlockSize; // auto-generated based on tuneInodeBlockBits
bool tuneEarlyCloseResponse; // don't wait for chunk files close result
bool tuneUseGlobalAppendLocks; // false means local append locks
bool tuneUseBufferedAppend; // false disables buffering of append writes
unsigned tuneStatFsCacheSecs; // 0 disables caching of free space info from servers
bool tuneCoherentBuffers; // try to keep buffer cache and page cache coherent
char* sysMgmtdHost;
char* sysInodeIDStyle;
InodeIDStyle sysInodeIDStyleNum; // auto-generated based on sysInodeIDStyle
bool sysCacheInvalidationVersion;
bool sysCreateHardlinksAsSymlinks;
unsigned sysMountSanityCheckMS;
bool sysSyncOnClose;
bool sysSessionCheckOnClose;
bool sysSessionChecksEnabled;
unsigned sysUpdateTargetStatesSecs;
unsigned sysTargetOfflineTimeoutSecs;
bool sysXAttrsEnabled;
CheckCapabilities sysXAttrsCheckCapabilities;
bool sysACLsEnabled;
bool sysXAttrsImplicitlyEnabled; // True when XAttrs have not been enabled in the config file
// but have been enabled by __Config_initImplicitVals
// because ACLs are enabled in the config and XAs are needed
// to store the ACLs.
bool sysBypassFileAccessCheckOnMeta; // bypass file access check on meta server
bool quotaEnabled;
enum EventLogMask eventLogMask;
/* workaround for rename of closed files on nfs */
bool sysRenameEbusyAsXdev;
// internals
StrCpyMap configMap;
// testing
unsigned remapConnectionFailureStatus;
};
char* Config_getCfgFile(Config* this)
{
return this->cfgFile;
}
int Config_getLogLevel(Config* this)
{
return this->logLevel;
}
bool Config_getLogClientID(Config* this)
{
return this->logClientID;
}
int Config_getConnClientPort(Config* this)
{
return this->connClientPort ? (this->connClientPort + this->connPortShift) : 0;
}
int Config_getConnMgmtdPort(Config* this)
{
return this->connMgmtdPort ? (this->connMgmtdPort + this->connPortShift) : 0;
}
int Config_getConnMgmtdGrpcPort(Config* this)
{
// not adding port shift here because connMgmtdGrpcPort is pulled from mgmtd and already shifted
return this->connMgmtdGrpcPort ? this->connMgmtdGrpcPort : 0;
}
void Config_setConnMgmtdGrpcPort(Config* this, int port)
{
this->connMgmtdGrpcPort = port;
}
bool Config_getConnUseRDMA(Config* this)
{
return this->connUseRDMA;
}
bool Config_getConnTCPFallbackEnabled(Config* this)
{
return this->connTCPFallbackEnabled;
}
unsigned Config_getConnMaxInternodeNum(Config* this)
{
return this->connMaxInternodeNum;
}
char* Config_getConnInterfacesFile(Config* this)
{
return this->connInterfacesFile;
}
char* Config_getConnInterfacesList(Config* this)
{
return this->connInterfacesList;
}
char* Config_getConnRDMAInterfacesFile(Config* this)
{
return this->connRDMAInterfacesFile;
}
unsigned Config_getConnFallbackExpirationSecs(Config* this)
{
return this->connFallbackExpirationSecs;
}
unsigned Config_getConnNumCommRetries(Config* this)
{
return this->connNumCommRetries;
}
unsigned Config_getConnCommRetrySecs(Config* this)
{
return this->connCommRetrySecs;
}
bool Config_getConnUnmountRetries(Config* this)
{
return this->connUnmountRetries;
}
int Config_getConnTCPRcvBufSize(Config* this)
{
return this->connTCPRcvBufSize;
}
int Config_getConnUDPRcvBufSize(Config* this)
{
return this->connUDPRcvBufSize;
}
unsigned Config_getConnRDMABufSize(Config* this)
{
return (unsigned) this->connRDMABufSize;
}
unsigned Config_getConnRDMAFragmentSize(Config* this)
{
return (unsigned) this->connRDMAFragmentSize;
}
unsigned Config_getConnRDMABufNum(Config* this)
{
return (unsigned) this->connRDMABufNum;
}
unsigned Config_getConnRDMAMetaBufSize(Config* this)
{
return (unsigned) this->connRDMAMetaBufSize;
}
unsigned Config_getConnRDMAMetaFragmentSize(Config* this)
{
return (unsigned) this->connRDMAMetaFragmentSize;
}
unsigned Config_getConnRDMAMetaBufNum(Config* this)
{
return (unsigned) this->connRDMAMetaBufNum;
}
int Config_getConnRDMATypeOfService(Config* this)
{
return this->connRDMATypeOfService;
}
char* Config_getConnRDMAKeyType(Config* this)
{
return this->connRDMAKeyType;
}
RDMAKeyType Config_getConnRDMAKeyTypeNum(Config* this)
{
return this->connRDMAKeyTypeNum;
}
unsigned Config_getRemapConnectionFailureStatus(Config* this)
{
return this->remapConnectionFailureStatus;
}
void Config_setRemapConnectionFailureStatus(Config* this, unsigned status)
{
this->remapConnectionFailureStatus = status;
}
char* Config_getConnNetFilterFile(Config* this)
{
return this->connNetFilterFile;
}
unsigned Config_getConnMaxConcurrentAttempts(Config* this)
{
return this->connMaxConcurrentAttempts;
}
char* Config_getConnAuthFile(Config* this)
{
return this->connAuthFile;
}
bool Config_getConnDisableAuthentication(Config* this)
{
return this->connDisableAuthentication;
}
uint64_t Config_getConnAuthHash(Config* this)
{
return this->connAuthHash;
}
char* Config_getConnTcpOnlyFilterFile(Config* this)
{
return this->connTcpOnlyFilterFile;
}
char* Config_getTunePreferredMetaFile(Config* this)
{
return this->tunePreferredMetaFile;
}
char* Config_getTunePreferredStorageFile(Config* this)
{
return this->tunePreferredStorageFile;
}
char* Config_getTuneFileCacheType(Config* this)
{
return this->tuneFileCacheType;
}
FileCacheType Config_getTuneFileCacheTypeNum(Config* this)
{
return this->tuneFileCacheTypeNum;
}
int Config_getTuneFileCacheBufSize(Config* this)
{
return this->tuneFileCacheBufSize;
}
int Config_getTuneFileCacheBufNum(Config* this)
{
return this->tuneFileCacheBufNum;
}
int Config_getTunePathBufSize(Config* this)
{
return this->tunePathBufSize;
}
int Config_getTunePathBufNum(Config* this)
{
return this->tunePathBufNum;
}
int Config_getTuneMsgBufSize(Config* this)
{
return this->tuneMsgBufSize;
}
int Config_getTuneMsgBufNum(Config* this)
{
return this->tuneMsgBufNum;
}
unsigned Config_getTunePageCacheValidityMS(Config* this)
{
return this->tunePageCacheValidityMS;
}
unsigned Config_getTuneDirSubentryCacheValidityMS(Config* this)
{
return this->tuneDirSubentryCacheValidityMS;
}
unsigned Config_getTuneFileSubentryCacheValidityMS(Config* this)
{
return this->tuneFileSubentryCacheValidityMS;
}
unsigned Config_getTuneENOENTCacheValidityMS(Config* this)
{
return this->tuneENOENTCacheValidityMS;
}
bool Config_getTuneRemoteFSync(Config* this)
{
return this->tuneRemoteFSync;
}
bool Config_getTuneUseGlobalFileLocks(Config* this)
{
return this->tuneUseGlobalFileLocks;
}
bool Config_getTuneRefreshOnGetAttr(Config* this)
{
return this->tuneRefreshOnGetAttr;
}
bool Config_getTuneCoherentBuffers(Config* this)
{
return this->tuneCoherentBuffers;
}
/**
* Special function to automatically enable TuneRefreshOnGetAttr, e.g. for NFS exports.
*
* Note: We do not use any locks here assuming the right value will propate to all cores rather
* soon.
*/
void Config_setTuneRefreshOnGetAttr(Config* this)
{
this->tuneRefreshOnGetAttr = true;
// do a memory barrier, so that other CPUs get the new value as soon as possible
smp_wmb();
}
unsigned Config_getTuneInodeBlockBits(Config* this)
{
return this->tuneInodeBlockBits;
}
unsigned Config_getTuneInodeBlockSize(Config* this)
{
return this->tuneInodeBlockSize;
}
bool Config_getTuneEarlyCloseResponse(Config* this)
{
return this->tuneEarlyCloseResponse;
}
bool Config_getTuneUseGlobalAppendLocks(Config* this)
{
return this->tuneUseGlobalAppendLocks;
}
bool Config_getTuneUseBufferedAppend(Config* this)
{
return this->tuneUseBufferedAppend;
}
unsigned Config_getTuneStatFsCacheSecs(Config* this)
{
return this->tuneStatFsCacheSecs;
}
char* Config_getSysMgmtdHost(Config* this)
{
return this->sysMgmtdHost;
}
char* Config_getSysInodeIDStyle(Config* this)
{
return this->sysInodeIDStyle;
}
InodeIDStyle Config_getSysInodeIDStyleNum(Config* this)
{
return this->sysInodeIDStyleNum;
}
bool Config_getSysCacheInvalidationVersion(Config* this)
{
return this->sysCacheInvalidationVersion;
}
bool Config_getSysCreateHardlinksAsSymlinks(Config* this)
{
return this->sysCreateHardlinksAsSymlinks;
}
unsigned Config_getSysMountSanityCheckMS(Config* this)
{
return this->sysMountSanityCheckMS;
}
bool Config_getSysSyncOnClose(Config* this)
{
return this->sysSyncOnClose;
}
bool Config_getSysSessionCheckOnClose(Config* this)
{
return this->sysSessionCheckOnClose;
}
bool Config_getSysSessionChecksEnabled(Config* this)
{
return this->sysSessionChecksEnabled;
}
unsigned Config_getSysUpdateTargetStatesSecs(Config* this)
{
return this->sysUpdateTargetStatesSecs;
}
unsigned Config_getSysTargetOfflineTimeoutSecs(Config* this)
{
return this->sysTargetOfflineTimeoutSecs;
}
bool Config_getSysXAttrsEnabled(Config* this)
{
return this->sysXAttrsEnabled;
}
CheckCapabilities Config_getSysXAttrsCheckCapabilities(Config* this)
{
return this->sysXAttrsCheckCapabilities;
}
bool Config_getSysACLsEnabled(Config* this)
{
return this->sysACLsEnabled;
}
bool Config_getSysXAttrsImplicitlyEnabled(Config* this)
{
return this->sysXAttrsImplicitlyEnabled;
}
bool Config_getSysBypassFileAccessCheckOnMeta(Config* this)
{
return this->sysBypassFileAccessCheckOnMeta;
}
bool Config_getQuotaEnabled(Config* this)
{
return this->quotaEnabled;
}
char* Config_getConnMessagingTimeouts(Config* this)
{
return this->connMessagingTimeouts;
}
char* Config_getConnRDMATimeouts(Config* this)
{
return this->connRDMATimeouts;
}
int Config_getConnRDMATimeoutConnect(Config* this)
{
return this->connRDMATimeoutConnect;
}
int Config_getConnRDMATimeoutCompletion(Config* this)
{
return this->connRDMATimeoutCompletion;
}
int Config_getConnRDMATimeoutFlowSend(Config* this)
{
return this->connRDMATimeoutFlowSend;
}
int Config_getConnRDMATimeoutFlowRecv(Config* this)
{
return this->connRDMATimeoutFlowRecv;
}
int Config_getConnRDMATimeoutPoll(Config* this)
{
return this->connRDMATimeoutPoll;
}
#endif /*CONFIG_H_*/

View File

@@ -0,0 +1,238 @@
#include <app/config/MountConfig.h>
#include <common/toolkit/list/StrCpyList.h>
#include <common/toolkit/list/StrCpyListIter.h>
#include <common/Common.h>
#include <linux/parser.h>
enum {
/* Mount options that take string arguments */
Opt_cfgFile,
Opt_logStdFile,
Opt_sysMgmtdHost,
Opt_tunePreferredMetaFile,
Opt_tunePreferredStorageFile,
Opt_connInterfacesList,
Opt_connAuthFile,
Opt_connDisableAuthentication,
/* Mount options that take integer arguments */
Opt_logLevel,
Opt_connPortShift,
Opt_connMgmtdPort,
Opt_sysMountSanityCheckMS,
/* Mount options that take no arguments */
Opt_grpid,
Opt_err
};
static match_table_t fhgfs_mount_option_tokens =
{
/* Mount options that take string arguments */
{ Opt_cfgFile, "cfgFile=%s" },
{ Opt_logStdFile, "logStdFile=%s" },
{ Opt_sysMgmtdHost, "sysMgmtdHost=%s" },
{ Opt_tunePreferredMetaFile, "tunePreferredMetaFile=%s" },
{ Opt_tunePreferredStorageFile, "tunePreferredStorageFile=%s" },
{ Opt_connInterfacesList, "connInterfacesList=%s" },
{ Opt_connAuthFile, "connAuthFile=%s" },
{ Opt_connDisableAuthentication, "connDisableAuthentication=%s" },
/* Mount options that take integer arguments */
{ Opt_logLevel, "logLevel=%d" },
{ Opt_connPortShift, "connPortShift=%d" },
{ Opt_connMgmtdPort, "connMgmtdPort=%u" },
{ Opt_sysMountSanityCheckMS, "sysMountSanityCheckMS=%u" },
{ Opt_grpid, "grpid" },
{ Opt_err, NULL }
};
bool MountConfig_parseFromRawOptions(MountConfig* this, char* mountOptions)
{
char* currentOption;
if(!mountOptions)
{
printk_fhgfs_debug(KERN_INFO, "Mount options = <none>\n");
return true;
}
printk_fhgfs_debug(KERN_INFO, "Mount options = '%s'\n", mountOptions);
while( (currentOption = strsep(&mountOptions, ",") ) != NULL)
{
substring_t args[MAX_OPT_ARGS];
int tokenID;
if(!*currentOption)
continue; // skip empty string
tokenID = match_token(currentOption, fhgfs_mount_option_tokens, args);
switch(tokenID)
{
/* Mount options that take STRING arguments */
case Opt_cfgFile:
{
SAFE_KFREE(this->cfgFile);
this->cfgFile = match_strdup(args);// (string kalloc'ed => needs kfree later)
} break;
case Opt_logStdFile:
{
SAFE_KFREE(this->logStdFile);
this->logStdFile = match_strdup(args); // (string kalloc'ed => needs kfree later)
} break;
case Opt_sysMgmtdHost:
{
SAFE_KFREE(this->sysMgmtdHost);
this->sysMgmtdHost = match_strdup(args); // (string kalloc'ed => needs kfree later)
} break;
case Opt_tunePreferredMetaFile:
{
SAFE_KFREE(this->tunePreferredMetaFile);
this->tunePreferredMetaFile = match_strdup(args); // (string kalloc'ed => needs kfree later)
} break;
case Opt_tunePreferredStorageFile:
{
SAFE_KFREE(this->tunePreferredStorageFile);
this->tunePreferredStorageFile = match_strdup(args); // (string kalloc'ed => needs kfree later)
} break;
case Opt_connInterfacesList:
{
SAFE_KFREE(this->connInterfacesList);
this->connInterfacesList = match_strdup(args);
} break;
case Opt_connAuthFile:
{
SAFE_KFREE(this->connAuthFile);
this->connAuthFile = match_strdup(args);
} break;
case Opt_connDisableAuthentication:
{
SAFE_KFREE(this->connDisableAuthentication);
this->connDisableAuthentication = match_strdup(args);
} break;
/* Mount options that take INTEGER arguments */
case Opt_logLevel:
{
if(match_int(args, &this->logLevel) )
goto err_exit_invalid_option;
this->logLevelDefined = true;
} break;
case Opt_connPortShift:
{
if(match_int(args, &this->connPortShift) )
goto err_exit_invalid_option;
this->connPortShiftDefined = true;
} break;
case Opt_connMgmtdPort:
{
if(match_int(args, &this->connMgmtdPort) )
goto err_exit_invalid_option;
this->connMgmtdPortDefined = true;
} break;
case Opt_sysMountSanityCheckMS:
{
if(match_int(args, &this->sysMountSanityCheckMS) )
goto err_exit_invalid_option;
this->sysMountSanityCheckMSDefined = true;
} break;
case Opt_grpid:
this->grpid = true;
break;
default:
goto err_exit_unknown_option;
}
}
return true;
err_exit_unknown_option:
printk_fhgfs(KERN_WARNING, "Unknown mount option: '%s'\n", currentOption);
return false;
err_exit_invalid_option:
printk_fhgfs(KERN_WARNING, "Invalid mount option: '%s'\n", currentOption);
return false;
}
void MountConfig_showOptions(MountConfig* this, struct seq_file* sf)
{
if (this->cfgFile)
seq_printf(sf, ",cfgFile=%s", this->cfgFile);
if (this->logStdFile)
seq_printf(sf, ",logStdFile=%s", this->logStdFile);
if (this->sysMgmtdHost)
seq_printf(sf, ",sysMgmtdHost=%s", this->sysMgmtdHost);
if (this->tunePreferredMetaFile)
seq_printf(sf, ",tunePreferredMetaFile=%s", this->tunePreferredMetaFile);
if (this->tunePreferredStorageFile)
seq_printf(sf, ",tunePreferredStorageFile=%s", this->tunePreferredStorageFile);
if (this->connInterfacesList)
seq_printf(sf, ",connInterfacesList=%s", this->connInterfacesList);
if (this->connAuthFile)
seq_printf(sf, ",connAuthFile=%s", this->connInterfacesList);
if (this->connDisableAuthentication)
seq_printf(sf, ",connDisableAuthentication=%s", this->connInterfacesList);
if (this->logLevelDefined)
seq_printf(sf, ",logLevel=%d", this->logLevel);
if (this->connPortShiftDefined)
seq_printf(sf, ",connPortShift=%d", this->connPortShift);
if (this->connMgmtdPortDefined)
seq_printf(sf, ",connMgmtdPort=%u", this->connMgmtdPort);
if (this->sysMountSanityCheckMSDefined)
seq_printf(sf, ",sysMountSanityCheckMS=%u", this->sysMountSanityCheckMS);
if (this->grpid)
seq_printf(sf, ",grpid");
}

View File

@@ -0,0 +1,80 @@
#ifndef OPEN_MOUNTCONFIG_H_
#define OPEN_MOUNTCONFIG_H_
#include <common/Common.h>
#include <linux/seq_file.h>
struct MountConfig;
typedef struct MountConfig MountConfig;
static inline void MountConfig_init(MountConfig* this);
static inline MountConfig* MountConfig_construct(void);
static inline void MountConfig_uninit(MountConfig* this);
static inline void MountConfig_destruct(MountConfig* this);
extern bool MountConfig_parseFromRawOptions(MountConfig* this, char* mountOptions);
extern void MountConfig_showOptions(MountConfig* this, struct seq_file* sf);
struct MountConfig
{
char* cfgFile;
char* logStdFile;
char* sysMgmtdHost;
char* tunePreferredMetaFile;
char* tunePreferredStorageFile;
bool logLevelDefined; // true if the value has been specified
bool connPortShiftDefined; // true if the value has been specified
bool connMgmtdPortDefined; // true if the value has been specified
bool sysMountSanityCheckMSDefined; // true if the value has been specified
int logLevel;
unsigned connPortShift;
unsigned connMgmtdPort;
unsigned sysMountSanityCheckMS;
char* connInterfacesList;
char* connAuthFile;
char* connDisableAuthentication;
bool grpid;
};
void MountConfig_init(MountConfig* this)
{
memset(this, 0, sizeof(*this) );
}
struct MountConfig* MountConfig_construct(void)
{
struct MountConfig* this = (MountConfig*)os_kmalloc(sizeof(*this) );
MountConfig_init(this);
return this;
}
void MountConfig_uninit(MountConfig* this)
{
SAFE_KFREE(this->cfgFile);
SAFE_KFREE(this->logStdFile);
SAFE_KFREE(this->sysMgmtdHost);
SAFE_KFREE(this->tunePreferredMetaFile);
SAFE_KFREE(this->tunePreferredStorageFile);
SAFE_KFREE(this->connInterfacesList);
SAFE_KFREE(this->connAuthFile);
SAFE_KFREE(this->connDisableAuthentication);
}
void MountConfig_destruct(MountConfig* this)
{
MountConfig_uninit(this);
kfree(this);
}
#endif /*OPEN_MOUNTCONFIG_H_*/