Index: uspace/lib/sif/src/sif.c
===================================================================
--- uspace/lib/sif/src/sif.c	(revision b79903b9e7df762a73fa73393777fd7e694a1690)
+++ uspace/lib/sif/src/sif.c	(revision 9c5e3a59be19d6add13d3b1b0d17fe8974755281)
@@ -68,4 +68,5 @@
 
 static errno_t sif_export_node(sif_node_t *, FILE *);
+static errno_t sif_import_node(sif_node_t *, FILE *, sif_node_t **);
 
 /** Create new SIF node.
@@ -169,16 +170,4 @@
 		return ENOMEM;
 
-	root = sif_node_new(NULL);
-	if (root == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
-	root->ntype = str_dup("sif");
-	if (root->ntype == NULL) {
-		rc = ENOMEM;
-		goto error;
-	}
-
 	f = fopen(fname, "r+");
 	if (f == NULL) {
@@ -186,4 +175,15 @@
 		goto error;
 	}
+
+	rc = sif_import_node(NULL, f, &root);
+	if (rc != EOK)
+		goto error;
+
+	if (str_cmp(root->ntype, "sif") != 0) {
+		rc = EIO;
+		goto error;
+	}
+
+	sess->root = root;
 
 	sess->f = f;
@@ -534,4 +534,71 @@
 }
 
+/** Import string from file.
+ *
+ * Import string from file (the string in the file must be
+ * properly bracketed and escaped).
+ *
+ * @param f File
+ * @param rstr Place to store pointer to newly allocated string
+ * @return EOK on success, EIO on I/O error
+ */
+static errno_t sif_import_string(FILE *f, char **rstr)
+{
+	char *str;
+	size_t str_size;
+	size_t sidx;
+	char c;
+	errno_t rc;
+
+	str_size = 1;
+	sidx = 0;
+	str = malloc(str_size + 1);
+	if (str == NULL)
+		return ENOMEM;
+
+	c = fgetc(f);
+	if (c != '[') {
+		rc = EIO;
+		goto error;
+	}
+
+	while (true) {
+		c = fgetc(f);
+		if (c == EOF) {
+			rc = EIO;
+			goto error;
+		}
+
+		if (c == ']')
+			break;
+
+		if (c == '\\') {
+			c = fgetc(f);
+			if (c == EOF) {
+				rc = EIO;
+				goto error;
+			}
+		}
+
+		if (sidx >= str_size) {
+			str_size *= 2;
+			str = realloc(str, str_size + 1);
+			if (str == NULL) {
+				rc = ENOMEM;
+				goto error;
+			}
+		}
+
+		str[sidx++] = c;
+	}
+
+	str[sidx] = '\0';
+	*rstr = str;
+	return EOK;
+error:
+	free(str);
+	return rc;
+}
+
 /** Export SIF node to file.
  *
@@ -567,4 +634,64 @@
 }
 
+/** Import SIF node from file.
+ *
+ * @param parent Parent node
+ * @param f File
+ * @param rnode Place to store pointer to imported node
+ * @return EOK on success, EIO on I/O error
+ */
+static errno_t sif_import_node(sif_node_t *parent, FILE *f, sif_node_t **rnode)
+{
+	errno_t rc;
+	sif_node_t *node = NULL;
+	sif_node_t *child;
+	char *ntype;
+	char c;
+
+	node = sif_node_new(parent);
+	if (node == NULL)
+		return ENOMEM;
+
+	rc = sif_import_string(f, &ntype);
+	if (rc != EOK)
+		goto error;
+
+	node->ntype = ntype;
+
+	c = fgetc(f);
+	if (c != '{') {
+		rc = EIO;
+		goto error;
+	}
+
+	c = fgetc(f);
+	if (c == EOF) {
+		rc = EIO;
+		goto error;
+	}
+
+	while (c != '}') {
+		ungetc(c, f);
+
+		rc = sif_import_node(node, f, &child);
+		if (rc != EOK)
+			goto error;
+
+		list_append(&child->lparent, &node->children);
+
+		c = fgetc(f);
+		if (c == EOF) {
+			rc = EIO;
+			goto error;
+		}
+	}
+
+	*rnode = node;
+	return EOK;
+error:
+	sif_node_delete(node);
+	return rc;
+}
+
 /** @}
  */
