X-Git-Url: http://git.vrable.net/?a=blobdiff_plain;f=inode.h;fp=inode.h;h=0000000000000000000000000000000000000000;hb=a6d16121ebce069728e454b9bd4c5716d59c8809;hp=23361c5048c0e4576de555459a62bef696aceb10;hpb=2246171d841d34e6368e340a6b76b7ee9d9a1084;p=bluesky.git diff --git a/inode.h b/inode.h deleted file mode 100644 index 23361c5..0000000 --- a/inode.h +++ /dev/null @@ -1,75 +0,0 @@ -#ifndef _BLUESKY_INODE_H -#define _BLUESKY_INODE_H - -#include -#include - -/* File types. The numeric values are chosen to match with those used in - * NFSv3. */ -enum BlueSkyFileType { - BLUESKY_INVALID = 0, - BLUESKY_REGULAR = 1, - BLUESKY_DIRECTORY = 2, - BLUESKY_BLOCK = 3, - BLUESKY_CHARACTER = 4, - BLUESKY_SYMLINK = 5, - BLUESKY_SOCKET = 6, - BLUESKY_FIFO = 7, -}; - -/* Filesystem state. Each filesystem which is exported is represented by a - * single bluesky_fs structure in memory. */ -typedef struct { - GMutex *lock; - - gchar *name; /* Descriptive name for the filesystem */ - GHashTable *inodes; /* Cached inodes */ - uint64_t next_inum; /* Next available inode for allocation */ -} BlueSkyFS; - -/* Timestamp, measured in microseconds since the Unix epoch. */ -typedef int64_t bluesky_time; - -/* In-memory representation of an inode within a Blue Sky server. This - * corresponds roughly with information that is committed to persistent - * storage. */ -typedef struct { - gint refcnt; /* May be accessed atomically without lock */ - GMutex *lock; - - int type; - uint32_t mode; - uint32_t uid, gid; - uint32_t nlink; - - /* Rather than track an inode number and generation number, we will simply - * never re-use a fileid after a file is deleted. 64 bits should be enough - * that we don't exhaust the identifier space. */ - uint64_t inum; - - uint64_t change_count; /* Incremented each with each change made */ - int64_t atime; /* Microseconds since the Unix epoch */ - int64_t ctime; - int64_t mtime; - int64_t ntime; /* "new time": time object was created */ - - /* File-specific fields */ - uint64_t size; - - /* Directory-specific fields */ - GSequence *dirents; -} BlueSkyInode; - -/* A directory entry. The name is UTF-8 and is a freshly-allocated string. - * The name is hashed to a 64-bit value, and the directory entries are sorted - * by hash value (the hash value can then be used as a cookie for resuming a - * READDIR call). */ -typedef struct { - gchar *name; - uint64_t hash; - uint64_t inum; -} BlueSkyDirent ; - -uint64_t bluesky_directory_hash(gchar *name); - -#endif