-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinode.h
More file actions
86 lines (75 loc) · 1.83 KB
/
inode.h
File metadata and controls
86 lines (75 loc) · 1.83 KB
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#ifndef INODE_H
#define INODE_H
#include <git2/oid.h>
#include <sys/stat.h>
#define T_DIR S_IFDIR
#define T_FILE S_IFREG
#define nlink(x) ((x) == T_DIR ? 2 : 1)
#define INODE_STATIC (1u << 0)
#define INODE_DELETED (1u << 1)
#define INODE_DETACHED (1u << 2)
#define INODE_READY (1u << 3)
#define INODE_POPULATING (1u << 4)
// static inodes
enum {
ROOT = 1,
BRANCHES,
TAGS,
OBJECTS,
HEAD,
REMOTES,
HEADS,
TOP_INODES,
};
enum {
T_GENERIC,
T_BRANCHES,
T_TAGS,
T_REMOTES,
T_COMMIT,
T_PARENT = T_COMMIT,
T_TREE,
T_HASH,
T_MSG,
T_OBJECTS,
T_ALL
};
struct git_repository;
struct git_object;
struct inode;
struct inode_ops {
int (*update)(struct git_repository *, struct inode *);
struct inode * (*lookup)(struct git_repository *, struct inode *,const char *);
int (*open)(struct git_repository *, struct inode *);
};
struct inode {
char *name;
mode_t mode;
unsigned type;
unsigned long ino;
unsigned flags;
unsigned long nlookup;
size_t size;
time_t mtime;
union {
struct inode *parent;
unsigned long parent_ino;
};
struct inode *sibling;
struct inode *child;
struct inode *retired;
struct inode_ops *ops;
struct git_object *obj;
git_oid oid;
};
extern struct inode_ops *get_inode_ops(unsigned);
#define aload(p) __atomic_load_n(p, __ATOMIC_ACQUIRE)
#define astore(p, v) __atomic_store_n(p, v, __ATOMIC_RELEASE)
#define axchg(p, v) __atomic_exchange_n(p, v, __ATOMIC_ACQ_REL)
#define acas(p, e, d) __atomic_compare_exchange_n(p, e, d, 1, \
__ATOMIC_ACQ_REL, __ATOMIC_ACQUIRE)
#define afadd(p, v) __atomic_fetch_add(p, v, __ATOMIC_ACQ_REL)
#define afsub(p, v) __atomic_fetch_sub(p, v, __ATOMIC_ACQ_REL)
#define afor(p, v) __atomic_fetch_or(p, v, __ATOMIC_RELEASE)
#define afand(p, v) __atomic_fetch_and(p, v, __ATOMIC_RELEASE)
#endif