Index: server/fen-data.h
===================================================================
--- server/fen-data.h	(revision 0)
+++ server/fen-data.h	(revision 0)
@@ -0,0 +1,73 @@
+/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/* vim:set expandtab ts=4 shiftwidth=4: */
+
+#include <port.h>
+#include <glib.h>
+
+#ifndef _FEN_DATA_H_
+#define _FEN_DATA_H_
+
+#define FN_PATH(fp)	(((fnode_t *)(fp))->fobj.fo_name)
+
+typedef struct fnode fnode_t;
+typedef void (*port_emit_events_cb) (fnode_t *f, int events);
+
+struct fnode
+{
+	/* must be the first member */
+	file_obj_t fobj;
+	
+	/* to identify if the path is dir */
+	gboolean is_dir;
+
+    /* the number of mondir subs this fnode has */
+    int md_ref;
+
+    /* protect above all */
+	pthread_mutex_t prop_lock;
+
+    /* state */
+	pthread_mutex_t ref_lock;
+    int ref;
+
+	/* lock/unlock by fn_hash, protect the following members  */
+	pthread_mutex_t fn_lock;
+
+	/* List of subscriptions monitoring this fnode/path */
+	GList *subs;
+
+	/* the parent fnode monitoring the directory of this fnode/path */
+    fnode_t *parent;
+
+/* private data */
+
+    /* call backs */
+    port_emit_events_cb emit_events;
+
+    /* fen-kernel private */
+    void *pn;
+    gboolean is_poll;
+};
+
+/* fnode functions */
+fnode_t *fnode_new (const gchar *path, port_emit_events_cb emit_events);
+void fnode_delete (fnode_t *fn);
+void fnode_set_stat (fnode_t *f, struct stat *sbuf);
+gboolean fnode_is_dir (fnode_t *f);
+void fnode_emit_events (fnode_t *f, int events);
+
+/* path <-> fnode_t hash */
+gboolean fn_hash_init ();
+fnode_t *fn_hash_safe_node_new (const gchar *file_name,
+                                 port_emit_events_cb emit_events);
+fnode_t *fn_hash_safe_node_ref (fnode_t *f);
+fnode_t *fn_hash_safe_node_unref (fnode_t *f);
+fnode_t *fn_hash_safe_lookup (const gchar *file_name);
+gint fn_hash_safe_node_remove (fnode_t *f);
+void fn_hash_safe_foreach (GHFunc func, gpointer user_data);
+void fn_hash_safe_foreach_remove (GHRFunc func, gpointer user_data);
+void fn_hash_safe_debug ();
+
+/* fnode_t */
+
+#endif /* _FEN_DATA_H_ */
