mirror of
https://github.com/trapexit/mergerfs.git
synced 2026-10-26 19:01:56 -04:00
node.cpp
This commit is contained in:
parent
95e62e6a98
commit
e9bfa96f26
21 changed files with 293 additions and 708 deletions
36
libfuse/lib/fuse_req.cpp
Normal file
36
libfuse/lib/fuse_req.cpp
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#include "fuse_req.hpp"
|
||||
|
||||
#include <cstddef>
|
||||
#include <cstdlib>
|
||||
|
||||
typedef struct stack_t stack_t;
|
||||
struct stack_t
|
||||
{
|
||||
stack_t *next;
|
||||
};
|
||||
|
||||
thread_local static stack_t *g_stack = NULL;
|
||||
|
||||
fuse_req_t*
|
||||
fuse_req_alloc()
|
||||
{
|
||||
if(g_stack == NULL)
|
||||
return (fuse_req_t*)calloc(1,sizeof(fuse_req_t));
|
||||
|
||||
fuse_req_t *req;
|
||||
|
||||
req = (fuse_req_t*)g_stack;
|
||||
g_stack = g_stack->next;
|
||||
|
||||
return req;
|
||||
}
|
||||
|
||||
void
|
||||
fuse_req_free(fuse_req_t *req_)
|
||||
{
|
||||
stack_t *stack;
|
||||
|
||||
stack = (stack_t*)req_;
|
||||
stack->next = g_stack;
|
||||
g_stack = stack;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue