Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
KoyamaSohei committed Mar 8, 2024
1 parent 0868cc1 commit 9610d60
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions finchfsd/fs_server.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
#include "find.h"

struct entry;
struct entrytree {
struct entry *rbh_root;
};
RB_HEAD(entrytree, entry);
struct entry {
char *name;
mode_t mode;
Expand All @@ -32,6 +30,14 @@ struct entry {

typedef struct entry entry_t;

static int
entry_compare(entry_t *a, entry_t *b)
{
return strcmp(a->name, b->name);
}

RB_GENERATE(entrytree, entry, link, entry_compare);

struct worker_ctx {
int rank;
int nprocs;
Expand Down Expand Up @@ -72,14 +78,6 @@ alloc_ino(struct worker_ctx *ctx)
return (i_ino);
}

static int
entry_compare(entry_t *a, entry_t *b)
{
return strcmp(a->name, b->name);
}

RB_GENERATE(entrytree, entry, link, entry_compare);

static void
free_meta_tree(entry_t *entry)
{
Expand Down

0 comments on commit 9610d60

Please sign in to comment.