projects
/
bluesky.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Hook NFS proxy together with BlueSky core.
[bluesky.git]
/
bluesky.h
diff --git
a/bluesky.h
b/bluesky.h
index
068173f
..
40c989b
100644
(file)
--- a/
bluesky.h
+++ b/
bluesky.h
@@
-14,8
+14,7
@@
/* File types. The numeric values are chosen to match with those used in
* NFSv3. */
/* File types. The numeric values are chosen to match with those used in
* NFSv3. */
-enum BlueSkyFileType {
- BLUESKY_INVALID = 0,
+typedef enum {
BLUESKY_REGULAR = 1,
BLUESKY_DIRECTORY = 2,
BLUESKY_BLOCK = 3,
BLUESKY_REGULAR = 1,
BLUESKY_DIRECTORY = 2,
BLUESKY_BLOCK = 3,
@@
-23,7
+22,7
@@
enum BlueSkyFileType {
BLUESKY_SYMLINK = 5,
BLUESKY_SOCKET = 6,
BLUESKY_FIFO = 7,
BLUESKY_SYMLINK = 5,
BLUESKY_SOCKET = 6,
BLUESKY_FIFO = 7,
-};
+}
BlueSkyFileType
;
/* Filesystem state. Each filesystem which is exported is represented by a
* single bluesky_fs structure in memory. */
/* Filesystem state. Each filesystem which is exported is represented by a
* single bluesky_fs structure in memory. */
@@
-35,6
+34,9
@@
typedef struct {
uint64_t next_inum; /* Next available inode for allocation */
} BlueSkyFS;
uint64_t next_inum; /* Next available inode for allocation */
} BlueSkyFS;
+/* Inode number of the root directory. */
+#define BLUESKY_ROOT_INUM 1
+
/* Timestamp, measured in microseconds since the Unix epoch. */
typedef int64_t bluesky_time;
/* Timestamp, measured in microseconds since the Unix epoch. */
typedef int64_t bluesky_time;
@@
-45,7
+47,7
@@
typedef struct {
gint refcnt; /* May be accessed atomically without lock */
GMutex *lock;
gint refcnt; /* May be accessed atomically without lock */
GMutex *lock;
-
int
type;
+
BlueSkyFileType
type;
uint32_t mode;
uint32_t uid, gid;
uint32_t nlink;
uint32_t mode;
uint32_t uid, gid;
uint32_t nlink;
@@
-66,6
+68,7
@@
typedef struct {
/* Directory-specific fields */
GSequence *dirents;
/* Directory-specific fields */
GSequence *dirents;
+ uint64_t parent_inum; /* inode for ".."; 0 if the root directory */
} BlueSkyInode;
/* A directory entry. The name is UTF-8 and is a freshly-allocated string.
} BlueSkyInode;
/* A directory entry. The name is UTF-8 and is a freshly-allocated string.
@@
-80,7
+83,10
@@
typedef struct {
int64_t bluesky_get_current_time();
uint64_t bluesky_fs_alloc_inode(BlueSkyFS *fs);
int64_t bluesky_get_current_time();
uint64_t bluesky_fs_alloc_inode(BlueSkyFS *fs);
-BlueSkyInode *bluesky_new_inode(uint64_t inum);
+BlueSkyInode *bluesky_new_inode(uint64_t inum, BlueSkyFileType type);
+
+BlueSkyInode *bluesky_get_inode(BlueSkyFS *fs, uint64_t inum);
+void bluesky_insert_inode(BlueSkyFS *fs, BlueSkyInode *inode);
void bluesky_dirent_destroy(gpointer dirent);
uint64_t bluesky_directory_hash(gchar *name);
void bluesky_dirent_destroy(gpointer dirent);
uint64_t bluesky_directory_hash(gchar *name);