File: node.c

package info (click to toggle)
mergerfs 2.40.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 5,000 kB
  • sloc: cpp: 58,559; ansic: 17,241; makefile: 348; python: 156; sh: 119
file content (60 lines) | stat: -rw-r--r-- 651 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#include "node.h"

#include "lfmp.h"

static lfmp_t g_NODE_FMP;

static
__attribute__((constructor))
void
node_constructor()
{
  lfmp_init(&g_NODE_FMP,sizeof(node_t),256);
}

static
__attribute__((destructor))
void
node_destructor()
{
  lfmp_destroy(&g_NODE_FMP);
}

node_t *
node_alloc()
{
  return lfmp_calloc(&g_NODE_FMP);
}

void
node_free(node_t *node_)
{
  lfmp_free(&g_NODE_FMP,node_);
}

int
node_gc1()
{
  return lfmp_gc(&g_NODE_FMP);
}

void
node_gc()
{
  int rv;
  int fails;

  fails = 0;
  do
    {
      rv = node_gc1();
      if(rv == 0)
        fails++;
    } while(rv || (fails < 3));
}

lfmp_t*
node_lfmp()
{
  return &g_NODE_FMP;
}