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,89 @@
#ifndef INT64CPYVEC_H_
#define INT64CPYVEC_H_
#include <common/toolkit/list/Int64CpyList.h>
/**
* Note: Derived from the corresponding list. Use the list iterator for read-only access
*/
struct Int64CpyVec;
typedef struct Int64CpyVec Int64CpyVec;
static inline void Int64CpyVec_init(Int64CpyVec* this);
static inline void Int64CpyVec_uninit(Int64CpyVec* this);
static inline void Int64CpyVec_append(Int64CpyVec* this, int64_t value);
static inline size_t Int64CpyVec_length(Int64CpyVec* this);
static inline void Int64CpyVec_clear(Int64CpyVec* this);
// getters & setters
static inline int64_t Int64CpyVec_at(Int64CpyVec* this, size_t index);
struct Int64CpyVec
{
Int64CpyList Int64CpyList;
int64_t** vecArray;
size_t vecArrayLen;
};
void Int64CpyVec_init(Int64CpyVec* this)
{
Int64CpyList_init( (Int64CpyList*)this);
this->vecArrayLen = 4;
this->vecArray = (int64_t**)os_kmalloc(
this->vecArrayLen * sizeof(int64_t*) );
}
void Int64CpyVec_uninit(Int64CpyVec* this)
{
kfree(this->vecArray);
Int64CpyList_uninit( (Int64CpyList*)this);
}
void Int64CpyVec_append(Int64CpyVec* this, int64_t value)
{
PointerListElem* lastElem;
int64_t* lastElemValuePointer;
Int64CpyList_append( (Int64CpyList*)this, value);
// check if we have enough buffer space for new elem
if(Int64CpyList_length( (Int64CpyList*)this) > this->vecArrayLen)
{ // double vector array size (create new, copy, exchange, delete old)
int64_t** newVecArray =
(int64_t**)os_kmalloc(this->vecArrayLen*sizeof(int64_t*)*2);
memcpy(newVecArray, this->vecArray, this->vecArrayLen*sizeof(int64_t*) );
kfree(this->vecArray);
this->vecArrayLen = this->vecArrayLen * 2;
this->vecArray = newVecArray;
}
// get last elem and add the valuePointer to the array
lastElem = PointerList_getTail( (PointerList*)this);
lastElemValuePointer = (int64_t*)lastElem->valuePointer;
(this->vecArray)[Int64CpyList_length( (Int64CpyList*)this)-1] = lastElemValuePointer;
}
size_t Int64CpyVec_length(Int64CpyVec* this)
{
return Int64CpyList_length( (Int64CpyList*)this);
}
int64_t Int64CpyVec_at(Int64CpyVec* this, size_t index)
{
BEEGFS_BUG_ON_DEBUG(index >= Int64CpyVec_length(this), "Index out of bounds");
return *(this->vecArray[index]);
}
void Int64CpyVec_clear(Int64CpyVec* this)
{
Int64CpyList_clear( (Int64CpyList*)this);
}
#endif /*INT64CPYVEC_H_*/

View File

@@ -0,0 +1,89 @@
#ifndef STRCPYVEC_H_
#define STRCPYVEC_H_
#include <common/toolkit/list/StrCpyList.h>
/**
* Note: Derived from the corresponding list. Use the list iterator for read-only access
*/
struct StrCpyVec;
typedef struct StrCpyVec StrCpyVec;
static inline void StrCpyVec_init(StrCpyVec* this);
static inline void StrCpyVec_uninit(StrCpyVec* this);
static inline void StrCpyVec_append(StrCpyVec* this, const char* valuePointer);
static inline size_t StrCpyVec_length(StrCpyVec* this);
static inline void StrCpyVec_clear(StrCpyVec* this);
// getters & setters
static inline char* StrCpyVec_at(StrCpyVec* this, size_t index);
struct StrCpyVec
{
StrCpyList strCpyList;
char** vecArray;
size_t vecArrayLen;
};
void StrCpyVec_init(StrCpyVec* this)
{
StrCpyList_init( (StrCpyList*)this);
this->vecArrayLen = 4;
this->vecArray = (char**)os_kmalloc(
this->vecArrayLen * sizeof(char*) );
}
void StrCpyVec_uninit(StrCpyVec* this)
{
kfree(this->vecArray);
StrCpyList_uninit( (StrCpyList*)this);
}
void StrCpyVec_append(StrCpyVec* this, const char* valuePointer)
{
PointerListElem* lastElem;
char* lastElemValuePointer;
StrCpyList_append( (StrCpyList*)this, valuePointer);
// check if we have enough buffer space for new elem
if(StrCpyList_length( (StrCpyList*)this) > this->vecArrayLen)
{ // double vector array size (create new, copy, exchange, delete old)
char** newVecArray = (char**)os_kmalloc(this->vecArrayLen*sizeof(char*)*2);
memcpy(newVecArray, this->vecArray, this->vecArrayLen*sizeof(char*) );
kfree(this->vecArray);
this->vecArrayLen = this->vecArrayLen * 2;
this->vecArray = newVecArray;
}
// get last elem and add the valuePointer to the array
lastElem = PointerList_getTail( (PointerList*)this);
lastElemValuePointer = (char*)lastElem->valuePointer;
(this->vecArray)[StrCpyList_length( (StrCpyList*)this)-1] = lastElemValuePointer;
}
size_t StrCpyVec_length(StrCpyVec* this)
{
return StrCpyList_length( (StrCpyList*)this);
}
char* StrCpyVec_at(StrCpyVec* this, size_t index)
{
BEEGFS_BUG_ON_DEBUG(index >= StrCpyVec_length(this), "Index out of bounds");
return (this->vecArray)[index];
}
void StrCpyVec_clear(StrCpyVec* this)
{
StrCpyList_clear( (StrCpyList*)this);
}
#endif /*STRCPYVEC_H_*/

View File

@@ -0,0 +1,90 @@
#ifndef UINT16VEC_H_
#define UINT16VEC_H_
#include <common/toolkit/list/UInt16List.h>
struct UInt16Vec;
typedef struct UInt16Vec UInt16Vec;
static inline void UInt16Vec_init(UInt16Vec* this);
static inline void UInt16Vec_uninit(UInt16Vec* this);
static inline void UInt16Vec_append(UInt16Vec* this, uint16_t value);
static inline size_t UInt16Vec_length(UInt16Vec* this);
static inline void UInt16Vec_clear(UInt16Vec* this);
// getters & setters
static inline uint16_t UInt16Vec_at(UInt16Vec* this, size_t index);
/**
* Note: Derived from the corresponding list. Use the list iterator for read-only access
*/
struct UInt16Vec
{
UInt16List UInt16List;
uint16_t* vecArray;
size_t vecArrayLen;
};
void UInt16Vec_init(UInt16Vec* this)
{
UInt16List_init( (UInt16List*)this);
this->vecArrayLen = 4;
this->vecArray = (uint16_t*)os_kmalloc(this->vecArrayLen * sizeof(uint16_t) );
}
void UInt16Vec_uninit(UInt16Vec* this)
{
kfree(this->vecArray);
UInt16List_uninit( (UInt16List*)this);
}
void UInt16Vec_append(UInt16Vec* this, uint16_t value)
{
size_t newListLen;
UInt16List_append( (UInt16List*)this, value);
newListLen = UInt16List_length( (UInt16List*)this);
// check if we have enough buffer space for new elem
if(newListLen > this->vecArrayLen)
{ // double vector array size: alloc new, copy values, delete old, switch to new
uint16_t* newVecArray = (uint16_t*)os_kmalloc(this->vecArrayLen * sizeof(uint16_t) * 2);
memcpy(newVecArray, this->vecArray, this->vecArrayLen * sizeof(uint16_t) );
kfree(this->vecArray);
this->vecArrayLen = this->vecArrayLen * 2;
this->vecArray = newVecArray;
}
// add value to last array elem (determine last used index based on list length)
(this->vecArray)[newListLen-1] = value;
}
size_t UInt16Vec_length(UInt16Vec* this)
{
return UInt16List_length( (UInt16List*)this);
}
uint16_t UInt16Vec_at(UInt16Vec* this, size_t index)
{
BEEGFS_BUG_ON_DEBUG(index >= UInt16Vec_length(this), "Index out of bounds");
return this->vecArray[index];
}
void UInt16Vec_clear(UInt16Vec* this)
{
UInt16List_clear( (UInt16List*)this);
}
#endif /* UINT16VEC_H_ */

View File

@@ -0,0 +1,92 @@
#ifndef UINT8VEC_H_
#define UINT8VEC_H_
#include <common/toolkit/list/UInt8List.h>
struct UInt8Vec;
typedef struct UInt8Vec UInt8Vec;
static inline void UInt8Vec_init(UInt8Vec* this);
static inline void UInt8Vec_uninit(UInt8Vec* this);
static inline void UInt8Vec_append(UInt8Vec* this, uint8_t value);
static inline size_t UInt8Vec_length(UInt8Vec* this);
static inline void UInt8Vec_clear(UInt8Vec* this);
// getters & setters
static inline uint8_t UInt8Vec_at(UInt8Vec* this, size_t index);
/**
* Note: Derived from the corresponding list. Use the list iterator for read-only access
*/
struct UInt8Vec
{
UInt8List UInt8List;
uint8_t* vecArray;
size_t vecArrayLen;
};
void UInt8Vec_init(UInt8Vec* this)
{
UInt8List_init( (UInt8List*)this);
this->vecArrayLen = 4;
this->vecArray = (uint8_t*)os_kmalloc(this->vecArrayLen * sizeof(uint8_t) );
}
void UInt8Vec_uninit(UInt8Vec* this)
{
kfree(this->vecArray);
UInt8List_uninit( (UInt8List*)this);
}
void UInt8Vec_append(UInt8Vec* this, uint8_t value)
{
size_t newListLen;
UInt8List_append( (UInt8List*)this, value);
newListLen = UInt8List_length( (UInt8List*)this);
// check if we have enough buffer space for new elem
if(newListLen > this->vecArrayLen)
{ // double vector array size: alloc new, copy values, delete old, switch to new
uint8_t* newVecArray = (uint8_t*)os_kmalloc(this->vecArrayLen * sizeof(uint8_t) * 2);
memcpy(newVecArray, this->vecArray, this->vecArrayLen * sizeof(uint8_t) );
kfree(this->vecArray);
this->vecArrayLen = this->vecArrayLen * 2;
this->vecArray = newVecArray;
}
// add value to last array elem (determine last used index based on list length)
(this->vecArray)[newListLen-1] = value;
}
size_t UInt8Vec_length(UInt8Vec* this)
{
return UInt8List_length( (UInt8List*)this);
}
uint8_t UInt8Vec_at(UInt8Vec* this, size_t index)
{
BEEGFS_BUG_ON_DEBUG(index >= UInt8Vec_length(this), "Index out of bounds");
return this->vecArray[index];
}
void UInt8Vec_clear(UInt8Vec* this)
{
UInt8List_clear( (UInt8List*)this);
}
#endif /* UINT8VEC_H_ */