-
Notifications
You must be signed in to change notification settings - Fork 10
/
inode.h
59 lines (43 loc) · 2.31 KB
/
inode.h
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
/*
runfs: a self-cleaning filesystem for runtime state.
Copyright (C) 2015 Jude Nelson
This program is dual-licensed: you can redistribute it and/or modify
it under the terms of the GNU General Public License version 3 or later as
published by the Free Software Foundation. For the terms of this
license, see LICENSE.LGPLv3+ or <http://www.gnu.org/licenses/>.
You are free to use this program under the terms of the GNU General
Public License, but WITHOUT ANY WARRANTY; without even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
Alternatively, you are free to use this program under the terms of the
Internet Software Consortium License, but WITHOUT ANY WARRANTY; without
even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
For the terms of this license, see LICENSE.ISC or
<http://www.isc.org/downloads/software-support-policy/isc-license/>.
*/
#ifndef _RUNFS_INODE_H_
#define _RUNFS_INODE_H_
#include <fskit/fskit.h>
#include <pstat/libpstat.h>
#include "util.h"
#define RUNFS_PIDFILE_BUF_LEN 50
#define RUNFS_VERIFY_INODE 0x1
#define RUNFS_VERIFY_MTIME 0x2
#define RUNFS_VERIFY_SIZE 0x4
#define RUNFS_VERIFY_PATH 0x8
#define RUNFS_VERIFY_STARTTIME 0x10
#define RUNFS_VERIFY_ALL 0x1F
#define RUNFS_VERIFY_DEFAULT (RUNFS_VERIFY_INODE | RUNFS_VERIFY_MTIME | RUNFS_VERIFY_SIZE | RUNFS_VERIFY_STARTTIME)
// information for an inode
struct runfs_inode {
struct pstat* ps; // process owner status
char* contents; // contents of the file
off_t size; // size of the file
size_t contents_len; // size of the contents buffer
bool deleted; // if true, then consider the associated fskit entry deleted
int verify_discipline; // bit flags of RUNFS_VERIFY_* that control how strict we are in verifying the accessing process
};
int runfs_inode_init( struct runfs_inode* inode, pid_t pid, int verify_discipline );
int runfs_inode_free( struct runfs_inode* inode );
int runfs_inode_is_valid( struct runfs_inode* inode );
#endif